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  * Copyright (C) 2013 Pierre Guillot, CICM - Université Paris 8
4  * All rights reserved.
5  * Website : https://github.com/CICM/CicmWrapper
6  * Contacts : cicm.mshparisnord@gmail.com
7  * For information on usage and redistribution, and for a DISCLAIMER OF ALL
8  * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
9  */
10 
11 #ifndef DEF_EGRAPHICS
12 #define DEF_EGRAPHICS
13 
14 #include "ecommon.h"
15 
28 void egraphics_set_line_width(t_elayer *g, float width);
29 
36 void egraphics_set_color_rgba(t_elayer *g, const t_rgba *rgba);
37 
44 void egraphics_set_color_rgb(t_elayer *g, const t_rgb *rgb);
45 
53 
60 void egraphics_set_color_hsla(t_elayer *g, const t_hsla *hsla);
61 
68 void egraphics_set_color_hsl(t_elayer *g, const t_hsl *hsl);
69 
81 void egraphics_matrix_init(t_matrix *x, float xx, float yx, float xy, float yy, float x0, float y0);
82 
89 void egraphics_set_matrix(t_elayer *g, const t_matrix *matrix);
90 
97 void egraphics_rotate(t_elayer *g, float angle);
98 
107 void egraphics_move_to(t_elayer *g, float x, float y);
108 
117 void egraphics_line_to(t_elayer *g, float x, float y);
118 
131 void egraphics_curve_to(t_elayer *g, float ctrl1x, float ctrl1y, float ctrl2x, float ctrl2y, float endx, float endy);
132 
142 void egraphics_arc_to(t_elayer *g, float cx, float cy, float extend);
143 
154 void egraphics_arc_oval_to(t_elayer *g, float cx, float cy, float radius, float extend);
155 
166 void egraphics_line(t_elayer *g, float x0, float y0, float x1, float y1);
167 
182 void egraphics_curve(t_elayer *g, float startx, float starty, float ctrl1x, float ctrl1y, float ctrl2x, float ctrl2y, float endx, float endy);
183 
194 void egraphics_line_fast(t_elayer *g, float x0, float y0, float x1, float y1);
195 
202 
212 void egraphics_rectangle(t_elayer *g, float x, float y, float width, float height);
213 
224 void egraphics_rectangle_rounded(t_elayer *g, float x, float y, float width, float height, float roundness);
225 
234 void egraphics_circle(t_elayer *g, float xc, float yc, float radius);
235 
245 void egraphics_oval(t_elayer *g, float xc, float yc, float radiusx, float radiusy);
246 
257 void egraphics_arc(t_elayer *g, float xc, float yc, float radius, float angle1, float angle2);
258 
270 void egraphics_arc_oval(t_elayer *g, float xc, float yc, float radiusx, float radiusy, float angle1, float angle2);
271 
278 
284 void etext_layout_destroy(t_etext* textlayout);
285 
300 void etext_layout_set(t_etext* textlayout, const char* text, t_efont *font, float x, float y, float width, float height, etextanchor_flags anchor, etextjustify_flags justify, etextwrap_flags wrap);
301 
308 void etext_layout_settextcolor(t_etext* textlayout, t_rgba* color);
309 
319 t_efont* efont_create(t_symbol* family, t_symbol* slant, t_symbol* weight, float size);
320 
326 void efont_destroy(t_efont* font);
327 
333 void egraphics_fill(t_elayer *g);
334 
341 
347 void egraphics_stroke(t_elayer *g);
348 
355 
362 void etext_layout_draw(t_etext* textlayout, t_elayer *g);
363 
373 void rgba_set(t_rgba *color, float red, float green, float blue, float alpha);
374 
383 void rgb_set(t_rgb *color, float red, float green, float blue);
384 
394 void hsla_set(t_hsla *color, float hue, float saturation, float lightness, float alpha);
395 
404 void hsl_set(t_hsl *color, float hue, float saturation, float lightness);
405 
412 char* rgba_to_hex(t_rgba color);
413 
420 char* rgb_to_hex(t_rgb color);
421 
428 char* hsla_to_hex(t_hsla color);
429 
436 char* hsl_to_hex(t_hsl color);
437 
444 t_hsla rgba_to_hsla(t_rgba color);
445 
452 t_hsl rgb_to_hsl(t_rgb color);
453 
460 t_rgba hex_to_rgba(char* color);
461 
468 t_rgb hex_to_rgb(char* color);
469 
476 t_rgba hsla_to_rgba(t_hsla color);
477 
484 t_rgb hsl_to_rgb(t_hsl color);
485 
494 t_rgba rgba_addContrast(t_rgba color, float contrast);
495 
504 t_rgb rgb_addContrast(t_rgb color, float contrast);
505 
507 float pd_clip_min(float aValue, float aMinimum);
508 float pd_clip_max(float aValue, float aMaximum);
509 float pd_clip_minmax(float aValue, float aMinimum, float aMaximum);
510 float pd_ordinate(float radius, float angle);
511 float pd_abscissa(float radius, float angle);
512 float pd_radius(float x, float y);
513 float pd_angle(float x, float y);
515 
518 #endif
void egraphics_set_color_rgb(t_elayer *g, const t_rgb *rgb)
Sets the color in rgb that will be used by the t_elayer.
Definition: egraphics.c:38
t_rgb rgb_addContrast(t_rgb color, float contrast)
Adds some constrast to a t_rgb color.
Definition: egraphics.c:854
char * hsla_to_hex(t_hsla color)
Converts a t_hsla color to an hexadecimal color.
Definition: egraphics.c:646
void egraphics_set_matrix(t_elayer *g, const t_matrix *matrix)
Initializes the t_matrix of a t_elayer.
Definition: egraphics.c:903
t_etext * etext_layout_create(void)
Allocates a new t_etext layout.
Definition: egraphics.c:981
void egraphics_oval(t_elayer *g, float xc, float yc, float radiusx, float radiusy)
Adds a oval in the t_elayer.
Definition: egraphics.c:538
void hsla_set(t_hsla *color, float hue, float saturation, float lightness, float alpha)
Intialize a t_hsla color.
Definition: egraphics.c:878
void egraphics_set_color_rgba(t_elayer *g, const t_rgba *rgba)
Sets the color in rgba that will be used by the t_elayer.
Definition: egraphics.c:33
void egraphics_close_path(t_elayer *g)
Marks the current path as closed.
Definition: egraphics.c:414
void egraphics_stroke(t_elayer *g)
Strokes the t_elayer with the current path.
Definition: egraphics.c:128
char * hsl_to_hex(t_hsl color)
Converts a t_hsl color to an hexadecimal color.
Definition: egraphics.c:652
void egraphics_matrix_init(t_matrix *x, float xx, float yx, float xy, float yy, float x0, float y0)
Initializes a matrix.
Definition: egraphics.c:893
t_efont * efont_create(t_symbol *family, t_symbol *slant, t_symbol *weight, float size)
Allocates a new t_efont.
Definition: egraphics.c:1044
void egraphics_arc(t_elayer *g, float xc, float yc, float radius, float angle1, float angle2)
Adds an arc in the t_elayer.
Definition: egraphics.c:562
void egraphics_fill_preserve(t_elayer *g)
Fills the t_elayer with the current path and preserves the current path.
Definition: egraphics.c:113
t_hsla rgba_to_hsla(t_rgba color)
Converts a t_rgba color to a t_hsla color.
Definition: egraphics.c:679
t_rgba rgba_addContrast(t_rgba color, float contrast)
Adds some constrast to a t_rgba color.
Definition: egraphics.c:845
etextanchor_flags
The flags that defines the text anchor.
Definition: edefine.h:147
void egraphics_fill(t_elayer *g)
Fills the t_elayer with the current path.
Definition: egraphics.c:118
void egraphics_line(t_elayer *g, float x0, float y0, float x1, float y1)
Adds a new path at specific point and link it linearly to another.
Definition: egraphics.c:432
void egraphics_stroke_preserve(t_elayer *g)
Strokes the t_elayer with the current path and preserves the current path.
Definition: egraphics.c:123
The t_symbol struture.
Definition: enative.h:46
void egraphics_move_to(t_elayer *g, float x, float y)
Starts a new path in a t_elayer.
Definition: egraphics.c:168
etextwrap_flags
The flags that defines if the text should be wrapped.
Definition: edefine.h:166
t_rgb hex_to_rgb(char *color)
Converts an hexadecimal color to a t_rgb color.
Definition: egraphics.c:669
void etext_layout_draw(t_etext *textlayout, t_elayer *g)
Draws the t_etext in a t_elayer.
Definition: egraphics.c:133
void hsl_set(t_hsl *color, float hue, float saturation, float lightness)
Intialize a t_hsl color.
Definition: egraphics.c:886
void egraphics_line_fast(t_elayer *g, float x0, float y0, float x1, float y1)
Adds a new path at specific point and link it linearly to another then draw directly the line...
Definition: egraphics.c:450
void egraphics_set_color_hsla(t_elayer *g, const t_hsla *hsla)
Sets the color in hsla that will be used by the t_elayer.
Definition: egraphics.c:48
void egraphics_line_to(t_elayer *g, float x, float y)
Adds a line in the current path of a t_elayer.
Definition: egraphics.c:211
void egraphics_rotate(t_elayer *g, float angle)
Adds a rotation to the t_matrix of a t_elayer.
Definition: egraphics.c:908
t_rgba hsla_to_rgba(t_hsla color)
Converts a t_hsla color to a t_rgba color.
Definition: egraphics.c:817
void egraphics_rectangle_rounded(t_elayer *g, float x, float y, float width, float height, float roundness)
Adds a rounded rectangle in the t_elayer.
Definition: egraphics.c:491
void egraphics_curve_to(t_elayer *g, float ctrl1x, float ctrl1y, float ctrl2x, float ctrl2y, float endx, float endy)
Adds a bezier curve in the current path of a t_elayer.
Definition: egraphics.c:238
void egraphics_arc_to(t_elayer *g, float cx, float cy, float extend)
Adds an arc to the current path of a t_elayer.
Definition: egraphics.c:290
void egraphics_set_line_width(t_elayer *g, float width)
Sets the line width that will be used by the t_elayer.
Definition: egraphics.c:28
void egraphics_arc_oval(t_elayer *g, float xc, float yc, float radiusx, float radiusy, float angle1, float angle2)
Adds an oval arc in the t_elayer.
Definition: egraphics.c:588
void efont_destroy(t_efont *font)
Frees a t_efont.
Definition: egraphics.c:1063
void egraphics_curve(t_elayer *g, float startx, float starty, float ctrl1x, float ctrl1y, float ctrl2x, float ctrl2y, float endx, float endy)
Adds a new path at specific point and continue the path with a curve.
Definition: egraphics.c:441
void rgba_set(t_rgba *color, float red, float green, float blue, float alpha)
Intialize a t_rgba color.
Definition: egraphics.c:863
void etext_layout_settextcolor(t_etext *textlayout, t_rgba *color)
Sets the color of a t_etext layout.
Definition: egraphics.c:1039
char * rgb_to_hex(t_rgb color)
Converts a t_rgb color to an hexadecimal color.
Definition: egraphics.c:630
void egraphics_set_color_hex(t_elayer *g, t_symbol *hex)
Sets the color in hexadecimal that will be used by the t_elayer.
Definition: egraphics.c:43
void etext_layout_destroy(t_etext *textlayout)
Frees a t_etext layout.
Definition: egraphics.c:992
void rgb_set(t_rgb *color, float red, float green, float blue)
Intialize a t_rgb color.
Definition: egraphics.c:871
void egraphics_rectangle(t_elayer *g, float x, float y, float width, float height)
Adds a rectangle in the t_elayer.
Definition: egraphics.c:460
t_rgba hex_to_rgba(char *color)
Converts an hexadecimal color to a t_rgba color.
Definition: egraphics.c:658
t_hsl rgb_to_hsl(t_rgb color)
Converts a t_rgb color to a t_hsl color.
Definition: egraphics.c:728
void egraphics_circle(t_elayer *g, float xc, float yc, float radius)
Adds a circle in the t_elayer.
Definition: egraphics.c:533
The font structure.
Definition: edefine.h:322
The drawing layer.
Definition: edefine.h:373
A rgb color structure.
Definition: edefine.h:255
A rgba color structure.
Definition: edefine.h:267
The text structure.
Definition: edefine.h:336
A hsl color structure.
Definition: edefine.h:280
A hsla color structure.
Definition: edefine.h:292
A matrix structure.
Definition: edefine.h:240
void egraphics_set_color_hsl(t_elayer *g, const t_hsl *hsl)
Sets the color in hsl that will be used by the t_elayer.
Definition: egraphics.c:54
t_rgb hsl_to_rgb(t_hsl color)
Converts a t_hsl color to a t_rgb color.
Definition: egraphics.c:791
char * rgba_to_hex(t_rgba color)
Converts a t_rgba color to an hexadecimal color.
Definition: egraphics.c:614
void egraphics_arc_oval_to(t_elayer *g, float cx, float cy, float radius, float extend)
Adds an oval arc to the current path of a t_elayer.
Definition: egraphics.c:362
void etext_layout_set(t_etext *textlayout, const char *text, t_efont *font, float x, float y, float width, float height, etextanchor_flags anchor, etextjustify_flags justify, etextwrap_flags wrap)
Initializes a t_etext.
Definition: egraphics.c:997
etextjustify_flags
The flags that define the text justification.
Definition: edefine.h:177