| 1 |
lars |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
|
|
2 |
<HTML>
|
|
|
3 |
<HEAD>
|
|
|
4 |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
|
|
|
5 |
<LINK REL="Start" HREF="index.html">
|
|
|
6 |
<LINK REL="Contents" HREF="toc.html">
|
|
|
7 |
<LINK REL="Prev" HREF="814Addingatabtitle.html">
|
|
|
8 |
<LINK REL="Next" HREF="816Usingabackgroundgradient.html">
|
|
|
9 |
<STYLE TYPE="text/css"><!--
|
|
|
10 |
BODY { font-family: serif }
|
|
|
11 |
H1 { font-family: sans-serif }
|
|
|
12 |
H2 { font-family: sans-serif }
|
|
|
13 |
H3 { font-family: sans-serif }
|
|
|
14 |
H4 { font-family: sans-serif }
|
|
|
15 |
H5 { font-family: sans-serif }
|
|
|
16 |
H6 { font-family: sans-serif }
|
|
|
17 |
SUB { font-size: smaller }
|
|
|
18 |
SUP { font-size: smaller }
|
|
|
19 |
PRE { font-family: monospace }
|
|
|
20 |
A { text-decoration: none }
|
|
|
21 |
--></STYLE>
|
|
|
22 |
</HEAD>
|
|
|
23 |
<BODY>
|
|
|
24 |
<A HREF="toc.html">Contents</A>
|
|
|
25 |
<A HREF="814Addingatabtitle.html">Previous</A>
|
|
|
26 |
<A HREF="816Usingabackgroundgradient.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H2><A NAME="8_15">8.15 Using background images</A></H2>
|
|
|
29 |
<P> Instead of having a single color background you can easily have an
|
|
|
30 |
arbitrary image as the background. The image may be in either PNG, JPG
|
|
|
31 |
or GIF format depending on what your installation supports.</P>
|
|
|
32 |
<P></P>
|
|
|
33 |
<HR> <SMALL>
|
|
|
34 |
<P><STRONG> A note on GD:</STRONG> If you are using GD 2.xx you must
|
|
|
35 |
make sure that the define USE_TRUECOLOR is set to true. This is also
|
|
|
36 |
the default. Failure to do so in combination with GD 2.xx will make the
|
|
|
37 |
background image just look like a solid black square.</P>
|
|
|
38 |
</SMALL>
|
|
|
39 |
<HR>
|
|
|
40 |
<P> To use a specific image as the background you just have to use the
|
|
|
41 |
method <A href="../ref/Graph.html#_GRAPH_SETBACKGROUNDIMAGE">
|
|
|
42 |
Graph::SetBackgroundImage()</A> The arguments specify file-name, how
|
|
|
43 |
the image should be positioned in the graph and finally the format of
|
|
|
44 |
the image (if it is in JPG, PNG or GIF) format. If the format is
|
|
|
45 |
specified as "auto" (the default) then the appropriate image format
|
|
|
46 |
will be determined from the extension of the image file.</P>
|
|
|
47 |
<P> The file name is of course obvious but the second argument might not
|
|
|
48 |
be. This arguments determine how the image should be copied onto the
|
|
|
49 |
graph image. You can specify three different variants here</P>
|
|
|
50 |
<OL>
|
|
|
51 |
<LI> BGIMG_ COPY This will just copy the image unchanged onto the graph
|
|
|
52 |
from the top left corner.</LI>
|
|
|
53 |
<LI> BGIMG_CENTER This will just copy the image unchanged onto the graph
|
|
|
54 |
but it will center the image in the graph.</LI>
|
|
|
55 |
<LI> BGIMG_FILLFRAME This will scale the image to exactly fit the whole
|
|
|
56 |
graph image.</LI>
|
|
|
57 |
<LI> BGIMG_FILLPLOT This will scale the image to exactly fit just the
|
|
|
58 |
plot area of the graph.</LI>
|
|
|
59 |
</OL>
|
|
|
60 |
<P></P>
|
|
|
61 |
<P></P>
|
|
|
62 |
<HR><STRONG> The following section only applies to palette based images.
|
|
|
63 |
True color images can NOT be manipulated this way. Applying the
|
|
|
64 |
following sections to true-color images will have no affect.</STRONG>
|
|
|
65 |
<HR>
|
|
|
66 |
<P> You might often find yourself wanting to use a background image as a
|
|
|
67 |
"waterstamp". This usually means taking the original image, import it
|
|
|
68 |
to some image editing program and then "bleaching" the color
|
|
|
69 |
saturation, reducing the contrast and so on. Finally you save the
|
|
|
70 |
modified image which you then use as a background image.</P>
|
|
|
71 |
<P> This whole process can be automatically accomplished in JpGraph by
|
|
|
72 |
using the method <A href="../ref/Graph.html#_GRAPH_ADJBACKGROUNDIMAGE">
|
|
|
73 |
Graph::AdjBackgroundImage()</A> which allow you to adjust color
|
|
|
74 |
saturation, brightness and contrast of the background image.</P>
|
|
|
75 |
<P><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB">
|
|
|
76 |
$graph</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">
|
|
|
77 |
AdjBackgroundImage</FONT><FONT color="#007700">(...)</FONT><FONT color="#0000BB">
|
|
|
78 |
</FONT></FONT></CODE></DIV></P>
|
|
|
79 |
<P></P>
|
|
|
80 |
<P> to achieve the "watercolor" effect to avoid the image being too
|
|
|
81 |
intrusive in the graph.<DIV class="example">
|
|
|
82 |
<BR> <A href="exframes/frame_backgroundex03.html" target="blank"><IMG border="0"
|
|
|
83 |
HEIGHT="200" src="img/backgroundex03.png" WIDTH="400"></A>
|
|
|
84 |
<BR><B>Figure 89:</B> Example on using a watermark type background image
|
|
|
85 |
<A href="exframes/frame_backgroundex03.html" target="blank">[src]</A>
|
|
|
86 |
<P></P>
|
|
|
87 |
</DIV></P>
|
|
|
88 |
<P><DIV class="note"><B>Note:</B> The background image depicts a 1998
|
|
|
89 |
Triumph Tiger. This bike is a 900cc off-road bike.</DIV></P>
|
|
|
90 |
<HR NOSHADE>
|
|
|
91 |
<A HREF="toc.html">Contents</A>
|
|
|
92 |
<A HREF="814Addingatabtitle.html">Previous</A>
|
|
|
93 |
<A HREF="816Usingabackgroundgradient.html">Next</A>
|
|
|
94 |
</BODY>
|
|
|
95 |
</HTML>
|