AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Free pascal resize image3/18/2024 ![]() Yes, this suffers from aliasing – but I can live with it – it’s good enough for me so I hope it’s good enough for you. The only solution I’ve come up is to programmatically resize (or more precisely upsize) depending on the logical DPI setting. BUT, I still want my application to look usable even on 250% DPI scaling. If you have your glyphs in all needed sizes you can accomplish this by storing all the images you use in your UI directly inside your executable as a resource, then depending on the DPI scaling load the needed size and apply to UI.Īs said, I do not have those glyphs in various needed sizes – I’m stuck with 16×16 pixels. When I say pixel perfect I mean you would want to have a glyph that is not upsized or downsized by resizing – as stretching a bitmap will suffer from aliasing effect. Now, and again, ideally you would want to display pixel perfect 40×40 bitmap when on 250% DPI. I guess most of you are in the same position. I’m no graphics guru – have no plans (read: time) to redraw all those glyphs to have them in various pixel perfect sizes. I’ve used those for menus, toolbars, buttons and all around my UI. ![]() At that time I’ve used bitmaps shipped with Delphi and those are 16 x 16 pixels (actually 32×16 as the image has the mask in it). ![]() I’ve started developing this particular application of mine some 10+ years ago. Do you have all the images/bitmaps you use in your application in 40×40 px size? Do you have them in 20×20 (125%) and 24×24 (150%) and 32×32 (200%) and 48×48 (300%) and so on. ![]() Say you run your application on a 15’’ laptop with resolution set to 3480×2160 and scaling set to 250% (240 DPI) – the ideal glyph size for this is 40×40 pixels as 250% of 16 is 40. Now what? How to have those images at the correct size for the applied DPI scaling? However, you open up the application’s main menu (or any popup menu) set to display images from an image list – and your fancy images appear super small (or are not drawn at all when you move your mouse over items)? The same small images appear on toolbars? You then note buttons having their Glyph property set to display some 16×16 pixels graphics – caption font is ok, but the glyph is also barely visible. So, you’ve made your Delphi application high-DPI aware and after a few manual fixes the UI looks more or less usable on 4K displays having logical DPI values set to more than 100% (96 DPI). ![]()
0 Comments
Read More
Leave a Reply. |