21#include <vstgui4/vstgui/lib/cdrawcontext.h>
22#include <vstgui4/vstgui/lib/cview.h>
24#include <base/source/fstring.h>
32using namespace VSTGUI;
84 return fRect.getWidth();
93 return fRect.getHeight();
98 return x +
fRect.left;
103 return y +
fRect.top;
108 return x -
fRect.left;
113 return y -
fRect.top;
228 CRect size{x, y,
fDrawContext->getStringWidth(iText.getPlatformString()), iHeight};
246 template<
typename... Args>
250 auto s = Steinberg::String().printf(iFormat, std::forward<Args>(iArgs)...);
251 debugText(x, y, s.text8());
255 template<
typename... Args>
256 void debugTopLeft(
char const *iFormat, Args&& ...iArgs) { debugXY(0, 0, iFormat, std::forward<Args>(iArgs)...); }
259 template<
typename... Args>
260 void debugTopRight(
char const *iFormat, Args&& ...iArgs) { debugXY(-1, 0, iFormat, std::forward<Args>(iArgs)...); }
263 template<
typename... Args>
264 void debugBottomLeft(
char const *iFormat, Args&& ...iArgs) { debugXY(0, -1, iFormat, std::forward<Args>(iArgs)...); }
267 template<
typename... Args>
268 void debugBottomRight(
char const *iFormat, Args&& ...iArgs) { debugXY(-1, -1, iFormat, std::forward<Args>(iArgs)...); }
273 template<
typename... Args>
274 void debug(
char const *iFormat, Args&& ...iArgs) { debugTopLeft(iFormat, std::forward<Args>(iArgs)...); }
279 void debugText(
char const *iText) { debugText(0, 0, iText); }
293 CColor fDebugStringColor{kGreenCColor};
294 FontPtr fDebugStringFont{kNormalFontVerySmall};
void drawLine(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &color)
Definition DrawContext.h:162
void fillRect(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &iColor)
Definition DrawContext.h:179
void fillEllipse(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &iColor)
Definition DrawContext.h:208
void drawEllipse(RelativeRect const &iRect, CColor const &iStrokeColor)
Definition DrawContext.h:202
void drawRect(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &iStrokeColor)
Definition DrawContext.h:168
void drawEllipse(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &iStrokeColor)
Definition DrawContext.h:197
void fillAndStrokeEllipse(RelativeRect const &iRect, CColor const &iFillColor, CColor const &iStrokeColor)
Definition DrawContext.h:219
void drawString(UTF8String const &iText, StringDrawContext &iSdc)
Definition DrawContext.h:234
void drawRect(RelativeRect const &iRect, CColor const &iStrokeColor)
Definition DrawContext.h:173
RelativeDrawContext(CView *iView, CDrawContext *iDrawContext)
Definition DrawContext.h:158
void drawString(UTF8String const &iText, RelativeCoord x, RelativeCoord y, RelativeCoord iHeight, StringDrawContext &iSdc)
Definition DrawContext.h:226
CDrawContext * fDrawContext
Definition DrawContext.h:289
void fillEllipse(RelativeRect const &iRect, CColor const &iColor)
Definition DrawContext.h:213
void fillRect(RelativeRect const &iRect, CColor const &iColor)
Definition DrawContext.h:184
void fillAndStrokeRect(RelativeRect const &iRect, CColor const &iFillColor, CColor const &iStrokeColor)
Definition DrawContext.h:190
Range getHorizontalRange() const
Definition DrawContext.h:87
RelativeView(AbsoluteRect const &iRect)
Definition DrawContext.h:73
RelativeCoord fromAbsoluteX(AbsoluteCoord x) const
Definition DrawContext.h:106
Range getVerticalRange() const
Definition DrawContext.h:89
RelativeRect getViewSize() const
Definition DrawContext.h:77
CCoord getWidth() const
Definition DrawContext.h:82
AbsolutePoint toAbsolutePoint(RelativePoint const &iPoint) const
Definition DrawContext.h:116
AbsoluteRect const & fRect
Definition DrawContext.h:149
RelativePoint fromAbsolutePoint(AbsolutePoint const &iPoint) const
Definition DrawContext.h:121
AbsolutePoint toAbsolutePoint(RelativeCoord x, RelativeCoord y) const
Definition DrawContext.h:138
CCoord getHeight() const
Definition DrawContext.h:91
AbsoluteRect toAbsoluteRect(RelativeRect const &iRect) const
Definition DrawContext.h:143
RelativePoint clampAbsolutePoint(AbsolutePoint const &iPoint) const
Convert the absolute point to a relative point while making sure it is clamped (constrained) within t...
Definition DrawContext.h:130
RelativeView(CView const *iView)
Definition DrawContext.h:69
AbsoluteCoord toAbsoluteY(RelativeCoord y) const
Definition DrawContext.h:101
RelativeCoord fromAbsoluteY(AbsoluteCoord y) const
Definition DrawContext.h:111
AbsoluteCoord toAbsoluteX(RelativeCoord x) const
Definition DrawContext.h:96
static constexpr T clamp(const U &iValue, const T &iLower, const T &iUpper)
Make sure that the value remains within its bounds.
Definition Misc.h:34
Definition DrawContext.cpp:25
CRect AbsoluteRect
Definition DrawContext.h:64
CRect RelativeRect
Definition DrawContext.h:63
CPoint AbsolutePoint
Definition DrawContext.h:62
CCoord RelativeCoord
Definition DrawContext.h:59
CPoint RelativePoint
Definition DrawContext.h:61
CCoord AbsoluteCoord
Definition DrawContext.h:60
CFontDesc * FontPtr
Definition Types.h:52
Utils::Range< CCoord > Range
Defines a Range.
Definition Types.h:62
The context which contains the details on how the string should be drawn.
Definition DrawContext.h:37
void setStyle(Style iStyle)
Definition DrawContext.h:55
CHoriTxtAlign fHorizTxtAlign
Definition DrawContext.h:44
CPoint fShadowTextOffset
Definition DrawContext.h:51
Style
Definition DrawContext.h:39
@ kShadowText
Definition DrawContext.h:40
@ kNoTextStyle
Definition DrawContext.h:41
bool fAntialias
Definition DrawContext.h:52
void addStyle(Style iStyle)
Definition DrawContext.h:56
constexpr bool hasStyle(Style iStyle) const
Definition DrawContext.h:54
FontPtr fFont
Definition DrawContext.h:47
CColor fFontColor
Definition DrawContext.h:48
int32_t fStyle
Should be a value provided by StringDrawContext::Style.
Definition DrawContext.h:46
CPoint fTextInset
Definition DrawContext.h:50
CColor fShadowColor
Definition DrawContext.h:49