mathematical 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +11 -21
- data/ext/mathematical/extconf.rb +21 -12
- data/ext/mathematical/lasem/Makefile +10 -10
- data/ext/mathematical/lasem/docs/Makefile +9 -9
- data/ext/mathematical/lasem/docs/reference/Makefile +9 -9
- data/ext/mathematical/lasem/docs/reference/lasem/Makefile +15 -9
- data/ext/mathematical/lasem/docs/reference/lasem/lasem-decl-list.txt +245 -0
- data/ext/mathematical/lasem/docs/reference/lasem/lasem-decl.txt +856 -0
- data/ext/mathematical/lasem/docs/reference/lasem/lasem-overrides.txt +0 -0
- data/ext/mathematical/lasem/itex2mml/Makefile +9 -9
- data/ext/mathematical/lasem/src/Makefile +34 -13
- data/ext/mathematical/lasem/src/lasemrender.c +13 -7
- data/ext/mathematical/lasem/src/lsmdomenumtypes.c +99 -0
- data/ext/mathematical/lasem/src/lsmdomenumtypes.h +26 -0
- data/ext/mathematical/lasem/src/lsmmathmlenums.c +24 -0
- data/ext/mathematical/lasem/src/lsmmathmlenums.h +12 -1
- data/ext/mathematical/lasem/src/lsmmathmlenumtypes.c +793 -0
- data/ext/mathematical/lasem/src/lsmmathmlenumtypes.h +96 -0
- data/ext/mathematical/lasem/src/lsmmathmlspaceelement.c +14 -0
- data/ext/mathematical/lasem/src/lsmmathmlspaceelement.h +1 -1
- data/ext/mathematical/lasem/src/lsmmathmltraits.c +24 -0
- data/ext/mathematical/lasem/src/lsmmathmltraits.h +1 -0
- data/ext/mathematical/lasem/src/lsmsvgattributes.h +50 -0
- data/ext/mathematical/lasem/src/lsmsvgdocument.c +18 -0
- data/ext/mathematical/lasem/src/lsmsvgenums.c +130 -0
- data/ext/mathematical/lasem/src/lsmsvgenums.h +59 -0
- data/ext/mathematical/lasem/src/lsmsvgenumtypes.c +1254 -0
- data/ext/mathematical/lasem/src/lsmsvgenumtypes.h +129 -0
- data/ext/mathematical/lasem/src/lsmsvgfiltercolormatrix.c +115 -0
- data/ext/mathematical/lasem/src/lsmsvgfiltercolormatrix.h +58 -0
- data/ext/mathematical/lasem/src/lsmsvgfilterconvolvematrix.c +206 -0
- data/ext/mathematical/lasem/src/lsmsvgfilterconvolvematrix.h +64 -0
- data/ext/mathematical/lasem/src/lsmsvgfilterdisplacementmap.c +124 -0
- data/ext/mathematical/lasem/src/lsmsvgfilterdisplacementmap.h +60 -0
- data/ext/mathematical/lasem/src/lsmsvgfilterimage.c +167 -0
- data/ext/mathematical/lasem/src/lsmsvgfilterimage.h +61 -0
- data/ext/mathematical/lasem/src/lsmsvgfiltermorphology.c +116 -0
- data/ext/mathematical/lasem/src/lsmsvgfiltermorphology.h +58 -0
- data/ext/mathematical/lasem/src/lsmsvgfilterspecularlighting.c +9 -2
- data/ext/mathematical/lasem/src/lsmsvgfiltersurface.c +1169 -87
- data/ext/mathematical/lasem/src/lsmsvgfiltersurface.h +28 -2
- data/ext/mathematical/lasem/src/lsmsvgfilterturbulence.c +142 -0
- data/ext/mathematical/lasem/src/lsmsvgfilterturbulence.h +61 -0
- data/ext/mathematical/lasem/src/lsmsvgtraits.c +249 -0
- data/ext/mathematical/lasem/src/lsmsvgtraits.h +18 -0
- data/ext/mathematical/lasem/src/lsmsvgtypes.h +6 -0
- data/ext/mathematical/lasem/src/lsmsvgview.c +267 -66
- data/ext/mathematical/lasem/src/lsmsvgview.h +23 -0
- data/ext/mathematical/lasem/src/lsmtraits.c +53 -1
- data/ext/mathematical/lasem/src/lsmtraits.h +2 -0
- data/ext/mathematical/lasem/tests/Makefile +26 -15
- data/ext/mathematical/lasem/tests/filter.c +152 -0
- data/ext/mathematical/lasem/tests/lsmtest.c +34 -30
- data/ext/mathematical/lasem/tests/suite.c +5 -2
- data/ext/mathematical/lib/libmtex2MML.a +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeCache.txt +425 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeCCompiler.cmake +55 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeCXXCompiler.cmake +56 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeSystem.cmake +15 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CompilerIdC/CMakeCCompilerId.c +393 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/CMakeRuleHashes.txt +34 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Continuous.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Continuous.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousBuild.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousBuild.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousConfigure.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousConfigure.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousCoverage.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousCoverage.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousMemCheck.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousMemCheck.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousStart.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousStart.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousSubmit.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousSubmit.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousTest.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousTest.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousUpdate.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousUpdate.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Experimental.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Experimental.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalBuild.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalBuild.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalConfigure.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalConfigure.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalCoverage.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalCoverage.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalMemCheck.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalMemCheck.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalStart.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalStart.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalSubmit.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalSubmit.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalTest.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalTest.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalUpdate.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalUpdate.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Makefile.cmake +95 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Nightly.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Nightly.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyBuild.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyBuild.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyConfigure.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyConfigure.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyCoverage.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyCoverage.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemCheck.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemCheck.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemoryCheck.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemoryCheck.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyStart.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyStart.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlySubmit.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlySubmit.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyTest.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyTest.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyUpdate.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyUpdate.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/TargetDirectories.txt +34 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/format.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/format.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/DependInfo.cmake +44 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/cmake_clean.cmake +19 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/link.txt +1 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/DependInfo.cmake +43 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/cmake_clean.cmake +18 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/link.txt +2 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/memcheck.dir/DependInfo.cmake +27 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/memcheck.dir/cmake_clean.cmake +8 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/DependInfo.cmake +44 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/cmake_clean.cmake +19 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/link.txt +1 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/DependInfo.cmake +59 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/cmake_clean.cmake +35 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/link.txt +1 -0
- data/ext/mathematical/mtex2MML/build/CTestTestfile.cmake +7 -0
- data/ext/mathematical/mtex2MML/build/Makefile +1332 -0
- data/ext/mathematical/mtex2MML/build/cmake_install.cmake +43 -0
- data/ext/mathematical/mtex2MML/build/lexer.c +8877 -0
- data/ext/mathematical/mtex2MML/build/libmtex2MML.a +0 -0
- data/ext/mathematical/mtex2MML/build/mtex2mml_export.h +35 -0
- data/ext/mathematical/mtex2MML/build/parser.c +10202 -0
- data/ext/mathematical/mtex2MML/build/parser.h +619 -0
- data/ext/mathematical/mtex2MML/src/mtex2MML.h +1 -1
- data/lib/mathematical/version.rb +1 -1
- metadata +115 -2
@@ -0,0 +1,60 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2015 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#ifndef LSM_SVG_FILTER_DISPLACEMENT_MAP_H
|
25
|
+
#define LSM_SVG_FILTER_DISPLACEMENT_MAP_H
|
26
|
+
|
27
|
+
#include <lsmsvgtypes.h>
|
28
|
+
#include <lsmsvgfilterprimitive.h>
|
29
|
+
|
30
|
+
G_BEGIN_DECLS
|
31
|
+
|
32
|
+
#define LSM_TYPE_SVG_FILTER_DISPLACEMENT_MAP (lsm_svg_filter_displacement_map_get_type ())
|
33
|
+
#define LSM_SVG_FILTER_DISPLACEMENT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LSM_TYPE_SVG_FILTER_DISPLACEMENT_MAP, LsmSvgFilterDisplacementMap))
|
34
|
+
#define LSM_SVG_FILTER_DISPLACEMENT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LSM_TYPE_SVG_FILTER_DISPLACEMENT_MAP, LsmSvgFilterDisplacementMapClass))
|
35
|
+
#define LSM_IS_SVG_FILTER_DISPLACEMENT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LSM_TYPE_SVG_FILTER_DISPLACEMENT_MAP))
|
36
|
+
#define LSM_IS_SVG_FILTER_DISPLACEMENT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LSM_TYPE_SVG_FILTER_DISPLACEMENT_MAP))
|
37
|
+
#define LSM_SVG_FILTER_DISPLACEMENT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LSM_TYPE_SVG_FILTER_DISPLACEMENT_MAP, LsmSvgFilterDisplacementMapClass))
|
38
|
+
|
39
|
+
typedef struct _LsmSvgFilterDisplacementMapClass LsmSvgFilterDisplacementMapClass;
|
40
|
+
|
41
|
+
struct _LsmSvgFilterDisplacementMap {
|
42
|
+
LsmSvgFilterPrimitive base;
|
43
|
+
|
44
|
+
LsmAttribute in2;
|
45
|
+
LsmSvgDoubleAttribute scale;
|
46
|
+
LsmSvgChannelSelectorAttribute x_channel_selector;
|
47
|
+
LsmSvgChannelSelectorAttribute y_channel_selector;
|
48
|
+
};
|
49
|
+
|
50
|
+
struct _LsmSvgFilterDisplacementMapClass {
|
51
|
+
LsmSvgFilterPrimitiveClass element_class;
|
52
|
+
};
|
53
|
+
|
54
|
+
GType lsm_svg_filter_displacement_map_get_type (void);
|
55
|
+
|
56
|
+
LsmDomNode * lsm_svg_filter_displacement_map_new (void);
|
57
|
+
|
58
|
+
G_END_DECLS
|
59
|
+
|
60
|
+
#endif
|
@@ -0,0 +1,167 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2015 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <lsmsvgfilterimage.h>
|
25
|
+
#include <lsmsvgview.h>
|
26
|
+
|
27
|
+
static GObjectClass *parent_class;
|
28
|
+
|
29
|
+
/* GdomNode implementation */
|
30
|
+
|
31
|
+
static const char *
|
32
|
+
lsm_svg_filter_image_get_node_name (LsmDomNode *node)
|
33
|
+
{
|
34
|
+
return "feImage";
|
35
|
+
}
|
36
|
+
|
37
|
+
static void
|
38
|
+
lsm_svg_filter_image_set_attribute (LsmDomElement *self, const char *name, const char *value)
|
39
|
+
{
|
40
|
+
LsmSvgFilterImage *filter = LSM_SVG_FILTER_IMAGE (self);
|
41
|
+
|
42
|
+
LSM_DOM_ELEMENT_CLASS (parent_class)->set_attribute (self, name, value);
|
43
|
+
|
44
|
+
if (g_strcmp0 (name, "xlink:href") == 0)
|
45
|
+
g_clear_object (&filter->pixbuf);
|
46
|
+
}
|
47
|
+
|
48
|
+
/* LsmSvgElement implementation */
|
49
|
+
|
50
|
+
static void
|
51
|
+
lsm_svg_filter_image_apply (LsmSvgFilterPrimitive *self, LsmSvgView *view,
|
52
|
+
const char *input, const char *output, const LsmBox *subregion)
|
53
|
+
{
|
54
|
+
LsmSvgFilterImage *filter = LSM_SVG_FILTER_IMAGE (self);
|
55
|
+
|
56
|
+
/* TODO href can also be a reference to an element */
|
57
|
+
/* TODO this code can be factorized with the one of <image> */
|
58
|
+
|
59
|
+
if (filter->pixbuf == NULL) {
|
60
|
+
LsmDomDocument *document;
|
61
|
+
char *data;
|
62
|
+
gsize size;
|
63
|
+
|
64
|
+
document = lsm_dom_node_get_owner_document (LSM_DOM_NODE (self));
|
65
|
+
|
66
|
+
if (filter->href.value != NULL) {
|
67
|
+
data = lsm_dom_document_get_href_data (document, filter->href.value, &size);
|
68
|
+
if (data != NULL) {
|
69
|
+
GdkPixbufLoader *loader;
|
70
|
+
|
71
|
+
loader = gdk_pixbuf_loader_new ();
|
72
|
+
|
73
|
+
gdk_pixbuf_loader_write (loader, (guchar *) data, size, NULL);
|
74
|
+
|
75
|
+
g_free (data);
|
76
|
+
|
77
|
+
gdk_pixbuf_loader_close (loader, NULL);
|
78
|
+
|
79
|
+
filter->pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
80
|
+
g_object_ref (filter->pixbuf);
|
81
|
+
|
82
|
+
g_object_unref (loader);
|
83
|
+
} else
|
84
|
+
lsm_debug_render ("[SvgFilterImage::apply] Failed to load image '%s'",
|
85
|
+
filter->href.value);
|
86
|
+
} else
|
87
|
+
lsm_debug_render ("[SvgFilterImage::apply] Missing xlink:href attribute");
|
88
|
+
}
|
89
|
+
|
90
|
+
if (GDK_IS_PIXBUF (filter->pixbuf))
|
91
|
+
lsm_svg_view_apply_image (view, output, subregion, filter->pixbuf, filter->preserve_aspect_ratio.value);
|
92
|
+
}
|
93
|
+
|
94
|
+
/* LsmSvgFilterImage implementation */
|
95
|
+
|
96
|
+
LsmDomNode *
|
97
|
+
lsm_svg_filter_image_new (void)
|
98
|
+
{
|
99
|
+
return g_object_new (LSM_TYPE_SVG_FILTER_IMAGE, NULL);
|
100
|
+
}
|
101
|
+
|
102
|
+
static const LsmSvgPreserveAspectRatio preserve_aspect_ratio_default = {
|
103
|
+
.defer = FALSE,
|
104
|
+
.align = LSM_SVG_ALIGN_X_MID_Y_MID,
|
105
|
+
.meet_or_slice = LSM_SVG_MEET_OR_SLICE_MEET
|
106
|
+
};
|
107
|
+
|
108
|
+
static void
|
109
|
+
lsm_svg_filter_image_init (LsmSvgFilterImage *self)
|
110
|
+
{
|
111
|
+
self->pixbuf = NULL;
|
112
|
+
self->preserve_aspect_ratio.value = preserve_aspect_ratio_default;
|
113
|
+
}
|
114
|
+
|
115
|
+
static void
|
116
|
+
lsm_svg_filter_image_finalize (GObject *object)
|
117
|
+
{
|
118
|
+
LsmSvgFilterImage *filter = LSM_SVG_FILTER_IMAGE (object);
|
119
|
+
|
120
|
+
g_clear_object (&filter->pixbuf);
|
121
|
+
|
122
|
+
parent_class->finalize (object);
|
123
|
+
}
|
124
|
+
|
125
|
+
/* LsmSvgFilterImage class */
|
126
|
+
|
127
|
+
static const LsmAttributeInfos lsm_svg_filter_image_attribute_infos[] = {
|
128
|
+
{
|
129
|
+
.name = "xlink:href",
|
130
|
+
.attribute_offset = offsetof (LsmSvgFilterImage, href),
|
131
|
+
.trait_class = &lsm_null_trait_class
|
132
|
+
},
|
133
|
+
{
|
134
|
+
.name = "preserveAspectRatio",
|
135
|
+
.attribute_offset = offsetof (LsmSvgFilterImage, preserve_aspect_ratio),
|
136
|
+
.trait_class = &lsm_svg_preserve_aspect_ratio_trait_class,
|
137
|
+
.trait_default = &preserve_aspect_ratio_default
|
138
|
+
}
|
139
|
+
};
|
140
|
+
|
141
|
+
static void
|
142
|
+
lsm_svg_filter_image_class_init (LsmSvgFilterImageClass *klass)
|
143
|
+
{
|
144
|
+
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
145
|
+
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (klass);
|
146
|
+
LsmDomElementClass *d_element_class = LSM_DOM_ELEMENT_CLASS (klass);
|
147
|
+
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (klass);
|
148
|
+
LsmSvgFilterPrimitiveClass *f_primitive_class = LSM_SVG_FILTER_PRIMITIVE_CLASS (klass);
|
149
|
+
|
150
|
+
parent_class = g_type_class_peek_parent (klass);
|
151
|
+
|
152
|
+
object_class->finalize = lsm_svg_filter_image_finalize;
|
153
|
+
|
154
|
+
d_node_class->get_node_name = lsm_svg_filter_image_get_node_name;
|
155
|
+
|
156
|
+
d_element_class->set_attribute = lsm_svg_filter_image_set_attribute;
|
157
|
+
|
158
|
+
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
|
159
|
+
|
160
|
+
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
|
161
|
+
G_N_ELEMENTS (lsm_svg_filter_image_attribute_infos),
|
162
|
+
lsm_svg_filter_image_attribute_infos);
|
163
|
+
|
164
|
+
f_primitive_class->apply = lsm_svg_filter_image_apply;
|
165
|
+
}
|
166
|
+
|
167
|
+
G_DEFINE_TYPE (LsmSvgFilterImage, lsm_svg_filter_image, LSM_TYPE_SVG_FILTER_PRIMITIVE)
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2015 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#ifndef LSM_SVG_FILTER_IMAGE_H
|
25
|
+
#define LSM_SVG_FILTER_IMAGE_H
|
26
|
+
|
27
|
+
#include <lsmsvgtypes.h>
|
28
|
+
#include <lsmsvgfilterprimitive.h>
|
29
|
+
|
30
|
+
G_BEGIN_DECLS
|
31
|
+
|
32
|
+
#define LSM_TYPE_SVG_FILTER_IMAGE (lsm_svg_filter_image_get_type ())
|
33
|
+
#define LSM_SVG_FILTER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LSM_TYPE_SVG_FILTER_IMAGE, LsmSvgFilterImage))
|
34
|
+
#define LSM_SVG_FILTER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LSM_TYPE_SVG_FILTER_IMAGE, LsmSvgFilterImageClass))
|
35
|
+
#define LSM_IS_SVG_FILTER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LSM_TYPE_SVG_FILTER_IMAGE))
|
36
|
+
#define LSM_IS_SVG_FILTER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LSM_TYPE_SVG_FILTER_IMAGE))
|
37
|
+
#define LSM_SVG_FILTER_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LSM_TYPE_SVG_FILTER_IMAGE, LsmSvgFilterImageClass))
|
38
|
+
|
39
|
+
typedef struct _LsmSvgFilterImageClass LsmSvgFilterImageClass;
|
40
|
+
|
41
|
+
struct _LsmSvgFilterImage {
|
42
|
+
LsmSvgFilterPrimitive base;
|
43
|
+
|
44
|
+
LsmAttribute href;
|
45
|
+
|
46
|
+
LsmSvgPreserveAspectRatioAttribute preserve_aspect_ratio;
|
47
|
+
|
48
|
+
GdkPixbuf *pixbuf;
|
49
|
+
};
|
50
|
+
|
51
|
+
struct _LsmSvgFilterImageClass {
|
52
|
+
LsmSvgFilterPrimitiveClass element_class;
|
53
|
+
};
|
54
|
+
|
55
|
+
GType lsm_svg_filter_image_get_type (void);
|
56
|
+
|
57
|
+
LsmDomNode * lsm_svg_filter_image_new (void);
|
58
|
+
|
59
|
+
G_END_DECLS
|
60
|
+
|
61
|
+
#endif
|
@@ -0,0 +1,116 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2015 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <lsmsvgfiltermorphology.h>
|
25
|
+
#include <lsmsvgview.h>
|
26
|
+
|
27
|
+
static GObjectClass *parent_class;
|
28
|
+
|
29
|
+
/* GdomNode implementation */
|
30
|
+
|
31
|
+
static const char *
|
32
|
+
lsm_svg_filter_morphology_get_node_name (LsmDomNode *node)
|
33
|
+
{
|
34
|
+
return "feMorphology";
|
35
|
+
}
|
36
|
+
|
37
|
+
/* LsmSvgElement implementation */
|
38
|
+
|
39
|
+
static void
|
40
|
+
lsm_svg_filter_morphology_apply (LsmSvgFilterPrimitive *self, LsmSvgView *view,
|
41
|
+
const char *input, const char *output, const LsmBox *subregion)
|
42
|
+
{
|
43
|
+
double radius;
|
44
|
+
|
45
|
+
LsmSvgFilterMorphology *morphology = LSM_SVG_FILTER_MORPHOLOGY (self);
|
46
|
+
|
47
|
+
radius = lsm_svg_view_normalize_length (view, &morphology->radius.length, LSM_SVG_LENGTH_DIRECTION_DIAGONAL);
|
48
|
+
|
49
|
+
lsm_svg_view_apply_morphology (view, input, output, subregion, morphology->op.value, radius);
|
50
|
+
}
|
51
|
+
|
52
|
+
/* LsmSvgFilterMorphology implementation */
|
53
|
+
|
54
|
+
LsmDomNode *
|
55
|
+
lsm_svg_filter_morphology_new (void)
|
56
|
+
{
|
57
|
+
return g_object_new (LSM_TYPE_SVG_FILTER_MORPHOLOGY, NULL);
|
58
|
+
}
|
59
|
+
|
60
|
+
static const LsmSvgLength radius_default = { .value_unit = 0.0, .type = LSM_SVG_LENGTH_TYPE_PX};
|
61
|
+
static const LsmSvgMorphologyOperator operator_default = LSM_SVG_MORPHOLOGY_OPERATOR_ERODE;
|
62
|
+
|
63
|
+
static void
|
64
|
+
lsm_svg_filter_morphology_init (LsmSvgFilterMorphology *self)
|
65
|
+
{
|
66
|
+
self->radius.length = radius_default;
|
67
|
+
self->op.value = operator_default;
|
68
|
+
}
|
69
|
+
|
70
|
+
static void
|
71
|
+
lsm_svg_filter_morphology_finalize (GObject *object)
|
72
|
+
{
|
73
|
+
parent_class->finalize (object);
|
74
|
+
}
|
75
|
+
|
76
|
+
/* LsmSvgFilterMorphology class */
|
77
|
+
|
78
|
+
static const LsmAttributeInfos lsm_svg_filter_morphology_attribute_infos[] = {
|
79
|
+
{
|
80
|
+
.name = "radius",
|
81
|
+
.attribute_offset = offsetof (LsmSvgFilterMorphology, radius),
|
82
|
+
.trait_class = &lsm_svg_length_trait_class,
|
83
|
+
.trait_default = &radius_default
|
84
|
+
},
|
85
|
+
{
|
86
|
+
.name = "operator",
|
87
|
+
.attribute_offset = offsetof (LsmSvgFilterMorphology, op),
|
88
|
+
.trait_class = &lsm_svg_morphology_operator_trait_class,
|
89
|
+
.trait_default = &operator_default
|
90
|
+
}
|
91
|
+
};
|
92
|
+
|
93
|
+
static void
|
94
|
+
lsm_svg_filter_morphology_class_init (LsmSvgFilterMorphologyClass *klass)
|
95
|
+
{
|
96
|
+
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
97
|
+
LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (klass);
|
98
|
+
LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (klass);
|
99
|
+
LsmSvgFilterPrimitiveClass *f_primitive_class = LSM_SVG_FILTER_PRIMITIVE_CLASS (klass);
|
100
|
+
|
101
|
+
parent_class = g_type_class_peek_parent (klass);
|
102
|
+
|
103
|
+
object_class->finalize = lsm_svg_filter_morphology_finalize;
|
104
|
+
|
105
|
+
d_node_class->get_node_name = lsm_svg_filter_morphology_get_node_name;
|
106
|
+
|
107
|
+
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
|
108
|
+
|
109
|
+
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
|
110
|
+
G_N_ELEMENTS (lsm_svg_filter_morphology_attribute_infos),
|
111
|
+
lsm_svg_filter_morphology_attribute_infos);
|
112
|
+
|
113
|
+
f_primitive_class->apply = lsm_svg_filter_morphology_apply;
|
114
|
+
}
|
115
|
+
|
116
|
+
G_DEFINE_TYPE (LsmSvgFilterMorphology, lsm_svg_filter_morphology, LSM_TYPE_SVG_FILTER_PRIMITIVE)
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2015 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#ifndef LSM_SVG_FILTER_MORPHOLOGY_H
|
25
|
+
#define LSM_SVG_FILTER_MORPHOLOGY_H
|
26
|
+
|
27
|
+
#include <lsmsvgtypes.h>
|
28
|
+
#include <lsmsvgfilterprimitive.h>
|
29
|
+
|
30
|
+
G_BEGIN_DECLS
|
31
|
+
|
32
|
+
#define LSM_TYPE_SVG_FILTER_MORPHOLOGY (lsm_svg_filter_morphology_get_type ())
|
33
|
+
#define LSM_SVG_FILTER_MORPHOLOGY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LSM_TYPE_SVG_FILTER_MORPHOLOGY, LsmSvgFilterMorphology))
|
34
|
+
#define LSM_SVG_FILTER_MORPHOLOGY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LSM_TYPE_SVG_FILTER_MORPHOLOGY, LsmSvgFilterMorphologyClass))
|
35
|
+
#define LSM_IS_SVG_FILTER_MORPHOLOGY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LSM_TYPE_SVG_FILTER_MORPHOLOGY))
|
36
|
+
#define LSM_IS_SVG_FILTER_MORPHOLOGY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LSM_TYPE_SVG_FILTER_MORPHOLOGY))
|
37
|
+
#define LSM_SVG_FILTER_MORPHOLOGY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LSM_TYPE_SVG_FILTER_MORPHOLOGY, LsmSvgFilterMorphologyClass))
|
38
|
+
|
39
|
+
typedef struct _LsmSvgFilterMorphologyClass LsmSvgFilterMorphologyClass;
|
40
|
+
|
41
|
+
struct _LsmSvgFilterMorphology {
|
42
|
+
LsmSvgFilterPrimitive base;
|
43
|
+
|
44
|
+
LsmSvgMorphologyOperatorAttribute op;
|
45
|
+
LsmSvgLengthAttribute radius;
|
46
|
+
};
|
47
|
+
|
48
|
+
struct _LsmSvgFilterMorphologyClass {
|
49
|
+
LsmSvgFilterPrimitiveClass element_class;
|
50
|
+
};
|
51
|
+
|
52
|
+
GType lsm_svg_filter_morphology_get_type (void);
|
53
|
+
|
54
|
+
LsmDomNode * lsm_svg_filter_morphology_new (void);
|
55
|
+
|
56
|
+
G_END_DECLS
|
57
|
+
|
58
|
+
#endif
|
@@ -38,9 +38,16 @@ lsm_svg_filter_specular_lighting_get_node_name (LsmDomNode *node)
|
|
38
38
|
|
39
39
|
static void
|
40
40
|
lsm_svg_filter_specular_lighting_apply (LsmSvgFilterPrimitive *self, LsmSvgView *view,
|
41
|
-
|
41
|
+
const char *input, const char *output, const LsmBox *subregion)
|
42
42
|
{
|
43
|
-
|
43
|
+
LsmSvgFilterSpecularLighting *specular_lighting = LSM_SVG_FILTER_SPECULAR_LIGHTING (self);
|
44
|
+
|
45
|
+
lsm_svg_view_apply_specular_lighting (view, output, subregion,
|
46
|
+
specular_lighting->surface_scale.value,
|
47
|
+
specular_lighting->specular_constant.value,
|
48
|
+
specular_lighting->specular_exponent.value,
|
49
|
+
specular_lighting->kernel_unit_length.value.a,
|
50
|
+
specular_lighting->kernel_unit_length.value.b);
|
44
51
|
}
|
45
52
|
|
46
53
|
/* LsmSvgFilterSpecularLighting implementation */
|