< index < 5. Image toolkit | ===================================== 5.8 Changing the color of a pixel ===================================== |

You can modify the colors of an image with :

    C++ : TCODColor TCODImage::putPixel(int x, int y, const TCODColor col)
    C   : void TCOD_image_put_pixel(TCOD_image_t image,int x, int y,TCOD_color_t col)
    Py  : image_put_pixel(image,x, y,col)

Parameter | Description
--- | ---
image | In the C version, the image handler, obtained with the load function.
x,y | The pixel coordinates inside the image. 0 <= x < width 0 <= y < height
col | The new color of the pixel.

Example :

    C++ : TCODImage *pix = new TCODImage(80,50);
          pix->putPixel(40,25,TCODColor::white);
    C   : TCOD_image_t pix = TCOD_image_new(80,50);
          TCOD_image_put_pixel(pix,40,25,TCOD_white);
    Py  : pix = libtcod.image_new(80,50)
          libtcod.image_put_pixel(pix,40,25,libtcod.white)