Author Topic: Small update to deal with different image formats.  (Read 1742 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5940
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Small update to deal with different image formats.
« on: October 27, 2016, 06:11:43 PM »
With the help of a few members who are literate in image handling, I have a viable technique for loading a variety of image formats from a resource file and converting them to bitmaps so they can be easily used in normal Windows API programs. The different formats seem to have different uses, PNG with its alpha channel support is the right choice for toolbar strips, for conventional RGB image data (photos etc ...) JPG is both flexible and able to be compressed to small sizes if you are careful with the level of compression chosen, TIF seems to work OK with alpha channel images but not as small as PNG and GIF if you don't mind a loss of image quality. There may be others but I have not tested them.

The attached zip file has to have its components added into the MASM32 installation manually as I don't know a safe way to do it without risking destroying any non standard modifications that a user makes.

1. There is a library module and the main INC file for the m64lib directory.
2. There is a later version of the macros64.inc file that must go into the macros64 directory.
3. There are a collection of QE scripts in the script64 that most go into the script64 directory.
4. There is a text file in the zip root dir called "menu_addin.txt" that shows what to modify in the " Edit - Settings - Edit Menus " to make the scripts available from QE.
5. There is a working example called "jpg_image" that is buildable AFTER you put the rest above in place AND run the "makeit.bat" file.  :biggrin:

Any feedback is welcome if its well informed.

LATER : Make sure you get the "masm64rt.inc" file posted below that I forgot to put in this zip file. It goes in the include64 directory replacing the earlier version.
« Last Edit: October 28, 2016, 12:17:59 AM by hutch-- »
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

jj2007

  • Member
  • *****
  • Posts: 8889
  • Assembler is fun ;-)
    • MasmBasic
Re: Small update to deal with different image formats.
« Reply #1 on: October 27, 2016, 07:22:36 PM »
5. There is a working example called "jpg_image" that is buildable AFTER you put the rest above in place AND run the "makeit.bat" file.  :biggrin:

jpg_image.asm(17) : error A2006:undefined symbol : GdiplusStartup

After adding GdiPlus.inc, I get
Code: [Select]
POLINK: error: Unresolved external symbol '__imp_GdiplusStartup'.
POLINK: error: Unresolved external symbol 'ResImageLoad'.
POLINK: error: Unresolved external symbol '__imp_GdiplusShutdown'.

So it seems that somewhere on the road you updated masm64rt.inc and the corresponding libs
\Masm32\lib64\gdiplus.lib is 3 October 2016, and it does have GdiplusStartup and GdiplusShutdown. Same for the inc file ::)

I got it working, partially, adding this under include \masm32\include64\masm64rt.inc in jpg_image.asm:
Code: [Select]
    include \masm32\include64\GdiPlus.inc
    includelib \masm32\lib64\GdiPlus.lib
The exe is 21504 bytes, so the jpg is included, but the dialog remains empty.

Siekmanski

  • Member
  • *****
  • Posts: 1704
Re: Small update to deal with different image formats.
« Reply #2 on: October 27, 2016, 08:26:29 PM »
The executable works perfect.
Couldn't test the code. Maybe it's time for me to make the jump to Masm64 development as you guys.
Creative coders use backward thinking techniques as a strategy.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5940
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Small update to deal with different image formats.
« Reply #3 on: October 27, 2016, 11:43:06 PM »
 :biggrin:

Forgot to add MASM64RT.INC.  :P

I added the GDI+ lib and include to it.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5940
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Small update to deal with different image formats.
« Reply #4 on: October 27, 2016, 11:44:42 PM »
Marinus,

Once you get past the irritations, it seems to be an OK system, plenty of grunt and lots and lots of memory.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin: