http://bugs.winehq.org/show_bug.cgi?id=24278
Summary: Transparent PNG are shown inverted by applications compiled with Lazarus Product: Wine Version: 1.2-rc4 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: alejandro.lavarello@gmail.com
Created an attachment (id=30578) --> (http://bugs.winehq.org/attachment.cgi?id=30578) Even at design time, Lazarus shows inverted the PNG in Wine.
Applications that are compiled with Lazarus display transparent PNG images upside down. Tested in Wine 1.2 rc4 in Puppy Linux 5 and in WineXO.
The same executable shows OK in Windows.
A example executable showing the problem can be downloaded from:
http://freakshare.net/files/meqi0gmc/ImageMirroredInWine.rar.html
duplicated in this other link:
http://www.megaupload.com/?d=NVSAW5Y1
According to Marc Weustink, the Lazarus implementer of bitmap handling, this can occur because:
" Through the GetObject() function I get the BITMAP info of a given HBITMAP If the HBITMAP was created as DIBsection, the BITMAP.bmBits will point to the data of the bitmap. On "real" windows you are allowed to manipulate this data.
For these bmBits I want to know if they are bottom-up or top-down.
With the GetDIBits() function I request the first scanline/pixel in bottom-up order (so it is the last line of the bitmap). I cannot compare it to the value I found in bmBits, since top and bottom may have the same pixelvalue.
Now I invert the first pixel of bmBits and I request again the first scanline in bottom-up order.
If the first pixel did change, then the data was bottom-up. It the pixel didn't change, I was manipulating the top of the bitmap
There can be a few issues with wine: 1) bmBits points to a copy of the bitmap data 2) GetDIBits doesn't honor the requested scanline order (== doesn't reorder if bottom-up is requested while the image is top-down) 3) Wine does report a negative height, and I think I request a bottom-up but I get a top-down
"
(see http://www.lazarus.freepascal.org/index.php/topic,10353.0.html )
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #1 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-09-05 09:42:37 CDT --- Created an attachment (id=30579) --> (http://bugs.winehq.org/attachment.cgi?id=30579) Same problem in WineXO
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #2 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-09-05 09:43:50 CDT --- Created an attachment (id=30580) --> (http://bugs.winehq.org/attachment.cgi?id=30580) In Windows XP, no problem.
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #3 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-09-05 09:48:02 CDT --- Created an attachment (id=30581) --> (http://bugs.winehq.org/attachment.cgi?id=30581) The Lazarus project for compiling test program
http://bugs.winehq.org/show_bug.cgi?id=24278
Alejandro Lavarello alejandro.lavarello@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #30578|Even at design time, |A Lazarus application shows description|Lazarus shows inverted the |inverted the PNG in Wine. |PNG in Wine. |
http://bugs.winehq.org/show_bug.cgi?id=24278
Dmitry Shachnev Mitya57@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |Mitya57@gmail.com
--- Comment #4 from Dmitry Shachnev Mitya57@gmail.com 2010-09-05 09:50:54 CDT --- *** Bug 24277 has been marked as a duplicate of this bug. ***
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #5 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-09-05 09:51:03 CDT --- Created an attachment (id=30582) --> (http://bugs.winehq.org/attachment.cgi?id=30582) Lazarus IDE exhibit this problem at design time in Wine
http://bugs.winehq.org/show_bug.cgi?id=24278
Andrew O. Shadoura (I DO NOT USE COMPIZ) bugzilla@tut.by changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@tut.by
http://bugs.winehq.org/show_bug.cgi?id=24278
Marc Weustink marc@freepascal.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |marc@freepascal.org
--- Comment #6 from Marc Weustink marc@freepascal.org 2010-09-08 18:32:23 CDT --- The pasted description is what I remembered when I implemented this. I've written a small example showing the source of the problem. On the windows GetDIBits ignores the sign of Info.biHeight while WINE doesnt.
Output on Windows (XP): pix 1: 0x00000001 pix 2: 0x00000001 pix 3: 0x00000003 pix 4: 0x00000003
Output on WINE (wine-1.2.0-2.fc13.i686): pix 1: 0x00000001 pix 2: 0x00000003 pix 3: 0x00000001 pix 4: 0x00000003
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #7 from Marc Weustink marc@freepascal.org 2010-09-08 18:35:17 CDT --- Created an attachment (id=30641) --> (http://bugs.winehq.org/attachment.cgi?id=30641) Sample source + exe showing problem
http://bugs.winehq.org/show_bug.cgi?id=24278
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, testcase
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #8 from Marc Weustink marc@freepascal.org 2010-09-09 04:13:08 CDT --- On second thought.... This might be a issue, but isn't the issue for lazarus. The correct pixels are returned for a positive Info.biHeight, so that can't be the case.
To be continued.... (and I need to install 1.3.2)
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #9 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-09-09 12:53:01 CDT --- Marc, Ok, is not the Lazarus problem, but... why only occurs with transparent PNG and not with opaque PNG or Windows BMP files???
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #10 from Marc Weustink marc@freepascal.org 2010-09-09 14:00:56 CDT --- 32bpp bmp files with alpha channel suffer from the same problem.
The point is that alpha images in lazarus are not premultiplied, while the AlphaBlend() function requires a premultiplied bitmap. So I need to premultiply all pixels. Therefore I need the pixels of the bitmap. I need the direction of the scanlines in order to get the sourcerectangle of the image we want to alphablend
http://bugs.winehq.org/show_bug.cgi?id=24278
--- Comment #11 from Marc Weustink marc@freepascal.org 2010-09-13 18:25:44 CDT --- Created an attachment (id=30739) --> (http://bugs.winehq.org/attachment.cgi?id=30739) Sample source + exe showing problem with DIBsection
while then bitmap_dir example (attachment 30641) still shows an incompatibility with windows (wine 1.3.2), it is not the source of the reversed Lazarus images. In that example the source bitmap was based on CreateDIBitmap(), which is not the type used for bitmaps in Lazarus.
The bitmap_dir_2 example is based on CreateDIBSection(). This shows the lazarus problem. This example returns the wrong scanline for top to bottom bitmaps.
output on windows XP: test 1: 0x00000001 test 2: 0x00000001 test 3: 0x00000003 test 4: 0x00000003
output on wine 1.3.2: test 1: 0x00000001 test 2: 0x00000001 test 3: 0x00000001 test 4: 0x00000001
http://bugs.winehq.org/show_bug.cgi?id=24278
Jack Edmonds pocketcookies2@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |pocketcookies2@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=24278
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |00cpxxx@gmail.com
--- Comment #12 from Bruno Jesus 00cpxxx@gmail.com 2011-10-02 11:49:57 CDT --- Output in latest git:
winefree@ACER:/home/bjesus/Downloads$ wine project2.exe pix 1: 0x00000001 pix 2: 0x00000001 pix 3: 0x00000003 pix 4: 0x00000003
winefree@ACER:/home/bjesus/Downloads$ wine project3.exe test 1: 0x00000001 test 2: 0x00000001 test 3: 0x00000003 test 4: 0x00000003
It seems fixed to me.
http://bugs.winehq.org/show_bug.cgi?id=24278
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #13 from Austin English austinenglish@gmail.com 2011-10-03 13:33:45 CDT --- (In reply to comment #12)
Output in latest git:
winefree@ACER:/home/bjesus/Downloads$ wine project2.exe pix 1: 0x00000001 pix 2: 0x00000001 pix 3: 0x00000003 pix 4: 0x00000003
winefree@ACER:/home/bjesus/Downloads$ wine project3.exe test 1: 0x00000001 test 2: 0x00000001 test 3: 0x00000003 test 4: 0x00000003
It seems fixed to me.
Fixed.
http://bugs.winehq.org/show_bug.cgi?id=24278
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org 2011-10-10 13:13:32 CDT --- Closing bugs fixed in 1.3.30.