gegl r2851 - in trunk: . bin gegl/property-types operations/common operations/external operations/workshop
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2851 - in trunk: . bin gegl/property-types operations/common operations/external operations/workshop
- Date: Fri, 2 Jan 2009 15:15:19 +0000 (UTC)
Author: ok
Date: Fri Jan 2 15:15:19 2009
New Revision: 2851
URL: http://svn.gnome.org/viewvc/gegl?rev=2851&view=rev
Log:
Made GeglColor primarily operate on double arguments, (internals
are still 32bit floating point but not directly exposed).
* gegl/property-types/gegl-color.[ch]:
(gegl_color_get_rgba4f): gets the color to a buffer of 4floats (might
need better name)
(gegl_color_set_rgba), (gegl_color_get_rgba): use doubles.
Updated the following code / operations to reflect the change.
* bin/editor.c: (add_path), (stroke_press_event):
* bin/gegl-node-editor.c: (type_editor_color):
* bin/gegl.c:
* operations/common/checkerboard.c: (process):
* operations/common/color.c: (process):
* operations/external/path.c: (process), (detect):
* operations/external/text.c: (text_layout_text):
* operations/workshop/linear-gradient.c: (process):
* operations/workshop/radial-gradient.c: (process):
Modified:
trunk/ChangeLog
trunk/bin/editor.c
trunk/bin/gegl-node-editor.c
trunk/bin/gegl.c
trunk/gegl/property-types/gegl-color.c
trunk/gegl/property-types/gegl-color.h
trunk/operations/common/checkerboard.c
trunk/operations/common/color.c
trunk/operations/external/path.c
trunk/operations/external/text.c
trunk/operations/workshop/linear-gradient.c
trunk/operations/workshop/radial-gradient.c
Modified: trunk/bin/editor.c
==============================================================================
--- trunk/bin/editor.c (original)
+++ trunk/bin/editor.c Fri Jan 2 15:15:19 2009
@@ -314,7 +314,7 @@
{
GeglColor *color2;
gdouble linewidth;
- gfloat r,g,b,a;
+ gdouble r,g,b,a;
if (self && g_str_equal (gegl_node_get_operation (self), "gegl:path"))
{
@@ -1971,7 +1971,7 @@
{
GeglColor *color2;
gdouble linewidth;
- gfloat r,g,b,a;
+ gdouble r,g,b,a;
if (g_str_equal (gegl_node_get_operation (self), "gegl:path"))
{
Modified: trunk/bin/gegl-node-editor.c
==============================================================================
--- trunk/bin/gegl-node-editor.c (original)
+++ trunk/bin/gegl-node-editor.c Fri Jan 2 15:15:19 2009
@@ -264,7 +264,7 @@
{
GeglColor *color;
GdkColor gdkcolor;
- gfloat r,g,b,a;
+ gdouble r,g,b,a;
gegl_node_get (node, param_spec->name, &color, NULL);
gegl_color_get_rgba (color, &r, &g, &b, &a);
Modified: trunk/bin/gegl.c
==============================================================================
--- trunk/bin/gegl.c (original)
+++ trunk/bin/gegl.c Fri Jan 2 15:15:19 2009
@@ -19,6 +19,7 @@
#include "config.h"
#include <glib.h>
+#include <glib/gprintf.h>
#include <gegl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -48,6 +49,7 @@
#include "editor.h"
#endif
+
#define DEFAULT_COMPOSITION \
"<?xml version='1.0' encoding='UTF-8'?> <gegl> <node operation='gegl:crop'> <params> <param name='x'>0</param> <param name='y'>0</param> <param name='width'>690</param> <param name='height'>670</param> </params> </node> <node operation='gegl:over'> <node operation='gegl:translate'> <params> <param name='x'>14</param> <param name='y'>613</param> </params> </node> <node operation='gegl:opacity'> <params> <param name='value'>0.59999999999999998</param> </params> </node> <node name='text' operation='gegl: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, Hans Petter Jansson, Jan Heller, dmacks netspace org, Sven An
ders, Hubert Figui?re, Sam Hocevar, yahvuu at gmail.com, Nicolas Robidoux, Garry R. Osgood, Shlomi Fish, Jakub Steiner and Tonda Tavalec</param> <param name='font'>Sans</param> <param name='size'>8</param> <param name='color'>rgb(0.0000, 0.0000, 0.0000)</param> <param name='wrap'>628</param> <param name='alignment'>0</param> <param name='width'>622</param> <param name='height'>40</param> </params> </node> </node> <node operation='gegl:over'> <node operation='gegl:translate'> <params> <param name='x'>300</param> <param name='y'>500</param> </params> </node> <node operation='gegl:over'> <node operation='gegl:translate'> <params> <param name='x'>0</param> <param name='y'>0</param> </params> </node> <node operation='gegl:dropshadow'> <params> <param name='opacity'>1.2</param> <param name='x'>0</param> <param name='y'>0</param> <param name='radius'>8</param> </params> </node> <gegl:path d='M0,50 C0,78 24,100 50,100 C77,100 100,78 100,50 C100,45 99,40 98,35 C82,35 66,35 50,35 C42,
35 35,42 35,50 C35,58 42,65 50,65 C56,65 61,61 64,56 C67,51 75,55 73,60 C69,69 60,75 50,75 C36,75 25,64 25,50 C25,36 36,25 50,25 L93,25 C83,9 67,0 49,0 C25,0 0,20 0,50 z' fill='white'/> </node> <node operation='gegl:over'> <node operation='gegl:translate'> <params> <param name='x'>88</param> <param name='y'>0</param> </params> </node> <node operation='gegl:dropshadow'> <params> <param name='opacity'>1.2</param> <param name='x'>0</param> <param name='y'>0</param> <param name='radius'>8</param> </params> </node> <node operation='gegl:path'> <params> <param name='d'>M50,0 C23,0 0,22 0,50 C0,77 22,100 50,100 C68,100 85,90 93,75 L40,75 C35,75 35,65 40,65 L98,65 C100,55 100,45 98,35 L40,35 C35,35 35,25 40,25 L93,25 C84,10 68,0 50,0 z</param> <param name='fill'>rgb(1.0000, 1.0000, 1.0000)</param> </params> </node> </node> <node operation='gegl:over'> <node operation='gegl:translate'> <params> <param name='x'>176</param> <param name='y'>0</param> </params> </node> <node operation='g
egl:dropshadow'> <params> <param name='opacity'>1.2</param> <param name='x'>0</param> <param name='y'>0</param> <param name='radius'>8</param> </params> </node> <node operation='gegl:path'> <params> <param name='d'>M0,50 C0,78 24,100 50,100 C77,100 100,78 100,50 C100,45 99,40 98,35 C82,35 66,35 50,35 C42,35 35,42 35,50 C35,58 42,65 50,65 C56,65 61,61 64,56 C67,51 75,55 73,60 C69,69 60,75 50,75 C36,75 25,64 25,50 C25,36 36,25 50,25 L93,25 C83,9 67,0 49,0 C25,0 0,20 0,50 z</param> <param name='fill'>rgb(1.0000, 1.0000, 1.0000)</param> </params> </node> </node> <node operation='gegl:translate'> <params> <param name='x'>264</param> <param name='y'>0</param> </params> </node> <node operation='gegl:dropshadow'> <params> <param name='opacity'>1.2</param> <param name='x'>0</param> <param name='y'>0</param> <param name='radius'>8</param> </params> </node> <node operation='gegl:path'> <params> <param name='d'>M30,4 C12,13 0,30 0,50 C0,78 23,100 50,100 C71,100 88,88 96,71 L56,71 C42,71
30,59 30,45 L30,4 z</param> <param name='fill'>rgb(1.0000, 1.0000, 1.0000)</param> </params> </node> </node> <node operation='gegl: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'>42</param> </params> </node> <node operation='gegl:checkerboard'> <params> <param name='x'>43</param> <param name='y'>44</param> <param name='x-offset'>0</param> <param name='y-offset'>0</param> <param name='color1'>rgb(0.7097, 0.7097, 0.7097)</param> <param name='color2'>rgb(0.7661, 0.7661, 0.7661)</param> </params> </node> </gegl>"
Modified: trunk/gegl/property-types/gegl-color.c
==============================================================================
--- trunk/gegl/property-types/gegl-color.c (original)
+++ trunk/gegl/property-types/gegl-color.c Fri Jan 2 15:15:19 2009
@@ -250,6 +250,7 @@
return FALSE;
}
+#if 0
const gfloat *
gegl_color_float4 (GeglColor *self)
{
@@ -258,32 +259,29 @@
priv = GEGL_COLOR_GET_PRIVATE (self);
return &priv->rgba_color[0];
}
+#endif
void
-gegl_color_get_rgba (GeglColor *self,
- gfloat *r,
- gfloat *g,
- gfloat *b,
- gfloat *a)
+gegl_color_get_rgba4f (GeglColor *color,
+ gfloat *rgba)
{
GeglColorPrivate *priv;
+ gint i;
- g_return_if_fail (GEGL_IS_COLOR (self));
+ g_return_if_fail (GEGL_IS_COLOR (color));
- priv = GEGL_COLOR_GET_PRIVATE (self);
+ priv = GEGL_COLOR_GET_PRIVATE (color);
- *r = priv->rgba_color[0];
- *g = priv->rgba_color[1];
- *b = priv->rgba_color[2];
- *a = priv->rgba_color[3];
+ for (i=0; i< 4; i++)
+ rgba[i] = priv->rgba_color[i];
}
void
gegl_color_set_rgba (GeglColor *self,
- gfloat r,
- gfloat g,
- gfloat b,
- gfloat a)
+ gdouble r,
+ gdouble g,
+ gdouble b,
+ gdouble a)
{
GeglColorPrivate *priv;
@@ -297,6 +295,25 @@
priv->rgba_color[3] = a;
}
+void
+gegl_color_get_rgba (GeglColor *self,
+ gdouble *r,
+ gdouble *g,
+ gdouble *b,
+ gdouble *a)
+{
+ GeglColorPrivate *priv;
+
+ g_return_if_fail (GEGL_IS_COLOR (self));
+
+ priv = GEGL_COLOR_GET_PRIVATE (self);
+
+ *r = priv->rgba_color[0];
+ *g = priv->rgba_color[1];
+ *b = priv->rgba_color[2];
+ *a = priv->rgba_color[3];
+}
+
static void
gegl_color_set_from_string (GeglColor *self,
const gchar *color_string)
Modified: trunk/gegl/property-types/gegl-color.h
==============================================================================
--- trunk/gegl/property-types/gegl-color.h (original)
+++ trunk/gegl/property-types/gegl-color.h Fri Jan 2 15:15:19 2009
@@ -66,45 +66,46 @@
/**
* gegl_color_get_rgba:
* @color: a #GeglColor
- * @r: red return location.
- * @g: green return location.
- * @b: blue return location.
- * @a: alpha return location.
+ * @red: red return location.
+ * @green: green return location.
+ * @blue: blue return location.
+ * @alpha: alpha return location.
*
* Retrieves the current set color as linear light non premultipled RGBA data,
* any of the return pointers can be omitted.
*/
void gegl_color_get_rgba (GeglColor *color,
- gfloat *r,
- gfloat *g,
- gfloat *b,
- gfloat *a);
+ gdouble *red,
+ gdouble *green,
+ gdouble *blue,
+ gdouble *alpha);
/**
- * gegl_color_set_rgba:
+ * gegl_color_get_rgba4f:
* @color: a #GeglColor
- * @r: red value
- * @g: green value
- * @b: blue value
- * @a: alpha value
+ * @buf: pointer to a buffer for a single "RGBA float" pixel.
*
- * Retrieves the current set color as linear light non premultipled RGBA data
+ * Retrieves the current set color as linear light non premultipled RGBA data,
+ * and stores it at the memory location in @buf
*/
-void gegl_color_set_rgba (GeglColor *color,
- gfloat r,
- gfloat g,
- gfloat b,
- gfloat a);
+void gegl_color_get_rgba4f (GeglColor *color,
+ gfloat *buf);
/**
- * gegl_color_float4:
+ * gegl_color_set_rgba:
* @color: a #GeglColor
+ * @red: red value
+ * @green: green value
+ * @blue: blue value
+ * @alpha: alpha value
*
- * Returns a direct pointer to the internal representation
- * XXX: should probably be removed from the public API.
+ * Retrieves the current set color as linear light non premultipled RGBA data
*/
-const gfloat*gegl_color_float4 (GeglColor *color);
-
+void gegl_color_set_rgba (GeglColor *color,
+ gdouble red,
+ gdouble green,
+ gdouble blue,
+ gdouble alpha);
/***
*/
Modified: trunk/operations/common/checkerboard.c
==============================================================================
--- trunk/operations/common/checkerboard.c (original)
+++ trunk/operations/common/checkerboard.c Fri Jan 2 15:15:19 2009
@@ -67,17 +67,8 @@
gint x = roi->x; /* initial x */
gint y = roi->y; /* and y coordinates */
- gegl_color_get_rgba (o->color1,
- &color1[0],
- &color1[1],
- &color1[2],
- &color1[3]);
-
- gegl_color_get_rgba (o->color2,
- &color2[0],
- &color2[1],
- &color2[2],
- &color2[3]);
+ gegl_color_get_rgba4f (o->color1, color1);
+ gegl_color_get_rgba4f (o->color2, color2);
while (n_pixels--)
{
Modified: trunk/operations/common/color.c
==============================================================================
--- trunk/operations/common/color.c (original)
+++ trunk/operations/common/color.c Fri Jan 2 15:15:19 2009
@@ -53,11 +53,7 @@
gfloat *out_pixel = out_buf;
gfloat color[4];
- gegl_color_get_rgba (o->value,
- &color[0],
- &color[1],
- &color[2],
- &color[3]);
+ gegl_color_get_rgba4f (o->value, color);
while (n_pixels--)
{
Modified: trunk/operations/external/path.c
==============================================================================
--- trunk/operations/external/path.c (original)
+++ trunk/operations/external/path.c Fri Jan 2 15:15:19 2009
@@ -132,7 +132,7 @@
-
+#if 0
static gboolean gegl_path_is_closed (GeglPath *path)
{
const GeglPathItem *knot;
@@ -148,6 +148,7 @@
}
return FALSE;
}
+#endif
#if 0
@@ -181,7 +182,7 @@
if (o->fill_opacity > 0.0001 && o->fill)
{
- gfloat r,g,b,a;
+ gdouble r,g,b,a;
gegl_color_get_rgba (o->fill, &r,&g,&b,&a);
a *= o->fill_opacity;
if (a>0.001)
@@ -294,7 +295,7 @@
{
if (o->d)
{
- gfloat r,g,b,a;
+ gdouble r,g,b,a;
gegl_color_get_rgba (o->fill, &r,&g,&b,&a);
if (a * o->fill_opacity>0.8)
result = cairo_in_fill (cr, x, y);
Modified: trunk/operations/external/text.c
==============================================================================
--- trunk/operations/external/text.c (original)
+++ trunk/operations/external/text.c Fri Jan 2 15:15:19 2009
@@ -123,8 +123,7 @@
attrs = pango_attr_list_new ();
if (attrs)
{
- gegl_color_get_rgba (o->color,
- &color[0], &color[1], &color[2], &color[3]);
+ gegl_color_get_rgba4f (o->color, color);
attr = pango_attr_foreground_new ((guint16) (color[0] * 65535),
(guint16) (color[1] * 65535),
(guint16) (color[2] * 65535));
Modified: trunk/operations/workshop/linear-gradient.c
==============================================================================
--- trunk/operations/workshop/linear-gradient.c (original)
+++ trunk/operations/workshop/linear-gradient.c Fri Jan 2 15:15:19 2009
@@ -70,16 +70,8 @@
gfloat length = dist (o->x1, o->y1, o->x2, o->y2);
- gegl_color_get_rgba (o->color1,
- &color1[0],
- &color1[1],
- &color1[2],
- &color1[3]);
- gegl_color_get_rgba (o->color2,
- &color2[0],
- &color2[1],
- &color2[2],
- &color2[3]);
+ gegl_color_get_rgba4f (o->color1, color1);
+ gegl_color_get_rgba4f (o->color2, color2);
x= roi->x;
Modified: trunk/operations/workshop/radial-gradient.c
==============================================================================
--- trunk/operations/workshop/radial-gradient.c (original)
+++ trunk/operations/workshop/radial-gradient.c Fri Jan 2 15:15:19 2009
@@ -68,17 +68,8 @@
gint x, y;
gfloat length = dist (o->x1, o->y1, o->x2, o->y2);
- gegl_color_get_rgba (o->color1,
- &color1[0],
- &color1[1],
- &color1[2],
- &color1[3]);
- gegl_color_get_rgba (o->color2,
- &color2[0],
- &color2[1],
- &color2[2],
- &color2[3]);
-
+ gegl_color_get_rgba4f (o->color1, color1);
+ gegl_color_get_rgba4f (o->color2, color2);
x= roi->x;
y= roi->y;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]