aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-06 06:10:46 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-06 06:10:46 +0200
commit0c3e33c7bf1060972a79bb5a22cdedfebc316a11 (patch)
tree2d2bcefa3c85b596287ddfcc2c1f40894c2f66d3 /src
parentdrawing to the framebuffer (diff)
downloadcrt-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 'src')
-rw-r--r--src/framebuffer.c29
-rw-r--r--src/framebuffer.h19
2 files changed, 38 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;
-}
-
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);