Recent

Author Topic: TImage in Lazarus 0.9.24  (Read 12606 times)

giorgiotani

  • Guest
TImage in Lazarus 0.9.24
« on: November 15, 2007, 04:37:51 pm »
Hi, to use themeable graphic on my application compiled with 0.9.20 I defined some TBitmap variables, loaded BPM from files at application startup, assigned bitmaps to TImage objects.
The result was quite good and the color of the first pixel of the BMP (the one on the bottom left) was automatically used as the color for transparence.
This no longer happens in Lazarus 0.9.24, even setting property transparent:=true for the image and manually setting transparence color for the bitmap, even loading the bitmap form designer (so statically linking it in the executable, which I must avoid since graphic may be changed from the user at startup, like in the previous version of the application)...
what is the correct way to use transparence color in bitmaps for TImage now, or PNG files with transparence?
Loading a PNG with transparence in the designer does the trick, but I need the application do this at startup, not statically loading the images in the executable.

giorgiotani

  • Guest
TImage in Lazarus 0.9.24
« Reply #1 on: November 16, 2007, 08:59:29 am »
Ok, it's needed to explicitely set the image transparent i.e. Image1.Transparent:=true;
setting it in the RAD is not working.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2695
TImage in Lazarus 0.9.24
« Reply #2 on: November 16, 2007, 11:13:31 am »
Did you really check this with 0.9.24 ?
I ask since this was one of the issues I fixed before 0.9.24 was tagged
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

giorgiotani

  • Guest
TImage in Lazarus 0.9.24
« Reply #3 on: November 17, 2007, 08:32:19 am »
Yes, I tested recompiling PeaZip 1.9.3 sources with Lazarus-0.9.24-fpc-2.2.0-20071114-win32.exe on XP SP2 (I downloaded it the first day it was available), my former reference development environment was 0.9.20.

TImage bitmaps have needed to be set explicitely transparent, and TBitmaps for being used in stringgrids needed to be set transparent too; otherwise, the bitmap was not possible to be set transparent from the RAD.
Another thing, bitmaps loaded at runtime in a TImagelist object for being used in main menu and popup menu were not displayed correctly, so I just removed the TImagelist and explicitely set bitmaps for menu items.
Button gliphs worked fine without any intervention.

However overall 0.9.24 is a big improvement and I'm very glad using it!

giorgiotani

  • Guest
TImage in Lazarus 0.9.24
« Reply #4 on: November 19, 2007, 10:33:16 am »
I tested on a better monitor... button gliphs too suffers of the same issue of bitmaps not automatically having first pixel's color interpreted as transparent.
(at the moment, I'm only testing the Win32 version of Lazarus 0.9.24)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2695
TImage in Lazarus 0.9.24
« Reply #5 on: November 19, 2007, 12:54:34 pm »
Yes, images are not automatically set to transparent. That is delphi compatible and different to earlier verisons of lazarus (what was wrong)

However I realize now that it will effect existing forms
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

giorgiotani

  • Guest
TImage in Lazarus 0.9.24
« Reply #6 on: November 20, 2007, 11:29:31 am »
Hi, well, after I realized what was the cause the solution is very simple, and overall I can say this new release of Lazarus is great!

BTW, thanking the embedded file drag and drop example I'll add "system to application" drag and drop feature to PeaZip's next release, which I think many users will like!
Doing the reverse, dragging items from the application to the system, IMHO will be more difficult, but I'll keep studying on it.

Thank you very much and keep up the good work!

oniriabot

  • New Member
  • *
  • Posts: 12
TImage in Lazarus 0.9.24
« Reply #7 on: November 23, 2007, 06:32:14 pm »
Hi,

What is the solution about this bug ? I want to set transparent in the RAD and it doesn't work. If I set Transparent to be set in my software and I load a bitmap from disk, my bitmap isn't transparent.

How to correct this, please ?

Oniria

giorgiotani

  • Guest
TImage in Lazarus 0.9.24
« Reply #8 on: November 25, 2007, 11:13:14 am »
Hi Oniria, for me it worked loading bitmaps from disk to TBitmap objects, and then using those tbitmap as bitmaps for TImage objects.
To make the image transparent I needed to set transparent TImage objects, i.e. Image1.Transparent:=true; at form create event; then you can even replace bitmap in the image at runtime (i.e. I do so at mouseover) and, once the TImage is set transparent, transparence is applied to any TBitmap used as bitmap of the TImage.

 

TinyPortal © 2005-2018