You.i Engine
CYIPath Class Reference

Detailed Description

A class that contains information on how a path will be drawn.

The path defined here will be drawn in software using CYICanvas.

Note
Does not use GPU / hardware acceleration.
See also
CYICanvas::DrawPath

#include <graphics/YiPath.h>

Classes

class  Segment
 A class representing one segment of a path. More...
 
struct  YI_PATH_CUBIC
 

Public Types

enum  Command {
  Command::MoveTo,
  Command::LineTo,
  Command::CubicTo,
  Command::Close
}
 
enum  BoundsIndex {
  BoundsIndex::Left = 0,
  BoundsIndex::Top,
  BoundsIndex::Right,
  BoundsIndex::Bottom
}
 

Public Member Functions

 CYIPath ()
 
 CYIPath (uint32_t segCountHint, uint32_t vertexCountHint)
 
virtual ~CYIPath ()
 
void Clear ()
 
bool MoveTo (const glm::vec2 &point)
 
bool LineTo (const glm::vec2 &point)
 
bool CubicTo (const glm::vec2 &start, const glm::vec2 &mid, const glm::vec2 &end)
 
bool Close ()
 
size_t GetSegmentCount ()
 
SegmentGetSegment (size_t index)
 
bool GeneratePolygonData ()
 
size_t GetPolygonCount () const
 
const CYIPolygonDataGetPolygonData () const
 
CYIPolygonDataGetPolygonData ()
 
void CalculateBounds ()
 
glm::vec4 GetFloatBounds () const
 
YI_RECT GetIntBounds () const
 

Static Public Member Functions

static std::unique_ptr< CYIPathCreateLine (float x1, float y1, float x2, float y2)
 
static std::unique_ptr< CYIPathCreateRectangle (float x, float y, float width, float height)
 
static std::unique_ptr< CYIPathCreateRoundedRectangle (float x, float y, float width, float height, float rX, float rY)
 

Member Enumeration Documentation

◆ BoundsIndex

enum CYIPath::BoundsIndex
strong
Enumerator
Left 
Top 
Right 
Bottom 

◆ Command

enum CYIPath::Command
strong
Enumerator
MoveTo 

Command that moves the cursor instantaneously to a position.

See also
CYIPath::MoveTo()
LineTo 

Command that moves the cursor to a position while drawing a line along the path.

See also
CYIPath::LineTo()
CubicTo 

Command that moves the cursor along a bezier curve while drawing a line along the path.

See also
CYIPath::CubicTo()
Close 

Command that moves the cursor to the starting point while drawing a line along the path.

See also
CYIPath::Close()

Constructor & Destructor Documentation

◆ CYIPath() [1/2]

CYIPath::CYIPath ( )

◆ CYIPath() [2/2]

CYIPath::CYIPath ( uint32_t  segCountHint,
uint32_t  vertexCountHint 
)

◆ ~CYIPath()

virtual CYIPath::~CYIPath ( )
virtual

Member Function Documentation

◆ CalculateBounds()

void CYIPath::CalculateBounds ( )

Calculates the polygon bounds based on the data created by GeneratePolygonData().

See also
GetFloatBounds()
GetIntBounds()

◆ Clear()

void CYIPath::Clear ( )

Deletes all segments this path contains.

◆ Close()

bool CYIPath::Close ( )

Creates a Segment using the CYIPath::Command::Close_TO command to "close" the path by going back to the starting point while drawing.

See also
CYIPath::Segment
CYIPath::Command

◆ CreateLine()

static std::unique_ptr<CYIPath> CYIPath::CreateLine ( float  x1,
float  y1,
float  x2,
float  y2 
)
static

Creates a line starting at point (x1, y1) to point (x2, y2).

◆ CreateRectangle()

static std::unique_ptr<CYIPath> CYIPath::CreateRectangle ( float  x,
float  y,
float  width,
float  height 
)
static

Creates a width by height rectangle where the top left corner is situated at point (x, y).

◆ CreateRoundedRectangle()

static std::unique_ptr<CYIPath> CYIPath::CreateRoundedRectangle ( float  x,
float  y,
float  width,
float  height,
float  rX,
float  rY 
)
static

Creates a width by height rounded rectangle where the top left corner is situated at point (x, y).

Note
Rounded corners are defined using radiuses rX and rY.

◆ CubicTo()

bool CYIPath::CubicTo ( const glm::vec2 &  start,
const glm::vec2 &  mid,
const glm::vec2 &  end 
)

Creates a Segment using the CYIPath::Command::CubicTo command to move the cursor along a bezier curve created using c1, c2, end while drawing.

See also
CYIPath::Segment
CYIPath::Command

◆ GeneratePolygonData()

bool CYIPath::GeneratePolygonData ( )

Generates polygon data based on the segments contained in the path.

◆ GetFloatBounds()

glm::vec4 CYIPath::GetFloatBounds ( ) const

Returns the polygon bounds.

Note
The values contained are float data.

◆ GetIntBounds()

YI_RECT CYIPath::GetIntBounds ( ) const

Returns the polygon bounds.

Note
The values contained are int32_t data.

◆ GetPolygonCount()

size_t CYIPath::GetPolygonCount ( ) const

Returns the number of polygons created by GeneratePolygonData().

◆ GetPolygonData() [1/2]

const CYIPolygonData* CYIPath::GetPolygonData ( ) const

Returns the polygon data created by GeneratePolygonData().

◆ GetPolygonData() [2/2]

CYIPolygonData* CYIPath::GetPolygonData ( )

Returns the polygon data created by GeneratePolygonData().

◆ GetSegment()

Segment* CYIPath::GetSegment ( size_t  index)

Returns the segment stored at the index index.

◆ GetSegmentCount()

size_t CYIPath::GetSegmentCount ( )

Returns the number of segments contained in the path.

◆ LineTo()

bool CYIPath::LineTo ( const glm::vec2 &  point)

Creates a Segment using the CYIPath::Command::LineTo command to move the cursor to point while drawing.

See also
CYIPath::Segment
CYIPath::Command

◆ MoveTo()

bool CYIPath::MoveTo ( const glm::vec2 &  point)

Creates a Segment using the CYIPath::Command::MoveTo command to move the cursor to point without drawing it.

See also
CYIPath::Segment
CYIPath::Command

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