[Lazarus] High-DPI TImageList

Ondrej Pokorny lazarus at kluug.net
Wed Jan 10 14:40:20 CET 2018


I am happy to announce that I uploaded the first version of High-DPI 
TImageList. The LCL part should be complete, the win32 part as well. 
There is one backwards compatibility issue: adding sprites - their 
support is broken (the image is added as one and not cut into several 
images). I haven't done the design-time part yet either. That means that 
the ImageList dialog doesn't support multiple resolutions. But 
everything else should be good.

+ Good news: I was able to add interpolation support with alpha chanel 
(did you know FPC supports it? :) ) !!! So images are scaled smoothly 
and nicely without any external library evolved - and it is supported on 
all OS/WS. Obviously scaling down works better than scaling up.

For now I tested Win32 only - other widgetsets will be probably broken. 
I'll take a look into them later.

Issue report with a test project: 
https://bugs.freepascal.org/view.php?id=32967
Branch to test: 
https://svn.freepascal.org/svn/lazarus/branches/HiDPIImageList

Please test and comment - especially component vendors.

To take advantage of the new PPI features in your control you have to 
replace all ImgList.Width, ImgList.Height, ImgList.Draw* etc. methods 
with PPI-aware properties/constructs. Like:
ImgList.Width -> ImgList.WidthForImagePPI[DesiredWidthAt96PPI, 
Font.PixelsPerInch]
- or -
ImgResolution := ImgList.ResolutionForImagePPI[DesiredWidthAt96PPI, 
Font.PixelsPerInch];
ImgResolution := ImgList.Resolution[DesiredWidthRegardlessOfPPI];
ImageWidth := ImgResolution.Width;
ImageHeight := ImgResolution.Height;
ImgResolution.Draw(...);
ImgResolution.GetBitmap(...);

etc.

Ondrej
_______________________________________________
Lazarusdev mailing list
Lazarusdev at freepascal.org
https://idefix.freepascal.org/cgi-bin/mailman/listinfo/lazarusdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180110/7ff9575c/attachment.html>


More information about the Lazarus mailing list