[Lazarus] to the BGRABitmap maintainer...

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Apr 19 10:47:53 CEST 2011


Hi,

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.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/





More information about the Lazarus mailing list