Main Menu

PhotoX Source

Started by binarycrush, November 02, 2008, 05:56:06 PM

Previous topic - Next topic

binarycrush

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

Enjoy!
Sean.

kevin


  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.

binarycrush

#2
 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...


  • This was compiled using PB 1.64c
  • Be sure to use the freeimage.dll and freeimage.pba in the .zip package. This is the latest freeimage.dll which adds some functions i used. I also modified the freeimage_loadimage function to load low quality thumbnails for speed ( again should have caught to load as FX image ).
  • I placed the runtime .dll's (PB_VM.dll etc.. ) in the same folder as the .exe as this fixed path name issues i was having.


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

feildmaster

aww... i was hoping to get this after looking in the hall of fame and then the sites down. :(oh well.

kevin


feildmaster