Cairo-Dock
3.4.0
|
Data Structures | |
struct | _CairoDockGLPath |
Definition of a CairoDockGLPath. More... | |
Functions | |
CairoDockGLPath * | cairo_dock_new_gl_path (int iNbVertices, double x0, double y0, int iWidth, int iHeight) |
void | cairo_dock_free_gl_path (CairoDockGLPath *pPath) |
void | cairo_dock_gl_path_move_to (CairoDockGLPath *pPath, double x0, double y0) |
void | cairo_dock_gl_path_set_extent (CairoDockGLPath *pPath, int iWidth, int iHeight) |
void | cairo_dock_gl_path_line_to (CairoDockGLPath *pPath, GLfloat x, GLfloat y) |
void | cairo_dock_gl_path_rel_line_to (CairoDockGLPath *pPath, GLfloat dx, GLfloat dy) |
void | cairo_dock_gl_path_curve_to (CairoDockGLPath *pPath, int iNbPoints, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3) |
void | cairo_dock_gl_path_rel_curve_to (CairoDockGLPath *pPath, int iNbPoints, GLfloat dx1, GLfloat dy1, GLfloat dx2, GLfloat dy2, GLfloat dx3, GLfloat dy3) |
void | cairo_dock_gl_path_simple_curve_to (CairoDockGLPath *pPath, int iNbPoints, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) |
void | cairo_dock_gl_path_rel_simple_curve_to (CairoDockGLPath *pPath, int iNbPoints, GLfloat dx1, GLfloat dy1, GLfloat dx2, GLfloat dy2) |
void | cairo_dock_gl_path_arc (CairoDockGLPath *pPath, int iNbPoints, GLfloat xc, GLfloat yc, double r, double teta0, double cone) |
void | cairo_dock_stroke_gl_path (const CairoDockGLPath *pPath, gboolean bClosePath) |
void | cairo_dock_fill_gl_path (const CairoDockGLPath *pPath, GLuint iTexture) |
void | cairo_dock_draw_rounded_rectangle_opengl (double fFrameWidth, double fFrameHeight, double fRadius, double fLineWidth, double *fLineColor) |
This class define OpenGL path, with similar functions as cairo. You create a path with cairo_dock_new_gl_path, then you add lines, curves or arcs to it. Once the path is defined, you can eigher stroke it with cairo_dock_stroke_gl_path or fill it with cairo_dock_fill_gl_path. You can fill a path with the current color or with a texture, in this case you must provide the dimension of the husk. To destroy the path, use cairo_dock_free_gl_path.
CairoDockGLPath* cairo_dock_new_gl_path | ( | int | iNbVertices, |
double | x0, | ||
double | y0, | ||
int | iWidth, | ||
int | iHeight | ||
) |
Create a new path. It will start at the point (x0, y0). If you want to be abe to fill it with a texture, you can specify here the dimension of the path's husk.
iNbVertices | maximum number of vertices the path will have |
x0 | x coordinate of the origin point |
y0 | y coordinate of the origin point |
iWidth | width of the husk of the path. |
iHeight | height of the husk of the path |
void cairo_dock_free_gl_path | ( | CairoDockGLPath * | pPath | ) |
Destroy a path and free its allocated ressources.
pPath | the path. |
void cairo_dock_gl_path_move_to | ( | CairoDockGLPath * | pPath, |
double | x0, | ||
double | y0 | ||
) |
Rewind the path, defining its origin point. The path has only 1 point after a call to this function.
pPath | the path. |
x0 | x coordinate of the origin point |
y0 | y coordinate of the origin point |
void cairo_dock_gl_path_set_extent | ( | CairoDockGLPath * | pPath, |
int | iWidth, | ||
int | iHeight | ||
) |
Define the dimension of the hulk. This is needed if you intend to fill the path with a texture.
pPath | the path. |
iWidth | width of the hulk |
iHeight | height of the hulk |
void cairo_dock_gl_path_line_to | ( | CairoDockGLPath * | pPath, |
GLfloat | x, | ||
GLfloat | y | ||
) |
Add a line between the current point and a given point.
pPath | the path. |
x | x coordinate of the point |
y | y coordinate of the point |
void cairo_dock_gl_path_rel_line_to | ( | CairoDockGLPath * | pPath, |
GLfloat | dx, | ||
GLfloat | dy | ||
) |
Add a line defined relatively to the current point.
pPath | the path. |
dx | horizontal offset |
dy | vertical offset |
void cairo_dock_gl_path_curve_to | ( | CairoDockGLPath * | pPath, |
int | iNbPoints, | ||
GLfloat | x1, | ||
GLfloat | y1, | ||
GLfloat | x2, | ||
GLfloat | y2, | ||
GLfloat | x3, | ||
GLfloat | y3 | ||
) |
Add a Bezier cubic curve starting from the current point.
pPath | the path. |
iNbPoints | number of points used to discretize the curve |
x1 | first control point x |
y1 | first control point y |
x2 | second control point x |
y2 | second control point y |
x3 | terminal point of the curve x |
y3 | terminal point of the curve y |
void cairo_dock_gl_path_rel_curve_to | ( | CairoDockGLPath * | pPath, |
int | iNbPoints, | ||
GLfloat | dx1, | ||
GLfloat | dy1, | ||
GLfloat | dx2, | ||
GLfloat | dy2, | ||
GLfloat | dx3, | ||
GLfloat | dy3 | ||
) |
Add a Bezier cubic curve starting from the current point. The control and terminal points are defined relatively to the current point.
pPath | the path. |
iNbPoints | number of points used to discretize the curve |
dx1 | first control point offset x |
dy1 | first control point offset y |
dx2 | second control point offset x |
dy2 | second control point offset y |
dx3 | terminal point of the curve offset x |
dy3 | terminal point of the curve offset y |
void cairo_dock_gl_path_simple_curve_to | ( | CairoDockGLPath * | pPath, |
int | iNbPoints, | ||
GLfloat | x1, | ||
GLfloat | y1, | ||
GLfloat | x2, | ||
GLfloat | y2 | ||
) |
Add a Bezier bilinear curve starting from the current point
pPath | the path. |
iNbPoints | number of points used to discretize the curve |
x1 | control point x |
y1 | control point y |
x2 | terminal point of the curve x |
y2 | terminal point of the curve y |
void cairo_dock_gl_path_rel_simple_curve_to | ( | CairoDockGLPath * | pPath, |
int | iNbPoints, | ||
GLfloat | dx1, | ||
GLfloat | dy1, | ||
GLfloat | dx2, | ||
GLfloat | dy2 | ||
) |
Add a Bezier bilinear curve starting from the current point. The control and terminal points are defined relatively to the current point.
pPath | the path. |
iNbPoints | number of points used to discretize the curve |
dx1 | control point offset x |
dy1 | control point offset y |
dx2 | terminal point of the curve offset x |
dy2 | terminal point of the curve offset y |
void cairo_dock_gl_path_arc | ( | CairoDockGLPath * | pPath, |
int | iNbPoints, | ||
GLfloat | xc, | ||
GLfloat | yc, | ||
double | r, | ||
double | teta0, | ||
double | cone | ||
) |
Add an arc to the path, joining the current point to the beginning of the arc with a line.
pPath | the path. |
iNbPoints | number of points used to discretize the arc |
xc | x coordinate of the center |
yc | y coordinate of the center |
r | radius |
teta0 | initial angle |
cone | cone of the arc (a negative value means clockwise). |
void cairo_dock_stroke_gl_path | ( | const CairoDockGLPath * | pPath, |
gboolean | bClosePath | ||
) |
Stroke a path with the current color and with the current line width.
pPath | the path. |
bClosePath | whether to close the path (that is to say, join the last point with the first one) or not. |
void cairo_dock_fill_gl_path | ( | const CairoDockGLPath * | pPath, |
GLuint | iTexture | ||
) |
Fill a path with a texture, or with the current color if the texture is 0.
pPath | the path. |
iTexture | the texture, or 0 to fill the path with the current color. To fill the path with a gradation, use GL_COLOR_ARRAY and feed it with a table of colors that matches the vertices. |
void cairo_dock_draw_rounded_rectangle_opengl | ( | double | fFrameWidth, |
double | fFrameHeight, | ||
double | fRadius, | ||
double | fLineWidth, | ||
double * | fLineColor | ||
) |
Draw a rectangle with rounded corners. The rectangle will be centered at the current point. The current matrix is not altered.
fFrameWidth | width of the rectangle, without the corners. |
fFrameHeight | height of the rectangle, including the corners. |
fRadius | radius of the corners (can be 0). |
fLineWidth | width of the line. If set to 0, the background will be filled with the provided color, otherwise the path will be stroke with this color. |
fLineColor | color of the line if fLineWidth is non nul, or color of the background otherwise. |