Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<style type="text/css">
2
		<!--
3
		A:link        {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
4
		A:visited     {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
5
		A:hover       {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: underline; color: #FF0000}
6
		th            {font-family: helvetica, arial; color : blue; font-size:85%; background : lightgrey; border-right:black solid 1pt; border-bottom:black solid 1pt;}
7
		//-->
8
		</style><hr><a name="_C_IMAGE"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>Image</b></div>
9
<i>(Defined in: jpgraph.php : 5929)</i><table border=1><tr><td>&nbsp;<a href="Image.html" style="font-family:arial;font-weight:bold;color:darkblue;">Image</a>&nbsp;</td></tr><tr><td valign=top>&nbsp;<a href="Image.html#_IMAGE_ROUNDEDRECTANGLE">RoundedRectangle()</a>&nbsp;<br>
10
&nbsp;<a href="Image.html#_IMAGE_SETALPHABLENDING">SetAlphaBlending()</a>&nbsp;<br>
11
&nbsp;<a href="Image.html#_IMAGE_SETANTIALIASING">SetAntiAliasing()</a>&nbsp;<br>
12
&nbsp;<a href="Image.html#_IMAGE_SETCANVASCOLOR">SetCanvasColor()</a>&nbsp;<br>
13
&nbsp;<a href="Image.html#_IMAGE_SETEXPIRED">SetExpired()</a>&nbsp;<br>
14
&nbsp;<a href="Image.html#_IMAGE_SETIMGFORMAT">SetImgFormat()</a>&nbsp;<br>
15
&nbsp;<a href="Image.html#_IMAGE_SETMARGIN">SetMargin()</a>&nbsp;<br>
16
&nbsp;<a href="Image.html#_IMAGE_SETQUALITY">SetQuality()</a>&nbsp;<br>
17
&nbsp;<a href="Image.html#_IMAGE_SETTRANSPARENT">SetTransparent()</a>&nbsp;<br>
18
</td></tr></table>&nbsp;<p><div style="font-weight:bold;font-family:arial;font-size:100%;">Class usage and Overview</div>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.
19
<p>
20
By replacing Image (and RotImage) it is possible to change the output driver for the whole library withou any further changes.
21
<p>
22
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.
23
<p>
24
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.
25
<p>
26
Note that all coordinates in methods belonging to Image is given in direct screen coordinates.
27
 
28
 
29
 
30
 <p> &nbsp;
31
<div style="font-weight:bold;font-family:arial;font-size:85%;">See also related classes:</div><a href="RotImage.html">RotImage</a>, <a href="RGB.html">RGB</a> and <a href="TTF.html">TTF</a> <p> &nbsp;<hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p>
32
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_ROUNDEDRECTANGLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
33
function&nbsp;RoundedRectangle($xt,$yt,$xr,$yl,$r)</font>
34
</b></div></a></span>
35
 
36
<span style='font-family:arial;font-size:90%;'><i>Draw a rectangle with rounded corners</i></span><p>
37
 
38
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
39
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
40
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
41
$xt</font>
42
 
43
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Top left X</td></tr>
44
 
45
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
46
$yt</font>
47
 
48
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Top left Y</td></tr>
49
 
50
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
51
$xr</font>
52
 
53
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Bottom right X</td></tr>
54
 
55
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
56
$yl</font>
57
 
58
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Bottom right Y</td></tr>
59
 
60
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
61
$r</font>
62
 
63
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
64
5</font>
65
</td><td>Corner radius</td></tr>
66
</table>
67
 
68
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a rectangle with rounded corners.&nbsp;<br>
69
 
70
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
71
$img-&gt;RoundedRectangle(0,0,100,100,10);</font>
72
</span><br>
73
<p>
74
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_SETALPHABLENDING"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
75
function&nbsp;SetAlphaBlending($aFlg)</font>
76
</b></div></a></span>
77
 
78
<span style='font-family:arial;font-size:90%;'><i>Enable alpha blending of colors</i></span><p>
79
 
80
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
81
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
82
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
83
$aFlg</font>
84
 
85
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
86
true</font>
87
</td><td>True/false = Enable/Disable alpha blending</td></tr>
88
</table>
89
 
90
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>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.
91
<p>
92
Alphablending is enabled by default (when GD2 is used) but can be turned off by a call to this function with the argument false.&nbsp;<br>
93
 
94
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
95
$graph-&gt;img-&gt;SetAlphaBlending();
<br />...
<br />$lineplot-&gt;SetFillColor('orange@0.5');
<br /></font>
96
</span><br>
97
<p>
98
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_SETANTIALIASING"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
99
function&nbsp;SetAntiAliasing()</font>
100
</b></div></a></span>
101
102
<span style='font-family:arial;font-size:90%;'><i>Specify if anti-aliasing should be used</i></span><p>
103
<br>
104
 
105
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify if anti-aliasing should be used.
106
107
 
108
109
 
110
&nbsp;<br>
111
 
112
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
113
$graph-&gt;img-&gt;SetAntiAliasing();
<br /></font>
114
</span><br>
115
<p>
116
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_SETCANVASCOLOR"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
117
function&nbsp;SetCanvasColor($aColor)</font>
118
</b></div></a></span>
119
120
<span style='font-family:arial;font-size:90%;'><i>Set canvas color</i></span><p>
121
122
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
123
 
124
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
125
 
126
127
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Color</td></tr>
128
</table>
129
130
 
131
<p>
132
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.
133
 
134
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETMARGINCOLOR">Graph::SetMarginColor</a> and <a href="Graph.html#_GRAPH_SETCOLOR">Graph::SetColor</a>
135
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
136
$graph-&gt;SetCanvasColor('lightblue');</font>
137
</span><br>
138
<p>
139
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_SETEXPIRED"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
140
function&nbsp;SetExpired($aFlg)</font>
141
</b></div></a></span>
142
143
<span style='font-family:arial;font-size:90%;'><i>Turn on/off expired header</i></span><p>
144
145
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
146
 
147
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
148
 
149
150
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
151
true</font>
152
</td><td>True=Return expired header.</td></tr>
153
 
154
155
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>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.
156
<p>
157
By default this is turned on.
158
 
159
Note: There is no reason as far as we can tell to turn this off.
160
&nbsp;<br>
161
162
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
163
$graph-&gt;img-&gt;SetExpired(false);</font>
164
</span><br>
165
 
166
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_SETIMGFORMAT"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
167
function&nbsp;SetImgFormat($aFormat,$aQuality)</font>
168
</b></div></a></span>
169
170
<span style='font-family:arial;font-size:90%;'><i>Specify what image format to use</i></span><p>
171
172
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
173
 
174
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
175
 
176
177
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Image format</td></tr>
178
179
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
180
 
181
182
 
183
75</font>
184
</td><td>No description available</td></tr>
185
 
186
187
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify image format. Note depending on your installation    of PHP not all formats may be supported.
188
189
Supported formats are:
190
 
191
<li> "gif", GIF format. Please note that GD 1.8 and above no longer supports the GIF format.
192
 
193
<li> "jpeg", JPEG format. The quality of the JPEG format can be specified with the SetQuality() method.
194
</ul>
195
&nbsp;<br>
196
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_SETQUALITY">Image::SetQuality</a>
197
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
198
$graph-&gt;img-&gt;SetImgFormat('jpeg');</font>
199
</span><br>
200
<p>
201
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_SETMARGIN"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
202
function&nbsp;SetMargin($lm,$rm,$tm,$bm)</font>
203
</b></div></a></span>
204
205
<span style='font-family:arial;font-size:90%;'><i>Specify margin for the plot area</i></span><p>
206
207
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
208
 
209
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
210
 
211
212
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Left margin</td></tr>
213
214
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
215
 
216
217
 
218
219
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
220
 
221
222
 
223
224
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
225
 
226
227
 
228
</table>
229
230
 
231
&nbsp;<br>
232
233
 
234
$graph-&gt;img-&gt;SetMargin(20,20,40,20);
<br /></font>
235
</span><br>
236
 
237
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_SETQUALITY"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
238
function&nbsp;SetQuality($q)</font>
239
</b></div></a></span>
240
241
<span style='font-family:arial;font-size:90%;'><i>Specify JPEG image quality</i></span><p>
242
243
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
244
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
245
 
246
$q</font>
247
 
248
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Image quality paramer (0-100)</td></tr>
249
</table>
250
251
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify JPEG image quality. For this to have any effect the image format, as specified with SetImgFormat(), must have been set to "jpeg".
252
 
253
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.&nbsp;<br>
254
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_SETIMGFORMAT">Image::SetImgFormat</a>
255
 
256
$graph-&gt;image-&gt;SetQuality(40);</font>
257
 
258
<p>
259
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_IMAGE_SETTRANSPARENT"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
260
function&nbsp;SetTransparent($color)</font>
261
</b></div></a></span>
262
263
<span style='font-family:arial;font-size:90%;'><i>Specify transparent color</i></span><p>
264
265
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
266
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
267
 
268
$color</font>
269
 
270
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Color</td></tr>
271
</table>
272
273
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify transparent color for image.&nbsp;<br>
274
 
275
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
276
$graph-&gt;img-&gt;SetTransparent("white");
<br /></font>
277
 
278
<p> <hr> <p>