GuiBitmapBuffer class
The GuiBitmapBuffer class provides an interface for creating custom 24-bit or 32-bit bitmaps and flutter image. The structure of a Bitmap Buffer is defined below: Reference Documentation: https://en.wikipedia.org/wiki/BMP_file_format
bitmap file header : (14 bytes)
WORD bfType; - 0-1
'B' 'M'
DWORD bfSize; - 2-5
Size of File (headers + data) - little endian
WORD bfReserved1; - 6-7
0 , 0
WORD bfReserved2; - 8-9
0 , 0
DWORD bfOffBits; - 10-13
54
bitmap info header : (40 bytes)
DWORD biSize; - 14-17
40
LONG biWidth; - 18-21
width of image
LONG biHeight; - 22-25
height of image
WORD biPlanes; - 26-27
# of planes = 1
WORD biBitCount; - 28-29
# of bits per pixel
DWORD biCompression; - 30-33
DWORD biSizeImage; - 34-37
size of bitmap image (# of pixels * bytes per pixel)
LONG biXPelsPerMeter; - 38-41
the horizontal resolution of the image. (pixel per metre, signed integer) (200 dpi = 7874)
LONG biYPelsPerMeter; - 42-45
the vertical resolution of the image. (pixel per metre, signed integer) (200 dpi = 7874)
DWORD biClrUsed; - 46-49
the number of colors in the color palette, or 0 to default to 2n
DWORD biClrImportant; - 50-53
the number of important colors used, or 0 when every color is important; generally ignored
bitmap data : (size of bitmap image)
BYTE bdData - ...
data for image is ordered from bottom of image to top of image.
Row N
Row N-1
...
...
Row 2
Row 1
Constructors
- GuiBitmapBuffer({required int width, required int height, int bitsPerPixel = bitsPerPixelArgb})
- Create a bitmap buffer with header prepopulated with necessary data. The actual image data must still be populated by the user.
Properties
- bitsPerPixel → int
-
Number of bits per pixel (ie. 24 for 24-bit RGB pixel, 32 for for ARGB pixel w/ transparency)
final
- bytesPerPixel → int
-
Number of bytes required to render a pixel (informational only)
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- headerOffset → int
-
Starting offset of Bitmap header
no setter
- height → int
-
Height of bitmap image in pixels
final
- imageData → Uint8List
-
Raw bitmap data
no setter
- imageOffset → int
-
Starting offset of Bitmap data
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → int
-
Width of bitmap image in pixels
final
Methods
-
getColor(
int column, int row) → Color -
Return color at position
column
(x), androw
(y). Both column and row are 0-based offset. -
imageRowOffset(
int row) → int -
Starting offset of Bitmap image for row
row
(zero-based) -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setColor(
int column, int row, Color color) → void -
Set color at position
column
(x), androw
(y). Both column and row are 0-based offset. -
toImage(
) → Image - Convert Bitmap buffer into a Flutter Image widget.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- bitsPerPixelArgb → const int
- Constant for 32-bit pixel w/ ARGB value
- bitsPerPixelRgb → const int
- Constant for 24-bit pixel w/ RGB value