flags indicating which corners are sharp (for grouping widgets)
how text on a control is aligned
states altering the styling of a widget
states altering the styling of a widget (values)
build an icon ID from two coordinates into the icon sheet, where * (0, 0) designates the upper-leftmost icon, (1, 0) the one right next to it, * and so on.
how text on a control is aligned (values)
Draw a horizontal arrow for a number field with its center at (x, y) and size s; if s is negative, the arrow points to the left.
Draw a flat panel without any decorations at position (x, y) with size (w, h) and fills it with backgroundColor
Draw a beveled border at position (x, y) with size (w, h) shaded with lighter and darker versions of backgroundColor
Draw a lower inset for a rounded box at position (x, y) with size (w, h) that gives the impression the surface has been pushed in.
Draw a checkmark for an option box with the given upper left coordinates (ox, oy) with the specified color.
Draw a choice button with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
/////////////////////////////////////////////////////////////////////////////
Clears current icon image.
Draw a color button with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
Draw a node wire originating at (x0, y0) and floating to (x1, y1), with a colored gradient based on the two colors color0 and color1
Draw a drop shadow around the rounded box at (x, y) with size (w, h) and radius r, with feather as its maximum range in pixels.
Returns opaque object with the current font.
Returns icon sheet image.
Returns the currently set theme
Draw an icon with (x, y) as its upper left coordinate; the iconid selects the icon from the sheet; use the BND_ICONID macro to build icon IDs.
Draw an optional icon specified by <iconid>, an optional label and a caret with given fontsize and color within a widget box.
Calculate the corresponding text position for given coordinates px/py in an iconLabel. See bndIconLabelCaret for more info.
Draw an optional icon specified by <iconid> and an optional label with given alignment (BNDtextAlignment), fontsize and color within a widget box.
computes the upper and lower gradient colors for the inner box from a widget theme and the widgets state. If flipActive is set and the state is BND_ACTIVE, the upper and lower colors will be swapped.
Draw the join area overlay stencil into the rectangle at origin (x, y) and size (w, h)
Draw a label with its lower left origin at (x, y) and size of (w, h).
returns the height for a label with given icon, text and width; this function is primarily useful in conjunction with multiline labels and textboxes
///////////////////////////////////////////////////////////////////////////// Estimator Functions Use these functions to estimate sizes for widgets with your NVGcontext. returns the ideal width for a label with given icon and text
Draw a menu background with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags.
Draw a menu item with its lower left origin at (x, y) and size of (w, h), where state denotes the widgets current UI state.
Draw a menu label with its lower left origin at (x, y) and size of (w, h).
/////////////////////////////////////////////////////////////////////////////
Draw a node down-arrow with its tip at (x, y) and size s
Draw a node background with its upper left origin at (x, y) and size of (w, h) where titleColor provides the base color for the title bar
Draw an optional icon specified by <iconid> and an optional label with given alignment (BNDtextAlignment), fontsize and color within a node title bar
Draw a node port at the given position filled with the given color
Draw a node wire originating at (x0, y0) and floating to (x1, y1), with a colored gradient based on the states state0 and state1:
return the color of a node wire based on state
Draw a number field with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
offset a color by a given integer delta in the range -100 to 100
Draw an option button with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
Draw the outline part of a widget box with the given color
Draw a radio button with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
Draw a radio button with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
Draw a checkmark for a radio with the given upper left coordinates (ox, oy) with the specified color.
Add a rounded box path at position (x, y) with size (w, h) and a separate radius for each corner listed in clockwise order, so that cr0 = top left, cr1 = top right, cr2 = bottom right, cr3 = bottom left;
Draw scrollbar with its lower left origin at (x, y) and size of (w, h), where state denotes the widgets current UI state.
computes the bounds of the scrollbar handle from the scrollbar size and the handles offset and size.
Draw scrollbar with its lower left origin at (x, y) and size of (w, h), where state denotes the widgets current UI state.
computes the bounds of the scroll slider from the scrollbar size and the handles offset and size.
assigns radius r to the four entries of array radiuses depending on whether the corner is marked as sharp or not; see BNDcornerFlags for possible flag values.
Designates an image handle as returned by nvgCreateFont*() as the themes' UI font. Blender's original UI font Droid Sans is perfectly suited and available here: https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/datafiles/fonts/
Designates an image handle as returned by nvgCreateFont*() as the themes' UI font. Blender's original UI font Droid Sans is perfectly suited and available here: https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/datafiles/fonts/
Sets current font from the opaque object, returned by bndGetFont.
Designates an image handle as returned by nvgCreateImage*() as the themes' icon sheet. The icon sheet format must be compatible to Blender 2.6's icon sheet; the order of icons does not matter.
///////////////////////////////////////////////////////////////////////////// Sets the current theme all widgets will be drawn with. the default Blender 2.6 theme is set by default.
Draw slider control with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
Draw a window with the upper right and lower left splitter widgets into the rectangle at origin (x, y) and size (w, h)
computes the text color for a widget label from a widget theme and the widgets state.
Draw a text field with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
Calculate the corresponding text position for given coordinates px/py in a text field. See bndTextField for more info.
Draw a tool button with its lower left origin at (x, y) and size of (w, h), where flags is one or multiple flags from BNDcornerFlags and state denotes the widgets current UI state.
Draw a tooltip background with its lower left origin at (x, y) and size of (w, h)
make color transparent using the default alpha value
Draw an up/down arrow for a choice box with its center at (x, y) and size s
default color for active element
default text color
default highlighted text color
max glyphs for position testing
max rows for position testing
shade intensity of beveled panels
alpha of disabled widget groups; can be used in conjunction with nvgGlobalAlpha()
shade intensity of hovered inner boxes
default horizontal spacing
gridsize of icon sheet in both dimensions
height of icon sheet
offset of first icon tile relative to left border
offset of first icon tile relative to top border
resolution of single icon
width of icon sheet
shade intensity of beveled insets
///////////////////////////////////////////////////////////////////////////// default text size
label: value separator string
radius of menu popup
width of node title arrow click area
size of node title arrow
bottom margin of node content
left and right margin of node content
top margin of node content
default radius of node ports
radius of node box
feather of node title text
height of node title bar
stroke width of wire outline
stroke width of wire
size of number field arrow
radius of number button
height of option button checkbox
radius of option button
width of option button checkbox
default text padding in inner box
shade intensity of active scrollbar
height of horizontal scrollbar
radius of scrollbar
width of vertical scrollbar
alpha of menu popup shadow
feather of menu popup shadow
size of splitter corner click area
shade intensity of splitter bevels
text distance from bottom
radius of text field
radius of tool button
default toolbutton width (if icon only)
alpha intensity of transparent items (0xa4)
default vertical spacing
default vertical spacing between groups
default widget height
///////////////////////////////////////////////////////////////////////////// the initial theme
describes the theme used to draw nodes
describes the theme used to draw widgets
describes the theme used to draw a single widget or widget box; * these values correspond to the same values that can be retrieved from * the Theme panel in the Blender preferences
Drawbacks
There is no support for varying dpi resolutions yet. The library is hardcoded to the equivalent of 72 dpi in the Blender system settings.
Support for label truncation is missing. Text rendering breaks when widgets are too short to contain their labels.
Revision 6 (2014-09-21)
Blendish is a small collection of drawing functions for NanoVega, designed to replicate the look of the Blender 2.5+ User Interface. You can use these functions to theme your UI library. Several metric constants for faithful reproduction are also included.
Blendish supports the original Blender icon sheet; As the licensing of Blenders icons is unclear, they are not included in Blendishes repository, but a SVG template, "icons_template.svg" is provided, which you can use to build your own icon sheet.
To use icons, you must first load the icon sheet using one of the nvgCreateImage*() functions and then pass the image handle to bndSetIconImage(); otherwise, no icons will be drawn. See bndSetIconImage() for more information.
Blendish will not render text until a suitable UI font has been passed to bndSetFont() has been called. See bndSetFont() for more information.