diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-08-06 06:10:46 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-08-06 06:10:46 +0200 |
commit | 0c3e33c7bf1060972a79bb5a22cdedfebc316a11 (patch) | |
tree | 2d2bcefa3c85b596287ddfcc2c1f40894c2f66d3 /src/framebuffer.c | |
parent | drawing to the framebuffer (diff) | |
download | crt-calibrator-0c3e33c7bf1060972a79bb5a22cdedfebc316a11.tar.gz crt-calibrator-0c3e33c7bf1060972a79bb5a22cdedfebc316a11.tar.bz2 crt-calibrator-0c3e33c7bf1060972a79bb5a22cdedfebc316a11.tar.xz |
doc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/framebuffer.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/framebuffer.c b/src/framebuffer.c index 6e5e1f4..2418934 100644 --- a/src/framebuffer.c +++ b/src/framebuffer.c @@ -121,6 +121,15 @@ void fb_close(framebuffer_t* restrict fb) } +/** + * Construct an sRGB colour in 32-bit XRGB encoding to + * use when specifying colours + * + * @param red The red component from [0, 255] sRGB + * @param green The green component from [0, 255] sRGB + * @param blue The blue component from [0, 255] sRGB + * @return The colour as one 32-bit integer + */ uint32_t fb_colour(int red, int green, int blue) { uint32_t rc = 0; @@ -131,6 +140,16 @@ uint32_t fb_colour(int red, int green, int blue) } +/** + * Print a filled in rectangle to a framebuffer + * + * @param fb The framebuffer + * @param colour The colour to use when drawing the rectangle + * @param x The starting pixel on the X axis for the rectangle + * @param y The starting pixel on the Y axis for the rectangle + * @param width The width of the rectangle, in pixels + * @param height The height of the rectangle, in pixels + */ void fb_fill_rectangle(framebuffer_t* restrict fb, uint32_t colour, uint32_t x, uint32_t y, uint32_t width, uint32_t height) { @@ -148,13 +167,3 @@ void fb_fill_rectangle(framebuffer_t* restrict fb, uint32_t colour, } } - -int main() -{ - framebuffer_t fb; - fb_open(0, &fb); - fb_fill_rectangle(&fb, fb_colour(36, 149, 190), 20, 20, fb.width - 40, fb.height - 40); - fb_close(&fb); - return 0; -} - |