Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mwuahahahahaha...
#1
Sometimes, other BASICs can provide useful stuff. Case in point, this JPEG library that is used often in LibertyBasic:

http://www.nodtveidt.net/fb/jpegdll.zip

Wow, what an utterly crappy language LibertyBasic is. :barf: Talk about code obfuscation...Anyways, this isn't hard to use. Basically, you have a UInteger handle that will be a handle to the image when loaded, and you pass the hwnd of the window making the call (it works this way but I'm not 110% sure that that's how it's designed to work...but it works anyways). LoadImageFile will return the handle to the image. In your WM_PAINT, you want a Compatible DC (CreateCompatibleDC) and use SelectObject on the image handle you got earlier. Then, just BitBlt the image and use DeleteObject on the DC after you call EndPaint. The WM_PAINT code I tested this with looks like this:
Code:
hdc = BeginPaint(imghwnd,pnt)
              hsrcdc = CreateCompatibleDC(hDC)
              SelectObject(hsrcdc, jpegimg)
              BitBlt(hDC, 0, 0, 320, 240, hsrcdc, 0, 0, SRCCOPY)
            EndPaint hWnd, pnt
            DeleteObject(hsrcdc)
            UpdateWindow hWnd
whereas jpegimg is the handle that was returned by LoadImageFile.

I hope this is of use to someone...it sure was of use to me. Big Grin Also, this can load more than JPEGs...according to some online docs, it is supposed to be able to handle jpg, bmp, gif, ico, wmf and emf formats. From my tests, it loads JPEG images exceptionally fast, so it's useful for loading many images into many objects in sequence. This looks like it has solved the image nightmares that would have plagued the GUI Compiler...and in the meantime, has actually extended its capabilities. Big Grin
I'd knock on wood, but my desk is particle board.
Reply
#2
And now it's the turn of the Windows programming newbie (i.e. me) to ask something: can it be used with lillo's gfx lib? If so, how?
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
I have no idea but I doubt it...
I'd knock on wood, but my desk is particle board.
Reply
#4
Then I guess I'll port Antoni's... once again Big Grin
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#5
Angelo has a JPEG lib for Allegro on his website...
I'd knock on wood, but my desk is particle board.
Reply
#6
Sure, but I need Allegro first Wink

v. 0.11b : the most awaited... for me Big Grin
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)