Browse Source

Add warning about Alpha Blending

rexim 1 year ago
parent
commit
100d74eccf
2 changed files with 7 additions and 0 deletions
  1. 3 0
      README.md
  2. 4 0
      olive.c

+ 3 - 0
README.md

@@ -20,6 +20,9 @@ Olive.c is a classical [stb-style](https://github.com/nothings/stb) single heade
 
 ## Quick Example (Flag of Japan)
 
+> [!WARNING]
+> Always initialize your Canvas with a color that has Non-Zero Alpha Channel! A lot of functions use `olivec_blend_color()` function to blend with the Background which preserves the original Alpha of the Background. So you may easily end up with a result that is perceptually transparent if the Alpha is Zero.
+
 *This example also uses [stb_image_write.h](https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h) to create the PNG image*
 
 ```c

+ 4 - 0
olive.c

@@ -314,6 +314,10 @@ static Olivec_Font olivec_default_font = {
     .height = OLIVEC_DEFAULT_FONT_HEIGHT,
 };
 
+// WARNING! Always initialize your Canvas with a color that has Non-Zero Alpha Channel!
+// A lot of functions use `olivec_blend_color()` function to blend with the Background
+// which preserves the original Alpha of the Background. So you may easily end up with
+// a result that is perceptually transparent if the Alpha is Zero.
 typedef struct {
     uint32_t *pixels;
     size_t width;