예제 #1
0
 /** <summary> Draws the palette image into the specified graphics. </summary> */
 public void Draw(Graphics g, Point point, Palette palette, RemapColors remap1 = RemapColors.None, RemapColors remap2 = RemapColors.None, RemapColors remap3 = RemapColors.None)
 {
     for (int x1 = 0; x1 < Width; x1++)
     {
         for (int y1 = 0; y1 < Height; y1++)
         {
             Brush brush = new SolidBrush(GetColorRemapped(pixels[x1, y1], palette, remap1, remap2, remap3));
             g.FillRectangle(brush, new Rectangle(point.X + x1, point.Y + y1, 1, 1));
             brush.Dispose();
         }
     }
 }
예제 #2
0
 /** <summary> Draws the palette image into the specified palette image. </summary> */
 public void Draw(PaletteImage p, Point point, int darkness, bool glass, RemapColors remap1 = RemapColors.None, RemapColors remap2 = RemapColors.None, RemapColors remap3 = RemapColors.None)
 {
     for (int x1 = 0; x1 < Width; x1++)
     {
         for (int y1 = 0; y1 < Height; y1++)
         {
             if (x1 + point.X >= 0 && y1 + point.Y >= 0 && x1 + point.X < p.Width && y1 + point.Y < p.Height)
             {
                 p.pixels[x1 + point.X, y1 + point.Y] = GetColorIndexRemapped(pixels[x1, y1], p.pixels[x1 + point.X, y1 + point.Y], darkness, glass, remap1, remap2, remap3);
             }
         }
     }
 }
예제 #3
0
        /** <summary> Creates a bitmap from the specified palette. </summary> */
        public Bitmap CreateImage(Palette palette, RemapColors remap1 = RemapColors.None, RemapColors remap2 = RemapColors.None, RemapColors remap3 = RemapColors.None)
        {
            Bitmap image = new Bitmap(Width, Height);

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    image.SetPixel(x, y, GetColorRemapped(pixels[x, y], palette, remap1, remap2, remap3));
                }
            }
            return(image);
        }
예제 #4
0
        /** <summary> Draws the palette image into the specified graphics using the image entry's offset. </summary> */
        public void DrawWithOffset(Graphics g, int x, int y, Palette palette, RemapColors remap1 = RemapColors.None, RemapColors remap2 = RemapColors.None, RemapColors remap3 = RemapColors.None)
        {
            x += this.entry.XOffset;
            y += this.entry.YOffset;

            for (int x1 = 0; x1 < Width; x1++)
            {
                for (int y1 = 0; y1 < Height; y1++)
                {
                    Brush brush = new SolidBrush(GetColorRemapped(pixels[x1, y1], palette, remap1, remap2, remap3));
                    g.FillRectangle(brush, new Rectangle(x + x1, y + y1, 1, 1));
                    brush.Dispose();
                }
            }
        }
예제 #5
0
        /** <summary> Gets the remapped version of the specified color. </summary> */
        private Color GetColorRemapped(byte source, Palette palette, RemapColors remap1, RemapColors remap2, RemapColors remap3)
        {
            byte pixel = source;

            if (remap1 != RemapColors.None && pixel >= 243 && pixel < 255)
            {
                pixel = ColorRemapping.RemapPalettes[(int)remap1].remapIndexes[pixel - 243];
            }
            else if (remap2 != RemapColors.None && pixel >= 202 && pixel < 214)
            {
                pixel = ColorRemapping.RemapPalettes[(int)remap2].remapIndexes[pixel - 202];
            }
            else if (remap3 != RemapColors.None && pixel >= 46 && pixel < 58)
            {
                pixel = ColorRemapping.RemapPalettes[(int)remap3].remapIndexes[pixel - 46];
            }
            return(palette.Colors[pixel]);
        }
예제 #6
0
        /** <summary> Gets the remapped version of the specified color. </summary> */
        private byte GetColorIndexRemapped(byte source, byte destination, int darkness, bool glass, RemapColors remap1, RemapColors remap2, RemapColors remap3)
        {
            byte pixel = source;

            if (remap1 != RemapColors.None && pixel >= 243 && pixel < 255)
            {
                if (glass)
                {
                    pixel = ColorRemapping.GlassPalettes[(int)remap1].remapIndexes[destination];
                }
                else
                {
                    pixel = ColorRemapping.RemapPalettes[(int)remap1].remapIndexes[pixel - 243];
                }
            }
            else if (remap2 != RemapColors.None && pixel >= 202 && pixel < 214)
            {
                if (glass)
                {
                    pixel = ColorRemapping.GlassPalettes[(int)remap2].remapIndexes[destination];
                }
                else
                {
                    pixel = ColorRemapping.RemapPalettes[(int)remap2].remapIndexes[pixel - 202];
                }
            }
            else if (remap3 != RemapColors.None && pixel >= 46 && pixel < 58)
            {
                if (glass)
                {
                    pixel = ColorRemapping.GlassPalettes[(int)remap3].remapIndexes[destination];
                }
                else
                {
                    pixel = ColorRemapping.RemapPalettes[(int)remap3].remapIndexes[pixel - 46];
                }
            }
            else if (glass && pixel >= 1 && pixel <= 5)
            {
                pixel = ColorRemapping.WaterPalettes[pixel - 1].remapIndexes[destination];
            }
            if (darkness > 0)
            {
                pixel = ColorRemapping.RemapPalettes[darkness - 1].remapIndexes[pixel];
            }
            if (source == 0)
            {
                pixel = destination;
            }
            return(pixel);
        }
