Benoît Minisini a écrit : >> 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, > Thanks Benoit, I replaced PicCase[] and PicSac by Image and used Draw method instead of Draw.Begin(...). The last instruction is now: PictureBox1.Picture = PicSac.Picture
Here are the results: 1) i=0 now display correctly the image with transparent part 2) If I use 2 buttons to draw with i=0 (button1) and i=1 (button2) * button1 then button2 display correctly the two images successively * button2 then button1 display only the image without transparent part (button1 didn't change the display) * if I replace Image1 with another image without transparent part I could see the images associated with their buttons In conclusion, as soon as there is a transparent part in my image, it could never override another image Hope this helps Dominique Simonart ------------------------------------------------------------------------------ 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