remove unneccessary rgb_to_hsv and bugfiles

This commit is contained in:
Stanislav Brabec 2000-01-19 14:57:19 +00:00
parent b78467d93d
commit a270c0dc2d
13 changed files with 181 additions and 367 deletions

View File

@ -1,3 +1,27 @@
Wed Jan 19 12:50:55 CET 2000 Stanislav Brabec <utx@penguin.cz>
* plug-ins/gflare/gflare.c: Typo fix and typo update.
Wed Jan 19 11:00:19 CET 2000 Stanislav Brabec <utx@penguin.cz>
Applied patch from Martin Weber <martweb@gmx.net>:
* plug-ins/fp/fp_hsv.c removed
* plug-ins/fp/fp_hsv.h removed
* plug-ins/common/nova.c
* plug-ins/fp/Makefile.am
* plug-ins/fp/fp.c
* plug-ins/fp/fp_gdk.c
* plug-ins/fp/fp_gtk.c
* plug-ins/fp/fp_misc.c
* plug-ins/common/color_enhance.c: Removed unneccessary
rgb_to_hsv routines.
* plug-ins/gflare/gtkmultioptionmenu.c: Bugfix, not very
elegant but correct.
* plug-ins/common/sparkle.c: Bugfix.
* plug-ins/script-fu/scripts/frosty-logo.scm
* plug-ins/script-fu/scripts/t-o-p-logo.scm: Necessary for the
patched sparkle.
2000-01-19 David Monniaux <monniaux@quatramaran.ens.fr>
* plug-ins/gfig/gfig.c

View File

