Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::svg::components::RectProperties Struct Reference

Parameters for a "<rect>" element. More...

#include "donner/svg/components/shape/RectComponent.h"

Collaboration diagram for donner::svg::components::RectProperties:
[legend]

Public Member Functions

auto allProperties ()
 Get all properties as a tuple.
 
std::tuple< Lengthd, double > calculateRx (const Boxd &viewbox, const FontMetrics &fontMetrics) const
 Calculate the actual value of rx in pixels, taking into account the viewbox and handling "auto".
 
std::tuple< Lengthd, double > calculateRy (const Boxd &viewbox, const FontMetrics &fontMetrics) const
 Calculate the actual value of ry in pixels, taking into account the viewbox and handling "auto".
 

Public Attributes

Property< Lengthdx
 The x-coordinate of the rectangle, defaults to 0.
 
Property< Lengthdy
 The y-coordinate of the rectangle, defaults to 0.
 
Property< Lengthdwidth
 The width of the rectangle, defaults to 0.
 
Property< Lengthdheight
 The height of the rectangle, defaults to 0.
 
Property< Lengthdrx {"rx", []() -> std::optional<Lengthd> { return std::nullopt; }}
 The corner radius of the rectangle, to enable creating rounded corners. Defaults to 0 (angled corners).
 
Property< Lengthdry {"ry", []() -> std::optional<Lengthd> { return std::nullopt; }}
 The corner radius of the rectangle, to enable creating rounded corners. Defaults to 0 (angled corners).
 

Detailed Description

Parameters for a "<rect>" element.

Member Function Documentation

◆ calculateRx()

std::tuple< Lengthd, double > donner::svg::components::RectProperties::calculateRx ( const Boxd & viewbox,
const FontMetrics & fontMetrics ) const
inline

Calculate the actual value of rx in pixels, taking into account the viewbox and handling "auto".

Parameters
viewboxThe viewbox of the SVG document.
fontMetricsThe font metrics of the SVG document.
Returns
The actual value of rx in pixels.

◆ calculateRy()

std::tuple< Lengthd, double > donner::svg::components::RectProperties::calculateRy ( const Boxd & viewbox,
const FontMetrics & fontMetrics ) const
inline

Calculate the actual value of ry in pixels, taking into account the viewbox and handling "auto".

Parameters
viewboxThe viewbox of the SVG document.
fontMetricsThe font metrics of the SVG document.
Returns
The actual value of ry in pixels.

Member Data Documentation

◆ height

Property<Lengthd> donner::svg::components::RectProperties::height
Initial value:
{
"height", []() -> std::optional<Lengthd> { return Lengthd(0, Lengthd::Unit::None); }}
Length< double > Lengthd
Shorthand for Length<double>.
Definition Length.h:222

The height of the rectangle, defaults to 0.

◆ width

Property<Lengthd> donner::svg::components::RectProperties::width
Initial value:
{
"width", []() -> std::optional<Lengthd> { return Lengthd(0, Lengthd::Unit::None); }}

The width of the rectangle, defaults to 0.

◆ x

Property<Lengthd> donner::svg::components::RectProperties::x
Initial value:
{"x",
[]() -> std::optional<Lengthd> { return Lengthd(0, Lengthd::Unit::None); }}

The x-coordinate of the rectangle, defaults to 0.

◆ y

Property<Lengthd> donner::svg::components::RectProperties::y
Initial value:
{"y",
[]() -> std::optional<Lengthd> { return Lengthd(0, Lengthd::Unit::None); }}

The y-coordinate of the rectangle, defaults to 0.


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