Ejemplo n.º 1
0
        public void OnRemapDisplayChar(Rectangle frame, IndexedBitmap bitmap)
        {
            Invoke(new Action(() =>
            {
                bitmap.CopyTo(Model.Palette, frame, Model.CharsBitmap);
#if DEBUG_WINDOW
                bitmap.CopyTo(Model.Palette, frame, DEBUG_WINDOW.DEBUG_IMAGE);
#endif
            }));
        }
Ejemplo n.º 2
0
		protected override void OnInitialized(EventArgs e)
		{
			base.OnInitialized(e);
			if (this.image == null)
			{
				var image = new IndexedBitmap(640, 350, 8);
				var pal = Palette.GetEgaPalette();
				while (pal.Count < image.Palette.Count)
					pal.Add(Colors.Black);
				image.Palette = pal;
				this.image = image;
			}
		}
Ejemplo n.º 3
0
        IndexedBitmap CreateImage()
        {
            var image = new IndexedBitmap(100, 100, 8);
            var ega   = Palette.GetEgaPalette();
            var pal   = new Palette(ega);

            // must have at least 256 colors for an 8-bit bitmap
            while (pal.Count < 256)
            {
                pal.Add(Colors.Black);
            }
            image.Palette = pal;
            using (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;
                        col = -y;
                        for (int x = 0; x < image.Size.Width; x++)
                        {
                            while (col < 0)
                            {
                                col = ega.Count + col;
                            }
                            while (col >= ega.Count)
                            {
                                col -= ega.Count;
                            }
                            *b = (byte)col++;
                            b++;
                        }
                        brow += bd.ScanWidth;
                    }
                }
            }
            return(image);
        }