GUIGraphics

Undocumented in source.
class GUIGraphics : UIElement , IGraphics {}

Constructors

this
this(SizeConstraints sizeConstraints, UIFlags flags)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Classes

WindowListener
class WindowListener
Undocumented in source.

Functions

buildCompositor
ICompositor buildCompositor(CompositorCreationContext* context)
Undocumented in source. Be warned that the author may not have intended to support it.
closeUI
void closeUI()
Undocumented in source. Be warned that the author may not have intended to support it.
compositeGUI
void compositeGUI(ImageRef!RGBA wfb)

Do the PBR compositing step. This is the most expensive step in the UI.

compositor
ICompositor compositor()
Undocumented in source. Be warned that the author may not have intended to support it.
convertLogicalRectToUserRect
box2i convertLogicalRectToUserRect(box2i b)
Undocumented in source. Be warned that the author may not have intended to support it.
convertPBRLayerRectToRawLayerRect
box2i convertPBRLayerRectToRawLayerRect(box2i rect, int width, int height)
Undocumented in source. Be warned that the author may not have intended to support it.
convertUserRectToLogicalRect
box2i convertUserRectToLogicalRect(box2i b)
Undocumented in source. Be warned that the author may not have intended to support it.
doDraw
void doDraw(WindowPixelFormat pf)
Undocumented in source. Be warned that the author may not have intended to support it.
doResize
ImageRef!RGBA doResize(int widthLogicalPixels, int heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
getDefaultUISizeInPixels
vec2i getDefaultUISizeInPixels()
Undocumented in source. Be warned that the author may not have intended to support it.
getGUISize
void getGUISize(int* widthLogicalPixels, int* heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
getMaxSmallerValidSize
void getMaxSmallerValidSize(int* inoutWidth, int* inoutHeight)
Undocumented in source. Be warned that the author may not have intended to support it.
getNearestValidSize
void getNearestValidSize(int* inoutWidth, int* inoutHeight)
Undocumented in source. Be warned that the author may not have intended to support it.
getUINearestValidSize
void getUINearestValidSize(int* widthLogicalPixels, int* heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
getUIScale
float getUIScale()
Undocumented in source. Be warned that the author may not have intended to support it.
getUISizeInPixelsLogical
vec2i getUISizeInPixelsLogical()
Undocumented in source. Be warned that the author may not have intended to support it.
getUISizeInPixelsPhysical
vec2i getUISizeInPixelsPhysical()
Undocumented in source. Be warned that the author may not have intended to support it.
getUISizeInPixelsUser
vec2i getUISizeInPixelsUser()
Undocumented in source. Be warned that the author may not have intended to support it.
getUserScale
float getUserScale()
Undocumented in source. Be warned that the author may not have intended to support it.
isResizeable
bool isResizeable()
Undocumented in source. Be warned that the author may not have intended to support it.
isUIResizable
bool isUIResizable()
Undocumented in source. Be warned that the author may not have intended to support it.
nativeWindowResize
bool nativeWindowResize(int newWidthLogicalPixels, int newHeightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
openUI
void* openUI(void* parentInfo, void* controlInfo, IClient client, GraphicsBackend backend)
Undocumented in source. Be warned that the author may not have intended to support it.
profiler
IProfiler profiler()
Undocumented in source. Be warned that the author may not have intended to support it.
recomputeDirtyAreas
void recomputeDirtyAreas()
Undocumented in source. Be warned that the author may not have intended to support it.
recomputeDrawLists
void recomputeDrawLists()
Undocumented in source. Be warned that the author may not have intended to support it.
recomputePurelyDerivedRectangles
void recomputePurelyDerivedRectangles()
Undocumented in source. Be warned that the author may not have intended to support it.
redrawElementsPBR
void redrawElementsPBR()

Draw the PBR layer of UIElement widgets

redrawElementsRaw
void redrawElementsRaw()

Draw the Raw layer of UIElement widgets

regenerateMipmaps
void regenerateMipmaps()

Compose lighting effects from depth and diffuse into a result. takes output image and non-overlapping areas as input Useful multithreading code.

reorderComponents
void reorderComponents(WindowPixelFormat pf)
Undocumented in source. Be warned that the author may not have intended to support it.
requestUIResize
bool requestUIResize(int widthLogicalPixels, int heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
resizeContent
void resizeContent(WindowPixelFormat pf)
Undocumented in source. Be warned that the author may not have intended to support it.
setUpdateMargin
void setUpdateMargin(int margin)

Tune this to tune the trade-off between light quality and speed. The default value was tuned by hand on very shiny light sources. Too high and processing becomes more expensive. Too little and the ligth decay doesn't feel natural. IMPORTANT: This should be called only inside your main reflow() or at UI creation time.

toImageRef
ImageRef!RGBA toImageRef(ubyte* alignedBuffer, int width, int height)
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

PBR_TILE_MAX_HEIGHT
enum PBR_TILE_MAX_HEIGHT;
Undocumented in source.
PBR_TILE_MAX_WIDTH
enum PBR_TILE_MAX_WIDTH;
Undocumented in source.

Variables

_client
IClient _client;
Undocumented in source.
_compositedBuffer
OwnedImage!RGBA _compositedBuffer;

The composited buffer, before the Raw layer is applied.

_compositor
ICompositor _compositor;
Undocumented in source.
_currentLogicalHeight
int _currentLogicalHeight;
Undocumented in source.
_currentLogicalWidth
int _currentLogicalWidth;
Undocumented in source.
_currentUserHeight
int _currentUserHeight;
Undocumented in source.
_currentUserWidth
int _currentUserWidth;
Undocumented in source.
_depthMap
Mipmap!L16 _depthMap;
Undocumented in source.
_diffuseMap
Mipmap!RGBA _diffuseMap;
Undocumented in source.
_elemsToDrawPBR
Vec!UIElement _elemsToDrawPBR;

The list of UIElement to potentially call onDrawPBR on.

_elemsToDrawRaw
Vec!UIElement _elemsToDrawRaw;

The list of UIElement to potentially call onDrawPBR on.

_firstResize
bool _firstResize;
Undocumented in source.
_materialMap
Mipmap!RGBA _materialMap;
Undocumented in source.
_rectsTemp
Vec!box2i _rectsTemp;
Undocumented in source.
_rectsToComposite
Vec!box2i _rectsToComposite;
Undocumented in source.
_rectsToCompositeDisjointed
Vec!box2i _rectsToCompositeDisjointed;
Undocumented in source.
_rectsToCompositeDisjointedTiled
Vec!box2i _rectsToCompositeDisjointedTiled;
Undocumented in source.
_rectsToDisplay
Vec!box2i _rectsToDisplay;
Undocumented in source.
_rectsToDisplayDisjointed
Vec!box2i _rectsToDisplayDisjointed;
Undocumented in source.
_rectsToResize
Vec!box2i _rectsToResize;
Undocumented in source.
_rectsToResizeDisjointed
Vec!box2i _rectsToResizeDisjointed;
Undocumented in source.
_rectsToUpdateDisjointedPBR
Vec!box2i _rectsToUpdateDisjointedPBR;

The list of areas to be redrawn at the Raw and PBR levels (composited). These are accumulated over possibly several calls of recomputeDirtyRects and cleared by a call to onDraw. Other lists of areas are purely derived from _rectsToUpdateDisjointedRaw and _rectsToUpdateDisjointedPBR.

_rectsToUpdateDisjointedRaw
Vec!box2i _rectsToUpdateDisjointedRaw;

The list of areas to be redrawn at the Raw and PBR levels (composited). These are accumulated over possibly several calls of recomputeDirtyRects and cleared by a call to onDraw. Other lists of areas are purely derived from _rectsToUpdateDisjointedRaw and _rectsToUpdateDisjointedPBR.

_redrawBlackBordersAndResizedArea
bool _redrawBlackBordersAndResizedArea;
Undocumented in source.
_renderedBuffer
OwnedImage!RGBA _renderedBuffer;

The rendered framebuffer. This is copied from _compositedBuffer, then Raw layer is drawn on top. Components are reordered there. It must be possible to use a Canvas on it.

_reportBlackBordersAndResizedAreaAsDirty
bool _reportBlackBordersAndResizedAreaAsDirty;
Undocumented in source.
_resizedBuffer
ubyte* _resizedBuffer;

The final framebuffer. It is the only buffer to have a size in logical pixels. Internally the UI has an "user" size. FUTURE: resize from user size to logical size using a resizer, to allow better looking DPI without the OS blurry resizing. Or to allow higher internal pixel count.

_sizeConstraints
SizeConstraints _sizeConstraints;
Undocumented in source.
_sortScratchBuf
Vec!UIElement _sortScratchBuf;

The scratch buffer used to sort the two above list.

_threadPool
ThreadPool _threadPool;
Undocumented in source.
_uiContext
UIContext _uiContext;
Undocumented in source.
_updateMargin
int _updateMargin;

Amount of pixels dirty rectangles are extended with.

_updateRectScratch
Vec!box2i[2] _updateRectScratch;
Undocumented in source.
_userArea
box2i _userArea;

the area in logical area where the user area is drawn.

_window
IWindow _window;
Undocumented in source.
_windowListener
WindowListener _windowListener;
Undocumented in source.

Inherited Members

From UIElement

~this
~this()
Undocumented in source.
setId
void setId(const(char)[] identifier)

Set this element ID. All UIElement can have a string as unique identifier, similar to HTML. There is a maximum of 63 characters for this id though. This ID is supposed to be unique. If it isn't, a search by ID will return null. Chrome rules applies: can't contain any space characters.

getId
const(char)[] getId()

Get this element ID. All UIElement can have a string as unique identifier, similar to HTML. Returns the empty string "" if there is no ID. Note: this return an interior slice, and could be invalidated if the ID is reassigned.

id
const(char)[] id()
void id(const(char)[] identifier)

Properties to access this element ID.

hasId
bool hasId()
getElementById
UIElement getElementById(const(char)* id)

Search subtree for an UIElement with ID id. Undefined Behaviour if ID are not unique.

renderRaw
void renderRaw(ImageRef!RGBA rawMap, box2i[] areasToUpdate)

This method is called for each item in the drawlist that was visible and has a dirty Raw layer. This is called after compositing, starting from the buffer output by the Compositor.

renderPBR
void renderPBR(ImageRef!RGBA diffuseMap, ImageRef!L16 depthMap, ImageRef!RGBA materialMap, box2i[] areasToUpdate)
reflow
void reflow()

The goal of this method is to update positions of childrens. It is called whenever _position changes.

position
box2i position()
position
void position(box2i p)

Changes the position of the element. This calls reflow if that position has changed. IMPORTANT: As of today you are not allowed to assign a position outside the extent of the window. This is purely a Dplug limitation.

position
void position(box2f p)

Changes the position of the element. This calls reflow if that position has changed. Note: Widget coordinates are always integer coordinates. The input rectangle is rounded to nearest integer.

child
UIElement child(int n)
addChild
void addChild(UIElement element)

Adds an UIElement The addChild method is mandatory. Such a child MUST be created through dplug.core.nogc.mallocEmplace. Note: to display a newly added widget, use position setter.

removeChild
void removeChild(UIElement element)

Removes a child (but does not destroy it, you take back the ownership of it). Useful for creating dynamic UI's. MAYDO: there are restrictions for where this is allowed. Find them.

onMouseClick
Click onMouseClick(int x, int y, int button, bool isDoubleClick, MouseState mstate)

onMouseClick is called for every new click, whether or not you are in a dragging operation. This function is meant to be overriden.

onMouseWheel
bool onMouseWheel(int x, int y, int wheelDeltaX, int wheelDeltaY, MouseState mstate)

Mouse wheel was turned. This function is meant to be overriden. It should return true if the wheel is handled.

onMouseMove
void onMouseMove(int x, int y, int dx, int dy, MouseState mstate)

Called when mouse move over this Element. This function is meant to be overriden.

onBeginDrag
void onBeginDrag()

Called when clicked with left/middle/right button This function is meant to be overriden. Between onBeginDrag and onStopDrag, isDragged will return true.

onMouseDrag
void onMouseDrag(int x, int y, int dx, int dy, MouseState mstate)

Called when mouse drag this Element. This function is meant to be overriden.

onStopDrag
void onStopDrag()

Called once a dragging operation is finished. This function is meant to be overriden. Between onBeginDrag and onStopDrag, isDragged will return true.

onMouseEnter
void onMouseEnter()

Called when mouse enter this Element. This function is meant to be overriden. Between onMouseEnter and onMouseExit, isMouseOver will return true.

onMouseExit
void onMouseExit()

Called when mouse enter this Element. This function is meant to be overriden. Between onMouseEnter and onMouseExit, isMouseOver will return true.

onFocusEnter
void onFocusEnter()

Called when this Element is clicked and get the "focus" (ie. keyboard focus). This function is meant to be overriden.

onFocusExit
void onFocusExit()

Called when focus is lost because another Element was clicked. This widget then loose the "focus" (ie. keyboard focus). This function is meant to be overriden.

onKeyDown
bool onKeyDown(Key key)

Called when a key is pressed. This event bubbles down-up until being processed. Return true if treating the message.

onKeyUp
bool onKeyUp(Key key)

Called when a key is pressed. This event bubbles down-up until being processed. Return true if treating the message.

contains
bool contains(int x, int y)

Check if given point is within the widget. Override this to disambiguate clicks and mouse-over between widgets that would otherwise partially overlap.

mouseClick
bool mouseClick(int x, int y, int button, bool isDoubleClick, MouseState mstate)
Undocumented in source. Be warned that the author may not have intended to support it.
mouseRelease
void mouseRelease(int x, int y, int button, MouseState mstate)
Undocumented in source. Be warned that the author may not have intended to support it.
mouseWheel
bool mouseWheel(int x, int y, int wheelDeltaX, int wheelDeltaY, MouseState mstate)
Undocumented in source. Be warned that the author may not have intended to support it.
mouseMove
bool mouseMove(int x, int y, int dx, int dy, MouseState mstate, bool alreadyFoundMouseOver)
Undocumented in source. Be warned that the author may not have intended to support it.
keyDown
bool keyDown(Key key)
Undocumented in source. Be warned that the author may not have intended to support it.
keyUp
bool keyUp(Key key)
Undocumented in source. Be warned that the author may not have intended to support it.
animate
void animate(double dt, double time)
Undocumented in source. Be warned that the author may not have intended to support it.
context
UIContext context()
Undocumented in source. Be warned that the author may not have intended to support it.
isVisible
bool isVisible()

A widget is "visible" when it has a true visibility flag, and its parent is itself visible.

visibility
bool visibility()

Get visibility flag of the widget. A widget might still be invisible, if one of its parent is not visible.

visibility
void visibility(bool visible)

Change visibility flag of the widget. This show and hide all children of this UIElement, regardless of their position on screen, invalidating their graphics if need be much like a position change.

zOrder
int zOrder()
Undocumented in source. Be warned that the author may not have intended to support it.
setZOrder
alias setZOrder = zOrder
Undocumented in source.
zOrder
void zOrder(int zOrder)
Undocumented in source. Be warned that the author may not have intended to support it.
setDirtyWhole
void setDirtyWhole(UILayer layer)

Mark this element as wholly dirty.

setDirty
void setDirty(box2i rect, UILayer layer)

Mark a part of the element dirty. This part must be a subrect of its _position.

parent
UIElement parent()
topLevelParent
UIElement topLevelParent()
isMouseOver
bool isMouseOver()
isDragged
bool isDragged()
Undocumented in source. Be warned that the author may not have intended to support it.
isFocused
bool isFocused()
Undocumented in source. Be warned that the author may not have intended to support it.
drawsToPBR
bool drawsToPBR()
Undocumented in source. Be warned that the author may not have intended to support it.
drawsToRaw
bool drawsToRaw()
Undocumented in source. Be warned that the author may not have intended to support it.
isAnimated
bool isAnimated()
Undocumented in source. Be warned that the author may not have intended to support it.
isDrawAloneRaw
bool isDrawAloneRaw()
Undocumented in source. Be warned that the author may not have intended to support it.
isDrawAlonePBR
bool isDrawAlonePBR()
Undocumented in source. Be warned that the author may not have intended to support it.
getDrawLists
void getDrawLists(Vec!UIElement listRaw, Vec!UIElement listPBR)

Appends the Elements that should be drawn, in order. You should empty it before calling this function. Everything visible get into the draw list, but that doesn't mean they will get drawn if they don't overlap with a dirty area.

cursorWhenDragged
MouseCursor cursorWhenDragged()
Undocumented in source. Be warned that the author may not have intended to support it.
setCursorWhenDragged
void setCursorWhenDragged(MouseCursor mouseCursor)
Undocumented in source. Be warned that the author may not have intended to support it.
cursorWhenMouseOver
MouseCursor cursorWhenMouseOver()
Undocumented in source. Be warned that the author may not have intended to support it.
setCursorWhenMouseOver
void setCursorWhenMouseOver(MouseCursor mouseCursor)
Undocumented in source. Be warned that the author may not have intended to support it.
getUserPointer
void* getUserPointer(int pointerID)

Get a user pointer. Allow dplug:gui extensions.

setUserPointer
void setUserPointer(int pointerID, void* userPointer)

Set a user pointer. Allow dplug:gui extensions.

onDrawRaw
void onDrawRaw(ImageRef!RGBA rawMap, box2i[] dirtyRects)

Raw layer draw method. This gives you 1 surface cropped by _position for drawing. Note that you are not forced to draw to the surfaces at all.

onDrawPBR
void onDrawPBR(ImageRef!RGBA diffuseMap, ImageRef!L16 depthMap, ImageRef!RGBA materialMap, box2i[] dirtyRects)

PBR layer draw method. This gives you 3 surfaces cropped by _position for drawing. Note that you are not forced to draw all to the surfaces at all, in which case the below UIElement will be displayed.

onAnimate
void onAnimate(double dt, double time)

Called periodically for every UIElement. Override this to create animations. Using setDirty there allows to redraw an element continuously (like a meter or an animated object). Warning: Summing dt will not lead to a time that increase like time. time can go backwards if the window was reopen. time is guaranteed to increase as fast as system time but is not synced to audio time.

_parent
UIElement _parent;

Parent element. Following this chain gets to the root element.

_position
box2i _position;

Position is the graphical extent of the element, or something larger. An UIElement is not allowed though to draw further than its _position. For efficiency it's best to keep _position as small as feasible. This is an absolute "world" positioning data, that doesn't depend on the parent's position.

_children
Vec!UIElement _children;

The list of children UI elements.

_flags
immutable(uint) _flags;

Flags, for now immutable

_zOrder
int _zOrder;

Higher z-order = above other UIElement. By default, every UIElement have the same z-order. Because the sort is stable, tree traversal order is the default order (depth first). The children added last with addChild is considered above its siblings if you don't have legacyZOrder.

From IGraphics

openUI
void* openUI(void* parentInfo, void* controlInfo, IClient client, GraphicsBackend backend)

Create an UI, return a system-specific handle for the window/view

closeUI
void closeUI()

Close that UI.

getGUISize
void getGUISize(int* widthLogicalPixels, int* heightLogicalPixels)

Get the current plugin UI size in logical pixels.

isResizeable
bool isResizeable()

Used by VST3.

getMaxSmallerValidSize
void getMaxSmallerValidSize(int* inoutWidth, int* inoutHeight)

Used by VST3.

getNearestValidSize
void getNearestValidSize(int* inoutWidth, int* inoutHeight)

Used by VST3.

nativeWindowResize
bool nativeWindowResize(int newWidthLogicalPixels, int newHeightLogicalPixels)

Used by VST3. Tells the native window to resize itself. Called by the host when it's one resizing the parent window, and wants our window to follow suit. This is to be forwarded to IWindow.

Meta