gegl r2486 - in branches/branch_zhangjb: . bin bindings/pygegl bindings/pygegl/samples bindings/rgegl bindings/rgegl/samples bindings/rgegl/src bindings/rgegl/src/lib docs examples gegl gegl/buffer gegl/graph gegl/operation gegl/process gegl/property-types operations/affine operations/common operations/core operations/external operations/generated operations/workshop operations/workshop/generated tests/buffer tests/buffer/reference tests/buffer/tests tools
- From: zhangjb svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2486 - in branches/branch_zhangjb: . bin bindings/pygegl bindings/pygegl/samples bindings/rgegl bindings/rgegl/samples bindings/rgegl/src bindings/rgegl/src/lib docs examples gegl gegl/buffer gegl/graph gegl/operation gegl/process gegl/property-types operations/affine operations/common operations/core operations/external operations/generated operations/workshop operations/workshop/generated tests/buffer tests/buffer/reference tests/buffer/tests tools
- Date: Thu, 19 Jun 2008 02:52:47 +0000 (UTC)
Author: zhangjb
Date: Thu Jun 19 02:52:46 2008
New Revision: 2486
URL: http://svn.gnome.org/viewvc/gegl?rev=2486&view=rev
Log:
Merged from the HEAD trunk.
Added:
branches/branch_zhangjb/gegl/buffer/gegl-buffer-iterator.c
- copied unchanged from r2485, /trunk/gegl/buffer/gegl-buffer-iterator.c
branches/branch_zhangjb/gegl/buffer/gegl-buffer-iterator.h
- copied unchanged from r2485, /trunk/gegl/buffer/gegl-buffer-iterator.h
branches/branch_zhangjb/gegl/buffer/gegl-buffer-linear.c
- copied unchanged from r2485, /trunk/gegl/buffer/gegl-buffer-linear.c
branches/branch_zhangjb/gegl/buffer/gegl-buffer-linear.h
- copied unchanged from r2485, /trunk/gegl/buffer/gegl-buffer-linear.h
branches/branch_zhangjb/gegl/gegl-simd.h
- copied unchanged from r2485, /trunk/gegl/gegl-simd.h
branches/branch_zhangjb/gegl/operation/gegl-operation-context.c
- copied unchanged from r2485, /trunk/gegl/operation/gegl-operation-context.c
branches/branch_zhangjb/gegl/operation/gegl-operation-context.h
- copied unchanged from r2485, /trunk/gegl/operation/gegl-operation-context.h
branches/branch_zhangjb/gegl/operation/gegl-operation-point-render.c
- copied unchanged from r2485, /trunk/gegl/operation/gegl-operation-point-render.c
branches/branch_zhangjb/gegl/operation/gegl-operation-point-render.h
- copied unchanged from r2485, /trunk/gegl/operation/gegl-operation-point-render.h
branches/branch_zhangjb/gegl/operation/gegl-operation-temporal.c
- copied unchanged from r2485, /trunk/gegl/operation/gegl-operation-temporal.c
branches/branch_zhangjb/gegl/operation/gegl-operation-temporal.h
- copied unchanged from r2485, /trunk/gegl/operation/gegl-operation-temporal.h
branches/branch_zhangjb/tests/buffer/reference/linear_from_data
- copied unchanged from r2485, /trunk/tests/buffer/reference/linear_from_data
branches/branch_zhangjb/tests/buffer/reference/linear_from_data_rows
- copied unchanged from r2485, /trunk/tests/buffer/reference/linear_from_data_rows
branches/branch_zhangjb/tests/buffer/reference/linear_modify
- copied unchanged from r2485, /trunk/tests/buffer/reference/linear_modify
branches/branch_zhangjb/tests/buffer/reference/linear_new
- copied unchanged from r2485, /trunk/tests/buffer/reference/linear_new
branches/branch_zhangjb/tests/buffer/reference/linear_proxy_modify
- copied unchanged from r2485, /trunk/tests/buffer/reference/linear_proxy_modify
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_copy_lower_left
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_copy_lower_left
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_copy_lower_right
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_copy_lower_right
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_copy_upper_left
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_copy_upper_left
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_copy_upper_right
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_copy_upper_right
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_iterator1
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_iterator1
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_iterator1sub
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_iterator1sub
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_iterator2
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_iterator2
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_iterator2sub
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_iterator2sub
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_iterator3
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_iterator3
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_iterator3sub
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_iterator3sub
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_iterator4
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_iterator4
branches/branch_zhangjb/tests/buffer/reference/test_gegl_buffer_iterator4sub
- copied unchanged from r2485, /trunk/tests/buffer/reference/test_gegl_buffer_iterator4sub
branches/branch_zhangjb/tests/buffer/tests/
- copied from r2485, /trunk/tests/buffer/tests/
Removed:
branches/branch_zhangjb/gegl/graph/gegl-node-context.c
branches/branch_zhangjb/gegl/graph/gegl-node-context.h
Modified:
branches/branch_zhangjb/ChangeLog
branches/branch_zhangjb/NEWS
branches/branch_zhangjb/bin/Makefile.am
branches/branch_zhangjb/bin/editor-optype.c
branches/branch_zhangjb/bin/editor.c
branches/branch_zhangjb/bin/gegl.c
branches/branch_zhangjb/bindings/pygegl/ChangeLog
branches/branch_zhangjb/bindings/pygegl/samples/subgraph.py
branches/branch_zhangjb/bindings/pygegl/samples/xml-parsing.py
branches/branch_zhangjb/bindings/rgegl/ChangeLog
branches/branch_zhangjb/bindings/rgegl/samples/view-test.rb
branches/branch_zhangjb/bindings/rgegl/samples/xml-parsing.rb
branches/branch_zhangjb/bindings/rgegl/src/lib/gegl-view.rb
branches/branch_zhangjb/bindings/rgegl/src/rgegl-node.c
branches/branch_zhangjb/bindings/rgegl/src/rgegl.c
branches/branch_zhangjb/configure.ac
branches/branch_zhangjb/docs/ (props changed)
branches/branch_zhangjb/docs/ChangeLog
branches/branch_zhangjb/docs/Makefile.am
branches/branch_zhangjb/docs/index-static.txt.in
branches/branch_zhangjb/examples/gegl-paint.c
branches/branch_zhangjb/gegl/Makefile.am
branches/branch_zhangjb/gegl/buffer/Makefile.am
branches/branch_zhangjb/gegl/buffer/gegl-buffer-access.c
branches/branch_zhangjb/gegl/buffer/gegl-buffer-private.h
branches/branch_zhangjb/gegl/buffer/gegl-buffer-types.h
branches/branch_zhangjb/gegl/buffer/gegl-buffer.c
branches/branch_zhangjb/gegl/buffer/gegl-buffer.h
branches/branch_zhangjb/gegl/buffer/gegl-sampler-cubic.c
branches/branch_zhangjb/gegl/buffer/gegl-sampler-lanczos.c
branches/branch_zhangjb/gegl/buffer/gegl-sampler-linear.c
branches/branch_zhangjb/gegl/buffer/gegl-sampler-nearest.c
branches/branch_zhangjb/gegl/buffer/gegl-sampler.c
branches/branch_zhangjb/gegl/buffer/gegl-sampler.h
branches/branch_zhangjb/gegl/buffer/gegl-tile-storage.c
branches/branch_zhangjb/gegl/buffer/gegl-tile.c
branches/branch_zhangjb/gegl/buffer/gegl-tile.h
branches/branch_zhangjb/gegl/gegl-chant.h
branches/branch_zhangjb/gegl/gegl-config.c
branches/branch_zhangjb/gegl/gegl-config.h
branches/branch_zhangjb/gegl/gegl-init.c
branches/branch_zhangjb/gegl/gegl-plugin.h
branches/branch_zhangjb/gegl/gegl-types.h
branches/branch_zhangjb/gegl/graph/Makefile.am
branches/branch_zhangjb/gegl/graph/gegl-node.c
branches/branch_zhangjb/gegl/graph/gegl-node.h
branches/branch_zhangjb/gegl/operation/Makefile.am
branches/branch_zhangjb/gegl/operation/gegl-operation-composer.c
branches/branch_zhangjb/gegl/operation/gegl-operation-filter.c
branches/branch_zhangjb/gegl/operation/gegl-operation-point-composer.c
branches/branch_zhangjb/gegl/operation/gegl-operation-point-composer.h
branches/branch_zhangjb/gegl/operation/gegl-operation-point-filter.c
branches/branch_zhangjb/gegl/operation/gegl-operation-point-filter.h
branches/branch_zhangjb/gegl/operation/gegl-operation-sink.c
branches/branch_zhangjb/gegl/operation/gegl-operation-sink.h
branches/branch_zhangjb/gegl/operation/gegl-operation-source.c
branches/branch_zhangjb/gegl/operation/gegl-operation.c
branches/branch_zhangjb/gegl/operation/gegl-operation.h
branches/branch_zhangjb/gegl/operation/gegl-operations.c
branches/branch_zhangjb/gegl/process/gegl-cr-visitor.c
branches/branch_zhangjb/gegl/process/gegl-debug-rect-visitor.c
branches/branch_zhangjb/gegl/process/gegl-eval-mgr.c
branches/branch_zhangjb/gegl/process/gegl-eval-visitor.c
branches/branch_zhangjb/gegl/process/gegl-prepare-visitor.c
branches/branch_zhangjb/gegl/process/gegl-processor.c
branches/branch_zhangjb/gegl/property-types/gegl-color.c
branches/branch_zhangjb/gegl/property-types/gegl-vector.c
branches/branch_zhangjb/operations/affine/affine.c
branches/branch_zhangjb/operations/affine/affine.h
branches/branch_zhangjb/operations/common/brightness-contrast.c
branches/branch_zhangjb/operations/common/checkerboard.c
branches/branch_zhangjb/operations/common/color-temperature.c
branches/branch_zhangjb/operations/common/color.c
branches/branch_zhangjb/operations/common/contrast-curve.c
branches/branch_zhangjb/operations/common/grey.c
branches/branch_zhangjb/operations/common/introspect.c
branches/branch_zhangjb/operations/common/invert.c
branches/branch_zhangjb/operations/common/levels.c
branches/branch_zhangjb/operations/common/load-buffer.c
branches/branch_zhangjb/operations/common/magick-load.c
branches/branch_zhangjb/operations/common/mblur.c
branches/branch_zhangjb/operations/common/noise.c
branches/branch_zhangjb/operations/common/opacity.c
branches/branch_zhangjb/operations/common/open-buffer.c
branches/branch_zhangjb/operations/common/raw-load.c
branches/branch_zhangjb/operations/common/remap.c
branches/branch_zhangjb/operations/common/svg-huerotate.c
branches/branch_zhangjb/operations/common/svg-luminancetoalpha.c
branches/branch_zhangjb/operations/common/svg-matrix.c
branches/branch_zhangjb/operations/common/svg-saturate.c
branches/branch_zhangjb/operations/common/threshold.c
branches/branch_zhangjb/operations/common/value-invert.c
branches/branch_zhangjb/operations/common/whitebalance.c
branches/branch_zhangjb/operations/core/clone.c
branches/branch_zhangjb/operations/core/convert-format.c
branches/branch_zhangjb/operations/core/crop.c
branches/branch_zhangjb/operations/core/nop.c
branches/branch_zhangjb/operations/core/shift.c
branches/branch_zhangjb/operations/external/text.c
branches/branch_zhangjb/operations/generated/math.rb
branches/branch_zhangjb/operations/generated/other-blend.rb
branches/branch_zhangjb/operations/generated/svg-12-blend.rb
branches/branch_zhangjb/operations/generated/svg-12-porter-duff.rb
branches/branch_zhangjb/operations/workshop/ (props changed)
branches/branch_zhangjb/operations/workshop/generated/ (props changed)
branches/branch_zhangjb/operations/workshop/rawbayer-load.c
branches/branch_zhangjb/operations/workshop/stroke.c
branches/branch_zhangjb/tests/buffer/Makefile
branches/branch_zhangjb/tests/buffer/buffer-test.c
branches/branch_zhangjb/tools/create-reference.rb
branches/branch_zhangjb/tools/operation_reference.c
Modified: branches/branch_zhangjb/NEWS
==============================================================================
--- branches/branch_zhangjb/NEWS (original)
+++ branches/branch_zhangjb/NEWS Thu Jun 19 02:52:46 2008
@@ -5,26 +5,29 @@
GEGL only has released development snapshots thus far. Odd micro versions are
from SVN whilst even micro numbers indicate released snapshots.
-Changes in GEGL 0.0.17
+Changes in GEGL 0.0.18
ââââââââââââââââââââââ
â Configuration both from commandline arguments and at runtime.
â GeglBuffer
- â Transparently sharable across processes.
- â Fileformat compatible with swap format.
- â Tunable cache size.
+ â New raw tiled raster file format, used both as swap and stored buffers.
+ â Sharing between processes through synced swap.
+ â Babl powered scan iteration infrastructure for efficient access.
+ â Cubic and lanczos samplers re-enabled.
â Operations
- â Optimized iteration over buffer in pointer filters when possible using a
- scan iterator.
- â Handle variant implementations of GeglOperations.
+ â Use scan iterator for point-filter, point-composer and point-render base
+ classes internally for minimal amount of copies.
â Optimized variants of some point and compositing operations reimplemented
- using a new data type /g4float/ that allows writing cpu agnostic vectorized
+ using a new data type /g4float/ that allows writing CPU agnostic vectorized
code for GCC.
+ â New temporal filter base class, for operations operating on color values from
+ neighbouring frames in a video stream.
+ â Autogenerated operation reference installed for use with devhelp.
â New operations: write-buffer, v4l, color-temperature.
Contributions from:
Ãyvind KolÃs, Kevin Cozens, Sven Neumann, Manish Singh, Martin Nordholts,
- Ãtienne Bersac, Hans Petter Jansson, Jan Heller, dmacs netspace org,
- Sven Anders and Hubert Figuiere.
+ Ãtienne Bersac, Hans Petter Jansson, Jan Heller, dmacks netspace org,
+ Sven Anders, Hubert Figuiere and Geert Jordaens.
Changes in GEGL 0.0.16
ââââââââââââââââââââââ
Modified: branches/branch_zhangjb/bin/Makefile.am
==============================================================================
--- branches/branch_zhangjb/bin/Makefile.am (original)
+++ branches/branch_zhangjb/bin/Makefile.am Thu Jun 19 02:52:46 2008
@@ -15,7 +15,6 @@
editor-optype.h \
export.c \
export.h \
- gegl-bin-types.h \
gegl-bin-gui-types.h \
gegl-node-editor.c \
gegl-node-editor.h \
Modified: branches/branch_zhangjb/bin/editor-optype.c
==============================================================================
--- branches/branch_zhangjb/bin/editor-optype.c (original)
+++ branches/branch_zhangjb/bin/editor-optype.c Thu Jun 19 02:52:46 2008
@@ -61,7 +61,9 @@
static void
chain_in_operation (const gchar *op_type)
{
+ GtkWidget *widget = editor.structure;
gegl_add_sibling (op_type);
+ gtk_widget_show (widget);
}
static void
@@ -394,6 +396,8 @@
hbox = gtk_hbox_new (FALSE, 5);
if (col1) label = gtk_label_new ("operation");
+ else
+ label = gtk_label_new ("add:");
hbox2 = gtk_hbox_new (FALSE, 0);
entry = gtk_entry_new ();
if (!col1)
@@ -411,7 +415,7 @@
}
else
{
- current_type = g_strdup ("Enter action here");
+ current_type = g_strdup ("Type a GEGL operation, or examine to dropdown menu to the right");
}
if (label) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@@ -419,7 +423,7 @@
gtk_box_pack_start (GTK_BOX (hbox2), entry, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (button), button_arrow);
- if (label)
+ if (label && col1)
{
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_size_group_add_widget (col1, label);
Modified: branches/branch_zhangjb/bin/editor.c
==============================================================================
--- branches/branch_zhangjb/bin/editor.c (original)
+++ branches/branch_zhangjb/bin/editor.c Thu Jun 19 02:52:46 2008
@@ -34,7 +34,6 @@
#include "gegl-store.h"
#include "gegl-tree-editor.h"
#include "gegl-view.h"
-#include "gegl-view.h"
#include "editor.h"
Modified: branches/branch_zhangjb/bin/gegl.c
==============================================================================
--- branches/branch_zhangjb/bin/gegl.c (original)
+++ branches/branch_zhangjb/bin/gegl.c Thu Jun 19 02:52:46 2008
@@ -48,8 +48,7 @@
#endif
#define DEFAULT_COMPOSITION \
-"<?xml version='1.0' encoding='UTF-8'?> <gegl> <node operation='crop'> <params> <param name='x'>0</param> <param name='y'>0</param> <param name='width'>512</param> <param name='height'>400</param> </params> </node> <node operation='over'> <node name='dropshadow' operation='dropshadow'> <params> <param name='opacity'>-8</param> <param name='x'>3.75</param> <param name='y'>2.5</param> <param name='radius'>8</param> </params> </node> <node operation='shift'> <params> <param name='x'>24</param> <param name='y'>80</param> </params> </node> <node operation='text'> <params> <param name='string'>GEGL</param> <param name='font'>Sans</param> <param name='size'>76.037999999999997</param> <param name='color'>rgb(1.0000, 0.9421, 0.0000)</param> <param name='wrap'>-1</param> <param name='alignment'>0</param> <param name='width'>208</param> <param name='height'>89</param> </params> </node> </node> <node operation='over'> <node operation='shift'> <params> <param name='x'>30</param> <param n
ame='y'>180</param> </params> </node> <node operation='text'> <params> <param name='string'>A graph based image processing and compositing engine.</param> <param name='font'>Sans</param> <param name='size'>14</param>" \
-"<param name='color'>rgb(1.0000, 1.0000, 1.0000)</param> <param name='wrap'>500</param> <param name='alignment'>0</param> <param name='width'>402</param> <param name='height'>17</param> </params> </node> </node> <node operation='over'> <node operation='shift'> <params> <param name='x'>30</param> <param name='y'>216</param> </params> </node> <node name='text' operation='text'> <params> <param name='string'>2000-2008 Â Calvin Williamson, Caroline Dahloff, Manish Singh, Jay Cox, Daniel Rogers, Sven Neumann, Michael Natterer, Ãyvind KolÃs, Philip Lafleur, Dominik Ernst, Richard Kralovic, Kevin Cozens, Victor Bogado, Martin Nordholts, Geert Jordaens, Michael Schumacher, John Marshall, Ãtienne Bersac, Mark Probst, HÃkon Hitland, Tor Lillqvist, Hans Breuer, Deji Akingunola, Bradley Broom, Garry R. Osgood, Shlomi Fish and Jakub Steiner</param> <param name='font'>Sans</param> <param name='size'>13</param> <param name='color'>rgba(0.4513, 0.4160, 0.0000, 0.5412)</param> <param n
ame='wrap'>440</param> <param name='alignment'>0</param> <param name='width'>436</param> <param name='height'>119</param> </params> </node> </node> <node operation='whitebalance'> <params> <param name='high-a-delta'>0.36499999999999999</param> <param name='high-b-delta'>0.027</param> <param name='low-a-delta'>0</param> <param name='low-b-delta'>0</param> <param name='saturation'>0.32000000000000001</param> </params> </node> <node operation='fractal-explorer'> <params> <param name='width'>512</param> <param name='height'>400</param> <param name='fractaltype'>4</param> <param name='xmin'>-0.20000000000000001</param> <param name='xmax'>1</param> <param name='ymin'>0.20000000000000001</param> <param name='ymax'>-0.29999999999999999</param> <param name='iter'>10</param> <param name='cx'>-0.81999999999999995</param> <param name='cy'>0.19500000000000001</param> <param name='redstretch'>0.10000000000000001</param> <param name='greenstretch'>0.10000000000000001</param>" " <param name
='bluestretch'>1</param> <param name='redmode'>1</param> <param name='greenmode'>1</param> <param name='bluemode'>0</param> <param name='redinvert'>false</param> <param name='greeninvert'>false</param> <param name='blueinvert'>true</param> <param name='ncolors'>16</param> <param name='useloglog'>false</param> </params> </node> </gegl>"
+"<?xml version='1.0' encoding='UTF-8'?> <gegl> <node operation='crop'> <params> <param name='x'>0</param> <param name='y'>0</param> <param name='width'>512</param> <param name='height'>288</param> </params> </node> <node operation='over'> <node name='dropshadow' operation='dropshadow'> <params> <param name='opacity'>2</param> <param name='x'>3.75</param> <param name='y'>2.5</param> <param name='radius'>8</param> </params> </node> <node operation='shift'> <params> <param name='x'>190</param> <param name='y'>70</param> </params> </node> <node operation='text'> <params> <param name='string'>GEGL</param> <param name='font'>Sans</param> <param name='size'>76.037999999999997</param> <param name='color'>rgb(1.0000, 0.9421, 0.0000)</param> <param name='wrap'>-1</param> <param name='alignment'>0</param> <param name='width'>208</param> <param name='height'>89</param> </params> </node> </node> <node operation='over'> <node operation='shift'> <params> <param name='x'>160</param> <param
name='y'>170</param> </params> </node> <node operation='text'> <params> <param name='string'>A graph based image processing and compositing engine.</param> <param name='font'>Sans</param> <param name='size'>11</param> <param name='color'>rgb(1.0000, 1.0000, 1.0000)</param> <param name='wrap'>500</param> <param name='alignment'>0</param> <param name='width'>402</param> <param name='height'>17</param> </params> </node> </node> <node operation='over'> <node operation='shift'> <params> <param name='x'>20</param> <param name='y'>210</param> </params> </node> <opacity value='0.1'/><node name='text' operation='text'> <params> <param name='string'>2000-2008 Â Calvin Williamson, Caroline Dahloff, Manish Singh, Jay Cox, Daniel Rogers, Sven Neumann, Michael Natterer, Ãyvind KolÃs, Philip Lafleur, Dominik Ernst, Richard Kralovic, Kevin Cozens, Victor Bogado, Martin Nordholts, Geert Jordaens, Michael Schumacher, John Marshall, Ãtienne Bersac, Mark Probst, HÃkon Hitland, Tor Lillqvi
st, Hans Breuer, Deji Akingunola, Bradley Broom, Hans Petter Jansson, Jan Heller, dmacks netspace org, Sven Anders, Huber Figuiere, Garry R. Osgood, Shlomi Fish and Jakub Steiner</param> <param name='font'>Sans</param> <param name='size'>9</param> <param name='color'>rgba(0.8313, 1.0000, 1.0000, 1.0000)</param> <param name='wrap'>480</param> <param name='alignment'>0</param> <param name='width'>355</param> <param name='height'>70</param> </params> </node> </node> <node operation='whitebalance'> <params> <param name='high-a-delta'>0.16500000000000001</param> <param name='high-b-delta'>0.20000000000000001</param> <param name='low-a-delta'>0</param> <param name='low-b-delta'>0</param> <param name='saturation'>0.29999999999999999</param> </params> </node> <node operation='translate'> <params> <param name='origin-x'>0</param> <param name='origin-y'>0</param> <param name='filter'>linear</param> <param name='hard-edges'>false</param> <param name='lanczos-width'>3</param> <param nam
e='x'>-150</param> <param name='y'>1</param> </params> </node> <node operation='rotate'> <params> <param name='origin-x'>0</param> <param name='origin-y'>0</param> <param name='filter'>linear</param> <param name='hard-edges'>false</param> <param name='lanczos-width'>3</param> <param name='degrees'>20</param> </params> </node> <gaussian-blur std-dev-x='80' std-dev-y='0.5' /><node operation='fractal-explorer'> <params> <param name='width'>650</param> <param name='height'>600</param> <param name='fractaltype'>1</param> <param name='xmin'>-1</param> <param name='xmax'>1</param> <param name='ymin'>-1</param> <param name='ymax'>1</param> <param name='iter'>10</param> <param name='cx'>-0.81999999999999995</param> <param name='cy'>0.19500000000000001</param> <param name='redstretch'>0.10000000000000001</param> <param name='greenstretch'>0.10000000000000001</param> <param name='bluestretch'>1</param> <param name='redmode'>1</param> <param name='greenmode'>1</param> <param name='bluem
ode'>0</param> <param name='redinvert'>false</param> <param name='greeninvert'>false</param> <param name='blueinvert'>true</param> <param name='ncolors'>16</param> <param name='useloglog'>false</param> </params> </node> </gegl>"
/******************/
Modified: branches/branch_zhangjb/bindings/pygegl/samples/subgraph.py
==============================================================================
--- branches/branch_zhangjb/bindings/pygegl/samples/subgraph.py (original)
+++ branches/branch_zhangjb/bindings/pygegl/samples/subgraph.py Thu Jun 19 02:52:46 2008
@@ -8,7 +8,7 @@
gegl = Gegl.Node() # create a new GEGL graph
-fractal = gegl.new_child("FractalExplorer")
+fractal = gegl.new_child("fractal-explorer")
unsharp = gegl.new_child("unsharp-mask")
Modified: branches/branch_zhangjb/bindings/pygegl/samples/xml-parsing.py
==============================================================================
--- branches/branch_zhangjb/bindings/pygegl/samples/xml-parsing.py (original)
+++ branches/branch_zhangjb/bindings/pygegl/samples/xml-parsing.py Thu Jun 19 02:52:46 2008
@@ -10,20 +10,29 @@
<gegl>
<crop x='0' y='145' width='400' height='200'/>
<over>
- <gaussian-blur std_dev_y='0' name='blur'/>
- <shift x='20' y='170' name='shift'/>
+ <translate x='20' y='170' name='translate'/>
+ <gaussian-blur std_dev_x='10' std_dev_y='0' name='blur'/>
<text string='pygegl' size='110' color='rgb(0.5,0.5,1.0)'/>
</over>
- <FractalExplorer xmin='0.2' ymin='0' xmax='0.5' ymax='0.45'
- width='400' height='400'/>
+ <fractal-explorer xmin='0.2' ymin='0' xmax='0.5' ymax='0.45'
+ width='400' height='400'/>
</gegl>
""")
display = gegl.new_child("display")
gegl >> display
-frames = 10
+frames=30
for frame in range(frames):
- gegl.lookup("blur").std_dev_x = (frames-frame)*3.0 # animate the composition
- gegl.lookup("shift").y = 20*frame #
+ gegl.lookup("translate").y = (frame*1.0)/frames*200.0 #
+ display.process()
+
+frames=10
+for frame in range(frames):
+ gegl.lookup("blur").std_dev_x = (1.0-((frame*1.0)/frames))*10.0 # animate the composition
+ display.process()
+
+frames=10
+for frame in range(frames):
+ gegl.lookup("translate").y = 200+(frame*1.0)/frames*200.0 #
display.process()
Modified: branches/branch_zhangjb/bindings/rgegl/samples/view-test.rb
==============================================================================
--- branches/branch_zhangjb/bindings/rgegl/samples/view-test.rb (original)
+++ branches/branch_zhangjb/bindings/rgegl/samples/view-test.rb Thu Jun 19 02:52:46 2008
@@ -13,7 +13,7 @@
<shift x='20' y='170' name='shift'/>
<text string='rgegl' size='120' color='rgb(0.5,0.5,1.0)'/>
</over>
- <FractalExplorer xmin='0.2' ymin='0' xmax='0.5' ymax='0.45'
+ <fractal-explorer xmin='0.2' ymin='0' xmax='0.5' ymax='0.45'
width='400' height='400'/>
</gegl>", "")
Modified: branches/branch_zhangjb/bindings/rgegl/samples/xml-parsing.rb
==============================================================================
--- branches/branch_zhangjb/bindings/rgegl/samples/xml-parsing.rb (original)
+++ branches/branch_zhangjb/bindings/rgegl/samples/xml-parsing.rb Thu Jun 19 02:52:46 2008
@@ -8,22 +8,24 @@
gegl=Gegl.parse_xml(
"<gegl>
- <crop x='0' y='145' width='400' height='200'/>
+ <crop x='0' y='145' width='320' height='240'/>
<over>
<gaussian-blur std_dev_y='0' name='blur'/>
<shift x='20' y='170' name='shift'/>
<text string='rgegl' size='120' color='rgb(0.5,0.5,1.0)'/>
</over>
- <FractalExplorer xmin='0.2' ymin='0' xmax='0.5' ymax='0.45'
- width='400' height='400'/>
+ <fractal-explorer xmin='0.2' ymin='0' xmax='0.5' ymax='0.45'
+ width='320' height='400'/>
</gegl>", "")
display = gegl.new_child :display
gegl >> display
-frames=10
+frames=50
frames.times do |frame|
- gegl.lookup("blur").std_dev_x = (frames-frame)*3.0 # animate the composition
- gegl.lookup("shift").y = 20*frame #
+ t = 1.0*frame/frames
+ puts t
+# gegl.lookup("blur").std_dev_x = t * 20.0
+ gegl.lookup("shift").y = t * 200
display.process
end
Modified: branches/branch_zhangjb/bindings/rgegl/src/lib/gegl-view.rb
==============================================================================
--- branches/branch_zhangjb/bindings/rgegl/src/lib/gegl-view.rb (original)
+++ branches/branch_zhangjb/bindings/rgegl/src/lib/gegl-view.rb Thu Jun 19 02:52:46 2008
@@ -20,16 +20,17 @@
signal_connect("expose-event") { |view, event|
if @node!=nil
event.region.rectangles.each { |rect|
- roi = Gegl::Rectangle.new(view.x + rect.x/view.scale,
- view.y + rect.y/view.scale,
- rect.width, rect.height)
+ roi = Gegl::Rectangle.new(view.x / view.scale + rect.x,
+ view.y / view.scale + rect.y,
+ rect.width,
+ rect.height)
buf = view.node.render(roi, view.scale, "R'G'B' u8", 3)
Gdk::RGB.draw_rgb_image(view.window,
view.style.black_gc,
rect.x, rect.y,
rect.width, rect.height,
- 0, buf, rect.width*3)
+ 0, buf, roi.width*3)
}
end
repaint
@@ -44,7 +45,7 @@
self.processor.rectangle=roi
if @handler==nil
- @handler=GLib::Idle.add(200){ #refresh view twice a second
+ @handler=GLib::Idle.add(100){ #refresh view twice a second
more=self.processor.work # returns true if there is more work
@handler=nil if !more
more
@@ -83,12 +84,12 @@
@node=new_node
@node.signal_connect("computed") {|node, rectangle|
- rectangle.x = self.scale * (rectangle.x - self.x)
- rectangle.y = self.scale * (rectangle.y - self.y)
- rectangle.width = (rectangle.width * self.scale).ceil
- rectangle.height = (rectangle.height * self.scale).ceil
- self.queue_draw_area(rectangle.x, rectangle.y, rectangle.width, rectangle.height)
+ self.queue_draw_area(
+ self.scale * (rectangle.x - self.x),
+ self.scale * (rectangle.y - self.y),
+ (rectangle.width * self.scale).ceil,
+ (rectangle.height * self.scale).ceil)
}
@node.signal_connect("invalidated") {|node, event|
repaint
Modified: branches/branch_zhangjb/bindings/rgegl/src/rgegl-node.c
==============================================================================
--- branches/branch_zhangjb/bindings/rgegl/src/rgegl-node.c (original)
+++ branches/branch_zhangjb/bindings/rgegl/src/rgegl-node.c Thu Jun 19 02:52:46 2008
@@ -415,12 +415,14 @@
c_gegl_init (self)
VALUE self;
{
+ /*
static gboolean inited=FALSE;
if (!inited)
{
gegl_init (NULL, NULL);
inited = TRUE;
}
+ */
return Qnil;
}
Modified: branches/branch_zhangjb/bindings/rgegl/src/rgegl.c
==============================================================================
--- branches/branch_zhangjb/bindings/rgegl/src/rgegl.c (original)
+++ branches/branch_zhangjb/bindings/rgegl/src/rgegl.c Thu Jun 19 02:52:46 2008
@@ -24,6 +24,13 @@
{
VALUE mGegl = rb_define_module("Gegl");
+ static gboolean inited=FALSE;
+ if (!inited)
+ {
+ gegl_init (NULL, NULL);
+ inited = TRUE;
+ }
+
Init_gegl_color(mGegl);
Init_gegl_node(mGegl);
Init_gegl_processor(mGegl);
Modified: branches/branch_zhangjb/configure.ac
==============================================================================
--- branches/branch_zhangjb/configure.ac (original)
+++ branches/branch_zhangjb/configure.ac Thu Jun 19 02:52:46 2008
@@ -14,7 +14,7 @@
m4_define([gegl_major_version], [0])
m4_define([gegl_minor_version], [0])
-m4_define([gegl_micro_version], [17])
+m4_define([gegl_micro_version], [19])
m4_define([gegl_real_version],
[gegl_major_version.gegl_minor_version.gegl_micro_version])
m4_define([gegl_version], [gegl_real_version])
@@ -38,7 +38,7 @@
m4_define([gimp_full_name], [Generic Graphical Library])
# required versions of external libraries
-m4_define([babl_required_version], [0.0.20])
+m4_define([babl_required_version], [0.0.22])
m4_define([glib_required_version], [2.12.0])
m4_define([gtk_required_version], [2.8.6])
m4_define([lua_required_version], [5.1.0])
@@ -492,18 +492,20 @@
# Disable deprecated APIs
#########################
-AC_MSG_CHECKING([if GLib is version 2.15.0 or newer])
-if $PKG_CONFIG --atleast-version=2.15.0 glib-2.0; then
- have_glib_2_15=yes
+AC_MSG_CHECKING([if GLib is version 2.17.0 or newer])
+if $PKG_CONFIG --atleast-version=2.17.0 glib-2.0; then
+ have_glib_2_17=yes
else
- have_glib_2_15=no
+ have_glib_2_17=no
fi
-AC_MSG_RESULT($have_glib_2_15)
+AC_MSG_RESULT($have_glib_2_17)
-if test "x$have_glib_2_15" != "xyes"; then
+if test "x$have_glib_2_17" != "xyes"; then
CPPFLAGS="${CPPFLAGS} -DG_DISABLE_DEPRECATED"
fi
+CPPFLAGS="${CPPFLAGS} -DG_DISABLE_SINGLE_INCLUDES"
+
######################################
# Checks for gtk-doc and docbook-tools
Modified: branches/branch_zhangjb/docs/Makefile.am
==============================================================================
--- branches/branch_zhangjb/docs/Makefile.am (original)
+++ branches/branch_zhangjb/docs/Makefile.am Thu Jun 19 02:52:46 2008
@@ -15,11 +15,25 @@
HTML_FILES += api.html
endif
+# dummy target to force the operations be available for scanning when
+# creating the docbook index when doing parallel builds.
+api.html: operations.html
+
if HAVE_ENSCRIPT
ENSCRIPT_FILES = \
brightness-contrast.c.html \
gegl.h.html \
gegl-operation.h.html \
+ gegl-operation-filter.h.html \
+ gegl-operation-composer.h.html \
+ gegl-operation-area-filter.h.html \
+ gegl-operation-meta.h.html \
+ gegl-operation-point-composer.h.html \
+ gegl-operation-point-filter.h.html \
+ gegl-operation-point-render.h.html \
+ gegl-operation-temporal.h.html \
+ gegl-operation-sink.h.html \
+ gegl-operation-source.h.html \
gegl-plugin.h.html
HTML_FILES += $(ENSCRIPT_FILES)
@@ -58,17 +72,60 @@
$(ENSCRIPT) -E --color --language=html -p$@ $<
endif
-gegl-operation.h.html: $(top_srcdir)/gegl/operation/gegl-operation.h
+
+gegl-plugin.h.html: $(top_srcdir)/gegl/gegl-plugin.h
if HAVE_ENSCRIPT
$(ENSCRIPT) -E --color --language=html -p$@ $<
endif
-gegl-plugin.h.html: $(top_srcdir)/gegl/gegl-plugin.h
+brightness-contrast.c.html: $(top_srcdir)/operations/common/brightness-contrast.c
if HAVE_ENSCRIPT
$(ENSCRIPT) -E --color --language=html -p$@ $<
endif
-brightness-contrast.c.html: $(top_srcdir)/operations/common/brightness-contrast.c
+
+gegl-operation.h.html: $(top_srcdir)/gegl/operation/gegl-operation.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+
+gegl-operation-composer.h.html: $(top_srcdir)/gegl/operation/gegl-operation-composer.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-area-filter.h.html: $(top_srcdir)/gegl/operation/gegl-operation-area-filter.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-filter.h.html: $(top_srcdir)/gegl/operation/gegl-operation-filter.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-meta.h.html: $(top_srcdir)/gegl/operation/gegl-operation-meta.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-point-composer.h.html: $(top_srcdir)/gegl/operation/gegl-operation-point-composer.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-temporal.h.html: $(top_srcdir)/gegl/operation/gegl-operation-temporal.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-point-filter.h.html: $(top_srcdir)/gegl/operation/gegl-operation-point-filter.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-point-render.h.html: $(top_srcdir)/gegl/operation/gegl-operation-point-render.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-sink.h.html: $(top_srcdir)/gegl/operation/gegl-operation-sink.h
+if HAVE_ENSCRIPT
+ $(ENSCRIPT) -E --color --language=html -p$@ $<
+endif
+gegl-operation-source.h.html: $(top_srcdir)/gegl/operation/gegl-operation-source.h
if HAVE_ENSCRIPT
$(ENSCRIPT) -E --color --language=html -p$@ $<
endif
@@ -100,6 +157,13 @@
@false
endif
+clean-local:
+ if test $(srcdir) = .; then :; else \
+ rm -f gegl.devhelp; \
+ fi
+
+
+
distclean-local:
if test $(srcdir) = .; then :; else \
rm -f $(BUILT_EXTRA_DIST); \
@@ -112,6 +176,16 @@
$(INSTALL) $(srcdir)/brightness-contrast.c.html \
$(srcdir)/gegl.h.html \
$(srcdir)/gegl-operation.h.html \
+ $(srcdir)/gegl-operation-filter.h.html \
+ $(srcdir)/gegl-operation-composer.h.html \
+ $(srcdir)/gegl-operation-area-filter.h.html \
+ $(srcdir)/gegl-operation-meta.h.html \
+ $(srcdir)/gegl-operation-point-composer.h.html \
+ $(srcdir)/gegl-operation-point-filter.h.html \
+ $(srcdir)/gegl-operation-point-render.h.html \
+ $(srcdir)/gegl-operation-sink.h.html \
+ $(srcdir)/gegl-operation-temporal.h.html \
+ $(srcdir)/gegl-operation-source.h.html \
$(srcdir)/gegl-plugin.h.html $(help_dir)
endif
if HAVE_RUBY
@@ -123,7 +197,17 @@
uninstall-local:
if HAVE_ENSCRIPT
rm -f $(help_dir)/brightness-contrast.c.html $(help_dir)/gegl.h.html
- rm -f $(help_dir)/gegl-operation.h.html $(help_dir)/gegl-plugin.h.html
+ rm -f $(help_dir)/gegl-operation.h.html $(help_dir)/gegl-plugin.h.html \
+ $(help_dir)/gegl-operation-filter.h.html \
+ $(help_dir)/gegl-operation-composer.h.html \
+ $(help_dir)/gegl-operation-area-filter.h.html \
+ $(help_dir)/gegl-operation-meta.h.html \
+ $(help_dir)/gegl-operation-temporal.h.html \
+ $(help_dir)/gegl-operation-point-composer.h.html \
+ $(help_dir)/gegl-operation-point-filter.h.html \
+ $(help_dir)/gegl-operation-point-render.h.html \
+ $(help_dir)/gegl-operation-sink.h.html \
+ $(help_dir)/gegl-operation-source.h.html
endif
if HAVE_RUBY
rm -f $(help_dir)/api.html
Modified: branches/branch_zhangjb/docs/index-static.txt.in
==============================================================================
--- branches/branch_zhangjb/docs/index-static.txt.in (original)
+++ branches/branch_zhangjb/docs/index-static.txt.in Thu Jun 19 02:52:46 2008
@@ -7,39 +7,30 @@
----
GEGL (Generic Graphics Library) is a graph based image processing framework.
-GEGL is a raster compositing and processing core. It provides a framework for
-organizing operations into nodes in a graph that can contain cached states to
-improve re-render performance. It currently implements a set of 32bit floating
-point buffer operations for filters, video frame loading, file loading, pattern
-generation, webcam input. As well as operations for storing individual frames,
-generate video sequences or displaying the result in fullscreen.
-
-GEGL's original design was made to scratch http://www.gimp.org/[GIMP]'s itches
-for a new compositing and processing core. This core is being designed to have
-minimal dependencies. and a simple well defined API.
-
+GEGL provides infratructure to do demand based cached non destructive image
+editing on larger than RAM buffers. Through link:http://gegl.org/babl/[babl]
+it provides support for a wide range of color models and pixel storage formats
+for input and output.
[[features]]
Features
~~~~~~~~
- - Output in RGB, CIE Lab and Y'CbCr color models with 8bit, 16bit integer and
- 32bit floating point per component. Possible to extend to ICC managed
- output in http://gegl.org/babl/[babl].
- - Non destructive editing
- - C, http://gegl.org/gegl-sharp/[C#], http://gegl.org/pygegl/[Python] and
- http://gegl.org/rgegl/[Ruby] interfaces.
- - Extendable through plug-ins.
- - XML serialization format (not-finalized)
- - Iterative processing.
- - Efficient subregion evaluation.
- - Per node caches.
- - Processing and display of image buffers larger than RAM
- - Internal sparse pyramidial render cache.
- - Bounding box based hit detection.
- - Rich core set of processing operations that operates in
- http://en.wikipedia.org/wiki/ScRGB_color_space[scRGB] (32bit linear
- light RGBA)
- * PNG, JPEG, SVG, EXR, RAW, ffmpeg and other image sources.
+ - Floating point handling and processing and output of larger 8bit, 16bit
+ integer and 32bit floating point per component buffers larger than RAM.
+ - C, http://gegl.org/gegl-vala[vala], http://gegl.org/gegl-sharp/[C#], http://
+ http://gegl.org/pygegl/[Python] and http://gegl.org/rgegl/[Ruby] interfaces
+ using a consistent DOM like graph API to manage processing graphs.
+ - Processing
+ * Iterative chunk-wise processing.
+ * Processes subregions and dependencies.
+ * Subgraph caches to aid non destructive editing performance.
+ - link:api.html#GeglBuffer[GeglBuffer]
+ * Storage of all babl supported formats.
+ * Tiled sparse buffers (larger than RAM images).
+ * On demand tiled mipmapping.
+ * inter process shared storage
+ - Operations
+ * PNG, JPEG, SVG, EXR, RAW, ffmpeg, v4l and other image sources.
* link:operations.html#cat_render[Pattern renderers]
* link:operations.html#math[Arithmetic operations]
* link_operations.html#porter_duff[porter duff compositing]
@@ -48,6 +39,11 @@
mask.
* link:operations.html#cat_color[Color correction].
* Text rendering using cairo and http://pango.org/[pango].
+ * Most operations operates in
+ http://en.wikipedia.org/wiki/ScRGB_color_space[scRGB] (using 32bit
+ linear light RGBA)
+ - Bounding box based hit detection.
+ - XML serialization format (not-finalized)
News
~~~~
@@ -102,8 +98,10 @@
Contributors
~~~~~~~~~~~~
-Multiple people have contributed to GEGL over time the following lists are are
-ordered chronologically according to when they are mentioned in the ChangeLog.
+Multiple people have contributed to GEGL
+http://www.ohloh.net/projects/4349/analyses/latest[over time] the following
+lists are are ordered chronologically according to when they are mentioned in
+the ChangeLog.
include::../AUTHORS[]
@@ -111,8 +109,8 @@
Building from source
--------------------
-GEGL and it's dependencies are known to work on Linux based systems, windows with msys/mingw,
-and probably other platforms.
+GEGL and it's dependencies are known to work on Linux based systems, windows
+with msys/mingw, and probably other platforms.
Download
~~~~~~~~
@@ -129,16 +127,17 @@
Dependencies
~~~~~~~~~~~~
-GEGL is currently building on linux, the build enviroment probably needs some
-fixes before all of it builds gracefully on many platforms. If building from
-a subversion checkout you need to have ruby installed.
+GEGL currently builds and works on linux, win32 and OSX most probably also on
+other systems where glib and gtk+ work.
- Core
- * glib (including gobject, and gmodule) 2.10 or newer, which provides
+ * glib (including gobject, and gmodule) 2.12 or newer, which provides
inheritance, dynamic modules, common algorithms and data structures for
C programming.
- * http://gegl.org/babl/[babl] 0.0.14 or newer (for pixel-format agnostisism).
+ * http://gegl.org/babl/[babl] 0.0.22 or newer (for pixel-format
+ agnostisism).
* libpng (png load/export ops, and image magick fallback import)
+ * ruby (only if building from svn)
- GUI (sandbox for testing ops and the API)
* GTK+
- Optional dependencies for operations.
@@ -148,7 +147,7 @@
* cairo, pango (text source op)
* avcodec, avformat (ff-load and experimental ff-save)
* librsvg (svg loader)
- - Documentation
+ - Documentation (this document)
* asciidoc
Compiling
@@ -174,32 +173,40 @@
Public API
~~~~~~~~~~
-The link:api.html[public API] is the API used for creating things with GEGL,
-this API does not change much at all and is also the API provided by language
-bindings. To make the public API available when compiling a .c file add
-#include <link:gegl.h.html[gegl.h]>, compile and link with the flags provided
-by pkg-config and you should be all set. When you are comfortable with the
-public API, or are using GEGL in some project looking at the
-link:operations.html[Operation reference] might be useful.
+The link:api.html[public API reference] documents the API used for creating
+things with GEGL, this API does not change much at all and is also the API
+provided by language bindings. To make the public API available when compiling
+a .c file add #include <link:gegl.h.html[gegl.h]>, compile and link with the
+flags provided by pkg-config and you should be all set. When you are
+comfortable with the public API, or are using GEGL in some project looking at
+the link:operations.html[Operation reference] might be useful.
+
+The public API also includes link:api.html#GeglBuffer[GeglBuffer], a flexible
+tiled and linear raster buffer storage system.
Bindings
^^^^^^^^
The bindings for use of GEGL in other programming languages than C are
co-hosted with GEGL in GNOME subversion but are not part of the regular GEGL
distribution. The following language bindings are currently available:
-link:rgegl/index.html[ruby], link:pygegl/index.html[python]:: and
-link:gegl-sharp/index.html[C#/Mono].
+
+http://gegl.org/gegl-vala[vala], http://gegl.org/gegl-sharp/[C#], http://
+http://gegl.org/pygegl/[Python] and http://gegl.org/rgegl/[Ruby].
+
Hello world
^^^^^^^^^^^
-This is a small sample GEGL application that animates a zoom on a mandelbrot
-fractal
+The follwing is a small sample GEGL application that animates a zoom on a
+mandelbrot fractal compile it with:
+
+ $ gcc hello-world.c `pkg-config --libs --cflags gegl` -o hello-world
+
+This example and others can be found in the examples subdir of the GEGL distribution.
---------------------------
sys::[cat ../examples/hello-world.c]
---------------------------
- $ gcc hello-world.c `pkg-config --libs --cflags gegl` -o hello-world
Operation API
@@ -215,10 +222,10 @@
The base operation class, which all the other base classes are derived
from, deriving from this is often quite a bit of work and is encouraged
only when your operation doesn't fit into any of the other categories
- GeglOperationFilter::
+link:gegl-operation-filter.h.html[GeglOperationFilter]::
The filter base class sets up GeglBuffers for input and output pads
- GeglOperationPointFilter::
+link:gegl-operation-point-filter.h.html[GeglOperationPointFilter]::
The point-filter base class is for filters where an output pixel only
depends on the color and alpha values of the corresponding input pixel.
This allows you to do the processing on linear buffers, in the future
@@ -226,29 +233,35 @@
speed increases due to more intelligent processing possible in the point
filter class
- GeglOperationAreaFilter::
+link:gegl-operation-area-filter.h.html[GeglOperationAreaFilter]::
The AreaFilter base class allows defining operations where the output data
depends on a neighbourhood with an input window that extends beyond the
output window, the information about needed extra pixels in different
directions should be set up in the prepare callback for the operation.
- GeglOperationComposer::
+link:gegl-operation-composer.h.html[GeglOperationComposer]::
Composer operations are operations that take two inputs named 'input' and
'aux' and writes their output to the output pad 'output'
- GeglOperationPointComposer::
+link:gegl-operation-point-composer.h.html[GeglOperationPointComposer]::
A baseclass for composer functions where the output pixels values depends
only on the values of the single corresponding input and aux pixels.
- GeglOperationSource::
+link:gegl-operation-source.h.html[GeglOperationSource]::
Operations used as render sources or file loaders, the process method
receives a GeglBuffer to write it's output into
- GeglOperationSink::
+link:gegl-operation-sink.h.html[GeglOperationSink]::
An operation that consumes a GeglBuffer, used for filewriters, display (for
the sdl display node)
- GeglOperationMeta::
+link:gegl-operation-temporal.h.html[GeglOperationTemporal]::
+ Base class for operations that want access to previous frames in a video
+ sequence, it contains API to configure the amounts of frames to store as
+ well as getting a GeglBuffer pointing to any of the previously stored
+ frames.
+
+link:gegl-operation-meta.h.html[GeglOperationMeta]::
Used for GEGL operations that are implemented as a sub-graph, at the moment
these are defined as C files but should in the future be possible to
declare as XML instead.
@@ -257,12 +270,8 @@
approximatly what you already need. Copy it to a new .c source file, and
replace the occurences of the filename (operation name in the source.)
-Most of the operations try to trim down the amount of needed GObject boilerplate
-and provides a chanting framework creating with the C preprocessor that makes defining
-introspectable typed and documented properties easy.
-
-Take a look at link:brightness-contrast.c.html[the brightness contrast operation] for
-a simple point operation well sprinkled with comments.
+Take a look at link:brightness-contrast.c.html[the brightness contrast
+operation] for a point operation well sprinkled with comments as a starting point.
//XML data model
//~~~~~~~~~~~~~~
@@ -281,26 +290,39 @@
Environment
~~~~~~~~~~~
-Some environment variables can be set to alter how GEGL runs, this list might
-not be exhaustive but it should list the most useful ones.
-
+Some environment variables can be set to alter how GEGL runs, all of these
+options are also available as properties on a singleton GObject returned from
+gegl_config ().
+
+GEGL_QUALITY::
+ A value between 0.0 and 1.0 indicating a trade-off between quality and
+ speed. Defaults to 1.0 (max quality).
+BABL_TOLERANCE::
+ The amount of error that babl tolerates, set it to for instance 0.1 to use
+ some conversions that trade some quality for speed.
+GEGL_CHUNK_SIZE::
+ The number of pixels processed simulatnously.
+GEGL_TILE_SIZE::
+ The tile size used internally by GEGL, defaults to 128x64
+GEGL_SWAP::
+ The directory where temporary swap files are written, if not specified GEGL
+ will not swap to disk. Be aware that swapping to disk is still experimental
+ and GEGL is currently not removing the per process swap files.
+GEGL_CACHE_SIZE::
+ The size of the tile cache used by GeglBuffer specified in megabytes.
+GEGL_DEBUG::
+ set it to "all" to enable all debugging, more specific domains for
+ debugging information are also available.
BABL_STATS::
When set babl will write a html file (/tmp/babl-stats.html) containing a
matrix of used conversions, as well as all existing conversions and which
optimized paths are followed.
-BABL_ERROR::
- The amount of error that babl tolerates, set it to for instance 0.1 to use
- some conversions that trade some quality for speed.
GEGL_DEBUG_BUFS::
Display tile/buffer leakage statistics.
GEGL_DEBUG_RECTS::
Show the results of have/need rect negotiations.
GEGL_DEBUG_TIME::
Print a performance instrumentation breakdown of GEGL and it's operations.
-GEGL_SWAP::
- The directory where temporary swap files are written, if not specified GEGL
- will not swap to disk. Be aware that swapping to disk is still experimental
- and GEGL is currently not removing the per process swap files.
gegl
@@ -450,23 +472,6 @@
â
âââtools some small utilities to help the build.
-babl dirs
-^^^^^^^^^
-
- babl-dist-root
- â
- âââbabl the babl core
- â âââbase reference implementations for RGB and Grayscale Color Models,
- â 8bit 16bit, and 32bit and 64bit floating point.
- âââextensions CIE-Lab color model as well as a naive-CMYK color model.
- â also contains a random cribbage of old conversion optimized
- â code from gggl. Finding more exsisting conversions in third
- â part libraries (hermes, lcms?, liboil?) could improve the
- â speed of babl.
- âââtests tests used to keep babl sane during development.
- âââdocs Documentation/webpage for babl.
-
-
++++++++
<div id='toc'>
<div id="toctitle">Table of Contents</div>
@@ -474,30 +479,31 @@
<div class="toclevel2"><a href="#features">Features</a></div>
<div class="toclevel2"><a href="#_news">News</a></div>
<div class="toclevel2"><a href="gallery/index.html">Gallery</a></div>
-<div class="toclevel2"><a href="http://bugzilla.gnome.org/buglist.cgi?product=GEGL&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">Bugzilla</a></div>
-<div class="toclevel2"><a href="#_mailinglist">Mailinglist</a></div>
+<!--<div class="toclevel2"><a href="http://bugzilla.gnome.org/buglist.cgi?product=GEGL&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">Bugzilla</a></div>
+<div class="toclevel2"><a href="#_mailinglist">Mailinglist</a></div>-->
<div class="toclevel2"><a href="#_copyright">Copyright</a></div>
<div class="toclevel2"><a href="#_code">Contributors</a></div>
-<div class="toclevel1"><a href="#_documentation">Building from source</a></div>
+<div class="toclevel1"><a href="#_building_from_source">Building from source</a></div>
<div class="toclevel2"><a href="#_download">Download</a></div>
<div class="toclevel2"><a href="#_dependencies">Dependencies</a></div>
<div class="toclevel2"><a href="#_compiling">Compiling</a></div>
<div class="toclevel1"><a href="#_documentation_2">Documentation</a></div>
+<div class="toclevel2"><a href="operations.html">Operations</a></div>
<div class="toclevel2"><a href="api.html">Public API</a></div>
<div class="toclevel2"><a href="#_operation_api">Operation API</a></div>
<div class="toclevel2"><a href="#_environment">Environment</a></div>
<div class="toclevel2"><a href="#_gegl">gegl</a></div>
<div class="toclevel1"><a href="#_appendixes">Appendixes</a></div>
<div class="toclevel2"><a href="operations.html">Operations</a></div>
-<div class="toclevel2"><a href="#_glossart">Glossary</a></div>
+<div class="toclevel2"><a href="#_glossary">Glossary</a></div>
<div class="toclevel2"><a href="#_directory_overview">Directory overview</a></div>
<div> </div>
<div class="toclevel1"> </div>
-<div class="toclevel2"><a href="http://svn.gnome.org/viewcvs/gegl/trunk/ChangeLog?view=markup">changes</a></div>
+<div class="toclevel2"><a href="http://svn.gnome.org/viewvc/gegl/trunk/ChangeLog?view=markup">changes</a></div>
<div class="toclevel2"><a href="http://bugzilla.gnome.org/buglist.cgi?product=GEGL&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=UNCONFIRMED&bug_status=NEEDINFO">bugzilla</a></div>
<div class="toclevel2"><a href="http://blog.gmane.org/gmane.comp.video.gegl.devel?set_blog_all=yes">mailarchive</a></div>
-<div class="toclevel2"><a href="http://svn.gnome.org/viewcvs/gegl/trunk/">viewcvs</a></div>
+<div class="toclevel2"><a href="http://svn.gnome.org/viewvc/gegl/trunk/">viewvc</a></div>
</div>
Modified: branches/branch_zhangjb/examples/gegl-paint.c
==============================================================================
--- branches/branch_zhangjb/examples/gegl-paint.c (original)
+++ branches/branch_zhangjb/examples/gegl-paint.c Thu Jun 19 02:52:46 2008
@@ -24,11 +24,12 @@
#include "../bin/gegl-view.c"
#include "property-types/gegl-vector.h"
-#define HARDNESS 0.8
-#define LINEWIDTH 10.0
+#define HARDNESS 0.2
+#define LINEWIDTH 60.0
+#define COLOR "rgba(0.0,0.0,0.0,0.4)"
-GtkWidget *window;
-GtkWidget *view;
+GtkWidget *window;
+GtkWidget *view;
static GeglBuffer *buffer = NULL;
static GeglNode *gegl = NULL;
static GeglNode *out = NULL;
@@ -40,18 +41,17 @@
static GeglNode *stroke = NULL;
-static gboolean paint_press (GtkWidget *widget,
- GdkEventButton *event)
+static gboolean paint_press (GtkWidget *widget,
+ GdkEventButton *event)
{
if (event->button == 1)
{
-
vector = gegl_vector_new ();
over = gegl_node_new_child (gegl, "operation", "over", NULL);
stroke = gegl_node_new_child (gegl, "operation", "stroke",
"vector", vector,
- "color", gegl_color_new ("rgba(1.0,0.5,0.5,0.4)"),
+ "color", gegl_color_new (COLOR),
"linewidth", LINEWIDTH,
"hardness", HARDNESS,
NULL);
@@ -66,65 +66,65 @@
}
-static gboolean paint_motion (GtkWidget *widget,
- GdkEventMotion *event)
+static gboolean paint_motion (GtkWidget *widget,
+ GdkEventMotion *event)
{
if (event->state & GDK_BUTTON1_MASK)
{
if (!pen_down)
- return TRUE;
-
-
- gegl_vector_line_to (vector, event->x,
- event->y);
-
+ {
+ return TRUE;
+ }
+
+ gegl_vector_line_to (vector,
+ event->x,
+ event->y);
return TRUE;
}
return FALSE;
}
-static gboolean paint_release (GtkWidget *widget,
- GdkEventButton *event)
+static gboolean paint_release (GtkWidget *widget,
+ GdkEventButton *event)
{
if (event->button == 1)
{
- gdouble x0,x1,y0,y1;
-
- GeglProcessor *processor;
- GeglNode *writebuf;
- GeglRectangle roi;
-
- gegl_vector_get_bounds (vector, &x0, &x1, &y0, &y1);
-
- roi = (GeglRectangle){x0 - LINEWIDTH, y0 - LINEWIDTH,
- x1-x0 + LINEWIDTH*2, y1-y0 + LINEWIDTH *2};
-
- writebuf = gegl_node_new_child (gegl,
- "operation", "write-buffer",
- "buffer", buffer,
- NULL);
- gegl_node_link_many (over, writebuf, NULL);
-
- processor = gegl_node_new_processor (writebuf, &roi);
- while (gegl_processor_work (processor, NULL));
- g_object_unref (processor);
- g_object_unref (writebuf);
-
- gegl_node_link_many (top, out, NULL);
- g_object_unref (over);
- g_object_unref (stroke);
- over = NULL;
- stroke = NULL;
- pen_down = FALSE;
+ gdouble x0, x1, y0, y1;
+ GeglProcessor *processor;
+ GeglNode *writebuf;
+ GeglRectangle roi;
+
+ gegl_vector_get_bounds (vector, &x0, &x1, &y0, &y1);
+
+ roi = (GeglRectangle){x0 - LINEWIDTH, y0 - LINEWIDTH,
+ x1 - x0 + LINEWIDTH * 2, y1 - y0 + LINEWIDTH * 2};
+
+ writebuf = gegl_node_new_child (gegl,
+ "operation", "write-buffer",
+ "buffer", buffer,
+ NULL);
+ gegl_node_link_many (over, writebuf, NULL);
+
+ processor = gegl_node_new_processor (writebuf, &roi);
+ while (gegl_processor_work (processor, NULL)) ;
+
+ g_object_unref (processor);
+ g_object_unref (writebuf);
+
+ gegl_node_link_many (top, out, NULL);
+ g_object_unref (over);
+ g_object_unref (stroke);
+
+ over = NULL;
+ stroke = NULL;
+ pen_down = FALSE;
return TRUE;
}
return FALSE;
}
-
-
gint
main (gint argc,
gchar **argv)
@@ -138,38 +138,38 @@
/*gegl = gegl_node_new_from_xml ("<gegl><rectangle width='512' height='512' color='red'/></gegl>", NULL);*/
- if (argv[1]==NULL)
+ if (argv[1] == NULL)
{
gchar *buf = NULL;
- buffer = gegl_buffer_new (&(GeglRectangle){0,0,512,512},
+ buffer = gegl_buffer_new (&(GeglRectangle){0, 0, 512, 512},
babl_format("RGBA float"));
- buf = g_malloc(512*512);
- memset (buf, 255, 512*512);
+ buf = g_malloc(512 * 512);
+ memset (buf, 255, 512 * 512); /* FIXME: we need a babl_buffer_paint () */
gegl_buffer_set (buffer, NULL, babl_format ("Y' u8"), buf, 0);
g_free (buf);
}
else
- buffer = gegl_buffer_open (argv[1]);
-
+ {
+ buffer = gegl_buffer_open (argv[1]);
+ }
gegl = gegl_node_new ();
-
-{
- GeglNode *loadbuf = gegl_node_new_child (gegl, "operation", "load-buffer", "buffer", buffer, NULL);
- out = gegl_node_new_child (gegl, "operation", "nop", NULL);
+ {
+ GeglNode *loadbuf = gegl_node_new_child (gegl, "operation", "load-buffer", "buffer", buffer, NULL);
+ out = gegl_node_new_child (gegl, "operation", "nop", NULL);
gegl_node_link_many (loadbuf, out, NULL);
- view = g_object_new (GEGL_TYPE_VIEW, "node", out, NULL);
- top = loadbuf;
-}
+ view = g_object_new (GEGL_TYPE_VIEW, "node", out, NULL);
+ top = loadbuf;
+ }
gtk_signal_connect (GTK_OBJECT (view), "motion-notify-event",
- (GtkSignalFunc) paint_motion, NULL);
+ (GtkSignalFunc) paint_motion, NULL);
gtk_signal_connect (GTK_OBJECT (view), "button-press-event",
- (GtkSignalFunc) paint_press, NULL);
+ (GtkSignalFunc) paint_press, NULL);
gtk_signal_connect (GTK_OBJECT (view), "button-release-event",
- (GtkSignalFunc) paint_release, NULL);
+ (GtkSignalFunc) paint_release, NULL);
gtk_widget_add_events (view, GDK_BUTTON_RELEASE_MASK);
Modified: branches/branch_zhangjb/gegl/Makefile.am
==============================================================================
--- branches/branch_zhangjb/gegl/Makefile.am (original)
+++ branches/branch_zhangjb/gegl/Makefile.am Thu Jun 19 02:52:46 2008
@@ -65,8 +65,8 @@
gegl.h \
gegl-utils.h \
gegl-chant.h \
+ gegl-simd.h \
gegl-plugin.h \
- gegl-config.c \
buffer/gegl-buffer.h \
property-types/gegl-paramspecs.h \
property-types/gegl-color.h \
Modified: branches/branch_zhangjb/gegl/buffer/Makefile.am
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/Makefile.am (original)
+++ branches/branch_zhangjb/gegl/buffer/Makefile.am Thu Jun 19 02:52:46 2008
@@ -12,6 +12,8 @@
gegl-buffer-access.c \
gegl-buffer-share.c \
gegl-buffer-index.h \
+ gegl-buffer-iterator.c \
+ gegl-buffer-linear.c \
gegl-buffer-save.c \
gegl-buffer-load.c \
gegl-cache.c \
@@ -38,6 +40,8 @@
BUFFER_headers = \
gegl-buffer.h \
gegl-buffer-private.h \
+ gegl-buffer-iterator.h \
+ gegl-buffer-linear.h \
gegl-buffer-load.h \
gegl-buffer-save.h \
gegl-buffer-types.h \
Modified: branches/branch_zhangjb/gegl/buffer/gegl-buffer-access.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-buffer-access.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-buffer-access.c Thu Jun 19 02:52:46 2008
@@ -13,7 +13,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
- * Copyright 2006,2007 Ãyvind KolÃs <pippin gimp org>
+ * Copyright 2006-2008 Ãyvind KolÃs <pippin gimp org>
*/
#include "config.h"
@@ -35,234 +35,15 @@
#include "gegl-sampler-nearest.h"
#include "gegl-sampler-linear.h"
#include "gegl-sampler-cubic.h"
+#include "gegl-sampler-lanczos.h"
#include "gegl-buffer-index.h"
#include "gegl-tile-backend.h"
+#include "gegl-buffer-iterator.h"
#if ENABLE_MP
GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
#endif
-
-
-void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i,
- GeglBuffer *buffer,
- GeglRectangle roi,
- gboolean write)
-{
- g_assert (i);
- memset (i, 0, sizeof (GeglBufferTileIterator));
- i->buffer = buffer;
- i->roi = roi;
- i->row = 0;
- i->col = 0;
- i->tile = NULL;
- i->write = write;
-}
-
-
-GeglBufferTileIterator *
-gegl_buffer_tile_iterator_new (GeglBuffer *buffer,
- GeglRectangle roi,
- gboolean write)
-{
- GeglBufferTileIterator *i = g_malloc (sizeof (GeglBufferTileIterator));
- gegl_buffer_tile_iterator_init (i, buffer, roi, write);
- return i;
-}
-
-void gegl_buffer_scan_iterator_init (GeglBufferScanIterator *i,
- GeglBuffer *buffer,
- GeglRectangle roi,
- gboolean write)
-{
- GeglBufferTileIterator *tile_i = (GeglBufferTileIterator*)i;
- g_assert (i);
- memset (i, 0, sizeof (GeglBufferScanIterator));
- gegl_buffer_tile_iterator_init (tile_i, buffer, roi, write);
- i->max_size = tile_i->buffer->tile_storage->tile_width *
- tile_i->buffer->tile_storage->tile_height *
- tile_i->buffer->format->format.bytes_per_pixel;
-}
-
-GeglBufferScanIterator *gegl_buffer_scan_iterator_new (GeglBuffer *buffer,
- GeglRectangle roi,
- gboolean write)
-{
- GeglBufferScanIterator *i = g_malloc (sizeof (GeglBufferScanIterator));
- gegl_buffer_scan_iterator_init (i, buffer, roi, write);
- return i;
-}
-
-gboolean
-gegl_buffer_scan_iterator_next (GeglBufferScanIterator *i)
-{
- GeglBufferTileIterator *tile_i = (GeglBufferTileIterator*)i;
-
- if (tile_i->tile==NULL)
- {
- gulp:
- if (!gegl_buffer_tile_iterator_next (tile_i))
- return FALSE;
- i->width = tile_i->subrect.width;
- i->row = 0;
- }
- /* we should now have a valid tile */
-
- if (tile_i->subrect.width == tile_i->buffer->tile_storage->tile_width &&
- i->row < tile_i->subrect.height)
- /* the entire contents of the tile can be expressed as one long scan */
- {
- gint px_size = tile_i->buffer->format->format.bytes_per_pixel;
- guchar *data = tile_i->data;
- i->width = tile_i->subrect.width * tile_i->subrect.height;
- i->data = data + px_size * (tile_i->subrect.width * tile_i->subrect.y);
- i->row = tile_i->subrect.height;
- return TRUE;
- }
- else if (i->row < tile_i->subrect.height)
- /* iterate thorugh the scanlines in the subrect */
- {
- guchar *data = tile_i->sub_data;
- i->data = data + i->row * tile_i->rowstride;
- i->row ++;
- return TRUE;
- }
- else
- { /* we're done with that tile go get another one if possible */
- goto gulp;
- }
-
- return FALSE;
-}
-
-
-gboolean gegl_buffer_scan_compatible (GeglBuffer *input,
- GeglBuffer *output)
-{
- if (input->tile_storage->tile_width !=
- output->tile_storage->tile_width)
- return FALSE;
- if (input->tile_storage->tile_height !=
- output->tile_storage->tile_height)
- return FALSE;
- if (input->shift_x !=
- output->shift_x)
- return FALSE;
- if (input->shift_y !=
- output->shift_y)
- return FALSE;
- return TRUE;
-}
-
-gboolean
-gegl_buffer_tile_iterator_next (GeglBufferTileIterator *i)
-{
- GeglBuffer *buffer = i->buffer;
- gint tile_width = buffer->tile_storage->tile_width;
- gint tile_height = buffer->tile_storage->tile_height;
- gint buffer_shift_x = buffer->shift_x;
- gint buffer_shift_y = buffer->shift_y;
- gint buffer_x = buffer->extent.x + buffer_shift_x;
- gint buffer_y = buffer->extent.y + buffer_shift_y;
- gint buffer_abyss_x = buffer->abyss.x + buffer_shift_x;
- gint abyss_x_total = buffer_abyss_x + buffer->abyss.width;
-
- if (i->roi.width == 0 || i->roi.height == 0)
- return FALSE;
-
-gulp:
-
- /* unref previous held tile */
- if (i->tile)
- {
- if (i->write)
- {
- gegl_tile_unlock (i->tile);
- }
- g_object_unref (i->tile);
- i->tile = NULL;
- }
-
- if (i->col < i->roi.width)
- { /* return tile on this row */
- gint tiledx = buffer_x + i->col;
- gint tiledy = buffer_y + i->row;
- gint offsetx = gegl_tile_offset (tiledx, tile_width);
- gint offsety = gegl_tile_offset (tiledy, tile_height);
- gint pixels;
-
- if (i->roi.width + offsetx - i->col < tile_width)
- pixels = (i->roi.width + offsetx - i->col) - offsetx;
- else
- pixels = tile_width - offsetx;
-
- if (!(buffer_x + i->col + tile_width >= buffer_abyss_x &&
- buffer_x + i->col < abyss_x_total))
- {
- g_warning ("entire tile in abyss?");
-
- i->col += tile_width - offsetx;
- }
- else
- {
- /* gap between left side of tile, and abyss */
- i->subrect.x = offsetx;
- i->subrect.y = offsety;
- /* gap between right side of tile, and abyss */
-
-
- i->subrect.width = (i->roi.width - i->col < tile_width) ?
- (i->roi.width - i->col) - i->subrect.x:
- tile_width - i->subrect.x;
-
- i->subrect.height = (i->roi.height - i->row < tile_height) ?
- (i->roi.height - i->row) - i->subrect.y:
- tile_height - i->subrect.y;
-
- i->tile = gegl_tile_source_get_tile ((GeglTileSource *) (buffer),
- gegl_tile_indice (tiledx, tile_width),
- gegl_tile_indice (tiledy, tile_height),
- 0);
- if (i->write)
- {
- gegl_tile_lock (i->tile);
- }
- i->data = gegl_tile_get_data (i->tile);
-
- {
- gint bpp = i->buffer->format->format.bytes_per_pixel;
- i->rowstride = bpp * tile_width;
- i->sub_data = (guchar*)(i->data) + bpp * (i->subrect.y * tile_width + i->subrect.x);
- }
-
- /* update with new future position (note this means that the
- * coordinates read from the iterator do not make full sense
- * */
- i->col += tile_width - offsetx;
-
- return TRUE;
- }
- }
- else /* move down to next row */
- {
- gint tiledy = buffer_y + i->row;
- gint offsety = gegl_tile_offset (tiledy, tile_height);
-
- i->row += tile_height - offsety;
- i->col=0;
-
- if (i->row < i->roi.height)
- {
- goto gulp; /* return the first tile in the next row */
- }
-
- return FALSE;
- }
- return FALSE;
-}
-
-
-
#ifdef BABL
#undef BABL
#endif
@@ -520,7 +301,7 @@
buffer->hot_tile = NULL;
}
if ((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))
- {
+ {
((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))->x =buffer->extent.x;
((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))->y =buffer->extent.y;
((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))->width =buffer->extent.width;
@@ -563,6 +344,7 @@
gint i;
gint factor = 1;
+
for (i = 0; i < level; i++)
{
factor *= 2;
@@ -642,6 +424,7 @@
else
pixels = tile_width - offsetx;
+
if (!(buffer_x + bufx + tile_width >= buffer_abyss_x &&
buffer_x + bufx < abyss_x_total))
{ /* entire tile is in abyss */
@@ -1305,6 +1088,7 @@
const Babl *format,
GeglInterpolation interpolation)
{
+ GType desired_type;
g_return_if_fail (GEGL_IS_BUFFER (buffer));
/*#define USE_WORKING_SHORTCUT*/
@@ -1317,26 +1101,19 @@
g_static_rec_mutex_lock (&mutex);
#endif
+ desired_type = gegl_sampler_type_from_interpolation (interpolation);
+
+ if (buffer->sampler != NULL &&
+ !G_TYPE_CHECK_INSTANCE_TYPE (buffer->sampler, desired_type))
+ {
+ g_object_unref(buffer->sampler);
+ buffer->sampler = NULL;
+ }
+
/* look up appropriate sampler,. */
if (buffer->sampler == NULL)
{
- /* FIXME: should probably check if the desired form of interpolation
- * changes from the currently cached sampler.
- */
- GType interpolation_type = 0;
-
- switch (interpolation)
- {
- case GEGL_INTERPOLATION_NEAREST:
- interpolation_type=GEGL_TYPE_SAMPLER_NEAREST;
- break;
- case GEGL_INTERPOLATION_LINEAR:
- interpolation_type=GEGL_TYPE_SAMPLER_LINEAR;
- break;
- default:
- g_warning ("unimplemented interpolation type %i", interpolation);
- }
- buffer->sampler = g_object_new (interpolation_type,
+ buffer->sampler = g_object_new (desired_type,
"buffer", buffer,
"format", format,
NULL);
@@ -1375,14 +1152,7 @@
GeglBuffer *dst,
const GeglRectangle *dst_rect)
{
- /* FIXME: make gegl_buffer_copy work with COW shared tiles when possible */
-
- GeglRectangle src_line;
- GeglRectangle dst_line;
- const Babl *format;
- guchar *temp;
- guint i;
- gint pxsize;
+ Babl *fish;
g_return_if_fail (GEGL_IS_BUFFER (src));
g_return_if_fail (GEGL_IS_BUFFER (dst));
@@ -1397,39 +1167,29 @@
dst_rect = src_rect;
}
- pxsize = src->tile_storage->px_size;
- format = src->format;
+ fish = babl_fish (src->format, dst->format);
- src_line = *src_rect;
- src_line.height = 1;
-
- dst_line = *dst_rect;
- dst_line.width = src_line.width;
- dst_line.height = src_line.height;
+ {
+ GeglRectangle dest_rect_r = *dst_rect;
+ GeglBufferIterator *i;
+ gint read;
- temp = g_malloc (src_line.width * pxsize);
+ dest_rect_r.width = src_rect->width;
+ dest_rect_r.height = src_rect->height;
- for (i=0; i<src_rect->height; i++)
- {
- gegl_buffer_get (src, 1.0, &src_line, format, temp, GEGL_AUTO_ROWSTRIDE);
- gegl_buffer_set (dst, &dst_line, format, temp, GEGL_AUTO_ROWSTRIDE);
- src_line.y++;
- dst_line.y++;
+ i = gegl_buffer_iterator_new (dst, &dest_rect_r, dst->format, GEGL_BUFFER_WRITE);
+ read = gegl_buffer_iterator_add (i, src, src_rect, src->format, GEGL_BUFFER_READ);
+ while (gegl_buffer_iterator_next (i))
+ babl_process (fish, i->data[read], i->data[0], i->length);
}
- g_free (temp);
}
void
gegl_buffer_clear (GeglBuffer *dst,
const GeglRectangle *dst_rect)
{
- /* FIXME: make gegl_buffer_copy work with COW shared tiles when possible */
-
- GeglRectangle dst_line;
- const Babl *format;
- guchar *temp;
- guint i;
- gint pxsize;
+ GeglBufferIterator *i;
+ gint pxsize;
g_return_if_fail (GEGL_IS_BUFFER (dst));
@@ -1437,32 +1197,54 @@
{
dst_rect = gegl_buffer_get_extent (dst);
}
-
- pxsize = dst->tile_storage->px_size;
- format = dst->format;
-
- dst_line = *dst_rect;
- dst_line.height = 1;
-
- temp = g_malloc0 (dst_line.width * pxsize);
-
- for (i=0; i<dst_rect->height; i++)
- {
- gegl_buffer_set (dst, &dst_line, format, temp, GEGL_AUTO_ROWSTRIDE);
- dst_line.y++;
+ if (dst_rect->width == 0 ||
+ dst_rect->height == 0)
+ return;
+
+ pxsize = dst->format->format.bytes_per_pixel;
+
+ i = gegl_buffer_iterator_new (dst, dst_rect, dst->format, GEGL_BUFFER_WRITE);
+ while (gegl_buffer_iterator_next (i))
+ {
+ gint j;
+ for (j=0;j<i->length * pxsize;j++)
+ ((guchar*)(i->data[0]))[j]=0;
}
- g_free (temp);
}
GeglBuffer *
gegl_buffer_dup (GeglBuffer *buffer)
{
- GeglBuffer *new;
+ GeglBuffer *new_buffer;
g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
- new = gegl_buffer_new (gegl_buffer_get_extent (buffer), buffer->format);
+ new_buffer = gegl_buffer_new (gegl_buffer_get_extent (buffer), buffer->format);
gegl_buffer_copy (buffer, gegl_buffer_get_extent (buffer),
- new, gegl_buffer_get_extent (buffer));
- return new;
+ new_buffer, gegl_buffer_get_extent (buffer));
+ return new_buffer;
+}
+
+void
+gegl_buffer_sampler (GeglBuffer *buffer,
+ gdouble x,
+ gdouble y,
+ gdouble scale,
+ gpointer dest,
+ const Babl *format,
+ gpointer sampler2)
+{
+ GeglSampler *sampler = sampler2;
+ g_return_if_fail (GEGL_IS_BUFFER (buffer));
+ g_return_if_fail (GEGL_IS_SAMPLER (sampler));
+
+#if ENABLE_MP
+ g_static_rec_mutex_lock (&mutex);
+#endif
+
+ gegl_sampler_get (sampler, x, y, dest);
+
+#if ENABLE_MP
+ g_static_rec_mutex_unlock (&mutex);
+#endif
}
Modified: branches/branch_zhangjb/gegl/buffer/gegl-buffer-private.h
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-buffer-private.h (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-buffer-private.h Thu Jun 19 02:52:46 2008
@@ -14,14 +14,17 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
- * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
+ * Copyright 2006-2008 Ãyvind KolÃs <pippin gimp org>
*/
#ifndef __GEGL_BUFFER_PRIVATE_H__
#define __GEGL_BUFFER_PRIVATE_H__
#include "gegl-buffer.h"
+#include "gegl-sampler.h"
#include "gegl-tile-handler.h"
+#include "gegl-buffer-iterator.h"
+#include "gegl-buffer-linear.h"
#define GEGL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_BUFFER, GeglBufferClass))
#define GEGL_IS_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_BUFFER))
@@ -100,47 +103,16 @@
gboolean gegl_buffer_unlock (GeglBuffer *buffer);
-typedef struct GeglBufferTileIterator
-{
- GeglBuffer *buffer;
- GeglTile *tile;
- GeglRectangle roi;
- gint col;
- gint row;
- gboolean write; /* perhaps in a subclass struct? */
- GeglRectangle subrect; /* has negative x when entire tile is valid */
- gpointer data;
- gpointer sub_data;
- gint rowstride;
-} GeglBufferTileIterator;
-
-typedef struct GeglBufferScanIterator {
- GeglBufferTileIterator tile_iterator;
- gint max_size; /* in bytes */
- gint width;
- gint row;
- gpointer data;
-} GeglBufferScanIterator;
-
-gboolean gegl_buffer_tile_iterator_next (GeglBufferTileIterator *i);
-gboolean gegl_buffer_scan_iterator_next (GeglBufferScanIterator *i);
-GeglBufferTileIterator *gegl_buffer_tile_iterator_new (GeglBuffer *buffer,
- GeglRectangle roi,
- gboolean write);
-void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i,
- GeglBuffer *buffer,
- GeglRectangle roi,
- gboolean write);
-
-void gegl_buffer_scan_iterator_init (GeglBufferScanIterator *i,
- GeglBuffer *buffer,
- GeglRectangle roi,
- gboolean write);
-GeglBufferScanIterator *gegl_buffer_scan_iterator_new (GeglBuffer *buffer,
- GeglRectangle roi,
- gboolean write);
-gboolean gegl_buffer_scan_compatible (GeglBuffer *input,
- GeglBuffer *output);
+
+GType gegl_sampler_type_from_interpolation (GeglInterpolation interpolation);
+
+void gegl_buffer_sampler (GeglBuffer *buffer,
+ gdouble x,
+ gdouble y,
+ gdouble scale,
+ gpointer dest,
+ const Babl *format,
+ gpointer sampler);
#endif
Modified: branches/branch_zhangjb/gegl/buffer/gegl-buffer-types.h
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-buffer-types.h (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-buffer-types.h Thu Jun 19 02:52:46 2008
@@ -19,7 +19,7 @@
#ifndef __GEGL_BUFFER_TYPES_H__
#define __GEGL_BUFFER_TYPES_H__
-typedef struct _GeglSampler GeglSampler;
+
typedef struct _GeglTile GeglTile;
typedef struct _GeglTileClass GeglTileClass;
Modified: branches/branch_zhangjb/gegl/buffer/gegl-buffer.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-buffer.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-buffer.c Thu Jun 19 02:52:46 2008
@@ -61,6 +61,7 @@
#include "gegl-sampler-nearest.h"
#include "gegl-sampler-linear.h"
#include "gegl-sampler-cubic.h"
+#include "gegl-sampler-lanczos.h"
#include "gegl-types.h"
#include "gegl-utils.h"
#include "gegl-id-pool.h"
@@ -104,7 +105,9 @@
gint x,
gint y,
gint width,
- gint height);
+ gint height,
+ gint tile_width,
+ gint tile_height);
static inline gint needed_tiles (gint w,
gint stride)
@@ -225,11 +228,11 @@
buffer->extent.height = g_value_get_int (value);
break;
- case PROP_TILE_WIDTH:
+ case PROP_TILE_HEIGHT:
buffer->tile_height = g_value_get_int (value);
break;
- case PROP_TILE_HEIGHT:
+ case PROP_TILE_WIDTH:
buffer->tile_width = g_value_get_int (value);
break;
@@ -292,7 +295,7 @@
(*(GeglRectangle*)gegl_buffer_get_extent (buffer))=*extent;
if ((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))
- {
+ {
GeglBufferHeader *header = ((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header));
header->x = buffer->extent.x;
header->y = buffer->extent.x;
@@ -462,7 +465,7 @@
}
source = g_object_new (GEGL_TYPE_BUFFER, "source", storage, NULL);
-
+
/* after construction,. x and y should be set to reflect
* the top level behavior exhibited by this buffer object.
*/
@@ -491,7 +494,9 @@
buffer->extent.x,
buffer->extent.y,
buffer->extent.width,
- buffer->extent.height));
+ buffer->extent.height,
+ buffer->tile_width,
+ buffer->tile_height));
/* after construction,. x and y should be set to reflect
* the top level behavior exhibited by this buffer object.
*/
@@ -603,7 +608,7 @@
buffer->abyss.height = self.height;
}
- /* compute our own total shift <- this should probably happen
+ /* compute our own total shift <- this should probably happen
* approximatly first */
if (GEGL_IS_BUFFER (source))
{
@@ -633,7 +638,7 @@
GeglTile *tile = NULL;
source = handler->source;
- if (source)
+ if (source)
tile = gegl_tile_source_get_tile (source, x, y, z);
else
g_assert (0);
@@ -771,13 +776,13 @@
g_object_class_install_property (gobject_class, PROP_TILE_HEIGHT,
g_param_spec_int ("tile-height", "tile-height", "height of a tile",
- -1, G_MAXINT, 64,
+ -1, G_MAXINT, gegl_config()->tile_height,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_TILE_WIDTH,
g_param_spec_int ("tile-width", "tile-width", "width of a tile",
- -1, G_MAXINT, 128,
+ -1, G_MAXINT, gegl_config()->tile_width,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
@@ -886,19 +891,6 @@
g_object_unref (buffer);
}
-GeglInterpolation
-gegl_buffer_interpolation_from_string (const gchar *string)
-{
- if (g_str_equal (string, "nearest") ||
- g_str_equal (string, "none"))
- return GEGL_INTERPOLATION_NEAREST;
-
- if (g_str_equal (string, "linear") ||
- g_str_equal (string, "bilinear"))
- return GEGL_INTERPOLATION_LINEAR;
-
- return GEGL_INTERPOLATION_NEAREST;
-}
@@ -909,7 +901,9 @@
gint x,
gint y,
gint width,
- gint height)
+ gint height,
+ gint tile_width,
+ gint tile_height)
{
GeglTileStorage *tile_storage;
GeglBuffer *buffer;
@@ -934,23 +928,29 @@
{
tile_storage = g_object_new (GEGL_TYPE_TILE_STORAGE,
"format", babl_format,
+ "tile-width", tile_width,
+ "tile-height", tile_height,
NULL);
}
else
{
tile_storage = g_object_new (GEGL_TYPE_TILE_STORAGE,
"format", babl_format,
+ "tile-width", tile_width,
+ "tile-height", tile_height,
"path", path,
NULL);
}
buffer = g_object_new (GEGL_TYPE_BUFFER,
- "source", tile_storage,
- "x", x,
- "y", y,
- "width", width,
- "height", height,
- NULL);
+ "source", tile_storage,
+ "x", x,
+ "y", y,
+ "width", width,
+ "height", height,
+ "tile-width", tile_width,
+ "tile-height", tile_height,
+ NULL);
g_object_unref (tile_storage);
return buffer;
@@ -1019,6 +1019,12 @@
}
}
+
+const Babl *gegl_buffer_get_format (GeglBuffer *buffer)
+{
+ return buffer?buffer->format:0;
+}
+
gboolean gegl_buffer_is_shared (GeglBuffer *buffer)
{
GeglTileBackend *backend = gegl_buffer_backend (buffer);
Modified: branches/branch_zhangjb/gegl/buffer/gegl-buffer.h
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-buffer.h (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-buffer.h Thu Jun 19 02:52:46 2008
@@ -41,7 +41,7 @@
*/
GType gegl_buffer_get_type (void) G_GNUC_CONST;
-/**
+/**
* gegl_buffer_new:
* @extent: the geometry of the buffer (origin, width and height) a
* GeglRectangle.
@@ -105,7 +105,7 @@
void gegl_buffer_flush (GeglBuffer *buffer);
-/**
+/**
* gegl_buffer_create_sub_buffer:
* @buffer: parent buffer.
* @extent: coordinates of new buffer.
@@ -239,6 +239,8 @@
gint rowstride);
+const Babl *gegl_buffer_get_format (GeglBuffer *buffer);
+
/**
* gegl_buffer_clear:
* @buffer: a #GeglBuffer
@@ -271,7 +273,7 @@
const GeglRectangle *dst_rect);
-/**
+/**
* gegl_buffer_dup:
* @buffer: the GeglBuffer to duplicate.
*
@@ -284,6 +286,8 @@
typedef enum {
GEGL_INTERPOLATION_NEAREST = 0,
GEGL_INTERPOLATION_LINEAR,
+ GEGL_INTERPOLATION_CUBIC,
+ GEGL_INTERPOLATION_LANCZOS,
} GeglInterpolation;
/**
@@ -296,7 +300,9 @@
* @format: the format to store the sampled color in.
* @interpolation: the interpolation behavior to use, currently only nearest
* neighbour is implemented for this API, bilinear, bicubic and lanczos needs
- * to be ported from working code. Valid values: GEGL_INTERPOLATION_NEAREST
+ * to be ported from working code. Valid values: GEGL_INTERPOLATION_NEAREST and
+ * GEGL_INTERPOLATION_LINEAR, CUBIC and LANCZOS will become available for now they
+ * fall back to linear.
*
* Resample the buffer at some given coordinates using a specified format. For
* some operations this might be sufficient, but it might be considered
@@ -311,6 +317,7 @@
const Babl *format,
GeglInterpolation interpolation);
+
/**
* gegl_buffer_sample_cleanup:
* @buffer: the GeglBuffer to sample from
@@ -319,7 +326,7 @@
* automatically later when the buffer is destroyed, for long lived buffers
* cleaning up the sampling infrastructure when it has been used for its
* purpose will sometimes be more efficient).
- */
+ */
void gegl_buffer_sample_cleanup (GeglBuffer *buffer);
/**
@@ -331,6 +338,7 @@
*/
GeglInterpolation gegl_buffer_interpolation_from_string (const gchar *string);
+
/**
*/
#endif
Modified: branches/branch_zhangjb/gegl/buffer/gegl-sampler-cubic.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-sampler-cubic.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-sampler-cubic.c Thu Jun 19 02:52:46 2008
@@ -13,39 +13,40 @@
* You should have received a copy of the GNU Lesser General Public
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
*/
+
+#include <glib-object.h>
+#include <glib/gstdio.h>
+#include <glib/gprintf.h>
+#include "gegl-types.h"
+#include "gegl-buffer-private.h"
#include "gegl-sampler-cubic.h"
-#include "gegl-buffer-private.h" /* XXX */
#include <string.h>
#include <math.h>
-/* XXX WARNING: This code compiles, but is functionally broken, and
- * currently not used by the rest of GeglBuffer */
-
enum
{
PROP_0,
PROP_B,
+ PROP_C,
PROP_TYPE,
PROP_LAST
};
-static void get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static inline float cubicKernel(float x, float b, float c);
-static void finalize (GObject *gobject);
-
-static void gegl_sampler_cubic_get (GeglSampler *self,
- gdouble x,
- gdouble y,
- void *output);
-
-static void gegl_sampler_cubic_prepare (GeglSampler *self);
+static void gegl_sampler_cubic_get (GeglSampler *sampler,
+ gdouble x,
+ gdouble y,
+ void *output);
+static void get_property (GObject *gobject,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void set_property (GObject *gobject,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static inline gfloat cubicKernel (gfloat x,
+ gfloat b,
+ gfloat c);
G_DEFINE_TYPE (GeglSamplerCubic, gegl_sampler_cubic, GEGL_TYPE_SAMPLER)
@@ -53,14 +54,12 @@
static void
gegl_sampler_cubic_class_init (GeglSamplerCubicClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
GeglSamplerClass *sampler_class = GEGL_SAMPLER_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = finalize;
object_class->set_property = set_property;
object_class->get_property = get_property;
- sampler_class->prepare = gegl_sampler_cubic_prepare;
sampler_class->get = gegl_sampler_cubic_get;
g_object_class_install_property (object_class, PROP_B,
@@ -69,6 +68,15 @@
"B-spline parameter",
0.0,
1.0,
+ 1.0,
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_C,
+ g_param_spec_double ("c",
+ "C",
+ "C-spline parameter",
+ 0.0,
+ 1.0,
0.0,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
@@ -78,21 +86,18 @@
"B-spline type (cubic | catmullrom | formula) 2c+b=1",
"cubic",
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
+
}
static void
gegl_sampler_cubic_init (GeglSamplerCubic *self)
{
-}
-
-void
-gegl_sampler_cubic_prepare (GeglSampler *sampler)
-{
- GeglSamplerCubic *self = GEGL_SAMPLER_CUBIC (sampler);
-
- /* fill the internal bufer */
-
- if (strcmp (self->type, "cubic"))
+ GEGL_SAMPLER (self)->context_rect= (GeglRectangle){-1,-1,4,4};
+ GEGL_SAMPLER (self)->interpolate_format = babl_format ("RaGaBaA float");
+ self->b=1.0;
+ self->c=0.0;
+ self->type = g_strdup("cubic");
+ if (strcmp (self->type, "cubic"))
{
/* cubic B-spline */
self->b = 0.0;
@@ -106,95 +111,67 @@
}
else if (strcmp (self->type, "formula"))
{
- self->c = (1 - self->b) / 2.0;
+ self->c = (1.0 - self->b) / 2.0;
}
}
-static void
-finalize (GObject *object)
-{
- GeglSamplerCubic *self = GEGL_SAMPLER_CUBIC (object);
-
- if (self->type)
- g_free (self->type);
- G_OBJECT_CLASS (gegl_sampler_cubic_parent_class)->finalize (object);
-}
-
void
-gegl_sampler_cubic_get (GeglSampler *sampler,
- gdouble x,
- gdouble y,
- void *output)
-{
- GeglSamplerCubic *self = GEGL_SAMPLER_CUBIC (sampler);
- gfloat *cache_buffer = sampler->cache_buffer;
- GeglRectangle *rectangle = &sampler->cache_rectangle;
- GeglBuffer *buffer = sampler->buffer;
- gfloat *buf_ptr;
- gfloat factor;
-
- gdouble arecip;
- gdouble newval[4];
-
- gfloat dst[4];
- gfloat abyss = 0.;
- gint i, j, pu, pv;
-
- gegl_sampler_fill_buffer (sampler, x, y);
- cache_buffer = sampler->cache_buffer;
- if (!buffer)
- return;
-
- if (x >= 0 &&
- y >= 0 &&
- x < buffer->extent.width &&
- y < buffer->extent.height)
+gegl_sampler_cubic_get (GeglSampler *self,
+ gdouble x,
+ gdouble y,
+ void *output)
+{
+ GeglSamplerCubic *cubic = (GeglSamplerCubic*)(self);
+ GeglRectangle context_rect;
+ gfloat *sampler_bptr;
+ gfloat factor;
+ gdouble arecip;
+ gdouble newval[4];
+ gfloat abyss = 0.;
+ gfloat dst[4];
+ gint u,v;
+ gint dx,dy;
+ gint i;
+
+ context_rect = self->context_rect;
+ dx = (gint) x;
+ dy = (gint) y;
+ newval[0] = newval[1] = newval[2] = newval[3] = 0.;
+ for (v=dy+context_rect.y ; v < dy+context_rect.y+context_rect.height ; v++)
+ for (u=dx+context_rect.x ; u < dx+context_rect.x+context_rect.width ; u++)
+ {
+ sampler_bptr = gegl_sampler_get_from_buffer (self, u, v);
+ factor = cubicKernel (y - v, cubic->b, cubic->c) *
+ cubicKernel (x - u, cubic->b, cubic->c);
+ newval[0] += factor * sampler_bptr[0] * sampler_bptr[3];
+ newval[1] += factor * sampler_bptr[1] * sampler_bptr[3];
+ newval[2] += factor * sampler_bptr[2] * sampler_bptr[3];
+ newval[3] += factor * sampler_bptr[3];
+ }
+ if (newval[3] <= abyss)
{
- gint u = (gint) (x - rectangle->x);
- gint v = (gint) (y - rectangle->y);
- newval[0] = newval[1] = newval[2] = newval[3] = 0.0;
- for (j = -1; j <= 2; j++)
- for (i = -1; i <= 2; i++)
- {
- pu = CLAMP (u + i, 0, rectangle->width - 1);
- pv = CLAMP (v + j, 0, rectangle->height - 1);
- factor = cubicKernel ((y - rectangle->y) - pv, self->b, self->c) *
- cubicKernel ((x - rectangle->x) - pu, self->b, self->c);
- buf_ptr = cache_buffer + ((pv * rectangle->width + pu) * 4);
- newval[0] += factor * buf_ptr[0] * buf_ptr[3];
- newval[1] += factor * buf_ptr[1] * buf_ptr[3];
- newval[2] += factor * buf_ptr[2] * buf_ptr[3];
- newval[3] += factor * buf_ptr[3];
- }
- if (newval[3] <= 0.0)
- {
- arecip = 0.0;
- newval[3] = 0;
- }
- else if (newval[3] > G_MAXDOUBLE)
- {
- arecip = 1.0 / newval[3];
- newval[3] = G_MAXDOUBLE;
- }
- else
- {
- arecip = 1.0 / newval[3];
- }
-
- dst[0] = CLAMP (newval[0] * arecip, 0, G_MAXDOUBLE);
- dst[1] = CLAMP (newval[1] * arecip, 0, G_MAXDOUBLE);
- dst[2] = CLAMP (newval[2] * arecip, 0, G_MAXDOUBLE);
- dst[3] = CLAMP (newval[3], 0, G_MAXDOUBLE);
+ arecip = abyss;
+ newval[3] = abyss;
+ }
+ else if (newval[3] > G_MAXDOUBLE)
+ {
+ arecip = 1.0 / newval[3];
+ newval[3] = G_MAXDOUBLE;
}
else
{
- dst[0] = abyss;
- dst[1] = abyss;
- dst[2] = abyss;
- dst[3] = abyss;
+ arecip = 1.0 / newval[3];
}
- babl_process (babl_fish (sampler->interpolate_format, sampler->format),
+
+ for ( i=0 ; i < 3 ; i++ )
+ newval[i] *= arecip;
+ for ( i=0 ; i < 4 ; i++ )
+ dst[i] = CLAMP (newval[i], 0, G_MAXDOUBLE);
+
+
+ babl_process (babl_fish (self->interpolate_format, self->format),
dst, output, 1);
+
}
static void
@@ -236,10 +213,9 @@
case PROP_TYPE:
{
- const gchar *type = g_value_get_string (value);
if (self->type)
g_free (self->type);
- self->type = g_strdup (type);
+ self->type = g_strdup (g_value_get_string (value));
break;
}
@@ -248,10 +224,13 @@
}
}
-static inline float cubicKernel (float x, float b, float c)
-{
- float weight, x2, x3;
- float ax = (float) fabs (x);
+static inline gfloat
+cubicKernel (gfloat x,
+ gfloat b,
+ gfloat c)
+ {
+ gfloat weight, x2, x3;
+ gfloat ax = (gfloat) fabs (x);
if (ax > 2) return 0;
@@ -270,3 +249,4 @@
return weight * (1.0 / 6.0);
}
+
Modified: branches/branch_zhangjb/gegl/buffer/gegl-sampler-lanczos.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-sampler-lanczos.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-sampler-lanczos.c Thu Jun 19 02:52:46 2008
@@ -18,11 +18,17 @@
/* XXX WARNING: This code compiles, but is functionally broken, and
* currently not used by the rest of GeglBuffer */
+
+#include <glib-object.h>
+#include <glib/gstdio.h>
+#include <glib/gprintf.h>
+#include "gegl-types.h"
+#include "gegl-buffer-private.h"
#include "gegl-sampler-lanczos.h"
-#include "gegl-buffer-private.h" /* XXX */
#include <string.h>
#include <math.h>
+
enum
{
PROP_0,
@@ -31,86 +37,42 @@
PROP_LAST
};
-static void
-get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GeglSamplerLanczos *self = GEGL_SAMPLER_LANCZOS (object);
-
- switch (prop_id)
- {
- case PROP_LANCZOS_WIDTH:
- g_value_set_int (value, self->lanczos_width);
- break;
-
- case PROP_LANCZOS_SAMPLES:
- g_value_set_int (value, self->lanczos_spp);
- break;
-
- default:
- break;
- }
-}
-
-static void
-set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GeglSamplerLanczos *self = GEGL_SAMPLER_LANCZOS (object);
-
- switch (prop_id)
- {
- case PROP_LANCZOS_WIDTH:
- self->lanczos_width = g_value_get_int (value);
- break;
-
- case PROP_LANCZOS_SAMPLES:
- self->lanczos_spp = g_value_get_int (value);
- break;
-
- default:
- break;
- }
-}
-
-static void gegl_sampler_lanczos_get (GeglSampler *self,
- gdouble x,
- gdouble y,
- void *output);
-
-static void gegl_sampler_lanczos_prepare (GeglSampler *self);
-
static inline gdouble sinc (gdouble x);
-static void lanczos_lookup (GeglSampler *sampler);
+static void lanczos_lookup (GeglSamplerLanczos *sampler);
+static void gegl_sampler_lanczos_get (GeglSampler *sampler,
+ gdouble x,
+ gdouble y,
+ void *output);
+static void get_property (GObject *gobject,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void set_property (GObject *gobject,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static GObject *
+gegl_sampler_lanczos_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params);
+static void finalize (GObject *object);
-G_DEFINE_TYPE (GeglSamplerLanczos, gegl_sampler_lanczos, GEGL_TYPE_SAMPLER)
-static void
-finalize (GObject *object)
-{
- GeglSamplerLanczos *self = GEGL_SAMPLER_LANCZOS (object);
- GeglSampler *sampler = GEGL_SAMPLER (object);
+G_DEFINE_TYPE (GeglSamplerLanczos, gegl_sampler_lanczos, GEGL_TYPE_SAMPLER)
+static GObjectClass * parent_class = NULL;
- g_free (self->lanczos_lookup);
- g_free (sampler->cache_buffer);
- G_OBJECT_CLASS (gegl_sampler_lanczos_parent_class)->finalize (object);
-}
static void
gegl_sampler_lanczos_class_init (GeglSamplerLanczosClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
GeglSamplerClass *sampler_class = GEGL_SAMPLER_CLASS (klass);
-
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ parent_class = g_type_class_peek_parent (klass);
object_class->finalize = finalize;
object_class->set_property = set_property;
object_class->get_property = get_property;
+ object_class->constructor = gegl_sampler_lanczos_constructor;
- sampler_class->prepare = gegl_sampler_lanczos_prepare;
sampler_class->get = gegl_sampler_lanczos_get;
g_object_class_install_property (object_class, PROP_LANCZOS_WIDTH,
@@ -136,115 +98,174 @@
static void
gegl_sampler_lanczos_init (GeglSamplerLanczos *self)
{
+
}
-void
-gegl_sampler_lanczos_prepare (GeglSampler *sampler)
+static GObject *
+gegl_sampler_lanczos_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params)
{
- /*GeglBuffer *input = GEGL_BUFFER (sampler->input);*/
+ GObject *object;
+ GeglSamplerLanczos *self;
+ gint i;
+
+ object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
+ self = GEGL_SAMPLER_LANCZOS (object);
+ for (i = 0; i < n_params; i++) {
+ if (!strcmp (params[i].pspec->name, "lanczos_spp"))
+ g_object_set(object, params[i].pspec->name, g_value_get_int (params[i].value), NULL);
+ if (!strcmp (params[i].pspec->name, "lanczos_width"))
+ g_object_set(object, params[i].pspec->name, g_value_get_int (params[i].value), NULL);
+ }
- /* calculate lookup */
- lanczos_lookup (sampler);
+ lanczos_lookup (self);
+ return object;
}
-void
-gegl_sampler_lanczos_get (GeglSampler *sampler,
- gdouble x,
- gdouble y,
- void *output)
+static void
+finalize (GObject *object)
{
- GeglSamplerLanczos *self = GEGL_SAMPLER_LANCZOS (sampler);
- GeglBuffer *buffer = sampler->buffer;
- gfloat *cache_buffer;
- gfloat *buf_ptr;
+ GeglSamplerLanczos *self = GEGL_SAMPLER_LANCZOS (object);
+
+ if ( self->lanczos_lookup != NULL )
+ {
+ g_free (self->lanczos_lookup);
+ self->lanczos_lookup = NULL;
+ }
+
+ G_OBJECT_CLASS (gegl_sampler_lanczos_parent_class)->finalize (object);
+}
+void
+gegl_sampler_lanczos_get (GeglSampler *self,
+ gdouble x,
+ gdouble y,
+ void *output)
+{
+ GeglSamplerLanczos *lanczos = GEGL_SAMPLER_LANCZOS (self);
+ GeglRectangle context_rect = self->context_rect;
+ gfloat *sampler_bptr;
gdouble x_sum, y_sum, arecip;
gdouble newval[4];
gfloat dst[4];
- gfloat abyss = 0.;
- gint i, j, pos, pu, pv;
- gint lanczos_spp = self->lanczos_spp;
- gint lanczos_width = self->lanczos_width;
- gint lanczos_width2 = lanczos_width * 2 + 1;
-
- gdouble x_kernel[lanczos_width2], /* 1-D kernels of Lanczos window coeffs */
- y_kernel[lanczos_width2];
-
- gegl_sampler_fill_buffer (sampler, x, y);
- cache_buffer = sampler->cache_buffer;
- if (!cache_buffer)
- return;
-
- if (x >= 0 &&
- y >= 0 &&
- x < buffer->extent.width &&
- y < buffer->extent.height)
+ gint i, j;
+ gint spp = lanczos->lanczos_spp;
+ gint width = lanczos->lanczos_width;
+ gint width2 = context_rect.width;
+ gint dx,dy;
+ gint u,v;
+
+ gdouble x_kernel[width2], /* 1-D kernels of Lanczos window coeffs */
+ y_kernel[width2];
+
+ self->interpolate_format = babl_format ("RaGaBaA float");
+
+ dx = (gint) ((x - ((gint) x)) * spp + 0.5);
+ dy = (gint) ((y - ((gint) y)) * spp + 0.5);
+ /* fill 1D kernels */
+ for (x_sum = y_sum = 0.0, i = width; i >= -width; i--)
{
- gint u = (gint) x;
- gint v = (gint) y;
- /* get weight for fractional error */
- gint su = (gint) ((x - u) * lanczos_spp + 0.5);
- gint sv = (gint) ((y - v) * lanczos_spp + 0.5);
- /* fill 1D kernels */
- for (x_sum = y_sum = 0.0, i = lanczos_width; i >= -lanczos_width; i--)
- {
- pos = i * lanczos_spp;
- x_sum += x_kernel[lanczos_width + i] = self->lanczos_lookup[ABS (su - pos)];
- y_sum += y_kernel[lanczos_width + i] = self->lanczos_lookup[ABS (sv - pos)];
- }
-
- /* normalise the weighted arrays */
- for (i = 0; i < lanczos_width2; i++)
- {
- x_kernel[i] /= x_sum;
- y_kernel[i] /= y_sum;
- }
+ gint pos = i * spp;
+ x_sum += x_kernel[width + i] = lanczos->lanczos_lookup[ABS (dx - pos)];
+ y_sum += y_kernel[width + i] = lanczos->lanczos_lookup[ABS (dy - pos)];
+ }
- newval[0] = newval[1] = newval[2] = newval[3] = 0.0;
- for (j = 0; j < lanczos_width2; j++)
- for (i = 0; i < lanczos_width2; i++)
- {
- pu = CLAMP (u + i - lanczos_width, 0, buffer->extent.width - 1);
- pv = CLAMP (v + j - lanczos_width, 0, buffer->extent.height - 1);
- buf_ptr = cache_buffer + ((pv * buffer->extent.width + pu) * 4);
- newval[0] += y_kernel[j] * x_kernel[i] * buf_ptr[0] * buf_ptr[3];
- newval[1] += y_kernel[j] * x_kernel[i] * buf_ptr[1] * buf_ptr[3];
- newval[2] += y_kernel[j] * x_kernel[i] * buf_ptr[2] * buf_ptr[3];
- newval[3] += y_kernel[j] * x_kernel[i] * buf_ptr[3];
- }
- if (newval[3] <= 0.0)
- {
- arecip = 0.0;
- newval[3] = 0;
- }
- else if (newval[3] > G_MAXDOUBLE)
- {
- arecip = 1.0 / newval[3];
- newval[3] = G_MAXDOUBLE;
- }
- else
- {
- arecip = 1.0 / newval[3];
- }
+ /* normalise the weighted arrays */
+ for (i = 0; i < width2; i++)
+ {
+ x_kernel[i] /= x_sum;
+ y_kernel[i] /= y_sum;
+ }
+ arecip = 0.0;
+ newval[0] = newval[1] = newval[2] = newval[3] = 0.0;
- dst[0] = CLAMP (newval[0] * arecip, 0, G_MAXDOUBLE);
- dst[1] = CLAMP (newval[1] * arecip, 0, G_MAXDOUBLE);
- dst[2] = CLAMP (newval[2] * arecip, 0, G_MAXDOUBLE);
- dst[3] = CLAMP (newval[3], 0, G_MAXDOUBLE);
+ dx = (gint) x;
+ dy = (gint) y;
+ for (v=dy+context_rect.y, j = 0; v < dy+context_rect.y+context_rect.height; j++, v++)
+ for (u=dx+context_rect.x, i = 0; u < dx+context_rect.x+context_rect.width; i++, u++)
+ {
+ sampler_bptr = gegl_sampler_get_from_buffer (self, u, v);
+ newval[0] += y_kernel[j] * x_kernel[i] * sampler_bptr[0] * sampler_bptr[3];
+ newval[1] += y_kernel[j] * x_kernel[i] * sampler_bptr[1] * sampler_bptr[3];
+ newval[2] += y_kernel[j] * x_kernel[i] * sampler_bptr[2] * sampler_bptr[3];
+ newval[3] += y_kernel[j] * x_kernel[i] * sampler_bptr[3];
+ }
+ if (newval[3] <= 0.0)
+ {
+ arecip = 0.0;
+ newval[3] = 0;
+ }
+ else if (newval[3] > G_MAXDOUBLE)
+ {
+ arecip = 1.0 / newval[3];
+ newval[3] = G_MAXDOUBLE;
}
else
{
- dst[0] = abyss;
- dst[1] = abyss;
- dst[2] = abyss;
- dst[3] = abyss;
+ arecip = 1.0 / newval[3];
}
- babl_process (babl_fish (sampler->interpolate_format, sampler->format),
+ for ( i=0 ; i < 3 ; i++ )
+ newval[i] *= arecip;
+ for ( i=0 ; i < 4 ; i++ )
+ dst[i] = CLAMP (newval[i], 0, G_MAXDOUBLE);
+
+ babl_process (babl_fish (self->interpolate_format, self->format),
dst, output, 1);
}
+static void
+get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GeglSamplerLanczos *self = GEGL_SAMPLER_LANCZOS (object);
+
+ switch (prop_id)
+ {
+ case PROP_LANCZOS_WIDTH:
+ g_value_set_int (value, self->lanczos_width);
+ break;
+
+ case PROP_LANCZOS_SAMPLES:
+ g_value_set_int (value, self->lanczos_spp);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
+set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GeglSamplerLanczos *self = GEGL_SAMPLER_LANCZOS (object);
+
+ switch (prop_id)
+ {
+ case PROP_LANCZOS_WIDTH:
+ {
+ self->lanczos_width = g_value_get_int (value);
+ GEGL_SAMPLER (self)->context_rect.x = - self->lanczos_width;
+ GEGL_SAMPLER (self)->context_rect.y = - self->lanczos_width;
+ GEGL_SAMPLER (self)->context_rect.width = self->lanczos_width*2+1;
+ GEGL_SAMPLER (self)->context_rect.height = self->lanczos_width*2+1;
+ }
+ break;
+ case PROP_LANCZOS_SAMPLES:
+ self->lanczos_spp = g_value_get_int (value);
+ break;
+
+ default:
+ break;
+ }
+}
/* Internal lanczos */
@@ -260,14 +281,13 @@
}
static void
-lanczos_lookup (GeglSampler *sampler)
+lanczos_lookup (GeglSamplerLanczos *sampler)
{
GeglSamplerLanczos *self = GEGL_SAMPLER_LANCZOS (sampler);
const gint lanczos_width = self->lanczos_width;
const gint samples = (self->lanczos_spp * (lanczos_width + 1));
const gdouble dx = (gdouble) lanczos_width / (gdouble) (samples - 1);
-
gdouble x = 0.0;
gint i;
Modified: branches/branch_zhangjb/gegl/buffer/gegl-sampler-linear.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-sampler-linear.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-sampler-linear.c Thu Jun 19 02:52:46 2008
@@ -14,28 +14,36 @@
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
*
*/
-#include "gegl-sampler-linear.h"
+
+
+#include <glib-object.h>
+#include <glib/gstdio.h>
+#include <glib/gprintf.h>
+#include "gegl-types.h"
#include "gegl-buffer-private.h"
+#include "gegl-sampler-linear.h"
#include <string.h>
+#include <math.h>
+
+
enum
{
PROP_0,
- PROP_CONTEXT_PIXELS,
PROP_LAST
};
-static void gegl_sampler_linear_get (GeglSampler *self,
- gdouble x,
- gdouble y,
- void *output);
+static void gegl_sampler_linear_get (GeglSampler *self,
+ gdouble x,
+ gdouble y,
+ void *output);
static void set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static void get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+static void get_property (GObject *gobject,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
G_DEFINE_TYPE (GeglSamplerLinear, gegl_sampler_linear, GEGL_TYPE_SAMPLER)
@@ -50,99 +58,74 @@
object_class->get_property = get_property;
sampler_class->get = gegl_sampler_linear_get;
-
- g_object_class_install_property (object_class, PROP_CONTEXT_PIXELS,
- g_param_spec_int ("context-pixels",
- "ContextPixels",
- "number of neighbourhood pixels needed in each direction",
- 0, 16, 1,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
-
}
static void
gegl_sampler_linear_init (GeglSamplerLinear *self)
{
- GEGL_SAMPLER (self)->context_pixels=1;
+ GEGL_SAMPLER (self)->context_rect = (GeglRectangle){ 0, 0, 2, 2};
+ GEGL_SAMPLER (self)->interpolate_format = babl_format ("RaGaBaA float");
}
void
-gegl_sampler_linear_get (GeglSampler *sampler,
- gdouble x,
- gdouble y,
- void *output)
-{
- GeglRectangle *rect;
- gfloat *cache_buffer;
- gfloat dst[4];
- gfloat abyss = 0.;
-
- gegl_sampler_fill_buffer (sampler, x, y);
- rect = &sampler->cache_rectangle;
- cache_buffer = sampler->cache_buffer;
- if (!cache_buffer)
- return;
-
- if (x >= rect->x &&
- y >= rect->y &&
- x < rect->x+rect->width &&
- y < rect->y+rect->height)
+gegl_sampler_linear_get (GeglSampler *self,
+ gdouble x,
+ gdouble y,
+ void *output)
+{
+ GeglRectangle context_rect = self->context_rect;
+ gfloat *sampler_bptr;
+ gfloat abyss = 0.;
+ gfloat dst[4];
+ gdouble arecip;
+ gdouble newval[4];
+ gdouble q[4];
+ gdouble dx,dy;
+ gdouble uf, vf;
+ gint u,v;
+ gint i;
+
+
+ uf = x - (gint) x;
+ vf = y - (gint) y;
+
+ q[0] = (1 - uf) * (1 - vf);
+ q[1] = uf * (1 - vf);
+ q[2] = (1 - uf) * vf;
+ q[3] = uf * vf;
+ dx = (gint) x;
+ dy = (gint) y;
+ newval[0] = newval[1] = newval[2] = newval[3] = 0.;
+ for (i=0, v=dy+context_rect.y; v < dy+context_rect.height ; v++)
+ for (u=dx+context_rect.x; u < dx+context_rect.width ; u++, i++)
+ {
+ sampler_bptr = gegl_sampler_get_from_buffer (self, u, v);
+ newval[0] += q[i] * sampler_bptr[0] * sampler_bptr[3];
+ newval[1] += q[i] * sampler_bptr[1] * sampler_bptr[3];
+ newval[2] += q[i] * sampler_bptr[2] * sampler_bptr[3];
+ newval[3] += q[i] * sampler_bptr[3];
+ }
+
+ if (newval[3] <= abyss)
+ {
+ arecip = abyss;
+ newval[3] = abyss;
+ }
+ else if (newval[3] > G_MAXDOUBLE)
{
- gint i;
- gint x0;
- gint y0;
- gint x1;
- gint y1;
- gint u;
- gint v;
- gdouble uf;
- gdouble vf;
- gdouble q1;
- gdouble q2;
- gdouble q3;
- gdouble q4;
- gfloat * p00;
- gfloat * p01;
- gfloat * p10;
- gfloat * p11;
- x -= rect->x;
- y -= rect->y;
- x0 = 0;
- y0 = 0;
- x1 = rect->width - 1;
- y1 = rect->height - 1;
- u = (gint) x;
- v = (gint) y;
- uf = x - u;
- vf = y - v;
- q1 = (1 - uf) * (1 - vf);
- q2 = uf * (1 - vf);
- q3 = (1 - uf) * vf;
- q4 = uf * vf;
- p00 = cache_buffer + (v * rect->width + u) * 4;
- u = CLAMP ((gint) x + 0, x0, x1);
- v = CLAMP ((gint) y + 1, y0, y1);
- p01 = cache_buffer + (v * rect->width + u) * 4;
- u = CLAMP ((gint) x + 1, x0, x1);
- v = CLAMP ((gint) y + 0, y0, y1);
- p10 = cache_buffer + (v * rect->width + u) * 4;
- u = CLAMP ((gint) x + 1, x0, x1);
- v = CLAMP ((gint) y + 1, y0, y1);
- p11 = cache_buffer + (v * rect->width + u) * 4;
- for (i = 0; i < 4; i++)
- {
- dst[i] = q1 * p00[i] + q2 * p10[i] + q3 * p01[i] + q4 * p11[i];
- }
+ arecip = 1.0 / newval[3];
+ newval[3] = G_MAXDOUBLE;
}
else
{
- dst[0] = abyss;
- dst[1] = abyss;
- dst[2] = abyss;
- dst[3] = abyss;
+ arecip = 1.0 / newval[3];
}
- babl_process (babl_fish (sampler->interpolate_format, sampler->format),
+ for ( i=0 ; i < 3 ; i++ )
+ newval[i] *= arecip;
+ for ( i=0 ; i < 4 ; i++ )
+ dst[i] = CLAMP (newval[i], 0, G_MAXDOUBLE);
+
+ babl_process (babl_fish (self->interpolate_format, self->format),
dst, output, 1);
}
@@ -156,9 +139,6 @@
{
switch (property_id)
{
- case PROP_CONTEXT_PIXELS:
- g_object_set_property (gobject, "GeglSampler::context-pixels", value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
@@ -174,9 +154,6 @@
{
switch (property_id)
{
- case PROP_CONTEXT_PIXELS:
- g_object_get_property (gobject, "GeglSampler::context-pixels", value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
Modified: branches/branch_zhangjb/gegl/buffer/gegl-sampler-nearest.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-sampler-nearest.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-sampler-nearest.c Thu Jun 19 02:52:46 2008
@@ -14,15 +14,31 @@
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
*
*/
-#include "gegl-sampler-nearest.h"
+
+#include <glib-object.h>
+#include "gegl-types.h"
#include "gegl-buffer-private.h"
+#include "gegl-sampler-nearest.h"
#include <string.h>
-static void gegl_sampler_nearest_get (GeglSampler *self,
- gdouble x,
- gdouble y,
- void *output);
-
+enum
+{
+ PROP_0,
+ PROP_LAST
+};
+
+static void gegl_sampler_nearest_get (GeglSampler *self,
+ gdouble x,
+ gdouble y,
+ void *output);
+static void set_property (GObject *gobject,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void get_property (GObject *gobject,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
G_DEFINE_TYPE (GeglSamplerNearest, gegl_sampler_nearest, GEGL_TYPE_SAMPLER)
@@ -30,6 +46,10 @@
gegl_sampler_nearest_class_init (GeglSamplerNearestClass *klass)
{
GeglSamplerClass *sampler_class = GEGL_SAMPLER_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
sampler_class->get = gegl_sampler_nearest_get;
@@ -38,6 +58,8 @@
static void
gegl_sampler_nearest_init (GeglSamplerNearest *self)
{
+ GEGL_SAMPLER (self)->context_rect = (GeglRectangle){0,0,1,1};
+ GEGL_SAMPLER (self)->interpolate_format = babl_format ("RaGaBaA float");
}
void
@@ -46,37 +68,35 @@
gdouble y,
void *output)
{
- gfloat * cache_buffer;
- GeglRectangle * rect;
- gint u;
- gint v;
- gfloat dst[4];
-
- gegl_sampler_fill_buffer (self, x, y);
-
- rect = &self->cache_rectangle;
- cache_buffer = self->cache_buffer;
- if (!cache_buffer)
- return;
- u = (x - rect->x);
- v = (y - rect->y);
-
- if (u >= 0 &&
- v >= 0 &&
- u < rect->width &&
- v < rect->height)
+ gfloat *sampler_bptr;
+ sampler_bptr = gegl_sampler_get_from_buffer (self, (gint)x, (gint)y);
+ babl_process (babl_fish (self->interpolate_format, self->format), sampler_bptr, output, 1);
+}
+
+static void
+set_property (GObject *gobject,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id)
{
- gint pos = (v * rect->width + u) * 4;
- memcpy (dst, cache_buffer + pos, sizeof (gfloat) * 4);
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
+ break;
}
- else
+}
+
+static void
+get_property (GObject *gobject,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id)
{
- dst[0] = 0.0;
- dst[1] = 0.0;
- dst[2] = 0.0;
- dst[3] = 0.0;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
+ break;
}
- babl_process (babl_fish (self->interpolate_format, self->format),
- dst, output, 1);
}
-
Modified: branches/branch_zhangjb/gegl/buffer/gegl-sampler.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-sampler.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-sampler.c Thu Jun 19 02:52:46 2008
@@ -15,26 +15,31 @@
*
* 2007 Â Ãyvind KolÃs
*/
-
-#define SIZE 16 /* the cached region around a fetched pixel value is
- SIZEÃSIZE pixels. */
-
#include "config.h"
#include <glib-object.h>
#include <string.h>
#include "gegl-types.h"
-#include "gegl-sampler.h"
+#include "gegl-buffer.h"
#include "gegl-utils.h"
#include "gegl-buffer-private.h"
+#include "gegl-sampler-nearest.h"
+#include "gegl-sampler-linear.h"
+#include "gegl-sampler-cubic.h"
+#include "gegl-sampler-lanczos.h"
+
+#if ENABLE_MP
+GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
+#endif
+
enum
{
PROP_0,
PROP_BUFFER,
PROP_FORMAT,
- PROP_CONTEXT_PIXELS,
+ PROP_CONTEXT_RECT,
PROP_LAST
};
@@ -50,6 +55,8 @@
guint prop_id,
const GValue *value,
GParamSpec *pspec);
+static void set_buffer (GeglSampler *self,
+ GeglBuffer *buffer);
G_DEFINE_TYPE (GeglSampler, gegl_sampler, G_TYPE_OBJECT)
@@ -63,16 +70,11 @@
klass->prepare = NULL;
klass->get = NULL;
+ klass->set_buffer = set_buffer;
object_class->set_property = set_property;
object_class->get_property = get_property;
- g_object_class_install_property (object_class, PROP_BUFFER,
- g_param_spec_object ("buffer",
- "Buffer",
- "Input pad, for image buffer input.",
- GEGL_TYPE_BUFFER,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_FORMAT,
g_param_spec_pointer ("format",
@@ -80,33 +82,38 @@
"babl format",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- g_object_class_install_property (object_class, PROP_CONTEXT_PIXELS,
- g_param_spec_int ("context-pixels",
- "ContextPixels",
- "number of neighbourhood pixels needed in each direction",
- 0, 16, 0,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
+ g_object_class_install_property (object_class, PROP_BUFFER,
+ g_param_spec_object ("buffer",
+ "Buffer",
+ "Input pad, for image buffer input.",
+ GEGL_TYPE_BUFFER,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}
static void
gegl_sampler_init (GeglSampler *self)
{
- self->cache_buffer = NULL;
+ GeglRectangle context_rect = {0,0,1,1};
+ GeglRectangle sampler_rectangle = {0,0,0,0};
+ self->sampler_buffer = NULL;
self->buffer = NULL;
- self->context_pixels = 0;
+ self->context_rect = context_rect;
+ self->sampler_rectangle = sampler_rectangle;
}
void
gegl_sampler_get (GeglSampler *self,
- gdouble x,
- gdouble y,
- void *output)
+ gdouble x,
+ gdouble y,
+ void *output)
{
GeglSamplerClass *klass;
-
+#if 0 /* avoiding expensive typecheck here */
g_return_if_fail (GEGL_IS_SAMPLER (self));
+#endif
+ self->x = x;
+ self->y = y;
klass = GEGL_SAMPLER_GET_CLASS (self);
klass->get (self, x, y, output);
@@ -135,14 +142,28 @@
#endif
}
+void
+gegl_sampler_set_buffer (GeglSampler *self, GeglBuffer *buffer)
+{
+ GeglSamplerClass *klass;
+
+ g_return_if_fail (GEGL_IS_SAMPLER (self));
+
+ klass = GEGL_SAMPLER_GET_CLASS (self);
+
+ if (klass->set_buffer)
+ klass->set_buffer (self, buffer);
+}
+
+
static void
finalize (GObject *gobject)
{
GeglSampler *sampler = GEGL_SAMPLER (gobject);
- if (sampler->cache_buffer)
+ if (sampler->sampler_buffer)
{
- g_free (sampler->cache_buffer);
- sampler->cache_buffer = NULL;
+ g_free (sampler->sampler_buffer);
+ sampler->sampler_buffer = NULL;
}
G_OBJECT_CLASS (gegl_sampler_parent_class)->finalize (gobject);
}
@@ -159,50 +180,66 @@
G_OBJECT_CLASS (gegl_sampler_parent_class)->dispose (gobject);
}
-void
-gegl_sampler_fill_buffer (GeglSampler *sampler,
- gdouble x,
- gdouble y)
-{
- GeglBuffer *buffer;
- GeglRectangle surround;
-
- buffer = sampler->buffer;
- g_assert (buffer);
-
- if (sampler->cache_buffer)
- {
- GeglRectangle r = sampler->cache_rectangle;
-
- /* check if the cache-buffer includes both the desired coordinates and
- * a sufficient surrounding context
- */
- if (x - r.x >= sampler->context_pixels &&
- x - r.x < r.width - sampler->context_pixels &&
- y - r.y >= sampler->context_pixels &&
- y - r.y < r.height - sampler->context_pixels)
- {
- return; /* we can reuse our cached interpolation source buffer */
- }
-
- g_free (sampler->cache_buffer);
- sampler->cache_buffer = NULL;
- }
-
- surround.x = x - SIZE/2;
- surround.y = y - SIZE/2;
- surround.width = SIZE;
- surround.height = SIZE;
-
- sampler->cache_buffer = g_malloc0 (surround.width *
- surround.height *
- 4 * sizeof (gfloat));
- sampler->cache_rectangle = surround;
- sampler->interpolate_format = babl_format ("RaGaBaA float");
-
- gegl_buffer_get (buffer, 1.0, &surround,
- sampler->interpolate_format,
- sampler->cache_buffer, GEGL_AUTO_ROWSTRIDE);
+#include <math.h>
+
+gfloat *
+gegl_sampler_get_from_buffer (GeglSampler *sampler,
+ gint x,
+ gint y)
+{
+ guchar *buffer_ptr;
+ gint dx;
+ gint dy;
+ gint bpp;
+ gint sof;
+
+
+ bpp = sampler->interpolate_format->format.bytes_per_pixel;
+
+ if (sampler->sampler_buffer == NULL ||
+ x < sampler->sampler_rectangle.x ||
+ y < sampler->sampler_rectangle.y ||
+ x >= sampler->sampler_rectangle.x + sampler->sampler_rectangle.width ||
+ y >= sampler->sampler_rectangle.y + sampler->sampler_rectangle.height)
+ {
+ GeglRectangle fetch_rectangle/* = sampler->context_rect*/;
+
+ fetch_rectangle.x = (gint) sampler->x;
+ fetch_rectangle.y = (gint) sampler->y;
+
+ /* we override the fetch rectangle needed by the sampler, hoping that
+ * the extra pixels we fetch comes in useful in subsequent requests,
+ * we assume that it is more likely that further access is to the right
+ * or down of our currently requested position.
+ */
+ fetch_rectangle.x -= 8;
+ fetch_rectangle.y -= 8;
+ fetch_rectangle.width = 64;
+ fetch_rectangle.height = 64;
+
+
+ if (sampler->sampler_buffer == NULL )
+ { /* we always request the same amount of pixels (64kb worth) */
+ sampler->sampler_buffer = g_malloc0 (fetch_rectangle.width *
+ fetch_rectangle.height *
+ bpp);
+ }
+
+ gegl_buffer_get (sampler->buffer,
+ 1.0,
+ &fetch_rectangle,
+ sampler->interpolate_format,
+ sampler->sampler_buffer,
+ GEGL_AUTO_ROWSTRIDE);
+
+ sampler->sampler_rectangle = fetch_rectangle;
+ }
+
+ dx = x - sampler->sampler_rectangle.x;
+ dy = y - sampler->sampler_rectangle.y;
+ buffer_ptr = (guchar *)sampler->sampler_buffer;
+ sof = ( dx + (dy * sampler->sampler_rectangle.width)) * bpp;
+ return (gfloat*)(buffer_ptr+sof);
}
static void
@@ -223,10 +260,6 @@
g_value_set_pointer (value, self->format);
break;
- case PROP_CONTEXT_PIXELS:
- g_value_set_int (value, self->context_pixels);
- break;
-
default:
break;
}
@@ -250,11 +283,62 @@
self->format = g_value_get_pointer (value);
break;
- case PROP_CONTEXT_PIXELS:
- self->context_pixels = g_value_get_int (value);
- break;
-
default:
break;
}
}
+
+
+static void
+set_buffer (GeglSampler *self, GeglBuffer *buffer)
+{
+ if (self->buffer != buffer)
+ {
+ if (GEGL_IS_BUFFER(self->buffer))
+ g_object_unref(self->buffer);
+ if (GEGL_IS_BUFFER (buffer))
+ self->buffer = gegl_buffer_dup (buffer);
+ else
+ self->buffer = NULL;
+ }
+}
+
+GeglInterpolation
+gegl_buffer_interpolation_from_string (const gchar *string)
+{
+ if (g_str_equal (string, "nearest") ||
+ g_str_equal (string, "none"))
+ return GEGL_INTERPOLATION_NEAREST;
+
+ if (g_str_equal (string, "linear") ||
+ g_str_equal (string, "bilinear"))
+ return GEGL_INTERPOLATION_LINEAR;
+
+ if (g_str_equal (string, "cubic") ||
+ g_str_equal (string, "bicubic"))
+ return GEGL_INTERPOLATION_CUBIC;
+
+ if (g_str_equal (string, "lanczos"))
+ return GEGL_INTERPOLATION_LANCZOS;
+
+ return GEGL_INTERPOLATION_NEAREST;
+}
+
+
+GType
+gegl_sampler_type_from_interpolation (GeglInterpolation interpolation)
+{
+ switch (interpolation)
+ {
+ case GEGL_INTERPOLATION_NEAREST:
+ return GEGL_TYPE_SAMPLER_NEAREST;
+ case GEGL_INTERPOLATION_LINEAR:
+ return GEGL_TYPE_SAMPLER_LINEAR;
+ case GEGL_INTERPOLATION_CUBIC:
+ return GEGL_TYPE_SAMPLER_CUBIC;
+ case GEGL_INTERPOLATION_LANCZOS:
+ return GEGL_TYPE_SAMPLER_LANCZOS;
+ default:
+ return GEGL_TYPE_SAMPLER_LINEAR;
+ }
+}
Modified: branches/branch_zhangjb/gegl/buffer/gegl-sampler.h
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-sampler.h (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-sampler.h Thu Jun 19 02:52:46 2008
@@ -20,8 +20,8 @@
#include <glib-object.h>
#include <babl/babl.h>
-#include "gegl-types.h"
-#include "buffer/gegl-buffer-types.h"
+
+/* this file needs to be included by gegl-buffer-private */
G_BEGIN_DECLS
@@ -33,6 +33,7 @@
#define GEGL_SAMPLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_SAMPLER, GeglSamplerClass))
typedef struct _GeglSamplerClass GeglSamplerClass;
+typedef struct _GeglSampler GeglSampler;
struct _GeglSampler
{
@@ -41,36 +42,43 @@
/*< private >*/
GeglBuffer *buffer;
Babl *format;
-
- GeglRectangle cache_rectangle;
- void *cache_buffer;
Babl *interpolate_format;
- gint context_pixels;
+ GeglRectangle context_rect;
+ void *sampler_buffer;
+ GeglRectangle sampler_rectangle;
+ gdouble x; /* mirrors the currently requested */
+ gdouble y; /* coordinates in the instance */
};
struct _GeglSamplerClass
{
GObjectClass parent_class;
- void (* prepare) (GeglSampler *self);
- void (* get) (GeglSampler *self,
- gdouble x,
- gdouble y,
- void *output);
+ void (* prepare) (GeglSampler *self);
+ void (* get) (GeglSampler *self,
+ gdouble x,
+ gdouble y,
+ void *output);
+ void (*set_buffer) (GeglSampler *self,
+ GeglBuffer *buffer);
};
GType gegl_sampler_get_type (void) G_GNUC_CONST;
/* virtual method invokers */
void gegl_sampler_prepare (GeglSampler *self);
+void gegl_sampler_set_buffer (GeglSampler *self,
+ GeglBuffer *buffer);
+
void gegl_sampler_get (GeglSampler *self,
gdouble x,
gdouble y,
void *output);
+gfloat * gegl_sampler_get_from_buffer (GeglSampler *sampler,
+ gint x,
+ gint y);
-void gegl_sampler_fill_buffer (GeglSampler *sampler,
- gdouble x,
- gdouble y);
+GType gegl_sampler_type_from_interpolation (GeglInterpolation interpolation);
G_END_DECLS
Modified: branches/branch_zhangjb/gegl/buffer/gegl-tile-storage.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-tile-storage.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-tile-storage.c Thu Jun 19 02:52:46 2008
@@ -33,13 +33,11 @@
#include "gegl-tile-handler-log.h"
#include "gegl-types.h"
#include "gegl-utils.h"
+#include "gegl-config.h"
G_DEFINE_TYPE (GeglTileStorage, gegl_tile_storage, GEGL_TYPE_TILE_HANDLER_CHAIN)
-#define TILE_WIDTH 128
-#define TILE_HEIGHT 64
-
static GObjectClass * parent_class = NULL;
enum
@@ -196,6 +194,7 @@
tile_handler_chain = GEGL_TILE_HANDLER_CHAIN (tile_storage);
handler = GEGL_HANDLER (tile_storage);
+
if (tile_storage->path != NULL)
{
#if 1
@@ -260,6 +259,7 @@
if (g_getenv("GEGL_LOG_TILE_CACHE"))
gegl_tile_handler_chain_add (tile_handler_chain,
g_object_new (GEGL_TYPE_TILE_HANDLER_LOG, NULL));
+ g_object_set_data (G_OBJECT (tile_storage), "cache", cache);
g_object_set_data (G_OBJECT (empty), "cache", cache);
g_object_set_data (G_OBJECT (zoom), "cache", cache);
@@ -302,12 +302,12 @@
g_object_class_install_property (gobject_class, PROP_TILE_WIDTH,
g_param_spec_int ("tile-width", "tile-width", "width of a tile in pixels",
- 0, G_MAXINT, TILE_WIDTH,
+ 0, G_MAXINT, 128,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_TILE_HEIGHT,
g_param_spec_int ("tile-height", "tile-height", "height of a tile in pixels",
- 0, G_MAXINT, TILE_HEIGHT,
+ 0, G_MAXINT, 64,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_TILE_SIZE,
Modified: branches/branch_zhangjb/gegl/buffer/gegl-tile.c
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-tile.c (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-tile.c Thu Jun 19 02:52:46 2008
@@ -108,6 +108,12 @@
#include "gegl-utils.h"
+static void default_free (gpointer data,
+ gpointer userdata)
+{
+ gegl_free (data);
+}
+
static void
dispose (GObject *object)
{
@@ -120,7 +126,8 @@
{
if (tile->next_shared == tile)
{ /* no clones */
- gegl_free (tile->data);
+ if (tile->destroy_notify)
+ tile->destroy_notify (tile->data, tile->destroy_notify_data);
tile->data = NULL;
}
else
@@ -187,6 +194,7 @@
#if ENABLE_MP
tile->mutex = g_mutex_new ();
#endif
+ tile->destroy_notify = default_free;
}
GeglTile *
@@ -217,7 +225,6 @@
tile->size = size;
tile->stored_rev = 1;
-
return tile;
}
Modified: branches/branch_zhangjb/gegl/buffer/gegl-tile.h
==============================================================================
--- branches/branch_zhangjb/gegl/buffer/gegl-tile.h (original)
+++ branches/branch_zhangjb/gegl/buffer/gegl-tile.h Thu Jun 19 02:52:46 2008
@@ -30,6 +30,7 @@
#define GEGL_IS_TILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_TILE))
#define GEGL_TILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_TILE, GeglTileClass))
+
/* the instance size of a GeglTile is a bit large, and should if possible be
* trimmed down
*/
@@ -62,11 +63,15 @@
/* the shared list is a doubly linked circular list */
GeglTile *next_shared;
GeglTile *prev_shared;
+
+ void (*destroy_notify) (gpointer pixels,
+ gpointer data);
+ gpointer destroy_notify_data;
};
struct _GeglTileClass
{
- GObjectClass parent_class;
+ GObjectClass parent_class;
};
GType gegl_tile_get_type (void) G_GNUC_CONST;
Modified: branches/branch_zhangjb/gegl/gegl-chant.h
==============================================================================
--- branches/branch_zhangjb/gegl/gegl-chant.h (original)
+++ branches/branch_zhangjb/gegl/gegl-chant.h Thu Jun 19 02:52:46 2008
@@ -205,6 +205,38 @@
#endif
+
+#ifdef GEGL_CHANT_TYPE_POINT_RENDER
+struct _GeglChant
+{
+ GeglOperationPointRender parent_instance;
+ gpointer properties;
+};
+
+typedef struct
+{
+ GeglOperationPointRenderClass parent_class;
+} GeglChantClass;
+
+GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_POINT_RENDER);
+
+#endif
+
+
+#ifdef GEGL_CHANT_TYPE_TEMPORAL
+struct _GeglChant
+{
+ GeglOperationTemporal parent_instance;
+ gpointer properties;
+};
+
+typedef struct
+{
+ GeglOperationTemporalClass parent_class;
+} GeglChantClass;
+GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_TEMPORAL);
+#endif
+
#ifdef GEGL_CHANT_TYPE_AREA_FILTER
struct _GeglChant
{
Modified: branches/branch_zhangjb/gegl/gegl-config.c
==============================================================================
--- branches/branch_zhangjb/gegl/gegl-config.c (original)
+++ branches/branch_zhangjb/gegl/gegl-config.c Thu Jun 19 02:52:46 2008
@@ -30,8 +30,11 @@
PROP_0,
PROP_QUALITY,
PROP_CACHE_SIZE,
+ PROP_CHUNK_SIZE,
PROP_SWAP,
- PROP_BABL_ERROR
+ PROP_BABL_TOLERANCE,
+ PROP_TILE_WIDTH,
+ PROP_TILE_HEIGHT
};
static void
@@ -48,12 +51,24 @@
g_value_set_int (value, config->cache_size);
break;
+ case PROP_CHUNK_SIZE:
+ g_value_set_int (value, config->chunk_size);
+ break;
+
+ case PROP_TILE_WIDTH:
+ g_value_set_int (value, config->tile_width);
+ break;
+
+ case PROP_TILE_HEIGHT:
+ g_value_set_int (value, config->tile_height);
+ break;
+
case PROP_QUALITY:
g_value_set_double (value, config->quality);
break;
- case PROP_BABL_ERROR:
- g_value_set_double (value, config->babl_error);
+ case PROP_BABL_TOLERANCE:
+ g_value_set_double (value, config->babl_tolerance);
break;
case PROP_SWAP:
@@ -79,15 +94,24 @@
case PROP_CACHE_SIZE:
config->cache_size = g_value_get_int (value);
break;
+ case PROP_CHUNK_SIZE:
+ config->chunk_size = g_value_get_int (value);
+ break;
+ case PROP_TILE_WIDTH:
+ config->tile_width = g_value_get_int (value);
+ break;
+ case PROP_TILE_HEIGHT:
+ config->tile_height = g_value_get_int (value);
+ break;
case PROP_QUALITY:
config->quality = g_value_get_double (value);
return;
- case PROP_BABL_ERROR:
+ case PROP_BABL_TOLERANCE:
{
gchar buf[256];
- config->babl_error = g_value_get_double (value);
- g_sprintf (buf, "%f", config->babl_error);
- g_setenv ("BABL_ERROR", buf, 0);
+ config->babl_tolerance = g_value_get_double (value);
+ g_sprintf (buf, "%f", config->babl_tolerance);
+ g_setenv ("BABL_TOLERANCE", buf, 0);
/* babl picks up the babl error through the environment, babl
* caches valid conversions though so this needs to be set
* before any processing is done
@@ -127,9 +151,27 @@
gobject_class->get_property = get_property;
gobject_class->finalize = finalize;
+
+ g_object_class_install_property (gobject_class, PROP_TILE_WIDTH,
+ g_param_spec_int ("tile-width", "Tile width", "default tile width for created buffers.",
+ 0, G_MAXINT, 64,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class, PROP_TILE_HEIGHT,
+ g_param_spec_int ("tile-height", "Tile height", "default tile heightfor created buffers.",
+ 0, G_MAXINT, 64,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (gobject_class, PROP_CACHE_SIZE,
- g_param_spec_double ("cachei-size", "Cache size", "size of cache in bytes",
- 0.0, 1.0, 1.0,
+ g_param_spec_int ("cache-size", "Cache size", "size of cache in bytes",
+ 0, G_MAXINT, 256*1024*1024,
+ G_PARAM_READWRITE));
+
+
+ g_object_class_install_property (gobject_class, PROP_CHUNK_SIZE,
+ g_param_spec_int ("chunk-size", "Chunk size",
+ "the number of pixels processed simulatnously by GEGL.",
+ 1, G_MAXINT, 256*300,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_QUALITY,
@@ -137,8 +179,8 @@
0.0, 1.0, 1.0,
G_PARAM_READWRITE));
- g_object_class_install_property (gobject_class, PROP_BABL_ERROR,
- g_param_spec_double ("babl-error", "babl error", "the error tolerance babl operates with",
+ g_object_class_install_property (gobject_class, PROP_BABL_TOLERANCE,
+ g_param_spec_double ("babl-tolerance", "babl error", "the error tolerance babl operates with",
0.0, 0.2, 0.0001,
G_PARAM_READWRITE));
@@ -150,7 +192,10 @@
static void
gegl_config_init (GeglConfig *self)
{
- self->swap = NULL;
- self->quality = 1.0;
- self->cache_size = 256*1024*1024;
+ self->swap = NULL;
+ self->quality = 1.0;
+ self->cache_size = 256 * 1024 * 1024;
+ self->chunk_size = 256 * 256;
+ self->tile_width = 128;
+ self->tile_height = 64;
}
Modified: branches/branch_zhangjb/gegl/gegl-config.h
==============================================================================
--- branches/branch_zhangjb/gegl/gegl-config.h (original)
+++ branches/branch_zhangjb/gegl/gegl-config.h Thu Jun 19 02:52:46 2008
@@ -40,8 +40,11 @@
gchar *swap;
gint cache_size;
+ gint chunk_size; /* The size of elements being processed at once */
gdouble quality;
- gdouble babl_error;
+ gdouble babl_tolerance;
+ gint tile_width;
+ gint tile_height;
};
struct _GeglConfigClass
Modified: branches/branch_zhangjb/gegl/gegl-init.c
==============================================================================
--- branches/branch_zhangjb/gegl/gegl-init.c (original)
+++ branches/branch_zhangjb/gegl/gegl-init.c Thu Jun 19 02:52:46 2008
@@ -38,7 +38,6 @@
guint gegl_debug_flags = 0;
-
#include "gegl-instrument.h"
#include "gegl-init.h"
#include "module/geglmodule.h"
@@ -157,14 +156,16 @@
static gchar *cmd_gegl_swap=NULL;
static gchar *cmd_gegl_cache_size=NULL;
+static gchar *cmd_gegl_chunk_size=NULL;
static gchar *cmd_gegl_quality=NULL;
-static gchar *cmd_babl_error=NULL;
+static gchar *cmd_gegl_tile_size=NULL;
+static gchar *cmd_babl_tolerance =NULL;
static const GOptionEntry cmd_entries[]=
{
{
- "babl-error", 0, 0,
- G_OPTION_ARG_STRING, &cmd_babl_error,
+ "babl-tolerance", 0, 0,
+ G_OPTION_ARG_STRING, &cmd_babl_tolerance,
N_("babls error tolerance, a value beteen 0.2 and 0.000000001"), "<float>"
},
{
@@ -178,6 +179,16 @@
N_("How much memory to (approximately) use for caching imagery"), "<megabytes>"
},
{
+ "gegl-tile-size", 0, 0,
+ G_OPTION_ARG_STRING, &cmd_gegl_tile_size,
+ N_("Default size of tiles in GeglBuffers"), "<widthxheight>"
+ },
+ {
+ "gegl-chunk-size", 0, 0,
+ G_OPTION_ARG_STRING, &cmd_gegl_chunk_size,
+ N_("The count of pixels to compute simulantous"), "pixel count"
+ },
+ {
"gegl-quality", 0, 0,
G_OPTION_ARG_STRING, &cmd_gegl_quality,
N_("The quality of rendering a value between 0.0(fast) and 1.0(reference)"), "<quality>"
@@ -348,6 +359,16 @@
config->quality = atof(g_getenv("GEGL_QUALITY"));
if (g_getenv ("GEGL_CACHE_SIZE"))
config->cache_size = atoi(g_getenv("GEGL_CACHE_SIZE"))* 1024*1024;
+ if (g_getenv ("GEGL_CHUNK_SIZE"))
+ config->chunk_size = atoi(g_getenv("GEGL_CHUNK_SIZE"));
+ if (g_getenv ("GEGL_TILE_SIZE"))
+ {
+ const gchar *str = g_getenv ("GEGL_TILE_SIZE");
+ config->tile_width = atoi(str);
+ str = strchr (str, 'x');
+ if (str)
+ config->tile_height = atoi(str+1);
+ }
if (gegl_swap_dir())
config->swap = g_strdup(gegl_swap_dir ());
@@ -357,8 +378,19 @@
config->quality = atof (cmd_gegl_quality);
if (cmd_gegl_cache_size)
config->cache_size = atoi (cmd_gegl_cache_size)*1024*1024;
- if (cmd_babl_error)
- g_object_set (config, "babl-error", atof(cmd_babl_error), NULL);
+ if (cmd_gegl_chunk_size)
+ config->chunk_size = atoi (cmd_gegl_chunk_size);
+ if (cmd_gegl_tile_size)
+ {
+ const gchar *str = cmd_gegl_tile_size;
+ config->tile_width = atoi(str);
+ str = strchr (str, 'x');
+ if (str)
+ config->tile_height = atoi(str+1);
+ }
+
+ if (cmd_babl_tolerance)
+ g_object_set (config, "babl-tolerance", atof(cmd_babl_tolerance), NULL);
#ifdef GEGL_ENABLE_DEBUG
{
Modified: branches/branch_zhangjb/gegl/gegl-plugin.h
==============================================================================
--- branches/branch_zhangjb/gegl/gegl-plugin.h (original)
+++ branches/branch_zhangjb/gegl/gegl-plugin.h Thu Jun 19 02:52:46 2008
@@ -30,7 +30,7 @@
/* Extra types needed when coding operations */
typedef struct _GeglOperation GeglOperation;
-typedef struct _GeglNodeContext GeglNodeContext;
+typedef struct _GeglOperationContext GeglOperationContext;
typedef struct _GeglPad GeglPad;
typedef struct _GeglConnection GeglConnection;
@@ -57,86 +57,31 @@
* should be extended so a range of abi versions are accepted.
*/
-#define GEGL_MODULE_ABI_VERSION 0x0008
+#define GEGL_MODULE_ABI_VERSION 0x000A
struct _GeglModuleInfo
{
guint32 abi_version;
};
-GType
-gegl_module_register_type (GTypeModule *module,
- GType parent_type,
- const gchar *type_name,
- const GTypeInfo *type_info,
- GTypeFlags flags);
-
-
-
-GeglBuffer *gegl_node_context_get_source (GeglNodeContext *self,
- const gchar *padname);
-GeglBuffer *gegl_node_context_get_target (GeglNodeContext *self,
- const gchar *padname);
-void gegl_node_context_set_object (GeglNodeContext *context,
- const gchar *padname,
- GObject *data);
-
-void gegl_extension_handler_register (const gchar *extension,
- const gchar *handler);
-const gchar * gegl_extension_handler_get (const gchar *extension);
-
-
-#if defined(__GNUC__) && (__GNUC__ >= 4)
-#define HAS_G4FLOAT 1
-#include <math.h>
-
-typedef float g4float __attribute__ ((vector_size (4*sizeof(float))));
-
-#define g4float_a(a) ((float *)(&a))
-#define g4floatR(a) g4float_a(a)[0]
-#define g4floatG(a) g4float_a(a)[1]
-#define g4floatB(a) g4float_a(a)[2]
-#define g4floatA(a) g4float_a(a)[3]
-#define g4float(a,b,c,d) ((g4float){a,b,c,d})
-#define g4float_all(val) g4float(val,val,val,val)
-#define g4float_zero g4float_all(0.0)
-#define g4float_one g4float_all(1.0)
-#define g4float_half g4float_all(0.5)
-#define g4float_half g4float_all(0.5)
-#define g4float_mul(a,val) g4float_all(val)*(a)
-
-#ifdef USE_SSE
-
-#define g4float_sqrt(v) __builtin_ia32_sqrtps((v))
-#define g4float_max(a,b) __builtin_ia32_maxps((a,b))
-#define g4float_min(a,b) __builtin_ia32_minps((a,b))
-#define g4float_rcp(a,b) __builtin_ia32_rcpps((v))
-
-#else
-
-#define g4float_sqrt(v) g4float(sqrt(g4floatR(v)),\
- sqrt(g4floatG(v)),\
- sqrt(g4floatB(v)),\
- sqrt(g4floatA(v)))
-#define g4float_rcp(v) g4float(1.0/(g4floatR(v)),\
- 1.0/(g4floatG(v)),\
- 1.0/(g4floatB(v)),\
- 1.0/(g4floatA(v)))
-#define g4float_max(a,b) g4float(\
- gfloat4R(a)>gfloat4R(b)?gfloat4R(a):gfloat4R(b),\
- gfloat4G(a)>gfloat4G(b)?gfloat4G(a):gfloat4G(b),\
- gfloat4B(a)>gfloat4B(b)?gfloat4B(a):gfloat4B(b),\
- gfloat4A(a)>gfloat4A(b)?gfloat4A(a):gfloat4A(b))
-#define g4float_min(a,b) g4float(\
- gfloat4R(a)<gfloat4R(b)?gfloat4R(a):gfloat4R(b),\
- gfloat4G(a)<gfloat4G(b)?gfloat4G(a):gfloat4G(b),\
- gfloat4B(a)<gfloat4B(b)?gfloat4B(a):gfloat4B(b),\
- gfloat4A(a)<gfloat4A(b)?gfloat4A(a):gfloat4A(b))
-#endif
+GType gegl_module_register_type (GTypeModule *module,
+ GType parent_type,
+ const gchar *type_name,
+ const GTypeInfo *type_info,
+ GTypeFlags flags);
+
+GeglBuffer *gegl_operation_context_get_source (GeglOperationContext *self,
+ const gchar *padname);
+GeglBuffer *gegl_operation_context_get_target (GeglOperationContext *self,
+ const gchar *padname);
+void gegl_operation_context_set_object (GeglOperationContext *context,
+ const gchar *padname,
+ GObject *data);
+
+void gegl_extension_handler_register (const gchar *extension,
+ const gchar *handler);
+const gchar * gegl_extension_handler_get (const gchar *extension);
-#endif
-
-#if 1
#include <glib-object.h>
#include <babl/babl.h>
@@ -146,431 +91,11 @@
#include <operation/gegl-operation-point-filter.h>
#include <operation/gegl-operation-composer.h>
#include <operation/gegl-operation-point-composer.h>
+#include <operation/gegl-operation-point-render.h>
+#include <operation/gegl-operation-temporal.h>
#include <operation/gegl-operation-source.h>
#include <operation/gegl-operation-sink.h>
#include <operation/gegl-operation-meta.h>
-
-
-#else
-
-/***** ***/
-
-
-#include <glib-object.h>
-#include <babl/babl.h>
-
-
-/***
- * GeglOperation:
- *
- * All the image processing code in GEGL is implemented as
- * GeglOperations, GEGL oeprations are implemented as GObject with a
- * convenience API called chanting that abstracts away the boiler
- * plater needed to generate introspectable named properties of
- * different types.
- *
- * Most types of operations like: filters, composers, sources, sinks,
- * point operations, compositing operations, and spatial operations
- * with fixed neighbourhoods. These base classes builds on top of the
- * GeglOperationsClass:
- *
- * See <a href='gegl-operation.h.html'>gegl-operation.h</a> for details.
- */
-
-#define GEGL_TYPE_OPERATION (gegl_operation_get_type ())
-#define GEGL_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION, GeglOperation))
-#define GEGL_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION, GeglOperationClass))
-#define GEGL_IS_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION))
-#define GEGL_IS_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION))
-#define GEGL_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION, GeglOperationClass))
-
-typedef struct _GeglOperationClass GeglOperationClass;
-
-struct _GeglOperation
-{
- GObject parent_instance;
-
- /*< private >*/
- GeglNode *node; /* the node that this operation object is communicated
- with through */
-};
-
-struct _GeglOperationClass
-{
- GObjectClass parent_class;
-
- const gchar *name; /* name(string) used to create/indetify
- this type of operation in GEGL*/
- const gchar *description; /* textual description of the operation */
- const gchar *categories; /* a colon seperated list of categories */
-
- gboolean no_cache; /* do not create a cache for this operation */
-
- /* attach this operation with a GeglNode, override this if you are creating a
- * GeglGraph, it is already defined for Filters/Sources/Composers.
- */
- void (*attach) (GeglOperation *operation);
-
- /* prepare() is called on each operation providing data to a node that
- * is requested to provide a rendered result. When prepare is called all
- * properties are known. This is the time to set desired pixel formats
- * for input and output pads.
- */
- void (*prepare) (GeglOperation *operation);
-
- /* Returns the bounding rectangle for the data that is defined by this op.
- * (is already implemented in GeglOperationPointFilter and
- * GeglOperationPointComposer, GeglOperationAreaFilter base classes.
- */
- GeglRectangle (*get_bounding_box) (GeglOperation *operation);
-
- /* Computes the region in output (same affected rect assumed for all outputs)
- * when a given region has changed on an input. Used to aggregate dirt in the
- * graph. A default implementation of this, if not provided should probably
- * be to report that the entire defined region is dirtied.
- */
- GeglRectangle (*get_invalidated_by_change) (GeglOperation *operation,
- const gchar *input_pad,
- const GeglRectangle *input_region);
-
- /* Computes the rectangle needed to be correctly computed in a buffer
- * on the named input_pad, for a given region of interest.
- */
- GeglRectangle (*get_required_for_output) (GeglOperation *operation,
- const gchar *input_pad,
- const GeglRectangle *roi);
-
- /* Adjust result rect, adapts the rectangle used for computing results.
- * (useful for global operations like contrast stretching, as well as
- * file loaders to force caching of the full raster).
- */
- GeglRectangle (*get_cached_region) (GeglOperation *operation,
- const GeglRectangle *roi);
-
- /* Perform processing for the @output_pad, pad The result_rect provides the
- * region to process. For sink operations @output_pad can be ignored but the
- * result_rect is then then indicating the data available for consumption.
- */
- gboolean (*process) (GeglOperation *operation,
- GeglNodeContext *context,
- const gchar *output_pad,
- const GeglRectangle *result_rect);
-
- /* XXX: What is GeglNode doing in this part of the API?
- * Returns the node providing data for a specific location within the
- * operations output. Does this recurse?, perhaps it should only point out
- * which pad the data is coming from?
- */
- GeglNode* (*detect) (GeglOperation *operation,
- gint x,
- gint y);
-};
-
-
-
-
-GType gegl_operation_get_type (void) G_GNUC_CONST;
-
-GeglRectangle gegl_operation_get_invalidated_by_change
- (GeglOperation *operation,
- const gchar *input_pad,
- const GeglRectangle *input_region);
-GeglRectangle gegl_operation_get_bounding_box (GeglOperation *operation);
-
-/* retrieves the bounding box of an input pad */
-GeglRectangle * gegl_operation_source_get_bounding_box
- (GeglOperation *operation,
- const gchar *pad_name);
-
-
-GeglRectangle gegl_operation_get_cached_region (GeglOperation *operation,
- const GeglRectangle *roi);
-
-GeglRectangle gegl_operation_get_required_for_output
- (GeglOperation *operation,
- const gchar *input_pad,
- const GeglRectangle *roi);
-
-GeglNode *gegl_operation_detect (GeglOperation *operation,
- gint x,
- gint y);
-
-
-/* virtual method invokers that change behavior based on the roi being computed,
- * needs a context_id being based that is used for storing context data.
- */
-
-void gegl_operation_attach (GeglOperation *operation,
- GeglNode *node);
-void gegl_operation_prepare (GeglOperation *operation);
-gboolean gegl_operation_process (GeglOperation *operation,
- GeglNodeContext *context,
- const gchar *output_pad,
- const GeglRectangle *result_rect);
-
-/* create a pad for a specified property for this operation, this method is
- * to be called from the attach method of operations, most operations do not
- * have to care about this since a super class like filter, sink, source or
- * composer already does so.
- */
-void gegl_operation_create_pad (GeglOperation *operation,
- GParamSpec *param_spec);
-
-/* specify the bablformat for a pad on this operation (XXX: document when
- * this is legal, at the moment, only used internally in some ops,. but might
- * turn into a global mechanism) */
-void gegl_operation_set_format (GeglOperation *operation,
- const gchar *pad_name,
- const Babl *format);
-
-
-const Babl * gegl_operation_get_format (GeglOperation *operation,
- const gchar *pad_name);
-
-
-
-/* retrieves the node providing data to a named input pad */
-GeglNode * gegl_operation_get_source_node (GeglOperation *operation,
- const gchar *pad_name);
-
-
-#define GEGL_TYPE_OPERATION_SOURCE (gegl_operation_source_get_type ())
-#define GEGL_OPERATION_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_SOURCE, GeglOperationSource))
-#define GEGL_OPERATION_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_SOURCE, GeglOperationSourceClass))
-#define GEGL_IS_OPERATION_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_SOURCE, GeglOperationSource))
-#define GEGL_IS_OPERATION_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_SOURCE, GeglOperationSourceClass))
-#define GEGL_OPERATION_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_SOURCE, GeglOperationSourceClass))
-
-typedef struct _GeglOperationSource GeglOperationSource;
-struct _GeglOperationSource
-{
- GeglOperation parent_instance;
-};
-
-typedef struct _GeglOperationSourceClass GeglOperationSourceClass;
-struct _GeglOperationSourceClass
-{
- GeglOperationClass parent_class;
-
- gboolean (* process) (GeglOperation *self,
- GeglBuffer *output,
- const GeglRectangle *result);
-};
-
-GType gegl_operation_source_get_type (void) G_GNUC_CONST;
-
-
-
-#define GEGL_TYPE_OPERATION_SINK (gegl_operation_sink_get_type ())
-#define GEGL_OPERATION_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_SINK, GeglOperationSink))
-#define GEGL_OPERATION_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_SINK, GeglOperationSinkClass))
-#define GEGL_IS_OPERATION_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_SINK))
-#define GEGL_IS_OPERATION_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_SINK))
-#define GEGL_OPERATION_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_SINK, GeglOperationSinkClass))
-
-typedef struct _GeglOperationSink GeglOperationSink;
-struct _GeglOperationSink
-{
- GeglOperation parent_instance;
-};
-
-typedef struct _GeglOperationSinkClass GeglOperationSinkClass;
-struct _GeglOperationSinkClass
-{
- GeglOperationClass parent_class;
-
- gboolean needs_full;
-
- gboolean (* process) (GeglOperation *self,
- GeglBuffer *input,
- const GeglRectangle *result);
-};
-
-GType gegl_operation_sink_get_type (void) G_GNUC_CONST;
-
-gboolean gegl_operation_sink_needs_full (GeglOperation *operation);
-
-
-
-#define GEGL_TYPE_OPERATION_FILTER (gegl_operation_filter_get_type ())
-#define GEGL_OPERATION_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_FILTER, GeglOperationFilter))
-#define GEGL_OPERATION_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_FILTER, GeglOperationFilterClass))
-#define GEGL_IS_OPERATION_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_FILTER))
-#define GEGL_IS_OPERATION_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_FILTER))
-#define GEGL_OPERATION_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_FILTER, GeglOperationFilterClass))
-
-typedef struct _GeglOperationFilter GeglOperationFilter;
-struct _GeglOperationFilter
-{
- GeglOperation parent_instance;
-};
-
-typedef struct _GeglOperationFilterClass GeglOperationFilterClass;
-struct _GeglOperationFilterClass
-{
- GeglOperationClass parent_class;
-
- gboolean (* process) (GeglOperation *self,
- GeglBuffer *input,
- GeglBuffer *output,
- const GeglRectangle *result);
-};
-
-GType gegl_operation_filter_get_type (void) G_GNUC_CONST;
-
-
-#define GEGL_TYPE_OPERATION_COMPOSER (gegl_operation_composer_get_type ())
-#define GEGL_OPERATION_COMPOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_COMPOSER, GeglOperationComposer))
-#define GEGL_OPERATION_COMPOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_COMPOSER, GeglOperationComposerClass))
-#define GEGL_IS_OPERATION_COMPOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_COMPOSER))
-#define GEGL_IS_OPERATION_COMPOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_COMPOSER))
-#define GEGL_OPERATION_COMPOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_COMPOSER, GeglOperationComposerClass))
-
-typedef struct _GeglOperationComposer GeglOperationComposer;
-struct _GeglOperationComposer
-{
- GeglOperation parent_instance;
-};
-
-typedef struct _GeglOperationComposerClass GeglOperationComposerClass;
-struct _GeglOperationComposerClass
-{
- GeglOperationClass parent_class;
-
- gboolean (* process) (GeglOperation *self,
- GeglBuffer *input,
- GeglBuffer *aux,
- GeglBuffer *output,
- const GeglRectangle *result);
-};
-
-GType gegl_operation_composer_get_type (void) G_GNUC_CONST;
-
-
-
-
-#define GEGL_TYPE_OPERATION_POINT_COMPOSER (gegl_operation_point_composer_get_type ())
-#define GEGL_OPERATION_POINT_COMPOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_POINT_COMPOSER, GeglOperationPointComposer))
-#define GEGL_OPERATION_POINT_COMPOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_POINT_COMPOSER, GeglOperationPointComposerClass))
-#define GEGL_IS_OPERATION_POINT_COMPOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_POINT_COMPOSER))
-#define GEGL_IS_OPERATION_POINT_COMPOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_POINT_COMPOSER))
-#define GEGL_OPERATION_POINT_COMPOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_POINT_COMPOSER, GeglOperationPointComposerClass))
-
-typedef struct _GeglOperationPointComposer GeglOperationPointComposer;
-struct _GeglOperationPointComposer
-{
- GeglOperationComposer parent_instance;
-
- /*< private >*/
-};
-
-typedef struct _GeglOperationPointComposerClass GeglOperationPointComposerClass;
-struct _GeglOperationPointComposerClass
-{
- GeglOperationComposerClass parent_class;
-
- gboolean (* process) (GeglOperation *self, /* for parameters */
- void *in,
- void *aux,
- void *out,
- glong samples); /* number of samples */
-
-};
-
-GType gegl_operation_point_composer_get_type (void) G_GNUC_CONST;
-
-
-
-
-#define GEGL_TYPE_OPERATION_POINT_FILTER (gegl_operation_point_filter_get_type ())
-#define GEGL_OPERATION_POINT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_POINT_FILTER, GeglOperationPointFilter))
-#define GEGL_OPERATION_POINT_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_POINT_FILTER, GeglOperationPointFilterClass))
-#define GEGL_IS_OPERATION_POINT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_POINT_FILTER))
-#define GEGL_IS_OPERATION_POINT_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_POINT_FILTER))
-#define GEGL_OPERATION_POINT_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_POINT_FILTER, GeglOperationPointFilterClass))
-
-typedef struct _GeglOperationPointFilter GeglOperationPointFilter;
-struct _GeglOperationPointFilter
-{
- GeglOperationFilter parent_instance;
-};
-
-typedef struct _GeglOperationPointFilterClass GeglOperationPointFilterClass;
-struct _GeglOperationPointFilterClass
-{
- GeglOperationFilterClass parent_class;
-
- gboolean (* process) (GeglOperation *self, /* for parameters */
- void *in_buf, /* input buffer */
- void *out_buf, /* output buffer */
- glong samples); /* number of samples */
-};
-
-GType gegl_operation_point_filter_get_type (void) G_GNUC_CONST;
-
-
-
-#define GEGL_TYPE_OPERATION_AREA_FILTER (gegl_operation_area_filter_get_type ())
-#define GEGL_OPERATION_AREA_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_AREA_FILTER, GeglOperationAreaFilter))
-#define GEGL_OPERATION_AREA_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_AREA_FILTER, GeglOperationAreaFilterClass))
-#define GEGL_IS_OPERATION_AREA_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_AREA_FILTER))
-#define GEGL_IS_OPERATION_AREA_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_AREA_FILTER))
-#define GEGL_OPERATION_AREA_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_AREA_FILTER, GeglOperationAreaFilterClass))
-
-typedef struct _GeglOperationAreaFilter GeglOperationAreaFilter;
-struct _GeglOperationAreaFilter
-{
- GeglOperationFilter parent_instance;
-
- gint left;
- gint right;
- gint top;
- gint bottom;
-};
-
-typedef struct _GeglOperationAreaFilterClass GeglOperationAreaFilterClass;
-struct _GeglOperationAreaFilterClass
-{
- GeglOperationFilterClass parent_class;
-};
-
-GType gegl_operation_area_filter_get_type (void) G_GNUC_CONST;
-
-
-#define GEGL_TYPE_OPERATION_META (gegl_operation_meta_get_type ())
-#define GEGL_OPERATION_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_META, GeglOperationMeta))
-#define GEGL_OPERATION_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_META, GeglOperationMetaClass))
-#define GEGL_IS_OPERATION_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_META))
-#define GEGL_IS_OPERATION_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_META))
-#define GEGL_OPERATION_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_META, GeglOperationMetaClass))
-
-typedef struct _GeglOperationMeta GeglOperationMeta;
-struct _GeglOperationMeta
-{
- GeglOperation parent_instance;
- GSList *redirects;
-};
-
-typedef struct _GeglOperationMetaClass GeglOperationMetaClass;
-struct _GeglOperationMetaClass
-{
- GeglOperationClass parent_class;
-};
-
-
-GType gegl_operation_meta_get_type (void) G_GNUC_CONST;
-
-void gegl_operation_meta_redirect (GeglOperation *operation,
- const gchar *name,
- GeglNode *internal,
- const gchar *internal_name);
-
-void gegl_operation_meta_property_changed (GeglOperationMeta *self,
- GParamSpec *arg1,
- gpointer user_data);
-
-
-
-#endif
+#include <gegl-simd.h>
#endif /* __GEGL_PLUGIN_H__ */
Modified: branches/branch_zhangjb/gegl/gegl-types.h
==============================================================================
--- branches/branch_zhangjb/gegl/gegl-types.h (original)
+++ branches/branch_zhangjb/gegl/gegl-types.h Thu Jun 19 02:52:46 2008
@@ -56,7 +56,7 @@
#ifndef __GEGL_PLUGIN_H__
typedef struct _GeglPad GeglPad;
typedef struct _GeglOperation GeglOperation;
-typedef struct _GeglNodeContext GeglNodeContext;
+typedef struct _GeglOperationContext GeglOperationContext;
typedef struct _GeglConnection GeglConnection;
#endif
typedef struct _GeglPrepareVisitor GeglPrepareVisitor;
Modified: branches/branch_zhangjb/gegl/graph/Makefile.am
==============================================================================
--- branches/branch_zhangjb/gegl/graph/Makefile.am (original)
+++ branches/branch_zhangjb/gegl/graph/Makefile.am Thu Jun 19 02:52:46 2008
@@ -3,7 +3,6 @@
GRAPH_sources = \
gegl-connection.c \
gegl-node.c \
- gegl-node-context.c \
gegl-pad.c \
gegl-visitor.c \
gegl-visitable.c
@@ -12,7 +11,6 @@
GRAPH_headers = \
gegl-connection.h \
gegl-node.h \
- gegl-node-context.h \
gegl-pad.h \
gegl-visitor.h \
gegl-visitable.h
Modified: branches/branch_zhangjb/gegl/graph/gegl-node.c
==============================================================================
--- branches/branch_zhangjb/gegl/graph/gegl-node.c (original)
+++ branches/branch_zhangjb/gegl/graph/gegl-node.c Thu Jun 19 02:52:46 2008
@@ -67,6 +67,7 @@
GeglNode *parent;
gchar *name;
GeglProcessor *processor;
+ GHashTable *contexts;
};
@@ -150,7 +151,7 @@
g_param_spec_boolean ("dont-cache",
"Do not cache",
"Do not cache the result of this operation, the property is inherithed by children created from a node.",
- TRUE,
+ TRUE,
G_PARAM_READWRITE));
@@ -208,6 +209,7 @@
priv->children = NULL;
priv->name = NULL;
priv->processor = NULL;
+ priv->contexts = g_hash_table_new (NULL, NULL);
}
static void
@@ -278,6 +280,7 @@
{
g_free (priv->name);
}
+ g_hash_table_destroy (priv->contexts);
G_OBJECT_CLASS (gegl_node_parent_class)->finalize (gobject);
}
@@ -301,7 +304,16 @@
break;
case PROP_OP_CLASS:
- gegl_node_set_op_class (node, g_value_get_string (value), NULL, NULL);
+ {
+ va_list null; /* dummy to pass along, it's not used anyways since
+ * the preceding argument is NULL, gcc might warn about
+ * use of uninitialized variable.
+ */
+#if defined(__GNUC__)
+ memset(&null, 0, sizeof(null));
+#endif
+ gegl_node_set_op_class (node, g_value_get_string (value), NULL, null);
+ }
break;
case PROP_OPERATION:
@@ -948,7 +960,8 @@
}
if (node->operation &&
- type == G_OBJECT_TYPE (node->operation))
+ type == G_OBJECT_TYPE (node->operation) &&
+ first_property)
{
gegl_node_set_valist (node, first_property, var_args);
return;
@@ -1387,22 +1400,15 @@
void
gegl_node_set_need_rect (GeglNode *node,
gpointer context_id,
- gint x,
- gint y,
- gint width,
- gint height)
+ const GeglRectangle *rect)
{
- GeglNodeContext *context;
+ GeglOperationContext *context;
g_return_if_fail (GEGL_IS_NODE (node));
g_return_if_fail (context_id != NULL);
context = gegl_node_get_context (node, context_id);
-
- context->need_rect.x = x;
- context->need_rect.y = y;
- context->need_rect.width = width;
- context->need_rect.height = height;
+ gegl_operation_context_set_need_rect (context, rect);
}
const gchar *
@@ -1507,6 +1513,8 @@
return root->have_rect;
}
+#if 1
+
void
gegl_node_process (GeglNode *self)
{
@@ -1520,7 +1528,7 @@
gegl_processor_destroy (processor);
}
-#if 0
+#else
/* simplest form of GeglProcess that processes all data in one
*
* single large chunk
@@ -1529,7 +1537,7 @@
gegl_node_process (GeglNode *self)
{
GeglNode *input;
- GeglNodeContext *context;
+ GeglOperationContext *context;
GeglBuffer *buffer;
GeglRectangle defined;
@@ -1548,44 +1556,33 @@
GValue value = { 0, };
g_value_init (&value, GEGL_TYPE_BUFFER);
g_value_set_object (&value, buffer);
- gegl_node_context_set_property (context, "input", &value);
+ gegl_operation_context_set_property (context, "input", &value);
g_value_unset (&value);
}
- gegl_node_context_set_result_rect (context, defined.x, defined.y, defined.width, defined.h);
+ gegl_operation_context_set_result_rect (context, defined.x, defined.y, defined.width, defined.h);
gegl_operation_process (self->operation, &defined, "foo");
gegl_node_remove_context (self, &defined);
g_object_unref (buffer);
}
#endif
-static gint
-lookup_context (gconstpointer a,
- gconstpointer context_id)
-{
- GeglNodeContext *context = (void *) a;
-
- if (context->context_id == context_id)
- return 0;
- return -1;
-}
-
void babl_backtrack (void);
-GeglNodeContext *
+GeglOperationContext *
gegl_node_get_context (GeglNode *self,
gpointer context_id)
{
- GSList *found;
- GeglNodeContext *context = NULL;
+ GeglOperationContext *context = NULL;
+ GeglNodePrivate *priv;
g_return_val_if_fail (GEGL_IS_NODE (self), NULL);
g_return_val_if_fail (context_id != NULL, NULL);
- found = g_slist_find_custom (self->context, context_id, lookup_context);
- if (found)
- context = found->data;
- else
+ priv = GEGL_NODE_GET_PRIVATE (self);
+
+ context = g_hash_table_lookup (priv->contexts, context_id);
+ if (!context)
{
g_warning ("didn't find %p", context_id);
babl_backtrack ();
@@ -1597,7 +1594,8 @@
gegl_node_remove_context (GeglNode *self,
gpointer context_id)
{
- GeglNodeContext *context;
+ GeglOperationContext *context;
+ GeglNodePrivate *priv;
g_return_if_fail (GEGL_IS_NODE (self));
g_return_if_fail (context_id != NULL);
@@ -1609,24 +1607,23 @@
context_id, gegl_node_get_debug_name (self));
return;
}
- self->context = g_slist_remove (self->context, context);
+ priv = GEGL_NODE_GET_PRIVATE (self);
+ g_hash_table_remove (priv->contexts, context_id);
g_object_unref (context);
}
-GeglNodeContext *
+GeglOperationContext *
gegl_node_add_context (GeglNode *self,
gpointer context_id)
{
- GeglNodeContext *context = NULL;
- GSList *found;
+ GeglOperationContext *context = NULL;
+ GeglNodePrivate *priv;
g_return_val_if_fail (GEGL_IS_NODE (self), NULL);
g_return_val_if_fail (context_id != NULL, NULL);
- found = g_slist_find_custom (self->context, context_id, lookup_context);
-
- if (found)
- context = found->data;
+ priv = GEGL_NODE_GET_PRIVATE (self);
+ context = g_hash_table_lookup (priv->contexts, context_id);
if (context)
{
@@ -1635,10 +1632,9 @@
return context;
}
- context = g_object_new (GEGL_TYPE_NODE_CONTEXT, NULL);
- context->node = self;
- context->context_id = context_id;
- self->context = g_slist_prepend (self->context, context);
+ context = g_object_new (GEGL_TYPE_OPERATION_CONTEXT, NULL);
+ context->operation = self->operation;
+ g_hash_table_insert (priv->contexts, context_id, context);
return context;
}
Modified: branches/branch_zhangjb/gegl/graph/gegl-node.h
==============================================================================
--- branches/branch_zhangjb/gegl/graph/gegl-node.h (original)
+++ branches/branch_zhangjb/gegl/graph/gegl-node.h Thu Jun 19 02:52:46 2008
@@ -20,7 +20,7 @@
#ifndef __GEGL_NODE_H__
#define __GEGL_NODE_H__
-#include "gegl-node-context.h"
+#include "operation/gegl-operation-context.h"
#include <gegl/buffer/gegl-buffer.h>
#include <gegl/buffer/gegl-cache.h>
@@ -54,8 +54,6 @@
gboolean is_root;
gboolean enabled;
- GSList *context; /*< list of GeglNodeContext's corresponding to
- evaluation contexts */
gboolean is_graph;
GeglCache *cache; /* For a node, the cache should be created at
@@ -133,11 +131,11 @@
GType gegl_node_get_type (void) G_GNUC_CONST;
-GeglNodeContext *gegl_node_get_context (GeglNode *self,
+GeglOperationContext *gegl_node_get_context (GeglNode *self,
gpointer context_id);
void gegl_node_remove_context (GeglNode *self,
gpointer context_id);
-GeglNodeContext *gegl_node_add_context (GeglNode *self,
+GeglOperationContext *gegl_node_add_context (GeglNode *self,
gpointer context_id);
void gegl_node_add_pad (GeglNode *self,
@@ -173,10 +171,7 @@
const gchar *property_name);
void gegl_node_set_need_rect (GeglNode *node,
gpointer context_id,
- gint x,
- gint y,
- gint width,
- gint height);
+ const GeglRectangle *rect);
/* Graph related member functions of the GeglNode class */
Modified: branches/branch_zhangjb/gegl/operation/Makefile.am
==============================================================================
--- branches/branch_zhangjb/gegl/operation/Makefile.am (original)
+++ branches/branch_zhangjb/gegl/operation/Makefile.am Thu Jun 19 02:52:46 2008
@@ -1,47 +1,54 @@
noinst_LTLIBRARIES = liboperation.la
OPERATION_sources = \
- gegl-extension-handler.c \
- gegl-operation.c \
- gegl-operation-area-filter.c \
- gegl-operation-composer.c \
- gegl-operation-filter.c \
- gegl-operation-meta.c \
- gegl-operation-point-composer.c \
- gegl-operation-point-filter.c \
- gegl-operation-sink.c \
- gegl-operation-source.c \
- gegl-operation-processors.c \
+ gegl-extension-handler.c \
+ gegl-operation.c \
+ gegl-operation-area-filter.c \
+ gegl-operation-composer.c \
+ gegl-operation-filter.c \
+ gegl-operation-meta.c \
+ gegl-operation-point-composer.c \
+ gegl-operation-point-filter.c \
+ gegl-operation-point-render.c \
+ gegl-operation-sink.c \
+ gegl-operation-source.c \
+ gegl-operation-temporal.c \
+ gegl-operation-processors.c \
+ gegl-operation-context.c \
gegl-operations.c
-
OPERATION_headers = \
- gegl-extension-handler.h \
- gegl-operation.h \
- gegl-operation-composer.h \
- gegl-operation-area-filter.h \
- gegl-operation-filter.h \
- gegl-operation-meta.h \
- gegl-operation-point-composer.h \
- gegl-operation-point-filter.h \
- gegl-operation-sink.h \
- gegl-operation-source.h \
+ gegl-extension-handler.h \
+ gegl-operation.h \
+ gegl-operation-area-filter.h \
+ gegl-operation-composer.h \
+ gegl-operation-filter.h \
+ gegl-operation-meta.h \
+ gegl-operation-point-composer.h \
+ gegl-operation-point-filter.h \
+ gegl-operation-point-render.h \
+ gegl-operation-sink.h \
+ gegl-operation-source.h \
+ gegl-operation-temporal.h \
+ gegl-operation-context.h \
gegl-operations.h
public_headers = \
- gegl-operation.h \
- gegl-operation-composer.h \
- gegl-operation-area-filter.h \
- gegl-operation-filter.h \
- gegl-operation-meta.h \
- gegl-operation-point-composer.h \
- gegl-operation-point-filter.h \
- gegl-operation-sink.h \
- gegl-operation-source.h
+ gegl-operation.h \
+ gegl-operation-area-filter.h \
+ gegl-operation-composer.h \
+ gegl-operation-filter.h \
+ gegl-operation-meta.h \
+ gegl-operation-point-composer.h \
+ gegl-operation-point-filter.h \
+ gegl-operation-point-render.h \
+ gegl-operation-sink.h \
+ gegl-operation-source.h \
+ gegl-operation-temporal.h
-liboperation_la_SOURCES = $(OPERATION_sources) $(public_headers)
-liboperationinclude_HEADERS = $(OPERATION_headers)
+liboperation_la_SOURCES = $(OPERATION_sources) $(OPERATION_headers)
+liboperationinclude_HEADERS = $(public_headers)
liboperationincludedir = $(includedir)/gegl-$(GEGL_API_VERSION)/operation
INCLUDES = \
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-composer.c
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-composer.c (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-composer.c Thu Jun 19 02:52:46 2008
@@ -47,8 +47,8 @@
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static gboolean process (GeglOperation *operation,
- GeglNodeContext *context,
+static gboolean gegl_operation_composer_process (GeglOperation *operation,
+ GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result);
static void attach (GeglOperation *operation);
@@ -74,7 +74,7 @@
object_class->set_property = set_property;
object_class->get_property = get_property;
- operation_class->process = process;
+ operation_class->process = gegl_operation_composer_process;
operation_class->attach = attach;
operation_class->detect = detect;
operation_class->get_bounding_box = get_bounding_box;
@@ -144,10 +144,10 @@
}
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
- const gchar *output_prop,
- const GeglRectangle *result)
+gegl_operation_composer_process (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result)
{
GeglOperationComposerClass *klass = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
GeglBuffer *input;
@@ -161,9 +161,9 @@
return FALSE;
}
- input = gegl_node_context_get_source (context, "input");
- aux = gegl_node_context_get_source (context, "aux");
- output = gegl_node_context_get_target (context, "output");
+ input = gegl_operation_context_get_source (context, "input");
+ aux = gegl_operation_context_get_source (context, "aux");
+ output = gegl_operation_context_get_target (context, "output");
/* A composer with a NULL aux, can still be valid, the
* subclass has to handle it.
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-filter.c
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-filter.c (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-filter.c Thu Jun 19 02:52:46 2008
@@ -39,24 +39,25 @@
};
static void get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static gboolean process (GeglOperation *operation,
- GeglNodeContext *context,
- const gchar *output_prop,
- const GeglRectangle *result);
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static gboolean gegl_operation_filter_process
+ (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result);
static void attach (GeglOperation *operation);
-static GeglNode *detect (GeglOperation *operation,
- gint x,
- gint y);
+static GeglNode *detect (GeglOperation *operation,
+ gint x,
+ gint y);
static GeglRectangle get_bounding_box (GeglOperation *self);
static GeglRectangle get_required_for_output (GeglOperation *operation,
@@ -76,7 +77,7 @@
object_class->set_property = set_property;
object_class->get_property = get_property;
- operation_class->process = process;
+ operation_class->process = gegl_operation_filter_process;
operation_class->attach = attach;
operation_class->detect = detect;
operation_class->get_bounding_box = get_bounding_box;
@@ -179,10 +180,10 @@
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
- const gchar *output_prop,
- const GeglRectangle *result)
+gegl_operation_filter_process (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result)
{
GeglOperationFilter *gegl_operation_filter;
GeglOperationFilterClass *klass;
@@ -201,8 +202,8 @@
return FALSE;
}
- input = gegl_node_context_get_source (context, "input");
- output = gegl_node_context_get_target (context, "output");
+ input = gegl_operation_context_get_source (context, "input");
+ output = gegl_operation_context_get_target (context, "output");
if (input != NULL)
{ /* FIXME: perhaps input should really be passed instead of context */
success = klass->process (operation, input, output, result);
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-point-composer.c
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-point-composer.c (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-point-composer.c Thu Jun 19 02:52:46 2008
@@ -28,12 +28,19 @@
#include "graph/gegl-pad.h"
#include <string.h>
-static gboolean process_inner (GeglOperation *operation,
+static gboolean gegl_operation_point_composer_process
+ (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *aux,
GeglBuffer *output,
const GeglRectangle *result);
+static gboolean
+gegl_operation_composer_process2 (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result);
+
G_DEFINE_TYPE (GeglOperationPointComposer, gegl_operation_point_composer, GEGL_TYPE_OPERATION_COMPOSER)
static void prepare (GeglOperation *operation)
@@ -51,9 +58,10 @@
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
GeglOperationComposerClass *composer_class = GEGL_OPERATION_COMPOSER_CLASS (klass);
- composer_class->process = process_inner;
+ composer_class->process = gegl_operation_point_composer_process;
operation_class->prepare = prepare;
operation_class->no_cache =TRUE;
+ operation_class->process = gegl_operation_composer_process2;
}
static void
@@ -62,146 +70,62 @@
}
-#if 0 /* FIXME: this should be re-enabled, possibly by skipping the point-composer class duplicating that
- * code and directly implement on top of GeglOperation
- */
-static gboolean
-fast_paths (GeglOperation *operation,
- GeglNodeContext *context,
- const Babl *in_format,
- const Babl *aux_format,
- const Babl *out_format,
- const GeglRectangle *result);
-#endif
-
+/* we replicate the process function from GeglOperationComposer to be
+ * able to bail out earlier for some common processing time pitfalls
+ */
static gboolean
-process_inner (GeglOperation *operation,
- GeglBuffer *input,
- GeglBuffer *aux,
- GeglBuffer *output,
- const GeglRectangle *result)
+gegl_operation_composer_process2 (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result)
{
- GeglPad *pad;
- const Babl *in_format;
- const Babl *aux_format;
- const Babl *out_format;
-
- pad = gegl_node_get_pad (operation->node, "input");
- in_format = gegl_pad_get_format (pad);
- if (!in_format)
- {
- g_warning ("%s", gegl_node_get_debug_name (operation->node));
- }
- g_assert (in_format);
+ GeglOperationComposerClass *klass = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
+ GeglBuffer *input;
+ GeglBuffer *aux;
+ GeglBuffer *output;
+ gboolean success = FALSE;
- pad = gegl_node_get_pad (operation->node, "aux");
- aux_format = gegl_pad_get_format (pad);
- if (!aux_format)
+ if (strcmp (output_prop, "output"))
{
- g_warning ("%s", gegl_node_get_debug_name (operation->node));
+ g_warning ("requested processing of %s pad on a composer", output_prop);
+ return FALSE;
}
- g_assert (aux_format);
- pad = gegl_node_get_pad (operation->node, "output");
- out_format = gegl_pad_get_format (pad);
- if (!out_format)
- {
- g_warning ("%s", gegl_node_get_debug_name (operation->node));
- }
- g_assert (out_format);
+ input = gegl_operation_context_get_source (context, "input");
+ aux = gegl_operation_context_get_source (context, "aux");
- /* XXX: when disabling fast_paths everything should work, albeit slower,
- * disabling of fast paths can be tried when things appear strange, debugging
- * with and without fast paths when tracking buffer leaks is probably also a
- * good idea. NB! some of the OpenRaster meta ops, depends on the
- * short-circuiting happening in fast_paths.
- * */
-#if 0
- if (0 && fast_paths (operation, context,
- in_format,
- aux_format,
- out_format,
- result))
- return TRUE;
-#endif
+ /* we could be even faster by not alway writing to this buffer, that
+ * would potentially break other assumptions we want to make from the
+ * GEGL core so we avoid doing that
+ */
+ output = gegl_operation_context_get_target (context, "output");
-#if 0
- /* retrieve the buffer we're writing to from GEGL */
- output = gegl_node_context_get_target (context, "output");
-#endif
- if ((result->width > 0) && (result->height > 0))
+ if (input != NULL ||
+ aux != NULL)
{
- gfloat *in_buf = NULL, *out_buf = NULL, *aux_buf = NULL;
-
- in_buf = gegl_malloc (in_format->format.bytes_per_pixel *
- output->extent.width * output->extent.height);
- if (in_format == out_format)
- {
- out_buf = in_buf;
- }
- else
- {
- out_buf = gegl_malloc (out_format->format.bytes_per_pixel *
- output->extent.width * output->extent.height);
- }
+ gboolean done = FALSE;
- gegl_buffer_get (input, 1.0, result, in_format, in_buf, GEGL_AUTO_ROWSTRIDE);
-
- if (aux)
+ if (result->width == 0 ||
+ result->height == 0)
+ done = TRUE;
+
+#if 1 /* this can be set to 0, and everything should work normally,
+ but some fast paths would not be taken */
+ if (!strcmp (gegl_node_get_operation (operation->node), "over"))
{
- aux_buf = gegl_malloc (aux_format->format.bytes_per_pixel *
- output->extent.width * output->extent.height);
- gegl_buffer_get (aux, 1.0, result, aux_format, aux_buf, GEGL_AUTO_ROWSTRIDE);
- }
- {
- GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
- operation,
- in_buf,
- aux_buf,
- out_buf,
- output->extent.width * output->extent.height);
- }
-
- gegl_buffer_set (output, NULL, out_format, out_buf, GEGL_AUTO_ROWSTRIDE);
-
- gegl_free (in_buf);
- if (in_format != out_format)
- gegl_free (out_buf);
- if (aux)
- gegl_free (aux_buf);
- }
- return TRUE;
-}
+ /* these optimizations probably apply to more than over */
-#if 0
-static gboolean
-fast_paths (GeglOperation *operation,
- GeglNodeContext *context,
- const Babl *in_format,
- const Babl *aux_format,
- const Babl *out_format,
- const GeglRectangle *result)
-{
- GeglBuffer *input = gegl_node_context_get_source (context, "input");
- GeglBuffer *aux = gegl_node_context_get_source (context, "aux");
+ if ((result->width > 0) && (result->height > 0))
- if (!input && aux)
- {
- g_object_ref (aux);
- gegl_node_context_set_object (context, "output", G_OBJECT (aux));
- return TRUE;
- }
+ if (input && aux==NULL)
+ {
+ gegl_buffer_copy (input, result, output, result);
+ done = TRUE;
+ }
- {
- if ((result->width > 0) && (result->height > 0))
- {
-
- const gchar *op = gegl_node_get_operation (operation->node);
- if (!strcmp (op, "over")) /* these optimizations probably apply to more than
- over */
- {
-/* SKIP_EMPTY_IN */
+ /* SKIP_EMPTY_IN */
+ if(!done)
{
const GeglRectangle *in_abyss;
@@ -216,17 +140,18 @@
if (!gegl_rectangle_intersect (NULL, aux_abyss, result))
{
- GeglBuffer *output = gegl_buffer_new (NULL, NULL);
- gegl_node_context_set_object (context, "output", G_OBJECT (output));
- return TRUE;
+ done = TRUE;
+ }
+ else
+ {
+ gegl_buffer_copy (aux, result, output, result);
+ done = TRUE;
}
- g_object_ref (aux);
- gegl_node_context_set_object (context, "output", G_OBJECT (aux));
- return TRUE;
}
}
/* SKIP_EMPTY_AUX */
- {
+ if(!done)
+ {
const GeglRectangle *aux_abyss = NULL;
if (aux)
@@ -235,20 +160,66 @@
if (!aux ||
(aux && !gegl_rectangle_intersect (NULL, aux_abyss, result)))
{
- g_object_ref (input);
- gegl_node_context_set_object (context, "output", G_OBJECT (input));
- return TRUE;
+ gegl_buffer_copy (input, result, output, result);
+ done = TRUE;
}
}
- }
- }
- else
- {
- GeglBuffer *output = gegl_buffer_new (NULL, out_format);
- gegl_node_context_set_object (context, "output", G_OBJECT (output));
- return TRUE;
}
- }
- return FALSE;
-}
#endif
+
+ success = done;
+ if (!done)
+ {
+ success = klass->process (operation, input, aux, output, result);
+ }
+ if (input)
+ g_object_unref (input);
+ if (aux)
+ g_object_unref (aux);
+ }
+ else
+ {
+ g_warning ("%s received NULL input and aux",
+ gegl_node_get_debug_name (operation->node));
+ }
+
+ return success;
+}
+
+static gboolean
+gegl_operation_point_composer_process (GeglOperation *operation,
+ GeglBuffer *input,
+ GeglBuffer *aux,
+ GeglBuffer *output,
+ const GeglRectangle *result)
+{
+ GeglOperationPointComposerClass *point_composer_class = GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation);
+ const Babl *in_format = gegl_operation_get_format (operation, "input");
+ const Babl *aux_format = gegl_operation_get_format (operation, "aux");
+ const Babl *out_format = gegl_operation_get_format (operation, "output");
+
+ if ((result->width > 0) && (result->height > 0))
+ {
+ GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, out_format, GEGL_BUFFER_WRITE);
+ gint read = gegl_buffer_iterator_add (i, input, result, in_format, GEGL_BUFFER_READ);
+
+ if (aux)
+ {
+ gint foo = gegl_buffer_iterator_add (i, aux, result, aux_format, GEGL_BUFFER_READ);
+
+ while (gegl_buffer_iterator_next (i))
+ {
+ point_composer_class->process (operation, i->data[read], i->data[foo], i->data[0], i->length, &(i->roi[0]));
+ }
+ }
+ else
+ {
+ while (gegl_buffer_iterator_next (i))
+ {
+ point_composer_class->process (operation, i->data[read], NULL, i->data[0], i->length, &(i->roi[0]));
+ }
+ }
+ return TRUE;
+ }
+ return TRUE;
+}
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-point-composer.h
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-point-composer.h (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-point-composer.h Thu Jun 19 02:52:46 2008
@@ -43,11 +43,13 @@
{
GeglOperationComposerClass parent_class;
- gboolean (* process) (GeglOperation *self, /* for parameters */
- void *in,
- void *aux,
- void *out,
- glong samples); /* number of samples */
+ gboolean (* process) (GeglOperation *self, /* for parameters */
+ void *in,
+ void *aux,
+ void *out,
+ glong samples, /* number of samples */
+ const GeglRectangle *roi /* rectangular region in output buffer */
+ );
};
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-point-filter.c
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-point-filter.c (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-point-filter.c Thu Jun 19 02:52:46 2008
@@ -31,7 +31,8 @@
#include "gegl-buffer-private.h"
#include "gegl-tile-storage.h"
-static gboolean process_inner (GeglOperation *operation,
+static gboolean gegl_operation_point_filter_process
+ (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result);
@@ -50,7 +51,7 @@
GeglOperationFilterClass *filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
- filter_class->process = process_inner;
+ filter_class->process = gegl_operation_point_filter_process;
operation_class->prepare = prepare;
}
@@ -61,184 +62,24 @@
static gboolean
-process_inner (GeglOperation *operation,
- GeglBuffer *input,
- GeglBuffer *output,
- const GeglRectangle *result)
+gegl_operation_point_filter_process (GeglOperation *operation,
+ GeglBuffer *input,
+ GeglBuffer *output,
+ const GeglRectangle *result)
{
- GeglPad *pad;
- const Babl *in_format;
- const Babl *out_format;
+ const Babl *in_format = gegl_operation_get_format (operation, "input");
+ const Babl *out_format = gegl_operation_get_format (operation, "output");
GeglOperationPointFilterClass *point_filter_class;
point_filter_class = GEGL_OPERATION_POINT_FILTER_GET_CLASS (operation);
- pad = gegl_node_get_pad (operation->node, "input");
- in_format = gegl_pad_get_format (pad);
- if (!in_format)
- {
- g_warning ("%s", gegl_node_get_debug_name (operation->node));
- }
- g_assert (in_format);
-
- pad = gegl_node_get_pad (operation->node, "output");
- out_format = gegl_pad_get_format (pad);
- if (!out_format)
- {
- g_warning ("%s", gegl_node_get_debug_name (operation->node));
- }
- g_assert (out_format);
-
if ((result->width > 0) && (result->height > 0))
{
- if (gegl_buffer_scan_compatible (input, output))
- /* We can use the fastest possible path with the least possible
- * copies using paralell scan iteratator with possibly direct
- * read write access to buffers.
- */
- {
- gint input_bpp = in_format->format.bytes_per_pixel;
- gint output_bpp = output->format->format.bytes_per_pixel;
- gpointer *in_buf = NULL;
- gpointer *out_buf = NULL;
- Babl *infish;
- Babl *outfish;
-
- GeglBufferScanIterator read;
- GeglBufferScanIterator write;
- gegl_buffer_scan_iterator_init (&read, input, *result, FALSE);
- gegl_buffer_scan_iterator_init (&write, output, *result, TRUE);
-
- g_assert (input->tile_storage->tile_width == output->tile_storage->tile_width);
-
-
- infish = babl_fish (input->format, in_format);
- outfish = babl_fish (out_format, output->format);
-
- gegl_buffer_lock (output);
- {
- gboolean a = FALSE, b = FALSE;
- if (in_format == input->format &&
- out_format == output->format)
- {
- while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
- (b = gegl_buffer_scan_iterator_next (&write)))
- {
- g_assert (read.width == write.width);
- point_filter_class->process (operation, read.data, write.data, write.width);
- }
- }
- else if (in_format == input->format &&
- out_format != output->format)
- {
- out_buf = gegl_malloc (output_bpp * write.max_size);
- while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
- (b = gegl_buffer_scan_iterator_next (&write)))
- {
- g_assert (read.width == write.width);
- point_filter_class->process (operation, read.data, out_buf, read.width);
- babl_process (outfish, out_buf, write.data, write.width);
- }
- }
- else if (in_format != input->format &&
- out_format == output->format)
- {
- in_buf = gegl_malloc (input_bpp * read.max_size);
- while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
- (b = gegl_buffer_scan_iterator_next (&write)))
- {
- if (read.width < 0)
- continue;
- g_assert (read.width == write.width);
- babl_process (infish, read.data, in_buf, read.width);
- point_filter_class->process (operation, in_buf, write.data, read.width);
- }
- }
- else if (in_format != input->format &&
- out_format != output->format)
- {
- in_buf = gegl_malloc (input_bpp * read.max_size);
- out_buf = gegl_malloc (output_bpp * write.max_size);
- while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
- (b = gegl_buffer_scan_iterator_next (&write)))
- {
- g_assert (read.width == write.width);
- babl_process (infish, read.data, in_buf, read.width);
- point_filter_class->process (operation, in_buf, out_buf, read.width);
- babl_process (outfish, out_buf, write.data, write.width);
- }
- }
-
- if (a)
- while (gegl_buffer_scan_iterator_next (&read));
- if (b)
- while (gegl_buffer_scan_iterator_next (&write));
- }
-
- if (in_buf)
- gegl_free (in_buf);
- if (out_buf)
- gegl_free (out_buf);
- gegl_buffer_unlock (output);
- }
-#if 0
- else
- /* do the entire buffer */
- {
- gfloat *in_buf;
- gfloat *out_buf;
- in_buf = gegl_malloc (in_format->format.bytes_per_pixel *
- input->extent.width * input->extent.height);
- out_buf = gegl_malloc (out_format->format.bytes_per_pixel *
- output->extent.width * output->extent.height);
-
- gegl_buffer_get (input, 1.0, result, in_format, in_buf, GEGL_AUTO_ROWSTRIDE);
-
- GEGL_OPERATION_POINT_FILTER_GET_CLASS (operation)->process (
- operation,
- in_buf,
- out_buf,
- output->extent.width * output->extent.height);
-
- gegl_buffer_set (output, result, out_format, out_buf, GEGL_AUTO_ROWSTRIDE);
- gegl_free (in_buf);
- gegl_free (out_buf);
-#else
- else
- /* do it in vertical chunks of 32 scanlines */
- {
- gfloat *in_buf;
- GeglRectangle roi;
- gint skip = 32;
- gfloat *out_buf;
- in_buf = gegl_malloc (in_format->format.bytes_per_pixel * result->width * skip);
- out_buf = gegl_malloc (out_format->format.bytes_per_pixel * result->width * skip);
-
-
- roi = *result;
- while (roi.y < result->y + result->height && skip >0 )
- {
- for (roi.height=skip; (roi.y + skip <= result->y + result->height);
- roi.y+=skip)
- {
- gegl_buffer_get (input, 1.0, &roi, in_format, in_buf, GEGL_AUTO_ROWSTRIDE);
-
- GEGL_OPERATION_POINT_FILTER_GET_CLASS (operation)->process (
- operation,
- in_buf,
- out_buf,
- result->width * skip);
-
- gegl_buffer_set (output, &roi, out_format, out_buf, GEGL_AUTO_ROWSTRIDE);
- }
- skip /= 2;
- }
-
-
- gegl_free (in_buf);
- gegl_free (out_buf);
- }
-#endif
+ GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, out_format, GEGL_BUFFER_WRITE);
+ gint read = gegl_buffer_iterator_add (i, input, result, in_format, GEGL_BUFFER_READ);
+ while (gegl_buffer_iterator_next (i))
+ point_filter_class->process (operation, i->data[read], i->data[0], i->length, &i->roi[0]);
+
}
return TRUE;
}
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-point-filter.h
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-point-filter.h (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-point-filter.h Thu Jun 19 02:52:46 2008
@@ -41,10 +41,14 @@
{
GeglOperationFilterClass parent_class;
- gboolean (* process) (GeglOperation *self, /* for parameters */
- void *in_buf, /* input buffer */
- void *out_buf, /* output buffer */
- glong samples); /* number of samples */
+ gboolean (* process) (GeglOperation *self, /* for parameters */
+ void *in_buf, /* input buffer */
+ void *out_buf, /* output buffer */
+ glong samples, /* number of samples */
+ const GeglRectangle *roi); /* rectangle out_buf spans
+ in in buffer, see the
+ checkerboard op for
+ semantics */
};
GType gegl_operation_point_filter_get_type (void) G_GNUC_CONST;
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-sink.c
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-sink.c (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-sink.c Thu Jun 19 02:52:46 2008
@@ -43,10 +43,11 @@
const GValue *value,
GParamSpec *pspec);
-static gboolean process (GeglOperation *operation,
- GeglNodeContext *context,
- const gchar *output_prop,
- const GeglRectangle *result);
+static gboolean gegl_operation_sink_process
+ (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result);
static void attach (GeglOperation *operation);
static GeglRectangle get_bounding_box (GeglOperation *self);
static GeglRectangle get_required_for_output (GeglOperation *operation,
@@ -68,7 +69,7 @@
object_class->set_property = set_property;
object_class->get_property = get_property;
- operation_class->process = process;
+ operation_class->process = gegl_operation_sink_process;
operation_class->attach = attach;
operation_class->get_bounding_box = get_bounding_box;
operation_class->get_required_for_output = get_required_for_output;
@@ -115,10 +116,10 @@
}
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
- const gchar *output_prop,
- const GeglRectangle *result)
+gegl_operation_sink_process (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result)
{
GeglOperationSink *gegl_operation_sink;
GeglOperationSinkClass *klass;
@@ -130,7 +131,7 @@
g_assert (klass->process);
- input = gegl_node_context_get_source (context, "input");
+ input = gegl_operation_context_get_source (context, "input");
if (input)
{
success = klass->process (operation, input, result);
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-sink.h
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-sink.h (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-sink.h Thu Jun 19 02:52:46 2008
@@ -41,6 +41,9 @@
{
GeglOperationClass parent_class;
+ /* Wether or not the sink operation needs full input data in one go
+ * in order to be able to do its processing
+ */
gboolean needs_full;
gboolean (* process) (GeglOperation *self,
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation-source.c
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation-source.c (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation-source.c Thu Jun 19 02:52:46 2008
@@ -41,8 +41,9 @@
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static gboolean process (GeglOperation *operation,
- GeglNodeContext *context,
+static gboolean gegl_operation_source_process
+ (GeglOperation *operation,
+ GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result);
static void attach (GeglOperation *operation);
@@ -68,7 +69,7 @@
gobject_class->set_property = set_property;
gobject_class->get_property = get_property;
- operation_class->process = process;
+ operation_class->process = gegl_operation_source_process;
operation_class->attach = attach;
operation_class->get_cached_region = get_cached_region;
@@ -117,10 +118,10 @@
}
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
- const gchar *output_prop,
- const GeglRectangle *result)
+gegl_operation_source_process (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result)
{
GeglOperationSourceClass *klass = GEGL_OPERATION_SOURCE_GET_CLASS (operation);
GeglBuffer *output;
@@ -133,7 +134,7 @@
}
g_assert (klass->process);
- output = gegl_node_context_get_target (context, "output");
+ output = gegl_operation_context_get_target (context, "output");
success = klass->process (operation, output, result);
return success;
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation.c
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation.c (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation.c Thu Jun 19 02:52:46 2008
@@ -102,7 +102,7 @@
gboolean
gegl_operation_process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *result)
{
@@ -116,7 +116,7 @@
(result->width == 0 || result->height == 0))
{
GeglBuffer *output = gegl_buffer_new (NULL, NULL);
- gegl_node_context_set_object (context, "output", G_OBJECT (output));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (output));
return TRUE;
}
@@ -286,11 +286,17 @@
if (self->node->is_graph)
{
- return gegl_operation_get_bounding_box (
- gegl_node_get_output_proxy (self->node, "output")->operation);
+ GeglOperation *operation;
+
+ operation = gegl_node_get_output_proxy (self->node, "output")->operation;
+ rect = gegl_operation_get_bounding_box (operation);
}
- g_warning ("Op '%s' has no defined_region method",
- G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (self)));
+ else
+ {
+ g_warning ("Operation '%s' has no get_bounding_box() method",
+ G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (self)));
+ }
+
return rect;
}
@@ -401,6 +407,10 @@
pad = gegl_node_get_pad (self->node, pad_name);
+ if (pad == NULL || pad->format == NULL)
+ {
+ g_warning ("%s: returns NULL", G_STRFUNC);
+ }
g_return_val_if_fail (pad != NULL, NULL);
return pad->format;
Modified: branches/branch_zhangjb/gegl/operation/gegl-operation.h
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operation.h (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operation.h Thu Jun 19 02:52:46 2008
@@ -126,7 +126,7 @@
* result_rect is then then indicating the data available for consumption.
*/
gboolean (*process) (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *roi);
@@ -178,7 +178,7 @@
GeglNode *node);
void gegl_operation_prepare (GeglOperation *operation);
gboolean gegl_operation_process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *roi);
Modified: branches/branch_zhangjb/gegl/operation/gegl-operations.c
==============================================================================
--- branches/branch_zhangjb/gegl/operation/gegl-operations.c (original)
+++ branches/branch_zhangjb/gegl/operation/gegl-operations.c Thu Jun 19 02:52:46 2008
@@ -30,7 +30,7 @@
#include "gegl-operations.h"
#include "graph/gegl-node.h"
#include "graph/gegl-pad.h"
-#include "graph/gegl-node-context.h"
+#include "gegl-operation-context.h"
#include "buffer/gegl-region.h"
static void
@@ -152,7 +152,7 @@
}
{
- GeglNodeContext *child_context = gegl_node_get_context (child, context_id);
+ GeglOperationContext *child_context = gegl_node_get_context (child, context_id);
gegl_rectangle_bounding_box (&child_need, &child_context->need_rect, region);
gegl_rectangle_intersect (&child_need, &child->have_rect, &child_need);
@@ -174,9 +174,7 @@
}
}
- gegl_node_set_need_rect (child, context_id,
- child_need.x, child_need.y,
- child_need.width, child_need.height);
+ gegl_node_set_need_rect (child, context_id, &child_need);
}
}
gboolean
@@ -184,7 +182,7 @@
gpointer context_id)
{
GSList *input_pads;
- GeglNodeContext *context;
+ GeglOperationContext *context;
GeglRectangle request;
context = gegl_node_get_context (operation->node, context_id);
@@ -201,14 +199,3 @@
}
return TRUE;
}
-
-void
-gegl_operation_vector_prop_changed (GeglVector *vector,
- GeglOperation *operation)
-{
- /* In the end forces a re-render, should be adapted to
- * allow a smaller region to be forced for re-rendering
- * when the vector is incrementally grown
- */
- g_object_notify (G_OBJECT (operation), "vector");
-}
Modified: branches/branch_zhangjb/gegl/process/gegl-cr-visitor.c
==============================================================================
--- branches/branch_zhangjb/gegl/process/gegl-cr-visitor.c (original)
+++ branches/branch_zhangjb/gegl/process/gegl-cr-visitor.c Thu Jun 19 02:52:46 2008
@@ -25,8 +25,8 @@
#include "gegl-cr-visitor.h"
#include "operation/gegl-operation.h"
+#include "operation/gegl-operation-context.h"
#include "graph/gegl-node.h"
-#include "graph/gegl-node-context.h"
#include "graph/gegl-pad.h"
#include "graph/gegl-visitable.h"
#include "gegl-utils.h"
@@ -57,7 +57,7 @@
visit_node (GeglVisitor *self,
GeglNode *node)
{
- GeglNodeContext *context = gegl_node_get_context (node, self->context_id);
+ GeglOperationContext *context = gegl_node_get_context (node, self->context_id);
GEGL_VISITOR_CLASS (gegl_cr_visitor_parent_class)->visit_node (self, node);
Modified: branches/branch_zhangjb/gegl/process/gegl-debug-rect-visitor.c
==============================================================================
--- branches/branch_zhangjb/gegl/process/gegl-debug-rect-visitor.c (original)
+++ branches/branch_zhangjb/gegl/process/gegl-debug-rect-visitor.c Thu Jun 19 02:52:46 2008
@@ -27,8 +27,8 @@
#include "gegl-debug-rect-visitor.h"
#include "operation/gegl-operation.h"
+#include "operation/gegl-operation-context.h"
#include "graph/gegl-node.h"
-#include "graph/gegl-node-context.h"
#include "graph/gegl-pad.h"
#include "graph/gegl-visitable.h"
@@ -58,7 +58,7 @@
visit_node (GeglVisitor *self,
GeglNode *node)
{
- GeglNodeContext *context = gegl_node_get_context (node, self->context_id);
+ GeglOperationContext *context = gegl_node_get_context (node, self->context_id);
GEGL_VISITOR_CLASS (gegl_debug_rect_visitor_parent_class)->visit_node (self, node);
Modified: branches/branch_zhangjb/gegl/process/gegl-eval-mgr.c
==============================================================================
--- branches/branch_zhangjb/gegl/process/gegl-eval-mgr.c (original)
+++ branches/branch_zhangjb/gegl/process/gegl-eval-mgr.c Thu Jun 19 02:52:46 2008
@@ -118,8 +118,7 @@
self->roi = root->have_rect;
}
- gegl_node_set_need_rect (root, context_id, self->roi.x, self->roi.y,
- self->roi.width, self->roi.height);
+ gegl_node_set_need_rect (root, context_id, &self->roi);
root->is_root = TRUE;
need_visitor = g_object_new (GEGL_TYPE_NEED_VISITOR, "id", context_id, NULL);
@@ -172,7 +171,7 @@
/* extract return buffer before running finish visitor */
GValue value = { 0, };
g_value_init (&value, G_TYPE_OBJECT);
- gegl_node_context_get_property (gegl_node_get_context (root, context_id),
+ gegl_operation_context_get_property (gegl_node_get_context (root, context_id),
"output", &value);
buffer = g_value_get_object (&value);
g_object_ref (buffer);/* salvage buffer from finalization */
Modified: branches/branch_zhangjb/gegl/process/gegl-eval-visitor.c
==============================================================================
--- branches/branch_zhangjb/gegl/process/gegl-eval-visitor.c (original)
+++ branches/branch_zhangjb/gegl/process/gegl-eval-visitor.c Thu Jun 19 02:52:46 2008
@@ -25,11 +25,11 @@
#include "gegl-eval-visitor.h"
#include "graph/gegl-node.h"
-#include "graph/gegl-node-context.h"
+#include "operation/gegl-operation.h"
+#include "operation/gegl-operation-context.h"
#include "graph/gegl-pad.h"
#include "graph/gegl-visitable.h"
#include "gegl-instrument.h"
-#include "operation/gegl-operation.h"
#include "operation/gegl-operation-sink.h"
#include "buffer/gegl-region.h"
@@ -64,7 +64,7 @@
{
GeglNode *node = gegl_pad_get_node (pad);
gpointer context_id = self->context_id;
- GeglNodeContext *context = gegl_node_get_context (node, context_id);
+ GeglOperationContext *context = gegl_node_get_context (node, context_id);
GeglOperation *operation = node->operation;
GEGL_VISITOR_CLASS (gegl_eval_visitor_parent_class)->visit_pad (self, pad);
@@ -77,7 +77,7 @@
* that has not been invalidated, (the validity of the cache
* is determined by other visitors)
*/
- gegl_node_context_get_target (context, pad->name);
+ gegl_operation_context_get_target (context, pad->name);
/* XXX: why is the _get_target call needed anyways? */
}
else
@@ -115,11 +115,11 @@
GValue value = { 0 };
GParamSpec *prop_spec = gegl_pad_get_param_spec (pad);
GeglNode *source_node = gegl_pad_get_node (source_pad);
- GeglNodeContext *source_context = gegl_node_get_context (source_node, context_id);
+ GeglOperationContext *source_context = gegl_node_get_context (source_node, context_id);
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec));
- gegl_node_context_get_property (source_context,
+ gegl_operation_context_get_property (source_context,
gegl_pad_get_name (source_pad),
&value);
@@ -130,7 +130,7 @@
gegl_pad_get_name (source_pad),
g_value_get_object (&value));
- gegl_node_context_set_property (context,
+ gegl_operation_context_set_property (context,
gegl_pad_get_name (pad),
&value);
/* reference counting for this source dropped to zero, freeing up */
@@ -138,7 +138,7 @@
gegl_pad_get_node (source_pad), context_id)->refs == 0 &&
g_value_get_object (&value))
{
- gegl_node_context_remove_property (
+ gegl_operation_context_remove_property (
gegl_node_get_context (
gegl_pad_get_node (source_pad), context_id),
gegl_pad_get_name (source_pad));
Modified: branches/branch_zhangjb/gegl/process/gegl-prepare-visitor.c
==============================================================================
--- branches/branch_zhangjb/gegl/process/gegl-prepare-visitor.c (original)
+++ branches/branch_zhangjb/gegl/process/gegl-prepare-visitor.c Thu Jun 19 02:52:46 2008
@@ -84,7 +84,10 @@
}
gegl_operation_prepare (operation);
- gegl_node_set_need_rect (node, self->context_id, 0, 0, 0, 0);
+ {
+ GeglRectangle empty ={0,};
+ gegl_node_set_need_rect (node, self->context_id, &empty);
+ }
time = gegl_ticks () - time;
gegl_instrument ("process", gegl_node_get_operation (node), time);
gegl_instrument (gegl_node_get_operation (node), "prepare", time);
Modified: branches/branch_zhangjb/gegl/process/gegl-processor.c
==============================================================================
--- branches/branch_zhangjb/gegl/process/gegl-processor.c (original)
+++ branches/branch_zhangjb/gegl/process/gegl-processor.c Thu Jun 19 02:52:46 2008
@@ -15,40 +15,49 @@
*
* Copyright 2007 Ãyvind KolÃs
*/
-#define GEGL_PROCESSOR_CHUNK_SIZE 256*256
#include "config.h"
+
#include <glib-object.h>
-#include "gegl-types.h"
+
+#include "buffer/gegl-region.h"
+
#include "graph/gegl-node.h"
+
+#include "operation/gegl-operation-sink.h"
+
+#include "gegl-config.h"
#include "gegl-processor.h"
+#include "gegl-types.h"
#include "gegl-utils.h"
-#include "buffer/gegl-region.h"
-#include "operation/gegl-operation-sink.h"
+
enum
{
PROP_0,
PROP_NODE,
PROP_CHUNK_SIZE,
- PROP_PROGRESS
+ PROP_PROGRESS,
+ PROP_RECTANGLE
};
-static void gegl_processor_class_init (GeglProcessorClass *klass);
-static void gegl_processor_init (GeglProcessor *self);
-static void finalize (GObject *self_object);
-static void set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static GObject * constructor (GType type,
- guint n_params,
- GObjectConstructParam *params);
-static gdouble gegl_processor_progress (GeglProcessor *processor);
+
+static void gegl_processor_class_init (GeglProcessorClass *klass);
+static void gegl_processor_init (GeglProcessor *self);
+static void gegl_processor_finalize (GObject *self_object);
+static void gegl_processor_set_property (GObject *gobject,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gegl_processor_get_property (GObject *gobject,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static GObject * gegl_processor_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params);
+static gdouble gegl_processor_progress (GeglProcessor *processor);
+
struct _GeglProcessor
{
@@ -56,28 +65,31 @@
GeglNode *node;
GeglRectangle rectangle;
GeglNode *input;
- GeglNodeContext *context;
+ GeglOperationContext *context;
- GeglRegion *valid_region; /* used when doing unbuffered rendering */
- GeglRegion *queued_region;
- GSList *dirty_rectangles;
- gint chunk_size;
-
- GThread *thread;
- gboolean thread_done;
- gdouble progress;
+ GeglRegion *valid_region; /* used when doing unbuffered rendering */
+ GeglRegion *queued_region;
+ GSList *dirty_rectangles;
+ gint chunk_size;
+
+ GThread *thread;
+ gboolean thread_done;
+ gdouble progress;
};
+
G_DEFINE_TYPE (GeglProcessor, gegl_processor, G_TYPE_OBJECT);
-static void gegl_processor_class_init (GeglProcessorClass *klass)
+
+static void
+gegl_processor_class_init (GeglProcessorClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = finalize;
- gobject_class->constructor = constructor;
- gobject_class->set_property = set_property;
- gobject_class->get_property = get_property;
+ gobject_class->finalize = gegl_processor_finalize;
+ gobject_class->constructor = gegl_processor_constructor;
+ gobject_class->set_property = gegl_processor_set_property;
+ gobject_class->get_property = gegl_processor_get_property;
g_object_class_install_property (gobject_class, PROP_NODE,
g_param_spec_object ("node",
@@ -87,18 +99,30 @@
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT));
+ g_object_class_install_property (gobject_class, PROP_RECTANGLE,
+ g_param_spec_pointer ("rectangle",
+ "rectangle",
+ "The rectangle of the region to process.",
+ G_PARAM_READWRITE));
+
g_object_class_install_property (gobject_class, PROP_PROGRESS,
- g_param_spec_double ("progress", "progress", "query progress 0.0 is not started 1.0 is done.",
- 0.0, 1.0, 0.0,
- G_PARAM_READWRITE));
+ g_param_spec_double ("progress",
+ "progress",
+ "query progress 0.0 is not started 1.0 is done.",
+ 0.0, 1.0, 0.0,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (gobject_class, PROP_CHUNK_SIZE,
- g_param_spec_int ("chunksize", "chunksize", "Size of chunks being rendered (larger chunks need more memory to do the processing).",
- 8 * 8, 2048 * 2048, GEGL_PROCESSOR_CHUNK_SIZE,
+ g_param_spec_int ("chunksize",
+ "chunksize",
+ "Size of chunks being rendered (larger chunks need more memory to do the processing).",
+ 1, 1024 * 1024, gegl_config()->chunk_size,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
-static void gegl_processor_init (GeglProcessor *processor)
+static void
+gegl_processor_init (GeglProcessor *processor)
{
processor->node = NULL;
processor->input = NULL;
@@ -108,10 +132,10 @@
processor->chunk_size = 128 * 128;
}
-
-static GObject *constructor (GType type,
- guint n_params,
- GObjectConstructParam *params)
+static GObject *
+gegl_processor_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params)
{
GObject *object;
GeglProcessor *processor;
@@ -125,15 +149,20 @@
{
processor->input = gegl_node_get_producer (processor->node, "input", NULL);
if (!gegl_operation_sink_needs_full (processor->node->operation))
- processor->valid_region = gegl_region_new ();
+ {
+ processor->valid_region = gegl_region_new ();
+ }
else
- processor->valid_region = NULL;
+ {
+ processor->valid_region = NULL;
+ }
}
else
{
processor->input = processor->node;
processor->valid_region = NULL;
}
+
g_object_ref (processor->input);
processor->queued_region = gegl_region_new ();
@@ -141,29 +170,39 @@
return object;
}
-
-static void finalize (GObject *self_object)
+static void
+gegl_processor_finalize (GObject *self_object)
{
GeglProcessor *processor = GEGL_PROCESSOR (self_object);
if (processor->node)
- g_object_unref (processor->node);
+ {
+ g_object_unref (processor->node);
+ }
+
if (processor->input)
- g_object_unref (processor->input);
+ {
+ g_object_unref (processor->input);
+ }
+
if (processor->queued_region)
- gegl_region_destroy (processor->queued_region);
+ {
+ gegl_region_destroy (processor->queued_region);
+ }
+
if (processor->valid_region)
- gegl_region_destroy (processor->valid_region);
+ {
+ gegl_region_destroy (processor->valid_region);
+ }
G_OBJECT_CLASS (gegl_processor_parent_class)->finalize (self_object);
}
-
static void
-set_property (GObject *gobject,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+gegl_processor_set_property (GObject *gobject,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GeglProcessor *self = GEGL_PROCESSOR (gobject);
@@ -181,6 +220,10 @@
self->chunk_size = g_value_get_int (value);
break;
+ case PROP_RECTANGLE:
+ gegl_processor_set_rectangle (self, g_value_get_pointer (value));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
@@ -188,10 +231,10 @@
}
static void
-get_property (GObject *gobject,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+gegl_processor_get_property (GObject *gobject,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GeglProcessor *self = GEGL_PROCESSOR (gobject);
@@ -201,6 +244,10 @@
g_value_set_object (value, self->node);
break;
+ case PROP_RECTANGLE:
+ g_value_set_pointer (value, &self->rectangle);
+ break;
+
case PROP_CHUNK_SIZE:
g_value_set_int (value, self->chunk_size);
break;
@@ -220,19 +267,29 @@
{
GSList *iter;
GeglRectangle bounds;
+ GeglRectangle input_bounding_box;
+
+ if (! rectangle)
+ {
+ input_bounding_box = gegl_node_get_bounding_box (processor->input);
+ rectangle = &input_bounding_box;
+ }
- if (gegl_rectangle_equal (&processor->rectangle, rectangle))
- return;
+ if (! gegl_rectangle_equal (&processor->rectangle, rectangle))
+ {
+ bounds = gegl_node_get_bounding_box (processor->input);
+ processor->rectangle = *rectangle;
+ gegl_rectangle_intersect (&processor->rectangle, &processor->rectangle, &bounds);
- bounds = gegl_node_get_bounding_box (processor->input);
- processor->rectangle = *rectangle;
- gegl_rectangle_intersect (&processor->rectangle, &processor->rectangle, &bounds);
-
- /* remove already queued dirty rectangles */
- for (iter = processor->dirty_rectangles; iter; iter = g_slist_next (iter))
- g_slice_free (GeglRectangle, iter->data);
- g_slist_free (processor->dirty_rectangles);
- processor->dirty_rectangles = NULL;
+ /* remove already queued dirty rectangles */
+ for (iter = processor->dirty_rectangles; iter; iter = g_slist_next (iter))
+ {
+ g_slice_free (GeglRectangle, iter->data);
+ }
+ g_slist_free (processor->dirty_rectangles);
+
+ processor->dirty_rectangles = NULL;
+ }
}
GeglProcessor *
@@ -243,25 +300,17 @@
g_return_val_if_fail (GEGL_IS_NODE (node), NULL);
- processor = g_object_new (GEGL_TYPE_PROCESSOR, "node", node, NULL);
-
- if (rectangle)
- {
- gegl_processor_set_rectangle (processor, rectangle);
- }
- else
- {
- GeglRectangle tmp = gegl_node_get_bounding_box (processor->input);
- gegl_processor_set_rectangle (processor, &tmp);
- }
-
- if (node->operation &&
- GEGL_IS_OPERATION_SINK (node->operation))
+ processor = g_object_new (GEGL_TYPE_PROCESSOR,
+ "node", node,
+ "rectangle", rectangle,
+ NULL);
+
+ if (node->operation &&
+ GEGL_IS_OPERATION_SINK (node->operation) &&
+ gegl_operation_sink_needs_full (node->operation))
{
- GeglCache *cache;
+ GeglCache *cache;
- if (!gegl_operation_sink_needs_full (node->operation))
- return processor;
cache = gegl_node_get_cache (processor->input);
processor->context = gegl_node_add_context (node, cache);
@@ -269,33 +318,22 @@
GValue value = { 0, };
g_value_init (&value, GEGL_TYPE_BUFFER);
g_value_set_object (&value, cache);
- gegl_node_context_set_property (processor->context, "input", &value);
+ gegl_operation_context_set_property (processor->context, "input", &value);
g_value_unset (&value);
}
- gegl_node_context_set_result_rect (processor->context,
- processor->rectangle.x,
- processor->rectangle.y,
- processor->rectangle.width,
- processor->rectangle.height);
- gegl_node_context_set_need_rect (processor->context,
- processor->rectangle.x,
- processor->rectangle.y,
- processor->rectangle.width,
- processor->rectangle.height);
-
-
- }
- else
- {
- processor->context = NULL;
+ gegl_operation_context_set_result_rect (processor->context,
+ &processor->rectangle);
+ gegl_operation_context_set_need_rect (processor->context,
+ &processor->rectangle);
}
return processor;
}
/* returns TRUE if there is more work */
-static gboolean render_rectangle (GeglProcessor *processor)
+static gboolean
+render_rectangle (GeglProcessor *processor)
{
gboolean buffered;
const gint max_area = processor->chunk_size;
@@ -334,6 +372,7 @@
dr->y += band_size;
processor->dirty_rectangles = g_slist_prepend (processor->dirty_rectangles, fragment);
+
return TRUE;
}
else
@@ -352,6 +391,7 @@
dr->x += band_size;
processor->dirty_rectangles = g_slist_prepend (processor->dirty_rectangles, fragment);
+
return TRUE;
}
}
@@ -360,9 +400,9 @@
if (!dr->width || !dr->height)
{
g_slice_free (GeglRectangle, dr);
+
return TRUE;
}
-
if (buffered)
{
@@ -404,12 +444,14 @@
}
-static gint rect_area (GeglRectangle *rectangle)
+static gint
+rect_area (GeglRectangle *rectangle)
{
return rectangle->width * rectangle->height;
}
-static gint region_area (GeglRegion *region)
+static gint
+region_area (GeglRegion *region)
{
GeglRectangle *rectangles;
gint n_rectangles;
@@ -427,8 +469,9 @@
return sum;
}
-static gint area_left (GeglRegion *area,
- GeglRectangle *rectangle)
+static gint
+area_left (GeglRegion *area,
+ GeglRectangle *rectangle)
{
GeglRegion *region;
gint sum = 0;
@@ -453,14 +496,18 @@
gegl_processor_progress (GeglProcessor *processor)
{
GeglRegion *valid_region;
- gint valid;
- gint wanted;
- gdouble ret;
+ gint valid;
+ gint wanted;
+ gdouble ret;
if (processor->valid_region)
- valid_region = processor->valid_region;
+ {
+ valid_region = processor->valid_region;
+ }
else
- valid_region = gegl_node_get_cache (processor->input)->valid_region;
+ {
+ valid_region = gegl_node_get_cache (processor->input)->valid_region;
+ }
wanted = rect_area (&(processor->rectangle));
valid = wanted - area_left (valid_region, &(processor->rectangle));
@@ -470,13 +517,16 @@
return 1.0;
return 0.999;
}
+
ret = (double) valid / wanted;
- g_warning ("%f", ret);
if (ret>=1.0)
{
if (!gegl_processor_is_rendered (processor))
- return 0.9999;
+ {
+ return 0.9999;
+ }
}
+
return ret;
}
@@ -488,12 +538,17 @@
GeglRegion *valid_region;
if (processor->valid_region)
- valid_region = processor->valid_region;
+ {
+ valid_region = processor->valid_region;
+ }
else
- valid_region = gegl_node_get_cache (processor->input)->valid_region;
+ {
+ valid_region = gegl_node_get_cache (processor->input)->valid_region;
+ }
{
gboolean more_work = render_rectangle (processor);
+
if (more_work == TRUE)
{
if (progress)
@@ -520,6 +575,7 @@
}
wanted = 1;
}
+
return more_work;
}
}
@@ -546,6 +602,7 @@
processor->dirty_rectangles = g_slist_prepend (processor->dirty_rectangles,
g_slice_dup (GeglRectangle, &roi));
}
+
g_free (rectangles);
if (n_rectangles != 0)
@@ -555,6 +612,7 @@
rect_area (rectangle));
return TRUE;
}
+
return FALSE;
}
else if (!gegl_region_empty (processor->queued_region) &&
@@ -579,10 +637,14 @@
processor->dirty_rectangles = g_slist_prepend (processor->dirty_rectangles,
g_slice_dup (GeglRectangle, &roi));
}
+
g_free (rectangles);
}
+
if (progress)
- *progress = 0.69;
+ {
+ *progress = 0.69;
+ }
return !gegl_processor_is_rendered (processor);
}
@@ -611,12 +673,17 @@
gegl_node_remove_context (processor->node, cache);
processor->context = NULL;
if (progress)
- *progress = 1.0;
+ {
+ *progress = 1.0;
+ }
+
return TRUE;
}
if (progress)
- *progress = 1.0;
+ {
+ *progress = 1.0;
+ }
return FALSE;
}
Modified: branches/branch_zhangjb/gegl/property-types/gegl-color.c
==============================================================================
--- branches/branch_zhangjb/gegl/property-types/gegl-color.c (original)
+++ branches/branch_zhangjb/gegl/property-types/gegl-color.c Thu Jun 19 02:52:46 2008
@@ -452,6 +452,14 @@
GEGL_PARAM_COLOR (self)->default_color = NULL;
}
+GeglColor *
+gegl_param_spec_color_get_default (GParamSpec *self);
+GeglColor *
+gegl_param_spec_color_get_default (GParamSpec *self)
+{
+ return GEGL_PARAM_COLOR (self)->default_color;
+}
+
static void
gegl_param_color_finalize (GParamSpec *self)
{
Modified: branches/branch_zhangjb/gegl/property-types/gegl-vector.c
==============================================================================
--- branches/branch_zhangjb/gegl/property-types/gegl-vector.c (original)
+++ branches/branch_zhangjb/gegl/property-types/gegl-vector.c Thu Jun 19 02:52:46 2008
@@ -28,6 +28,7 @@
#include "gegl-buffer-private.h"
#include "gegl-vector.h"
#include "gegl-color.h"
+#include "gegl-utils.h"
@@ -78,6 +79,8 @@
Path *axis[8];
gint n_axes;
+
+ GeglRectangle dirtied;
};
enum
@@ -392,6 +395,7 @@
return path_move_to (path, path->point.x + x, path->point.y + y);
}
+#if 0
static Path *
path_rel_line_to (Path *path,
gfloat x,
@@ -414,6 +418,7 @@
path->point.x + x2, path->point.y + y2,
path->point.x + x3, path->point.y + y3);
}
+#endif
#include <gegl-buffer.h>
@@ -601,8 +606,15 @@
ceil (x+radius) - floor (x-radius),
ceil (y+radius) - floor (y-radius)};
+ GeglRectangle temp;
+
+ /* bail out if we wouldn't leave a mark on the buffer */
+ if (!gegl_rectangle_intersect (&temp, &roi, gegl_buffer_get_extent (buffer)))
+ return;
+
if (s.format == NULL)
s.format = babl_format ("RGBA float");
+
if (s.buf == NULL ||
s.radius != radius)
{
@@ -626,10 +638,12 @@
gfloat inner_radius_squared = (radius * hardness)*(radius * hardness);
gfloat soft_range = radius_squared - inner_radius_squared;
- for (u= roi.x; u < roi.x + roi.width; u++)
- for (v= roi.y; v < roi.y + roi.height ; v++)
+ for (v= roi.y; v < roi.y + roi.height ; v++)
+ {
+ gfloat vy2 = (v-y)*(v-y);
+ for (u= roi.x; u < roi.x + roi.width; u++)
{
- gfloat o = (u-x) * (u-x) + (v-y) * (v-y);
+ gfloat o = (u-x) * (u-x) + vy2;
if (o < inner_radius_squared)
o = col[3];
@@ -646,10 +660,10 @@
gint c;
for (c=0;c<4;c++)
s.buf[i*4+c] = (s.buf[i*4+c] * (1.0-o) + col[c] * o);
- /*s.buf[i*4+3] = s.buf[i*4+3] + o * (1.0-o);*/
}
i++;
}
+ }
}
gegl_buffer_set (buffer, &roi, s.format, s.buf, 0);
}
@@ -662,6 +676,7 @@
gdouble hardness)
{
GeglVectorPrivate *priv = GEGL_VECTOR_GET_PRIVATE (vector);
+ GeglRectangle bufext;
gfloat traveled_length = 0;
gfloat need_to_travel = 0;
gfloat x = 0,y = 0;
@@ -676,9 +691,13 @@
extent.width = ceil (xmax) - extent.x;
extent.height = ceil (ymax) - extent.y;
+ bufext = *gegl_buffer_get_extent (buffer);
+
if (gegl_buffer_is_shared (buffer))
while (!gegl_buffer_try_lock (buffer));
+ if (!gegl_rectangle_intersect (&extent, &bufext, &bufext))
+ return;
gegl_buffer_clear (buffer, &extent);
while (iter)
@@ -732,7 +751,6 @@
* for each step from the tool, to be
* able to have variable line width
*/
-
lerp (&spot, &a, &b, ratio);
gegl_vector_stamp (buffer,
@@ -789,15 +807,17 @@
0 /* class offset */,
NULL /* accumulator */,
NULL /* accu_data */,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE /*return type */,
- 0 /* n_params */);
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, /*return type */
+ 1, G_TYPE_POINTER);
}
static void
-gegl_vector_emit_changed (GeglVector *vector)
+gegl_vector_emit_changed (GeglVector *vector,
+ const GeglRectangle *bounds)
{
- g_signal_emit (vector, gegl_vector_signals[GEGL_VECTOR_CHANGED], 0);
+ g_signal_emit (vector, gegl_vector_signals[GEGL_VECTOR_CHANGED], 0,
+ bounds, NULL);
}
static void
@@ -854,6 +874,33 @@
return self;
}
+static void gen_rect (GeglRectangle *r,
+ gdouble x1, gdouble y1, gdouble x2, gdouble y2)
+{
+ if (x1>x2)
+ {
+ gint t;
+ t=x1;
+ x1=x2;
+ x2=x1;
+ }
+ if (y1>y2)
+ {
+ gint t;
+ t=y1;
+ y1=y2;
+ y2=y1;
+ }
+ x1=floor (x1);
+ y1=floor (y1);
+ x2=ceil (x2);
+ y2=ceil (y2);
+ r->x=x1;
+ r->y=y1;
+ r->width=x2-x1;
+ r->height=y2-y1;
+}
+
void
gegl_vector_line_to (GeglVector *self,
gdouble x,
@@ -861,8 +908,14 @@
{
GeglVectorPrivate *priv;
priv = GEGL_VECTOR_GET_PRIVATE (self);
+
+ if (priv->path)
+ gen_rect (&priv->dirtied, x, y, priv->path->point.x,
+ priv->path->point.y);
priv->path = path_line_to (priv->path, x, y);
- gegl_vector_emit_changed (self);
+
+ if (priv->path)
+ gegl_vector_emit_changed (self, &priv->dirtied);
}
void
@@ -873,7 +926,7 @@
GeglVectorPrivate *priv;
priv = GEGL_VECTOR_GET_PRIVATE (self);
priv->path = path_move_to (priv->path, x, y);
- gegl_vector_emit_changed (self);
+ /*gegl_vector_emit_changed (self);*/
}
void
@@ -889,8 +942,7 @@
g_print ("foo\n");
priv = GEGL_VECTOR_GET_PRIVATE (self);
priv->path = path_curve_to (priv->path, x1, y1, x2, y2, x3, y3);
- gegl_vector_emit_changed (self);
- g_print ("bar\n");
+ /*gegl_vector_emit_changed (self);*/
}
@@ -901,8 +953,7 @@
{
GeglVectorPrivate *priv;
priv = GEGL_VECTOR_GET_PRIVATE (self);
- priv->path = path_rel_line_to (priv->path, x, y);
- gegl_vector_emit_changed (self);
+ gegl_vector_line_to (self, priv->path->point.x + x, priv->path->point.y + y);
}
void
@@ -913,7 +964,7 @@
GeglVectorPrivate *priv;
priv = GEGL_VECTOR_GET_PRIVATE (self);
priv->path = path_rel_move_to (priv->path, x, y);
- gegl_vector_emit_changed (self);
+/* gegl_vector_emit_changed (self);*/
}
void
@@ -927,8 +978,10 @@
{
GeglVectorPrivate *priv;
priv = GEGL_VECTOR_GET_PRIVATE (self);
- priv->path = path_rel_curve_to (priv->path, x1, y1, x2, y2, x3, y3);
- gegl_vector_emit_changed (self);
+ gegl_vector_curve_to (self,
+ priv->path->point.x + x1, priv->path->point.y + y1,
+ priv->path->point.x + x2, priv->path->point.y + y2,
+ priv->path->point.x + x3, priv->path->point.y + y3);
}
@@ -1201,6 +1254,59 @@
return param_vector_type;
}
+const GeglRectangle *gegl_vector_changed_rect (GeglVector *vector);
+
+const GeglRectangle *gegl_vector_changed_rect (GeglVector *vector)
+{
+ GeglVectorPrivate *priv = GEGL_VECTOR_GET_PRIVATE (vector);
+ return &priv->dirtied;
+}
+
+
+void
+gegl_operation_invalidate (GeglOperation *operation,
+ const GeglRectangle *roi);
+
+void
+gegl_operation_vector_prop_changed (GeglVector *vector,
+ const GeglRectangle *roi,
+ GeglOperation *operation);
+
+void
+gegl_operation_vector_prop_changed (GeglVector *vector,
+ const GeglRectangle *roi,
+ GeglOperation *operation)
+{
+ /* In the end forces a re-render, should be adapted to
+ * * allow a smaller region to be forced for re-rendering
+ * * when the vector is incrementally grown
+ * */
+ /* g_object_notify (G_OBJECT (operation), "vector"); */
+ GeglRectangle rect = *roi;
+ gint radius = 8;
+
+ radius = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (operation), "vector-radius"));
+
+ rect.width += radius * 2;
+ rect.height += radius * 2;
+ rect.x -= radius;
+ rect.y -= radius;
+
+ {
+ gint align = 127;
+ gint x= rect.x & (0xffff-align);
+
+ rect.width +=(rect.x-x);
+ x=rect.width & align;
+ if (x)
+ rect.width += (align-x);
+ }
+
+ gegl_operation_invalidate (operation, &rect);
+}
+
+
+
GParamSpec *
gegl_param_spec_vector (const gchar *name,
const gchar *nick,
@@ -1217,3 +1323,5 @@
return G_PARAM_SPEC (param_vector);
}
+
+
Modified: branches/branch_zhangjb/operations/affine/affine.c
==============================================================================
--- branches/branch_zhangjb/operations/affine/affine.c (original)
+++ branches/branch_zhangjb/operations/affine/affine.c Thu Jun 19 02:52:46 2008
@@ -25,10 +25,11 @@
#include <math.h>
#include <gegl-plugin.h>
+#include "buffer/gegl-sampler.h"
#include <graph/gegl-pad.h>
#include <graph/gegl-node.h>
#include <graph/gegl-connection.h>
-/*#include "buffer/gegl-sampler.h"*/
+
#include "affine.h"
#include "module.h"
@@ -118,19 +119,74 @@
return g_define_type_id;
}
+
+GType
+gegl_sampler_type_from_interpolation (GeglInterpolation interpolation);
+
/* ************************* */
+static void
+op_affine_sampler_init (OpAffine *self)
+{
+ Babl *format;
+ GeglSampler *sampler;
+ GType desired_type;
+ GeglInterpolation interpolation;
+
+ format = babl_format ("RaGaBaA float");
+
+ interpolation = gegl_buffer_interpolation_from_string (self->filter);
+ desired_type = gegl_sampler_type_from_interpolation (interpolation);
+
+ if (self->sampler != NULL &&
+ !G_TYPE_CHECK_INSTANCE_TYPE (self->sampler, desired_type))
+ {
+ self->sampler->buffer=NULL;
+ g_object_unref(self->sampler);
+ self->sampler = NULL;
+ }
+
+ if (self->sampler == NULL)
+ {
+ if (interpolation == GEGL_INTERPOLATION_LANCZOS)
+ {
+ sampler = g_object_new (desired_type,
+ "format", format,
+ "lanczos_width", self->lanczos_width,
+ NULL);
+ }
+ else
+ {
+ sampler = g_object_new (desired_type,
+ "format", format,
+ NULL);
+ }
+ self->sampler = g_object_ref(sampler);
+ }
+}
static void
prepare (GeglOperation *operation)
{
- Babl *format = babl_format ("RaGaBaA float");
-
+ OpAffine *affine = (OpAffine *) operation;
+ Babl *format = babl_format ("RaGaBaA float");
+ op_affine_sampler_init (affine);
/*gegl_operation_set_format (operation, "input", format);
gegl_operation_set_format (operation, "aux", format); XXX(not used yet) */
gegl_operation_set_format (operation, "output", format);
}
static void
+finalize (GObject *object)
+{
+ OpAffine *affine = (OpAffine *) object;
+ if (affine->sampler != NULL)
+ {
+ g_object_unref(affine->sampler);
+ affine->sampler = NULL;
+ }
+}
+
+static void
op_affine_class_init (OpAffineClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@@ -139,6 +195,7 @@
gobject_class->set_property = set_property;
gobject_class->get_property = get_property;
+ gobject_class->finalize = finalize;
op_class->get_invalidated_by_change = get_invalidated_by_change;
op_class->get_bounding_box = get_bounding_box;
@@ -147,6 +204,7 @@
op_class->categories = "transform";
op_class->prepare = prepare;
+
filter_class->process = process;
klass->create_matrix = NULL;
@@ -171,7 +229,7 @@
g_param_spec_string (
"filter",
"Filter",
- "Filter type (nearest, linear, lanczos)",
+ "Filter type (nearest, linear, lanczos, cubic)",
"linear",
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_HARD_EDGES,
@@ -190,6 +248,7 @@
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
}
+
static void
op_affine_init (OpAffine *self)
{
@@ -370,8 +429,15 @@
gdouble have_points [8];
gint i;
+ GeglRectangle context_rect;
+ GeglSampler *sampler;
+
+ sampler = affine->sampler;
+ context_rect = sampler->context_rect;
+
+
if (gegl_operation_source_get_bounding_box (op, "input"))
- in_rect = *gegl_operation_source_get_bounding_box (op, "input");
+ in_rect = *gegl_operation_source_get_bounding_box (op, "input");
/* invoke child's matrix creation function */
g_assert (klass->create_matrix);
@@ -394,21 +460,10 @@
return in_rect;
}
- if (! strcmp (affine->filter, "linear"))
- {
- if (affine->hard_edges)
- {
- in_rect.width ++;
- in_rect.height ++;
- }
- else
- {
- in_rect.x--;
- in_rect.y--;
- in_rect.width += 2;
- in_rect.height += 2;
- }
- }
+ in_rect.x += context_rect.x;
+ in_rect.y += context_rect.y;
+ in_rect.width += context_rect.width;
+ in_rect.height += context_rect.height;
have_points [0] = in_rect.x;
have_points [1] = in_rect.y;
@@ -427,7 +482,6 @@
have_points + i, have_points + i + 1);
bounding_box (have_points, 4, &have_rect);
-
return have_rect;
}
@@ -472,10 +526,14 @@
Matrix3 inverse;
GeglRectangle requested_rect,
need_rect;
+ GeglRectangle context_rect;
+ GeglSampler *sampler;
gdouble need_points [8];
gint i;
requested_rect = *region;
+ sampler = affine->sampler;
+ context_rect = sampler->context_rect;
matrix3_copy (inverse, affine->matrix);
matrix3_invert (inverse);
@@ -506,22 +564,10 @@
need_points + i, need_points + i + 1);
bounding_box (need_points, 4, &need_rect);
- if (! strcmp (affine->filter, "linear"))
- {
- if (affine->hard_edges)
- {
- need_rect.width ++;
- need_rect.height ++;
- }
- else
- {
- need_rect.x--;
- need_rect.y--;
- need_rect.width += 2;
- need_rect.height += 2;
- }
- }
-
+ need_rect.x += context_rect.x;
+ need_rect.y += context_rect.y;
+ need_rect.width += context_rect.width;
+ need_rect.height += context_rect.height;
return need_rect;
}
@@ -530,13 +576,18 @@
const gchar *input_pad,
const GeglRectangle *input_region)
{
- OpAffine *affine = (OpAffine *) op;
- OpAffineClass *klass = OP_AFFINE_GET_CLASS (affine);
- GeglRectangle affected_rect;
- gdouble affected_points [8];
- gint i;
- GeglRectangle region = *input_region;
-
+ OpAffine *affine = (OpAffine *) op;
+ OpAffineClass *klass = OP_AFFINE_GET_CLASS (affine);
+ GeglRectangle affected_rect;
+ GeglRectangle context_rect;
+ GeglSampler *sampler;
+ gdouble affected_points [8];
+ gint i;
+ GeglRectangle region = *input_region;
+
+ op_affine_sampler_init (affine);
+ sampler = affine->sampler;
+ context_rect = sampler->context_rect;
/* invoke child's matrix creation function */
g_assert (klass->create_matrix);
matrix3_identity (affine->matrix);
@@ -558,21 +609,10 @@
return region;
}
- if (! strcmp (affine->filter, "linear"))
- {
- if (affine->hard_edges)
- {
- region.width ++;
- region.height ++;
- }
- else
- {
- region.x--;
- region.y--;
- region.width += 2;
- region.height += 2;
- }
- }
+ region.x += context_rect.x;
+ region.y += context_rect.y;
+ region.width += context_rect.width;
+ region.height += context_rect.height;
affected_points [0] = region.x;
affected_points [1] = region.y;
@@ -591,22 +631,18 @@
affected_points + i, affected_points + i + 1);
bounding_box (affected_points, 4, &affected_rect);
-
return affected_rect;
}
-void gegl_sampler_prepare (GeglSampler *self);
- /*XXX: Eeeek, obsessive avoidance of public headers, the API needed to
- * satisfy this use case should probably be provided.
- */
static void
affine_generic (GeglBuffer *dest,
GeglBuffer *src,
Matrix3 matrix,
- GeglInterpolation interpolation)
+ GeglSampler *sampler)
{
+ GeglBufferIterator *i;
const GeglRectangle *dest_extent;
gint x, y;
gfloat *dest_buf,
@@ -630,54 +666,45 @@
g_object_get (dest, "pixels", &dest_pixels, NULL);
dest_extent = gegl_buffer_get_extent (dest);
- dest_buf = g_new (gfloat, dest_pixels * 4);
-
- matrix3_copy (inverse, matrix);
- matrix3_invert (inverse);
- u_start = inverse[0][0] * dest_extent->x + inverse[0][1] * dest_extent->y
- + inverse[0][2];
- v_start = inverse[1][0] * dest_extent->x + inverse[1][1] * dest_extent->y
- + inverse[1][2];
+ i = gegl_buffer_iterator_new (dest, dest_extent, format, GEGL_BUFFER_WRITE);
+ while (gegl_buffer_iterator_next (i))
+ {
+ GeglRectangle *roi = &i->roi[0];
+ dest_buf = (gfloat *)i->data[0];
- /* correct rounding on e.g. negative scaling (is this sound?) */
- if (inverse [0][0] < 0.)
- u_start -= .001;
- if (inverse [1][1] < 0.)
- v_start -= .001;
+ matrix3_copy (inverse, matrix);
+ matrix3_invert (inverse);
- if (src->sampler)
- {
- gegl_sampler_prepare (src->sampler);
- }
+ u_start = inverse[0][0] * roi->x + inverse[0][1] * roi->y + inverse[0][2];
+ v_start = inverse[1][0] * roi->x + inverse[1][1] * roi->y + inverse[1][2];
- for (dest_ptr = dest_buf, y = dest_extent->height; y--;)
- {
- u_float = u_start;
- v_float = v_start;
+ /* correct rounding on e.g. negative scaling (is this sound?) */
+ if (inverse [0][0] < 0.) u_start -= .001;
+ if (inverse [1][1] < 0.) v_start -= .001;
- for (x = dest_extent->width; x--;)
+ for (dest_ptr = dest_buf, y = roi->height; y--;)
{
- gfloat pix[4];
- gegl_buffer_sample (src, u_float, v_float, 1.0, pix, format, interpolation);
-
- *dest_ptr++ = pix[0];
- *dest_ptr++ = pix[1];
- *dest_ptr++ = pix[2];
- *dest_ptr++ = pix[3];
+ u_float = u_start;
+ v_float = v_start;
- u_float += inverse [0][0];
- v_float += inverse [1][0];
+ for (x = roi->width; x--;)
+ {
+ gegl_sampler_get (sampler, u_float, v_float, dest_ptr);
+ dest_ptr+=4;
+ u_float += inverse [0][0];
+ v_float += inverse [1][0];
+ }
+ u_start += inverse [0][1];
+ v_start += inverse [1][1];
}
- u_start += inverse [0][1];
- v_start += inverse [1][1];
}
- gegl_buffer_sample_cleanup (src);
- gegl_buffer_set (dest, NULL, format, dest_buf, GEGL_AUTO_ROWSTRIDE);
- g_free (dest_buf);
}
-
+void gegl_sampler_prepare (GeglSampler *self);
+ /*XXX: Eeeek, obsessive avoidance of public headers, the API needed to
+ * satisfy this use case should probably be provided.
+ */
static gboolean
process (GeglOperation *operation,
@@ -687,11 +714,6 @@
{
OpAffine *affine = (OpAffine *) operation;
- /*g_warning ("%i,%i %ix%i | %i,%i %ix%i | %i,%i %ix%i",
- input->x, input->y, input->width, input->height,
- output->x, output->y, output->width, output->height,
- result->x, result->y, result->width, result->height);*/
-
if (is_intermediate_node (affine) ||
matrix3_is_identity (affine->matrix))
{
@@ -708,27 +730,21 @@
(affine->matrix [0][2] == (gint) affine->matrix [0][2] &&
affine->matrix [1][2] == (gint) affine->matrix [1][2])))
{
- output = g_object_new (GEGL_TYPE_BUFFER,
- "source", input,
- "x", result->x,
- "y", result->y,
- "width", result->width ,
- "height", result->height,
- "shift-x", (gint) - affine->matrix [0][2],
- "shift-y", (gint) - affine->matrix [1][2],
- "abyss-width", -1, /* use source's abyss */
- NULL);
- /* fast path for affine translate with integer coordinates */
- gegl_operation_set_data (operation, context_id, "output", G_OBJECT (output));
- return TRUE;
+ GeglRectangle input_rectangle = *result;
+ input_rectangle.x += (gint) affine->matrix [0][2];
+ input_rectangle.y += (gint) affine->matrix [1][2];
+ gegl_buffer_copy (input, NULL, output, &input_rectangle);
}
#endif
else
{
/* XXX: add back more samplers */
- affine_generic (output, input, affine->matrix,
- gegl_buffer_interpolation_from_string (affine->filter));
+ g_object_set(affine->sampler, "buffer", input, NULL);
+ affine_generic (output, input, affine->matrix, affine->sampler);
+ g_object_unref(affine->sampler->buffer);
+ affine->sampler->buffer = NULL;
}
return TRUE;
}
+
Modified: branches/branch_zhangjb/operations/affine/affine.h
==============================================================================
--- branches/branch_zhangjb/operations/affine/affine.h (original)
+++ branches/branch_zhangjb/operations/affine/affine.h Thu Jun 19 02:52:46 2008
@@ -2,6 +2,7 @@
#define __OP_AFFINE_H__
#include "matrix.h"
+#include "gegl-buffer-private.h"
G_BEGIN_DECLS
@@ -19,12 +20,13 @@
{
GeglOperationFilter parent;
- Matrix3 matrix;
- gdouble origin_x,
- origin_y;
- gchar *filter;
- gboolean hard_edges;
- gint lanczos_width;
+ Matrix3 matrix;
+ gdouble origin_x,
+ origin_y;
+ gchar *filter;
+ gboolean hard_edges;
+ gint lanczos_width;
+ GeglSampler *sampler;
};
typedef struct _OpAffineClass OpAffineClass;
Modified: branches/branch_zhangjb/operations/common/brightness-contrast.c
==============================================================================
--- branches/branch_zhangjb/operations/common/brightness-contrast.c (original)
+++ branches/branch_zhangjb/operations/common/brightness-contrast.c Thu Jun 19 02:52:46 2008
@@ -72,10 +72,11 @@
* buffers with a pixel count.
*/
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
/* Retrieve a pointer to GeglChantO structure which contains all the
* chanted properties
@@ -115,21 +116,22 @@
*/
static gboolean
-process_simd (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong samples)
+process_simd (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
- g4float *in = in_buf;
- g4float *out = out_buf;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ g4float *in = in_buf;
+ g4float *out = out_buf;
/* add 0.5 to brightness here to make the logic in the innerloop tighter
*/
g4float brightness = g4float_all(o->brightness + 0.5);
g4float contrast = g4float_all(o->contrast);
g4float half = g4float_half;
-
+
while (samples--)
{
*out = (*in - half) * contrast + brightness;
Modified: branches/branch_zhangjb/operations/common/checkerboard.c
==============================================================================
--- branches/branch_zhangjb/operations/common/checkerboard.c (original)
+++ branches/branch_zhangjb/operations/common/checkerboard.c Thu Jun 19 02:52:46 2008
@@ -32,7 +32,7 @@
#else
-#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_TYPE_POINT_RENDER
#define GEGL_CHANT_C_FILE "checkerboard.c"
#include "gegl-chant.h"
@@ -46,21 +46,23 @@
static GeglRectangle
get_bounding_box (GeglOperation *operation)
{
- GeglRectangle result = {-10000000, -10000000, 20000000, 20000000};
+ /*GeglRectangle result = {-10000000, -10000000, 20000000, 20000000};*/
+ GeglRectangle result = {40,40,540,540};
return result;
}
static gboolean
process (GeglOperation *operation,
- GeglBuffer *output,
- const GeglRectangle *result)
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- gfloat *buf;
+ gfloat *out_pixel = out_buf;
gfloat color1[4];
gfloat color2[4];
- gint pxsize;
- gint n_pixels;
+ gint x = roi->x; /* initial x */
+ gint y = roi->y; /* and y coordinates */
gegl_color_get_rgba (o->color1,
&color1[0],
@@ -74,34 +76,38 @@
&color2[2],
&color2[3]);
- g_object_get (output, "px-size", &pxsize,
- "pixels", &n_pixels,
- NULL);
- buf = g_malloc (n_pixels * pxsize);
+ while (n_pixels--)
{
- gfloat *dst=buf;
- gint y;
- for (y=0; y < result->height; y++)
+ gint nx,ny;
+
+ nx = ((x + o->x_offset + 100000 * o->x)/o->x) ;
+ ny = ((y + o->y_offset + 100000 * o->y)/o->y) ;
+
+ if ( (nx+ny) % 2 == 0)
{
- gint x;
- for (x=0; x < result->width ; x++)
- {
- gfloat *rgba_color;
- gint nx,ny;
-
- nx = ((x + result->x + o->x_offset + 100000 * o->x)/o->x) ;
- ny = ((y + result->y + o->y_offset + 100000 * o->y)/o->y) ;
-
- rgba_color = (nx+ny) % 2 == 0 ? color1 : color2;
-
- memcpy (dst, rgba_color, 4*sizeof(gfloat));
- dst += 4;
- }
+ out_pixel[0]=color1[0];
+ out_pixel[1]=color1[1];
+ out_pixel[2]=color1[2];
+ out_pixel[3]=color1[3];
+ }
+ else
+ {
+ out_pixel[0]=color2[0];
+ out_pixel[1]=color2[1];
+ out_pixel[2]=color2[2];
+ out_pixel[3]=color2[3];
}
- }
- gegl_buffer_set (output, NULL, NULL, buf, GEGL_AUTO_ROWSTRIDE);
- g_free (buf);
+ out_pixel += 4;
+
+ /* update x and y coordinates */
+ x++;
+ if (x>=roi->x + roi->width)
+ {
+ x=roi->x;
+ y++;
+ }
+ }
return TRUE;
}
@@ -110,22 +116,19 @@
static void
gegl_chant_class_init (GeglChantClass *klass)
{
- GeglOperationClass *operation_class;
- GeglOperationSourceClass *source_class;
+ GeglOperationClass *operation_class;
+ GeglOperationPointRenderClass *point_render_class;
operation_class = GEGL_OPERATION_CLASS (klass);
- source_class = GEGL_OPERATION_SOURCE_CLASS (klass);
+ point_render_class = GEGL_OPERATION_POINT_RENDER_CLASS (klass);
- source_class->process = process;
+ point_render_class->process = process;
operation_class->get_bounding_box = get_bounding_box;
operation_class->prepare = prepare;
operation_class->name = "checkerboard";
operation_class->categories = "render";
operation_class->description = "Checkerboard renderer.";
-
- operation_class->no_cache = TRUE;
- operation_class->get_cached_region = NULL;
}
#endif
Modified: branches/branch_zhangjb/operations/common/color-temperature.c
==============================================================================
--- branches/branch_zhangjb/operations/common/color-temperature.c (original)
+++ branches/branch_zhangjb/operations/common/color-temperature.c Thu Jun 19 02:52:46 2008
@@ -28,13 +28,13 @@
#include "gegl-chant.h"
-#define LOWEST_TEMPERATURE 1000
+#define LOWEST_TEMPERATURE 1000
#define HIGHEST_TEMPERATURE 12000
-gfloat rgb_r55[][12];
+static const gfloat rgb_r55[][12];
static void
-convert_k_to_rgb (gfloat temperature,
+convert_k_to_rgb (gfloat temperature,
gfloat *rgb)
{
gfloat nomin, denom;
@@ -56,13 +56,13 @@
nomin = rgb_r55[channel][0];
for (deg = 1; deg < 6; deg++)
nomin = nomin * temperature + rgb_r55[channel][deg];
-
+
denom = rgb_r55[channel][6];
for (deg = 1; deg < 6; deg++)
denom = denom * temperature + rgb_r55[channel][6 + deg];
-
- rgb[channel] = nomin / denom;
- }
+
+ rgb[channel] = nomin / denom;
+ }
}
@@ -77,10 +77,11 @@
* in our requested pixel format
*/
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
gfloat *in_pixel;
@@ -95,19 +96,20 @@
original_temp = o->original_temp;
intended_temp = o->intended_temp;
-
+
convert_k_to_rgb (original_temp, original_temp_rgb);
convert_k_to_rgb (intended_temp, intended_temp_rgb);
-
- coefs[0] = original_temp_rgb[0] / intended_temp_rgb[0];
- coefs[1] = original_temp_rgb[1] / intended_temp_rgb[1];
- coefs[2] = original_temp_rgb[2] / intended_temp_rgb[2];
+
+ coefs[0] = original_temp_rgb[0] / intended_temp_rgb[0];
+ coefs[1] = original_temp_rgb[1] / intended_temp_rgb[1];
+ coefs[2] = original_temp_rgb[2] / intended_temp_rgb[2];
for (i = 0; i < n_pixels; i++)
{
out_pixel[0] = in_pixel[0] * coefs[0];
out_pixel[1] = in_pixel[1] * coefs[1];
out_pixel[2] = in_pixel[2] * coefs[2];
+ out_pixel[3] = in_pixel[3];
in_pixel += 4;
out_pixel += 4;
@@ -134,15 +136,15 @@
"Allows changing the color temperature of an image.";
}
-/* Coefficients of rational functions of degree 5 fitted per color channel to
- * the linear RGB coordinates of the range 1000K-12000K of the Planckian locus
+/* Coefficients of rational functions of degree 5 fitted per color channel to
+ * the linear RGB coordinates of the range 1000K-12000K of the Planckian locus
* with the 20K step. Original CIE-xy data from
*
* http://www.aim-dtp.net/aim/technology/cie_xyz/k2xy.txt
*
* converted to the linear RGB space assuming the ITU-R BT.709-5/sRGB primaries
*/
-gfloat rgb_r55[][12] = {{
+static const gfloat rgb_r55[][12] = {{
6.9389923563552169e-01, 2.7719388100974670e+03,
2.0999316761104289e+07,-4.8889434162208414e+09,
-1.1899785506796783e+07,-4.7418427686099203e+04,
Modified: branches/branch_zhangjb/operations/common/color.c
==============================================================================
--- branches/branch_zhangjb/operations/common/color.c (original)
+++ branches/branch_zhangjb/operations/common/color.c Thu Jun 19 02:52:46 2008
@@ -21,7 +21,7 @@
"The color to render (defaults to 'black')")
#else
-#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_TYPE_POINT_RENDER
#define GEGL_CHANT_C_FILE "color.c"
#include "gegl-chant.h"
@@ -39,21 +39,14 @@
return result;
}
-static GeglNode *
-detect (GeglOperation *operation,
- gint x,
- gint y)
-{
- return NULL;
-}
-
static gboolean
process (GeglOperation *operation,
- GeglBuffer *output,
- const GeglRectangle *result)
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- gfloat *buf;
+ gfloat *out_pixel = out_buf;
gfloat color[4];
gegl_color_get_rgba (o->value,
@@ -62,19 +55,15 @@
&color[2],
&color[3]);
- buf = g_new (gfloat, result->width * result->height * 4);
+ while (n_pixels--)
{
- gfloat *dst = buf;
- gint i;
- for (i = 0; i < result->height * result->width ; i++)
- {
- memcpy(dst, color, 4 * sizeof (gfloat));
- dst += 4;
- }
- }
- gegl_buffer_set (output, NULL, NULL, buf, GEGL_AUTO_ROWSTRIDE);
- g_free (buf);
+ out_pixel[0]=color[0];
+ out_pixel[1]=color[1];
+ out_pixel[2]=color[2];
+ out_pixel[3]=color[3];
+ out_pixel += 4;
+ }
return TRUE;
}
@@ -82,13 +71,13 @@
static void
gegl_chant_class_init (GeglChantClass *klass)
{
- GeglOperationClass *operation_class;
- GeglOperationSourceClass *source_class;
+ GeglOperationClass *operation_class;
+ GeglOperationPointRenderClass *point_render_class;
operation_class = GEGL_OPERATION_CLASS (klass);
- source_class = GEGL_OPERATION_SOURCE_CLASS (klass);
+ point_render_class = GEGL_OPERATION_POINT_RENDER_CLASS (klass);
- source_class->process = process;
+ point_render_class->process = process;
operation_class->get_bounding_box = get_bounding_box;
operation_class->prepare = prepare;
@@ -96,10 +85,6 @@
operation_class->categories = "render";
operation_class->description =
"Generates a buffer entirely filled with the specified color, crop it to get smaller dimensions.";
-
- operation_class->no_cache = TRUE;
- operation_class->detect = detect;
- operation_class->get_cached_region = NULL;
}
#endif
Modified: branches/branch_zhangjb/operations/common/contrast-curve.c
==============================================================================
--- branches/branch_zhangjb/operations/common/contrast-curve.c (original)
+++ branches/branch_zhangjb/operations/common/contrast-curve.c Thu Jun 19 02:52:46 2008
@@ -37,10 +37,11 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong samples)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
gint num_sampling_points;
Modified: branches/branch_zhangjb/operations/common/grey.c
==============================================================================
--- branches/branch_zhangjb/operations/common/grey.c (original)
+++ branches/branch_zhangjb/operations/common/grey.c Thu Jun 19 02:52:46 2008
@@ -35,10 +35,11 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong samples)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi)
{
glong i;
gfloat *in = in_buf;
Modified: branches/branch_zhangjb/operations/common/introspect.c
==============================================================================
--- branches/branch_zhangjb/operations/common/introspect.c (original)
+++ branches/branch_zhangjb/operations/common/introspect.c Thu Jun 19 02:52:46 2008
@@ -48,7 +48,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *result)
{
@@ -60,7 +60,7 @@
{
g_object_ref (o->buf); /* add an extra reference, since gegl_operation_set_data
is stealing one */
- gegl_node_context_set_object (context, "output", G_OBJECT (o->buf));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (o->buf));
}
return TRUE;
}
@@ -96,7 +96,7 @@
if (context)
{
g_object_ref (o->buf);
- gegl_node_context_set_object (context, "output", G_OBJECT (o->buf));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (o->buf));
}
}
Modified: branches/branch_zhangjb/operations/common/invert.c
==============================================================================
--- branches/branch_zhangjb/operations/common/invert.c (original)
+++ branches/branch_zhangjb/operations/common/invert.c Thu Jun 19 02:52:46 2008
@@ -28,10 +28,11 @@
#include "gegl-chant.h"
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong samples)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi)
{
glong i;
gfloat *in = in_buf;
@@ -56,10 +57,11 @@
#ifdef HAS_G4FLOAT
static gboolean
-process_simd (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong samples)
+process_simd (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi)
{
g4float *in = in_buf;
g4float *out = out_buf;
Modified: branches/branch_zhangjb/operations/common/levels.c
==============================================================================
--- branches/branch_zhangjb/operations/common/levels.c (original)
+++ branches/branch_zhangjb/operations/common/levels.c Thu Jun 19 02:52:46 2008
@@ -38,10 +38,11 @@
* in our requested pixel format
*/
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
gfloat *pixel;
Modified: branches/branch_zhangjb/operations/common/load-buffer.c
==============================================================================
--- branches/branch_zhangjb/operations/common/load-buffer.c (original)
+++ branches/branch_zhangjb/operations/common/load-buffer.c Thu Jun 19 02:52:46 2008
@@ -43,7 +43,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *result)
{
@@ -56,8 +56,8 @@
* stealing one.
*/
- /* override core behaviour, by resetting the buffer in the node_context */
- gegl_node_context_set_object (context, "output",
+ /* override core behaviour, by resetting the buffer in the operation_context */
+ gegl_operation_context_set_object (context, "output",
G_OBJECT (o->buffer));
}
return TRUE;
Modified: branches/branch_zhangjb/operations/common/magick-load.c
==============================================================================
--- branches/branch_zhangjb/operations/common/magick-load.c (original)
+++ branches/branch_zhangjb/operations/common/magick-load.c Thu Jun 19 02:52:46 2008
@@ -106,7 +106,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *result)
{
@@ -116,7 +116,7 @@
return FALSE;
/* overriding the predefined behavior */
- gegl_node_context_set_object (context, "output", G_OBJECT (o->chant_data));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (o->chant_data));
o->chant_data = NULL;
return TRUE;
Modified: branches/branch_zhangjb/operations/common/mblur.c
==============================================================================
--- branches/branch_zhangjb/operations/common/mblur.c (original)
+++ branches/branch_zhangjb/operations/common/mblur.c Thu Jun 19 02:52:46 2008
@@ -17,7 +17,7 @@
*/
#ifdef GEGL_CHANT_PROPERTIES
-gegl_chant_double (dampness, "Dampness", 0.0, 1.0, 0.95, "dampening, 0.0 is no dampening 1.0 is no change.")
+gegl_chant_double (dampness, "Dampness", 0.0, 1.0, 0.95, "The value represents the contribution of the past to the new frame.")
#else
@@ -33,9 +33,8 @@
static void
-init (GeglChantO *operation)
+init (GeglChantO *o)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
Priv *priv = (Priv*)o->chant_data;
GeglRectangle extent = {0,0,1024,1024};
@@ -67,6 +66,7 @@
p = (Priv*)o->chant_data;
if (p == NULL)
init (o);
+ p = (Priv*)o->chant_data;
{
GeglBuffer *temp_in;
@@ -134,7 +134,7 @@
operation_class->prepare = prepare;
operation_class->name = "mblur";
- operation_class->categories = "blur:misc";
+ operation_class->categories = "blur:video";
operation_class->description = "Accumulating motion blur";
}
Modified: branches/branch_zhangjb/operations/common/noise.c
==============================================================================
--- branches/branch_zhangjb/operations/common/noise.c (original)
+++ branches/branch_zhangjb/operations/common/noise.c Thu Jun 19 02:52:46 2008
@@ -25,7 +25,7 @@
#else
-#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_TYPE_POINT_RENDER
#define GEGL_CHANT_C_FILE "noise.c"
#include "gegl-chant.h"
@@ -47,49 +47,48 @@
static gboolean
process (GeglOperation *operation,
- GeglBuffer *output,
- const GeglRectangle *result)
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- gfloat *buf;
+ gfloat *out_pixel = out_buf;
+ gint x = roi->x; /* initial x */
+ gint y = roi->y; /* and y coordinates */
- buf = g_new (gfloat, result->width * result->height);
+
+ while (n_pixels--)
{
- gfloat *dst = buf;
- gint y;
- for (y = 0; y < result->height; y++)
+ gfloat val;
+
+ val = PerlinNoise3D ((double) (x)/50.0,
+ (double) (y)/50.0,
+ (double) o->zoff, o->alpha, o->scale,
+ o->n);
+ *out_pixel = val * 0.5 + 0.5;
+ out_pixel ++;
+
+ /* update x and y coordinates */
+ x++;
+ if (x>=roi->x + roi->width)
{
- gint x;
- for (x = 0; x < result->width ; x++)
- {
- gfloat val;
-
- val = PerlinNoise3D ((double) (x + result->x)/50.0,
- (double) (y + result->y)/50.0,
- (double) o->zoff, o->alpha, o->scale,
- o->n);
- *dst = val * 0.5 + 0.5;
- dst ++;
- }
+ x=roi->x;
+ y++;
}
}
- gegl_buffer_set (output, NULL, babl_format ("Y float"), buf,
- GEGL_AUTO_ROWSTRIDE);
- g_free (buf);
-
return TRUE;
}
static void
gegl_chant_class_init (GeglChantClass *klass)
{
- GeglOperationClass *operation_class;
- GeglOperationSourceClass *source_class;
+ GeglOperationClass *operation_class;
+ GeglOperationPointRenderClass *point_render_class;
operation_class = GEGL_OPERATION_CLASS (klass);
- source_class = GEGL_OPERATION_SOURCE_CLASS (klass);
+ point_render_class = GEGL_OPERATION_POINT_RENDER_CLASS (klass);
- source_class->process = process;
+ point_render_class->process = process;
operation_class->get_bounding_box = get_bounding_box;
operation_class->prepare = prepare;
Modified: branches/branch_zhangjb/operations/common/opacity.c
==============================================================================
--- branches/branch_zhangjb/operations/common/opacity.c (original)
+++ branches/branch_zhangjb/operations/common/opacity.c Thu Jun 19 02:52:46 2008
@@ -36,11 +36,12 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ const glong n_pixels,
+ const GeglRectangle *roi)
{
gfloat *in = in_buf;
gfloat *out = out_buf;
Modified: branches/branch_zhangjb/operations/common/open-buffer.c
==============================================================================
--- branches/branch_zhangjb/operations/common/open-buffer.c (original)
+++ branches/branch_zhangjb/operations/common/open-buffer.c Thu Jun 19 02:52:46 2008
@@ -69,7 +69,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *result)
{
@@ -82,8 +82,8 @@
* stealing one.
*/
- /* override core behaviour, by resetting the buffer in the node_context */
- gegl_node_context_set_object (context, "output", G_OBJECT (buffer));
+ /* override core behaviour, by resetting the buffer in the operation_context */
+ gegl_operation_context_set_object (context, "output", G_OBJECT (buffer));
return TRUE;
}
return FALSE;
Modified: branches/branch_zhangjb/operations/common/raw-load.c
==============================================================================
--- branches/branch_zhangjb/operations/common/raw-load.c (original)
+++ branches/branch_zhangjb/operations/common/raw-load.c Thu Jun 19 02:52:46 2008
@@ -118,7 +118,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *result)
{
@@ -129,7 +129,7 @@
g_assert (g_str_equal (output_pad, "output"));
output = GEGL_BUFFER (o->chant_data);
- gegl_node_context_set_object (context, "output", G_OBJECT (output));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (output));
o->chant_data = NULL;
return TRUE;
Modified: branches/branch_zhangjb/operations/common/remap.c
==============================================================================
--- branches/branch_zhangjb/operations/common/remap.c (original)
+++ branches/branch_zhangjb/operations/common/remap.c Thu Jun 19 02:52:46 2008
@@ -108,7 +108,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result)
{
@@ -122,9 +122,9 @@
gint pixels = result->width * result->height;
gint i;
- input = gegl_node_context_get_source (context, "input");
- low = gegl_node_context_get_source (context, "low");
- high = gegl_node_context_get_source (context, "high");
+ input = gegl_operation_context_get_source (context, "input");
+ low = gegl_operation_context_get_source (context, "low");
+ high = gegl_operation_context_get_source (context, "high");
buf = g_new (gfloat, pixels * 4);
min = g_new (gfloat, pixels * 3);
@@ -134,7 +134,7 @@
gegl_buffer_get (low, 1.0, result, babl_format ("RGB float"), min, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (high, 1.0, result, babl_format ("RGB float"), max, GEGL_AUTO_ROWSTRIDE);
- output = gegl_node_context_get_target (context, "output");
+ output = gegl_operation_context_get_target (context, "output");
for (i = 0; i < pixels; i++)
{
Modified: branches/branch_zhangjb/operations/common/svg-huerotate.c
==============================================================================
--- branches/branch_zhangjb/operations/common/svg-huerotate.c (original)
+++ branches/branch_zhangjb/operations/common/svg-huerotate.c Thu Jun 19 02:52:46 2008
@@ -1,7 +1,4 @@
-/* !!!! AUTOGENERATED FILE generated by svg-colormatrix.sh !!!!!
- *
- *
- * This file is an image processing operation for GEGL
+/* This file is an image processing operation for GEGL
*
* GEGL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,9 +15,8 @@
*
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
* Copyright 2006 Geert Jordaens <geert jordaens telenet be>
- *
- * !!!! AUTOGENERATED FILE !!!!!
*/
+
#ifdef GEGL_CHANT_PROPERTIES
gegl_chant_string (values, "Values", "", "list of <number>s")
@@ -43,13 +39,14 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
- gfloat *in = in_buf;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ gfloat *in = in_buf;
gfloat *out = out_buf;
gfloat *m;
Modified: branches/branch_zhangjb/operations/common/svg-luminancetoalpha.c
==============================================================================
--- branches/branch_zhangjb/operations/common/svg-luminancetoalpha.c (original)
+++ branches/branch_zhangjb/operations/common/svg-luminancetoalpha.c Thu Jun 19 02:52:46 2008
@@ -1,6 +1,4 @@
-/* !!!! AUTOGENERATED FILE generated by svg-colormatrix.sh !!!!!
- *
- * This file is an image processing operation for GEGL
+/* This file is an image processing operation for GEGL
*
* GEGL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,9 +15,8 @@
*
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
* Copyright 2006 Geert Jordaens <geert jordaens telenet be>
- *
- * !!!! AUTOGENERATED FILE !!!!!
*/
+
#ifdef GEGL_CHANT_PROPERTIES
gegl_chant_string (values, "Values", "", "list of <number>s")
@@ -42,10 +39,11 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
gfloat *in = in_buf;
gfloat *out = out_buf;
Modified: branches/branch_zhangjb/operations/common/svg-matrix.c
==============================================================================
--- branches/branch_zhangjb/operations/common/svg-matrix.c (original)
+++ branches/branch_zhangjb/operations/common/svg-matrix.c Thu Jun 19 02:52:46 2008
@@ -1,6 +1,4 @@
-/* !!!! AUTOGENERATED FILE generated by svg-colormatrix.sh !!!!!
- *
- * This file is an image processing operation for GEGL
+/* This file is an image processing operation for GEGL
*
* GEGL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,9 +15,8 @@
*
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
* Copyright 2006 Geert Jordaens <geert jordaens telenet be>
- *
- * !!!! AUTOGENERATED FILE !!!!!
*/
+
#ifdef GEGL_CHANT_PROPERTIES
gegl_chant_string (values, "Values", "", "list of <number>s")
@@ -42,10 +39,11 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
gfloat *in = in_buf;
Modified: branches/branch_zhangjb/operations/common/svg-saturate.c
==============================================================================
--- branches/branch_zhangjb/operations/common/svg-saturate.c (original)
+++ branches/branch_zhangjb/operations/common/svg-saturate.c Thu Jun 19 02:52:46 2008
@@ -1,6 +1,4 @@
-/* !!!! AUTOGENERATED FILE generated by svg-colormatrix.sh !!!!!
- *
- * This file is an image processing operation for GEGL
+/* This file is an image processing operation for GEGL
*
* GEGL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,9 +15,8 @@
*
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
* Copyright 2006 Geert Jordaens <geert jordaens telenet be>
- *
- * !!!! AUTOGENERATED FILE !!!!!
*/
+
#ifdef GEGL_CHANT_PROPERTIES
gegl_chant_string (values, "Values", "", "list of <number>s")
@@ -43,10 +40,11 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
gfloat *in = in_buf;
Modified: branches/branch_zhangjb/operations/common/threshold.c
==============================================================================
--- branches/branch_zhangjb/operations/common/threshold.c (original)
+++ branches/branch_zhangjb/operations/common/threshold.c Thu Jun 19 02:52:46 2008
@@ -35,11 +35,12 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
gfloat *in = in_buf;
gfloat *out = out_buf;
Modified: branches/branch_zhangjb/operations/common/value-invert.c
==============================================================================
--- branches/branch_zhangjb/operations/common/value-invert.c (original)
+++ branches/branch_zhangjb/operations/common/value-invert.c Thu Jun 19 02:52:46 2008
@@ -42,10 +42,11 @@
#include "gegl-chant.h"
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong samples)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi)
{
glong j;
gfloat *src = in_buf;
Modified: branches/branch_zhangjb/operations/common/whitebalance.c
==============================================================================
--- branches/branch_zhangjb/operations/common/whitebalance.c (original)
+++ branches/branch_zhangjb/operations/common/whitebalance.c Thu Jun 19 02:52:46 2008
@@ -42,10 +42,11 @@
* in our requested pixel format
*/
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
gfloat *in_pixel;
Modified: branches/branch_zhangjb/operations/core/clone.c
==============================================================================
--- branches/branch_zhangjb/operations/core/clone.c (original)
+++ branches/branch_zhangjb/operations/core/clone.c Thu Jun 19 02:52:46 2008
@@ -66,7 +66,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result)
{
@@ -78,13 +78,13 @@
return FALSE;
}
- input = gegl_node_context_get_source (context, "input");
+ input = gegl_operation_context_get_source (context, "input");
if (!input)
{
g_warning ("clone received NULL input");
return FALSE;
}
- gegl_node_context_set_object (context, "output", G_OBJECT (input));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (input));
return TRUE;
}
Modified: branches/branch_zhangjb/operations/core/convert-format.c
==============================================================================
--- branches/branch_zhangjb/operations/core/convert-format.c (original)
+++ branches/branch_zhangjb/operations/core/convert-format.c Thu Jun 19 02:52:46 2008
@@ -45,10 +45,11 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *out_buf,
- glong samples)
+process (GeglOperation *op,
+ void *in_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi)
{
return TRUE;
}
Modified: branches/branch_zhangjb/operations/core/crop.c
==============================================================================
--- branches/branch_zhangjb/operations/core/crop.c (original)
+++ branches/branch_zhangjb/operations/core/crop.c Thu Jun 19 02:52:46 2008
@@ -87,12 +87,15 @@
const gchar *input_pad,
const GeglRectangle *roi)
{
- return *roi;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglRectangle result = {o->x, o->y, o->width, o->height};
+ gegl_rectangle_intersect (&result, &result, roi);
+ return result;
}
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result)
{
@@ -107,14 +110,14 @@
return FALSE;
}
- input = gegl_node_context_get_source (context, "input");
+ input = gegl_operation_context_get_source (context, "input");
if (input != NULL)
{
GeglBuffer *output;
output = gegl_buffer_create_sub_buffer (input, &extent);
- gegl_node_context_set_object (context, "output", G_OBJECT (output));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (output));
g_object_unref (input);
success = TRUE;
}
Modified: branches/branch_zhangjb/operations/core/nop.c
==============================================================================
--- branches/branch_zhangjb/operations/core/nop.c (original)
+++ branches/branch_zhangjb/operations/core/nop.c Thu Jun 19 02:52:46 2008
@@ -29,7 +29,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result)
{
@@ -41,14 +41,14 @@
return FALSE;
}
- input = gegl_node_context_get_source (context, "input");
+ input = gegl_operation_context_get_source (context, "input");
if (!input)
{
g_warning ("nop received NULL input");
return FALSE;
}
- gegl_node_context_set_object (context, "output", G_OBJECT (input));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (input));
return TRUE;
}
Modified: branches/branch_zhangjb/operations/core/shift.c
==============================================================================
--- branches/branch_zhangjb/operations/core/shift.c (original)
+++ branches/branch_zhangjb/operations/core/shift.c Thu Jun 19 02:52:46 2008
@@ -109,7 +109,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result)
{
@@ -126,7 +126,7 @@
return FALSE;
}
- input = gegl_node_context_get_source (context, "input");
+ input = gegl_operation_context_get_source (context, "input");
if (input != NULL)
{
@@ -141,7 +141,7 @@
of source) */
NULL);
- gegl_node_context_set_object (context, "output", G_OBJECT (output));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (output));
g_object_unref (input);
Modified: branches/branch_zhangjb/operations/external/text.c
==============================================================================
--- branches/branch_zhangjb/operations/external/text.c (original)
+++ branches/branch_zhangjb/operations/external/text.c Thu Jun 19 02:52:46 2008
@@ -123,12 +123,12 @@
(guint16) (color[1] * 65535),
(guint16) (color[2] * 65535));
if (attr)
- {
- attr->start_index = 0;
- attr->end_index = -1;
- pango_attr_list_insert (attrs, attr);
- pango_layout_set_attributes (layout, attrs);
- }
+ {
+ attr->start_index = 0;
+ attr->end_index = -1;
+ pango_attr_list_insert (attrs, attr);
+ pango_layout_set_attributes (layout, attrs);
+ }
}
/* Inform Pango to re-layout the text with the new transformation */
Modified: branches/branch_zhangjb/operations/generated/math.rb
==============================================================================
--- branches/branch_zhangjb/operations/generated/math.rb (original)
+++ branches/branch_zhangjb/operations/generated/math.rb Thu Jun 19 02:52:46 2008
@@ -24,13 +24,13 @@
*/'
a = [
- ['add', 'c = c + value', 0],
- ['subtract', 'c = c - value', 0],
- ['multiply', 'c = c * value', 1.0],
- ['divide', 'c = value==0.0?0.0:c/value', 1.0],
- ['gamma', 'c = powf (c, value)', 1.0],
-# ['threshold', 'c = c>=value?1.0:0.0', 0.5],
-# ['invert', 'c = 1.0-c']
+ ['add', 'c = c + value', 0.0],
+ ['subtract', 'c = c - value', 0.0],
+ ['multiply', 'c = c * value', 1.0],
+ ['divide', 'c = value==0.0?0.0:c/value', 1.0],
+ ['gamma', 'c = powf (c, value)', 1.0],
+# ['threshold', 'c = c>=value?1.0:0.0', 0.5],
+# ['invert', 'c = 1.0-c']
]
a.each do
@@ -76,11 +76,12 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
gfloat *in = in_buf;
gfloat *out = out_buf;
Modified: branches/branch_zhangjb/operations/generated/other-blend.rb
==============================================================================
--- branches/branch_zhangjb/operations/generated/other-blend.rb (original)
+++ branches/branch_zhangjb/operations/generated/other-blend.rb Thu Jun 19 02:52:46 2008
@@ -61,11 +61,12 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
gint i;
gfloat *in = in_buf;
@@ -157,11 +158,12 @@
#ifdef HAS_G4FLOAT
static gboolean
-process_gegl4float (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong n_pixels)
+process_gegl4float (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
g4float *A = aux_buf;
g4float *B = in_buf;
@@ -170,7 +172,7 @@
if (B==NULL || n_pixels == 0)
return TRUE;
- while (--n_pixels)
+ while (n_pixels--)
{
#{sse_formula};
Modified: branches/branch_zhangjb/operations/generated/svg-12-blend.rb
==============================================================================
--- branches/branch_zhangjb/operations/generated/svg-12-blend.rb (original)
+++ branches/branch_zhangjb/operations/generated/svg-12-blend.rb Thu Jun 19 02:52:46 2008
@@ -88,11 +88,12 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
gfloat *in = in_buf;
gfloat *aux = aux_buf;
Modified: branches/branch_zhangjb/operations/generated/svg-12-porter-duff.rb
==============================================================================
--- branches/branch_zhangjb/operations/generated/svg-12-porter-duff.rb (original)
+++ branches/branch_zhangjb/operations/generated/svg-12-porter-duff.rb Thu Jun 19 02:52:46 2008
@@ -90,11 +90,12 @@
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong n_pixels)
+process (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
gint i;
gfloat *in = in_buf;
@@ -121,7 +122,7 @@
#ifdef HAS_G4FLOAT
gegl_operation_class_add_processor (operation_class,
- G_CALLBACK (process_gegl4float), "simd");
+ G_CALLBACK (process_simd), "simd");
#endif
'
@@ -186,11 +187,12 @@
#ifdef HAS_G4FLOAT
static gboolean
-process_gegl4float (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong n_pixels)
+process_simd (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong n_pixels,
+ const GeglRectangle *roi)
{
g4float *A = aux_buf;
g4float *B = in_buf;
@@ -199,7 +201,7 @@
if (B==NULL || n_pixels == 0)
return TRUE;
- while (--n_pixels)
+ while (n_pixels--)
{
#{sse_formula};
Modified: branches/branch_zhangjb/operations/workshop/rawbayer-load.c
==============================================================================
--- branches/branch_zhangjb/operations/workshop/rawbayer-load.c (original)
+++ branches/branch_zhangjb/operations/workshop/rawbayer-load.c Thu Jun 19 02:52:46 2008
@@ -105,7 +105,7 @@
static gboolean
process (GeglOperation *operation,
- GeglNodeContext *context,
+ GeglOperationContext *context,
const gchar *output_pad,
const GeglRectangle *result)
@@ -113,7 +113,7 @@
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
#if 1
g_assert (o->chant_data);
- gegl_node_context_set_object (context, "output", G_OBJECT (o->chant_data));
+ gegl_operation_context_set_object (context, "output", G_OBJECT (o->chant_data));
o->chant_data = NULL;
#else
@@ -123,8 +123,8 @@
is stealing one.
*/
- /* override core behaviour, by resetting the buffer in the node_context */
- gegl_node_context_set_object (context, "output", G_OBJECT (o->chant_data));
+ /* override core behaviour, by resetting the buffer in the operation_context */
+ gegl_operation_context_set_object (context, "output", G_OBJECT (o->chant_data));
}
#endif
return TRUE;
Modified: branches/branch_zhangjb/operations/workshop/stroke.c
==============================================================================
--- branches/branch_zhangjb/operations/workshop/stroke.c (original)
+++ branches/branch_zhangjb/operations/workshop/stroke.c Thu Jun 19 02:52:46 2008
@@ -48,15 +48,15 @@
static GeglRectangle
get_bounding_box (GeglOperation *operation)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- GeglRectangle defined = {0,0, 512,512};
- gdouble x0,x1,y0,y1;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglRectangle defined = { 0, 0, 512, 512 };
+ gdouble x0, x1, y0, y1;
gegl_vector_get_bounds (o->vector, &x0, &x1, &y0, &y1);
- defined.x = x0 - o->linewidth;
- defined.y = y0 - o->linewidth;
- defined.width = x1-x0 + o->linewidth * 2;
- defined.height = y1-y0 + o->linewidth * 2;
+ defined.x = x0 - o->linewidth;
+ defined.y = y0 - o->linewidth;
+ defined.width = x1 - x0 + o->linewidth * 2;
+ defined.height = y1 - y0 + o->linewidth * 2;
return defined;
}
@@ -70,6 +70,7 @@
GeglRectangle box = get_bounding_box (operation);
gegl_buffer_clear (output, &box);
+ g_object_set_data (operation, "vector-radius", GINT_TO_POINTER((gint)(o->linewidth+1)/2));
gegl_vector_stroke (output, o->vector, o->color, o->linewidth, o->hardness);
return TRUE;
Modified: branches/branch_zhangjb/tests/buffer/Makefile
==============================================================================
--- branches/branch_zhangjb/tests/buffer/Makefile (original)
+++ branches/branch_zhangjb/tests/buffer/Makefile Thu Jun 19 02:52:46 2008
@@ -7,16 +7,22 @@
@echo `cat report | grep identical | wc -l` of `ls -1 reference | wc -l` tests succesful.
-buffer-tests.inc: buffer-test.c Makefile
+buffer-tests.inc: buffer-test.c Makefile tests/*.c
# extracting list of test functions from .c file before compilation
# of c-file itself.
- echo 'typedef gchar *(*TestFunc) ();TestFunc tests[]={' > $@
- for TEST in `rgrep '^static gchar.*(' buffer-test.c | sed -e 's/static.*\* *//' -e 's/[(){ ]*$$//'`;do \
+ echo '/* this file is generated by the Makefile */' > $@
+ for TEST in `ls tests/*.c -1|sed -e s:tests/:: -e s:\\\.c::`; do \
+ echo "#define TEST() static gchar * $$TEST ()" >> $@;\
+ echo "#include \"tests/"$$TEST".c\"" >> $@;\
+ echo "#undef TEST" >> $@;\
+ done;
+ echo 'typedef gchar *(*TestFunc) ();TestFunc tests[]={' >> $@
+ for TEST in `ls tests/*.c -1|sed -e s:tests/:: -e s:\\\.c::`; do \
echo $$TEST, >> $@;\
done;
echo '};' >> $@
echo 'static gchar *test_names[]={' >> $@
- for TEST in `rgrep '^static gchar.*(' buffer-test.c | sed -e 's/static.*\* *//' -e 's/[(){ ]*$$//'`;do \
+ for TEST in `ls tests/*.c -1|sed -e s:tests/:: -e s:\\\.c::`; do \
echo \"$$TEST\", >> $@;\
done;
echo '};' >> $@
@@ -25,6 +31,7 @@
@cat report
@echo ''
@echo `cat report | grep identical | wc -l` of `ls -1 reference | wc -l` tests succesful.
+ @cat report | grep Only
rm report
clean:
Modified: branches/branch_zhangjb/tests/buffer/buffer-test.c
==============================================================================
--- branches/branch_zhangjb/tests/buffer/buffer-test.c (original)
+++ branches/branch_zhangjb/tests/buffer/buffer-test.c Thu Jun 19 02:52:46 2008
@@ -12,6 +12,11 @@
* tile sizes to make sure the behavior is consistent.
*/
+#include "../../gegl/buffer/gegl-buffer-iterator.h"
+#include "../../gegl/buffer/gegl-buffer-linear.h"
+
+
+
/* helper macros for the output, issue a test_start() after your defined
* variables and the first logic, use print as your printf and print_buffer to
* dump a GeglBuffer's contents to the log, issue test_end for the final
@@ -57,476 +62,14 @@
gint height,
gfloat value);
+static void fill_rect (GeglBuffer *buffer,
+ const GeglRectangle *roi,
+ gfloat value
+ );
-/***********************************************************************/
-
-static gchar * vertical_gradient ()
-{
- GeglBuffer *buffer;
- GeglRectangle rect = {0, 0, 20, 20};
-
- test_start();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
- vgrad (buffer);
- print_buffer (buffer);
- gegl_buffer_destroy (buffer);
- test_end();
-}
-
-static gchar * test_checkerboard ()
-{
- GeglBuffer *buffer;
- GeglRectangle rect = {0, 0, 20, 20};
-
- test_start ();
-
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
- checkerboard (buffer, 3, 0.0, 1.0);
- print_buffer (buffer);
- gegl_buffer_destroy (buffer);
-
- test_end ();
-}
-
-static gchar * test_get_buffer_scaled ()
-{
- GeglBuffer *buffer;
- GeglRectangle rect = {0, 0, 50, 50};
- GeglRectangle getrect = {0, 0, 12, 8};
- guchar *buf;
-
- test_start ();
-
- buffer = gegl_buffer_new (&rect, babl_format ("Y u8"));
- checkerboard (buffer, 2, 0.0, 1.0);
- buf = g_malloc (getrect.width*getrect.height*sizeof(gfloat));
-
- {
- gint i;
-
- for (i=0; i<10; i++)
- {
- getrect.x=i;
- /*getrect.y=i;*/
- gegl_buffer_get (buffer, 1.2, &getrect, babl_format ("Y u8"), buf, 0);
- print_linear_buffer_u8 (getrect.width, getrect.height, buf);
- }
- }
-
- gegl_buffer_destroy (buffer);
-
- g_free (buf);
- test_end ();
-}
-
-static gchar * test_get_buffer_scaled2 ()
-{
- GeglBuffer *buffer;
- GeglRectangle rect = {0, 0, 10, 10};
- GeglRectangle getrect = {-2, -2, 10, 10};
- guchar *buf;
-
- test_start ();
-
- buffer = gegl_buffer_new (&rect, babl_format ("Y u8"));
- checkerboard (buffer, 2, 0.0, 1.0);
- buf = g_malloc (getrect.width*getrect.height*sizeof(gfloat));
-
- gegl_buffer_get (buffer, 0.66, &getrect, babl_format ("Y u8"), buf, 0);
-
-
- print_linear_buffer_u8 (getrect.width, getrect.height, buf);
- gegl_buffer_destroy (buffer);
-
- g_free (buf);
- test_end ();
-}
-
-
-
-
-
-static gchar * test_blank ()
-{
- GeglBuffer *buffer;
- GeglRectangle rect = {0, 0, 20, 20};
-
- test_start ();
-
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
- print_buffer (buffer);
- gegl_buffer_destroy (buffer);
-
- test_end ();
-}
-
-static gchar * test_gray ()
-{
- GeglBuffer *buffer;
- GeglRectangle rect = {0, 0, 20, 20};
-
- test_start ();
-
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
- fill (buffer, 0.5);
- print_buffer (buffer);
- gegl_buffer_destroy (buffer);
-
- test_end ();
-}
-
-static gchar * test_rectangle ()
-{
- GeglBuffer *buffer;
- GeglRectangle rect = {0, 0, 20, 20};
-
- test_start ();
-
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
- fill (buffer, 0.5);
- rectangle (buffer, 5,5, 10, 10, 0.0);
- print_buffer (buffer);
- gegl_buffer_destroy (buffer);
-
- test_end ();
-}
-
-static gchar * sub_rect_fills_and_gets ()
-{
- GeglBuffer *buffer, *sub1, *sub2, *sub3;
- GeglRectangle subrect1 = {5, 5, 10, 10};
- GeglRectangle subrect2 = {8, 8, 30, 30};
- GeglRectangle subrect3 = {-2, -2, 24, 24};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
- sub1 = gegl_buffer_create_sub_buffer (buffer, &subrect1);
- sub2 = gegl_buffer_create_sub_buffer (buffer, &subrect2);
- sub3 = gegl_buffer_create_sub_buffer (buffer, &subrect3);
-
- fill (sub1, 0.5);
- print ("root with sub1 filled in:\n");
- print_buffer (buffer);
-
- print ("sub2 before fill:\n");
- print_buffer (sub2);
- fill (sub2, 1.0);
- print ("final root:\n");
- print_buffer (buffer);
- print ("final sub1:\n");
- print_buffer (sub1);
- print ("final sub3:\n");
- print_buffer (sub3);
-
- gegl_buffer_destroy (sub1);
- gegl_buffer_destroy (sub2);
- gegl_buffer_destroy (sub3);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-static gchar * sub_sub_fill2 ()
-{
- GeglBuffer *buffer, *sub, *subsub;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle subsubrect = {3, 3, 4, 4};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
- fill (buffer, 0.8);
- sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
-
- fill (sub, 0.5);
-
- subsub = gegl_buffer_create_sub_buffer (sub, &subsubrect);
- fill (subsub, 1.0);
- print_buffer (buffer);
- print_buffer (subsub);
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-static gchar * sub_sub_fill ()
-{
- GeglBuffer *buffer, *sub, *subsub;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle subsubrect = {3, 3, 4, 4};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
- sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
-
- fill (sub, 0.5);
-
- subsub = gegl_buffer_create_sub_buffer (sub, &subsubrect);
- fill (subsub, 1.0);
- print_buffer (buffer);
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-static gchar * test_sample ()
-{
- GeglBuffer *buffer, *sub, *subsub, *subsubsub;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle subsubrect = {3, 3, 14, 14};
- GeglRectangle subsubsubrect = {5, 3, 2, 2};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
-
- vgrad (buffer);
-
- sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
-
- fill (sub, 0.5);
-
- subsub = gegl_buffer_create_sub_buffer (sub, &subsubrect);
- fill (subsub, 1.0);
- subsubsub = gegl_buffer_create_sub_buffer (buffer, &subsubsubrect);
- fill (subsubsub, 1.0);
-
- print_buffer (buffer);
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (subsubsub);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-/* this functionality is not accesible through the normal (non gobject
- * constructor properties based) API
- */
-static gchar * disabled_abyss ()
-{
- GeglBuffer *buffer, *sub, *subsub;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle subsubrect = {3, 3, 4, 4};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
-
- sub = g_object_new (GEGL_TYPE_BUFFER,
- "source", buffer,
- "x", subrect.x,
- "y", subrect.y,
- "width", subrect.width,
- "height", subrect.height,
- "abyss-width", -1,
- "abyss-height", -1,
- NULL);
- fill (sub, 0.5);
- subsub = g_object_new (GEGL_TYPE_BUFFER,
- "source", sub,
- "x", subsubrect.x,
- "y", subsubrect.y,
- "width", subsubrect.width,
- "height", subsubrect.height,
- "abyss-width", -1,
- "abyss-height", -1,
- NULL);
-
- fill (subsub, 1.0);
- print_buffer (buffer);
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-static gchar * buffer_inherit_parent_extent ()
-{
- GeglBuffer *buffer, *sub, *subsub;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle subsubrect = {0, 0, -1, -1};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
-
- sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
- fill (sub, 0.5);
- subsub = gegl_buffer_create_sub_buffer (sub, &subsubrect);
- fill (subsub, 1.0);
- print_buffer (buffer);
-
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-static gchar * buffer_shift_vertical ()
-{
- GeglBuffer *buffer, *sub, *subsub;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
-
- sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
- fill (sub, 0.5);
- subsub = g_object_new (GEGL_TYPE_BUFFER,
- "source", sub,
- "x", 5,
- "y", 5,
- "width", 4,
- "height", 4,
- "shift-y", 5,
- "shift-x", 0,
- NULL);
-
- fill (subsub, 1.0);
- print_buffer (buffer);
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-static gchar * buffer_shift_horizontal ()
-{
- GeglBuffer *buffer, *sub, *subsub;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
-
- sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
- fill (sub, 0.5);
- subsub = g_object_new (GEGL_TYPE_BUFFER,
- "source", sub,
- "x", 5,
- "y", 5,
- "width", 6,
- "height", 6,
- "shift-x", 8,
- NULL);
-
- fill (subsub, 1.0);
- print_buffer (buffer);
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-static gchar * buffer_shift_diagonal ()
-{
- GeglBuffer *buffer, *sub, *subsub;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
-
- sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
- fill (sub, 0.5);
- subsub = g_object_new (GEGL_TYPE_BUFFER,
- "source", sub,
- "x", 3,
- "y", 3,
- "width", 4,
- "height", 4,
- "shift-x", 6,
- "shift-y", 6,
- NULL);
-
- fill (subsub, 0.2);
- print_buffer (buffer);
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-static gchar * get_shifted ()
-{
- GeglBuffer *buffer, *sub, *subsub, *foo;
- GeglRectangle subrect = {5, 5, 10, 10};
- GeglRectangle foor = {0, 0, 10, 10};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
-
- sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
- vgrad (buffer);
- vgrad (sub);
- subsub = g_object_new (GEGL_TYPE_BUFFER,
- "source", sub,
- "x", 0,
- "y", 0,
- "width", 40,
- "height", 40,
- "shift-x", 0,
- "shift-y", 0,
- NULL);
- foo = gegl_buffer_create_sub_buffer (subsub, &foor);
-
- /*fill (subsub, 0.2);*/
- print_buffer (buffer);
- print_buffer (foo);
- gegl_buffer_destroy (sub);
- gegl_buffer_destroy (subsub);
- gegl_buffer_destroy (buffer);
- gegl_buffer_destroy (foo);
- test_end ();
-}
-
-
-static gchar * test_gegl_buffer_copy_self ()
-{
- GeglBuffer *buffer;
- GeglRectangle source = {2, 2, 2, 2};
- GeglRectangle dest = {15, 15, 1, 1};
- GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
-
- vgrad (buffer);
- gegl_buffer_copy (buffer, &source, buffer, &dest); /* copying to self */
- print_buffer (buffer);
- gegl_buffer_destroy (buffer);
- test_end ();
-}
-
-
-static gchar * test_gegl_buffer_copy ()
-{
- GeglBuffer *buffer, *buffer2;
- GeglRectangle bound = {0, 0, 20, 20};
- GeglRectangle source = {2, 2, 5, 5};
- GeglRectangle dest = {10, 10, 0, 0};
- test_start ();
- buffer = gegl_buffer_new (&bound, babl_format ("Y float"));
- buffer2 = gegl_buffer_new (&bound, babl_format ("Y float"));
-
- vgrad (buffer);
- gegl_buffer_copy (buffer, &source, buffer2, &dest); /* copying to self */
- print_buffer (buffer2);
- gegl_buffer_destroy (buffer);
- gegl_buffer_destroy (buffer2);
- test_end ();
-}
-
-static gchar * test_gegl_buffer_duplicate ()
-{
- GeglBuffer *buffer, *buffer2;
- GeglRectangle bound = {0, 0, 20, 20};
- test_start ();
- buffer = gegl_buffer_new (&bound, babl_format ("Y float"));
-
- vgrad (buffer);
- buffer2 = gegl_buffer_dup (buffer);
- print_buffer (buffer2);
- gegl_buffer_destroy (buffer);
- gegl_buffer_destroy (buffer2);
- test_end ();
-}
+/***********************************************************************/
/**************************************************************************/
static void
@@ -535,7 +78,7 @@
gint height,
gfloat *buf)
{
- gchar *scale[]={" ", "â", "â", "â", "â"};
+ gchar *scale[]={" ", "â", "â", "â", "â", "â"};
gint x,y;
print ("â");
for (x=0;x<width;x++)
@@ -545,7 +88,14 @@
{
print ("â");
for (x=0;x<width;x++)
- print ("%s", scale[ (gint)floor ( buf[y*width+x] * 4 + 0.5)]);
+ {
+ gint val = floor ( buf[y*width+x] * 4 + 0.5);
+ if (val>4)
+ val=4;
+ if (val<0)
+ val=0;
+ print ("%s", scale[val]);
+ }
print ("â\n");
}
print ("â");
@@ -697,6 +247,24 @@
g_free (buf);
}
+static void fill_rect (GeglBuffer *buffer,
+ const GeglRectangle *roi,
+ gfloat value
+ )
+{
+ GeglBufferIterator *gi;
+ gi = gegl_buffer_iterator_new (buffer, roi, NULL, GEGL_BUFFER_WRITE);
+ while (gegl_buffer_iterator_next (gi))
+ {
+ gfloat *buf = gi->data[0];
+ gint i;
+ for (i=0; i<gi->length; i++)
+ {
+ buf[i]=value;
+ }
+ }
+}
+
void rectangle (GeglBuffer *buffer,
gint x,
gint y,
@@ -744,8 +312,8 @@
else
{
gchar output_file[1024];
- ret=tests[i]();
printf ("%s ", test_names[i]);
+ ret=tests[i]();
sprintf (output_file, "output/%s", test_names[i]);
g_file_set_contents (output_file, ret, -1, NULL);
}
Modified: branches/branch_zhangjb/tools/create-reference.rb
==============================================================================
--- branches/branch_zhangjb/tools/create-reference.rb (original)
+++ branches/branch_zhangjb/tools/create-reference.rb Thu Jun 19 02:52:46 2008
@@ -507,7 +507,7 @@
<ul>
<li><a href='index.html' style='padding-top: 0.5em;'>GEGL</a></li>
<li><a href='index.html#Documentation' style='padding-top: 0.5em;'>Documentation</a></li>
- <li><a href='index.html#Glossary'> Glossary</a></li>
+ <li><a href='index.html#_glossary'> Glossary</a></li>
<li><a href='operations.html'> Operations</a></li>
"
Modified: branches/branch_zhangjb/tools/operation_reference.c
==============================================================================
--- branches/branch_zhangjb/tools/operation_reference.c (original)
+++ branches/branch_zhangjb/tools/operation_reference.c Thu Jun 19 02:52:46 2008
@@ -55,6 +55,9 @@
return operations;
}
+GeglColor *
+gegl_param_spec_color_get_default (GParamSpec *self);
+
static void
list_properties (GType type,
@@ -94,14 +97,104 @@
type_name = strstr (type_name, "Param");
type_name+=5;
- g_print("<tr><td colspan='1'> </td><td colspan='1' class='prop_type' valign='top'>%s</td><td class='prop_name' valign='top'>%s</td>\n",
- type_name,
+
+ g_print("<tr><td colspan='1'> </td><td colspan='1' class='prop_type' valign='top'>%s<br/><span style='font-style:normal;text-align:right;float:right;padding-right:1em;'>", type_name);
+
+ if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_DOUBLE))
+ {
+
+ g_print ("%2.2f", G_PARAM_SPEC_DOUBLE (self[prop_no])->default_value);
+
+ {
+ gdouble min = G_PARAM_SPEC_DOUBLE (self[prop_no])->minimum;
+ gdouble max = G_PARAM_SPEC_DOUBLE (self[prop_no])->maximum;
+ g_print ("<br/>");
+ if (min<-10000000)
+ g_print ("-inf ");
+ else
+ g_print ("%2.2f", min);
+
+ g_print ("-");
+
+ if (max>10000000)
+ g_print (" +inf");
+ else
+ g_print ("%2.2f", max);
+ }
+
+ }
+ else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_INT))
+ {
+ g_print ("%i", G_PARAM_SPEC_INT (self[prop_no])->default_value);
+
+ {
+ gint min = G_PARAM_SPEC_INT (self[prop_no])->minimum;
+ gint max = G_PARAM_SPEC_INT (self[prop_no])->maximum;
+ g_print ("<br/>");
+ if (min<-10000000)
+ g_print ("-inf ");
+ else
+ g_print ("%i", min);
+
+ g_print ("-");
+
+ if (max>10000000)
+ g_print (" +inf");
+ else
+ g_print ("%i", max);
+ }
+
+ }
+ else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_FLOAT))
+ {
+ g_print ("%2.2f", G_PARAM_SPEC_FLOAT (self[prop_no])->default_value);
+ }
+ else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_BOOLEAN))
+ {
+ g_print ("%s", G_PARAM_SPEC_BOOLEAN (self[prop_no])->default_value?"True":"False");
+ }
+ else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), G_TYPE_STRING))
+ {
+ const gchar *string = G_PARAM_SPEC_STRING (self[prop_no])->default_value;
+
+ if (strlen (string) > 8)
+ {
+ gchar copy[16];
+ g_snprintf (copy, 12, "%s..", string);
+ g_print (copy);
+ }
+ else
+ g_print ("%s", string);
+ }
+ else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (self[prop_no]), GEGL_TYPE_COLOR))
+ {
+ GeglColor *color = gegl_param_spec_color_get_default (self[prop_no]);
+ if (color)
+ {
+ gchar *string;
+ g_object_get (color, "string", &string, NULL);
+ g_print ("%s", string);
+ g_free (string);
+ }
+ g_object_unref (color);
+ }
+ else
+ {
+ g_print ("\n");
+ }
+ g_print ("</span></td>");
+
+ g_print("<td class='prop_name' valign='top'>%s</td>\n",
g_param_spec_get_name (self[prop_no]));
+
if (g_param_spec_get_blurb (self[prop_no])[0]!='\0')
- g_print ("<td colspan='1' class='prop_blurb'>%s</td>\n</tr>\n",
+ g_print ("<td colspan='1' valign='top' class='prop_blurb'>%s</td>\n",
g_param_spec_get_blurb (self[prop_no]));
else
- g_print ("<td><em>not documented</em></td>\n</tr>\n");
+ g_print ("<td><em>not documented</em></td>\n\n");
+
+ g_print ("</tr>\n");
+
}
}
if (self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]