Author Topic: what makes and breaks Icons?sizecontrol?  (Read 618 times)

daydreamer

  • Member
  • *****
  • Posts: 1384
  • building nextdoor
what makes and breaks Icons?sizecontrol?
« on: August 24, 2020, 09:46:13 PM »
I am trying different sizes of icons and trying to use them on buttons and draw them with icondraw and icondrawex
100,100 buttons use centered small icon sizes around 40x40 (checking screenshot)
icondrawex only makes use of smaller size of icon,so bigger sizes in icondrawex size only draws smaller lowres icon upsized which looks terrible
any way to control Loadicon a resource or something else to control buttons and icondrawex to use the biggest 256x256 icon,or 128x128?
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)

fearless

  • Member
  • ***
  • Posts: 480
    • LetTheLightIn
Re: what makes and breaks Icons?sizecontrol?
« Reply #1 on: August 24, 2020, 10:03:25 PM »
Can look at LoadImage and using IMAGE_ICON and specifying size, or try LoadIconWithScaleDown or LoadIconMetric functions
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

My Github  Twitter

TouEnMasm

  • Member
  • *****
  • Posts: 1395
    • EditMasm
Re: what makes and breaks Icons?sizecontrol?
« Reply #2 on: August 24, 2020, 10:48:27 PM »
When you have really specific needs with buttons ,an owner drawn button can be a soluce.
you can search here: http://www.massmind.org/images/www/asmedit/AsmMain.html with no update,"Helas".
or you can test one of it's creation in the zip.
Fa is a musical note to play with CL

daydreamer

  • Member
  • *****
  • Posts: 1384
  • building nextdoor
Re: what makes and breaks Icons?sizecontrol?
« Reply #3 on: August 26, 2020, 01:34:17 AM »
thanks Yves for the tool :thumbsup:
Can look at LoadImage and using IMAGE_ICON and specifying size, or try LoadIconWithScaleDown or LoadIconMetric functions
thanks that works to get big icons and suddenly 2 of my test drawiconex works
one with 256,256 size and one that has 0,0 size and DEFAULTSIZE as flag :thumbsup:
one looks little darker,used DEFAULTCOLOR flag have something todo with it?
but stretchblt or GDI+ might draw resized Icons with antialias?

so many HANDLES/HICON after each other,I can treat it as animation frames
many image buttons in a row can be for different spells
 
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)

daydreamer

  • Member
  • *****
  • Posts: 1384
  • building nextdoor
Re: what makes and breaks Icons?sizecontrol?
« Reply #4 on: August 28, 2020, 04:20:30 AM »
I think array of Icons and array cursors would be better way to organize them ,just tiny LUT to control animation
Code: [Select]
hIcons[0] = LoadIcon(hInst, IDI_APPLICATION);
hIcons[1] = LoadIcon(NULL, IDI_ASTERISK);
hIcons[2] = LoadIcon(NULL, IDI_EXCLAMATION);
hIcons[3] = LoadIcon(NULL, IDI_QUESTION);
hIcons[4] = LoadIcon(NULL, IDI_HAND);
hIcons[5] = LoadIcon(hInst,MAKEINTRESOURCE(IDI_SMALL));
hIcon1 = LoadIcon(NULL, IDI_QUESTION);
hIcon2 = LoadIcon(hInst, MAKEINTRESOURCE(201));
//hIcon3 = LoadIcon(hInst,MAKEINTRESOURCE( IDI_WTEST));
hIcon3 =(HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_WTEST), IMAGE_ICON, 256, 256, LR_DEFAULTCOLOR);

in paint alternative drawex with DI_DEFAULTSIZE uses 256x256 or whatever size icon is,just use 0,0
Code: [Select]
DrawIcon(hdc, 600, 400, hIcon2);
DrawIconEx(hdc, 800, 0, hIcon2, 256, 256,0, NULL, DI_NORMAL);
DrawIconEx(hdc, 800, 300, hIcon1, 256, 256, 0, NULL, DI_NORMAL);
DrawIconEx(hdc, 1000, 0, hIcon3, 0, 0, 0, NULL, DI_NORMAL);
DrawIconEx(hdc, 1000, 300, hIcon3, 0, 0, 0, NULL, DI_NORMAL | DI_DEFAULTSIZE);
DrawIconEx(hdc, 1000, 500, hIcon3, 256, 256,0, NULL, DI_NORMAL);

DrawIcon(hdc, i*20, j*20, hIcon2);//Rectangle(hdc, i * 20, j * 20, i * 20 + 19, j * 20 + 19);
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)

daydreamer

  • Member
  • *****
  • Posts: 1384
  • building nextdoor
Re: what makes and breaks Icons?sizecontrol?
« Reply #5 on: September 05, 2020, 08:49:55 PM »
Can look at LoadImage and using IMAGE_ICON and specifying size, or try LoadIconWithScaleDown or LoadIconMetric functions
I make macro that creates button ,percentages of screensizes,also percentage of screenheight/screenwidht controls position so it works in any resolution ,just above 768 to above hires 1080 and LoadImages matching buttonsizes
 
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7608
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: what makes and breaks Icons?sizecontrol?
« Reply #6 on: September 06, 2020, 12:14:09 AM »
Magnus,

