Image module
This module interfaces to the GD library for creating and editing JPEG and PNG images. It also provides a displayPage function so that the generated images may be easily output by webapps.
See the Shape CGI for an example of the use of this module on the web.
Type Synonyms
Color=Colour
Data types
- Image::ArcStyle - Arc fill styles.
- Image::Colour - Drawing colour.
- Image::Font - Drawing font.
- Image::Image - Image data.
- Image::ImageType - Image format
- Image::WebImage - Web image data
Exceptions
- ColourOutOfRange - Colour value out of range
Functions
- Void arc(Image img,Int cx,Int cy,Int w,Int h,Int start,Int end,Colour col,Bool filled=false,[ArcStyle] style=[Arc]) - Draw an arc of an ellipse.
- Void copy(Image dest,Image src,Int dstx,Int dsty,Int srcx,Int srcy,Int w,Int h) - Copy a portion of an image.
- Void copyResized(Image dest,Image src,Int dstx,Int dsty,Int srcx,Int srcy,Int destw,Int desth,Int srcw,Int srch) - Copy and resize a portion of an image.
- Image create(Int x,Int y,Bool truecolour=false) - Create a new image
- Image create(String fname,ImageType ty) - Create an image from a file
- Void dashedLine(Image img,Int x1,Int y1,Int x2,Int y2,Colour col) - Draw a dashed line.
- Void destroy(Image img) - Destroy an image
- Void displayPage(WebImage image) - Display function for webapps
- Void drawString(Image img,Font font,Int x,Int y,String str,Colour col,Bool up=false) - Draw a text string.
- Void ellipse(Image img,Int cx,Int cy,Int w,Int h,Colour col,Bool filled=false) - Draw an ellipse.
- Binary getJPEG(Image img,Int qual=-1) - Get JPEG data
- Binary getPNG(Image img) - Get PNG data
- Font giant() - Giant font
- Int height(Image img) - Get image height
- Font large() - Large font
- Void line(Image img,Int x1,Int y1,Int x2,Int y2,Colour col) - Draw a line.
- Colour makeColour(Image img,Int r,Int g,Int b,Int a=0) - Allocate a colour.
- Void makeJPEG(Image img,Int qual=-1,String file="") - Output a JPEG.
- Void makePNG(Image img,String file="") - Output a PNG.
- Font mediumBold() - Medium bold font
- Void poly(Image img,[Pair<Int, Int> ] points,Colour col,Bool filled=false) - Draw a polygon.
- Void rectangle(Image img,Int x1,Int y1,Int x2,Int y2,Colour col,Bool filled=false) - Draw a rectangle.
- Void setPixel(Image img,Int x,Int y,Colour col) - Set a pixel's colour.
- Font small() - Small font
- Font tiny() - Tiny font
- WebImage webJPEG(Image img,[Pair<String, String> ] extraheaders,Int qual=-1) - Get a JPEG for webmain
- WebImage webPNG(Image img,[Pair<String, String> ] extraheaders) - Get a PNG for webmain
- Int width(Image img) - Get image width