Graphics::drawPixel

Description

void Graphics::drawPixel( int16_t x, int16_t y ) 
void Graphics::drawPixel( int16_t x, int16_t y, Color or ColorIndex color )

Graphics::drawPixel will draw a pixel :

  • to the screen : gb.display.drawPixel()
  • to the 8 back LEDs : gb.lights.drawPixel()
  • to an image : gb."picture object".drawPixel()
  • at x/y coordinates and with a certain color.
    If no color specified, the current pencil set via Graphics::setColor is used.

    Parameters

    • int16_t x: x-coordinate of the pixel to set
    • int16_t y: y-coordinate of the pixel to set
    • Color | ColorIndex color (optional): color of the pixel to set

    Returns

    none

    Example

    #include <Gamebuino-Meta.h>
    

    void setup() { gb.begin(); }

    void loop() { while(!gb.update()); // update the screen gb.display.clear(); // clear the sceen gb.lights.clear(); // clear the lights = off

    // turn only the top-left pixel of the lights read gb.lights.drawPixel(0, 0, RED);

    // set a pixel of the display green gb.display.setColor(GREEN); // select the GREEN pencil gb.display.drawPixel(42, 42); }