package vendor:nanovg

⌘K
Ctrl+K
or
/

    Packages 1

    gl

    External Examples 2 ¶

    The programs in odin-lang/examples about this package, and how many of its declarations each uses.

    Index

    Variables (1)
    Procedures (107)
    Procedure Groups (1)

    Types

    AlignHorizontal ¶

    AlignHorizontal :: fontstash.AlignHorizontal

    Related Procedures With Parameters

    AlignVertical ¶

    AlignVertical :: fontstash.AlignVertical

    Related Procedures With Parameters

    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, 
    }

    Color ¶

    Color :: [4]f32
    External examples nanovg/example

    Related Procedures With Parameters

    Related Procedures With Returns

    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, 
    }

    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,
    }
    External examples nanovg/example · nanovg/fbo

    Related Procedures With Parameters

    Glyph_Position ¶

    Glyph_Position :: struct {
    	str:  int,
    	x:    f32,
    	minx: f32,
    	maxx: f32,
    }
    External examples nanovg/example

    ImageFlag ¶

    ImageFlag :: enum int {
    	GENERATE_MIPMAPS, 
    	REPEAT_X, 
    	REPEAT_Y, 
    	FLIP_Y, 
    	PREMULTIPLIED, 
    	NEAREST, 
    	NO_DELETE, 
    }

    ImageFlags ¶

    ImageFlags :: bit_set[ImageFlag]

    Related Procedures With Parameters

    LineCapType ¶

    LineCapType :: enum int {
    	BUTT, 
    	ROUND, 
    	SQUARE, 
    	BEVEL, 
    	MITER, 
    }
    External examples nanovg/example

    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,
    }
    External examples nanovg/example

    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),
    }

    Path ¶

    Path :: struct {
    	first:   int,
    	count:   int,
    	closed:  bool,
    	nbevel:  int,
    	fill:    [][4]f32,
    	stroke:  [][4]f32,
    	winding: Winding,
    	convex:  bool,
    }

    PathCache ¶

    PathCache :: struct {
    	points: [dynamic]Point,
    	paths:  [dynamic]Path,
    	verts:  [dynamic][4]f32,
    	bounds: [4]f32,
    }

    Point ¶

    Point :: struct {
    	x:     f32,
    	y:     f32,
    	dx:    f32,
    	dy:    f32,
    	len:   f32,
    	dmx:   f32,
    	dmy:   f32,
    	flags: bit_set[PointFlag],
    }

    PointFlag ¶

    PointFlag :: enum int {
    	CORNER, 
    	LEFT, 
    	BEVEL, 
    	INNER_BEVEL, 
    }

    ScissorT ¶

    ScissorT :: struct {
    	xform:  [6]f32,
    	extent: [2]f32,
    }

    Solidity ¶

    Solidity :: enum int {
    	SOLID = 1, // CCW
    	HOLE,      // CW
    }

    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 :: struct {
    	start: int,
    	end:   int,
    	next:  int,
    	width: f32,
    	minx:  f32,
    	maxx:  f32,
    }
     

    text row with relative byte offsets into a string

    External examples nanovg/example

    Texture ¶

    Texture :: enum int {
    	Alpha, 
    	RGBA, 
    }

    Vertex ¶

    Vertex :: [4]f32
     

    x,y,u,v

    Related Procedures With Parameters

    Related Procedures With Returns

    Winding ¶

    Winding :: enum int {
    	CCW = 1, 
    	CW, 
    }

    Related Procedures With Parameters

    Constants

    KAPPA ¶

    KAPPA :: 0.5522847493

    Variables

    OP_STATE_TABLE ¶

    OP_STATE_TABLE: [CompositeOperation][2]BlendFactor = …
     

    state table instead of if else chains

    Procedures

    AddFallbackFont ¶

    AddFallbackFont :: proc(ctx: ^Context, base_font: string, fallback_font: string) -> bool {…}
     

    Adds a fallback font by name.

    AddFallbackFontId ¶

    AddFallbackFontId :: proc(ctx: ^Context, base_font, fallback_font: int) -> bool {…}
     

    Adds a fallback font by handle.

    External examples nanovg/example

    Arc ¶

    Arc :: proc(
    	ctx:               ^Context, 
    	cx, cy, r, a0, a1: f32, 
    	dir:               Winding, 
    ) {…}
     

    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.

    External examples nanovg/example

    ArcTo ¶

    ArcTo :: proc(
    	ctx:    ^Context, 
    	x1, y1: f32, 
    	x2, y2: f32, 
    	radius: f32, 
    ) {…}
     

    Adds an arc segment at the corner defined by the last path point, and two specified points.

    BeginFrame ¶

    BeginFrame :: proc(ctx: ^Context, windowWidth: f32, windowHeight: f32, devicePixelRatio: f32) {…}
     

    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.

    External examples nanovg/example · nanovg/fbo

    BeginPath ¶

    BeginPath :: proc(ctx: ^Context) {…}
     

    Clears the current path and sub-paths.

    External examples nanovg/example · nanovg/fbo

    BezierTo ¶

    BezierTo :: proc(
    	ctx:      ^Context, 
    	c1x, c1y: f32, 
    	c2x, c2y: f32, 
    	x, 
    	y:        f32, 
    ) {…}
     

    Adds cubic bezier segment from last point in the path via two control points to the specified point.

    External examples nanovg/example

    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().

    External examples nanovg/example

    CancelFrame ¶

    CancelFrame :: proc(ctx: ^Context) {…}
     

    Cancels drawing the current frame.

    Circle ¶

    Circle :: proc(ctx: ^Context, cx, cy: f32, radius: f32) {…}
     

    Creates new circle shaped sub-path.

    External examples nanovg/example · nanovg/fbo

    ClosePath ¶

    ClosePath :: proc(ctx: ^Context) {…}
     

    Closes current sub-path with a line segment.

    External examples nanovg/example

    ColorHex ¶

    ColorHex :: proc(color: u32) -> (res: [4]f32) {…}
     

    hex to 0xAARRGGBB color

    CreateFont ¶

    CreateFont :: proc(ctx: ^Context, name, filename: string) -> int {…}
     

    Creates font by loading it from the disk from specified file name. Returns handle to the font.

    External examples nanovg/example · nanovg/fbo

    CreateFontMem ¶

    CreateFontMem :: proc(ctx: ^Context, name: string, slice: []u8, free_loaded_data: bool) -> int {…}
     

    Creates font by loading it from the specified memory chunk. Returns handle to the font.

    CreateImageMem ¶

    CreateImageMem :: proc(ctx: ^Context, data: []u8, imageFlags: bit_set[ImageFlag]) -> int {…}
     

    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.

    CreateInternal ¶

    CreateInternal :: proc(params: Params) -> (ctx: ^Context) {…}

    CurrentTransform ¶

    CurrentTransform :: proc(ctx: ^Context, xform: ^[6]f32) {…}
     

    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) {…}

    DegToRad ¶

    DegToRad :: proc(deg: f32) -> f32 {…}
    External examples nanovg/example

    DeleteImage ¶

    DeleteImage :: proc(ctx: ^Context, image: int) {…}
     

    Deletes created image.

    External examples nanovg/example

    DeleteInternal ¶

    DeleteInternal :: proc(ctx: ^Context) {…}

    Ellipse ¶

    Ellipse :: proc(ctx: ^Context, cx, cy, rx, ry: f32) {…}
     

    Creates new ellipse shaped sub-path.

    External examples nanovg/example

    EndFrame ¶

    EndFrame :: proc(ctx: ^Context) {…}
     

    Ends drawing flushing remaining render state.

    External examples nanovg/fbo · nanovg/example

    Fill ¶

    Fill :: proc(ctx: ^Context) {…}
     

    Fills the current path with current fill style.

    External examples nanovg/example · nanovg/fbo

    FillColor ¶

    FillColor :: proc(ctx: ^Context, color: [4]f32) {…}
     

    Sets current fill style to a solid color.

    External examples nanovg/example · nanovg/fbo

    FillPaint ¶

    FillPaint :: proc(ctx: ^Context, paint: Paint) {…}
     

    Sets current fill style to a paint, which can be a one of the gradients or a pattern.

    External examples nanovg/example · nanovg/fbo

    FillScoped ¶

    @(deferred_in=Fill)
    FillScoped :: proc(ctx: ^Context) {…}
    External examples nanovg/example · nanovg/fbo

    FillStrokeScoped ¶

    @(deferred_in=Stroke)
    FillStrokeScoped :: proc(ctx: ^Context) {…}

    FindFont ¶

    FindFont :: proc(ctx: ^Context, name: string) -> int {…}
     

    Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.

    FontBlur ¶

    FontBlur :: proc(ctx: ^Context, blur: f32) {…}
     

    Sets the blur of current text style.

    External examples nanovg/example

    FontFace ¶

    FontFace :: proc(ctx: ^Context, font: string) {…}
     

    Sets the font face based on specified name of current text style.

    External examples nanovg/example

    FontFaceId ¶

    FontFaceId :: proc(ctx: ^Context, font: int) {…}
     

    Sets the font face based on specified name of current text style.

    FontSize ¶

    FontSize :: proc(ctx: ^Context, size: f32) {…}
     

    Sets the font size of current text style.

    External examples nanovg/example

    FrameScoped ¶

    @(deferred_out=EndFrame)
    FrameScoped :: proc(
    	ctx:              ^Context, 
    	windowWidth:      f32, 
    	windowHeight:     f32, 
    	devicePixelRatio: f32, 
    ) -> ^Context {…}
    External examples nanovg/fbo

    GlobalAlpha ¶

    GlobalAlpha :: proc(ctx: ^Context, alpha: f32) {…}
     

    Sets the transparency applied to all rendered shapes. Already transparent paths will get proportionally more transparent as well.

    External examples nanovg/example

    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 ¶

    HSL :: proc(h, s, l: f32) -> [4]f32 {…}
     

    Returns color value specified by hue, saturation and lightness. HSL values are all in range [0..1], alpha will be set to 255.

    HSLA ¶

    HSLA :: proc(hue, saturation, lightness: f32, a: u8) -> (col: [4]f32) {…}
     

    Returns color value specified by hue, saturation and lightness and alpha. HSL values are all in range [0..1], alpha in range [0..255]

    External examples nanovg/example · nanovg/fbo

    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().

    External examples nanovg/example · nanovg/fbo

    ImageSize ¶

    ImageSize :: proc(ctx: ^Context, image: int) -> (w, h: int) {…}
     

    Returns the dimensions of a created image.

    External examples nanovg/example · nanovg/fbo

    IntersectScissor ¶

    IntersectScissor :: proc(ctx: ^Context, x, y, w, h: f32) {…}
     

    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.

    External examples nanovg/example

    LerpRGBA ¶

    LerpRGBA :: proc(c0, c1: [4]f32, u: f32) -> (cint: [4]f32) {…}
     

    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.

    External examples nanovg/example

    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.

    External examples nanovg/example

    LineTo ¶

    LineTo :: proc(ctx: ^Context, x, y: f32) {…}
     

    Adds line segment from the last point in the path to the specified point.

    External examples nanovg/example

    LinearGradient ¶

    LinearGradient :: proc(
    	sx, sy: f32, 
    	ex, ey: f32, 
    	icol:   [4]f32, 
    	ocol:   [4]f32, 
    ) -> (p: Paint) {…}
     

    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().

    External examples nanovg/example

    MiterLimit ¶

    MiterLimit :: proc(ctx: ^Context, limit: f32) {…}
     

    Sets the miter limit of the stroke style. Miter limit controls when a sharp corner is beveled.

    MoveTo ¶

    MoveTo :: proc(ctx: ^Context, x, y: f32) {…}
     

    Starts new sub-path with specified point as first point.

    External examples nanovg/example

    PathSolidity ¶

    PathSolidity :: proc(ctx: ^Context, solidity: Solidity) {…}
     

    same as path_winding but with different enum

    External examples nanovg/example

    PathWinding ¶

    PathWinding :: proc(ctx: ^Context, direction: Winding) {…}
     

    Sets the current sub-path winding, see NVGwinding and NVGsolidity.

    QuadTo ¶

    QuadTo :: proc(ctx: ^Context, cx, cy, x, y: f32) {…}
     

    Adds quadratic bezier segment from last point in the path via a control point to the specified point.

    RGB ¶

    RGB :: proc(r, g, b: u8) -> [4]f32 {…}
     

    Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0f).

    External examples nanovg/example

    RGBA ¶

    RGBA :: proc(r, g, b, a: u8) -> (res: [4]f32) {…}
     

    Returns a color value from red, green, blue and alpha values.

    External examples nanovg/example · nanovg/fbo

    RadToDeg ¶

    RadToDeg :: proc(rad: f32) -> f32 {…}

    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().

    External examples nanovg/example

    Rect ¶

    Rect :: proc(ctx: ^Context, x, y, w, h: f32) {…}
     

    Creates new rectangle shaped sub-path.

    External examples nanovg/example · nanovg/fbo

    Reset ¶

    Reset :: proc(ctx: ^Context) {…}
     

    Resets current render state to default values. Does not affect the render state stack.

    ResetFallbackFonts ¶

    ResetFallbackFonts :: proc(ctx: ^Context, base_font: string) {…}
     

    Resets fallback fonts by name.

    ResetFallbackFontsId ¶

    ResetFallbackFontsId :: proc(ctx: ^Context, base_font: int) {…}
     

    Resets fallback fonts by handle.

    ResetScissor ¶

    ResetScissor :: proc(ctx: ^Context) {…}
     

    Reset and disables scissoring.

    External examples nanovg/example

    ResetTransform ¶

    ResetTransform :: proc(ctx: ^Context) {…}
     

    Resets current transform to a identity matrix.

    Restore ¶

    Restore :: proc(ctx: ^Context) {…}
     

    Pops and restores current render state.

    External examples nanovg/example

    Rotate ¶

    Rotate :: proc(ctx: ^Context, angle: f32) {…}
     

    Rotates current coordinate system. Angle is specified in radians.

    External examples nanovg/example

    RoundedRect ¶

    RoundedRect :: proc(
    	ctx:        ^Context, 
    	x, y, w, h, 
    	radius:     f32, 
    ) {…}
     

    Creates new rounded rectangle shaped sub-path.

    External examples nanovg/example · nanovg/fbo

    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.

    External examples nanovg/example

    SaveScoped ¶

    @(deferred_in=Restore)
    SaveScoped :: proc(ctx: ^Context) {…}
     

    NOTE useful helper

    External examples nanovg/example · nanovg/fbo

    Scale ¶

    Scale :: proc(ctx: ^Context, x, y: f32) {…}
     

    Scales the current coordinate system.

    External examples nanovg/example

    Scissor ¶

    Scissor :: proc(ctx: ^Context, x, y: f32, width, height: f32) {…}
     

    Sets the current scissor rectangle. The scissor rectangle is transformed by the current transform.

    External examples nanovg/example

    ShapeAntiAlias ¶

    ShapeAntiAlias :: proc(ctx: ^Context, enabled: bool) {…}
     

    Sets whether to draw antialias for nvgStroke() and nvgFill(). It's enabled by default.

    SkewX ¶

    SkewX :: proc(ctx: ^Context, angle: f32) {…}
     

    Skews the current coordinate system along X axis. Angle is specified in radians.

    SkewY ¶

    SkewY :: proc(ctx: ^Context, angle: f32) {…}
     

    Skews the current coordinate system along Y axis. Angle is specified in radians.

    Stroke ¶

    Stroke :: proc(ctx: ^Context) {…}
     

    Fills the current path with current stroke style.

    External examples nanovg/example · nanovg/fbo

    StrokeColor ¶

    StrokeColor :: proc(ctx: ^Context, color: [4]f32) {…}
     

    Sets current stroke style to a solid color.

    External examples nanovg/example · nanovg/fbo

    StrokePaint ¶

    StrokePaint :: proc(ctx: ^Context, paint: Paint) {…}
     

    Sets current stroke style to a paint, which can be a one of the gradients or a pattern.

    StrokeScoped ¶

    @(deferred_in=Stroke)
    StrokeScoped :: proc(ctx: ^Context) {…}
    External examples nanovg/example

    StrokeWidth ¶

    StrokeWidth :: proc(ctx: ^Context, width: f32) {…}
     

    Sets the stroke width of the stroke style.

    External examples nanovg/example · nanovg/fbo

    Text ¶

    Text :: proc(ctx: ^Context, x, y: f32, text: string) -> f32 {…}
     

    Draws text string at specified location. If end is specified only the sub-string up to the end is drawn.

    External examples nanovg/example

    TextAlign ¶

    TextAlign :: proc(ctx: ^Context, ah: fontstash.AlignHorizontal, av: fontstash.AlignVertical) {…}
     

    Sets the text align of current text style, see NVGalign for options.

    External examples nanovg/example

    TextAlignHorizontal ¶

    TextAlignHorizontal :: proc(ctx: ^Context, align: fontstash.AlignHorizontal) {…}
     

    Sets the horizontal text align of current text style

    External examples nanovg/example

    TextAlignVertical ¶

    TextAlignVertical :: proc(ctx: ^Context, align: fontstash.AlignVertical) {…}
     

    Sets the vertical text align of current text style

    External examples nanovg/example

    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.

    External examples nanovg/example

    TextBox ¶

    TextBox :: proc(ctx: ^Context, x, y: f32, break_row_width: f32, input: string) {…}
     

    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).

    External examples nanovg/example

    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.

    External examples nanovg/example

    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).

    External examples nanovg/example

    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.

    External examples nanovg/example

    TextIcon ¶

    TextIcon :: proc(ctx: ^Context, xpos, ypos: f32, codepoint: rune) -> f32 {…}
     

    draw a single codepoint, useful for icons

    External examples nanovg/example

    TextLetterSpacing ¶

    TextLetterSpacing :: proc(ctx: ^Context, spacing: f32) {…}
     

    Sets the letter spacing of current text style.

    TextLineHeight ¶

    TextLineHeight :: proc(ctx: ^Context, lineHeight: f32) {…}
     

    Sets the proportional line height of current text style. The line height is specified as multiple of font size.

    External examples nanovg/example

    TextMetrics ¶

    TextMetrics :: proc(ctx: ^Context) -> (ascender, descender, lineHeight: f32) {…}
     

    Returns the vertical metrics based on the current text style. Measured values are returned in local coordinate space.

    External examples nanovg/example

    Transform ¶

    Transform :: proc(
    	ctx:           ^Context, 
    	a, b, c, d, e, 
    	f:             f32, 
    ) {…}

    TransformIdentity ¶

    TransformIdentity :: proc(t: ^[6]f32) {…}
     

    Sets the transform to identity matrix.

    TransformInverse ¶

    TransformInverse :: proc(inv: ^[6]f32, t: [6]f32) -> bool {…}
     

    Sets the destination to inverse of specified transform. Returns true if the inverse could be calculated, else false.

    TransformMultiply ¶

    TransformMultiply :: proc(t: ^[6]f32, s: [6]f32) {…}
     

    Sets the transform to the result of multiplication of two transforms, of A = A*B.

    TransformPoint ¶

    TransformPoint :: proc(dx: ^f32, dy: ^f32, t: [6]f32, sx: f32, sy: f32) {…}
     

    Transform a point by given transform.

    TransformPremultiply ¶

    TransformPremultiply :: proc(t: ^[6]f32, s: [6]f32) {…}
     

    Sets the transform to the result of multiplication of two transforms, of A = B*A.

    TransformRotate ¶

    TransformRotate :: proc(t: ^[6]f32, a: f32) {…}
     

    Sets the transform to rotate matrix. Angle is specified in radians.

    TransformScale ¶

    TransformScale :: proc(t: ^[6]f32, sx, sy: f32) {…}
     

    Sets the transform to scale matrix.

    TransformSkewX ¶

    TransformSkewX :: proc(t: ^[6]f32, a: f32) {…}
     

    Sets the transform to skew-x matrix. Angle is specified in radians.

    TransformSkewY ¶

    TransformSkewY :: proc(t: ^[6]f32, a: f32) {…}
     

    Sets the transform to skew-y matrix. Angle is specified in radians.

    TransformTranslate ¶

    TransformTranslate :: proc(t: ^[6]f32, tx, ty: f32) {…}
     

    Sets the transform to translation matrix matrix.

    Translate ¶

    Translate :: proc(ctx: ^Context, x, y: f32) {…}
     

    Translates current coordinate system.

    External examples nanovg/example

    UpdateImage ¶

    UpdateImage :: proc(ctx: ^Context, image: int, data: []u8) {…}
     

    Updates image data specified by image handle.

    Procedure Groups

    CreateImage ¶

    CreateImage :: proc{
    	CreateImagePath,
    	CreateImageMem,
    }
    
    External examples nanovg/example

    Source Files

    Generation Information

    Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-12 23:22:57.846843600 +0000 UTC