Working with this library I found some bug : you can not open a picture more than 12 times with function BitmapFromMemory (on 13 time will be an error )

So does anybody know other library where i can open the JPEG from memory

I'am making a Web Browser, and i don't want to save the picture to disk

Thank's
Posted on 2003-05-11 02:44:12 by Anorak
What error are you getting ? Are you using the imagelib version that comes in MASM32 v8. I've never had this problem.

whoops didn't notice it was BitmapfromMemory you were using. I haven't tried that one.
Posted on 2003-05-11 03:04:19 by donkey
The error is ocurring when the function BitmapFromMemory is operating with memory (illegal memory operation)

I'am using ImageLib from library that comes in MASM32 v8

Do you know some other libraries that allows to convert JPEG to Bitmap in memory?
Posted on 2003-05-11 03:13:48 by Anorak
Intel JPEG Library.
Posted on 2003-05-11 08:08:55 by comrade
can you give me some examples or code?
Posted on 2003-05-16 13:03:47 by Anorak
This one use Intel JPEG Library for saving only. There is IJG demo on Iczelion's website.
Posted on 2003-05-16 15:22:48 by comrade
Thank's but i have an picture in memory and i need to view it (in picture control)
The imagelib have some bugs, so i need to know how to do it with intel jpeg library
(?? ?????? : ??? ???? ???????? ???????? ? JPEG'?, ??????? ? ??????, ????? ?? ????????? ? ???? (?? ????????))
Thank's
?????
Posted on 2003-05-17 12:39:59 by Anorak
?????:
.data?

bmi BITMAPINFO <>
ps PAINTSTRUCT <>

.code
ijlOpenJPEG proc pszFileName:DWORD
invoke RtlZeroMemory, ADDR bmi, sizeof bmi
invoke RtlZeroMemory, ADDR jcp, sizeof jcp
invoke ijlInit, ADDR jcp
test eax, eax
jnz ijl_err
m2m [jcp.JPGFile], [pszFileName]
invoke ijlRead, ADDR jcp, IJL_JFILE_READPARAMS
test eax, eax
jnz ijl_err
.if jcp.JPGChannels==1
mov [jcp.JPGColor], IJL_G
.elseif jcp.JPGChannels==3
mov [jcp.JPGColor], IJL_YCBCR
.else
mov [jcp.DIBColor], IJL_OTHER
mov [jcp.JPGColor], IJL_OTHER
.endif
mov [bmi.bmiHeader.biSize], sizeof bmi.bmiHeader
mov [bmi.bmiHeader.biPlanes], 1
mov [bmi.bmiHeader.biBitCount], 24
mov [bmi.bmiHeader.biCompression], BI_RGB
mov eax, [jcp.JPGWidth]
mov [jcp.DIBWidth], eax
mov [bmi.bmiHeader.biWidth], eax
mov eax, [jcp.JPGHeight]
mov [jcp.DIBHeight], eax
mov [bmi.bmiHeader.biHeight], eax
mov [jcp.DIBChannels], 3

xor edx, edx
mov eax, [jcp.DIBWidth]
mov ecx, sizeof DWORD
div ecx
mov [jcp.DIBPadBytes], edx

xor edx, edx
mov eax, [jcp.DIBWidth]
mov ecx, [jcp.DIBChannels]
mul ecx
add eax, [jcp.DIBPadBytes]
mov ecx, [jcp.DIBHeight]
mul ecx

invoke GlobalAlloc, GMEM_MOVEABLE OR GMEM_ZEROINIT, eax
mov [hMem], eax
invoke GlobalLock, eax
mov [hImageData], eax

m2m [jcp.DIBBytes], [hImageData]
invoke ijlRead, ADDR jcp, IJL_JFILE_READWHOLEIMAGE
test eax, eax
jnz ijl_err

jmp ijldone
ijl_err:invoke ijlErrorStr, eax
invoke MessageBox, [hMainWnd], eax, ADDR szError, MB_OK OR MB_ICONHAND OR MB_APPLMODAL
ijldone:invoke ijlFree, ADDR jcp
test eax, eax
jnz ijl_err
ret
ijlOpenJPEG endp


??????? ??-???? ???? ????? ?? ?????? ?????? ? ??? ????? ?????
Posted on 2003-05-17 12:53:09 by comrade
??????? ??????? (??????? ?????? ???????)
Posted on 2003-05-17 13:05:58 by Anorak
??? ??? ? ???? ??????????, ?? ??? ?? ???????? :
Here what i got but it not work's
ijlOpenJPEG proc hBuffer:DWORD, sizebytes:DWORD
invoke RtlZeroMemory, ADDR bmi, sizeof bmi
invoke RtlZeroMemory, ADDR jcp, sizeof jcp
invoke ijlInit, ADDR jcp
test eax, eax
jnz ijl_err

mov eax, hBuffer
mov jcp.JPGBytes,eax

mov eax, sizebytes
mov jcp.JPGSizeBytes,eax

invoke ijlRead, ADDR jcp, IJL_JBUFF_READPARAMS
test eax, eax
jnz ijl_err
.if jcp.JPGChannels==1
mov , IJL_G
.elseif jcp.JPGChannels==3
mov , IJL_YCBCR
.else
mov , IJL_OTHER
mov , IJL_OTHER
.endif
mov , sizeof bmi.bmiHeader
mov , 1
mov , 24
mov , BI_RGB
mov eax,
mov , eax
mov , eax
mov eax,
mov , eax
mov , eax
mov , 3

xor edx, edx
mov eax,
mov ecx, sizeof DWORD
div ecx
mov , edx

xor edx, edx
mov eax,
mov ecx,
mul ecx
add eax,
mov ecx,
mul ecx

invoke GlobalAlloc, GMEM_MOVEABLE OR GMEM_ZEROINIT, eax
mov , eax
invoke GlobalLock, eax
mov , eax
push
pop
invoke ijlRead, ADDR jcp, IJL_JBUFF_READWHOLEIMAGE
test eax, eax
jnz ijl_err
;invoke CreateBitmap, jcp.JPGWidth, jcp.JPGHeight, 1, 24, hImageData <----i think here is creating the bitmap
mov hImage, eax
jmp ijldone
ijl_err:
invoke ijlErrorStr, eax
; invoke WriteToLog, hBuffer, dwSize
invoke MessageBox, 0, eax, eax, 0
ijldone:invoke ijlFree, ADDR jcp
test eax, eax
jnz ijl_err
ret
ijlOpenJPEG endp

????? ? ?????????
before it i use
invoke SendDlgItemMessage, hWnd, 102, STM_SETIMAGE,IMAGE_BITMAP,hImage
????? ???????? ?????? ????????
to change Picture control bitmap

where is the error?
??? ?????
Posted on 2003-05-17 14:59:00 by Anorak
????????? CreateDIBSection ??? CreateDIBitmap ? ????? CreateBitmap.


Use CreateDIBSection or CreateDIBitmap instead of CreateBitmap.
Posted on 2003-05-17 15:06:50 by comrade
???????? ? ???, ??? CreateDIBSection ??? CreateDIBitmap ??????? ?????? ??? ????????? (hdc) ? ??? ???? handle ??????? (??, ??? ?????? LoadBitmap )

the problem is in that CreateDIBSection or CreateDIBitmap are creating the bitmap for context (hdc) but i need a bitmap handle (like LoadBitmap creates)
Posted on 2003-05-18 06:28:55 by Anorak
Doe's anyone know's how?
Posted on 2003-05-21 03:00:51 by Anorak
I just need to invoke SendDlgItemMessage, hWnd, 103, STM_SETIMAGE,IMAGE_BITMAP, hBitmap

hBitmap - is that i need to get from raw bitmap

so doe's anyone know some functions or something else?
Posted on 2003-05-24 09:54:23 by Anorak
I also found that BitmapFromMemory has a bug.
There's no error in Windows Me, but when I use it in Windows 2000 or XP it has a bug.
Even if it looks like working good, when I debug the process it still has an error message.
In my case, I got an error when I loaded the image 5 times.
But the number needed to get an error message is depending on image size.
I'm also using the library carded in MASMv8.
I prefer Ernie's library to Intel library, cause Ernie's library is easier to use.
Is there any bugfixed version? Does somebody know the solution?
thanks in advance.
Posted on 2004-01-29 18:50:46 by arkanoid