diff options
| author | Manolo Gouy <Manolo> | 2018-03-19 17:43:18 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-03-19 17:43:18 +0000 |
| commit | 916b44e361f275555c5f22b9d91c973ccc089037 (patch) | |
| tree | a36b734804a82d3e5d4bd900bc9031b8fe60d35a /FL/Fl_SVG_Image.H | |
| parent | c4f7c09b7bacbfe19d1dcea5a28eeb30b1136a95 (diff) | |
New member function Fl_Image::scale(int width, int height) to set the FLTK size of an image.
Each image has now two sizes implemented as follows:
- the pixel size is stored in private members pixel_w_ and pixel_h_
with public accessors pixel_w() and pixel_h()
- the FLTK size is stored in private members w_ and h_ and read by w() and h()
- when the image is constructed, the two sizes have the same value
- the protected w(int) and h(int) member functions set both FLTK and pixel sizes.
- the public scale(int, int) member function is essentially nothing but
set the FLTK size and don't change the pixel size.
- when the image is drawn, its FLTK size determines how big it is drawn, its pixel
size determines how much data are available to draw it.
FLTK 1.3.4 with FL_ABI_VERSION=10304 contained an equivalent member function
but only for the Fl_Shared_Image class.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12776 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_SVG_Image.H')
| -rw-r--r-- | FL/Fl_SVG_Image.H | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/FL/Fl_SVG_Image.H b/FL/Fl_SVG_Image.H index 27611016f..d9c5b76c8 100644 --- a/FL/Fl_SVG_Image.H +++ b/FL/Fl_SVG_Image.H @@ -34,9 +34,8 @@ struct NSVGimage; If the image has loaded correctly, w(), h(), and d() should return values greater than zero. Rasterization is not done until the image is first drawn or resize() is called. Therefore, - \ref array is NULL until then. The delayed rasterization ensures an Fl_Shared_Image based on - an SVG image and scaled to its display size by Fl_Shared_Image::scale() will be - always rasterized to the exact screen resolution. + \ref array is NULL until then. The delayed rasterization ensures an Fl_SVG_Image is always rasterized + to the exact screen resolution at which it is drawn. The Fl_SVG_Image class draws images computed by \c nanosvg: one known limitation is that text within \c <text\></text\> blocks is not rendered. @@ -118,8 +117,6 @@ private: void rasterize_(int W, int H); void init_(const char *filename, const char *filedata, Fl_SVG_Image *copy_source); Fl_SVG_Image(Fl_SVG_Image *source); -protected: - virtual int draw_scaled(int X, int Y, int W, int H); public: /** Set this to \c false to allow image re-scaling that alters the image aspect ratio. Upon object creation, proportional is set to \c true, and the aspect ratio is kept constant.*/ |
