Skip to content

Commit

Permalink
Add warning about Alpha Blending
Browse files Browse the repository at this point in the history
  • Loading branch information
rexim committed Sep 7, 2024
1 parent c0eb82c commit 100d74e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://github.com/raw/nothings/stb/master/stb_image_write.h) to create the PNG image*

```c
Expand Down
4 changes: 4 additions & 0 deletions olive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 100d74e

Please sign in to comment.