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_Shared_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_Shared_Image.H')
| -rw-r--r-- | FL/Fl_Shared_Image.H | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/FL/Fl_Shared_Image.H b/FL/Fl_Shared_Image.H index a62f4db97..9b5dad13d 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, scaling, and drawing of image files. + This class supports caching, loading, and drawing of image files. Most applications will also want to link against the fltk_images library and call the fl_register_images() function to support standard image @@ -54,9 +54,6 @@ class FL_EXPORT Fl_Shared_Image : public Fl_Image { friend class Fl_PNG_Image; friend class Fl_Graphics_Driver; -private: - static Fl_RGB_Scaling scaling_algorithm_; // method used to rescale RGB source images - Fl_Image *scaled_image_; protected: static Fl_Shared_Image **images_; // Shared images @@ -108,7 +105,6 @@ public: virtual void desaturate(); virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0); void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); } - void scale(int width, int height, int proportional = 1, int can_expand = 0); virtual void uncache(); static Fl_Shared_Image *find(const char *name, int W = 0, int H = 0); @@ -118,15 +114,6 @@ public: static int num_images(); static void add_handler(Fl_Shared_Handler f); static void remove_handler(Fl_Shared_Handler f); - /** Sets what algorithm is used when resizing a source image. - The default algorithm is FL_RGB_SCALING_BILINEAR. - Drawing an Fl_Shared_Image is sometimes performed by first resizing the source image - and then drawing the resized copy. This occurs, e.g., when drawing to screen under Linux - after having called Fl_Shared_Image::scale(). - This function controls what method is used when the image to be resized is an Fl_RGB_Image. - \version 1.3.4 - */ - static void scaling_algorithm(Fl_RGB_Scaling algorithm) {scaling_algorithm_ = algorithm; } }; // |
