AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
AeonGUI::PreserveAspectRatio Class Reference

SVG preserveAspectRatio attribute. More...

#include <aeongui/Attribute.hpp>

Public Types

enum  MinMidMax : uint8_t { Min = 0x1 , Mid = 0x2 , Max = 0x3 }
 Axis alignment selector values. More...
enum  Align : uint8_t {
  none = 0 , XMinYMin = Min << 4 | Min , XMinYMid = Min << 4 | Mid , XMinYMax = Min << 4 | Max ,
  XMidYMin = Mid << 4 | Min , XMidYMid = Mid << 4 | Mid , XMidYMax = Mid << 4 | Max , XMaxYMin = Max << 4 | Min ,
  XMaxYMid = Max << 4 | Mid , XMaxYMax = Max << 4 | Max
}
 Combined X and Y alignment values for preserveAspectRatio. More...
enum class  MeetOrSlice { Meet , Slice }
 Meet-or-slice scaling strategy. More...

Public Member Functions

 PreserveAspectRatio ()=default
 Default constructor. Initializes to xMidYMid meet.
 PreserveAspectRatio (std::string_view aString)
 Construct from a string representation.
Align GetAlign () const
 Get the alignment value.
MinMidMax GetAlignX () const
 Get the X-axis alignment component.
MinMidMax GetAlignY () const
 Get the Y-axis alignment component.
MeetOrSlice GetMeetOrSlice () const
 Get the meet-or-slice strategy.

Detailed Description

SVG preserveAspectRatio attribute.

Controls how an SVG element with a viewBox is scaled and aligned within its viewport. See the SVG specification for details.

Member Enumeration Documentation

◆ Align

Combined X and Y alignment values for preserveAspectRatio.

Enumerator
none 

Do not force uniform scaling.

XMinYMin 

Align X-min, Y-min.

XMinYMid 

Align X-min, Y-mid.

XMinYMax 

Align X-min, Y-max.

XMidYMin 

Align X-mid, Y-min.

XMidYMid 

Align X-mid, Y-mid (default).

XMidYMax 

Align X-mid, Y-max.

XMaxYMin 

Align X-max, Y-min.

XMaxYMid 

Align X-max, Y-mid.

XMaxYMax 

Align X-max, Y-max.

◆ MeetOrSlice

Meet-or-slice scaling strategy.

Enumerator
Meet 

Scale to fit entirely within the viewport.

Slice 

Scale to cover the viewport, clipping overflow.

◆ MinMidMax

Axis alignment selector values.

Enumerator
Min 

Align to the minimum (start) edge.

Mid 

Align to the midpoint.

Max 

Align to the maximum (end) edge.

Constructor & Destructor Documentation

◆ PreserveAspectRatio()

AeonGUI::PreserveAspectRatio::PreserveAspectRatio ( std::string_view aString)

Construct from a string representation.

Parameters
aStringA string such as "xMidYMid meet".

Member Function Documentation

◆ GetAlign()

PreserveAspectRatio::Align AeonGUI::PreserveAspectRatio::GetAlign ( ) const

Get the alignment value.

Returns
The combined Align enumeration value.

◆ GetAlignX()

PreserveAspectRatio::MinMidMax AeonGUI::PreserveAspectRatio::GetAlignX ( ) const

Get the X-axis alignment component.

Returns
Min, Mid, or Max for the X axis.

◆ GetAlignY()

PreserveAspectRatio::MinMidMax AeonGUI::PreserveAspectRatio::GetAlignY ( ) const

Get the Y-axis alignment component.

Returns
Min, Mid, or Max for the Y axis.

◆ GetMeetOrSlice()

PreserveAspectRatio::MeetOrSlice AeonGUI::PreserveAspectRatio::GetMeetOrSlice ( ) const

Get the meet-or-slice strategy.

Returns
Meet or Slice.

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