com.gif4j.imageio
Class GifImageWriterSpi

java.lang.Object
  extended byjavax.imageio.spi.IIOServiceProvider
      extended byjavax.imageio.spi.ImageReaderWriterSpi
          extended byjavax.imageio.spi.ImageWriterSpi
              extended bycom.gif4j.imageio.GifImageWriterSpi
All Implemented Interfaces:
javax.imageio.spi.RegisterableService

public class GifImageWriterSpi
extends javax.imageio.spi.ImageWriterSpi


Field Summary
 
Fields inherited from class javax.imageio.spi.ImageWriterSpi
STANDARD_OUTPUT_TYPE
 
Constructor Summary
GifImageWriterSpi()
           
 
Method Summary
 boolean canEncodeImage(javax.imageio.ImageTypeSpecifier type)
          Returns true if the ImageWriter implementation associated with this service provider is able to encode an image with the given layout.
 javax.imageio.ImageWriter createWriterInstance(java.lang.Object extension)
          Returns an instance of the ImageWriter implementation associated with this service provider.
 java.lang.String getDescription(java.util.Locale locale)
          Returns a brief, human-readable description of this service provider and its associated implementation.
 
Methods inherited from class javax.imageio.spi.ImageWriterSpi
canEncodeImage, createWriterInstance, getImageReaderSpiNames, getOutputTypes, isFormatLossless, isOwnWriter
 
Methods inherited from class javax.imageio.spi.ImageReaderWriterSpi
getExtraImageMetadataFormatNames, getExtraStreamMetadataFormatNames, getFileSuffixes, getFormatNames, getImageMetadataFormat, getMIMETypes, getNativeImageMetadataFormatName, getNativeStreamMetadataFormatName, getPluginClassName, getStreamMetadataFormat, isStandardImageMetadataFormatSupported, isStandardStreamMetadataFormatSupported
 
Methods inherited from class javax.imageio.spi.IIOServiceProvider
getVendorName, getVersion, onDeregistration, onRegistration
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GifImageWriterSpi

public GifImageWriterSpi()
Method Detail

getDescription

public java.lang.String getDescription(java.util.Locale locale)
Description copied from class: javax.imageio.spi.IIOServiceProvider
Returns a brief, human-readable description of this service provider and its associated implementation. The resulting string should be localized for the supplied Locale, if possible.

Parameters:
locale - a Locale for which the return value should be localized.
Returns:
a String containing a description of this service provider.

createWriterInstance

public javax.imageio.ImageWriter createWriterInstance(java.lang.Object extension)
                                               throws java.io.IOException
Description copied from class: javax.imageio.spi.ImageWriterSpi
Returns an instance of the ImageWriter implementation associated with this service provider. The returned object will initially be in an initial state as if its reset method had been called.

An Object may be supplied to the plug-in at construction time. The nature of the object is entirely plug-in specific.

Typically, a plug-in will implement this method using code such as return new MyImageWriter(this).

Parameters:
extension - a plug-in specific extension object, which may be null.
Returns:
an ImageWriter instance.
Throws:
java.io.IOException - if the attempt to instantiate the writer fails.

canEncodeImage

public boolean canEncodeImage(javax.imageio.ImageTypeSpecifier type)
Description copied from class: javax.imageio.spi.ImageWriterSpi
Returns true if the ImageWriter implementation associated with this service provider is able to encode an image with the given layout. The layout (i.e., the image's SampleModel and ColorModel) is described by an ImageTypeSpecifier object.

A return value of true is not an absolute guarantee of successful encoding; the encoding process may still produce errors due to factors such as I/O errors, inconsistent or malformed data structures, etc. The intent is that a reasonable inspection of the basic structure of the image be performed in order to determine if it is within the scope of the encoding format. For example, a service provider for a format that can only encode greyscale would return false if handed an RGB BufferedImage. Similarly, a service provider for a format that can encode 8-bit RGB imagery might refuse to encode an image with an associated alpha channel.

Different ImageWriters, and thus service providers, may choose to be more or less strict. For example, they might accept an image with premultiplied alpha even though it will have to be divided out of each pixel, at some loss of precision, in order to be stored.

Parameters:
type - an ImageTypeSpecifier specifying the layout of the image to be written.
Returns:
true if this writer is likely to be able to encode images with the given layout.