[lasem] svg: implement a element.



commit 81b049358d22ee562f0a13307482a92aea9bce70
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Mon Oct 29 16:24:16 2012 +0100

    svg: implement a element.

 docs/reference/lasem/Makefile.am                   |    1 +
 src/Makefile.am                                    |    2 +
 src/lsmsvgaelement.c                               |   73 ++++
 src/lsmsvgaelement.h                               |   55 +++
 src/lsmsvgdocument.c                               |    3 +
 src/lsmsvgtypes.h                                  |    1 +
 .../librsvg-bug142561-gnome-desktop-config.png     |  Bin 5085 -> 0 bytes
 .../librsvg-bug142561-gnome-desktop-config.svg     |  187 ---------
 .../librsvg/librsvg-bug166385-ile_de_france_01.png |  Bin 100280 -> 0 bytes
 .../librsvg/librsvg-bug166385-ile_de_france_01.svg |  399 --------------------
 tests/data/svg/suite/struct/link01-ref.png         |  Bin 0 -> 1253 bytes
 tests/data/svg/suite/struct/link01.svg             |   10 +
 12 files changed, 145 insertions(+), 586 deletions(-)
---
diff --git a/docs/reference/lasem/Makefile.am b/docs/reference/lasem/Makefile.am
index 4d05f0a..05b8a8f 100644
--- a/docs/reference/lasem/Makefile.am
+++ b/docs/reference/lasem/Makefile.am
@@ -124,6 +124,7 @@ IGNORE_HFILES=\
 	lsmsvgclippathelement.h			\
 	lsmsvgsvgelement.h			\
 	lsmsvgtransformable.h			\
+	lsmsvgaelement.h			\
 	lsmsvggelement.h			\
 	lsmsvgdefselement.h			\
 	lsmsvguseelement.h			\
diff --git a/src/Makefile.am b/src/Makefile.am
index 710a649..af15f51 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -107,6 +107,7 @@ LASEM_SVG_SRCS =				\
 	lsmsvgimageelement.c			\
 	lsmsvgsymbolelement.c			\
 	lsmsvgmarkerelement.c			\
+	lsmsvgaelement.c			\
 	lsmsvggelement.c			\
 	lsmsvgdefselement.c			\
 	lsmsvgrectelement.c			\
@@ -218,6 +219,7 @@ LASEM_SVG_HDRS =				\
 	lsmsvgtransformable.h			\
 	lsmsvgclippathelement.h			\
 	lsmsvgsvgelement.h			\
+	lsmsvgaelement.h			\
 	lsmsvggelement.h			\
 	lsmsvgdefselement.h			\
 	lsmsvguseelement.h			\
