opacity helper
[vg.git] / vg_imgui.h
index 4433b2a2d9b650d7cdd576618297d7bd0baa37f5..0a83a53f714e6fe6e59bac27fe03eedfa2582e7d 100644 (file)
@@ -850,6 +850,11 @@ static void ui_text_glyph( const struct ui_font *font, ui_px scale,
    out_texcoords[3] = out_texcoords[1] + font->glyph_height;
 }
 
+static u32 ui_opacity( u32 colour, f32 opacity ){
+   u32 alpha = opacity * 255.0f;
+   return (colour & 0x00ffffff) | (alpha << 24);
+}
+
 static u32 ui_ntext( ui_rect rect, const char *str, u32 len, ui_px scale, 
                      enum ui_align align, u32 colour ){
        ui_rect text_cursor;