Commit 4f870bc1 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

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.
parent 79d2bb6a
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>
* libgimp/gimpprocbrowserdialog.[ch]: removed all parameters from
......
......@@ -42,9 +42,9 @@ colorize_init (Colorize *colorize)
for (i = 0; i < 256; i ++)
{
colorize->lum_red_lookup[i] = i * GIMP_RGB_INTENSITY_RED;
colorize->lum_green_lookup[i] = i * GIMP_RGB_INTENSITY_GREEN;
colorize->lum_blue_lookup[i] = i * GIMP_RGB_INTENSITY_BLUE;
colorize->lum_red_lookup[i] = i * GIMP_RGB_LUMINANCE_RED;
colorize->lum_green_lookup[i] = i * GIMP_RGB_LUMINANCE_GREEN;
colorize->lum_blue_lookup[i] = i * GIMP_RGB_LUMINANCE_BLUE;
}
}
......
......@@ -194,7 +194,7 @@ levels_adjust_by_colors (Levels *levels,
guchar lightness;
/* 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);
......
......@@ -116,7 +116,7 @@ temp_buf_to_gray (TempBuf *src_buf,
g_return_if_fail (src_buf->bytes == 3);
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;
src += 3;
......@@ -127,7 +127,7 @@ temp_buf_to_gray (TempBuf *src_buf,
g_return_if_fail (src_buf->bytes == 4);
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++ = src[3]; /* alpha channel */
......
......@@ -820,7 +820,7 @@ gradient_put_pixel (gint x,
else
{
/* Convert to grayscale */
gdouble gray = gimp_rgb_intensity (color);
gdouble gray = gimp_rgb_luminance (color);
if (ppd->dither_rand)
{
......@@ -1078,7 +1078,7 @@ gradient_fill_single_region_gray (RenderBlendData *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);
}
}
......@@ -1102,7 +1102,7 @@ gradient_fill_single_region_gray_dither (RenderBlendData *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++ = color.a * 255.0 + (gdouble) (i & 0xff) / 256.0;
......
......@@ -186,7 +186,7 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
d = dest;
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[BLUE_PIX]) + 0.5;
*d++ = (guchar) val;
......@@ -217,7 +217,7 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
for (col = 0; col < srcPR.w; col++)
{
offset = *s++ * 3;
val = GIMP_RGB_INTENSITY (cmap[offset+0],
val = GIMP_RGB_LUMINANCE (cmap[offset+0],
cmap[offset+1],
cmap[offset+2]) + 0.5;
*d++ = (guchar) val;
......
......@@ -161,7 +161,7 @@ desaturate_region_luminosity (gpointer data,
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[BLUE_PIX]) + 0.5;
......
......@@ -760,8 +760,8 @@ color_quicksort (const void *c1,
Color *color1 = (Color *)c1;
Color *color2 = (Color *)c2;
double v1 = GIMP_RGB_INTENSITY (color1->red, color1->green, color1->blue);
double v2 = GIMP_RGB_INTENSITY (color2->red, color2->green, color2->blue);
double v1 = GIMP_RGB_LUMINANCE (color1->red, color1->green, color1->blue);
double v2 = GIMP_RGB_LUMINANCE (color2->red, color2->green, color2->blue);
if (v1 < v2)
return -1;
......
......@@ -2064,7 +2064,7 @@ gimp_image_transform_color (const GimpImage *dest_gimage,
case GIMP_GRAY_IMAGE:
case GIMP_GRAYA_IMAGE:
/* NTSC conversion */
*dest = GIMP_RGB_INTENSITY (src[RED_PIX],
*dest = GIMP_RGB_LUMINANCE (src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]) + 0.5;
break;
......
......@@ -370,7 +370,7 @@ splash_average_bottom (GtkWidget *widget,
gint width, height;
gint rowstride;
gint channels;
gint intensity;
gint luminance;
gint count;
guint sum[3] = { 0, 0, 0 };
......@@ -404,13 +404,13 @@ splash_average_bottom (GtkWidget *widget,
pixels += rowstride;
}
intensity = GIMP_RGB_INTENSITY (sum[0] / count,
luminance = GIMP_RGB_LUMINANCE (sum[0] / count,
sum[1] / 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),
color, FALSE, TRUE);
......
......@@ -942,14 +942,12 @@ view_set_hint (GimpGradientEditor *editor,
gimp_rgb_to_hsv (&rgb, &hsv);
str1 = g_strdup_printf (_("Position: %0.6f"), xpos);
str2 = g_strdup_printf (_("RGB (%0.3f, %0.3f, %0.3f)"),
rgb.r, rgb.g, rgb.b);
str3 = g_strdup_printf (_("HSV (%0.3f, %0.3f, %0.3f)"),
hsv.h * 360.0, hsv.s, hsv.v);
str4 = g_strdup_printf (_("Intensity: %0.3f Opacity: %0.3f"),
GIMP_RGB_INTENSITY (rgb.r, rgb.g, rgb.b), rgb.a);
str4 = g_strdup_printf (_("Luminance: %0.3f Opacity: %0.3f"),
GIMP_RGB_LUMINANCE (rgb.r, rgb.g, rgb.b), rgb.a);
gradient_editor_set_hint (editor, str1, str2, str3, str4);
......
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>
* libgimpwidgets/libgimpwidgets-sections.txt
......
......@@ -63,6 +63,8 @@ gimp_rgb_max
gimp_rgb_min
gimp_rgb_clamp
gimp_rgb_gamma
gimp_rgb_luminance
gimp_rgb_luminance_uchar
gimp_rgb_intensity
gimp_rgb_intensity_uchar
gimp_rgb_composite
......@@ -74,6 +76,10 @@ gimp_rgba_add
gimp_rgba_subtract
gimp_rgba_multiply
gimp_rgba_distance
GIMP_RGB_LUMINANCE
GIMP_RGB_LUMINANCE_RED
GIMP_RGB_LUMINANCE_GREEN
GIMP_RGB_LUMINANCE_BLUE
GIMP_RGB_INTENSITY
GIMP_RGB_INTENSITY_RED
GIMP_RGB_INTENSITY_GREEN
......
......@@ -193,6 +193,24 @@ Definitions and Functions relating to RGB colors.
@gamma:
<!-- ##### FUNCTION gimp_rgb_luminance ##### -->
<para>
</para>
@rgb:
@Returns:
<!-- ##### FUNCTION gimp_rgb_luminance_uchar ##### -->
<para>
</para>
@rgb:
@Returns:
<!-- ##### FUNCTION gimp_rgb_intensity ##### -->
<para>
......@@ -305,6 +323,37 @@ Definitions and Functions relating to RGB colors.
@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 ##### -->
<para>
This macro calculates the intensity of an RGB value based on
......
......@@ -248,12 +248,12 @@ gimp_drawable_get_color_uchar (gint32 drawable_ID,
break;
case GIMP_GRAY_IMAGE:
color_uchar[0] = gimp_rgb_intensity_uchar (color);
color_uchar[0] = gimp_rgb_luminance_uchar (color);
color_uchar[1] = 255;
break;
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]);
break;
......
......@@ -160,7 +160,7 @@ gimp_pixel_fetcher_set_bg_color (GimpPixelFetcher *pf,
{
case 2: pf->bg_color[1] = 255;
case 1:
pf->bg_color[0] = gimp_rgb_intensity_uchar (color);
pf->bg_color[0] = gimp_rgb_luminance_uchar (color);
break;
case 4: pf->bg_color[3] = 255;
......
......@@ -36,6 +36,8 @@ EXPORTS
gimp_rgb_intensity
gimp_rgb_intensity_uchar
gimp_rgb_list_names
gimp_rgb_luminance
gimp_rgb_luminance_uchar
gimp_rgb_max
gimp_rgb_min
gimp_rgb_multiply
......
......@@ -25,6 +25,7 @@
#include "gimpcolortypes.h"
#undef GIMP_DISABLE_DEPRECATED /* for GIMP_RGB_INTENSITY() */
#include "gimprgb.h"
......@@ -228,6 +229,50 @@ gimp_rgb_gamma (GimpRGB *rgb,
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
gimp_rgb_intensity (const GimpRGB *rgb)
{
......@@ -240,6 +285,14 @@ gimp_rgb_intensity (const GimpRGB *rgb)
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
gimp_rgb_intensity_uchar (const GimpRGB *rgb)
{
......
......@@ -99,8 +99,13 @@ void gimp_rgb_clamp (GimpRGB *rgb);
void gimp_rgb_gamma (GimpRGB *rgb,
gdouble gamma);
gdouble gimp_rgb_intensity (const GimpRGB *rgb);
guchar gimp_rgb_intensity_uchar (const GimpRGB *rgb);
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);
guchar gimp_rgb_intensity_uchar (const GimpRGB *rgb);
#endif
void gimp_rgb_composite (GimpRGB *color1,
const GimpRGB *color2,
......@@ -146,13 +151,44 @@ gdouble gimp_rgba_distance (const GimpRGB *rgba1,
/* Map RGB to intensity */
#define GIMP_RGB_INTENSITY_RED 0.30
#define GIMP_RGB_INTENSITY_GREEN 0.59
#define GIMP_RGB_INTENSITY_BLUE 0.11
/*
* The weights to compute true CIE luminance from linear red, green
* 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 + \
(g) * GIMP_RGB_INTENSITY_GREEN + \
(b) * GIMP_RGB_INTENSITY_BLUE)
#endif
G_END_DECLS
......
......@@ -325,7 +325,7 @@ colorsel_triangle_update_preview (ColorselTriangle *triangle)
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);
......
......@@ -306,13 +306,13 @@ gimp2aa (gint32 drawable_ID,
case 3: /* RGB */
for (x = 0, p = buffer; x < width; x++, p += 3)
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;
case 4: /* RGBA, blend over black */
for (x = 0, p = buffer; x < width; x++, p += 4)
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);
break;
......
......@@ -785,12 +785,12 @@ bumpmap_convert_row (guchar *row,
{
if (has_alpha)
*p++ = lut[(gint) (bmvals.waterlevel +
(((gint) (GIMP_RGB_INTENSITY (row[0],
(((gint) (GIMP_RGB_LUMINANCE (row[0],
row[1],
row[2]) + 0.5) -
bmvals.waterlevel) * row[3]) / 255.0)];
else
*p++ = lut[(gint) (GIMP_RGB_INTENSITY (row[0],
*p++ = lut[(gint) (GIMP_RGB_LUMINANCE (row[0],
row[1],
row[2]) + 0.5)];
......
......@@ -212,9 +212,9 @@ colorify (GimpDrawable *drawable,
for (i = 0; i < 256; i ++)
{
lum_red_lookup[i] = i * GIMP_RGB_INTENSITY_RED;
lum_green_lookup[i] = i * GIMP_RGB_INTENSITY_GREEN;
lum_blue_lookup[i] = i * GIMP_RGB_INTENSITY_BLUE;
lum_red_lookup[i] = i * GIMP_RGB_LUMINANCE_RED;
lum_green_lookup[i] = i * GIMP_RGB_LUMINANCE_GREEN;
lum_blue_lookup[i] = i * GIMP_RGB_LUMINANCE_BLUE;
final_red_lookup[i] = i * cvals.color.r;
final_green_lookup[i] = i * cvals.color.g;
final_blue_lookup[i] = i * cvals.color.b;
......
......@@ -86,7 +86,7 @@ static void preview_update (GtkWidget *preview);
static gint quick_median_select (guchar **p,
guchar *i,
gint n);
static inline guchar pixel_intensity (const guchar *p,
static inline guchar pixel_luminance (const guchar *p,
gint bpp);
static inline void pixel_copy (guchar *dest,
const guchar *src,
......@@ -635,7 +635,7 @@ despeckle_median (guchar *src,
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)
{
......@@ -705,7 +705,7 @@ despeckle_median (guchar *src,
* Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5
* 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.
*/
static gint
......@@ -793,7 +793,7 @@ quick_median_select (guchar **p,
}
static inline guchar
pixel_intensity (const guchar *p,
pixel_luminance (const guchar *p,
gint bpp)
{
switch (bpp)
......@@ -804,7 +804,7 @@ pixel_intensity (const guchar *p,
case 3:
case 4:
return GIMP_RGB_INTENSITY (p[0], p[1], p[2]);
return GIMP_RGB_LUMINANCE (p[0], p[1], p[2]);
default:
return 0; /* should not be reached */
......
......@@ -31,7 +31,7 @@
* (http://ha1.seikyou.ne.jp/home/taka/gimp/displace/displace.html)
* Added ability to use transparency as the identity transformation
* (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
*
* Joao S. O. Bueno, Dec. 2004:
......@@ -175,7 +175,7 @@ query (void)
"Displace the contents of the specified drawable",
"Displaces the contents of the specified drawable "
"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' "
"drawables. If mode is polar coordinates"
"drawable is whirled and pinched according to map.",
......@@ -757,7 +757,7 @@ displace_map_give_value (guchar *pt,
gdouble ret, val_alpha;
if (bytes >= 3)
ret = GIMP_RGB_INTENSITY (pt[0], pt[1], pt[2]);
ret = GIMP_RGB_LUMINANCE (pt[0], pt[1], pt[2]);
else
ret = (gdouble) *pt;
......
......@@ -362,7 +362,7 @@ engrave_large (GimpDrawable *drawable,
if (bpp < 3)
inten = average[0] / 254.0 * height;
else
inten = GIMP_RGB_INTENSITY (average[0],
inten = GIMP_RGB_LUMINANCE (average[0],
average[1],
average[2]) / 254.0 * height;
......@@ -553,7 +553,7 @@ engrave_sub (gint height,
if (bpp < 3)
inten = average[0] / 254.0 * height;
else
inten = GIMP_RGB_INTENSITY (average[0],
inten = GIMP_RGB_LUMINANCE (average[0],
average[1],
average[2]) / 254.0 * height;
......
......@@ -27,14 +27,10 @@
#include "libgimp/stdplugins-intl.h"
#ifdef RCSID
static char rcsid[] = "$Id$";
#endif
/* Some useful macros */
#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
{
......@@ -331,7 +327,7 @@ get_samples_palette (GimpDrawable *drawable)
gimp_rgb_get_uchar (&color_sample,
b_samp, b_samp + 1, b_samp + 2);
else
*b_samp = gimp_rgb_intensity_uchar (&color_sample);
*b_samp = gimp_rgb_luminance_uchar (&color_sample);
if (has_alpha)
b_samp[alpha] = 255;
......
......@@ -354,9 +354,9 @@ grid (gint32 image_ID,
break;
case GIMP_GRAY:
hcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.hcolor);
vcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.vcolor);
icolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.icolor);
hcolor[0] = gimp_rgb_luminance_uchar (&grid_cfg.hcolor);
vcolor[0] = gimp_rgb_luminance_uchar (&grid_cfg.vcolor);
icolor[0] = gimp_rgb_luminance_uchar (&grid_cfg.icolor);
blend = TRUE;
break;
......
......@@ -662,7 +662,9 @@ mng_save_image (const gchar *filename,
gimp_context_get_background(&bgcolor);
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()");
mng_cleanup(&handle);
......@@ -671,7 +673,9 @@ mng_save_image (const gchar *filename,
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()");
mng_cleanup(&handle);
......
......@@ -89,7 +89,7 @@
#define CS_GREY 0
#define CS_RGB 1
#define CS_CMYK 2
#define CS_INTENSITY 3
#define CS_LUMINANCE 3
#define NUM_CS 4
#define VALID_CS(x) ((x) >= 0 && (x) <= NUM_CS-1)
......@@ -190,7 +190,7 @@ typedef struct
gint cell_width;
/* 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 */
/* grey screen (only used if greyscale drawable) */
......@@ -276,7 +276,7 @@ static const NewsprintValues factory_defaults =
10, /* cell width */
/* 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 */
/* grey/black */
......@@ -404,10 +404,10 @@ static const chan_tmpl cmyk_tmpl[] =
{ 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_spotfn,
&factory_defaults.gry_ang,
......@@ -424,7 +424,7 @@ static const chan_tmpl *cspace_chan_tmpl[] =
grey_tmpl,
rgb_tmpl,
cmyk_tmpl,
intensity_tmpl
luminance_tmpl
};
#define NCHANS(x) ((sizeof(x) / sizeof(chan_tmpl)) - 1)
......@@ -437,7 +437,7 @@ static const gint cspace_nchans[] =
NCHANS (grey_tmpl),
NCHANS (rgb_tmpl),
NCHANS (cmyk_tmpl),