index.html

来自「CA仿真模型中SLEUTH模型」· HTML 代码 · 共 1,606 行 · 第 1/5 页

HTML
1,606
字号
<HTML><HEAD><TITLE>gd 1.2</TITLE></HEAD><BODY><H1>gd 1.2</H1><H2>A graphics library for fast GIF creation</H2><H2>Follow this link to the <A HREF="http://www.boutell.com/gd/">latest versionof this document</A>.</H2><H3>Table of Contents</H3><UL><LI><A HREF="#notice">Credits and license terms</A><LI><A HREF="#whatsnew1.2">What's new in version 1.2?</A><LI><A HREF="#whatsnew1.1.1">What's new in version 1.1.1?</A><LI><A HREF="#whatis">What is gd?</A><LI><A HREF="#gdperl">What if I want to use Perl instead of C?</A><LI><A HREF="#gdtcl">What if I want to use Tcl instead of C?</A><LI><A HREF="#gdit">What if I want to use another scripting language?</A><LI><A HREF="#required">What else do I need to use gd?</A><LI><A HREF="#getgd">How do I get gd?</A><LI><A HREF="#buildgd">How do I build gd?</A><LI><A HREF="#basics">gd basics: using gd in your program</A><LI><A HREF="#webgif">webgif: a useful example</A><LI><A HREF="#reference">Function and type reference by category</A><LI><A HREF="#gdformat">About the additional .gd image file format</A><LI><A HREF="#informing"><strong>Please</strong> tell us you're using gd!</A><LI><A HREF="#problems">If you have problems</A><LI><A HREF="#languages">Using gd from tcl</A></LI><LI><A HREF="#index">Alphabetical quick index</A></UL><P><A HREF="http://www.boutell.com/">Up to the <EM>boutell.com, Inc. Home Page</EM></A><A NAME="notice"><H3>Credits and license terms</A></H3><P>gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,Cold Spring Harbor Labs. Permission granted to copy and distributethis work provided that this notice remains intact. Creditfor the library must be given to the Quest Protein Database Center,Cold Spring Harbor Labs, in all derived works. This does notaffect your ownership of the derived work itself, and the intentis to assure proper credit for Quest, not to interfere with youruse of gd. If you have questions, ask. ("Derived works"includes all programs that utilize the library. Credit mustbe given in user-visible documentation.) <p>gd 1.2 was written by Thomas Boutell and is currentlydistributed by boutell.com, Inc.<P>If you wish to release modifications to gd,please clear them first by sending email to boutell@boutell.com; if this is not done, any modified version of the gd library must be clearly labeled as such.<P>The Quest Protein Database Center is funded under Grant P41-RR02188 bythe National Institutes of Health.<P>Written by <A HREF="http://sunsite.unc.edu/boutell/index.html">Thomas Boutell</A>, 2/94 - 8/95. <P>The GIF compression code is based on that found in the pbmplus utilities, which in turn is based on GIFENCOD by David Rowley. See the notice below:<PRE>/*** Based on GIFENCOD by David Rowley <mgardi@watdscu.waterloo.edu>.A** Lempel-Zim compression based on "compress".**** Modified by Marcel Wijkstra <wijkstra@fwi.uva.nl>**** Copyright (C) 1989 by Jef Poskanzer.**** Permission to use, copy, modify, and distribute this software and its** documentation for any purpose and without fee is hereby granted, provided** that the above copyright notice appear in all copies and that both that** copyright notice and this permission notice appear in supporting** documentation.  This software is provided "as is" without express or** implied warranty.**** The Graphics Interchange Format(c) is the Copyright property of** CompuServe Incorporated.  GIF(sm) is a Service Mark property of** CompuServe Incorporated.*/</PRE><P><A NAME="koblas">The GIF decompression is based on that found in the pbmplus utilities, which in turn is based on GIFDECOD by David Koblas. See the notice below:<PRE>/* +-------------------------------------------------------------------+ *//* | Copyright 1990, 1991, 1993, David Koblas.  (koblas@netcom.com)    | *//* |   Permission to use, copy, modify, and distribute this software   | *//* |   and its documentation for any purpose and without fee is hereby | *//* |   granted, provided that the above copyright notice appear in all | *//* |   copies and that both that copyright notice and this permission  | *//* |   notice appear in supporting documentation.  This software is    | *//* |   provided "as is" without express or implied warranty.           | *//* +-------------------------------------------------------------------+ */</PRE></A><A NAME="whatis"><H3>What is gd?</H3></A><P>gd is a graphics library. It allows your code to quicklydraw images complete with lines, arcs, text, multiplecolors, cut and paste from other images, and flood fills, andwrite out the result as a .GIF file. This is particularlyuseful in World Wide Web applications, where .GIF is theformat used for inline images.<P>gd is not a paint program. If you are looking for a paint program, try xpaint by David Koblas, available by <A HREF="ftp://ftp.netcom.com/pub/ko/koblas">anonymous FTP</A> from ftp.netcom.com in pub/ko/koblas.(That package is for the X Window System; for the Mac and the PC, paintprograms are considerably easier to find.)<P>gd does not provide for every possible desirable graphicsoperation. It is not necessary or desirable for gd to becomea kitchen-sink graphics package, but version 1.2 incorporatesmost of the commonly requested features for a 2D package.Font support does need improvement, and support for the PNGgraphics format will arrive in a forthcoming release.<P><A NAME="gdperl"><H3>What if I want to use Perl instead of C?</H3></A>gd can also be used from Perl, courtesy ofLincoln Stein's<a href="http://www-genome.wi.mit.edu/ftp/pub/software/WWW/GD.html">GD.pm</a> library, which uses gd as the basis for a set ofPerl 5.x classes. GD.pm is based on gd 1.1.1 but gd 1.2 shouldbe compatible.<A NAME="gdtcl"><H3>What if I want to use Tcl instead of C?</H3></A>gd can also be used from Tcl by way of the<a href="http://guraldi.hgp.med.umich.edu/gdtcl.html">gdtcl</a>Tcl extension.<A NAME="gdit"><H3>What if I want to use another scripting language?</H3></A>There are, at the moment, at least three simple interpreters thatperform gd operations. You can output the desired commands to a simpletext file from whatever scripting language you prefer to use, theninvoke the interpreter.<p>These packages are based on gd 1.1.1 as of this writing but shouldbe compatible with gd 1.2 with minimal tweaking.<ul><li><a href="http://www.demon.co.uk/3Wiz/gdit/">gdit</a>, by DavidHarvey-George<li><a href="http://s27w007.pswfs.gov/tgd/">tgd</a>, by Bradley K. Sherman<li><a href="http://www.unimelb.edu.au/fly/fly.html">fly</a>, by Martin Gleeson</ul><P><A NAME="whatsnew1.2"><H3>What's new in version 1.2?</H3></A>Version 1.2 is another fine-tuning release. The next major releasewill after 1.2 will be version 2.0 and will feature support forthe new <a href="http://sunsite.unc.edu/boutell/png.html">PNG</a>graphics format as well as improved font support. gd 1.2 doesadd several new fonts in the meantime.<p>Version 1.2 moves gd to ANSI standard C. Non-ANSI C compilers,such as the old SunOS 4.1.3 cc compiler, will not work. The useof pre-ANSI C led to several long-standing bugs, and the ANSI C standard has been with us for nearly ten years now. If your compiler does not support ANSI, upgrade to a recent release of your compiler, or get gcc, which is free and does support ANSI C. <P>The provided Unix Makefile has been changed to be a bitmore broadly compatible, and to acknowledge the changes thatmay be necessary on various systems.<P>Version 1.2 also includes the following improvements:<P><ul><li><a href="#gdImageCopy">gdImageCopy</a> and<a href="#gdImageCopyResized">gdImageCopyResized</a> now ignorepixels which are transparent in the source image. This is allowseasy copying of non-square regions, which could previously beaccomplished only with brushes.<li><a href="#gdImageFilledPolygon">gdImageFilledPolygon</a>now draws horizontal edges correctly, correcting along-standing bug. In addition, gdImageFilledPolygon copeswith polygons which have several horizontal segments onthe same scan line. There can still be a few pixels ofdisagreement between gdImagePolygon and gdImageFilledPolygonwith regard to the borders of the polygon, however.<li>Several new public-domain fonts are included, courtesy ofJoseph M. Orost at AT&T.<li>gd now properly recognizes an existing image with ahigh color slot number transparent.<li>Bugs in the <a href="#gdImageCreateFromXbm">gdImageCreateFromXbm</a>function have been corrected. Previously the function was incorrectfor image widths not evenly divisible by eight.</ul><P><A NAME="whatsnew1.1.1"><H3>What's new in version 1.1.1?</H3></A>A fine-tuning and bug-fixing release.<P><A HREF="#gdImageSetStyle">gdImageSetStyle</A> now copiesthe style array to make it easier to take advantage ofthe line styling feature; it is now safe to free the memoryassociated with your style array after setting a style(or allocate styles on the stack...).  This should not break existing code.<P><A HREF="#webgif">webgif</A>, a small but powerful GIF-manipulating utility program, has been added as an additional code example.<P>An access macro to determinewhether an image is interlaced has been added; see<A HREF="gdImageGetInterlaced">gdImageGetInterlaced</A>.<P>A better Unix Makefile, provided by Mark Scott. Note thatan actual library (libgd.a) is now produced; you will wantto link with this library in your own gd apps, in the samemanner that gddemo and giftogd link with it. You no longerneed to explicitly list the standard font files on the link line. No doubt many users have already made this enhancement themselves.<p><strong>Important:</strong> depending on your system you mayneed to rewrite this Makefile. Basic code-compiling skillsare expected for the use of this library.<P><A HREF="#koblas">David Koblas</A> has been given proper creditfor the original GIF decoding routine; previously I erroneouslycredited David Rowley with both the encoder and the decoder.<P><A HREF="#gdImageFill">gdImageFill</A> no longer crashes whenattempting to fill a region with the color it already has.Also, attempting to fill a region with the special color<A HREF="#gdTiled">gdTiled</A> no longer crashes. <P>However, filling a region with a transparent tile has beenforbidden (gdImageFill simply draws nothing in this case).Otherwise, gd would not know when to stop drawingwithout the use of an additional image to keep track ofwhich pixels have been visited. <P>Invoking <A HREF="#gdImageFillToBorder">gdImageFillToBorder</A>with a special border color such as <A HREF="#gdTiled">gdTiled</A>now fails, for similar reasons. However, the coloryou are filling <em>with</em> can be <A HREF="#gdTiled">gdTiled</A>,even if it is transparent. See the discussion of<A HREF="#gdImageFillToBorder">gdImageFillToBorder</A> foradditional caveats.<P>Many documentation fixes.<P><A NAME="whatsnew1.1"><H3>What's new in version 1.1?</H3></A><P><UL><LI><A HREF="#gdImageFilledPolygon">Polygon fills</A></LI><LI><A HREF="#gdImageSetStyle">Line styling</A></LI><LI><A HREF="#gdImageSetBrush">"Brushing" of lines with a brush image</A></LI><LI><A HREF="#gdImageSetTile">Tiling of polygon, rectangle and flood-fills</A><LI><A HREF="#gdImageInterlace">Interlaced GIFs for gradual fade-in</A></LI></LI><LI>Macros to access <A HREF="#gdImageSX">image size</A>, etc.</LI></UL><P><A NAME="required"><H3>What else do I need to use gd?</H3></A><P>To use gd, you will need an ANSI C compiler. Any full-ANSI-standardC compiler should be adequate, although those with PCs will need to replacethe Makefile with one of their own. <strong>The cc compiler releasedwith SunOS 4.1.3 is not an ANSI C compiler. Get gcc, which is freelyavailable. See the Sun-related newsgroups for more information.</strong><P>You will also want a GIF viewer, if you do not already haveone for your system, since you will need a good way to check theresults of your work. lview is a good package for Windows PCs; xv is a good package for X11. There areGIF viewers available for every graphics-capablecomputer out there, so consult newsgroups relevant toyour particular system.<P><A NAME="getgd"><H3>How do I get gd?</H3></A><P>You can <A HREF="http://www.boutell.com/gd/gd1.2.tar.Z">fetch gd as a compressed tar file</A> from www.boutell.com.<A NAME="buildgd"><H3>How do I build gd?</H3></A><P>In order to build gd, first uncompress and untar the gd.tar file with thefollowing commands:<P><em>Note:</em> if you have a non-Unix system, you will needto acquire versions of "uncompress" and "tar" suitable foryour system. Both have been ported to PC and Macenvironments. Consult newsgroups relevant to yourparticular system.<PRE>uncompress gd1.2.tar.Ztar -xf gd1.2.tar</PRE>This will create the directory "gd1.2" beneath the currentdirectory.<P>cd to this directory and examine the Makefile, which you may needto change slightly depending on your installation (or more thanslightly for a Windows or Mac environment).<P>Now, to build the demonstration program, just type "make gddemo"if you are working in a command-line environment. If all goes well,the program "gddemo" will be compiled and linked without incident.Depending on your system you may need to edit the Makefile.Understanding the basic techniques of compiling and linkingprograms on your system is up to you.<P>You have now built a demonstration program which shows offthe capabilities of gd. To see it in action, type"gddemo".<P>gddemo should execute without incident, creating the filedemoout.gif. (Note there is also a file named demoin.gif,which is provided in the package as part of the demonstration.)<P>Display demoout.gif in your GIF viewer. The image shouldbe 128x128 pixels and should contain an image of thespace shuttle with the word "hi" written in the upperleft corner twice (once across and once upwards),an arc in the middle and an oval intersecting the arc(these are somewhat faint).

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?