jv.thirdParty.acmeEncoders
Class ImageEncoder
java.lang.Object
|
+--jv.thirdParty.acmeEncoders.ImageEncoder
- All Implemented Interfaces:
- java.awt.image.ImageConsumer
- Direct Known Subclasses:
- GifEncoder, PpmEncoder
- public abstract class ImageEncoder
- extends java.lang.Object
- implements java.awt.image.ImageConsumer
Abstract class for writing out an image.
A framework for classes that encode and write out an image in
a particular file format.
This provides a simplified rendition of the ImageConsumer interface.
It always delivers the pixels as ints in the RGBdefault color model.
It always provides them in top-down left-right order.
If you want more flexibility you can always implement ImageConsumer
directly.
Copyright (C)1996,1998 by Jef Poskanzer . All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Visit the ACME Labs Java page for up-to-date versions of this and other
fine Java utilities: http://www.acme.com/java/
- Version:
- 06.11.00, 2.00 revised (ep) Win NT color model bug handling.
- See Also:
GifEncoder,
PpmEncoder
|
Field Summary |
protected java.io.OutputStream |
out
|
| Fields inherited from interface java.awt.image.ImageConsumer |
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT |
|
Constructor Summary |
ImageEncoder(java.awt.Image img,
java.io.OutputStream out)
Constructor. |
ImageEncoder(java.awt.image.ImageProducer producer,
java.io.OutputStream out)
Constructor. |
|
Method Summary |
void |
encode()
Call this after initialization to get things going. |
void |
imageComplete(int status)
|
void |
setColorModel(java.awt.image.ColorModel model)
|
void |
setDimensions(int width,
int height)
|
void |
setHints(int hintflags)
|
void |
setPixels(int x,
int y,
int w,
int h,
java.awt.image.ColorModel model,
byte[] pixels,
int off,
int scansize)
|
void |
setPixels(int x,
int y,
int w,
int h,
java.awt.image.ColorModel model,
int[] pixels,
int off,
int scansize)
|
void |
setProperties(java.util.Hashtable props)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
out
protected java.io.OutputStream out
ImageEncoder
public ImageEncoder(java.awt.Image img,
java.io.OutputStream out)
throws java.io.IOException
- Constructor.
- Parameters:
img - The image to encode.out - The stream to write the bytes to.
ImageEncoder
public ImageEncoder(java.awt.image.ImageProducer producer,
java.io.OutputStream out)
throws java.io.IOException
- Constructor.
- Parameters:
producer - The ImageProducer to encode.out - The stream to write the bytes to.
encode
public void encode()
throws java.io.IOException
- Call this after initialization to get things going.
setDimensions
public void setDimensions(int width,
int height)
- Specified by:
setDimensions in interface java.awt.image.ImageConsumer
setProperties
public void setProperties(java.util.Hashtable props)
- Specified by:
setProperties in interface java.awt.image.ImageConsumer
setColorModel
public void setColorModel(java.awt.image.ColorModel model)
- Specified by:
setColorModel in interface java.awt.image.ImageConsumer
setHints
public void setHints(int hintflags)
- Specified by:
setHints in interface java.awt.image.ImageConsumer
setPixels
public void setPixels(int x,
int y,
int w,
int h,
java.awt.image.ColorModel model,
byte[] pixels,
int off,
int scansize)
- Specified by:
setPixels in interface java.awt.image.ImageConsumer
setPixels
public void setPixels(int x,
int y,
int w,
int h,
java.awt.image.ColorModel model,
int[] pixels,
int off,
int scansize)
- Specified by:
setPixels in interface java.awt.image.ImageConsumer
imageComplete
public void imageComplete(int status)
- Specified by:
imageComplete in interface java.awt.image.ImageConsumer
The software JavaView® is copyright protected. All Rights Reserved.