Java Doc for ImageWriteParam.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
      javax.imageio.ImageWriteParam

All known Subclasses:   javax.imageio.plugins.jpeg.JPEGImageWriteParam,  javax.imageio.plugins.bmp.BMPImageWriteParam,
ImageWriteParam
public class ImageWriteParam extends IIOParam (Code)
A class describing how a stream is to be encoded. Instances of this class or its subclasses are used to supply prescriptive "how-to" information to instances of ImageWriter.

A plug-in for a specific image format may define a subclass of this class, and return objects of that class from the getDefaultWriteParam method of its ImageWriter implementation. For example, the built-in JPEG writer plug-in will return instances of javax.imageio.plugins.jpeg.JPEGImageWriteParam.

The region of the image to be written is determined by first intersecting the actual bounds of the image with the rectangle specified by IIOParam.setSourceRegion, if any. If the resulting rectangle has a width or height of zero, the writer will throw an IIOException. If the intersection is non-empty, writing will commence with the first subsampled pixel and include additional pixels within the intersected bounds according to the horizontal and vertical subsampling factors specified by IIOParam.setSourceSubsamplingIIOParam.setSourceSubsampling .

Individual features such as tiling, progressive encoding, and compression may be set in one of four modes. MODE_DISABLED disables the features; MODE_DEFAULT enables the feature with writer-controlled parameter values; MODE_EXPLICIT enables the feature and allows the use of a set method to provide additional parameters; and MODE_COPY_FROM_METADATA copies relevant parameter values from the stream and image metadata objects passed to the writer. The default for all features is MODE_COPY_FROM_METADATA. Non-standard features supplied in subclasses are encouraged, but not required to use a similar scheme.

Plug-in writers may extend the functionality of ImageWriteParam by providing a subclass that implements additional, plug-in specific interfaces. It is up to the plug-in to document what interfaces are available and how they are to be used. Writers will silently ignore any extended features of an ImageWriteParam subclass of which they are not aware. Also, they may ignore any optional features that they normally disable when creating their own ImageWriteParam instances via getDefaultWriteParam.

Note that unless a query method exists for a capability, it must be supported by all ImageWriter implementations (e.g. progressive encoding is optional, but subsampling must be supported).
version:
   0.5
See Also:   ImageReadParam



Field Summary
final public static  intMODE_COPY_FROM_METADATA
     A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, or setCompressionMode to enable that feature for future writes.
final public static  intMODE_DEFAULT
     A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, and setCompressionMode to enable that feature for future writes.
final public static  intMODE_DISABLED
     A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, and setCompressionMode to disable a feature for future writes.
final public static  intMODE_EXPLICIT
     A constant value that may be passed into methods such as setTilingMode or setCompressionMode to enable a feature for future writes.
protected  booleancanOffsetTiles
     A boolean that is true if this ImageWriteParam allows tiling grid offset parameters to be set.
protected  booleancanWriteCompressed
     A boolean that is true if this writer can write images using compression.
protected  booleancanWriteProgressive
     A boolean that is true if this ImageWriteParam allows images to be written as a progressive sequence of increasing quality passes.
protected  booleancanWriteTiles
     A boolean that is true if this ImageWriteParam allows tile width and tile height parameters to be set.
protected  intcompressionMode
     The mode controlling compression settings, which must be set to one of the four MODE_* values.
protected  floatcompressionQuality
     A float containing the current compression quality setting.
protected  StringcompressionType
     A String containing the name of the current compression type, or null if none is set.
protected  String[]compressionTypes
     An array of Strings containing the names of the available compression types.
protected  Localelocale
     A Locale to be used to localize compression type names and quality descriptions, or null to use a default Locale.
protected  Dimension[]preferredTileSizes
     An array of preferred tile size range pairs.
protected  intprogressiveMode
     The mode controlling progressive encoding, which must be set to one of the four MODE_* values, except MODE_EXPLICIT.
protected  inttileGridXOffset
     The amount by which the tile grid origin should be offset horizontally from the image origin if tiling has been set, or 0 otherwise.
protected  inttileGridYOffset
     The amount by which the tile grid origin should be offset vertically from the image origin if tiling has been set, or 0 otherwise.
protected  inttileHeight
     The height of each tile if tiling has been set, or 0 otherwise.
protected  inttileWidth
     The width of each tile if tiling has been set, or 0 otherwise.
protected  inttilingMode
     The mode controlling tiling settings, which Must be set to one of the four MODE_* values.
protected  booleantilingSet
     A boolean that is true if tiling parameters have been specified.

Constructor Summary
protected  ImageWriteParam()
     Constructs an empty ImageWriteParam.
public  ImageWriteParam(Locale locale)
     Constructs an ImageWriteParam set to use a given Locale.

Method Summary
public  booleancanOffsetTiles()
     Returns true if the writer can perform tiling with non-zero grid offsets while writing.
public  booleancanWriteCompressed()
     Returns true if this writer supports compression.
public  booleancanWriteProgressive()
     Returns true if the writer can write out images as a series of passes of progressively increasing quality.
public  booleancanWriteTiles()
     Returns true if the writer can perform tiling while writing.
public  floatgetBitRate(float quality)
     Returns a float indicating an estimate of the number of bits of output data for each bit of input image data at the given quality level.
public  intgetCompressionMode()
     Returns the current compression mode, if compression is supported.
public  floatgetCompressionQuality()
     Returns the current compression quality setting.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and that the compression mode is MODE_EXPLICIT.

public  String[]getCompressionQualityDescriptions()
     Returns an array of Strings that may be used along with getCompressionQualityValues as part of a user interface for setting or displaying the compression quality level.
public  float[]getCompressionQualityValues()
     Returns an array of floats that may be used along with getCompressionQualityDescriptions as part of a user interface for setting or displaying the compression quality level.
public  StringgetCompressionType()
     Returns the currently set compression type, or null if none has been set.
public  String[]getCompressionTypes()
     Returns a list of available compression types, as an array or Strings, or null if a compression type may not be chosen using these interfaces.
public  LocalegetLocale()
     Returns the currently set Locale, or null if only a default Locale is supported.
public  StringgetLocalizedCompressionTypeName()
     Returns a localized version of the name of the current compression type, using the Locale returned by getLocale.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT.

public  Dimension[]getPreferredTileSizes()
     Returns an array of Dimensions indicating the legal size ranges for tiles as they will be encoded in the output file or stream.
public  intgetProgressiveMode()
     Returns the current mode for writing the stream in a progressive manner.
public  intgetTileGridXOffset()
     Returns the horizontal tile grid offset of an image as it will be written to the output stream.
public  intgetTileGridYOffset()
     Returns the vertical tile grid offset of an image as it will be written to the output stream.
public  intgetTileHeight()
     Returns the height of each tile in an image as it will be written to the output stream.
public  intgetTileWidth()
     Returns the width of each tile in an image as it will be written to the output stream.
public  intgetTilingMode()
     Returns the current tiling mode, if tiling is supported.
public  booleanisCompressionLossless()
     Returns true if the current compression type provides lossless compression.
public  voidsetCompressionMode(int mode)
     Specifies whether compression is to be performed, and if so how compression parameters are to be determined.
public  voidsetCompressionQuality(float quality)
     Sets the compression quality to a value between 0 and 1.
public  voidsetCompressionType(String compressionType)
     Sets the compression type to one of the values indicated by getCompressionTypes.
public  voidsetProgressiveMode(int mode)
     Specifies that the writer is to write the image out in a progressive mode such that the stream will contain a series of scans of increasing quality.
public  voidsetTiling(int tileWidth, int tileHeight, int tileGridXOffset, int tileGridYOffset)
     Specifies that the image should be tiled in the output stream. The tileWidth and tileHeight parameters specify the width and height of the tiles in the file.
public  voidsetTilingMode(int mode)
     Determines whether the image will be tiled in the output stream and, if it will, how the tiling parameters will be determined.
public  voidunsetCompression()
     Removes any previous compression type and quality settings.
public  voidunsetTiling()
     Removes any previous tile grid parameters specified by calls to setTiling.

Field Detail
MODE_COPY_FROM_METADATA
final public static int MODE_COPY_FROM_METADATA(Code)
A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, or setCompressionMode to enable that feature for future writes. That is, when this mode is enabled the stream will be tiled, progressive, or compressed based on the contents of stream and/or image metadata passed into the write operation, and any relevant accessor methods will throw an IllegalStateException.

This is the default mode for all features, so that a read including metadata followed by a write including metadata will preserve as much information as possible.
See Also:   ImageWriteParam.MODE_DISABLED
See Also:   ImageWriteParam.MODE_EXPLICIT
See Also:   ImageWriteParam.MODE_DEFAULT
See Also:   ImageWriteParam.setProgressiveMode
See Also:   ImageWriteParam.getProgressiveMode
See Also:   ImageWriteParam.setTilingMode
See Also:   ImageWriteParam.getTilingMode
See Also:   ImageWriteParam.setCompressionMode
See Also:   ImageWriteParam.getCompressionMode




MODE_DEFAULT
final public static int MODE_DEFAULT(Code)
A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, and setCompressionMode to enable that feature for future writes. That is, when this mode is enabled the stream will be tiled, progressive, or compressed according to a sensible default chosen internally by the writer in a plug-in dependent way, and the relevant accessor methods will throw an IllegalStateException.
See Also:   ImageWriteParam.MODE_DISABLED
See Also:   ImageWriteParam.MODE_EXPLICIT
See Also:   ImageWriteParam.MODE_COPY_FROM_METADATA
See Also:   ImageWriteParam.setProgressiveMode
See Also:   ImageWriteParam.getProgressiveMode
See Also:   ImageWriteParam.setTilingMode
See Also:   ImageWriteParam.getTilingMode
See Also:   ImageWriteParam.setCompressionMode
See Also:   ImageWriteParam.getCompressionMode



MODE_DISABLED
final public static int MODE_DISABLED(Code)
A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, and setCompressionMode to disable a feature for future writes. That is, when this mode is set the stream will not be tiled, progressive, or compressed, and the relevant accessor methods will throw an IllegalStateException.
See Also:   ImageWriteParam.MODE_EXPLICIT
See Also:   ImageWriteParam.MODE_COPY_FROM_METADATA
See Also:   ImageWriteParam.MODE_DEFAULT
See Also:   ImageWriteParam.setProgressiveMode
See Also:   ImageWriteParam.getProgressiveMode
See Also:   ImageWriteParam.setTilingMode
See Also:   ImageWriteParam.getTilingMode
See Also:   ImageWriteParam.setCompressionMode
See Also:   ImageWriteParam.getCompressionMode



MODE_EXPLICIT
final public static int MODE_EXPLICIT(Code)
A constant value that may be passed into methods such as setTilingMode or setCompressionMode to enable a feature for future writes. That is, when this mode is set the stream will be tiled or compressed according to additional information supplied to the corresponding set methods in this class and retrievable from the corresponding get methods. Note that this mode is not supported for progressive output.
See Also:   ImageWriteParam.MODE_DISABLED
See Also:   ImageWriteParam.MODE_COPY_FROM_METADATA
See Also:   ImageWriteParam.MODE_DEFAULT
See Also:   ImageWriteParam.setProgressiveMode
See Also:   ImageWriteParam.getProgressiveMode
See Also:   ImageWriteParam.setTilingMode
See Also:   ImageWriteParam.getTilingMode
See Also:   ImageWriteParam.setCompressionMode
See Also:   ImageWriteParam.getCompressionMode



canOffsetTiles
protected boolean canOffsetTiles(Code)
A boolean that is true if this ImageWriteParam allows tiling grid offset parameters to be set. By default, the value is false. Subclasses must set the value manually.

Subclasses that do not support writing tiles, or that supprt writing but not offsetting tiles must ensure that this value is set to false.




canWriteCompressed
protected boolean canWriteCompressed(Code)
A boolean that is true if this writer can write images using compression. By default, the value is false. Subclasses must set the value manually.

Subclasses that do not support compression must ensure that this value is set to false.




canWriteProgressive
protected boolean canWriteProgressive(Code)
A boolean that is true if this ImageWriteParam allows images to be written as a progressive sequence of increasing quality passes. By default, the value is false. Subclasses must set the value manually.

Subclasses that do not support progressive encoding must ensure that this value is set to false.




canWriteTiles
protected boolean canWriteTiles(Code)
A boolean that is true if this ImageWriteParam allows tile width and tile height parameters to be set. By default, the value is false. Subclasses must set the value manually.

Subclasses that do not support writing tiles should ensure that this value is set to false.




compressionMode
protected int compressionMode(Code)
The mode controlling compression settings, which must be set to one of the four MODE_* values. The default is MODE_COPY_FROM_METADATA.

Subclasses that do not support compression may ignore this value.
See Also:   ImageWriteParam.MODE_DISABLED
See Also:   ImageWriteParam.MODE_EXPLICIT
See Also:   ImageWriteParam.MODE_COPY_FROM_METADATA
See Also:   ImageWriteParam.MODE_DEFAULT
See Also:   ImageWriteParam.setCompressionMode
See Also:   ImageWriteParam.getCompressionMode




compressionQuality
protected float compressionQuality(Code)
A float containing the current compression quality setting. The initial value is 1.0F.

Subclasses that do not support compression may ignore this value.




compressionType
protected String compressionType(Code)
A String containing the name of the current compression type, or null if none is set.

Subclasses that do not support compression may ignore this value.




compressionTypes
protected String[] compressionTypes(Code)
An array of Strings containing the names of the available compression types. Subclasses must set the value manually.

Subclasses that do not support compression may ignore this value.




locale
protected Locale locale(Code)
A Locale to be used to localize compression type names and quality descriptions, or null to use a default Locale. Subclasses must set the value manually.



preferredTileSizes
protected Dimension[] preferredTileSizes(Code)
An array of preferred tile size range pairs. The default value is null, which indicates that there are no preferred sizes. If the value is non-null, it must have an even length of at least two.

Subclasses that do not support writing tiles may ignore this value.
See Also:   ImageWriteParam.getPreferredTileSizes




progressiveMode
protected int progressiveMode(Code)
The mode controlling progressive encoding, which must be set to one of the four MODE_* values, except MODE_EXPLICIT. The default is MODE_COPY_FROM_METADATA.

Subclasses that do not support progressive encoding may ignore this value.
See Also:   ImageWriteParam.MODE_DISABLED
See Also:   ImageWriteParam.MODE_EXPLICIT
See Also:   ImageWriteParam.MODE_COPY_FROM_METADATA
See Also:   ImageWriteParam.MODE_DEFAULT
See Also:   ImageWriteParam.setProgressiveMode
See Also:   ImageWriteParam.getProgressiveMode




tileGridXOffset
protected int tileGridXOffset(Code)
The amount by which the tile grid origin should be offset horizontally from the image origin if tiling has been set, or 0 otherwise. The initial value is 0.

Subclasses that do not support offsetting tiles may ignore this value.




tileGridYOffset
protected int tileGridYOffset(Code)
The amount by which the tile grid origin should be offset vertically from the image origin if tiling has been set, or 0 otherwise. The initial value is 0.

Subclasses that do not support offsetting tiles may ignore this value.




tileHeight
protected int tileHeight(Code)
The height of each tile if tiling has been set, or 0 otherwise. The initial value is 0.

Subclasses that do not support tiling may ignore this value.




tileWidth
protected int tileWidth(Code)
The width of each tile if tiling has been set, or 0 otherwise.

Subclasses that do not support tiling may ignore this value.




tilingMode
protected int tilingMode(Code)
The mode controlling tiling settings, which Must be set to one of the four MODE_* values. The default is MODE_COPY_FROM_METADATA.

Subclasses that do not writing tiles may ignore this value.
See Also:   ImageWriteParam.MODE_DISABLED
See Also:   ImageWriteParam.MODE_EXPLICIT
See Also:   ImageWriteParam.MODE_COPY_FROM_METADATA
See Also:   ImageWriteParam.MODE_DEFAULT
See Also:   ImageWriteParam.setTilingMode
See Also:   ImageWriteParam.getTilingMode




tilingSet
protected boolean tilingSet(Code)
A boolean that is true if tiling parameters have been specified.

Subclasses that do not support writing tiles may ignore this value.





Constructor Detail
ImageWriteParam
protected ImageWriteParam()(Code)
Constructs an empty ImageWriteParam. It is up to the subclass to set up the instance variables properly.



ImageWriteParam
public ImageWriteParam(Locale locale)(Code)
Constructs an ImageWriteParam set to use a given Locale.
Parameters:
  locale - a Locale to be used to localizecompression type names and quality descriptions, ornull.




Method Detail
canOffsetTiles
public boolean canOffsetTiles()(Code)
Returns true if the writer can perform tiling with non-zero grid offsets while writing. If this method returns false, then setTiling will throw an UnsupportedOperationException if the grid offset arguments are not both zero. If canWriteTiles returns false, this method will return false as well. true if the writer supports non-zero tileoffsets.
See Also:   ImageWriteParam.canWriteTiles()
See Also:   ImageWriteParam.setTiling(int,int,int,int)



canWriteCompressed
public boolean canWriteCompressed()(Code)
Returns true if this writer supports compression. true if the writer supports compression.



canWriteProgressive
public boolean canWriteProgressive()(Code)
Returns true if the writer can write out images as a series of passes of progressively increasing quality. true if the writer supports progressive encoding.
See Also:   ImageWriteParam.setProgressiveMode
See Also:   ImageWriteParam.getProgressiveMode



