Posted: Wed Jul 24, 2002 8:01 am
Restored from previous forum. Originally posted by Danilo.
This procedure loads many different image formats
by using the free NVIEWLIB.DLL available here:
http://www.programmersheaven.com/file.asp?FileID=2045
The NVIEWLIB.DLL must be in the same directory
like your created .exe file or in the windows-path.
At development time, the .DLL must also be in the
directory \PureBasic\Compilers\ (for compiling with F5) !!
Thanks for the hint go to halo.
Have fun...
...Danilo
(registered PureBasic user)
This procedure loads many different image formats
by using the free NVIEWLIB.DLL available here:
http://www.programmersheaven.com/file.asp?FileID=2045
Code: Select all
Procedure LoadNViewImage(ImageNumber,FileName$)
;
; Load JPG, JIF, GIF, BMP, DIB, RLE, TGA and PCX images with PB and NViewLib.DLL
; NViewLib 1.1.4 is free: [url]http://www.programmersheaven.com/file.asp?FileID=2045[/url]
;
;
; SYNTAX
; ImageHandle = LoadNViewImage(#Image, FileName$)
;
; DESCRIPTION
; Load the specified image.
; The image format can be a JPG, JIF, GIF, BMP, DIB, RLE, TGA or PCX file.
; If the function fails, 0 is returned, Else all is fine.
; This command requires the NVIEWLIB.DLL in the Path.
;
If OpenLibrary(0,"nviewlib.dll")
AddrImage = CallFunction(0,"NViewLibLoad",FileName$,0)
Width = CallFunction(0,"GetWidth"))
Height = CallFunction(0,"GetHeight"))
newImage = CreateImage(ImageNumber,Width,Height)
StartDrawing(ImageOutput())
DrawImage(AddrImage,0,0)
StopDrawing()
DeleteObject_(AddrImage)
CloseLibrary(0)
Else
MessageRequester("ERROR","Cant find NVIEWLIB.DLL in Path",0):End
EndIf
ProcedureReturn newImage
EndProcedure
File$ = OpenFileRequester("Load Image", "", "All supported images | *.jpg;*.jpeg;*.jif;*.gif;*.bmp;*.dib;*.rle;*.tga;*.pcx | All files *.* | *.*", 0)
If File$ ""
If LoadNViewImage(1,File$)
OpenWindow(0,200,200,ImageWidth(),ImageHeight(),#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget,"PB Image Viewer")
SetForeGroundWindow_(WindowID())
Repeat
event=WaitWindowEvent()
If event=#WM_PAINT
StartDrawing(WindowOutput())
DrawImage(ImageID(),0,0)
StopDrawing()
EndIf
Until event=#PB_EventCloseWindow
EndIf
EndIf
End
like your created .exe file or in the windows-path.
At development time, the .DLL must also be in the
directory \PureBasic\Compilers\ (for compiling with F5) !!
Thanks for the hint go to halo.
Have fun...
...Danilo
(registered PureBasic user)