× CodeTyphon MacOS Development, discussions and problems

Question HiDPI images in menus

  • Premysl Beran
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
3 weeks 2 days ago #15032 by Premysl Beran
HiDPI images in menus was created by Premysl Beran
Hi all,

Recently, I find out that the TImageList component support HiDPI image export. I used it for adding icons to my TToolButtons and it works perfectly. I have very nice sharp images. I added the same ImageList to be used also for one of my TPopupMenu. But unfortunately, those images are blurred.

I found the procedure of how the tool button is painted and it uses the following method to draw the icon:
ImgList.ResolutionForPPI[FToolBar.ImagesWidth, Font.PixelsPerInch, GetCanvasScaleFactor]
        .Draw(Canvas, IconPos.X, IconPos.Y, ImgIndex, ImgEffect);

I tried to find similar for the TMenuItem, but I was unsuccessful. I tried the OwnerDraw method, but it seems doesn't work for me. Can anyone help me out how to get the sharp images also for the menu items? Thanks in advance.

With best regards

Premek

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 2 days ago - 3 weeks 2 days ago #15033 by Sternas Stefanos
Replied by Sternas Stefanos on topic HiDPI images in menus
Thanks Sir
Please
-your OS-CPU ?
-your CodeTyphon version ?

PilotLogic Architect and Core Programmer
Last edit: 3 weeks 2 days ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • Premysl Beran
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
3 weeks 2 days ago #15034 by Premysl Beran
Replied by Premysl Beran on topic HiDPI images in menus
Hi Sternas,

macOS Catalina, CT 7.1

Premek

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 2 days ago - 3 weeks 2 days ago #15035 by Sternas Stefanos
Replied by Sternas Stefanos on topic HiDPI images in menus
My suggestion
for MacOS is to
test and LAB CT ver 7.20 OR
to wait for final CT ver 7.20 (soon, I hope)

LAB CT 7.20 on MacOS has many changes.

PilotLogic Architect and Core Programmer
Last edit: 3 weeks 2 days ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • Premysl Beran
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
3 weeks 1 day ago #15036 by Premysl Beran
Replied by Premysl Beran on topic HiDPI images in menus
Hi Sternas,

I just tried the latest CT LAB 7.18, but with the same results. In the attachment is the screenshot of part with toolbutton with sharp images and popup menu with blurred one. They use the same image list component.

The menu uses to extract and store the image in TBitmap. The toolbutton is drawing directly on the canvas.

There is a GetBitmap function using the following code for extracting image from image list:
iml.ResolutionForPPI[imw, 96, 1].Resolution.GetBitmap(ImageIndex, FBitmap);

But I was not able to find the procedure where the menu bitmap is drawn on the canvas as for toolbuttons.

All other components as TBitBtn, TSpeedButton and TToolButton handle the images very nicely, only menus are blurred.

With best regards

Premek
Attachments:

Please Log in or Create an account to join the conversation.