This function sets the pixel-by-pixel display on the screen.

Syntax

void SetPixel(
  int x,
  int y,
  int color
);

Parameters

x
[in] Specifies the X coordinate value of the pixel to set.
y
[in] Specifies the Y coordinate value of the pixel to set.
color
[in] Specifies the pixel color to set.
ValueDescription
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

The coordinate value in the upper left corner of the screen is (0,0).
The coordinate values in the lower right corner of the screen are (DISP_WIDTH --1, DISP_HEIGHT --1).
When the display of the data bar is set, the coordinate values in the lower right corner of the screen that can be set are as follows.
The coordinate values in the lower right corner of the screen are (DISP_WIDTH --1, DISP_HEIGHT -17).
ValueDescription
DISP_WIDTH 128 pixel
DISP_HEIGHT 160 pixel

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

typedef struct
{
    union
    {
        long value;
        struct
        {
            unsigned char b;
            unsigned char g;
            unsigned char r;
            unsigned char empty;
        }palette;
    };
}RgbColor;
void main(void)
{
    RgbColor rgbColorSt;
    int x, y;
    rgbColorSt.value = RGB_BLUE;
    for (y = 0 ; y < 128 ; y++)
    {
        for (x = 0 ; x < 128 ; x++)
        {
            rgbColorSt.palette.r = y*2;
            rgbColorSt.palette.g = y + x;
            rgbColorSt.palette.b = x*2;
            SetPixel(x, y, (int)rgbColorSt.value);
        }
    }
    printf("Please any key\r");
    ResetKey();
    while(!kbhit())
        Idle();
}

Last updated: 2020/10/02