Java Doc for IIOParam.java in  » 6.0-JDK-Core » image » javax » imageio » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » image » javax.imageio 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.imageio.IIOParam

All known Subclasses:   javax.imageio.ImageReadParam,  javax.imageio.ImageWriteParam,
IIOParam
abstract public class IIOParam (Code)
A superclass of all classes describing how streams should be decoded or encoded. This class contains all the variables and methods that are shared by ImageReadParam and ImageWriteParam.

This class provides mechanisms to specify a source region and a destination region. When reading, the source is the stream and the in-memory image is the destination. When writing, these are reversed. In the case of writing, destination regions may be used only with a writer that supports pixel replacement.

Decimation subsampling may be specified for both readers and writers, using a movable subsampling grid.

Subsets of the source and destination bands may be selected.
version:
   0.5



Field Summary
protected  IIOParamControllercontroller
     The IIOParamController that will be used to provide settings for this IIOParam object when the activateController method is called.
protected  IIOParamControllerdefaultController
     The default IIOParamController that will be used to provide settings for this IIOParam object when the activateController method is called.
protected  PointdestinationOffset
     The offset in the destination where the upper-left decoded pixel should be placed.
protected  ImageTypeSpecifierdestinationType
     An ImageTypeSpecifier to be used to generate a destination image when reading, or to set the output color type when writing.
protected  int[]sourceBands
     An array of ints indicating which source bands will be used, or null.
protected  RectanglesourceRegion
     The source region, on null if none is set.
protected  intsourceXSubsampling
     The decimation subsampling to be applied in the horizontal direction.
protected  intsourceYSubsampling
     The decimation subsampling to be applied in the vertical direction.
protected  intsubsamplingXOffset
     A horizontal offset to be applied to the subsampling grid before subsampling.
protected  intsubsamplingYOffset
     A vertical offset to be applied to the subsampling grid before subsampling.

Constructor Summary
protected  IIOParam()
     Protected constructor may be called only by subclasses.

Method Summary
public  booleanactivateController()
     Activates the installed IIOParamController for this IIOParam object and returns the resulting value.
public  IIOParamControllergetController()
     Returns whatever IIOParamController is currently installed.
public  IIOParamControllergetDefaultController()
     Returns the default IIOParamController, if there is one, regardless of the currently installed controller.
public  PointgetDestinationOffset()
     Returns the offset in the destination image at which pixels are to be placed.
public  ImageTypeSpecifiergetDestinationType()
     Returns the type of image to be returned by the read, if one was set by a call to setDestination(ImageTypeSpecifier), as an ImageTypeSpecifier.
public  int[]getSourceBands()
     Returns the set of of source bands to be used.
public  RectanglegetSourceRegion()
     Returns the source region to be used.
public  intgetSourceXSubsampling()
     Returns the number of source columns to advance for each pixel.
public  intgetSourceYSubsampling()
     Returns the number of rows to advance for each pixel.
public  intgetSubsamplingXOffset()
     Returns the horizontal offset of the subsampling grid.
public  intgetSubsamplingYOffset()
     Returns the vertical offset of the subsampling grid.
public  booleanhasController()
     Returns true if there is a controller installed for this IIOParam object.
public  voidsetController(IIOParamController controller)
     Sets the IIOParamController to be used to provide settings for this IIOParam object when the activateController method is called, overriding any default controller.
public  voidsetDestinationOffset(Point destinationOffset)
     Specifies the offset in the destination image at which future decoded pixels are to be placed, when reading, or where a region will be written, when writing.

When reading, the region to be written within the destination BufferedImage will start at this offset and have a width and height determined by the source region of interest, the subsampling parameters, and the destination bounds.

Normal writes are not affected by this method, only writes performed using ImageWriter.replacePixels.

public  voidsetDestinationType(ImageTypeSpecifier destinationType)
     Sets the desired image type for the destination image, using an ImageTypeSpecifier.

When reading, if the layout of the destination has been set using this method, each call to an ImageReader read method will return a new BufferedImage using the format specified by the supplied type specifier.

public  voidsetSourceBands(int[] sourceBands)
     Sets the indices of the source bands to be used.
public  voidsetSourceRegion(Rectangle sourceRegion)
     Sets the source region of interest.
public  voidsetSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset)
     Specifies a decimation subsampling to apply on I/O.

Field Detail
controller
protected IIOParamController controller(Code)
The IIOParamController that will be used to provide settings for this IIOParam object when the activateController method is called. This value overrides any default controller, even when null.
See Also:   IIOParamController
See Also:   IIOParam.setController(IIOParamController)
See Also:   IIOParam.hasController()
See Also:   IIOParam.activateController()



