Author Topic: Redundancy ?  (Read 511 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7553
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Redundancy ?
« on: November 28, 2019, 02:43:35 AM »
I had recently dug out a 2 bitmap button design I did back in about 2000 and spent an hour or so converting it from basic to 64 bit MASM. Its up and working fine but it dawned on me that I had already done it in 32 bit MASM earlier which would have been a far easier conversion. Its advantage is you can run 2 different images for the up and down positions but it comes at the cost of having to have 2 images for each button. They were only semi useful back in 2000 as you did not have RGBA images where today with later OS versions you can do some decent art work.

The size can be reduced using JPG images but this involves a large number of images having to loaded as resources. The alternative done long ago was to load a single combined image then chop it up into individual pieces for display but its been many years since I have done this.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

K_F

  • Member
  • *****
  • Posts: 1609
  • Anybody out there?
Re: Redundancy ?
« Reply #1 on: November 29, 2019, 07:16:44 AM »
No link...no proof  ;) ;)
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

Vortex

  • Member
  • *****
  • Posts: 2339
Re: Redundancy ?
« Reply #2 on: November 29, 2019, 07:53:08 AM »
Hi Hutch,

You can easily load the JPG images from memory using the OLE image functions.

jj2007

  • Member
  • *****
  • Posts: 10557
  • Assembler is fun ;-)
    • MasmBasic
Re: Redundancy ?
« Reply #3 on: November 29, 2019, 08:23:41 AM »
ShlWapi:SHCreateMemStream plus GdipCreateBitmapFromStream are also quite handy. Read the "Prior to Windows Vista" remark carefully.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7553
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Redundancy ?
« Reply #4 on: November 29, 2019, 10:23:06 AM »
I have the test pieces working, the last one loads a PNG image for both up and down buttons and it works OK and drops the size of the resources. What is taking time is the difference in the art work, you make a background tile for the two images, then position the up and down images on the two tiles and save them as PNG files. The load and run code is reasonably straight forward once you have the images working correctly. I did the first one using BMP images and the size as you would expect was enormous, JPG files dropped the size but did not work well with my image editor where the PNG files with the alpha channel are doing the task well and they look correct.

So far you can make toolbars with them and free standing buttons for more specialised tasks. The code for the button is finished and reliable, when I get a bit better at the art work I will post an example, the button code will be put into a library module.

Also thanks for the reference material, this code uses a STATIC control window and the STM_SETIMAGE message to switch the bitmaps and it worked on Win9x but some these later techniques will be handy for future tasks.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

AW

  • Member
  • *****
  • Posts: 2583
  • Let's Make ASM Great Again!
Re: Redundancy ?
« Reply #5 on: November 30, 2019, 02:33:13 AM »
A common approach is a glyph with 4 images next to each other.
Up, Disabled, Clicked, Down
Delphi has some categories of buttons ready to accept such glyphs. Of course, MASM provides the reinventing the wheel fun.  :biggrin: