iPlug2 - C++ Audio Plug-in Framework
Classes | Public Member Functions | Protected Member Functions | List of all members
IGraphicsSkia Class Reference

IGraphics draw class using Skia. More...

#include <IGraphicsSkia.h>

Inheritance diagram for IGraphicsSkia:
[legend]

Classes

class  Bitmap
 
struct  Font
 

Public Member Functions

 IGraphicsSkia (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.
 
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 PathClear () override
 Clear the stack of path drawing commands.
 
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 x1, float y1, float x2, float y2, float x3, float y3) 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 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...
 
void DrawFastDropShadow (const IRECT &innerBounds, const IRECT &outerBounds, float xyDrop, float roundness, float blur, IBlend *pBlend) override
 NanoVG only.
 
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...
 
bool BitmapExtSupported (const char *ext) override
 Checks a file extension and reports whether this drawing API supports loading that extension.
 
int AlphaChannel () const override
 
bool FlippedBitmap () const override
 
APIBitmapCreateAPIBitmap (int width, int height, int scale, double drawScale, bool cacheable=false) override
 Creates a new API bitmap, either in memory or as a GPU texture. More...
 
void GetLayerBitmapData (const ILayerPtr &layer, RawBitmapData &data) override
 Get the contents of a layers pixels as bitmap data. 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...
 
void UpdateLayer () override
 Implemented by a graphics backend to prepare for drawing to the layer at the top of the stack.
 
- Public Member Functions inherited from IGraphics
virtual void DrawSVG (const ISVG &svg, const IRECT &bounds, const IBlend *pBlend=0)
 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 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 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...
 
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 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)
 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...
 
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...
 
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 PathSetWinding (bool clockwise)
 NanoVG only. More...
 
void PathTransformSave ()
 Save the current affine transform of the current path.
 
void PathTransformRestore ()
 Restore the affine transform of the current path, to the previously saved state.
 
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...
 
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 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 void UpdateTooltips ()=0
 Call this if you modify control tool tips at runtime. More...
 
virtual EMsgBoxResult ShowMessageBox (const char *str, const char *caption, EMsgBoxType type, IMsgBoxCompletionHanderFunc 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 *extensions=0)=0
 Create a platform file prompt dialog to choose a file/directory path for opening/saving a file/directory. More...
 
virtual void PromptForDirectory (WDL_String &dir)=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 ()
 Get the bundle ID on macOS and iOS, returns emtpy string on other OSs.
 
 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)
 
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 ()
 
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.
 
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 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...
 
void AttachImGui (std::function< void(IGraphics *)> drawFunc, std::function< void()> setupFunc=nullptr)
 Set functions to draw DearImGui widgets on top of the IGraphics context (only relevant when IGRAPHICS_IMGUI is defined) 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.
 
void OnGestureRecognized (const IGestureInfo &info)
 Called by platform class when a gesture is recognized.
 
virtual float GetPlatformWindowScale () const
 Returns a scaling factor for resizing parent windows via the host/plugin API. More...
 
void ForAllControlsFunc (std::function< void(IControl *pControl)> 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 (std::function< void(IControl *pControl)> 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, std::function< void(IControl *pControl)> func)
 For all standard controls in the main control stack that are linked to a specific parameter, execute a function. More...
 
void ForControlInGroup (const char *group, std::function< void(IControl *pControl)> 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.
 
void AttachTextEntryControl ()
 Attach a control for text entry, to override platform text entry.
 
void RemoveTextEntryControl ()
 Remove the IGraphics text entry, use platform text entry if available.
 
void AttachBubbleControl (const IText &text=DEFAULT_TEXT)
 Attach the default control to show text as a control changes.
 
void AttachBubbleControl (IBubbleControl *pControl)
 Attach a custom control to show text as a control changes.
 
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)
 
int GetControlIdx (IControl *pControl) const
 
int GetIdxOfTaggedControl (int ctrlTag) const
 Gets the index of a tagged control. More...
 
IControlGetControlWithTag (int ctrlTag) const
 
int GetControlTag (const IControl *pControl) const
 Get the tag given to a control. More...
 
bool ControlIsCaptured () const
 Check to see if any control is captured.
 
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.
 
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.
 
void SetAllControlsClean ()
 Calls SetClean() on every control.
 
void SetControlPosition (int idx, float x, float y)
 Reposition a control, redrawing the interface correctly. More...
 
void SetControlSize (int idx, float w, float h)
 Resize a control, redrawing the interface correctly. More...
 
void SetControlBounds (int idx, 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.
 
void OnMouseUp (const std::vector< IMouseInfo > &points)
 Called when the platform class sends mouse up events.
 
void OnMouseDrag (const std::vector< IMouseInfo > &points)
 Called when the platform class sends drag events.
 
void OnTouchCancelled (const std::vector< IMouseInfo > &points)
 Called when the platform class sends touch cancel events.
 
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.
 
void OnSetCursor ()
 Called when the mouse enters the graphics context, to update the cursor to mCursorType.
 
void OnDrop (const char *str, 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.
 
void OnDragResize (float x, float y)
 Called by ICornerResizerControl as the corner is dragged to resize.
 
void EnableMouseOver (bool enable)
 
void ReleaseMouseCapture ()
 Used to tell the graphics context to stop tracking mouse interaction with a control.
 
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.
 

Protected Member Functions

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
 
bool LoadAPIFont (const char *fontID, const PlatformFontPtr &font) override
 Drawing API method to load a font from a PlatformFontPtr, called internally. More...
 
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...
 
- Protected Member Functions inherited from IGraphics
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
 
virtual IPopupMenuCreatePlatformPopupMenu (IPopupMenu &menu, const IRECT &bounds, bool &isAsync)=0
 Calls the platform backend to create the platform popup menu. More...
 
virtual bool AssetsLoaded ()
 Specialized in IGraphicsCanvas drawing backend.
 
void SearchNextScale (int &sourceScale, int targetScale)
 Utility used by SearchImageResource/SearchBitmapInCache. More...
 
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...
 
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 Skia.

Definition at line 44 of file IGraphicsSkia.h.

Member Function Documentation

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

Implements IGraphics.

Definition at line 116 of file IGraphicsSkia.h.

void IGraphicsSkia::ApplyShadowMask ( ILayerPtr layer,
RawBitmapData &  mask,
const IShadow shadow 
)
overridevirtual

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 951 of file IGraphicsSkia.cpp.

Referenced by FlippedBitmap().

void IGraphicsSkia::BeginFrame ( )
overridevirtual

Called at the beginning of drawing.

Call base implementation if overridden.

Reimplemented from IGraphics.

Definition at line 380 of file IGraphicsSkia.cpp.

References IGraphics::BeginFrame().

APIBitmap * IGraphicsSkia::CreateAPIBitmap ( int  width,
int  height,
int  scale,
double  drawScale,
bool  cacheable = false 
)
overridevirtual

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

Implements IGraphics.

Definition at line 902 of file IGraphicsSkia.cpp.

Referenced by FlippedBitmap().

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

Implements IGraphics.

Definition at line 694 of file IGraphicsSkia.cpp.

Referenced by FlippedBitmap().

float IGraphicsSkia::DoMeasureText ( const IText text,
const char *  str,
IRECT bounds 
) const
overrideprotectedvirtual
Todo:
Parameters
text

Implements IGraphics.

Definition at line 682 of file IGraphicsSkia.cpp.

References IRECT::W().

Referenced by FlippedBitmap().

void IGraphicsSkia::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 546 of file IGraphicsSkia.cpp.

References Clip(), IBitmap::GetAPIBitmap(), APIBitmap::GetBitmap(), IBitmap::GetDrawScale(), IBitmap::GetScale(), IRECT::L, and IRECT::T.

void IGraphicsSkia::DrawResize ( )
overridevirtual
Todo:

Reimplemented from IGraphics.

Definition at line 340 of file IGraphicsSkia.cpp.

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

Implements IGraphics.

Definition at line 117 of file IGraphicsSkia.h.

References ApplyShadowMask(), CreateAPIBitmap(), DoDrawText(), DoMeasureText(), GetLayerBitmapData(), LoadAPIBitmap(), LoadAPIFont(), and UpdateLayer().

void* IGraphicsSkia::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 113 of file IGraphicsSkia.h.

References BitmapExtSupported().

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

Implements IGraphics.

Definition at line 1005 of file IGraphicsSkia.cpp.

void IGraphicsSkia::GetLayerBitmapData ( const ILayerPtr layer,
RawBitmapData &  data 
)
overridevirtual

Get the contents of a layers pixels as bitmap data.

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

Implements IGraphics.

Definition at line 936 of file IGraphicsSkia.cpp.

Referenced by FlippedBitmap().

IColor IGraphicsSkia::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 605 of file IGraphicsSkia.cpp.

Referenced by PathQuadraticBezierTo().

APIBitmap * IGraphicsSkia::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 270 of file IGraphicsSkia.cpp.

References LoadWinResource().

Referenced by FlippedBitmap().

APIBitmap * IGraphicsSkia::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 301 of file IGraphicsSkia.cpp.

bool IGraphicsSkia::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 614 of file IGraphicsSkia.cpp.

References IRECT::B, IRECT::L, IRECT::MH(), IRECT::MW(), IRECT::R, and IRECT::T.

Referenced by FlippedBitmap().

void IGraphicsSkia::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 324 of file IGraphicsSkia.cpp.

void IGraphicsSkia::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 306 of file IGraphicsSkia.cpp.

void IGraphicsSkia::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 575 of file IGraphicsSkia.cpp.

Referenced by PathClose().

void IGraphicsSkia::PathClose ( )
inlineoverridevirtual

Close the path that is being specified.

Implements IGraphics.

Definition at line 64 of file IGraphicsSkia.h.

References PathArc().

void IGraphicsSkia::PathCubicBezierTo ( float  c1x,
float  c1y,
float  c2x,
float  c2y,
float  x2,
float  y2 
)
inlineoverridevirtual

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 70 of file IGraphicsSkia.h.

void IGraphicsSkia::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 756 of file IGraphicsSkia.cpp.

References IGraphics::DrawArc(), IGraphics::DrawCircle(), IGraphics::DrawEllipse(), IGraphics::DrawRect(), IGraphics::DrawRoundRect(), IGraphics::FillArc(), IGraphics::FillCircle(), IGraphics::FillEllipse(), IGraphics::FillRect(), IGraphics::FillRoundRect(), IRECT::L, and IRECT::T.

Referenced by PathQuadraticBezierTo().

void IGraphicsSkia::PathLineTo ( float  x,
float  y 
)
inlineoverridevirtual

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 68 of file IGraphicsSkia.h.

void IGraphicsSkia::PathMoveTo ( float  x,
float  y 
)
inlineoverridevirtual

Move the current point in the current path.

Parameters
xThe X coordinate
yThe Y coordinate

Implements IGraphics.

Definition at line 67 of file IGraphicsSkia.h.

void IGraphicsSkia::PathQuadraticBezierTo ( float  cx,
float  cy,
float  x2,
float  y2 
)
inlineoverridevirtual

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 75 of file IGraphicsSkia.h.

References IGraphics::DrawArc(), IGraphics::DrawCircle(), IGraphics::DrawEllipse(), DrawFastDropShadow(), IGraphics::DrawRect(), IGraphics::DrawRoundRect(), IGraphics::FillArc(), IGraphics::FillCircle(), IGraphics::FillEllipse(), IGraphics::FillRect(), IGraphics::FillRoundRect(), GetPoint(), PathFill(), and PathStroke().

void IGraphicsSkia::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 712 of file IGraphicsSkia.cpp.

Referenced by PathQuadraticBezierTo().


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