Esempio n. 1
0
        public static void DisplayMultiColorChar(GR.Memory.ByteBuffer Data, int BGColor, int MColor1, int MColor2, int CharColor, CustomDrawControlContext Context)
        {
            // multicolor
            if (CharColor < 8)
            {
                DisplayHiResChar(Data, BGColor, CharColor, Context);
                return;
            }

            // single color
            int charColor = CharColor - 8;

            for (int j = 0; j < 8; ++j)
            {
                for (int i = 0; i < 4; ++i)
                {
                    int pixelValue = (Data.ByteAt(j) & (3 << ((3 - i) * 2))) >> ((3 - i) * 2);

                    switch (pixelValue)
                    {
                    case 0:
                        pixelValue = BGColor;
                        break;

                    case 1:
                        pixelValue = MColor1;
                        break;

                    case 2:
                        pixelValue = MColor2;
                        break;

                    case 3:
                        pixelValue = charColor;
                        break;
                    }
                    Context.Graphics.FillRectangle(Types.ConstantData.Palette.ColorBrushes[pixelValue],
                                                   (i * Context.Bounds.Width) / 4,
                                                   (j * Context.Bounds.Height) / 8,
                                                   ((i + 1) * Context.Bounds.Width) / 4 - (i * Context.Bounds.Width) / 4,
                                                   ((j + 1) * Context.Bounds.Height) / 8 - (j * Context.Bounds.Height) / 8);
                }
            }
        }
Esempio n. 2
0
        public static void DisplayHiResChar(GR.Memory.ByteBuffer Data, int BGColor, int CharColor, CustomDrawControlContext Context)
        {
            // single color
            int colorIndex = 0;

            for (int j = 0; j < 8; ++j)
            {
                for (int i = 0; i < 8; ++i)
                {
                    if ((Data.ByteAt(j) & (1 << (7 - i))) != 0)
                    {
                        colorIndex = CharColor;
                    }
                    else
                    {
                        colorIndex = BGColor;
                    }
                    Context.Graphics.FillRectangle(Types.ConstantData.Palette.ColorBrushes[colorIndex],
                                                   (i * Context.Bounds.Width) / 8,
                                                   (j * Context.Bounds.Height) / 8,
                                                   ((i + 1) * Context.Bounds.Width) / 8 - (i * Context.Bounds.Width) / 8,
                                                   ((j + 1) * Context.Bounds.Height) / 8 - (j * Context.Bounds.Height) / 8);
                }
            }
        }
Esempio n. 3
0
        public static void DisplayChar(Formats.CharsetProject Charset, int CharIndex, CustomDrawControlContext Context, int AlternativeColor, int AltBGColor, int AltMColor1, int AltMColor2, int AltBGColor4)
        {
            Formats.CharData Char = Charset.Characters[CharIndex];

            DisplayChar(Charset, CharIndex, Context, AlternativeColor, AltBGColor, AltMColor1, AltMColor2, AltBGColor4, Char.Mode);
        }
Esempio n. 4
0
        public static void DisplayChar(Formats.CharsetProject Charset, int CharIndex, CustomDrawControlContext Context, int AlternativeColor, int AltBGColor, int AltMColor1, int AltMColor2, int AltBGColor4, Types.CharsetMode AlternativeMode)
        {
            Formats.CharData Char = Charset.Characters[CharIndex];

            if (AlternativeMode == C64Studio.Types.CharsetMode.ECM)
            {
                // ECM
                Formats.CharData origChar = Charset.Characters[CharIndex % 64];

                int bgColor = AltBGColor;
                switch (CharIndex / 64)
                {
                case 1:
                    bgColor = AltMColor1;
                    break;

                case 2:
                    bgColor = AltMColor2;
                    break;

                case 3:
                    bgColor = AltBGColor4;
                    break;
                }
                Displayer.CharacterDisplayer.DisplayHiResChar(origChar.Data, bgColor, AlternativeColor, Context);
            }
            else if (AlternativeMode == C64Studio.Types.CharsetMode.MULTICOLOR)
            {
                Displayer.CharacterDisplayer.DisplayMultiColorChar(Char.Data, AltBGColor, AltMColor1, AltMColor2, AlternativeColor, Context);
            }
            else if (AlternativeMode == C64Studio.Types.CharsetMode.HIRES)
            {
                Displayer.CharacterDisplayer.DisplayHiResChar(Char.Data, AltBGColor, AlternativeColor, Context);
            }
        }
