From 987835afe8fc5d46cb3a6359ec80c9f035e72801 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 28 Nov 2017 19:01:51 +0100 Subject: Add module spec headers Signed-off-by: pacien --- include/blender/canvas.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 include/blender/canvas.h (limited to 'include/blender/canvas.h') diff --git a/include/blender/canvas.h b/include/blender/canvas.h new file mode 100644 index 0000000..12f7ce1 --- /dev/null +++ b/include/blender/canvas.h @@ -0,0 +1,79 @@ +#ifndef UPEM_MORPHING_CANVAS +#define UPEM_MORPHING_CANVAS + +/** + * File: canvas.h + * + * See also: + * Freedom, according to Bob Ross + */ + +#include +#include "common/geom.h" +#include "color.h" + +/** + * Type: Canvas + * Represents a fixed size RGBa pixel matrix. + */ +typedef struct { + MLV_Image mlv; +} Canvas; + +/** + * Function: canvas_init + * Initialises a canvas of the given size + * + * Parameters: + * *canvas - the canvas to initialise + * width - the width in pixels + * height - the height in pixels + */ +void canvas_init(Canvas *canvas, IntVector width, IntVector height); + +/** + * Function: canvas_free + * Frees all memory allocated to a canvas. + * + * Parameters: + * *canvas - the canvas to destroy + */ +void canvas_free(Canvas *canvas); + +/** + * Function: canvas_set_pixel + * Sets the pixel colour at the given coordinates. + * + * Parameters: + * *canvas - the canvas to alter + * position - the cartesian coordinates of the pixel to set + * color - the new colour to set + */ +void canvas_set_pixel(Canvas *canvas, CartesianVector position, Color color); + +/** + * Function: canvas_get_pixel + * Returns the colour of the pixel at the given position. + * + * Parameters: + * *canvas - the base canvas + * position - the position in cartesian coordinates + * + * Returns: + * The colour of the requested pixel + */ +Color canvas_get_pixel(Canvas *canvas, CartesianVector position); + +/** + * Function: canvas_get_size + * Returns the size (in pixels) of the given canvas. + * + * Parameters: + * *canvas - the canvas + * + * Returns: + * The size of the canvas + */ +CartesianVector canvas_get_size(Canvas *canvas); + +#endif -- cgit v1.2.3