ChartDirector 7.0 (Perl Edition)

DrawArea


The DrawArea class represents drawing surfaces, with methods for performing graphics primitives (such as drawing lines, shapes and texts) and the surfaces.

All ChartDirector chart objects contains an internal DrawArea object for drawing the charts. This DrawArea object is accessible via BaseChart.getDrawArea or BaseChart.makeChart3. This allows developers to apply custom graphics operations on the charts.

ChartDirector also supports creating standalone DrawArea objects by calling the DrawArea.DrawArea constructor. One common application is to use ChartDirector as a general purpose graphics library (e.g. adding text annotations to existing images, creating GIF buttons on the fly, etc).

MethodInheritedDescription
DrawArea(Self)Creates a DrawArea object.
setSize(Self)Sets the size and background color of the drawing surface.
resize(Self)Resize the drawing surface.
getWidth(Self)Gets the width of the drawing surface in pixels.
getHeight(Self)Gets the height of the drawing surface in pixels.
setClipRect(Self)Sets the clip rectangle.
setBgColor(Self)Sets the background color of the image.
move(Self)Moves the drawing surface.
rotate(Self)Rotate the drawing surface.
hFlip(Self)Flip the drawing surface along the central horizontal line.
vFlip(Self)Flip the drawing surface along the central vertical line.
clone(Self)Copy the current DrawArea object to another DrawArea object, with optional resizing.
pixel(Self)Draw a pixel.
getPixel(Self)Gets the color of a pixel.
line(Self)Draw a straight line.
hline(Self)Draws a horizontal line.
vline(Self)Draws a vertical line.
arc(Self)Draws a circular or elliptical arc.
rect(Self)Draws a rectangle.
polygon(Self)Draws a polygon.
polyShape(Self)Draws a shape.
surface(Self)Draws a parallelogram.
sector(Self)Draws a circular or elliptical sector.
cylinder(Self)Draws a cylinder surface as the area spanned by moving an arc.
circle(Self)Draws a circle or an ellipse.
fill(Self)Flood fill a region using the specified color.
fill2(Self)Fill a region using the specified color, where the region is bounded by a given border color.
text(Self)Draws text. This method is a simplified version of the DrawArea.text2 method.
text2(Self)Draws text.
text3(Self)Creates a TTFText object representing a text block. This method is a simplified version of the DrawArea.text4 method.
text4(Self)Creates a TTFText object representing a text block.
setDefaultFonts(Self)Sets the defaults for normal, bold, italic and bold-italic fonts.
setFontTable(Self)Sets an entry in the font table to the specified font name.
merge(Self)Copy another DrawArea to the current DrawArea.
tile(Self)Copy another DrawArea to the current DrawArea as a wallpaper.
setSearchPath(Self)Sets the search path for loading image files.
setResource(Self)Assigns a resource ID to a DrawArea object to allow it to be referenced using a resource path.
load(Self)Load an image file or resource into the current DrawArea, replacing any existing content.
loadPNG(Self)Load a PNG image or resource into the current DrawArea, replacing any existing content.
loadGIF(Self)Load a GIF image or resource into the current DrawArea, replacing any existing content.
loadJPG(Self)Load a JPG image or resource into the current DrawArea, replacing any existing content.
loadWMP(Self)Load a WAP bitmap image or resource into the current DrawArea, replacing any existing content.
rAffineTransform(Self)Perform reverse affine transformation on the drawing surface.
affineTransform(Self)Perform affine transformation on the drawing surface.
sphereTransform(Self)Wraps the drawing surface onto a sphere or ellipsoid.
hCylinderTransform(Self)Wraps the drawing surface onto a horizontal cylinder.
vCylinderTransform(Self)Wraps the drawing surface onto a vertical cylinder.
hTriangleTransform(Self)Wraps the drawing surface onto a horizontal triangle pointing leftwards.
vTriangleTransform(Self)Wraps the drawing surface onto a vertical triangle pointing upwards.
shearTransform(Self)Shear the drawing surface.
waveTransform(Self)Moves the pixels on the drawing surface according to a sinusoidal function to achieve a wave effect.
enableVectorOutput(Self)This method is deprecated. It has no effect and may be removed in future versions of ChartDirector.
setOutputOptions(Self)Sets output format options for the next chart output.
out(Self)Writes the DrawArea to an image file.
outPNG(Self)Writes the DrawArea to a PNG image file.
outPNG2(Self)Writes the DrawArea as a PNG image to memory.
outGIF(Self)Writes the DrawArea to a GIF image file.
outGIF2(Self)Writes the DrawArea as a GIF image to memory.
outJPG(Self)Writes the DrawArea to a JPEG image file.
outJPG2(Self)Writes the DrawArea as a JPEG image to memory.
outBMP(Self)Writes the DrawArea to a BMP image file.
outBMP2(Self)Writes the DrawArea as a BMP image to memory.
outWMP(Self)Writes the DrawArea to a WAP bitmap image file.
outWMP2(Self)Writes the DrawArea as a WAP bitmap image to memory.
outSVG(Self)Writes the DrawArea to a SVG or SVGZ image file.
outSVG2(Self)Writes the DrawArea as a SVG or SVGZ image to memory.
outPDF(Self)Writes the DrawArea to a PDF image file.
outPDF2(Self)Writes the DrawArea as a PDF image to memory.
setPaletteMode(Self)Sets the palette mode to use when writing the image in PNG format.
setDitherMethod(Self)Sets the dithering method in case dithering is necessary.
setTransparentColor(Self)Specifies a certain color to mean transparent when creating a raster image output.
setAntiAlias(Self)Controls whether anti-alias is used when drawing lines, shapes and text.
setInterlace(Self)Sets the interlace mode when creating the image.
setColorTable(Self)Change the colors in the palette starting with the specified offset position.
getARGBColor(Self)Obtain the ARGB color given a palette color.
adjustBrightness(Self)Creates a color that is a darkened or brightened version of the given color.
halfColor(Self)Creates a color that is half the intensity of the given color.
dashLineColor(Self)Creates a dash line color.
patternColor(Self)Creates a pattern color using an array of colors as the bitmap pattern.
patternColor2(Self)Creates a pattern color by using the image from the specified file or resource as the pattern.
linearGradientColor(Self)Creates a two-point linear gradient color.
linearGradientColor2(Self)Creates a multi-point linear gradient color.
radialGradientColor(Self)Creates a two-point radial gradient color.
radialGradientColor2(Self)Creates a multi-point radial gradient color.
angleGradientColor(Self)Creates an angle gradient color.
gradientColor(Self)Creates a two-point linear gradient color.
gradientColor2(Self)Creates a multi-point linear gradient color.
reduceColors(Self)Reduces the number of colors in the image.