コード例 #1
0
ファイル: IndexedBitmapSection.cs プロジェクト: M1C/Eto
        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;
        }
コード例 #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);
         }
     }
 }
コード例 #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);
 }
コード例 #4
0
 public override void InitilizeLandRegion(Land land, LandRegionType land_region_type, Palette <LandRegionSplat> palette)
 {
     palette.AddRange(GetLandRegionSplats());
 }