Use current foreground color, draw mode and line pattern to draw a line on the draw window.
|
Direct: |
"LNxyx1y1" //Draw a line from (x,y) to (x1,y1) "LTxy" //Draw a line from current position to (x,y) |
|
Arduino: |
void drawLine(unsigned int x, unsigned int y, unsigned int x1, unsigned int y1) //basic function void drawLineTo(unsigned int x, unsigned int y) //Draw a line from current position to (x,y) void drawHLine(unsigned int x, unsigned int y, unsigned int w) //Draw horizontal line, width w pixels void drawVLine(unsigned int x, unsigned int y, unsigned int h) //Draw vertical line, height h pixels |
|
C: |
void Digole_drawLine(unsigned int x, unsigned int y, unsigned int x1, unsigned int y1) |
(x, y),(x1,y1)
The pixel position of start or end of line.
w
Line width of pixels
h
Line height of pixels
NOTE: if the value of x or y 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.
none
Example (Arduino):
mydisp.drawLine(150,300,220,400); //draw line from(150,300) to (220,400)
serial.writeString("DP\x96\xFF\x2D\DC\xFF\x91"); //draw line from(150,300) to (220,400)
//for 4.3" IPS modules, use uint16_t type
serial.writeString("DP\00\x96\x01\x2C\x00\xDC\x01\x90"); //draw line from(150,300) to (220,400)
| Version | Description |
|---|---|