Mattias Gaertner wrote:
On Mon, 16 Apr 2007 22:46:49 +0200
Marc Weustink <[EMAIL PROTECTED]> wrote:

Mattias Gaertner wrote:
On Mon, 16 Apr 2007 11:20:55 +0200
Marc Weustink <[EMAIL PROTECTED]> wrote:

Continuing my TRawImageQuestion.

While implementing cursors and imagelists, Paul and I start to get confused. It appears that Mask and Alpha are treated as equal while
in fact they are each others inverse. (An 1 in a mask means that
this part of the image is masked, not drawn, where for alpha a 1
means opaque, fully drawn)

A RawImageDesription describes the RGB and Alpha parts of an image.
It has also a flag that the Alpha is separate. This got introduced
since traditional windows has only an image and a (1bpp) mask.
When reading such image, the mask gets converted into a 1bit
separate alpha.

With CreateBitmapFromRawImage the fun starts. It creates a bitmap
and mask handle form the rawimage. The maskhandle is created from
the (separate) alpha and is in fact returning an alpha handle and
not a maskhandle. On win32 this is nonsense since alpha is never
separated. So I think a Maskhandle should return what it means: a
handle to a Mask (and only in the case when the description had
the AlphaSeparate flag).

Comments ?
Maybe we need an enum, how to interpret the alpha value?
I was think on that also, but somehow didn't sound right. I don't know
exactly for all widgets, but as far as I can tell the separate alpha
is only used for win32 1bit masks.
If this is the case, then ignore my other mail since
TRawImage.MaskData is indeed MaskData. But then the AlphaSeparate,
AlphaBitsPerPixel, AlphaLineEnd, AlphaBitOrder and AlphaByteOrder are
not really Alpha, but Mask -> MaskSeparate (or HasMask),
MaskBitsPerPixel, MaskLineEnd, MaskBitOrder and MaskByteOrder

True.
What do we take instead of the enum?
define: if Mask is separate, then it is opacity, otherwise transparency?

Something like that. But IMO there is no such thing as MaskIsSeparate since there won't be an included mask. HasMask is a better name I think.

And if we add MaskPrec and MaskShift: cardinal; then the Alpha definition is complete independent of a Mask definition

BTW, why are the xxxPrec and xxxShift defined as Cardinal and not byte ?

Marc

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to