* * *

Author Topic: [Solved] How to add High DPI icon set to package?  (Read 1199 times)

lainz

  • Hero Member
  • *****
  • Posts: 2776
  • I'm coding :)
    • Lainz
[Solved] How to add High DPI icon set to package?
« on: December 14, 2017, 03:09:07 pm »
Hi, I noticed that now Lazarus components has 3 png files, one for 100, other for 150 and other for 200.

I want to update my packages icons to fit this new way of using package icons, how I can do it?
« Last Edit: December 14, 2017, 03:29:45 pm by lainz »

wp

  • Hero Member
  • *****
  • Posts: 4741
Re: How to add High DPI icon set to package?
« Reply #1 on: December 14, 2017, 03:24:13 pm »
You must design the icons in three sizes, 24x24, 32x32 and 48x48. The first one is to be stored under the name of the component as before, the middle one has an appended _150 (for 150%), the last one _200 (200%), e.g. tpanel.png, tpanel_150.png, tpanel_200.png.

As an example, just look at folder (lazarus)/images/components. The script which creates the res file for the IDE is (lazarus)/images/components_images.bat, the needed file list is components_images_list.txt
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

lainz

  • Hero Member
  • *****
  • Posts: 2776
  • I'm coding :)
    • Lainz
Re: How to add High DPI icon set to package?
« Reply #2 on: December 14, 2017, 03:29:33 pm »
Many thanks wp.

wp

  • Hero Member
  • *****
  • Posts: 4741
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

BBasile

  • Sr. Member
  • ****
  • Posts: 400
Re: [Solved] How to add High DPI icon set to package?
« Reply #4 on: December 14, 2017, 05:47:23 pm »
Time to add a SVGToolButton, SVGSpeedButton, etc...unfortunately this require to pull a better 2D API (just for this purpose) in each widgetset.

lainz

  • Hero Member
  • *****
  • Posts: 2776
  • I'm coding :)
    • Lainz
Re: [Solved] How to add High DPI icon set to package?
« Reply #5 on: December 14, 2017, 05:58:21 pm »
Time to add a SVGToolButton, SVGSpeedButton, etc...unfortunately this require to pull a better 2D API (just for this purpose) in each widgetset.

Well BGRABitmap handles SVG very well, is not native but it works. An user is adding gradients to it. It's cross platform and solves transparency problems on Linux.

In macOS btw there is needed to fix bitmap drawings (any bitmap (TBitmap), not just bgrabitmap) for retina display. Including @2x images OR doubling the width and height of the memory bitmaps when running on retina, so these don't get pixelated.

BBasile

  • Sr. Member
  • ****
  • Posts: 400
Re: [Solved] How to add High DPI icon set to package?
« Reply #6 on: December 14, 2017, 06:11:00 pm »
Yes, they would have to look native + work out of the box after Laz get setup so for now let's go for icon sets.

lainz

  • Hero Member
  • *****
  • Posts: 2776
  • I'm coding :)
    • Lainz
Re: [Solved] How to add High DPI icon set to package?
« Reply #7 on: December 14, 2017, 06:26:01 pm »
Yes, they would have to look native + work out of the box after Laz get setup so for now let's go for icon sets.

In fact to look native is the easy part. These buttons are already custom buttons, that uses "Themes" unit to paint it state, like TSpeedButton for example.

And the only thing should be replaced is the bitmap drawing, not so hard.

Edit: as you say, must work out of the box, and having a bgrabitmap copy on lazarus has already been discussed on bugtracker and rejected.
« Last Edit: December 14, 2017, 06:37:08 pm by lainz »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus