Lazarus
Programming => Widgetset => Carbon => Topic started by: Hansaplast on October 15, 2012, 04:21:12 am
-
I love to see Lazarus Development moving forward ... big thumbs up guys!
However; Did something change from 1.0.0 -> 1.0.2 affecting the transparent background for TextOut and CopyRect now no longer appear to be transparent.
The regular TextOut (in my case anyway) now has a white background - which (in 1.0.0) used to be transparant.
Using CopyRect (source: LRS Lazarus Resource of a transparant PNG) results in the same issue (background white).
I have not been able to test this on other platforms, but I'm using MacOS X 10.8.2, Lazarus 1.0.2, FPC 2.6.0, i386-darwin-carbon (Intel).
For TextOut, I used TextRect as a workaround successfully, which works even without setting TextStyle.Opaque:=false.
For CopyRect I did try
SetBkMode(Handle, TRANSPARENT);
But that didn't fix it ... :(
Any suggestions?
-
Providing the entire (unfinished code) can be provided, but maybe this is enough to get started;
Procedure xyz;
var icnInactive : TPicture;
begin
...
{$I pngicons.lrs} // resources hold transparant PNG, icn_inactive
...
icnInactive := TPicture.Create;
icnInactive.LoadFromLazarusResource('icn_inactive');
...
APanel.Canvas.CopyRect(Rect(0,0,16,16),icnInactive.Bitmap.Canvas,Rect(0,0,16,16));
...
end;
APanel is an existing TPanel on Form1.
I'm loading the picture in a TImage because multiple images are copied on the TPanel depending on states.
Setting Pixelformat didn't make a difference either ...
icnInactive.Bitmap.PixelFormat:=pf32Bit;
Using Draw instead of CopyRect (with and without PixelFormat set to 32 bit) didn't work either;
APanel.Canvas.Draw(0,0,icnInactive.Graphic);
-
Attached: example screenshots.
In Lazarus 1.0.0 the white background was actually transparant (see Untitled2.png).
In Lazarus 1.0.2 it's white as shown in the picture (Untitled.png).
-
Please fill an issue about it and attach example - it's regression.
-
Full example please. That can be unzipped in a folder, and compiled without further work.
-
Thanks for the replies, I'll make a full working example and post it here and as a bug ... :)
-
Well I wanted to try to compile it 1.0.0 as well but I'm afraid reinstalling 1.0.0 might get confused with the existing 1.0.2 install. So here the coe I slapped together.
Click in button will create a gradient, then the PNG in the resource will be place in the image on top of the gradient.
The transparant part turns black in this example.
-
Sorry - it appears this is a bad demo of what I was doing in my other project.
I compiled it in a virtual machine and it showed the same black background.
In my project (rather large) I use CopyRect to display a PNG (in LRS, made with lazres) on the canvas of a TPanel.
Maybe someone has advise how to do this differently?
-
After removing my new component, recompiling the component, and putting the component back transparency appeared normal again .. !?