| [ Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]
STR #3185
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Image Support |
Summary: | add Fl_Image::draw_scaled(X,Y,W,H) to print high resolution images |
Version: | 1.3-feature |
Created By: | manolo |
Assigned To: | manolo |
Fix Version: | 1.3.4 (SVN: v10615) |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | manolo 23:19 Feb 07, 2015 |
| Roman remarked that FLTK doesn't allow to print high resolution images. I propose to add a new member function to the Fl_Image class Fl_Image::draw_scaled(x, y, w, h) which draws the image in the current drawing surface scaling it to the x,y,w,h rectangle. This effectively allows to send to the drawing surface all the pixel data of a large image, so high resolution laser printers can use all that pixel information.
The attached pach does that, in an ABI-compatible way.
Run the modified pixmap_browser demo to test it, opening a large photo. If you print the photo-containing window to a PostScript printer, or to a resolution-independant file (e.g., .ps or .pdf) you'll see that the full pixel density of the photo is available. | |
|
#2 | manolo 06:58 Feb 12, 2015 |
| Attached file #2 proposes a complete solution to handling high resolution images with a new class, Fl_Scalable_Image, derived from Fl_Image, which, therefore, integrates seamlessly with FLTK.
Doxygen description of this class:
The Fl_Scalable_Image class can re-scale a source image when drawing it. An Fl_Scalable_Image can be useful to draw an 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. The Fl_Scalable_Image class allows to draw within a rectangle of the drawing surface a source image that has its own size, independently from the rectangle size. The source image is typically larger than the drawing rectangle, so its pixels can 'fill' high resolution drawing surfaces. Example code: use an Fl_Scalable_Image as the background image of a box. \code Fl_Shared_Image *source = ...; // the source image. Fl_Box *box = ...; // a box // create the scalable image from the source image, give it the size // of the box and keep it proportionally scaled Fl_Scalable_Image *scalable = new Fl_Scalable_Image(source, box->w(), box->h(), 1); box->image(scalable); // make the scalable image the box's image \endcode | |
|
#3 | manolo 10:16 Feb 15, 2015 |
| Attached patch #3 improves memory handling by the new Fl_Scalable_Image class. Attached files #1 and #2 are deprecated by #3. | |
|
#4 | manolo 06:15 Feb 23, 2015 |
| Attached file #4 is a new implementation of scaled image drawing, that does not involve a new class. Instead, it adds a new member function Fl_Shared_Image::scale(int width, int height) that sets the drawing size of the shared image which becomes deconnected from the size of the underlying image. Function Fl_Shared_Image::draw() uses the drawing size of the shared image, that may differ from that of the underlying image if Fl_Shared_Image::scale() was used.
All previous patches are deprecated by the new one. | |
|
#5 | manolo 08:37 Feb 24, 2015 |
| Attached patch #5 modifies #4 as follows:
1) the new functionality requires FLTK_ABI_VERSION=10304, so the implementation is not ABI compatible but entirely source-compatible with current software.
2) function Fl_Graphics_Driver::draw_scaled(Fl_RGB_Image*,...) returns 0 to indicate the implementation is missing. | |
|
#6 | manolo 14:11 Mar 10, 2015 |
| Fixed in Subversion repository.
A new member function was added Fl_Shared_Image::scale(width, height). | |
[ Return to Bugs & Features ]
|
| |