diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gui/pictureframe.h | 70 |
1 files changed, 65 insertions, 5 deletions
diff --git a/include/gui/pictureframe.h b/include/gui/pictureframe.h index f194feb..de9ae1c 100644 --- a/include/gui/pictureframe.h +++ b/include/gui/pictureframe.h | |||
@@ -2,23 +2,83 @@ | |||
2 | #define UPEM_MORPHING_PITUREFRAME | 2 | #define UPEM_MORPHING_PITUREFRAME |
3 | 3 | ||
4 | #include <blender/canvas.h> | 4 | #include <blender/canvas.h> |
5 | #include <morpher/morphing.h> | ||
5 | 6 | ||
6 | /** | 7 | /** |
7 | * File: pictureframe.h | 8 | * File: pictureframe.h |
8 | */ | 9 | */ |
9 | 10 | /** | |
11 | * Type: CartesianMappingDivision | ||
12 | * Type of functions needed to split CartesianMapping and keep only the CartesianVector needed, related to the type of PictureFrame involved | ||
13 | */ | ||
14 | typedef CartesianVector (*CartesianMappingDivision)(const CartesianMapping *cartesianMapping); | ||
15 | /** | ||
16 | * Struct: PictureFrame | ||
17 | * Represents a component to print pictures. | ||
18 | * | ||
19 | * Fields: | ||
20 | * component - inherent component management of the PictureFrame | ||
21 | * morphing - abstract coordinate transform | ||
22 | * canvas - image that will be printed | ||
23 | * cartesianMappingDivision - pointer of function that gives the role of the current PictureFrame to retrieve the right CartesianVector related to its usage | ||
24 | */ | ||
10 | typedef struct { | 25 | typedef struct { |
11 | Component component; | 26 | Component component; |
27 | Morphing *morphing; | ||
28 | Canvas *canvas; | ||
29 | CartesianMappingDivision cartesianMappingDivision; | ||
12 | } PictureFrame; | 30 | } PictureFrame; |
13 | 31 | ||
14 | void pictureframe_init(PictureFrame *pictureFrame, int length); | 32 | /** |
33 | * Function: pictureframe_origin_split | ||
34 | * Splits the CartesianMapping to get the CartesianVector related to the origin PictureFrame. | ||
35 | * | ||
36 | * Parameters: | ||
37 | * *cartesianMapping - CartesianMapping that contains the origin and target CartesianVector needed to be split | ||
38 | */ | ||
39 | CartesianVector pictureframe_origin_split(const CartesianMapping *cartesianMapping); | ||
40 | |||
41 | /** | ||
42 | * Function: pictureframe_target_split | ||
43 | * Splits the CartesianMapping to get the CartesianVector related to the target PictureFrame. | ||
44 | * | ||
45 | * Parameters: | ||
46 | * *cartesianMapping - CartesianMapping that contains the origin and target CartesianVector needed to be split | ||
47 | */ | ||
48 | CartesianVector pictureframe_target_split(const CartesianMapping *cartesianMapping); | ||
49 | |||
50 | void pictureframe_init(PictureFrame *pictureFrame, int width, int height, int x_pos, int y_pos, CartesianMappingDivision cartesianMappingDivision); | ||
15 | 51 | ||
16 | void pictureframe_free(PictureFrame *pictureFrame); | 52 | void pictureframe_free(PictureFrame *pictureFrame); |
17 | 53 | ||
18 | void pictureframe_draw_canvas(PictureFrame *pictureFrame, Canvas *canvas); | 54 | /** |
55 | * Function: pictureframe_draw_canvas | ||
56 | * Draws the contained Canvas of the PictureFrame. | ||
57 | * | ||
58 | * Parameters: | ||
59 | * *pictureFrame - current PictureFrame containing the Canvas to print. | ||
60 | */ | ||
61 | void pictureframe_draw_canvas(PictureFrame *pictureFrame); | ||
19 | 62 | ||
20 | void pictureframe_draw_triangulation(PictureFrame *pictureFrame, void *triangulation); | 63 | /** |
64 | * Function: pictureframe_print | ||
65 | * Prints the PictureFrame (The Canvas involved, plus the triangles and points of the Morphing) | ||
66 | * | ||
67 | * Parameters: | ||
68 | * *parameterSelf - pointer that will be casted into a PictureFrame to be printed | ||
69 | */ | ||
70 | void pictureframe_print(Component *parameterSelf); | ||
71 | |||
72 | /** | ||
73 | * Function: pictureframe_click_handler | ||
74 | * Adds a point on the coordinate of the picture that the mouse is pointing. | ||
75 | * | ||
76 | * Parameters: | ||
77 | * x_pos - coordinate on x axis of the mouse | ||
78 | * y_pos - coordinate on y axis of the mouse | ||
79 | * *parameterSelf - pointer that will be casted into a PictureFrame | ||
80 | */ | ||
81 | void pictureframe_click_handler(int x_pos, int y_pos, Component *parameterSelf); | ||
21 | 82 | ||
22 | void pictureframe_draw_point(PictureFrame *pictureFrame, int x_pos, int y_pos); | ||
23 | 83 | ||
24 | #endif | 84 | #endif |