defaultController
protected IIOParamController defaultController(Code)
The default IIOParamController that will be used to provide settings for this IIOParam object when the activateController method is called. This default should be set by subclasses that choose to provide their own default controller, usually a GUI, for setting parameters.
See Also:   IIOParamController
See Also:   IIOParam.getDefaultController
See Also:   IIOParam.activateController



destinationOffset
protected Point destinationOffset(Code)
The offset in the destination where the upper-left decoded pixel should be placed. By default, the value is (0, 0).



destinationType
protected ImageTypeSpecifier destinationType(Code)
An ImageTypeSpecifier to be used to generate a destination image when reading, or to set the output color type when writing. If non has been setm the value will be null. By default, the value is null.



sourceBands
protected int[] sourceBands(Code)
An array of ints indicating which source bands will be used, or null. If null, the set of source bands to be used is as described in the comment for the setSourceBands method. No value should be allowed to be negative.



sourceRegion
protected Rectangle sourceRegion(Code)
The source region, on null if none is set.



sourceXSubsampling
protected int sourceXSubsampling(Code)
The decimation subsampling to be applied in the horizontal direction. By default, the value is 1. The value must not be negative or 0.



sourceYSubsampling
protected int sourceYSubsampling(Code)
The decimation subsampling to be applied in the vertical direction. By default, the value is 1. The value must not be negative or 0.



subsamplingXOffset
protected int subsamplingXOffset(Code)
A horizontal offset to be applied to the subsampling grid before subsampling. The first pixel to be used will be offset this amount from the origin of the region, or of the image if no region is specified.



subsamplingYOffset
protected int subsamplingYOffset(Code)
A vertical offset to be applied to the subsampling grid before subsampling. The first pixel to be used will be offset this amount from the origin of the region, or of the image if no region is specified.




Constructor Detail
IIOParam
protected IIOParam()(Code)
Protected constructor may be called only by subclasses.




Method Detail
activateController
public boolean activateController()(Code)
Activates the installed IIOParamController for this IIOParam object and returns the resulting value. When this method returns true, all values for this IIOParam object will be ready for the next read or write operation. If false is returned, no settings in this object will have been disturbed (i.e., the user canceled the operation).

Ordinarily, the controller will be a GUI providing a user interface for a subclass of IIOParam for a particular plug-in. Controllers need not be GUIs, however. true if the controller completed normally.
exception:
  IllegalStateException - if there is no controllercurrently installed.
See Also:   IIOParamController
See Also:   IIOParam.setController(IIOParamController)
See Also:   IIOParam.getController
See Also:   IIOParam.getDefaultController
See Also:   IIOParam.hasController




getController
public IIOParamController getController()(Code)
Returns whatever IIOParamController is currently installed. This could be the default if there is one, null, or the argument of the most recent call to setController. the currently installedIIOParamController, or null.
See Also:   IIOParamController
See Also:   IIOParam.setController
See Also:   IIOParam.getDefaultController
See Also:   IIOParam.hasController
See Also:   IIOParam.activateController()



getDefaultController
public IIOParamController getDefaultController()(Code)
Returns the default IIOParamController, if there is one, regardless of the currently installed controller. If there is no default controller, returns null. the default IIOParamController, ornull.
See Also:   IIOParamController
See Also:   IIOParam.setController(IIOParamController)
See Also:   IIOParam.getController
See Also:   IIOParam.hasController
See Also:   IIOParam.activateController()



getDestinationOffset
public Point getDestinationOffset()(Code)
Returns the offset in the destination image at which pixels are to be placed.

If setDestinationOffsets has not been called, a Point with zero X and Y values is returned (which is the correct value). the destination offset as a Point.
See Also:   IIOParam.setDestinationOffset




getDestinationType
public ImageTypeSpecifier getDestinationType()(Code)
Returns the type of image to be returned by the read, if one was set by a call to setDestination(ImageTypeSpecifier), as an ImageTypeSpecifier. If none was set, null is returned. an ImageTypeSpecifier describing thedestination type, or null.
See Also:   IIOParam.setDestinationType



getSourceBands
public int[] getSourceBands()(Code)
Returns the set of of source bands to be used. The returned value is that set by the most recent call to setSourceBands, or null if there have been no calls to setSourceBands.

Semantically, the array returned is a copy; changes to array contents subsequent to this call have no effect on this IIOParam. the set of source bands to be used, ornull.
See Also:   IIOParam.setSourceBands




