I'm guessing it's probably more I'm doing something wrong, but I'd like to confirm anyway.
In my project, there is a wrapper class around TBgraBitmaps. This is so that I can easily switch between different graphics libraries and/or use different ones on different platforms (for example, I already also have a - fully working - wrapper for Graphics32, too).
The following procedure is meant to give equivalent behaviour to (Graphics32's) TBitmap32.Clear - as far as I can tell TBgraBitmap doesn't have an equivalent procedure built in, so I did something that should give an equivalent result.
procedure <wrapper class>.DoClear(aColor: Cardinal);
begin
<TBgraBitmap>.Rectangle(0, 0, Width, Height, aColor, aColor, dmSet);
<TBgraBitmap>.SaveToFile(IntToHex(aColor, 8) + '.png');
end;
I've tried a few of the other overloads of Rectangle and FillRect too, but always get the same result. It appears that this works fine when dealing with solid colors, but goes haywire when non-255 alpha values become involved. In the above procedure, the second line is there solely for debugging purposes.
The output images, regardless of the value of aColor, always seem to be one of two results:
(ARGB) 00, 00, 00, 00; every pixel in the output PNG is 255, 0, 0, 0. (IE: Correct color, but wrong alpha value.)
Anything else; every pixel in the output PNG is 255, 200, 200, 200. (IE: Wrong color, wrong alpha value, and always the same color.)
Any pointers on where I might be going wrong here? I have verified that the actual value being passed for aColor is correct, although since the saved PNG filename is based off aColor's value anyway it'd be pretty apparent if the issue was there.