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"
27 # pragma warning(push)
28 # pragma warning(disable:4661)
31 #ifndef DGL_NO_SHARED_RESOURCES
32 # define NANOVG_DEJAVU_SANS_TTF "__dpf_dejavusans_ttf__"
52 NVGcontext* nvgCreateGL(
int flags);
74 Handle(NVGcontext* c,
int id) noexcept
123 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoImage)
228 CREATE_ANTIALIAS = 1 << 0,
234 CREATE_STENCIL_STROKES = 1 << 1,
239 CREATE_DEBUG = 1 << 2,
243 IMAGE_GENERATE_MIPMAPS = 1 << 0,
244 IMAGE_REPEAT_X = 1 << 1,
245 IMAGE_REPEAT_Y = 1 << 2,
246 IMAGE_FLIP_Y = 1 << 3,
247 IMAGE_PREMULTIPLIED = 1 << 4
253 ALIGN_CENTER = 1 << 1,
254 ALIGN_RIGHT = 1 << 2,
257 ALIGN_MIDDLE = 1 << 4,
258 ALIGN_BOTTOM = 1 << 5,
259 ALIGN_BASELINE = 1 << 6
294 Paint(
const NVGpaint&) noexcept;
295 operator NVGpaint()
const noexcept;
343 void beginFrame(
const uint width,
const uint height,
const float scaleFactor = 1.0f);
391 void strokeColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
397 void strokeColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
413 void fillColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
419 void fillColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
475 void transform(
float a,
float b,
float c,
float d,
float e,
float f);
563 static void transformPoint(
float& dstx,
float& dsty,
const float xform[6],
float srcx,
float srcy);
606 ImageFlags imageFlags, ImageFormat format);
614 int imageFlags, ImageFormat format);
680 void scissor(
float x,
float y,
float w,
float h);
718 void bezierTo(
float c1x,
float c1y,
float c2x,
float c2y,
float x,
float y);
723 void quadTo(
float cx,
float cy,
float x,
float y);
728 void arcTo(
float x1,
float y1,
float x2,
float y2,
float radius);
745 void arc(
float cx,
float cy,
float r,
float a0,
float a1, Winding dir);
750 void rect(
float x,
float y,
float w,
float h);
760 void ellipse(
float cx,
float cy,
float rx,
float ry);
765 void circle(
float cx,
float cy,
float r);
842 float text(
float x,
float y,
const char*
string,
const char* end);
850 void textBox(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end =
nullptr);
864 void textBoxBounds(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end,
float bounds[4]);
876 void textMetrics(
float* ascender,
float* descender,
float* lineh);
885 #ifndef DGL_NO_SHARED_RESOURCES
893 NVGcontext*
const fContext;
897 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoVG)
910 template <
class BaseW
idget>
966 void onDisplay()
override;
969 void beginFrame(uint,uint) {}
970 void beginFrame(uint,uint,
float) {}
971 void beginFrame(
Widget*) {}
972 void cancelFrame() {}
976 const bool fUsingParentContext;
977 void displayChildren();
988 DISTRHO_DEPRECATED_BY(
"NanoSubWidget")
996 # pragma warning(pop)
Definition: Application.hpp:43
Definition: NanoVG.hpp:64
GLuint getTextureHandle() const
bool isValid() const noexcept
NanoImage & operator=(const Handle &handle)
Size< uint > getSize() const noexcept
NanoImage(const Handle &handle)
Definition: NanoVG.hpp:222
Paint imagePattern(float ox, float oy, float ex, float ey, float angle, const NanoImage &image, float alpha)
static void transformTranslate(float dst[6], float tx, float ty)
void intersectScissor(float x, float y, float w, float h)
static void transformPremultiply(float dst[6], const float src[6])
Paint boxGradient(float x, float y, float w, float h, float r, float f, const Color &icol, const Color &ocol)
void textBox(float x, float y, float breakRowWidth, const char *string, const char *end=nullptr)
static float radToDeg(float rad)
static void transformSkewX(float dst[6], float a)
Paint radialGradient(float cx, float cy, float inr, float outr, const Color &icol, const Color &ocol)
void rect(float x, float y, float w, float h)
FontId createFontFromFile(const char *name, const char *filename)
void ellipse(float cx, float cy, float rx, float ry)
virtual bool loadSharedResources()
void strokeColor(const float red, const float green, const float blue, const float alpha=1.0f)
void fontFace(const char *font)
void fontSize(float size)
float textBounds(float x, float y, const char *string, const char *end, Rectangle< float > &bounds)
NanoImage::Handle createImageFromFile(const char *filename, ImageFlags imageFlags)
void fontFaceId(FontId font)
FontId createFontFromMemory(const char *name, const uchar *data, uint dataSize, bool freeData)
NanoVG(NVGcontext *context)
NanoImage::Handle createImageFromRawMemory(uint w, uint h, const uchar *data, ImageFlags imageFlags, ImageFormat format)
void fillColor(const float red, const float green, const float blue, const float alpha=1.0f)
void strokeWidth(float size)
static void transformMultiply(float dst[6], const float src[6])
static void transformRotate(float dst[6], float a)
void bezierTo(float c1x, float c1y, float c2x, float c2y, float x, float y)
void textBoxBounds(float x, float y, float breakRowWidth, const char *string, const char *end, float bounds[4])
CreateFlags
Definition: NanoVG.hpp:224
void arc(float cx, float cy, float r, float a0, float a1, Winding dir)
void textMetrics(float *ascender, float *descender, float *lineh)
void strokeColor(const int red, const int green, const int blue, const int alpha=255)
void lineTo(float x, float y)
NanoImage::Handle createImageFromRGBA(uint w, uint h, const uchar *data, ImageFlags imageFlags)
NanoImage::Handle createImageFromMemory(const uchar *data, uint dataSize, int imageFlags)
void lineJoin(LineCap join=MITER)
NanoImage::Handle createImageFromFile(const char *filename, int imageFlags)
void scale(float x, float y)
void beginFrame(Widget *const widget)
NanoVG(int flags=CREATE_ANTIALIAS)
void scissor(float x, float y, float w, float h)
static void transformIdentity(float dst[6])
NanoImage::Handle createImageFromMemory(const uchar *data, uint dataSize, ImageFlags imageFlags)
void miterLimit(float limit)
NVGcontext * getContext() const noexcept
Definition: NanoVG.hpp:335
void strokePaint(const Paint &paint)
static void transformScale(float dst[6], float sx, float sy)
void lineCap(LineCap cap=BUTT)
void textAlign(int align)
void fillColor(const Color &color)
void fillColor(const int red, const int green, const int blue, const int alpha=255)
void textAlign(Align align)
void fontBlur(float blur)
void circle(float cx, float cy, float r)
NanoImage::Handle createImageFromTextureHandle(GLuint textureId, uint w, uint h, int imageFlags, bool deleteTexture=false)
Paint linearGradient(float sx, float sy, float ex, float ey, const Color &icol, const Color &ocol)
void textLineHeight(float lineHeight)
void pathWinding(Winding dir)
int textBreakLines(const char *string, const char *end, float breakRowWidth, TextRow &rows, int maxRows)
void translate(float x, float y)
void globalTint(Color tint)
NanoImage::Handle createImageFromRGBA(uint w, uint h, const uchar *data, int imageFlags)
static int transformInverse(float dst[6], const float src[6])
void beginFrame(const uint width, const uint height, const float scaleFactor=1.0f)
void roundedRect(float x, float y, float w, float h, float r)
void fillPaint(const Paint &paint)
void globalAlpha(float alpha)
void strokeColor(const Color &color)
void transform(float a, float b, float c, float d, float e, float f)
void quadTo(float cx, float cy, float x, float y)
void currentTransform(float xform[6])
void textLetterSpacing(float spacing)
NanoImage::Handle createImageFromRawMemory(uint w, uint h, const uchar *data, int imageFlags, ImageFormat format)
static void transformPoint(float &dstx, float &dsty, const float xform[6], float srcx, float srcy)
static float degToRad(float deg)
int textGlyphPositions(float x, float y, const char *string, const char *end, GlyphPosition &positions, int maxPositions)
void arcTo(float x1, float y1, float x2, float y2, float radius)
void moveTo(float x, float y)
static void transformSkewY(float dst[6], float a)
NanoImage::Handle createImageFromTextureHandle(GLuint textureId, uint w, uint h, ImageFlags imageFlags, bool deleteTexture=false)
float text(float x, float y, const char *string, const char *end)
FontId findFont(const char *name)
Definition: Geometry.hpp:614
Definition: Geometry.hpp:133
Definition: StandaloneWindow.hpp:29
Definition: Window.hpp:63
Definition: NanoVG.hpp:298
Definition: NanoVG.hpp:280
Definition: NanoVG.hpp:304