diff --git a/src/lsmsvgaelement.c b/src/lsmsvgaelement.c
new file mode 100644
index 0000000..575817c
--- /dev/null
+++ b/src/lsmsvgaelement.c
@@ -0,0 +1,73 @@
+/* Lasem
+ *
+ * Copyright  2012 Emmanuel Pacaud
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * 	Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#include <lsmsvgaelement.h>
+#include <lsmdebug.h>
+#include <stdio.h>
+
+static GObjectClass *parent_class;
+
+/* GdomNode implementation */
+
+static const char *
+lsm_svg_a_element_get_node_name (LsmDomNode *node)
+{
+	return "a";
+}
+
+/* GGElement implementation */
+
+/* LsmSvgElement implementation */
+
+/* LsmSvgAElement implementation */
+
+LsmDomNode *
+lsm_svg_a_element_new (void)
+{
+	return g_object_new (LSM_TYPE_SVG_A_ELEMENT, NULL);
+}
+
+static void
+lsm_svg_a_element_init (LsmSvgAElement *self)
+{
+}
+
+/* LsmSvgAElement class */
+
+
+static void
+lsm_svg_a_element_class_init (LsmSvgAElementClass *s_g_class)
+{
+	LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_g_class);
+	LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_g_class);
+
+	parent_class = g_type_class_peek_parent (s_g_class);
+
+	d_node_class->get_node_name = lsm_svg_a_element_get_node_name;
+
+	s_element_class->category =
+		LSM_SVG_ELEMENT_CATEGORY_CONTAINER |
+		LSM_SVG_ELEMENT_CATEGORY_STRUCTURAL;
+}
+
+G_DEFINE_TYPE (LsmSvgAElement, lsm_svg_a_element, LSM_TYPE_SVG_TRANSFORMABLE)
diff --git a/src/lsmsvgaelement.h b/src/lsmsvgaelement.h
new file mode 100644
index 0000000..4e435d7
--- /dev/null
+++ b/src/lsmsvgaelement.h
@@ -0,0 +1,55 @@
+/* Lasem
+ *
+ * Copyright  2012 Emmanuel Pacaud
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * 	Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#ifndef LSM_SVG_A_ELEMENT_H
+#define LSM_SVG_A_ELEMENT_H
+
+#include <lsmsvgtypes.h>
+#include <lsmsvgtransformable.h>
+
+G_BEGIN_DECLS
+
+#define LSM_TYPE_SVG_A_ELEMENT             (lsm_svg_a_element_get_type ())
+#define LSM_SVG_A_ELEMENT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), LSM_TYPE_SVG_A_ELEMENT, LsmSvgAElement))
+#define LSM_SVG_A_ELEMENT_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), LSM_TYPE_SVG_A_ELEMENT, LsmSvgAElementClass))
+#define LSM_IS_SVG_A_ELEMENT(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LSM_TYPE_SVG_A_ELEMENT))
+#define LSM_IS_SVG_A_ELEMENT_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), LSM_TYPE_SVG_A_ELEMENT))
+#define LSM_SVG_A_ELEMENT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), LSM_TYPE_SVG_A_ELEMENT, LsmSvgAElementClass))
+
+typedef struct _LsmSvgAElementClass LsmSvgAElementClass;
+
+struct _LsmSvgAElement {
+	LsmSvgTransformable base;
+};
+
+struct _LsmSvgAElementClass {
+	LsmSvgTransformableClass  base_class;
+};
+
+GType lsm_svg_a_element_get_type (void);
+
+LsmDomNode *		lsm_svg_a_element_new 		(void);
+
+G_END_DECLS
+
+#endif
diff --git a/src/lsmsvgdocument.c b/src/lsmsvgdocument.c
index 32be2e6..d80c3df 100644
--- a/src/lsmsvgdocument.c
+++ b/src/lsmsvgdocument.c
@@ -22,6 +22,7 @@
  */
 
 #include <lsmdebug.h>
+#include <lsmsvgaelement.h>
 #include <lsmsvgcircleelement.h>
 #include <lsmsvgclippathelement.h>
 #include <lsmsvgdefselement.h>
@@ -143,6 +144,8 @@ _create_element (LsmDomDocument *document, const char *tag_name)
 		node = lsm_svg_clip_path_element_new ();
 	else if (strcmp (tag_name, "switch") == 0)
 		node = lsm_svg_switch_element_new ();
+	else if (strcmp (tag_name, "a") == 0)
+		node = lsm_svg_a_element_new ();
 	else if (strcmp (tag_name, "filter") == 0)
 		node = lsm_svg_filter_element_new ();
 	else if (strcmp (tag_name, "feBlend") == 0)
diff --git a/src/lsmsvgtypes.h b/src/lsmsvgtypes.h
index 0eba798..9451f9b 100644
--- a/src/lsmsvgtypes.h
+++ b/src/lsmsvgtypes.h
@@ -34,6 +34,7 @@ typedef struct _LsmSvgTransformable LsmSvgTransformable;
 typedef struct _LsmSvgGraphic LsmSvgGraphic;
 typedef struct _LsmSvgClipPathElement LsmSvgClipPathElement;
 typedef struct _LsmSvgSvgElement LsmSvgSvgElement;
+typedef struct _LsmSvgAElement LsmSvgAElement;
 typedef struct _LsmSvgGElement LsmSvgGElement;
 typedef struct _LsmSvgDefsElement LsmSvgDefsElement;
 typedef struct _LsmSvgUseElement LsmSvgUseElement;
diff --git a/tests/data/svg/suite/struct/link01-ref.png b/tests/data/svg/suite/struct/link01-ref.png
new file mode 100644
index 0000000..ed96675
Binary files /dev/null and b/tests/data/svg/suite/struct/link01-ref.png differ
diff --git a/tests/data/svg/suite/struct/link01.svg b/tests/data/svg/suite/struct/link01.svg
new file mode 100644
index 0000000..6a7f12a
--- /dev/null
+++ b/tests/data/svg/suite/struct/link01.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink";>
+  <desc>Example link01 - a link on an ellipse
+  </desc>
+  <rect x="0.5" y="0.5" width="99" height="99" fill="none" stroke="blue" stroke-width="1"/>
+  <a xlink:href="http://www.w3.org";>
+    <ellipse cx="50" cy="50" rx="45" ry="30" fill="red"/>
+  </a>
+</svg>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]