You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by bu...@apache.org on 2013/03/18 16:10:46 UTC

svn commit: r854966 - in /websites/staging/xmlgraphics/trunk/content: ./ commons/image-loader.html

Author: buildbot
Date: Mon Mar 18 15:10:45 2013
New Revision: 854966

Log:
Staging update by buildbot for xmlgraphics

Modified:
    websites/staging/xmlgraphics/trunk/content/   (props changed)
    websites/staging/xmlgraphics/trunk/content/commons/image-loader.html

Propchange: websites/staging/xmlgraphics/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Mar 18 15:10:45 2013
@@ -1 +1 @@
-1457795
+1457799

Modified: websites/staging/xmlgraphics/trunk/content/commons/image-loader.html
==============================================================================
--- websites/staging/xmlgraphics/trunk/content/commons/image-loader.html (original)
+++ websites/staging/xmlgraphics/trunk/content/commons/image-loader.html Mon Mar 18 15:10:45 2013
@@ -201,7 +201,10 @@ $(document).ready(function () {
 </pre></div>
 
 
+<blockquote>
+<p><strong>NOTE:</strong></p>
 <p>In this example, <code>DefaultImageContext</code> is used. You may need to write your own implementation of <code>ImageContext</code> for your use case.</p>
+</blockquote>
 <h2 id="preloading">Preloading an image</h2>
 <p>In order to load an image, it needs to be "preloaded" first, i.e. the image content type is detected and the intrinsic size of the image is determined. The result of this process is an <code>ImageInfo</code> instance which contains the URI, MIME type and intrinsic size. In most cases, this is done without loading the whole image (see SPI section below for information on exceptions to this rule).</p>
 <p>Preloading is normally done through the <code>ImageManager</code> 's <code>getImageInfo()</code> method. For this operation an <code>ImageSessionContext</code> needs to be provided. It is responsible for supplying JAXP <code>Source</code> objects, URI resolution and providing other information needed for the image operations. In simple cases you can simply use <code>DefaultImageSessionContext</code>, but often you will want to write your own implementation of <code>ImageSessionContext</code>. In that case, it's recommended to subclass <code>AbstractImageSessionContext</code> which lets you avoid rewriting a lot of code for providing <code>Source</code> objects.</p>
@@ -258,7 +261,10 @@ $(document).ready(function () {
 </pre></div>
 
 
+<blockquote>
+<p><strong>NOTE:</strong></p>
 <p>While each <code>BufferedImage</code> is also a <code>RenderedImage</code>, it can be more efficient to also specify <code>ImageFlavor.BUFFERED_IMAGE</code> in the flavor array.</p>
+</blockquote>
 <h1 id="tipsntricks">Tips &amp; Tricks</h1>
 <p>If you are loading bitmap images and you get an error like <code>"Cannot load image (no suitable loader/converter combination available) for
         myimage.tif (image/tiff)</code>, you maybe be missing the necessary ImageIO codec to decode the image. A number of well-written codecs can be found in <a href="https://jai-imageio.dev.java.net/">JAI Image I/O Tools Project</a>. Just download the distribution and add the JAR to the classpath. ImageIO will automatically pick up the new codecs and they will subsequently be available to the image framework.</p>
@@ -280,8 +286,11 @@ $(document).ready(function () {
 <h3 id="ImagePreloader">ImagePreloader</h3>
 <p>The first task is identifying whether the implementation supports the given image. If the image is loaded using an ImageInputStream it is important to always reset the stream position to the beginning of the file at the end of the <code>preloadImage()</code> method, because all registered preloaders are check in turn until one implementation signals that it supports the format. In that case, it has to extract only the minimal information from the image necessary to identify the image's intrinsic size. For most formats, this is doable without loading the whole image into memory.</p>
 <p>However, for some formats (like MathML or WMF), loading the whole image at preloading time is hard to avoid since the image's size can only be determined that way. In such a case, the <code>ImagePreloader</code> implementations shall pass the loaded document to the respective <code>ImageLoader</code> through the custom objects that can be attached to the <code>ImageInfo</code> object. If the preloader loads the whole document, it shall close the given <code>Source</code> object (calling <code>ImageUtil.closeQuietly(Source)</code>).</p>
-<p>The priority the implementation reports is used to sort all registered implementations. This is to fine-tune the inner workings and to optimize performance since some formats are usually used more frequently than others.
-Normally, if you implement an <code>ImagePreloader</code> you will also need to implement the respective <code>ImageLoader/ImageLoaderFactory</code>, or vice versa.</p>
+<p>The priority the implementation reports is used to sort all registered implementations. This is to fine-tune the inner workings and to optimize performance since some formats are usually used more frequently than others.</p>
+<blockquote>
+<p><strong>NOTE:</strong></p>
+<p>Normally, if you implement an <code>ImagePreloader</code> you will also need to implement the respective <code>ImageLoader/ImageLoaderFactory</code>, or vice versa.</p>
+</blockquote>
 <h2 id="ImageLoader">ImageLoader and ImageLoaderFactory</h2>
 <p>The factory interface has been created to allow checking if some library that an implementation depends on is really in the classpath so it can report back that the <code>ImageLoader</code> is not funtional. The factory also reports what kind of image formats it supports and which image flavors it can return. There can be a complex relationship between the two. It is recommmended, however, to write smaller implementations rather than big, almighty ones.</p>
 <p>The usage penalty is used when constructing image conversion pipelines. There can be multiple ways to provide an image in one of the supported flavors and this value helps to make the best decision.</p>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org