CLASS Image
(Defined in: jpgraph.php : 3788) 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
Argument | Default | Description |
$xt
| | Top left X |
$yt
| | Top left Y |
$xr
| | Bottom right X |
$yl
| | Bottom right Y |
$r
| | Corner radius |
Description
Draw a rectangle with rounded corners.
function SetAntiAliasing()
Specify if anti-aliasing should be used
Description
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
Image::Line
$graph->img->SetAntiAliasing();
function SetImgFormat($aFormat)
Specify what image format to use
Argument | Default | Description |
$aFormat
| | Image format |
Description
Specify image format. Note depending on your installation of PHP not all formats may be supported.
Supported formats are:
- "gif", GIF format. Please note that GD 1.8 and above no longer supports the GIF format.
- "png", PNG format
- "jpeg", JPEG format. The quality of the JPEG format can be specified with the SetQuality() method.
See also
Image::SetQuality
$graph->img->SetImgFormat('jpeg');
function SetMargin($lm,$rm,$tm,$bm)
Specify margin for the plot area
Argument | Default | Description |
$lm
| | Left margin |
$rm
| | Right margin |
$tm
| | Top margin |
$bm
| | Bottom margin |
Description
Specify margin for the plot area.
$graph->img->SetMargin(20,20,40,20);
function SetTransparent($color)
Specify transparent color
Argument | Default | Description |
$color
| | Color |
Description
Specify transparent color for image.
$graph->img->SetTransparent("white");