2using System.Collections.Generic;
4using System.Drawing.Imaging;
6using System.Runtime.InteropServices;
8using System.Threading.Tasks;
27 public Int32[]
Bits {
get;
private set; }
35 public int Height {
get;
private set; }
39 public int Width {
get;
private set; }
54 Bits =
new Int32[width * height];
56 Bitmap =
new Bitmap(width, height, width * 4, PixelFormat.Format32bppPArgb,
BitsHandle.AddrOfPinnedObject());
65 public void SetPixel(
int x,
int y, Color colour)
67 int index = x + (y *
Width);
68 int col = colour.ToArgb();
78 public void SetRow(
int y, Color colour)
80 int col = colour.ToArgb();
81 int index = y *
Width;
83 for (
int x = 0; x <
Width; x++)
85 Bits[index + x] = col;
97 int index = x + (y *
Width);
98 int col =
Bits[index];
99 Color result = Color.FromArgb(col);
The DirectBitmap class provides an efficient bitmap creating class.
Int32[] Bits
Returns an array containing the raw bitmap data.
int Height
Returns the bitmap height.
void Dispose()
Release all resources used.
DirectBitmap(int width, int height)
The constructro.
GCHandle BitsHandle
Returns the bitmap memory handle.
bool Disposed
Returns true when disposed.
void SetRow(int y, Color colour)
Set an entire row to the same color.
Color GetPixel(int x, int y)
Returns the color of a pixel in the bitmap.
void SetPixel(int x, int y, Color colour)
Sets a pixel within the bitmap with the specified color.
int Width
Returns the bitmap width.
Bitmap Bitmap
Returns the Bitmap itself.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.