C Language Development Kit/Functions/SetPixel

From OptiWiki

Jump to: navigation, search
Description Sets, clears or inverts a pixel on the display.
void setpixel(int x, int y, int state);
int x, int y
The x and y coordinates of the pixel that is to be set.
int state
state can have one of the following values:
0 Clears the pixel.
1 Sets the pixel.
2 Inverts the pixel. Sets when it was clear and clears when it was set.
Returns None
Remarks The following table shows the possible screen coordinates.
OPH100x PHL1300 PHL1700 PHL2700 OPL97xx DCL153x
Upper left corner 0,0 0,0 0,0 0,0 0,0 0,0
Bottom right corner 127,127 111,127 95,63 95,47 127,63 111,63 111,63
#include "lib.h"
#include <stdio.h>
void main( void )
    int x, y, z;
    while( 1 )
        z = 1-z;
        for( y=0; y < 48; y++)
            for( x=0; x < 96; x++)
                setpixel( x, y, z);
        gotoxy( 3, 1);
        printf("Press a key");
        while( !kbhit())

Personal tools