deprecated RGB intensity functions and definitions. These coefficients do

2005-08-03  Sven Neumann  <sven@gimp.org>

	* libgimpcolor/gimprgb.[ch]: deprecated RGB intensity functions
	and definitions. These coefficients do not accurately compute
	luminance for contemporary monitors. Instead the coefficients from
	the sRGB spec should be used which have now been added.

	* libgimpcolor/gimpcolor.def: updated.

	* libgimp/gimpdrawable.c
	* libgimp/gimppixelfetcher.c
	* app/base/colorize.c
	* app/base/levels.c
	* app/base/temp-buf.c
	* app/core/gimpdrawable-blend.c
	* app/core/gimpdrawable-convert.c
	* app/core/gimpdrawable-desaturate.c
	* app/core/gimpimage-convert.c
	* app/core/gimpimage.c
	* app/gui/splash.c
	* app/widgets/gimpgradienteditor.c
	* modules/colorsel_triangle.c
	* plug-ins/common/aa.c
	* plug-ins/common/bumpmap.c
	* plug-ins/common/colorify.c
	* plug-ins/common/despeckle.c
	* plug-ins/common/displace.c
	* plug-ins/common/engrave.c
	* plug-ins/common/gradmap.c
	* plug-ins/common/grid.c
	* plug-ins/common/mng.c
	* plug-ins/common/newsprint.c
	* plug-ins/common/png.c
	* plug-ins/common/whirlpinch.c
	* plug-ins/gflare/gflare.c
	* plug-ins/gfli/gfli.c
	* plug-ins/maze/handy.c
	* plug-ins/pagecurl/pagecurl.c: use gimp_rgb_luminance() and
	friends instead of the deprecated intensity functions.
This commit is contained in:
Sven Neumann 2005-08-03 00:36:41 +00:00 committed by Sven Neumann
parent 79d2bb6a1e
commit 4f870bc132
39 changed files with 321 additions and 113 deletions

View File

@ -1,3 +1,43 @@
2005-08-03 Sven Neumann <sven@gimp.org>
* libgimpcolor/gimprgb.[ch]: deprecated RGB intensity functions
and definitions. These coefficients do not accurately compute
luminance for contemporary monitors. Instead the coefficients from
the sRGB spec should be used which have now been added.
* libgimpcolor/gimpcolor.def: updated.
* libgimp/gimpdrawable.c
* libgimp/gimppixelfetcher.c
* app/base/colorize.c
* app/base/levels.c
* app/base/temp-buf.c
* app/core/gimpdrawable-blend.c
* app/core/gimpdrawable-convert.c
* app/core/gimpdrawable-desaturate.c
* app/core/gimpimage-convert.c
* app/core/gimpimage.c
* app/gui/splash.c
* app/widgets/gimpgradienteditor.c
* modules/colorsel_triangle.c
* plug-ins/common/aa.c
* plug-ins/common/bumpmap.c
* plug-ins/common/colorify.c
* plug-ins/common/despeckle.c
* plug-ins/common/displace.c
* plug-ins/common/engrave.c
* plug-ins/common/gradmap.c
* plug-ins/common/grid.c
* plug-ins/common/mng.c
* plug-ins/common/newsprint.c
* plug-ins/common/png.c
* plug-ins/common/whirlpinch.c
* plug-ins/gflare/gflare.c
* plug-ins/gfli/gfli.c
* plug-ins/maze/handy.c
* plug-ins/pagecurl/pagecurl.c: use gimp_rgb_luminance() and
friends instead of the deprecated intensity functions.
2005-08-03 Michael Natterer <mitch@gimp.org> 2005-08-03 Michael Natterer <mitch@gimp.org>
* libgimp/gimpprocbrowserdialog.[ch]: removed all parameters from * libgimp/gimpprocbrowserdialog.[ch]: removed all parameters from

View File

@ -42,9 +42,9 @@ colorize_init (Colorize *colorize)
for (i = 0; i < 256; i ++) for (i = 0; i < 256; i ++)
{ {
colorize->lum_red_lookup[i] = i * GIMP_RGB_INTENSITY_RED; colorize->lum_red_lookup[i] = i * GIMP_RGB_LUMINANCE_RED;
colorize->lum_green_lookup[i] = i * GIMP_RGB_INTENSITY_GREEN; colorize->lum_green_lookup[i] = i * GIMP_RGB_LUMINANCE_GREEN;
colorize->lum_blue_lookup[i] = i * GIMP_RGB_INTENSITY_BLUE; colorize->lum_blue_lookup[i] = i * GIMP_RGB_LUMINANCE_BLUE;
} }
} }

View File

