17 #ifndef DGL_NANO_WIDGET_HPP_INCLUDED
18 #define DGL_NANO_WIDGET_HPP_INCLUDED
22 #include "SubWidget.hpp"
23 #include "TopLevelWidget.hpp"
24 #include "StandaloneWindow.hpp"
26 #ifndef DGL_NO_SHARED_RESOURCES
27 # define NANOVG_DEJAVU_SANS_TTF "__dpf_dejavusans_ttf__"
60 Handle(NVGcontext* c,
int id) noexcept
109 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoImage)
229 IMAGE_GENERATE_MIPMAPS = 1 << 0,
230 IMAGE_REPEAT_X = 1 << 1,
231 IMAGE_REPEAT_Y = 1 << 2,
232 IMAGE_FLIP_Y = 1 << 3,
233 IMAGE_PREMULTIPLIED = 1 << 4
239 ALIGN_CENTER = 1 << 1,
240 ALIGN_RIGHT = 1 << 2,
243 ALIGN_MIDDLE = 1 << 4,
244 ALIGN_BOTTOM = 1 << 5,
245 ALIGN_BASELINE = 1 << 6
280 Paint(
const NVGpaint&) noexcept;
281 operator NVGpaint()
const noexcept;
330 void beginFrame(
const uint width,
const uint height,
const float scaleFactor = 1.0f);
378 void strokeColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
384 void strokeColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
400 void fillColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
406 void fillColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
428 void lineCap(LineCap cap = BUTT);
434 void lineJoin(LineCap join = MITER);
457 void transform(
float a,
float b,
float c,
float d,
float e,
float f);
472 void skewX(
float angle);
477 void skewY(
float angle);
482 void scale(
float x,
float y);
545 static void transformPoint(
float& dstx,
float& dsty,
const float xform[6],
float srcx,
float srcy);
587 NanoImage::Handle
createImageFromRGBA(uint w, uint h,
const uchar* data, ImageFlags imageFlags);
625 Paint
boxGradient(
float x,
float y,
float w,
float h,
float r,
float f,
const Color& icol,
const Color& ocol);
639 Paint
imagePattern(
float ox,
float oy,
float ex,
float ey,
float angle,
const NanoImage& image,
float alpha);
648 void scissor(
float x,
float y,
float w,
float h);
676 void moveTo(
float x,
float y);
681 void lineTo(
float x,
float y);
686 void bezierTo(
float c1x,
float c1y,
float c2x,
float c2y,
float x,
float y);
691 void quadTo(
float cx,
float cy,
float x,
float y);
696 void arcTo(
float x1,
float y1,
float x2,
float y2,
float radius);
713 void arc(
float cx,
float cy,
float r,
float a0,
float a1, Winding dir);
718 void rect(
float x,
float y,
float w,
float h);
723 void roundedRect(
float x,
float y,
float w,
float h,
float r);
728 void ellipse(
float cx,
float cy,
float rx,
float ry);
733 void circle(
float cx,
float cy,
float r);
810 float text(
float x,
float y,
const char*
string,
const char* end);
818 void textBox(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end =
nullptr);
832 void textBoxBounds(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end,
float bounds[4]);
838 int textGlyphPositions(
float x,
float y,
const char*
string,
const char* end, GlyphPosition& positions,
int maxPositions);
844 void textMetrics(
float* ascender,
float* descender,
float* lineh);
851 int textBreakLines(
const char*
string,
const char* end,
float breakRowWidth, TextRow& rows,
int maxRows);
853 #ifndef DGL_NO_SHARED_RESOURCES
861 NVGcontext*
const fContext;
865 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoVG)
878 template <
class BaseW
idget>
924 inline void onDisplay()
override
932 void beginFrame(uint,uint) {}
933 void beginFrame(uint,uint,
float) {}
934 void beginFrame(
Widget*) {}
935 void cancelFrame() {}
945 DISTRHO_DEPRECATED_BY(
"NanoSubWidget")
952 #endif // DGL_NANO_WIDGET_HPP_INCLUDED
@ CREATE_ANTIALIAS
Definition: NanoVG.hpp:214
Paint boxGradient(float x, float y, float w, float h, float r, float f, const Color &icol, const Color &ocol)
GLuint getTextureHandle() const
static float radToDeg(float rad)
static void transformMultiply(float dst[6], const float src[6])
void currentTransform(float xform[6])
@ CREATE_STENCIL_STROKES
Definition: NanoVG.hpp:220
int textGlyphPositions(float x, float y, const char *string, const char *end, GlyphPosition &positions, int maxPositions)
static float degToRad(float deg)
void roundedRect(float x, float y, float w, float h, float r)
void textLineHeight(float lineHeight)
static void transformPremultiply(float dst[6], const float src[6])
static int transformInverse(float dst[6], const float src[6])
Definition: NanoVG.hpp:290
Definition: Window.hpp:50
void rect(float x, float y, float w, float h)
Paint radialGradient(float cx, float cy, float inr, float outr, const Color &icol, const Color &ocol)
NanoImage::Handle createImageFromRGBA(uint w, uint h, const uchar *data, ImageFlags imageFlags)
void fillColor(const Color &color)
void scissor(float x, float y, float w, float h)
void fontFaceId(FontId font)
void lineCap(LineCap cap=BUTT)
Definition: Geometry.hpp:30
Definition: Application.hpp:36
void fontSize(float size)
void strokeColor(const Color &color)
virtual bool loadSharedResources()
Definition: NanoVG.hpp:49
void lineJoin(LineCap join=MITER)
void miterLimit(float limit)
void quadTo(float cx, float cy, float x, float y)
void translate(float x, float y)
void scale(float x, float y)
Paint linearGradient(float sx, float sy, float ex, float ey, const Color &icol, const Color &ocol)
static void transformSkewX(float dst[6], float a)
void fontBlur(float blur)
CreateFlags
Definition: NanoVG.hpp:210
void pathWinding(Winding dir)
void transform(float a, float b, float c, float d, float e, float f)
Definition: NanoVG.hpp:284
void fillPaint(const Paint &paint)
NVGcontext * getContext() const noexcept
Definition: NanoVG.hpp:322
static void transformRotate(float dst[6], float a)
void beginFrame(const uint width, const uint height, const float scaleFactor=1.0f)
void strokePaint(const Paint &paint)
NanoImage::Handle createImageFromFile(const char *filename, ImageFlags imageFlags)
Paint imagePattern(float ox, float oy, float ex, float ey, float angle, const NanoImage &image, float alpha)
Definition: NanoVG.hpp:266
float textBounds(float x, float y, const char *string, const char *end, Rectangle< float > &bounds)
void lineTo(float x, float y)
void globalAlpha(float alpha)
static void transformIdentity(float dst[6])
static void transformSkewY(float dst[6], float a)
NanoImage::Handle createImageFromTextureHandle(GLuint textureId, uint w, uint h, ImageFlags imageFlags, bool deleteTexture=false)
NanoImage::Handle createImageFromMemory(uchar *data, uint dataSize, ImageFlags imageFlags)
void textBox(float x, float y, float breakRowWidth, const char *string, const char *end=nullptr)
void fontFace(const char *font)
NanoImage & operator=(const Handle &handle)
static void transformPoint(float &dstx, float &dsty, const float xform[6], float srcx, float srcy)
FontId createFontFromFile(const char *name, const char *filename)
static void transformScale(float dst[6], float sx, float sy)
@ CREATE_DEBUG
Definition: NanoVG.hpp:225
int textBreakLines(const char *string, const char *end, float breakRowWidth, TextRow &rows, int maxRows)
void circle(float cx, float cy, float r)
void arc(float cx, float cy, float r, float a0, float a1, Winding dir)
FontId createFontFromMemory(const char *name, const uchar *data, uint dataSize, bool freeData)
void strokeWidth(float size)
void intersectScissor(float x, float y, float w, float h)
bool isValid() const noexcept
static void transformTranslate(float dst[6], float tx, float ty)
void textBoxBounds(float x, float y, float breakRowWidth, const char *string, const char *end, float bounds[4])
void moveTo(float x, float y)
void ellipse(float cx, float cy, float rx, float ry)
float text(float x, float y, const char *string, const char *end)
void arcTo(float x1, float y1, float x2, float y2, float radius)
Definition: NanoVG.hpp:207
void textLetterSpacing(float spacing)
NanoVG(int flags=CREATE_ANTIALIAS)
FontId findFont(const char *name)
void textMetrics(float *ascender, float *descender, float *lineh)
void textAlign(Align align)
Size< uint > getSize() const noexcept
void bezierTo(float c1x, float c1y, float c2x, float c2y, float x, float y)