I have created declared a Bitmap using the following statement:
Dim bmp As New Bitmap(100, 100, PixelFormat.For mat8bppIndexed)
Because the SetPixel() method is disabled and a Graphics object cannot be
created for indexed PixelFormats, I am not sure how to edit the Bitmap. I am
assuming that there is some class or technique other than the following:
Dim bmpdata As BitmapData = bmp.LockBits(Ne w Rectangle(0, 0, bmp.Width,
bmp.Height), ImageLockMode.R eadOnly, PixelFormat.For mat8bppIndexed)
For y As Integer = 0 To bmp.Height - 1
For x As Integer = 0 To bmp.Width - 1
System.Diagnost ics.Debug.Write Line(System.Run time.InteropSer vices.Marshal.R eadByte(bmpdata .Scan0,
y * bmpdata.Stride + x))
Next
Next
bmp.UnlockBits( bmpdata)
Which is basically just directly changing the data that will be saved when
the Bitmap is saved. However, using the technique shown above can make it
require multiple steps and calculations when drawing shapes such as
ellipses. Is there a more efficient way to edit an indexed Bitmap? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/