HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
hi::v1::draw_attributes Struct Reference

#include <hikogui/GFX/draw_context_intf.hpp>

Public Member Functions

constexpr draw_attributes (draw_attributes const &) noexcept=default
 
constexpr draw_attributes (draw_attributes &&) noexcept=default
 
constexpr draw_attributesoperator= (draw_attributes const &) noexcept=default
 
constexpr draw_attributesoperator= (draw_attributes &&) noexcept=default
 
template<draw_attribute... Args>
constexpr draw_attributes (Args const &...args) noexcept
 Construct the draw attributes based on types and order of the attributes.
 
constexpr void add () noexcept
 
template<draw_attribute T>
constexpr void add (T const &attribute) noexcept
 
template<draw_attribute First, draw_attribute Second, draw_attribute... Rest>
constexpr void add (First const &first, Second const &second, Rest const &...rest) noexcept
 

Data Fields

unsigned char num_colors = 0
 
unsigned char num_line_caps = 0
 
quad_color fill_color = {}
 The fill color used for the color of a box inside the border.
 
quad_color line_color = {}
 The line color used for the color of the border of the box.
 
float line_width = 0.0f
 The width of a line, or the width of a border.
 
hi::border_side border_side = hi::border_side::on
 The side on which side of the edge of a shape the border should be drawn.
 
hi::corner_radii corner_radius = {}
 The radii of each corner of a quad.
 
aarectangle clipping_rectangle = aarectangle::large()
 The rectangle used the clip the shape when drawing.
 
line_end_cap begin_line_cap = line_end_cap::flat
 The shape of the beginning of a line.
 
line_end_cap end_line_cap = line_end_cap::flat
 The shape of the beginning of a line.
 

Detailed Description

The draw attributes used to draw shaped into the draw context.

Constructor & Destructor Documentation

◆ draw_attributes()

template<draw_attribute... Args>
constexpr hi::v1::draw_attributes::draw_attributes ( Args const &... args)
inlineconstexprnoexcept

Construct the draw attributes based on types and order of the attributes.

The following order of attributes is maintained:

  • By default the fill_color and line_color are transparent.
  • The first hi::color or hi::quad_color is used for the fill_color.
  • The second hi::color or hi::quad_color is used for the line_color.
  • By default the begin_line_cap and end_line_cap are set to flat.
  • The first hi::line_end_cap is used for both the begin_line_cap and end_line_cap.
  • The second hi::line_end_cap is used to override the end_line_cap.
  • By default the border_side is set to border_side::on
  • A hi::border_side argument is used to set the border_side.
  • By default the corner_radius are set to (0, 0, 0, 0).
  • A hi::corner_radii argument is used to set the corner_radius.
  • By default the clipping_rectangle is set to a rectangle encompassing the whole window.
  • A hi::aarectangle argument is used to set the clipping_rectangle.
  • By default the line_width is set to 0.
  • A float or int argument is used to set the line_width.
Parameters
argsThe attributes to be set.

Field Documentation

◆ begin_line_cap

line_end_cap hi::v1::draw_attributes::begin_line_cap = line_end_cap::flat

The shape of the beginning of a line.

◆ border_side

hi::border_side hi::v1::draw_attributes::border_side = hi::border_side::on

The side on which side of the edge of a shape the border should be drawn.

◆ clipping_rectangle

aarectangle hi::v1::draw_attributes::clipping_rectangle = aarectangle::large()

The rectangle used the clip the shape when drawing.

This rectangle is used for limiting drawing outside of a widget's rectangle. But it may also be used to cut shapes for special effects.

◆ corner_radius

hi::corner_radii hi::v1::draw_attributes::corner_radius = {}

The radii of each corner of a quad.

◆ end_line_cap

line_end_cap hi::v1::draw_attributes::end_line_cap = line_end_cap::flat

The shape of the beginning of a line.

◆ fill_color

quad_color hi::v1::draw_attributes::fill_color = {}

The fill color used for the color of a box inside the border.

This is also used as the line-color when drawing lines. Or the color of the text. And the color for the primary cursor.

◆ line_color

quad_color hi::v1::draw_attributes::line_color = {}

The line color used for the color of the border of the box.

This is also used as the color for the secondary cursor.

◆ line_width

float hi::v1::draw_attributes::line_width = 0.0f

The width of a line, or the width of a border.


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