Syntax
void DrawLine(
int x1,
int y1,
int x2,
int y2,
int color
);
Parameters
- x1,y1
-
[in] The pixel coordinates of the start point of the line.
- x2,y2
-
[in] The pixel coordinates of the end point of the line.
- color
-
[in] Specifies the pixel color to set.
Value Description 0xRRGGBB Optional specification (RR: red, GG: green, BB: blue) RGB_WHITE White (0xFFFFFF) RGB_RED Red (0xFF0000) RGB_GREEN Green (0x00FF00) RGB_BLUE Blue (0x0000FF) RGB_MAGENTA Magenta (0xFF00FF) RGB_CYAN Cyan (0x00FFFF) RGB_YELLOW Yellow (0xFFFF00) RGB_BLACK Black (0x000000)
Return value
None
Remarks
This function uses the dot coordinates of the screen to draw the line.
The values that can be set are as follows.
X (Left and Right): 0 〜 (DISP_WIDTH - 1)
Y (Up and Down): 0 〜 (DISP_HEIGHT - 1)
When the display of the status bar is set, the Y coordinate values that can be set are as follows.
Y (Up and Down): 0 〜 (DISP_HEIGHT - 17)
The values that can be set are as follows.
X (Left and Right): 0 〜 (DISP_WIDTH - 1)
Y (Up and Down): 0 〜 (DISP_HEIGHT - 1)
When the display of the status bar is set, the Y coordinate values that can be set are as follows.
Y (Up and Down): 0 〜 (DISP_HEIGHT - 17)
Value | Description |
---|---|
DISP_WIDTH | 128 pixel |
DISP_HEIGHT | 160 pixel |
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
void main(void)
{
int rgbColorSt;
int paletteR, paletteG, paletteB;
int x, y;
printf("\f");
rgbColorSt = RGB_RED;
for(x = 0 ; x < 128 ; x++)
{
paletteG = x * 2;
DrawLine(x, 0, 63, 63, rgbColorSt);
}
rgbColorSt = RGB_GREEN;
for (y = 0 ; y < 128 ; y++)
{
paletteB = y * 2;
DrawLine(127, y, 63, 63, rgbColorSt);
}
rgbColorSt = RGB_BLUE;
for (x = 127 ; x >= 0 ;x--)
{
paletteR = (127 - x) * 2;
DrawLine(x, 127, 63, 63, rgbColorSt);
}
rgbColorSt = RGB_BLACK;
for (y = 127 ; y >= 0 ; y--)
{
paletteR = (127 - y) * 2;
paletteG = paletteR;
paletteB = paletteR;
DrawLine(0, y, 63, 63, rgbColorSt);
}
printf("Please any key\r");
ResetKey();
while(!kbhit())
Idle();
}
Last updated: 2020/10/02