Describes a pixel packing format and provides format-specific operations. More...
#include <pixelformat.h>
Classes | |
| struct | CompDesc |
| Describes a single component within the pixel format. More... | |
| struct | Data |
| Aggregate descriptor holding all metadata for a pixel format. More... | |
| struct | PlaneDesc |
| Describes a single image plane. More... | |
Public Member Functions | |
| PixelFormat ()=default | |
| Default constructor. | |
| virtual | ~PixelFormat () |
| Virtual destructor. | |
| bool | isValid () const |
| Returns true if this pixel format is valid (not Invalid). | |
| int | id () const |
| Returns the unique ID of this pixel format. | |
| String | name () const |
| Returns the short name of this pixel format. | |
| String | desc () const |
| Returns a human-readable description of this pixel format. | |
| Sampling | sampling () const |
| Returns the chroma subsampling mode. | |
| size_t | pixelsPerBlock () const |
| Returns the number of pixels in one encoded block. | |
| size_t | bytesPerBlock () const |
| Returns the number of bytes in one encoded block. | |
| bool | hasAlpha () const |
| Returns true if this format includes an alpha channel. | |
| bool | isCompressed () const |
| Returns true if this is a compressed pixel format. | |
| const FourCCList & | fourccList () const |
| Returns the list of FourCC codes associated with this format. | |
| size_t | compCount () const |
| Returns the number of components in this pixel format. | |
| const CompDesc & | compDesc (size_t index) const |
| Returns the component descriptor at the given index. | |
| size_t | planeCount () const |
| Returns the number of planes in this pixel format. | |
| const PlaneDesc & | planeDesc (size_t index) const |
| Returns the plane descriptor at the given index. | |
| bool | isValidPlane (size_t index) const |
| Returns true if the given plane index is valid. | |
| bool | isValidCompCount (size_t ct) const |
| Returns true if the given component count is sufficient. | |
| size_t | lineStride (size_t planeIndex, const ImageDesc &desc) const |
| Returns the number of bytes per line for a given plane. | |
| size_t | planeSize (size_t planeIndex, const ImageDesc &desc) const |
| Returns the total byte size of a given plane. | |
| PaintEngine | createPaintEngine (const Image &img) const |
| Creates a PaintEngine that can draw on the given image. | |
| PixelFormat (ID id=Invalid) | |
| Constructs a PixelFormat from an ID. | |
| PixelFormat & | operator= (const PixelFormat &o) |
| Copy assignment operator. | |
| bool | operator== (const PixelFormat &o) const |
| Returns true if both formats have the same ID. | |
| bool | operator!= (const PixelFormat &o) const |
| Returns true if the formats have different IDs. | |
| bool | isValid () const |
| Returns true if this pixel format is valid (not Invalid). | |
| const Data & | data () const |
| Returns a const reference to the underlying Data descriptor. | |
| ID | id () const |
| Returns the format ID. | |
| const String & | name () const |
| Returns the short format name. | |
| const String & | desc () const |
| Returns the human-readable description. | |
| size_t | comps () const |
| Returns the number of components in this format. | |
| size_t | planes () const |
| Returns the number of planes in this format. | |
| size_t | stride (const Size2Du32 &s, int p=0) const |
| Returns the line stride in bytes for the given image size and plane. | |
| size_t | size (const Size2Du32 &s, int p=0) const |
| Returns the total byte size for the given image size and plane. | |
| bool | fill (const Image &img, const CompList &comps) const |
| Fills an image with the pixel value defined by a component list. | |
| bool | fill (const Image &img, const Comp *comps, size_t compCount) const |
| Fills an image with the pixel value defined by a component array. | |
| Pixel | createPixel (const Comp *comps, size_t compCount) const |
| Creates a Pixel from a component array. | |
Static Public Member Functions | |
| static int | registerPixelFormat (PixelFormat *pixelFormat) |
| Registers a pixel format in the global registry. | |
| static const PixelFormat * | lookup (int id) |
| Looks up a registered pixel format by its ID. | |
| static const String & | formatName (ID id) |
| Returns the human-readable name for a given format ID. | |
Protected Member Functions | |
| virtual size_t | __lineStride (size_t planeIndex, const ImageDesc &desc) const |
| Virtual implementation of lineStride(). | |
| virtual size_t | __planeSize (size_t planeIndex, const ImageDesc &desc) const |
| Virtual implementation of planeSize(). | |
| virtual PaintEngine | __createPaintEngine (const Image &image) const |
| Virtual implementation of createPaintEngine(). | |
Protected Attributes | |
| int | _id = Invalid |
| Unique format identifier. | |
| String | _name |
| Short format name. | |
| String | _desc |
| Human-readable description. | |
| Sampling | _sampling = SamplingUndefined |
| Chroma subsampling mode. | |
| size_t | _pixelsPerBlock = 0 |
| Pixels per encoded block. | |
| size_t | _bytesPerBlock = 0 |
| Bytes per encoded block. | |
| bool | _hasAlpha = false |
| Whether format has alpha. | |
| bool | _compressed = false |
| Whether format is compressed. | |
| FourCCList | _fourccList |
| Associated FourCC codes. | |
| List< CompDesc > | _compList |
| Component descriptors. | |
| List< PlaneDesc > | _planeList |
| Plane descriptors. | |
Describes a pixel packing format and provides format-specific operations.
Legacy pixel format descriptor (superseded by the new PixelFormat).
PixelFormat is a polymorphic base class that describes how pixel data is packed in memory. It does not concern itself with color semantics, only with the layout of components, planes, and blocks. Concrete subclasses are registered at static-init time via PROMEKI_REGISTER_PIXELFORMAT and looked up by numeric ID.
Provides an interface for interacting with data in a particular pixel packing format. This class does not concern itself with the concept of color, only with the layout of components within packed data.
Function that computes a Pixel from component inputs.
| comps | Array of component values. |
Function that fills an image with a pixel value from a component array.
| img | The image to fill. |
| comps | Array of component values (must have at least the required count). |
Function that returns the total number of bytes for an image of the given size.
| size | Image dimensions. |
Pixel component type.
Pixel component type.
The ID of the unique packing format for the pixel.
Unique packing format identifier.
Chroma subsampling mode.
Chroma subsampling mode.
Constructs a PixelFormat from an ID.
| id | The pixel format ID (defaults to Invalid). |
|
protectedvirtual |
Virtual implementation of createPaintEngine().
| image | The image to create a paint engine for. |
|
protectedvirtual |
Virtual implementation of lineStride().
| planeIndex | Zero-based plane index. |
| desc | Image descriptor providing dimensions. |
|
protectedvirtual |
Virtual implementation of planeSize().
| planeIndex | Zero-based plane index. |
| desc | Image descriptor providing dimensions. |
Returns the component descriptor at the given index.
| index | Zero-based component index. |
| PaintEngine PixelFormat::createPaintEngine | ( | const Image & | img | ) | const |
Creates a PaintEngine that can draw on the given image.
| img | The image to create a paint engine for. |
Creates a Pixel from a component array.
| comps | Array of component values. |
| compCount | Number of components in the array. |
Fills an image with the pixel value defined by a component array.
| img | The image to fill. |
| comps | Array of component values. |
| compCount | Number of components in the array. |
Fills an image with the pixel value defined by a component list.
| img | The image to fill. |
| comps | List of component values. |
Returns the human-readable name for a given format ID.
| id | The pixel format ID. |
|
inline |
Returns true if this is a compressed pixel format.
Compressed formats (e.g. JPEG_RGB8) store an encoded bitstream rather than scanline-addressable pixel data. Image::isCompressed() is a convenience wrapper around this.
Returns true if the given component count is sufficient.
| ct | Number of components to check against. |
Returns true if the given plane index is valid.
| index | Zero-based plane index to check. |
|
static |
Looks up a registered pixel format by its ID.
| id | The format ID to look up. |
Returns the plane descriptor at the given index.
| index | Zero-based plane index. |
Returns the total byte size of a given plane.
| planeIndex | Zero-based plane index. |
| desc | Image descriptor providing dimensions. |
|
static |
Registers a pixel format in the global registry.
| pixelFormat | Pointer to a heap-allocated PixelFormat subclass. |
Returns the total byte size for the given image size and plane.
| s | Image dimensions. |
| p | Plane index (defaults to 0). |