JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.swing.encode
Class AbstractImageEncoder

java.lang.Object
  |
  +--com.klg.jclass.util.swing.encode.AbstractImageEncoder
All Implemented Interfaces:
Encoder
Direct Known Subclasses:
GIFEncoder, JPEGEncoder, PNGEncoder

public abstract class AbstractImageEncoder
extends Object
implements Encoder

This is the base class for encoding a component to a stream file.


Constructor Summary
AbstractImageEncoder()
           
 
Method Summary
static byte byteFromChar(char ochar)
           
static byte byteFromInt(int value)
           
static byte[] bytesFromInt(int value)
           
static byte[] bytesFromLong(long value)
           
 byte compressColor(int clr)
          Compress the given color into one 8 bit representation.
 byte compressColor(int red, int green, int blue)
          Compress the given color into one 8 bit representation.
static byte createByte(int b7, int b6, int b5, int b4, int b3, int b2, int b1, int b0)
           
 void encode(Component component, OutputStream os)
          Encode the specified component on the specified stream
 void encode(Image image, OutputStream os)
           
protected  void error(String msg)
           
abstract  void saveImage(Image image, OutputStream os)
           
static Image snapshot(Component component)
           
protected static void snapshotJava3d(Component component, Graphics igc)
          Run through the component and its children looking for those that implement Java3dImageable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractImageEncoder

public AbstractImageEncoder()
Method Detail

encode

public void encode(Image image,
                   OutputStream os)
            throws IOException,
                   EncoderException
Specified by:
encode in interface Encoder
IOException
EncoderException

encode

public void encode(Component component,
                   OutputStream os)
            throws IOException,
                   EncoderException
Description copied from interface: Encoder
Encode the specified component on the specified stream

Specified by:
encode in interface Encoder
IOException
EncoderException

snapshot

public static Image snapshot(Component component)

snapshotJava3d

protected static void snapshotJava3d(Component component,
                                     Graphics igc)
Run through the component and its children looking for those that implement Java3dImageable. If such a component is found, then the image of its Java3D canvas is drawn into the image being built.

Parameters:
component - the component to test for Java3d Image drawing capability
igc - the Graphics object representing the parent image being drawn to

saveImage

public abstract void saveImage(Image image,
                               OutputStream os)
                        throws IOException,
                               EncoderException
IOException
EncoderException

createByte

public static byte createByte(int b7,
                              int b6,
                              int b5,
                              int b4,
                              int b3,
                              int b2,
                              int b1,
                              int b0)

byteFromInt

public static byte byteFromInt(int value)

bytesFromInt

public static byte[] bytesFromInt(int value)

bytesFromLong

public static byte[] bytesFromLong(long value)

byteFromChar

public static byte byteFromChar(char ochar)

compressColor

public byte compressColor(int clr)
Compress the given color into one 8 bit representation.

Parameters:
clr - integer representation of rgb value (lowest byte is blue, second lowest byte is green, third lowest byte is red)
Returns:
color compressed into 8-bit representation

compressColor

public byte compressColor(int red,
                          int green,
                          int blue)
Compress the given color into one 8 bit representation.

Parameters:
red - value of the red portion of the color
green - value of the green portion of the color
blue - value of the blue portion of the color
Returns:
color compressed into 8-bit representation

error

protected void error(String msg)
              throws EncoderException
EncoderException

Copyright © 2004 Quest Software Inc..
All rights reserved.