Esempio n. 5
0
 public static void DisplayChar(Formats.CharsetProject Charset, int CharIndex, CustomDrawControlContext Context, int AlternativeColor)
 {
     DisplayChar(Charset, CharIndex, Context, AlternativeColor, Charset.BackgroundColor, Charset.MultiColor1, Charset.MultiColor2, Charset.BGColor4);
 }
Esempio n. 6
0
        public static void DisplayChar(Formats.CharsetProject Charset, int CharIndex, CustomDrawControlContext Context)
        {
            Formats.CharData Char = Charset.Characters[CharIndex];

            DisplayChar(Charset, CharIndex, Context, Char.Color);
        }
Esempio n. 7
0
        public static void DisplayChar(Formats.CharsetProject Charset, int CharIndex, CustomDrawControlContext Context, int AlternativeColor, int AltBGColor, int AltMColor1, int AltMColor2, int AltBGColor4, TextCharMode AlternativeMode)
        {
            Formats.CharData Char = Charset.Characters[CharIndex];

            if (AlternativeMode == TextCharMode.COMMODORE_ECM)
            {
                // ECM
                Formats.CharData origChar = Charset.Characters[CharIndex % 64];

                int bgColor = AltBGColor;
                switch (CharIndex / 64)
                {
                case 1:
                    bgColor = AltMColor1;
                    break;

                case 2:
                    bgColor = AltMColor2;
                    break;

                case 3:
                    bgColor = AltBGColor4;
                    break;
                }
                DisplayHiResChar(origChar.Tile.Data, bgColor, AlternativeColor, Context);
            }
            else if (AlternativeMode == TextCharMode.COMMODORE_MULTICOLOR)
            {
                DisplayMultiColorChar(Char.Tile.Data, AltBGColor, AltMColor1, AltMColor2, AlternativeColor, Context);
            }
            else if (AlternativeMode == TextCharMode.COMMODORE_HIRES)
            {
                DisplayHiResChar(Char.Tile.Data, AltBGColor, AlternativeColor, Context);
            }
            else if ((AlternativeMode == TextCharMode.MEGA65_FCM) ||
                     (AlternativeMode == TextCharMode.MEGA65_FCM_16BIT))
            {
                DisplayMega65FCMChar(Char.Tile.Data, AltBGColor, AlternativeColor, Context);
            }
            else if (AlternativeMode == TextCharMode.VIC20)
            {
                DisplayVIC20Char(Char.Tile.Data, AltBGColor, AltMColor1, AltMColor2, AlternativeColor, Context);
            }
            else
            {
                Debug.Log("DisplayChar unsupported mode " + AlternativeMode);
            }
        }
Esempio n. 8
0
 public static void DisplayMega65FCMChar(GR.Memory.ByteBuffer Data, int BGColor, int CharColor, CustomDrawControlContext Context)
 {
     // single color
     for (int j = 0; j < 8; ++j)
     {
         for (int i = 0; i < 8; ++i)
         {
             int colorIndex = Data.ByteAt(i + j * 8);
             if (colorIndex < Context.Palette.ColorBrushes.Length)
             {
                 Context.Graphics.FillRectangle(Context.Palette.ColorBrushes[colorIndex],
                                                (i * Context.Bounds.Width) / 8,
                                                (j * Context.Bounds.Height) / 8,
                                                ((i + 1) * Context.Bounds.Width) / 8 - (i * Context.Bounds.Width) / 8,
                                                ((j + 1) * Context.Bounds.Height) / 8 - (j * Context.Bounds.Height) / 8);
             }
         }
     }
 }
Esempio n. 9
0
 public static void DisplayMega65NCMChar(GR.Memory.ByteBuffer Data, int BGColor, int CharColor, CustomDrawControlContext Context)
 {
     // single color
     for (int j = 0; j < 8; ++j)
     {
         for (int i = 0; i < 16; ++i)
         {
             int byteValue = Data.ByteAt(i / 2 + j * 8);
             if ((i % 2) != 0)
             {
                 byteValue >>= 4;
             }
             else
             {
                 byteValue &= 0x0f;
             }
             if (byteValue < Context.Palette.ColorBrushes.Length)
             {
                 if (byteValue == 0)
                 {
                     byteValue = BGColor;
                 }
                 Context.Graphics.FillRectangle(Context.Palette.ColorBrushes[byteValue],
                                                (i * Context.Bounds.Width) / 16,
                                                (j * Context.Bounds.Height) / 8,
                                                ((i + 1) * Context.Bounds.Width) / 16 - (i * Context.Bounds.Width) / 16,
                                                ((j + 1) * Context.Bounds.Height) / 8 - (j * Context.Bounds.Height) / 8);
             }
         }
     }
 }