mirror of
https://github.com/fltk/fltk.git
synced 2026-05-25 00:53:39 +08:00
SVG support: improve printed SVG images by increasing the resolution when printing.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12830 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -234,7 +234,9 @@ void Fl_SVG_Image::resize(int width, int height) {
|
||||
|
||||
|
||||
void Fl_SVG_Image::draw(int X, int Y, int W, int H, int cx, int cy) {
|
||||
float f = Fl::screen_driver()->retina_factor() * fl_graphics_driver->scale();
|
||||
float f = fl_graphics_driver->scale();
|
||||
if (fl_graphics_driver->has_feature(Fl_Graphics_Driver::PRINTER)) f *= 2;
|
||||
else f *= Fl::screen_driver()->retina_factor();
|
||||
int w1 = w(), h1 = h();
|
||||
/* When f > 1, there may be several pixels per FLTK unit in an area
|
||||
of size w() x h() of the display. This occurs, e.g., with Apple retina displays
|
||||
|
||||
@@ -604,7 +604,7 @@ void Fl_PostScript_Graphics_Driver::draw_rgb(Fl_RGB_Image * rgb,int XP, int YP,
|
||||
int h = rgb->h();
|
||||
mask=0;
|
||||
if (lang_level_>2) //when not true, not making alphamask, mixing colors instead...
|
||||
if (alpha_mask(di, w, h, rgb->d(),rgb->ld())) return; //everthing masked, no need for painting!
|
||||
if (alpha_mask(di, w, h, rgb->d(),rgb->ld())) return; //everything masked, no need for painting!
|
||||
draw_image(di, XP + cx, YP + cy, w, h, rgb->d(), rgb->ld());
|
||||
delete[]mask;
|
||||
mask=0;
|
||||
@@ -621,7 +621,8 @@ int Fl_PostScript_Graphics_Driver::scale_and_draw(Fl_Image *img, int XP, int YP,
|
||||
clocale_printf("GS %d %d TR %f %f SC GS\n", XP, YP, float(WP)/img->data_w(), float(HP)/img->data_h());
|
||||
int keep_w = img->w(), keep_h = img->h();
|
||||
img->scale(img->data_w(), img->data_h(), 0, 1);
|
||||
img->draw(0, 0, img->data_w(), img->data_h(), 0, 0);
|
||||
if (img->as_rgb_image()) draw_rgb(img->as_rgb_image(), 0, 0, img->data_w(), img->data_h(), 0, 0);
|
||||
else img->draw(0, 0, img->data_w(), img->data_h(), 0, 0);
|
||||
clocale_printf("GR GR\n");
|
||||
img->scale(keep_w, keep_h, 0, 1);
|
||||
pop_clip(); // restore FLTK's clip
|
||||
|
||||
Reference in New Issue
Block a user