flat assembler
Message board for the users of flat assembler.
Index
> Windows > download a gif from internet and show it in window Goto page 1, 2 Next |
Author |
|
sina 27 Dec 2004, 17:51
ok i am gonna retrieve a gif file by using the method
inskipp has told here http://board.flatassembler.net/topic.php?t=1434 and i will have the gif file in the buffer now to show the gif on my window; in the giflib by exagone which is ported to fasm by JohnFound there r 2 stdcalls GIFLoadResource GIFLoadFile as it is not in the resource and i dont think putting it in res is wise, if it can be so i will use GIFLoadFile now should i first save the buffer to a file and then open it and use GIFLoadFile, or there is a shortcut to do it with the buffer? anyway i wanted to ask this before coding ps: i also appreciate helps on puttin the buffer to a file |
|||
27 Dec 2004, 17:51 |
|
JohnFound 27 Dec 2004, 18:23
Actually GIFLoadResource and GIFLoadFile shold not be called directly. They only load gif image from resource/file into the memory and set internal TGifFile structure fields.
In giflib.asm you should check the procedure "DoLoadGif" this is the only procedure that creates DIB bitmap from GIF image. It uses as first call GIFLoadResource, but you can modify it to use GIFLoadFile, or even to skip this stage and to fill TGifImage fields with appropriate pointers to memory image. (check .lpGIFData field). After loading of compressed image, there are several stages to be called in order to uncompess the image and to create DIB bitmap. This all is on prima vista, because I wrote this port some time ago and probably I forgot some details. Regards. |
|||
27 Dec 2004, 18:23 |
|
sina 27 Dec 2004, 20:13
thx johnfound i will try to do it
lets see |
|||
27 Dec 2004, 20:13 |
|
sina 27 Dec 2004, 22:38
err johnfound, i have downloaded an old one of giflib i think becouse i did not have doloadgif and now i have downloaded the latest fresh and using the ones inside it with doloadgif, i think they r the most uptodate ones
|
|||
27 Dec 2004, 22:38 |
|
sina 27 Dec 2004, 23:00
err hi again johnfound,and others if anyone watching this thread
so look at my modification to the doloadgif pls Code: ;proc DoLoadGif, .hInst, .ptrName, .ptrGifInfo proc DoLoadGif, .ptrFile, .ptrGifInfo .bitmapinfo BITMAPINFOHEADER .result dd ? begin push esi edi mov [.result], 0 mov edi, [.ptrGifInfo] lea esi, [.bitmapinfo] ; stdcall GIFLoadResource, edi, [.hInst], [.ptrName] stdcall GIFLoadFile, edi, [.ptrFile] jz .quit stdcall GIFLoadHeader, edi jz .quit stdcall GIFInitalizeDecoder, edi jz .quit stdcall GIFFillBitmapInfoStruct, edi, esi lea eax, [edi+TGifInfo.lpImageData] invoke CreateDIBSection, NULL, esi, DIB_RGB_COLORS, eax, NULL, NULL test eax, eax jz .quit mov [.result], eax stdcall GIFDecompress, edi jz .quit stdcall GIFCleanup, edi .quit: mov eax, [.result] pop edi esi return endp after using .ptrFile i should clean it up right? and how? Code: push esi mov esi, [.ptrFile] invoke GetProcessHeap invoke HeapFree, eax, 0, [esi+something] pop esi return am i going near? and after these can u show me the way for showing the dib image on the window, i have an example u have wrriten with the old giflib.asm i told u, v1.1 using ImageList_LoadGif, but that did not give me ideas |
|||
27 Dec 2004, 23:00 |
|
JohnFound 27 Dec 2004, 23:21
VeSCeRa wrote: after using .ptrFile i should clean it up right? and how? Hm, GIFLoadFile allocates one memory buffer to store the compressed .gif image as it was in the file. After the decompression, you don't need this buffer and you have to free it with HeapFree, somewhere at the end of DoLoadGif. Something like: Code: mov esi, [.lpGifInfo] invoke GetProcessHeap invoke HeapFree, eax, 0, [esi+TGifInfo.lpGIFData] [.ptrFile] is simply a string. You have to deal with it only if you dynamically allocated its buffer from the heap. Quote: and after these can u show me the way for showing the dib image on the window, i have an example u have wrriten with the old giflib.asm i told u, v1.1 using ImageList_LoadGif, but that did not give me ideas Well, you can use the handle to the DIB like every other bitmap. You can assign it to STATIC control (with SS_BITMAP style set) with STM_SETIMAGE message, also, you can create compatible DC and draw it to another (screen) DC using BitBlt, StretchBlt, etc. etc. P.S. Why not to modify DoLoadGif to load resource is [.hInst] <> -1 and to load a file is [.hInst] = -1 (or to introduce new argument .fLoadFromFile)? Regards |
|||
27 Dec 2004, 23:21 |
|
sina 28 Dec 2004, 10:09
hmm first johnfound i like u becouse u r wise and u always have quick replies thx for that
and second excuse me but i could not understand what u mean here; Quote:
is my modification useless? ps: i must go to university now , i wish Thomasz would port fasm to symbian phones then i would try on my ngage phone |
|||
28 Dec 2004, 10:09 |
|
JohnFound 28 Dec 2004, 10:18
VeSCeRa wrote: is my modification useless? No at all. I simply though to use one DoLoadGif procedure for both resources and files depending on input arguments. And there is mistake in my post - read "is" as "if". johnfound wrote:
Regards |
|||
28 Dec 2004, 10:18 |
|
sina 28 Dec 2004, 19:02
hmm what about this
please check this Code: proc DoLoadGif, .hInst, .ptrName, .ptrGifInfo .bitmapinfo BITMAPINFOHEADER .result dd ? begin push esi edi mov [.result], 0 mov edi, [.ptrGifInfo] lea esi, [.bitmapinfo] cmp [.hInst], -1 je @f stdcall GIFLoadResource, edi, [.hInst], [.ptrName] jz .quit jmp .gifloadheader @@: stdcall GIFLoadFile, edi, [.ptrName] jz .quit .gifloadheader: stdcall GIFLoadHeader, edi jz .quit stdcall GIFInitalizeDecoder, edi jz .quit stdcall GIFFillBitmapInfoStruct, edi, esi lea eax, [edi+TGifInfo.lpImageData] invoke CreateDIBSection, NULL, esi, DIB_RGB_COLORS, eax, NULL, NULL test eax, eax jz .quit mov [.result], eax stdcall GIFDecompress, edi jz .quit stdcall GIFCleanup, edi .quit: mov eax, [.result] pop edi esi return endp |
|||
28 Dec 2004, 19:02 |
|
JohnFound 28 Dec 2004, 20:03
VeSCeRa wrote: hmm what about this Yes, that was exactly what I meant. I have no time to test it actually, but it seems OK. Please provide some feedback, when you make it work. I will include it in giflib. Regards. |
|||
28 Dec 2004, 20:03 |
|
sina 28 Dec 2004, 23:45
now i had removed some hair from my head!
ok i needed to modify giflib.asm and giflib.inc a bit more to get rid of syntax errors but the Loadgif procedure, or if i call it from Doloadgif it does not matter crashes and i could not find out what is wrong my code is messy i know but i can only code in midnights becouse of the lack of time, if i can get rid of this gif to dib issue i will clean it but first i want to have that gif file on my static now it downloads 4 gif files, the messageboxes try to show the buffer of gif files and then they r saved to c:\temp?.gif and when i try to open first one it crashes on Loadgif
|
|||||||||||
28 Dec 2004, 23:45 |
|
JohnFound 29 Dec 2004, 00:26
VeSCeRa wrote: now i had removed some hair from my head! Right approach. Now I see. You MUST use Fresh "StrCallEx.inc" library with "giflib.asm" or entirely rewrite it to use FASM standard for procedures. Simply commenting "begin" statements wouldn't help... Regards |
|||
29 Dec 2004, 00:26 |
|
sina 29 Dec 2004, 17:27
i dont think that is the only one to include
can u tell me what other files to include from frash libs when i try to compile it says purge errendp#open@proc extra chars in bla bla in stdcallex.inc |
|||
29 Dec 2004, 17:27 |
|
JohnFound 29 Dec 2004, 19:48
At least, if you really want to use FASM includes, you have not to include the file "stdcall.inc" from the FASM include library, but to use "StdCallEx.inc" from the Fresh package. Then you have to use following procedure schema for your own application as well:
Code: proc someproc, arg, arg, ... ;local variables declarations begin ; code of the procedure return ; there can be more than one. endp You must not include both "stdcall.inc" and "StdCallEx.inc" at the same source. With these macroses, giflib.asm should be compiled normally. (only don't forget to restore "begin" statements you commented, or better restore whole file from the archive.) Regards |
|||
29 Dec 2004, 19:48 |
|
sina 29 Dec 2004, 20:13
hmm these r my includes
include 'stdcallex.inc' include 'struct.inc' include 'giflib.inc' include '%fasminc%\win32ax.inc' how can i not include stdcall.inc |
|||
29 Dec 2004, 20:13 |
|
JohnFound 29 Dec 2004, 21:05
VeSCeRa wrote: hmm these r my includes Well, you have to remove it from '%fasminc%\win32ax.inc'. Or you can use only Fresh libraries: Try "File|New application" and then choose "Win32 SDI tiny application". Regards. P.S. Only use the latest work release of Fresh. |
|||
29 Dec 2004, 21:05 |
|
sina 29 Dec 2004, 21:05
err i have replaced all fasm includes with fresh ones but still i got errors
i think it is better to port giflib to fasm includes version but i think i am losing power and concentration here |
|||
29 Dec 2004, 21:05 |
|
JohnFound 29 Dec 2004, 21:14
VeSCeRa wrote: err i have replaced all fasm includes with fresh ones but still i got errors OK, post your latest version here (or sent it to my email) and I will try to fix it. If you replaced StdCall.inc there should be only some minor problems. Regards. |
|||
29 Dec 2004, 21:14 |
|
sina 30 Dec 2004, 15:58
yes the problem is in my dialogproc
Code: proc DialogProc, hwnddlg, msg, wparam, lparam begin push ebx esi edi mov eax, [msg] cmp eax,WM_COMMAND je wmcommand cmp eax,WM_DESTROY je wmdestroy xor eax,eax jmp finish it says ERROR! the argument 'hwnddlg' MUST begins with dot then when i add dots to the arguments it says if .__info.frame undefined symbol at begin |
|||
30 Dec 2004, 15:58 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.