canWriteTiles
public boolean canWriteTiles()(Code)
Returns true if the writer can perform tiling while writing. If this method returns false, then setTiling will throw an UnsupportedOperationException. true if the writer supports tiling.
See Also:   ImageWriteParam.canOffsetTiles()
See Also:   ImageWriteParam.setTiling(int,int,int,int)



getBitRate
public float getBitRate(float quality)(Code)
Returns a float indicating an estimate of the number of bits of output data for each bit of input image data at the given quality level. The value will typically lie between 0 and 1, with smaller values indicating more compression. A special value of -1.0F is used to indicate that no estimate is available.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null, and quality is within bounds, it returns -1.0.
Parameters:
  quality - the quality setting whose bit rate is to bequeried. an estimate of the compressed bit rate, or-1.0F if no estimate is available.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the set of legalcompression types is non-null and the currentcompression type is null.
exception:
  IllegalArgumentException - if quality isnot between 0and 1, inclusive.




getCompressionMode
public int getCompressionMode()(Code)
Returns the current compression mode, if compression is supported. the current compression mode.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
See Also:   ImageWriteParam.setCompressionMode



getCompressionQuality
public float getCompressionQuality()(Code)
Returns the current compression quality setting.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and that the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null, it returns the value of the compressionQuality instance variable. the current compression quality setting.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the set of legalcompression types is non-null and the currentcompression type is null.
See Also:   ImageWriteParam.setCompressionQuality




getCompressionQualityDescriptions
public String[] getCompressionQualityDescriptions()(Code)
Returns an array of Strings that may be used along with getCompressionQualityValues as part of a user interface for setting or displaying the compression quality level. The String with index i provides a description of the range of quality levels between getCompressionQualityValues[i] and getCompressionQualityValues[i + 1]. Note that the length of the array returned from getCompressionQualityValues will always be one greater than that returned from getCompressionQualityDescriptions.

As an example, the strings "Good", "Better", and "Best" could be associated with the ranges [0, .33), [.33, .66), and [.66, 1.0]. In this case, getCompressionQualityDescriptions would return { "Good", "Better", "Best" } and getCompressionQualityValues would return { 0.0F, .33F, .66F, 1.0F }.

If no descriptions are available, null is returned. If null is returned from getCompressionQualityValues, this method must also return null.

The descriptions should be localized for the Locale returned by getLocale, if it is non-null.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and that the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null, it returns null. an array of Strings containing localizeddescriptions of the compression quality levels.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the set of legalcompression types is non-null and the currentcompression type is null.
See Also:   ImageWriteParam.getCompressionQualityValues




getCompressionQualityValues
public float[] getCompressionQualityValues()(Code)
Returns an array of floats that may be used along with getCompressionQualityDescriptions as part of a user interface for setting or displaying the compression quality level. See ImageWriteParam.getCompressionQualityDescriptionsgetCompressionQualityDescriptions for more information.

If no descriptions are available, null is returned. If null is returned from getCompressionQualityDescriptions, this method must also return null.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and that the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null, it returns null. an array of floats indicating theboundaries between the compression quality levels as describedby the Strings fromgetCompressionQualityDescriptions.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the set of legalcompression types is non-null and the currentcompression type is null.
See Also:   ImageWriteParam.getCompressionQualityDescriptions




getCompressionType
public String getCompressionType()(Code)
Returns the currently set compression type, or null if none has been set. The type is returned as a String from among those returned by getCompressionTypes. If no compression type has been set, null is returned.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT. If so, it returns the value of the compressionType instance variable. the current compression type as a String,or null if no type is set.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
See Also:   ImageWriteParam.setCompressionType




getCompressionTypes
public String[] getCompressionTypes()(Code)
Returns a list of available compression types, as an array or Strings, or null if a compression type may not be chosen using these interfaces. The array returned is a copy.

If the writer only offers a single, mandatory form of compression, it is not necessary to provide any named compression types. Named compression types should only be used where the user is able to make a meaningful choice between different schemes.

The default implementation checks if compression is supported and throws an UnsupportedOperationException if not. Otherwise, it returns a clone of the compressionTypes instance variable if it is non-null, or else returns null. an array of Strings containing the(non-localized) names of available compression types, ornull.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.




getLocale
public Locale getLocale()(Code)
Returns the currently set Locale, or null if only a default Locale is supported. the current Locale, or null.



getLocalizedCompressionTypeName
public String getLocalizedCompressionTypeName()(Code)
Returns a localized version of the name of the current compression type, using the Locale returned by getLocale.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT. If so, if compressionType is non-null the value of getCompressionType is returned as a convenience. a String containing a localized version ofthe name of the current compression type.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if no compression type is set.




getPreferredTileSizes
public Dimension[] getPreferredTileSizes()(Code)
Returns an array of Dimensions indicating the legal size ranges for tiles as they will be encoded in the output file or stream. The returned array is a copy.

The information is returned as a set of pairs; the first element of a pair contains an (inclusive) minimum width and height, and the second element contains an (inclusive) maximum width and height. Together, each pair defines a valid range of sizes. To specify a fixed size, use the same width and height for both elements. To specify an arbitrary range, a value of null is used in place of an actual array of Dimensions.

If no array is specified on the constructor, but tiling is allowed, then this method returns null.
exception:
  UnsupportedOperationException - if the plug-in doesnot support tiling. an array of Dimensions with an even lengthof at least two, or null.




getProgressiveMode
public int getProgressiveMode()(Code)
Returns the current mode for writing the stream in a progressive manner. the current mode for progressive encoding.
exception:
  UnsupportedOperationException - if the writer does notsupport progressive encoding.
See Also:   ImageWriteParam.setProgressiveMode



getTileGridXOffset
public int getTileGridXOffset()(Code)
Returns the horizontal tile grid offset of an image as it will be written to the output stream. If tiling parameters have not been set, an IllegalStateException is thrown. the tile grid X offset to be used for encoding.
exception:
  UnsupportedOperationException - if the plug-in does notsupport tiling.
exception:
  IllegalStateException - if the tiling mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the tiling parameters havenot been set.
See Also:   ImageWriteParam.setTiling(int,int,int,int)
See Also:   ImageWriteParam.getTileGridYOffset()



getTileGridYOffset
public int getTileGridYOffset()(Code)
Returns the vertical tile grid offset of an image as it will be written to the output stream. If tiling parameters have not been set, an IllegalStateException is thrown. the tile grid Y offset to be used for encoding.
exception:
  UnsupportedOperationException - if the plug-in does notsupport tiling.
exception:
  IllegalStateException - if the tiling mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the tiling parameters havenot been set.
See Also:   ImageWriteParam.setTiling(int,int,int,int)
See Also:   ImageWriteParam.getTileGridXOffset()



getTileHeight
public int getTileHeight()(Code)
Returns the height of each tile in an image as it will be written to the output stream. If tiling parameters have not been set, an IllegalStateException is thrown. the tile height to be used for encoding.
exception:
  UnsupportedOperationException - if the plug-in does notsupport tiling.
exception:
  IllegalStateException - if the tiling mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the tiling parameters havenot been set.
See Also:   ImageWriteParam.setTiling(int,int,int,int)
See Also:   ImageWriteParam.getTileWidth()



getTileWidth
public int getTileWidth()(Code)
Returns the width of each tile in an image as it will be written to the output stream. If tiling parameters have not been set, an IllegalStateException is thrown. the tile width to be used for encoding.
exception:
  UnsupportedOperationException - if the plug-in does notsupport tiling.
exception:
  IllegalStateException - if the tiling mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the tiling parameters havenot been set.
See Also:   ImageWriteParam.setTiling(int,int,int,int)
See Also:   ImageWriteParam.getTileHeight()



getTilingMode
public int getTilingMode()(Code)
Returns the current tiling mode, if tiling is supported. Otherwise throws an UnsupportedOperationException. the current tiling mode.
exception:
  UnsupportedOperationException - ifcanWriteTiles returns false.
See Also:   ImageWriteParam.setTilingMode



isCompressionLossless
public boolean isCompressionLossless()(Code)
Returns true if the current compression type provides lossless compression. If a plug-in provides only one mandatory compression type, then this method may be called without calling setCompressionType first.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null true is returned as a convenience. true if the current compression type islossless.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the set of legalcompression types is non-null and the currentcompression type is null.




setCompressionMode
public void setCompressionMode(int mode)(Code)
Specifies whether compression is to be performed, and if so how compression parameters are to be determined. The mode argument must be one of the four modes, interpreted as follows:
  • MODE_DISABLED - If the mode is set to MODE_DISABLED, methods that query or modify the compression type or parameters will throw an IllegalStateException (if compression is normally supported by the plug-in). Some writers, such as JPEG, do not normally offer uncompressed output. In this case, attempting to set the mode to MODE_DISABLED will throw an UnsupportedOperationException and the mode will not be changed.
  • MODE_EXPLICIT - Compress using the compression type and quality settings specified in this ImageWriteParam. Any previously set compression parameters are discarded.
  • MODE_COPY_FROM_METADATA - Use whatever compression parameters are specified in metadata objects passed in to the writer.
  • MODE_DEFAULT - Use default compression parameters.