@ -4,7 +4,7 @@
* Copyright (C) 1999 Martin Weber
* Copyright (C) 1996 Federico Mena Quintero
*
* You can contact me at martin.weber@usa.net
* You can contact me at martweb@gmx.net
* You can contact the original The Gimp authors at gimp@xcf.berkeley.edu
*
* This program is free software; you can redistribute it and/or modify
@ -36,24 +36,20 @@
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#include "libgimp/gimpcolorspace.h"
/* Declare local functions.
*/
static void query (void);
static void run (char *name,
int nparams,
gint nparams,
GParam *param,
int *nreturn_vals,
gint *nreturn_vals,
GParam **return_vals);
static void Color_Enhance (GDrawable * drawable);
static void indexed_Color_Enhance (gint32 image_ID);
static void calc_rgb_to_hsv(gint r, gint g, gint b, double *h, double
*s, double *v);
static void calc_hsv_to_rgb(gint *r, gint *g, gint *b,
double h, double s, double v);
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
@ -75,8 +71,8 @@ query (void)
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
static gint nargs = sizeof (args) / sizeof (args[0]);
static gint nreturn_vals = 0;
INIT_I18N();
@ -96,9 +92,9 @@ query (void)
static void
run (char *name,
int nparams,
gint nparams,
GParam *param,
int *nreturn_vals,
gint *nreturn_vals,
GParam **return_vals)
{
static GParam values[1];
@ -155,7 +151,7 @@ indexed_Color_Enhance(gint32 image_ID) /* a.d.m. */
guchar *cmap;
gint ncols,i;
double vhi = 0.0, vlo = 1.0;
gdouble vhi = 0.0, vlo = 1.0;
cmap = gimp_image_get_cmap (image_ID, &ncols);
@ -168,34 +164,47 @@ indexed_Color_Enhance(gint32 image_ID) /* a.d.m. */
for (i=0;i<ncols;i++)
{
double h, s, v;
double c, m, y;
double k;
gint c, m, y;
gdouble k;
guchar map[3];
c = 255 - cmap[i*3+0];
m = 255 - cmap[i*3+1];
y = 255 - cmap[i*3+2];
k = c;
if (m < k) k = m;
if (y < k) k = y;
calc_rgb_to_hsv(c - k, m - k, y - k, &h, &s, &v);
map[0] = c - k;
map[1] = m - k;
map[2] = y - k;
gimp_rgb_to_hsv4(map, &h, &s, &v);
if (v > vhi) vhi = v;
if (v < vlo) vlo = v;
}
for (i=0;i<ncols;i++)
{
double h, s, v;
gdouble h, s, v;
gint c, m, y;
double k;
gdouble k;
guchar map[3];
c = 255 - cmap[i*3+0];
m = 255 - cmap[i*3+1];
y = 255 - cmap[i*3+2];
k = c;
if (m < k) k = m;
if (y < k) k = y;
calc_rgb_to_hsv(c - k, m - k, y - k, &h, &s, &v);
map[0] = c - k;
map[1] = m - k;
map[2] = y - k;
gimp_rgb_to_hsv4(map, &h, &s, &v);
if (vhi!=vlo)
v = (v-vlo) / (vhi-vlo);
calc_hsv_to_rgb(&c, &m, &y, h, s, v);
gimp_hsv_to_rgb4(map, h, s, v);
c = map[0];
m = map[1];
y = map[2];
c += k;
if (c > 255) c = 255;
m += k;
@ -217,7 +226,7 @@ Color_Enhance (GDrawable *drawable)
GPixelRgn src_rgn, dest_rgn;
guchar *src, *s;
guchar *dest, *d;
double vhi = 0.0, vlo = 1.0;
gdouble vhi = 0.0, vlo = 1.0;
gint progress, max_progress;
gint has_alpha, alpha;
gint x1, y1, x2, y2;
@ -246,16 +255,21 @@ Color_Enhance (GDrawable *drawable)
{
if (!has_alpha || (has_alpha && s[alpha]))
{
double h, z, v;
double c, m, y;
double k;
gdouble h, z, v;
gint c, m, y;
gdouble k;
guchar map[3];
c = 255 - s[0];
m = 255 - s[1];
y = 255 - s[2];
k = c;
if (m < k) k = m;
if (y < k) k = y;
calc_rgb_to_hsv(c - k, m - k, y - k, &h, &z, &v);
map[0] = c - k;
map[1] = m - k;
map[2] = y - k;
gimp_rgb_to_hsv4(map, &h, &z, &v);
if (v > vhi) vhi = v;
if (v < vlo) vlo = v;
}
@ -269,7 +283,7 @@ Color_Enhance (GDrawable *drawable)
/* Update progress */
progress += src_rgn.w * src_rgn.h;
gimp_progress_update ((double) progress / (double) max_progress);
gimp_progress_update ((gdouble) progress / (gdouble) max_progress);
}
/* Now substitute pixel vales */
@ -288,19 +302,27 @@ Color_Enhance (GDrawable *drawable)
for (x = 0; x < src_rgn.w; x++)
{
double h, z, v;
gdouble h, z, v;
gint c, m, y;
double k;
gdouble k;
guchar map[3];
c = 255 - s[0];
m = 255 - s[1];
y = 255 - s[2];
k = c;
if (m < k) k = m;
if (y < k) k = y;
calc_rgb_to_hsv(c - k, m - k, y - k, &h, &z, &v);
map[0] = c - k;
map[1] = m - k;
map[2] = y - k;
gimp_rgb_to_hsv4(map, &h, &z, &v);
if (vhi!=vlo)
v = (v-vlo) / (vhi-vlo);
calc_hsv_to_rgb(&c, &m , &y, h, z, v);
gimp_hsv_to_rgb4(map, h, z, v);
c = map[0];
m = map[1];
y = map[2];
c += k;
if (c > 255) c = 255;
m += k;
@ -326,7 +348,7 @@ Color_Enhance (GDrawable *drawable)
/* Update progress */
progress += src_rgn.w * src_rgn.h;
gimp_progress_update ((double) progress / (double) max_progress);
gimp_progress_update ((gdouble) progress / (gdouble) max_progress);
}
/* update the region */
@ -334,148 +356,3 @@ Color_Enhance (GDrawable *drawable)
gimp_drawable_merge_shadow (drawable->id, TRUE);
gimp_drawable_update (drawable->id, x1, y1, (x2 - x1), (y2 - y1));
}
static void
calc_rgb_to_hsv(gint r, gint g, gint b, double *hue, double *sat, double
*val) {
double red, green, blue;
double h, s, v;
double min, max;
double delta;
red = (double)r / 255.0;
green = (double)g / 255.0;
blue = (double)b / 255.0;
h = 0.0; /* Shut up -Wall */
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
if (green < blue)
min = green;
else
min = blue;
}
else
{
if (green > blue)
max = green;
else
max = blue;
if (red < blue)
min = red;
else
min = blue;
}
v = max;
if (max != 0.0)
s = (max - min) / max;
else
s = 0.0;
if (s == 0.0)
h = 0.0;
else
{
delta = max - min;
if (red == max)
h = (green - blue) / delta;
else if (green == max)
h = 2 + (blue - red) / delta;
else if (blue == max)
h = 4 + (red - green) / delta;
h /= 6.0;
if (h < 0.0)
h += 1.0;
else if (h > 1.0)
h -= 1.0;
}
*hue = h;
*sat = s;
*val = v;
}
static void
calc_hsv_to_rgb(gint *r, gint *g, gint *b, double h, double s, double
v) {
double hue, saturation, value;
double f, p, q, t;
if (s == 0.0)
{
h = v;
s = v;
v = v; /* heh */
}
else
{
hue = h * 6.0;
saturation = s;
value = v;
if (hue == 6.0)
hue = 0.0;
f = hue - (int) hue;
p = value * (1.0 - saturation);
q = value * (1.0 - saturation * f);
t = value * (1.0 - saturation * (1.0 - f));
switch ((int) hue)
{
case 0:
h = value;
s = t;
v = p;
break;
case 1:
h = q;
s = value;
v = p;
break;
case 2:
h = p;
s = value;
v = t;
break;
case 3:
h = p;
s = q;
v = value;
break;
case 4:
h = t;
s = p;
v = value;
break;
case 5:
h = value;
s = p;
v = q;
break;
}
}
*r = h*255;
*g = s*255;
*b = v*255;
}

