Sample Code- Image Viewer


#1

I have uploaded a REALLY simple image viewer that I wrote as a first JUCE “etude”.
Don’t hold your breath! :lol:
I am only putting it here only for the slight chance it might save you time on your next project.

There’s a screenshot inside, so if you can’t compile it, at least you can see what it can look like.

http://subminimal.org/juce/index.php?act=view&file=U2ltcGxlSW1hZ2VWaWV3ZXItMDAxLXdhbS56aXA=

See main.cpp for all sorts of caveats

I have no intention to develop this further, but comments are welcome.


#2

Thanks, look nice!

Few comments:

  • You should imclude juce with #include <juce.h> instead of a relative path, and tell your compiler where juce is…
  • there are few warnings about some conversion
  • I tried to look at my picture folder and got an exception here

void ImageCache::addImageToCache (Image* const image,
const int hashCode)
{
jassert (image != 0);
}

maybe you patched the juce source (from your other post) and we don’t have this patch?


#3

Thanks for the comments!

  • You can ignore the warnings, or you can just type cast the ints to floats in drawLine

  • As for not showing pictures… Are these are jpegs coming from a digital camera? If so, you may want to look in here for a problem and its fix.
    http://www.adbe.org/juceforum/viewtopic.php?t=123

Let me know


#4

If I apply the patch to juce jpeg code then it works…

One more comment, why don’t you use DialogWindow for the main window so it will be moveable, etc.?

thanks


#5