bn::dp_direct_bitmap_bg_painter class

Performs low-level painting on dual page direct bitmap backgrounds.

Only one bitmap painter can be active at the same time.

Constructors, destructors, conversion operators

dp_direct_bitmap_bg_painter(const dp_direct_bitmap_bg_ptr& bg) explicit
Class constructor.
dp_direct_bitmap_bg_painter(dp_direct_bitmap_bg_ptr&& bg) explicit
Class constructor.
dp_direct_bitmap_bg_painter(dp_direct_bitmap_bg_painter&& other) noexcept
Move constructor.
~dp_direct_bitmap_bg_painter()
Class destructor.

Public functions

auto operator=(dp_direct_bitmap_bg_painter&& other) -> dp_direct_bitmap_bg_painter& noexcept
Move assignment operator.
auto bg() const -> const dp_direct_bitmap_bg_ptr&
Returns the background modified by this painter.
auto page() const -> span<const color>
Returns a span of the hidden frame buffer.
auto page() -> span<color>
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 fill(color color)
Fills the current page with the given color.
auto unsafe_get(int x, int y) const -> color
Returns the referenced color without bounds checking.
auto unsafe_get(const point& position) const -> color
Returns the referenced color without bounds checking.
auto get(int x, int y) const -> optional<color>
Returns the referenced color with bounds checking.
auto get(const point& position) const -> optional<color>
Returns the referenced color with bounds checking.
void unsafe_plot(int x, int y, color color)
Plots a pixel on the current page without bounds checking.
void unsafe_plot(const point& position, color color)
Plots a pixel on the current page without bounds checking.
void plot(int x, int y, color color)
Plots a pixel on the current page with bounds checking.
void plot(const point& position, color color)
Plots a pixel on the current page with bounds checking.
void unsafe_horizontal_line(int x1, int x2, int y, color color)
Draws an horizontal line in the current page without bounds checking.
void horizontal_line(int x1, int x2, int y, color color)
Draws an horizontal line in the current page with bounds checking.
void unsafe_vertical_line(int x, int y1, int y2, color color)
Draws a vertical line in the current page without bounds checking.
void vertical_line(int x, int y1, int y2, color color)
Draws a vertical line in the current page with bounds checking.
void unsafe_line(int x1, int y1, int x2, int y2, color color)
Draws a line in the current page without bounds checking.
void unsafe_line(const point& first, const point& last, color color)
Draws a line in the current page without bounds checking.
void line(int x1, int y1, int x2, int y2, color color)
Draws a line in the current page with bounds checking.
void line(const point& first, const point& last, color color)
Draws a line in the current page with bounds checking.
void unsafe_rectangle(int x1, int y1, int x2, int y2, color color)
Draws a filled rectangle in the current page without bounds checking.
void unsafe_rectangle(const point& first, const point& last, color color)
Draws a filled rectangle in the current page without bounds checking.
void rectangle(int x1, int y1, int x2, int y2, color color)
Draws a filled rectangle in the current page with bounds checking.
void rectangle(const point& first, const point& last, color color)
Draws a filled rectangle in the current page with bounds checking.
void unsafe_blit(int x, int y, const direct_bitmap_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 direct_bitmap_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 direct_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 direct_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 direct_bitmap_item& item)
Copies the given item to the current page with bounds checking. Transparent pixels are also copied.
void blit(const point& position, const direct_bitmap_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 direct_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 direct_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 direct_bitmap_item& item, bn::color transparent_color)
Copies the given item to the current page without bounds checking. Transparent pixels are skipped.
void unsafe_draw(const point& position, const direct_bitmap_item& item, bn::color transparent_color)
Copies the given item to the current page without bounds checking. Transparent pixels are skipped.
void unsafe_draw(int x, int y, const direct_bitmap_roi& roi, bn::color transparent_color)
Copies the given region of interest to the current page without bounds checking. Transparent pixels are skipped.
void unsafe_draw(const point& position, const direct_bitmap_roi& roi, bn::color transparent_color)
Copies the given region of interest to the current page without bounds checking. Transparent pixels are skipped.
void draw(int x, int y, const direct_bitmap_item& item, bn::color transparent_color)
Copies the given item to the current page with bounds checking. Transparent pixels are skipped.
void draw(const point& position, const direct_bitmap_item& item, bn::color transparent_color)
Copies the given item to the current page with bounds checking. Transparent pixels are skipped.
void draw(int x, int y, const direct_bitmap_roi& roi, bn::color transparent_color)
Copies the given region of interest to the current page with bounds checking. Transparent pixels are skipped.
void draw(const point& position, const direct_bitmap_roi& roi, bn::color transparent_color)
Copies the given region of interest to the current page with bounds checking. Transparent pixels are skipped.

Function documentation

bn::dp_direct_bitmap_bg_painter::dp_direct_bitmap_bg_painter(const dp_direct_bitmap_bg_ptr& bg) explicit

Class constructor.

Parameters
bg Dual page direct bitmap background to be modified.

bn::dp_direct_bitmap_bg_painter::dp_direct_bitmap_bg_painter(dp_direct_bitmap_bg_ptr&& bg) explicit

Class constructor.

Parameters
bg Dual page direct bitmap background to be modified.

bn::dp_direct_bitmap_bg_painter::dp_direct_bitmap_bg_painter(dp_direct_bitmap_bg_painter&& other) noexcept

Move constructor.

Parameters
other dp_direct_bitmap_bg_painter to move.

dp_direct_bitmap_bg_painter& bn::dp_direct_bitmap_bg_painter::operator=(dp_direct_bitmap_bg_painter&& other) noexcept

Move assignment operator.

Parameters
other dp_direct_bitmap_bg_painter to move.
Returns Reference to this.

void bn::dp_direct_bitmap_bg_painter::flip_page_now()

Swaps the hidden frame buffer without waiting to the next core::update call.

Expect lack of vsync issues like screen tearing.

color bn::dp_direct_bitmap_bg_painter::unsafe_get(int x, int y) const

Returns the referenced color without bounds checking.

Parameters
x Horizontal position in the current page [0..bitmap_bg::dp_direct_width()).
y Vertical position in the current page [0..bitmap_bg::dp_direct_height()).
Returns The referenced color.

color bn::dp_direct_bitmap_bg_painter::unsafe_get(const point& position) const

Returns the referenced color without bounds checking.

Parameters
position Position in the current page.
Returns The referenced color.

optional<color> bn::dp_direct_bitmap_bg_painter::get(int x, int y) const

Returns the referenced color with bounds checking.

Parameters
x Horizontal position in the current page [0..bitmap_bg::dp_direct_width()).
y Vertical position in the current page [0..bitmap_bg::dp_direct_height()).
Returns The referenced color.

optional<color> bn::dp_direct_bitmap_bg_painter::get(const point& position) const

Returns the referenced color with bounds checking.

Parameters
position Position in the current page.
Returns The referenced color.

void bn::dp_direct_bitmap_bg_painter::unsafe_plot(int x, int y, color color)

Plots a pixel on the current page without bounds checking.

