summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 89a8b4c)
raw | patch | inline | side by side (parent: 89a8b4c)
author | acspike <acspike@users.sourceforge.net> | |
Fri, 5 Sep 2008 04:07:55 +0000 (04:07 +0000) | ||
committer | acspike <acspike@users.sourceforge.net> | |
Fri, 5 Sep 2008 04:07:55 +0000 (04:07 +0000) |
This is patch is the result of cooperation between John Cliff, Josh Blocher and myself. There remains an issue with the positioning of filtered objects that originally possessed transforms.
src/extension/internal/cairo-renderer-pdf-out.cpp | patch | blob | history | |
src/extension/internal/cairo-renderer.cpp | patch | blob | history | |
src/helper/pixbuf-ops.cpp | patch | blob | history |
diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp
index bd25706520bacd7c97ef663c8f3a2eb124074fca..96366e5928dbce6aae8a24163ad383daab7c8dfb 100644 (file)
"<_item value='PDF14'>" N_("PDF 1.4") "</_item>\n"
"</param>\n"
"<param name=\"textToPath\" gui-text=\"" N_("Convert texts to paths") "\" type=\"boolean\">false</param>\n"
- "<param name=\"blurToBitmap\" gui-text=\"" N_("Convert blur effects to bitmaps") "\" type=\"boolean\">false</param>\n"
+ "<param name=\"blurToBitmap\" gui-text=\"" N_("Convert filter effects to bitmaps") "\" type=\"boolean\">false</param>\n"
"<param name=\"resolution\" gui-text=\"" N_("Preferred resolution (DPI) of bitmaps") "\" type=\"int\" min=\"72\" max=\"2400\">90</param>\n"
"<param name=\"exportDrawing\" gui-text=\"" N_("Export drawing, not page") "\" type=\"boolean\">false</param>\n"
"<param name=\"exportCanvas\" gui-text=\"" N_("Export canvas") "\" type=\"boolean\">false</param>\n"
index be9953ae196ab9b0fde83a3b9bb78d09bac58b71..bb4a48d68d6c83295c142cb03b4a240c36d308d2 100644 (file)
*/
static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx)
{
- g_warning("render as bitmap");
-
//the code now was copied from sp_selection_create_bitmap_copy
SPDocument *document = SP_OBJECT(item)->document;
// The width and height of the bitmap in pixels
- unsigned width = (unsigned) floor ((bbox.x1 - bbox.x0) * res / PX_PER_IN);
- unsigned height =(unsigned) floor ((bbox.y1 - bbox.y0) * res / PX_PER_IN);
+ unsigned width = (unsigned) floor ((bbox.x1 - bbox.x0) * (res / PX_PER_IN));
+ unsigned height =(unsigned) floor ((bbox.y1 - bbox.y0) * (res / PX_PER_IN));
+
+ double scale_x = (bbox.x1 - bbox.x0) / width;
+ double scale_y = (bbox.y1 - bbox.y0) / height;
+
// Find out if we have to run a filter
gchar const *run = NULL;
shift_x = round (shift_x);
shift_y = -round (-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone
}
- t = (Geom::Matrix)(Geom::Scale(1, -1) * (Geom::Matrix)(Geom::Translate (shift_x, shift_y)* eek.inverse()));
+ t = (Geom::Matrix)(Geom::Scale(scale_x, -scale_y) * (Geom::Matrix)(Geom::Translate (shift_x, shift_y)* eek.inverse()));
//t = t * ((Geom::Matrix)ctx->getCurrentState()->transform).inverse();
index 94976da27fc13107ccff669f9129f4e93f5f7b83..711e691f0e0126368c06a27352368f0019ad2e3f 100644 (file)
#include <sp-item.h>
#include <sp-root.h>
#include <sp-defs.h>
+#include "unit-constants.h"
#include "libnr/nr-matrix-translate-ops.h"
#include "libnr/nr-scale-ops.h"
GdkPixbuf*
sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
double x0, double y0, double x1, double y1,
- unsigned width, unsigned height, double /*xdpi*/, double /*ydpi*/,
+ unsigned width, unsigned height, double xdpi, double ydpi,
unsigned long bgcolor,
GSList *items_only)
double zoom_scale = 1.0;
double padding = 1.0;
- width = (int)ceil(screen[Geom::X].extent() * zoom_scale * padding);
- height = (int)ceil(screen[Geom::Y].extent() * zoom_scale * padding);
-
Geom::Point origin(screen.min()[Geom::X],
sp_document_height(doc) - screen[Geom::Y].extent() - screen.min()[Geom::Y]);
origin[Geom::X] = origin[Geom::X] + (screen[Geom::X].extent() * ((1 - padding) / 2));
origin[Geom::Y] = origin[Geom::Y] + (screen[Geom::Y].extent() * ((1 - padding) / 2));
- Geom::Scale scale(zoom_scale, zoom_scale);
+ Geom::Scale scale( (xdpi / PX_PER_IN), (ydpi / PX_PER_IN));
Geom::Matrix affine = scale * Geom::Translate(-origin * scale);
/* Create ArenaItems and set transform */