From 0c3e33c7bf1060972a79bb5a22cdedfebc316a11 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 6 Aug 2014 06:10:46 +0200 Subject: doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/framebuffer.c | 29 +++++++++++++++++++---------- src/framebuffer.h | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+), 10 deletions(-) (limited to 'src') 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; -} - diff --git a/src/framebuffer.h b/src/framebuffer.h index 1dffb82..701ccea 100644 --- a/src/framebuffer.h +++ b/src/framebuffer.h @@ -84,8 +84,27 @@ int fb_open(size_t index, framebuffer_t* restrict fb); */ 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); +/** + * 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); -- cgit v1.2.3-70-g09d2