This is a Luigifan's little test of both transparency methods:
left - alpha-blending algorithm,
middle - AND->OR blitting algorithm.
right - Source image and it's mask.

Test #1
I made vertical gradient background image:
- Spoiler

- Spoiler


And run this interesting test:


Result:
- SMBX uses masks always in the render process by AND->OR bit blitting algorithm, result have a lot of color glitches.
- The PGE using masks once in the loading process which merging image and mask into RGBA-image which rendering by alpha-bleding algorithm.
Get this test
Test #2
Will be made test with horizontal gradient:
- Spoiler

- Spoiler





















And ran this test:


Result:
- SMBX uses AND->OR bit blitting algorithm which is not support true transparency and makes garbled colors.
- PGE uses the alpha-channel to generate target sprites from masks, and renders them with real semi-transparency by alpha-blending algorithm.
Get this test
Test #3
Little programming examples:
For make real test, I got THIS example for Visual Basic 6 (Language, used for made SMBX) which implementing AND->OR bit blitting algorithm:
http://www.vbexplorer.com/VBExplorer/gdi1.asp
And I replaced images to my SMBX's sprites:

And build them.
I take this result:

As you see, result is same, what displayed in SMBX.
VisualBasic 6 source which creating this mask (And I think, this is same method, what uses in SMBX for render sprites)
Code: Select all
Private Sub cmdDrawMask_Click()
'Draws the mask with vbSrcAnd raster operation
BitBlt Me.hDC, 0, 0, picMask.ScaleWidth, picMask.ScaleHeight, picMask.hDC, 0, 0, vbSrcAnd
End Sub
Private Sub cmdDrawSprite_Click()
'Draws the sprite witht the vbSrcPaint raster operation
BitBlt Me.hDC, 0, 0, picSprite.ScaleWidth, picSprite.ScaleHeight, picSprite.hDC, 0, 0, vbSrcPaint
End Sub
All sources and test EXE of this you can get here: VB6 Mask Example.zip
In C++ with Qt I using mask once to define alpha-channel of target image:
https://github.com/Wohlhabend-Networks/PlatGEnWohl/blob/master/Editor/common_features/graphics_funcs.cpp#L24
Code: Select all
QPixmap setAlphaMask(QPixmap image, QPixmap mask)
{
if(mask.isNull())
return image;
if(image.isNull())
return image;
QImage target = image.toImage();
QImage newmask = mask.toImage();
if(target.size()!= newmask.size())
{
newmask = newmask.copy(0,0, target.width(), target.height());
}
newmask.invertPixels();
target.setAlphaChannel(newmask);
return QPixmap::fromImage(target);
}
This allow using of any grades of semi-transparency.
But you should fix all lazy-made sprites (What is this?) which sometimes using in the SMBX's custom stuff



