summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 55a3b51)
raw | patch | inline | side by side (parent: 55a3b51)
author | theAdib <theAdib@users.sourceforge.net> | |
Fri, 1 May 2009 22:25:05 +0000 (22:25 +0000) | ||
committer | theAdib <theAdib@users.sourceforge.net> | |
Fri, 1 May 2009 22:25:05 +0000 (22:25 +0000) |
index ce13072b9c16f669575fa90cab4d6c9c245e5eb5..74e0f409c85525ef0d96468c63d2605efa44aafd 100644 (file)
--- a/src/display/nr-arena.cpp
+++ b/src/display/nr-arena.cpp
#include "nr-arena-item.h"
#include "nr-arena.h"
+#include "nr-filter-gaussian.h"
+#include "nr-filter-types.h"
#include <libnr/nr-blit.h>
+#include "preferences.h"
static void nr_arena_class_init (NRArenaClass *klass);
static void nr_arena_init (NRArena *arena);
nr_arena_init (NRArena *arena)
{
arena->delta = 0; // to be set by desktop from prefs
+ arena->renderoffscreen = false; // use render values from preferences otherwise render exact
arena->rendermode = Inkscape::RENDERMODE_NORMAL; // default is normal render
+ arena->blurquality = BLUR_QUALITY_NORMAL;
+ arena->filterquality = Inkscape::Filters::FILTER_QUALITY_NORMAL;
arena->outlinecolor = 0xff; // black; to be set by desktop from bg color
arena->canvasarena = NULL;
}
nr_return_if_fail (NR_IS_ARENA (arena));
nr_return_if_fail (item != NULL);
nr_return_if_fail (NR_IS_ARENA_ITEM (item));
+ // setup render parameter
+ if (arena->renderoffscreen == false) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ arena->blurquality = prefs->getInt("/options/blurquality/value", 0);
+ arena->filterquality = prefs->getInt("/options/filterquality/value", 0);
+ } else {
+ arena->blurquality = BLUR_QUALITY_BEST;
+ arena->filterquality = Inkscape::Filters::FILTER_QUALITY_BEST;
+ arena->rendermode = Inkscape::RENDERMODE_NORMAL;
+ }
if (aobject->callbacks) {
for (unsigned int i = 0; i < aobject->callbacks->length; i++) {
nr_return_if_fail (NR_IS_ARENA (arena));
nr_return_if_fail (area != NULL);
+ // setup render parameter
+ if (arena->renderoffscreen == false) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ arena->blurquality = prefs->getInt("/options/blurquality/value", 0);
+ arena->filterquality = prefs->getInt("/options/filterquality/value", 0);
+ } else {
+ arena->blurquality = BLUR_QUALITY_BEST;
+ arena->filterquality = Inkscape::Filters::FILTER_QUALITY_BEST;
+ arena->rendermode = Inkscape::RENDERMODE_NORMAL;
+ }
if (aobject->callbacks && area && !nr_rect_l_test_empty_ptr(area)) {
for (unsigned int i = 0; i < aobject->callbacks->length; i++) {
NRObjectListener *listener = aobject->callbacks->listeners + i;
@@ -139,6 +165,21 @@ nr_arena_render_paintserver_fill (NRPixBlock *pb, NRRectL *area, SPPainter *pain
nr_pixblock_release (&cb_opa);
}
+/**
+ set arena to offscreen mode
+ rendering will be exact
+ @param arena NRArena object
+*/
+void
+nr_arena_set_renderoffscreen (NRArena *arena)
+{
+ nr_return_if_fail (arena != NULL);
+ nr_return_if_fail (NR_IS_ARENA (arena));
+
+ // the real assignment to the quality indicators is in the update function
+ arena->renderoffscreen = true;
+
+}
/*
Local Variables:
diff --git a/src/display/nr-arena.h b/src/display/nr-arena.h
index 1a042b355fa096c50cd853b76c3d961e925a6858..1c091b7c76eb9aafc025b15bf6fdc197a9dac8d3 100644 (file)
--- a/src/display/nr-arena.h
+++ b/src/display/nr-arena.h
}
double delta;
+ bool renderoffscreen; // if true then rendering must be exact
Inkscape::RenderMode rendermode;
+ int blurquality; // will be updated during update from preferences
+ int filterquality; // will be updated during update from preferences
+
guint32 outlinecolor;
SPCanvasArena *canvasarena; // may be NULL is this arena is not the screen but used for export etc.
};
void nr_arena_request_update (NRArena *arena, NRArenaItem *item);
void nr_arena_request_render_rect (NRArena *arena, NRRectL *area);
+void nr_arena_set_renderoffscreen (NRArena *arena);
void nr_arena_render_paintserver_fill (NRPixBlock *pb, NRRectL *area, SPPainter *painter, float opacity, NRPixBlock *mask);
index 5d071be8c0aafdb62ba5b6091dc69365f8b735e5..90220d296cfcd269d1e50700bfd14e24bf268cf3 100644 (file)
#endif // HAVE_OPENMP
// Subsampling constants
- int const quality = prefs->getInt("/options/blurquality/value");
+ int const quality = slot.get_blurquality();
int const x_step_l2 = _effect_subsample_step_log2(deviation_x_org, quality);
int const y_step_l2 = _effect_subsample_step_log2(deviation_y_org, quality);
int const x_step = 1<<x_step_l2;
index 7631d9eb6286218b28aa23568b2f1614eec4a377..245bdfa4815b68e206c74cbc0111b7659b87e753 100644 (file)
#include "display/nr-arena-item.h"
#include "display/nr-filter-types.h"
+#include "display/nr-filter-gaussian.h"
#include "display/nr-filter-slot.h"
#include "display/nr-filter-getalpha.h"
#include "display/nr-filter-units.h"
FilterSlot::FilterSlot(int slots, NRArenaItem const *item)
: _last_out(-1),
filterquality(FILTER_QUALITY_BEST),
+ blurquality(BLUR_QUALITY_BEST),
_arena_item(item)
{
_slot_count = ((slots > 0) ? slots : 2);
filterquality = q;
}
+void FilterSlot::set_blurquality(int const q) {
+ g_warning("FilterSlot::set_blurquality");
+ blurquality = q;
+}
+
+int FilterSlot::get_blurquality(void) {
+ return blurquality;
+}
+
} /* namespace Filters */
} /* namespace Inkscape */
index bddb42dc3528ecf2bcaad29b530362d2e546175e..8d7a82d2d80bed1411df86af66fcc7d59f1afa4c 100644 (file)
/** Sets the filtering quality. Affects used interpolation methods */
void set_quality(FilterQuality const q);
+ /** Sets the gaussian filtering quality. Affects used interpolation methods */
+ void set_blurquality(int const q);
+
+ /** Gets the gaussian filtering quality. Affects used interpolation methods */
+ int get_blurquality(void);
+
private:
NRPixBlock **_slot;
int *_slot_number;
FilterQuality filterquality;
+ int blurquality;
+
NRArenaItem const *_arena_item;
FilterUnits units;
index 30f8ae7e9d1219692f49b070e64fb2aa2232bc69..af432bdf343b524ae46999f3c8cde196a0514798 100644 (file)
#include "display/nr-filter-tile.h"
#include "display/nr-filter-turbulence.h"
+#include "display/nr-arena.h"
#include "display/nr-arena-item.h"
#include "libnr/nr-pixblock.h"
#include "libnr/nr-blit.h"
{
if (!_primitive[0]) {
// TODO: Should clear the input buffer instead of just returning
- return 1;
+ return 1;
}
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- FilterQuality const filterquality = (FilterQuality)prefs->getInt("/options/filterquality/value");
+ FilterQuality const filterquality = (FilterQuality)item->arena->filterquality;
+ int const blurquality = item->arena->blurquality;
Geom::Matrix trans = item->ctm;
FilterSlot slot(_slot_count, item);
slot.set_quality(filterquality);
+ slot.set_blurquality(blurquality);
Geom::Rect item_bbox;
{
diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp
index 804919e331fef925338e70ae50167fa68eb39303..b44e83449323711c64434b05789d061639d77fe5 100644 (file)
/* Create new arena */
NRArena *arena = NRArena::create();
+ nr_arena_set_renderoffscreen (arena);
unsigned dkey = sp_item_display_key_new(1);
sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY);
index ee17e7079e639a724607ec37e2d45609f088a3c8..0e056e98149d7202d476136da11b67727bfc804d 100644 (file)
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
return true;
}
- // export with maximum blur rendering quality
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- int saved_quality = prefs->getInt("/options/blurquality/value", 0);
- prefs->setInt("/options/blurquality/value", 2);
- int saved_filter_quality = prefs->getInt("/options/filterquality/value", 0);
- prefs->setInt("/options/filterquality/value", 2);
-
sp_document_ensure_up_to_date(doc);
/* Calculate translation by transforming to document coordinates (flipping Y)*/
/* Create new arena */
NRArena *const arena = NRArena::create();
+ // export with maximum blur rendering quality
+ nr_arena_set_renderoffscreen(arena);
unsigned const dkey = sp_item_display_key_new(1);
/* Create ArenaItems and set transform */
/* Free arena */
nr_object_unref((NRObject *) arena);
- // restore saved blur and filter quality
- prefs->setInt("/options/blurquality/value", saved_quality);
- prefs->setInt("/options/filterquality/value", saved_filter_quality);
-
g_free(path);
return write_status;