Rgb32Image Class Reference

#include <Pt/Gfx/Rgb32Image.h>

Premultiplied ARGB-32 image. More...

Inherits BasicImage< Rgb32 >.

Public Member Functions

 Rgb32Image (const Rgb32 &format=Rgb32::get())
 Constructs an empty image.
 Rgb32Image (Pt::ssize_t width, Pt::ssize_t height, const Rgb32 &format=Rgb32::get())
 Constructs an image of the given size.
 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.
 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.
 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.
 Rgb32Image (const Rgb32Image &image)
 Copy constructor.
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 is BasicImage with the Rgb32 format bound at compile time. Each pixel is 32 bits with 8-bit channels in premultiplied ARGB-32 layout: when a color is written, the RGB components are multiplied by alpha. Use this type when blending should not divide by alpha per pixel. Use Argb32Image when channels are stored with straight alpha.

Constructors that take width and height allocate. Constructors that take a data pointer wrap the caller buffer; that buffer must remain valid for the lifetime of the image.

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.