iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | List of all members
IGraphicsNanoVG Class Reference

IGraphics draw class using NanoVG
More...

#include <IGraphicsNanoVG.h>

Inheritance diagram for IGraphicsNanoVG:
[legend]

Classes

class  Bitmap
 

Public Member Functions

 IGraphicsNanoVG (IGEditorDelegate &dlg, int w, int h, int fps, float scale)
 
const char * GetDrawingAPIStr () override
 
void BeginFrame () override
 Called at the beginning of drawing. More...
 
void EndFrame () override
 Called by some drawing API classes to finally blit the draw bitmap onto the screen or perform other cleanup after drawing. More...
 
void OnViewInitialized (void *pContext) override
 Called after platform view initialization, so that drawing classes can e.g. More...
 
void OnViewDestroyed () override
 Called after a platform view is destroyed, so that drawing classes can e.g. More...
 
void DrawResize () override
 
void DrawBitmap (const IBitmap &bitmap, const IRECT &dest, int srcX, int srcY, const IBlend *pBlend) override
 Draw a bitmap (raster) image to the graphics context. More...
 
void DrawDottedLine (const IColor &color, float x1, float y1, float x2, float y2, const IBlend *pBlend, float thickness, float dashLen) override
 Draw a dotted line to the graphics context. More...
 
void DrawDottedRect (const IColor &color, const IRECT &bounds, const IBlend *pBlend, float thickness, float dashLen) override
 Draw a dotted rectangle to the graphics context. More...
 
void DrawFastDropShadow (const IRECT &innerBounds, const IRECT &outerBounds, float xyDrop=5.f, float roundness=0.f, float blur=10.f, IBlend *pBlend=nullptr) override
 NanoVG only. More...
 
void DrawMultiLineText (const IText &text, const char *str, IRECT &bounds, const IBlend *pBlend) override
 Draw some multi-line text to the graphics context in a specific rectangle (NanoVG only) More...
 
void PathClear () override
 Clear the stack of path drawing commands. More...
 
void PathClose () override
 Close the path that is being specified. More...
 
void PathArc (float cx, float cy, float r, float a1, float a2, EWinding winding) override
 Add an arc to the current path. More...
 
void PathMoveTo (float x, float y) override
 Move the current point in the current path. More...
 
void PathLineTo (float x, float y) override
 Add a line to the current path from the current point to the specified location. More...
 
void PathCubicBezierTo (float c1x, float c1y, float c2x, float c2y, float x2, float y2) override
 Add a cubic bezier to the current path from the current point to the specified location. More...
 
void PathQuadraticBezierTo (float cx, float cy, float x2, float y2) override
 Add a quadratic bezier to the current path from the current point to the specified location. More...
 
void PathSetWinding (bool clockwise) override
 NanoVG only. More...
 
void PathStroke (const IPattern &pattern, float thickness, const IStrokeOptions &options, const IBlend *pBlend) override
 Stroke the current current path. More...
 
void PathFill (const IPattern &pattern, const IFillOptions &options, const IBlend *pBlend) override
 Fill the current current path. More...
 
IColor GetPoint (int x, int y) override
 Get the color at an X, Y location in the graphics context. More...
 
