FireBirdLib - Topfield TMS PVR TAP Programming Library
FM_AlphaBlend.c
Go to the documentation of this file.
1#include "FBLib_FontManager.h"
2
3byte FM_AlphaBlend(byte Alpha, byte FG, byte BG, float AntiAliasFactor)
4{
6
7 dword Color;
8 float ColorFactor;
9
10 if(Alpha == 0)
11 {
12 TRACEEXIT();
13 return BG;
14 }
15
16 if(Alpha == 0xff)
17 {
18 TRACEEXIT();
19 return FG;
20 }
21
22 ColorFactor = (float)((((dword)Alpha * FG) + ((dword)(255 - Alpha) * BG)) >> 8) * AntiAliasFactor;
23 Color = (int)ColorFactor;
24
25 TRACEEXIT();
26 return (Color > 255) ? 255 : Color;
27}
byte FM_AlphaBlend(byte Alpha, byte FG, byte BG, float AntiAliasFactor)
Definition: FM_AlphaBlend.c:3
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243