diff options
| -rw-r--r-- | FL/Fl_Image.H | 9 | ||||
| -rw-r--r-- | FL/Fl_Shared_Image.H | 2 | ||||
| -rw-r--r-- | src/Fl_Shared_Image.cxx | 11 |
3 files changed, 13 insertions, 9 deletions
diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H index 1f1ed16bb..6890a9356 100644 --- a/FL/Fl_Image.H +++ b/FL/Fl_Image.H @@ -149,10 +149,13 @@ class FL_EXPORT Fl_Image { virtual void label(Fl_Menu_Item*m); /** Draws the image with a bounding box. - This form specifies + Arguments <tt>X,Y,W,H</tt> specify a bounding box for the image, with the origin - (upper-lefthand corner) of the image offset by the cx - and cy arguments. + (upper-left corner) of the image offset by the \c cx + and \c cy arguments.\n + In other words: <tt>fl_push_clip(X,Y,W,H)</tt> is applied, + the image is drawn with its upper-left corner at <tt>X-cx,Y-cy</tt> and its own width and height, + <tt>fl_pop_clip</tt><tt>()</tt> is applied. */ virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); // platform dependent /** diff --git a/FL/Fl_Shared_Image.H b/FL/Fl_Shared_Image.H index 5f96f7f2d..09bd636b2 100644 --- a/FL/Fl_Shared_Image.H +++ b/FL/Fl_Shared_Image.H @@ -31,7 +31,7 @@ typedef Fl_Image *(*Fl_Shared_Handler)(const char *name, uchar *header, // Shared images class. /** - This class supports caching, loading, + This class supports caching, loading, scaling, and drawing of image files. Most applications will also want to link against the fltk_images library and call the fl_register_images() diff --git a/src/Fl_Shared_Image.cxx b/src/Fl_Shared_Image.cxx index 16181e9a8..13a0eb5bc 100644 --- a/src/Fl_Shared_Image.cxx +++ b/src/Fl_Shared_Image.cxx @@ -365,10 +365,11 @@ void Fl_Shared_Image::draw(int X, int Y, int W, int H, int cx, int cy) { /** Sets the drawing size of the shared image. This function gives the shared image its own size, independently from the size of the original image - that is typically larger than the shared image. + that is typically larger. This can be useful to draw a shared image on a drawing surface whose resolution is higher - than the drawing unit for this surface. Examples of such drawing surfaces: laser printers, - PostScript files, PDF printers, retina displays on Apple hardware. + than the drawing unit for this surface: all pixels of the original image become available to fill + an area of the drawing surface sized at <tt>width,height</tt>. + Examples of such drawing surfaces: laser printers, PostScript files, PDF printers, retina displays on Apple hardware. \param width,height maximum width and height (in drawing units) to use when drawing the shared image \param proportional if not null, keep the width and height of the shared image proportional to those of its original image @@ -380,9 +381,9 @@ void Fl_Shared_Image::draw(int X, int Y, int W, int H, int cx, int cy) { \code Fl_Box *b = ... // a box Fl_Shared_Image *shared = Fl_Shared_Image::get("/path/to/picture.jpeg"); // read a picture file + shared->scale(b->w(), b->h(), 1); // set the drawing size of the shared image to the size of the box b->image(shared); // use the shared image as the box image b->align(FL_ALIGN_INSIDE | FL_ALIGN_CENTER | FL_ALIGN_CLIP); // the image is to be drawn centered in the box - shared->scale(b->w(), b->h(), 1); // set the drawing size of the shared image to the size of the box \endcode */ void Fl_Shared_Image::scale(int width, int height, int proportional, int can_expand) @@ -453,7 +454,7 @@ Fl_Shared_Image* Fl_Shared_Image::find(const char *n, int W, int H) { \brief Find or load an image that can be shared by multiple widgets. Gets a shared image, if it exists already ; it will return it. - If it does not exist or if it exist but with other size, + If it does not exist or if it exists but with other size, then the existing image is deleted and replaced by a new image from the n filename of the proper dimension. If n is not a valid image filename, then get() will return NULL. |
