javax.media.format
Class RGBFormat

java.lang.Object
  |
  +--javax.media.Format
        |
        +--javax.media.format.VideoFormat
              |
              +--javax.media.format.RGBFormat

public class RGBFormat
extends VideoFormat

Describes uncompressed RGB data. The data is in interleaved form. RGB components can be packed into a short or an int. If the pixel components are packed, then the redMask, greenMask and blueMask fields specify the bit masks, otherwise they specify the order of arrangement of the components. For example:

Since:
JMF 2.0
See Also:
Serialized Form

Field Summary
static int BIG_ENDIAN
           
protected  int bitsPerPixel
          The number of bits required to represent a pixel, including all three color components.
protected  int blueMask
          Mask value for the Blue component.
protected  int endian
          Endian ordering of the data where applicable
protected  int flipped
          Indicates whether or not the lines in the video frame are flipped vertically (upside down).
protected  int greenMask
          Mask value for the Green component.
protected  int lineStride
          Increment value of the array index from the first pixel on line n to the first pixel on line n+1.
static int LITTLE_ENDIAN
           
protected  int pixelStride
          Increment value of the array index from one pixel to the next.
protected  int redMask
          Mask value for the Red component.
 
Fields inherited from class javax.media.format.VideoFormat
CINEPAK, frameRate, H261, H261_RTP, H263, H263_1998_RTP, H263_RTP, INDEO32, INDEO41, INDEO50, IRGB, JPEG, JPEG_RTP, maxDataLength, MJPEGA, MJPEGB, MJPG, MPEG, MPEG_RTP, RGB, RLE, RPZA, size, SMC, YUV
 
Fields inherited from class javax.media.Format
byteArray, clz, dataType, encoding, FALSE, formatArray, intArray, NOT_SPECIFIED, shortArray, TRUE
 
Constructor Summary
RGBFormat()
          Constructs a default RGBFormat.
RGBFormat(java.awt.Dimension size, int maxDataLength, java.lang.Class dataType, float frameRate, int bitsPerPixel, int red, int green, int blue)
          Constructs an RGBFormat object with the specified properties.
RGBFormat(java.awt.Dimension size, int maxDataLength, java.lang.Class dataType, float frameRate, int bitsPerPixel, int red, int green, int blue, int pixelStride, int lineStride, int flipped, int endian)
          Constructs an RGBFormat object with the specified properties.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this RGBFormat.
protected  void copy(Format f)
          Copies the attributes from the specified Format into this RGBFormat.
 boolean equals(java.lang.Object format)
          Compares the specified Format with this RGBFormat.
 int getBitsPerPixel()
          Gets the number of bits required per pixel of data.
 int getBlueMask()
          Gets the mask for the blue component.
 int getEndian()
          Gets the endian ordering of the data for unpacked 16-bit data.
 int getFlipped()
          Checks whether or not the video image is vertically flipped.
 int getGreenMask()
          Gets the mask for the green component.
 int getLineStride()
          Gets the line stride--the number of array elements between adjacent rows of pixels.
 int getPixelStride()
          Gets the pixel stride--the number of array elements between adjacent pixels.
 int getRedMask()
          Gets the mask for the red component.
 Format intersects(Format format)
          Finds the attributes shared by two matching Format objects.
 boolean matches(Format format)
          Checks whether or not the specified Format matches this RGBFormat.
 Format relax()
          Generate a format that's less restrictive than this format but contains the basic attributes that will make this resulting format useful for format matching.
 java.lang.String toString()
          Gets a String representation of the attributes of this RGBFormat.
 
Methods inherited from class javax.media.format.VideoFormat
getFrameRate, getMaxDataLength, getSize
 
Methods inherited from class javax.media.Format
getDataType, getEncoding, isSameEncoding, isSameEncoding
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

redMask

protected int redMask
Mask value for the Red component.

greenMask

protected int greenMask
Mask value for the Green component.

blueMask

protected int blueMask
Mask value for the Blue component.

bitsPerPixel

protected int bitsPerPixel
The number of bits required to represent a pixel, including all three color components.

pixelStride

protected int pixelStride
Increment value of the array index from one pixel to the next.

lineStride

protected int lineStride
Increment value of the array index from the first pixel on line n to the first pixel on line n+1.

flipped

protected int flipped
Indicates whether or not the lines in the video frame are flipped vertically (upside down).

endian

protected int endian
Endian ordering of the data where applicable

BIG_ENDIAN

public static final int BIG_ENDIAN

LITTLE_ENDIAN

public static final int LITTLE_ENDIAN
Constructor Detail

RGBFormat

public RGBFormat()
Constructs a default RGBFormat.

RGBFormat

public RGBFormat(java.awt.Dimension size,
                 int maxDataLength,
                 java.lang.Class dataType,
                 float frameRate,
                 int bitsPerPixel,
                 int red,
                 int green,
                 int blue)
