> Hi,
>
> Gambas 2.12 with QT
>
> I had a prog that worked well in Gambas 2.11 but now it
> doesn't work correctly for all the images with transparent
> areas.
> Here is a very short illustration of the problem
>
> DIM PicSac AS Picture
> DIM PicCase AS Object[]
> Dim i AS Integer
>
> PicCase.Resize(2)
> FOR i = 0 TO 1
>     PicCase[i] = NEW Picture(14, 14, TRUE)
> NEXT
> PicCase[0] = Picture.Load(image with some transparent part)
> PicCase[1] = Picture.Load(image without transparent area)
>
> PicSac = NEW Picture(14, 14, TRUE)
> i = 0
> Draw.Begin(PicSac)
> Draw.Picture(PicCase[i], 0, 0, 14, 14, 0, 0, 14, 14)
> Draw.End
>
> PictureBox1.Picture = PicSac
>
> i = 0 => nothing displayed
> i = 1 => correct display
> (I know that Gambas 2.12 changed the Draw routine)
> Is it a bug?
>
> regards,
> Dominique Simonart
>

I will look at that.

Beware that the Picture class is not really transparent. It has no alpha 
channel but a bitmap mask.

Creating a "transparent" Picture internally creates an X11 pixmap and a X11 
bitmap mask. Drawing on it the must update both the pixmap and the mask. I 
think that the mask update is buggy for the Draw.Picture() method.

Anyway, you should use the Image class and its Draw method to draw an image on 
top another one with real alpha transparency.

To add to the complexity, converting an Image to a Picture keeps the alpha 
information with gb.qt, but not with gb.gtk. This is a Qt feature, that uses 
the XRender extension for that. But GTK+ don't, and just removes all pixels 
whose alpha component is lower than 128. But you should not take that into 
account as it is really toolkit specific.

Regards,

-- 
Benoît

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to