package vendor:nanovg
Index
Variables (1)
Procedures (107)
- AddFallbackFont
- AddFallbackFontId
- Arc
- ArcTo
- BeginFrame
- BeginPath
- BezierTo
- BoxGradient
- CancelFrame
- Circle
- ClosePath
- ColorHex
- CreateFont
- CreateFontMem
- CreateImageMem
- CreateImagePath
- CreateImageRGBA
- CreateInternal
- CurrentTransform
- DebugDumpPathCache
- DegToRad
- DeleteImage
- DeleteInternal
- Ellipse
- EndFrame
- Fill
- FillColor
- FillPaint
- FillScoped
- FillStrokeScoped
- FindFont
- FontBlur
- FontFace
- FontFaceId
- FontSize
- FrameScoped
- GlobalAlpha
- GlobalCompositeBlendFunc
- GlobalCompositeBlendFuncSeparate
- GlobalCompositeOperation
- HSL
- HSLA
- ImagePattern
- ImageSize
- IntersectScissor
- LerpRGBA
- LineCap
- LineJoin
- LineTo
- LinearGradient
- MiterLimit
- MoveTo
- PathSolidity
- PathWinding
- QuadTo
- RGB
- RGBA
- RadToDeg
- RadialGradient
- Rect
- Reset
- ResetFallbackFonts
- ResetFallbackFontsId
- ResetScissor
- ResetTransform
- Restore
- Rotate
- RoundedRect
- RoundedRectVarying
- Save
- SaveScoped
- Scale
- Scissor
- ShapeAntiAlias
- SkewX
- SkewY
- Stroke
- StrokeColor
- StrokePaint
- StrokeScoped
- StrokeWidth
- Text
- TextAlign
- TextAlignHorizontal
- TextAlignVertical
- TextBounds
- TextBox
- TextBoxBounds
- TextBreakLines
- TextGlyphPositions
- TextIcon
- TextLetterSpacing
- TextLineHeight
- TextMetrics
- Transform
- TransformIdentity
- TransformInverse
- TransformMultiply
- TransformPoint
- TransformPremultiply
- TransformRotate
- TransformScale
- TransformSkewX
- TransformSkewY
- TransformTranslate
- Translate
- UpdateImage
Procedure Groups (1)
Types
AlignHorizontal ¶
AlignHorizontal :: fontstash.AlignHorizontal
AlignVertical ¶
AlignVertical :: fontstash.AlignVertical
BlendFactor ¶
BlendFactor :: enum int { ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, SRC_ALPHA_SATURATE, }
Related Procedures With Parameters
Codepoint_Type ¶
Codepoint_Type :: enum int { Space, Newline, Char, CJK, }
Commands ¶
Commands :: enum int { MOVE_TO, LINE_TO, BEZIER_TO, CLOSE, WINDING, }
CompositeOperation ¶
CompositeOperation :: enum int { SOURCE_OVER, SOURCE_IN, SOURCE_OUT, ATOP, DESTINATION_OVER, DESTINATION_IN, DESTINATION_OUT, DESTINATION_ATOP, LIGHTER, COPY, XOR, }
Related Procedures With Parameters
CompositeOperationState ¶
CompositeOperationState :: struct { srcRGB: BlendFactor, dstRGB: BlendFactor, srcAlpha: BlendFactor, dstAlpha: BlendFactor, }
Context ¶
Context :: struct { params: Params, commands: [dynamic]f32, commandx: f32, commandy: f32, states: [32]State, nstates: int, cache: PathCache, tessTol: f32, distTol: f32, fringeWidth: f32, devicePxRatio: f32, // font fs: fontstash.FontContext, fontImages: [4]int, fontImageIdx: int, // stats drawCallCount: int, fillTriCount: int, strokeTriCount: int, textTriCount: int, // flush texture textureDirty: bool, }
Related Procedures With Parameters
- AddFallbackFont
- AddFallbackFontId
- Arc
- ArcTo
- BeginFrame
- BeginPath
- BezierTo
- CancelFrame
- Circle
- ClosePath
- CreateFont
- CreateFontMem
- CreateImageMem
- CreateImagePath
- CreateImageRGBA
- CurrentTransform
- DebugDumpPathCache
- DeleteImage
- DeleteInternal
- Ellipse
- EndFrame
- Fill
- FillColor
- FillPaint
- FillScoped
- FillStrokeScoped
- FindFont
- FontBlur
- FontFace
- FontFaceId
- FontSize
- FrameScoped
- GlobalAlpha
- GlobalCompositeBlendFunc
- GlobalCompositeBlendFuncSeparate
- GlobalCompositeOperation
- ImageSize
- IntersectScissor
- LineCap
- LineJoin
- LineTo
- MiterLimit
- MoveTo
- PathSolidity
- PathWinding
- QuadTo
- Rect
- Reset
- ResetFallbackFonts
- ResetFallbackFontsId
- ResetScissor
- ResetTransform
- Restore
- Rotate
- RoundedRect
- RoundedRectVarying
- Save
- SaveScoped
- Scale
- Scissor
- ShapeAntiAlias
- SkewX
- SkewY
- Stroke
- StrokeColor
- StrokePaint
- StrokeScoped
- StrokeWidth
- Text
- TextAlign
- TextAlignHorizontal
- TextAlignVertical
- TextBounds
- TextBox
- TextBoxBounds
- TextBreakLines
- TextGlyphPositions
- TextIcon
- TextLetterSpacing
- TextLineHeight
- TextMetrics
- Transform
- Translate
- UpdateImage
- CreateImage (procedure groups)
Related Procedures With Returns
ImageFlag ¶
ImageFlag :: enum int { GENERATE_MIPMAPS, REPEAT_X, REPEAT_Y, FLIP_Y, PREMULTIPLIED, NEAREST, NO_DELETE, }
ImageFlags ¶
ImageFlags :: bit_set[ImageFlag]
LineCapType ¶
LineCapType :: enum int { BUTT, ROUND, SQUARE, BEVEL, MITER, }
Related Procedures With Parameters
Paint ¶
Paint :: struct { xform: [6]f32, extent: [2]f32, radius: f32, feather: f32, innerColor: [4]f32, outerColor: [4]f32, image: int, }
Related Procedures With Parameters
Related Procedures With Returns
Params ¶
Params :: struct { userPtr: rawptr, edgeAntiAlias: bool, // callbacks to fill out renderCreate: proc(uptr: rawptr) -> bool, renderDelete: proc(uptr: rawptr), // textures calls renderCreateTexture: proc(uptr: rawptr, type: Texture, w, h: int, imageFlags: bit_set[ImageFlag], data: []u8) -> int, renderDeleteTexture: proc(uptr: rawptr, image: int) -> bool, renderUpdateTexture: proc(uptr: rawptr, image: int, x, y: int, w, h: int, data: []u8) -> bool, renderGetTextureSize: proc(uptr: rawptr, image: int, w, h: ^int) -> bool, // rendering calls renderViewport: proc(uptr: rawptr, width, height, devicePixelRatio: f32), renderCancel: proc(uptr: rawptr), renderFlush: proc(uptr: rawptr), renderFill: proc(uptr: rawptr, paint: ^Paint, compositeOperation: CompositeOperationState, scissor: ^ScissorT, fringe: f32, bounds: [4]f32, paths: []Path), renderStroke: proc(uptr: rawptr, paint: ^Paint, compositeOperation: CompositeOperationState, scissor: ^ScissorT, fringe: f32, strokeWidth: f32, paths: []Path), renderTriangles: proc(uptr: rawptr, paint: ^Paint, compositeOperation: CompositeOperationState, scissor: ^ScissorT, verts: [][4]f32, fringe: f32), }
Related Procedures With Parameters
PointFlag ¶
PointFlag :: enum int { CORNER, LEFT, BEVEL, INNER_BEVEL, }
PointFlags ¶
PointFlags :: bit_set[PointFlag]
Solidity ¶
Solidity :: enum int { SOLID = 1, // CCW HOLE, // CW }
Related Procedures With Parameters
State ¶
State :: struct { compositeOperation: CompositeOperationState, shapeAntiAlias: bool, fill: Paint, stroke: Paint, strokeWidth: f32, miterLimit: f32, lineJoin: LineCapType, lineCap: LineCapType, alpha: f32, xform: [6]f32, scissor: ScissorT, // font state fontSize: f32, letterSpacing: f32, lineHeight: f32, fontBlur: f32, alignHorizontal: fontstash.AlignHorizontal, alignVertical: fontstash.AlignVertical, fontId: int, }
Text_Row ¶
text row with relative byte offsets into a string
Constants
INIT_COMMANDS_SIZE ¶
INIT_COMMANDS_SIZE :: 256
INIT_FONTIMAGE_SIZE ¶
INIT_FONTIMAGE_SIZE :: 512
INIT_PATH_SIZE ¶
INIT_PATH_SIZE :: 16
INIT_POINTS_SIZE ¶
INIT_POINTS_SIZE :: 128
INIT_VERTS_SIZE ¶
INIT_VERTS_SIZE :: 26
MAX_FONTIMAGES ¶
MAX_FONTIMAGES :: 4
MAX_FONTIMAGE_SIZE ¶
MAX_FONTIMAGE_SIZE :: 2048
MAX_STATES ¶
MAX_STATES :: 32
Variables
OP_STATE_TABLE ¶
OP_STATE_TABLE: [CompositeOperation][2]BlendFactor = …
state table instead of if else chains
Procedures
AddFallbackFont ¶
Adds a fallback font by name.
AddFallbackFontId ¶
Adds a fallback font by handle.
Arc ¶
Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r, and the arc is drawn from angle a0 to a1, and swept in direction dir (NVG_CCW, or NVG_CW). Angles are specified in radians.
ArcTo ¶
Adds an arc segment at the corner defined by the last path point, and two specified points.
BeginFrame ¶
Begin drawing a new frame Calls to nanovg drawing API should be wrapped in nvgBeginFrame() & nvgEndFrame() nvgBeginFrame() defines the size of the window to render to in relation currently set viewport (i.e. glViewport on GL backends). Device pixel ration allows to control the rendering on Hi-DPI devices. For example, GLFW returns two dimension for an opened window: window size and frame buffer size. In that case you would set windowWidth/Height to the window size devicePixelRatio to: frameBufferWidth / windowWidth.
BezierTo ¶
Adds cubic bezier segment from last point in the path via two control points to the specified point.
BoxGradient ¶
BoxGradient :: proc( x, y: f32, w, h: f32, r: f32, f: f32, icol: [4]f32, ocol: [4]f32, ) -> (p: Paint) {…}
Creates and returns a radial gradient. Parameters (cx,cy) specify the center, inr and outr specify the inner and outer radius of the gradient, icol specifies the start color and ocol the end color. The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
Circle ¶
Creates new circle shaped sub-path.
CreateFont ¶
Creates font by loading it from the disk from specified file name. Returns handle to the font.
CreateFontMem ¶
Creates font by loading it from the specified memory chunk. Returns handle to the font.
CreateImageMem ¶
Creates image by loading it from the specified chunk of memory. Returns handle to the image.
CreateImagePath ¶
CreateImagePath :: proc(ctx: ^Context, filename: cstring, imageFlags: bit_set[ImageFlag]) -> int {…}
Creates image by loading it from the disk from specified file name. Returns handle to the image.
CreateImageRGBA ¶
CreateImageRGBA :: proc(ctx: ^Context, w, h: int, imageFlags: bit_set[ImageFlag], data: []u8) -> int {…}
Creates image from specified image data. Returns handle to the image.
CurrentTransform ¶
Stores the top part (a-f) of the current transformation matrix in to the specified buffer. [a c e] [b d f] [0 0 1] There should be space for 6 floats in the return buffer for the values a-f.
DebugDumpPathCache ¶
DebugDumpPathCache :: proc(ctx: ^Context) {…}
DeleteInternal ¶
DeleteInternal :: proc(ctx: ^Context) {…}
Ellipse ¶
Creates new ellipse shaped sub-path.
FillColor ¶
Sets current fill style to a solid color.
FillPaint ¶
Sets current fill style to a paint, which can be a one of the gradients or a pattern.
FillScoped ¶
FillScoped :: proc(ctx: ^Context) {…}
FillStrokeScoped ¶
FillStrokeScoped :: proc(ctx: ^Context) {…}
FindFont ¶
Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.
FontBlur ¶
Sets the blur of current text style.
FontFace ¶
Sets the font face based on specified name of current text style.
FontFaceId ¶
Sets the font face based on specified name of current text style.
FontSize ¶
Sets the font size of current text style.
GlobalAlpha ¶
Sets the transparency applied to all rendered shapes. Already transparent paths will get proportionally more transparent as well.
GlobalCompositeBlendFunc ¶
GlobalCompositeBlendFunc :: proc(ctx: ^Context, sfactor, dfactor: BlendFactor) {…}
Sets the composite operation with custom pixel arithmetic. The parameters should be one of NVGblendFactor.
GlobalCompositeBlendFuncSeparate ¶
GlobalCompositeBlendFuncSeparate :: proc(ctx: ^Context, srcRGB: BlendFactor, dstRGB: BlendFactor, srcAlpha: BlendFactor, dstAlpha: BlendFactor) {…}
Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. The parameters should be one of NVGblendFactor.
GlobalCompositeOperation ¶
GlobalCompositeOperation :: proc(ctx: ^Context, op: CompositeOperation) {…}
Sets the composite operation. The op parameter should be one of NVGcompositeOperation.
HSL ¶
Returns color value specified by hue, saturation and lightness. HSL values are all in range [0..1], alpha will be set to 255.
HSLA ¶
Returns color value specified by hue, saturation and lightness and alpha. HSL values are all in range [0..1], alpha in range [0..255]
ImagePattern ¶
ImagePattern :: proc( cx, cy: f32, w, h: f32, angle: f32, image: int, alpha: f32, ) -> (p: Paint) {…}
Creates and returns an image pattern. Parameters (ox,oy) specify the left-top location of the image pattern, (ex,ey) the size of one image, angle rotation around the top-left corner, image is handle to the image to render. The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
ImageSize ¶
Returns the dimensions of a created image.
IntersectScissor ¶
Intersects current scissor rectangle with the specified rectangle. The scissor rectangle is transformed by the current transform. Note: in case the rotation of previous scissor rect differs from the current one, the intersection will be done between the specified rectangle and the previous scissor rectangle transformed in the current transform space. The resulting shape is always rectangle.
LerpRGBA ¶
Linearly interpolates from color c0 to c1, and returns resulting color value.
LineCap ¶
LineCap :: proc(ctx: ^Context, cap: LineCapType) {…}
Sets how the end of the line (cap) is drawn, Can be one of: NVG_BUTT (default), NVG_ROUND, NVG_SQUARE.
LineJoin ¶
LineJoin :: proc(ctx: ^Context, join: LineCapType) {…}
Sets how sharp path corners are drawn. Can be one of NVG_MITER (default), NVG_ROUND, NVG_BEVEL.
LineTo ¶
Adds line segment from the last point in the path to the specified point.
LinearGradient ¶
Creates and returns a linear gradient. Parameters (sx,sy)-(ex,ey) specify the start and end coordinates of the linear gradient, icol specifies the start color and ocol the end color. The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
MiterLimit ¶
Sets the miter limit of the stroke style. Miter limit controls when a sharp corner is beveled.
MoveTo ¶
Starts new sub-path with specified point as first point.
PathSolidity ¶
same as path_winding but with different enum
PathWinding ¶
Sets the current sub-path winding, see NVGwinding and NVGsolidity.
QuadTo ¶
Adds quadratic bezier segment from last point in the path via a control point to the specified point.
RGB ¶
Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0f).
RGBA ¶
Returns a color value from red, green, blue and alpha values.
RadialGradient ¶
RadialGradient :: proc( cx, cy: f32, inr: f32, outr: f32, icol: [4]f32, ocol: [4]f32, ) -> (p: Paint) {…}
Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle, (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient. The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
Rect ¶
Creates new rectangle shaped sub-path.
Reset ¶
Reset :: proc(ctx: ^Context) {…}
Resets current render state to default values. Does not affect the render state stack.
ResetFallbackFonts ¶
Resets fallback fonts by name.
ResetFallbackFontsId ¶
Resets fallback fonts by handle.
ResetTransform ¶
ResetTransform :: proc(ctx: ^Context) {…}
Resets current transform to a identity matrix.
Rotate ¶
Rotates current coordinate system. Angle is specified in radians.
RoundedRect ¶
Creates new rounded rectangle shaped sub-path.
RoundedRectVarying ¶
RoundedRectVarying :: proc( ctx: ^Context, x, y: f32, w, h: f32, radius_top_left: f32, radius_top_right: f32, radius_bottom_right: f32, radius_bottom_left: f32, ) {…}
Creates new rounded rectangle shaped sub-path with varying radii for each corner.
Save ¶
Save :: proc(ctx: ^Context) {…}
Pushes and saves the current render state into a state stack. A matching nvgRestore() must be used to restore the state.
Scissor ¶
Sets the current scissor rectangle. The scissor rectangle is transformed by the current transform.
ShapeAntiAlias ¶
Sets whether to draw antialias for nvgStroke() and nvgFill(). It's enabled by default.
SkewX ¶
Skews the current coordinate system along X axis. Angle is specified in radians.
SkewY ¶
Skews the current coordinate system along Y axis. Angle is specified in radians.
StrokeColor ¶
Sets current stroke style to a solid color.
StrokePaint ¶
Sets current stroke style to a paint, which can be a one of the gradients or a pattern.
StrokeScoped ¶
StrokeScoped :: proc(ctx: ^Context) {…}
StrokeWidth ¶
Sets the stroke width of the stroke style.
Text ¶
Draws text string at specified location. If end is specified only the sub-string up to the end is drawn.
TextAlign ¶
TextAlign :: proc(ctx: ^Context, ah: fontstash.AlignHorizontal, av: fontstash.AlignVertical) {…}
Sets the text align of current text style, see NVGalign for options.
TextAlignHorizontal ¶
TextAlignHorizontal :: proc(ctx: ^Context, align: fontstash.AlignHorizontal) {…}
Sets the horizontal text align of current text style
TextAlignVertical ¶
TextAlignVertical :: proc(ctx: ^Context, align: fontstash.AlignVertical) {…}
Sets the vertical text align of current text style
TextBounds ¶
TextBounds :: proc(ctx: ^Context, x, y: f32, input: string, bounds: ^[4]f32 = nil) -> (advance: f32) {…}
Measures the specified text string. Parameter bounds should be a pointer to float[4], if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] Returns the horizontal advance of the measured text (i.e. where the next character should drawn). Measured values are returned in local coordinate space.
TextBox ¶
Draws multi-line text string at specified location wrapped at the specified width. If end is specified only the sub-string up to the end is drawn. White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer than the max width are slit at nearest character (i.e. no hyphenation).
TextBoxBounds ¶
TextBoxBounds :: proc( ctx: ^Context, x, y: f32, breakRowWidth: f32, input: string, bounds: ^[4]f32, ) {…}
Measures the specified multi-text string. Parameter bounds should be a pointer to float[4], if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] Measured values are returned in local coordinate space.
TextBreakLines ¶
TextBreakLines :: proc(ctx: ^Context, text: ^string, break_row_width: f32, rows: ^[]Text_Row) -> (nrows: int, last: string, ok: bool) {…}
NOTE text break lines works relative to the string in byte indexes now, instead of on pointers Breaks the specified text into lines White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer than the max width are slit at nearest character (i.e. no hyphenation).
TextGlyphPositions ¶
TextGlyphPositions :: proc(ctx: ^Context, x, y: f32, text: string, positions: ^[]Glyph_Position) -> int {…}
Calculates the glyph x positions of the specified text. Measured values are returned in local coordinate space.
TextIcon ¶
draw a single codepoint, useful for icons
TextLetterSpacing ¶
Sets the letter spacing of current text style.
TextLineHeight ¶
Sets the proportional line height of current text style. The line height is specified as multiple of font size.
TextMetrics ¶
Returns the vertical metrics based on the current text style. Measured values are returned in local coordinate space.
TransformIdentity ¶
TransformIdentity :: proc(t: ^[6]f32) {…}
Sets the transform to identity matrix.
TransformInverse ¶
Sets the destination to inverse of specified transform. Returns true if the inverse could be calculated, else false.
TransformMultiply ¶
Sets the transform to the result of multiplication of two transforms, of A = A*B.
TransformPoint ¶
Transform a point by given transform.
TransformPremultiply ¶
Sets the transform to the result of multiplication of two transforms, of A = B*A.
TransformRotate ¶
Sets the transform to rotate matrix. Angle is specified in radians.
TransformScale ¶
Sets the transform to scale matrix.
TransformSkewX ¶
Sets the transform to skew-x matrix. Angle is specified in radians.
TransformSkewY ¶
Sets the transform to skew-y matrix. Angle is specified in radians.
TransformTranslate ¶
Sets the transform to translation matrix matrix.
Translate ¶
Translates current coordinate system.
UpdateImage ¶
Updates image data specified by image handle.
Procedure Groups
CreateImage ¶
CreateImage :: proc{ CreateImagePath, CreateImageMem, }
Source Files
Generation Information
Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-20 21:10:47.652772600 +0000 UTC