[Lazarus] to the BGRABitmap maintainer...
alexione at gmail.com
Tue Apr 19 11:34:55 CEST 2011
On Tue, Apr 19, 2011 at 10:47, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> I have been taking a quick look at the BGRABitmap package and looked
> through a few of the tutorials posted on the FPC Wiki. The library seems
> quite impressive - nice work.
> I have found a rather gaping API flaw though, regarding these two methods:
> function BGRA(red, green, blue, alpha: byte): TBGRAPixel; overload;
> function BGRA(red, green, blue: byte): TBGRAPixel; overload;
> >From the name, one would expect the parameters to be "blue", "green",
> "red", "alpha", but in fact that is not the case - but rather the
> reverse is true.
> Maybe a more sensible name for those methods would be RGBA(...)? That
> way the name of the method matches the parameters order better.
> eg: Code take from: http://wiki.freepascal.org/BGRABitmap
> bmp.FillRect(40,40,80,80,BGRA(0,0,255,128), dmDrawWithTransparency);
> If one doesn't know the API and parameter names, but rather just looking
> at the code itself, I would have thought the above code would draw a Red
> square, not a Blue square.
red-green-blue is "standard" order of RGB components, so changing it
to blue-green-red wouldn't be very wise. Maybe changing function names
to something more suitable is better? I believe this is little
annoyance - once you take a look at parameter names, you see what is
More information about the Lazarus