Commit 564f45ba authored by Jon Nordby's avatar Jon Nordby

Merge remote-tracking branch 'origin/meta-json'

parents 539c231c aed68655
...@@ -494,7 +494,7 @@ AC_CHECK_FUNCS(fsync) ...@@ -494,7 +494,7 @@ AC_CHECK_FUNCS(fsync)
PKG_CHECK_MODULES(BABL, babl >= babl_required_version) PKG_CHECK_MODULES(BABL, babl >= babl_required_version)
GLIB_PACKAGES="gobject-2.0 gmodule-2.0 gio-2.0" GLIB_PACKAGES="gobject-2.0 gmodule-2.0 gio-2.0 json-glib-1.0"
# select platform-specific GIO # select platform-specific GIO
case "$os_win32" in case "$os_win32" in
yes) yes)
......
...@@ -28,6 +28,7 @@ liboperation_public_HEADERS = \ ...@@ -28,6 +28,7 @@ liboperation_public_HEADERS = \
gegl-operation-context.h \ gegl-operation-context.h \
gegl-operation-filter.h \ gegl-operation-filter.h \
gegl-operation-meta.h \ gegl-operation-meta.h \
gegl-operation-meta-json.h \
gegl-operation-point-composer.h \ gegl-operation-point-composer.h \
gegl-operation-point-composer3.h \ gegl-operation-point-composer3.h \
gegl-operation-point-filter.h \ gegl-operation-point-filter.h \
...@@ -46,6 +47,7 @@ liboperation_sources = \ ...@@ -46,6 +47,7 @@ liboperation_sources = \
gegl-operation-composer3.c \ gegl-operation-composer3.c \
gegl-operation-filter.c \ gegl-operation-filter.c \
gegl-operation-meta.c \ gegl-operation-meta.c \
gegl-operation-meta-json.c \
gegl-operation-point-composer.c \ gegl-operation-point-composer.c \
gegl-operation-point-composer3.c \ gegl-operation-point-composer3.c \
gegl-operation-point-filter.c \ gegl-operation-point-filter.c \
......
/* This file is part of GEGL
*
* GEGL 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 3 of the License, or (at your option) any later version.
*
* GEGL 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 GEGL; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2014 Jon Nordby <jononor@gmail.com>
*/
#include "config.h"
#include <glib-object.h>
#include <string.h>
#include "gegl.h"
#include "gegl-operation-meta-json.h"
static void finalize (GObject *self_object);
G_DEFINE_TYPE (GeglOperationMetaJson, gegl_operation_meta_json, GEGL_TYPE_OPERATION_META)
static void
gegl_operation_meta_json_class_init (GeglOperationMetaJsonClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
// TODO: override attach()
object_class->finalize = finalize;
}
static void
gegl_operation_meta_json_init (GeglOperationMetaJson *self)
{
}
static void
finalize (GObject *gobject)
{
GeglOperationMetaJson *self = GEGL_OPERATION_META_JSON (gobject);
G_OBJECT_CLASS (gegl_operation_meta_json_parent_class)->finalize (gobject);
}
/* This file is part of GEGL
*
* GEGL 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 3 of the License, or (at your option) any later version.
*
* GEGL 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 GEGL; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2014 Jon Nordby <jononor@gmail.com>
*/
/* GeglOperationMetaJsn
* Used for GEGL operations that are implemented as a sub-graph in .json
*/
#ifndef __GEGL_OPERATION_META_JSON_H__
#define __GEGL_OPERATION_META_JSON_H__
#include "gegl-operation-meta.h"
G_BEGIN_DECLS
#define GEGL_TYPE_OPERATION_META_JSON (gegl_operation_meta_get_type ())
#define GEGL_OPERATION_META_JSON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_META_JSON, GeglOperationMetaJson))
#define GEGL_OPERATION_META_JSON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_META_JSON, GeglOperationMetaJsonClass))
#define GEGL_IS_OPERATION_META_JSON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_META_JSON))
#define GEGL_IS_OPERATION_META_JSON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_META_JSON))
#define GEGL_OPERATION_META_JSON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_META_JSON, GeglOperationMetaJsonClass))
typedef struct _GeglOperationMetaJson GeglOperationMetaJson;
struct _GeglOperationMetaJson
{
GeglOperationMeta parent_instance;
gpointer pad[4];
};
typedef struct _GeglOperationMetaJsonClass GeglOperationMetaJsonClass;
struct _GeglOperationMetaJsonClass
{
GeglOperationMetaClass parent_class;
gpointer pad[4];
};
GType gegl_operation_meta_json_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif
...@@ -13,4 +13,5 @@ op_LTLIBRARIES = \ ...@@ -13,4 +13,5 @@ op_LTLIBRARIES = \
cast-format.la \ cast-format.la \
convert-format.la \ convert-format.la \
crop.la \ crop.la \
json.la \
nop.la nop.la
This diff is collapsed.
INPORT=translate.X:X
INPORT=translate.Y:Y
INPORT=color.VALUE:COLOR
INPORT=blur.STD_DEV_X:RADIUS
INPORT=opacity.VALUE:OPACITY
INPORT=input.INPUT:INPUT
OUTPORT=over.OUTPUT:OUTPUT
# FIXME: multiple export mapping? INPORT=blur.STD-DEV-Y:RADIUS
# FIXME: allow - in property names, or map _ to - ?
# TODO: allow \ or \n between connections
input(gegl/nop) OUTPUT -> INPUT darken(gegl/src_in) OUTPUT -> INPUT blur(gegl/gaussian_blur) OUTPUT -> INPUT opacity(gegl/opacity) OUTPUT -> INPUT translate(gegl/translate) OUTPUT -> INPUT over(gegl/over)
input OUTPUT -> AUX over
color(gegl/color) OUTPUT -> AUX darken
'rgba(0.0, 0.0, 0.0, 0.0)' -> VALUE color
'0.5' -> VALUE opacity
'10' -> STD_DEV_Y blur
'20' -> Y translate
'20' -> X translate
{
"properties": {
"name": "gegl/json/dropshadow2"
},
"processes": {
"input": {
"component": "gegl/nop"
},
"darken": {
"component": "gegl/src-in",
"metadata": {
"routes": "in"
}
},
"blur": {
"component": "gegl/gaussian-blur",
"metadata": {
"routes": "blur"
}
},
"opacity": {
"component": "gegl/opacity"
},
"color": {
"component": "gegl/color"
},
"translate": {
"component": "gegl/translate"
},
"over": {
"component": "gegl/over"
}
},
"connections": [
{
"src": {
"process": "input",
"port": "output"
},
"tgt": {
"process": "darken",
"port": "input"
}
},
{
"src": {
"process": "darken",
"port": "output"
},
"tgt": {
"process": "blur",
"port": "input"
}
},
{
"src": {
"process": "blur",
"port": "output"
},
"tgt": {
"process": "opacity",
"port": "input"
}
},
{
"src": {
"process": "opacity",
"port": "output"
},
"tgt": {
"process": "translate",
"port": "input"
}
},
{
"src": {
"process": "translate",
"port": "output"
},
"tgt": {
"process": "over",
"port": "input"
}
},
{
"src": {
"process": "input",
"port": "output"
},
"tgt": {
"process": "over",
"port": "aux"
}
},
{
"src": {
"process": "color",
"port": "output"
},
"tgt": {
"process": "darken",
"port": "aux"
}
},
{
"data": "rgba(0.0, 0.0, 0.0, 0.0)",
"tgt": {
"process": "color",
"port": "value"
}
},
{
"data": "0.5",
"tgt": {
"process": "opacity",
"port": "value"
}
}
],
"inports": {
"x": {
"process": "translate",
"port": "x"
},
"y": {
"process": "translate",
"port": "y"
},
"color": {
"process": "color",
"port": "value"
},
"radius": {
"process": "blur",
"port": "std-dev-x"
},
"opacity": {
"process": "opacity",
"port": "value"
},
"input": {
"process": "input",
"port": "input"
}
},
"outports": {
"output": {
"process": "over",
"port": "output"
}
}
}
INPORT=in.INPUT:INPUT
OUTPORT=out.OUTPUT:OUTPUT
INPORT=tr.HEIGHT:HEIGHT
INPORT=tr.WIDTH:WIDTH
in(gegl/nop) OUTPUT -> INPUT g(gegl/gray) OUTPUT -> INPUT tr(gegl/crop) OUTPUT -> INPUT out(gegl/nop)
{
"properties": {
"name": "gegl/json/grey2"
},
"processes": {
"in": {
"component": "gegl/nop"
},
"g": {
"component": "gegl/gray"
},
"tr": {
"component": "gegl/crop"
},
"out": {
"component": "gegl/nop"
}
},
"connections": [
{
"src": {
"process": "in",
"port": "output"
},
"tgt": {
"process": "g",
"port": "input"
}
},
{
"src": {
"process": "g",
"port": "output"
},
"tgt": {
"process": "tr",
"port": "input"
}
},
{
"src": {
"process": "tr",
"port": "output"
},
"tgt": {
"process": "out",
"port": "input"
}
}
],
"inports": {
"input": {
"process": "in",
"port": "input"
},
"height": {
"process": "tr",
"port": "height"
},
"width": {
"process": "tr",
"port": "width"
}
},
"outports": {
"output": {
"process": "out",
"port": "output"
}
}
}
...@@ -58,6 +58,7 @@ TESTS = \ ...@@ -58,6 +58,7 @@ TESTS = \
supernova.xml \ supernova.xml \
transform.xml \ transform.xml \
video-degradation.xml \ video-degradation.xml \
grey-json.xml \
weighted-blend.xml \ weighted-blend.xml \
rectangles.xml rectangles.xml
......
<?xml version='1.0' encoding='UTF-8'?>
<gegl>
<node operation='gegl:json:dropshadow2'>
<params>
<param name='radius'>10</param>
</params>
</node>
<node operation='gegl:load'>
<params>
<param name='path'>data/car-stack.png</param>
</params>
</node>
</gegl>
<?xml version='1.0' encoding='UTF-8'?>
<gegl>
<node operation='gegl:json:grey2'>
<params>
<param name='height'>200</param>
<param name='width'>100</param>
</params>
</node>
<node operation='gegl:load'>
<params>
<param name='path'>data/car-stack.png</param>
</params>
</node>
</gegl>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment