Ocean
|
This class implements a Windows device independent bitmap. More...
Public Member Functions | |
Bitmap ()=default | |
Creates an invalid bitmap. More... | |
Bitmap (const Bitmap &bitmap) | |
Copies a bitmap. More... | |
Bitmap (Bitmap &&bitmap) | |
Move constructor. More... | |
Bitmap (const Frame &frame) | |
Creates a new bitmap by a given frame holding the image data. More... | |
Bitmap (const FrameType &frameType) | |
Creates a new bitmap with given size and pixel format. More... | |
Bitmap (const unsigned int width, const unsigned int height, const FrameType::PixelFormat preferredPixelFormat, const FrameType::PixelOrigin pixelOrigin) | |
Creates a new bitmap with given size and pixel format. More... | |
Bitmap (unsigned int width, unsigned int height, const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin, const uint8_t *frame, const unsigned int framePaddingElements) | |
Creates a new bitmap with given size and pixel data. More... | |
~Bitmap () | |
Destructs a bitmap. More... | |
unsigned int | width () const |
Returns the width of the bitmap. More... | |
unsigned int | height () const |
Returns the height of the bitmap. More... | |
FrameType::PixelFormat | pixelFormat () const |
Returns the bitmap's pixel format. More... | |
FrameType::PixelOrigin | pixelOrigin () const |
Returns the origin of the bitmap. More... | |
HDC | dc () const |
Returns the device context of the bitmap. More... | |
const uint8_t * | data () const |
Returns the pixel data of the bitmap. More... | |
uint8_t * | data () |
Returns the pixel data of the bitmap. More... | |
unsigned int | size () const |
Returns the size of the bitmap's internal image buffer. More... | |
unsigned int | paddingElements () const |
Returns the number of padding elements at the end of each bitmap row. More... | |
unsigned int | strideElements () const |
Returns the number of elements per bitmap row including optional padding elements at the end of each row. More... | |
bool | setData (const uint8_t *frame, const FrameType::PixelFormat pixelFormat, const unsigned int framePaddingElements) |
Sets the pixel data of the bitmap. More... | |
bool | set (const unsigned int width, const unsigned int height, const FrameType::PixelFormat preferredPixelFormat, const FrameType::PixelOrigin pixelOrigin) |
Sets or changes the format of the bitmap. More... | |
bool | set (const Frame &frame) |
Sets or changes the bitmap data. More... | |
void | release () |
Releases the bitmap data and resets all values to default values. More... | |
bool | isValid () const |
Returns whether the bitmap holds valid data. More... | |
Bitmap & | operator= (Bitmap &&bitmap) |
Move operator. More... | |
Bitmap & | operator= (const Bitmap &bitmap) |
Assigns a bitmap. More... | |
Static Public Member Functions | |
static FrameType::PixelFormat | internalPixelFormat (const FrameType::PixelFormat pixelFormat) |
Returns which (internal) pixel format the bitmap uses to store the image data for a given pixel format. More... | |
Protected Member Functions | |
bool | createBitmap (const unsigned int width, const unsigned int height, const FrameType::PixelFormat supportedPixelFormat, const FrameType::PixelOrigin pixelOrigin) |
Creates a new bitmap object. More... | |
Static Protected Member Functions | |
static bool | createBitmapInfo (const unsigned int width, const unsigned int height, const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin, Memory &bitmapInfoMemory) |
Creates the bitmap info for a specified bitmap. More... | |
Protected Attributes | |
unsigned int | bitmapWidth_ = 0u |
Width of the bitmap in pixel, with range [0, infinity) More... | |
unsigned int | bitmapHeight_ = 0u |
Height of the bitmap in pixel, with range [0, infinity) More... | |
FrameType::PixelFormat | bitmapPixelFormat_ = FrameType::FORMAT_UNDEFINED |
Pixel format of the bitmap. More... | |
FrameType::PixelOrigin | bitmapPixelOrigin_ = FrameType::ORIGIN_INVALID |
Origin of the frame. More... | |
uint8_t * | bitmapData_ = nullptr |
Pixel data of the bitmap. More... | |
unsigned int | bitmapSize_ = 0u |
Size of the pixel buffer in bytes. More... | |
unsigned int | bitmapPaddingElements_ = 0u |
The number of padding elements at the end of each bitmap row, with range [0, 3]. More... | |
unsigned int | bitmapStrideElements_ = 0u |
Number of elements per bitmap row including optional padding elements at the end of each row, with range [width * channels, infinity) More... | |
HDC | bitmapDC_ = nullptr |
Device context of the bitmap. More... | |
HBITMAP | bitmapHandle_ = nullptr |
Handle of the bitmap. More... | |
This class implements a Windows device independent bitmap.
|
default |
Creates an invalid bitmap.
Ocean::Platform::Win::Bitmap::Bitmap | ( | const Bitmap & | bitmap | ) |
Copies a bitmap.
bitmap | The bitmap to copy |
Ocean::Platform::Win::Bitmap::Bitmap | ( | Bitmap && | bitmap | ) |
Move constructor.
bitmap | The bitmap to move |
|
explicit |
Creates a new bitmap by a given frame holding the image data.
frame | The frame to create a bitmap from |
|
explicit |
Creates a new bitmap with given size and pixel format.
frameType | The type of the bitmap that will be created |
Ocean::Platform::Win::Bitmap::Bitmap | ( | const unsigned int | width, |
const unsigned int | height, | ||
const FrameType::PixelFormat | preferredPixelFormat, | ||
const FrameType::PixelOrigin | pixelOrigin | ||
) |
Creates a new bitmap with given size and pixel format.
width | The width of the bitmap in pixel, with range [1, infinity) |
height | The height of the bitmap in pixel, with range [1, infinity) |
preferredPixelFormat | Pixel format of the bitmap |
pixelOrigin | Frame origin |
Ocean::Platform::Win::Bitmap::Bitmap | ( | unsigned int | width, |
unsigned int | height, | ||
const FrameType::PixelFormat | pixelFormat, | ||
const FrameType::PixelOrigin | pixelOrigin, | ||
const uint8_t * | frame, | ||
const unsigned int | framePaddingElements | ||
) |
Creates a new bitmap with given size and pixel data.
width | The width of the bitmap in pixel, with range [1, infinity) |
height | The height of the bitmap in pixel, with range [1, infinity) |
pixelFormat | The pixel format of the given data, must be supported |
pixelOrigin | The origin of the given frame data |
frame | The frame data to be copied, must be valid |
framePaddingElements | Optional number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
Ocean::Platform::Win::Bitmap::~Bitmap | ( | ) |
Destructs a bitmap.
|
protected |
Creates a new bitmap object.
width | The width of the bitmap in pixel, with range [1, infinity) |
height | The height of the bitmap in pixel, with range [1, infinity) |
supportedPixelFormat | The pixel format of the bitmap, must be supported by the bitmap, must be valid |
pixelOrigin | The origin of the bitmap |
|
staticprotected |
Creates the bitmap info for a specified bitmap.
width | The width of the bitmap in pixel, with range [1, infinity) |
height | The height of the bitmap in pixel, with range [1, infinity) |
pixelFormat | The pixel format of the bitmap, must be supported, must be valid |
pixelOrigin | The origin of the bitmap |
bitmapInfoMemory | The resulting bitmap info |
|
inline |
Returns the pixel data of the bitmap.
|
inline |
Returns the pixel data of the bitmap.
|
inline |
Returns the device context of the bitmap.
|
inline |
Returns the height of the bitmap.
|
static |
Returns which (internal) pixel format the bitmap uses to store the image data for a given pixel format.
pixelFormat | The pixel format for which the bitmap's internal pixel format will be returned, must be valid |
bool Ocean::Platform::Win::Bitmap::isValid | ( | ) | const |
Returns whether the bitmap holds valid data.
Move operator.
bitmap | The bitmap to move |
Assigns a bitmap.
bitmap | Right bitmap |
|
inline |
Returns the number of padding elements at the end of each bitmap row.
|
inline |
|
inline |
Returns the origin of the bitmap.
void Ocean::Platform::Win::Bitmap::release | ( | ) |
Releases the bitmap data and resets all values to default values.
bool Ocean::Platform::Win::Bitmap::set | ( | const Frame & | frame | ) |
Sets or changes the bitmap data.
frame | The frame to set |
bool Ocean::Platform::Win::Bitmap::set | ( | const unsigned int | width, |
const unsigned int | height, | ||
const FrameType::PixelFormat | preferredPixelFormat, | ||
const FrameType::PixelOrigin | pixelOrigin | ||
) |
Sets or changes the format of the bitmap.
width | The width of the bitmap in pixel, with range [1, infinity) |
height | The height of the bitmap in pixel, with range [1, infinity) |
preferredPixelFormat | Preferred pixel format of the bitmap, this may be changed internally |
pixelOrigin | The origin of the bitmap |
bool Ocean::Platform::Win::Bitmap::setData | ( | const uint8_t * | frame, |
const FrameType::PixelFormat | pixelFormat, | ||
const unsigned int | framePaddingElements | ||
) |
Sets the pixel data of the bitmap.
The pixel format of the given frame must match with the bitmap's internal pixel format. Both pixel formats match if bitmap.internalPixelFormat(pixelFormat) == bitmap.pixelFormat().
frame | The frame data to be set, must fit the resolution of this bitmap, must be valid |
pixelFormat | The pixel format of the given data, must be a supported pixel format, must be valid |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
|
inline |
Returns the size of the bitmap's internal image buffer.
|
inline |
Returns the number of elements per bitmap row including optional padding elements at the end of each row.
Windows bitmap strides are 4-byte aligned.
|
inline |
Returns the width of the bitmap.
|
protected |
Pixel data of the bitmap.
|
protected |
Device context of the bitmap.
|
protected |
Handle of the bitmap.
|
protected |
Height of the bitmap in pixel, with range [0, infinity)
|
protected |
The number of padding elements at the end of each bitmap row, with range [0, 3].
|
protected |
Pixel format of the bitmap.
|
protected |
Origin of the frame.
|
protected |
Size of the pixel buffer in bytes.
|
protected |
Number of elements per bitmap row including optional padding elements at the end of each row, with range [width * channels, infinity)
|
protected |
Width of the bitmap in pixel, with range [0, infinity)