CRM32Pro SDK  v5.22
How SDL Alpha works (based on SDL documentation)


SDL has two alpha blending modes: per-surface and per-pixel. Both modes will work with values ranging from 0(transperent) to 255(opaque).

Per-surface
adjusts the alpha properties of a surface, in other words, each pixel of this surface will have the same alpha value,the given by the per-surface value. To set it, you can use the SetAlpha() member of CFont, CTile, CSprite and IButton.
The per-surface alpha value of 128 is considered a special case and is optimised, so it's much faster than other per-surface values.

Per-pixel set an individual alpha value for each pixel. It is also known as alpha channel or RGBA. Usually, the easiest way to get it, is using your favourite digital imaging software(Paint Shop Pro,GIMP, etc.) and exporting your image to PNG which can be directly loaded by IImage.

Note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available. In addition, CFont,CTile, CSprite and IButton will ignore any attempt to set per-surface alpha if they already have enable the per-pixel alpha.

When blitting, the presence or absence of any alpha blending mode is relevant only on the source surface, not the destination.

Note that RGBA->RGBA blits, keep the alpha of the destination surface. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them; the destination alpha will work as a mask.

In the CRM32Pro context, you can also use the SetAlpha() member to enable(0-254) or to disable(255) the alpha blending but it will only affect to per-surface alpha.
The per-pixel alpha if presents, is always enabled.

By default, all CFont,CTile,CSprite and IButton created, will have the per-surface on disabled state while you do not set any other value. This is to help to improve the graphic performance.
Note also that all CFont,CTile,CSprite and IButton loaded from DPF will have the previously assigned alpha blending mode, which can be any.

It is quite important to remember that if you are using any alpha blending mode, you usually have to use ACCEL_SOFTWARE with the only exception of glSDL, which can work on hardware mode(ACCEL_HARDSPEED or ACCEL_HARDSMOOTH) with alpha blending using the hardware.
Otherwise, you will get a very hard slowdown on your graphic performance.

In some cases, you can mix the per-surface alpha with colorkey. You can read below table to check it.

Alpha effects surface blitting in the following ways:

RGBA->RGB The source is alpha-blended with the destination, using the alpha channel. Colorkey and the per-surface alpha are ignored.
RGB->RGBA The source is alpha-blended with the destination using the per-surface alpha value (if any). If Colorkey is set, only the pixels not matching the colorkey value are copied. The alpha channel of the copied pixels is set to opaque.
RGBA->RGBA The source is alpha-blended with the destination using the source alpha channel. The alpha channel in the destination surface is left untouched. Colorkey is ignored.
RGB->RGB The source is alpha-blended with the destination using the per-surface alpha value(if any). If Colorkey is set, only the pixels not matching the colorkey value are copied.