summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2017-11-28 19:01:51 +0100
committerpacien2017-11-28 19:01:51 +0100
commit987835afe8fc5d46cb3a6359ec80c9f035e72801 (patch)
treee93ddebbfc15900f9307df446e420c086f8a2ebd
parentac60669cd3a93312f0ff186055e61a5e3fb5fcdd (diff)
downloadmorpher-987835afe8fc5d46cb3a6359ec80c9f035e72801.tar.gz
Add module spec headers
Signed-off-by: pacien <pacien.trangirard@pacien.net>
-rw-r--r--include/blender/blender.h42
-rw-r--r--include/blender/canvas.h79
-rw-r--r--include/blender/color.h27
-rw-r--r--include/common/geom.h32
-rw-r--r--include/common/matrix.h34
-rw-r--r--include/common/time.h23
-rw-r--r--include/gui/gui.h14
-rw-r--r--include/morpher/morpher.h64
8 files changed, 315 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
diff --git a/include/common/geom.h b/include/common/geom.h
new file mode 100644
index 0000000..15a1d57
--- /dev/null
+++ b/include/common/geom.h
@@ -0,0 +1,32 @@
1#ifndef UPEM_MORPHING_GEOM
2#define UPEM_MORPHING_GEOM
3
4/**
5 * File: geom.h
6 */
7
8#include <inttypes.h>
9
10/**
11 * Type: IntVector
12 * An abstract 1-D vector.
13 */
14typedef int32_t IntVector;
15
16/**
17 * Type: CartesianVector
18 * An abstract 2-D vector in cartesian coordinates.
19 */
20typedef struct {
21 IntVector x, y;
22} CartesianVector;
23
24/**
25 * Type: CartesianMapping
26 * A tuple of cartesian vectors representing a mapping.
27 */
28typedef struct {
29 CartesianVector origin, target;
30} CartesianMapping;
31
32#endif
diff --git a/include/common/matrix.h b/include/common/matrix.h
new file mode 100644
index 0000000..6c35cc0
--- /dev/null
+++ b/include/common/matrix.h
@@ -0,0 +1,34 @@
1#ifndef UPEM_MORPHING_MATRIX
2#define UPEM_MORPHING_MATRIX
3
4/**
5 * File: matrix.h
6 *
7 * See also:
8 * The film
9 */
10
11#include "geom.h"
12
13/**
14 * Type: IntSquareMatrix
15 * Represents a square integer matrix.
16 */
17typedef struct {
18 IntVector *elements;
19 IntVector dim;
20} IntSquareMatrix;
21
22/**
23 * Function: matrix_int_det
24 * Computes and returns the determinant of a square integer matrix.
25 *
26 * Parameters:
27 * *matrix - pointer to input matrix
28 *
29 * Returns:
30 * The integer determinant
31 */
32IntVector matrix_int_det(IntSquareMatrix *matrix);
33
34#endif
diff --git a/include/common/time.h b/include/common/time.h
new file mode 100644
index 0000000..060b7be
--- /dev/null
+++ b/include/common/time.h
@@ -0,0 +1,23 @@
1#ifndef UPEM_MORPHING_TIME
2#define UPEM_MORPHING_TIME
3
4/**
5 * File: time.h
6 */
7
8/**
9 * Type: TimeVector
10 * An abstract time vector.
11 */
12typedef float TimeVector;
13
14/**
15 * Constants: Time vectors
16 *
17 * TIME_ORIGIN - the origin of times
18 * TIME_UNIT - a unit time vector
19 */
20const TimeVector TIME_ORIGIN = 0;
21const TimeVector TIME_UNIT = 1;
22
23#endif
diff --git a/include/gui/gui.h b/include/gui/gui.h
new file mode 100644
index 0000000..14bdcf2
--- /dev/null
+++ b/include/gui/gui.h
@@ -0,0 +1,14 @@