1 <erldriver name="gd1_drv" abbrev="" default_async_calls="0"
2 default_debug_verbose="0">
4 <summary>An Erlang driver interface for libgd version 1</summary>
6 <cpy>Copyright (c) 2002, Scott Lystig Fritchie. All rights reserved.</cpy>
7 <cpy>See the file "LICENSE" at the top of the source distribution for</cpy>
8 <cpy>full license terms.</cpy>
12 <verbatim place="top_cpp_stuff">
14 #include <string.h>
18 #include <my-gd1.h>
21 <func name="gdImageCreate">
22 <arg name="sx" ctype="int"/>
23 <arg name="sy" ctype="int"/>
24 <return ctype="gdImagePtr" name="ret_gdImagePtr"
25 valmap_name="imageptr" valmap_type="start"
26 expect="!= NULL" expect_errval="0"/>
29 <func name="gdImageCreateFromJpeg" cname="my_gdImageCreateFromJpeg">
30 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
31 <arg name="status" ctype="int" noerlcall="1" argtype="out"/>
32 <return ctype="gdImagePtr" name="ret_gdImagePtr"
33 valmap_name="imageptr" valmap_type="start"
34 expect="!= NULL" expect_errval="c->o.status"/>
37 <func name="gdImageCreateFromPng" cname="my_gdImageCreateFromPng">
38 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
39 <arg name="status" ctype="int" noerlcall="1" argtype="out"/>
40 <return ctype="gdImagePtr" name="ret_gdImagePtr"
41 valmap_name="imageptr" valmap_type="start"
42 expect="!= NULL" expect_errval="c->o.status"/>
45 <!-- XXX We won't support gdImageCreateFromPngSource() -->
47 <func name="gdImageCreateFromGd" cname="my_gdImageCreateFromGd">
48 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
49 <arg name="status" ctype="int" noerlcall="1" argtype="out"/>
50 <return ctype="gdImagePtr" name="ret_gdImagePtr"
51 valmap_name="imageptr" valmap_type="start"
52 expect="!= NULL" expect_errval="c->o.status"/>
55 <func name="gdImageCreateFromGd2" cname="my_gdImageCreateFromGd2">
56 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
57 <arg name="status" ctype="int" noerlcall="1" argtype="out"/>
58 <return ctype="gdImagePtr" name="ret_gdImagePtr"
59 valmap_name="imageptr" valmap_type="start"
60 expect="!= NULL" expect_errval="c->o.status"/>
63 <func name="gdImageCreateFromGd2Part" cname="my_gdImageCreateFromGd2Part">
64 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
65 <arg name="srcX" ctype="int"/>
66 <arg name="srcY" ctype="int"/>
67 <arg name="h" ctype="int"/>
68 <arg name="w" ctype="int"/>
69 <arg name="status" ctype="int" noerlcall="1" argtype="out"/>
70 <return ctype="gdImagePtr" name="ret_gdImagePtr"
71 valmap_name="imageptr" valmap_type="start"
72 expect="!= NULL" expect_errval="c->o.status"/>
75 <func name="gdImageCreateFromXpm" cname="my_gdImageCreateFromXpm">
76 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
77 <arg name="status" ctype="int" noerlcall="1" argtype="out"/>
78 <return ctype="gdImagePtr" name="ret_gdImagePtr"
79 valmap_name="imageptr" valmap_type="start"
80 expect="!= NULL" expect_errval="c->o.status"/>
83 <func name="gdImageColorAllocate">
84 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
85 <arg name="r" ctype="int"/>
86 <arg name="g" ctype="int"/>
87 <arg name="b" ctype="int"/>
88 <return ctype="int" name="ret_int"
89 expect=">= 0" expect_errval="-1"/>
92 <func name="gdImageColorClosest">
93 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
94 <arg name="r" ctype="int"/>
95 <arg name="g" ctype="int"/>
96 <arg name="b" ctype="int"/>
97 <return ctype="int" name="ret_int"
98 expect=">= 0" expect_errval="-1"/>
101 <func name="gdImageColorExact">
102 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
103 <arg name="r" ctype="int"/>
104 <arg name="g" ctype="int"/>
105 <arg name="b" ctype="int"/>
106 <return ctype="int" name="ret_int"
107 expect=">= 0" expect_errval="-1"/>
110 <func name="gdImageColorResolve">
111 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
112 <arg name="r" ctype="int"/>
113 <arg name="g" ctype="int"/>
114 <arg name="b" ctype="int"/>
115 <return ctype="int" name="ret_int"
116 expect=">= 0" expect_errval="-1"/>
119 <func name="gdImageColorsTotal">
120 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
121 <return ctype="int" name="ret_int"
122 expect=">= 0" expect_errval="-1"/>
125 <func name="gdImageGetInterlaced">
126 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
127 <return ctype="int" name="ret_int"
128 expect=">= 0" expect_errval="-1"/>
131 <func name="gdImageGetTransparent">
132 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
133 <return ctype="int" name="ret_int"
134 expect=">= 0" expect_errval="-1"/>
137 <func name="gdImageColorDeallocate">
138 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
139 <arg name="color" ctype="int"/>
140 <return ctype="void"/>
143 <func name="gdImageColorTransparent">
144 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
145 <arg name="color" ctype="int"/>
146 <return ctype="void"/>
149 <func name="gdImageSetPixel">
150 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
151 <arg name="x" ctype="int"/>
152 <arg name="y" ctype="int"/>
153 <arg name="color" ctype="int"/>
154 <return ctype="void"/>
157 <func name="gdImageLine">
158 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
159 <arg name="x1" ctype="int"/>
160 <arg name="y1" ctype="int"/>
161 <arg name="x2" ctype="int"/>
162 <arg name="y2" ctype="int"/>
163 <arg name="color" ctype="int"/>
164 <return ctype="void"/>
167 <!-- We will not support gdImageDashedLine(): GD has deprecated it! -->
169 <func name="gdImagePolygon" cname="my_gdImagePolygon">
170 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
171 <arg name="points" ctype="char *" ser_type="binary" binlen2stash="0"/>
172 <arg name="pointsTotal" ctype="int"/>
173 <arg name="color" ctype="int"/>
174 <return ctype="int" name="ret_int"
175 expect="== 0" expect_errval="-1"/>
176 <hack place="post-deserialize" type="verbatim">
177 if (c->i.pointsTotal != (c->i.__stash[0] / (sizeof(long) * 2))) {
183 <func name="gdImageFilledPolygon" cname="my_gdImageFilledPolygon">
184 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
185 <arg name="points" ctype="char *" ser_type="binary" binlen2stash="0"/>
186 <arg name="pointsTotal" ctype="int"/>
187 <arg name="color" ctype="int"/>
188 <return ctype="int" name="ret_int"
189 expect="== 0" expect_errval="-1"/>
192 <func name="gdImageRectangle">
193 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
194 <arg name="x1" ctype="int"/>
195 <arg name="y1" ctype="int"/>
196 <arg name="x2" ctype="int"/>
197 <arg name="y2" ctype="int"/>
198 <arg name="color" ctype="int"/>
199 <return ctype="void"/>
202 <func name="gdImageFilledRectangle">
203 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
204 <arg name="x1" ctype="int"/>
205 <arg name="y1" ctype="int"/>
206 <arg name="x2" ctype="int"/>
207 <arg name="y2" ctype="int"/>
208 <arg name="color" ctype="int"/>
209 <return ctype="void"/>
212 <func name="gdImageArc">
213 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
214 <arg name="cx" ctype="int"/>
215 <arg name="cy" ctype="int"/>
216 <arg name="w" ctype="int"/>
217 <arg name="h" ctype="int"/>
218 <arg name="s" ctype="int"/>
219 <arg name="e" ctype="int"/>
220 <arg name="color" ctype="int"/>
221 <return ctype="void"/>
224 <func name="gdImageFillToBorder">
225 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
226 <arg name="x" ctype="int"/>
227 <arg name="y" ctype="int"/>
228 <arg name="border" ctype="int"/>
229 <arg name="color" ctype="int"/>
230 <return ctype="void"/>
233 <func name="gdImageFill">
234 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
235 <arg name="x" ctype="int"/>
236 <arg name="y" ctype="int"/>
237 <arg name="color" ctype="int"/>
238 <return ctype="void"/>
241 <func name="gdImageSetBrush">
242 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
243 <arg name="brush" ctype="gdImagePtr" valmap_name="imageptr"/>
244 <return ctype="void"/>
247 <func name="gdImageSetTile">
248 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
249 <arg name="brush" ctype="gdImagePtr" valmap_name="imageptr"/>
250 <return ctype="void"/>
253 <func name="gdImageSetStyle" cname="my_gdImageSetStyle">
254 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
255 <arg name="style" ctype="char *" ser_type="binary" binlen2stash="0"/>
256 <arg name="styleLength" ctype="int"/>
257 <return ctype="int" name="ret_int"
258 expect="== 0" expect_errval="-1"/>
261 <func name="gdImageGetPixel">
262 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
263 <arg name="x" ctype="int"/>
264 <arg name="y" ctype="int"/>
265 <return ctype="int" name="ret_int"/>
268 <func name="gdImageRed">
269 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
270 <arg name="color" ctype="int"/>
271 <return ctype="int" name="ret_int"/>
274 <func name="gdImageGreen">
275 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
276 <arg name="color" ctype="int"/>
277 <return ctype="int" name="ret_int"/>
280 <func name="gdImageBlue">
281 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
282 <arg name="color" ctype="int"/>
283 <return ctype="int" name="ret_int"/>
286 <func name="gdImageBoundsSafe">
287 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
288 <arg name="x" ctype="int"/>
289 <arg name="y" ctype="int"/>
290 <return ctype="int" name="ret_int"/>
293 <func name="gdImageSX">
294 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
295 <return ctype="int" name="ret_int"/>
298 <func name="gdImageSY">
299 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
300 <return ctype="int" name="ret_int"/>
303 <func name="gdImagePng" cname="my_gdImagePng">
304 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
305 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
306 <return ctype="int" name="ret_int"
307 expect="== 0" expect_errval="c->o.ret_int"/>
310 <func name="gdImagePngPtr">
311 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
312 <arg name="size" ctype="int" noerlcall="1" argtype="out"/>
313 <return ctype="void *" name="ret_void_p"
314 etype="binary" offset="0" length="c->o.size"
315 expect="!= NULL" expect_errval="-1"/>
316 <hack place="ready_async-post-reply" type="verbatim">
317 if (c->o.ret_void_p != NULL) gdFree(c->o.ret_void_p);
321 <func name="gdImagePngPtr_QQQ_deleteme" cname="gdImagePngPtr">
322 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
323 <arg name="size" ctype="int" noerlcall="1" argtype="out"/>
324 <return ctype="void *" name="ret_void_p"
325 xreturn="void_p_and_size"
326 expect="!= NULL" expect_errval="-1"/>
327 <hack place="ready_async-post-reply" type="verbatim">
328 if (c->o.ret_void_p != NULL) gdFree(c->o.ret_void_p);
332 <func name="gdImageJpeg" cname="my_gdImageJpeg">
333 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
334 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
335 <arg name="quality" ctype="int"/>
336 <return ctype="int" name="ret_int"
337 expect="== 0" expect_errval="c->o.ret_int"/>
340 <func name="gdImageJpegPtr">
341 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
342 <arg name="size" ctype="int" noerlcall="1" argtype="out"/>
343 <arg name="quality" ctype="int"/>
344 <return ctype="void *" name="ret_void_p"
345 etype="binary" offset="0" length="c->o.size"
346 expect="!= NULL" expect_errval="-1"/>
347 <hack place="ready_async-post-reply" type="verbatim">
348 if (c->o.ret_void_p != NULL) gdFree(c->o.ret_void_p);
352 <func name="gdImageWBMP" cname="my_gdImageWBMP">
353 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
354 <arg name="fg" ctype="int"/>
355 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
356 <return ctype="int" name="ret_int"
357 expect="== 0" expect_errval="c->o.ret_int"/>
360 <func name="gdImageWBMPPtr">
361 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
362 <arg name="size" ctype="int" noerlcall="1" argtype="out"/>
363 <arg name="fg" ctype="int"/>
364 <return ctype="void *" name="ret_void_p"
365 etype="binary" offset="0" length="c->o.size"
366 expect="!= NULL" expect_errval="-1"/>
367 <hack place="ready_async-post-reply" type="verbatim">
368 if (c->o.ret_void_p != NULL) gdFree(c->o.ret_void_p);
372 <func name="gdImageGd" cname="my_gdImageGd">
373 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
374 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
375 <return ctype="int" name="ret_int"
376 expect="== 0" expect_errval="c->o.ret_int"/>
379 <func name="gdImageGdPtr">
380 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
381 <arg name="size" ctype="int" noerlcall="1" argtype="out"/>
382 <return ctype="void *" name="ret_void_p"
383 etype="binary" offset="0" length="c->o.size"
384 expect="!= NULL" expect_errval="-1"/>
385 <hack place="ready_async-post-reply" type="verbatim">
386 if (c->o.ret_void_p != NULL) gdFree(c->o.ret_void_p);
390 <func name="gdImageGd2" cname="my_gdImageGd2">
391 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
392 <arg name="filename" ctype="char *" ser_type="binary" nulterm="1"/>
393 <arg name="chunkSize" ctype="int"/>
394 <arg name="fmt" ctype="int"/>
395 <return ctype="int" name="ret_int"
396 expect="== 0" expect_errval="c->o.ret_int"/>
399 <func name="gdImageGd2Ptr">
400 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
401 <arg name="chunkSize" ctype="int"/>
402 <arg name="fmt" ctype="int"/>
403 <arg name="size" ctype="int" noerlcall="1" argtype="out"/>
404 <return ctype="void *" name="ret_void_p"
405 etype="binary" offset="0" length="c->o.size"
406 expect="!= NULL" expect_errval="-1"/>
407 <hack place="ready_async-post-reply" type="verbatim">
408 if (c->o.ret_void_p != NULL) gdFree(c->o.ret_void_p);
413 <arg name="path" ctype="char *" ser_type="binary" nulterm="1"/>
414 <arg name="fmode" ctype="char *" ser_type="binary" nulterm="1"/>
415 <return ctype="FILE *" name="filep"
416 valmap_name="FILE_P" valmap_type="start"
417 expect="!= NULL" expect_errval="errno"/>
421 <arg name="filep" ctype="FILE *" valmap_name="FILE_P"/>
422 <return ctype="int" name="ret_int"
423 valmap_name="FILE_P" valmap_type="stop"
424 expect="== 0" expect_errval="errno"/>
428 <func name="gdImagePngFILE" cname="gdImagePng">
429 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
430 <arg name="outFile" ctype="FILE *" valmap_name="FILE_P"/>
431 <return ctype="void"/>
434 <func name="gdImageJpegFILE" cname="gdImageJpeg">
435 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
436 <arg name="outFile" ctype="FILE *" valmap_name="FILE_P"/>
437 <arg name="quality" ctype="int"/>
438 <return ctype="void"/>
441 <func name="gdImageDestroy">
442 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
443 <return ctype="void" valmap_name="imageptr" valmap_type="stop"/>
446 <func name="getFontPtr" cname="my_GetFontPtr">
447 <arg name="font_idx" ctype="int"/>
448 <return ctype="gdFontPtr" name="ret_gdFontPtr"
449 valmap_name="fontptr" valmap_type="start"
450 expect="!= NULL" expect_errval="0"/>
453 <func name="gdImageChar">
454 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
455 <arg name="font" ctype="gdFontPtr" valmap_name="fontptr"/>
456 <arg name="x" ctype="int"/>
457 <arg name="y" ctype="int"/>
458 <arg name="c" ctype="int"/>
459 <arg name="color" ctype="int"/>
460 <return ctype="void"/>
463 <func name="gdImageCharUp">
464 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
465 <arg name="font" ctype="gdFontPtr" valmap_name="fontptr"/>
466 <arg name="x" ctype="int"/>
467 <arg name="y" ctype="int"/>
468 <arg name="c" ctype="int"/>
469 <arg name="color" ctype="int"/>
470 <return ctype="void"/>
473 <func name="gdImageString">
474 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
475 <arg name="font" ctype="gdFontPtr" valmap_name="fontptr"/>
476 <arg name="x" ctype="int"/>
477 <arg name="y" ctype="int"/>
478 <arg name="string" ctype="unsigned char *" ser_type="binary" nulterm="1"/>
479 <arg name="color" ctype="int"/>
480 <return ctype="void"/>
483 <!-- XXX gdImageString16() and gdImageStringUp16() not supported
484 'cause I don't know how to test them adequately. -->
486 <func name="gdImageStringUp">
487 <arg name="im" ctype="gdImagePtr" valmap_name="imageptr"/>
488 <arg name="font" ctype="gdFontPtr" valmap_name="fontptr"/>
489 <arg name="x" ctype="int"/>
490 <arg name="y" ctype="int"/>
491 <arg name="string" ctype="unsigned char *" ser_type="binary" nulterm="1"/>
492 <arg name="color" ctype="int"/>
493 <return ctype="void"/>
496 <!-- XXX The True-Type font functions, e.g. gdImageStringFT(), are not
497 supported because 1. I don't have the fonts installed on my machine,
498 and 2. EDTK cannot currently pass floating-point values in
499 either direction. -->
501 <func name="gdImageCopy">
502 <arg name="dst" ctype="gdImagePtr" valmap_name="imageptr"/>
503 <arg name="src" ctype="gdImagePtr" valmap_name="imageptr"/>
504 <arg name="dstX" ctype="int"/>
505 <arg name="dstY" ctype="int"/>
506 <arg name="srcX" ctype="int"/>
507 <arg name="srcY" ctype="int"/>
508 <arg name="w" ctype="int"/>
509 <arg name="h" ctype="int"/>
510 <return ctype="void"/>
513 <func name="gdImageCopyResized">
514 <arg name="dst" ctype="gdImagePtr" valmap_name="imageptr"/>
515 <arg name="src" ctype="gdImagePtr" valmap_name="imageptr"/>
516 <arg name="dstX" ctype="int"/>
517 <arg name="dstY" ctype="int"/>
518 <arg name="srcX" ctype="int"/>
519 <arg name="srcY" ctype="int"/>
520 <arg name="destW" ctype="int"/>
521 <arg name="destH" ctype="int"/>
522 <arg name="srcW" ctype="int"/>
523 <arg name="srcH" ctype="int"/>
524 <return ctype="void"/>
527 <func name="gdImageCopyMerge">
528 <arg name="dst" ctype="gdImagePtr" valmap_name="imageptr"/>
529 <arg name="src" ctype="gdImagePtr" valmap_name="imageptr"/>
530 <arg name="dstX" ctype="int"/>
531 <arg name="dstY" ctype="int"/>
532 <arg name="srcX" ctype="int"/>
533 <arg name="srcY" ctype="int"/>
534 <arg name="w" ctype="int"/>
535 <arg name="h" ctype="int"/>
536 <arg name="pct" ctype="int"/>
537 <return ctype="void"/>
540 <func name="gdImageCopyMergeGray">
541 <arg name="dst" ctype="gdImagePtr" valmap_name="imageptr"/>
542 <arg name="src" ctype="gdImagePtr" valmap_name="imageptr"/>
543 <arg name="dstX" ctype="int"/>
544 <arg name="dstY" ctype="int"/>
545 <arg name="srcX" ctype="int"/>
546 <arg name="srcY" ctype="int"/>
547 <arg name="w" ctype="int"/>
548 <arg name="h" ctype="int"/>
549 <arg name="pct" ctype="int"/>
550 <return ctype="void"/>
553 <func name="gdImagePaletteCopy">
554 <arg name="dst" ctype="gdImagePtr" valmap_name="imageptr"/>
555 <arg name="src" ctype="gdImagePtr" valmap_name="imageptr"/>
556 <return ctype="void"/>
559 <func name="gdImageCompare">
560 <arg name="dst" ctype="gdImagePtr" valmap_name="imageptr"/>
561 <arg name="src" ctype="gdImagePtr" valmap_name="imageptr"/>
562 <return ctype="int" name="ret_int"/>
565 <func name="gdImageInterlace">
566 <arg name="dst" ctype="gdImagePtr" valmap_name="imageptr"/>
567 <arg name="interlace" ctype="int"/>
568 <return ctype="void"/>
571 <valmap name="imageptr" ctype="gdImagePtr" maxsize="32" initial_val="NULL"
572 cleanup_func="gdImageDestroy"/>
574 <valmap name="FILE_P" ctype="FILE *" maxsize="8" initial_val="NULL"
575 cleanup_func="fclose"/>
577 <!-- for fontptr valmap, _no_ cleanup_func! -->
578 <valmap name="fontptr" ctype="gdFontPtr" maxsize="32" initial_val="NULL"/>
580 <xtra_return name="void_p_and_size">
582 <xtra_val etype="binary" valtype="static_buf" val="c->o.ret_void_p"
583 offset="0" length="c->o.size"/>
586 <xtra_val etype="integer" val="-1"/>
590 <const name="MAX_POLYGON_VERTICES" value="512" comment="Max vertices/polygon"/>
591 <const name="MAX_STYLE_LENGTH" value="512" comment="Max ints for style length"/>
593 <const name="FONT_TINY" value="1" comment="gdFontTiny"/>
594 <const name="FONT_SMALL" value="2" comment="gdFontSmall"/>
595 <const name="FONT_MEDIUMBOLD" value="3" comment="gdFontMediumBold"/>
596 <const name="FONT_LARGE" value="4" comment="gdFontLarge"/>
597 <const name="FONT_GIANT" value="5" comment="gdFontGiant"/>
599 <verbatim place="end-hrl">
602 %%% Useful constants from gd.h
605 -define(GD2_VERS, 1).
606 -define(GD2_ID, "gd2").
607 -define(GD2_FMT_RAW, 1).
608 -define(GD2_FMT_COMPRESSED, 2).
610 -define(GD2_gdMaxColors, 256).
612 -define(GD2_gdStyled, -2).
613 -define(GD2_gdBrushed, -3).
614 -define(GD2_gdStyledBrushed, -4).
615 -define(GD2_gdTiled, -5).
617 -define(GD_CMP_IMAGE, 1).
618 -define(GD_CMP_NUM_COLORS, 2).
619 -define(GD_CMP_COLOR, 4).
620 -define(GD_CMP_SIZE_X, 8).
621 -define(GD_CMP_SIZE_Y, 16).
622 -define(GD_CMP_TRANSPARENT, 32).
623 -define(GD_CMP_BACKGROUND, 64).
624 -define(GD_CMP_INTERLACE, 128).
629 -export([make_vertex_array/1, make_style_array/1]).
632 make_vertex_array(L) ->
633 make_vertex_array(L, []).
634 make_vertex_array([], Acc) ->
636 if L > ?_MAX_POLYGON_VERTICES -> badarg;
637 true -> {L, lists:reverse(Acc)}
639 make_vertex_array([{X, Y}|Vs], Acc) ->
640 make_vertex_array(Vs, [<<X:32/signed-integer, Y:32/signed-integer>>|Acc]);
641 make_vertex_array([X, Y|Vs], Acc) when integer(X), integer(Y) ->
642 make_vertex_array(Vs, [<<X:32/signed-integer, Y:32/signed-integer>>|Acc]).
644 make_style_array(L) ->
645 [<<X:32/signed-integer>> || X <- L].