// Drawing primitives. // // All primitives clip to the surface rectangle. Out-of-bounds draws are // silent no-ops, not errors. samplePixel returns 0 for off-surface reads. // Primitives operate on color indices; per-scanline palette resolution // happens only at display time. #ifndef JOEYLIB_DRAW_H #define JOEYLIB_DRAW_H #include "platform.h" #include "surface.h" #include "types.h" // Fill the entire surface with a single color index. Writes color 0 is // a legitimate clear-to-black and does not skip. void surfaceClear(SurfaceT *s, uint8_t colorIndex); // Plot a single pixel. Off-surface coordinates are no-ops. void drawPixel(SurfaceT *s, int16_t x, int16_t y, uint8_t colorIndex); // Read a pixel value. Off-surface coordinates return 0. uint8_t samplePixel(const SurfaceT *s, int16_t x, int16_t y); // Fill a solid rectangle. Negative or zero dimensions are no-ops. void fillRect(SurfaceT *s, int16_t x, int16_t y, uint16_t w, uint16_t h, uint8_t colorIndex); #endif