2 using System.Collections.Generic;
5 using System.Drawing.Imaging;
20 BitmapData bitmapData = null;
25 this.bitmap =
new Bitmap(bitmap);
30 this.bitmap =
new Bitmap(width, height, PixelFormat.Format24bppRgb);
46 private Point PixelSize
50 GraphicsUnit unit = GraphicsUnit.Pixel;
51 RectangleF bounds = bitmap.GetBounds(ref unit);
53 return new Point((
int)bounds.Width, (
int)bounds.Height);
59 GraphicsUnit unit = GraphicsUnit.Pixel;
60 RectangleF boundsF = bitmap.GetBounds(ref unit);
61 Rectangle bounds =
new Rectangle((
int)boundsF.X,
70 width = (int)boundsF.Width *
sizeof(
PixelData);
73 width = 4 * (width / 4 + 1);
76 bitmap.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
78 pBase = (Byte*)bitmapData.Scan0.ToPointer();
89 bitmap.UnlockBits(bitmapData);
Struct holding the data for a single pixel in a bitmap.
UnsafeBitmap(Bitmap bitmap)
PixelData * PixelAt(int x, int y)
This class allows fast access to the pixels of a bitmap. The code was inspired/stolen from this threa...
UnsafeBitmap(int width, int height)
PixelData GetPixel(int x, int y)