|
|
|
|
Language SpecificationUsagegdit [-s] [-d] [-w] [-v] [-?] [-h] [-f <script_file>.gdt] [filename.[gif|xbm] -s silent operation, don't write to stdout -d turn parser debugging on -w turn warning messages on -v print version number -? print usage -h help -f run gdit script file (extension .gdt) Language SpecificationReserved WordsThe words given in this language specification should not be used as color or style names. Functionsarc, comment, debug, delete, fill, get, help, line, new, polygon, print, quit, rectangle, save, set. Qualifiersbrush, brushed, closest, exact, filled, interlaced, information, large, pixel, style, small, tiled, tile, up, transparent. newn[ew] width height [color] [transparent] [interlaced] n[ew] [filename.gif] n[ew] [filename.xbm] Description Create a new image. Either the filename of an existing GIF or XBM file can be specified or the dimensions of an new image supplied. In this case the background color defaults to white, otherwise a predefined or previously defined color must be given. The background color can be made transparent; interlace instructs some browsers to build the image in a number of passes. gd library gdImageCreate(), gdImageCreateFromGif(), gdImageInterlace(), gdImageColorTransparent() saves[ave] [filename.gif] Description Saves the current image as a GIF file. Will overwrite any existing file. If no filename is given GIF data is written to the standard output. gd library gdImageGif() deletedel[ete] Description Deletes the current image. Does nothing if there is not a current image. del[ete] bru[sh] Description Deletes the bush. delete tile Description Deletes the tile. delete style name Description Deletes the named style. del[ete] sty[le] al[l] Description Deletes all the styles. del[ete] al[l] Description Deletes all of the above. gd library gdImageDestroy() setse[t] pix[el] x y color Description Sets the pixel specified by the coordinate x, y to the given color. se[t] tran[sparent] [color | index] Description Set the transparent color, the color can either be specified as a name (either from the predefined list or the user list) or as an index from the current palette. If no value is give the transparent color is set to none. GDIT does not check whether an index is valid. se[t] inter[laced] Description Make the current image interlaced. Some Web browsers can load interlaced images in a number of passes. An initial low resolution images of the correct dimensions is loaded first and the full image is built up over a number of passes. se[t] [clos[est]] color <red> <green> <blue> name Description Define a color. This option lets the user add colors in addition to the predefined set. The user may redefine any of the predefined colors but may not redefine any previously defined user colors. These must be deleted before redefinition. The user defined color name takes precedence over a predefined color of the same name. Up to gdMaxColors can be defined. se[t] clos[est] set exact Description Instructs drawing operations to use either the closest color match if the color table is full. Normally draw functions fail if there is not an exact match for the desired color. The default is exact. se[t] sty[le] name [count] color1... [countn] colorn Description se[t] bru[sh] <file>.gif Description Loads a brush from the specified brush file. The brush can be used in line drawing by giving a color of brushed. Example new 100 100 light_gray interlaced transparent set brush brush.gif arc 50 50 35 35 0 360 brushed
se[t] tile filename.gif Description Load a tile from the specified tile file. A tile can be used in filled area drawing by giving a color of tiled. Example new 100 100 light_gray interlaced transparent set tile tile.gif r 20 20 80 80 tiled filled
Remarks You will normally want to set the background color of the brush to transparent. You can do this by loading the image in gdit , examining the background color with get pixel and then set the returned index to transparent. This is much better for you than giftrans! new brush.gif Load brush gif file get pixel 1 1 index 7 rgb 128 128 128 set transparent 7 save brush.gif gd library gdImageSetPixel(), gdImageInterlaced(), gdImageColorTransparent(), gdImageSetBrush() gdImageSetStyle(), linel[ine] x1 y1 x2 y2 color l[ine] x1 y1 x2 y2 brushed l[ine] x1 y1 x2 y2 style name [brushed] Description Draws a line between the points x1,y1 and x2,y2. Color can be any predefined or user defined color. If a brush has been loaded the modifier brushed can be used. The brush image will be drawn for each pixel, as a brush image is normally more than one pixel wide it will create the effect of a wide paintbrush. The second form allows drawing with a previously defined style. Dashed, dotted or even more exotic line styles can be drawn. If the modifier brushed is supplied the brush image is drawn for each pixel which is not transparent. example This image was produced by linetest.gdt:
gd library gdImageLine() polygonpo[lygon] x1 y1 ... xn yn color [filled] po[lygon] x1 y1 ... xn yn style name [brushed][filled] po[lygon] x1 y1 ... xn yn tiled filled Description Draws a polygon. That is a closed shape between the given coordinates. It can be filled with the border color. The color can also be specified as brushed, and the border will be drawn with the current brush. A user defined style can be used in place of the color. This color can be brushed, in this case the brush is only drawn where there is a color specified in the style (e.g. not transparent). Filled polygons can also be tiled. example This image was generated by the file polytest.gdt and shows some of the weird possibilities:
gd library gdImagePolygon(), gdImageFilledPolygon() rectangler[ectangle] x1 y1 x2 y2 color [filled] r[ectangle] x1 y1 x2 y2 style name [brushed][filled] r[ectangle] x1 y1 x2 y2 tiled filled Description Draw a rectangle. x1,y1 is the top left corner and x2,y2 the bottom right. The same styles as for polygons can be applied. example And using rectest.gdt here's what's possible:
gd library gdImageRectangle(), gdImageFilledRectangle() arca[rc] x y height width start end color a[rc] x y height width start end brushed a[rc] x y height width start end style name [brushed] Description Draws a partial ellipse centered on coordinates x,y of size width and height. It begins at the angle given by start and finishes at the angle specified by end. The same styles as for line can be applied. example n 100 100 light_gray interlaced transparent arc 50 50 30 20 25 180 red
and from arctest.gdt:
gd library gdImageArc() fillf[ill] x y color [color] f[ill] x y tiled [color] Description This floods a portion of the image with the specified color. It begins at the point x y and floods the surrounding region until a color different from the starting color is reached. If a second color is given fill floods a region to this specified border color. The flood color can be tiled. Note: a tile should not be transparent, load a tile in gdit and set transparent to turn off transparency. examples n 100 100 light_gray interlaced transparent r 20 20 80 80 red r 40 40 60 60 green fill 30 30 yellow
n 100 100 light_gray interlaced transparent arc 50 50 40 80 0 360 red fill 50 50 white red
and from filltest.gdt:
gd library gdImageFill(), gdImageFillToBorder getg[et] pix[el] x y Description Returns the color index and red, green and blue components. This is useful for setting a color to transparent in a GIF. Example new old.gif an old GIF87 file get pixel 0 0 index 0; RGB values are 192, 192, 192 set transparent 0 shiny new transparent GIF87! get information Description Returns information about the image including the width and height in pixels, whether it's interlaced, the transparent color index pr[int] [up][large|small|medium|giant|tiny] x y color "string" Description Print text strings. Two fonts are provided by the gd library, these are called large and small. The qualifier up prints text vertically. x and y give the position of the top left of the first letter. Color can be any predefined or user defined color. The string to be printed must be surrounded by double quotes. Note: It should be possible to print a " character within a string by escaping it with a \, this does not work for some reason. example As a variation on the old hello world theme try prttest.gdt:
gd library gdImageString(), gdImageStringUp() commentc[omment] "comment string" Description Add a comment string to the GIF file. helph[elp] <topic> Description On line help for the above topics. quitquit|bye Description Exit the program. Deallocates styles and images before quitting. This is the preferred way of exiting gdit. debugdebug_on debug_off Description Turn on parser debugging (program must be built with parser debugging enabled, see makefile) Predefined ColorsThis set of colors is predefined and may be referred to by name in the drawing primitives.
Notes
thus: > new 100 100; line 0 0 100 100 red; save file.gif is valid. This has been added because the Windows parser fails to recognize new line characters as input tokens until the next input token in encountered. I don't have a fix for this, any offers? so on Windows: > help <NEWLINE> will not display help until the next input line (including an input line with only a newline token!). > help; will display help. Unsupported gd functionsgdImageCreateFromGd(), gdImageGd(), gdImageDashedLine(),gdImageBoundsSafe(), gdImageChar(), gdImageCharUp(), gdImageCopy(), gdImageCopyResized(). Last Updated: 16th December, 1995. |