UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: binarycrush on November 02, 2008, 05:56:06 PM

Title: PhotoX Source
Post by: binarycrush on November 02, 2008, 05:56:06 PM
Hi,
   The full source for my PhotoViewer is now available. You will need to create the .exe yourself to use it. Please read the license agreement also. Please do NOT distribute the .exe file that you compile.


See PhotoX.zip 1.76M (http://www.playbasic.com/sourcecodes.php?page=0&Order=1&Category=All&Author=BinaryCrush)

Enjoy!
Sean.
Title: Re: PhotoView Source
Post by: kevin on November 05, 2008, 07:58:23 AM

  It's a nice program, but there's a few bits of code that you don't really need. Anyway, when loading the thumbs rather than loading the picture to VIDEO memory then scaling it and copying the video buffer to the FX buffer.  A better approach would be to load the picture as FX buffer.  This saves thrash the video memory..



`Get Thumbnail images (this is slow so it is done inside the main loop to avoid huge stall at startup)
If ThumbCount<=PhotoCount
img=FreeImage_LoadImage(Photo(ThumbCount).file$,1) ; load as FXimage
ScaleImage img,thumbwidth,thumbheight,1+4  ;(set bilinear filter)
RenderToImage 4
; LockBuffer
DrawImage img,nx,3,0
; UnLockBuffer
nx=nx+(thumbwidth + 20)
DeleteImage img
Inc ThumbCount
RenderToScreen
EndIf


Also when casting, you don't need to cast all of the terms for division.  To get an float result,  if one term is a float and you divide, then the runtime will auto cast both terms as floats and use a floating point divide for you.
Title: Re: PhotoView Source
Post by: binarycrush on November 05, 2008, 07:34:11 PM
 Thanks for the tips Kevin!
I should have caught that i was loading to video memory, duh.

I also thought of a few notes to add...



I am sure the code can be cleaned up more, remember i had a deadline to meet ;)
I will upload a new version soon!

Sean
Title: Re: PhotoX Source
Post by: feildmaster on March 21, 2011, 04:26:25 PM
aww... i was hoping to get this after looking in the hall of fame and then the sites down. :(oh well.
Title: Re: PhotoX Source
Post by: kevin on March 22, 2011, 03:31:35 PM

See here (http://www.playbasic.com/sourcecodes.php?page=0&Order=1&Category=All&Author=BinaryCrush)
Title: Re: PhotoX Source
Post by: feildmaster on March 22, 2011, 03:55:19 PM
Oh, thank you. ^^