News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

New image library

Started by raymond, March 21, 2006, 04:17:08 AM

Previous topic - Next topic

raymond

Bit depth for JPG is 8 bits max. YUVs are computed from RGBs, the max Y being 0FFh. When computing the DCT, the max positive value for Y becomes 7Fh and the maximum DC which can result is 8*7Fh=3F8h. Dwords are thus sufficient.

Raymond


When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Vortex

Hi Raymond,

Have the load from memory version of your image functions?

raymond

Quote from: Vortex on July 12, 2006, 08:35:03 PM
Hi Raymond,

Have the load from memory version of your image functions?

Do you mean AFTER loading an image file from external storage to memory?? If so, why would you have loaded it in the first place?

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Vortex

Hi Raymond,

You can always embed your images into your executable with the help of tools like Hutch's fda.exe
( or put them in the resource section ) This is why I asked about the load from memory versions.

raymond

Thanks Vortex. I'll take that into consideration when I eventually get back into that project.

Personally, I would not embed image files into an executable, neither directly nor along with resources.

Raymond

When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Vortex

Hi Raymond,

I understand your point of view. Sometimes, embedding small sized images into an executable can be a usefull method. Thanks for your consideration.

taianmonkey

Is Wrote by this?
_Monkeycd_Jpg_Paint_Proc  proc  hWndDC:DWORD , hDI:DIBINFO
    LOCAL @hOld:DWORD
    LOCAL @memDC :DWORD

    invoke CreateCompatibleDC , hWndDC
    mov @memDC, eax   
   
   .if hDI != 0
        mov    eax,hDI
        mov    ebx,eax
        invoke SelectObject , @memDC , [eax].DIBINFO.hDIB
        mov    @hOld , eax
        mov    eax,ebx
        mov    ecx,[eax].DIBINFO.bmih.bmiHeader.biWidth
        mov    edx,[eax].DIBINFO.bmih.bmiHeader.biHeight
        test   edx,edx
        jns    @F
        neg    edx
    @@:
        invoke BitBlt,hWndDC,0,0,ecx,edx,@memDC,0,0,SRCCOPY   
        invoke SelectObject,hWndDC,@hOld
        invoke DeleteDC,@memDC
   .endif
    ret
_Monkeycd_Jpg_Paint_Proc  endp

raymond

I have to assume that you would already have called the loadJPG function from the library. The function creates a global variable having the DIBINFO struc format as given in the .inc file, and returns the ADDRESS of that global variable.

Quote_Monkeycd_Jpg_Paint_ProcĀ  procĀ  hWndDC:DWORD , hDI:DIBINFO

You should thus be passing the address of that global variable to your proc, such that hDI should only be a DWORD in the above description of parameters. In addition,
SelectObject,hWndDC,@hOld should be SelectObject,@memDC,@hOld

Apart from that, the remainder of your code looks OK to display the image.

Don't forget to delete the hDIB object once you are finished with it

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

caraveiro

Hi Raymond!


It's any chance to include a LoadJPGFromMemory function?

You see, often I need to show a JPG's file projected/loaded into Memory buffer, and it will be easier than figthing with .tmp files.


Thank you in advance!
"knowledge is now free at last, everything should be free from now on, enjoy knowledge and life and work for everybody else"
+ORC
http://www.fravia.com

raymond

Quote from: caraveiro on October 14, 2008, 04:23:27 PMIt's any chance to include a LoadJPGFromMemory function?

You probably got the original version of the library. It was expanded last summer at the request of others to include loading JPEG (and GIF files) from memory. You can download the latest version from this thread:

http://www.masm32.com/board/index.php?topic=9538.0

Be sure to read the thread to understand the required parameters of the newer functions. They are not yet covered in the HELP file.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

caraveiro

Wow!... Last version will do!

Thank you very much!
"knowledge is now free at last, everything should be free from now on, enjoy knowledge and life and work for everybody else"
+ORC
http://www.fravia.com