]> granicus.if.org Git - graphviz/commitdiff
add support for TrueColor to gdtclft (gd commands, used by webdot)
authorellson <devnull@localhost>
Mon, 29 Jun 2009 12:51:41 +0000 (12:51 +0000)
committerellson <devnull@localhost>
Mon, 29 Jun 2009 12:51:41 +0000 (12:51 +0000)
tclpkg/gdtclft/gdtclft.3tcl
tclpkg/gdtclft/gdtclft.c

index abd7b6557180355ff2fd9ac98f7906dde79280fc..d7c879a2eb91f64e0873608df629e4a7189d1fac 100644 (file)
@@ -69,6 +69,9 @@ Reference
    gd create <width> <height>
           Return a handle to a new gdImage that is width X height.
           
+   gd createTrueColor <width> <height>
+          Return a handle to a new trueColor gdImage that is width X height.
+          
    gd createFromGD <filehandle>
    gd createFromGD2 <filehandle>
    gd createFromGIF <filehandle>
index bae5256665aff921e3201177986443575e65334d..456d129b08f6dcc8d7c8c096cad8d83ef373331f 100644 (file)
@@ -98,6 +98,8 @@ typedef struct {
 static cmdOptions subcmdVec[] = {
     {"create", tclGdCreateCmd, 2, 2, 0, 0,
      "width height"},
+    {"createTrueColor", tclGdCreateCmd, 2, 2, 0, 0,
+     "width height"},
     {"createFromGD", tclGdCreateCmd, 1, 1, 0, 0,
      "filehandle"},
 #ifdef HAVE_LIBZ
@@ -299,6 +301,8 @@ static int tclGd_GetColor(Tcl_Interp * interp, Tcl_Obj * obj, int *color)
  *
  * gd create <width> <height>
  *             Return a handle to a new gdImage that is width X height.
+ * gd createTrueColor <width> <height>
+ *             Return a handle to a new trueColor gdImage that is width X height.
  * gd createFromGD <filehandle>
  * gd createFromGD2 <filehandle>
  * gd createFromGIF <filehandle>
@@ -517,6 +521,17 @@ tclGdCreateCmd(Tcl_Interp * interp, GdData * gdData,
            Tcl_SetResult(interp, buf, TCL_VOLATILE);
            return TCL_ERROR;
        }
+    } else if (strcmp(cmd, "createTrueColor") == 0) {
+       if (Tcl_GetIntFromObj(interp, objv[2], &w) != TCL_OK)
+           return TCL_ERROR;
+       if (Tcl_GetIntFromObj(interp, objv[3], &h) != TCL_OK)
+           return TCL_ERROR;
+       im = gdImageCreateTrueColor(w, h);
+       if (im == NULL) {
+           sprintf(buf, "GD unable to allocate %d X %d image", w, h);
+           Tcl_SetResult(interp, buf, TCL_VOLATILE);
+           return TCL_ERROR;
+       }
     } else {
        fileByName = 0;         /* first try to get file from open channel */
        if (Tcl_GetOpenFile