Constructs an RGBFormat object with the specified properties. The pixel stride is initialized to the default for the specified data type and bits per pixel. The line stride is initialized using the default pixel stride and specified frame width. The image is not flipped and the endian is LITTLE_ENDIAN.
Parameters:
size - A Dimension that specifies the frame size.
maxDataLength - The maximum length of a data chunk.
dataType - The type of the data. For example, byte array.
frameRate - The frame rate.
bitsPerPixel - The number of bits representing a pixel.
red - The mask for the red color component.
green - The mask for the green color component.
blue - The mask for the blue color component.

RGBFormat

public RGBFormat(java.awt.Dimension size,
                 int maxDataLength,
                 java.lang.Class dataType,
                 float frameRate,
                 int bitsPerPixel,
                 int red,
                 int green,
                 int blue,
                 int pixelStride,
                 int lineStride,
                 int flipped,
                 int endian)
Constructs an RGBFormat object with the specified properties.
Parameters:
size - A Dimension that specifies the frame size.
maxDataLength - The maximum length of a data chunk.
dataType - The type of the data. For example, byte array.
frameRate - The frame rate.
bitsPerPixel - The number of bits representing a pixel.
red - The mask for the red color component.
green - The mask for the green color component.
blue - The mask for the blue color component.
pixelStride - The number of array elements between adjacent pixels.
flipped - Indicates whether or not the lines in the video frame are flipped vertically (upside down). Format.TRUE indicates the image is flipped, Format.FALSE indicates that it is not.
endian - The byte ordering used for this RGBFormat--BIG_ENDIAN or LITTLE_ENDIAN.
Method Detail

getBitsPerPixel

public int getBitsPerPixel()
Gets the number of bits required per pixel of data.
Returns:
An integer representing the number of bits per pixel.

getRedMask

public int getRedMask()
Gets the mask for the red component.
Returns:
The red mask.

getGreenMask

public int getGreenMask()
Gets the mask for the green component.
Returns:
The green mask.

getBlueMask

public int getBlueMask()
Gets the mask for the blue component.
Returns:
The blue mask.

getPixelStride

public int getPixelStride()
Gets the pixel stride--the number of array elements between adjacent pixels.
Returns:
An integer representing the pixel stride.

getLineStride

public int getLineStride()
Gets the line stride--the number of array elements between adjacent rows of pixels.
Returns:
An integer representing the line stride.

getFlipped

public int getFlipped()
Checks whether or not the video image is vertically flipped.
Returns:
Format.TRUE if the video is flipped, Format.FALSE if it is not.

getEndian

public int getEndian()
Gets the endian ordering of the data for unpacked 16-bit data.
Returns:
An integer representing the endian ordering: BIG_ENDIAN, LITTLE_ENDIAN or NOT_SPECIFIED

clone

public java.lang.Object clone()
Creates a clone of this RGBFormat.
Overrides:
clone in class VideoFormat
Returns:
A clone of this RGBFormat.

copy

protected void copy(Format f)
Copies the attributes from the specified Format into this RGBFormat.
Overrides:
copy in class VideoFormat
Parameters:
f - The Format to copy the attributes from.

equals

public boolean equals(java.lang.Object format)
Compares the specified Format with this RGBFormat. Returns true only if the specified Format is a RGBFormat object and all of its attributes are identical to the attributes in this RGBFormat.
Overrides:
equals in class VideoFormat
Parameters:
format - The Format to compare.
Returns:
true if the specified Format is the same as this one.

matches

public boolean matches(Format format)
Checks whether or not the specified Format matches this RGBFormat. Matches only compares the attributes that are defined in the specified Format, unspecified attributes are ignored.

The two Format objects do not have to be of the same class to match. For example, if "A" are "B" are being compared, a match is possible if "A" is derived from "B" or "B" is derived from "A". (The compared attributes must still match, or matches fails.)

Overrides:
matches in class VideoFormat
Parameters:
format - The Format to compare with this one.
Returns:
true if the specified Format matches this one, false if it does not.

intersects

public Format intersects(Format format)
Finds the attributes shared by two matching Format objects. If the specified Format does not match this one, the result is undefined.
Overrides:
intersects in class VideoFormat
Parameters:
The - matching Format to intersect with this RGBFormat.
Returns:
A Format object with its attributes set to those attributes common to both Format objects.
See Also:
matches(javax.media.Format)

relax

public Format relax()
Generate a format that's less restrictive than this format but contains the basic attributes that will make this resulting format useful for format matching.
Overrides:
relax in class VideoFormat
Returns:
A Format that's less restrictive than the this format.

toString

public java.lang.String toString()
Gets a String representation of the attributes of this RGBFormat. For example: "RGB, 352x240, ...".
Overrides:
toString in class VideoFormat
Returns:
A String that describes the format attributes.


Submit a bug or feature
Copyright 1999-2001 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved. See the Specification License for more details.
Sun, Sun Microsystems, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.