Parameters
x Horizontal position of the pixel to plot [0..bitmap_bg::dp_direct_width()).
y Vertical position of the pixel to plot [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::unsafe_plot(const point& position, color color)

Plots a pixel on the current page without bounds checking.

Parameters
position Position of the pixel to plot.
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::plot(int x, int y, color color)

Plots a pixel on the current page with bounds checking.

Parameters
x Horizontal position of the pixel to plot [0..bitmap_bg::dp_direct_width()).
y Vertical position of the pixel to plot [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::plot(const point& position, color color)

Plots a pixel on the current page with bounds checking.

Parameters
position Position of the pixel to plot.
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::unsafe_horizontal_line(int x1, int x2, int y, color color)

Draws an horizontal line in the current page without bounds checking.

Parameters
x1 Horizontal position of the first pixel [0..bitmap_bg::dp_direct_width()).
x2 Horizontal position of the last pixel [0..bitmap_bg::dp_direct_width()).
y Vertical position of the horizontal line [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::horizontal_line(int x1, int x2, int y, color color)

Draws an horizontal line in the current page with bounds checking.

Parameters
x1 Horizontal position of the first pixel [0..bitmap_bg::dp_direct_width()).
x2 Horizontal position of the last pixel [0..bitmap_bg::dp_direct_width()).
y Vertical position of the horizontal line [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::unsafe_vertical_line(int x, int y1, int y2, color color)

Draws a vertical line in the current page without bounds checking.

Parameters
x Horizontal position of the vertical line [0..bitmap_bg::dp_direct_width()).
y1 Vertical position of the first pixel [0..bitmap_bg::dp_direct_height()).
y2 Vertical position of the last pixel [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::vertical_line(int x, int y1, int y2, color color)

Draws a vertical line in the current page with bounds checking.

Parameters
x Horizontal position of the vertical line [0..bitmap_bg::dp_direct_width()).
y1 Vertical position of the first pixel [0..bitmap_bg::dp_direct_height()).
y2 Vertical position of the last pixel [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::unsafe_line(int x1, int y1, int x2, int y2, color color)

Draws a line in the current page without bounds checking.

Parameters
x1 Horizontal position of the first pixel [0..bitmap_bg::dp_direct_width()).
y1 Vertical position of the first pixel [0..bitmap_bg::dp_direct_height()).
x2 Horizontal position of the last pixel [0..bitmap_bg::dp_direct_width()).
y2 Vertical position of the last pixel [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::unsafe_line(const point& first, const point& last, color color)

Draws a line in the current page without bounds checking.

Parameters
first Position of the first pixel.
last Position of the last pixel.
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::line(int x1, int y1, int x2, int y2, color color)

Draws a line in the current page with bounds checking.

Parameters
x1 Horizontal position of the first pixel [0..bitmap_bg::dp_direct_width()).
y1 Vertical position of the first pixel [0..bitmap_bg::dp_direct_height()).
x2 Horizontal position of the last pixel [0..bitmap_bg::dp_direct_width()).
y2 Vertical position of the last pixel [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::line(const point& first, const point& last, color color)

Draws a line in the current page with bounds checking.

Parameters
first Position of the first pixel.
last Position of the last pixel.
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::unsafe_rectangle(int x1, int y1, int x2, int y2, color color)

Draws a filled rectangle in the current page without bounds checking.

Parameters
x1 Horizontal position of the first corner [0..bitmap_bg::dp_direct_width()).
y1 Vertical position of the first corner [0..bitmap_bg::dp_direct_height()).
x2 Horizontal position of the last corner [0..bitmap_bg::dp_direct_width()).
y2 Vertical position of the last corner [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::unsafe_rectangle(const point& first, const point& last, color color)

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 Color to plot.

void bn::dp_direct_bitmap_bg_painter::rectangle(int x1, int y1, int x2, int y2, color color)

Draws a filled rectangle in the current page with bounds checking.

Parameters
x1 Horizontal position of the first corner [0..bitmap_bg::dp_direct_width()).
y1 Vertical position of the first corner [0..bitmap_bg::dp_direct_height()).
x2 Horizontal position of the last corner [0..bitmap_bg::dp_direct_width()).
y2 Vertical position of the last corner [0..bitmap_bg::dp_direct_height()).
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::rectangle(const point& first, const point& last, color color)

Draws a filled rectangle in the current page with bounds checking.

Parameters
first Position of the first corner.
last Position of the last corner.
color Color to plot.

void bn::dp_direct_bitmap_bg_painter::unsafe_blit(int x, int y, const direct_bitmap_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::dp_direct_width()).
y Vertical position of the current page top-left corner [0..bitmap_bg::dp_direct_height()).
item Item to copy to the current page.

void bn::dp_direct_bitmap_bg_painter::unsafe_blit(const point& position, const direct_bitmap_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::dp_direct_bitmap_bg_painter::unsafe_blit(int x, int y, const direct_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::dp_direct_width()).
y Vertical position of the current page top-left corner [0..bitmap_bg::dp_direct_height()).
roi Region of interest to copy to the current page.

void bn::dp_direct_bitmap_bg_painter::unsafe_blit(const point& position, const direct_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::dp_direct_bitmap_bg_painter::blit(int x, int y, const direct_bitmap_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::dp_direct_width()).
y Vertical position of the current page top-left corner [0..bitmap_bg::dp_direct_height()).
item Item to copy to the current page.

void bn::dp_direct_bitmap_bg_painter::blit(const point& position, const direct_bitmap_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::dp_direct_bitmap_bg_painter::blit(int x, int y, const direct_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::dp_direct_width()).
y Vertical position of the current page top-left corner [0..bitmap_bg::dp_direct_height()).
roi Region of interest to copy to the current page.

void bn::dp_direct_bitmap_bg_painter::blit(const point& position, const direct_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::dp_direct_bitmap_bg_painter::unsafe_draw(int x, int y, const direct_bitmap_item& item, bn::color transparent_color)

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::dp_direct_width()).
y Vertical position of the current page top-left corner [0..bitmap_bg::dp_direct_height()).
item Item to copy to the current page.
transparent_color Color of the transparent pixels.

void bn::dp_direct_bitmap_bg_painter::unsafe_draw(const point& position, const direct_bitmap_item& item, bn::color transparent_color)

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.
transparent_color Color of the transparent pixels.

void bn::dp_direct_bitmap_bg_painter::unsafe_draw(int x, int y, const direct_bitmap_roi& roi, bn::color transparent_color)

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::dp_direct_width()).
y Vertical position of the current page top-left corner [0..bitmap_bg::dp_direct_height()).
roi Region of interest to copy to the current page.
transparent_color Color of the transparent pixels.

void bn::dp_direct_bitmap_bg_painter::unsafe_draw(const point& position, const direct_bitmap_roi& roi, bn::color transparent_color)

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.
transparent_color Color of the transparent pixels.

void bn::dp_direct_bitmap_bg_painter::draw(int x, int y, const direct_bitmap_item& item, bn::color transparent_color)

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::dp_direct_width()).
y Vertical position of the current page top-left corner [0..bitmap_bg::dp_direct_height()).
item Item to copy to the current page.
transparent_color Color of the transparent pixels.

void bn::dp_direct_bitmap_bg_painter::draw(const point& position, const direct_bitmap_item& item, bn::color transparent_color)

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.
transparent_color Color of the transparent pixels.

void bn::dp_direct_bitmap_bg_painter::draw(int x, int y, const direct_bitmap_roi& roi, bn::color transparent_color)

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::dp_direct_width()).
y Vertical position of the current page top-left corner [0..bitmap_bg::dp_direct_height()).
roi Region of interest to copy to the current page.
transparent_color Color of the transparent pixels.

void bn::dp_direct_bitmap_bg_painter::draw(const point& position, const direct_bitmap_roi& roi, bn::color transparent_color)

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.
transparent_color Color of the transparent pixels.