the display height
the display width
an array with the names of built-in color schemes
the canvas context type
true gui is over a 3D canvas
true if this gui can respond to mouse/key events
true if gui rendering is allowed
'p5js' if using p5.js else returns 'JS'
mouse x position relative to top-left corner of the canvas
mouse y position relative to top-left corner of the canvas
Adds a new color scheme to those already available. It does not replace an existing scheme.
the color scheme
this gui instance
Create a button control
unique id for this control
left-hand pixel position
top pixel position
width
height
Optionaltext: stringoptional face text
Optionalicon: cvsIconoptional face icon
a button
Create a checkbox control
unique id for this control
left-hand pixel position
top pixel position
width
height
Optionaltext: stringoptional face text
a checkbox
Get or set the default corner radii used in this GUI.
To set the radii the parameters must be one of the following
If no parameter is passed or does not match one of the above then an array of the currently used radii values.
valid radii combination
an array of the currently used radii values
This will create a new color scheme from an existing one. The returned scheme is a deep-copy of the source scheme and should be edited before adding it to the GUI with the addScheme(...) method. The name of the new scheme is specified in the first parameter and cannot be changed later.
The method will fail if -
a unique name for the user's color scheme.
the name of an existing color scheme.
the new color scheme or null if unable to create it.
If the [x, y] display position is over a controls pick region then return an object containing the 'control' and the pick region ('part') number.
horizontal pixel location
vertical pixel location
an object containing the control hit and the control part number
Get the named color scheme.
the name of the color scheme
the color scheme or undefined if it doesn't exist
Get a grid layout for a given pixel position and size in the display area. Initially the grid repreents a single cell but the number and size of horizontal and vertical cells should be set before creating the controls.
left edge position
top edge position
grid width
grid height
the grid layout
Hide all side panes. This will also close any pane that is open.
Sets the global default icon for checkboxes and option buttons.
iscon size (pixels)
Returns the unique id for this GUI.
GUI id
Create an image button control.
The button size is determined by the size of the off-button image. If a second image is provided (optional) then it will be used for the over-button state. In the absence of the second image otherwise a border highlight is used.
The button hit-zone is any non-transparent pixel if the off-button image of the mask image if provided. Any pixel with an alpha value ≥128 is considered non-transparent.
unique id for this control
left-hand pixel position
top pixel position
array of images for off-button and over-button states
hit zone image
image button control
Create a joystick control
unique id for this control
left-hand pixel position
top pixel position
width
height
a joystick control
Create a knob control
unique id for this control
left-hand pixel position
top pixel position
width
height
a knob control
Create a label control
unique id for this control
left-hand pixel position
top pixel position
width
height
Optionaltext: stringoptional face text
Optionalicon: cvsIconoptional face icon
a label
Create an option (radio button) control
unique id for this control
left-hand pixel position
top pixel position
width
height
Optionaltext: stringoptional face text
an option button
Create a side pane. The pane location is either 'north', 'south', 'east' or 'west'.
The pane will fill the whole width/height of the canvas depending on its position. The user controls how far the pane extends into the canvas when open.
unique id for this control
the pane position ('north', 'south', 'east' or 'west')
the maximum depth the pane expands into the canvas
Optionaltext: stringoptional text for the tab button
Optionalicon: cvsIconoptional icon for the tab button
a side pane
Create a label control
unique id for this control
left-hand pixel position
top pixel position
width
height
a label
Create a pin control.
The Pin control is a simple place holder for containing child controls relative to each other.
Create a poster control
unique id for this control
left-hand pixel position
top pixel position
width
height
a label
Create a ranger control
unique id for this control
left-hand pixel position
top pixel position
width
height
ranger control
Register a control so it is pickable.
If the control has already been registered it will be unchanged.
the control to make pickable
Set or get the existing global color scheme.
OptionalcsName: stringname of the color scheme to set
this gui instance
Display a 2D buffer in a canvas element with the specified ID.
An existing HTML element with this ID that is not a canvas element this will be ignored and the buffer will not be displayed.
An exising HTML canvas element with this ID will be used to display the buffer, if not it will be created and appended to the body section.
the ID (string) of the HTML canvas element to use.
the 2D canvas to display.
Show all pane tabs. All panes will be shown closed.
Create a slider control
unique id for this control
left-hand pixel position
top pixel position
width
height
slider control
Gets or sets the global minimum height for pane tabs.
the minimum tab height (must be ≥10)
this gui instance
Create a single line text input control
unique id for this control
left-hand pixel position
top pixel position
width
height
a textfield
If no parameter is passed then the global font family name will be returned.
If a parameter is provided it will be accepted if it is one of the following :-
loadFont()
function.Any other parameter value will display a warning and be ignored leaving the font unchanged.
Optionalfont: string | objectsystem or logical font, a FontFace object or a p5js font object.
this control
Sets or gets the global text size.
If no parameter is passed then the global text size is returned otherwise it returns this gui.
Optionaltsize: numbernew global text size
the global text size or this gui
Sets or gets the global text style.
The following strings are recognised as valid styles :-
'normal' 'bold' 'thin' 'italic' 'bold italic' 'thin italic' 'oblique'
It will also accept the 4 p5js constants :-
NORMAL BOLD ITALIC BOLDITALIC
Unrecognized styles are ignored and the global style left unchanged.
If no parameter is passed then the current global style is returned.
Optionalstyle: stringthe font style to use.
this control
Sets or gets the global tip text size. If no parameter is passed then the global tip text size is returned otherwise it returns this control
Optionalgtts: numbernew global tip text size
the global tip text size or this control
Controls how long a tooltip is shown and how long to wait before it can be shown again. This helps avoid the tip flicking on and off as the mouse moves over the control.
show duration (ms)
duration before the tip can be shown again
this gui
Create a viewer control
unique id for this control
left-hand pixel position
top pixel position
width
height
an image viewer
Static$$Get the GUI with the given id. If no such GUI exists then the function returns undefined.
The global function getGUI(...) is an alternative method that accepts the same parameters performs exactly the same task.
the GUI id
the matching GUI controller or undefined if not found.
Core class for the canvasGUI library
To make use of canvasGUI the user requires a GUI controller and the global method
createGUI(id, display)must be used to create it.
The first parameter (
id) is a unique string identifier for the gui. If the string is empty then a random id will be generated GUI.The second parameter (
display) must be the one of the following :createCanvas()'method executed in thesetup()'function.Any other value will result the program being terminated with an error