[Lazarus] High-DPI TImageList
Ondrej Pokorny
lazarus at kluug.net
Thu Feb 8 21:00:39 CET 2018
First of all, the image list became multi-resolution. You have the new
class TCustomImageListResolution that is the new "TCustomImageList". You
have to move your custom code there.
On 08.02.2018 16:02, lainz via Lazarus wrote:
> Hi, I have a component BGRAImageList that fixes basically the alpha channels
> of the regular ImageList on Linux using BGRABitmap.
>
> I did not code that component, but I'm the one that updates the package.
>
> Sources:
> https://github.com/bgrabitmap/bgracontrols/blob/master/bgraimagelist.pas
>
> It works fine in 1.8, but in trunk there are changes like:
>
> 1.8
> TCustomImageList = class(TLCLReferenceComponent)
>
> 1.9 is TCustomImageList = class(TLCLComponent), so the method
> ReferenceNeeded is not available.
>
> Questions:
> - *What does ReferenceNeeded, and if it is necessary on 1.9*.
On win32 you need a handle for WinAPI native controls. The real
imagelist code (along with ReferenceNeeded method) was moved into
TCustomImageListResolution.
You have to move all your code into a TCustomImageListResolution
descendant and register it in TCustomImageList.GetResolutionClass.
> Another is this:
>
> 1.8
> procedure Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer; ADrawingStyle:
> TDrawingStyle; AImageType: TImageType;
> ADrawEffect: TGraphicsDrawEffect); overload; virtual;
>
> 1.9
> procedure Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer; ADrawingStyle:
> TDrawingStyle; AImageType: TImageType;
> ADrawEffect: TGraphicsDrawEffect); overload;
>
> In 1.9 the virtual was removed and I can't use override anymore.
Again, override TCustomImageListResolution.Draw
> My question is *if the method still will be called instead of the LCL one in
> 1.9 without using override*. I know this is a basic of OOP but I need a bit
> of help because I never use virtual and overload.
Override TCustomImageListResolution.Draw
> Another question: If I remove override to compile in 1.9, what happens in
> 1.8?
The new image list from 1.9 is not compatible with 1.8. You have to
release a new version for 1.9+ only.
> I never use IFDEF LCL_FULLVERSION and don't know how to use it, any chances
> to have 2 different methods, one with override and other without, one for
> 1.8 and one for 1.9 or newer?
>
> And the big question:
>
> *Transparency is now or will be fixed on linux, so I don't need this
> component anymore and I can archive it?*
I didn't change anything about transparency but for me transparency
works fine on both Gtk2 and Qt Linux. (I don't know any other details.)
Ondrej
More information about the Lazarus
mailing list