public final class RGBAComponentImpl extends Object implements RGBAComponent, Serializable, XMLSerializable, Cloneable, CommonConstants
Implements an element of an array representing the order and size of the component values within a pixel value as part of an RGBA Layout. The RGB layout type type is a fixed-size 8 element array, where each element consists of an RGBA component value. Each RGBA component has with the following fields:
code - RGBA component kind enumerated value
specifying the component kind.size - Java byte specifying the number of bits.| Modifier and Type | Class and Description |
|---|---|
static class |
RGBAComponentImpl.XMLHandler
XML parser event handler for converting RGBA component elements into RGBA component
values.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
MYSQL_COLUMN_DEFINITION |
static String |
RGBACOMPONENT_TAG |
AAF_METADICT_NAMESPACE, AAF_METADICT_PREFIX, AAF_XML_NAMESPACE, AAF_XML_PREFIX, ApplicationPluginObjectID, ApplicationPluginsID, MAX_NUM_RGBA_COMPS, MemberOfID, ObjectClassID, ParentClassID, PropertiesID, XMLClassIDAsAttributeName| Constructor and Description |
|---|
RGBAComponentImpl()
Create a new RGBA component with a
RGBAComponentKind.Null code and
a size of 0. |
RGBAComponentImpl(RGBAComponentKind code,
byte size)
Create an element of an RGBAComponent array.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendXMLChildren(Node parent)
Append extra child elements to the given parent node to serialize the value of an object
to an XML fragment.
|
RGBAComponent |
clone()
Create a cloned copy of this RGBA component value.
|
boolean |
equals(Object o) |
static RGBAComponent |
fromPersistentForm(String rgbaComponent) |
RGBAComponentKind |
getCode()
Returns the type of an RGBA component.
|
String |
getComment()
Include a comment when serializing a value to XML.
|
byte |
getComponentSize()
Returns the size, measured in bits, of the RGBA component.
|
int |
hashCode() |
static RGBAComponentImpl |
parseFactory(String componentString)
Create a new value of this RGBA component type by parsing the given pseudo-XML
representation.
|
void |
setCode(RGBAComponentKind code)
Sets the type of an RGBA component.
|
void |
setComponentSize(byte size)
Sets the size, measured in bits, of the RGBA component.
|
static String |
toPersistentForm(RGBAComponent rgbaComponent) |
String |
toString()
Creates a pseudo-XML string representation of this RGBA component value.
|
public static final String RGBACOMPONENT_TAG
public static final String MYSQL_COLUMN_DEFINITION
public RGBAComponentImpl()
Create a new RGBA component with a RGBAComponentKind.Null code and
a size of 0.
This constructor is public to allow the
TypeDefinitionRecord#getObject(tv.amwa.maj.model.PropertyValue, Class)
method to create new instances of objects from record property values.
public RGBAComponentImpl(RGBAComponentKind code, @UInt8 byte size) throws NullPointerException, IllegalArgumentException
Create an element of an RGBAComponent array.
code - Code for the component.size - Size of the component in bits.NullPointerException - The code argument is null.IllegalArgumentException - The size argument is negative.public final RGBAComponentKind getCode()
RGBAComponentReturns the type of an RGBA component.
getCode in interface RGBAComponentpublic final void setCode(RGBAComponentKind code) throws NullPointerException
RGBAComponentSets the type of an RGBA component.
setCode in interface RGBAComponentcode - Type of an RGBA component.NullPointerException - The given component kind is null.@UInt8 public final byte getComponentSize()
RGBAComponentReturns the size, measured in bits, of the RGBA component.
getComponentSize in interface RGBAComponentpublic final void setComponentSize(@UInt8 byte size) throws IllegalArgumentException
RGBAComponentSets the size, measured in bits, of the RGBA component.
setComponentSize in interface RGBAComponentsize - Size of the RGBA component.IllegalArgumentException - The size value is negative.public final String toString()
Creates a pseudo-XML string representation of this RGBA component value. The representation
consists of a RGBAComponent element with Code and Size
sub-elements. For example, an 8-bit red component is represented as follows:
<RGBAComponent>
<Code>CompRed</Code>
<ComponentSize>8</ComponentSize>
</RGBAComponent>
toString in interface RGBAComponenttoString in class ObjectparseFactory(String),
RGBAComponentImpl.XMLHandlerpublic static final RGBAComponentImpl parseFactory(String componentString) throws NullPointerException, ParseException
Create a new value of this RGBA component type by parsing the given pseudo-XML
representation. This method will create an instance from the result of calling the
toString() method. The pseudo-XML format is illustrated below:
<RGBAComponent>
<Code>CompRed</Code>
<ComponentSize>8</ComponentSize>
</RGBAComponent>
If any tags are missing, default values are used and the method returns successfully. This method ignores any namespace prefix found in an element name.
componentString - Pseudo-XML string to convert into a RGBA component instance.NullPointerException - The given psuedo-XML representation is null.ParseException - The component size could not be parsed into a byte value or the
given component code was not recognized as an element of the
RGBA component kind enumeration.toString()public final RGBAComponent clone()
RGBAComponentCreate a cloned copy of this RGBA component value.
clone in interface RGBAComponentclone in class Objectpublic void appendXMLChildren(Node parent)
XMLSerializableAppend extra child elements to the given parent node to serialize the value of an object
to an XML fragment. Methods of the XMLBuilder class are provided to help with this
process.
appendXMLChildren in interface XMLSerializableparent - XML parent element to append child nodes to.public String getComment()
XMLSerializableInclude a comment when serializing a value to XML. The comment will be inserted as the first child node of the element representing the class.
getComment in interface XMLSerializablepublic static final String toPersistentForm(RGBAComponent rgbaComponent)
public static final RGBAComponent fromPersistentForm(String rgbaComponent)
(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.