summaryrefslogtreecommitdiff
path: root/docs/aggpas/gamma_correction.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/aggpas/gamma_correction.html')
-rw-r--r--docs/aggpas/gamma_correction.html245
1 files changed, 245 insertions, 0 deletions
diff --git a/docs/aggpas/gamma_correction.html b/docs/aggpas/gamma_correction.html
new file mode 100644
index 00000000..e5c91926
--- /dev/null
+++ b/docs/aggpas/gamma_correction.html
@@ -0,0 +1,245 @@
+<html><head><title>Anti-Grain Geometry - Gamma Correction</title>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel="stylesheet" type="text/css"
+href="gamma_correction_files/agg.css">
+</head><body><a name="PAGE_GAMMA_CORRECTION"><b></b></a>
+
+
+<table style="margin: 0px;" height="1px" width="640px" border="0"
+cellpadding="0" cellspacing="0">
+<tbody><tr>
+<td bgcolor="#583927"></td>
+</tr>
+</tbody></table>
+<table style="margin: 0px;" width="640px" border="0" cellpadding="0"
+cellspacing="0">
+<tbody><tr>
+<td>
+<table style="margin: 0px;" width="170px" border="0" cellpadding="0"
+cellspacing="0">
+<tbody><tr><td><a href="http://www.antigrain.com/index.html"
+class="mpmenu">Home/</a></td></tr>
+<tr><td><a href="http://www.antigrain.com/research/index.html"
+class="mpmenu">Research/</a></td></tr>
+<tr><td><a href="" class="mpmenu"></a></td></tr>
+<tr><td><a href="" class="mpmenu"></a></td></tr>
+<tr><td><a href="" class="mpmenu"></a></td></tr>
+<tr><td><a href="" class="mpmenu"></a></td></tr>
+</tbody></table>
+</td>
+<td width="1px" bgcolor="#583927"></td>
+<td style="text-align: right;" valign="top" width="450px">
+<table style="margin: 0px;" border="0" cellpadding="0" cellspacing="0">
+<tbody><tr>
+<td><img src="gamma_correction_files/agg_logo.gif" border="0"></td>
+</tr>
+<tr>
+<td>
+<table style="margin: 0px;" border="0" cellpadding="0" cellspacing="0">
+<tbody><tr height="15px">
+<td>&nbsp;&nbsp;<a class="topmenu"
+href="http://www.antigrain.com/news/index.html">News</a>&nbsp;&nbsp;</td>
+<td width="1px" bgcolor="#8e521d"></td>
+<td>&nbsp;&nbsp;<a class="topmenu"
+href="http://www.antigrain.com/doc/index.html">Docs</a>&nbsp;&nbsp;</td>
+<td width="1px" bgcolor="#8e521d"></td>
+<td>&nbsp;&nbsp;<a class="topmenu"
+href="http://www.antigrain.com/download/index.html">Download</a>&nbsp;&nbsp;</td>
+<td width="1px" bgcolor="#8e521d"></td>
+<td>&nbsp;&nbsp;<a class="topmenu"
+href="http://www.antigrain.com/maillist/index.html">Mailing List</a>&nbsp;&nbsp;</td>
+<td width="1px" bgcolor="#8e521d"></td>
+<td>&nbsp;&nbsp;<a class="topmenu"
+href="http://www.antigrain.com/cvs/index.html">CVS</a>&nbsp;&nbsp;</td>
+</tr>
+</tbody></table>
+</td>
+</tr>
+</tbody></table>
+</td>
+</tr>
+</tbody></table>
+<table style="margin: 0px;" height="1px" width="640px" bgcolor="#583927"
+ border="0" cellpadding="0" cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>
+</p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td><h1>Gamma Correction<span
+class="subtitle"><br>Using Gamma Correction in Anti-Aliasing</span></h1></td></tr></tbody></table>
+
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p><b><nobr>Anti-Aliasing</nobr></b>
+ technology is always difficult. The difficulty here
+is not only in algorithms, but also because the visual quality of
+the image depends on the displaying equipment. <b><nobr>Anti-Aliasing</nobr></b>
+ images look
+differently on CRT monitors and on LCD ones. In general it's a
+science (or maybe even art) called Color Management.
+<b><nobr>Anti-Grain</nobr> Geometry</b> uses the approach of <b><nobr>Anti-Aliasing</nobr></b>
+ that potentially allows us to
+obtain the best result. The rendering procedure calculates the
+exact coverage values for every boundary pixel and as a result
+one can have any number of <b><nobr>Anti-Aliasing</nobr></b> levels.
+<b><nobr>Anti-Grain</nobr> Geometry</b> uses 256 levels which is quite
+enough for any practical
+purpose and much better than 5-level <b><nobr>Anti-Aliasing</nobr></b>
+used in many applications,
+for example, True-Type font renderers, almost all
+<a href="http://www.adobe.com/"><img
+src="gamma_correction_files/link.gif" border="0">Adobe</a> products and
+so on.
+I was absolutely sure that the rendering method I use gives
+the best result. But when I tried to render the same image
+with <b><nobr>Anti-Grain</nobr> Geometry</b> and <a
+href="http://www.adobe.com/svg/"><img
+src="gamma_correction_files/link.gif" border="0">Adobe SVG Viewer</a>
+I found out that the Adobe SVG Viewer uses only 5 levels of <b><nobr>Anti-Aliasing</nobr></b>,
+
+but the result sometimes looks better than in <b><nobr>Anti-Grain</nobr>
+ Geometry</b>.</p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p><img
+ src="gamma_correction_files/gamma_lion1.jpg" title="" border="0"><!---->
+ &nbsp;&nbsp;&nbsp; <img src="gamma_correction_files/gamma_lion2.jpg"
+title="" border="0"><!----></p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>The
+left image is rendered with <b><nobr>Anti-Grain</nobr> Geometry</b>, the
+ right one with the
+<a href="http://www.adobe.com/svg/"><img
+src="gamma_correction_files/link.gif" border="0">Adobe SVG Viewer</a>.
+</p></td></tr></tbody></table><table style="margin: 0px;" height="1px"
+width="640px" bgcolor="#583927" border="0" cellpadding="0"
+cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>The
+lion's moustache look smoother when rendering with 5-level
+Adobe SVG Viewer, al least on CRT monitors. But still, the enlarged
+images show us the lack of the <b><nobr>Anti-Aliasing</nobr></b> levels
+used in Adobe Viewer.</p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p><img
+ src="gamma_correction_files/gamma_lion1e.jpg" title="" border="0"><!---->
+ &nbsp;&nbsp;&nbsp; <img src="gamma_correction_files/gamma_lion2e.jpg"
+title="" border="0"><!----></p></td></tr></tbody></table>
+
+<table style="margin: 0px;" height="1px" width="640px" bgcolor="#583927"
+ border="0" cellpadding="0" cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p><img
+ src="gamma_correction_files/gamma.gif" title="" style="border-color:
+rgb(255, 255, 255);" align="left" border="4"><!---->
+Obviously, <b><nobr>Anti-Grain</nobr> Geometry</b> can render better,
+but using a simple linear dependance
+Pixel Coverage <span class="larger">&#8594;</span> Brightness is not the best
+and should be corrected.
+In color management it's called Gamma Correction. For gamma correction
+I use a simple array of 256 values that give the desired value of
+brightness
+depending on the pixel coverage. If all the values in the array are
+equal
+to their index, i.e., 0,1,2,3,4,&#8230; it means that there's no gamma
+correction.
+The array can be calculated using any approach, but the simplest method
+is to use a B-Spline curve with two reference points and four
+coeffitiens
+(kx1, ky1, kx2, ky2) that determine its shape. So, I created an
+application
+with a special gamma correction control that allows for calculation of
+the
+array of the gamma values.
+It draws 6 very narrow ellipses, 6 circles and some other figures that
+can be used as a visual test of the quality of <b><nobr>Anti-Aliasing</nobr></b>.
+</p></td></tr></tbody></table><table style="margin: 0px;" height="1px"
+width="640px" bgcolor="#583927" border="0" cellpadding="0"
+cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td><center><img
+src="gamma_correction_files/gamma1.gif" title="Default Shape - No Gamma
+Correction" border="0"><br><i>Default Shape - No Gamma Correction</i></center></td></tr></tbody></table>
+<table style="margin: 0px;" height="1px" width="640px" bgcolor="#583927"
+ border="0" cellpadding="0" cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>The
+control points can be moved inside their quadrants.
+The following image looks much better at least on CRT monitors.</p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td><center><img
+src="gamma_correction_files/gamma2.gif" title="Gamma Correction for CRT
+Monitors" border="0"><br><i>Gamma Correction for CRT Monitors</i></center></td></tr></tbody></table>
+<table style="margin: 0px;" height="1px" width="640px" bgcolor="#583927"
+ border="0" cellpadding="0" cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>We
+actually can obtain much better result of certain thickness and
+brightness, but it cannot be used for general case. The shown above
+example is a kind of an average case which is not the best for certain
+parameters, but gives us rather a good average result on CRT monitors,
+as well as on LCD ones. Below are the examples of other shapes of the
+gamma curve.</p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td><center><img
+src="gamma_correction_files/gamma3.gif" title="Test Gamma 1" border="0"><br><i>Test
+ Gamma 1</i></center></td></tr></tbody></table>
+<table width="640px"><tbody><tr><td><center><img
+src="gamma_correction_files/gamma4.gif" title="Test Gamma 2" border="0"><br><i>Test
+ Gamma 2</i></center></td></tr></tbody></table>
+<table width="640px"><tbody><tr><td><center><img
+src="gamma_correction_files/gamma5.gif" title="Test Gamma 3" border="0"><br><i>Test
+ Gamma 3</i></center></td></tr></tbody></table>
+<table style="margin: 0px;" height="1px" width="640px" bgcolor="#583927"
+ border="0" cellpadding="0" cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>Besides,
+ the gamma correction strongly depends on the content of the image.
+The values that are good enough for rendering ellipses like shown above
+may give a very bad result when rendering small text glyphs. The latest
+require sharper forms, while large geometric figures look better with
+very smooth edges.
+</p></td></tr></tbody></table><table style="margin: 0px;" height="1px"
+width="640px" bgcolor="#583927" border="0" cellpadding="0"
+cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>Finally,
+ this is the result of rendering the same lion with gamma correction
+for CRT monitors. Now it looks better than the one rendered with Adobe
+SVG Viewer.</p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p><img
+ src="gamma_correction_files/gamma_lion3.jpg" title="" border="0"><!---->
+ &nbsp;&nbsp;&nbsp; <img src="gamma_correction_files/gamma_lion3e.jpg"
+title="" border="0"><!----></p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>You
+can download the working application for Windows:
+<a
+href="http://www.antigrain.com/research/gamma_correction/gamma_ctrl.zip"><img
+ src="gamma_correction_files/download.gif" border="0">Gamma Control
+&nbsp;(gamma_ctrl.zip)</a></p></td></tr></tbody></table>
+
+<table width="640px"><tbody><tr><td style="text-align: justify;"><p>The
+source code can be found in the <code>examples</code> directory of the
+distribution package. Visit the <a
+href="http://www.antigrain.com/download/index.html#PAGE_DOWNLOAD">Download</a>
+ page.</p></td></tr></tbody></table>
+
+
+<table style="margin: 0px;" height="1px" width="640px" bgcolor="#583927"
+ border="0" cellpadding="0" cellspacing="0"><tbody><tr><td></td></tr></tbody></table>
+<table width="640px" border="0" cellpadding="0" cellspacing="0">
+<tbody><tr><td><center><span class="authors">
+Copyright <span class="larger">©</span> 2002-2006
+<a href="http://www.antigrain.com/mcseem/index.html"><b>Maxim Shemanarev</b></a>
+</span></center></td></tr>
+<tr><td><center><span class="authors">
+Web Design and Programming
+<a href="http://www.antigrain.com/mcseem/index.html"><b>Maxim Shemanarev</b></a>
+</span></center></td></tr>
+</tbody></table>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+</body></html> \ No newline at end of file