CicmWrapper  Beta 0.4
A wrapper for Pure Data
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
egraphics.h
1 /*
2  * CicmWrapper
3  *
4  * A wrapper for Pure Data
5  *
6  * Copyright (C) 2013 Pierre Guillot, CICM - Université Paris 8
7  * All rights reserved.
8  *
9  * Website : http://www.mshparisnord.fr/HoaLibrary/
10  * Contacts : cicm.mshparisnord@gmail.com
11  *
12  * This library is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU Library General Public License as published
14  * by the Free Software Foundation; either version 2 of the License.
15  *
16  * This library is distributed in the hope that it will be useful, but WITHOUT
17  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
19  * License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public License
22  * along with this library; if not, write to the Free Software Foundation,
23  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24  *
25  */
26 
27 #ifndef DEF_EGRAPHICS
28 #define DEF_EGRAPHICS
29 
30 #include "ecommon.h"
31 
38 void egraphics_fill(t_elayer *g);
39 void egraphics_fill_preserve(t_elayer *g);
40 void egraphics_stroke(t_elayer *g);
41 void egraphics_stroke_preserve(t_elayer *g);
42 void etext_layout_draw(t_etext* textlayout, t_elayer *g);
43 
44 void egraphics_set_line_splinestep(t_elayer *g, float smooth);
45 void egraphics_set_line_width(t_elayer *g, float width);
46 void egraphics_set_color_rgba(t_elayer *g, const t_rgba *rgba);
47 void egraphics_set_color_rgb(t_elayer *g, const t_rgb *rgb);
48 void egraphics_set_color_hex(t_elayer *g, t_symbol *hex);
49 void egraphics_set_color_hsla(t_elayer *g, const t_hsla *hsla);
50 void egraphics_set_color_hsl(t_elayer *g, const t_hsl *hsl);
51 void egraphics_rotate(t_elayer *g, float angle);
52 void egraphics_matrix_init(t_matrix *x, float xx, float yx, float xy, float yy, float x0, float y0);
53 void egraphics_set_matrix(t_elayer *g, const t_matrix *matrix);
54 
55 // GRAPHICS MODIFICATIONS PRIVATE //
56 void egraphics_apply_matrix(t_elayer *g, t_egobj* gobj);
57 
58 void egraphics_line_to(t_elayer *g, float x, float y);
59 void egraphics_move_to(t_elayer *g, float x, float y);
60 void egraphics_curve_to(t_elayer *g, float ctrl1x, float ctrl1y, float ctrl2x, float ctrl2y, float endx, float endy);
61 void egraphics_arc_to(t_elayer *g, float cx, float cy, float extend);
62 void egraphics_arc_oval_to(t_elayer *g, float cx, float cy, float radius, float extend);
63 
64 void egraphics_line(t_elayer *g, float x0, float y0, float x1, float y1);
65 void egraphics_curve(t_elayer *g, float startx, float starty, float ctrl1x, float ctrl1y, float ctrl2x, float ctrl2y, float endx, float endy);
66 void egraphics_line_fast(t_elayer *g, float x0, float y0, float x1, float y1);
67 
68 void egraphics_close_path(t_elayer *g);
69 void egraphics_rectangle(t_elayer *g, float x, float y, float width, float height);
70 void egraphics_rectangle_rounded(t_elayer *g, float x, float y, float width, float height, float roundness);
71 void egraphics_circle(t_elayer *g, float xc, float yc, float radius);
72 void egraphics_oval(t_elayer *g, float xc, float yc, float radiusx, float radiusy);
73 void egraphics_arc(t_elayer *g, float xc, float yc, float radius, float angle1, float angle2);
74 void egraphics_arc_oval(t_elayer *g, float xc, float yc, float radiusx, float radiusy, float angle1, float angle2);
75 
76 t_etext* etext_layout_create(void);
77 void etext_layout_destroy(t_etext* textlayout);
78 void etext_layout_set(t_etext* textlayout, const char* text, t_efont *jfont, float x, float y, float width, float height, etextanchor_flags anchor, etextjustify_flags justify, etextwrap_flags wrap);
79 void etext_layout_settextcolor(t_etext* textlayout, t_rgba* color);
80 t_efont* efont_create(t_symbol* family, t_symbol* slant, t_symbol* weight, float size);
81 void efont_destroy(t_efont* font);
82 
83 char* rgba_to_hex(t_rgba color);
84 char* rgb_to_hex(t_rgb color);
85 char* hsla_to_hex(t_hsla color);
86 char* hsl_to_hex(t_hsl color);
87 t_hsl rgb_to_hsl(t_rgb color);
88 t_hsla rgba_to_hsla(t_rgba color);
89 t_rgba hex_to_rgba(char* color);
90 t_rgb hex_to_rgb(char* color);
91 t_rgba hsla_to_rgba(t_hsla color);
92 t_rgb hsl_to_rgb(t_hsl color);
93 
94 t_rgba rgba_addContrast(t_rgba color, float contrast);
95 t_rgb rgb_addContrast(t_rgb color, float contrast);
96 void rgba_set(t_rgba *color, float red, float green, float blue, float alpha);
97 void rgb_set(t_rgb *color, float red, float green, float blue);
98 void hsla_set(t_hsla *color, float hue, float saturation, float luminosity, float alpha);
99 void hsl_set(t_hsl *color, float hue, float saturation, float luminosity);
100 
101 float pd_clip_min(float aValue, float aMinimum);
102 float pd_clip_max(float aValue, float aMaximum);
103 float pd_clip_minmax(float aValue, float aMinimum, float aMaximum);
104 float pd_ordinate(float radius, float angle);
105 float pd_abscissa(float radius, float angle);
106 float pd_radius(float x, float y);
107 float pd_angle(float x, float y);
108 
111 #endif
etextanchor_flags
The flags that defines the text anchor.
Definition: edefine.h:162
etextjustify_flags
The flags that define the text justification.
Definition: edefine.h:192
The font structure.
Definition: edefine.h:337
The drawing object.
Definition: edefine.h:366
The drawing layer.
Definition: edefine.h:388
The text structure.
Definition: edefine.h:351
A hsl color structure.
Definition: edefine.h:295
A hsla color structure.
Definition: edefine.h:307
A matrix structure.
Definition: edefine.h:255
A rgb color structure.
Definition: edefine.h:270
A rgba color structure.
Definition: edefine.h:282
etextwrap_flags
The flags that defines if the text should be wrapped.
Definition: edefine.h:181