Package ghidra.program.model.data
Class AbstractColorDataType
- All Implemented Interfaces:
ArrayStringable,BuiltInDataType,DataType,ExtensionPoint
- Direct Known Subclasses:
RGB16ColorDataType,RGB32ColorDataType
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()).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final record -
Field Summary
Fields inherited from class ghidra.program.model.data.AbstractIntegerDataType
ENDIAN, MNEMONIC, PADDING, SETTINGS_DEFS, TYPEDEF_SETTINGS_DEFSFields inherited from class ghidra.program.model.data.DataTypeImpl
defaultSettingsFields inherited from class ghidra.program.model.data.AbstractDataType
categoryPath, dataMgr, EMPTY_TYPEDEF_DEFINITIONS, nameFields inherited from interface ghidra.program.model.data.DataType
CONFLICT_SUFFIX, DEFAULT, NO_LAST_CHANGE_TIME, NO_SOURCE_SYNC_TIME, TYPEDEF_ATTRIBUTE_PREFIX, TYPEDEF_ATTRIBUTE_SUFFIX, VOID -
Constructor Summary
ConstructorsConstructorDescriptionAbstractColorDataType(String name, DataTypeManager dtm) Abstract color datatype whose value corresponds to an approriate Color decode of the bytes at a memory location. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ColordecodeColor(MemBuffer buf, Settings settings) Generate theColorwhich corresponds to the memory bytes.protected abstract List<AbstractColorDataType.ComponentValue> getComponentValues(MemBuffer buf, Settings settings) protected abstract StringgetEncodingName(Settings settings) protected static intgetFieldValue(long fullValue, int rightShift, int finalMask) final StringgetRepresentation(MemBuffer buf, Settings settings, int length) Get bytes from memory in a printable format for this type.Returns the interpreted data value as an instance of theadvertised value class.final Class<?> getValueClass(Settings settings) Get the Class of the value Object to be returned by this datatype (seeDataType.getValue(MemBuffer, Settings, int)).protected static intscaleFieldValue(int value, int bitSize) Methods inherited from class ghidra.program.model.data.AbstractUnsignedIntegerDataType
isSignedMethods inherited from class ghidra.program.model.data.AbstractIntegerDataType
castValueToEncode, encodeRepresentation, encodeValue, getArrayDefaultLabelPrefix, getArrayDefaultOffcutLabelPrefix, getAssemblyMnemonic, getBitCount, getBuiltInSettingsDefinitions, getCDeclaration, getCMnemonic, getDefaultLabelPrefix, getFormatSettingsDefinition, getMnemonic, getSignedDataType, getSignedDataTypes, getTypeDefSettingsDefinitions, getUnsignedDataType, getUnsignedDataTypes, hasStringValue, isEncodable, isEquivalentMethods inherited from class ghidra.program.model.data.BuiltIn
addParent, copy, getCTypeDeclaration, getCTypeDeclaration, getCTypeDeclaration, getCTypeDeclaration, getDecompilerDisplayName, getLastChangeTime, getSettingsDefinitions, getUniversalID, removeParent, setDefaultSettingsMethods inherited from class ghidra.program.model.data.DataTypeImpl
equals, getAlignedLength, getAlignment, getDefaultSettings, getLastChangeTimeInSourceArchive, getParents, getSourceArchive, hashCode, notifyAlignmentChanged, notifyDeleted, notifyNameChanged, notifyParents, notifyReplaced, notifySizeChanged, replaceWith, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchiveMethods inherited from class ghidra.program.model.data.AbstractDataType
dataTypeAlignmentChanged, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, getCategoryPath, getDataOrganization, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDisplayName, getName, getPathName, hasLanguageDependantLength, isDeleted, isNotYetDefined, isZeroLength, setCategoryPath, setName, setNameAndCategory, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.program.model.data.ArrayStringable
getArrayStringMethods inherited from interface ghidra.program.model.data.DataType
addParent, clone, copy, dataTypeAlignmentChanged, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, getAlignedLength, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getLastChangeTime, getLastChangeTimeInSourceArchive, getLength, getName, getParents, getPathName, getSettingsDefinitions, getSourceArchive, getUniversalID, hasLanguageDependantLength, isDeleted, isNotYetDefined, isZeroLength, removeParent, replaceWith, setCategoryPath, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setName, setNameAndCategory, setSourceArchive
-
Constructor Details
-
AbstractColorDataType
Abstract color datatype whose value corresponds to an approriate Color decode of the bytes at a memory location.- Parameters:
name- datatype namedtm- datatype manager
-
-
Method Details
-
getOppositeSignednessDataType
- Specified by:
getOppositeSignednessDataTypein classAbstractIntegerDataType- 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
Description copied from interface:DataTypeGet the Class of the value Object to be returned by this datatype (seeDataType.getValue(MemBuffer, Settings, int)).- Specified by:
getValueClassin interfaceDataType- Overrides:
getValueClassin classAbstractIntegerDataType- 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
Description copied from interface:DataTypeGet bytes from memory in a printable format for this type.- Specified by:
getRepresentationin interfaceDataType- Overrides:
getRepresentationin classAbstractIntegerDataType- 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
-
getComponentValues
protected abstract List<AbstractColorDataType.ComponentValue> getComponentValues(MemBuffer buf, Settings settings) -
getValue
Description copied from interface:DataTypeReturns the interpreted data value as an instance of theadvertised value class.For instance,
Pointerdata types should return an Address object (or null), or integer data types should return aScalarobject.- Specified by:
getValuein interfaceDataType- Overrides:
getValuein classAbstractIntegerDataType- Parameters:
buf- the data buffersettings- the settings to use.length- indicates the maximum number of bytes that may be consumed by aDynamicdatatype, 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
Generate theColorwhich corresponds to the memory bytes. Implementation must factor Endianess setting into value used.- Parameters:
buf- memory bytes buffersettings- 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)
-