News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

what makes and breaks Icons?sizecontrol?

Started by daydreamer, August 24, 2020, 09:46:13 PM

Previous topic - Next topic

daydreamer

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?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

fearless

Can look at LoadImage and using IMAGE_ICON and specifying size, or try LoadIconWithScaleDown or LoadIconMetric functions

TouEnMasm

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

thanks Yves for the tool :thumbsup:
Quote from: fearless 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
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
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

I think array of Icons and array cursors would be better way to organize them ,just tiny LUT to control animation
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
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);
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

Quote from: fearless 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
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
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

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.

daydreamer

Quote from: hutch-- on September 06, 2020, 12:14:09 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:
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

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.

Vortex

Hi daydreamer,

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

daydreamer

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

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

Vortex

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

Quote from: Vortex on September 08, 2020, 04:27:37 PM
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 ?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

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.

daydreamer

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
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding