summaryrefslogtreecommitdiff
path: root/src/Fl_JPEG_Image.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2011-01-24 17:04:22 +0000
committerMatthias Melcher <fltk@matthiasm.com>2011-01-24 17:04:22 +0000
commitfe25f19767f1cd2393c4d1796fb42d5aa82b194c (patch)
tree229437962da4fa67acf27bf171d6124f5631c34e /src/Fl_JPEG_Image.cxx
parentf9363c16d0e6518ba82d05f1f7f415e9224a8e35 (diff)
Adding embedded documentation to Fluid if installed odcs are not found. Falls back to the internet if that does not exist either. Also, adds JPEG and PNG images to the Shared Image list if they were loaded from memory - see example use in fluid.cxx which loads and embedded html document containing an embedded PNG image.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8306 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_JPEG_Image.cxx')
-rw-r--r--src/Fl_JPEG_Image.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Fl_JPEG_Image.cxx b/src/Fl_JPEG_Image.cxx
index fa93cf441..330618013 100644
--- a/src/Fl_JPEG_Image.cxx
+++ b/src/Fl_JPEG_Image.cxx
@@ -35,6 +35,7 @@
//
#include <FL/Fl_JPEG_Image.H>
+#include <FL/Fl_Shared_Image.H>
#include <FL/fl_utf8.h>
#include <config.h>
#include <stdio.h>
@@ -268,14 +269,18 @@ static void jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *data)
/**
\brief The constructor loads the JPEG image from memory.
+ Construct an image from a block of memory inside the application. Fluid offers
+ "binary Data" chunks as a great way to add image data into the C++ source code.
+ name_png can be NULL. If a name is givem the image is added to the the list of
+ shared images (see: Fl_Shared_Image) and will be available by that name.
+
The inherited destructor frees all memory and server resources that are used
by the image.
There is no error function in this class. If the image has loaded correctly,
w(), h(), and d() should return values greater zero.
- \param name The developer should provide a unique name for this image.
- Note: currently this is not used!
+ \param name A unique name or NULL
\param data A pointer to the memory location of the JPEG image
*/
Fl_JPEG_Image::Fl_JPEG_Image(const char *name, const unsigned char *data)
@@ -363,6 +368,11 @@ Fl_JPEG_Image::Fl_JPEG_Image(const char *name, const unsigned char *data)
free(max_destroy_decompress_err);
free(max_finish_decompress_err);
+
+ if (w() && h() && name) {
+ Fl_Shared_Image *si = new Fl_Shared_Image(name, this);
+ si->add();
+ }
#endif // HAVE_LIBJPEG
}