Commit d6766de5 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

updated status

2001-01-12  Sven Neumann  <sven@gimp.org>

	* TODO.xml: updated status

	* app/gimpcontext.c: added temporary functions to make it compile

	* app/pixel_processor.c: include tile.h when ENABLE_MP is defined

	* libgimp/gimpcolor.[ch]: added more GimpRGB functions

	* plug-ins/common/aa.c: merged fix from gimp-1-2

	* plug-ins/common/colorify.c
	* plug-ins/common/colortoalpha.c
	* plug-ins/common/exchange.c
	* plug-ins/common/film.c
	* plug-ins/common/grid.c: use GimpRGB whereever possible.
	Still work in progress.
parent 9ae4f01b
2001-01-12 Sven Neumann <sven@gimp.org>
* TODO.xml: updated status
* app/gimpcontext.c: added temporary functions to make it compile
* app/pixel_processor.c: include tile.h when ENABLE_MP is defined
* libgimp/gimpcolor.[ch]: added more GimpRGB functions
* plug-ins/common/aa.c: merged fix from gimp-1-2
* plug-ins/common/colorify.c
* plug-ins/common/colortoalpha.c
* plug-ins/common/exchange.c
* plug-ins/common/film.c
* plug-ins/common/grid.c: use GimpRGB whereever possible.
Still work in progress.
2001-01-11 Sven Neumann <sven@gimp.org> 2001-01-11 Sven Neumann <sven@gimp.org>
* libgimp/gimpcolorarea.c: added antialiasing * libgimp/gimpcolorarea.c: added antialiasing
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</entry> </entry>
<entry size="medium" difficulty="medium" status="20%" target="1.4"> <entry size="medium" difficulty="medium" status="20%" target="1.4">
<title>Unify Color data types</title> <title>Unify color data types</title>
<description> <description>
<p> <p>
LibGimp already has a new type GimpRGB. This should be used LibGimp already has a new type GimpRGB. This should be used
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<section> <section>
<title>Objectification</title> <title>Objectification</title>
<entry size="small" difficulty="easy" status="0%" target="1.4"> <entry size="small" difficulty="easy" status="80%" target="1.4">
<title>Generic GimpObject</title> <title>Generic GimpObject</title>
<description> <description>
<p> <p>
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
</contact> </contact>
</entry> </entry>
<entry size="medium" difficulty="medium" status="0%" target="1.4"> <entry size="medium" difficulty="medium" status="10%" target="1.4">
<title>Cleanup existing internal objects</title> <title>Cleanup existing internal objects</title>
<description> <description>
<p> <p>
......
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
#include "pixel_region.h" #include "pixel_region.h"
#include "gimprc.h" #include "gimprc.h"
#ifdef ENABLE_MP
#include "tile.h"
#endif
typedef void (* p1_func) (gpointer , typedef void (* p1_func) (gpointer ,
PixelRegion *); PixelRegion *);
......
...@@ -1076,14 +1076,6 @@ gimp_context_get_foreground (GimpContext *context, ...@@ -1076,14 +1076,6 @@ gimp_context_get_foreground (GimpContext *context,
*b = context->foreground[2]; *b = context->foreground[2];
} }
void
gimp_palette_get_foreground (guchar *r,
guchar *g,
guchar *b)
{
gimp_context_get_foreground (NULL, r, g, b);
}
void void
gimp_context_set_foreground (GimpContext *context, gimp_context_set_foreground (GimpContext *context,
gint r, gint r,
...@@ -1155,14 +1147,6 @@ gimp_context_get_background (GimpContext *context, ...@@ -1155,14 +1147,6 @@ gimp_context_get_background (GimpContext *context,
*b = context->background[2]; *b = context->background[2];
} }
void
gimp_palette_get_background (guchar *r,
guchar *g,
guchar *b)
{
gimp_context_get_background (NULL, r, g, b);
}
void void
gimp_context_set_background (GimpContext *context, gimp_context_set_background (GimpContext *context,
gint r, gint r,
...@@ -1777,8 +1761,42 @@ gimp_context_update_gradient (GimpContext *context, ...@@ -1777,8 +1761,42 @@ gimp_context_update_gradient (GimpContext *context,
} }
} }
/* Temporary functions */
void void
gimp_context_update_gradients (gradient_t *gradient) gimp_context_update_gradients (gradient_t *gradient)
{ {
g_slist_foreach (context_list, (GFunc) gimp_context_update_gradient, gradient); g_slist_foreach (context_list, (GFunc) gimp_context_update_gradient, gradient);
} }
void
gimp_palette_get_foreground (guchar *r,
guchar *g,
guchar *b)
{
gimp_context_get_foreground (NULL, r, g, b);
}
void
gimp_palette_set_foreground (guchar r,
guchar g,
guchar b)
{
gimp_context_set_foreground (NULL, r, g, b);
}
void
gimp_palette_get_background (guchar *r,
guchar *g,
guchar *b)
{
gimp_context_get_background (NULL, r, g, b);
}
void
gimp_palette_set_background (guchar r,
guchar g,
guchar b)
{
gimp_context_set_background (NULL, r, g, b);
}
...@@ -1076,14 +1076,6 @@ gimp_context_get_foreground (GimpContext *context, ...@@ -1076,14 +1076,6 @@ gimp_context_get_foreground (GimpContext *context,
*b = context->foreground[2]; *b = context->foreground[2];
} }
void
gimp_palette_get_foreground (guchar *r,
guchar *g,
guchar *b)
{
gimp_context_get_foreground (NULL, r, g, b);
}
void void
gimp_context_set_foreground (GimpContext *context, gimp_context_set_foreground (GimpContext *context,
gint r, gint r,
...@@ -1155,14 +1147,6 @@ gimp_context_get_background (GimpContext *context, ...@@ -1155,14 +1147,6 @@ gimp_context_get_background (GimpContext *context,
*b = context->background[2]; *b = context->background[2];
} }
void
gimp_palette_get_background (guchar *r,
guchar *g,
guchar *b)
{
gimp_context_get_background (NULL, r, g, b);
}
void void
gimp_context_set_background (GimpContext *context, gimp_context_set_background (GimpContext *context,
gint r, gint r,
...@@ -1777,8 +1761,42 @@ gimp_context_update_gradient (GimpContext *context, ...@@ -1777,8 +1761,42 @@ gimp_context_update_gradient (GimpContext *context,
} }
} }
/* Temporary functions */
void void
gimp_context_update_gradients (gradient_t *gradient) gimp_context_update_gradients (gradient_t *gradient)
{ {
g_slist_foreach (context_list, (GFunc) gimp_context_update_gradient, gradient); g_slist_foreach (context_list, (GFunc) gimp_context_update_gradient, gradient);
} }
void
gimp_palette_get_foreground (guchar *r,
guchar *g,
guchar *b)
{
gimp_context_get_foreground (NULL, r, g, b);
}
void
gimp_palette_set_foreground (guchar r,
guchar g,
guchar b)
{
gimp_context_set_foreground (NULL, r, g, b);
}
void
gimp_palette_get_background (guchar *r,
guchar *g,
guchar *b)
{
gimp_context_get_background (NULL, r, g, b);
}
void
gimp_palette_set_background (guchar r,
guchar g,
guchar b)
{
gimp_context_set_background (NULL, r, g, b);
}
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
#include "pixel_region.h" #include "pixel_region.h"
#include "gimprc.h" #include "gimprc.h"
#ifdef ENABLE_MP
#include "tile.h"
#endif
typedef void (* p1_func) (gpointer , typedef void (* p1_func) (gpointer ,
PixelRegion *); PixelRegion *);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <glib.h> #include <glib.h>
#include "gimpcolor.h" #include "gimpcolor.h"
#include "gimpcolorspace.h"
#include "gimpmath.h" #include "gimpmath.h"
...@@ -45,6 +46,32 @@ gimp_rgb_set (GimpRGB *rgb, ...@@ -45,6 +46,32 @@ gimp_rgb_set (GimpRGB *rgb,
rgb->b = b; rgb->b = b;
} }
void
gimp_rgb_set_uchar (GimpRGB *rgb,
guchar r,
guchar g,
guchar b)
{
g_return_if_fail (rgb != NULL);
rgb->r = (gdouble) r / 255.0;
rgb->g = (gdouble) g / 255.0;
rgb->b = (gdouble) b / 255.0;
}
void
gimp_rgb_get_uchar (const GimpRGB *rgb,
guchar *r,
guchar *g,
guchar *b)
{
g_return_if_fail (rgb != NULL);
if (r) *r = rgb->r * 255.999;
if (g) *g = rgb->g * 255.999;
if (b) *b = rgb->b * 255.999;
}
void void
gimp_rgb_add (GimpRGB *rgb1, gimp_rgb_add (GimpRGB *rgb1,
const GimpRGB *rgb2) const GimpRGB *rgb2)
...@@ -136,6 +163,15 @@ gimp_rgb_gamma (GimpRGB *rgb, ...@@ -136,6 +163,15 @@ gimp_rgb_gamma (GimpRGB *rgb,
rgb->b = pow (rgb->b, ig); rgb->b = pow (rgb->b, ig);
} }
gdouble
gimp_rgb_intensity (const GimpRGB *rgb)
{
g_return_val_if_fail (rgb != NULL, 0.0);
return (INTENSITY_RED * rgb->r +
INTENSITY_GREEN * rgb->g +
INTENSITY_BLUE * rgb->b);
}
/* RGBA functions */ /* RGBA functions */
...@@ -154,6 +190,36 @@ gimp_rgba_set (GimpRGB *rgba, ...@@ -154,6 +190,36 @@ gimp_rgba_set (GimpRGB *rgba,
rgba->a = a; rgba->a = a;
} }
void
gimp_rgba_set_uchar (GimpRGB *rgba,
guchar r,
guchar g,
guchar b,
guchar a)
{
g_return_if_fail (rgba != NULL);
rgba->r = (gdouble) r / 255.0;
rgba->g = (gdouble) g / 255.0;
rgba->b = (gdouble) b / 255.0;
rgba->a = (gdouble) a / 255.0;
}
void
gimp_rgba_get_uchar (const GimpRGB *rgba,
guchar *r,
guchar *g,
guchar *b,
guchar *a)
{
g_return_if_fail (rgba != NULL);
if (r) *r = rgba->r * 255.999;
if (g) *g = rgba->g * 255.999;
if (b) *b = rgba->b * 255.999;
if (a) *a = rgba->a * 255.999;
}
void void
gimp_rgba_add (GimpRGB *rgba1, gimp_rgba_add (GimpRGB *rgba1,
const GimpRGB *rgba2) const GimpRGB *rgba2)
...@@ -250,3 +316,35 @@ gimp_rgba_gamma (GimpRGB *rgba, ...@@ -250,3 +316,35 @@ gimp_rgba_gamma (GimpRGB *rgba,
rgba->b = pow (rgba->b, ig); rgba->b = pow (rgba->b, ig);
rgba->a = pow (rgba->a, ig); rgba->a = pow (rgba->a, ig);
} }
/* These functions will become the default one day */
gboolean
gimp_palette_set_foreground_rgb (const GimpRGB *rgb)
{
guchar r, g, b;
g_return_val_if_fail (rgb != NULL, FALSE);
gimp_rgb_get_uchar (rgb, &r, &g, &b);
return gimp_palette_set_foreground (r, g, b);
}
gboolean
gimp_palette_get_foreground_rgb (GimpRGB *rgb)
{
guchar r, g, b;
g_return_val_if_fail (rgb != NULL, FALSE);
if (gimp_palette_get_foreground (&r, &g, &b))
{
gimp_rgb_set_uchar (rgb, r, g, b);
return TRUE;
}
return FALSE;
}
...@@ -37,45 +37,70 @@ struct _GimpRGB ...@@ -37,45 +37,70 @@ struct _GimpRGB
}; };
void gimp_rgb_set (GimpRGB *rgb, void gimp_rgb_set (GimpRGB *rgb,
gdouble r, gdouble r,
gdouble g, gdouble g,
gdouble b); gdouble b);
void gimp_rgb_set_uchar (GimpRGB *rgb,
void gimp_rgb_add (GimpRGB *rgb1, guchar r,
const GimpRGB *rgb2); guchar g,
void gimp_rgb_subtract (GimpRGB *rgb1, guchar b);
const GimpRGB *rgb2); void gimp_rgb_get_uchar (const GimpRGB *rgb,
void gimp_rgb_multiply (GimpRGB *rgb1, guchar *r,
gdouble factor); guchar *g,
gdouble gimp_rgb_distance (const GimpRGB *rgb1, guchar *b);
const GimpRGB *rgb2);
gdouble gimp_rgb_max (const GimpRGB *rgb); void gimp_rgb_add (GimpRGB *rgb1,
gdouble gimp_rgb_min (const GimpRGB *rgb); const GimpRGB *rgb2);
void gimp_rgb_clamp (GimpRGB *rgb); void gimp_rgb_subtract (GimpRGB *rgb1,
void gimp_rgb_gamma (GimpRGB *rgb, const GimpRGB *rgb2);
gdouble gamma); void gimp_rgb_multiply (GimpRGB *rgb1,
gdouble factor);
gdouble gimp_rgb_distance (const GimpRGB *rgb1,
void gimp_rgba_set (GimpRGB *rgba, const GimpRGB *rgb2);
gdouble r, gdouble gimp_rgb_max (const GimpRGB *rgb);
gdouble g, gdouble gimp_rgb_min (const GimpRGB *rgb);
gdouble b, void gimp_rgb_clamp (GimpRGB *rgb);
gdouble a); void gimp_rgb_gamma (GimpRGB *rgb,
gdouble gamma);
void gimp_rgba_add (GimpRGB *rgba1, gdouble gimp_rgb_intensity (const GimpRGB *rgb);
const GimpRGB *rgba2);
void gimp_rgba_subtract (GimpRGB *rgba1,
const GimpRGB *rgba2); void gimp_rgba_set (GimpRGB *rgba,
void gimp_rgba_multiply (GimpRGB *rgba, gdouble r,
gdouble factor); gdouble g,
gdouble gimp_rgba_distance (const GimpRGB *rgba1, gdouble b,
const GimpRGB *rgba2); gdouble a);
gdouble gimp_rgba_max (const GimpRGB *rgba); void gimp_rgba_set_uchar (GimpRGB *rgba,
gdouble gimp_rgba_min (const GimpRGB *rgba); guchar r,
void gimp_rgba_clamp (GimpRGB *rgba); guchar g,
void gimp_rgba_gamma (GimpRGB *rgba, guchar b,
gdouble gamma); guchar a);
void gimp_rgba_get_uchar (const GimpRGB *rgba,
guchar *r,
guchar *g,
guchar *b,
guchar *a);
void gimp_rgba_add (GimpRGB *rgba1,
const GimpRGB *rgba2);
void gimp_rgba_subtract (GimpRGB *rgba1,
const GimpRGB *rgba2);
void gimp_rgba_multiply (GimpRGB *rgba,
gdouble factor);
gdouble gimp_rgba_distance (const GimpRGB *rgba1,
const GimpRGB *rgba2);
gdouble gimp_rgba_max (const GimpRGB *rgba);
gdouble gimp_rgba_min (const GimpRGB *rgba);
void gimp_rgba_clamp (GimpRGB *rgba);
void gimp_rgba_gamma (GimpRGB *rgba,
gdouble gamma);
/* These will become the default one day */
gboolean gimp_palette_set_foreground_rgb (const GimpRGB *rgb);
gboolean gimp_palette_get_foreground_rgb (GimpRGB *rgb);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -94,7 +94,7 @@ query (void) ...@@ -94,7 +94,7 @@ query (void)
save_args, NULL); save_args, NULL);
gimp_register_save_handler ("file_aa_save", gimp_register_save_handler ("file_aa_save",
"ansi,txt,text,html", "ansi,txt,text",
""); "");
} }
......
...@@ -48,33 +48,31 @@ ...@@ -48,33 +48,31 @@
#define COLOR_SIZE 30 #define COLOR_SIZE 30
static void query (void); static void query (void);
static void run (gchar *name, static void run (gchar *name,
gint nparams, gint nparams,
GimpParam *param, GimpParam *param,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals); GimpParam **return_vals);
static void colorify (GimpDrawable *drawable); static void colorify (GimpDrawable *drawable);
static void colorify_row (guchar *row, static void colorify_row (guchar *row,
gint width, gint width,
gint bpp); gint bpp);
static gint colorify_dialog (guchar red, static gboolean colorify_dialog (GimpRGB *color);
guchar green, static void colorify_ok_callback (GtkWidget *widget,
guchar blue); gpointer data);
static void colorify_ok_callback (GtkWidget *widget, static void predefined_color_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void predefined_color_callback (GtkWidget *widget,
gpointer data);
typedef struct typedef struct
{ {
guchar color[3]; GimpRGB color;
} ColorifyVals; } ColorifyVals;
typedef struct typedef struct
{ {
gint run; gboolean run;
} ColorifyInterface; } ColorifyInterface;
static ColorifyInterface cint = static ColorifyInterface cint =
...@@ -84,7 +82,7 @@ static ColorifyInterface cint = ...@@ -84,7 +82,7 @@ static ColorifyInterface cint =
static ColorifyVals cvals = static ColorifyVals cvals =
{ {
{ 255, 255, 255 } { 1.0, 1.0, 1.0, 1.0 }
}; };
static GimpRGB button_color[] = static GimpRGB button_color[] =
...@@ -147,16 +145,16 @@ query (void) ...@@ -147,16 +145,16 @@ query (void)
} }
static void static void
run (gchar *name, run (gchar *name,
gint nparams, gint nparams,
GimpParam *param,