Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.awt.color.PixelFormat

java.lang.Object
  |
  +--java.text.Format
        |
        +--ncsa.horizon.awt.color.PixelFormat
Subclasses:
HSBPixelFormat

public class PixelFormat
extends java.text.Format
a Format object for reading in a color and opacity.

This Format supports three formats for describing a color and its opacity:

Other formats can be supported by subclassing this class.

The Object handed to format as well as the result of parsing is a 4-element byte array containing the red, green, blue, and alpha values.

See Also:
Serialized Form

Field Summary
static int FOURCOMPONENT
          an identifier of the four decimal component format
static int HEX_0x
          an identifier of the 0x Hexidecimal format
static int HEX_lb
          an identifier of the # Hexidecimal format
static int NEWTYPE
          an unknown format.
 
Constructor Summary
PixelFormat()
           
PixelFormat(int format_type, int ntypes)
          contruct this Format objects to format pixel values using a specified type.
PixelFormat(int format_type)
          contruct this Format objects to format pixel values using a specified type.
 
Method Summary
java.lang.StringBuffer format(byte[] pixel, java.lang.StringBuffer buf)
          format the 4-component pixel value and append results to a buffer.
java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
           
java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition status)
           
byte[] parsePixel(java.lang.String s, java.text.ParsePosition stat)
           
 
Methods inherited from class java.text.Format
clone, format, format, parseObject, parseObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

FOURCOMPONENT

public static final int FOURCOMPONENT
an identifier of the four decimal component format

HEX_0x

public static final int HEX_0x
an identifier of the 0x Hexidecimal format

HEX_lb

public static final int HEX_lb
an identifier of the # Hexidecimal format

NEWTYPE

public static final int NEWTYPE
an unknown format. Subclasses should identify new format types starting with this value.
Constructor Detail

PixelFormat

public PixelFormat()

PixelFormat

protected PixelFormat(int format_type,
                      int ntypes)
contruct this Format objects to format pixel values using a specified type.
Parameters:
format_type - the format type code
ntypes - the number of formats recognized by this subclass
Throws:
java.lang.IllegalArgumentException - if format_type >= ntypes

PixelFormat

public PixelFormat(int format_type)
contruct this Format objects to format pixel values using a specified type.
Throws:
java.lang.IllegalArgumentException - if format_type > 2
Method Detail

format

public java.lang.StringBuffer format(byte[] pixel,
                           java.lang.StringBuffer buf)
format the 4-component pixel value and append results to a buffer. Subclasses should override this method to support new formats.

format

public java.lang.StringBuffer format(java.lang.Object obj,
                           java.lang.StringBuffer toAppendTo,
                           java.text.FieldPosition pos)
Overrides:
format in class java.text.Format

parsePixel

public byte[] parsePixel(java.lang.String s,
                         java.text.ParsePosition stat)

parseObject

public java.lang.Object parseObject(java.lang.String source,
                          java.text.ParsePosition status)
Overrides:
parseObject in class java.text.Format

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD