palette_bitmap_bg_painter class
#include <bn_palette_bitmap_bg_painter.h>
Performs low-level painting on palette bitmap backgrounds.
Only one bitmap painter can be active at the same time.
Constructors, destructors, conversion operators
-
palette_bitmap_bg_painter(const palette_
bitmap_ bg_ ptr& bg) explicit - Class constructor.
-
palette_bitmap_bg_painter(palette_
bitmap_ bg_ ptr&& bg) explicit - Class constructor.
-
palette_bitmap_bg_painter(palette_
bitmap_ bg_ painter&& other) noexcept - Move constructor.
- ~palette_bitmap_bg_painter()
- Class destructor.
Public functions
-
auto operator=(palette_
bitmap_ bg_ painter&& other) -> palette_ bitmap_ bg_ painter& noexcept - Move assignment operator.
-
auto bg() const -> const palette_
bitmap_ bg_ ptr& - Returns the background modified by this painter.
- auto page() const -> span<const uint16_t>
- Returns a span of the hidden frame buffer.
- auto page() -> span<uint16_t>
- Returns a span of the hidden frame buffer.
- void flip_page_later()
- Swaps the hidden frame buffer in the next core::
update call. - void flip_page_now()
- Swaps the hidden frame buffer without waiting to the next core::
update call. - void clear()
- Fills the current page with the transparent color.
- void fill(int color_index)
- Fills the current page with the given color.
- auto unsafe_get(int x, int y) const -> int
- Returns the referenced color palette index without bounds checking.
- auto unsafe_get(const point& position) const -> int
- Returns the referenced color palette index without bounds checking.
- auto get(int x, int y) const -> optional<int>
- Returns the referenced color palette index with bounds checking.
- auto get(const point& position) const -> optional<int>
- Returns the referenced color palette index with bounds checking.
- void unsafe_plot(int x, int y, int color_index)
- Plots a pixel on the current page without bounds checking.
- void unsafe_plot(const point& position, int color_index)
- Plots a pixel on the current page without bounds checking.
- void plot(int x, int y, int color_index)
- Plots a pixel on the current page with bounds checking.
- void plot(const point& position, int color_index)
- Plots a pixel on the current page with bounds checking.
- void unsafe_horizontal_line(int x1, int x2, int y, int color_index)
- Draws an horizontal line in the current page without bounds checking.
- void horizontal_line(int x1, int x2, int y, int color_index)
- Draws an horizontal line in the current page with bounds checking.
- void unsafe_vertical_line(int x, int y1, int y2, int color_index)
- Draws a vertical line in the current page without bounds checking.
- void vertical_line(int x, int y1, int y2, int color_index)
- Draws a vertical line in the current page with bounds checking.
- void unsafe_line(int x1, int y1, int x2, int y2, int color_index)
- Draws a line in the current page without bounds checking.
- void unsafe_line(const point& first, const point& last, int color_index)
- Draws a line in the current page without bounds checking.
- void line(int x1, int y1, int x2, int y2, int color_index)
- Draws a line in the current page with bounds checking.
- void line(const point& first, const point& last, int color_index)
- Draws a line in the current page with bounds checking.
- void unsafe_rectangle(int x1, int y1, int x2, int y2, int color_index)
- Draws a filled rectangle in the current page without bounds checking.
- void unsafe_rectangle(const point& first, const point& last, int color_index)
- Draws a filled rectangle in the current page without bounds checking.
- void rectangle(int x1, int y1, int x2, int y2, int color_index)
- Draws a filled rectangle in the current page with bounds checking.
- void rectangle(const point& first, const point& last, int color_index)
- Draws a filled rectangle in the current page with bounds checking.
-
void unsafe_blit(int x,
int y,
const palette_
bitmap_ pixels_ item& item) - Copies the given item to the current page without bounds checking. Transparent pixels are also copied.
-
void unsafe_blit(const point& position,
const palette_
bitmap_ pixels_ item& item) - Copies the given item to the current page without bounds checking. Transparent pixels are also copied.
-
void unsafe_blit(int x,
int y,
const palette_
bitmap_ roi& roi) - Copies the given region of interest to the current page without bounds checking. Transparent pixels are also copied.
-
void unsafe_blit(const point& position,
const palette_
bitmap_ roi& roi) - Copies the given region of interest to the current page without bounds checking. Transparent pixels are also copied.
-
void blit(int x,
int y,
const palette_
bitmap_ pixels_ item& item) - Copies the given item to the current page with bounds checking. Transparent pixels are also copied.
-
void blit(const point& position,
const palette_
bitmap_ pixels_ item& item) - Copies the given item to the current page with bounds checking. Transparent pixels are also copied.
-
void blit(int x,
int y,
const palette_
bitmap_ roi& roi) - Copies the given region of interest to the current page with bounds checking. Transparent pixels are also copied.
-
void blit(const point& position,
const palette_
bitmap_ roi& roi) - Copies the given region of interest to the current page with bounds checking. Transparent pixels are also copied.
-
void unsafe_draw(int x,
int y,
const palette_
bitmap_ pixels_ item& item) - Copies the given item to the current page without bounds checking. Transparent pixels are skipped.
-
void unsafe_draw(const point& position,
const palette_
bitmap_ pixels_ item& item) - Copies the given item to the current page without bounds checking. Transparent pixels are skipped.
-
void unsafe_draw(int x,
int y,
const palette_
bitmap_ roi& roi) - Copies the given region of interest to the current page without bounds checking. Transparent pixels are skipped.
-
void unsafe_draw(const point& position,
const palette_
bitmap_ roi& roi) - Copies the given region of interest to the current page without bounds checking. Transparent pixels are skipped.
-
void draw(int x,
int y,
const palette_
bitmap_ pixels_ item& item) - Copies the given item to the current page with bounds checking. Transparent pixels are skipped.
-
void draw(const point& position,
const palette_
bitmap_ pixels_ item& item) - Copies the given item to the current page with bounds checking. Transparent pixels are skipped.
-
void draw(int x,
int y,
const palette_
bitmap_ roi& roi) - Copies the given region of interest to the current page with bounds checking. Transparent pixels are skipped.
-
void draw(const point& position,
const palette_
bitmap_ roi& roi) - Copies the given region of interest to the current page with bounds checking. Transparent pixels are skipped.
Function documentation
bn:: palette_bitmap_bg_painter:: palette_bitmap_bg_painter(const palette_ bitmap_ bg_ ptr& bg) explicit
Class constructor.
| Parameters | |
|---|---|
| bg | Palette bitmap background to be modified. |
bn:: palette_bitmap_bg_painter:: palette_bitmap_bg_painter(palette_ bitmap_ bg_ ptr&& bg) explicit
Class constructor.
| Parameters | |
|---|---|
| bg | Palette bitmap background to be modified. |
bn:: palette_bitmap_bg_painter:: palette_bitmap_bg_painter(palette_ bitmap_ bg_ painter&& other) noexcept
Move constructor.
| Parameters | |
|---|---|
| other | palette_ |
palette_ bitmap_ bg_ painter& bn:: palette_bitmap_bg_painter:: operator=(palette_ bitmap_ bg_ painter&& other) noexcept
Move assignment operator.
| Parameters | |
|---|---|
| other | palette_ |
| Returns | Reference to this. |
void bn:: palette_bitmap_bg_painter:: flip_page_now()
Swaps the hidden frame buffer without waiting to the next core::
Expect lack of vsync issues like screen tearing.
void bn:: palette_bitmap_bg_painter:: fill(int color_index)
Fills the current page with the given color.
| Parameters | |
|---|---|
| color_index | Palette index of the color to fill the current page. |
int bn:: palette_bitmap_bg_painter:: unsafe_get(int x,
int y) const
Returns the referenced color palette index without bounds checking.
| Parameters | |
|---|---|
| x | Horizontal position in the current page [0..bitmap_bg:: |
| y | Vertical position in the current page [0..bitmap_bg:: |
| Returns | The referenced color palette index. |
int bn:: palette_bitmap_bg_painter:: unsafe_get(const point& position) const
Returns the referenced color palette index without bounds checking.
| Parameters | |
|---|---|
| position | Position in the current page. |
| Returns | The referenced color palette index. |
optional<int> bn:: palette_bitmap_bg_painter:: get(int x,
int y) const
Returns the referenced color palette index with bounds checking.
| Parameters | |
|---|---|
| x | Horizontal position in the current page [0..bitmap_bg:: |
| y | Vertical position in the current page [0..bitmap_bg:: |
| Returns | The referenced color palette index. |
void bn:: palette_bitmap_bg_painter:: unsafe_plot(int x,
int y,
int color_index)
Plots a pixel on the current page without bounds checking.
| Parameters | |
|---|---|
| x | Horizontal position of the pixel to plot [0..bitmap_bg:: |
| y | Vertical position of the pixel to plot [0..bitmap_bg:: |
| color_index | Palette index of the color to plot. |
void bn:: palette_bitmap_bg_painter:: unsafe_plot(const point& position,
int color_index)
Plots a pixel on the current page without bounds checking.
| Parameters | |
|---|---|
| position | Position of the pixel to plot. |
| color_index | Palette index of the color to plot. |
void bn:: palette_bitmap_bg_painter:: plot(int x,
int y,
int color_index)
Plots a pixel on the current page with bounds checking.
| Parameters | |
|---|---|
| x | Horizontal position of the pixel to plot [0..bitmap_bg:: |
| y | Vertical position of the pixel to plot [0..bitmap_bg:: |
| color_index | Palette index of the color to plot. |
void bn:: palette_bitmap_bg_painter:: unsafe_horizontal_line(int x1,
int x2,
int y,
int color_index)
Draws an horizontal line in the current page without bounds checking.
| Parameters | |
|---|---|
| x1 | Horizontal position of the first pixel [0..bitmap_bg:: |
| x2 | Horizontal position of the last pixel [0..bitmap_bg:: |
| y | Vertical position of the horizontal line [0..bitmap_bg:: |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: horizontal_line(int x1,
int x2,
int y,
int color_index)
Draws an horizontal line in the current page with bounds checking.
| Parameters | |
|---|---|
| x1 | Horizontal position of the first pixel [0..bitmap_bg:: |
| x2 | Horizontal position of the last pixel [0..bitmap_bg:: |
| y | Vertical position of the horizontal line [0..bitmap_bg:: |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: unsafe_vertical_line(int x,
int y1,
int y2,
int color_index)
Draws a vertical line in the current page without bounds checking.
| Parameters | |
|---|---|
| x | Horizontal position of the vertical line [0..bitmap_bg:: |
| y1 | Vertical position of the first pixel [0..bitmap_bg:: |
| y2 | Vertical position of the last pixel [0..bitmap_bg:: |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: vertical_line(int x,
int y1,
int y2,
int color_index)
Draws a vertical line in the current page with bounds checking.
| Parameters | |
|---|---|
| x | Horizontal position of the vertical line [0..bitmap_bg:: |
| y1 | Vertical position of the first pixel [0..bitmap_bg:: |
| y2 | Vertical position of the last pixel [0..bitmap_bg:: |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: unsafe_line(int x1,
int y1,
int x2,
int y2,
int color_index)
Draws a line in the current page without bounds checking.
| Parameters | |
|---|---|
| x1 | Horizontal position of the first pixel [0..bitmap_bg:: |
| y1 | Vertical position of the first pixel [0..bitmap_bg:: |
| x2 | Horizontal position of the last pixel [0..bitmap_bg:: |
| y2 | Vertical position of the last pixel [0..bitmap_bg:: |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: unsafe_line(const point& first,
const point& last,
int color_index)
Draws a line in the current page without bounds checking.
| Parameters | |
|---|---|
| first | Position of the first pixel. |
| last | Position of the last pixel. |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: line(int x1,
int y1,
int x2,
int y2,
int color_index)
Draws a line in the current page with bounds checking.
| Parameters | |
|---|---|
| x1 | Horizontal position of the first pixel [0..bitmap_bg:: |
| y1 | Vertical position of the first pixel [0..bitmap_bg:: |
| x2 | Horizontal position of the last pixel [0..bitmap_bg:: |
| y2 | Vertical position of the last pixel [0..bitmap_bg:: |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: unsafe_rectangle(int x1,
int y1,
int x2,
int y2,
int color_index)
Draws a filled rectangle in the current page without bounds checking.
| Parameters | |
|---|---|
| x1 | Horizontal position of the first corner [0..bitmap_bg:: |
| y1 | Vertical position of the first corner [0..bitmap_bg:: |
| x2 | Horizontal position of the last corner [0..bitmap_bg:: |
| y2 | Vertical position of the last corner [0..bitmap_bg:: |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: unsafe_rectangle(const point& first,
const point& last,
int color_index)
Draws a filled rectangle in the current page without bounds checking.
| Parameters | |
|---|---|
| first | Position of the first corner. |
| last | Position of the last corner. |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: rectangle(int x1,
int y1,
int x2,
int y2,
int color_index)
Draws a filled rectangle in the current page with bounds checking.
| Parameters | |
|---|---|
| x1 | Horizontal position of the first corner [0..bitmap_bg:: |
| y1 | Vertical position of the first corner [0..bitmap_bg:: |
| x2 | Horizontal position of the last corner [0..bitmap_bg:: |
| y2 | Vertical position of the last corner [0..bitmap_bg:: |
| color_index | Color palette index. |
void bn:: palette_bitmap_bg_painter:: unsafe_blit(int x,
int y,
const palette_ bitmap_ pixels_ item& item)
Copies the given item to the current page without bounds checking. Transparent pixels are also copied.
| Parameters | |
|---|---|
| x | Horizontal position of the current page top-left corner [0..bitmap_bg:: |
| y | Vertical position of the current page top-left corner [0..bitmap_bg:: |
| item | Item to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: unsafe_blit(const point& position,
const palette_ bitmap_ pixels_ item& item)
Copies the given item to the current page without bounds checking. Transparent pixels are also copied.
| Parameters | |
|---|---|
| position | Position of the current page top-left corner. |
| item | Item to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: unsafe_blit(int x,
int y,
const palette_ bitmap_ roi& roi)
Copies the given region of interest to the current page without bounds checking. Transparent pixels are also copied.
| Parameters | |
|---|---|
| x | Horizontal position of the current page top-left corner [0..bitmap_bg:: |
| y | Vertical position of the current page top-left corner [0..bitmap_bg:: |
| roi | Region of interest to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: unsafe_blit(const point& position,
const palette_ bitmap_ roi& roi)
Copies the given region of interest to the current page without bounds checking. Transparent pixels are also copied.
| Parameters | |
|---|---|
| position | Position of the current page top-left corner. |
| roi | Region of interest to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: blit(int x,
int y,
const palette_ bitmap_ pixels_ item& item)
Copies the given item to the current page with bounds checking. Transparent pixels are also copied.
| Parameters | |
|---|---|
| x | Horizontal position of the current page top-left corner [0..bitmap_bg:: |
| y | Vertical position of the current page top-left corner [0..bitmap_bg:: |
| item | Item to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: blit(const point& position,
const palette_ bitmap_ pixels_ item& item)
Copies the given item to the current page with bounds checking. Transparent pixels are also copied.
| Parameters | |
|---|---|
| position | Position of the current page top-left corner. |
| item | Item to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: blit(int x,
int y,
const palette_ bitmap_ roi& roi)
Copies the given region of interest to the current page with bounds checking. Transparent pixels are also copied.
| Parameters | |
|---|---|
| x | Horizontal position of the current page top-left corner [0..bitmap_bg:: |
| y | Vertical position of the current page top-left corner [0..bitmap_bg:: |
| roi | Region of interest to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: blit(const point& position,
const palette_ bitmap_ roi& roi)
Copies the given region of interest to the current page with bounds checking. Transparent pixels are also copied.
| Parameters | |
|---|---|
| position | Position of the current page top-left corner. |
| roi | Region of interest to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: unsafe_draw(int x,
int y,
const palette_ bitmap_ pixels_ item& item)
Copies the given item to the current page without bounds checking. Transparent pixels are skipped.
| Parameters | |
|---|---|
| x | Horizontal position of the current page top-left corner [0..bitmap_bg:: |
| y | Vertical position of the current page top-left corner [0..bitmap_bg:: |
| item | Item to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: unsafe_draw(const point& position,
const palette_ bitmap_ pixels_ item& item)
Copies the given item to the current page without bounds checking. Transparent pixels are skipped.
| Parameters | |
|---|---|
| position | Position of the current page top-left corner. |
| item | Item to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: unsafe_draw(int x,
int y,
const palette_ bitmap_ roi& roi)
Copies the given region of interest to the current page without bounds checking. Transparent pixels are skipped.
| Parameters | |
|---|---|
| x | Horizontal position of the current page top-left corner [0..bitmap_bg:: |
| y | Vertical position of the current page top-left corner [0..bitmap_bg:: |
| roi | Region of interest to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: unsafe_draw(const point& position,
const palette_ bitmap_ roi& roi)
Copies the given region of interest to the current page without bounds checking. Transparent pixels are skipped.
| Parameters | |
|---|---|
| position | Position of the current page top-left corner. |
| roi | Region of interest to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: draw(int x,
int y,
const palette_ bitmap_ pixels_ item& item)
Copies the given item to the current page with bounds checking. Transparent pixels are skipped.
| Parameters | |
|---|---|
| x | Horizontal position of the current page top-left corner [0..bitmap_bg:: |
| y | Vertical position of the current page top-left corner [0..bitmap_bg:: |
| item | Item to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: draw(const point& position,
const palette_ bitmap_ pixels_ item& item)
Copies the given item to the current page with bounds checking. Transparent pixels are skipped.
| Parameters | |
|---|---|
| position | Position of the current page top-left corner. |
| item | Item to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: draw(int x,
int y,
const palette_ bitmap_ roi& roi)
Copies the given region of interest to the current page with bounds checking. Transparent pixels are skipped.
| Parameters | |
|---|---|
| x | Horizontal position of the current page top-left corner [0..bitmap_bg:: |
| y | Vertical position of the current page top-left corner [0..bitmap_bg:: |
| roi | Region of interest to copy to the current page. |
void bn:: palette_bitmap_bg_painter:: draw(const point& position,
const palette_ bitmap_ roi& roi)
Copies the given region of interest to the current page with bounds checking. Transparent pixels are skipped.
| Parameters | |
|---|---|
| position | Position of the current page top-left corner. |
| roi | Region of interest to copy to the current page. |