Commit 3343baa8 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

added utility functions to send GimpRGB values over the wire.

2006-02-23  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpwire.[ch]: added utility functions to send
	GimpRGB values over the wire.

	* libgimpbase/gimpprotocol.c: use the functions.
parent b3c3846e
2006-02-23 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpwire.[ch]: added utility functions to send
GimpRGB values over the wire.
* libgimpbase/gimpprotocol.c: use the functions.
2006-02-22 Simon Budig <simon@gimp.org>
* app/vectors/gimpvectors-import.c: fix the import of svg circles.
......
......@@ -1396,21 +1396,9 @@ _gp_params_read (GIOChannel *channel,
break;
case GIMP_PDB_COLOR:
if (! _gimp_wire_read_double (channel,
&(*params)[i].data.d_color.r, 1,
user_data))
goto cleanup;
if (! _gimp_wire_read_double (channel,
&(*params)[i].data.d_color.g, 1,
user_data))
goto cleanup;
if (! _gimp_wire_read_double (channel,
&(*params)[i].data.d_color.b, 1,
user_data))
goto cleanup;
if (! _gimp_wire_read_double (channel,
&(*params)[i].data.d_color.a, 1,
user_data))
if (! _gimp_wire_read_color (channel,
&(*params)[i].data.d_color, 1,
user_data))
goto cleanup;
break;
......@@ -1626,18 +1614,9 @@ _gp_params_write (GIOChannel *channel,
break;
case GIMP_PDB_COLOR:
{
GimpRGB *color = (GimpRGB *) &params[i].data.d_color;
if (! _gimp_wire_write_double (channel, &color->r, 1, user_data))
return;
if (! _gimp_wire_write_double (channel, &color->g, 1, user_data))
return;
if (! _gimp_wire_write_double (channel, &color->b, 1, user_data))
return;
if (! _gimp_wire_write_double (channel, &color->a, 1, user_data))
return;
}
if (! _gimp_wire_write_color (channel,
&params[i].data.d_color, 1, user_data))
return;
break;
case GIMP_PDB_REGION:
......
......@@ -23,6 +23,8 @@
#include <glib.h>
#include <libgimpcolor/gimpcolortypes.h>
#include "gimpwire.h"
......@@ -428,6 +430,18 @@ _gimp_wire_read_string (GIOChannel *channel,
return TRUE;
}
gboolean
_gimp_wire_read_color (GIOChannel *channel,
GimpRGB *data,
gint count,
gpointer user_data)
{
g_return_val_if_fail (count >= 0, FALSE);
return _gimp_wire_read_double (channel,
(gdouble *) data, 4 * count, user_data);
}
gboolean
_gimp_wire_write_int32 (GIOChannel *channel,
const guint32 *data,
......@@ -570,6 +584,18 @@ _gimp_wire_write_string (GIOChannel *channel,
return TRUE;
}
gboolean
_gimp_wire_write_color (GIOChannel *channel,
const GimpRGB *data,
gint count,
gpointer user_data)
{
g_return_val_if_fail (count >= 0, FALSE);
return _gimp_wire_write_double (channel,
(gdouble *) data, 4 * count, user_data);
}
static guint
gimp_wire_hash (const guint32 *key)
{
......
......@@ -101,6 +101,10 @@ gboolean _gimp_wire_read_string (GIOChannel *channel,
gchar **data,
gint count,
gpointer user_data) G_GNUC_INTERNAL;
gboolean _gimp_wire_read_color (GIOChannel *channel,
GimpRGB *data,
gint count,
gpointer user_data) G_GNUC_INTERNAL;
gboolean _gimp_wire_write_int32 (GIOChannel *channel,
const guint32 *data,
gint count,
......@@ -121,6 +125,10 @@ gboolean _gimp_wire_write_string (GIOChannel *channel,
gchar **data,
gint count,
gpointer user_data) G_GNUC_INTERNAL;
gboolean _gimp_wire_write_color (GIOChannel *channel,
const GimpRGB *data,
gint count,
gpointer user_data) G_GNUC_INTERNAL;
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment