Class NanoVG
- java.lang.Object
-
- org.lwjgl.nanovg.NanoVG
-
public class NanoVG extends java.lang.ObjectNanoVG is a small antialiased vector graphics rendering library for OpenGL. It has lean API modeled after HTML5 canvas API. It is aimed to be a practical and fun toolset for building scalable user interfaces and visualizations.Color utils
Colors in NanoVG are stored as unsigned ints in ABGR format.
State Handling
NanoVG contains state which represents how paths will be rendered. The state contains transform, fill and stroke styles, text and font styles, and scissor clipping.
Render styles
Fill and stroke render style can be either a solid color or a paint which is a gradient or a pattern. Solid color is simply defined as a color value, different kinds of paints can be created using
LinearGradient,BoxGradient,RadialGradientandImagePattern.Current render style can be saved and restored using
SaveandRestore.Transforms
The paths, gradients, patterns and scissor region are transformed by an transformation matrix at the time when they are passed to the API. The current transformation matrix is a affine matrix:
[sx kx tx] [ky sy ty] [ 0 0 1]Where:
sx,sydefine scaling,kx,kyskewing, andtx,tytranslation. The last row is assumed to be0,0,1and is not stored.Apart from
ResetTransform, each transformation function first creates specific transformation matrix and pre-multiplies the current transformation by it.Current coordinate system (transformation) can be saved and restored using
SaveandRestore.Images
NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering. In addition you can upload your own image. The image loading is provided by
stb_image.Paints
NanoVG supports four types of paints: linear gradient, box gradient, radial gradient and image pattern. These can be used as paints for strokes and fills.
Scissoring
Scissoring allows you to clip the rendering into a rectangle. This is useful for various user interface cases like rendering a text edit or a timeline.
Paths
Drawing a new shape starts with
BeginPath, it clears all the currently defined paths. Then you define one or more paths and sub-paths which describe the shape. The are functions to draw common shapes like rectangles and circles, and lower level step-by-step functions, which allow to define a path curve by curve.NanoVG uses even-odd fill rule to draw the shapes. Solid shapes should have counter clockwise winding and holes should have counter clockwise order. To specify winding of a path you can call
PathWinding. This is useful especially for the common shapes, which are drawnCCW.Finally you can fill the path using current fill style by calling
Fill, and stroke it with current stroke style by callingStroke.The curve segments and sub-paths are transformed by the current transform.
Text
NanoVG allows you to load .ttf files and use the font to render text.
The appearance of the text can be defined by setting the current text style and by specifying the fill color. Common text and font settings such as font size, letter spacing and text align are supported. Font blur allows you to create simple text effects such as drop shadows.
At render time the font face can be set based on the font handles or name.
Font measure functions return values in local space, the calculations are carried in the same resolution as the final rendering. This is done because the text glyph positions are snapped to the nearest pixels sharp rendering.
The local space means that values are not rotated or scale as per the current transformation. For example if you set font size to 12, which would mean that line height is 16, then regardless of the current scaling and rotation, the returned line height is always 16. Some measures may vary because of the scaling since aforementioned pixel snapping.
While this may sound a little odd, the setup allows you to always render the same way regardless of scaling. I.e. following works regardless of scaling:
const char* txt = "Text me up."; nvgTextBounds(vg, x,y, txt, NULL, bounds); nvgBeginPath(vg); nvgRoundedRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]); nvgFill(vg);Note: currently only solid color fill is supported for text.
-
-
Field Summary
Fields Modifier and Type Field Description static intNVG_ALIGN_BASELINE
NVG_ALIGN_BOTTOM
NVG_ALIGN_CENTER
NVG_ALIGN_LEFT
NVG_ALIGN_MIDDLE
NVG_ALIGN_RIGHT
NVG_ALIGN_TOPAlignments.static intNVG_ATOPComposite operations.static intNVG_BEVEL
NVG_BUTTLine caps and joins.static intNVG_CCWWinding order.static intNVG_COPYComposite operations.static intNVG_CWWinding order.static intNVG_DESTINATION_ATOP
NVG_DESTINATION_IN
NVG_DESTINATION_OUT
NVG_DESTINATION_OVERComposite operations.static intNVG_DST_ALPHA
NVG_DST_COLORBlend factors.static intNVG_HOLESolidity.static intNVG_IMAGE_FLIPY
NVG_IMAGE_GENERATE_MIPMAPS
NVG_IMAGE_NEAREST
NVG_IMAGE_PREMULTIPLIED
NVG_IMAGE_REPEATX
NVG_IMAGE_REPEATYImage flags.static intNVG_LIGHTERComposite operations.static intNVG_MITERLine caps and joins.static intNVG_ONE
NVG_ONE_MINUS_DST_ALPHA
NVG_ONE_MINUS_DST_COLOR
NVG_ONE_MINUS_SRC_ALPHA
NVG_ONE_MINUS_SRC_COLORBlend factors.static floatNVG_PIPIstatic intNVG_ROUNDLine caps and joins.static intNVG_SOLIDSolidity.static intNVG_SOURCE_IN
NVG_SOURCE_OUT
NVG_SOURCE_OVERComposite operations.static intNVG_SQUARELine caps and joins.static intNVG_SRC_ALPHA
NVG_SRC_ALPHA_SATURATE
NVG_SRC_COLORBlend factors.static intNVG_XORComposite operations.static intNVG_ZEROBlend factors.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intnnvgAddFallbackFont(long ctx, long baseFont, long fallbackFont)Unsafe version of:AddFallbackFontstatic intnnvgAddFallbackFontId(long ctx, int baseFont, int fallbackFont)Unsafe version of:AddFallbackFontIdstatic voidnnvgArc(long ctx, float cx, float cy, float r, float a0, float a1, int dir)Unsafe version of:Arcstatic voidnnvgArcTo(long ctx, float x1, float y1, float x2, float y2, float radius)Unsafe version of:ArcTostatic voidnnvgBeginFrame(long ctx, float windowWidth, float windowHeight, float devicePixelRatio)Unsafe version of:BeginFramestatic voidnnvgBeginPath(long ctx)Unsafe version of:BeginPathstatic voidnnvgBezierTo(long ctx, float c1x, float c1y, float c2x, float c2y, float x, float y)Unsafe version of:BezierTostatic voidnnvgBoxGradient(long ctx, float x, float y, float w, float h, float r, float f, long icol, long ocol, long __result)Unsafe version of:BoxGradientstatic voidnnvgCancelFrame(long ctx)Unsafe version of:CancelFramestatic voidnnvgCircle(long ctx, float cx, float cy, float r)Unsafe version of:Circlestatic voidnnvgClosePath(long ctx)Unsafe version of:ClosePathstatic intnnvgCreateFont(long ctx, long name, long filename)Unsafe version of:CreateFontstatic intnnvgCreateFontAtIndex(long ctx, long name, long filename, int fontIndex)Unsafe version of:CreateFontAtIndexstatic intnnvgCreateFontMem(long ctx, long name, long data, int ndata, int freeData)Unsafe version of:CreateFontMemstatic intnnvgCreateFontMemAtIndex(long ctx, long name, long data, int ndata, int freeData, int fontIndex)Unsafe version of:CreateFontMemAtIndexstatic intnnvgCreateImage(long ctx, long filename, int imageFlags)Unsafe version of:CreateImagestatic intnnvgCreateImageMem(long ctx, int imageFlags, long data, int ndata)Unsafe version of:CreateImageMemstatic intnnvgCreateImageRGBA(long ctx, int w, int h, int imageFlags, long data)Unsafe version of:CreateImageRGBAstatic voidnnvgCurrentTransform(long ctx, float[] xform)Array version of:nnvgCurrentTransform(long, long)static voidnnvgCurrentTransform(long ctx, long xform)Unsafe version of:CurrentTransformstatic voidnnvgDeleteImage(long ctx, int image)Unsafe version of:DeleteImagestatic voidnnvgEllipse(long ctx, float cx, float cy, float rx, float ry)Unsafe version of:Ellipsestatic voidnnvgEndFrame(long ctx)Unsafe version of:EndFramestatic voidnnvgFill(long ctx)Unsafe version of:Fillstatic voidnnvgFillColor(long ctx, long color)Unsafe version of:FillColorstatic voidnnvgFillPaint(long ctx, long paint)Unsafe version of:FillPaintstatic intnnvgFindFont(long ctx, long name)Unsafe version of:FindFontstatic voidnnvgFontBlur(long ctx, float blur)Unsafe version of:FontBlurstatic voidnnvgFontFace(long ctx, long font)Unsafe version of:FontFacestatic voidnnvgFontFaceId(long ctx, int font)Unsafe version of:FontFaceIdstatic voidnnvgFontSize(long ctx, float size)Unsafe version of:FontSizestatic voidnnvgGlobalAlpha(long ctx, float alpha)Unsafe version of:GlobalAlphastatic voidnnvgGlobalCompositeBlendFunc(long ctx, int sfactor, int dfactor)Unsafe version of:GlobalCompositeBlendFuncstatic voidnnvgGlobalCompositeBlendFuncSeparate(long ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)Unsafe version of:GlobalCompositeBlendFuncSeparatestatic voidnnvgGlobalCompositeOperation(long ctx, int op)Unsafe version of:GlobalCompositeOperationstatic voidnnvgHSL(float h, float s, float l, long __result)Unsafe version of:HSLstatic voidnnvgHSLA(float h, float s, float l, byte a, long __result)Unsafe version of:HSLAstatic voidnnvgImagePattern(long ctx, float ox, float oy, float ex, float ey, float angle, int image, float alpha, long __result)Unsafe version of:ImagePatternstatic voidnnvgImageSize(long ctx, int image, int[] w, int[] h)Array version of:nnvgImageSize(long, int, long, long)static voidnnvgImageSize(long ctx, int image, long w, long h)Unsafe version of:ImageSizestatic voidnnvgIntersectScissor(long ctx, float x, float y, float w, float h)Unsafe version of:IntersectScissorstatic voidnnvgLerpRGBA(long c0, long c1, float u, long __result)Unsafe version of:LerpRGBAstatic voidnnvgLinearGradient(long ctx, float sx, float sy, float ex, float ey, long icol, long ocol, long __result)Unsafe version of:LinearGradientstatic voidnnvgLineCap(long ctx, int cap)Unsafe version of:LineCapstatic voidnnvgLineJoin(long ctx, int join)Unsafe version of:LineJoinstatic voidnnvgLineTo(long ctx, float x, float y)Unsafe version of:LineTostatic voidnnvgMiterLimit(long ctx, float limit)Unsafe version of:MiterLimitstatic voidnnvgMoveTo(long ctx, float x, float y)Unsafe version of:MoveTostatic voidnnvgPathWinding(long ctx, int dir)Unsafe version of:PathWindingstatic voidnnvgQuadTo(long ctx, float cx, float cy, float x, float y)Unsafe version of:QuadTostatic voidnnvgRadialGradient(long ctx, float cx, float cy, float inr, float outr, long icol, long ocol, long __result)Unsafe version of:RadialGradientstatic voidnnvgRect(long ctx, float x, float y, float w, float h)Unsafe version of:Rectstatic voidnnvgReset(long ctx)Unsafe version of:Resetstatic voidnnvgResetFallbackFonts(long ctx, long baseFont)Unsafe version of:ResetFallbackFontsstatic voidnnvgResetFallbackFontsId(long ctx, int baseFont)Unsafe version of:ResetFallbackFontsIdstatic voidnnvgResetScissor(long ctx)Unsafe version of:ResetScissorstatic voidnnvgResetTransform(long ctx)Unsafe version of:ResetTransformstatic voidnnvgRestore(long ctx)Unsafe version of:Restorestatic voidnnvgRGB(byte r, byte g, byte b, long __result)Unsafe version of:RGBstatic voidnnvgRGBA(byte r, byte g, byte b, byte a, long __result)Unsafe version of:RGBAstatic voidnnvgRGBAf(float r, float g, float b, float a, long __result)Unsafe version of:RGBAfstatic voidnnvgRGBf(float r, float g, float b, long __result)Unsafe version of:RGBfstatic voidnnvgRotate(long ctx, float angle)Unsafe version of:Rotatestatic voidnnvgRoundedRect(long ctx, float x, float y, float w, float h, float r)Unsafe version of:RoundedRectstatic voidnnvgRoundedRectVarying(long ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft)Unsafe version of:RoundedRectVaryingstatic voidnnvgSave(long ctx)Unsafe version of:Savestatic voidnnvgScale(long ctx, float x, float y)Unsafe version of:Scalestatic voidnnvgScissor(long ctx, float x, float y, float w, float h)Unsafe version of:Scissorstatic voidnnvgShapeAntiAlias(long ctx, int enabled)Unsafe version of:ShapeAntiAliasstatic voidnnvgSkewX(long ctx, float angle)Unsafe version of:SkewXstatic voidnnvgSkewY(long ctx, float angle)Unsafe version of:SkewYstatic voidnnvgStroke(long ctx)Unsafe version of:Strokestatic voidnnvgStrokeColor(long ctx, long color)Unsafe version of:StrokeColorstatic voidnnvgStrokePaint(long ctx, long paint)Unsafe version of:StrokePaintstatic voidnnvgStrokeWidth(long ctx, float size)Unsafe version of:StrokeWidthstatic floatnnvgText(long ctx, float x, float y, long string, long end)Unsafe version of:Textstatic voidnnvgTextAlign(long ctx, int align)Unsafe version of:TextAlignstatic floatnnvgTextBounds(long ctx, float x, float y, long string, long end, float[] bounds)Array version of:nnvgTextBounds(long, float, float, long, long, long)static floatnnvgTextBounds(long ctx, float x, float y, long string, long end, long bounds)Unsafe version of:TextBoundsstatic voidnnvgTextBox(long ctx, float x, float y, float breakRowWidth, long string, long end)Unsafe version of:TextBoxstatic voidnnvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, long string, long end, float[] bounds)Array version of:nnvgTextBoxBounds(long, float, float, float, long, long, long)static voidnnvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, long string, long end, long bounds)Unsafe version of:TextBoxBoundsstatic intnnvgTextBreakLines(long ctx, long string, long end, float breakRowWidth, long rows, int maxRows)Unsafe version of:TextBreakLinesstatic intnnvgTextGlyphPositions(long ctx, float x, float y, long string, long end, long positions, int maxPositions)Unsafe version of:TextGlyphPositionsstatic voidnnvgTextLetterSpacing(long ctx, float spacing)Unsafe version of:TextLetterSpacingstatic voidnnvgTextLineHeight(long ctx, float lineHeight)Unsafe version of:TextLineHeightstatic voidnnvgTextMetrics(long ctx, float[] ascender, float[] descender, float[] lineh)Array version of:nnvgTextMetrics(long, long, long, long)static voidnnvgTextMetrics(long ctx, long ascender, long descender, long lineh)Unsafe version of:TextMetricsstatic voidnnvgTransform(long ctx, float a, float b, float c, float d, float e, float f)Unsafe version of:Transformstatic voidnnvgTransformIdentity(float[] dst)Array version of:nnvgTransformIdentity(long)static voidnnvgTransformIdentity(long dst)Unsafe version of:TransformIdentitystatic intnnvgTransformInverse(float[] dst, float[] src)Array version of:nnvgTransformInverse(long, long)static intnnvgTransformInverse(long dst, long src)Unsafe version of:TransformInversestatic voidnnvgTransformMultiply(float[] dst, float[] src)Array version of:nnvgTransformMultiply(long, long)static voidnnvgTransformMultiply(long dst, long src)Unsafe version of:TransformMultiplystatic voidnnvgTransformPoint(float[] dstx, float[] dsty, float[] xform, float srcx, float srcy)Array version of:nnvgTransformPoint(long, long, long, float, float)static voidnnvgTransformPoint(long dstx, long dsty, long xform, float srcx, float srcy)Unsafe version of:TransformPointstatic voidnnvgTransformPremultiply(float[] dst, float[] src)Array version of:nnvgTransformPremultiply(long, long)static voidnnvgTransformPremultiply(long dst, long src)Unsafe version of:TransformPremultiplystatic voidnnvgTransformRotate(float[] dst, float a)Array version of:nnvgTransformRotate(long, float)static voidnnvgTransformRotate(long dst, float a)Unsafe version of:TransformRotatestatic voidnnvgTransformScale(float[] dst, float sx, float sy)Array version of:nnvgTransformScale(long, float, float)static voidnnvgTransformScale(long dst, float sx, float sy)Unsafe version of:TransformScalestatic voidnnvgTransformSkewX(float[] dst, float a)Array version of:nnvgTransformSkewX(long, float)static voidnnvgTransformSkewX(long dst, float a)Unsafe version of:TransformSkewXstatic voidnnvgTransformSkewY(float[] dst, float a)Array version of:nnvgTransformSkewY(long, float)static voidnnvgTransformSkewY(long dst, float a)Unsafe version of:TransformSkewYstatic voidnnvgTransformTranslate(float[] dst, float tx, float ty)Array version of:nnvgTransformTranslate(long, float, float)static voidnnvgTransformTranslate(long dst, float tx, float ty)Unsafe version of:TransformTranslatestatic voidnnvgTranslate(long ctx, float x, float y)Unsafe version of:Translatestatic voidnnvgTransRGBA(long c0, byte a, long __result)Unsafe version of:TransRGBAstatic voidnnvgTransRGBAf(long c0, float a, long __result)Unsafe version of:TransRGBAfstatic voidnnvgUpdateImage(long ctx, int image, long data)Unsafe version of:UpdateImagestatic intnvgAddFallbackFont(long ctx, java.lang.CharSequence baseFont, java.lang.CharSequence fallbackFont)Adds fallback font by name.static intnvgAddFallbackFont(long ctx, java.nio.ByteBuffer baseFont, java.nio.ByteBuffer fallbackFont)Adds fallback font by name.static intnvgAddFallbackFontId(long ctx, int baseFont, int fallbackFont)Adds fallback font by handle.static voidnvgArc(long ctx, float cx, float cy, float r, float a0, float a1, int dir)Creates new circle arc shaped sub-path.static voidnvgArcTo(long ctx, float x1, float y1, float x2, float y2, float radius)Adds an arc segment at the corner defined by the last path point, and two specified points.static voidnvgBeginFrame(long ctx, float windowWidth, float windowHeight, float devicePixelRatio)Begins drawing a new frame.static voidnvgBeginPath(long ctx)Clears the current path and sub-paths.static voidnvgBezierTo(long ctx, float c1x, float c1y, float c2x, float c2y, float x, float y)Adds cubic bezier segment from last point in the path via two control points to the specified point.static NVGPaintnvgBoxGradient(long ctx, float x, float y, float w, float h, float r, float f, NVGColor icol, NVGColor ocol, NVGPaint __result)Creates and returns a box gradient.static voidnvgCancelFrame(long ctx)Cancels drawing the current frame.static voidnvgCircle(long ctx, float cx, float cy, float r)Creates new circle shaped sub-path.static voidnvgClosePath(long ctx)Closes current sub-path with a line segment.static intnvgCreateFont(long ctx, java.lang.CharSequence name, java.lang.CharSequence filename)Creates font by loading it from the disk from specified file name.static intnvgCreateFont(long ctx, java.nio.ByteBuffer name, java.nio.ByteBuffer filename)Creates font by loading it from the disk from specified file name.static intnvgCreateFontAtIndex(long ctx, java.lang.CharSequence name, java.lang.CharSequence filename, int fontIndex)Creates font by loading it from the disk from specified file name.static intnvgCreateFontAtIndex(long ctx, java.nio.ByteBuffer name, java.nio.ByteBuffer filename, int fontIndex)Creates font by loading it from the disk from specified file name.static intnvgCreateFontMem(long ctx, java.lang.CharSequence name, java.nio.ByteBuffer data, int freeData)Creates font by loading it from the specified memory chunk.static intnvgCreateFontMem(long ctx, java.nio.ByteBuffer name, java.nio.ByteBuffer data, int freeData)Creates font by loading it from the specified memory chunk.static intnvgCreateFontMemAtIndex(long ctx, java.lang.CharSequence name, java.nio.ByteBuffer data, int freeData, int fontIndex)Creates font by loading it from the specified memory chunk.static intnvgCreateFontMemAtIndex(long ctx, java.nio.ByteBuffer name, java.nio.ByteBuffer data, int freeData, int fontIndex)Creates font by loading it from the specified memory chunk.static intnvgCreateImage(long ctx, java.lang.CharSequence filename, int imageFlags)Creates image by loading it from the disk from specified file name.static intnvgCreateImage(long ctx, java.nio.ByteBuffer filename, int imageFlags)Creates image by loading it from the disk from specified file name.static intnvgCreateImageMem(long ctx, int imageFlags, java.nio.ByteBuffer data)Creates image by loading it from the specified chunk of memory.static intnvgCreateImageRGBA(long ctx, int w, int h, int imageFlags, java.nio.ByteBuffer data)Creates image from specified image data.static voidnvgCurrentTransform(long ctx, float[] xform)Array version of:CurrentTransformstatic voidnvgCurrentTransform(long ctx, java.nio.FloatBuffer xform)Stores the top part (a-f) of the current transformation matrix in to the specified buffer.static floatnvgDegToRad(float deg)Converts degrees to radians.static voidnvgDeleteImage(long ctx, int image)Deletes created image.static voidnvgEllipse(long ctx, float cx, float cy, float rx, float ry)Creates new ellipse shaped sub-path.static voidnvgEndFrame(long ctx)Ends drawing flushing remaining render state.static voidnvgFill(long ctx)Fills the current path with current fill style.static voidnvgFillColor(long ctx, NVGColor color)Sets current fill style to a solid color.static voidnvgFillPaint(long ctx, NVGPaint paint)Sets current fill style to a paint, which can be a one of the gradients or a pattern.static intnvgFindFont(long ctx, java.lang.CharSequence name)Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.static intnvgFindFont(long ctx, java.nio.ByteBuffer name)Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.static voidnvgFontBlur(long ctx, float blur)Sets the blur of current text style.static voidnvgFontFace(long ctx, java.lang.CharSequence font)Sets the font face based on specified name of current text style.static voidnvgFontFace(long ctx, java.nio.ByteBuffer font)Sets the font face based on specified name of current text style.static voidnvgFontFaceId(long ctx, int font)Sets the font face based on specified id of current text style.static voidnvgFontSize(long ctx, float size)Sets the font size of current text style.static voidnvgGlobalAlpha(long ctx, float alpha)Sets the transparency applied to all rendered shapes.static voidnvgGlobalCompositeBlendFunc(long ctx, int sfactor, int dfactor)Sets the composite operation with custom pixel arithmetic.static voidnvgGlobalCompositeBlendFuncSeparate(long ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately.static voidnvgGlobalCompositeOperation(long ctx, int op)Sets the composite operation.static NVGColornvgHSL(float h, float s, float l, NVGColor __result)Returns color value specified by hue, saturation and lightness.static NVGColornvgHSLA(float h, float s, float l, byte a, NVGColor __result)Returns color value specified by hue, saturation and lightness and alpha.static NVGPaintnvgImagePattern(long ctx, float ox, float oy, float ex, float ey, float angle, int image, float alpha, NVGPaint __result)Creates and returns an image patter.static voidnvgImageSize(long ctx, int image, int[] w, int[] h)Array version of:ImageSizestatic voidnvgImageSize(long ctx, int image, java.nio.IntBuffer w, java.nio.IntBuffer h)Returns the dimensions of a created image.static voidnvgIntersectScissor(long ctx, float x, float y, float w, float h)Intersects current scissor rectangle with the specified rectangle.static NVGColornvgLerpRGBA(NVGColor c0, NVGColor c1, float u, NVGColor __result)Linearly interpolates from colorc0toc1, and returns resulting color value.static NVGPaintnvgLinearGradient(long ctx, float sx, float sy, float ex, float ey, NVGColor icol, NVGColor ocol, NVGPaint __result)Creates and returns a linear gradient.static voidnvgLineCap(long ctx, int cap)Sets how the end of the line (cap) is drawn.static voidnvgLineJoin(long ctx, int join)Sets how sharp path corners are drawn.static voidnvgLineTo(long ctx, float x, float y)Adds line segment from the last point in the path to the specified point.static voidnvgMiterLimit(long ctx, float limit)Sets the miter limit of the stroke style.static voidnvgMoveTo(long ctx, float x, float y)Starts new sub-path with specified point as first point.static voidnvgPathWinding(long ctx, int dir)Sets the current sub-path winding.static voidnvgQuadTo(long ctx, float cx, float cy, float x, float y)Adds quadratic bezier segment from last point in the path via a control point to the specified point.static NVGPaintnvgRadialGradient(long ctx, float cx, float cy, float inr, float outr, NVGColor icol, NVGColor ocol, NVGPaint __result)Creates and returns a radial gradient.static floatnvgRadToDeg(float rad)Converts radians to degrees.static voidnvgRect(long ctx, float x, float y, float w, float h)Creates new rectangle shaped sub-path.static voidnvgReset(long ctx)Resets current render state to default values.static voidnvgResetFallbackFonts(long ctx, java.lang.CharSequence baseFont)Resets fallback fonts by name.static voidnvgResetFallbackFonts(long ctx, java.nio.ByteBuffer baseFont)Resets fallback fonts by name.static voidnvgResetFallbackFontsId(long ctx, int baseFont)Resets fallback fonts by handle.static voidnvgResetScissor(long ctx)Resets and disables scissoring.static voidnvgResetTransform(long ctx)Resets current transform to an identity matrix.static voidnvgRestore(long ctx)Pops and restores current render state.static NVGColornvgRGB(byte r, byte g, byte b, NVGColor __result)Returns a color value from red, green, blue values.static NVGColornvgRGBA(byte r, byte g, byte b, byte a, NVGColor __result)Returns a color value from red, green, blue and alpha values.static NVGColornvgRGBAf(float r, float g, float b, float a, NVGColor __result)Returns a color value from red, green, blue and alpha values.static NVGColornvgRGBf(float r, float g, float b, NVGColor __result)Returns a color value from red, green, blue values.static voidnvgRotate(long ctx, float angle)Rotates current coordinate system.static voidnvgRoundedRect(long ctx, float x, float y, float w, float h, float r)Creates new rounded rectangle shaped sub-path.static voidnvgRoundedRectVarying(long ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft)Creates new rounded rectangle shaped sub-path with varying radii for each corner.static voidnvgSave(long ctx)Pushes and saves the current render state into a state stack.static voidnvgScale(long ctx, float x, float y)Scales the current coordinate system.static voidnvgScissor(long ctx, float x, float y, float w, float h)Sets the current scissor rectangle.static voidnvgShapeAntiAlias(long ctx, boolean enabled)static voidnvgSkewX(long ctx, float angle)Skews the current coordinate system along X axis.static voidnvgSkewY(long ctx, float angle)Skews the current coordinate system along Y axis.static voidnvgStroke(long ctx)Fills the current path with current stroke style.static voidnvgStrokeColor(long ctx, NVGColor color)Sets current stroke style to a solid color.static voidnvgStrokePaint(long ctx, NVGPaint paint)Sets current stroke style to a paint, which can be a one of the gradients or a pattern.static voidnvgStrokeWidth(long ctx, float size)Sets the stroke width of the stroke style.static floatnvgText(long ctx, float x, float y, java.lang.CharSequence string)Draws text string at specified location.static floatnvgText(long ctx, float x, float y, java.nio.ByteBuffer string)Draws text string at specified location.static voidnvgTextAlign(long ctx, int align)Sets the text align of current text style.static floatnvgTextBounds(long ctx, float x, float y, java.lang.CharSequence string, float[] bounds)Array version of:TextBoundsstatic floatnvgTextBounds(long ctx, float x, float y, java.lang.CharSequence string, java.nio.FloatBuffer bounds)Measures the specified text string.static floatnvgTextBounds(long ctx, float x, float y, java.nio.ByteBuffer string, float[] bounds)Array version of:TextBoundsstatic floatnvgTextBounds(long ctx, float x, float y, java.nio.ByteBuffer string, java.nio.FloatBuffer bounds)Measures the specified text string.static voidnvgTextBox(long ctx, float x, float y, float breakRowWidth, java.lang.CharSequence string)Draws multi-line text string at specified location wrapped at the specified width.static voidnvgTextBox(long ctx, float x, float y, float breakRowWidth, java.nio.ByteBuffer string)Draws multi-line text string at specified location wrapped at the specified width.static voidnvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, java.lang.CharSequence string, float[] bounds)Array version of:TextBoxBoundsstatic voidnvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, java.lang.CharSequence string, java.nio.FloatBuffer bounds)Measures the specified multi-text string.static voidnvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, java.nio.ByteBuffer string, float[] bounds)Array version of:TextBoxBoundsstatic voidnvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, java.nio.ByteBuffer string, java.nio.FloatBuffer bounds)Measures the specified multi-text string.static intnvgTextBreakLines(long ctx, java.lang.CharSequence string, float breakRowWidth, NVGTextRow.Buffer rows)Breaks the specified text into lines.static intnvgTextBreakLines(long ctx, java.nio.ByteBuffer string, float breakRowWidth, NVGTextRow.Buffer rows)Breaks the specified text into lines.static intnvgTextGlyphPositions(long ctx, float x, float y, java.lang.CharSequence string, NVGGlyphPosition.Buffer positions)Calculates the glyph x positions of the specified text.static intnvgTextGlyphPositions(long ctx, float x, float y, java.nio.ByteBuffer string, NVGGlyphPosition.Buffer positions)Calculates the glyph x positions of the specified text.static voidnvgTextLetterSpacing(long ctx, float spacing)Sets the letter spacing of current text style.static voidnvgTextLineHeight(long ctx, float lineHeight)Sets the proportional line height of current text style.static voidnvgTextMetrics(long ctx, float[] ascender, float[] descender, float[] lineh)Array version of:TextMetricsstatic voidnvgTextMetrics(long ctx, java.nio.FloatBuffer ascender, java.nio.FloatBuffer descender, java.nio.FloatBuffer lineh)Returns the vertical metrics based on the current text style.static voidnvgTransform(long ctx, float a, float b, float c, float d, float e, float f)Premultiplies current coordinate system by specified matrix.static voidnvgTransformIdentity(float[] dst)Array version of:TransformIdentitystatic voidnvgTransformIdentity(java.nio.FloatBuffer dst)Sets the transform to identity matrix.static booleannvgTransformInverse(float[] dst, float[] src)Array version of:TransformInversestatic booleannvgTransformInverse(java.nio.FloatBuffer dst, java.nio.FloatBuffer src)Sets the destination to inverse of specified transform.static voidnvgTransformMultiply(float[] dst, float[] src)Array version of:TransformMultiplystatic voidnvgTransformMultiply(java.nio.FloatBuffer dst, java.nio.FloatBuffer src)Sets the transform to the result of multiplication of two transforms, ofA = A*B.static voidnvgTransformPoint(float[] dstx, float[] dsty, float[] xform, float srcx, float srcy)Array version of:TransformPointstatic voidnvgTransformPoint(java.nio.FloatBuffer dstx, java.nio.FloatBuffer dsty, java.nio.FloatBuffer xform, float srcx, float srcy)Transform a point by given transform.static voidnvgTransformPremultiply(float[] dst, float[] src)Array version of:TransformPremultiplystatic voidnvgTransformPremultiply(java.nio.FloatBuffer dst, java.nio.FloatBuffer src)Sets the transform to the result of multiplication of two transforms, ofA = B*A.static voidnvgTransformRotate(float[] dst, float a)Array version of:TransformRotatestatic voidnvgTransformRotate(java.nio.FloatBuffer dst, float a)Sets the transform to rotate matrix.static voidnvgTransformScale(float[] dst, float sx, float sy)Array version of:TransformScalestatic voidnvgTransformScale(java.nio.FloatBuffer dst, float sx, float sy)Sets the transform to scale matrix.static voidnvgTransformSkewX(float[] dst, float a)Array version of:TransformSkewXstatic voidnvgTransformSkewX(java.nio.FloatBuffer dst, float a)Sets the transform to skew-x matrix.static voidnvgTransformSkewY(float[] dst, float a)Array version of:TransformSkewYstatic voidnvgTransformSkewY(java.nio.FloatBuffer dst, float a)Sets the transform to skew-y matrix.static voidnvgTransformTranslate(float[] dst, float tx, float ty)Array version of:TransformTranslatestatic voidnvgTransformTranslate(java.nio.FloatBuffer dst, float tx, float ty)Sets the transform to translation matrix matrix.static voidnvgTranslate(long ctx, float x, float y)Translates current coordinate system.static NVGColornvgTransRGBA(NVGColor c0, byte a, NVGColor __result)Sets transparency of a color value.static NVGColornvgTransRGBAf(NVGColor c0, float a, NVGColor __result)Sets transparency of a color value.static voidnvgUpdateImage(long ctx, int image, java.nio.ByteBuffer data)Updates image data specified by image handle.
-
-
-
Field Detail
-
NVG_PI
PI
-
NVG_ALIGN_LEFT, NVG_ALIGN_CENTER, NVG_ALIGN_RIGHT, NVG_ALIGN_TOP, NVG_ALIGN_MIDDLE, NVG_ALIGN_BOTTOM, NVG_ALIGN_BASELINE
Alignments.Enum values:
ALIGN_LEFT- Default, align text horizontally to left.ALIGN_CENTER- Align text horizontally to center.ALIGN_RIGHT- Align text horizontally to right.ALIGN_TOP- Align text vertically to top.ALIGN_MIDDLE- Align text vertically to middle.ALIGN_BOTTOM- Align text vertically to bottom.ALIGN_BASELINE- Default, align text vertically to baseline.
-
NVG_ZERO, NVG_ONE, NVG_SRC_COLOR, NVG_ONE_MINUS_SRC_COLOR, NVG_DST_COLOR, NVG_ONE_MINUS_DST_COLOR, NVG_SRC_ALPHA, NVG_ONE_MINUS_SRC_ALPHA, NVG_DST_ALPHA, NVG_ONE_MINUS_DST_ALPHA, NVG_SRC_ALPHA_SATURATE
Blend factors.Enum values:
-
NVG_SOURCE_OVER, NVG_SOURCE_IN, NVG_SOURCE_OUT, NVG_ATOP, NVG_DESTINATION_OVER, NVG_DESTINATION_IN, NVG_DESTINATION_OUT, NVG_DESTINATION_ATOP, NVG_LIGHTER, NVG_COPY, NVG_XOR
Composite operations.Enum values:
-
NVG_IMAGE_GENERATE_MIPMAPS, NVG_IMAGE_REPEATX, NVG_IMAGE_REPEATY, NVG_IMAGE_FLIPY, NVG_IMAGE_PREMULTIPLIED, NVG_IMAGE_NEAREST
Image flags.Enum values:
IMAGE_GENERATE_MIPMAPS- Generate mipmaps during creation of the image.IMAGE_REPEATX- Repeat image in X direction.IMAGE_REPEATY- Repeat image in Y direction.IMAGE_FLIPY- Flips (inverses) image in Y direction when rendered.IMAGE_PREMULTIPLIED- Image data has premultiplied alpha.IMAGE_NEAREST- Image interpolation is Nearest instead Linear.
-
-
Method Detail
-
nnvgBeginFrame
public static void nnvgBeginFrame(long ctx, float windowWidth, float windowHeight, float devicePixelRatio)Unsafe version of:BeginFrame
-
nvgBeginFrame
public static void nvgBeginFrame(long ctx, float windowWidth, float windowHeight, float devicePixelRatio)Begins drawing a new frame.Calls to nanovg drawing API should be wrapped in
BeginFrame&EndFrame.BeginFramedefines the size of the window to render to in relation currently set viewport (i.e.glViewporton 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 setwindowWidth/Heightto the window sizedevicePixelRatioto:frameBufferWidth / windowWidth.- Parameters:
ctx- the NanoVG contextwindowWidth- the window widthwindowHeight- the window heightdevicePixelRatio- the device pixel ratio
-
nnvgCancelFrame
public static void nnvgCancelFrame(long ctx)
Unsafe version of:CancelFrame
-
nvgCancelFrame
public static void nvgCancelFrame(long ctx)
Cancels drawing the current frame.- Parameters:
ctx- the NanoVG context
-
nnvgEndFrame
public static void nnvgEndFrame(long ctx)
Unsafe version of:EndFrame
-
nvgEndFrame
public static void nvgEndFrame(long ctx)
Ends drawing flushing remaining render state.- Parameters:
ctx- the NanoVG context
-
nnvgGlobalCompositeOperation
public static void nnvgGlobalCompositeOperation(long ctx, int op)Unsafe version of:GlobalCompositeOperation
-
nvgGlobalCompositeOperation
public static void nvgGlobalCompositeOperation(long ctx, int op)Sets the composite operation.- Parameters:
ctx- the NanoVG contextop- the composite operation. One of:SOURCE_OVERSOURCE_INSOURCE_OUTATOPDESTINATION_OVERDESTINATION_INDESTINATION_OUTDESTINATION_ATOPLIGHTERCOPYXOR
-
nnvgGlobalCompositeBlendFunc
public static void nnvgGlobalCompositeBlendFunc(long ctx, int sfactor, int dfactor)Unsafe version of:GlobalCompositeBlendFunc
-
nvgGlobalCompositeBlendFunc
public static void nvgGlobalCompositeBlendFunc(long ctx, int sfactor, int dfactor)Sets the composite operation with custom pixel arithmetic.- Parameters:
ctx- the NanoVG contextsfactor- the source blend factor. One of:ZEROONESRC_COLORONE_MINUS_SRC_COLORDST_COLORONE_MINUS_DST_COLORSRC_ALPHAONE_MINUS_SRC_ALPHADST_ALPHAONE_MINUS_DST_ALPHASRC_ALPHA_SATURATEdfactor- the destination blend factor. One of:ZEROONESRC_COLORONE_MINUS_SRC_COLORDST_COLORONE_MINUS_DST_COLORSRC_ALPHAONE_MINUS_SRC_ALPHADST_ALPHAONE_MINUS_DST_ALPHASRC_ALPHA_SATURATE
-
nnvgGlobalCompositeBlendFuncSeparate
public static void nnvgGlobalCompositeBlendFuncSeparate(long ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)Unsafe version of:GlobalCompositeBlendFuncSeparate
-
nvgGlobalCompositeBlendFuncSeparate
public static void nvgGlobalCompositeBlendFuncSeparate(long ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately.- Parameters:
ctx- the NanoVG contextsrcRGB- the source RGB blend factor. One of:ZEROONESRC_COLORONE_MINUS_SRC_COLORDST_COLORONE_MINUS_DST_COLORSRC_ALPHAONE_MINUS_SRC_ALPHADST_ALPHAONE_MINUS_DST_ALPHASRC_ALPHA_SATURATEdstRGB- the destination RGB blend factor. One of:ZEROONESRC_COLORONE_MINUS_SRC_COLORDST_COLORONE_MINUS_DST_COLORSRC_ALPHAONE_MINUS_SRC_ALPHADST_ALPHAONE_MINUS_DST_ALPHASRC_ALPHA_SATURATEsrcAlpha- the source alpha blend factor. One of:ZEROONESRC_COLORONE_MINUS_SRC_COLORDST_COLORONE_MINUS_DST_COLORSRC_ALPHAONE_MINUS_SRC_ALPHADST_ALPHAONE_MINUS_DST_ALPHASRC_ALPHA_SATURATEdstAlpha- the destination alpha blend factor. One of:ZEROONESRC_COLORONE_MINUS_SRC_COLORDST_COLORONE_MINUS_DST_COLORSRC_ALPHAONE_MINUS_SRC_ALPHADST_ALPHAONE_MINUS_DST_ALPHASRC_ALPHA_SATURATE
-
nnvgRGB
public static void nnvgRGB(byte r, byte g, byte b, long __result)Unsafe version of:RGB
-
nvgRGB
public static NVGColor nvgRGB(byte r, byte g, byte b, NVGColor __result)
Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0f).- Parameters:
r- the red valueg- the green valueb- the blue value
-
nnvgRGBf
public static void nnvgRGBf(float r, float g, float b, long __result)Unsafe version of:RGBf
-
nvgRGBf
public static NVGColor nvgRGBf(float r, float g, float b, NVGColor __result)
Returns a color value from red, green, blue values. Alpha will be set to 1.0f.- Parameters:
r- the red valueg- the green valueb- the blue value
-
nnvgRGBA
public static void nnvgRGBA(byte r, byte g, byte b, byte a, long __result)Unsafe version of:RGBA
-
nvgRGBA
public static NVGColor nvgRGBA(byte r, byte g, byte b, byte a, NVGColor __result)
Returns a color value from red, green, blue and alpha values.- Parameters:
r- the red valueg- the green valueb- the blue valuea- the alpha value
-
nnvgRGBAf
public static void nnvgRGBAf(float r, float g, float b, float a, long __result)Unsafe version of:RGBAf
-
nvgRGBAf
public static NVGColor nvgRGBAf(float r, float g, float b, float a, NVGColor __result)
Returns a color value from red, green, blue and alpha values.- Parameters:
r- the red valueg- the green valueb- the blue valuea- the alpha value
-
nnvgLerpRGBA
public static void nnvgLerpRGBA(long c0, long c1, float u, long __result)Unsafe version of:LerpRGBA
-
nvgLerpRGBA
public static NVGColor nvgLerpRGBA(NVGColor c0, NVGColor c1, float u, NVGColor __result)
Linearly interpolates from colorc0toc1, and returns resulting color value.- Parameters:
c0- the first colorc1- the second coloru- the interpolation factor
-
nnvgTransRGBA
public static void nnvgTransRGBA(long c0, byte a, long __result)Unsafe version of:TransRGBA
-
nvgTransRGBA
public static NVGColor nvgTransRGBA(NVGColor c0, byte a, NVGColor __result)
Sets transparency of a color value.- Parameters:
c0- the colora- the alpha value
-
nnvgTransRGBAf
public static void nnvgTransRGBAf(long c0, float a, long __result)Unsafe version of:TransRGBAf
-
nvgTransRGBAf
public static NVGColor nvgTransRGBAf(NVGColor c0, float a, NVGColor __result)
Sets transparency of a color value.- Parameters:
c0- the colora- the alpha value
-
nnvgHSL
public static void nnvgHSL(float h, float s, float l, long __result)Unsafe version of:HSL
-
nvgHSL
public static NVGColor nvgHSL(float h, float s, float l, NVGColor __result)
Returns color value specified by hue, saturation and lightness.HSL values are all in range
[0..1], alpha will be set to 255.- Parameters:
h- the hue values- the saturation valuel- the lightness value
-
nnvgHSLA
public static void nnvgHSLA(float h, float s, float l, byte a, long __result)Unsafe version of:HSLA
-
nvgHSLA
public static NVGColor nvgHSLA(float h, float s, float l, byte a, NVGColor __result)
Returns color value specified by hue, saturation and lightness and alpha.HSL values are all in range
[0..1], alpha in range[0..255]- Parameters:
h- the hue values- the saturation valuel- the lightness valuea- the alpha value
-
nnvgSave
public static void nnvgSave(long ctx)
Unsafe version of:Save
-
nvgSave
public static void nvgSave(long ctx)
Pushes and saves the current render state into a state stack. A matchingRestoremust be used to restore the state.- Parameters:
ctx- the NanoVG context
-
nnvgRestore
public static void nnvgRestore(long ctx)
Unsafe version of:Restore
-
nvgRestore
public static void nvgRestore(long ctx)
Pops and restores current render state.- Parameters:
ctx- the NanoVG context
-
nnvgReset
public static void nnvgReset(long ctx)
Unsafe version of:Reset
-
nvgReset
public static void nvgReset(long ctx)
Resets current render state to default values. Does not affect the render state stack.- Parameters:
ctx- the NanoVG context
-
nnvgShapeAntiAlias
public static void nnvgShapeAntiAlias(long ctx, int enabled)Unsafe version of:ShapeAntiAlias
-
nvgShapeAntiAlias
public static void nvgShapeAntiAlias(long ctx, boolean enabled)- Parameters:
ctx- the NanoVG contextenabled- the flag to set
-
nnvgStrokeColor
public static void nnvgStrokeColor(long ctx, long color)Unsafe version of:StrokeColor
-
nvgStrokeColor
public static void nvgStrokeColor(long ctx, NVGColor color)Sets current stroke style to a solid color.- Parameters:
ctx- the NanoVG contextcolor- the color to set
-
nnvgStrokePaint
public static void nnvgStrokePaint(long ctx, long paint)Unsafe version of:StrokePaint
-
nvgStrokePaint
public static void nvgStrokePaint(long ctx, NVGPaint paint)Sets current stroke style to a paint, which can be a one of the gradients or a pattern.- Parameters:
ctx- the NanoVG contextpaint- the paint to set
-
nnvgFillColor
public static void nnvgFillColor(long ctx, long color)Unsafe version of:FillColor
-
nvgFillColor
public static void nvgFillColor(long ctx, NVGColor color)Sets current fill style to a solid color.- Parameters:
ctx- the NanoVG contextcolor- the color to set
-
nnvgFillPaint
public static void nnvgFillPaint(long ctx, long paint)Unsafe version of:FillPaint
-
nvgFillPaint
public static void nvgFillPaint(long ctx, NVGPaint paint)Sets current fill style to a paint, which can be a one of the gradients or a pattern.- Parameters:
ctx- the NanoVG contextpaint- the paint to set
-
nnvgMiterLimit
public static void nnvgMiterLimit(long ctx, float limit)Unsafe version of:MiterLimit
-
nvgMiterLimit
public static void nvgMiterLimit(long ctx, float limit)Sets the miter limit of the stroke style. Miter limit controls when a sharp corner is beveled.- Parameters:
ctx- the NanoVG contextlimit- the miter limit to set
-
nnvgStrokeWidth
public static void nnvgStrokeWidth(long ctx, float size)Unsafe version of:StrokeWidth
-
nvgStrokeWidth
public static void nvgStrokeWidth(long ctx, float size)Sets the stroke width of the stroke style.- Parameters:
ctx- the NanoVG contextsize- the stroke width to set
-
nnvgLineCap
public static void nnvgLineCap(long ctx, int cap)Unsafe version of:LineCap
-
nvgLineCap
public static void nvgLineCap(long ctx, int cap)Sets how the end of the line (cap) is drawn.The default line cap is
BUTT.
-
nnvgLineJoin
public static void nnvgLineJoin(long ctx, int join)Unsafe version of:LineJoin
-
nvgLineJoin
public static void nvgLineJoin(long ctx, int join)Sets how sharp path corners are drawn.The default line join is
MITER.
-
nnvgGlobalAlpha
public static void nnvgGlobalAlpha(long ctx, float alpha)Unsafe version of:GlobalAlpha
-
nvgGlobalAlpha
public static void nvgGlobalAlpha(long ctx, float alpha)Sets the transparency applied to all rendered shapes.Already transparent paths will get proportionally more transparent as well.
- Parameters:
ctx- the NanoVG contextalpha- the alpha value to set
-
nnvgResetTransform
public static void nnvgResetTransform(long ctx)
Unsafe version of:ResetTransform
-
nvgResetTransform
public static void nvgResetTransform(long ctx)
Resets current transform to an identity matrix.- Parameters:
ctx- the NanoVG context
-
nnvgTransform
public static void nnvgTransform(long ctx, float a, float b, float c, float d, float e, float f)Unsafe version of:Transform
-
nvgTransform
public static void nvgTransform(long ctx, float a, float b, float c, float d, float e, float f)Premultiplies current coordinate system by specified matrix. The parameters are interpreted as matrix as follows:[a c e] [b d f] [0 0 1]- Parameters:
ctx- the NanoVG contexta- the a valueb- the b valuec- the c valued- the d valuee- the e valuef- the f value
-
nnvgTranslate
public static void nnvgTranslate(long ctx, float x, float y)Unsafe version of:Translate
-
nvgTranslate
public static void nvgTranslate(long ctx, float x, float y)Translates current coordinate system.- Parameters:
ctx- the NanoVG contextx- the X axis translation amounty- the Y axis translation amount
-
nnvgRotate
public static void nnvgRotate(long ctx, float angle)Unsafe version of:Rotate
-
nvgRotate
public static void nvgRotate(long ctx, float angle)Rotates current coordinate system.- Parameters:
ctx- the NanoVG contextangle- the rotation angle, in radians
-
nnvgSkewX
public static void nnvgSkewX(long ctx, float angle)Unsafe version of:SkewX
-
nvgSkewX
public static void nvgSkewX(long ctx, float angle)Skews the current coordinate system along X axis.- Parameters:
ctx- the NanoVG contextangle- the skew angle, in radians
-
nnvgSkewY
public static void nnvgSkewY(long ctx, float angle)Unsafe version of:SkewY
-
nvgSkewY
public static void nvgSkewY(long ctx, float angle)Skews the current coordinate system along Y axis.- Parameters:
ctx- the NanoVG contextangle- the skew angle, in radians
-
nnvgScale
public static void nnvgScale(long ctx, float x, float y)Unsafe version of:Scale
-
nvgScale
public static void nvgScale(long ctx, float x, float y)Scales the current coordinate system.- Parameters:
ctx- the NanoVG contextx- the X axis scale factory- the Y axis scale factor
-
nnvgCurrentTransform
public static void nnvgCurrentTransform(long ctx, long xform)Unsafe version of:CurrentTransform
-
nvgCurrentTransform
public static void nvgCurrentTransform(long ctx, java.nio.FloatBuffer xform)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.- Parameters:
ctx- the NanoVG contextxform- the destination buffer
-
nnvgTransformIdentity
public static void nnvgTransformIdentity(long dst)
Unsafe version of:TransformIdentity
-
nvgTransformIdentity
public static void nvgTransformIdentity(java.nio.FloatBuffer dst)
Sets the transform to identity matrix.- Parameters:
dst- the destination buffer
-
nnvgTransformTranslate
public static void nnvgTransformTranslate(long dst, float tx, float ty)Unsafe version of:TransformTranslate
-
nvgTransformTranslate
public static void nvgTransformTranslate(java.nio.FloatBuffer dst, float tx, float ty)Sets the transform to translation matrix matrix.- Parameters:
dst- the destination buffertx- the X axis translation amountty- the Y axis translation amount
-
nnvgTransformScale
public static void nnvgTransformScale(long dst, float sx, float sy)Unsafe version of:TransformScale
-
nvgTransformScale
public static void nvgTransformScale(java.nio.FloatBuffer dst, float sx, float sy)Sets the transform to scale matrix.- Parameters:
dst- the destination buffersx- the X axis scale factorsy- the Y axis scale factor
-
nnvgTransformRotate
public static void nnvgTransformRotate(long dst, float a)Unsafe version of:TransformRotate
-
nvgTransformRotate
public static void nvgTransformRotate(java.nio.FloatBuffer dst, float a)Sets the transform to rotate matrix.- Parameters:
dst- the destination buffera- the rotation angle, in radians
-
nnvgTransformSkewX
public static void nnvgTransformSkewX(long dst, float a)Unsafe version of:TransformSkewX
-
nvgTransformSkewX
public static void nvgTransformSkewX(java.nio.FloatBuffer dst, float a)Sets the transform to skew-x matrix.- Parameters:
dst- the destination buffera- the skew angle, in radians
-
nnvgTransformSkewY
public static void nnvgTransformSkewY(long dst, float a)Unsafe version of:TransformSkewY
-
nvgTransformSkewY
public static void nvgTransformSkewY(java.nio.FloatBuffer dst, float a)Sets the transform to skew-y matrix.- Parameters:
dst- the destination buffera- the skew angle, in radians
-
nnvgTransformMultiply
public static void nnvgTransformMultiply(long dst, long src)Unsafe version of:TransformMultiply
-
nvgTransformMultiply
public static void nvgTransformMultiply(java.nio.FloatBuffer dst, java.nio.FloatBuffer src)Sets the transform to the result of multiplication of two transforms, ofA = A*B.- Parameters:
dst- the destination buffersrc- theBtransformation matrix
-
nnvgTransformPremultiply
public static void nnvgTransformPremultiply(long dst, long src)Unsafe version of:TransformPremultiply
-
nvgTransformPremultiply
public static void nvgTransformPremultiply(java.nio.FloatBuffer dst, java.nio.FloatBuffer src)Sets the transform to the result of multiplication of two transforms, ofA = B*A.- Parameters:
dst- the destination buffersrc- theBtransformation matrix
-
nnvgTransformInverse
public static int nnvgTransformInverse(long dst, long src)Unsafe version of:TransformInverse
-
nvgTransformInverse
public static boolean nvgTransformInverse(java.nio.FloatBuffer dst, java.nio.FloatBuffer src)Sets the destination to inverse of specified transform.- Parameters:
dst- the destination buffersrc- the transformation matrix to inverse- Returns:
- 1 if the inverse could be calculated, else 0
-
nnvgTransformPoint
public static void nnvgTransformPoint(long dstx, long dsty, long xform, float srcx, float srcy)Unsafe version of:TransformPoint
-
nvgTransformPoint
public static void nvgTransformPoint(java.nio.FloatBuffer dstx, java.nio.FloatBuffer dsty, java.nio.FloatBuffer xform, float srcx, float srcy)Transform a point by given transform.- Parameters:
dstx- returns the transformed X axis coordinatedsty- returns the transformed Y axis coordinatexform- the transformation matrixsrcx- the point X axis coordinatesrcy- the point Y axis coordinate
-
nvgDegToRad
public static float nvgDegToRad(float deg)
Converts degrees to radians.- Parameters:
deg- the rotation value, in degrees
-
nvgRadToDeg
public static float nvgRadToDeg(float rad)
Converts radians to degrees.- Parameters:
rad- the rotation value, in radians
-
nnvgCreateImage
public static int nnvgCreateImage(long ctx, long filename, int imageFlags)Unsafe version of:CreateImage
-
nvgCreateImage
public static int nvgCreateImage(long ctx, java.nio.ByteBuffer filename, int imageFlags) public static int nvgCreateImage(long ctx, java.lang.CharSequence filename, int imageFlags)Creates image by loading it from the disk from specified file name.- Parameters:
ctx- the NanoVG contextfilename- the image file nameimageFlags- the image flags. One of:IMAGE_GENERATE_MIPMAPSIMAGE_REPEATXIMAGE_REPEATYIMAGE_FLIPYIMAGE_PREMULTIPLIEDIMAGE_NEAREST- Returns:
- a handle to the image
-
nnvgCreateImageMem
public static int nnvgCreateImageMem(long ctx, int imageFlags, long data, int ndata)Unsafe version of:CreateImageMem- Parameters:
ndata- the image data size, in bytes
-
nvgCreateImageMem
public static int nvgCreateImageMem(long ctx, int imageFlags, java.nio.ByteBuffer data)Creates image by loading it from the specified chunk of memory.- Parameters:
ctx- the NanoVG contextimageFlags- the image flags. One of:IMAGE_GENERATE_MIPMAPSIMAGE_REPEATXIMAGE_REPEATYIMAGE_FLIPYIMAGE_PREMULTIPLIEDIMAGE_NEARESTdata- the image data- Returns:
- a handle to the image
-
nnvgCreateImageRGBA
public static int nnvgCreateImageRGBA(long ctx, int w, int h, int imageFlags, long data)Unsafe version of:CreateImageRGBA
-
nvgCreateImageRGBA
public static int nvgCreateImageRGBA(long ctx, int w, int h, int imageFlags, java.nio.ByteBuffer data)Creates image from specified image data.- Parameters:
ctx- the NanoVG contextw- the image widthh- the image heightimageFlags- the image flags. One of:IMAGE_GENERATE_MIPMAPSIMAGE_REPEATXIMAGE_REPEATYIMAGE_FLIPYIMAGE_PREMULTIPLIEDIMAGE_NEARESTdata- the image data- Returns:
- a handle to the image
-
nnvgUpdateImage
public static void nnvgUpdateImage(long ctx, int image, long data)Unsafe version of:UpdateImage
-
nvgUpdateImage
public static void nvgUpdateImage(long ctx, int image, java.nio.ByteBuffer data)Updates image data specified by image handle.- Parameters:
ctx- the NanoVG contextimage- the image handledata- the image data
-
nnvgImageSize
public static void nnvgImageSize(long ctx, int image, long w, long h)Unsafe version of:ImageSize
-
nvgImageSize
public static void nvgImageSize(long ctx, int image, java.nio.IntBuffer w, java.nio.IntBuffer h)Returns the dimensions of a created image.- Parameters:
ctx- the NanoVG contextimage- the image handlew- returns the image widthh- returns the image height
-
nnvgDeleteImage
public static void nnvgDeleteImage(long ctx, int image)Unsafe version of:DeleteImage
-
nvgDeleteImage
public static void nvgDeleteImage(long ctx, int image)Deletes created image.- Parameters:
ctx- the NanoVG contextimage- the image handle to delete
-
nnvgLinearGradient
public static void nnvgLinearGradient(long ctx, float sx, float sy, float ex, float ey, long icol, long ocol, long __result)Unsafe version of:LinearGradient
-
nvgLinearGradient
public static NVGPaint nvgLinearGradient(long ctx, float sx, float sy, float ex, float ey, NVGColor icol, NVGColor ocol, NVGPaint __result)
Creates and returns a linear gradient.The gradient is transformed by the current transform when it is passed to
FillPaintorStrokePaint.- Parameters:
ctx- the NanoVG contextsx- the X axis start coordinatesy- the Y axis start coordinateex- the X axis end coordinateey- the Y axis end coordinateicol- the start colorocol- the end color
-
nnvgBoxGradient
public static void nnvgBoxGradient(long ctx, float x, float y, float w, float h, float r, float f, long icol, long ocol, long __result)Unsafe version of:BoxGradient
-
nvgBoxGradient
public static NVGPaint nvgBoxGradient(long ctx, float x, float y, float w, float h, float r, float f, NVGColor icol, NVGColor ocol, NVGPaint __result)
Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering drop shadows or highlights for boxes.The gradient is transformed by the current transform when it is passed to
FillPaintorStrokePaint.- Parameters:
ctx- the NanoVG contextx- the rectangle left coordinatey- the rectangle top coordinatew- the rectangle widthh- the rectangle heightr- the corner radiusf- the feather value. Feather defines how blurry the border of the rectangle is.icol- the inner colorocol- the outer color
-
nnvgRadialGradient
public static void nnvgRadialGradient(long ctx, float cx, float cy, float inr, float outr, long icol, long ocol, long __result)Unsafe version of:RadialGradient
-
nvgRadialGradient
public static NVGPaint nvgRadialGradient(long ctx, float cx, float cy, float inr, float outr, NVGColor icol, NVGColor ocol, NVGPaint __result)
Creates and returns a radial gradient.The gradient is transformed by the current transform when it is passed to
FillPaintorStrokePaint.- Parameters:
ctx- the NanoVG contextcx- the X axis center coordinatecy- the Y axis center coordinateinr- the inner radiusoutr- the outer radiusicol- the start colorocol- the end color
-
nnvgImagePattern
public static void nnvgImagePattern(long ctx, float ox, float oy, float ex, float ey, float angle, int image, float alpha, long __result)Unsafe version of:ImagePattern
-
nvgImagePattern
public static NVGPaint nvgImagePattern(long ctx, float ox, float oy, float ex, float ey, float angle, int image, float alpha, NVGPaint __result)
Creates and returns an image patter.The gradient is transformed by the current transform when it is passed to
FillPaintorStrokePaint.- Parameters:
ctx- the NanoVG contextox- the image pattern left coordinateoy- the image pattern top coordinateex- the image widthey- the image heightangle- the rotation angle around the top-left cornerimage- the image to renderalpha- the alpha value
-
nnvgScissor
public static void nnvgScissor(long ctx, float x, float y, float w, float h)Unsafe version of:Scissor
-
nvgScissor
public static void nvgScissor(long ctx, float x, float y, float w, float h)Sets the current scissor rectangle.The scissor rectangle is transformed by the current transform.
- Parameters:
ctx- the NanoVG contextx- the rectangle X axis coordinatey- the rectangle Y axis coordinatew- the rectangle widthh- the rectangle height
-
nnvgIntersectScissor
public static void nnvgIntersectScissor(long ctx, float x, float y, float w, float h)Unsafe version of:IntersectScissor
-
nvgIntersectScissor
public static void nvgIntersectScissor(long ctx, float x, float y, float w, float h)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.
- Parameters:
ctx- the NanoVG contextx- the rectangle X axis coordinatey- the rectangle Y axis coordinatew- the rectangle widthh- the rectangle height
-
nnvgResetScissor
public static void nnvgResetScissor(long ctx)
Unsafe version of:ResetScissor
-
nvgResetScissor
public static void nvgResetScissor(long ctx)
Resets and disables scissoring.- Parameters:
ctx- the NanoVG context
-
nnvgBeginPath
public static void nnvgBeginPath(long ctx)
Unsafe version of:BeginPath
-
nvgBeginPath
public static void nvgBeginPath(long ctx)
Clears the current path and sub-paths.- Parameters:
ctx- the NanoVG context
-
nnvgMoveTo
public static void nnvgMoveTo(long ctx, float x, float y)Unsafe version of:MoveTo
-
nvgMoveTo
public static void nvgMoveTo(long ctx, float x, float y)Starts new sub-path with specified point as first point.- Parameters:
ctx- the NanoVG contextx- the point X axis coordinatey- the point Y axis coordinate
-
nnvgLineTo
public static void nnvgLineTo(long ctx, float x, float y)Unsafe version of:LineTo
-
nvgLineTo
public static void nvgLineTo(long ctx, float x, float y)Adds line segment from the last point in the path to the specified point.- Parameters:
ctx- the NanoVG contextx- the point X axis coordinatey- the point Y axis coordinate
-
nnvgBezierTo
public static void nnvgBezierTo(long ctx, float c1x, float c1y, float c2x, float c2y, float x, float y)Unsafe version of:BezierTo
-
nvgBezierTo
public static void nvgBezierTo(long ctx, float c1x, float c1y, float c2x, float c2y, float x, float y)Adds cubic bezier segment from last point in the path via two control points to the specified point.- Parameters:
ctx- the NanoVG contextc1x- the first control point X axis coordinatec1y- the first control point Y axis coordinatec2x- the second control point X axis coordinatec2y- the second control point Y axis coordinatex- the point X axis coordinatey- the point Y axis coordinate
-
nnvgQuadTo
public static void nnvgQuadTo(long ctx, float cx, float cy, float x, float y)Unsafe version of:QuadTo
-
nvgQuadTo
public static void nvgQuadTo(long ctx, float cx, float cy, float x, float y)Adds quadratic bezier segment from last point in the path via a control point to the specified point.- Parameters:
ctx- the NanoVG contextcx- the control point X axis coordinatecy- the control point Y axis coordinatex- the point X axis coordinatey- the point Y axis coordinate
-
nnvgArcTo
public static void nnvgArcTo(long ctx, float x1, float y1, float x2, float y2, float radius)Unsafe version of:ArcTo
-
nvgArcTo
public static void nvgArcTo(long ctx, float x1, float y1, float x2, float y2, float radius)Adds an arc segment at the corner defined by the last path point, and two specified points.- Parameters:
ctx- the NanoVG contextx1- the first point X axis coordinatey1- the first point Y axis coordinatex2- the second point X axis coordinatey2- the second point Y axis coordinateradius- the arc radius, in radians
-
nnvgClosePath
public static void nnvgClosePath(long ctx)
Unsafe version of:ClosePath
-
nvgClosePath
public static void nvgClosePath(long ctx)
Closes current sub-path with a line segment.- Parameters:
ctx- the NanoVG context
-
nnvgPathWinding
public static void nnvgPathWinding(long ctx, int dir)Unsafe version of:PathWinding
-
nvgPathWinding
public static void nvgPathWinding(long ctx, int dir)Sets the current sub-path winding.
-
nnvgArc
public static void nnvgArc(long ctx, float cx, float cy, float r, float a0, float a1, int dir)Unsafe version of:Arc
-
nvgArc
public static void nvgArc(long ctx, float cx, float cy, float r, float a0, float a1, int dir)Creates new circle arc shaped sub-path.
-
nnvgRect
public static void nnvgRect(long ctx, float x, float y, float w, float h)Unsafe version of:Rect
-
nvgRect
public static void nvgRect(long ctx, float x, float y, float w, float h)Creates new rectangle shaped sub-path.- Parameters:
ctx- the NanoVG contextx- the rectangle X axis coordinatey- the rectangle Y axis coordinatew- the rectangle widthh- the rectangle height
-
nnvgRoundedRect
public static void nnvgRoundedRect(long ctx, float x, float y, float w, float h, float r)Unsafe version of:RoundedRect
-
nvgRoundedRect
public static void nvgRoundedRect(long ctx, float x, float y, float w, float h, float r)Creates new rounded rectangle shaped sub-path.- Parameters:
ctx- the NanoVG contextx- the rectangle X axis coordinatey- the rectangle Y axis coordinatew- the rectangle widthh- the rectangle heightr- the corner radius
-
nnvgRoundedRectVarying
public static void nnvgRoundedRectVarying(long ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft)Unsafe version of:RoundedRectVarying
-
nvgRoundedRectVarying
public static void nvgRoundedRectVarying(long ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft)Creates new rounded rectangle shaped sub-path with varying radii for each corner.- Parameters:
ctx- the NanoVG contextx- the rectangle X axis coordinatey- the rectangle Y axis coordinatew- the rectangle widthh- the rectangle heightradTopLeft- the top-left corner radiusradTopRight- the top-right corner radiusradBottomRight- the bottom-right corner radiusradBottomLeft- the bottom-left corner radius
-
nnvgEllipse
public static void nnvgEllipse(long ctx, float cx, float cy, float rx, float ry)Unsafe version of:Ellipse
-
nvgEllipse
public static void nvgEllipse(long ctx, float cx, float cy, float rx, float ry)Creates new ellipse shaped sub-path.- Parameters:
ctx- the NanoVG contextcx- the ellipse center X axis coordinatecy- the ellipse center Y axis coordinaterx- the ellipse X axis radiusry- the ellipse Y axis radius
-
nnvgCircle
public static void nnvgCircle(long ctx, float cx, float cy, float r)Unsafe version of:Circle
-
nvgCircle
public static void nvgCircle(long ctx, float cx, float cy, float r)Creates new circle shaped sub-path.- Parameters:
ctx- the NanoVG contextcx- the circle center X axis coordinatecy- the circle center Y axis coordinater- the circle radius
-
nnvgFill
public static void nnvgFill(long ctx)
Unsafe version of:Fill
-
nvgFill
public static void nvgFill(long ctx)
Fills the current path with current fill style.- Parameters:
ctx- the NanoVG context
-
nnvgStroke
public static void nnvgStroke(long ctx)
Unsafe version of:Stroke
-
nvgStroke
public static void nvgStroke(long ctx)
Fills the current path with current stroke style.- Parameters:
ctx- the NanoVG context
-
nnvgCreateFont
public static int nnvgCreateFont(long ctx, long name, long filename)Unsafe version of:CreateFont
-
nvgCreateFont
public static int nvgCreateFont(long ctx, java.nio.ByteBuffer name, java.nio.ByteBuffer filename) public static int nvgCreateFont(long ctx, java.lang.CharSequence name, java.lang.CharSequence filename)Creates font by loading it from the disk from specified file name.- Parameters:
ctx- the NanoVG contextname- the font namefilename- the font file name- Returns:
- a handle to the font
-
nnvgCreateFontAtIndex
public static int nnvgCreateFontAtIndex(long ctx, long name, long filename, int fontIndex)Unsafe version of:CreateFontAtIndex
-
nvgCreateFontAtIndex
public static int nvgCreateFontAtIndex(long ctx, java.nio.ByteBuffer name, java.nio.ByteBuffer filename, int fontIndex) public static int nvgCreateFontAtIndex(long ctx, java.lang.CharSequence name, java.lang.CharSequence filename, int fontIndex)Creates font by loading it from the disk from specified file name.- Parameters:
ctx- the NanoVG contextname- the font namefilename- the font file namefontIndex- specifies which font face to load from a .ttf/.ttc file- Returns:
- a handle to the font
-
nnvgCreateFontMem
public static int nnvgCreateFontMem(long ctx, long name, long data, int ndata, int freeData)Unsafe version of:CreateFontMem- Parameters:
ndata- the font data size, in bytes
-
nvgCreateFontMem
public static int nvgCreateFontMem(long ctx, java.nio.ByteBuffer name, java.nio.ByteBuffer data, int freeData) public static int nvgCreateFontMem(long ctx, java.lang.CharSequence name, java.nio.ByteBuffer data, int freeData)Creates font by loading it from the specified memory chunk.The memory chunk must remain valid for as long as the font is used by NanoVG.
- Parameters:
ctx- the NanoVG contextname- the font namedata- the font datafreeData- 1 if the font data should be freed automatically, 0 otherwise- Returns:
- a handle to the font
-
nnvgCreateFontMemAtIndex
public static int nnvgCreateFontMemAtIndex(long ctx, long name, long data, int ndata, int freeData, int fontIndex)Unsafe version of:CreateFontMemAtIndex- Parameters:
ndata- the font data size, in bytes
-
nvgCreateFontMemAtIndex
public static int nvgCreateFontMemAtIndex(long ctx, java.nio.ByteBuffer name, java.nio.ByteBuffer data, int freeData, int fontIndex) public static int nvgCreateFontMemAtIndex(long ctx, java.lang.CharSequence name, java.nio.ByteBuffer data, int freeData, int fontIndex)Creates font by loading it from the specified memory chunk.The memory chunk must remain valid for as long as the font is used by NanoVG.
- Parameters:
ctx- the NanoVG contextname- the font namedata- the font datafreeData- 1 if the font data should be freed automatically, 0 otherwisefontIndex- specifies which font face to load from a .ttf/.ttc file- Returns:
- a handle to the font
-
nnvgFindFont
public static int nnvgFindFont(long ctx, long name)Unsafe version of:FindFont
-
nvgFindFont
public static int nvgFindFont(long ctx, java.nio.ByteBuffer name) public static int nvgFindFont(long ctx, java.lang.CharSequence name)Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.- Parameters:
ctx- the NanoVG contextname- the font name
-
nnvgAddFallbackFontId
public static int nnvgAddFallbackFontId(long ctx, int baseFont, int fallbackFont)Unsafe version of:AddFallbackFontId
-
nvgAddFallbackFontId
public static int nvgAddFallbackFontId(long ctx, int baseFont, int fallbackFont)Adds fallback font by handle.- Parameters:
ctx- the NanoVG context
-
nnvgAddFallbackFont
public static int nnvgAddFallbackFont(long ctx, long baseFont, long fallbackFont)Unsafe version of:AddFallbackFont
-
nvgAddFallbackFont
public static int nvgAddFallbackFont(long ctx, java.nio.ByteBuffer baseFont, java.nio.ByteBuffer fallbackFont) public static int nvgAddFallbackFont(long ctx, java.lang.CharSequence baseFont, java.lang.CharSequence fallbackFont)Adds fallback font by name.- Parameters:
ctx- the NanoVG context
-
nnvgResetFallbackFontsId
public static void nnvgResetFallbackFontsId(long ctx, int baseFont)Unsafe version of:ResetFallbackFontsId
-
nvgResetFallbackFontsId
public static void nvgResetFallbackFontsId(long ctx, int baseFont)Resets fallback fonts by handle.- Parameters:
ctx- the NanoVG context
-
nnvgResetFallbackFonts
public static void nnvgResetFallbackFonts(long ctx, long baseFont)Unsafe version of:ResetFallbackFonts
-
nvgResetFallbackFonts
public static void nvgResetFallbackFonts(long ctx, java.nio.ByteBuffer baseFont) public static void nvgResetFallbackFonts(long ctx, java.lang.CharSequence baseFont)Resets fallback fonts by name.- Parameters:
ctx- the NanoVG context
-
nnvgFontSize
public static void nnvgFontSize(long ctx, float size)Unsafe version of:FontSize
-
nvgFontSize
public static void nvgFontSize(long ctx, float size)Sets the font size of current text style.- Parameters:
ctx- the NanoVG contextsize- the font size to set
-
nnvgFontBlur
public static void nnvgFontBlur(long ctx, float blur)Unsafe version of:FontBlur
-
nvgFontBlur
public static void nvgFontBlur(long ctx, float blur)Sets the blur of current text style.- Parameters:
ctx- the NanoVG contextblur- the blur amount to set
-
nnvgTextLetterSpacing
public static void nnvgTextLetterSpacing(long ctx, float spacing)Unsafe version of:TextLetterSpacing
-
nvgTextLetterSpacing
public static void nvgTextLetterSpacing(long ctx, float spacing)Sets the letter spacing of current text style.- Parameters:
ctx- the NanoVG contextspacing- the letter spacing amount to set
-
nnvgTextLineHeight
public static void nnvgTextLineHeight(long ctx, float lineHeight)Unsafe version of:TextLineHeight
-
nvgTextLineHeight
public static void nvgTextLineHeight(long ctx, float lineHeight)Sets the proportional line height of current text style. The line height is specified as multiple of font size.- Parameters:
ctx- the NanoVG contextlineHeight- the line height to set
-
nnvgTextAlign
public static void nnvgTextAlign(long ctx, int align)Unsafe version of:TextAlign
-
nvgTextAlign
public static void nvgTextAlign(long ctx, int align)Sets the text align of current text style.- Parameters:
ctx- the NanoVG contextalign- the text align to set. One of:ALIGN_LEFTALIGN_CENTERALIGN_RIGHTALIGN_TOPALIGN_MIDDLEALIGN_BOTTOMALIGN_BASELINE
-
nnvgFontFaceId
public static void nnvgFontFaceId(long ctx, int font)Unsafe version of:FontFaceId
-
nvgFontFaceId
public static void nvgFontFaceId(long ctx, int font)Sets the font face based on specified id of current text style.- Parameters:
ctx- the NanoVG contextfont- the font id
-
nnvgFontFace
public static void nnvgFontFace(long ctx, long font)Unsafe version of:FontFace
-
nvgFontFace
public static void nvgFontFace(long ctx, java.nio.ByteBuffer font) public static void nvgFontFace(long ctx, java.lang.CharSequence font)Sets the font face based on specified name of current text style.- Parameters:
ctx- the NanoVG contextfont- the font name
-
nnvgText
public static float nnvgText(long ctx, float x, float y, long string, long end)Unsafe version of:Text- Parameters:
end- a pointer to the end of the sub-string to draw, orNULL
-
nvgText
public static float nvgText(long ctx, float x, float y, java.nio.ByteBuffer string) public static float nvgText(long ctx, float x, float y, java.lang.CharSequence string)Draws text string at specified location. Ifendis specified only the sub-string up to theendis drawn.- Parameters:
ctx- the NanoVG contextx- the text X axis coordinatey- the text Y axis coordinatestring- the text string to draw
-
nnvgTextBox
public static void nnvgTextBox(long ctx, float x, float y, float breakRowWidth, long string, long end)Unsafe version of:TextBox- Parameters:
end- a pointer to the end of the sub-string to draw, orNULL
-
nvgTextBox
public static void nvgTextBox(long ctx, float x, float y, float breakRowWidth, java.nio.ByteBuffer string) public static void nvgTextBox(long ctx, float x, float y, float breakRowWidth, java.lang.CharSequence string)Draws multi-line text string at specified location wrapped at the specified width. Ifendis specified only the sub-string up to theendis 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).
- Parameters:
ctx- the NanoVG contextx- the text box X axis coordinatey- the text box Y axis coordinatebreakRowWidth- the maximum row widthstring- the text string to draw
-
nnvgTextBounds
public static float nnvgTextBounds(long ctx, float x, float y, long string, long end, long bounds)Unsafe version of:TextBounds- Parameters:
end- a pointer to the end of the sub-string to measure, orNULL
-
nvgTextBounds
public static float nvgTextBounds(long ctx, float x, float y, java.nio.ByteBuffer string, @Nullable java.nio.FloatBuffer bounds) public static float nvgTextBounds(long ctx, float x, float y, java.lang.CharSequence string, @Nullable java.nio.FloatBuffer bounds)Measures the specified text string.Parameter
boundsshould be a pointer tofloat[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.
- Parameters:
ctx- the NanoVG contextx- the text X axis coordinatey- the text Y axis coordinatestring- the text string to measurebounds- returns the bounding box of the text- Returns:
- the horizontal advance of the measured text (i.e. where the next character should drawn)
-
nnvgTextBoxBounds
public static void nnvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, long string, long end, long bounds)Unsafe version of:TextBoxBounds- Parameters:
end- a pointer to the end of the sub-string to measure, orNULL
-
nvgTextBoxBounds
public static void nvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, java.nio.ByteBuffer string, @Nullable java.nio.FloatBuffer bounds) public static void nvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, java.lang.CharSequence string, @Nullable java.nio.FloatBuffer bounds)Measures the specified multi-text string.Parameter
boundsshould be a pointer tofloat[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.
- Parameters:
ctx- the NanoVG contextx- the text box X axis coordinatey- the text box Y axis coordinatebreakRowWidth- the maximum row widthstring- the text string to measurebounds- returns the bounding box of the text box
-
nnvgTextGlyphPositions
public static int nnvgTextGlyphPositions(long ctx, float x, float y, long string, long end, long positions, int maxPositions)Unsafe version of:TextGlyphPositions- Parameters:
end- a pointer to the end of the sub-string to measure, orNULLmaxPositions- the maximum number of glyph positions to return
-
nvgTextGlyphPositions
public static int nvgTextGlyphPositions(long ctx, float x, float y, java.nio.ByteBuffer string, NVGGlyphPosition.Buffer positions) public static int nvgTextGlyphPositions(long ctx, float x, float y, java.lang.CharSequence string, NVGGlyphPosition.Buffer positions)Calculates the glyph x positions of the specified text. Ifendis specified only the sub-string will be used.Measured values are returned in local coordinate space.
- Parameters:
ctx- the NanoVG contextx- the text X axis coordinatey- the text Y axis coordinatestring- the text string to measurepositions- returns the glyph x positions
-
nnvgTextMetrics
public static void nnvgTextMetrics(long ctx, long ascender, long descender, long lineh)Unsafe version of:TextMetrics
-
nvgTextMetrics
public static void nvgTextMetrics(long ctx, @Nullable java.nio.FloatBuffer ascender, @Nullable java.nio.FloatBuffer descender, @Nullable java.nio.FloatBuffer lineh)Returns the vertical metrics based on the current text style.Measured values are returned in local coordinate space.
- Parameters:
ctx- the NanoVG contextascender- the line ascenddescender- the line descendlineh- the line height
-
nnvgTextBreakLines
public static int nnvgTextBreakLines(long ctx, long string, long end, float breakRowWidth, long rows, int maxRows)Unsafe version of:TextBreakLines- Parameters:
end- a pointer to the end of the sub-string to measure, orNULLmaxRows- the maximum number of text rows to return
-
nvgTextBreakLines
public static int nvgTextBreakLines(long ctx, java.nio.ByteBuffer string, float breakRowWidth, NVGTextRow.Buffer rows) public static int nvgTextBreakLines(long ctx, java.lang.CharSequence string, float breakRowWidth, NVGTextRow.Buffer rows)Breaks the specified text into lines. Ifendis specified only the sub-string will be used.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).
- Parameters:
ctx- the NanoVG contextstring- the text string to measurebreakRowWidth- the maximum row widthrows- returns the text rows
-
nnvgCurrentTransform
public static void nnvgCurrentTransform(long ctx, float[] xform)Array version of:nnvgCurrentTransform(long, long)
-
nvgCurrentTransform
public static void nvgCurrentTransform(long ctx, float[] xform)Array version of:CurrentTransform
-
nnvgTransformIdentity
public static void nnvgTransformIdentity(float[] dst)
Array version of:nnvgTransformIdentity(long)
-
nvgTransformIdentity
public static void nvgTransformIdentity(float[] dst)
Array version of:TransformIdentity
-
nnvgTransformTranslate
public static void nnvgTransformTranslate(float[] dst, float tx, float ty)Array version of:nnvgTransformTranslate(long, float, float)
-
nvgTransformTranslate
public static void nvgTransformTranslate(float[] dst, float tx, float ty)Array version of:TransformTranslate
-
nnvgTransformScale
public static void nnvgTransformScale(float[] dst, float sx, float sy)Array version of:nnvgTransformScale(long, float, float)
-
nvgTransformScale
public static void nvgTransformScale(float[] dst, float sx, float sy)Array version of:TransformScale
-
nnvgTransformRotate
public static void nnvgTransformRotate(float[] dst, float a)Array version of:nnvgTransformRotate(long, float)
-
nvgTransformRotate
public static void nvgTransformRotate(float[] dst, float a)Array version of:TransformRotate
-
nnvgTransformSkewX
public static void nnvgTransformSkewX(float[] dst, float a)Array version of:nnvgTransformSkewX(long, float)
-
nvgTransformSkewX
public static void nvgTransformSkewX(float[] dst, float a)Array version of:TransformSkewX
-
nnvgTransformSkewY
public static void nnvgTransformSkewY(float[] dst, float a)Array version of:nnvgTransformSkewY(long, float)
-
nvgTransformSkewY
public static void nvgTransformSkewY(float[] dst, float a)Array version of:TransformSkewY
-
nnvgTransformMultiply
public static void nnvgTransformMultiply(float[] dst, float[] src)Array version of:nnvgTransformMultiply(long, long)
-
nvgTransformMultiply
public static void nvgTransformMultiply(float[] dst, float[] src)Array version of:TransformMultiply
-
nnvgTransformPremultiply
public static void nnvgTransformPremultiply(float[] dst, float[] src)Array version of:nnvgTransformPremultiply(long, long)
-
nvgTransformPremultiply
public static void nvgTransformPremultiply(float[] dst, float[] src)Array version of:TransformPremultiply
-
nnvgTransformInverse
public static int nnvgTransformInverse(float[] dst, float[] src)Array version of:nnvgTransformInverse(long, long)
-
nvgTransformInverse
public static boolean nvgTransformInverse(float[] dst, float[] src)Array version of:TransformInverse
-
nnvgTransformPoint
public static void nnvgTransformPoint(float[] dstx, float[] dsty, float[] xform, float srcx, float srcy)Array version of:nnvgTransformPoint(long, long, long, float, float)
-
nvgTransformPoint
public static void nvgTransformPoint(float[] dstx, float[] dsty, float[] xform, float srcx, float srcy)Array version of:TransformPoint
-
nnvgImageSize
public static void nnvgImageSize(long ctx, int image, int[] w, int[] h)Array version of:nnvgImageSize(long, int, long, long)
-
nvgImageSize
public static void nvgImageSize(long ctx, int image, int[] w, int[] h)Array version of:ImageSize
-
nnvgTextBounds
public static float nnvgTextBounds(long ctx, float x, float y, long string, long end, float[] bounds)Array version of:nnvgTextBounds(long, float, float, long, long, long)
-
nvgTextBounds
public static float nvgTextBounds(long ctx, float x, float y, java.nio.ByteBuffer string, @Nullable float[] bounds) public static float nvgTextBounds(long ctx, float x, float y, java.lang.CharSequence string, @Nullable float[] bounds)Array version of:TextBounds
-
nnvgTextBoxBounds
public static void nnvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, long string, long end, float[] bounds)Array version of:nnvgTextBoxBounds(long, float, float, float, long, long, long)
-
nvgTextBoxBounds
public static void nvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, java.nio.ByteBuffer string, @Nullable float[] bounds) public static void nvgTextBoxBounds(long ctx, float x, float y, float breakRowWidth, java.lang.CharSequence string, @Nullable float[] bounds)Array version of:TextBoxBounds
-
nnvgTextMetrics
public static void nnvgTextMetrics(long ctx, float[] ascender, float[] descender, float[] lineh)Array version of:nnvgTextMetrics(long, long, long, long)
-
nvgTextMetrics
public static void nvgTextMetrics(long ctx, @Nullable float[] ascender, @Nullable float[] descender, @Nullable float[] lineh)Array version of:TextMetrics
-
-