|  | @@ -79,10 +79,46 @@ enum NVGalign { | 
														
													
														
															
																|  |  | // Vertical align |  |  | // Vertical align | 
														
													
														
															
																|  |  | NVG_ALIGN_TOP 		= 1<<3,	// Align text vertically to top. |  |  | NVG_ALIGN_TOP 		= 1<<3,	// Align text vertically to top. | 
														
													
														
															
																|  |  | NVG_ALIGN_MIDDLE	= 1<<4,	// Align text vertically to middle. |  |  | NVG_ALIGN_MIDDLE	= 1<<4,	// Align text vertically to middle. | 
														
													
														
															
																|  |  | NVG_ALIGN_BOTTOM	= 1<<5,	// Align text vertically to bottom. |  |  |  | 
														
													
														
															
																|  |  | NVG_ALIGN_BASELINE	= 1<<6, // Default, align text vertically to baseline. |  |  |  | 
														
													
														
															
																|  |  |  |  |  | NVG_ALIGN_BOTTOM	= 1<<5,	// Align text vertically to bottom. | 
														
													
														
															
																|  |  |  |  |  | NVG_ALIGN_BASELINE	= 1<<6, // Default, align text vertically to baseline. | 
														
													
														
															
																|  |  | }; |  |  | }; | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | enum NVGblendFactor { | 
														
													
														
															
																|  |  |  |  |  | NVG_ZERO = 1<<0, | 
														
													
														
															
																|  |  |  |  |  | NVG_ONE = 1<<1, | 
														
													
														
															
																|  |  |  |  |  | NVG_SRC_COLOR = 1<<2, | 
														
													
														
															
																|  |  |  |  |  | NVG_ONE_MINUS_SRC_COLOR = 1<<3, | 
														
													
														
															
																|  |  |  |  |  | NVG_DST_COLOR = 1<<4, | 
														
													
														
															
																|  |  |  |  |  | NVG_ONE_MINUS_DST_COLOR = 1<<5, | 
														
													
														
															
																|  |  |  |  |  | NVG_SRC_ALPHA = 1<<6, | 
														
													
														
															
																|  |  |  |  |  | NVG_ONE_MINUS_SRC_ALPHA = 1<<7, | 
														
													
														
															
																|  |  |  |  |  | NVG_DST_ALPHA = 1<<8, | 
														
													
														
															
																|  |  |  |  |  | NVG_ONE_MINUS_DST_ALPHA = 1<<9, | 
														
													
														
															
																|  |  |  |  |  | NVG_SRC_ALPHA_SATURATE = 1<<10, | 
														
													
														
															
																|  |  |  |  |  | }; | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | enum NVGcompositeOperation { | 
														
													
														
															
																|  |  |  |  |  | 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, | 
														
													
														
															
																|  |  |  |  |  | }; | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | struct NVGcompositeOperationState { | 
														
													
														
															
																|  |  |  |  |  | int srcRGB; | 
														
													
														
															
																|  |  |  |  |  | int dstRGB; | 
														
													
														
															
																|  |  |  |  |  | int srcAlpha; | 
														
													
														
															
																|  |  |  |  |  | int dstAlpha; | 
														
													
														
															
																|  |  |  |  |  | }; | 
														
													
														
															
																|  |  |  |  |  | typedef struct NVGcompositeOperationState NVGcompositeOperationState; | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  | struct NVGglyphPosition { |  |  | struct NVGglyphPosition { | 
														
													
														
															
																|  |  | const char* str;	// Position of the glyph in the input string. |  |  | const char* str;	// Position of the glyph in the input string. | 
														
													
														
															
																|  |  | float x;			// The x-coordinate of the logical glyph position. |  |  | float x;			// The x-coordinate of the logical glyph position. | 
														
													
												
													
														
															
																|  | @@ -123,6 +159,22 @@ void nvgCancelFrame(NVGcontext* ctx); | 
														
													
														
															
																|  |  | // Ends drawing flushing remaining render state. |  |  | // Ends drawing flushing remaining render state. | 
														
													
														
															
																|  |  | void nvgEndFrame(NVGcontext* ctx); |  |  | void nvgEndFrame(NVGcontext* ctx); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | // | 
														
													
														
															
																|  |  |  |  |  | // Composite operation | 
														
													
														
															
																|  |  |  |  |  | // | 
														
													
														
															
																|  |  |  |  |  | // The composite operations in NanoVG are modeled after HTML Canvas API, and | 
														
													
														
															
																|  |  |  |  |  | // the blend func is based on OpenGL (see corresponding manuals for more info). | 
														
													
														
															
																|  |  |  |  |  | // The colors in the blending state have premultiplied alpha. | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | // Sets the composite operation. The op parameter should be one of NVGcompositeOperation. | 
														
													
														
															
																|  |  |  |  |  | void nvgGlobalCompositeOperation(NVGcontext* ctx, int op); | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | // Sets the composite operation with custom pixel arithmetic. The parameters should be one of NVGblendFactor. | 
														
													
														
															
																|  |  |  |  |  | void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor); | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | // Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. The parameters should be one of NVGblendFactor. | 
														
													
														
															
																|  |  |  |  |  | void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha); | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  | // |  |  | // | 
														
													
														
															
																|  |  | // Color utils |  |  | // Color utils | 
														
													
														
															
																|  |  | // |  |  | // | 
														
													
												
													
														
															
																|  | @@ -183,7 +235,7 @@ void nvgReset(NVGcontext* ctx); | 
														
													
														
															
																|  |  | // Solid color is simply defined as a color value, different kinds of paints can be created |  |  | // Solid color is simply defined as a color value, different kinds of paints can be created | 
														
													
														
															
																|  |  | // using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern(). |  |  | // using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern(). | 
														
													
														
															
																|  |  | // |  |  | // | 
														
													
														
															
																|  |  | // Current render style can be saved and restored using nvgSave() and nvgRestore(). |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // Current render style can be saved and restored using nvgSave() and nvgRestore(). | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Sets current stroke style to a solid color. |  |  | // Sets current stroke style to a solid color. | 
														
													
														
															
																|  |  | void nvgStrokeColor(NVGcontext* ctx, NVGcolor color); |  |  | void nvgStrokeColor(NVGcontext* ctx, NVGcolor color); | 
														
													
												
													
														
															
																|  | @@ -231,7 +283,7 @@ void nvgGlobalAlpha(NVGcontext* ctx, float alpha); | 
														
													
														
															
																|  |  | // Apart from nvgResetTransform(), each transformation function first creates |  |  | // Apart from nvgResetTransform(), each transformation function first creates | 
														
													
														
															
																|  |  | // specific transformation matrix and pre-multiplies the current transformation by it. |  |  | // specific transformation matrix and pre-multiplies the current transformation by it. | 
														
													
														
															
																|  |  | // |  |  | // | 
														
													
														
															
																|  |  | // Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore(). |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore(). | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Resets current transform to a identity matrix. |  |  | // Resets current transform to a identity matrix. | 
														
													
														
															
																|  |  | void nvgResetTransform(NVGcontext* ctx); |  |  | void nvgResetTransform(NVGcontext* ctx); | 
														
													
												
													
														
															
																|  | @@ -368,7 +420,7 @@ NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey | 
														
													
														
															
																|  |  | // Scissoring |  |  | // Scissoring | 
														
													
														
															
																|  |  | // |  |  | // | 
														
													
														
															
																|  |  | // Scissoring allows you to clip the rendering into a rectangle. This is useful for various |  |  | // 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. |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // user interface cases like rendering a text edit or a timeline. | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Sets the current scissor rectangle. |  |  | // Sets the current scissor rectangle. | 
														
													
														
															
																|  |  | // The scissor rectangle is transformed by the current transform. |  |  | // The scissor rectangle is transformed by the current transform. | 
														
													
												
													
														
															
																|  | @@ -423,7 +475,7 @@ void nvgArcTo(NVGcontext* ctx, float x1, float y1, float x2, float y2, float rad | 
														
													
														
															
																|  |  | // Closes current sub-path with a line segment. |  |  | // Closes current sub-path with a line segment. | 
														
													
														
															
																|  |  | void nvgClosePath(NVGcontext* ctx); |  |  | void nvgClosePath(NVGcontext* ctx); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Sets the current sub-path winding, see NVGwinding and NVGsolidity. |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // Sets the current sub-path winding, see NVGwinding and NVGsolidity. | 
														
													
														
															
																|  |  | void nvgPathWinding(NVGcontext* ctx, int dir); |  |  | void nvgPathWinding(NVGcontext* ctx, int dir); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r, |  |  | // Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r, | 
														
													
												
													
														
															
																|  | @@ -440,7 +492,7 @@ void nvgRoundedRect(NVGcontext* ctx, float x, float y, float w, float h, float r | 
														
													
														
															
																|  |  | // Creates new ellipse shaped sub-path. |  |  | // Creates new ellipse shaped sub-path. | 
														
													
														
															
																|  |  | void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry); |  |  | void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Creates new circle shaped sub-path. |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // Creates new circle shaped sub-path. | 
														
													
														
															
																|  |  | void nvgCircle(NVGcontext* ctx, float cx, float cy, float r); |  |  | void nvgCircle(NVGcontext* ctx, float cx, float cy, float r); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Fills the current path with current fill style. |  |  | // Fills the current path with current fill style. | 
														
													
												
													
														
															
																|  | @@ -503,7 +555,7 @@ void nvgFontBlur(NVGcontext* ctx, float blur); | 
														
													
														
															
																|  |  | // Sets the letter spacing of current text style. |  |  | // Sets the letter spacing of current text style. | 
														
													
														
															
																|  |  | void nvgTextLetterSpacing(NVGcontext* ctx, float spacing); |  |  | void nvgTextLetterSpacing(NVGcontext* ctx, float spacing); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Sets the proportional line height of current text style. The line height is specified as multiple of font size. |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // Sets the proportional line height of current text style. The line height is specified as multiple of font size. | 
														
													
														
															
																|  |  | void nvgTextLineHeight(NVGcontext* ctx, float lineHeight); |  |  | void nvgTextLineHeight(NVGcontext* ctx, float lineHeight); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Sets the text align of current text style, see NVGalign for options. |  |  | // Sets the text align of current text style, see NVGalign for options. | 
														
													
												
													
														
															
																|  | @@ -590,7 +642,7 @@ struct NVGparams { | 
														
													
														
															
																|  |  | int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h); |  |  | int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h); | 
														
													
														
															
																|  |  | void (*renderViewport)(void* uptr, int width, int height, float devicePixelRatio); |  |  | void (*renderViewport)(void* uptr, int width, int height, float devicePixelRatio); | 
														
													
														
															
																|  |  | void (*renderCancel)(void* uptr); |  |  | void (*renderCancel)(void* uptr); | 
														
													
														
															
																|  |  | void (*renderFlush)(void* uptr); |  |  |  | 
														
													
														
															
																|  |  |  |  |  | void (*renderFlush)(void* uptr, NVGcompositeOperationState compositeOperation); | 
														
													
														
															
																|  |  | void (*renderFill)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths); |  |  | void (*renderFill)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths); | 
														
													
														
															
																|  |  | void (*renderStroke)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths); |  |  | void (*renderStroke)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths); | 
														
													
														
															
																|  |  | void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGscissor* scissor, const NVGvertex* verts, int nverts); |  |  | void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGscissor* scissor, const NVGvertex* verts, int nverts); | 
														
													
												
													
														
															
																|  | 
 |