getSourceRegion
public Rectangle getSourceRegion()(Code)
Returns the source region to be used. The returned value is that set by the most recent call to setSourceRegion, and will be null if there is no region set. the source region of interest as aRectangle, or null.
See Also:   IIOParam.setSourceRegion



getSourceXSubsampling
public int getSourceXSubsampling()(Code)
Returns the number of source columns to advance for each pixel.

If setSourceSubsampling has not been called, 1 is returned (which is the correct value). the source subsampling X period.
See Also:   IIOParam.setSourceSubsampling
See Also:   IIOParam.getSourceYSubsampling




getSourceYSubsampling
public int getSourceYSubsampling()(Code)
Returns the number of rows to advance for each pixel.

If setSourceSubsampling has not been called, 1 is returned (which is the correct value). the source subsampling Y period.
See Also:   IIOParam.setSourceSubsampling
See Also:   IIOParam.getSourceXSubsampling




getSubsamplingXOffset
public int getSubsamplingXOffset()(Code)
Returns the horizontal offset of the subsampling grid.

If setSourceSubsampling has not been called, 0 is returned (which is the correct value). the source subsampling grid X offset.
See Also:   IIOParam.setSourceSubsampling
See Also:   IIOParam.getSubsamplingYOffset




getSubsamplingYOffset
public int getSubsamplingYOffset()(Code)
Returns the vertical offset of the subsampling grid.

If setSourceSubsampling has not been called, 0 is returned (which is the correct value). the source subsampling grid Y offset.
See Also:   IIOParam.setSourceSubsampling
See Also:   IIOParam.getSubsamplingXOffset




hasController
public boolean hasController()(Code)
Returns true if there is a controller installed for this IIOParam object. This will return true if getController would not return null. true if a controller is installed.
See Also:   IIOParamController
See Also:   IIOParam.setController(IIOParamController)
See Also:   IIOParam.getController
See Also:   IIOParam.getDefaultController
See Also:   IIOParam.activateController()



setController
public void setController(IIOParamController controller)(Code)
Sets the IIOParamController to be used to provide settings for this IIOParam object when the activateController method is called, overriding any default controller. If the argument is null, no controller will be used, including any default. To restore the default, use setController(getDefaultController()).
Parameters:
  controller - An appropriate IIOParamController, or null.
See Also:   IIOParamController
See Also:   IIOParam.getController
See Also:   IIOParam.getDefaultController
See Also:   IIOParam.hasController
See Also:   IIOParam.activateController()



setDestinationOffset
public void setDestinationOffset(Point destinationOffset)(Code)
Specifies the offset in the destination image at which future decoded pixels are to be placed, when reading, or where a region will be written, when writing.

When reading, the region to be written within the destination BufferedImage will start at this offset and have a width and height determined by the source region of interest, the subsampling parameters, and the destination bounds.

Normal writes are not affected by this method, only writes performed using ImageWriter.replacePixels. For such writes, the offset specified is within the output stream image whose pixels are being modified.

There is no unsetDestinationOffset method; simply call setDestinationOffset(new Point(0, 0)) to restore default values.
Parameters:
  destinationOffset - the offset in the destination, as aPoint.
exception:
  IllegalArgumentException - ifdestinationOffset is null.
See Also:   IIOParam.getDestinationOffset
See Also:   ImageWriter.replacePixels




setDestinationType
public void setDestinationType(ImageTypeSpecifier destinationType)(Code)
Sets the desired image type for the destination image, using an ImageTypeSpecifier.

When reading, if the layout of the destination has been set using this method, each call to an ImageReader read method will return a new BufferedImage using the format specified by the supplied type specifier. As a side effect, any destination BufferedImage set by ImageReadParam.setDestination(BufferedImage) will no longer be set as the destination. In other words, this method may be thought of as calling setDestination((BufferedImage)null).

When writing, the destination type maybe used to determine the color type of the image. The SampleModel information will be ignored, and may be null. For example, a 4-banded image could represent either CMYK or RGBA data. If a destination type is set, its ColorModel will override any ColorModel on the image itself. This is crucial when setSourceBands is used since the image's ColorModel will refer to the entire image rather than to the subset of bands being written.
Parameters:
  destinationType - the ImageTypeSpecifier tobe used to determine the destination layout and color type.
See Also:   IIOParam.getDestinationType




setSourceBands
public void setSourceBands(int[] sourceBands)(Code)
Sets the indices of the source bands to be used. Duplicate indices are not allowed.

