Recent

Author Topic: [SOLVED] Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?  (Read 10837 times)

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
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

Code: [Select]
SetBkMode(Handle, TRANSPARENT);
But that didn't fix it ... :(

Any suggestions?
« Last Edit: October 16, 2012, 06:11:45 am by Hansaplast »

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?
« Reply #1 on: October 15, 2012, 04:28:22 am »
Providing the entire (unfinished code) can be provided, but maybe this is enough to get started;

Code: [Select]
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 ...
Code: [Select]
icnInactive.Bitmap.PixelFormat:=pf32Bit;
Using Draw instead of CopyRect (with and without PixelFormat set to 32 bit) didn't work either;
Code: [Select]
APanel.Canvas.Draw(0,0,icnInactive.Graphic);
« Last Edit: October 15, 2012, 04:55:32 am by Hansaplast »

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?
« Reply #2 on: October 15, 2012, 04:38:00 am »
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).


« Last Edit: October 15, 2012, 04:41:57 am by Hansaplast »

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?
« Reply #3 on: October 15, 2012, 10:23:58 am »
Please fill an issue about it and attach example - it's regression.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?
« Reply #4 on: October 15, 2012, 01:27:12 pm »
Full example please. That can be unzipped in a folder, and compiled without further work.

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?
« Reply #5 on: October 15, 2012, 03:42:27 pm »
Thanks for the replies, I'll make a full working example and post it here and as a bug ... :)

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?
« Reply #6 on: October 16, 2012, 03:21:32 am »
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.

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?
« Reply #7 on: October 16, 2012, 04:42:28 am »
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?

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus 1.0.2: TextOut and CopyRect background no longer transparent?
« Reply #8 on: October 16, 2012, 06:11:29 am »
After removing my new component, recompiling the component, and putting the component back transparency appeared normal again .. !?

 

TinyPortal © 2005-2018