constixel
Loading...
Searching...
No Matches
constixel::shapes::rect< T, W, H, GRAYSCALE, USE_SPAN > Class Template Reference

Fluent API for drawing rectangles. More...

#include <constixel.hpp>

Public Member Functions

constexpr rect (image_type &image, int32_t x_, int32_t y_, int32_t w_, int32_t h_)
 Construct a rectangle shape.
 
constexpr rectfill (uint8_t col)
 Fill the rectangle with a solid color.
 
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_shader (const shader_func &shader) -> rect &
 Fill the rectangle using a shader function.
 
constexpr rectstroke (uint8_t col, int32_t stroke_width=1)
 Draw the rectangle outline.
 

Detailed Description

template<template< size_t, size_t, bool, bool > class T, size_t W, size_t H, bool GRAYSCALE, bool USE_SPAN>
class constixel::shapes::rect< T, W, H, GRAYSCALE, USE_SPAN >

Fluent API for drawing rectangles.

Provides a chainable interface for drawing filled and stroked rectangles.

Constructor & Destructor Documentation

◆ rect()

template<template< size_t, size_t, bool, bool > class T, size_t W, size_t H, bool GRAYSCALE, bool USE_SPAN>
constixel::shapes::rect< T, W, H, GRAYSCALE, USE_SPAN >::rect ( image_type & image,
int32_t x_,
int32_t y_,
int32_t w_,
int32_t h_ )
inlineconstexpr

Construct a rectangle shape.

Parameters
imageTarget image to draw on
x_X coordinate of top-left corner
y_Y coordinate of top-left corner
w_Width of rectangle
h_Height of rectangle

Member Function Documentation

◆ fill()

template<template< size_t, size_t, bool, bool > class T, size_t W, size_t H, bool GRAYSCALE, bool USE_SPAN>
rect & constixel::shapes::rect< T, W, H, GRAYSCALE, USE_SPAN >::fill ( uint8_t col)
inlineconstexpr

Fill the rectangle with a solid color.

Parameters
colColor value
Returns
Reference to this rectangle for chaining

◆ fill_shader()

template<template< size_t, size_t, bool, bool > class T, size_t W, size_t H, bool GRAYSCALE, bool USE_SPAN>
template<typename shader_func>
requires std::is_invocable_r_v<std::array<float, 4>, shader_func, float, float, int32_t, int32_t>
auto constixel::shapes::rect< T, W, H, GRAYSCALE, USE_SPAN >::fill_shader ( const shader_func & shader) -> rect &
inlineconstexpr

Fill the rectangle using a shader function.

Parameters
shaderFunction that returns RGBA values based on normalized coordinates
Returns
Reference to this rectangle for chaining

◆ stroke()

template<template< size_t, size_t, bool, bool > class T, size_t W, size_t H, bool GRAYSCALE, bool USE_SPAN>
rect & constixel::shapes::rect< T, W, H, GRAYSCALE, USE_SPAN >::stroke ( uint8_t col,
int32_t stroke_width = 1 )
inlineconstexpr

Draw the rectangle outline.

Parameters
colColor value
stroke_widthWidth of the stroke (default: 1)
Returns
Reference to this rectangle for chaining

The documentation for this class was generated from the following file: