constixel
|
Core class of constixel. Holds a buffer of an image width a certain size and format. Typical use: More...
#include <constixel.hpp>
Public Member Functions | |
image ()=default | |
Creates a new image with internal storage. | |
image (const std::span< uint8_t, T< W, H, GRAYSCALE, USE_SPAN >::image_size > &other) | |
When USE_SPAN=true creates a new image with external storage based existing std::span. | |
constexpr void | clear () |
Clear the image by setting everything to zero. | |
constexpr std::array< uint8_t, T< W, H, GRAYSCALE, USE_SPAN >::image_size > & | data_ref () |
Get a reference to the underlying raw data of the image. | |
constexpr image< T, W, H, GRAYSCALE > | clone () const |
Returns a clone of this image. Data is copied. | |
constexpr void | copy (const image< T, W, H, GRAYSCALE > &src) |
Copy source image into this instance. No compositing occurs, replaces current content. | |
template<size_t BYTE_SIZE> | |
constexpr void | copy (const uint8_t *src) |
Copy raw source data into this instance. No compositing occurs. | |
constexpr uint8_t | get_nearest_color (uint8_t r, uint8_t g, uint8_t b) const |
Return closest match in the color palette based on the supplied red, green and blue values. | |
constexpr void | plot (int32_t x, int32_t y, uint8_t col) |
Plot a single pixel at the specified coordinates using the supplied color. | |
constexpr void | plot (const struct plot &p) |
Plot a single pixel at the specified coordinates using the supplied color. | |
constexpr void | draw_line (int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint8_t col, int32_t stroke_width=1) |
Draw a line with the specified color and thickness. Example: | |
constexpr void | draw_line (const struct draw_line &d) |
Draw a line with the specified color and thickness. Example: | |
constexpr void | draw_line_aa (int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint8_t col, float stroke_width=1.0f) |
Draw an antialiased line with variable stroke width. Only format_8bit targets are supported. Example: | |
constexpr void | draw_line_aa (const struct draw_line &d) |
Draw a 1-pixel wide antialiased line with the specified color. Only format_8bit targets are supported. Example: | |
template<typename FONT, bool KERNING = false> | |
constexpr int32_t | string_width (const char *str, size_t character_count=std::numeric_limits< size_t >::max(), size_t *character_actual=nullptr) |
Return the width of a string using the specified font in the template parameter. Typical use: | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr int32_t | draw_string_mono (int32_t x, int32_t y, const char *str, uint8_t col, size_t character_count=std::numeric_limits< size_t >::max(), size_t *character_actual=nullptr) |
Draw text at the specified coordinate. The template parameter selects which mono font to use. Only format_8bit targets are supported. | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr int32_t | draw_string_mono (const struct draw_string &d, size_t character_count=std::numeric_limits< size_t >::max(), size_t *character_actual=nullptr) |
Draw text at the specified coordinate. The template parameter selects which mono font to use. Only format_8bit targets are supported. | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr void | draw_string_centered_mono (int32_t x, int32_t y, const char *str, uint8_t col) |
Draw text centered at the specified coordinate. The template parameter selects which mono font to use. Only format_8bit targets are supported. | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr int32_t | draw_string_aa (int32_t x, int32_t y, const char *str, uint8_t col, size_t character_count=std::numeric_limits< size_t >::max(), size_t *character_actual=nullptr) |
Draw antialiased text at the specified coordinate. The template parameter selects which antialiased font to use. Only format_8bit targets are supported. Typical use: | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr int32_t | draw_string_aa (const struct draw_string &d, size_t character_count=std::numeric_limits< size_t >::max(), size_t *character_actual=nullptr) |
Draw antialiased text at the specified coordinate. The template parameter selects which antialiased font to use. Only format_8bit targets are supported. Typical use: | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr void | draw_string_centered_aa (int32_t x, int32_t y, const char *str, uint8_t col) |
Draw antialiased text centered at the specified coordinate. The template parameter selects which antialiased font to use. Only format_8bit targets are supported. Typical use. | |
constexpr void | fill_rect (int32_t x, int32_t y, int32_t w, int32_t h, uint8_t col) |
Fill a rectangle with the specified color. Example: | |
constexpr void | fill_rect (const struct draw_rect &d) |
Fill a rectangle with the specified color. Example: | |
template<typename shader_func> requires std::is_invocable_r_v<std::array<float, 4>, shader_func, float, float, int32_t, int32_t> | |
constexpr auto | fill_rect (int32_t x, int32_t y, int32_t w, int32_t h, const shader_func &shader) -> void |
Fill a rectangle with a shader function that generates colors per pixel. | |
constexpr void | stroke_rect (int32_t x, int32_t y, int32_t w, int32_t h, uint8_t col, int32_t stroke_width=1) |
Draw a stroked rectangle with the specified color and stroke width. Example: | |
constexpr void | stroke_rect (const struct draw_rect &d) |
Draw a stroked rectangle with the specified color and stroke width. Example: | |
constexpr void | fill_circle (int32_t cx, int32_t cy, int32_t radius, uint8_t col) |
Fill a circle with the specified radius and color. Example: | |
constexpr void | fill_circle (const struct draw_circle &d) |
Fill a circle with the specified radius and color. Example: | |
constexpr void | stroke_circle (int32_t cx, int32_t cy, int32_t radius, uint8_t col, int32_t stroke_width=1) |
Stroke a circle with the specified radius and color. Example: | |
constexpr void | stroke_circle (const struct draw_circle &d) |
Stroke a circle with the specified radius and color. Example: | |
constexpr void | stroke_circle_aa (int32_t cx, int32_t cy, int32_t radius, uint8_t col, int32_t stroke_width=1) |
Stroke a circle using antialiasing with the specified radius and color. Only format_8bit targets are supported. Example: | |
constexpr void | stroke_circle_aa (const struct draw_circle &d) |
Stroke a circle using antialiasing with the specified radius and color. Only format_8bit targets are supported. Example: | |
constexpr void | fill_circle_aa (int32_t cx, int32_t cy, int32_t radius, uint8_t col) |
Fill a circle using antialiasing with the specified radius and color. Only format_8bit targets are supported. Example: | |
constexpr void | fill_circle_aa (const struct draw_circle &d) |
Fill a circle using antialiasing with the specified radius and color. Only format_8bit targets are supported. Example: | |
template<typename shader_func> requires std::is_invocable_r_v<std::array<float, 4>, shader_func, float, float, int32_t, int32_t> | |
constexpr auto | fill_circle_aa (int32_t cx, int32_t cy, int32_t radius, const shader_func &shader) -> void |
Fill a circle using antialiasing with a shader function that generates colors per pixel. | |
constexpr void | stroke_round_rect (int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius, uint8_t col, int32_t stroke_width=1) |
Stroke a rounded rectangle with the specified color. Example: | |
constexpr void | stroke_round_rect (const struct draw_round_rect &d) |
Stroke a rounded rectangle with the specified color. Example: | |
constexpr void | fill_round_rect (int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius, uint8_t col) |
Fill a rounded rectangle with the specified color. Example: | |
constexpr void | fill_round_rect (const struct draw_round_rect &d) |
Fill a rounded rectangle with the specified color. Example: | |
constexpr void | fill_round_rect_aa (int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius, uint8_t col) |
Fill a rounded rectangle using antialiasing with the specified color. Only format_8bit targets are supported. Example: | |
constexpr void | fill_round_rect_aa (const struct draw_round_rect &d) |
Fill a rounded rectangle using antialiasing with the specified color. Only format_8bit targets are supported. | |
template<typename shader_func> requires std::is_invocable_r_v<std::array<float, 4>, shader_func, float, float, int32_t, int32_t> | |
constexpr auto | fill_round_rect_aa (int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius, const shader_func &shader) -> void |
Fill a rounded rectangle using antialiasing with a shader function that generates colors per pixel. | |
constexpr void | stroke_round_rect_aa (int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius, uint8_t col, int32_t stroke_width=1) |
Stroke a rounded rectangle using antialiasing with the specified color. Example: | |
constexpr void | stroke_round_rect_aa (const struct draw_round_rect &d) |
Stroke a rounded rectangle using antialiasing with the specified color. Example: | |
constexpr void | RGBA_uint32 (std::array< uint32_t, W *H > &dst) const |
Convert this instance to an equivalent RGBA8 data array. | |
constexpr void | RGBA_uint8 (std::array< uint8_t, W *H *4 > &dst) const |
Convert this instance to an equivalent RGBA8 data array. | |
constexpr void | flip_h () |
Flip the contents of this image horizontally. | |
constexpr void | flip_v () |
Flip the contents of this image vertically. | |
constexpr void | flip_hv () |
Flip the contents of this image horizontally & vertically. | |
template<bool FLIP_H = false, bool FLIP_V = false> | |
constexpr image< T, H, W, GRAYSCALE > | transpose () const |
Return a transposed version of this image. | |
template<bool FLIP_H = false, bool FLIP_V = false> | |
constexpr void | transpose (image< T, H, W, GRAYSCALE > &dst) const |
Transpose this image into another. | |
constexpr void | blit_RGBA (int32_t x, int32_t y, int32_t w, int32_t h, const uint8_t *ptr, int32_t iw, int32_t ih, int32_t stride) |
Blit an RGBA8 buffer into this instance using brute force color mapping. | |
constexpr void | blit_RGBA (const rect< int32_t > &dstrect, const uint8_t *ptr, int32_t iw, int32_t ih, int32_t stride) |
Blit an RGBA8 buffer into this instance using brute force color mapping. | |
constexpr void | blit_RGBA_diffused (int32_t x, int32_t y, int32_t w, int32_t h, const uint8_t *ptr, int32_t iw, int32_t ih, int32_t stride) |
Blit an RGBA8 buffer into this instance using brute force color mapping. Simple integer based diffusion is applied. | |
constexpr void | blit_RGBA_diffused (const rect< int32_t > &dstrect, const uint8_t *ptr, int32_t iw, int32_t ih, int32_t stride) |
Blit an RGBA8 buffer into this instance using brute force color mapping. Simple integer based diffusion is applied. | |
constexpr void | blit_RGBA_diffused_linear (int32_t x, int32_t y, int32_t w, int32_t h, const uint8_t *ptr, int32_t iw, int32_t ih, int32_t stride) |
Blit an RGBA8 buffer into this instance using brute force color mapping. Diffusion in linear color space is applied. | |
constexpr void | blit_RGBA_diffused_linear (const rect< int32_t > &dstrect, const uint8_t *ptr, int32_t iw, int32_t ih, int32_t stride) |
Blit an RGBA8 buffer into this instance using brute force color mapping. Diffusion in linear color space is applied. | |
template<typename F> | |
constexpr void | png (F &&char_out) const |
Convert the current instance into a png image. Typically an implementation looks like this: | |
template<size_t S = 1, typename F> | |
constexpr void | sixel (F &&char_out) const |
Convert the current instance into a sixel stream. Typically an implementation looks like this: | |
template<size_t S = 1, typename F> | |
constexpr void | sixel (F &&char_out, const rect< int32_t > &rect) const |
Convert the current instance into a sixel stream. Typically an implementation looks like this: | |
template<size_t S = 1> | |
void | sixel_to_cout () const |
Convert the current instance into a sixel stream and output it to std::cout. | |
void | vt100_clear () const |
Send a escape command to std::cout to clear the screen and scroll buffer of a vt100 compatible terminal. | |
void | vt100_clear_scrollback () const |
Send a escape command to std::cout to clear the screen and scroll buffer of a vt100 compatible terminal. | |
void | vt100_home () const |
Send a escape command to std::cout to home the cursor of a vt100 compatible terminal. | |
void | png_to_iterm () const |
Convert the current instance into a png and display it in iTerm. | |
void | png_to_kitty () const |
Convert the current instance into a png and display it in a terminal with kitty graphics support. | |
template<device_format dst_format, typename F> | |
constexpr void | convert (F &&uint8_out) |
Convert the current instance into a byte stream formatted for embedded displays. | |
constexpr auto | rect (int32_t x, int32_t y, int32_t w, int32_t h) |
Fluent shape API methods for method chaining These provide a more expressive way to create shapes compared to struct-based calls. | |
constexpr auto | circle (int32_t cx, int32_t cy, int32_t r) |
Create a circle shape for fluent method chaining. | |
constexpr auto | circle_aa (int32_t cx, int32_t cy, int32_t r) |
Create an antialiased circle shape for fluent method chaining. Only format_8bit targets are supported. | |
constexpr auto | round_rect (int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius) |
Create a rounded rectangle shape for fluent method chaining. | |
constexpr auto | round_rect_aa (int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius) |
Create an antialiased rounded rectangle shape for fluent method chaining. Only format_8bit targets are supported. | |
constexpr auto | line (int32_t x0, int32_t y0, int32_t x1, int32_t y1) |
Create a line shape for fluent method chaining. | |
constexpr auto | line_aa (int32_t x0, int32_t y0, int32_t x1, int32_t y1) |
Create an antialiased line shape for fluent method chaining. Only format_8bit targets are supported. | |
constexpr auto | point (int32_t x, int32_t y) |
Create a point shape for fluent method chaining. | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr auto | text_mono (int32_t x, int32_t y, const char *str) |
Create a text shape for fluent monospace string drawing with method chaining. | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr auto | text_aa (int32_t x, int32_t y, const char *str) |
Create a text shape for fluent antialiased string drawing with method chaining. Only format_8bit targets are supported. | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr auto | text_centered_mono (int32_t x, int32_t y, const char *str) |
Create a text shape for fluent centered monospace string drawing with method chaining. | |
template<typename FONT, bool KERNING = false, text_rotation ROTATION = DEGREE_0> | |
constexpr auto | text_centered_aa (int32_t x, int32_t y, const char *str) |
Create a text shape for fluent centered antialiased string drawing with method chaining. Only format_8bit targets are supported. | |
Static Public Member Functions | |
static constexpr bool | grayscale () |
Boolean indicating that the palette is grayscale instead of color. | |
static constexpr size_t | bit_depth () |
Bit depth of the image. | |
static constexpr size_t | size () |
Size in bytes of the image data. This does not include the image instance size. | |
static constexpr size_t | bytes_per_line () |
Bytes per line in the image data. Also called stride. | |
static constexpr int32_t | width () |
Width in pixels of the image. | |
static constexpr int32_t | height () |
Height in pixels of the image. | |
Core class of constixel. Holds a buffer of an image width a certain size and format. Typical use:
T | Type of the image buffer. One of format_1bit, format_2bit, format_4bit, format_8bit, format_24bit or format_32bit. |
W | Width in pixels. |
H | Height in pixels. |
GRAYSCALE | boolean to indicate if palette should be grayscale. Otherwise a colored palette will be used. |
USE_SPAN | Pass in your own std::span in the constructor to be used as a back buffer. Defaults to false. |
|
inline |
When USE_SPAN=true creates a new image with external storage based existing std::span.
other | If USE_SPAN=true this constructor will accept a std::span. |
|
inlinestaticnodiscardconstexpr |
Bit depth of the image.
|
inlineconstexpr |
Blit an RGBA8 buffer into this instance using brute force color mapping.
dstrect | Rectangular area in the target buffer to blit into. If the rectangle is smaller than the RGBA8 buffer, clipping occurs. |
ptr | Pointer to the RGBA8 buffer. |
iw | Width in pixels of the RGBA8 buffer. |
ih | Weight in pixels of the RGBA8 buffer. |
stride | Bytes per line of pixels of the RGBA8 buffer. |
|
inlineconstexpr |
Blit an RGBA8 buffer into this instance using brute force color mapping.
x | Starting X-coordinate position in the target instance in pixels. |
y | Starting Y-coordinate position in the target instance in pixels. |
w | Width of the rectangle. If the width is smaller than the RGBA8 buffer content will be clipped. |
h | Weight of the rectangle. If the height is smaller than the RGBA8 buffer content will be clipped. |
ptr | Pointer to the RGBA8 buffer. |
iw | Width in pixels of the RGBA8 buffer. |
ih | Height in pixels of the RGBA8 buffer. |
stride | Bytes per line of pixels of the RGBA8 buffer. |
|
inlineconstexpr |
Blit an RGBA8 buffer into this instance using brute force color mapping. Simple integer based diffusion is applied.
dstrect | Rectangular area in the target buffer to blit into. If the rectangle is smaller than the RGBA8 buffer, clipping occurs. |
ptr | Pointer to the RGBA8 buffer. |
iw | Width in pixels of the RGBA8 buffer. |
ih | Weight in pixels of the RGBA8 buffer. |
stride | Bytes per line of pixels of the RGBA8 buffer. |
|
inlineconstexpr |
Blit an RGBA8 buffer into this instance using brute force color mapping. Simple integer based diffusion is applied.
x | Starting X-coordinate position in the target instance in pixels. |
y | Starting Y-coordinate position in the target instance in pixels. |
w | Width of the rectangle. If the width is smaller than the RGBA8 buffer content will be clipped. |
h | Weight of the rectangle. If the height is smaller than the RGBA8 buffer content will be clipped. |
ptr | Pointer to the RGBA8 buffer. |
iw | Width in pixels of the RGBA8 buffer. |
ih | Height in pixels of the RGBA8 buffer. |
stride | Bytes per line of pixels of the RGBA8 buffer. |
|
inlineconstexpr |
Blit an RGBA8 buffer into this instance using brute force color mapping. Diffusion in linear color space is applied.
dstrect | Rectangular area in the target buffer to blit into. If the rectangle is smaller than the RGBA8 buffer, clipping occurs. |
ptr | Pointer to the RGBA8 buffer. |
iw | Width in pixels of the RGBA8 buffer. |
ih | Weight in pixels of the RGBA8 buffer. |
stride | Bytes per line of pixels of the RGBA8 buffer. |
|
inlineconstexpr |
Blit an RGBA8 buffer into this instance using brute force color mapping. Diffusion in linear color space is applied.
x | Starting X-coordinate position in the target instance in pixels. |
y | Starting Y-coordinate position in the target instance in pixels. |
w | Width of the rectangle. If the width is smaller than the RGBA8 buffer content will be clipped. |
h | Weight of the rectangle. If the height is smaller than the RGBA8 buffer content will be clipped. |
ptr | Pointer to the RGBA8 buffer. |
iw | Width in pixels of the RGBA8 buffer. |
ih | Height in pixels of the RGBA8 buffer. |
stride | Bytes per line of pixels of the RGBA8 buffer. |
|
inlinestaticnodiscardconstexpr |
Bytes per line in the image data. Also called stride.
|
inlineconstexpr |
Create a circle shape for fluent method chaining.
cx | Center X-coordinate in pixels. |
cy | Center Y-coordinate in pixels. |
r | Radius of the circle in pixels. |
|
inlineconstexpr |
Create an antialiased circle shape for fluent method chaining. Only format_8bit targets are supported.
cx | Center X-coordinate in pixels. |
cy | Center Y-coordinate in pixels. |
r | Radius of the circle in pixels. |
|
inlinenodiscardconstexpr |
Returns a clone of this image. Data is copied.
|
inlineconstexpr |
Convert the current instance into a byte stream formatted for embedded displays.
dst_format | The desired data format. |
uint8_out | A lambda function which consumes the data stream one byte at a time. |
|
inlineconstexpr |
Copy source image into this instance. No compositing occurs, replaces current content.
src | Source image. |
|
inlineconstexpr |
Copy raw source data into this instance. No compositing occurs.
BYTE_SIZE | Amount data in the source data. Typically a sizeof() of an array. Must match image::size() |
src | Source data. |
|
inlinenodiscardconstexpr |
Get a reference to the underlying raw data of the image.
|
inlineconstexpr |
|
inlineconstexpr |
Draw a line with the specified color and thickness. Example:
x0 | Starting X-coordinate in pixels. |
y0 | Starting Y-coordinate in pixels. |
x1 | Ending X-coordinate in pixels. |
y1 | Ending Y-coordinate in pixels. |
col | Color palette index to use. |
stroke_width | Width of the stroke in pixels. |
|
inlineconstexpr |
Draw a 1-pixel wide antialiased line with the specified color. Only format_8bit targets are supported. Example:
d | draw_line initializer struct |
|
inlineconstexpr |
Draw an antialiased line with variable stroke width. Only format_8bit targets are supported. Example:
x0 | Starting X-coordinate in pixels. |
y0 | Starting Y-coordinate in pixels. |
x1 | Ending X-coordinate in pixels. |
y1 | Ending Y-coordinate in pixels. |
col | Color palette index to use. |
stroke_width | Width of the line in pixels (can be fractional). |
|
inlineconstexpr |
Draw antialiased text at the specified coordinate. The template parameter selects which antialiased font to use. Only format_8bit targets are supported. Typical use:
FONT | The font struct name. |
KERNING | Boolean, use kerning information if available. Default to false. |
ROTATION | Rotation around the x/y coordinate. Can be text_rotation::DEGREE_0, text_rotation::DEGREE_90, text_rotation::DEGREE_180 or text_rotation::DEGREE_270 |
d | draw_string initializer struct. |
character_count | How many utf32 characters in the string should be drawn. |
character_actual | How many utf32 characters in the string were drawn. |
|
inlineconstexpr |
Draw antialiased text at the specified coordinate. The template parameter selects which antialiased font to use. Only format_8bit targets are supported. Typical use:
FONT | The font struct name. |
KERNING | Boolean, use kerning information if available. Default to false. |
ROTATION | Rotation around the x/y coordinate. Can be text_rotation::DEGREE_0, text_rotation::DEGREE_90, text_rotation::DEGREE_180 or text_rotation::DEGREE_270 |
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
str | UTF-8 string. |
col | Color palette index to use. |
character_count | How many utf32 characters in the string should be drawn. |
character_actual | How many utf32 characters in the string were drawn. |
|
inlineconstexpr |
Draw antialiased text centered at the specified coordinate. The template parameter selects which antialiased font to use. Only format_8bit targets are supported. Typical use.
FONT | The font struct name. |
KERNING | Boolean, use kerning information if available. Default to false. |
ROTATION | Rotation around the x/y coordinate. Can be text_rotation::DEGREE_0, text_rotation::DEGREE_90, text_rotation::DEGREE_180 or text_rotation::DEGREE_270 |
x | Center/Starting X-coordinate in pixels. |
y | Center/Starting Y-coordinate in pixels. |
str | UTF-8 string. |
col | Color palette index to use. |
|
inlineconstexpr |
Draw text centered at the specified coordinate. The template parameter selects which mono font to use. Only format_8bit targets are supported.
FONT | The font struct name. |
KERNING | Boolean, use kerning information if available. Default to false. |
ROTATION | Rotation around the x/y coordinate. Can be text_rotation::DEGREE_0, text_rotation::DEGREE_90, text_rotation::DEGREE_180 or text_rotation::DEGREE_270 |
x | Center/Starting X-coordinate in pixels. |
y | Center/Starting Y-coordinate in pixels. |
str | UTF-8 string. |
col | Color palette index to use. |
|
inlineconstexpr |
Draw text at the specified coordinate. The template parameter selects which mono font to use. Only format_8bit targets are supported.
FONT | The font struct name. |
KERNING | Boolean, use kerning information if available. Default to false. |
ROTATION | Rotation around the x/y coordinate. Defaults to text_rotation::DEGREE_0. Can be text_rotation::DEGREE_0, text_rotation::DEGREE_90, text_rotation::DEGREE_180 or text_rotation::DEGREE_270 |
d | draw_string initializer struct. |
character_count | How many utf32 characters in the string should be drawn. |
character_actual | How many utf32 characters in the string were drawn. |
|
inlineconstexpr |
Draw text at the specified coordinate. The template parameter selects which mono font to use. Only format_8bit targets are supported.
FONT | The font struct name. |
KERNING | Boolean, use kerning information if available. Default to false. |
ROTATION | Rotation around the x/y coordinate. Defaults to text_rotation::DEGREE_0. Can be text_rotation::DEGREE_0, text_rotation::DEGREE_90, text_rotation::DEGREE_180 or text_rotation::DEGREE_270 |
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
str | UTF-8 string. |
col | Color palette index to use. |
character_count | How many utf32 characters in the string should be drawn. |
character_actual | How many utf32 characters in the string were drawn. |
|
inlineconstexpr |
Fill a circle with the specified radius and color. Example:
d | draw_circle initializer struct |
|
inlineconstexpr |
Fill a circle with the specified radius and color. Example:
cx | Center X-coordinate of the circle in pixels. |
cy | Center Y-coordinate of the circle in pixels. |
radius | radius of the circle in pixels. |
col | Color palette index to use. |
|
inlineconstexpr |
Fill a circle using antialiasing with the specified radius and color. Only format_8bit targets are supported. Example:
d | draw_circle initializer struct |
|
inlineconstexpr |
Fill a circle using antialiasing with a shader function that generates colors per pixel.
cx | Center X-coordinate of the circle in pixels. |
cy | Center Y-coordinate of the circle in pixels. |
radius | Radius of the circle in pixels. |
shader | Lambda function taking (u, v, x, y) normalized coordinates and returning RGBA color as std::array<float, 4> |
|
inlineconstexpr |
Fill a circle using antialiasing with the specified radius and color. Only format_8bit targets are supported. Example:
cx | Center X-coordinate of the circle in pixels. |
cy | Center Y-coordinate of the circle in pixels. |
radius | Radius of the circle in pixels. |
col | Color palette index to use. |
|
inlineconstexpr |
|
inlineconstexpr |
Fill a rectangle with a shader function that generates colors per pixel.
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
shader | Lambda function taking (u, v, x, y) normalized coordinates and returning RGBA color as std::array<float, 4> |
|
inlineconstexpr |
Fill a rectangle with the specified color. Example:
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
col | Color palette index to use. |
|
inlineconstexpr |
Fill a rounded rectangle with the specified color. Example:
d | draw_round_rect initializer struct |
|
inlineconstexpr |
Fill a rounded rectangle with the specified color. Example:
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
radius | Radius of the rounded corners in pixels. |
col | Color palette index to use. |
|
inlineconstexpr |
Fill a rounded rectangle using antialiasing with the specified color. Only format_8bit targets are supported.
d | draw_round_rect initializer struct |
|
inlineconstexpr |
Fill a rounded rectangle using antialiasing with a shader function that generates colors per pixel.
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
radius | Radius of the rounded corners in pixels. |
shader | Lambda function taking (u, v, x, y) normalized coordinates and returning RGBA color as std::array<float, 4> |
|
inlineconstexpr |
Fill a rounded rectangle using antialiasing with the specified color. Only format_8bit targets are supported. Example:
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle. |
h | Height of the rectangle. |
radius | Radius of the rounded corners. |
col | Color palette index to use. |
|
inlinenodiscardconstexpr |
Return closest match in the color palette based on the supplied red, green and blue values.
r | Red value (0-255) |
g | Green value (0-255) |
b | Blue value (0-255) |
|
inlinestaticnodiscardconstexpr |
Boolean indicating that the palette is grayscale instead of color.
|
inlinestaticnodiscardconstexpr |
Height in pixels of the image.
|
inlineconstexpr |
Create a line shape for fluent method chaining.
x0 | Starting X-coordinate in pixels. |
y0 | Starting Y-coordinate in pixels. |
x1 | Ending X-coordinate in pixels. |
y1 | Ending Y-coordinate in pixels. |
|
inlineconstexpr |
Create an antialiased line shape for fluent method chaining. Only format_8bit targets are supported.
x0 | Starting X-coordinate in pixels. |
y0 | Starting Y-coordinate in pixels. |
x1 | Ending X-coordinate in pixels. |
y1 | Ending Y-coordinate in pixels. |
|
inlineconstexpr |
Plot a single pixel at the specified coordinates using the supplied color.
p | plot initializer struct |
|
inlineconstexpr |
Plot a single pixel at the specified coordinates using the supplied color.
x | X-coordinate in pixels. |
y | Y-coordinate in pixels. |
col | Color palette index to use. |
|
inlineconstexpr |
Convert the current instance into a png image. Typically an implementation looks like this:
char_out | A lambda function which consumes the png image data one byte at a time. |
|
inlineconstexpr |
Create a point shape for fluent method chaining.
x | X-coordinate in pixels. |
y | Y-coordinate in pixels. |
|
inlineconstexpr |
Fluent shape API methods for method chaining These provide a more expressive way to create shapes compared to struct-based calls.
Example usage:
Create a rectangle shape for fluent method chaining.
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
|
inlineconstexpr |
Convert this instance to an equivalent RGBA8 data array.
dst | RGBA8 array made of image::width() * img::height() * uint32_t values. |
|
inlineconstexpr |
Convert this instance to an equivalent RGBA8 data array.
dst | RGBA8 array made of image::width() * img::height() * 4 * uint8_t values. |
|
inlineconstexpr |
Create a rounded rectangle shape for fluent method chaining.
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
radius | Radius of the rounded corners in pixels. |
|
inlineconstexpr |
Create an antialiased rounded rectangle shape for fluent method chaining. Only format_8bit targets are supported.
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
radius | Radius of the rounded corners in pixels. |
|
inlineconstexpr |
Convert the current instance into a sixel stream. Typically an implementation looks like this:
S | scale of sixel output. |
char_out | A lambda function which consumes the sixel stream data one byte at a time. |
|
inlineconstexpr |
Convert the current instance into a sixel stream. Typically an implementation looks like this:
S | scale of sixel output. |
char_out | A lambda function which consumes the sixel stream data one byte at a time |
rect | Clipping rectangle; to only show a portion of the image. |
|
inline |
Convert the current instance into a sixel stream and output it to std::cout.
S | scale of sixel output. |
|
inlinestaticnodiscardconstexpr |
Size in bytes of the image data. This does not include the image instance size.
|
inlinenodiscardconstexpr |
Return the width of a string using the specified font in the template parameter. Typical use:
FONT | The font struct name. |
KERNING | Boolean, use kerning information if available. |
str | UTF-8 string. |
character_count | How many utf32 characters in the string should be measured. |
character_actual | How many utf32 characters in the string were measured. |
|
inlineconstexpr |
Stroke a circle with the specified radius and color. Example:
d | draw_circle initializer struct |
|
inlineconstexpr |
Stroke a circle with the specified radius and color. Example:
cx | Center X-coordinate of the circle in pixels. |
cy | Center Y-coordinate of the circle in pixels. |
radius | radius of the circle in pixels. |
col | Color palette index to use. |
stroke_width | Width of the stroke in pixels. |
|
inlineconstexpr |
Stroke a circle using antialiasing with the specified radius and color. Only format_8bit targets are supported. Example:
d | draw_circle initializer struct |
|
inlineconstexpr |
Stroke a circle using antialiasing with the specified radius and color. Only format_8bit targets are supported. Example:
cx | Center X-coordinate of the circle in pixels. |
cy | Center Y-coordinate of the circle in pixels. |
radius | radius of the circle in pixels. |
col | Color palette index to use. |
stroke_width | Width of the stroke in pixels. |
|
inlineconstexpr |
|
inlineconstexpr |
Draw a stroked rectangle with the specified color and stroke width. Example:
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
col | Color palette index to use. |
stroke_width | Width of the stroke in pixels. |
|
inlineconstexpr |
Stroke a rounded rectangle with the specified color. Example:
d | draw_round_rect initializer struct |
|
inlineconstexpr |
Stroke a rounded rectangle with the specified color. Example:
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
radius | Radius of the rounded corners in pixels. |
col | Color palette index to use. |
stroke_width | Width of the stroke in pixels. |
|
inlineconstexpr |
Stroke a rounded rectangle using antialiasing with the specified color. Example:
d | draw_round_rect initializer struct |
|
inlineconstexpr |
Stroke a rounded rectangle using antialiasing with the specified color. Example:
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
w | Width of the rectangle in pixels. |
h | Height of the rectangle in pixels. |
radius | Radius of the rounded corners in pixels. |
col | Color palette index to use. |
stroke_width | Width of the stroke in pixels. |
|
inlineconstexpr |
Create a text shape for fluent antialiased string drawing with method chaining. Only format_8bit targets are supported.
FONT | The font type to use for rendering. |
KERNING | Enable kerning if true (default: false). |
ROTATION | Text rotation (default: DEGREE_0). |
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
str | The string to draw. |
Example usage:
|
inlineconstexpr |
Create a text shape for fluent centered antialiased string drawing with method chaining. Only format_8bit targets are supported.
FONT | The font type to use for rendering. |
KERNING | Enable kerning if true (default: false). |
ROTATION | Text rotation (default: DEGREE_0). |
x | Center X-coordinate in pixels. |
y | Center Y-coordinate in pixels. |
str | The string to draw. |
Example usage:
|
inlineconstexpr |
Create a text shape for fluent centered monospace string drawing with method chaining.
FONT | The font type to use for rendering. |
KERNING | Enable kerning if true (default: false). |
ROTATION | Text rotation (default: DEGREE_0). |
x | Center X-coordinate in pixels. |
y | Center Y-coordinate in pixels. |
str | The string to draw. |
Example usage:
|
inlineconstexpr |
Create a text shape for fluent monospace string drawing with method chaining.
FONT | The font type to use for rendering. |
KERNING | Enable kerning if true (default: false). |
ROTATION | Text rotation (default: DEGREE_0). |
x | Starting X-coordinate in pixels. |
y | Starting Y-coordinate in pixels. |
str | The string to draw. |
Example usage:
|
inlineconstexpr |
Return a transposed version of this image.
FLIP_H | Flip image horizontally |
FLIP_V | Flip image vertically |
|
inlineconstexpr |
Transpose this image into another.
FLIP_H | Flip image horizontally |
FLIP_V | Flip image vertically |
|
inlinestaticnodiscardconstexpr |
Width in pixels of the image.