summaryrefslogtreecommitdiff
path: root/include/blender
diff options
context:
space:
mode:
authorpacien2017-11-28 19:01:51 +0100
committerpacien2017-11-28 19:01:51 +0100
commit987835afe8fc5d46cb3a6359ec80c9f035e72801 (patch)
treee93ddebbfc15900f9307df446e420c086f8a2ebd /include/blender
parentac60669cd3a93312f0ff186055e61a5e3fb5fcdd (diff)
downloadmorpher-987835afe8fc5d46cb3a6359ec80c9f035e72801.tar.gz
Add module spec headers
Signed-off-by: pacien <pacien.trangirard@pacien.net>
Diffstat (limited to 'include/blender')
-rw-r--r--include/blender/blender.h42
-rw-r--r--include/blender/canvas.h79
-rw-r--r--include/blender/color.h27
3 files changed, 148 insertions, 0 deletions
diff --git a/include/blender/blender.h b/include/blender/blender.h
new file mode 100644
index 0000000..356c68e
--- /dev/null
+++ b/include/blender/blender.h
@@ -0,0 +1,42 @@
1#ifndef UPEM_MORPHING_BLENDER
2#define UPEM_MORPHING_BLENDER
3
4/**
5 * File: blender.h
6 * Will it blend? That is the question.
7 */
8
9#include "common/time.h"
10#include "blender/canvas.h"
11#include "blender/color.h"
12#include "morpher/morpher.h"
13
14/**
15 * Function: blender_blend_canvas
16 * Blends two canvas by applying the given morphing at the requested time frame.
17 *
18 * Parameters:
19 * *canvas - pointer to the canvas to paint
20 * *source - source image
21 * *target - target image
22 * *morphing - morphing transform to apply
23 * frame - the interpolation distance from the origin canvas [0;1]
24 */
25void blender_blend_canvas(Canvas *canvas, Canvas *source, Canvas *target, Morphing *morphing, TimeVector frame);
26
27/**
28 * Function: blender_blend_colors
29 * Properly blends two coloured pixels, interpolated at the given time frame.
30 * (https://www.youtube.com/watch?v=LKnqECcg6Gw)
31 *
32 * Parameters:
33 * origin - the origin colour
34 * target - the target colour
35 * frame - the interpolation distance from the origin colour [0;1]
36 *
37 * Returns:
38 * The blended coloured pixel
39 */
40Color blender_blend_colors(Color origin, Color target, TimeVector frame);
41
42#endif
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 @@
1#ifndef UPEM_MORPHING_CANVAS
2#define UPEM_MORPHING_CANVAS
3
4/**
5 * File: canvas.h
6 *
7 * See also:
8 * Freedom, according to Bob Ross
9 */
10
11#include <MLV_image.h>
12#include "common/geom.h"
13#include "color.h"
14
15/**
16 * Type: Canvas
17 * Represents a fixed size RGBa pixel matrix.
18 */
19typedef struct {
20 MLV_Image mlv;
21} Canvas;
22
23/**
24 * Function: canvas_init
25 * Initialises a canvas of the given size
26 *
27 * Parameters:
28 * *canvas - the canvas to initialise
29 * width - the width in pixels
30 * height - the height in pixels
31 */
32void canvas_init(Canvas *canvas, IntVector width, IntVector height);
33
34/**
35 * Function: canvas_free
36 * Frees all memory allocated to a canvas.
37 *
38 * Parameters:
39 * *canvas - the canvas to destroy
40 */
41void canvas_free(Canvas *canvas);
42
43/**
44 * Function: canvas_set_pixel
45 * Sets the pixel colour at the given coordinates.
46 *
47 * Parameters:
48 * *canvas - the canvas to alter
49 * position - the cartesian coordinates of the pixel to set
50 * color - the new colour to set
51 */
52void canvas_set_pixel(Canvas *canvas, CartesianVector position, Color color);
53
54/**
55 * Function: canvas_get_pixel
56 * Returns the colour of the pixel at the given position.
57 *
58 * Parameters:
59 * *canvas - the base canvas
60 * position - the position in cartesian coordinates
61 *
62 * Returns:
63 * The colour of the requested pixel
64 */
65Color canvas_get_pixel(Canvas *canvas, CartesianVector position);
66
67/**
68 * Function: canvas_get_size
69 * Returns the size (in pixels) of the given canvas.
70 *
71 * Parameters:
72 * *canvas - the canvas
73 *
74 * Returns:
75 * The size of the canvas
76 */
77CartesianVector canvas_get_size(Canvas *canvas);
78
79#endif
diff --git a/include/blender/color.h b/include/blender/color.h
new file mode 100644
index 0000000..cdf488a
--- /dev/null
+++ b/include/blender/color.h
@@ -0,0 +1,27 @@
1#ifndef UPEM_MORPHING_COLOR
2#define UPEM_MORPHING_COLOR
3
4/**
5 * File: color.h
6 *
7 * See also:
8 * A rainbow
9 */
10
11/**
12 * Type: ColorComponent
13 * Represents a single colour component of 32-bits RGBa tuple.
14 */
15typedef uint8_t ColorComponent;
16
17/**
18 * Type: ColorPixel
19 * Represents a single RGBa coloured pixel.
20 * Compatible with the libMLV representation.
21 */
22typedef union {
23 ColorComponent r, g, b, a;
24 MLV_Color mlv;
25} Color;
26
27#endif