From 31d4bf8bfad3aa47efe5c61995d184045ebfdb85 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 14 Feb 2023 14:03:38 -0800 Subject: [PATCH] Fix transparency in C64 visualizer GIF only allows for one transparent palette entry. (issue #145) --- CommonUtil/UnpackedGif.cs | 6 ++++++ SourceGen/RuntimeData/Commodore/VisC64.cs | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CommonUtil/UnpackedGif.cs b/CommonUtil/UnpackedGif.cs index 4eadfbe..c6cf2f9 100644 --- a/CommonUtil/UnpackedGif.cs +++ b/CommonUtil/UnpackedGif.cs @@ -346,6 +346,12 @@ namespace CommonUtil { " height=" + grb.ImageHeight); Debug.WriteLine(" localCT=" + grb.LocalColorTableFlag + " size=" + grb.LocalColorTableSize + " itrl=" + grb.InterlaceFlag); + for (int i = 0; i < grb.LocalColorTable.Length; i += 3) { + Debug.WriteLine(" " + (i / 3) + ": $" + + grb.LocalColorTable[i].ToString("x2") + " $" + + grb.LocalColorTable[i + 1].ToString("x2") + " $" + + grb.LocalColorTable[i + 2].ToString("x2")); + } } } } diff --git a/SourceGen/RuntimeData/Commodore/VisC64.cs b/SourceGen/RuntimeData/Commodore/VisC64.cs index a7fc517..082a316 100644 --- a/SourceGen/RuntimeData/Commodore/VisC64.cs +++ b/SourceGen/RuntimeData/Commodore/VisC64.cs @@ -433,7 +433,11 @@ namespace RuntimeData.Commodore { } private const byte TRANSPARENT = 16; - private const byte BORDER_COLOR = 17; +#if SHOW_BORDER + private const byte BORDER_COLOR = 0; +#else + private const byte BORDER_COLOR = TRANSPARENT; +#endif // C64 colors, from http://unusedino.de/ec64/technical/misc/vic656x/colors/ // (the ones on https://www.c64-wiki.com/wiki/Color looked wrong) @@ -455,11 +459,6 @@ namespace RuntimeData.Commodore { vb.SetColor(14, 0xff, 0x6c, 0x5e, 0xb5); // 14=light blue vb.SetColor(15, 0xff, 0x95, 0x95, 0x95); // 15=light grey vb.SetColor(16, 0, 0, 0, 0); // 16=transparent -#if SHOW_BORDER - vb.SetColor(17, 0xff, 0x00, 0xd6, 0xff); // 17=grid border -#else - vb.SetColor(17, 0, 0, 0, 0); // 17=grid border -#endif } } }