If you can make sense of what you are after, icons come in fixed sizes and when multiple sizes are required, they are written into the same icon file which makes them bigger. One trick is to make an icon the biggest size you need but only have one image in the icon file as the OS resizes icons to fit like in the top left of the window and some about boxes.

Multi-resolution icons look the best but single sized icons are usually smaller.

Get yourself a decent icon editor, the Axialis Icon Workshop is a very good tool.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

daydreamer

  • Member
  • *****
  • Posts: 1384
  • building nextdoor
Re: what makes and breaks Icons?sizecontrol?
« Reply #7 on: September 07, 2020, 06:39:56 AM »
If you can make sense of what you are after, icons come in fixed sizes and when multiple sizes are required, they are written into the same icon file which makes them bigger. One trick is to make an icon the biggest size you need but only have one image in the icon file as the OS resizes icons to fit like in the top left of the window and some about boxes.

Multi-resolution icons look the best but single sized icons are usually smaller.

Get yourself a decent icon editor, the Axialis Icon Workshop is a very good tool.
thanks Hutch :thumbsup:
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7608
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: what makes and breaks Icons?sizecontrol?
« Reply #8 on: September 07, 2020, 12:05:37 PM »
Magnus,

Icons are usually used in standard sizes and while you can build non standard sized icons, they are normally in pixel square sizes, 16, 32, 48, 64, 96, 128, 256, and even 512 on late OS versions.

You load them with LoadImage() and in normal contexts like in the client area, you use DrawIconEx() called from a WM_PAINT to display an icon at whatever location you want.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Vortex

  • Member
  • *****
  • Posts: 2372
Re: what makes and breaks Icons?sizecontrol?
« Reply #9 on: September 08, 2020, 05:08:40 AM »
Hi daydreamer,

Here is an example for you. It displays an icon in the client area of a window.

daydreamer

  • Member
  • *****
  • Posts: 1384
  • building nextdoor
Re: what makes and breaks Icons?sizecontrol?
« Reply #10 on: September 08, 2020, 08:31:10 AM »
I need to find later version of resource compiler,this one gives error message when. Ico files are compressed, now when I tried different compressor alternatives, 8bit and 32bit compressed
File sizes goes down to ca 60kb when its very detailed artwork, to b/w simple goes down to only 4.05 kb
Thanks Erol

Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)

Vortex

  • Member
  • *****
  • Posts: 2372
Re: what makes and breaks Icons?sizecontrol?
« Reply #11 on: September 08, 2020, 04:27:37 PM »
Hi daydreamer,

As we know, the latest versions of Visual Studio are providing rc.exe , the MS resource compiler. Some alternatives are Pelle's resource compiler, Jeremy Gordon's GoRc and windres the GNU resouce compiler.

daydreamer

  • Member
  • *****
  • Posts: 1384
  • building nextdoor
Re: what makes and breaks Icons?sizecontrol?
« Reply #12 on: September 09, 2020, 06:02:02 AM »
As we know, the latest versions of Visual Studio are providing rc.exe , the MS resource compiler. Some alternatives are Pelle's resource compiler, Jeremy Gordon's GoRc and windres the GNU resouce compiler.
rc.exe combined with cvtres.exe was used previously,was only able to find cvtres.exe,seem rc.exe is integrated in VS,maybe inside on of these .dll file
so I found GoRC ,which is capable of RC files->.obj files directly,works great,also with compressed .ico files :thumbsup:
10 big Icons +350kb on .exe

Hutch ,is LoadImage from file going to be same limits as the OS it is run on:pre-vista OS incapable of compressed 256x256.ico files?,512x512 .ico only on win10 ?
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7608
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: what makes and breaks Icons?sizecontrol?
« Reply #13 on: September 09, 2020, 10:36:31 AM »
Magnus,

RC.EXE from 10 years ago will do the job correctly when it comes to resources. The same with cvtres.exe. An icon is a specific file format and you must make them correctly for them to work.

LoadImage has been around since Win NT 4 and its nothing new, what changes is the OS and with the current Windows version, you can use icons up to 512 x 512 pixel but they end up really large file sizes. Your real use of icons apart from a desktop icon is being able to use DrawIconEx() from a WM_PAINT message where you need the transparency when drawn over different backgrounds.

If you just need to display an image, use a BMP or a JPG if you know how to load them. Pelle's resource compiler works fine but I have never used Jeremy's version so you will have to test that yourself.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

daydreamer

  • Member
  • *****
  • Posts: 1384
  • building nextdoor
Re: what makes and breaks Icons?sizecontrol?
« Reply #14 on: September 13, 2020, 01:27:05 AM »
I think I need a secondary system drawing only moving Icons and only the underlying "tile" to reduce flicker from WM_TIMER
+ and - moves up and down level

mouse button = move player here
just testing
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)