33#define IMGPTR(O) (O->internalRep.otherValuePtr)
38typedef int (
GdDataFunction)(Tcl_Interp *interp,
int argc, Tcl_Obj *CONST objv[]);
39typedef int (
GdImgFunction)(Tcl_Interp *interp, gdImagePtr gdImg,
int argc,
const int args[]);
75 {
"createTrueColor",
tclGdCreateCmd, 2, 2, 0, 0, 2,
"width height"},
95 {
"writeGD",
tclGdWriteCmd, 2, 2, 0, 1, 3,
"gdhandle filehandle"},
97 {
"writeGD2",
tclGdWriteCmd, 2, 2, 0, 1, 3,
"gdhandle filehandle"},
100 {
"writeGIF",
tclGdWriteCmd, 2, 2, 0, 1, 3,
"gdhandle filehandle"},
103 {
"writeJPEG",
tclGdWriteCmd, 2, 2, 0, 1, 3,
"gdhandle filehandle"},
106 {
"writePNG",
tclGdWriteCmd, 2, 2, 0, 1, 3,
"gdhandle filehandle"},
108 {
"writeWBMP",
tclGdWriteCmd, 2, 2, 0, 1, 3,
"gdhandle filehandle"},
110 {
"writeXBM",
tclGdWriteCmd, 2, 2, 0, 1, 3,
"gdhandle filehandle"},
117 {
"brush",
tclGdBrushCmd, 2, 2, 0, 2, 0,
"gdhandle brushhandle"},
118 {
"style",
tclGdStyleCmd, 2, 999, 0, 1, 0,
"gdhandle color..."},
119 {
"tile",
tclGdTileCmd, 2, 2, 0, 2, 0,
"gdhandle tilehandle"},
120 {
"set",
tclGdSetCmd, 4, 4, 0, 1, 0,
"gdhandle color x y"},
121 {
"line",
tclGdLineCmd, 6, 6, 0, 1, 0,
"gdhandle color x1 y1 x2 y2"},
122 {
"rectangle",
tclGdRectCmd, 6, 6, 0, 1, 0,
"gdhandle color x1 y1 x2 y2"},
123 {
"fillrectangle",
tclGdRectCmd, 6, 6, 0, 1, 0,
"gdhandle color x1 y1 x2 y2"},
124 {
"arc",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
125 {
"fillarc",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
126 {
"openarc",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
127 {
"chord",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
128 {
"fillchord",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
129 {
"openchord",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
130 {
"pie",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
131 {
"fillpie",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
132 {
"openpie",
tclGdArcCmd, 8, 8, 0, 1, 0,
"gdhandle color cx cy width height start end"},
133 {
"polygon",
tclGdPolygonCmd,2, 999, 0, 1, 0,
"gdhandle color x1 y1 x2 y2 x3 y3 ..."},
134 {
"fillpolygon",
tclGdPolygonCmd,3, 999, 0, 1, 0,
"gdhandle color x1 y1 x2 y2 x3 y3 ..."},
135 {
"fill",
tclGdFillCmd, 4, 5, 0, 1, 0,
"gdhandle color x y ?bordercolor?"},
140 {
"text",
tclGdTextCmd, 8, 8, 0, 0, 4,
"gdhandle color fontname size angle x y string"},
141 {
"copy",
tclGdCopyCmd, 8, 10, 0, 2, 0,
"desthandle srchandle destx desty srcx srcy destw desth ?srcw srch?"},
142 {
"get",
tclGdGetCmd, 3, 3, 0, 1, 0,
"gdhandle x y"},
161 int nlist, retval = TCL_OK;
163 char *firsttag, *secondtag;
166 if (Tcl_GetIntFromObj(interp, obj,
color) == TCL_OK)
169 Tcl_ResetResult(interp);
170 if (Tcl_ListObjGetElements(interp, obj, &nlist, &theList) != TCL_OK)
172 if (nlist < 1 || nlist > 2)
175 firsttag = Tcl_GetString(theList[0]);
176 switch (firsttag[0]) {
180 secondtag = Tcl_GetString(theList[1]);
181 if (secondtag[0] ==
's') {
182 *
color = gdStyledBrushed;
192 secondtag = Tcl_GetString(theList[1]);
193 if (secondtag[0] ==
'b') {
194 *
color = gdStyledBrushed;
210 if (retval == TCL_ERROR)
211 Tcl_SetResult(interp,
"Malformed special color value", TCL_STATIC);
341static int gdCmd(ClientData clientData, Tcl_Interp *interp,
int argc,
342 Tcl_Obj *CONST objv[]) {
347 Tcl_SetResult(interp,
"wrong # args: should be \"gd option ...\"", TCL_STATIC);
353 if (strcmp(
subcmdVec[subi].
cmd, Tcl_GetString(objv[1])) == 0) {
365 Tcl_SetResult(interp,
"GD handle(s) not specified", TCL_STATIC);
379 const char *
fname = Tcl_GetString(objv[
subcmdVec[subi].unsafearg]);
380 if (!Tcl_IsChannelExisting(
fname)) {
381 Tcl_AppendResult(interp,
"Access to ",
fname,
" not allowed in safe interpreter", TCL_STATIC);
386 return (*
subcmdVec[subi].f) (interp, argc, objv);
391 Tcl_AppendResult(interp,
"bad option \"", Tcl_GetString(objv[1]),
"\": should be ", 0);
393 Tcl_AppendResult(interp, (subi > 0 ?
", " :
""),
subcmdVec[subi].
cmd, 0);
401 gdImagePtr im =
NULL;
406 cmd = Tcl_GetString(objv[1]);
407 if (strcmp(
cmd,
"create") == 0) {
409 if (Tcl_GetIntFromObj(interp, objv[2], &w) != TCL_OK)
411 if (Tcl_GetIntFromObj(interp, objv[3], &h) != TCL_OK)
414 if (argc == 5 && Tcl_GetBooleanFromObj(interp, objv[4], &trueColor) == TCL_ERROR)
417 im = gdImageCreateTrueColor(w, h);
419 im = gdImageCreate(w, h);
422 snprintf(buf,
sizeof(buf),
"GD unable to allocate %d X %d image", w, h);
423 Tcl_SetResult(interp, buf, TCL_VOLATILE);
426 }
else if (strcmp(
cmd,
"createTrueColor") == 0) {
427 if (Tcl_GetIntFromObj(interp, objv[2], &w) != TCL_OK)
429 if (Tcl_GetIntFromObj(interp, objv[3], &h) != TCL_OK)
431 im = gdImageCreateTrueColor(w, h);
434 snprintf(buf,
sizeof(buf),
"GD unable to allocate %d X %d image", w, h);
435 Tcl_SetResult(interp, buf, TCL_VOLATILE);
439 char *arg2 = Tcl_GetString(objv[2]);
441 FILE *filePtr =
NULL;
443 ClientData clientdata;
444 if (Tcl_GetOpenFile(interp, arg2, 0, 1, &clientdata) == TCL_OK) {
445 filePtr = (FILE *) clientdata;
448 if (filePtr ==
NULL) {
452 if ((filePtr = fopen(arg2,
"rb")) ==
NULL) {
456 Tcl_ResetResult(interp);
460 if (strcmp(&
cmd[10],
"GD") == 0) {
461 im = gdImageCreateFromGd(filePtr);
463 }
else if (strcmp(&
cmd[10],
"GD2") == 0) {
464 im = gdImageCreateFromGd2(filePtr);
467 }
else if (strcmp(&
cmd[10],
"GIF") == 0) {
468 im = gdImageCreateFromGif(filePtr);
471 }
else if (strcmp(&
cmd[10],
"JPEG") == 0) {
472 im = gdImageCreateFromJpeg(filePtr);
475 }
else if (strcmp(&
cmd[10],
"PNG") == 0) {
476 im = gdImageCreateFromPng(filePtr);
478 }
else if (strcmp(&
cmd[10],
"WBMP") == 0) {
479 im = gdImageCreateFromWBMP(filePtr);
481 }
else if (strcmp(&
cmd[10],
"XBM") == 0) {
482 im = gdImageCreateFromXbm(filePtr);
485 Tcl_AppendResult(interp,
cmd + 10,
"unrecognizable format requested",
NULL);
495 Tcl_AppendResult(interp,
"GD unable to read image file '", arg2,
"` as ",
cmd + 10,
NULL);
500 result = Tcl_NewObj();
503 result->bytes =
NULL;
504 Tcl_SetObjResult(interp, result);
531 cmd = Tcl_GetString(objv[1]);
532 if (
cmd[5] ==
'J' ||
cmd[5] ==
'W') {
538 Tcl_SetResult(interp,
"WBMP saving requires the foreground pixel value", TCL_STATIC);
541 }
else if (Tcl_GetIntFromObj(interp, objv[4], &arg4) != TCL_OK)
544 if (
cmd[5] ==
'J' && argc > 4 && (arg4 > 100 || arg4 < 1)) {
545 Tcl_SetObjResult(interp, objv[4]);
546 Tcl_AppendResult(interp,
": JPEG image quality, if specified, must be an integer from 1 to 100, or -1 for default",
NULL);
553 fname = Tcl_GetString(objv[3]);
557 FILE *filePtr =
NULL;
559 ClientData clientdata;
560 if (Tcl_GetOpenFile(interp,
fname, 1, 1, &clientdata)
562 filePtr = (FILE *) clientdata;
565 if (filePtr ==
NULL) {
570 if ((filePtr = fopen(
fname,
"wb")) ==
NULL) {
571 Tcl_AppendResult(interp,
"could not open :",
fname,
"': ", strerror(errno),
NULL);
574 Tcl_ResetResult(interp);
586 if (strcmp(&
cmd[5],
"GD") == 0) {
587 gdImageGd(im, filePtr);
588 }
else if (strcmp(&
cmd[5],
"GD2") == 0) {
590#define GD2_CHUNKSIZE 128
591#define GD2_COMPRESSED 2
592 gdImageGd2(im, filePtr, GD2_CHUNKSIZE, GD2_COMPRESSED);
595 }
else if (strcmp(&
cmd[5],
"GIF") == 0) {
596 gdImageGif(im, filePtr);
599 }
else if (strcmp(&
cmd[5],
"JPEG") == 0) {
600#define JPEG_QUALITY -1
601 gdImageJpeg(im, filePtr, JPEG_QUALITY);
604 }
else if (strcmp(&
cmd[5],
"PNG") == 0) {
605 gdImagePng(im, filePtr);
607 }
else if (strcmp(&
cmd[5],
"WBMP") == 0) {
610 int foreground = gdImageColorClosest(im, 0, 0, 0);
611 gdImageWBMP(im, foreground, filePtr);
634 if (Tcl_GetBooleanFromObj(interp, objv[3], &on_off) != TCL_OK)
638 gdImageInterlace(im, on_off);
641 on_off = gdImageGetInterlaced(im);
643 Tcl_SetObjResult(interp, Tcl_NewBooleanObj(on_off));
651 int subi, nsub, i, args[3];
656 for (subi = 0; subi < nsub; subi++) {
671 for (i = 0; i < argc - 4; i++) {
672 if (Tcl_GetIntFromObj(interp, objv[i + 4], &args[i]) != TCL_OK) {
675 if (args[i] < -255 || args[i] > 255) {
676 Tcl_SetResult(interp,
"argument out of range 0-255", TCL_STATIC);
690 Tcl_AppendResult(interp,
"bad option \"",
691 Tcl_GetString(objv[2]),
"\": ", 0);
693 Tcl_AppendResult(interp,
"wrong # args: ", 0);
695 Tcl_AppendResult(interp,
"should be ", 0);
696 for (subi = 0; subi < nsub; subi++)
697 Tcl_AppendResult(interp, subi > 0 ?
", " :
"",
colorCmdVec[subi].
cmd, 0);
709 color = gdImageColorAllocate(im, args[0], args[1], args[2]);
710 Tcl_SetObjResult(interp, Tcl_NewIntObj(
color));
721 color = gdImageColorExact(im, args[0], args[1], args[2]);
722 Tcl_SetObjResult(interp, Tcl_NewIntObj(
color));
733 color = gdImageColorClosest(im, args[0], args[1], args[2]);
734 Tcl_SetObjResult(interp, Tcl_NewIntObj(
color));
745 color = gdImageColorResolve(im, args[0], args[1], args[2]);
746 Tcl_SetObjResult(interp, Tcl_NewIntObj(
color));
756 gdImageColorDeallocate(im, args[0]);
767 gdImageColorTransparent(im,
color);
769 color = gdImageGetTransparent(im);
771 Tcl_SetObjResult(interp, Tcl_NewIntObj(
color));
779 Tcl_Obj *tuple[4], *result;
781 ncolors = gdImageColorsTotal(im);
785 if (i >= ncolors || im->open[i]) {
786 Tcl_SetResult(interp,
"No such color", TCL_STATIC);
789 tuple[0] = Tcl_NewIntObj(i);
790 tuple[1] = Tcl_NewIntObj(gdImageRed(im,i));
791 tuple[2] = Tcl_NewIntObj(gdImageGreen(im,i));
792 tuple[3] = Tcl_NewIntObj(gdImageBlue(im,i));
793 Tcl_SetObjResult(interp, Tcl_NewListObj(4, tuple));
795 result = Tcl_NewListObj(0,
NULL);
796 for (i = 0; i < ncolors; i++) {
799 tuple[0] = Tcl_NewIntObj(i);
800 tuple[1] = Tcl_NewIntObj(gdImageRed(im,i));
801 tuple[2] = Tcl_NewIntObj(gdImageGreen(im,i));
802 tuple[3] = Tcl_NewIntObj(gdImageBlue(im,i));
803 Tcl_ListObjAppendElement(
NULL, result,
804 Tcl_NewListObj(4, tuple));
806 Tcl_SetObjResult(interp, result);
818 gdImagePtr im, imbrush;
822 imbrush =
IMGPTR(objv[3]);
825 gdImageSetBrush(im, imbrush);
843 gdImageSetTile(im, tile);
853 int ncolor, *colors =
NULL, i;
854 Tcl_Obj **colorObjv = (Tcl_Obj **) (&objv[3]);
864 if (Tcl_ListObjGetElements(interp, objv[3], &ncolor, &colorObjv) != TCL_OK)
867 colors = (
int *) Tcl_Alloc(ncolor *
sizeof(
int));
869 for (i = 0; i < ncolor; i++)
870 if (Tcl_GetIntFromObj(interp, colorObjv[i], &colors[i]) != TCL_OK) {
876 if (retval == TCL_OK)
877 gdImageSetStyle(im, colors, ncolor);
881 Tcl_Free((
char *) colors);
900 if (Tcl_GetIntFromObj(interp, objv[4], &x) != TCL_OK)
902 if (Tcl_GetIntFromObj(interp, objv[5], &y) != TCL_OK)
906 gdImageSetPixel(im, x, y,
color);
917 int color, x1, y1, x2, y2;
925 if (Tcl_GetIntFromObj(interp, objv[4], &x1) != TCL_OK)
927 if (Tcl_GetIntFromObj(interp, objv[5], &y1) != TCL_OK)
929 if (Tcl_GetIntFromObj(interp, objv[6], &x2) != TCL_OK)
931 if (Tcl_GetIntFromObj(interp, objv[7], &y2) != TCL_OK)
935 gdImageLine(im, x1, y1, x2, y2,
color);
946 int color, x1, y1, x2, y2;
955 if (Tcl_GetIntFromObj(interp, objv[4], &x1) != TCL_OK)
957 if (Tcl_GetIntFromObj(interp, objv[5], &y1) != TCL_OK)
959 if (Tcl_GetIntFromObj(interp, objv[6], &x2) != TCL_OK)
961 if (Tcl_GetIntFromObj(interp, objv[7], &y2) != TCL_OK)
965 cmd = Tcl_GetString(objv[1]);
967 gdImageRectangle(im, x1, y1, x2, y2,
color);
969 gdImageFilledRectangle(im, x1, y1, x2, y2,
color);
980 int color, cx, cy, width, height, start, end;
989 if (Tcl_GetIntFromObj(interp, objv[4], &cx) != TCL_OK)
991 if (Tcl_GetIntFromObj(interp, objv[5], &cy) != TCL_OK)
993 if (Tcl_GetIntFromObj(interp, objv[6], &width) != TCL_OK)
995 if (Tcl_GetIntFromObj(interp, objv[7], &height) != TCL_OK)
997 if (Tcl_GetIntFromObj(interp, objv[8], &start) != TCL_OK)
999 if (Tcl_GetIntFromObj(interp, objv[9], &end) != TCL_OK)
1003 cmd = Tcl_GetString(objv[1]);
1005 gdImageArc(im, cx, cy, width, height, start, end,
color);
1008 else if (
cmd[0] ==
'f' &&
cmd[4] ==
'a')
1009 gdImageFilledArc(im, cx, cy, width, height, start, end,
color, gdArc);
1011 else if (
cmd[0] ==
'o' &&
cmd[4] ==
'a') {
1012 gdImageArc(im, cx, cy, width, height, start, end,
color);
1013 gdImageFilledArc(im, cx, cy, width, height, start, end,
color, gdChord | gdNoFill);
1015 else if (
cmd[0] ==
'c')
1016 gdImageFilledArc(im, cx, cy, width, height, start, end,
color, gdChord | gdNoFill);
1017 else if (
cmd[0] ==
'f' &&
cmd[4] ==
'c')
1018 gdImageFilledArc(im, cx, cy, width, height, start, end,
color, gdChord);
1019 else if (
cmd[0] ==
'o' &&
cmd[4] ==
'c')
1020 gdImageFilledArc(im, cx, cy, width, height, start, end,
color, gdChord | gdEdged | gdNoFill);
1021 else if (
cmd[0] ==
'p' || (
cmd[0] ==
'f' &&
cmd[4] ==
'p'))
1022 gdImageFilledArc(im, cx, cy, width, height, start, end,
color, gdPie);
1023 else if (
cmd[0] ==
'o' &&
cmd[4] ==
'p')
1024 gdImageFilledArc(im, cx, cy, width, height, start, end,
color, gdPie | gdEdged | gdNoFill);
1033 int color, npoints, i;
1034 Tcl_Obj **pointObjv = (Tcl_Obj **) (&objv[4]);
1036 int retval = TCL_OK;
1050 if (Tcl_ListObjGetElements(interp, objv[4], &npoints, &pointObjv) != TCL_OK)
1054 if (npoints % 2 != 0) {
1055 Tcl_SetResult(interp,
"Number of coordinates must be even", TCL_STATIC);
1063 Tcl_SetResult(interp,
"Must specify at least 3 points.", TCL_STATIC);
1068 points = (gdPointPtr) Tcl_Alloc(npoints *
sizeof(gdPoint));
1071 for (i = 0; i < npoints; i++)
1072 if (Tcl_GetIntFromObj(interp, pointObjv[i * 2], &
points[i].x) != TCL_OK
1073 || Tcl_GetIntFromObj(interp, pointObjv[i * 2 + 1],
1074 &
points[i].y) != TCL_OK) {
1080 cmd = Tcl_GetString(objv[1]);
1089 Tcl_Free((
char *)
points);
1099 int color, x, y, border;
1107 if (Tcl_GetIntFromObj(interp, objv[4], &x) != TCL_OK)
1109 if (Tcl_GetIntFromObj(interp, objv[5], &y) != TCL_OK)
1113 if (argc - 2 == 5) {
1114 if (Tcl_GetIntFromObj(interp, objv[6], &border) != TCL_OK)
1116 gdImageFillToBorder(im, x, y, border,
color);
1118 gdImageFill(im, x, y,
color);
1127 gdImagePtr imdest, imsrc;
1128 int destx, desty, srcx, srcy, destw, desth, srcw, srch;
1131 imdest =
IMGPTR(objv[2]);
1135 if (Tcl_GetIntFromObj(interp, objv[4], &destx) != TCL_OK)
1137 if (Tcl_GetIntFromObj(interp, objv[5], &desty) != TCL_OK)
1139 if (Tcl_GetIntFromObj(interp, objv[6], &srcx) != TCL_OK)
1141 if (Tcl_GetIntFromObj(interp, objv[7], &srcy) != TCL_OK)
1143 if (Tcl_GetIntFromObj(interp, objv[8], &destw) != TCL_OK)
1145 if (Tcl_GetIntFromObj(interp, objv[9], &desth) != TCL_OK)
1149 if (argc - 2 == 10) {
1150 if (Tcl_GetIntFromObj(interp, objv[10], &srcw) != TCL_OK)
1152 if (Tcl_GetIntFromObj(interp, objv[11], &srch) != TCL_OK)
1155 gdImageCopyResized(imdest, imsrc, destx, desty, srcx, srcy,
1156 destw, desth, srcw, srch);
1158 gdImageCopy(imdest, imsrc, destx, desty, srcx, srcy, destw, desth);
1175 if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
1177 if (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)
1181 color = gdImageGetPixel(im, x, y);
1182 Tcl_SetObjResult(interp, Tcl_NewIntObj(
color));
1192 Tcl_Obj *answers[2];
1197 answers[0] = Tcl_NewIntObj(gdImageSX(im));
1198 answers[1] = Tcl_NewIntObj(gdImageSY(im));
1199 Tcl_SetObjResult(interp, Tcl_NewListObj(2, answers));
1209 double ptsize, angle;
1210 char *
error, *fontname;
1211 int i, brect[8],
len;
1229 if (Tcl_GetDoubleFromObj(interp, objv[5], &ptsize) != TCL_OK) {
1234 if (Tcl_GetDoubleFromObj(interp, objv[6], &angle) != TCL_OK) {
1239 if (Tcl_GetIntFromObj(interp, objv[7], &x) != TCL_OK) {
1242 if (Tcl_GetIntFromObj(interp, objv[8], &y) != TCL_OK) {
1246 str = Tcl_GetStringFromObj(objv[9], &
len);
1247 fontname = Tcl_GetString(objv[4]);
1249 gdFTUseFontConfig(1);
1251 gdImageStringFT(im, brect,
color, fontname, ptsize, angle, x, y,
str);
1254 Tcl_SetResult(interp,
error, TCL_VOLATILE);
1257 for (i = 0; i < 8; i++) {
1258 orect[i] = Tcl_NewIntObj(brect[i]);
1260 Tcl_SetObjResult(interp, Tcl_NewListObj(8, orect));
1268__declspec(dllexport)
int Gdtclft_Init(Tcl_Interp *interp)
1275 if (Tcl_InitStubs(interp, TCL_VERSION, 0) ==
NULL) {
1279 if (Tcl_PkgRequire(interp,
"Tcl", TCL_VERSION, 0) ==
NULL) {
1285 char adjusted_version[
sizeof(PACKAGE_VERSION)] = PACKAGE_VERSION;
1286 char *tilde_dev = strstr(adjusted_version,
"~dev.");
1287 if (tilde_dev !=
NULL) {
1289 memmove(tilde_dev + 1, tilde_dev + strlen(
"~dev."),
1290 strlen(tilde_dev + strlen(
"~dev.")) + 1);
1292 if (Tcl_PkgProvide(interp,
"Gdtclft", adjusted_version) != TCL_OK) {
1295 Tcl_CreateObjCommand(interp,
"gd",
gdCmd,
NULL, (Tcl_CmdDeleteProc *)
NULL);
1306 if (
Gdtclft_Init(interp) != TCL_OK || Tcl_GetCommandInfo(interp,
"gd", &
info) != 1)
1308 info.objClientData = (
char *)
info.objClientData + 1;
1309 if (Tcl_SetCommandInfo(interp,
"gd", &
info) != 1)
1340BOOL APIENTRY DllEntryPoint(HINSTANCE hInst, DWORD reason, LPVOID reserved);
1341BOOL APIENTRY DllEntryPoint(HINSTANCE hInst, DWORD reason, LPVOID reserved) {
1348static int BufferSinkFunc(
void *context,
const char *buffer,
int len)
1353 p->
buf = Tcl_Alloc(
len + 1);
1354 memcpy(p->
buf, buffer,
len);
1360 memmove(bufend, buffer,
len);
1375 char *result =
NULL;
1384 buffsink.sink = BufferSinkFunc;
1385 buffsink.context = (
void *) &bsc;
1389 gdImagePngToSink(im, &buffsink);
1393 res = buffsink.context;
1396 output = Tcl_NewByteArrayObj((
unsigned char *) result, res->
buflen);
1400 Tcl_IncrRefCount(output);
1402 if (Tcl_ObjSetVar2(interp, objv[3],
NULL, output, 0) ==
NULL)
1411 size_t len = strlen(
GdPtrType.name) + (
sizeof(
void *) + 1) * 2 + 1;
1412 O->bytes = Tcl_Alloc(
len);
1419 if (
O->bytes ==
NULL ||
O->bytes[0] ==
'\0' ||
1423 Tcl_AppendResult(
I,
O->bytes,
" is not a ",
GdPtrType.name,
"-handle",
NULL);
static void out(agerrlevel_t level, const char *fmt, va_list args)
Report messages using a user-supplied or default write function.
void error(int level, const char *s,...)
static GdDataFunction tclGdCopyCmd
static Tcl_ObjType GdPtrType
static GdImgFunction tclGdColorGetCmd
static GdDataFunction tclGdInterlaceCmd
static cmdDataOptions subcmdVec[]
static GdImgFunction tclGdColorTranspCmd
static GdDataFunction tclGdSetCmd
Tcl_AppInitProc Gdtclft_SafeInit
static GdDataFunction tclGdRectCmd
static GdDataFunction tclGdLineCmd
static Tcl_UpdateStringProc GdPtrTypeUpdate
static GdDataFunction tclGdStyleCmd
static GdDataFunction tclGdBrushCmd
int() GdDataFunction(Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[])
static GdImgFunction tclGdColorResolveCmd
static GdImgFunction tclGdColorNewCmd
static GdDataFunction tclGdCreateCmd
static GdImgFunction tclGdColorFreeCmd
static GdImgFunction tclGdColorExactCmd
static GdDataFunction tclGdDestroyCmd
int() GdImgFunction(Tcl_Interp *interp, gdImagePtr gdImg, int argc, const int args[])
static int gdCmd(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[])
static GdDataFunction tclGdArcCmd
static GdDataFunction tclGdPolygonCmd
static GdDataFunction tclGdSizeCmd
static GdDataFunction tclGdWriteBufCmd
Tcl_AppInitProc Gdtclft_Init
static GdDataFunction tclGdWriteCmd
static GdDataFunction tclGdGetCmd
static GdDataFunction tclGdTextCmd
static int tclGd_GetColor(Tcl_Interp *interp, Tcl_Obj *obj, int *color)
static GdImgFunction tclGdColorClosestCmd
static GdDataFunction tclGdTileCmd
static cmdImgOptions colorCmdVec[]
static Tcl_SetFromAnyProc GdPtrTypeSet
static GdDataFunction tclGdFillCmd
static GdDataFunction tclGdColorCmd
static double len(glCompPoint p)
static void color(Agraph_t *g)
static const char * usage