[Lazarus] TColor and Alpha channel support

Martin Schreiber mse00000 at gmail.com
Mon Sep 26 15:52:50 CEST 2016


On Monday 26 September 2016 15:01:04 Graeme Geldenhuys via Lazarus wrote:
> On 2016-09-26 13:52, Martin Schreiber via Lazarus wrote:
> > Or:
> > "
> >  Alpha := ...; // property Alpha: TColor
> > "
> > for alpha per colour channel.
>
> In that case I would make it a record type with RedAlpha, GreenAlpha and
> BlueAlpha: Byte. Why?, Because TColor's range is way to large, with most
> of the acceptable values being meaningless.
>
Using TColor has the advantage that the same mechanism of RGB-lookup 
of "logical" colours as with normal TColor values can be used. TColor with 
the MSB = 0 is a special case where the lower bytes contain the RGB values. 
Simple and efficient.
In MSEgui the MSB defines the kind of the logical color value, "functional" 
(cl_invalid,cl_default..), "mapped" (cl_dkshadow,cl_shadow...), "named RGB" 
(cl_black, cl_dkgray...) and "user".

Martin


More information about the Lazarus mailing list