#ifndef PIXMAP_H_INCLUDED #define PIXMAP_H_INCLUDED #include /* for size_t */ /* An abstract 2D pixel map. * * A 2D pixel matrix. Each pixel is identified with an x,y coordinate * pair. Coordinates are greater or equal to 0. Pixels have binary * values: they can be set to a foreground value or to a background * value. A concrete implementation of this abstract class will * implement the pixel matrix and all the virtual methods defined below. */ struct pixmap; /* Clear the whole pixmap: Every pixel is set to the background value. */ extern void pixmap_clear(struct pixmap * this); /* Set the value of a pixel in the pixmap. * * A value != 0 sets the pixel (foreground); a value equals to 0 * resets the pixel (background). If the given coordinates are * outside the dimensions of the given pixmap, this function must have * no effect. */ extern void pixmap_set_pixel(struct pixmap * this, unsigned int x, unsigned int y, int value); /* Get the value of a pixel. zero means background; non-zero means * foreground. If the given coordinates are outside the dimensions of * the given pixmap, this function returns 0. */ extern int pixmap_get_pixel(const struct pixmap * this, unsigned int x, unsigned int y); /* Width of the pixmap. */ extern unsigned int pixmap_get_width(const struct pixmap * this); /* Height of the pixmap. */ extern unsigned int pixmap_get_height(const struct pixmap * this); /* Memory size of the implementation of this pixmap. */ extern size_t pixmap_get_memory_size(const struct pixmap * this); /* Destroy a pixmap. */ extern void pixmap_destroy(struct pixmap * this); #endif