Rgb32Image Class Reference

#include <Pt/Gfx/Api.h>

Image storing pixels in premultiplied ARGB-32 format. More...

Inherits BasicImage< Rgb32 >.

Public Member Functions

 Rgb32Image (const Rgb32 &format=Rgb32::get())
 Constructs an empty image. More...
 
 Rgb32Image (Pt::ssize_t width, Pt::ssize_t height, const Rgb32 &format=Rgb32::get())
 Constructs an image of the given size. More...
 
 Rgb32Image (Pt::ssize_t width, Pt::ssize_t height, Pt::ssize_t padding, const Rgb32 &format=Rgb32::get())
 Constructs an image of the given size with row padding. More...
 
 Rgb32Image (Pt::uint8_t *data, Pt::ssize_t width, Pt::ssize_t height, const Rgb32 &format=Rgb32::get())
 Constructs an image over external pixel data. More...
 
 Rgb32Image (Pt::uint8_t *data, Pt::ssize_t width, Pt::ssize_t height, Pt::ssize_t padding, const Rgb32 &format=Rgb32::get())
 Constructs an image over external pixel data with row padding. More...
 
 Rgb32Image (const Rgb32Image &image)
 Copy constructor. More...
 
void reset (Pt::ssize_t width, Pt::ssize_t height, Pt::ssize_t padding, const Format &format)
 Reset to new size.
 
void reset (Pt::ssize_t width, Pt::ssize_t height, Pt::ssize_t padding)
 Reset to new size, keep existing format.
 
void reset (Pt::uint8_t *data, Pt::ssize_t width, Pt::ssize_t height, Pt::ssize_t padding, const Format &format)
 Reset to new data.
 
void reset (Pt::uint8_t *data, Pt::ssize_t width, Pt::ssize_t height, Pt::ssize_t padding)
 Reset to new data, keep existing format.
 
void clear ()
 Clears the image.
 

Detailed Description

Rgb32Image owns its pixel data and stores each pixel as a 32-bit value with four 8-bit channels in premultiplied ARGB-32 layout. When colors are written, the RGB components are multiplied by alpha. This format is the native target for compositing operations and avoids the per-pixel division during blending.

Constructor & Destructor Documentation

◆ Rgb32Image() [1/6]

Rgb32Image ( const Rgb32 format = Rgb32::get())
explicit

Creates an image with no pixel data. The format parameter selects the pixel format and defaults to Rgb32::get().

◆ Rgb32Image() [2/6]

Rgb32Image ( Pt::ssize_t  width,
Pt::ssize_t  height,
const Rgb32 format = Rgb32::get() 
)

Allocates pixel data for width x height pixels. The format parameter selects the pixel format and defaults to Rgb32::get().

◆ Rgb32Image() [3/6]

Rgb32Image ( Pt::ssize_t  width,
Pt::ssize_t  height,
Pt::ssize_t  padding,
const Rgb32 format = Rgb32::get() 
)

Allocates pixel data for width x height pixels. Each row is extended by padding extra bytes beyond the last pixel, which is useful when the image data must be aligned to a specific stride. The format parameter selects the pixel format and defaults to Rgb32::get().

◆ Rgb32Image() [4/6]

Rgb32Image ( Pt::uint8_t data,
Pt::ssize_t  width,
Pt::ssize_t  height,
const Rgb32 format = Rgb32::get() 
)

Wraps the caller-supplied data buffer without taking ownership. The buffer must cover at least width x height pixels in Rgb32 format and must remain valid for the lifetime of this image. The format parameter selects the pixel format and defaults to Rgb32::get().

◆ Rgb32Image() [5/6]

Rgb32Image ( Pt::uint8_t data,
Pt::ssize_t  width,
Pt::ssize_t  height,
Pt::ssize_t  padding,
const Rgb32 format = Rgb32::get() 
)

Wraps the caller-supplied data buffer without taking ownership. Each row occupies width pixels plus padding extra bytes. The buffer must be sized accordingly and must remain valid for the lifetime of this image. The format parameter selects the pixel format and defaults to Rgb32::get().

◆ Rgb32Image() [6/6]

Rgb32Image ( const Rgb32Image image)

Creates a deep copy of image, including all pixel data.