The default is MODE_COPY_FROM_METADATA.
Parameters:
  mode - The mode for setting compression in the outputstream.
exception:
  UnsupportedOperationException - if the writer does notsupport compression, or does not support the requested mode.
exception:
  IllegalArgumentException - if mode is notone of the modes listed above.
See Also:   ImageWriteParam.getCompressionMode




setCompressionQuality
public void setCompressionQuality(float quality)(Code)
Sets the compression quality to a value between 0 and 1. Only a single compression quality setting is supported by default; writers can provide extended versions of ImageWriteParam that offer more control. For lossy compression schemes, the compression quality should control the tradeoff between file size and image quality (for example, by choosing quantization tables when writing JPEG images). For lossless schemes, the compression quality may be used to control the tradeoff between file size and time taken to perform the compression (for example, by optimizing row filters and setting the ZLIB compression level when writing PNG images).

A compression quality setting of 0.0 is most generically interpreted as "high compression is important," while a setting of 1.0 is most generically interpreted as "high image quality is important."

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported, and that the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() returns null or compressionType is non-null it sets the compressionQuality instance variable.
Parameters:
  quality - a float between 0and1 indicating the desired quality level.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
exception:
  IllegalStateException - if the set of legalcompression types is non-null and the currentcompression type is null.
exception:
  IllegalArgumentException - if quality isnot between 0and 1, inclusive.
See Also:   ImageWriteParam.getCompressionQuality




setCompressionType
public void setCompressionType(String compressionType)(Code)
Sets the compression type to one of the values indicated by getCompressionTypes. If a value of null is passed in, any previous setting is removed.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT. If so, it calls getCompressionTypes and checks if compressionType is one of the legal values. If it is, the compressionType instance variable is set. If compressionType is null, the instance variable is set without performing any checking.
Parameters:
  compressionType - one of the Strings returnedby getCompressionTypes, or null toremove any previous setting.
exception:
  UnsupportedOperationException - if the writer does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
exception:
  UnsupportedOperationException - if there are nosettable compression types.
exception:
  IllegalArgumentException - ifcompressionType is non-null but is notone of the values returned by getCompressionTypes.
See Also:   ImageWriteParam.getCompressionTypes
See Also:   ImageWriteParam.getCompressionType
See Also:   ImageWriteParam.unsetCompression




setProgressiveMode
public void setProgressiveMode(int mode)(Code)
Specifies that the writer is to write the image out in a progressive mode such that the stream will contain a series of scans of increasing quality. If progressive encoding is not supported, an UnsupportedOperationException will be thrown.

The mode argument determines how the progression parameters are chosen, and must be either MODE_DISABLED, MODE_COPY_FROM_METADATA, or MODE_DEFAULT. Otherwise an IllegalArgumentException is thrown.

The modes are interpreted as follows:

  • MODE_DISABLED - No progression. Use this to turn off progession.
  • MODE_COPY_FROM_METADATA - The output image will use whatever progression parameters are found in the metadata objects passed into the writer.
  • MODE_DEFAULT - The image will be written progressively, with parameters chosen by the writer.

The default is MODE_COPY_FROM_METADATA.
Parameters:
  mode - The mode for setting progression in the outputstream.
exception:
  UnsupportedOperationException - if the writer does notsupport progressive encoding.
exception:
  IllegalArgumentException - if mode is notone of the modes listed above.
See Also:   ImageWriteParam.getProgressiveMode




setTiling
public void setTiling(int tileWidth, int tileHeight, int tileGridXOffset, int tileGridYOffset)(Code)
Specifies that the image should be tiled in the output stream. The tileWidth and tileHeight parameters specify the width and height of the tiles in the file. If the tile width or height is greater than the width or height of the image, the image is not tiled in that dimension.

If canOffsetTiles returns false, then the tileGridXOffset and tileGridYOffset parameters must be zero.
Parameters:
  tileWidth - the width of each tile.
Parameters:
  tileHeight - the height of each tile.
Parameters:
  tileGridXOffset - the horizontal offset of the tile grid.
Parameters:
  tileGridYOffset - the vertical offset of the tile grid.
exception:
  UnsupportedOperationException - if the plug-in does notsupport tiling.
exception:
  IllegalStateException - if the tiling mode is notMODE_EXPLICIT.
