gegl r2439 - in trunk: . examples gegl/property-types
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2439 - in trunk: . examples gegl/property-types
- Date: Sat, 14 Jun 2008 11:20:15 +0000 (UTC)
Author: ok
Date: Sat Jun 14 11:20:15 2008
New Revision: 2439
URL: http://svn.gnome.org/viewvc/gegl?rev=2439&view=rev
Log:
* examples/gegl-paint.c: (paint_press), (main): modified the default
stroke to be thicker, and black.
* gegl/property-types/gegl-vector.c: (gegl_vector_stamp): fixed
rendering by swapping the x/y coordinates (actually the loops) in the
brush rendering/compositing code.
Modified:
trunk/ChangeLog
trunk/examples/gegl-paint.c
trunk/gegl/property-types/gegl-vector.c
Modified: trunk/examples/gegl-paint.c
==============================================================================
--- trunk/examples/gegl-paint.c (original)
+++ trunk/examples/gegl-paint.c Sat Jun 14 11:20:15 2008
@@ -24,8 +24,9 @@
#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;
@@ -51,7 +52,7 @@
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);
@@ -144,7 +145,7 @@
buffer = gegl_buffer_new (&(GeglRectangle){0,0,512,512},
babl_format("RGBA float"));
buf = g_malloc(512*512);
- memset (buf, 255, 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);
}
@@ -153,9 +154,8 @@
gegl = gegl_node_new ();
-
{
- GeglNode *loadbuf = gegl_node_new_child (gegl, "operation", "load-buffer", "buffer", buffer, 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);
Modified: trunk/gegl/property-types/gegl-vector.c
==============================================================================
--- trunk/gegl/property-types/gegl-vector.c (original)
+++ trunk/gegl/property-types/gegl-vector.c Sat Jun 14 11:20:15 2008
@@ -606,14 +606,15 @@
ceil (x+radius) - floor (x-radius),
ceil (y+radius) - floor (y-radius)};
- GeglRectangle foo;
+ 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 (!gegl_rectangle_intersect (&foo, &roi, gegl_buffer_get_extent (buffer)))
- return;
-
if (s.buf == NULL ||
s.radius != radius)
{
@@ -637,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];
@@ -657,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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]