bn::direct_bitmap_item class

Contains the required information to generate direct bitmaps.

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

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

Constructors, destructors, conversion operators

direct_bitmap_item(const bn::color& colors_ref, const size& dimensions) constexpr
Constructor.
direct_bitmap_item(const bn::color& colors_ref, const size& dimensions, compression_type compression) constexpr
Constructor.

Public functions

auto colors_ptr() const -> const bn::color* constexpr
Returns a pointer to the referenced bitmap colors.
auto colors_ref() const -> const bn::color& constexpr
Returns the referenced bitmap colors.
auto dimensions() const -> const size& constexpr
Returns the size in pixels of the referenced bitmap.
auto colors_count() const -> int constexpr
Returns the number of referenced colors.
auto color_index(int x, int y) const -> int constexpr
Returns the index of the referenced color in the specified pixel coordinates.
auto color_index(const point& position) const -> int constexpr
Returns the index of the referenced color in the specified pixel coordinates.
auto color(int x, int y) const -> bn::color constexpr
Returns the referenced bitmap color in the specified pixel coordinates.
auto color(const point& position) const -> bn::color constexpr
Returns the referenced bitmap color in the specified pixel coordinates.
auto compression() const -> compression_type constexpr
Returns the compression type.
auto decompress(span<bn::color> decompressed_colors_ref) const -> direct_bitmap_item
Decompresses the stored data in the colors referenced by decompressed_colors_ref.

Friends

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

Function documentation

bn::direct_bitmap_item::direct_bitmap_item(const bn::color& colors_ref, const size& dimensions) constexpr

Constructor.

Parameters
colors_ref Reference to the bitmap colors.
dimensions Size in pixels of the referenced bitmap.

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

bn::direct_bitmap_item::direct_bitmap_item(const bn::color& colors_ref, const size& dimensions, compression_type compression) constexpr

Constructor.

Parameters
colors_ref Reference to the bitmap colors.
dimensions Size in pixels of the referenced bitmap.
compression Compression type.

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

const bn::color* bn::direct_bitmap_item::colors_ptr() const constexpr

Returns a pointer to the referenced bitmap colors.

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

const bn::color& bn::direct_bitmap_item::colors_ref() const constexpr

Returns the referenced bitmap colors.

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

const size& bn::direct_bitmap_item::dimensions() const constexpr

Returns the size in pixels of the referenced bitmap.

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

int bn::direct_bitmap_item::colors_count() const constexpr

Returns the number of referenced colors.

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

int bn::direct_bitmap_item::color_index(int x, int y) const constexpr

Returns the index of the referenced color in the specified pixel coordinates.

Parameters
x Horizontal position of the bitmap color [0..dimensions().width()).
y Vertical position of the bitmap color [0..dimensions().height()).
Returns The index of the referenced bitmap color.

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

int bn::direct_bitmap_item::color_index(const point& position) const constexpr

Returns the index of the referenced color in the specified pixel coordinates.

Parameters
position Position of the bitmap color.
Returns The index of the referenced bitmap color.

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

bn::color bn::direct_bitmap_item::color(int x, int y) const constexpr

Returns the referenced bitmap color in the specified pixel coordinates.

Parameters
x Horizontal position of the bitmap color [0..dimensions().width()).
y Vertical position of the bitmap color [0..dimensions().height()).
Returns The referenced bitmap color.

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

bn::color bn::direct_bitmap_item::color(const point& position) const constexpr

Returns the referenced bitmap color in the specified pixel coordinates.

Parameters
position Position of the bitmap color.
Returns The referenced bitmap color.

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

direct_bitmap_item bn::direct_bitmap_item::decompress(span<bn::color> decompressed_colors_ref) const

Decompresses the stored data in the colors referenced by decompressed_colors_ref.

Parameters
decompressed_colors_ref Destination of the decompressed colors.
Returns An direct_bitmap_item pointing to the decompressed colors.

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