[lasem] filter: implementation of get_extents.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem] filter: implementation of get_extents.
- Date: Sun, 17 Oct 2010 14:16:20 +0000 (UTC)
commit ea1c04dba67f80b220f8d284a13497649ffb1e85
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Fri Oct 8 16:39:54 2010 +0200
filter: implementation of get_extents.
src/lsmsvgfilterelement.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/src/lsmsvgfilterelement.c b/src/lsmsvgfilterelement.c
index 73f3c96..fbf3cfa 100644
--- a/src/lsmsvgfilterelement.c
+++ b/src/lsmsvgfilterelement.c
@@ -119,6 +119,45 @@ lsm_svg_filter_element_enable_rendering (LsmSvgElement *element)
LSM_SVG_FILTER_ELEMENT (element)->enable_rendering = TRUE;
}
+static void
+lsm_svg_filter_element_get_extents (LsmSvgElement *self, LsmSvgView *view, LsmExtents *extents)
+{
+ LsmSvgFilterElement *filter = LSM_SVG_FILTER_ELEMENT (self);
+ const LsmBox *source_extents;
+ double x, y;
+ double w, h;
+ gboolean is_object_bounding_box;
+
+ source_extents = lsm_svg_view_get_pattern_extents (view);
+
+ is_object_bounding_box = (filter->units.value == LSM_SVG_PATTERN_UNITS_OBJECT_BOUNDING_BOX);
+
+ if (is_object_bounding_box) {
+ LsmBox viewbox = {.x = 0.0, .y = .0, .width = 1.0, .height = 1.0};
+
+ lsm_svg_view_push_viewbox (view, &viewbox);
+ }
+
+ x = lsm_svg_view_normalize_length (view, &filter->x.length, LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
+ y = lsm_svg_view_normalize_length (view, &filter->y.length, LSM_SVG_LENGTH_DIRECTION_VERTICAL);
+ w = lsm_svg_view_normalize_length (view, &filter->width.length, LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
+ h = lsm_svg_view_normalize_length (view, &filter->height.length, LSM_SVG_LENGTH_DIRECTION_VERTICAL);
+
+ if (is_object_bounding_box) {
+ lsm_svg_view_pop_viewbox (view);
+
+ x = x * source_extents->width + source_extents->x;
+ y = y * source_extents->height + source_extents->y;
+ w *= source_extents->width;
+ h *= source_extents->height;
+ }
+
+ extents->x1 = x;
+ extents->y1 = y;
+ extents->x2 = x + w;
+ extents->y2 = y + h;
+}
+
/* LsmSvgGraphic implementation */
/* LsmSvgFilterElement implementation */
@@ -209,6 +248,7 @@ lsm_svg_filter_element_class_init (LsmSvgFilterElementClass *s_rect_class)
s_element_class->category = LSM_SVG_ELEMENT_CATEGORY_NONE;
s_element_class->render = lsm_svg_filter_element_render;
+ s_element_class->get_extents = lsm_svg_filter_element_get_extents;
s_element_class->enable_rendering = lsm_svg_filter_element_enable_rendering;
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]