2 using System.Collections.Generic;
5 using System.Drawing.Imaging;
7 namespace DirectOutput.General.BitmapHandling
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);
57 public void LockBitmap()
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();
87 public void UnlockBitmap()
89 bitmap.UnlockBits(bitmapData);