| 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="918AntialiasinginJpGraph.html">
|
|
|
8 |
<LINK REL="Next" HREF="919Rotatingthegraphs.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="918AntialiasinginJpGraph.html">Previous</A>
|
|
|
26 |
<A HREF="919Rotatingthegraphs.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H3><A NAME="9_18_1">9.18.1 Enabling anti-aliased lines</A></H3>
|
|
|
29 |
<P> Anti-aliased lines are enabled by calling the method <A href="../ref/Image.html#_IMAGE_SETANTIALIASING">
|
|
|
30 |
SetAntiAliasing()</A> in the <A href="../ref/Image.html#_C_IMAGE">
|
|
|
31 |
Image class</A> in the script where you want to use anti-aliasing.</P>
|
|
|
32 |
<P> The anti-aliasing for lines works by "smoothing" out the edges on
|
|
|
33 |
the line by using a progressive scale of colors interpolated between
|
|
|
34 |
the background color and the line color.</P>
|
|
|
35 |
<P><DIV class="note"><B>Note:</B> The algorithm used for anti-aliasing
|
|
|
36 |
of lines is quite simple. It would be possible to achieve even better
|
|
|
37 |
result by doing some real 2D signal processing. However, doing real
|
|
|
38 |
time 2D signal processing on a HTTP server would be foolish so the
|
|
|
39 |
design is deliberately kept simple. To achieve best visual result
|
|
|
40 |
always use a dark line color on a light background.</DIV></P>
|
|
|
41 |
<P> An example will show that this, quite simple algorithm, gives a
|
|
|
42 |
reasonable good result. The figures below shows a radar plot with and
|
|
|
43 |
without anti-aliasing.</P>
|
|
|
44 |
<P><DIV class="example">
|
|
|
45 |
<BR> <A href="exframes/frame_radarex8.html" target="blank"><IMG border="0"
|
|
|
46 |
HEIGHT="200" src="img/img/img/img/img/img/radarex8.png" WIDTH="300"></A>
|
|
|
47 |
<BR><B>Figure 174:</B> Spiderplot without anti-aliasing <A href="exframes/frame_radarex8.html"
|
|
|
48 |
target="blank">[src]</A>
|
|
|
49 |
<P></P>
|
|
|
50 |
</DIV></P>
|
|
|
51 |
<P></P>
|
|
|
52 |
<P><DIV class="example">
|
|
|
53 |
<BR> <A href="exframes/frame_radarex8.1.html" target="blank"><IMG border="0"
|
|
|
54 |
HEIGHT="200" src="img/img/img/img/img/img/radarex8.1.png" WIDTH="300"></A>
|
|
|
55 |
<BR><B>Figure 175:</B> Spiderplot with anti-aliasing <A href="exframes/frame_radarex8.1.html"
|
|
|
56 |
target="blank">[src]</A>
|
|
|
57 |
<P></P>
|
|
|
58 |
</DIV></P>
|
|
|
59 |
<P></P>
|
|
|
60 |
<P> One thing you need to keep in mind when deciding to use
|
|
|
61 |
anti-aliasing is that it could have potentially a dramatic effect on
|
|
|
62 |
the time it takes to generate the image. Line drawing with
|
|
|
63 |
anti-aliasing turned on is roughly 8 times slower than the normal line
|
|
|
64 |
drawing so treat this feature wisely.</P>
|
|
|
65 |
<P> Furthermore there are a couple of "gotchas" you should be aware of
|
|
|
66 |
when using anti-aliasing.</P>
|
|
|
67 |
<OL>
|
|
|
68 |
<LI> Anti-aliased lines uses up more of the available color-palette. The
|
|
|
69 |
exact number of colors used is dependent on the line-angle, a near
|
|
|
70 |
horizontal or near vertical line uses more colors (number of lines with
|
|
|
71 |
different angles uses more colors). Hence it might not be possible to
|
|
|
72 |
use anti-aliasing with color-gradient fill since the number of
|
|
|
73 |
available colors in the palette might not be enough. A normal palette
|
|
|
74 |
can keep around 256 colors. This means that you are advised to use a
|
|
|
75 |
true-color image when using anti-aliasing.</LI>
|
|
|
76 |
<LI> Anti-aliasing does not work very well together with background
|
|
|
77 |
images since it assumes a the same solid color on each side of the
|
|
|
78 |
line. Doing a more advanced anti-aliasing algorithm would simple take
|
|
|
79 |
to much processing power.</LI>
|
|
|
80 |
<LI>Anti-aliased lines will ignore the line width specified. They will
|
|
|
81 |
always have a width of roughly 1.</LI>
|
|
|
82 |
</OL>
|
|
|
83 |
<P></P>
|
|
|
84 |
<HR NOSHADE>
|
|
|
85 |
<A HREF="toc.html">Contents</A>
|
|
|
86 |
<A HREF="918AntialiasinginJpGraph.html">Previous</A>
|
|
|
87 |
<A HREF="919Rotatingthegraphs.html">Next</A>
|
|
|
88 |
</BODY>
|
|
|
89 |
</HTML>
|