17 #ifndef DGL_NANO_WIDGET_HPP_INCLUDED
18 #define DGL_NANO_WIDGET_HPP_INCLUDED
24 #ifndef DGL_NO_SHARED_RESOURCES
25 # define NANOVG_DEJAVU_SANS_TTF "__dpf_dejavusans_ttf__"
59 Handle(NVGcontext* c,
int id) noexcept
108 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoImage)
228 IMAGE_GENERATE_MIPMAPS = 1 << 0,
229 IMAGE_REPEAT_X = 1 << 1,
230 IMAGE_REPEAT_Y = 1 << 2,
231 IMAGE_FLIP_Y = 1 << 3,
232 IMAGE_PREMULTIPLIED = 1 << 4
238 ALIGN_CENTER = 1 << 1,
239 ALIGN_RIGHT = 1 << 2,
242 ALIGN_MIDDLE = 1 << 4,
243 ALIGN_BOTTOM = 1 << 5,
244 ALIGN_BASELINE = 1 << 6
279 Paint(
const NVGpaint&) noexcept;
280 operator NVGpaint()
const noexcept;
327 void beginFrame(
const uint width,
const uint height,
const float scaleFactor = 1.0f);
375 void strokeColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
381 void strokeColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
397 void fillColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
403 void fillColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
425 void lineCap(LineCap cap = BUTT);
431 void lineJoin(LineCap join = MITER);
454 void transform(
float a,
float b,
float c,
float d,
float e,
float f);
469 void skewX(
float angle);
474 void skewY(
float angle);
479 void scale(
float x,
float y);
542 static void transformPoint(
float& dstx,
float& dsty,
const float xform[6],
float srcx,
float srcy);
584 NanoImage::Handle
createImageFromRGBA(uint w, uint h,
const uchar* data, ImageFlags imageFlags);
622 Paint
boxGradient(
float x,
float y,
float w,
float h,
float r,
float f,
const Color& icol,
const Color& ocol);
636 Paint
imagePattern(
float ox,
float oy,
float ex,
float ey,
float angle,
const NanoImage& image,
float alpha);
645 void scissor(
float x,
float y,
float w,
float h);
673 void moveTo(
float x,
float y);
678 void lineTo(
float x,
float y);
683 void bezierTo(
float c1x,
float c1y,
float c2x,
float c2y,
float x,
float y);
688 void quadTo(
float cx,
float cy,
float x,
float y);
693 void arcTo(
float x1,
float y1,
float x2,
float y2,
float radius);
710 void arc(
float cx,
float cy,
float r,
float a0,
float a1, Winding dir);
715 void rect(
float x,
float y,
float w,
float h);
720 void roundedRect(
float x,
float y,
float w,
float h,
float r);
725 void ellipse(
float cx,
float cy,
float rx,
float ry);
730 void circle(
float cx,
float cy,
float r);
807 float text(
float x,
float y,
const char*
string,
const char* end);
815 void textBox(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end =
nullptr);
829 void textBoxBounds(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end,
float bounds[4]);
835 int textGlyphPositions(
float x,
float y,
const char*
string,
const char* end, GlyphPosition& positions,
int maxPositions);
841 void textMetrics(
float* ascender,
float* descender,
float* lineh);
848 int textBreakLines(
const char*
string,
const char* end,
float breakRowWidth, TextRow& rows,
int maxRows);
850 #ifndef DGL_NO_SHARED_RESOURCES
858 NVGcontext*
const fContext;
861 friend class BlendishWidget;
863 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoVG)
910 PrivateData*
const nData;
916 void onDisplay()
override;
919 void beginFrame(uint,uint) {}
920 void beginFrame(uint,uint,
float) {}
921 void beginFrame(
Widget*) {}
922 void cancelFrame() {}
925 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoWidget)
932 #endif // DGL_NANO_WIDGET_HPP_INCLUDED
static void transformPoint(float &dstx, float &dsty, const float xform[6], float srcx, float srcy)
NVGcontext * getContext() const noexcept
Definition: NanoVG.hpp:319
void textAlign(Align align)
Definition: NanoVG.hpp:289
void textBox(float x, float y, float breakRowWidth, const char *string, const char *end=nullptr)
Definition: NanoVG.hpp:48
void lineTo(float x, float y)
void globalAlpha(float alpha)
static void transformScale(float dst[6], float sx, float sy)
NanoImage::Handle createImageFromMemory(uchar *data, uint dataSize, ImageFlags imageFlags)
void currentTransform(float xform[6])
void circle(float cx, float cy, float r)
int textBreakLines(const char *string, const char *end, float breakRowWidth, TextRow &rows, int maxRows)
static void transformMultiply(float dst[6], const float src[6])
void fontSize(float size)
FontId createFontFromMemory(const char *name, const uchar *data, uint dataSize, bool freeData)
void intersectScissor(float x, float y, float w, float h)
void textBoxBounds(float x, float y, float breakRowWidth, const char *string, const char *end, float bounds[4])
int textGlyphPositions(float x, float y, const char *string, const char *end, GlyphPosition &positions, int maxPositions)
void miterLimit(float limit)
Definition: Window.hpp:36
void strokeWidth(float size)
Paint linearGradient(float sx, float sy, float ex, float ey, const Color &icol, const Color &ocol)
void translate(float x, float y)
static void transformPremultiply(float dst[6], const float src[6])
void arcTo(float x1, float y1, float x2, float y2, float radius)
void scale(float x, float y)
static void transformSkewX(float dst[6], float a)
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)
Definition: NanoVG.hpp:219
void fontBlur(float blur)
void strokePaint(const Paint &paint)
virtual void loadSharedResources()
NanoImage::Handle createImageFromFile(const char *filename, ImageFlags imageFlags)
void fontFaceId(FontId font)
void moveTo(float x, float y)
void transform(float a, float b, float c, float d, float e, float f)
void ellipse(float cx, float cy, float rx, float ry)
void bezierTo(float c1x, float c1y, float c2x, float c2y, float x, float y)
void fontFace(const char *font)
NanoVG(int flags=CREATE_ANTIALIAS)
Definition: Geometry.hpp:30
Definition: NanoVG.hpp:213
FontId findFont(const char *name)
void beginFrame(const uint width, const uint height, const float scaleFactor=1.0f)
Definition: NanoVG.hpp:265
void pathWinding(Winding dir)
Definition: NanoVG.hpp:206
void textLineHeight(float lineHeight)
static void transformIdentity(float dst[6])
Size< uint > getSize() const noexcept
float textBounds(float x, float y, const char *string, const char *end, Rectangle< float > &bounds)
static float radToDeg(float rad)
Definition: NanoVG.hpp:283
static void transformSkewY(float dst[6], float a)
static int transformInverse(float dst[6], const float src[6])
void roundedRect(float x, float y, float w, float h, float r)
NanoImage::Handle createImageFromRGBA(uint w, uint h, const uchar *data, ImageFlags imageFlags)
FontId createFontFromFile(const char *name, const char *filename)
static float degToRad(float deg)
static void transformTranslate(float dst[6], float tx, float ty)
Definition: NanoVG.hpp:224
void arc(float cx, float cy, float r, float a0, float a1, Winding dir)
void lineCap(LineCap cap=BUTT)
NanoImage & operator=(const Handle &handle)
float text(float x, float y, const char *string, const char *end)
void lineJoin(LineCap join=MITER)
GLuint getTextureHandle() const
void fillColor(const Color &color)
void scissor(float x, float y, float w, float h)
void strokeColor(const Color &color)
void textMetrics(float *ascender, float *descender, float *lineh)
void quadTo(float cx, float cy, float x, float y)
void fillPaint(const Paint &paint)
bool isValid() const noexcept
static void transformRotate(float dst[6], float a)
CreateFlags
Definition: NanoVG.hpp:209
Paint boxGradient(float x, float y, float w, float h, float r, float f, const Color &icol, const Color &ocol)
NanoImage::Handle createImageFromTextureHandle(GLuint textureId, uint w, uint h, ImageFlags imageFlags, bool deleteTexture=false)
void textLetterSpacing(float spacing)
Paint imagePattern(float ox, float oy, float ex, float ey, float angle, const NanoImage &image, float alpha)