ASPiK SDK
|
A drawing context encapsulates the drawing context of the underlying OS. More...
#include <cdrawcontext.h>
Classes | |
struct | Transform |
Public Member Functions | |
virtual void | beginDraw () |
virtual void | endDraw () |
Line Mode | |
virtual void | setLineStyle (const CLineStyle &style) |
set the current line style | |
const CLineStyle & | getLineStyle () const |
get the current line style | |
virtual void | setLineWidth (CCoord width) |
set the current line width | |
CCoord | getLineWidth () const |
get the current line width | |
Draw Mode | |
virtual void | setDrawMode (CDrawMode mode) |
set the current draw mode, see CDrawMode | |
CDrawMode | getDrawMode () const |
get the current draw mode, see CDrawMode | |
Clipping | |
virtual void | setClipRect (const CRect &clip) |
set the current clip | |
CRect & | getClipRect (CRect &clip) const |
get the current clip | |
virtual void | resetClipRect () |
reset the clip to the default state | |
Color | |
virtual void | setFillColor (const CColor &color) |
set current fill color | |
CColor | getFillColor () const |
get current fill color | |
virtual void | setFrameColor (const CColor &color) |
set current stroke color | |
CColor | getFrameColor () const |
get current stroke color | |
Font | |
virtual void | setFontColor (const CColor &color) |
set current font color | |
CColor | getFontColor () const |
get current font color | |
virtual void | setFont (const CFontRef font, const CCoord &size=0, const int32_t &style=-1) |
set current font | |
const CFontRef | getFont () const |
get current font | |
Text | |
CCoord | getStringWidth (UTF8StringPtr pStr) |
get the width of an UTF-8 encoded string | |
void | drawString (UTF8StringPtr string, const CRect &_rect, const CHoriTxtAlign hAlign=kCenterText, bool antialias=true) |
draw an UTF-8 encoded string | |
void | drawString (UTF8StringPtr string, const CPoint &_point, bool antialias=true) |
draw an UTF-8 encoded string | |
CCoord | getStringWidth (IPlatformString *pStr) |
get the width of a platform string | |
void | drawString (IPlatformString *string, const CRect &_rect, const CHoriTxtAlign hAlign=kCenterText, bool antialias=true) |
draw a platform string | |
void | drawString (IPlatformString *string, const CPoint &_point, bool antialias=true) |
draw a platform string | |
Global Alpha State | |
virtual void | setGlobalAlpha (float newAlpha) |
sets the global alpha value[0..1] | |
float | getGlobalAlpha () const |
get current global alpha value | |
Global State Stack | |
virtual void | saveGlobalState () |
virtual void | restoreGlobalState () |
Transformation | |
const CGraphicsTransform & | getCurrentTransform () const |
const CRect & | getAbsoluteClipRect () const |
virtual double | getScaleFactor () const |
CCoord | getHairlineSize () const |
![]() | |
ReferenceCounted (const ReferenceCounted &) | |
ReferenceCounted & | operator= (const ReferenceCounted &) |
void | forget () override |
decrease refcount and delete object if refcount == 0 | |
void | remember () override |
increase refcount | |
virtual int32_t | getNbReference () const |
get refcount | |
virtual void | beforeDelete () |
Protected Member Functions | |
CDrawContext (const CRect &surfaceRect) | |
virtual void | init () |
void | pushTransform (const CGraphicsTransform &transformation) |
void | popTransform () |
const UTF8String & | getDrawString (UTF8StringPtr string) |
void | clearDrawString () |
Protected Attributes | |
UTF8String * | drawStringHelper |
CRect | surfaceRect |
CDrawContextState | currentState |
Draw primitives | |
using | LinePair = std::pair< CPoint, CPoint > |
using | LineList = std::vector< LinePair > |
using | PointList = std::vector< CPoint > |
void | drawLine (const CPoint &start, const CPoint &end) |
virtual void | drawLine (const LinePair &line)=0 |
draw a line | |
virtual void | drawLines (const LineList &lines)=0 |
draw multiple lines at once | |
virtual void | drawPolygon (const PointList &polygonPointList, const CDrawStyle drawStyle=kDrawStroked)=0 |
draw a polygon | |
virtual void | drawRect (const CRect &rect, const CDrawStyle drawStyle=kDrawStroked)=0 |
draw a rect | |
virtual void | drawArc (const CRect &rect, const float startAngle1, const float endAngle2, const CDrawStyle drawStyle=kDrawStroked)=0 |
draw an arc, angles are in degree | |
virtual void | drawEllipse (const CRect &rect, const CDrawStyle drawStyle=kDrawStroked)=0 |
draw an ellipse | |
virtual void | drawPoint (const CPoint &point, const CColor &color)=0 |
draw a point | |
virtual void | drawBitmap (CBitmap *bitmap, const CRect &dest, const CPoint &offset=CPoint(0, 0), float alpha=1.f)=0 |
don't call directly, please use CBitmap::draw instead | |
virtual void | drawBitmapNinePartTiled (CBitmap *bitmap, const CRect &dest, const CNinePartTiledDescription &desc, float alpha=1.f) |
virtual void | fillRectWithBitmap (CBitmap *bitmap, const CRect &srcRect, const CRect &dstRect, float alpha) |
virtual void | clearRect (const CRect &rect)=0 |
clears the rect (makes r = 0, g = 0, b = 0, a = 0) | |
Graphics Paths | |
enum | PathDrawMode { kPathFilled, kPathFilledEvenOdd, kPathStroked } |
virtual CGraphicsPath * | createGraphicsPath ()=0 |
create a graphics path object, you need to forget it after usage | |
virtual CGraphicsPath * | createTextPath (const CFontRef font, UTF8StringPtr text)=0 |
create a graphics path from a text | |
CGraphicsPath * | createRoundRectGraphicsPath (const CRect &size, CCoord radius) |
create a rect with round corners as graphics path, you need to forget it after usage | |
virtual void | drawGraphicsPath (CGraphicsPath *path, PathDrawMode mode=kPathFilled, CGraphicsTransform *transformation=nullptr)=0 |
virtual void | fillLinearGradient (CGraphicsPath *path, const CGradient &gradient, const CPoint &startPoint, const CPoint &endPoint, bool evenOdd=false, CGraphicsTransform *transformation=nullptr)=0 |
virtual void | fillRadialGradient (CGraphicsPath *path, const CGradient &gradient, const CPoint ¢er, CCoord radius, const CPoint &originOffset=CPoint(0, 0), bool evenOdd=false, CGraphicsTransform *transformation=nullptr)=0 |
A drawing context encapsulates the drawing context of the underlying OS.
CCoord VSTGUI::CDrawContext::getHairlineSize | ( | ) | const |
returns the current line size which corresponds to one pixel on screen.
do not cache this value, instead ask for it every time you need it.
|
inlinevirtual |
returns the backend scale factor.