Fix Fl_Image::copy() and its versions for derived image classes following the introduction of Fl_Image::scale()

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12786 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2018-03-23 17:03:24 +00:00
parent bd5ec33148
commit b8a50851fd
7 changed files with 14 additions and 17 deletions

View File

@ -55,7 +55,7 @@ public:
Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0), cache_scale_(1) {data((const char **)&array, 1);} Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0), cache_scale_(1) {data((const char **)&array, 1);}
virtual ~Fl_Bitmap(); virtual ~Fl_Bitmap();
virtual Fl_Image *copy(int W, int H); virtual Fl_Image *copy(int W, int H);
Fl_Image *copy() { return copy(w(), h()); } Fl_Image *copy() { return Fl_Image::copy(); }
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); 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 draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
virtual void label(Fl_Widget*w); virtual void label(Fl_Widget*w);

View File

@ -164,13 +164,11 @@ public:
virtual ~Fl_Image(); virtual ~Fl_Image();
virtual Fl_Image *copy(int W, int H); virtual Fl_Image *copy(int W, int H);
/** /**
The copy() method creates a copy of the specified Creates a copy of the specified image.
image. If the width and height are provided, the image is The image should be deleted (or in the case of Fl_Shared_Image, released)
resized to the specified size. The image should be deleted (or in when you are done with it.
the case of Fl_Shared_Image, released) when you are done
with it.
*/ */
Fl_Image *copy() { return copy(w(), h()); } Fl_Image *copy() { Fl_Image *img = copy(data_w(), data_h()); img->scale(w(), h(), 0, 1); return img;}
virtual void color_average(Fl_Color c, float i); virtual void color_average(Fl_Color c, float i);
/** /**
The inactive() method calls The inactive() method calls
@ -268,7 +266,7 @@ public:
Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY); Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY);
virtual ~Fl_RGB_Image(); virtual ~Fl_RGB_Image();
virtual Fl_Image *copy(int W, int H); virtual Fl_Image *copy(int W, int H);
Fl_Image *copy() { return copy(w(), h()); } Fl_Image *copy() { return Fl_Image::copy(); }
virtual void color_average(Fl_Color c, float i); virtual void color_average(Fl_Color c, float i);
virtual void desaturate(); virtual void desaturate();
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);

View File

@ -69,7 +69,7 @@ public:
explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();} explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
virtual ~Fl_Pixmap(); virtual ~Fl_Pixmap();
virtual Fl_Image *copy(int W, int H); virtual Fl_Image *copy(int W, int H);
Fl_Image *copy() { return copy(w(), h()); } Fl_Image *copy() { return Fl_Image::copy(); }
virtual void color_average(Fl_Color c, float i); virtual void color_average(Fl_Color c, float i);
virtual void desaturate(); virtual void desaturate();
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);

View File

@ -124,7 +124,7 @@ public:
Fl_SVG_Image(const char *filename, const char *svg_data = NULL); Fl_SVG_Image(const char *filename, const char *svg_data = NULL);
virtual ~Fl_SVG_Image(); virtual ~Fl_SVG_Image();
virtual Fl_Image *copy(int W, int H); virtual Fl_Image *copy(int W, int H);
Fl_Image *copy() { return copy(w(), h()); } Fl_Image *copy() { return Fl_Image::copy(); }
void resize(int width, int height); void resize(int width, int height);
virtual void desaturate(); virtual void desaturate();
virtual void color_average(Fl_Color c, float i); virtual void color_average(Fl_Color c, float i);

View File

@ -100,7 +100,7 @@ public:
void reload(); void reload();
virtual Fl_Image *copy(int W, int H); virtual Fl_Image *copy(int W, int H);
Fl_Image *copy() { return copy(w(), h()); } Fl_Image *copy() { return Fl_Image::copy(); }
virtual void color_average(Fl_Color c, float i); virtual void color_average(Fl_Color c, float i);
virtual void desaturate(); virtual void desaturate();
virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0); virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0);

View File

@ -43,7 +43,7 @@ class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
virtual ~Fl_Tiled_Image(); virtual ~Fl_Tiled_Image();
virtual Fl_Image *copy(int W, int H); virtual Fl_Image *copy(int W, int H);
Fl_Image *copy() { return copy(w(), h()); } Fl_Image *copy() { return Fl_Image::copy(); }
virtual void color_average(Fl_Color c, float i); virtual void color_average(Fl_Color c, float i);
virtual void desaturate(); virtual void desaturate();
virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0); virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0);

View File

@ -79,11 +79,10 @@ void Fl_Image::draw_empty(int X, int Y) {
} }
/** /**
The copy() method creates a copy of the specified Creates a resized copy of the specified image.
image. If the width and height are provided, the image is The image should be deleted (or in the case of Fl_Shared_Image, released)
resized to the specified size. The image should be deleted (or in when you are done with it.
the case of Fl_Shared_Image, released) when you are done \param W,H width and height of the returned copied image
with it.
*/ */
Fl_Image *Fl_Image::copy(int W, int H) { Fl_Image *Fl_Image::copy(int W, int H) {
return new Fl_Image(W, H, d()); return new Fl_Image(W, H, d());