예제 #7
0
        /** <summary> Draws the palette image into the specified palette image using the image entry's offset. </summary> */
        public void DrawWithOffset(PaletteImage p, int x, int y, int darkness, bool glass, RemapColors remap1 = RemapColors.None, RemapColors remap2 = RemapColors.None, RemapColors remap3 = RemapColors.None)
        {
            x += this.entry.XOffset;
            y += this.entry.YOffset;

            for (int x1 = 0; x1 < Width; x1++)
            {
                for (int y1 = 0; y1 < Height; y1++)
                {
                    if (x1 + x >= 0 && y1 + y >= 0 && x1 + x < p.Width && y1 + y < p.Height)
                    {
                        p.pixels[x1 + x, y1 + y] = GetColorIndexRemapped(pixels[x1, y1], p.pixels[x1 + x, y1 + y], darkness, glass, remap1, remap2, remap3);
                    }
                }
            }
        }
예제 #8
0
        /**<summary>Gets the proper name of the remap color.</summary>*/
        public static string ToName(this RemapColors remap)
        {
            switch (remap)
            {
            case RemapColors.None: return("None");

                #region Row 1
            case RemapColors.Black: return("Black");

            case RemapColors.Gray: return("Gray");

            case RemapColors.White: return("White");

            case RemapColors.Indigo: return("Indigo");

            case RemapColors.SlateBlue: return("Slate Blue");

            case RemapColors.Purple: return("Purple");

            case RemapColors.Blue: return("Blue");

            case RemapColors.LightBlue: return("Light Blue");

                #endregion
                #region Row 2
            case RemapColors.Frost: return("Frost");

            case RemapColors.Water: return("Water");

            case RemapColors.LightWater: return("Light Water");

            case RemapColors.Green: return("Green");

            case RemapColors.SeaGreen: return("Sea Green");

            case RemapColors.DarkOliveGreen: return("Dark Olive Green");

            case RemapColors.Lime: return("Lime");

            case RemapColors.OliveDrab: return("Olive Drab");

                #endregion
                #region Row 3
            case RemapColors.Olive: return("Olive");

            case RemapColors.Yellow: return("Yellow");

            case RemapColors.Gold: return("Gold");

            case RemapColors.Goldenrod: return("Goldenrod");

            case RemapColors.Orange: return("Orange");

            case RemapColors.DarkOrange: return("Dark Orange");

            case RemapColors.LightBrown: return("Light Brown");

            case RemapColors.Brown: return("Brown");

                #endregion
                #region Row 4
            case RemapColors.Bark: return("Bark");

            case RemapColors.Tan: return("Tan");

            case RemapColors.IndianRed: return("Indian Red");

            case RemapColors.DarkRed: return("Dark Red");

            case RemapColors.Red: return("Red");

            case RemapColors.Magenta: return("Magenta");

            case RemapColors.Pink: return("Pink");

            case RemapColors.Salmon: return("Salmon");

                #endregion
            }
            return("Invalid");
        }
예제 #9
0
 /**<summary>Draws the palette image into the specified palette image using the image entry's offset.</summary>*/
 public void DrawWithOffset(PaletteImage p, int x, int y, int darkness, bool glass, RemapColors remap1 = RemapColors.None, RemapColors remap2 = RemapColors.None, RemapColors remap3 = RemapColors.None)
 {
     DrawWithOffset(p, new Point(x, y), darkness, glass, remap1, remap2, remap3);
 }
예제 #10
0
 /**<summary>Draws the palette image into the specified graphics using the image entry's offset.</summary>*/
 public void DrawWithOffset(Graphics g, int x, int y, Palette palette, RemapColors remap1 = RemapColors.None, RemapColors remap2 = RemapColors.None, RemapColors remap3 = RemapColors.None)
 {
     DrawWithOffset(g, new Point(x, y), palette, remap1, remap2, remap3);
 }