A null value indicates that all source bands will be used.

At the time of reading, an IllegalArgumentException will be thrown by the reader or writer if a value larger than the largest available source band index has been specified or if the number of source bands and destination bands to be used differ. The ImageReader.checkReadParamBandSettings method may be used to automate this test.

Semantically, a copy is made of the array; changes to the array contents subsequent to this call have no effect on this IIOParam.
Parameters:
  sourceBands - an array of integer band indices to beused.
exception:
  IllegalArgumentException - if sourceBandscontains a negative or duplicate value.
See Also:   IIOParam.getSourceBands
See Also:   ImageReadParam.setDestinationBands
See Also:   ImageReader.checkReadParamBandSettings




setSourceRegion
public void setSourceRegion(Rectangle sourceRegion)(Code)
Sets the source region of interest. The region of interest is described as a rectangle, with the upper-left corner of the source image as pixel (0, 0) and increasing values down and to the right. The actual number of pixels used will depend on the subsampling factors set by setSourceSubsampling. If subsampling has been set such that this number is zero, an IllegalStateException will be thrown.

The source region of interest specified by this method will be clipped as needed to fit within the source bounds, as well as the destination offsets, width, and height at the time of actual I/O.

A value of null for sourceRegion will remove any region specification, causing the entire image to be used.
Parameters:
  sourceRegion - a Rectangle specifying thesource region of interest, or null.
exception:
  IllegalArgumentException - ifsourceRegion is non-null and eithersourceRegion.x or sourceRegion.y isnegative.
exception:
  IllegalArgumentException - ifsourceRegion is non-null and eithersourceRegion.width orsourceRegion.height is negative or 0.
exception:
  IllegalStateException - if subsampling is such thatthis region will have a subsampled width or height of zero.
See Also:   IIOParam.getSourceRegion
See Also:   IIOParam.setSourceSubsampling
See Also:   ImageReadParam.setDestinationOffset
See Also:   ImageReadParam.getDestinationOffset




setSourceSubsampling
public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset)(Code)
Specifies a decimation subsampling to apply on I/O. The sourceXSubsampling and sourceYSubsampling parameters specify the subsampling period (i.e., the number of rows and columns to advance after every source pixel). Specifically, a period of 1 will use every row or column; a period of 2 will use every other row or column. The subsamplingXOffset and subsamplingYOffset parameters specify an offset from the region (or image) origin for the first subsampled pixel. Adjusting the origin of the subsample grid is useful for avoiding seams when subsampling a very large source image into destination regions that will be assembled into a complete subsampled image. Most users will want to simply leave these parameters at 0.

The number of pixels and scanlines to be used are calculated as follows.

The number of subsampled pixels in a scanline is given by

truncate[(width - subsamplingXOffset + sourceXSubsampling - 1) / sourceXSubsampling].

If the region is such that this width is zero, an IllegalStateException is thrown.

The number of scanlines to be used can be computed similarly.

The ability to set the subsampling grid to start somewhere other than the source region origin is useful if the region is being used to create subsampled tiles of a large image, where the tile width and height are not multiples of the subsampling periods. If the subsampling grid does not remain consistent from tile to tile, there will be artifacts at the tile boundaries. By adjusting the subsampling grid offset for each tile to compensate, these artifacts can be avoided. The tradeoff is that in order to avoid these artifacts, the tiles are not all the same size. The grid offset to use in this case is given by:
grid offset = [period - (region offset modulo period)] modulo period)

If either sourceXSubsampling or sourceYSubsampling is 0 or negative, an IllegalArgumentException will be thrown.

If either subsamplingXOffset or subsamplingYOffset is negative or greater than or equal to the corresponding period, an IllegalArgumentException will be thrown.

There is no unsetSourceSubsampling method; simply call setSourceSubsampling(1, 1, 0, 0) to restore default values.
Parameters:
  sourceXSubsampling - the number of columns to advancebetween pixels.
Parameters:
  sourceYSubsampling - the number of rows to advance betweenpixels.
Parameters:
  subsamplingXOffset - the horizontal offset of the first subsamplewithin the region, or within the image if no region is set.
Parameters:
  subsamplingYOffset - the horizontal offset of the first subsamplewithin the region, or within the image if no region is set.
exception:
  IllegalArgumentException - if either period isnegative or 0, or if either grid offset is negative or greater thanthe corresponding period.
exception:
  IllegalStateException - if the source region is such thatthe subsampled output would contain no pixels.




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.