summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2022-03-30 15:56:27 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2022-03-30 15:56:27 +0200
commita638f5a545817365897bc7892999b74d3ef83e34 (patch)
tree5084a9ee6428199b351e403d57fd883612b815e8
parentdf4503ea2ce2fd8727cf77f7d8d071897bb13445 (diff)
Add method Fl_Shared_Image::image()
This public method returns a pointer to the internal Fl_Image object (const Fl_Image *). This is only for reference, the internal image must not be modified by user code but it can be inspected and copied to another image.
-rw-r--r--FL/Fl_Shared_Image.H26
1 files changed, 25 insertions, 1 deletions
diff --git a/FL/Fl_Shared_Image.H b/FL/Fl_Shared_Image.H
index 9fdf33ebb..d109014e5 100644
--- a/FL/Fl_Shared_Image.H
+++ b/FL/Fl_Shared_Image.H
@@ -160,7 +160,31 @@ public:
static int num_images();
static void add_handler(Fl_Shared_Handler f);
static void remove_handler(Fl_Shared_Handler f);
-};
+
+ /**
+ Returns a pointer to the internal Fl_Image object.
+
+ The output is a pointer to the \p internal image ('Fl_Image' or subclass)
+ which can be used to inspect or copy the image.
+
+ <b>Do not try to modify the image!</b> You can copy the image though
+ if you want or need to change any attributes, size etc. If all you
+ need to do is to resize the image you should use
+ Fl_Shared_Image::copy(int, int) instead.
+
+ \note The internal image (pointer) is protected for good reasons, e.g.
+ to prevent access to the image so it can't be modified by user code.
+ \b DO \b NOT cast away the 'const' to modify the image.
+
+ User code should rarely need this method. Use with caution.
+
+ \return const Fl_Image* image, the internal Fl_Image
+
+ \since 1.4.0
+ */
+ const Fl_Image *image() const { return image_; }
+
+}; // class Fl_Shared_Image
//
// The following function is provided in the fltk_images library and