exception:
  UnsupportedOperationException - if the plug-in does notsupport grid offsets, and the grid offsets are not both zero.
exception:
  IllegalArgumentException - if the tile size is notwithin one of the allowable ranges returned bygetPreferredTileSizes.
exception:
  IllegalArgumentException - if tileWidthor tileHeight is less than or equal to 0.
See Also:   ImageWriteParam.canWriteTiles
See Also:   ImageWriteParam.canOffsetTiles
See Also:   ImageWriteParam.getTileWidth()
See Also:   ImageWriteParam.getTileHeight()
See Also:   ImageWriteParam.getTileGridXOffset()
See Also:   ImageWriteParam.getTileGridYOffset()




setTilingMode
public void setTilingMode(int mode)(Code)
Determines whether the image will be tiled in the output stream and, if it will, how the tiling parameters will be determined. The modes are interpreted as follows:
  • MODE_DISABLED - The image will not be tiled. setTiling will throw an IllegalStateException.
  • MODE_DEFAULT - The image will be tiled using default parameters. setTiling will throw an IllegalStateException.
  • MODE_EXPLICIT - The image will be tiled according to parameters given in the ImageWriteParam.setTilingsetTiling method. Any previously set tiling parameters are discarded.
  • MODE_COPY_FROM_METADATA - The image will conform to the metadata object passed in to a write. setTiling will throw an IllegalStateException.

Parameters:
  mode - The mode to use for tiling.
exception:
  UnsupportedOperationException - ifcanWriteTiles returns false.
exception:
  IllegalArgumentException - if mode is notone of the modes listed above.
See Also:   ImageWriteParam.setTiling
See Also:   ImageWriteParam.getTilingMode



unsetCompression
public void unsetCompression()(Code)
Removes any previous compression type and quality settings.

The default implementation sets the instance variable compressionType to null, and the instance variable compressionQuality to 1.0F.
exception:
  UnsupportedOperationException - if the plug-in does notsupport compression.
exception:
  IllegalStateException - if the compression mode is notMODE_EXPLICIT.
See Also:   ImageWriteParam.setCompressionType
See Also:   ImageWriteParam.setCompressionQuality




unsetTiling
public void unsetTiling()(Code)
Removes any previous tile grid parameters specified by calls to setTiling.

The default implementation sets the instance variables tileWidth, tileHeight, tileGridXOffset, and tileGridYOffset to 0.
exception:
  UnsupportedOperationException - if the plug-in does notsupport tiling.
exception:
  IllegalStateException - if the tiling mode is notMODE_EXPLICIT.
See Also:   ImageWriteParam.setTiling(int,int,int,int)




Fields inherited from javax.imageio.IIOParam
protected IIOParamController controller(Code)(Java Doc)
protected IIOParamController defaultController(Code)(Java Doc)
protected Point destinationOffset(Code)(Java Doc)
protected ImageTypeSpecifier destinationType(Code)(Java Doc)
protected int[] sourceBands(Code)(Java Doc)
protected Rectangle sourceRegion(Code)(Java Doc)
protected int sourceXSubsampling(Code)(Java Doc)
protected int sourceYSubsampling(Code)(Java Doc)
protected int subsamplingXOffset(Code)(Java Doc)
protected int subsamplingYOffset(Code)(Java Doc)

Methods inherited from javax.imageio.IIOParam
public boolean activateController()(Code)(Java Doc)
public IIOParamController getController()(Code)(Java Doc)
public IIOParamController getDefaultController()(Code)(Java Doc)
public Point getDestinationOffset()(Code)(Java Doc)
public ImageTypeSpecifier getDestinationType()(Code)(Java Doc)
public int[] getSourceBands()(Code)(Java Doc)
public Rectangle getSourceRegion()(Code)(Java Doc)
public int getSourceXSubsampling()(Code)(Java Doc)
public int getSourceYSubsampling()(Code)(Java Doc)
public int getSubsamplingXOffset()(Code)(Java Doc)
public int getSubsamplingYOffset()(Code)(Java Doc)
public boolean hasController()(Code)(Java Doc)
public void setController(IIOParamController controller)(Code)(Java Doc)
public void setDestinationOffset(Point destinationOffset)(Code)(Java Doc)
public void setDestinationType(ImageTypeSpecifier destinationType)(Code)(Java Doc)
public void setSourceBands(int[] sourceBands)(Code)(Java Doc)
public void setSourceRegion(Rectangle sourceRegion)(Code)(Java Doc)
public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset)(Code)(Java Doc)

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.