(Defined in: jpgraph.php : 5929)

Class usage and Overview
The Image class encapsulates the very lowest layer in the jpgraph library. It encapsulates the GD library function and presents a coherent interface hiding som of the details in the setup and management of GD.

By replacing Image (and RotImage) it is possible to change the output driver for the whole library withou any further changes.

A very close related class is RotImage which builds directly on Image but in additoin provides a 2D rotation featire, i.e the image may be rotated around a given point and possible also translated.

The image gets instantiated through in the Graph::Img property, or more accurate the RotImage class gets instantiated. The only method in this class that any end user is likely to need (and use) is the SetMargin() method used to give the margins around between the end of the image and the actual plotarea.

Note that all coordinates in methods belonging to Image is given in direct screen coordinates.


See also related classes:
RotImage, RGB and TTF


Class Methods



function RoundedRectangle($xt,$yt,$xr,$yl,$r)
Draw a rectangle with rounded corners

$xt  Top left X
$yt  Top left Y
$xr  Bottom right X
$yl  Bottom right Y
$r 5 Corner radius

Draw a rectangle with rounded corners. 





function SetAlphaBlending($aFlg)
Enable alpha blending of colors

$aFlg true True/false = Enable/Disable alpha blending

Alpha blending for colors can only be used with GD 2.x and above. You specify the alpha channel by adding a '@[alpha-value]' to your normal color specification. The alpha value is specified as a fraction in the range [0, 1] and indicated how much of the background color should be visible.

Alphablending is enabled by default (when GD2 is used) but can be turned off by a call to this function with the argument false. 





function SetAntiAliasing()
Specify if anti-aliasing should be used

Specify if anti-aliasing should be used. Enabling anti-aliasing will greatly improve the visual apperance of certain graphs. For example spider graphs greatly benefit from this. Note: Using anti-aliasing makes line drawing roughly 8 time slower than normal lines !! So you image will take longer to construct.  
See also





function SetCanvasColor($aColor)
Set canvas color

$aColor  Color

Set canvas color. The canvas color is the fill color for the frame when it is first created. This is white by defult. If you specify a frame or plot area color this background color will never be visible.

The one time it matters is when you use a drop shadow on the graph. In the small area (top right and bottom left) where there is an empty are which is covered by neither the shadow nor the graph margin this area will have the canvas color.  

See also
Graph::SetMarginColor and Graph::SetColor





function SetExpired($aFlg)
Turn on/off expired header

$aFlg true True=Return expired header.

Specify that the header returned should not only contain the image format but also the meta tags to force the browser not to cache and reload the image every time the script is called.

By default this is turned on.

Note: There is no reason as far as we can tell to turn this off.  





function SetImgFormat($aFormat,$aQuality)
Specify what image format to use

$aFormat  Image format
$aQuality 75 No description available

Specify image format. Note depending on your installation of PHP not all formats may be supported. Supported formats are:  
See also





function SetMargin($lm,$rm,$tm,$bm)
Specify margin for the plot area

$lm  Left margin
$rm  Right margin
$tm  Top margin
$bm  Bottom margin

Specify margin for the plot area.  





function SetQuality($q)
Specify JPEG image quality

$q  Image quality paramer (0-100)

Specify JPEG image quality. For this to have any effect the image format, as specified with SetImgFormat(), must have been set to "jpeg". The quality is specified as an integer in the range 0 (worst quality) to 100 (best quality) . By default the quality is set o 75. 
See also





function SetTransparent($color)
Specify transparent color

$color  Color

Specify transparent color for image.