Browse Source

Use a new Fl_Quartz_Graphics_Driver or Fl_GDI_Graphics_Driver instance when printing.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9276 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/49/head
Manolo Gouy 13 years ago
parent
commit
4715e1593e
  1. 4
      src/Fl_Double_Window.cxx
  2. 5
      src/Fl_GDI_Printer.cxx
  3. 8
      src/Fl_Quartz_Printer.mm
  4. 4
      src/Fl_cocoa.mm

4
src/Fl_Double_Window.cxx

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
//
// Double-buffered window code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 1998-2012 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
@ -71,7 +71,7 @@ static void fl_copy_offscreen_to_display(int x, int y, int w, int h, Fl_Offscree @@ -71,7 +71,7 @@ static void fl_copy_offscreen_to_display(int x, int y, int w, int h, Fl_Offscree
\param srcx,srcy origin in offscreen buffer of rectangle to copy
*/
void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
if (fl_graphics_driver == Fl_Display_Device::display_device()->driver()) {
if (fl_graphics_driver->class_name() == Fl_Display_Device::display_device()->driver()->class_name()) {
fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy);
}
else { // when copy is not to the display

5
src/Fl_GDI_Printer.cxx

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
//
// Support for WIN32 printing for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010 by Bill Spitzak and others.
// Copyright 2010-2012 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
@ -27,11 +27,12 @@ extern HWND fl_window; @@ -27,11 +27,12 @@ extern HWND fl_window;
Fl_System_Printer::Fl_System_Printer(void) : Fl_Paged_Device() {
hPr = NULL;
driver(Fl_Display_Device::display_device()->driver());
driver(new Fl_GDI_Graphics_Driver);
}
Fl_System_Printer::~Fl_System_Printer(void) {
if (hPr) end_job();
delete driver();
}
static void WIN_SetupPrinterDeviceContext(HDC prHDC)

8
src/Fl_Quartz_Printer.mm

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
//
// Mac OS X-specific printing support (objective-c++) for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010 by Bill Spitzak and others.
// Copyright 2010-2012 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
@ -32,10 +32,12 @@ Fl_System_Printer::Fl_System_Printer(void) @@ -32,10 +32,12 @@ Fl_System_Printer::Fl_System_Printer(void)
y_offset = 0;
scale_x = scale_y = 1.;
gc = 0;
driver(Fl_Display_Device::display_device()->driver());
driver(new Fl_Quartz_Graphics_Driver);
}
Fl_System_Printer::~Fl_System_Printer(void) {}
Fl_System_Printer::~Fl_System_Printer(void) {
delete driver();
}
int Fl_System_Printer::start_job (int pagecount, int *frompage, int *topage)
//printing using a Quartz graphics context

4
src/Fl_cocoa.mm

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
//
// MacOS-Cocoa specific code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2011 by Bill Spitzak and others.
// Copyright 1998-2012 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
@ -3347,7 +3347,7 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset) @@ -3347,7 +3347,7 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
Fl::check();
win->make_current();
this->set_current(); // back to the Fl_Paged_Device
if (this->class_name() == Fl_Printer::class_id) {
if (driver()->class_name() == Fl_Quartz_Graphics_Driver::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

Loading…
Cancel
Save