Class AbstractColorDataType

All Implemented Interfaces:
ArrayStringable, BuiltInDataType, DataType, ExtensionPoint
Direct Known Subclasses:
RGB16ColorDataType, RGB32ColorDataType

public abstract class AbstractColorDataType extends AbstractUnsignedIntegerDataType
AbstractColorDataType provides an abstract color datatype whose value corresponds to an approriate Color decode of the bytes at a memory location. This datatype is a fixed-length unsigned integer type which is rendered with a Color block when applied as Data.

The getValue(MemBuffer, Settings, int) method returns ColorIcon instance.

A fixed-length RGB datatype will adopt a predefined default encoding, however a Typedef may be formed from the RGB datatype which will allow an alternative encoding to be specified via a default Setting (See AbstractIntegerDataType.getTypeDefSettingsDefinitions()).

  • Constructor Details

    • AbstractColorDataType

      public AbstractColorDataType(String name, DataTypeManager dtm)
      Abstract color datatype whose value corresponds to an approriate Color decode of the bytes at a memory location.
      Parameters:
      name - datatype name
      dtm - datatype manager
  • Method Details

    • getOppositeSignednessDataType

      public AbstractIntegerDataType getOppositeSignednessDataType()
      Specified by:
      getOppositeSignednessDataType in class AbstractIntegerDataType
      Returns:
      the data-type with the opposite signedness from this data-type. For example, this method on IntegerDataType will return an instance of UnsignedIntegerDataType.
    • getValueClass

      public final Class<?> getValueClass(Settings settings)
      Description copied from interface: DataType
      Get the Class of the value Object to be returned by this datatype (see DataType.getValue(MemBuffer, Settings, int)).
      Specified by:
      getValueClass in interface DataType
      Overrides:
      getValueClass in class AbstractIntegerDataType
      Parameters:
      settings - the relevant settings to use or null for default.
      Returns:
      Class of the value to be returned by this datatype or null if it can vary or is unspecified. Types which correspond to a string or char array will return the String class.
    • getRepresentation

      public final String getRepresentation(MemBuffer buf, Settings settings, int length)
      Description copied from interface: DataType
      Get bytes from memory in a printable format for this type.
      Specified by:
      getRepresentation in interface DataType
      Overrides:
      getRepresentation in class AbstractIntegerDataType
      Parameters:
      buf - the data.
      settings - the settings to use for the representation.
      length - the number of bytes to represent.
      Returns:
      the representation of the data in this format, never null.
    • getEncodingName

      protected abstract String getEncodingName(Settings settings)
    • getComponentValues

      protected abstract List<AbstractColorDataType.ComponentValue> getComponentValues(MemBuffer buf, Settings settings)
    • getValue

      public ColorIcon getValue(MemBuffer buf, Settings settings, int length)
      Description copied from interface: DataType
      Returns the interpreted data value as an instance of the advertised value class.

      For instance, Pointer data types should return an Address object (or null), or integer data types should return a Scalar object.

      Specified by:
      getValue in interface DataType
      Overrides:
      getValue in class AbstractIntegerDataType
      Parameters:
      buf - the data buffer
      settings - the settings to use.
      length - indicates the maximum number of bytes that may be consumed by a Dynamic datatype, otherwise this value is ignored. A value of -1 may be specified to allow a Dynamic datatype to determine the length based upon the actual data bytes
      Returns:
      the data object, or null if data is invalid
    • decodeColor

      protected abstract Color decodeColor(MemBuffer buf, Settings settings)
      Generate the Color which corresponds to the memory bytes. Implementation must factor Endianess setting into value used.
      Parameters:
      buf - memory bytes buffer
      settings - datatype settings
      Returns:
      Color to be rendered
    • getFieldValue

      protected static int getFieldValue(long fullValue, int rightShift, int finalMask)
    • scaleFieldValue

      protected static int scaleFieldValue(int value, int bitSize)