Strange behavior on simple bitmap draw to a Canvas
Original Reporter info from Mantis: sekelsenmat
-
Reporter name: Felipe Monteiro de Carvalho
Original Reporter info from Mantis: sekelsenmat
- Reporter name: Felipe Monteiro de Carvalho
Description:
Hello,
I've noticed very string behavior when drawing a simple bitmap to a canvas, both on the canvas of a form and of a custom control.
What seams to happen is that one color of the bitmap is selected as transparent and part of the image isn't drawn. I would like to emphasize that this behavior is not connected to the Transparent property of the bitmap. If I set the bitmap to transparent and select a transparent color an extra color will become transparent in addition to the one related on the bug. If I set Transparent to false the bug also appears.
The problem only affects Linux (both GTK and GTK2) and does not affect all linux machines, but on the machines it affect, it affects them all of the time.
Specificaly, on some machines I have no problems, on some the White pixels of the bitmap becomes transparent and are not painted and on I even saw one where the Black pixels become transparent!
The behavior is erratic as bitmaps (.bmp) should never be transparent. It may have something to do with the X configuration on those machines as it isn't always reproducible.
I tested with many different bitmap files.
Steps to reproduce:
1 - Draw a big black square to the canvas of a form
Canvas.Brush.Color := clBlack;
Canvas.FillRect(0, 0, 500, 500);
2 - Draw a bitmap on top of it on the same canvas of the form. The areas witch were white on the bitmap are now black! (they were not painted)
var
bmp: TBitmap;
begin
bmp := TBitmap.Create;
bmp.LoadFromFile(GetTempDir(False) + 'display.bmp');
Canvas.Draw(0, 0, bmp);
bmp.Free;
How to reproduce with the test program:
1 - Put the display.bmp picture on your local temp directory. May be ~/tmp or /tmp
2 - Compile the program
3 - Click the "Paint with color button" (picture draw_test_2.png)
4 - Click the "Paint display" button (picture draw_test_3.png)
Additional information:
Machines witch present no error:
1 - Pentium 4 - Mandriva Linux 2006 - xorg 6.9
2 - AMD 1GHz - Kubuntu
machines where the White Pixels are not drawn:
1 - Pentium 4 - Mandriva Linux 2005 - xorg 6.8.2
2 - 750 Mhz - Ubuntu
3 - GTK 2.6.10, XOrg 6.8.2, Gentoo Linux 2005.1, GNOME 2.10.2
Machines where the Black Pixels are not drawn:
1 - Pentium 4 1.5Ghz - Damn Small Linux
Mantis conversion info:
- Mantis ID: 1566
- OS: Mandrake Linux
- OS Build: 10.2
- Platform: x86 intel
- Version: 0.9.11 (SVN)
- Monitored by: » bruce (Bruce Tulloch)
- Target version: 1.0.0
- LazTarget: 1.0