Welcome, Guest
Username: Password: Remember me
CodeTyphon MacOS Development, discussions and problems
  • Page:
  • 1

TOPIC:

HiDPI images in menus 3 years 8 months ago #15032

  • Premysl Beran
  • Premysl Beran's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 48
  • Thank you received: 0
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.

HiDPI images in menus 3 years 8 months ago #15033

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4517
  • Thank you received: 1102
Thanks Sir
Please
-your OS-CPU ?
-your CodeTyphon version ?
PilotLogic Architect and Core Programmer

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

Last edit: by Sternas Stefanos.

HiDPI images in menus 3 years 8 months ago #15034

  • Premysl Beran
  • Premysl Beran's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 48
  • Thank you received: 0
Hi Sternas,

macOS Catalina, CT 7.1

Premek

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

HiDPI images in menus 3 years 8 months ago #15035

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4517
  • Thank you received: 1102
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

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

Last edit: by Sternas Stefanos.

HiDPI images in menus 3 years 8 months ago #15036

  • Premysl Beran
  • Premysl Beran's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 48
  • Thank you received: 0
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

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

  • Page:
  • 1