Package org.tn5250j.tools.encoder
Class AbstractImageEncoder
- java.lang.Object
-
- org.tn5250j.tools.encoder.AbstractImageEncoder
-
- All Implemented Interfaces:
Encoder
- Direct Known Subclasses:
PNGEncoder
public abstract class AbstractImageEncoder extends java.lang.Object implements Encoder
This is the base class for encoding a component to a stream file.
-
-
Constructor Summary
Constructors Constructor Description AbstractImageEncoder()
-
Method Summary
Modifier and Type Method Description static bytebyteFromChar(char ochar)static bytebyteFromInt(int value)static byte[]bytesFromLong(long value)bytecompressColor(int clr)Compress the given color into one 8 bit representation.bytecompressColor(int red, int green, int blue)Compress the given color into one 8 bit representation.bytecreateByte(int b7, int b6, int b5, int b4, int b3, int b2, int b1, int b0)voidencode(java.awt.Component component, java.io.OutputStream os)Encode the specified component on the specified streamvoidencode(java.awt.Image image, java.io.OutputStream os)protected voiderror(java.lang.String msg)abstract voidsaveImage()static java.awt.Imagesnapshot(java.awt.Component component)
-
-
-
Method Detail
-
encode
public void encode(java.awt.Image image, java.io.OutputStream os) throws java.io.IOException, EncoderException- Throws:
java.io.IOExceptionEncoderException
-
encode
public void encode(java.awt.Component component, java.io.OutputStream os) throws java.io.IOException, EncoderExceptionDescription copied from interface:EncoderEncode the specified component on the specified stream- Specified by:
encodein interfaceEncoder- Parameters:
component- componentos- an outputstream- Throws:
java.io.IOException- an exceptionEncoderException- an encoder exception
-
snapshot
public static java.awt.Image snapshot(java.awt.Component component)
-
saveImage
public abstract void saveImage() throws java.io.IOException, EncoderException- Throws:
java.io.IOExceptionEncoderException
-
createByte
public 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)
-
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 colorgreen- value of the green portion of the colorblue- value of the blue portion of the color- Returns:
- color compressed into 8-bit representation
-
error
protected void error(java.lang.String msg) throws EncoderException- Throws:
EncoderException
-
-