|  | @@ -74,7 +74,7 @@ struct NVGstate { | 
														
													
														
															
																|  |  | float miterLimit; |  |  | float miterLimit; | 
														
													
														
															
																|  |  | int lineJoin; |  |  | int lineJoin; | 
														
													
														
															
																|  |  | int lineCap; |  |  | int lineCap; | 
														
													
														
															
																|  |  | float alpha; |  |  |  | 
														
													
														
															
																|  |  |  |  |  | NVGcolor tint; | 
														
													
														
															
																|  |  | float xform[6]; |  |  | float xform[6]; | 
														
													
														
															
																|  |  | NVGscissor scissor; |  |  | NVGscissor scissor; | 
														
													
														
															
																|  |  | float fontSize; |  |  | float fontSize; | 
														
													
												
													
														
															
																|  | @@ -651,7 +651,7 @@ void nvgReset(NVGcontext* ctx) | 
														
													
														
															
																|  |  | state->miterLimit = 10.0f; |  |  | state->miterLimit = 10.0f; | 
														
													
														
															
																|  |  | state->lineCap = NVG_BUTT; |  |  | state->lineCap = NVG_BUTT; | 
														
													
														
															
																|  |  | state->lineJoin = NVG_MITER; |  |  | state->lineJoin = NVG_MITER; | 
														
													
														
															
																|  |  | state->alpha = 1.0f; |  |  |  | 
														
													
														
															
																|  |  |  |  |  | state->tint = nvgRGBAf(1, 1, 1, 1); | 
														
													
														
															
																|  |  | nvgTransformIdentity(state->xform); |  |  | nvgTransformIdentity(state->xform); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | state->scissor.extent[0] = -1.0f; |  |  | state->scissor.extent[0] = -1.0f; | 
														
													
												
													
														
															
																|  | @@ -697,9 +697,34 @@ void nvgLineJoin(NVGcontext* ctx, int join) | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | void nvgGlobalAlpha(NVGcontext* ctx, float alpha) |  |  | void nvgGlobalAlpha(NVGcontext* ctx, float alpha) | 
														
													
														
															
																|  |  |  |  |  | { | 
														
													
														
															
																|  |  |  |  |  | nvgGlobalTint(ctx, nvgRGBAf(1, 1, 1, alpha)); | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | void nvgGlobalTint(NVGcontext* ctx, NVGcolor tint) | 
														
													
														
															
																|  |  |  |  |  | { | 
														
													
														
															
																|  |  |  |  |  | NVGstate* state = nvg__getState(ctx); | 
														
													
														
															
																|  |  |  |  |  | state->tint = tint; | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | NVGcolor nvgGetGlobalTint(NVGcontext* ctx) | 
														
													
														
															
																|  |  |  |  |  | { | 
														
													
														
															
																|  |  |  |  |  | NVGstate* state = nvg__getState(ctx); | 
														
													
														
															
																|  |  |  |  |  | return state->tint; | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | void nvgAlpha(NVGcontext* ctx, float alpha) | 
														
													
														
															
																|  |  |  |  |  | { | 
														
													
														
															
																|  |  |  |  |  | NVGstate* state = nvg__getState(ctx); | 
														
													
														
															
																|  |  |  |  |  | state->tint.a *= alpha; | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  |  |  |  | 
 | 
														
													
														
															
																|  |  |  |  |  | void nvgTint(NVGcontext* ctx, NVGcolor tint) | 
														
													
														
															
																|  |  | { |  |  | { | 
														
													
														
															
																|  |  | NVGstate* state = nvg__getState(ctx); |  |  | NVGstate* state = nvg__getState(ctx); | 
														
													
														
															
																|  |  | state->alpha = alpha; |  |  |  | 
														
													
														
															
																|  |  |  |  |  | int i; | 
														
													
														
															
																|  |  |  |  |  | for (i = 0; i < 4; i++) | 
														
													
														
															
																|  |  |  |  |  | state->tint.rgba[i] *= tint.rgba[i]; | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e, float f) |  |  | void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e, float f) | 
														
													
												
													
														
															
																|  | @@ -2234,9 +2259,11 @@ void nvgFill(NVGcontext* ctx) | 
														
													
														
															
																|  |  | else |  |  | else | 
														
													
														
															
																|  |  | nvg__expandFill(ctx, 0.0f, NVG_MITER, 2.4f); |  |  | nvg__expandFill(ctx, 0.0f, NVG_MITER, 2.4f); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Apply global alpha |  |  |  | 
														
													
														
															
																|  |  | fillPaint.innerColor.a *= state->alpha; |  |  |  | 
														
													
														
															
																|  |  | fillPaint.outerColor.a *= state->alpha; |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // Apply global tint | 
														
													
														
															
																|  |  |  |  |  | for (i = 0; i < 4; i++) { | 
														
													
														
															
																|  |  |  |  |  | fillPaint.innerColor.rgba[i] *= state->tint.rgba[i]; | 
														
													
														
															
																|  |  |  |  |  | fillPaint.outerColor.rgba[i] *= state->tint.rgba[i]; | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | ctx->params.renderFill(ctx->params.userPtr, &fillPaint, state->compositeOperation, &state->scissor, ctx->fringeWidth, |  |  | ctx->params.renderFill(ctx->params.userPtr, &fillPaint, state->compositeOperation, &state->scissor, ctx->fringeWidth, | 
														
													
														
															
																|  |  | ctx->cache->bounds, ctx->cache->paths, ctx->cache->npaths); |  |  | ctx->cache->bounds, ctx->cache->paths, ctx->cache->npaths); | 
														
													
												
													
														
															
																|  | @@ -2269,9 +2296,11 @@ void nvgStroke(NVGcontext* ctx) | 
														
													
														
															
																|  |  | strokeWidth = ctx->fringeWidth; |  |  | strokeWidth = ctx->fringeWidth; | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Apply global alpha |  |  |  | 
														
													
														
															
																|  |  | strokePaint.innerColor.a *= state->alpha; |  |  |  | 
														
													
														
															
																|  |  | strokePaint.outerColor.a *= state->alpha; |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // Apply global tint | 
														
													
														
															
																|  |  |  |  |  | for (i = 0; i < 4; i++) { | 
														
													
														
															
																|  |  |  |  |  | strokePaint.innerColor.rgba[i] *= state->tint.rgba[i]; | 
														
													
														
															
																|  |  |  |  |  | strokePaint.outerColor.rgba[i] *= state->tint.rgba[i]; | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | nvg__flattenPaths(ctx); |  |  | nvg__flattenPaths(ctx); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
												
													
														
															
																|  | @@ -2438,15 +2467,18 @@ static int nvg__allocTextAtlas(NVGcontext* ctx) | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | static void nvg__renderText(NVGcontext* ctx, NVGvertex* verts, int nverts) |  |  | static void nvg__renderText(NVGcontext* ctx, NVGvertex* verts, int nverts) | 
														
													
														
															
																|  |  | { |  |  | { | 
														
													
														
															
																|  |  |  |  |  | int i; | 
														
													
														
															
																|  |  | NVGstate* state = nvg__getState(ctx); |  |  | NVGstate* state = nvg__getState(ctx); | 
														
													
														
															
																|  |  | NVGpaint paint = state->fill; |  |  | NVGpaint paint = state->fill; | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Render triangles. |  |  | // Render triangles. | 
														
													
														
															
																|  |  | paint.image = ctx->fontImages[ctx->fontImageIdx]; |  |  | paint.image = ctx->fontImages[ctx->fontImageIdx]; | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | // Apply global alpha |  |  |  | 
														
													
														
															
																|  |  | paint.innerColor.a *= state->alpha; |  |  |  | 
														
													
														
															
																|  |  | paint.outerColor.a *= state->alpha; |  |  |  | 
														
													
														
															
																|  |  |  |  |  | // Apply global tint | 
														
													
														
															
																|  |  |  |  |  | for (i = 0; i < 4; i++) { | 
														
													
														
															
																|  |  |  |  |  | paint.innerColor.rgba[i] *= state->tint.rgba[i]; | 
														
													
														
															
																|  |  |  |  |  | paint.outerColor.rgba[i] *= state->tint.rgba[i]; | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
														
															
																|  |  | ctx->params.renderTriangles(ctx->params.userPtr, &paint, state->compositeOperation, &state->scissor, verts, nverts, ctx->fringeWidth); |  |  | ctx->params.renderTriangles(ctx->params.userPtr, &paint, state->compositeOperation, &state->scissor, verts, nverts, ctx->fringeWidth); | 
														
													
														
															
																|  |  | 
 |  |  | 
 | 
														
													
												
													
														
															
																|  | 
 |