class
#include <bn_sprite_palette_ptr.h>
sprite_palette_ptr std::shared_ptr like smart pointer that retains shared ownership of a sprite color palette.
Several sprite_
The sprite color palette is released when the last remaining sprite_
Public static functions
-
static auto find(const sprite_
palette_ item& palette_item) -> optional<sprite_ palette_ ptr> - Searches for a sprite_
palette_ ptr which contains the given colors. -
static auto create(const sprite_
palette_ item& palette_item) -> sprite_ palette_ ptr - Searches for a sprite_
palette_ ptr which contains the given colors. If it is not found, it creates a sprite_ palette_ ptr which contains them. -
static auto create_new(const sprite_
palette_ item& palette_item) -> sprite_ palette_ ptr - Creates a sprite_
palette_ ptr which contains the given colors. -
static auto create_optional(const sprite_
palette_ item& palette_item) -> optional<sprite_ palette_ ptr> - Searches for a sprite_
palette_ ptr which contains the given colors. If it is not found, it creates a sprite_ palette_ ptr which contains them. -
static auto create_new_optional(const sprite_
palette_ item& palette_item) -> optional<sprite_ palette_ ptr> - Creates a sprite_
palette_ ptr which contains the given colors.
Constructors, destructors, conversion operators
-
sprite_palette_ptr(const sprite_
palette_ ptr& other) - Copy constructor.
-
sprite_palette_ptr(sprite_
palette_ ptr&& other) noexcept - Move constructor.
- ~sprite_palette_ptr()
- Releases the referenced sprite color palette if no more sprite_
palette_ ptr objects reference to it.
Public functions
-
auto operator=(const sprite_
palette_ ptr& other) -> sprite_ palette_ ptr& - Copy assignment operator.
-
auto operator=(sprite_
palette_ ptr&& other) -> sprite_ palette_ ptr& noexcept - Move assignment operator.
- auto id() const -> int
- Returns the internal id.
- auto colors_count() const -> int
- Returns the number of colors contained in this palette.
- auto colors() const -> span<const color>
- Returns the colors contained in this palette.
-
void set_colors(const sprite_
palette_ item& palette_item) - Sets the colors contained in this palette.
- void set_color(int color_index, color color)
- Sets a single color in this palette.
-
auto bpp() const -> bpp_
mode - Returns the bits per pixel of this palette.
- auto inverted() const -> bool
- Indicates if the colors of this palette are inverted or not.
- void set_inverted(bool inverted)
- Sets if the colors of this palette must be inverted or not.
- auto grayscale_intensity() const -> fixed
- Returns the intensity of the grayscale effect applied to the colors of this palette.
- void set_grayscale_intensity(fixed intensity)
- Sets the intensity of the grayscale effect applied to the colors of this palette.
- auto hue_shift_intensity() const -> fixed
- Returns the intensity of the hue shift effect applied to the colors of this palette.
- void set_hue_shift_intensity(fixed intensity)
- Sets the intensity of the hue shift effect applied to the colors of this palette.
- auto fade_color() const -> color
- Returns the color of the fade effect applied to the colors of this palette.
- auto fade_intensity() const -> fixed
- Returns the intensity of the fade effect applied to the colors of this palette.
- void set_fade_color(color color)
- Sets the color of the fade effect applied to the colors of this palette.
- void set_fade_intensity(fixed intensity)
- Sets the intensity of the fade effect applied to the colors of this palette.
- void set_fade(color color, fixed intensity)
- Sets the color and the intensity of the fade effect applied to the colors of this palette.
- auto rotate_count() const -> int
- Returns the number of colors to rotate to the right in this palette.
- void set_rotate_count(int count)
- Sets the number of colors to rotate to the right in this palette.
- auto rotate_range_start() const -> int
- Returns the starting color index of the rotation range in this palette.
- auto rotate_range_size() const -> int
- Returns the number of colors of the rotation range in this palette.
- void set_rotate_range(int start, int size)
- Sets the rotation range of this palette.
-
void swap(sprite_
palette_ ptr& other) - Exchanges the contents of this sprite_
palette_ ptr with those of the other one.
Friends
-
void swap(sprite_
palette_ ptr& a, sprite_ palette_ ptr& b) - Exchanges the contents of a sprite_
palette_ ptr with those of another one. -
auto operator==(const sprite_
palette_ ptr& a, const sprite_ palette_ ptr& b) -> bool defaulted - Default equal operator.
Function documentation
static optional<sprite_ palette_ ptr> bn:: sprite_palette_ptr:: find(const sprite_ palette_ item& palette_item)
Searches for a sprite_
Parameters | |
---|---|
palette_item | sprite_ |
Returns | sprite_ |
static sprite_ palette_ ptr bn:: sprite_palette_ptr:: create(const sprite_ palette_ item& palette_item)
Searches for a sprite_
Parameters | |
---|---|
palette_item | sprite_ |
Returns | The requested sprite_ |
static sprite_ palette_ ptr bn:: sprite_palette_ptr:: create_new(const sprite_ palette_ item& palette_item)
Creates a sprite_
Parameters | |
---|---|
palette_item | sprite_ |
Returns | The requested sprite_ |
static optional<sprite_ palette_ ptr> bn:: sprite_palette_ptr:: create_optional(const sprite_ palette_ item& palette_item)
Searches for a sprite_
Parameters | |
---|---|
palette_item | sprite_ |
Returns | The requested sprite_ |
static optional<sprite_ palette_ ptr> bn:: sprite_palette_ptr:: create_new_optional(const sprite_ palette_ item& palette_item)
Creates a sprite_
Parameters | |
---|---|
palette_item | sprite_ |
Returns | The requested sprite_ |
bn:: sprite_palette_ptr:: sprite_palette_ptr(const sprite_ palette_ ptr& other)
Copy constructor.
Parameters | |
---|---|
other | sprite_ |
bn:: sprite_palette_ptr:: sprite_palette_ptr(sprite_ palette_ ptr&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | sprite_ |
sprite_ palette_ ptr& bn:: sprite_palette_ptr:: operator=(const sprite_ palette_ ptr& other)
Copy assignment operator.
Parameters | |
---|---|
other | sprite_ |
Returns | Reference to this. |
sprite_ palette_ ptr& bn:: sprite_palette_ptr:: operator=(sprite_ palette_ ptr&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | sprite_ |
Returns | Reference to this. |
void bn:: sprite_palette_ptr:: set_colors(const sprite_ palette_ item& palette_item)
Sets the colors contained in this palette.
Parameters | |
---|---|
palette_item | sprite_ |
void bn:: sprite_palette_ptr:: set_grayscale_intensity(fixed intensity)
Sets the intensity of the grayscale effect applied to the colors of this palette.
Parameters | |
---|---|
intensity | New intensity in the range [0..1]. |
void bn:: sprite_palette_ptr:: set_hue_shift_intensity(fixed intensity)
Sets the intensity of the hue shift effect applied to the colors of this palette.
Parameters | |
---|---|
intensity | New intensity in the range [0..1]. |
void bn:: sprite_palette_ptr:: set_fade_intensity(fixed intensity)
Sets the intensity of the fade effect applied to the colors of this palette.
Parameters | |
---|---|
intensity | New intensity in the range [0..1]. |
void bn:: sprite_palette_ptr:: set_rotate_count(int count)
Sets the number of colors to rotate to the right in this palette.
Parameters | |
---|---|
count | Number of colors to rotate to the right in the range [1 - rotate_ |
void bn:: sprite_palette_ptr:: set_rotate_range(int start,
int size)
Sets the rotation range of this palette.
Parameters | |
---|---|
start | Starting color index in the range [0 .. colors_ |
size | Number of colors in the range [2 .. colors_ |
void bn:: sprite_palette_ptr:: swap(sprite_ palette_ ptr& other)
Exchanges the contents of this sprite_
Parameters | |
---|---|
other | sprite_ |
void swap(sprite_ palette_ ptr& a,
sprite_ palette_ ptr& b)
Exchanges the contents of a sprite_
Parameters | |
---|---|
a | First sprite_ |
b | Second sprite_ |