summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-07-04 15:07:22 +0000
committerManolo Gouy <Manolo>2011-07-04 15:07:22 +0000
commit3bc8713baca48aa6a4882ead50e227698468d6cf (patch)
tree2d1fbbb4bd26312578494ba777d511bebb2a54e8 /src
parent0b784cc90f178a06b480309d0f1544d0e9bb37fa (diff)
Fl_Paged_Device::print_window() now works with any output surface on Mac platform.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8846 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 3bf74c85a..a561649e5 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -3424,14 +3424,24 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
fl_gc = NULL;
Fl::check();
win->make_current();
- // capture the window title bar from screen
- CGImageRef img = Fl_X::CGImage_from_window_rect(win, 0, -bt, win->w(), bt);
this->set_current(); // back to the Fl_Paged_Device
- CGRect rect = { { x_offset, y_offset }, { win->w(), bt } }; // print the title bar
- Fl_X::q_begin_image(rect, 0, 0, win->w(), bt);
- CGContextDrawImage(fl_gc, rect, img);
- Fl_X::q_end_image();
- CGImageRelease(img);
+ if (this->class_name() == Fl_Printer::class_id) {
+ // capture as transparent image the window title bar from screen
+ CGImageRef img = Fl_X::CGImage_from_window_rect(win, 0, -bt, win->w(), bt);
+ CGRect rect = { { x_offset, y_offset }, { win->w(), bt } }; // print the title bar
+ Fl_X::q_begin_image(rect, 0, 0, win->w(), bt);
+ CGContextDrawImage(fl_gc, rect, img);
+ Fl_X::q_end_image();
+ CGImageRelease(img);
+ }
+ else {
+ // capture the window title bar from screen
+ uchar *top_image = fl_read_image(NULL, 0, -bt, win->w(), bt);
+ if (top_image) { // print the title bar
+ fl_draw_image(top_image, x_offset, y_offset, win->w(), bt, 3);
+ delete[] top_image;
+ }
+ }
this->print_widget(win, x_offset, y_offset + bt); // print the window inner part
}