protected override System.Drawing.Image GetImage(int activeFrame, int activePalette)
        {
            TextureFormat format = textureFormats[activeFrame];
            int           oldPal = format.SelectedPalette;

            format.SelectedPalette = activePalette;
            Image img = format.GetImage();

            format.SelectedPalette = oldPal;

            return(img);
        }
Example #2
0
        private ICollection <Image> ConstructImages(TextureFormat texture, out Image referenceImage)
        {
            var list        = new List <Image>();
            int oldSelected = texture.SelectedPalette;

            for (int i = 0; i < (texture.PalettesCount == 0 ? 1 : texture.PalettesCount); i++)
            {
                texture.SelectedPalette = i;
                list.Add(texture.GetImage());
            }
            texture.SelectedPalette = oldSelected;
            referenceImage          = texture.GetReferenceImage();
            return(list);
        }
Example #3
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
            if (texture == null)
            {
                return;
            }

            Graphics graphics = pe.Graphics;

            Brush brush1, brush2;

            if (chessboard)
            {
                brush1 = new SolidBrush(color.IsEmpty ? PreferredTransparencyColor : color);
                brush2 = new SolidBrush(Color.White);
            }
            else
            {
                brush1 = new SolidBrush(color.IsEmpty ? PreferredTransparencyColor : color);
                brush2 = brush1;
            }


            int squareSize = 8;

            for (int y = 0; y < this.Height; y += squareSize)
            {
                for (int x = 0; x < this.Width; x += squareSize)
                {
                    graphics.FillRectangle((x / squareSize + y / squareSize) % 2 == 0 ? brush1 : brush2, x, y, squareSize, squareSize);
                }
            }

            Image img = texture.GetImage();

            Bitmap   b = new Bitmap(this.Width, this.Height);
            Graphics g = Graphics.FromImage(b);

            g.InterpolationMode = InterpolationMode.HighQualityBicubic;

            g.DrawImage(img, 0, 0, b.Width, b.Height);
            g.Dispose();

            graphics.DrawImage(b, 0, 0, b.Width, b.Height);
        }