View File

@ -27,10 +27,10 @@
#include "config.h"
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpcolorspace.h"
#include "libgimp/stdplugins-intl.h"
#include "fp.h"
#include "fp_hsv.h"
FP_Params Current =
{
@ -162,8 +162,10 @@ fp_row (const guchar *src_row,
backupP[0] = P[1] = src_row[col*bytes+1];
backupP[0] = P[2] = src_row[col*bytes+2];
rgb_to_hsv(P[0]/255.0, P[1]/255.0, P[2]/255.0, &H, &S, &V);
H = P[0]/255.0;
S = P[1]/255.0;
V = P[2]/255.0;
gimp_rgb_to_hsv_double(&H, &S, &V);
for (JudgeBy=BY_HUE; JudgeBy<JUDGE_BY; JudgeBy++) {
if (!Current.Touched[JudgeBy]) continue;

View File

@ -67,6 +67,7 @@
#include <libgimp/gimpui.h>
#include <libgimp/gimpmath.h>
#include <libgimp/gimplimits.h>
#include <libgimp/gimpcolorspace.h>
#include "libgimp/stdplugins-intl.h"
@ -163,12 +164,6 @@ static gint nova_center_preview_events (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void rgb_to_hsl (gdouble r, gdouble g, gdouble b,
gdouble *h, gdouble *s, gdouble *l);
static void hsl_to_rgb (gdouble h, gdouble s, gdouble l,
gdouble *r, gdouble *g, gdouble *b);
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
@ -919,11 +914,11 @@ nova (GDrawable *drawable)
gdouble new_alpha;
gdouble compl_ratio;
gdouble ratio;
gdouble r, g, b, h, s, lu;
gdouble h, s;
gdouble spokecol;
gint i, j;
gint color[4];
gint *spokecolor;
guchar *spokecolor;
/* initialize */
@ -931,12 +926,9 @@ nova (GDrawable *drawable)
srand (time (NULL));
spoke = g_new (gdouble, pvals.nspoke);
spokecolor = g_new (gint, 3 * pvals.nspoke);
spokecolor = g_new (guchar, 3 * pvals.nspoke);
rgb_to_hsl (pvals.color[0] / 255.0,
pvals.color[1] / 255.0,
pvals.color[2]/255.0,
&h, &s, &lu);
gimp_rgb_to_hsv4 (pvals.color, &h, &s, &v);
for (i = 0; i < pvals.nspoke; i++)
{
@ -947,10 +939,7 @@ nova (GDrawable *drawable)
h += 1.0;
else if (h >= 1.0)
h -= 1.0;
hsl_to_rgb (h, s, lu, &r, &g, &b);
spokecolor[3*i+0] = 255.0 * r;
spokecolor[3*i+1] = 255.0 * g;
spokecolor[3*i+2] = 255.0 * b;
gimp_hsv_to_rgb4 (&spokecolor[3*i], h, s, v);
}
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
@ -1052,108 +1041,3 @@ nova (GDrawable *drawable)
g_free(spoke);
g_free(spokecolor);
}
/*
* RGB-HSL transforms.
* Ken Fishkin, Pixar Inc., January 1989.
*/
/*
* given r,g,b on [0 ... 1],
* return (h,s,l) on [0 ... 1]
*/
static void
rgb_to_hsl (gdouble r,
gdouble g,
gdouble b,
gdouble *h,
gdouble *s,
gdouble *l)
{
gdouble v;
gdouble m;
gdouble vm;
gdouble r2, g2, b2;
v = MAX(r,g);
v = MAX(v,b);
m = MIN(r,g);
m = MIN(m,b);
if ((*l = (m + v) / 2.0) <= 0.0)
return;
if ((*s = vm = v - m) > 0.0)
{
*s /= (*l <= 0.5) ? (v + m) : (2.0 - v - m) ;
}
else
return;
r2 = (v - r) / vm;
g2 = (v - g) / vm;
b2 = (v - b) / vm;
if (r == v)
*h = (g == m ? 5.0 + b2 : 1.0 - g2);
else if (g == v)
*h = (b == m ? 1.0 + r2 : 3.0 - b2);
else
*h = (r == m ? 3.0 + g2 : 5.0 - r2);
*h /= 6;
}
/*
* given h,s,l on [0..1],
* return r,g,b on [0..1]
*/
static void
hsl_to_rgb (gdouble h,
gdouble sl,
gdouble l,
gdouble *r,
gdouble *g,
gdouble *b)
{
gdouble v;
v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl);
if (v <= 0)
{
*r = *g = *b = 0.0;
}
else
{
gdouble m;
gdouble sv;
gint sextant;
gdouble fract, vsf, mid1, mid2;
m = l + l - v;
sv = (v - m) / v;
h *= 6.0;
sextant = h;
fract = h - sextant;
vsf = v * sv * fract;
mid1 = m + vsf;
mid2 = v - vsf;
switch (sextant)
{
case 0: *r = v; *g = mid1; *b = m; break;
case 1: *r = mid2; *g = v; *b = m; break;
case 2: *r = m; *g = v; *b = mid1; break;
case 3: *r = m; *g = mid2; *b = v; break;
case 4: *r = mid1; *g = m; *b = v; break;
case 5: *r = v; *g = m; *b = mid2; break;
}
}
}

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* You can contact Michael at mjhammel@csn.net
* You can contact Martin at martin.weber@usa.net
* You can contact Martin at martweb@gmx.net
* Note: set tabstops to 3 to make this more readable.
*/
@ -45,7 +45,6 @@
#define MAX_CHANNELS 4
#define PSV 2 /* point spread value */
#define EPSILON 0.001
#define SQR(a) ((a) * (a))
#define NATURAL 0
#define FOREGROUND 1
@ -94,14 +93,15 @@ static gint compute_lum_threshold (GDrawable * drawable,
gdouble percentile);
static void sparkle (GDrawable * drawable,
gint threshold);
static void fspike (GPixelRgn * dest_rgn,
static void fspike (GPixelRgn * src_rgn,
GPixelRgn * dest_rgn,
gint gray,
gint x1,
gint y1,
gint x2,
gint y2,
gdouble xr,
gdouble yr,
gint xr,
gint yr,
gint tile_width,
gint tile_height,
gdouble inten,
@ -139,7 +139,7 @@ static SparkleVals svals =
4.0, /* spike points */
15.0, /* spike angle */
1.0, /* spike density */
1.0, /* opacity */
0.0, /* opacity */
0.0, /* random hue */
0.0, /* random saturation */
FALSE, /* preserve_luminosity */
@ -665,7 +665,7 @@ compute_lum_threshold (GDrawable *drawable,
for (i = 255; i >= 0; i--)
{
sum += values[i];
if ((gdouble) sum / (gdouble) total > percentile)
if ((gdouble) sum > percentile * (gdouble) total)
{
num_sparkles = sum;
return i;
@ -759,7 +759,7 @@ sparkle (GDrawable *drawable,
{
nfrac = fabs ((gdouble) (lum + 1 - threshold) / (gdouble) (256 - threshold));
length = (gdouble) svals.spike_len * (gdouble) pow (nfrac, 0.8);
inten = svals.flare_inten * pow (nfrac, 1.0);
inten = svals.flare_inten * nfrac /* pow (nfrac, 1.0) */;
/* fspike im x,y intens rlength angle */
if (svals.spike_pts > 0)
@ -771,12 +771,12 @@ sparkle (GDrawable *drawable,
spike_angle = svals.spike_angle;
if (rand() <= RAND_MAX * svals.density)
{
fspike (&dest_rgn, gray, x1, y1, x2, y2,
fspike (&src_rgn, &dest_rgn, gray, x1, y1, x2, y2,
x + src_rgn.x, y + src_rgn.y,
tile_width, tile_height,
inten, length, spike_angle);
/* minor spikes */
fspike (&dest_rgn, gray, x1, y1, x2, y2,
fspike (&src_rgn, &dest_rgn, gray, x1, y1, x2, y2,
x + src_rgn.x, y + src_rgn.y,
tile_width, tile_height,
inten * 0.7, length * 0.7,
@ -855,22 +855,22 @@ rpnt (GDrawable *drawable,
else
new = 255 - pixel[b];
if (svals.preserve_luminosity==TRUE)
{
if (new < color[b])
new *= (1.0 - val * svals.opacity);
else
{
new -= val * color[b] * svals.opacity;
if (new < 0.0)
new = 0.0;
if (svals.preserve_luminosity==TRUE)
{
if (new < color[b])
new *= (1.0 - val * (1.0 - svals.opacity));
else
{
new -= val * color[b] * (1.0 - svals.opacity);
if (new < 0.0)
new = 0.0;
}
}
new *= 1.0 - val * (1.0 - svals.opacity);
new += val * color[b];
}
}
new *= 1.0 - val * svals.opacity;
new += val * color[b];
if (new > 255) new = 255;
if (new > 255) new = 255;
if (svals.invers != FALSE)
pixel[b] = 255 - new;
@ -883,14 +883,15 @@ rpnt (GDrawable *drawable,
}
static void
fspike (GPixelRgn *dest_rgn,
fspike (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn,
gint gray,
gint x1,
gint y1,
gint x2,
gint y2,
gdouble xr,
gdouble yr,
gint xr,
gint yr,
gint tile_width,
gint tile_height,
gdouble inten,
@ -908,7 +909,6 @@ fspike (GPixelRgn *dest_rgn,
gint row, col;
gint i;
gint bytes;
gint x, y;
gint ok;
guchar pixel[MAX_CHANNELS];
guchar color[MAX_CHANNELS];
@ -921,10 +921,7 @@ fspike (GPixelRgn *dest_rgn,
/* draw the major spikes */
for (i = 0; i < svals.spike_pts; i++)
{
x = (int) (xr + 0.5);
y = (int) (yr + 0.5);
gimp_pixel_rgn_get_pixel (dest_rgn, pixel, x, y);
gimp_pixel_rgn_get_pixel (dest_rgn, pixel, xr, yr);
switch (svals.colortype)
{
@ -951,27 +948,27 @@ fspike (GPixelRgn *dest_rgn,
}
if (svals.random_hue > 0.0 || svals.random_saturation > 0.0)
{
r = color[0];
g = color[1];
b = color[2];
gimp_rgb_to_hls(&r, &g, &b);
r+= (svals.random_hue * ((gdouble) rand() / (gdouble) RAND_MAX - 0.5))*255;
if (r >= 255.0)
r -= 255.0;
else if (r < 0)
r += 255.0;
b+= (svals.random_saturation * (2 * (gdouble) rand() / (gdouble) RAND_MAX - 1.0))*255;
if (b > 1.0) b = 1.0;
gimp_hls_to_rgb(&r, &g, &b);
color[0] = r;
color[1] = g;
color[2] = b;
r = 255 - color[0];
g = 255 - color[1];
b = 255 - color[2];
gimp_rgb_to_hsv(&r, &g, &b);
r+= (svals.random_hue * ((gdouble) rand() / (gdouble) RAND_MAX - 0.5))*255;
if (r >= 255)
r -= 255;
else if (r < 0)
r += 255;
b+= (svals.random_saturation * (2.0 * (gdouble) rand() /
(gdouble) RAND_MAX - 1.0))*255; if (b > 255) b = 255;
gimp_hsv_to_rgb(&r, &g, &b);
color[0] = 255 - r;
color[1] = 255 - g;
color[2] = 255 - b;
}
dx = 0.2 * cos (theta * G_PI / 180.0);
dy = 0.2 * sin (theta * G_PI / 180.0);
xrt = xr;
yrt = yr;
xrt = (gdouble) xr; /* (gdouble) is needed because some */
yrt = (gdouble) yr; /* compilers optimize too much otherwise */
rpos = 0.2;
do
@ -984,9 +981,9 @@ fspike (GPixelRgn *dest_rgn,
ok = TRUE;
tile = rpnt (dest_rgn->drawable, tile, x1, y1, x2, y2, xrt, yrt, tile_width, tile_height, &row, &col, bytes, in, color);
tile = rpnt (dest_rgn->drawable, tile, x1, y1, x2, y2, xrt + 1, yrt, tile_width, tile_height, &row, &col, bytes, in, color);
tile = rpnt (dest_rgn->drawable, tile, x1, y1, x2, y2, xrt + 1, yrt + 1, tile_width, tile_height, &row, &col, bytes, in, color);
tile = rpnt (dest_rgn->drawable, tile, x1, y1, x2, y2, xrt, yrt + 1, tile_width, tile_height, &row, &col, bytes, in, color);
tile = rpnt (dest_rgn->drawable, tile, x1, y1, x2, y2, xrt + 1.0, yrt, tile_width, tile_height, &row, &col, bytes, in, color);
tile = rpnt (dest_rgn->drawable, tile, x1, y1, x2, y2, xrt + 1.0, yrt + 1.0, tile_width, tile_height, &row, &col, bytes, in, color);
tile = rpnt (dest_rgn->drawable, tile, x1, y1, x2, y2, xrt, yrt + 1.0, tile_width, tile_height, &row, &col, bytes, in, color);
xrt += dx;
yrt += dy;

View File

@ -9,8 +9,6 @@ fp_SOURCES = \
fp.h \
fp_gdk.c \
fp_gtk.c \
fp_hsv.c \
fp_hsv.h \
fp_misc.c
AM_CPPFLAGS = \

View File

@ -27,10 +27,10 @@
#include "config.h"
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpcolorspace.h"
#include "libgimp/stdplugins-intl.h"
#include "fp.h"
#include "fp_hsv.h"
FP_Params Current =
{
@ -162,8 +162,10 @@ fp_row (const guchar *src_row,
backupP[0] = P[1] = src_row[col*bytes+1];
backupP[0] = P[2] = src_row[col*bytes+2];
rgb_to_hsv(P[0]/255.0, P[1]/255.0, P[2]/255.0, &H, &S, &V);
H = P[0]/255.0;
S = P[1]/255.0;
V = P[2]/255.0;
gimp_rgb_to_hsv_double(&H, &S, &V);
for (JudgeBy=BY_HUE; JudgeBy<JUDGE_BY; JudgeBy++) {
if (!Current.Touched[JudgeBy]) continue;

View File

@ -4,7 +4,6 @@
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "fp.h"
#include "fp_hsv.h"
extern AdvancedWindow AW;
extern FP_Params Current;

View File

@ -13,7 +13,6 @@
#include "libgimp/stdplugins-intl.h"
#include "fp.h"
#include "fp_hsv.h"
AdvancedWindow AW = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };

View File

@ -3,8 +3,8 @@
#include <math.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpcolorspace.h"
#include "fp.h"
#include "fp_hsv.h"
extern FP_Params Current;
@ -108,7 +108,10 @@ ReducedImage *Reduce_The_Image(GDrawable *drawable,
G=src_row[whichcol*bytes+1];
B=src_row[whichcol*bytes+2];
rgb_to_hsv(R/255.0,G/255.0,B/255.0,&H,&S,&V);
H = R/255.0;
S = G/255.0;
V = B/255.0;
gimp_rgb_to_hsv_double(&H,&S,&V);
tempRGB[i*RW*bytes+j*bytes+0]=R;
tempRGB[i*RW*bytes+j*bytes+1]=G;
@ -351,13 +354,19 @@ fp_range_preview_spill(GtkWidget *preview, int type)
data[3*j+2]=j-Current.Offset;
break;
case BY_HUE:
hsv_to_rgb((hsv)((j-Current.Offset+256)%256)/255.0, 1.0, .5, &R, &G, &B);
R = (hsv)((j-Current.Offset+256)%256)/255.0;
G = 1.0;
B = .5;
gimp_hsv_to_rgb_double(&R, &G, &B);
data[3*j+0]=R*255;
data[3*j+1]=G*255;
data[3*j+2]=B*255;
break;
case BY_SAT:
hsv_to_rgb(.5,(hsv)((j-(gint)Current.Offset+256)%256)/255.0,.5,&R,&G,&B);
R = .5;
G = (hsv)((j-(gint)Current.Offset+256)%256)/255.0;
B = .5;
gimp_hsv_to_rgb_double(&R,&G,&B);
data[3*j+0]=R*255;
data[3*j+1]=G*255;
data[3*j+2]=B*255;

View File

@ -280,6 +280,8 @@ gtk_multi_option_menu_size_allocate (GtkWidget *widget,
{
GtkWidget *child;
GtkAllocation child_allocation;
GtkMultiOptionMenu *multi_option_menu;
gint tmp;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (widget));
@ -294,6 +296,27 @@ gtk_multi_option_menu_size_allocate (GtkWidget *widget,
child = GTK_BUTTON (widget)->child;
if (child && GTK_WIDGET_VISIBLE (child))
{
if ((allocation->width <= 1) && (allocation->height <= 1))
{
multi_option_menu = GTK_MULTI_OPTION_MENU (widget);
allocation->width = ((GTK_CONTAINER (widget)->border_width +
GTK_WIDGET (widget)->style->klass->xthickness) * 2 +
multi_option_menu->width +
MULTI_OPTION_INDICATOR_WIDTH +
MULTI_OPTION_INDICATOR_SPACING * 5 +
CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING);
allocation->height = ((GTK_CONTAINER (widget)->border_width +
GTK_WIDGET (widget)->style->klass->ythickness) * 2 +
multi_option_menu->height +
CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING);
tmp = (allocation->height - multi_option_menu->height +
MULTI_OPTION_INDICATOR_HEIGHT +
MULTI_OPTION_INDICATOR_SPACING * 2);
allocation->height = MAX (allocation->height, tmp);
}
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
GTK_WIDGET (widget)->style->klass->xthickness);
child_allocation.y = (GTK_CONTAINER (widget)->border_width +

View File

@ -38,7 +38,7 @@
(plug-in-noisify 1 img sparkle-layer FALSE 0.2 0.2 0.2 0.0)
(plug-in-c-astretch 1 img sparkle-layer)
(gimp-selection-none img)
(plug-in-sparkle 1 img sparkle-layer 0.03 0.45 (/ (min width height) 2) 6 15 1.0 1.0 0.0 0.0 FALSE FALSE FALSE 0)
(plug-in-sparkle 1 img sparkle-layer 0.03 0.5 (/ (min width height) 2) 6 15 1.0 0.0 0.0 0.0 FALSE FALSE FALSE 0)
(gimp-levels sparkle-layer 1 0 255 0.2 0 255)
(gimp-levels sparkle-layer 2 0 255 0.7 0 255)
(gimp-selection-layer-alpha sparkle-layer)

View File

@ -38,7 +38,7 @@
(gimp-selection-border img edge-size)
(plug-in-noisify 1 img sparkle-layer FALSE hit-rate hit-rate hit-rate 0.0)
(gimp-selection-none img)
(plug-in-sparkle 1 img sparkle-layer 0.03 0.45 width 6 15 1.0 1.0 0.0 0.0 FALSE FALSE FALSE 0)
(plug-in-sparkle 1 img sparkle-layer 0.03 0.49 width 6 15 1.0 0.0 0.0 0.0 FALSE FALSE FALSE 0)
(gimp-selection-load selection)
(gimp-selection-shrink img edge-size)
(gimp-levels sparkle-layer 0 0 255 1.2 0 255)