Esempio n. 1
0
        public Bitmap GetImage(PaletteId i, Zoom zoom)
        {
            if (images == null || images[(int)i, zoom - 1] == null || FullyDirty || _Dirty[(int)i])
            {
                GenerateBitmap(i, zoom);
            }

            return(images[(int)i, zoom - 1]);
        }
Esempio n. 2
0
 public TileMask(TileSP SP, Tile Tile, Zoom Zoom, bool FlipX, bool FlipY)
 {
     this.SP = SP;
     XDisp   = 0;
     YDisp   = 0;
     zoom    = Zoom;
     flipX   = FlipX;
     flipY   = FlipY;
     tile    = Tile;
     palette = ColorPalette.SelectedPalette;
     ColorPalette.SelectedGlobalPaletteChange += colorPalette_SelectedGlobalPaletteChange;
 }
Esempio n. 3
0
        public void GenerateBitmap(PaletteId paletteId, Zoom zoom)
        {
            if (ColorPalette.GlobalPaletteSize == 0)
            {
                return;
            }
            int npid = (int)paletteId;

            if (images == null || images.GetLength(0) != ColorPalette.GlobalPaletteSize)
            {
                images = new Bitmap[ColorPalette.GlobalPaletteSize, 20];
            }

            images[npid, zoom - 1] = new Bitmap(Size * zoom, Size * zoom);

            Bitmap bp = images[npid, zoom - 1];
            Brush  br;

            for (int i = 0; i < Size; i++)
            {
                for (int j = 0; j < Size; j++)
                {
                    if (colors[i, j] != 0)
                    {
                        using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bp))
                        {
                            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
                            br = new SolidBrush(ColorPalette.GetGlobalColor(colors[i, j], paletteId));
                            g.FillRectangle(br, new RectangleF(i * zoom, j * zoom, zoom, zoom));
                        }
                    }
                }
            }
            FullyDirty = false;
            setDirty(npid, false);
        }