Display bit image on the draw window

Description

Display bit image on the draw window by using current draw mode and foreground color

A bitonal image is represented by pixels consisting of 1 bit each, which can represent two tones (background color and foreground color), using the values 0 for back and 1 for fore.

A byte is represented 8 pixels, if the width of image is not the multiple of 8, then a completed byte for less 8 pixels.

eg.: for the width 17~24 pixels, need 3 bytes to represent one line of image.

Usage:

Direct:

 "DIMxywh" follow with bit format image data

Arduino:

void drawBitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const uint8_t *bitmap)

C:

void Digole_drawBitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const uint8_t *bitmap)

Parameters:

x, y

The pixel position of top-left of the area.

w, h

The pixel size of the width and height of the image.

bitmap

The pointer to the bit image data

Return:

none

NOTE: if the value of x,y,w or h greater than "254", then use 2 bytes format: the first byte is fix of 255, then the second byte is the value minus 255. eg.300=255+45, so, "\xFF\x2D" is the result.
This schedule is in order to compatible small displays, which the width and height is less than 255 pixels

Warning:The 4.3" IPS modules are always use 2 bytes regular integrate format.

Example (Arduino):

const uint8_t bitmap[]={......} //bit map data
mydisp.drawBitmap(20,30,80,85,&bitmap);//draw bitmap image, the top-left @(20,30), width=80px,height=85px

Example(direct)

 

const uint8_t bitmap[]={......} //bit map data
serial.writeString("DIMA\x14\x1E\x50\x55");//draw bitmap image, the top-left @(20,30), width=80px,height=85px
for(int i=0;i<80*((85+7)>>3);i++) //round 85bits to bytes
serial.write(bitmap[i]);

Changelog

Version Description
   

See Also

Set draw mode

Set foreground color

Set draw window