Hi,
Thanks for reporting, it was merely a reminder for me, since I did know
when I would have finished my last fixes. And I wanted to finish that
before I would focus on this.
(i'll resolve the mantis issue)
Felipe Monteiro de Carvalho wrote:
Hi,
I did some tests to see how the magnifier would works after the image
changes, and I found some problems introduced on revision 11861
Second, on the TrayIcon component, there is this code:
What was the old situatien:
The image descrtiptions didn't have an alpha channel, the had only a
1bit mask. and this mask was sometimes uses as mask and sometimes used
as 1bit alpha. As a result of this, setting a mask on a TBitmap,
resulted in a modification of the bitmap itself, so using different
masks on the same bitmap was not possible. On the gtk widgetset
implementation, a mask was part of the bitmap (while in the LCL TBitmap
it are 2 handles).
new situation:
An alpha channel is introduced in the image description, so that all
imageformats having a native alphachannel can be described. To be able
to diplay alpha images on gtk, the bitmap gdi object got extended to
hava an additional 1bit aplha mask since gtk itself doesn't have alpha.
Note that this bitmap is currently called Mask, but it might get renamed
to Alpha in a later stage (and also support an 8 bit alpha)
Further, the meaning of the mask was in the old situation inverse of how
it is used in delphi. (In delphi a 1 in a mask means that the background
is drawn and a 0 means the image is drawn). This has also been changed.
{*******************************************************************
* Draws the icon
*******************************************************************}
GDIObject := PgdiObject(Icon.Handle);
AImage := gtk_image_new_from_pixmap(GDIObject^.GDIPixmapObject,
GDIObject^.GDIBitmapMaskObject);
This was indeed the old situation where the mask was part of the gdiobject.
gtk_widget_show(AImage);
gtk_container_add(GTK_CONTAINER(GtkForm), AImage);
..............
Which worked fine to show the bitmap on the tray. After that revision
it no longer works, because the names of the structure items changed,
but not only this. I tryed using this code:
AImage := gtk_image_new_from_pixmap(GDIObject^.GDIPixmapObject.Image,
GDIObject^.GDIPixmapObject.Image);
But it will crash the application with a strange X11 syncronization
error. I can't even get a backtrace at this point, I only found this
line was the problem by changing the code and retesting.
I can imagine that, since you are passing the same image twice, once as
image, once as mask. This wont work.
Then I tryed this:
AImage := gtk_image_new_from_pixmap(GDIObject^.GDIPixmapObject.Image,
nil);
Which will work, but the areas of the image which should be
transparent will show random pixels.
True. In the current situation, looking at one GDIobject only, you can
use (if GDIBitmapType=gbPixmap)
AImage := gtk_image_new_from_pixmap(GDIObject^.GDIPixmapObject.Image,
GDIObject^.GDIPixmapObject.Mask);
However when a TBitmap also has a MaskHandle, you need to take the
second (mask) gdiobject into account
this maskobject is per def. a 1bpp bitmap.
To combine the alpha bitmap with whe mask bitmap (and take the mask
bitmap inversion into account), you can use the CreateGdkMaskBitmap in
gtkproc :
amask := CreateGdkMaskBitmap(bitmap.handle, bitmap.maskhandle);
or
amask := CreateGdkMaskBitmap(
GDIObject^.GDIPixmapObject.Mask,
MaskGDIObject^.GDIBitmapObject);
AImage := gtk_image_new_from_pixmap(GDIObject^.GDIPixmapObject.Image,
AMask);
gdk_unref(amask);
Marc
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives