BiomePainter.Clipboard.BiomeCopy.ToBitmap C# (CSharp) Method

ToBitmap() public method

public ToBitmap ( ) : Bitmap
return System.Drawing.Bitmap
        public Bitmap ToBitmap()
        {
            Bitmap b = new Bitmap(Width, Height);
            for (int x = 0; x < Width; x++)
            {
                for (int z = 0; z < Height; z++)
                {
                    Color c = Color.Black;
                    byte biome = Biomes[x, z];
                    if (biome == 255)
                        c = Color.Transparent;
                    else if (biome >= 0 && biome < 255 && BiomeType.Biomes[biome] != null)
                        c = BiomeType.Biomes[biome].Color;
                    b.SetPixel(x, z, c);
                }
            }
            return b;
        }

Usage Example

Esempio n. 1
0
        public static Bitmap StartPaste()
        {
            currentPaste = (BiomeCopy)System.Windows.Forms.Clipboard.GetData("BiomeCopy");
            if (currentPaste == null)
            {
                return(null);
            }
            if (currentPaste.Empty)
            {
                currentPaste = null;
                return(null);
            }

            return(currentPaste.ToBitmap());
        }