News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Icon scaling

Started by kkurkiewicz, September 14, 2023, 07:19:37 AM

Previous topic - Next topic

zedd151

Quote from: Caché GB on September 15, 2023, 07:16:28 AMIDA uses QtCore, QtGui and QtXml. You would need to look to those to find out what is going on.
IDA and Qt most likely have there own proprietary image storage/image manipulation solutions
for there user interfaces.
Thank you, Caché GB

That is precisely what kkurkiewicz needs to know. Probably why resizing the icon down to 32x32 using the usual apis looks so bad.

HSE

Looking in running applications, happen that icon is stored double: large and small icon.

In 32 and 64 bits Masm32 SDK test apps both have 32x32.

In IDA Freeware large is 32x32 and small is 16x16  (inside a Qt class, etc)

Interesting thing is that "blur icon" is the 16x16 scaled to 32x32 (like SPY show).

My system only show 16x16 icons in window title bar, then I can't help to find differences  :biggrin:


Equations in Assembly: SmplMath

zedd151

Which version number of IDA is that, HSE? The OP states that he is using IDA freeware version 8.2.

HSE

IDA have nothing to do. Problem apparently is related with "Scale Up", like Fearless think.
Equations in Assembly: SmplMath

zedd151

Quote from: kkurkiewicz on September 14, 2023, 06:17:31 PMThe size of the icon saved in ida.ico definitely is 128x128, and, as far as I can tell, that's the only version of the icon that's provided because inspecting ida64.exe with Resource Hacker also gives me only that one icon. In the snippet, I'm loading it using LR_LOADFROMFILE, but turning the icon into a resource and then loading it by ordinal or name – using either LoadImageA or LoadIconA – gives me the exact same result, and the same thing happens with other icons too. Obviously, IDA is not written in assembly, but is it possible that, when ida64.exe is run, the icon is loaded in some other way?
HSE, I am going by what kkurkiewicz posted. He is resizing a 128x128 icon from ida down to 32x32, please reread his posts.  :smiley:

jj2007

Quote from: kkurkiewicz on September 14, 2023, 06:17:31 PMusing either LoadImageA or LoadIconA

Kamil,

You are on the right track:
- create a static control with the SS_ICON style
- in your resource file, use 77 ICON "Ida.ico"
- use invoke SendMessage, hMyStatic, STM_SETIMAGE, IMAGE_ICON, rv(LoadImage, hInstance, 77, IMAGE_ICON, 0, 0, 0) where 77 is the resource ID

LoadIcon looks simpler but you get an awfully pixelated result - no good.

I can assure you that the QT framework is not needed :cool:

HSE

Quote from: zedd151 on September 15, 2023, 09:55:13 AMHe is resizing a 128x128 icon from ida down to 32x32

That is what you think. But under the hood, Windows API make other thing. I presume that depend on system, system configuration and manifest. 
Equations in Assembly: SmplMath

NoCforMe

Quote from: HSE on September 15, 2023, 11:07:38 PM
Quote from: zedd151 on September 15, 2023, 09:55:13 AMHe is resizing a 128x128 icon from ida down to 32x32

That is what you think. But under the hood, Windows API make other thing. I presume that depend on system, system configuration and manifest. 

No, that's what is actually happening, obviously: there's a 128x128 icon (confirmed by OP) that's being displayed at 32x32 (also confirmed), so what Zedd wrote is true.

The question is, just how is this being accomplished? That's open to speculation at this point.
Assembly language programming should be fun. That's why I do it.

HSE

Kamil problem is that 128x128 is scale down to 16x16. That is not strange because each window class store 2 icon copies, apparently one small to show in window corner, and one big to show in system bar. Because Kamil system show windows title bar bigger, small icon is scale up to 32x32.

But that it's not so simple. In my system (building template Masm32 SDK GUI apps) both windows class icons are 32x32. We don't know Kamil system, configurations, manifest, windows options... just something is different.
Equations in Assembly: SmplMath

NoCforMe

Quote from: HSE on September 16, 2023, 04:50:41 AMKamil problem is that 128x128 is scale down to 16x16. That is not strange because each window class store 2 icon copies, apparently one small to show in window corner, and one big to show in system bar. Because Kamil system show windows title bar bigger, small icon is scale up to 32x32.

Except that this does not seem to be the case for the icon displayed by IDA (see the first post in this thread), which is 32x32, apparently scaled down from 128x128. Just look at those two icons: the one he's trying to show is much clearer than his 32x32 one, which may well be scaled up from 16x16 as you describe. But the other one is certainly sharper, therefore (I'm assuming) it's scaled down (by some process unknown to me) from 128x128--> 32x32.

Or I could be completely full of it, and willing to be proven wrong. But it seems to me that this is what's going on.
Assembly language programming should be fun. That's why I do it.

HSE

 
Quote from: NoCforMe on September 16, 2023, 04:57:24 AMOr I could be completely full of it, and willing to be proven wrong. But it seems to me that this is what's going on.

:biggrin:  :biggrin:

IDA don't show window class icon in the corner. What you see is an specific "icon" Qt class .
Equations in Assembly: SmplMath

NoCforMe

Quote from: HSE on September 16, 2023, 05:23:40 AMIDA don't show window class icon in the corner. What you see is an specific "icon" Qt class .

So how do you know that? Not disputing you, mind you, just wondering where that knowledge comes from. (And I know nothing about Qt.)
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: jj2007 on September 15, 2023, 10:44:04 AM- create a static control with the SS_ICON style
- in your resource file, use 77 ICON "Ida.ico"
- use invoke SendMessage, hMyStatic, STM_SETIMAGE, IMAGE_ICON, rv(LoadImage, hInstance, 77, IMAGE_ICON, 0, 0, 0) where 77 is the resource ID

Attached a testbed for you, a pure Masm32 SDK source :cool:

The icon in the upper left is displayed with DrawIcon.
The icon in the lower left is actually a bmp file.
Only the one in the right looks good - on a static control, as shown above.

NoCforMe

Hard to tell at the size you posted, but both lower images look pretty good (and identical) to me.
Assembly language programming should be fun. That's why I do it.

kkurkiewicz

Quote from: kkurkiewicz on September 14, 2023, 06:26:03 PM
Quote from: NoCforMe on September 14, 2023, 11:30:47 AMWhat is the actual (displayed) size of that icon you show?
As far as I recall, the displayed size is 32x32.
I just checked some other icon, and it turns out that the actual size of the 'caption' icon displayed in the title bar might not be 32x32, but 28x28:

The icon is 32px, but, when rendered, the size changes to 28x28. This one seems to endure the loading process much better than Ida's head but it clearly shows that even if the icon has the proper size, Windows will still somehow transform it.
Kamil