diff --git a/src/nanovg.c b/src/nanovg.c index a9f6a07..c50657f 100644 --- a/src/nanovg.c +++ b/src/nanovg.c @@ -306,6 +306,12 @@ struct NVGcolor nvgTransRGBA(struct NVGcolor c, unsigned char a) return c; } +struct NVGcolor nvgTransRGBAf(struct NVGcolor c, float a) +{ + c.a = a; + return c; +} + struct NVGcolor nvgLerpRGBA(struct NVGcolor c0, struct NVGcolor c1, float u) { int i; diff --git a/src/nanovg.h b/src/nanovg.h index 0767759..9233560 100644 --- a/src/nanovg.h +++ b/src/nanovg.h @@ -133,6 +133,9 @@ struct NVGcolor nvgLerpRGBA(struct NVGcolor c0, struct NVGcolor c1, float u); // Sets transparency of a color value. struct NVGcolor nvgTransRGBA(struct NVGcolor c0, unsigned char a); +// Sets transparency of a color value. +struct NVGcolor nvgTransRGBAf(struct NVGcolor c0, float a); + // Returns color value specified by hue, saturation and lightness. // HSL values are all in range [0..1], alpha will be set to 255. struct NVGcolor nvgHSL(float h, float s, float l);