void * GetDrawContext () override
 Gets a void pointer to underlying drawing context, for the IGraphics backend See draw class implementation headers (e.g. More...
 
IBitmap LoadBitmap (const char *name, int nStates, bool framesAreHorizontal, int targetScale) override
 Load a bitmap image from disk or from windows resource. More...
 
void ReleaseBitmap (const IBitmap &bitmap) override
 Releases an IBitmap from the cache/static storage. More...
 
void RetainBitmap (const IBitmap &bitmap, const char *cacheName) override
 Adds an IBitmap to the cache/static storage. More...
 
bool BitmapExtSupported (const char *ext) override
 Checks a file extension and reports whether this drawing API supports loading that extension. More...
 
void DeleteFBO (NVGframebuffer *pBuffer)
 
- Public Member Functions inherited from IGraphics
virtual void BeginFrame ()
 Called at the beginning of drawing. More...
 
virtual void OnViewInitialized (void *pContext)
 Called after platform view initialization, so that drawing classes can e.g. More...
 
virtual void OnViewDestroyed ()
 Called after a platform view is destroyed, so that drawing classes can e.g. More...
 
virtual void EndFrame ()
 Called by some drawing API classes to finally blit the draw bitmap onto the screen or perform other cleanup after drawing. More...
 
virtual void DrawSVG (const ISVG &svg, const IRECT &bounds, const IBlend *pBlend=0, const IColor *pStrokeColor=nullptr, const IColor *pFillColor=nullptr)
 Draw an SVG image to the graphics context. More...
 
virtual void DrawRotatedSVG (const ISVG &svg, float destCentreX, float destCentreY, float width, float height, double angle, const IBlend *pBlend=0)
 Draw an SVG image to the graphics context with rotation. More...
 
virtual void DrawBitmap (const IBitmap &bitmap, const IRECT &bounds, int srcX, int srcY, const IBlend *pBlend=0)=0
 Draw a bitmap (raster) image to the graphics context. More...
 
virtual void DrawFittedBitmap (const IBitmap &bitmap, const IRECT &bounds, const IBlend *pBlend=0)
 Draw a bitmap (raster) image to the graphics context, scaling the image to fit the bounds. More...
 
virtual void DrawRotatedBitmap (const IBitmap &bitmap, float destCentreX, float destCentreY, double angle, const IBlend *pBlend=0)
 Draw a bitmap (raster) image to the graphics context with rotation. More...
 
virtual void DrawPoint (const IColor &color, float x, float y, const IBlend *pBlend=0)
 Fill a rectangle corresponding to a pixel on a 1:1 screen with a color. More...
 
virtual void DrawLine (const IColor &color, float x1, float y1, float x2, float y2, const IBlend *pBlend=0, float thickness=1.f)
 Draw a line to the graphics context. More...
 
virtual void DrawDottedLine (const IColor &color, float x1, float y1, float x2, float y2, const IBlend *pBlend=0, float thickness=1.f, float dashLen=2.f)
 Draw a dotted line to the graphics context. More...
 
virtual void DrawTriangle (const IColor &color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend *pBlend=0, float thickness=1.f)
 Draw a triangle to the graphics context. More...
 
virtual void DrawRect (const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
 Draw a rectangle to the graphics context. More...
 
virtual void DrawRoundRect (const IColor &color, const IRECT &bounds, float cornerRadius=5.f, const IBlend *pBlend=0, float thickness=1.f)
 Draw a rounded rectangle to the graphics context. More...
 
virtual void DrawRoundRect (const IColor &color, const IRECT &bounds, float cRTL, float cRTR, float cRBR, float cRBL, const IBlend *pBlend=0, float thickness=1.f)
 Draw a rounded rectangle to the graphics context with individual corner roundness. More...
 
virtual void DrawArc (const IColor &color, float cx, float cy, float r, float a1, float a2, const IBlend *pBlend=0, float thickness=1.f)
 Draw an arc to the graphics context. More...
 
virtual void DrawCircle (const IColor &color, float cx, float cy, float r, const IBlend *pBlend=0, float thickness=1.f)
 Draw a circle to the graphics context. More...
 
virtual void DrawEllipse (const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
 Draw an ellipse within a rectangular region of the graphics context. More...
 
virtual void DrawEllipse (const IColor &color, float x, float y, float r1, float r2, float angle=0.0, const IBlend *pBlend=0, float thickness=1.f)
 Draw an ellipse around a central point given two radii and an angle of orientation. More...
 
virtual void DrawConvexPolygon (const IColor &color, float *x, float *y, int nPoints, const IBlend *pBlend=0, float thickness=1.f)
 Draw a convex polygon to the graphics context. More...
 
virtual void DrawDottedRect (const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f, float dashLen=2.f)
 Draw a dotted rectangle to the graphics context. More...
 
virtual void FillTriangle (const IColor &color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend *pBlend=0)
 Fill a triangle with a color. More...
 
virtual void FillRect (const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
 Fill a rectangular region of the graphics context with a color. More...
 
virtual void FillRoundRect (const IColor &color, const IRECT &bounds, float cornerRadius=5.f, const IBlend *pBlend=0)
 Fill a rounded rectangle with a color. More...
 
virtual void FillRoundRect (const IColor &color, const IRECT &bounds, float cRTL, float cRTR, float cRBR, float cRBL, const IBlend *pBlend=0)
 Fill a rounded rectangle with a color. More...
 
virtual void FillCircle (const IColor &color, float cx, float cy, float r, const IBlend *pBlend=0)
 Fill a circle with a color. More...
 
virtual void FillEllipse (const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
 Fill an ellipse within a rectangular region of the graphics context. More...
 
virtual void FillEllipse (const IColor &color, float x, float y, float r1, float r2, float angle=0.0, const IBlend *pBlend=0)
 Fill an ellipse. More...
 
virtual void FillArc (const IColor &color, float cx, float cy, float r, float a1, float a2, const IBlend *pBlend=0)
 Fill an arc segment with a color. More...
 
virtual void FillConvexPolygon (const IColor &color, float *x, float *y, int nPoints, const IBlend *pBlend=0)
 Fill a convex polygon with a color. More...
 
void DrawText (const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=0)
 Draw some text to the graphics context in a specific rectangle. More...
 
void DrawText (const IText &text, const char *str, float x, float y, const IBlend *pBlend=0)
 Draw some text to the graphics context at a point. More...
 
virtual float MeasureText (const IText &text, const char *str, IRECT &bounds) const
 Measure the rectangular region that some text will occupy. More...
 
virtual void DrawMultiLineText (const IText &text, const char *str, IRECT &bounds, const IBlend *pBlend=0)
 Draw some multi-line text to the graphics context in a specific rectangle (NanoVG only) More...
 
virtual IColor GetPoint (int x, int y)=0
 Get the color at an X, Y location in the graphics context. More...
 
virtual void * GetDrawContext ()=0
 Gets a void pointer to underlying drawing context, for the IGraphics backend See draw class implementation headers (e.g. More...
 
virtual const char * GetDrawingAPIStr ()=0
 
virtual IBitmap ScaleBitmap (const IBitmap &inBitmap, const char *cacheName, int targetScale)
 Returns a new IBitmap, an integer scaled version of the input, and adds it to the cache. More...
 
virtual void RetainBitmap (const IBitmap &bitmap, const char *cacheName)
 Adds an IBitmap to the cache/static storage. More...
 
virtual void ReleaseBitmap (const IBitmap &bitmap)
 Releases an IBitmap from the cache/static storage. More...
 
IBitmap GetScaledBitmap (IBitmap &inBitmap)
 Get a version of the input bitmap from the cache that corresponds to the current screen scale For example, when IControl::OnRescale() is called bitmap-based IControls can load in. More...
 
virtual bool BitmapExtSupported (const char *ext)=0
 Checks a file extension and reports whether this drawing API supports loading that extension. More...
 
virtual void DrawFastDropShadow (const IRECT &innerBounds, const IRECT &outerBounds, float xyDrop=5.f, float roundness=0.f, float blur=10.f, IBlend *pBlend=nullptr)
 NanoVG only. More...
 
void DrawBitmap (const IBitmap &bitmap, const IRECT &bounds, int frame=1, const IBlend *pBlend=0)
 Draws a bitmap into the graphics context. More...
 
void DrawBitmapedText (const IBitmap &bitmap, const IRECT &bounds, IText &text, IBlend *pBlend, const char *str, bool vCenter=true, bool multiline=false, int charWidth=6, int charHeight=12, int charOffset=0)
 Draws mono spaced bitmap text. More...
 
void DrawLineAcross (const IColor &color, const IRECT &bounds, EDirection dir, float pos, const IBlend *pBlend=0, float thickness=1.f)
 Draw a horzional or vertical line, within a rectangular region of the graphics context. More...
 
void DrawVerticalLine (const IColor &color, const IRECT &bounds, float x, const IBlend *pBlend=0, float thickness=1.f)
 Draw a vertical line, within a rectangular region of the graphics context. More...
 
void DrawHorizontalLine (const IColor &color, const IRECT &bounds, float y, const IBlend *pBlend=0, float thickness=1.f)
 Draw a horizontal line, within a rectangular region of the graphics context. More...
 
void DrawVerticalLine (const IColor &color, float xi, float yLo, float yHi, const IBlend *pBlend=0, float thickness=1.f)
 Draw a clipped vertical line at a position bounds. More...
 
void DrawHorizontalLine (const IColor &color, float yi, float xLo, float xHi, const IBlend *pBlend=0, float thickness=1.f)
 Draw a clipped horizontal line at a position bounds. More...
 
void DrawRadialLine (const IColor &color, float cx, float cy, float angle, float rMin, float rMax, const IBlend *pBlend=0, float thickness=1.f)
 Draw a radial line to the graphics context, useful for pointers on dials. More...
 
virtual void DrawGrid (const IColor &color, const IRECT &bounds, float gridSizeH, float gridSizeV, const IBlend *pBlend=0, float thickness=1.f)
 Draw a grid to the graphics context. More...
 
virtual void DrawData (const IColor &color, const IRECT &bounds, float *normYPoints, int nPoints, float *normXPoints=nullptr, const IBlend *pBlend=0, float thickness=1.f, const IColor *pFillColor=nullptr)
 Draw a line between a collection of normalized points. More...
 
virtual bool LoadFont (const char *fontID, const char *fileNameOrResID)
 Load a font to be used by the graphics context. More...
 
virtual bool LoadFont (const char *fontID, void *pData, int dataSize)
 Load a font from in-memory data to be used by the graphics context. More...
 
bool LoadFont (const char *fontID, const char *fontName, ETextStyle style)
 Load a font with a particular style (bold, italic) from a font file. More...
 
void StartLayer (IControl *pOwner, const IRECT &r, bool cacheable=false)
 Create an IGraphics layer. More...
 
void ResumeLayer (ILayerPtr &layer)
 If a layer already exists, continue drawing to it. More...
 
ILayerPtr EndLayer ()
 End an IGraphics layer. More...
 
bool CheckLayer (const ILayerPtr &layer)
 Test to see if a layer needs drawing, for instance if the control's bounds were changed. More...
 
void DrawLayer (const ILayerPtr &layer, const IBlend *pBlend=nullptr)
 Draw a layer to the main IGraphics context. More...
 
void DrawFittedLayer (const ILayerPtr &layer, const IRECT &bounds, const IBlend *pBlend)
 Draw a layer to the main IGraphics context, fitting it to a rectangle that is different to the layer's bounds. More...
 
void DrawRotatedLayer (const ILayerPtr &layer, double angle)
 Draw a layer to the main IGraphics context, with rotation. More...
 
void ApplyLayerDropShadow (ILayerPtr &layer, const IShadow &shadow)
 Applies a drop shadow directly onto a layer. More...
 
virtual void GetLayerBitmapData (const ILayerPtr &layer, RawBitmapData &data)=0
 Get the contents of a layer as Raw RGBA bitmap data NOTE: you should only call this within IControl::Draw() More...
 
virtual void PathClear ()=0
 Clear the stack of path drawing commands. More...
 
virtual void PathClose ()=0
 Close the path that is being specified. More...
 
void PathLine (float x1, float y1, float x2, float y2)
 Add a line to the current path. More...
 
void PathRadialLine (float cx, float cy, float angle, float rMin, float rMax)
 Add a radial line to the current path. More...
 
void PathTriangle (float x1, float y1, float x2, float y2, float x3, float y3)
 Add a triangle to the current path. More...
 
void PathRect (const IRECT &bounds)
 Add a rectangle to the current path. More...
 
void PathRoundRect (const IRECT &bounds, float ctl, float ctr, float cbl, float cbr)
 Add a rounded rectangle to the current path, with independent corner roundness. More...
 
void PathRoundRect (const IRECT &bounds, float cornerRadius=5.f)
 Add a rounded rectangle to the current path. More...
 
virtual void PathArc (float cx, float cy, float r, float a1, float a2, EWinding winding=EWinding::CW)=0
 Add an arc to the current path. More...
 
void PathCircle (float cx, float cy, float r)
 Add a circle to the current path. More...
 
void PathEllipse (const IRECT &bounds)
 Add an ellipse to the current path, specifying the rectangular region. More...
 
void PathEllipse (float x, float y, float r1, float r2, float angle=0.0)
 Add an ellipse to the current path. More...
 
void PathConvexPolygon (float *x, float *y, int nPoints)
 Add a convex polygon to the current path. More...
 
virtual void PathMoveTo (float x, float y)=0
 Move the current point in the current path. More...
 
virtual void PathLineTo (float x, float y)=0
 Add a line to the current path from the current point to the specified location. More...
 
virtual void PathSetWinding (bool clockwise)
 NanoVG only. More...
 
virtual void PathCubicBezierTo (float c1x, float c1y, float c2x, float c2y, float x2, float y2)=0
 Add a cubic bezier to the current path from the current point to the specified location. More...
 
virtual void PathQuadraticBezierTo (float cx, float cy, float x2, float y2)=0
 Add a quadratic bezier to the current path from the current point to the specified location. More...
 
virtual void PathStroke (const IPattern &pattern, float thickness, const IStrokeOptions &options=IStrokeOptions(), const IBlend *pBlend=0)=0
 Stroke the current current path. More...
 
virtual void PathFill (const IPattern &pattern, const IFillOptions &options=IFillOptions(), const IBlend *pBlend=0)=0
 Fill the current current path. More...
 
void PathTransformSave ()
 Save the current affine transform of the current path. More...
 
void PathTransformRestore ()
 Restore the affine transform of the current path, to the previously saved state. More...
 
void PathTransformReset (bool clearStates=false)
 Reset the affine transform of the current path, to the default state. More...
 
void PathTransformTranslate (float x, float y)
 Apply a translation transform to the current path. More...
 
void PathTransformScale (float x, float y)
 Apply a scale transform to the current path, with independant x, y scales. More...
 
void PathTransformScale (float scale)
 Apply a scale transform to the current path, with independant x, y scales. More...
 
void PathTransformRotate (float angle)
 Apply a rotation transform to the current path. More...
 
void PathTransformSkew (float xAngle, float yAngle)
 Apply a skew transform to the current path. More...
 
void PathTransformMatrix (const IMatrix &matrix)
 Apply an arbitary affine transform matrix to the current path. More...
 
void PathClipRegion (const IRECT r=IRECT())
 Clip the current path to a particular region. More...
 
virtual void PathTransformSetMatrix (const IMatrix &matrix)=0
 
void DoTextRotation (const IText &text, const IRECT &bounds, const IRECT &rect)
 
virtual void AttachPlatformView (const IRECT &r, void *pView)
 Add an OS view as a sub-view, on top of the IGraphics view. More...
 
virtual void RemovePlatformView (void *pView)
 Remove a previously attached platform view from the IGraphics view. More...
 
virtual void HidePlatformView (void *pView, bool hide)
 Hide a previously attached platform view from the IGraphics view. More...
 
virtual void GetMouseLocation (float &x, float &y) const =0
 Get the x, y position of the mouse cursor. More...
 
virtual void HideMouseCursor (bool hide=true, bool lock=true)=0
 Call to hide/show the mouse cursor. More...
 
virtual void MoveMouseCursor (float x, float y)=0
 Force move the mouse cursor to a specific position. More...
 
virtual ECursor SetMouseCursor (ECursor cursorType=ECursor::ARROW)
 Sets the mouse cursor to one of ECursor (implementations should return the result of the base implementation) More...
 
virtual void ForceEndUserEdit ()=0
 Call to force end text entry (will cancel any half input text. More...
 
virtual void * OpenWindow (void *pParentWnd)=0
 Open a new platform view for this graphics context. More...
 
virtual void CloseWindow ()=0
 Close the platform view for this graphics context.
 
virtual void * GetWindow ()=0
 Get a pointer to the platform view e.g. More...
 
virtual bool WindowIsOpen ()
 
virtual bool GetTextFromClipboard (WDL_String &str)=0
 Get text from the clipboard. More...
 
virtual bool SetTextInClipboard (const char *str)=0
 Set text in the clipboard. More...
 
virtual bool SetFilePathInClipboard (const char *path)
 Set a file path in the clipboard. More...
 
virtual bool InitiateExternalFileDragDrop (const char *path, const IRECT &iconBounds)
 Initiate an drag-n-drop operation of an existing file, to be dropped outside of the current window. More...
 
virtual void UpdateTooltips ()=0
 Call this if you modify control tool tips at runtime. More...
 
virtual EMsgBoxResult ShowMessageBox (const char *str, const char *title, EMsgBoxType type, IMsgBoxCompletionHandlerFunc completionHandler=nullptr)=0
 Pop up a modal platform message box dialog. More...
 
virtual void PromptForFile (WDL_String &fileName, WDL_String &path, EFileAction action=EFileAction::Open, const char *ext="", IFileDialogCompletionHandlerFunc completionHandler=nullptr)=0
 Create a platform file prompt dialog to choose a path for opening/saving a single file. More...
 
virtual void PromptForDirectory (WDL_String &dir, IFileDialogCompletionHandlerFunc completionHandler=nullptr)=0
 Create a platform file prompt dialog to choose a directory path for opening/saving a directory. More...
 
virtual bool PromptForColor (IColor &color, const char *str="", IColorPickerHandlerFunc func=nullptr)=0
 Create a platform color chooser dialog. More...
 
virtual bool OpenURL (const char *url, const char *msgWindowTitle=0, const char *confirmMsg=0, const char *errMsgOnFailure=0)=0
 Open a URL in the platform’s default browser. More...
 
virtual const char * GetPlatformAPIStr ()
 
virtual bool RevealPathInExplorerOrFinder (WDL_String &path, bool select=false)
 
virtual void SetWinModuleHandle (void *pHinstance)
 Used on Windows to set the HINSTANCE module handle, which allows graphics APIs to load resources from the binary. More...
 
virtual void * GetWinModuleHandle ()
 
void SetPlatformContext (void *pContext)
 Set the platform draw context Used in order to set the platform level draw context - CGContextRef context on macOS and the GDI HDC draw context handle on Windows. More...
 
void * GetPlatformContext ()
 Get the platform level draw context - an HDC or CGContextRef. More...
 
virtual void ClientToScreen (float &x, float &y)
 Convert an x, y position in the view to screen coordinates. More...
 
virtual PlatformFontPtr LoadPlatformFont (const char *fontID, const char *fileNameOrResID)=0
 Load a font from disk or resource in a platform format. More...
 
virtual PlatformFontPtr LoadPlatformFont (const char *fontID, void *pData, int dataSize)=0
 Load a font from data in memory. More...
 
virtual PlatformFontPtr LoadPlatformFont (const char *fontID, const char *fontName, ETextStyle style)=0
 Load a system font in a platform format. More...
 
virtual void CachePlatformFont (const char *fontID, const PlatformFontPtr &font)=0
 Called to indicate that the platform should cache data about the platform font if needed. More...
 
virtual const char * GetBundleID () const
 Get the bundle ID on macOS and iOS, returns emtpy string on other OSs. More...
 
virtual const char * GetAppGroupID () const
 Get the app group ID on macOS and iOS, returns emtpy string on other OSs. More...
 
 IGraphics (IGEditorDelegate &dlg, int w, int h, int fps=DEFAULT_FPS, float scale=1.)
 
 IGraphics (const IGraphics &)=delete
 
IGraphicsoperator= (const IGraphics &)=delete
 
void SetScreenScale (float scale)
 Called by the platform IGraphics class when moving to a new screen to set DPI. More...
 
void SetTranslation (float x, float y)
 Called by some platform IGraphics classes in order to translate the graphics context, in response to e.g. More...
 
bool IsDirty (IRECTList &rects)
 Called repeatedly at frame rate by the platform class to check what the graphics context says is dirty. More...
 
void Draw (IRECTList &rects)
 Called by the platform class indicating a number of rectangles in the UI that need to redraw. More...
 
void PromptUserInput (IControl &control, const IRECT &bounds, int valIdx=0)
 Prompt for user input either using a text entry or pop up menu. More...
 
void CreatePopupMenu (IControl &control, IPopupMenu &menu, const IRECT &bounds, int valIdx=0)
 Shows a pop up/contextual menu in relation to a rectangular region of the graphics context. More...
 
void CreatePopupMenu (IControl &control, IPopupMenu &menu, float x, float y, int valIdx=0)
 Shows a pop up/contextual menu at point. More...
 
void CreateTextEntry (IControl &control, const IText &text, const IRECT &bounds, const char *str="", int valIdx=0)
 Create a text entry box. More...
 
void SetControlValueAfterTextEdit (const char *str)
 Called by the platform class after returning from a text entry in order to update a control with a new value. More...
 
void SetControlValueAfterPopupMenu (IPopupMenu *pMenu)
 Called by PopupMenuControl in order to update a control with a new value after returning from the non-blocking menu. More...
 
void SetScaleConstraints (float lo, float hi)
 Sets the minimum and maximum (draw) scaling values. More...
 
void Resize (int w, int h, float scale, bool needsPlatformResize=true)
 
void SetStrictDrawing (bool strict)
 Enables strict drawing mode. More...
 
void SetLayoutOnResize (bool layoutOnResize)
 
int Width () const
 Gets the width of the graphics context. More...
 
int Height () const
 Gets the height of the graphics context. More...
 
int WindowWidth () const
 Gets the width of the graphics context including draw scaling. More...
 
int WindowHeight () const
 Gets the height of the graphics context including draw scaling. More...
 
int FPS () const
 Gets the drawing frame rate. More...
 
float GetDrawScale () const
 Gets the graphics context scaling factor. More...
 
float GetScreenScale () const
 Gets the screen/display scaling factor, e.g. More...
 
int GetRoundedScreenScale () const
 Gets the screen/display scaling factor, rounded up. More...
 
float GetTotalScale () const
 Gets the combined draw and screen/display scaling factor. More...
 
IRECT GetPixelSnapped (IRECT &r) const
 Gets the nearest backing pixel aligned rect to the input IRECT. More...
 
IGEditorDelegateGetDelegate ()
 Gets a pointer to the delegate class that handles communication to and from this graphics context. More...
 
IPopupMenuGetPromptMenu ()
 
bool IsInPlatformTextEntry ()
 
IControlGetControlInTextEntry ()
 
void ClearInTextEntryControl ()
 Called when the text entry is dismissed, to reset mInTextEntry. More...
 
bool TooltipsEnabled () const
 
EUIResizerMode GetResizerMode () const
 
bool GetResizingInProcess () const
 
bool EnableMultiTouch (bool enable)
 Enable/disable multi touch, if platform supports it. More...
 
bool MultiTouchEnabled () const
 
virtual bool PlatformSupportsMultiTouch () const
 
void EnableTooltips (bool enable)
 
void AssignParamNameToolTips ()
 Call this method in order to create tool tips for every IControl that show the associated parameter's name. More...
 
void ShowControlBounds (bool enable)
 
void ShowAreaDrawn (bool enable)
 
bool ShowAreaDrawnEnabled () const
 
bool ShowControlBoundsEnabled () const
 
void EnableLiveEdit (bool enable)
 Live edit mode allows you to relocate controls at runtime in debug builds. More...
 
bool LiveEditEnabled () const
 
IRECT GetBounds () const
 Returns an IRECT that represents the entire UI bounds This is useful for programatically arranging UI elements by slicing up the IRECT using the various IRECT methods. More...
 
void SetDisplayTickFunc (IDisplayTickFunc func)
 Sets a function that is called at the frame rate, prior to checking for dirty controls. More...
 
void SetUIAppearanceChangedFunc (IUIAppearanceChangedFunc func)
 Sets a function that is called when the OS appearance (light/dark mode) is changed. More...
 
void SetKeyHandlerFunc (IKeyHandlerFunc func)
 Set a function that is called when key presses are not intercepted by any controls. More...
 
void SetQwertyMidiKeyHandlerFunc (std::function< void(const IMidiMsg &msg)> func=nullptr)
 A helper to set the IGraphics KeyHandlerFunc in order to make an instrument playable via QWERTY keys. More...
 
bool RespondsToGesture (float x, float y)
 Called by platform class to see if the point at x, y is linked to a gesture recognizer. More...
 
void OnGestureRecognized (const IGestureInfo &info)
 Called by platform class when a gesture is recognized. More...
 
virtual float GetPlatformWindowScale () const
 Returns a scaling factor for resizing parent windows via the host/plugin API. More...
 
void ForAllControlsFunc (IControlFunction func)
 For all controls, including the "special controls" call a method. More...
 
template<typename T , typename... Args>
void ForAllControls (T method, Args... args)
 For all controls, including the "special controls" call a method. More...
 
void ForStandardControlsFunc (IControlFunction func)
 For all standard controls in the main control stack perform a function. More...
 
template<typename T , typename... Args>
void ForMatchingControls (T method, int paramIdx, Args... args)
 For all standard controls in the main control stack that are linked to a specific parameter, call a method. More...
 
void ForControlWithParam (int paramIdx, IControlFunction func)
 For all standard controls in the main control stack that are linked to a specific parameter, execute a function. More...
 
void ForControlWithParam (const std::initializer_list< int > &params, IControlFunction func)
 For all standard controls in the main control stack that are linked to one of several parameters, execute a function. More...
 
void ForControlInGroup (const char *group, IControlFunction func)
 For all standard controls in the main control stack that are linked to a group, execute a function. More...
 
void AttachBackground (const char *fileName)
 Attach an IBitmapControl as the lowest IControl in the control stack to be the background for the graphics context. More...
 
void AttachSVGBackground (const char *fileName)
 Attach an ISVGControl as the lowest IControl in the control stack to be the background for the graphics context. More...
 
void AttachPanelBackground (const IPattern &color)
 Attach an IPanelControl as the lowest IControl in the control stack to fill the background with a solid color. More...
 
void AttachCornerResizer (EUIResizerMode sizeMode=EUIResizerMode::Scale, bool layoutOnResize=false, const IColor &color=COLOR_TRANSLUCENT, const IColor &mouseOverColor=COLOR_BLACK, const IColor &dragColor=COLOR_BLACK, float size=20.f)
 Attach the default control to scale or increase the UI size by dragging the plug-in bottom right-hand corner. More...
 
void AttachCornerResizer (ICornerResizerControl *pControl, EUIResizerMode sizeMode=EUIResizerMode::Scale, bool layoutOnResize=false)
 Attach your own control to scale or increase the UI size by dragging the plug-in bottom right-hand corner. More...
 
void AttachPopupMenuControl (const IText &text=DEFAULT_TEXT, const IRECT &bounds=IRECT())
 Attach a control for pop-up menus, to override platform style menus. More...
 
void RemovePopupMenuControl ()
 Remove the IGraphics popup menu, use platform popup menu if available. More...
 
void AttachTextEntryControl ()
 Attach a control for text entry, to override platform text entry. More...
 
void RemoveTextEntryControl ()
 Remove the IGraphics text entry, use platform text entry if available. More...
 
void AttachBubbleControl (const IText &text=DEFAULT_TEXT)
 Attach the default control to show text as a control changes. More...
 
void AttachBubbleControl (IBubbleControl *pControl)
 Attach a custom control to show text as a control changes. More...
 
void ShowBubbleControl (IControl *pCaller, float x, float y, const char *str, EDirection dir=EDirection::Horizontal, IRECT minimumContentBounds=IRECT())
 
void ShowFPSDisplay (bool enable)
 Shows a control to display the frame rate of drawing. More...
 
bool ShowingFPSDisplay ()
 
IControlAttachControl (IControl *pControl, int ctrlTag=kNoTag, const char *group="")
 Attach an IControl to the graphics context and add it to the top of the control stack. More...
 
IControlGetControl (int idx)
 Get the control at a certain index in the control stack. More...
 
int GetControlIdx (IControl *pControl) const
 Get the index of a particular IControl in the control stack. More...
 
int GetIdxOfTaggedControl (int ctrlTag) const
 Gets the index of a tagged control. More...
 
IControlGetControlWithTag (int ctrlTag) const
 Get the control with a particular tag. More...
 
int GetControlTag (const IControl *pControl) const
 Get the tag given to a control. More...
 
IControlGetControlWithParamIdx (int paramIdx)
 Get the first control with a parameter index that matches paramIdx. More...
 
bool ControlIsCaptured () const
 Check to see if any control is captured. More...
 
bool ControlIsCaptured (IControl *pControl) const
 Check to see if the control is already captured. More...
 
void GetTouches (IControl *pControl, std::vector< ITouchID > &touchesOnThisControl) const
 Populate a vector with the touchIDs active on pControl. More...
 
IControlGetBackgroundControl ()
 
IPopupMenuControlGetPopupMenuControl ()
 
ITextEntryControlGetTextEntryControl ()
 
IBubbleControlGetBubbleControl (int i=0)
 
int NBubbleControls () const
 
void StyleAllVectorControls (const IVStyle &style)
 Helper method to style all of the controls which inherit IVectorBase. More...
 
void UpdatePeers (IControl *pCaller, int callerValIdx)
 This method is called after interacting with a control, so that any other controls linked to the same parameter index, will also be set dirty, and have their values updated. More...
 
int NControls () const
 
void RemoveControlWithTag (int ctrlTag)
 Remove controls from the control list with a particular tag. More...
 
void RemoveControls (int fromIdx)
 Remove controls from the control list above a particular index, (frees memory). More...
 
void RemoveControl (int idx)
 Remove a control at a particular index, (frees memory). More...
 
void RemoveControl (IControl *pControl)
 Remove a control at using ptr, (frees memory). More...
 
void RemoveAllControls ()
 Removes all regular IControls from the control list, as well as special controls (frees memory). More...
 
void HideControl (int paramIdx, bool hide)
 Hide controls linked to a specific parameter. More...
 
void DisableControl (int paramIdx, bool diable)
 Disable or enable controls linked to a specific parameter. More...
 
void SetAllControlsDirty ()
 Calls SetDirty() on every control. More...
 
void SetAllControlsClean ()
 Calls SetClean() on every control. More...
 
void SetControlPosition (IControl *pControl, float x, float y)
 Reposition a control, redrawing the interface correctly. More...
 
void SetControlSize (IControl *pControl, float w, float h)
 Resize a control, redrawing the interface correctly. More...
 
void SetControlBounds (IControl *pControl, const IRECT &r)
 Set a controls target and draw rect to r, redrawing the interface correctly. More...
 
void OnMouseDown (const std::vector< IMouseInfo > &points)
 Called when the platform class sends mouse down events. More...
 
void OnMouseUp (const std::vector< IMouseInfo > &points)
 Called when the platform class sends mouse up events. More...
 
void OnMouseDrag (const std::vector< IMouseInfo > &points)
 Called when the platform class sends drag events. More...
 
void OnTouchCancelled (const std::vector< IMouseInfo > &points)
 Called when the platform class sends touch cancel events. More...
 
bool OnMouseDblClick (float x, float y, const IMouseMod &mod)
 
void OnMouseWheel (float x, float y, const IMouseMod &mod, float delta)
 
bool OnKeyDown (float x, float y, const IKeyPress &key)
 
bool OnKeyUp (float x, float y, const IKeyPress &key)
 
bool OnMouseOver (float x, float y, const IMouseMod &mod)
 
void OnMouseOut ()
 Called when the mouse leaves the graphics context. More...
 
void OnSetCursor ()
 Called when the mouse enters the graphics context, to update the cursor to mCursorType. More...
 
void OnDrop (const char *str, float x, float y)
 
void OnDropMultiple (const std::vector< const char * > &paths, float x, float y)
 
void OnGUIIdle ()
 This is an idle timer tick call on the GUI thread, only active if USE_IDLE_CALLS is defined. More...
 
void OnDragResize (float x, float y)
 Called by ICornerResizerControl as the corner is dragged to resize. More...
 
void OnAppearanceChanged (EUIAppearance appearance)
 Called by the platform class if the view changes to dark/light mode. More...
 
virtual EUIAppearance GetUIAppearance () const
 Get the UI Appearance (Light/Dark mode) More...
 
void EnableMouseOver (bool enable)
 
void ReleaseMouseCapture ()
 Used to tell the graphics context to stop tracking mouse interaction with a control. More...
 
bool CanEnableMouseOver () const
 
int GetMouseOver () const
 
void GetMouseDownPoint (float &x, float &y) const
 Get the x, y position of the last mouse down message. More...
 
void SetTabletInput (bool tablet)
 Set by the platform class if the mouse input is coming from a tablet/stylus. More...
 
int GetParamIdxForPTAutomation (float x, float y)
 [AAX only] This can be called by the ProTools API class (e.g. More...
 
int GetLastClickedParamForPTAutomation ()
 [AAX only] More...
 
void SetPTParameterHighlight (int paramIdx, bool isHighlighted, int color)
 [AAX only] See AAX_CEffectGUI::SetControlHighlightInfo() More...
 
void PopupHostContextMenuForParam (int controlIdx, int paramIdx, float x, float y)
 [VST3 primarily] In VST3 plug-ins this enable support for the IContextMenu interface, which allows the host to add contextual options to e.g. More...
 
void PopupHostContextMenuForParam (IControl *pControl, int paramIdx, float x, float y)
 [VST3 primarily] In VST3 plug-ins this enable support for the IContextMenu interface, which allows the host to add contextual options to e.g. More...
 
const char * GetSharedResourcesSubPath () const
 Gets the name of the shared resources subpath. More...
 
void SetSharedResourcesSubPath (const char *sharedResourcesSubPath)
 Sets the name of the shared resources subpath. More...
 
virtual IBitmap LoadBitmap (const char *fileNameOrResID, int nStates=1, bool framesAreHorizontal=false, int targetScale=0)
 Load a bitmap image from disk or from windows resource. More...
 
virtual IBitmap LoadBitmap (const char *name, const void *pData, int dataSize, int nStates=1, bool framesAreHorizontal=false, int targetScale=0)
 Load a bitmap image from memory. More...
 
virtual ISVG LoadSVG (const char *fileNameOrResID, const char *units="px", float dpi=72.f)
 Load an SVG from disk or from windows resource. More...
 
virtual ISVG LoadSVG (const char *name, const void *pData, int dataSize, const char *units="px", float dpi=72.f)
 Load an SVG image from memory. More...
 
virtual WDL_TypedBuf< uint8_t > LoadResource (const char *fileNameOrResID, const char *fileType)
 Load a resource from the file system, the bundle, or a Windows resource, and returns its data. More...
 
virtual void AttachGestureRecognizer (EGestureType type)
 Registers a gesture recognizer with the graphics context. More...
 
void AttachGestureRecognizerToRegion (const IRECT &bounds, EGestureType type, IGestureFunc func)
 Attach a gesture recognizer to a rectangular region of the GUI, i.e. More...
 
void ClearGestureRegions ()
 Remove all gesture recognizers linked to regions. More...
 

Protected Member Functions

APIBitmapLoadAPIBitmap (const char *fileNameOrResID, int scale, EResourceLocation location, const char *ext) override
 Drawing API method to load a bitmap, called internally. More...
 
APIBitmapLoadAPIBitmap (const char *name, const void *pData, int dataSize, int scale) override
 Drawing API method to load a bitmap from binary data, called internally. More...
 
APIBitmapCreateAPIBitmap (int width, int height, float scale, double drawScale, bool cacheable=false) override
 Creates a new API bitmap, either in memory or as a GPU texture. More...
 
bool LoadAPIFont (const char *fontID, const PlatformFontPtr &font) override
 Drawing API method to load a font from a PlatformFontPtr, called internally. More...
 
int AlphaChannel () const override
 
bool FlippedBitmap () const override
 
void GetLayerBitmapData (const ILayerPtr &layer, RawBitmapData &data) override
 Get the contents of a layer as Raw RGBA bitmap data NOTE: you should only call this within IControl::Draw() More...
 
void ApplyShadowMask (ILayerPtr &layer, RawBitmapData &mask, const IShadow &shadow) override
 Implemented by a graphics backend to apply a calculated shadow mask to a layer, according to the shadow settings specified. More...
 
float DoMeasureText (const IText &text, const char *str, IRECT &bounds) const override
 
void DoDrawText (const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend) override
 
- Protected Member Functions inherited from IGraphics
virtual void ApplyShadowMask (ILayerPtr &layer, RawBitmapData &mask, const IShadow &shadow)=0
 Implemented by a graphics backend to apply a calculated shadow mask to a layer, according to the shadow settings specified. More...
 
virtual void UpdateLayer ()
 Implemented by a graphics backend to prepare for drawing to the layer at the top of the stack. More...
 
void PushLayer (ILayer *pLayer)
 Push a layer on to the stack. More...
 
ILayerPopLayer ()
 Pop a layer off the stack. More...
 
virtual void ActivateGLContext ()
 
virtual void DeactivateGLContext ()
 
virtual void CreatePlatformTextEntry (int paramIdx, const IText &text, const IRECT &bounds, int length, const char *str)=0
 Creates a platform native text entry field. More...
 
virtual IPopupMenuCreatePlatformPopupMenu (IPopupMenu &menu, const IRECT bounds, bool &isAsync)=0
 Calls the platform backend to create the platform popup menu. More...
 
virtual APIBitmapLoadAPIBitmap (const char *fileNameOrResID, int scale, EResourceLocation location, const char *ext)=0
 Drawing API method to load a bitmap, called internally. More...
 
virtual APIBitmapLoadAPIBitmap (const char *name, const void *pData, int dataSize, int scale)=0
 Drawing API method to load a bitmap from binary data, called internally. More...
 
virtual APIBitmapCreateAPIBitmap (int width, int height, float scale, double drawScale, bool cacheable=false)=0
 Creates a new API bitmap, either in memory or as a GPU texture. More...
 
virtual bool LoadAPIFont (const char *fontID, const PlatformFontPtr &font)=0
 Drawing API method to load a font from a PlatformFontPtr, called internally. More...
 
virtual bool AssetsLoaded ()
 Specialized in IGraphicsCanvas drawing backend. More...
 
virtual int AlphaChannel () const =0
 
virtual bool FlippedBitmap () const =0
 
EResourceLocation SearchImageResource (const char *fileName, const char *type, WDL_String &result, int targetScale, int &sourceScale)
 Search for a bitmap image resource matching the target scale. More...
 
APIBitmapSearchBitmapInCache (const char *fileName, int targetScale, int &sourceScale)
 Search the static storage cache for a bitmap image resource matching the target scale. More...
 
virtual float DoMeasureText (const IText &text, const char *str, IRECT &bounds) const =0
 
virtual void DoDrawText (const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=nullptr)=0
 
void DoMeasureTextRotation (const IText &text, const IRECT &bounds, IRECT &rect) const
 
void CalculateTextRotation (const IText &text, const IRECT &bounds, IRECT &rect, double &tx, double &ty) const
 
virtual float GetBackingPixelScale () const
 
IMatrix GetTransformMatrix () const
 

Additional Inherited Members

- Protected Attributes inherited from IGraphics
IGEditorDelegatemDelegate
 
bool mCursorHidden = false
 
bool mCursorLock = false
 
bool mTabletInput = false
 
float mCursorX = -1.f
 
float mCursorY = -1.f
 
float mXTranslation = 0.f
 
float mYTranslation = 0.f
 
std::stack< ILayer * > mLayers
 
IRECT mClipRECT
 
IMatrix mTransform
 
std::stack< IMatrixmTransformStates
 

Detailed Description

IGraphics draw class using NanoVG

Definition at line 81 of file IGraphicsNanoVG.h.

Constructor & Destructor Documentation

◆ IGraphicsNanoVG()

END_IGRAPHICS_NAMESPACE END_IPLUG_NAMESPACE IGraphicsNanoVG::IGraphicsNanoVG ( IGEditorDelegate dlg,
int  w,
int  h,
int  fps,
float  scale 
)

Definition at line 230 of file IGraphicsNanoVG.cpp.

◆ ~IGraphicsNanoVG()

IGraphicsNanoVG::~IGraphicsNanoVG ( )

Definition at line 238 of file IGraphicsNanoVG.cpp.

Member Function Documentation

◆ AlphaChannel()

int IGraphicsNanoVG::AlphaChannel ( ) const
inlineoverrideprotectedvirtual
Returns
int The index of the alpha component in a drawing backend's pixel (RGBA or ARGB)

Implements IGraphics.

Definition at line 135 of file IGraphicsNanoVG.h.

◆ ApplyShadowMask()

void IGraphicsNanoVG::ApplyShadowMask ( ILayerPtr layer,
RawBitmapData &  mask,
const IShadow shadow 
)
overrideprotectedvirtual

Implemented by a graphics backend to apply a calculated shadow mask to a layer, according to the shadow settings specified.

Parameters
layerThe layer to apply the shadow to
maskThe mask of the shadow as raw bitmap data
shadowThe shadow specification

Implements IGraphics.

Definition at line 406 of file IGraphicsNanoVG.cpp.

References CreateAPIBitmap(), DrawBitmap(), APIBitmap::GetDrawScale(), APIBitmap::GetHeight(), APIBitmap::GetScale(), APIBitmap::GetWidth(), PathFill(), IGraphics::PathRect(), IGraphics::PathTransformRestore(), IGraphics::PathTransformSave(), IGraphics::PathTransformTranslate(), IGraphics::PopLayer(), IGraphics::PushLayer(), and IRECT::Translate().

◆ BeginFrame()

void IGraphicsNanoVG::BeginFrame ( )
overridevirtual

Called at the beginning of drawing.

Call base implementation if overridden.

Reimplemented from IGraphics.

Definition at line 495 of file IGraphicsNanoVG.cpp.

References IGraphics::BeginFrame(), IGraphics::GetScreenScale(), IGraphics::WindowHeight(), and IGraphics::WindowWidth().

◆ BitmapExtSupported()

bool IGraphicsNanoVG::BitmapExtSupported ( const char *  ext)
overridevirtual

Checks a file extension and reports whether this drawing API supports loading that extension.

Implements IGraphics.

Definition at line 266 of file IGraphicsNanoVG.cpp.

References ToLower().

Referenced by LoadBitmap().

◆ CreateAPIBitmap()

APIBitmap * IGraphicsNanoVG::CreateAPIBitmap ( int  width,
int  height,
float  scale,
double  drawScale,
bool  cacheable = false 
)
overrideprotectedvirtual

Creates a new API bitmap, either in memory or as a GPU texture.

Parameters
widthThe desired width
heightThe desired height
scaleThe scale in relation to 1:1 pixels
drawScale
Todo:
Parameters
cacheableUsed to make sure the underlying bitmap can be shared between plug-in instances
Returns
APIBitmap* The new API Bitmap

Implements IGraphics.

Definition at line 373 of file IGraphicsNanoVG.cpp.

References IGraphics::GetScreenScale(), IGraphics::WindowHeight(), and IGraphics::WindowWidth().

Referenced by ApplyShadowMask().

◆ DeleteFBO()

void IGraphicsNanoVG::DeleteFBO ( NVGframebuffer *  pBuffer)

Definition at line 884 of file IGraphicsNanoVG.cpp.

◆ DoDrawText()

void IGraphicsNanoVG::DoDrawText ( const IText text,
const char *  str,
const IRECT bounds,
const IBlend pBlend 
)
overrideprotectedvirtual
Todo:
Parameters
text
Todo:
Parameters
str
Todo:
Parameters
bounds
Todo:
Parameters
pBlend
Todo:

Implements IGraphics.

Definition at line 658 of file IGraphicsNanoVG.cpp.

References IGraphics::PathTransformRestore(), and IGraphics::PathTransformSave().

◆ DoMeasureText()

float IGraphicsNanoVG::DoMeasureText ( const IText text,
const char *  str,
IRECT bounds 
) const
overrideprotectedvirtual
Todo:
Parameters
text
Todo:
Parameters
str
Todo:
Parameters
bounds
Todo:
Returns
The width of the text

Implements IGraphics.

Definition at line 648 of file IGraphicsNanoVG.cpp.

References IGraphics::DoMeasureTextRotation(), and IRECT::W().

◆ DrawBitmap()

void IGraphicsNanoVG::DrawBitmap ( const IBitmap bitmap,
const IRECT bounds,
int  srcX,
int  srcY,
const IBlend pBlend 
)
overridevirtual

Draw a bitmap (raster) image to the graphics context.

Parameters
bitmapThe bitmap image to draw to the graphics context
boundsThe rectangular region to draw the image in
srcXThe X offset in the source image to draw from
srcYThe Y offset in the source image to draw from
pBlendOptional blend method

Implements IGraphics.

Definition at line 540 of file IGraphicsNanoVG.cpp.

References BlendWeight(), IBitmap::GetAPIBitmap(), APIBitmap::GetBitmap(), APIBitmap::GetDrawScale(), APIBitmap::GetScale(), IBitmap::GetScale(), IBitmap::H(), IRECT::H(), IBitmap::W(), and IRECT::W().

Referenced by ApplyShadowMask().

◆ DrawDottedLine()

void IGraphicsNanoVG::DrawDottedLine ( const IColor color,
float  x1,
float  y1,
float  x2,
float  y2,
const IBlend pBlend,
float  thickness,
float  dashLen 
)
overridevirtual

Draw a dotted line to the graphics context.

Parameters
colorThe color to draw the shape with
x1The X coordinate of the start of the line
y1The Y coordinate of the start of the line
x2The X coordinate of the end of the line
y2The Y coordinate of the end of the line
pBlendOptional blend method
thicknessOptional line thickness

Reimplemented from IGraphics.

Definition at line 809 of file IGraphicsNanoVG.cpp.

References PathLineTo(), PathMoveTo(), and PathStroke().

◆ DrawDottedRect()

void IGraphicsNanoVG::DrawDottedRect ( const IColor color,
const IRECT bounds,
const IBlend pBlend,
float  thickness,
float  dashLen 
)
overridevirtual

Draw a dotted rectangle to the graphics context.

Parameters
colorThe color to draw the shape with
boundsThe rectangular region to draw the shape in
pBlendOptional blend method
thicknessOptional line thickness

Reimplemented from IGraphics.

Definition at line 843 of file IGraphicsNanoVG.cpp.

References Clip(), IRECT::H(), PathLineTo(), PathMoveTo(), PathStroke(), and IRECT::W().

◆ DrawFastDropShadow()

void IGraphicsNanoVG::DrawFastDropShadow ( const IRECT innerBounds,
const IRECT outerBounds,
float  xyDrop = 5.f,
float  roundness = 0.f,
float  blur = 10.f,
IBlend pBlend = nullptr 
)
overridevirtual

NanoVG only.

Reimplemented from IGraphics.

Definition at line 905 of file IGraphicsNanoVG.cpp.

References IRECT::H(), and IRECT::W().

◆ DrawMultiLineText()

void IGraphicsNanoVG::DrawMultiLineText ( const IText text,
const char *  str,
IRECT bounds,
const IBlend pBlend 
)
overridevirtual

Draw some multi-line text to the graphics context in a specific rectangle (NanoVG only)

Parameters
textAn IText struct containing font and text properties and layout info
strThe text string to draw
boundsThe rectangular region in the graphics where you would like to draw the text
pBlendOptional blend method

Reimplemented from IGraphics.

Definition at line 916 of file IGraphicsNanoVG.cpp.

References IRECT::MH(), IRECT::MW(), and IRECT::W().

◆ DrawResize()

void IGraphicsNanoVG::DrawResize ( )
overridevirtual

◆ EndFrame()

void IGraphicsNanoVG::EndFrame ( )
overridevirtual

Called by some drawing API classes to finally blit the draw bitmap onto the screen or perform other cleanup after drawing.

Reimplemented from IGraphics.

Definition at line 513 of file IGraphicsNanoVG.cpp.

References IGraphics::GetScreenScale(), IGraphics::WindowHeight(), and IGraphics::WindowWidth().

◆ FlippedBitmap()

bool IGraphicsNanoVG::FlippedBitmap ( ) const
inlineoverrideprotectedvirtual
Returns
bool true if the drawing backend flips images (e.g. OpenGL)

Implements IGraphics.

Definition at line 137 of file IGraphicsNanoVG.h.

◆ GetDrawContext()

void * IGraphicsNanoVG::GetDrawContext ( )
inlineoverridevirtual

Gets a void pointer to underlying drawing context, for the IGraphics backend See draw class implementation headers (e.g.

IGraphicsNanoVG.h) for what you can cast the void pointer to

Implements IGraphics.

Definition at line 119 of file IGraphicsNanoVG.h.

◆ GetDrawingAPIStr()

const char * IGraphicsNanoVG::GetDrawingAPIStr ( )
overridevirtual
Returns
A CString representing the Drawing API in use e.g. "NanoVG"

Implements IGraphics.

Definition at line 245 of file IGraphicsNanoVG.cpp.

◆ GetLayerBitmapData()

void IGraphicsNanoVG::GetLayerBitmapData ( const ILayerPtr layer,
RawBitmapData &  data 
)
overrideprotectedvirtual

Get the contents of a layer as Raw RGBA bitmap data NOTE: you should only call this within IControl::Draw()

Parameters
layerThe layer to get the data from
dataThe pixel data extracted from the layer

Implements IGraphics.

Definition at line 391 of file IGraphicsNanoVG.cpp.

References APIBitmap::GetBitmap(), APIBitmap::GetHeight(), APIBitmap::GetWidth(), IGraphics::PopLayer(), and IGraphics::PushLayer().

◆ GetPoint()

IColor IGraphicsNanoVG::GetPoint ( int  x,
int  y 
)
overridevirtual

Get the color at an X, Y location in the graphics context.

Parameters
xThe X coordinate of the pixel
yThe Y coordinate of the pixel
Returns
An IColor specifiying the color of the pixel at x, y

Implements IGraphics.

Definition at line 611 of file IGraphicsNanoVG.cpp.

◆ LoadAPIBitmap() [1/2]

APIBitmap * IGraphicsNanoVG::LoadAPIBitmap ( const char *  fileNameOrResID,
int  scale,
EResourceLocation  location,
const char *  ext 
)
overrideprotectedvirtual

Drawing API method to load a bitmap, called internally.

Parameters
fileNameOrResIDA CString absolute path or resource ID
scaleInteger to identify the scale of the resource, for multi-scale bitmaps
locationIdentifies the kind of resource location
extCString for the file extension
Returns
APIBitmap* Drawing API bitmap abstraction

Implements IGraphics.

Definition at line 311 of file IGraphicsNanoVG.cpp.

References IGraphics::GetWinModuleHandle(), and LoadWinResource().

Referenced by LoadBitmap().

◆ LoadAPIBitmap() [2/2]

APIBitmap * IGraphicsNanoVG::LoadAPIBitmap ( const char *  name,
const void *  pData,
int  dataSize,
int  scale 
)
overrideprotectedvirtual

Drawing API method to load a bitmap from binary data, called internally.

Parameters
nameCString for the name of the resource
pDataRaw pointer to the binary data
dataSizeSize of the data in bytes
scaleInteger to identify the scale of the resource, for multi-scale bitmaps
Returns
APIBitmap* Drawing API bitmap abstraction

Implements IGraphics.

Definition at line 351 of file IGraphicsNanoVG.cpp.

◆ LoadAPIFont()

bool IGraphicsNanoVG::LoadAPIFont ( const char *  fontID,
const PlatformFontPtr &  font 
)
overrideprotectedvirtual

Drawing API method to load a font from a PlatformFontPtr, called internally.

Parameters
fontIDA CString that will be used to reference the font
fontValid PlatformFontPtr, loaded via LoadPlatformFont
Returns
bool true if the font was loaded successfully

Implements IGraphics.

Definition at line 740 of file IGraphicsNanoVG.cpp.

◆ LoadBitmap()

IBitmap IGraphicsNanoVG::LoadBitmap ( const char *  fileNameOrResID,
int  nStates,
bool  framesAreHorizontal,
int  targetScale 
)
overridevirtual

Load a bitmap image from disk or from windows resource.

Parameters
fileNameOrResIDCString file name or resource ID
nStatesThe number of states/frames in a multi-frame stacked bitmap
framesAreHorizontalSet true if the frames in a bitmap are stacked horizontally
targetScaleSet to a number > 0 to explicity load e.g. an @2x.png
Returns
An IBitmap representing the image

Reimplemented from IGraphics.

Definition at line 273 of file IGraphicsNanoVG.cpp.

References BitmapExtSupported(), IGraphics::GetRoundedScreenScale(), LoadAPIBitmap(), and IGraphics::SearchImageResource().

◆ OnViewDestroyed()

void IGraphicsNanoVG::OnViewDestroyed ( )
overridevirtual

Called after a platform view is destroyed, so that drawing classes can e.g.

free any resources

Reimplemented from IGraphics.

Definition at line 462 of file IGraphicsNanoVG.cpp.

References IGraphics::RemoveAllControls().

◆ OnViewInitialized()

void IGraphicsNanoVG::OnViewInitialized ( void *  pContext)
overridevirtual

Called after platform view initialization, so that drawing classes can e.g.

create an OpenGL context.

Reimplemented from IGraphics.

Definition at line 450 of file IGraphicsNanoVG.cpp.

◆ PathArc()

void IGraphicsNanoVG::PathArc ( float  cx,
float  cy,
float  r,
float  a1,
float  a2,
EWinding  winding 
)
overridevirtual

Add an arc to the current path.

Parameters
cxThe X coordinate of the centre of the circle on which the arc lies
cyThe Y coordinate of the centre of the circle on which the arc lies
rThe radius of the circle on which the arc lies
a1the start angle of the arc at in degrees clockwise where 0 is up
a2the end angle of the arc at in degrees clockwise where 0 is up

Implements IGraphics.

Definition at line 581 of file IGraphicsNanoVG.cpp.

◆ PathClear()

void IGraphicsNanoVG::PathClear ( )
overridevirtual

Clear the stack of path drawing commands.

Implements IGraphics.

Definition at line 571 of file IGraphicsNanoVG.cpp.

◆ PathClose()

void IGraphicsNanoVG::PathClose ( )
overridevirtual

Close the path that is being specified.

Implements IGraphics.

Definition at line 576 of file IGraphicsNanoVG.cpp.

◆ PathCubicBezierTo()

void IGraphicsNanoVG::PathCubicBezierTo ( float  c1x,
float  c1y,
float  c2x,
float  c2y,
float  x2,
float  y2 
)
overridevirtual

Add a cubic bezier to the current path from the current point to the specified location.

Parameters
c1xControl point 1 X coordinate
c1yControl point 1 Y coordinate
c2xControl point 2 X coordinate
c2yControl point 2 Y coordinate
x2The X coordinate of the end of the line
y2The Y coordinate of the end of the line

Implements IGraphics.

Definition at line 596 of file IGraphicsNanoVG.cpp.

◆ PathFill()

void IGraphicsNanoVG::PathFill ( const IPattern pattern,
const IFillOptions options,
const IBlend pBlend 
)
overridevirtual

Fill the current current path.

Parameters
patternThe IPattern to use, for e.g. color or gradient
optionsOptional IFillOptions to specify fill rule and preserve options
pBlendOptional blend method

Implements IGraphics.

Definition at line 708 of file IGraphicsNanoVG.cpp.

References IPattern::GetStop().

Referenced by ApplyShadowMask().

◆ PathLineTo()

void IGraphicsNanoVG::PathLineTo ( float  x,
float  y 
)
overridevirtual

Add a line to the current path from the current point to the specified location.

Parameters
xThe X coordinate of the end of the line
yThe Y coordinate of the end of the line

Implements IGraphics.

Definition at line 591 of file IGraphicsNanoVG.cpp.

Referenced by DrawDottedLine(), and DrawDottedRect().

◆ PathMoveTo()

void IGraphicsNanoVG::PathMoveTo ( float  x,
float  y 
)
overridevirtual

Move the current point in the current path.

Parameters
xThe X coordinate
yThe Y coordinate

Implements IGraphics.

Definition at line 586 of file IGraphicsNanoVG.cpp.

Referenced by DrawDottedLine(), and DrawDottedRect().

◆ PathQuadraticBezierTo()

void IGraphicsNanoVG::PathQuadraticBezierTo ( float  cx,
float  cy,
float  x2,
float  y2 
)
overridevirtual

Add a quadratic bezier to the current path from the current point to the specified location.

Parameters
cxControl point X coordinate
cyControl point Y coordinate
x2The X coordinate of the end of the line
y2The Y coordinate of the end of the line

Implements IGraphics.

Definition at line 601 of file IGraphicsNanoVG.cpp.

◆ PathSetWinding()

void IGraphicsNanoVG::PathSetWinding ( bool  clockwise)
overridevirtual

NanoVG only.

https://github.com/memononen/nanovg/blob/master/src/nanovg.h#L454

Parameters
clockwiseShould the path be wound clockwise

Reimplemented from IGraphics.

Definition at line 606 of file IGraphicsNanoVG.cpp.

◆ PathStroke()

void IGraphicsNanoVG::PathStroke ( const IPattern pattern,
float  thickness,
const IStrokeOptions options,
const IBlend pBlend 
)
overridevirtual

Stroke the current current path.

Parameters
patternThe IPattern to use, for e.g. color or gradient
thicknessThe line thickness
optionsOptional IStrokeOptions to specify dash, join and path preserve options
pBlendOptional blend method

Implements IGraphics.

Definition at line 673 of file IGraphicsNanoVG.cpp.

References IPattern::GetStop().

Referenced by DrawDottedLine(), and DrawDottedRect().

◆ ReleaseBitmap()

void IGraphicsNanoVG::ReleaseBitmap ( const IBitmap bitmap)
inlineoverridevirtual

Releases an IBitmap from the cache/static storage.

Parameters
bitmapThe bitmap to release

Reimplemented from IGraphics.

Definition at line 122 of file IGraphicsNanoVG.h.

◆ RetainBitmap()

void IGraphicsNanoVG::RetainBitmap ( const IBitmap bitmap,
const char *  cacheName 
)
inlineoverridevirtual

Adds an IBitmap to the cache/static storage.

Parameters
bitmapThe bitmap to cache
cacheNameThe name by which this bitmap is identified int the cache

Reimplemented from IGraphics.

Definition at line 123 of file IGraphicsNanoVG.h.


The documentation for this class was generated from the following files: