diff options
| author | Manolo Gouy <Manolo> | 2018-02-09 13:48:22 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-02-09 13:48:22 +0000 |
| commit | c472d5d8b76e17e4dd537ca20c9bfb144b06189c (patch) | |
| tree | fbe64110002b5d36127631c37cc5d1bb44f86318 /FL | |
| parent | b78b2f7f5f24b98640d31bb8ee7b573703e8cc19 (diff) | |
Fix fl_read_image() under MacOS platform when GUI is rescaled.
This commit also simplifies the platform-dependent support of fl_read_image():
only Fl_XXX_Screen_Driver::read_win_rectangle() contains platform-specific
code to capture pixels from the current window or from an offscreen buffer.
Platform-independent function Fl_Screen_Driver::traverse_to_gl_subwindows()
captures subwindows that intersect with the area fl_read_image() targets.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12653 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Graphics_Driver.H | 6 | ||||
| -rw-r--r-- | FL/Fl_Screen_Driver.H | 20 |
2 files changed, 15 insertions, 11 deletions
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index bd4a82326..27778da2f 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/FL/Fl_Graphics_Driver.H @@ -395,6 +395,12 @@ public: virtual void font_name(int num, const char *name) {} /** Support function for Fl_Shared_Image drawing */ virtual int draw_scaled(Fl_Image *img, int X, int Y, int W, int H); + /** Support function for fl_overlay_rect() and scaled GUI. + Defaut implementation may be enough */ + virtual bool overlay_rect_unscaled(); + /** Support function for fl_overlay_rect() and scaled GUI. + Defaut implementation may be enough */ + virtual void overlay_rect(int x, int y, int w , int h) { loop(x, y, x+w-1, y, x+w-1, y+h-1, x, y+h-1); } }; #ifndef FL_DOXYGEN diff --git a/FL/Fl_Screen_Driver.H b/FL/Fl_Screen_Driver.H index 00d3d763d..564b77754 100644 --- a/FL/Fl_Screen_Driver.H +++ b/FL/Fl_Screen_Driver.H @@ -3,7 +3,7 @@ // // All screen related calls in a driver style class. // -// Copyright 1998-2017 by Bill Spitzak and others. +// Copyright 1998-2018 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -126,25 +126,23 @@ public: #if defined(FL_PORTING) # pragma message "FL_PORTING: implement code to read RGB data from screen" #endif - /* Both member functions read_image() and read_win_rectangle() support - the public function fl_read_image() which captures pixel data either from + /* Member function read_win_rectangle() supports the public function + fl_read_image() which captures pixel data either from the current window or from an offscreen buffer. - A platform re-implements either read_image() or read_win_rectangle(). - In the 1st case and for capture from a window, the returned pixel array + With fl_read_image() and for capture from a window, the returned pixel array also contains data from any embedded sub-window. - In the 2nd case and for capture from a window, only data from the current - window is collected, and read_image()'s default implementation captures - pixels from any subwindow. + + In the case of read_win_rectangle() and for capture from a window, only data + from the current window is collected. A platform may also use its read_win_rectangle() implementation to capture window decorations (e.g., title bar). In that case, it is called by Fl_XXX_Window_Driver::capture_titlebar_and_borders(). */ - virtual uchar *read_image(uchar *p, int x, int y, int w, int h, int alpha); - virtual Fl_RGB_Image *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha) {return NULL;} + virtual Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h) {return NULL;} static void write_image_inside(Fl_RGB_Image *to, Fl_RGB_Image *from, int to_x, int to_y); - static Fl_RGB_Image *traverse_to_gl_subwindows(Fl_Group *g, uchar *p, int x, int y, int w, int h, int alpha, + static Fl_RGB_Image *traverse_to_gl_subwindows(Fl_Group *g, int x, int y, int w, int h, Fl_RGB_Image *full_img); // optional platform-specific key handling for Fl_Input widget // the default implementation may be enough |
