summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef9d155)
raw | patch | inline | side by side (parent: ef9d155)
author | kiirala <kiirala@users.sourceforge.net> | |
Tue, 10 Oct 2006 22:00:49 +0000 (22:00 +0000) | ||
committer | kiirala <kiirala@users.sourceforge.net> | |
Tue, 10 Oct 2006 22:00:49 +0000 (22:00 +0000) |
src/display/nr-arena-image.cpp | patch | blob | history | |
src/display/nr-arena-image.h | patch | blob | history | |
src/sp-image.cpp | patch | blob | history | |
src/sp-text.cpp | patch | blob | history |
index ee566d2dceb90a8b0a749c857ddd017a36090d95..39e33c7711b07f40bc418ed77cc99e8f7e46d3dc 100644 (file)
#include <libnr/nr-compose-transform.h>
#include "../prefs-utils.h"
#include "nr-arena-image.h"
+#include "style.h"
+#include "display/nr-filter.h"
+#include "display/nr-filter-gaussian.h"
+#include "sp-filter.h"
+#include "sp-gaussian-blur.h"
int nr_arena_image_x_sample = 1;
int nr_arena_image_y_sample = 1;
image->height = 256.0;
nr_matrix_set_identity (&image->grid2px);
+
+ image->style = 0;
}
static void
@@ -256,3 +263,53 @@ nr_arena_image_set_geometry (NRArenaImage *image, double x, double y, double wid
nr_arena_item_request_update (NR_ARENA_ITEM (image), NR_ARENA_ITEM_STATE_ALL, FALSE);
}
+void nr_arena_image_set_style (NRArenaImage *image, SPStyle *style)
+{
+ g_return_if_fail(image != NULL);
+ g_return_if_fail(NR_IS_ARENA_IMAGE(image));
+
+ if (style) sp_style_ref(style);
+ if (image->style) sp_style_unref(image->style);
+ image->style = style;
+
+ //if there is a filter set for this group
+ if (style && style->filter.set && style->filter.filter) {
+
+ image->filter = new NR::Filter();
+ image->filter->set_x(style->filter.filter->x);
+ image->filter->set_y(style->filter.filter->y);
+ image->filter->set_width(style->filter.filter->width);
+ image->filter->set_height(style->filter.filter->height);
+
+ //go through all SP filter primitives
+ for(int i=0; i<style->filter.filter->_primitive_count; i++)
+ {
+ SPFilterPrimitive *primitive = style->filter.filter->_primitives[i];
+ //if primitive is gaussianblur
+// if(SP_IS_GAUSSIANBLUR(primitive))
+ {
+ NR::FilterGaussian * gaussian = (NR::FilterGaussian *) image->filter->add_primitive(NR::NR_FILTER_GAUSSIANBLUR);
+ SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive);
+ float num = spblur->stdDeviation.getNumber();
+ if( num>=0.0 )
+ {
+ float optnum = spblur->stdDeviation.getOptNumber();
+ if( optnum>=0.0 )
+ gaussian->set_deviation((double) num, (double) optnum);
+ else
+ gaussian->set_deviation((double) num);
+ }
+ }
+ }
+ }
+ else
+ {
+ //no filter set for this group
+ image->filter = NULL;
+ }
+
+ if (style && style->enable_background.set
+ && style->enable_background.value == SP_CSS_BACKGROUND_NEW) {
+ image->background_new = true;
+ }
+}
index 8c5afc55f4cbd6d2c81ee683f0e4272102bb2ccb..60485ea33ef984236dc66e0cfdcefed24f8e814e 100644 (file)
#include <libnr/nr-matrix.h>
#include "nr-arena-item.h"
+#include "style.h"
NRType nr_arena_image_get_type (void);
/* From GRID to PIXELS */
NR::Matrix grid2px;
+ SPStyle *style;
+
static NRArenaImage *create(NRArena *arena) {
NRArenaImage *obj=reinterpret_cast<NRArenaImage *>(nr_object_new(NR_TYPE_ARENA_IMAGE));
obj->init(arena);
void nr_arena_image_set_pixels (NRArenaImage *image, const unsigned char *px, unsigned int pxw, unsigned int pxh, unsigned int pxrs);
void nr_arena_image_set_geometry (NRArenaImage *image, double x, double y, double width, double height);
+void nr_arena_image_set_style (NRArenaImage *image, SPStyle *style);
#endif
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 5804089e687cf9efc1ef658cb01ab2274c574c73..301c6f8d50c9edf50d6ddc15715d2b12c91bfc90 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -996,6 +996,7 @@ sp_image_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flag
if (image->pixbuf) {
pixskip = gdk_pixbuf_get_n_channels (image->pixbuf) * gdk_pixbuf_get_bits_per_sample (image->pixbuf) / 8;
rs = gdk_pixbuf_get_rowstride (image->pixbuf);
+ nr_arena_image_set_style(NR_ARENA_IMAGE(ai), SP_OBJECT_STYLE(SP_OBJECT(item)));
if (image->aspect_align == SP_ASPECT_NONE)
nr_arena_image_set_pixels (NR_ARENA_IMAGE (ai),
gdk_pixbuf_get_pixels (image->pixbuf),
for (v = item->display; v != NULL; v = v->next) {
pixskip = gdk_pixbuf_get_n_channels (image->pixbuf) * gdk_pixbuf_get_bits_per_sample (image->pixbuf) / 8;
rs = gdk_pixbuf_get_rowstride (image->pixbuf);
+ nr_arena_image_set_style (NR_ARENA_IMAGE(v->arenaitem), SP_OBJECT_STYLE(SP_OBJECT(image)));
if (image->aspect_align == SP_ASPECT_NONE) {
nr_arena_image_set_pixels (NR_ARENA_IMAGE (v->arenaitem),
gdk_pixbuf_get_pixels (image->pixbuf),
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index c9811ec6e18420d291de0efbd875a55beaadf6ef..3059cf22d9aaf16b599360e16eff94ccf7d19ef1 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE);
for (SPItemView* v = text->display; v != NULL; v = v->next) {
text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
+ nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
// pass the bbox of the text object as paintbox (used for paintserver fills)
text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
}
sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE);
for (SPItemView* v = text->display; v != NULL; v = v->next) {
text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
+ nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
}
}