Esempio n. 1
0
        IndexedBitmap CreateImage()
        {
            var image = new IndexedBitmap (100, 100, 8);
            var pal = new Palette (256);
            pal.AddRange (Palette.GetEgaPalette ());

            // must have at least 256 colors for an 8-bit bitmap
            while (pal.Count < 256)
                pal.Add (Color.Black);
            image.Palette = pal;
            var bd = image.Lock ();

            unsafe {
                int col = 0;
                byte* brow = (byte*)bd.Data;
                for (int y = 0; y < image.Size.Height; y++) {
                    byte* b = brow;
                    for (int x = 0; x < image.Size.Width; x++) {
                        if (col >= pal.Count)
                            col = 0;
                        *b = (byte)col++;
                        b++;
                    }
                    brow += bd.ScanWidth;
                }
            }
            image.Unlock (bd);
            return image;
        }
Esempio n. 2
0
 private void EstablishPalettes()
 {
     if (_baseList.Count == 0)
     {
         LoadPredefinedPalette();
     }
     if (_combinedList.Count == 0)
     {
         _combinedList.AddRange(_baseList);
         if (_customList.Count > 0)
         {
             _customStartIndex = _combinedList.Count;
             _combinedList.AddRange(_customList);
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Loads in a list of colors.
 /// </summary>
 /// <param name="palette">List of colors.</param>
 public void LoadPalette(List <NamedColor> palette)
 {
     _combinedList.Clear();
     _baseList.Clear();
     _baseList.AddRange(palette);
 }
Esempio n. 4
0
 public override void InitilizeLandRegion(Land land, LandRegionType land_region_type, Palette <LandRegionSplat> palette)
 {
     palette.AddRange(GetLandRegionSplats());
 }