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...
 

Public Member Functions

 CYIPath ()
 
 CYIPath (uint32_t nSegCountHint, uint32_t nVertexCountHint)
 
virtual ~CYIPath ()
 
void Clear ()
 
bool MoveTo (const glm::vec2 &vPoint)
 
bool LineTo (const glm::vec2 &vPoint)
 
bool CubicTo (const glm::vec2 &vStart, const glm::vec2 &vMid, const glm::vec2 &vEnd)
 
bool Close ()
 
int32_t GetSegmentCount ()
 
SegmentGetSegment (int32_t nIndex)
 
bool GeneratePolygonData ()
 
uint32_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 fX1, float fY1, float fX2, float fY2)
 
static std::unique_ptr< CYIPathCreateRectangle (float fX, float fY, float fWidth, float fHeight)
 
static std::unique_ptr< CYIPathCreateRoundedRectangle (float fX, float fY, float fWidth, float fHeight, float fRX, float fRY)
 

Constructor & Destructor Documentation

CYIPath::CYIPath ( )
CYIPath::CYIPath ( uint32_t  nSegCountHint,
uint32_t  nVertexCountHint 
)
virtual CYIPath::~CYIPath ( )
virtual

Member Function Documentation

void CYIPath::CalculateBounds ( )

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

See also
GetFloatBounds()
GetIntBounds()
void CYIPath::Clear ( )

Deletes all segments this path contains.

bool CYIPath::Close ( )

Creates a Segment using the YI_PATH_CLOSE_TO command to "close" the path by going back to the starting point while drawing.

See also
Segment
YI_PATH_CMD
static std::unique_ptr<CYIPath> CYIPath::CreateLine ( float  fX1,
float  fY1,
float  fX2,
float  fY2 
)
static

Creates a line starting at point (nX1, nY1) to point (nX2, nY2).

static std::unique_ptr<CYIPath> CYIPath::CreateRectangle ( float  fX,
float  fY,
float  fWidth,
float  fHeight 
)
static

Creates a nWidth by nHeight rectangle where the top left corner is situated at point (nX, nY).

static std::unique_ptr<CYIPath> CYIPath::CreateRoundedRectangle ( float  fX,
float  fY,
float  fWidth,
float  fHeight,
float  fRX,
float  fRY 
)
static

Creates a nWidth by nHeight rounded rectangle where the top left corner is situated at point (nX, nY).

Note
Rounded corners are defined using radiuses nRX and nRY.
bool CYIPath::CubicTo ( const glm::vec2 &  vStart,
const glm::vec2 &  vMid,
const glm::vec2 &  vEnd 
)

Creates a Segment using the YI_PATH_CUBIC_TO command to move the cursor along a bezier curve created using vC1, vC2, vCEnd while drawing.

See also
Segment
YI_PATH_CMD
bool CYIPath::GeneratePolygonData ( )

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

glm::vec4 CYIPath::GetFloatBounds ( ) const

Returns the polygon bounds.

Note
The values contained are float data.
YI_RECT CYIPath::GetIntBounds ( ) const

Returns the polygon bounds.

Note
The values contained are int32_t data.
uint32_t CYIPath::GetPolygonCount ( ) const

Returns the number of polygons created by GeneratePolygonData().

const CYIPolygonData* CYIPath::GetPolygonData ( ) const

Returns the polygon data created by GeneratePolygonData().

CYIPolygonData* CYIPath::GetPolygonData ( )

Returns the polygon data created by GeneratePolygonData().

Segment* CYIPath::GetSegment ( int32_t  nIndex)

Returns the segment stored at the index nIndex.

int32_t CYIPath::GetSegmentCount ( )

Returns the number of segments contained in the path.

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

Creates a Segment using the YI_PATH_LINE_TO command to move the cursor to vPoint while drawing.

See also
Segment
YI_PATH_CMD
bool CYIPath::MoveTo ( const glm::vec2 &  vPoint)

Creates a Segment using the YI_PATH_MOVE_TO command to move the cursor to vPoint without drawing it.

See also
Segment
YI_PATH_CMD

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