1DTK_CREATE_STRING(3) Draw Toolkit manual DTK_CREATE_STRING(3)
2
3
4
6 dtk_create_string - Creates or modify a shape to display a string
7
9 #include <drawtk.h>
10
11 dtk_hshape dtk_create_string(dtk_hshape shp, const char *text,
12 float size, float x, float y,
13 unsigned int alignment,
14 const float *color, dtk_hfont font);
15
17 dtk_create_string() creates a text specified by text at location (x,y)
18 with a font size of size using a previously loaded font referenced by
19 font argument (see dtk_load_font(3)).
20
21 The position (x,y) is interpreted according to the combination of flags
22 controlling the vertical and horizontal alignment defined in the align‐
23 ment argument:
24
25 * DTK_BOTTOM, DTK_VMID and DTK_TOP make the value y to be interpreted
26 as respectively the bottom, the middle and the top of the bounding
27 box of the shape.
28
29 * DTK_LEFT, DTK_HMID and DTK_RIGHT make the value x to be interpreted
30 as respectively the left, the middle and the right of the bounding
31 box of the shape.
32
33 shp and color has the same usage and meaning than in other shape cre‐
34 ation functions (see dtk_create_shape(3)):
35
36 * shp can be used to modify a previously created shape. If it is non-
37 null, the handle will be used to modify the shape referenced by shp:
38 no new shape is created and the returned value is ensured to be shp
39 in case of success, NULL otherwise. If shp is NULL, the function
40 will attempt to create a new shape.
41
42 * color should point to a 4 float array containing a normalized RGBA
43 value (i.e. each component is between 0.0 and 1.0).
44
46 In case of success the function returns the handle to the newly created
47 or modified shape. If the shp argument is non-null, the handle returned
48 is the same value. In case of error, NULL is returned.
49
51 dtk_load_font(3), dtk_create_shape(3)
52
53
54
55
56EPFL 2010 DTK_CREATE_STRING(3)