diff options
author | Mikhail Teterin <mi@FreeBSD.org> | 2006-12-04 10:00:01 +0000 |
---|---|---|
committer | Mikhail Teterin <mi@FreeBSD.org> | 2006-12-04 10:00:01 +0000 |
commit | 67a6c6f035e40b62749b948c691302079b578215 (patch) | |
tree | b6d79caeb6c29187d7a20e7b8bbe4d2ddc7bf36c /graphics/gdtclft | |
parent | c26cbc551b58eea84540a2b274224d13d77c1249 (diff) | |
download | ports-67a6c6f035e40b62749b948c691302079b578215.tar.gz ports-67a6c6f035e40b62749b948c691302079b578215.zip |
Another round of improvements:
* support read/write of files in the GD2-format (obtained from
the vendor's version bundled with, but not installed by
Graphviz);
* add an optional argument to `gd create W H' -- if "true", the
created image will be "TrueColor"
Bump PORTREVISION again.
Notes
Notes:
svn path=/head/; revision=178812
Diffstat (limited to 'graphics/gdtclft')
-rw-r--r-- | graphics/gdtclft/Makefile | 2 | ||||
-rw-r--r-- | graphics/gdtclft/files/patch-gif | 312 |
2 files changed, 280 insertions, 34 deletions
diff --git a/graphics/gdtclft/Makefile b/graphics/gdtclft/Makefile index d87788837239..90fe35ea51c1 100644 --- a/graphics/gdtclft/Makefile +++ b/graphics/gdtclft/Makefile @@ -7,7 +7,7 @@ PORTNAME= Gdtclft PORTVERSION= 2.2.5 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= graphics tcl${TCL_DVER} MASTER_SITES= http://www.graphviz.org/pub/ DISTNAME= ${PORTNAME}${PORTVERSION} diff --git a/graphics/gdtclft/files/patch-gif b/graphics/gdtclft/files/patch-gif index 95463a8aad52..09ca36d3ba0c 100644 --- a/graphics/gdtclft/files/patch-gif +++ b/graphics/gdtclft/files/patch-gif @@ -11,7 +11,7 @@ Use freely and get yourself a pademelon... -mi (http://cafepress.com/buy/pademelon?pid=5934485) --- gdCmd.c Fri Aug 4 17:11:05 2000 -+++ gdCmd.c Fri Dec 1 01:12:23 2006 ++++ gdCmd.c Mon Dec 4 03:50:17 2006 @@ -19,4 +19,5 @@ */ @@ -31,13 +31,21 @@ Use freely and get yourself a pademelon... + const char *usage; } cmdOptions; -@@ -65,12 +66,33 @@ +@@ -61,16 +62,39 @@ + + static cmdOptions subcmdVec[] = { +- {"create", tclGdCreateCmd, 2, 2, 0, 0, +- "width height"}, ++ {"create", tclGdCreateCmd, 2, 3, 0, 0, ++ "width height ?true?"}, {"createFromPNG", tclGdCreateCmd, 1, 1, 0, 0, "filehandle"}, + {"createFromGIF", tclGdCreateCmd, 1, 1, 0, 0, + "filehandle"}, {"createFromGD", tclGdCreateCmd, 1, 1, 0, 0, "filehandle"}, ++ {"createFromGD2", tclGdCreateCmd, 1, 1, 0, 0, ++ "filehandle"}, {"createFromXBM", tclGdCreateCmd, 1, 1, 0, 0, "filehandle"}, +#ifdef NOX11 @@ -65,14 +73,47 @@ Use freely and get yourself a pademelon... + "gdhandle filehandle ?quality?"}, {"writePNG", tclGdWriteCmd, 2, 2, 0, 1, "gdhandle filehandle"}, -@@ -79,4 +97,6 @@ +@@ -79,4 +103,8 @@ {"writeGD", tclGdWriteCmd, 2, 2, 0, 1, "gdhandle filehandle"}, ++ {"writeGD2", tclGdWriteCmd, 2, 2, 0, 1, ++ "gdhandle filehandle"}, + {"writeWBMP", tclGdWriteCmd, 3, 3, 0, 1, + "gdhandle filehandle foreground"}, {"interlace", tclGdInterlaceCmd, 1, 2, 0, 1, -@@ -414,30 +434,67 @@ +@@ -79,4 +103,8 @@ + {"writeGD", tclGdWriteCmd, 2, 2, 0, 1, + "gdhandle filehandle"}, ++ {"writeGD2", tclGdWriteCmd, 2, 2, 0, 1, ++ "gdhandle filehandle"}, ++ {"writeWBMP", tclGdWriteCmd, 3, 3, 0, 1, ++ "gdhandle filehandle foreground"}, + + {"interlace", tclGdInterlaceCmd, 1, 2, 0, 1, +@@ -402,9 +430,20 @@ + cmd = Tcl_GetString(objv[1]); + if (strcmp(cmd, "create") == 0) { ++ int trueColor = 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 = gdImageCreate(w, h); ++ /* An optional argument may specify true for "TrueColor" */ ++ if (argc == 5 && Tcl_GetBooleanFromObj(interp, objv[4], ++ &trueColor) == TCL_ERROR) ++ return TCL_ERROR; ++ ++ if (trueColor) ++ im = gdImageCreateTrueColor(w, h); ++ else ++ im = gdImageCreate(w, h); ++ + if (im == NULL) + { +@@ -414,30 +453,70 @@ } } else { + char *arg2 = Tcl_GetString(objv[2]); @@ -121,10 +162,13 @@ Use freely and get yourself a pademelon... + case 'X': + im = gdImageCreateFromXbm(filePtr); + break; -+ case 'G': -+ im = cmd[11] == 'I' ? -+ gdImageCreateFromGif(filePtr) : -+ gdImageCreateFromGd(filePtr); ++ case 'G': /* GIF, GD2, and GD */ ++ if (cmd[11] == 'I') ++ im = gdImageCreateFromGif(filePtr); ++ else if (cmd[12] == '2') ++ im = gdImageCreateFromGd2(filePtr); ++ else ++ im = gdImageCreateFromGd(filePtr); + break; + case 'J': + im = gdImageCreateFromJpeg(filePtr); @@ -161,7 +205,7 @@ Use freely and get yourself a pademelon... + cmd + 10, NULL); return TCL_ERROR; } -@@ -472,15 +529,41 @@ +@@ -472,15 +551,41 @@ FILE *filePtr; ClientData clientdata; - char *cmd; @@ -205,7 +249,7 @@ Use freely and get yourself a pademelon... + if (Tcl_GetOpenFile(interp, fname, 1, 1, &clientdata) == TCL_OK) { filePtr = (FILE *)clientdata; } else { -@@ -489,5 +572,7 @@ +@@ -489,5 +594,7 @@ */ fileByName++; - if ((filePtr = fopen(Tcl_GetString(objv[3]),"wb")) == NULL) { @@ -214,7 +258,7 @@ Use freely and get yourself a pademelon... + "': ", strerror(errno), NULL); return TCL_ERROR; } -@@ -496,8 +581,20 @@ +@@ -496,8 +603,22 @@ /* Do it. */ - if (cmd[5] == 'P') { @@ -227,6 +271,8 @@ Use freely and get yourself a pademelon... + case 'G': + if (cmd[6] == 'I') + gdImageGif(im, filePtr); ++ else if (cmd[7] == '2') ++ gdImageGd2(im, filePtr, GD2_CHUNKSIZE, GD2_FMT_COMPRESSED); + else + gdImageGd(im, filePtr); + break; @@ -239,8 +285,12 @@ Use freely and get yourself a pademelon... } if (fileByName) { --- gdtclft.n Fri Aug 4 17:11:41 2000 -+++ gdtclft.n Fri Dec 1 01:59:32 2006 -@@ -12,16 +12,6 @@ ++++ gdtclft.n Mon Dec 4 03:52:10 2006 +@@ -9,98 +9,89 @@ + + TCL GD EXTENSION +- ++ Thomas Boutell's Gd package provides a convenient way to generate PNG images with a C program. If you, like me, prefer Tcl for CGI - applications, you'll want my TCL GD extension. You can get it by @@ -258,26 +308,33 @@ Use freely and get yourself a pademelon... + applications, you'll want my TCL GD extension. + A TCL INTERFACE TO THE GD PACKAGE - -@@ -34,25 +24,15 @@ +- ++ + Spencer W. Thomas + Human Genome Center + University of Michigan + Ann Arbor, MI 48109 +- ++ + spencer.thomas@med.umich.edu TrueType font support using the FreeType library was added by - John Ellson (ellson@graphviz.org) + John Ellson (ellson@graphviz.org). - Latest sources available from: -- ++ FreeBSD port maintained by Mikhail Teterin (mi@aldan.algebra.com). + - http://www.graphviz.org/pub/ - -+ FreeBSD port maintained by Mikhail Teterin (mi@aldan.algebra.com). - +- Overview This package provides a simple Tcl interface to the gd (PNG drawing) - package, version 1.1. It includes an interface to all the gd functions + package. It includes an interface to most of the gd functions and data structures from Tcl commands. - +- - - -Installation @@ -286,53 +343,242 @@ Use freely and get yourself a pademelon... - make - make install - -+ ++ ++ Reference -@@ -70,20 +50,28 @@ + One Tcl command, 'gd', is added. All gd package actions are + sub-commands (or "options" in Tcl terminology) of this command. +- ++ + Each active gd image is referred to with a "handle". The handle is a + name of the form gd# (e.g., gd0) returned by the gd create options. +- ++ + Almost all the gd commands take a handle as the first argument (after + the option). All the drawing commands take a color_idx as the next + argument. +- ++ +- gd create <width> <height> ++ gd create <width> <height> ?true? Return a handle to a new gdImage that is width X height. - ++ If "true" is specified, the new image is "TrueColor". +- - gd createFromPNG <filehandle> - - gd createFromGD <filehandle> - - gd createFromXBM <filehandle> ++ + gd createFromGD <file> ++ gd createFromGD2 <file> + gd createFromGIF <file> + gd createFromJPG <file> + gd createFromPNG <file> + gd createFromWBMP <file> + gd createFromXBM <file> + gd createFromXPM <filename> -+ ++ Return a handle to a new gdImage created by reading a PNG - (resp. GD or XBM) image from the file open on filehandle. +- + (resp. GD or XBM) image from the <file>, which is either + a TCl filehandle, or a filename (except for XPM, which only + accepts filenames). - ++ gd destroy <gdhandle> Destroy the gdImage referred to by gdhandle. - +- - gd writePNG <gdhandle> <filehandle> +- +- gd writeGD <gdhandle> <filehandle> +- Write the image in gdhandle to filehandle as a PNG (resp. GD) +- file. ++ + gd writeGD <gdhandle> <file> ++ gd writeGD2 <gdhandle> <file> + gd writeGIF <gdhandle> <file> + gd writeJPG <gdhandle> <file> ?quality? + gd writePNG <gdhandle> <file> + gd writeWBMP <gdhandle> <file> fgpixel - -- gd writeGD <gdhandle> <filehandle> -- Write the image in gdhandle to filehandle as a PNG (resp. GD) -- file. ++ + Write the image in gdhandle to <file> (filehandle or filename) + in one of the specified formats. gd writePNGvar <gdhandle> <varname> -@@ -331,2 +319,7 @@ + Write the image in gdhandle to Tcl variable "varname" as a binary + coded PNG object. +- ++ + gd interlace <gdhandle> <on-off> + Make the output image interlaced (if on-off is true) or not (if + on-off is false). +- ++ + gd color new <gdhandle> <red> <green> <blue> + Allocate a new color with the given RGB values. Returns the + color_idx, or -1 on failure (256 colors already allocated). +- ++ + gd color exact <gdhandle> <red> <green> <blue> +- Find a color_idx in the image that exactly matches the given RGB ++ Find a color_idx in the image that exactly matches the given RGB + color. Returns the color_idx, or -1 if no exact match. +- ++ + gd color closest <gdhandle> <red> <green> <blue> + Find a color in the image that is closest to the given RGB color. +@@ -114,23 +104,23 @@ + set idx [gd color closest $gd $r $g $b] + } +- } +- ++ } ++ + gd color free <gdhandle> <color_idx> + Free the color at the given color_idx for reuse. +- ++ + gd color transparent <gdhandle> [<color_idx>] + Mark the color at <color_idx> as the transparent background color. Or, + return the transparent color_idx if no color_idx specified. +- ++ + gd color get <gdhandle> [<color_idx>] + Return the RGB value at <color_idx>, or {} if it is not allocated. + If <color_idx> is not specified, return a list of {color_idx R G B} + values for all allocated colors. +- ++ + gd brush <gdhandle> <brushhandle> + Set the brush image to be used for brushed lines. Transparent + pixels in the brush will not change the image when the brush is + applied. +- ++ + gd style <gdhandle> <color_idx> ... + Set the line style to the list of color indices. This is +@@ -141,10 +131,10 @@ + means not to fill the pixel, and a non-zero value means to + apply the brush. +- ++ + gd tile <gdhandle> <tilehandle> + Set the tile image to be used for tiled fills. Transparent + pixels in the tile will not change the underlying image during + tiling. +- ++ + In all drawing functions, the color_idx is a number, or may + be one of the strings styled, brushed, tiled, "styled brushed" +@@ -152,56 +142,55 @@ + effect will be used. Brushing and styling apply to lines, + tiling to filled areas. +- ++ + gd set <gdhandle> <color_idx> <x> <y> + Set the pixel at (x,y) to color <color_idx>. +- ++ + gd line <gdhandle> <color_idx> <x1> <y1> <x2> <y2> +- ++ + gd rectangle <gdhandle> <color_idx> <x1> <y1> <x2> <y2> +- ++ + gd fillrectangle <gdhandle> <color_idx> <x1> <y1> <x2> <y2> + Draw the outline of (resp. fill) a rectangle in color <color_idx> + with corners at (x1,y1) and (x2,y2). +- ++ + gd arc <gdhandle> <color_idx> <cx> <cy> <width> <height> <start> <end> + Draw an arc in color <color_idx>, centered at (cx,cy) in a rectangle width + x height, starting at start degrees and ending at end degrees. + start must be > end. +- ++ + gd polygon <gdhandle> <color_idx> <x1> <y1> ... +- ++ + gd fillpolygon <gdhandle> <color_idx> <x1> <y1> ... + Draw the outline of, or fill, a polygon specified by the x, y + coordinate list. There must be at least 3 points specified. +- ++ + gd fill <gdhandle> <color_idx> <x> <y> +- ++ + gd fill <gdhandle> <color_idx> <x> <y> <borderindex> + Fill with color <color_idx>, starting from (x,y) within a region of + pixels all the color of the pixel at (x,y) (resp., within a + border colored borderindex). +- ++ + gd size <gdhandle> + Returns a list {width height} of the image. +- +- gd text <gdhandle> <color_idx> <fontpath> <size> <angle> <x> <y> <string> +- Draw text using the .ttf font in <fontpath> in color <color_idx>, +- with pointsize <size>, rotation in radians <angle>, with lower left ++ ++ gd text <gdhandle> <color_idx> <fontpath> <size> <angle> <x> <y> <string> ++ Draw text using the .ttf font in <fontpath> in color <color_idx>, ++ with pointsize <size>, rotation in radians <angle>, with lower left + corner at (x,y). String may contain UTF8 sequences like: "À" + Returns 4 corner coords of bounding rectangle. + Use gdhandle = {} to get boundary without rendering. + Use negative of color_idx to disable antialiasing. +- ++ + gd copy <desthandle> <srchandle> <destx> <desty> <srcx> <srcy> <w> <h> +- +- gd copy <desthandle> <srchandle> <destx> <desty> <srcx> <srcy> \ +- <destw> <desth> <srcw> <srch> Copy a subimage from +- srchandle(srcx, srcy) to desthandle(destx, desty), size w x h. ++ ++ gd copy <desthandle> <srchandle> <destx> <desty> <srcx> <srcy> \\ ++ <destw> <desth> <srcw> <srch> ++ Copy a subimage from srchandle(srcx, srcy) to desthandle(destx, ++ desty), size w x h. + Or, resize the subimage in copying from srcw x srch to destw x + desth. +- +- +- +-Examples ++ ++.SH EXAMPLES + + The sample program from the gd documentation can be written thusly: +@@ -234,8 +223,8 @@ + gd destroy $im + +- +- ++ ++ + GDDEMO +- ++ + Here's the gddemo.c program translated to tcl. + +@@ -312,8 +301,8 @@ + gd destroy $im_out + +- +- ++ ++ + GDSHOW +- ++ + A quick Tcl procedure to display a GD image using the xv program. + +@@ -331,2 +320,6 @@ } } + +.SH SEE ALSO -+ See also -- you will find Thomas Boutell's documentation for the -+ underlying GD library quite useful, especially, if you are dealing -+ with WBMP format. ++ You will find Thomas Boutell's documentation for the underlying GD ++ library quite useful, especially, if you are dealing with WBMP format. |