@ -194,7 +194,7 @@ levels_adjust_by_colors (Levels *levels,
guchar lightness; guchar lightness;
/* Calculate lightness value */ /* Calculate lightness value */
lightness = GIMP_RGB_INTENSITY (gray[0], gray[1], gray[2]); lightness = GIMP_RGB_LUMINANCE (gray[0], gray[1], gray[2]);
input = levels_input_from_color (channel, gray); input = levels_input_from_color (channel, gray);

View File

@ -116,7 +116,7 @@ temp_buf_to_gray (TempBuf *src_buf,
g_return_if_fail (src_buf->bytes == 3); g_return_if_fail (src_buf->bytes == 3);
while (num_pixels--) while (num_pixels--)
{ {
pix = GIMP_RGB_INTENSITY (src[0], src[1], src[2]) + 0.5; pix = GIMP_RGB_LUMINANCE (src[0], src[1], src[2]) + 0.5;
*dest++ = (guchar) pix; *dest++ = (guchar) pix;
src += 3; src += 3;
@ -127,7 +127,7 @@ temp_buf_to_gray (TempBuf *src_buf,
g_return_if_fail (src_buf->bytes == 4); g_return_if_fail (src_buf->bytes == 4);
while (num_pixels--) while (num_pixels--)
{ {
pix = GIMP_RGB_INTENSITY (src[0], src[1], src[2]) + 0.5; pix = GIMP_RGB_LUMINANCE (src[0], src[1], src[2]) + 0.5;
*dest++ = (guchar) pix; *dest++ = (guchar) pix;
*dest++ = src[3]; /* alpha channel */ *dest++ = src[3]; /* alpha channel */

View File

@ -820,7 +820,7 @@ gradient_put_pixel (gint x,
else else
{ {
/* Convert to grayscale */ /* Convert to grayscale */
gdouble gray = gimp_rgb_intensity (color); gdouble gray = gimp_rgb_luminance (color);
if (ppd->dither_rand) if (ppd->dither_rand)
{ {
@ -1078,7 +1078,7 @@ gradient_fill_single_region_gray (RenderBlendData *rbd,
gradient_render_pixel (x, y, &color, rbd); gradient_render_pixel (x, y, &color, rbd);
*dest++ = gimp_rgb_intensity_uchar (&color); *dest++ = gimp_rgb_luminance_uchar (&color);
*dest++ = ROUND (color.a * 255.0); *dest++ = ROUND (color.a * 255.0);
} }
} }
@ -1102,7 +1102,7 @@ gradient_fill_single_region_gray_dither (RenderBlendData *rbd,
gradient_render_pixel (x, y, &color, rbd); gradient_render_pixel (x, y, &color, rbd);
gray = gimp_rgb_intensity (&color); gray = gimp_rgb_luminance (&color);
*dest++ = gray * 255.0 + (gdouble) (i & 0xff) / 256.0; i >>= 8; *dest++ = gray * 255.0 + (gdouble) (i & 0xff) / 256.0; i >>= 8;
*dest++ = color.a * 255.0 + (gdouble) (i & 0xff) / 256.0; *dest++ = color.a * 255.0 + (gdouble) (i & 0xff) / 256.0;

View File

@ -186,7 +186,7 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
d = dest; d = dest;
for (col = 0; col < srcPR.w; col++) for (col = 0; col < srcPR.w; col++)
{ {
val = GIMP_RGB_INTENSITY (s[RED_PIX], val = GIMP_RGB_LUMINANCE (s[RED_PIX],
s[GREEN_PIX], s[GREEN_PIX],
s[BLUE_PIX]) + 0.5; s[BLUE_PIX]) + 0.5;
*d++ = (guchar) val; *d++ = (guchar) val;
@ -217,7 +217,7 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
for (col = 0; col < srcPR.w; col++) for (col = 0; col < srcPR.w; col++)
{ {
offset = *s++ * 3; offset = *s++ * 3;
val = GIMP_RGB_INTENSITY (cmap[offset+0], val = GIMP_RGB_LUMINANCE (cmap[offset+0],
cmap[offset+1], cmap[offset+1],
cmap[offset+2]) + 0.5; cmap[offset+2]) + 0.5;
*d++ = (guchar) val; *d++ = (guchar) val;

View File

@ -161,7 +161,7 @@ desaturate_region_luminosity (gpointer data,
for (j = 0; j < srcPR->w; j++) for (j = 0; j < srcPR->w; j++)
{ {
gint luminosity = GIMP_RGB_INTENSITY (s[RED_PIX], gint luminosity = GIMP_RGB_LUMINANCE (s[RED_PIX],
s[GREEN_PIX], s[GREEN_PIX],
s[BLUE_PIX]) + 0.5; s[BLUE_PIX]) + 0.5;

View File

@ -760,8 +760,8 @@ color_quicksort (const void *c1,
Color *color1 = (Color *)c1; Color *color1 = (Color *)c1;
Color *color2 = (Color *)c2; Color *color2 = (Color *)c2;
double v1 = GIMP_RGB_INTENSITY (color1->red, color1->green, color1->blue); double v1 = GIMP_RGB_LUMINANCE (color1->red, color1->green, color1->blue);
double v2 = GIMP_RGB_INTENSITY (color2->red, color2->green, color2->blue); double v2 = GIMP_RGB_LUMINANCE (color2->red, color2->green, color2->blue);
if (v1 < v2) if (v1 < v2)
return -1; return -1;

View File

@ -2064,7 +2064,7 @@ gimp_image_transform_color (const GimpImage *dest_gimage,
case GIMP_GRAY_IMAGE: case GIMP_GRAY_IMAGE:
case GIMP_GRAYA_IMAGE: case GIMP_GRAYA_IMAGE:
/* NTSC conversion */ /* NTSC conversion */
*dest = GIMP_RGB_INTENSITY (src[RED_PIX], *dest = GIMP_RGB_LUMINANCE (src[RED_PIX],
src[GREEN_PIX], src[GREEN_PIX],
src[BLUE_PIX]) + 0.5; src[BLUE_PIX]) + 0.5;
break; break;

View File

@ -370,7 +370,7 @@ splash_average_bottom (GtkWidget *widget,
gint width, height; gint width, height;
gint rowstride; gint rowstride;
gint channels; gint channels;
gint intensity; gint luminance;
gint count; gint count;
guint sum[3] = { 0, 0, 0 }; guint sum[3] = { 0, 0, 0 };
@ -404,13 +404,13 @@ splash_average_bottom (GtkWidget *widget,
pixels += rowstride; pixels += rowstride;
} }
intensity = GIMP_RGB_INTENSITY (sum[0] / count, luminance = GIMP_RGB_LUMINANCE (sum[0] / count,
sum[1] / count, sum[1] / count,
sum[2] / count); sum[2] / count);
intensity = CLAMP0255 (intensity > 127 ? intensity - 223 : intensity + 223); luminance = CLAMP0255 (luminance > 127 ? luminance - 223 : luminance + 223);
color->red = color->green = color->blue = (intensity << 8 | intensity); color->red = color->green = color->blue = (luminance << 8 | luminance);
return gdk_colormap_alloc_color (gtk_widget_get_colormap (widget), return gdk_colormap_alloc_color (gtk_widget_get_colormap (widget),
color, FALSE, TRUE); color, FALSE, TRUE);

View File

@ -942,14 +942,12 @@ view_set_hint (GimpGradientEditor *editor,
gimp_rgb_to_hsv (&rgb, &hsv); gimp_rgb_to_hsv (&rgb, &hsv);
str1 = g_strdup_printf (_("Position: %0.6f"), xpos); str1 = g_strdup_printf (_("Position: %0.6f"), xpos);
str2 = g_strdup_printf (_("RGB (%0.3f, %0.3f, %0.3f)"), str2 = g_strdup_printf (_("RGB (%0.3f, %0.3f, %0.3f)"),
rgb.r, rgb.g, rgb.b); rgb.r, rgb.g, rgb.b);
str3 = g_strdup_printf (_("HSV (%0.3f, %0.3f, %0.3f)"), str3 = g_strdup_printf (_("HSV (%0.3f, %0.3f, %0.3f)"),
hsv.h * 360.0, hsv.s, hsv.v); hsv.h * 360.0, hsv.s, hsv.v);
str4 = g_strdup_printf (_("Intensity: %0.3f Opacity: %0.3f"), str4 = g_strdup_printf (_("Luminance: %0.3f Opacity: %0.3f"),
GIMP_RGB_INTENSITY (rgb.r, rgb.g, rgb.b), rgb.a); GIMP_RGB_LUMINANCE (rgb.r, rgb.g, rgb.b), rgb.a);
gradient_editor_set_hint (editor, str1, str2, str3, str4); gradient_editor_set_hint (editor, str1, str2, str3, str4);

View File

@ -1,3 +1,9 @@
2005-08-03 Sven Neumann <sven@gimp.org>
* libgimpcolor/libgimpcolor-sections.txt
* libgimpcolor/tmpl/gimprgb.sgml: added gimp_rgb_luminance() and
friends.
2005-07-22 Sven Neumann <sven@gimp.org> 2005-07-22 Sven Neumann <sven@gimp.org>
* libgimpwidgets/libgimpwidgets-sections.txt * libgimpwidgets/libgimpwidgets-sections.txt

View File

@ -63,6 +63,8 @@ gimp_rgb_max
gimp_rgb_min gimp_rgb_min
gimp_rgb_clamp gimp_rgb_clamp
gimp_rgb_gamma gimp_rgb_gamma
gimp_rgb_luminance
gimp_rgb_luminance_uchar
gimp_rgb_intensity gimp_rgb_intensity
gimp_rgb_intensity_uchar gimp_rgb_intensity_uchar
gimp_rgb_composite gimp_rgb_composite
@ -74,6 +76,10 @@ gimp_rgba_add
gimp_rgba_subtract gimp_rgba_subtract
gimp_rgba_multiply gimp_rgba_multiply
gimp_rgba_distance gimp_rgba_distance
GIMP_RGB_LUMINANCE
GIMP_RGB_LUMINANCE_RED
GIMP_RGB_LUMINANCE_GREEN
GIMP_RGB_LUMINANCE_BLUE
GIMP_RGB_INTENSITY GIMP_RGB_INTENSITY
GIMP_RGB_INTENSITY_RED GIMP_RGB_INTENSITY_RED
GIMP_RGB_INTENSITY_GREEN GIMP_RGB_INTENSITY_GREEN

View File

@ -193,6 +193,24 @@ Definitions and Functions relating to RGB colors.
@gamma: @gamma:
<!-- ##### FUNCTION gimp_rgb_luminance ##### -->
<para>
</para>
@rgb:
@Returns:
<!-- ##### FUNCTION gimp_rgb_luminance_uchar ##### -->
<para>
</para>
@rgb:
@Returns:
<!-- ##### FUNCTION gimp_rgb_intensity ##### --> <!-- ##### FUNCTION gimp_rgb_intensity ##### -->
<para> <para>
@ -305,6 +323,37 @@ Definitions and Functions relating to RGB colors.
@Returns: @Returns:
<!-- ##### MACRO GIMP_RGB_LUMINANCE ##### -->
<para>
</para>
@r:
@g:
@b:
<!-- ##### MACRO GIMP_RGB_LUMINANCE_RED ##### -->
<para>
</para>
<!-- ##### MACRO GIMP_RGB_LUMINANCE_GREEN ##### -->
<para>
</para>
<!-- ##### MACRO GIMP_RGB_LUMINANCE_BLUE ##### -->
<para>
</para>
<!-- ##### MACRO GIMP_RGB_INTENSITY ##### --> <!-- ##### MACRO GIMP_RGB_INTENSITY ##### -->
<para> <para>
This macro calculates the intensity of an RGB value based on This macro calculates the intensity of an RGB value based on

View File

@ -248,12 +248,12 @@ gimp_drawable_get_color_uchar (gint32 drawable_ID,
break; break;
case GIMP_GRAY_IMAGE: case GIMP_GRAY_IMAGE:
color_uchar[0] = gimp_rgb_intensity_uchar (color); color_uchar[0] = gimp_rgb_luminance_uchar (color);
color_uchar[1] = 255; color_uchar[1] = 255;
break; break;
case GIMP_GRAYA_IMAGE: case GIMP_GRAYA_IMAGE:
color_uchar[0] = gimp_rgb_intensity_uchar (color); color_uchar[0] = gimp_rgb_luminance_uchar (color);
gimp_rgba_get_uchar (color, NULL, NULL, NULL, &color_uchar[1]); gimp_rgba_get_uchar (color, NULL, NULL, NULL, &color_uchar[1]);
break; break;

View File

@ -160,7 +160,7 @@ gimp_pixel_fetcher_set_bg_color (GimpPixelFetcher *pf,
{ {
case 2: pf->bg_color[1] = 255; case 2: pf->bg_color[1] = 255;
case 1: case 1:
pf->bg_color[0] = gimp_rgb_intensity_uchar (color); pf->bg_color[0] = gimp_rgb_luminance_uchar (color);
break; break;
case 4: pf->bg_color[3] = 255; case 4: pf->bg_color[3] = 255;

View File

@ -36,6 +36,8 @@ EXPORTS
gimp_rgb_intensity gimp_rgb_intensity
gimp_rgb_intensity_uchar gimp_rgb_intensity_uchar
gimp_rgb_list_names gimp_rgb_list_names
gimp_rgb_luminance
gimp_rgb_luminance_uchar
gimp_rgb_max gimp_rgb_max
gimp_rgb_min gimp_rgb_min
gimp_rgb_multiply gimp_rgb_multiply

View File

@ -25,6 +25,7 @@
#include "gimpcolortypes.h" #include "gimpcolortypes.h"
#undef GIMP_DISABLE_DEPRECATED /* for GIMP_RGB_INTENSITY() */
#include "gimprgb.h" #include "gimprgb.h"
@ -228,6 +229,50 @@ gimp_rgb_gamma (GimpRGB *rgb,
rgb->b = pow (rgb->b, ig); rgb->b = pow (rgb->b, ig);
} }
/**
* gimp_rgb_luminance:
* @rgb:
*
* Return value: the luminous intensity of the range from 0.0 to 1.0.
*
* Since: GIMP 2.4
**/
gdouble
gimp_rgb_luminance (const GimpRGB *rgb)
{
gdouble luminance;
g_return_val_if_fail (rgb != NULL, 0.0);
luminance = GIMP_RGB_LUMINANCE (rgb->r, rgb->g, rgb->b);
return CLAMP (luminance, 0.0, 1.0);
}
/**
* gimp_rgb_luminance_uchar:
* @rgb:
*
* Return value: the luminous intensity in the range from 0 to 255.
*
* Since: GIMP 2.4
**/
guchar
gimp_rgb_luminance_uchar (const GimpRGB *rgb)
{
g_return_val_if_fail (rgb != NULL, 0);
return ROUND (gimp_rgb_luminance (rgb) * 255.0);
}
/**
* gimp_rgb_intensity:
* @rgb:
*
* This function is deprecated! Use gimp_rgb_luminance() instead.
*
* Return value: the intensity in the range from 0.0 to 1.0.
**/
gdouble gdouble
gimp_rgb_intensity (const GimpRGB *rgb) gimp_rgb_intensity (const GimpRGB *rgb)
{ {
@ -240,6 +285,14 @@ gimp_rgb_intensity (const GimpRGB *rgb)
return CLAMP (intensity, 0.0, 1.0); return CLAMP (intensity, 0.0, 1.0);
} }
/**
* gimp_rgb_intensity_uchar:
* @rgb:
*
* This function is deprecated! Use gimp_rgb_luminance_uchar() instead.
*
* Return value: the intensity in the range from 0 to 255.
**/
guchar guchar
gimp_rgb_intensity_uchar (const GimpRGB *rgb) gimp_rgb_intensity_uchar (const GimpRGB *rgb)
{ {

View File

@ -99,8 +99,13 @@ void gimp_rgb_clamp (GimpRGB *rgb);
void gimp_rgb_gamma (GimpRGB *rgb, void gimp_rgb_gamma (GimpRGB *rgb,
gdouble gamma); gdouble gamma);
gdouble gimp_rgb_luminance (const GimpRGB *rgb);
guchar gimp_rgb_luminance_uchar (const GimpRGB *rgb);
#ifndef GIMP_DISABLE_DEPRECATED
gdouble gimp_rgb_intensity (const GimpRGB *rgb); gdouble gimp_rgb_intensity (const GimpRGB *rgb);
guchar gimp_rgb_intensity_uchar (const GimpRGB *rgb); guchar gimp_rgb_intensity_uchar (const GimpRGB *rgb);
#endif
void gimp_rgb_composite (GimpRGB *color1, void gimp_rgb_composite (GimpRGB *color1,
const GimpRGB *color2, const GimpRGB *color2,
@ -146,13 +151,44 @@ gdouble gimp_rgba_distance (const GimpRGB *rgba1,
/* Map RGB to intensity */ /* Map RGB to intensity */
#define GIMP_RGB_INTENSITY_RED 0.30 /*
#define GIMP_RGB_INTENSITY_GREEN 0.59 * The weights to compute true CIE luminance from linear red, green
#define GIMP_RGB_INTENSITY_BLUE 0.11 * and blue, as defined by the ITU-R Recommendation BT.709, "Basic
* Parameter Values for the HDTV Standard for the Studio and for
* International Programme Exchange" (1990). Also suggested in the
* sRGB colorspace specification by the W3C.
*/
#define GIMP_RGB_LUMINANCE_RED (0.2126)
#define GIMP_RGB_LUMINANCE_GREEN (0.7152)
#define GIMP_RGB_LUMINANCE_BLUE (0.0722)
#define GIMP_RGB_LUMINANCE(r,g,b) ((r) * GIMP_RGB_LUMINANCE_RED + \
(g) * GIMP_RGB_LUMINANCE_GREEN + \
(b) * GIMP_RGB_LUMINANCE_BLUE)
#ifndef GIMP_DISABLE_DEPRECATED
/*
* The coefficients below properly computed luminance for monitors
* having phosphors that were contemporary at the introduction of NTSC
* television in 1953. They are still appropriate for computing video
* luma. However, these coefficients do not accurately compute
* luminance for contemporary monitors. The use of these definitions
* is deprecated.
*/
#define GIMP_RGB_INTENSITY_RED (0.30)
#define GIMP_RGB_INTENSITY_GREEN (0.59)
#define GIMP_RGB_INTENSITY_BLUE (0.11)
#define GIMP_RGB_INTENSITY(r,g,b) ((r) * GIMP_RGB_INTENSITY_RED + \ #define GIMP_RGB_INTENSITY(r,g,b) ((r) * GIMP_RGB_INTENSITY_RED + \
(g) * GIMP_RGB_INTENSITY_GREEN + \ (g) * GIMP_RGB_INTENSITY_GREEN + \
(b) * GIMP_RGB_INTENSITY_BLUE) (b) * GIMP_RGB_INTENSITY_BLUE)
#endif
G_END_DECLS G_END_DECLS

View File

@ -325,7 +325,7 @@ colorsel_triangle_update_preview (ColorselTriangle *triangle)
gimp_hsv_to_rgb4 (buf, atn / (2 * G_PI), 1, 1); gimp_hsv_to_rgb4 (buf, atn / (2 * G_PI), 1, 1);
col = GIMP_RGB_INTENSITY (buf[0], buf[1], buf[2]) > 127 ? 0 : 255; col = GIMP_RGB_LUMINANCE (buf[0], buf[1], buf[2]) > 127 ? 0 : 255;
d = CLAMP (triangle->wheelradius / 16, 2, 4); d = CLAMP (triangle->wheelradius / 16, 2, 4);

View File

@ -306,13 +306,13 @@ gimp2aa (gint32 drawable_ID,
case 3: /* RGB */ case 3: /* RGB */
for (x = 0, p = buffer; x < width; x++, p += 3) for (x = 0, p = buffer; x < width; x++, p += 3)
aa_putpixel (context, x, y, aa_putpixel (context, x, y,
GIMP_RGB_INTENSITY (p[0], p[1], p[2]) + 0.5); GIMP_RGB_LUMINANCE (p[0], p[1], p[2]) + 0.5);
break; break;
case 4: /* RGBA, blend over black */ case 4: /* RGBA, blend over black */
for (x = 0, p = buffer; x < width; x++, p += 4) for (x = 0, p = buffer; x < width; x++, p += 4)
aa_putpixel (context, x, y, aa_putpixel (context, x, y,
((guchar) (GIMP_RGB_INTENSITY (p[0], p[1], p[2]) + 0.5) ((guchar) (GIMP_RGB_LUMINANCE (p[0], p[1], p[2]) + 0.5)
* (p[3] + 1)) >> 8); * (p[3] + 1)) >> 8);
break; break;

View File

@ -785,12 +785,12 @@ bumpmap_convert_row (guchar *row,
{ {
if (has_alpha) if (has_alpha)
*p++ = lut[(gint) (bmvals.waterlevel + *p++ = lut[(gint) (bmvals.waterlevel +
(((gint) (GIMP_RGB_INTENSITY (row[0], (((gint) (GIMP_RGB_LUMINANCE (row[0],
row[1], row[1],
row[2]) + 0.5) - row[2]) + 0.5) -
bmvals.waterlevel) * row[3]) / 255.0)]; bmvals.waterlevel) * row[3]) / 255.0)];
else else
*p++ = lut[(gint) (GIMP_RGB_INTENSITY (row[0], *p++ = lut[(gint) (GIMP_RGB_LUMINANCE (row[0],
row[1], row[1],
row[2]) + 0.5)]; row[2]) + 0.5)];

View File

@ -212,9 +212,9 @@ colorify (GimpDrawable *drawable,
for (i = 0; i < 256; i ++) for (i = 0; i < 256; i ++)
{ {
lum_red_lookup[i] = i * GIMP_RGB_INTENSITY_RED; lum_red_lookup[i] = i * GIMP_RGB_LUMINANCE_RED;
lum_green_lookup[i] = i * GIMP_RGB_INTENSITY_GREEN; lum_green_lookup[i] = i * GIMP_RGB_LUMINANCE_GREEN;
lum_blue_lookup[i] = i * GIMP_RGB_INTENSITY_BLUE; lum_blue_lookup[i] = i * GIMP_RGB_LUMINANCE_BLUE;
final_red_lookup[i] = i * cvals.color.r; final_red_lookup[i] = i * cvals.color.r;
final_green_lookup[i] = i * cvals.color.g; final_green_lookup[i] = i * cvals.color.g;
final_blue_lookup[i] = i * cvals.color.b; final_blue_lookup[i] = i * cvals.color.b;

View File

@ -86,7 +86,7 @@ static void preview_update (GtkWidget *preview);
static gint quick_median_select (guchar **p, static gint quick_median_select (guchar **p,
guchar *i, guchar *i,
gint n); gint n);
static inline guchar pixel_intensity (const guchar *p, static inline guchar pixel_luminance (const guchar *p,
gint bpp); gint bpp);
static inline void pixel_copy (guchar *dest, static inline void pixel_copy (guchar *dest,
const guchar *src, const guchar *src,
@ -635,7 +635,7 @@ despeckle_median (guchar *src,
for (u = xmin, off2 += xmin * bpp; u <= xmax; u++, off2 += bpp) for (u = xmin, off2 += xmin * bpp; u <= xmax; u++, off2 += bpp)
{ {
guchar value = pixel_intensity (src + off2, bpp); guchar value = pixel_luminance (src + off2, bpp);
if (value < black_level) if (value < black_level)
{ {
@ -705,7 +705,7 @@ despeckle_median (guchar *src,
* Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5 * Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5
* This code by Nicolas Devillard - 1998. Public domain. * This code by Nicolas Devillard - 1998. Public domain.
* *
* Modified to swap pointers: swap is done by comparing intensity * Modified to swap pointers: swap is done by comparing luminance
* value for the pointer to RGB. * value for the pointer to RGB.
*/ */
static gint static gint
@ -793,7 +793,7 @@ quick_median_select (guchar **p,
} }
static inline guchar static inline guchar
pixel_intensity (const guchar *p, pixel_luminance (const guchar *p,
gint bpp) gint bpp)
{ {
switch (bpp) switch (bpp)
@ -804,7 +804,7 @@ pixel_intensity (const guchar *p,
case 3: case 3:
case 4: case 4:
return GIMP_RGB_INTENSITY (p[0], p[1], p[2]); return GIMP_RGB_LUMINANCE (p[0], p[1], p[2]);
default: default:
return 0; /* should not be reached */ return 0; /* should not be reached */

View File

@ -31,7 +31,7 @@
* (http://ha1.seikyou.ne.jp/home/taka/gimp/displace/displace.html) * (http://ha1.seikyou.ne.jp/home/taka/gimp/displace/displace.html)
* Added ability to use transparency as the identity transformation * Added ability to use transparency as the identity transformation
* (Full transparency is treated as if it was grey 0.5) * (Full transparency is treated as if it was grey 0.5)
* and the possibility to use RGB/RGBA pictures where the intensity * and the possibility to use RGB/RGBA pictures where the luminance
* of the pixel is taken into account * of the pixel is taken into account
* *
* Joao S. O. Bueno, Dec. 2004: * Joao S. O. Bueno, Dec. 2004:
@ -175,7 +175,7 @@ query (void)
"Displace the contents of the specified drawable", "Displace the contents of the specified drawable",
"Displaces the contents of the specified drawable " "Displaces the contents of the specified drawable "
"by the amounts specified by 'amount_x' and " "by the amounts specified by 'amount_x' and "
"'amount_y' multiplied by the intensity of " "'amount_y' multiplied by the luminance of "
"corresponding pixels in the 'displace_map' " "corresponding pixels in the 'displace_map' "
"drawables. If mode is polar coordinates" "drawables. If mode is polar coordinates"
"drawable is whirled and pinched according to map.", "drawable is whirled and pinched according to map.",
@ -757,7 +757,7 @@ displace_map_give_value (guchar *pt,
gdouble ret, val_alpha; gdouble ret, val_alpha;
if (bytes >= 3) if (bytes >= 3)
ret = GIMP_RGB_INTENSITY (pt[0], pt[1], pt[2]); ret = GIMP_RGB_LUMINANCE (pt[0], pt[1], pt[2]);
else else
ret = (gdouble) *pt; ret = (gdouble) *pt;

View File

@ -362,7 +362,7 @@ engrave_large (GimpDrawable *drawable,
if (bpp < 3) if (bpp < 3)
inten = average[0] / 254.0 * height; inten = average[0] / 254.0 * height;
else else
inten = GIMP_RGB_INTENSITY (average[0], inten = GIMP_RGB_LUMINANCE (average[0],
average[1], average[1],
average[2]) / 254.0 * height; average[2]) / 254.0 * height;
@ -553,7 +553,7 @@ engrave_sub (gint height,
if (bpp < 3) if (bpp < 3)
inten = average[0] / 254.0 * height; inten = average[0] / 254.0 * height;
else else
inten = GIMP_RGB_INTENSITY (average[0], inten = GIMP_RGB_LUMINANCE (average[0],
average[1], average[1],
average[2]) / 254.0 * height; average[2]) / 254.0 * height;

View File

@ -27,14 +27,10 @@
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
#ifdef RCSID
static char rcsid[] = "$Id$";
#endif
/* Some useful macros */ /* Some useful macros */
#define NSAMPLES 256 #define NSAMPLES 256
#define LUMINOSITY(X) (GIMP_RGB_INTENSITY (X[0], X[1], X[2]) + 0.5) #define LUMINOSITY(X) (GIMP_RGB_LUMINANCE (X[0], X[1], X[2]) + 0.5)
typedef enum typedef enum
{ {
@ -331,7 +327,7 @@ get_samples_palette (GimpDrawable *drawable)
gimp_rgb_get_uchar (&color_sample, gimp_rgb_get_uchar (&color_sample,
b_samp, b_samp + 1, b_samp + 2); b_samp, b_samp + 1, b_samp + 2);
else else
*b_samp = gimp_rgb_intensity_uchar (&color_sample); *b_samp = gimp_rgb_luminance_uchar (&color_sample);
if (has_alpha) if (has_alpha)
b_samp[alpha] = 255; b_samp[alpha] = 255;

View File

@ -354,9 +354,9 @@ grid (gint32 image_ID,
break; break;
case GIMP_GRAY: case GIMP_GRAY:
hcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.hcolor); hcolor[0] = gimp_rgb_luminance_uchar (&grid_cfg.hcolor);
vcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.vcolor); vcolor[0] = gimp_rgb_luminance_uchar (&grid_cfg.vcolor);
icolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.icolor); icolor[0] = gimp_rgb_luminance_uchar (&grid_cfg.icolor);
blend = TRUE; blend = TRUE;
break; break;

View File

@ -662,7 +662,9 @@ mng_save_image (const gchar *filename,
gimp_context_get_background(&bgcolor); gimp_context_get_background(&bgcolor);
gimp_rgb_get_uchar(&bgcolor, &red, &green, &blue); gimp_rgb_get_uchar(&bgcolor, &red, &green, &blue);
if ((ret = mng_putchunk_back(handle, red, green, blue, MNG_BACKGROUNDCOLOR_MANDATORY, 0, MNG_BACKGROUNDIMAGE_NOTILE)) != MNG_NOERROR) if ((ret = mng_putchunk_back(handle, red, green, blue,
MNG_BACKGROUNDCOLOR_MANDATORY,
0, MNG_BACKGROUNDIMAGE_NOTILE)) != MNG_NOERROR)
{ {
g_warning("Unable to mng_putchunk_back() in mng_save_image()"); g_warning("Unable to mng_putchunk_back() in mng_save_image()");
mng_cleanup(&handle); mng_cleanup(&handle);
@ -671,7 +673,9 @@ mng_save_image (const gchar *filename,
return 0; return 0;
} }
if ((ret = mng_putchunk_bkgd(handle, MNG_FALSE, 2, 0, gimp_rgb_intensity_uchar(&bgcolor), red, green, blue)) != MNG_NOERROR) if ((ret = mng_putchunk_bkgd(handle, MNG_FALSE, 2, 0,
gimp_rgb_luminance_uchar(&bgcolor),
red, green, blue)) != MNG_NOERROR)
{ {
g_warning("Unable to mng_putchunk_bkgd() in mng_save_image()"); g_warning("Unable to mng_putchunk_bkgd() in mng_save_image()");
mng_cleanup(&handle); mng_cleanup(&handle);

View File

@ -89,7 +89,7 @@
#define CS_GREY 0 #define CS_GREY 0
#define CS_RGB 1 #define CS_RGB 1
#define CS_CMYK 2 #define CS_CMYK 2
#define CS_INTENSITY 3 #define CS_LUMINANCE 3
#define NUM_CS 4 #define NUM_CS 4
#define VALID_CS(x) ((x) >= 0 && (x) <= NUM_CS-1) #define VALID_CS(x) ((x) >= 0 && (x) <= NUM_CS-1)
@ -190,7 +190,7 @@ typedef struct
gint cell_width; gint cell_width;
/* screening section: */ /* screening section: */
gint colourspace; /* 0: RGB, 1: CMYK, 2: Intensity */ gint colourspace; /* 0: RGB, 1: CMYK, 2: Luminance */
gint k_pullout; /* percentage of black to pull out */ gint k_pullout; /* percentage of black to pull out */
/* grey screen (only used if greyscale drawable) */ /* grey screen (only used if greyscale drawable) */
@ -276,7 +276,7 @@ static const NewsprintValues factory_defaults =
10, /* cell width */ 10, /* cell width */
/* screen setup (default is the classic rosette pattern) */ /* screen setup (default is the classic rosette pattern) */
CS_RGB, /* use RGB, not CMYK or Intensity */ CS_RGB, /* use RGB, not CMYK or Luminance */
100, /* max pullout */ 100, /* max pullout */
/* grey/black */ /* grey/black */
@ -404,10 +404,10 @@ static const chan_tmpl cmyk_tmpl[] =
{ NULL, NULL, NULL, NULL, NULL } { NULL, NULL, NULL, NULL, NULL }
}; };
static const chan_tmpl intensity_tmpl[] = static const chan_tmpl luminance_tmpl[] =
{ {
{ {
N_("Intensity"), N_("Luminance"),
&pvals.gry_ang, &pvals.gry_ang,
&pvals.gry_spotfn, &pvals.gry_spotfn,
&factory_defaults.gry_ang, &factory_defaults.gry_ang,
@ -424,7 +424,7 @@ static const chan_tmpl *cspace_chan_tmpl[] =
grey_tmpl, grey_tmpl,
rgb_tmpl, rgb_tmpl,
cmyk_tmpl, cmyk_tmpl,
intensity_tmpl luminance_tmpl
}; };
#define NCHANS(x) ((sizeof(x) / sizeof(chan_tmpl)) - 1) #define NCHANS(x) ((sizeof(x) / sizeof(chan_tmpl)) - 1)
@ -437,7 +437,7 @@ static const gint cspace_nchans[] =
NCHANS (grey_tmpl), NCHANS (grey_tmpl),
NCHANS (rgb_tmpl), NCHANS (rgb_tmpl),
NCHANS (cmyk_tmpl), NCHANS (cmyk_tmpl),
NCHANS (intensity_tmpl) NCHANS (luminance_tmpl)
}; };
@ -497,7 +497,7 @@ query (void)
{ GIMP_PDB_INT32, "cell_width", "screen cell width, in pixels" }, { GIMP_PDB_INT32, "cell_width", "screen cell width, in pixels" },
{ GIMP_PDB_INT32, "colorspace", "separate to 0:RGB, 1:CMYK, 2:Intensity" }, { GIMP_PDB_INT32, "colorspace", "separate to 0:RGB, 1:CMYK, 2:Luminance" },
{ GIMP_PDB_INT32, "k_pullout", "Percentage of black to pullout (CMYK only)" }, { GIMP_PDB_INT32, "k_pullout", "Percentage of black to pullout (CMYK only)" },
{ GIMP_PDB_FLOAT, "gry_ang", "Grey/black screen angle (degrees)" }, { GIMP_PDB_FLOAT, "gry_ang", "Grey/black screen angle (degrees)" },
@ -1327,7 +1327,7 @@ newsprint_dialog (GimpDrawable *drawable)
G_CALLBACK (gimp_preview_invalidate), G_CALLBACK (gimp_preview_invalidate),
preview); preview);
/* RGB / CMYK / Intensity select */ /* RGB / CMYK / Luminance select */
hbox = gtk_hbox_new (FALSE, 6); hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (st.vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (st.vbox), hbox, FALSE, FALSE, 0);
@ -1376,7 +1376,7 @@ newsprint_dialog (GimpDrawable *drawable)
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle)); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
(pvals.colourspace == CS_INTENSITY)); (pvals.colourspace == CS_LUMINANCE));
gtk_widget_show (toggle); gtk_widget_show (toggle);
g_object_set_data (G_OBJECT (toggle), "dialog", &st); g_object_set_data (G_OBJECT (toggle), "dialog", &st);
@ -1384,7 +1384,7 @@ newsprint_dialog (GimpDrawable *drawable)
g_signal_connect (toggle, "toggled", g_signal_connect (toggle, "toggled",
G_CALLBACK (newsprint_cspace_update), G_CALLBACK (newsprint_cspace_update),
GINT_TO_POINTER (CS_INTENSITY)); GINT_TO_POINTER (CS_LUMINANCE));
g_signal_connect_swapped (toggle, "toggled", g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate), G_CALLBACK (gimp_preview_invalidate),
preview); preview);
@ -1840,7 +1840,7 @@ do { \
} while(0) } while(0)
/* calculate the RGB / CMYK rotations and threshold matrices */ /* calculate the RGB / CMYK rotations and threshold matrices */
if (colour_bpp == 1 || colourspace == CS_INTENSITY) if (colour_bpp == 1 || colourspace == CS_LUMINANCE)
{ {
rot[0] = DEG2RAD (pvals.gry_ang); rot[0] = DEG2RAD (pvals.gry_ang);
thresh[0] = spot2thresh (pvals.gry_spotfn, width); thresh[0] = spot2thresh (pvals.gry_spotfn, width);
@ -1951,9 +1951,9 @@ do { \
} }
break; break;
case CS_INTENSITY: case CS_LUMINANCE:
data[3] = data[0]; /* save orig for later */ data[3] = data[0]; /* save orig for later */
data[0] = GIMP_RGB_INTENSITY (data[0], data[0] = GIMP_RGB_LUMINANCE (data[0],
data[1], data[1],
data[2]) + 0.5; data[2]) + 0.5;
break; break;
@ -2012,7 +2012,7 @@ do { \
data[2] = 0xff - data[2]; data[2] = 0xff - data[2];
break; break;
case CS_INTENSITY: case CS_LUMINANCE:
if (has_alpha) if (has_alpha)
{ {
dest[colour_bpp] = data[0]; dest[colour_bpp] = data[0];

View File

@ -1283,7 +1283,7 @@ save_image (const gchar *filename,
background.red = red; background.red = red;
background.green = green; background.green = green;
background.blue = blue; background.blue = blue;
background.gray = gimp_rgb_intensity_uchar (&color); background.gray = gimp_rgb_luminance_uchar (&color);
png_set_bKGD (pp, info, &background); png_set_bKGD (pp, info, &background);
} }
else else

View File

@ -632,12 +632,12 @@ dialog_update_preview (GimpDrawable *drawable,
switch (img_bpp) switch (img_bpp)
{ {
case 1: case 1:
outside[0] = outside[1] = outside [2] = gimp_rgb_intensity_uchar (&background); outside[0] = outside[1] = outside [2] = gimp_rgb_luminance_uchar (&background);
outside[3] = 255; outside[3] = 255;
break; break;
case 2: case 2:
outside[0] = outside[1] = outside [2] = gimp_rgb_intensity_uchar (&background); outside[0] = outside[1] = outside [2] = gimp_rgb_luminance_uchar (&background);
outside[3] = 0; outside[3] = 0;
break; break;

View File

@ -58,7 +58,7 @@
#define DEBUG_PRINT(X) #define DEBUG_PRINT(X)
#endif #endif
#define LUMINOSITY(PIX) (GIMP_RGB_INTENSITY (PIX[0], PIX[1], PIX[2]) + 0.5) #define LUMINOSITY(PIX) (GIMP_RGB_LUMINANCE (PIX[0], PIX[1], PIX[2]) + 0.5)
#define OFFSETOF(t,f) ((int) ((char*) &((t*) 0)->f)) #define OFFSETOF(t,f) ((int) ((char*) &((t*) 0)->f))
#define RESPONSE_RESCAN 1 #define RESPONSE_RESCAN 1
@ -1155,7 +1155,7 @@ plugin_put_pixel_func (gint ix,
} }
else else
{ {
dest[0] = gimp_rgb_intensity_uchar (color); dest[0] = gimp_rgb_luminance_uchar (color);
} }
if (dinfo.has_alpha) if (dinfo.has_alpha)

View File

@ -638,7 +638,7 @@ save_image (const gchar *filename,
{ {
cm[i*3+0] = cm[i*3+1] = cm[i*3+2] = i; cm[i*3+0] = cm[i*3+1] = cm[i*3+2] = i;
} }
bg = GIMP_RGB_INTENSITY (red, green, blue) + 0.5; bg = GIMP_RGB_LUMINANCE (red, green, blue) + 0.5;
break; break;
case GIMP_INDEXED: case GIMP_INDEXED:

View File

@ -58,8 +58,8 @@ get_colors (GimpDrawable *drawable,
case GIMP_GRAYA_IMAGE: case GIMP_GRAYA_IMAGE:
case GIMP_GRAY_IMAGE: case GIMP_GRAY_IMAGE:
fg[0] = gimp_rgb_intensity_uchar (&foreground); fg[0] = gimp_rgb_luminance_uchar (&foreground);
bg[0] = gimp_rgb_intensity_uchar (&background); bg[0] = gimp_rgb_luminance_uchar (&background);
break; break;
case GIMP_INDEXEDA_IMAGE: case GIMP_INDEXEDA_IMAGE:

View File

@ -760,10 +760,10 @@ do_curl_effect (gint32 drawable_id)
/* Init shade_curl */ /* Init shade_curl */
fore_grayval = GIMP_RGB_INTENSITY (fore_color[0], fore_grayval = GIMP_RGB_LUMINANCE (fore_color[0],
fore_color[1], fore_color[1],
fore_color[2]) + 0.5; fore_color[2]) + 0.5;
back_grayval = GIMP_RGB_INTENSITY (back_color[0], back_grayval = GIMP_RGB_LUMINANCE (back_color[0],
back_color[1], back_color[1],
back_color[2]) + 0.5; back_color[2]) + 0.5;
@ -1069,7 +1069,7 @@ get_gradient_samples (gint32 drawable_id,
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
b_samp[j] = f_samp[j] * 255; b_samp[j] = f_samp[j] * 255;
else else
b_samp[0] = GIMP_RGB_INTENSITY (f_samp[0], f_samp[1], f_samp[2]) * 255; b_samp[0] = GIMP_RGB_LUMINANCE (f_samp[0], f_samp[1], f_samp[2]) * 255;
if (has_alpha) if (has_alpha)
b_samp[alpha] = f_samp[3] * 255; b_samp[alpha] = f_samp[3] * 255;

View File

@ -1,3 +1,7 @@
2005-08-03 Sven Neumann <sven@gimp.org>
* pygimp-rgb.c: added wrapper for gimp_rgb_luminance().
2005-07-29 Sven Neumann <sven@gimp.org> 2005-07-29 Sven Neumann <sven@gimp.org>
* plug-ins/benchmark-foreground-extract.py: follow PDB API change. * plug-ins/benchmark-foreground-extract.py: follow PDB API change.

View File

@ -203,6 +203,12 @@ rgb_gamma(PyObject *self, PyObject *args, PyObject *kwargs)
return Py_None; return Py_None;
} }
static PyObject *
rgb_luminance(PyObject *self)
{
return PyFloat_FromDouble(gimp_rgb_luminance(pyg_boxed_get(self, GimpRGB)));
}
static PyObject * static PyObject *
rgb_intensity(PyObject *self) rgb_intensity(PyObject *self)
{ {
@ -322,6 +328,7 @@ static PyMethodDef rgb_methods[] = {
{ "min", (PyCFunction)rgb_min, METH_NOARGS }, { "min", (PyCFunction)rgb_min, METH_NOARGS },
{ "clamp", (PyCFunction)rgb_clamp, METH_NOARGS }, { "clamp", (PyCFunction)rgb_clamp, METH_NOARGS },
{ "gamma", (PyCFunction)rgb_gamma, METH_VARARGS|METH_KEYWORDS }, { "gamma", (PyCFunction)rgb_gamma, METH_VARARGS|METH_KEYWORDS },
{ "luminance", (PyCFunction)rgb_luminance, METH_NOARGS },
{ "intensity", (PyCFunction)rgb_intensity, METH_NOARGS }, { "intensity", (PyCFunction)rgb_intensity, METH_NOARGS },
{ "composite", (PyCFunction)rgb_composite, METH_VARARGS|METH_KEYWORDS }, { "composite", (PyCFunction)rgb_composite, METH_VARARGS|METH_KEYWORDS },
{ "parse_name", (PyCFunction)rgb_parse_name, METH_VARARGS|METH_KEYWORDS }, { "parse_name", (PyCFunction)rgb_parse_name, METH_VARARGS|METH_KEYWORDS },

View File

@ -203,6 +203,12 @@ rgb_gamma(PyObject *self, PyObject *args, PyObject *kwargs)
return Py_None; return Py_None;
} }
static PyObject *
rgb_luminance(PyObject *self)
{
return PyFloat_FromDouble(gimp_rgb_luminance(pyg_boxed_get(self, GimpRGB)));
}
static PyObject * static PyObject *
rgb_intensity(PyObject *self) rgb_intensity(PyObject *self)
{ {
@ -322,6 +328,7 @@ static PyMethodDef rgb_methods[] = {
{ "min", (PyCFunction)rgb_min, METH_NOARGS }, { "min", (PyCFunction)rgb_min, METH_NOARGS },
{ "clamp", (PyCFunction)rgb_clamp, METH_NOARGS }, { "clamp", (PyCFunction)rgb_clamp, METH_NOARGS },
{ "gamma", (PyCFunction)rgb_gamma, METH_VARARGS|METH_KEYWORDS }, { "gamma", (PyCFunction)rgb_gamma, METH_VARARGS|METH_KEYWORDS },
{ "luminance", (PyCFunction)rgb_luminance, METH_NOARGS },
{ "intensity", (PyCFunction)rgb_intensity, METH_NOARGS }, { "intensity", (PyCFunction)rgb_intensity, METH_NOARGS },
{ "composite", (PyCFunction)rgb_composite, METH_VARARGS|METH_KEYWORDS }, { "composite", (PyCFunction)rgb_composite, METH_VARARGS|METH_KEYWORDS },
{ "parse_name", (PyCFunction)rgb_parse_name, METH_VARARGS|METH_KEYWORDS }, { "parse_name", (PyCFunction)rgb_parse_name, METH_VARARGS|METH_KEYWORDS },