Java Doc for ImageWorker.java in  » GIS » GeoTools-2.4.1 » org » geotools » image » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.image 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.image.ImageWorker

ImageWorker
public class ImageWorker (Code)
Helper methods for applying JAI operations on an image. The image is specified at . Sucessive operations can be applied by invoking the methods defined in this class, and the final image can be obtained by invoking ImageWorker.getRenderedImage at the end of the process.

If an exception is thrown during a method invocation, then this ImageWorker is left in an undetermined state and should not be used anymore.
since:
   2.3
version:
   $Id: ImageWorker.java 28776 2008-01-15 20:26:28Z desruisseaux $
author:
   Simone Giannecchini
author:
   Bryce Nordgren
author:
   Martin Desruisseaux


Inner Class :final public static class PNGImageWriteParam extends ImageWriteParam

Field Summary
final public static  Hints.KeyTILING_ALLOWED
     If Boolean.FALSE FALSE , image operators are not allowed to produce tiled images.
protected  RenderedImageimage
     The image being built.

Constructor Summary
public  ImageWorker()
     Creates a new uninitialized builder for an .
public  ImageWorker(File input)
     Creates a new builder for an image read from the specified file.
public  ImageWorker(RenderedImage image)
     Creates a new builder for the specified image.

Method Summary
final public  ImageWorkeraddImage(RenderedImage renderedImage)
     Takes two rendered or renderable source images, and adds every pair of pixels, one from each source image of the corresponding position and band.
public  ImageWorkeraddTransparencyToIndexColorModel(RenderedImage alphaChannel, boolean errorDiffusion)
     Adds transparency to a preexisting image whose color model is .
final public  ImageWorkeraddTransparencyToIndexColorModel(RenderedImage alphaChannel, boolean translucent, int transparent, boolean errorDiffusion)
     Adds transparency to a preexisting image whose color model is .
final public  ImageWorkerbinarize()
     Binarizes the .
final public  ImageWorkerbinarize(double threshold)
     Binarizes the .
final public  ImageWorkerbinarize(int value0, int value1)
     Binarizes the (if not already done) and replace all 0 values by value0 and all 1 values by value1 .
final public  ImageWorkerforceBitmaskIndexColorModel()
     Reduces the color model to with or transparency.
final public  ImageWorkerforceBitmaskIndexColorModel(int transparent, boolean errorDiffusion)
     Reduces the color model to with or transparency.
final public  ImageWorkerforceColorSpaceGRAYScale()
     Forces the color model to the .
final public  ImageWorkerforceColorSpaceRGB()
     Forces the color model to the .
final public  ImageWorkerforceComponentColorModel()
     Reformats the to a preserving transparency.
final public  ImageWorkerforceComponentColorModel(boolean checkTransparent)
     Reformats the to a preserving transparency.
final public  ImageWorkerforceIndexColorModel(boolean error)
     Reduces the color model to . If the current already uses an , then this method do nothing.
final public  ImageWorkerforceIndexColorModelForGIF(boolean errorDiffusion)
     Converts the image to a GIF-compliant image.
final public  ImageWorkerformat(int dataType)
     Formats the underlying image to the provided data type.
Parameters:
  dataType - to be used for this FormatDescriptor operation.
final public  ROIgetImageAsROI()
     Returns a built from the current .
final public  double[]getMaximums()
     Returns the maximal values found in every bands.
final public  double[]getMinimums()
     Returns the minimal values found in every bands.
final public  intgetNumBands()
     Returns the number of bands in the .
final public  PlanarImagegetPlanarImage()
     Returns the as a planar image.
final public  ROIgetROI()
     Returns the region of interest currently set, or null if none.
final public  RenderedImagegetRenderedImage()
     Returns the current image.
final public  RenderedOpgetRenderedOperation()
     Returns the as a rendered operation.
final public  ObjectgetRenderingHint(RenderingHints.Key key)
     Returns the rendering hint for the specified key, or null if none.
final public  RenderingHintsgetRenderingHints()
     Returns the rendering hints for an image to be computed by this class. The default implementation returns the following hints:

  • An with tiles size computed automatically from the current size.
  • Any additional hints specified through the ImageWorker.setRenderingHint method.
final public  intgetTransparentPixel()
     Returns the transparent pixel value, or -1 if none.
final public  ImageWorkerintensity()
     Creates an image which represents approximatively the intensity of .
final public  ImageWorkerinvert()
     Inverts the pixel values of the .
final public  booleanisBinary()
     Returns true if the is binary.
final public  booleanisBytes()
     Returns true if the stores its pixel values in 8 bits.
final public  booleanisColorSpaceGRAYScale()
     Returns true if the uses a GrayScale .
final public  booleanisColorSpaceRGB()
     Returns true if the uses a RGB .
final public  booleanisIndexed()
     Returns true if the uses an .
final public  booleanisTranslucent()
     Returns true if the is .
final public  voidload(String source, int imageChoice, boolean readMetadata)
     Loads an image using the provided file name and the , which are used to control caching and layout.
public static  PlanarImageloadPlanarImageImage(String source, RenderingHints hints, int imageChoice, boolean readMetadata)
     Loads an image using the provided file name and the provided hints, which are used to control caching and layout.
Parameters:
  source - The source image.
Parameters:
  hints - The hints to use.
Parameters:
  imageChoice - For multipage images.
public static  voidmain(String[] args)
     Loads the image from the specified file, and it in a window.
final public  ImageWorkermakeColorTransparent(Color transparentColor)
     Replaces all occurences of the given color (usually opaque) by a fully transparent color. Currents implementation supports image backed by any IndexColorModel , or by ComponentColorModel with DataBuffer.TYPE_BYTE TYPE_BYTE .
final public  ImageWorkermask(RenderedImage mask, boolean maskValue, int newValue)
     Applies the specified mask over the current .
final public  ImageWorkermaskComponentColorModelByte(Color transparentColor)
     For an image backed by an ComponentColorModel , replaces all occurences of the given color (usually opaque) by a fully transparent color.
Parameters:
  transparentColor - The color to make transparent.
final public  ImageWorkermaskIndexColorModelByte(Color transparentColor)
     For an image backed by an IndexColorModel , replaces all occurences of the given color (usually opaque) by a fully transparent color.
Parameters:
  transparentColor - The color to make transparent.
final public  ImageWorkermultiplyConst(double[] inValues)
     Takes one rendered or renderable image and an array of double constants, and multiplies every pixel of the same band of the source by the constant from the corresponding array entry.
final public  ImageWorkerremoveRenderingHint(RenderingHints.Key key)
     Removes a rendering hint.
final public  ImageWorkerrescaleToBytes()
     Rescales the such that it uses 8 bits.
final public  ImageWorkerretainBands(int numBands)
     Retains inconditionnaly the first numBands of . All other bands (if any) are discarted without any further processing. This method does nothing if the current does not have a greater amount of bands than numBands .
Parameters:
  numBands - the number of bands to retain.
final public  ImageWorkerretainBands(int[] bands)
     Retains inconditionnaly certain bands of .
final public  ImageWorkerretainFirstBand()
     Retains inconditionnaly the first band of .
final public  ImageWorkerretainLastBand()
     Retains inconditionnaly the last band of .
final public  ImageWorkersetImage(RenderedImage image)
     Prepare this builder for the specified image.
final public  ImageWorkersetROI(ROI roi)
     Set the region of interest (ROI).
final public  ImageWorkersetRenderingHint(RenderingHints.Key key, Object value)
     Sets a rendering hint tile to use for all images to be computed by this class.
final public  ImageWorkershow()
     Shows the current in a window together with the operation chain as a .
final public  ImageWorkertile()
     If the was not already tiled, tile it.
final public  ImageWorkertileCacheEnabled(boolean status)
     If false , disables the tile cache.
final public  ImageWorkerwrite(File output)
     Writes the to the specified file.
final public  ImageWorkerwriteGIF(Object destination, String compression, float compressionRate)
     Writes outs the image contained into this ImageWorker as a GIF using the provided destination, compression and compression rate.

It is worth to point out that the only compressions algorithm availaible with the jdk GIFImageWriter is "LZW" while the compression rates have to be confined between 0 and 1.

final public  voidwriteJPEG(Object destination, String compression, float compressionRate, boolean nativeAcc)
     Writes outs the image contained into this ImageWorker as a JPEG using the provided destination , compression and compression rate.

The destination object can be anything providing that we have an ImageOutputStreamSpi that recognizes it.
Parameters:
  destination - where to write the internal ImageWorker.image as a JPEG.
Parameters:
  compression - algorithm.
Parameters:
  compressionRate - percentage of compression.
Parameters:
  nativeAcc - should we use native acceleration.

final public  voidwritePNG(Object destination, String compression, float compressionRate, boolean nativeAcc, boolean paletted)
     Writes outs the image contained into this ImageWorker as a PNG using the provided destination, compression and compression rate.
final public  ImageWorkerxorConst(int[] values)
     Takes one rendered or renderable image and an array of integer constants, and performs a bit-wise logical "xor" between every pixel in the same band of the source and the constant from the corresponding array entry.

Field Detail
TILING_ALLOWED
final public static Hints.Key TILING_ALLOWED(Code)
If Boolean.FALSE FALSE , image operators are not allowed to produce tiled images. The default is Boolean.TRUE TRUE . The FALSE value is sometime useful for exporting images to some formats that doesn't support tiling (e.g. GIF).
See Also:   ImageWorker.setRenderingHint



image
protected RenderedImage image(Code)
The image being built.




Constructor Detail
ImageWorker
public ImageWorker()(Code)
Creates a new uninitialized builder for an .
See Also:   ImageWorker.load



ImageWorker
public ImageWorker(File input) throws IOException(Code)
Creates a new builder for an image read from the specified file.
Parameters:
  input - The file to read.
throws:
  IOException - if the file can't be read.



ImageWorker
public ImageWorker(RenderedImage image)(Code)
Creates a new builder for the specified image. The images to be computed (if any) will save their tiles in the default .
Parameters:
  image - The source image.




Method Detail
addImage
final public ImageWorker addImage(RenderedImage renderedImage)(Code)
Takes two rendered or renderable source images, and adds every pair of pixels, one from each source image of the corresponding position and band. See JAI AddDescriptor for details.
Parameters:
  renderedImage - the RenderedImage to be added to this ImageWorker. this ImageWorker.
See Also:   AddDescriptor



addTransparencyToIndexColorModel
public ImageWorker addTransparencyToIndexColorModel(RenderedImage alphaChannel, boolean errorDiffusion)(Code)
Adds transparency to a preexisting image whose color model is . For all pixels with the value false in the specified transparency mask, the corresponding pixel in the is set to the transparent pixel value. All other pixels are left unchanged.
Parameters:
  alphaChannel - The mask to apply as a image.
Parameters:
  errorDiffusion - Tells if I should use ErrorDiffusionDescriptor orOrderedDitherDescriptor JAi operations. this ImageWorker.
See Also:   ImageWorker.isTranslucent
See Also:   ImageWorker.forceBitmaskIndexColorModel



