bn::palette_bitmap_item class

Contains the required information to generate palette bitmaps.

The assets conversion tools generate an object of this type in the build folder for each *.bmp file with palette_bitmap type.

Pixels and colors are not copied but referenced, so they should outlive the palette_bitmap_item to avoid dangling references.

Constructors, destructors, conversion operators

palette_bitmap_item(const uint8_t& pixels_ref, const size& dimensions, const span<const color>& colors_ref) constexpr
Constructor.
palette_bitmap_item(const palette_bitmap_pixels_item& pixels_item, const bg_palette_item& palette_item) constexpr
Constructor.

Public functions

auto pixels_item() const -> const palette_bitmap_pixels_item& constexpr
Returns the item that references the pixels of the bitmap.
auto palette_item() const -> const bg_palette_item& constexpr
Returns the item that references the colors of the bitmap.
auto decompress(span<uint8_t> decompressed_pixels_ref, span<color> decompressed_colors_ref) const -> palette_bitmap_item
Decompresses the stored data in the pixels referenced by decompressed_pixels_ref and the colors referenced by decompressed_colors_ref.

Friends

auto operator==(const palette_bitmap_item& a, const palette_bitmap_item& b) -> bool defaulted constexpr
Default equal operator.

Function documentation

bn::palette_bitmap_item::palette_bitmap_item(const uint8_t& pixels_ref, const size& dimensions, const span<const color>& colors_ref) constexpr

Constructor.

Parameters
pixels_ref Reference to the palette bitmap pixels.
dimensions Size in pixels of the referenced palette bitmap pixels.
colors_ref Reference to an array of multiples of 16 colors.

The pixels are not copied but referenced, so they should outlive the palette_bitmap_item to avoid dangling references.

The colors are not copied but referenced, so they should outlive the palette_bitmap_item to avoid dangling references.

bn::palette_bitmap_item::palette_bitmap_item(const palette_bitmap_pixels_item& pixels_item, const bg_palette_item& palette_item) constexpr

Constructor.

Parameters
pixels_item It references the pixels of the bitmap.
palette_item It references the colors of the bitmap.

palette_bitmap_item bn::palette_bitmap_item::decompress(span<uint8_t> decompressed_pixels_ref, span<color> decompressed_colors_ref) const

Decompresses the stored data in the pixels referenced by decompressed_pixels_ref and the colors referenced by decompressed_colors_ref.

Parameters
decompressed_pixels_ref Destination of the decompressed pixels.
decompressed_colors_ref Destination of the decompressed colors.
Returns A sprite_item pointing to the decompressed pixels and colors.

If the source and destination pixels or colors overlap, the behavior is undefined.