addTransparencyToIndexColorModel
final public ImageWorker addTransparencyToIndexColorModel(RenderedImage alphaChannel, boolean translucent, int transparent, boolean errorDiffusion)(Code)
Adds transparency to a preexisting image whose color model is . First, this method creates a new index color model with the specified transparent pixel, if needed (this method may skip this step if the specified pixel is already transparent. Then for all pixels with the value false in the specified transparency mask, the corresponding pixel in the is set to that transparent value. All other pixels are left unchanged.
Parameters:
  alphaChannel - The mask to apply as a image.
Parameters:
  translucent - true if images areallowed, or false if the resulting images must be a.
Parameters:
  transparent - The value for transparent pixels, to be given to every pixels in the corresponding to false in the mask. Thespecial value -1 maps to the last pixel value allowed for the.
Parameters:
  errorDiffusion - Tells if I should use ErrorDiffusionDescriptor orOrderedDitherDescriptor JAi operations. this ImageWorker.



binarize
final public ImageWorker binarize()(Code)
Binarizes the . If the image is multi-bands, then this method first computes an estimation of its . Then, the threshold value is set halfway between the minimal and maximal values found in the image. this ImageWorker.
See Also:   ImageWorker.isBinary
See Also:   ImageWorker.binarize(double)
See Also:   ImageWorker.binarize(int,int)
See Also:   BinarizeDescriptor



binarize
final public ImageWorker binarize(double threshold)(Code)
Binarizes the . If the image is already binarized, then this method does nothing.
Parameters:
  threshold - The threshold value. this ImageWorker.
See Also:   ImageWorker.isBinary
See Also:   ImageWorker.binarize()
See Also:   ImageWorker.binarize(int,int)
See Also:   BinarizeDescriptor



binarize
final public ImageWorker binarize(int value0, int value1)(Code)
Binarizes the (if not already done) and replace all 0 values by value0 and all 1 values by value1 . If the image should be binarized using a custom threshold value (instead of the automatic one), invoke ImageWorker.binarize(double) explicitly before this method. this ImageWorker.
See Also:   ImageWorker.isBinary
See Also:   ImageWorker.binarize()
See Also:   ImageWorker.binarize(double)
See Also:   BinarizeDescriptor
See Also:   LookupDescriptor



forceBitmaskIndexColorModel
final public ImageWorker forceBitmaskIndexColorModel()(Code)
Reduces the color model to with or transparency. If the current already uses a suitable color model, then this method do nothing. this ImageWorker.
See Also:   ImageWorker.isIndexed
See Also:   ImageWorker.isTranslucent
See Also:   ImageWorker.forceIndexColorModel
See Also:   ImageWorker.forceIndexColorModelForGIF



forceBitmaskIndexColorModel
final public ImageWorker forceBitmaskIndexColorModel(int transparent, boolean errorDiffusion)(Code)
Reduces the color model to with or transparency. If the current already uses a suitable color model, then this method do nothing.
Parameters:
  transparent - A pixel value to define as the transparent pixel. *
Parameters:
  errorDiffusion - Tells if I should use ErrorDiffusionDescriptor orOrderedDitherDescriptor JAi operations. errorDiffusion this ImageWorker.
See Also:   ImageWorker.isIndexed
See Also:   ImageWorker.isTranslucent
See Also:   ImageWorker.forceIndexColorModel
See Also:   ImageWorker.forceIndexColorModelForGIF



forceColorSpaceGRAYScale
final public ImageWorker forceColorSpaceGRAYScale()(Code)
Forces the color model to the . If the current color space is already of , then this method does nothing. this ImageWorker.
See Also:   ImageWorker.isColorSpaceGRAYScale
See Also:   ColorConvertDescriptor



forceColorSpaceRGB
final public ImageWorker forceColorSpaceRGB()(Code)
Forces the color model to the . If the current color space is already of , then this method does nothing. This operation may loose the alpha channel. this ImageWorker.
See Also:   ImageWorker.isColorSpaceRGB
See Also:   ColorConvertDescriptor



forceComponentColorModel
final public ImageWorker forceComponentColorModel()(Code)
Reformats the to a preserving transparency. This is used especially in order to go from PackedColorModel to ComponentColorModel , which seems to be well accepted from PNGEncoder and TIFFEncoder .

This code is adapted from jai-interests mailing list archive. this ImageWorker.
See Also:   FormatDescriptor




forceComponentColorModel
final public ImageWorker forceComponentColorModel(boolean checkTransparent)(Code)
Reformats the to a preserving transparency. This is used especially in order to go from PackedColorModel to ComponentColorModel , which seems to be well accepted from PNGEncoder and TIFFEncoder .

This code is adapted from jai-interests mailing list archive.
Parameters:
  checkTransparent - tells this method to not consider fully transparent pixelswhen optimizing grayscale palettes. this ImageWorker.
See Also:   FormatDescriptor




forceIndexColorModel
final public ImageWorker forceIndexColorModel(boolean error)(Code)
Reduces the color model to . If the current already uses an , then this method do nothing. Otherwise, the current implementation performs a ditering on the original color model. Note that this operation loose the alpha channel.

This for the moment should work only with opaque images, with non opaque images we just remove the alpha band in order to build an IndexColorModel . This is one because in general it could be very difficult to decide the final transparency for each pixel given the complexity if the algorithms for obtaining an IndexColorModel .

If an IndexColorModel with a single transparency index is enough for you, we advise you to take a look at ImageWorker.forceIndexColorModelForGIF(boolean) methdo.
See Also:   ImageWorker.isIndexed
See Also:   ImageWorker.forceBitmaskIndexColorModel
See Also:   ImageWorker.forceIndexColorModelForGIF
See Also:   OrderedDitherDescriptor




forceIndexColorModelForGIF
final public ImageWorker forceIndexColorModelForGIF(boolean errorDiffusion)(Code)
Converts the image to a GIF-compliant image. This method has been created in order to convert the input image to a form that is compatible with the GIF model. It first remove the information about transparency since the error diffusion and the error dither operations are unable to process images with more than 3 bands. Afterwards the image is processed with an error diffusion operator in order to reduce the number of bands from 3 to 1 and the number of color to 216. A suitable layout is used for the final image via the in order to take into account the different layout model for the final image.

Tip: For optimizing writing GIF, we need to create the image untiled. This can be done by invoking ( , Boolean.FALSE) first.
Parameters:
  errorDiffusion - Tells if I should use ErrorDiffusionDescriptor orOrderedDitherDescriptor JAi operations. this ImageWorker.
See Also:   ImageWorker.isIndexed
See Also:   ImageWorker.forceIndexColorModel
See Also:   ImageWorker.forceBitmaskIndexColorModel




format
final public ImageWorker format(int dataType)(Code)
Formats the underlying image to the provided data type.
Parameters:
  dataType - to be used for this FormatDescriptor operation. this ImageWorker



getImageAsROI
final public ROI getImageAsROI()(Code)
Returns a built from the current . If the image is multi-bands, then this method first computes an estimation of its . Next, this method the image and constructs a ROI from the result.
See Also:   ImageWorker.getRenderedImage
See Also:   ImageWorker.getPlanarImage
See Also:   ImageWorker.getRenderedOperation



getMaximums
final public double[] getMaximums()(Code)
Returns the maximal values found in every bands. If a is defined, then the statistics will be computed only over that region.
See Also:   ImageWorker.getMinimums
See Also:   ImageWorker.setROI



getMinimums
final public double[] getMinimums()(Code)
Returns the minimal values found in every bands. If a is defined, then the statistics will be computed only over that region.
See Also:   ImageWorker.getMaximums
See Also:   ImageWorker.setROI



getNumBands
final public int getNumBands()(Code)
Returns the number of bands in the .
See Also:   ImageWorker.retainBands
See Also:   ImageWorker.retainFirstBand
See Also:   SampleModel.getNumBands



getPlanarImage
final public PlanarImage getPlanarImage()(Code)
Returns the as a planar image.
See Also:   ImageWorker.getRenderedImage
See Also:   ImageWorker.getRenderedOperation
See Also:   ImageWorker.getImageAsROI



getROI
final public ROI getROI()(Code)
Returns the region of interest currently set, or null if none. The default value is null .
See Also:   ImageWorker.getMinimums
See Also:   ImageWorker.getMaximums



getRenderedImage
final public RenderedImage getRenderedImage()(Code)
Returns the current image.
See Also:   ImageWorker.getPlanarImage
See Also:   ImageWorker.getRenderedOperation
See Also:   ImageWorker.getImageAsROI



getRenderedOperation
final public RenderedOp getRenderedOperation()(Code)
Returns the as a rendered operation.
See Also:   ImageWorker.getRenderedImage
See Also:   ImageWorker.getPlanarImage
See Also:   ImageWorker.getImageAsROI



getRenderingHint
final public Object getRenderingHint(RenderingHints.Key key)(Code)
Returns the rendering hint for the specified key, or null if none.



getRenderingHints
final public RenderingHints getRenderingHints()(Code)
Returns the rendering hints for an image to be computed by this class. The default implementation returns the following hints:

  • An with tiles size computed automatically from the current size.
  • Any additional hints specified through the ImageWorker.setRenderingHint method. If the user provided explicitly a JAI.KEY_IMAGE_LAYOUT , then the user layout has precedence over the automatic layout computed in previous step.
The rendering hints to use for image computation (never null ).



getTransparentPixel
final public int getTransparentPixel()(Code)
Returns the transparent pixel value, or -1 if none.



intensity
final public ImageWorker intensity()(Code)
Creates an image which represents approximatively the intensity of . The result is always a single-banded image. If the image uses an , then this method just without any further processing. Otherwise, this method performs a simple operation on the in order to come up with a simple estimation of the intensity of the image based on the average value of the color components. It is worthwhile to note that the alpha band is stripped from the image. this ImageWorker.
See Also:   BandCombineDescriptor



invert
final public ImageWorker invert()(Code)
Inverts the pixel values of the .
See Also:   InvertDescriptor



isBinary
final public boolean isBinary()(Code)
Returns true if the is binary. Such image usually contains only two values: 0 and 1.
See Also:   ImageWorker.binarize()
See Also:   ImageWorker.binarize(double)
See Also:   ImageWorker.binarize(int,int)



isBytes
final public boolean isBytes()(Code)
Returns true if the stores its pixel values in 8 bits.
See Also:   ImageWorker.rescaleToBytes



isColorSpaceGRAYScale
final public boolean isColorSpaceGRAYScale()(Code)
Returns true if the uses a GrayScale . Note that a GrayScale color space doesn't mean that pixel values are directly stored as GrayScale component. The image may be as well.
See Also:   ImageWorker.forceColorSpaceGRAYScale



isColorSpaceRGB
final public boolean isColorSpaceRGB()(Code)
Returns true if the uses a RGB . Note that a RGB color space doesn't mean that pixel values are directly stored as RGB components. The image may be as well.
See Also:   ImageWorker.forceColorSpaceRGB



isIndexed
final public boolean isIndexed()(Code)
Returns true if the uses an .
See Also:   ImageWorker.forceIndexColorModel
See Also:   ImageWorker.forceBitmaskIndexColorModel
See Also:   ImageWorker.forceIndexColorModelForGIF



isTranslucent
final public boolean isTranslucent()(Code)
Returns true if the is .
See Also:   ImageWorker.forceBitmaskIndexColorModel



load
final public void load(String source, int imageChoice, boolean readMetadata)(Code)
Loads an image using the provided file name and the , which are used to control caching and layout.
Parameters:
  source - Filename of the source image to read.
Parameters:
  imageChoice - Image index in multipage images.
Parameters:
  readMatadata - If true , metadata will be read.



loadPlanarImageImage
public static PlanarImage loadPlanarImageImage(String source, RenderingHints hints, int imageChoice, boolean readMetadata)(Code)
Loads an image using the provided file name and the provided hints, which are used to control caching and layout.
Parameters:
  source - The source image.
Parameters:
  hints - The hints to use.
Parameters:
  imageChoice - For multipage images. The loaded image.



main
public static void main(String[] args)(Code)
Loads the image from the specified file, and it in a window. This method is mostly as a convenient way to test operation chains. This method can be invoked from the command line. If an optional -operation argument is provided, the Java method (one of the image operations provided in this class) immediately following it is executed. Example:
 java org.geotools.image.ImageWorker -operation binarize <var><filename></var>
 



makeColorTransparent
final public ImageWorker makeColorTransparent(Color transparentColor) throws IllegalStateException(Code)
Replaces all occurences of the given color (usually opaque) by a fully transparent color. Currents implementation supports image backed by any IndexColorModel , or by ComponentColorModel with DataBuffer.TYPE_BYTE TYPE_BYTE . More types may be added in future GeoTools versions.
Parameters:
  transparentColor - The color to make transparent. this image worker.
throws:
  IllegalStateException - if the current has an unsupported colormodel.



mask
final public ImageWorker mask(RenderedImage mask, boolean maskValue, int newValue)(Code)
Applies the specified mask over the current . The mask should be - if it is not, this method will do it itself. Then, for every pixels in the mask with value equals to maskValue , the corresponding pixel in the will be set to the specified newValue .

Note: current implementation force the color model to an one. Future versions may avoid this change.
Parameters:
  mask - The mask to apply, as a image.
Parameters:
  maskValue - The mask value to search for ( false for 0 or true for 1).
Parameters:
  newValue - The new value for every pixels in corresponding to maskValue in the mask. this ImageWorker. newValue maskValue false




maskComponentColorModelByte
final public ImageWorker maskComponentColorModelByte(Color transparentColor)(Code)
For an image backed by an ComponentColorModel , replaces all occurences of the given color (usually opaque) by a fully transparent color.
Parameters:
  transparentColor - The color to make transparent. this image worker.ImageWorker.makeColorTransparent



maskIndexColorModelByte
final public ImageWorker maskIndexColorModelByte(Color transparentColor)(Code)
For an image backed by an IndexColorModel , replaces all occurences of the given color (usually opaque) by a fully transparent color.
Parameters:
  transparentColor - The color to make transparent. this image worker.ImageWorker.makeColorTransparent



multiplyConst
final public ImageWorker multiplyConst(double[] inValues)(Code)
Takes one rendered or renderable image and an array of double constants, and multiplies every pixel of the same band of the source by the constant from the corresponding array entry. See JAI MultiplyConstDescriptor for details.
Parameters:
  inValues - The constants to be multiplied. this ImageWorker.
See Also:   MultiplyConstDescriptor



removeRenderingHint
final public ImageWorker removeRenderingHint(RenderingHints.Key key)(Code)
Removes a rendering hint. Note that invoking this method is not the same than invoking (key, null). This is especially true for the hint:

  • ( , null) disables the use of any tile cache. In other words, this method call do request a tile cache, which happen to be the "null" cache.
  • removeRenderingHint( ) unsets any tile cache specified by a previous rendering hint. All images to be computed after this method call will save their tiles in the .
This ImageWorker



rescaleToBytes
final public ImageWorker rescaleToBytes()(Code)
Rescales the such that it uses 8 bits. If the image already uses 8 bits, then this method does nothing. Otherwise this method computes the minimum and maximum values for each band, them in the range [0 .. 255] and force the resulting image to DataBuffer.TYPE_BYTE TYPE_BYTE . This ImageWorker
See Also:   ImageWorker.isBytes
See Also:   RescaleDescriptor



retainBands
final public ImageWorker retainBands(int numBands)(Code)
Retains inconditionnaly the first numBands of . All other bands (if any) are discarted without any further processing. This method does nothing if the current does not have a greater amount of bands than numBands .
Parameters:
  numBands - the number of bands to retain. this ImageWorker.
See Also:   ImageWorker.getNumBands
See Also:   ImageWorker.retainFirstBand
See Also:   BandSelectDescriptor



retainBands
final public ImageWorker retainBands(int[] bands)(Code)
Retains inconditionnaly certain bands of . All other bands (if any) are discarded without any further processing.
Parameters:
  bands - the bands to retain. this ImageWorker.
See Also:   ImageWorker.getNumBands
See Also:   ImageWorker.retainFirstBand
See Also:   BandSelectDescriptor



retainFirstBand
final public ImageWorker retainFirstBand()(Code)
Retains inconditionnaly the first band of . All other bands (if any) are discarted without any further processing. this ImageWorker.
See Also:   ImageWorker.getNumBands
See Also:   ImageWorker.retainBands
See Also:   BandSelectDescriptor



retainLastBand
final public ImageWorker retainLastBand()(Code)
Retains inconditionnaly the last band of . All other bands (if any) are discarted without any further processing. this ImageWorker.
See Also:   ImageWorker.getNumBands
See Also:   ImageWorker.retainBands
See Also:   BandSelectDescriptor



setImage
final public ImageWorker setImage(RenderedImage image)(Code)
Prepare this builder for the specified image. The images to be computed (if any) will save their tiles in the default .
Parameters:
  image - The source image.



setROI
final public ImageWorker setROI(ROI roi)(Code)
Set the region of interest (ROI). A null set the ROI to the whole . The ROI is used by statistical methods like ImageWorker.getMinimums and ImageWorker.getMaximums . This ImageWorker
See Also:   ImageWorker.getMinimums
See Also:   ImageWorker.getMaximums



setRenderingHint
final public ImageWorker setRenderingHint(RenderingHints.Key key, Object value)(Code)
Sets a rendering hint tile to use for all images to be computed by this class. This method applies only to the next images to be computed; images already computed before this method call (if any) will not be affected.

Some common examples:

  • setRenderingHint( , null) disables completly the tile cache.
  • setRenderingHint( , Boolean.FALSE) forces all operators to produce untiled images.
This ImageWorker



show
final public ImageWorker show() throws HeadlessException(Code)
Shows the current in a window together with the operation chain as a . This method is provided mostly for debugging purpose. This method requires the gt2-widgets-swing.jar file in the classpath.
throws:
  HeadlessException - if gt2-widgets-swing.jar is not on the classpath, orif AWT can't create the window components. this ImageWorker.
See Also:   org.geotools.gui.swing.image.OperationTreeBrowser.show(RenderedImage)



tile
final public ImageWorker tile()(Code)
If the was not already tiled, tile it. Note that no tiling will be done if 'getRenderingHints()' failed to suggest a tile size. This method is for internal use by ImageWorker.write methods only. this ImageWorker.



tileCacheEnabled
final public ImageWorker tileCacheEnabled(boolean status)(Code)
If false , disables the tile cache. Invoking this method with value true cancel the last invocation with value false . If this method was invoking many time with value false , then this method must be invoked the same amount of time with the value true for reenabling the cache.

Note: This method name doesn't contain the usual set prefix because it doesn't really set a flag. Instead it increments or decrements a counter. This ImageWorker




write
final public ImageWorker write(File output) throws IOException(Code)
Writes the to the specified file. This method differs from ImageIO.write(StringFile) in a number of ways:

  • The to use is inferred from the file extension.
  • If the image writer accepts File objects as input, then the file argument is given directly without creating an ImageOutputStream object. This is important for some formats like HDF, which work only with files.
  • If the is not tiled, then it is tiled prior to be written.
  • If some special processing is needed for a given format, then the corresponding method is invoked. Example: ImageWorker.forceIndexColorModelForGIF .
this ImageWorker.



writeGIF
final public ImageWorker writeGIF(Object destination, String compression, float compressionRate) throws IOException(Code)
Writes outs the image contained into this ImageWorker as a GIF using the provided destination, compression and compression rate.

It is worth to point out that the only compressions algorithm availaible with the jdk GIFImageWriter is "LZW" while the compression rates have to be confined between 0 and 1. AN acceptable values is usally 0.75f.

The destination object can be anything providing that we have an ImageOutputStreamSpi that recognizes it.
Parameters:
  destination - where to write the internal ImageWorker.image as a gif.
Parameters:
  compression - The name of compression algorithm.
Parameters:
  compressionRate - percentage of compression, as a number between 0 and 1. this ImageWorker.
throws:
  IOException - In case an error occurs during the search for anImageOutputStream or during the eoncding process.
See Also:   ImageWorker.forceIndexColorModelForGIF(boolean)




writeJPEG
final public void writeJPEG(Object destination, String compression, float compressionRate, boolean nativeAcc) throws IOException(Code)
Writes outs the image contained into this ImageWorker as a JPEG using the provided destination , compression and compression rate.

The destination object can be anything providing that we have an ImageOutputStreamSpi that recognizes it.
Parameters:
  destination - where to write the internal ImageWorker.image as a JPEG.
Parameters:
  compression - algorithm.
Parameters:
  compressionRate - percentage of compression.
Parameters:
  nativeAcc - should we use native acceleration. this ImageWorker.
throws:
  IOException - In case an error occurs during the search for anImageOutputStream or during the eoncding process.




writePNG
final public void writePNG(Object destination, String compression, float compressionRate, boolean nativeAcc, boolean paletted) throws IOException(Code)
Writes outs the image contained into this ImageWorker as a PNG using the provided destination, compression and compression rate.

The destination object can be anything providing that we have an ImageOutputStreamSpi that recognizes it.
Parameters:
  destination - where to write the internal ImageWorker.image as a PNG.
Parameters:
  compression - algorithm.
Parameters:
  compressionRate - percentage of compression.
Parameters:
  nativeAcc - should we use native acceleration.
Parameters:
  paletted - should we write the png as 8 bits? this ImageWorker.
throws:
  IOException - In case an error occurs during the search for anImageOutputStream or during the eoncding process.ImageOutputStream




xorConst
final public ImageWorker xorConst(int[] values)(Code)
Takes one rendered or renderable image and an array of integer constants, and performs a bit-wise logical "xor" between every pixel in the same band of the source and the constant from the corresponding array entry. See JAI XorConstDescriptor for details.
See Also:   XorConstDescriptor



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.