plug-ins: port hot to GEGL, stupid 8-bit port only
(cherry picked from commit bad956cb1f
)
This commit is contained in:
@ -1491,6 +1491,7 @@ hot_LDADD = \
|
|||||||
$(libgimpcolor) \
|
$(libgimpcolor) \
|
||||||
$(libgimpbase) \
|
$(libgimpbase) \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
|
$(GEGL_LIBS) \
|
||||||
$(RT_LIBS) \
|
$(RT_LIBS) \
|
||||||
$(INTLLIBS) \
|
$(INTLLIBS) \
|
||||||
$(hot_RC)
|
$(hot_RC)
|
||||||
|
@ -237,6 +237,7 @@ run (const gchar *name,
|
|||||||
*retvals = rvals;
|
*retvals = rvals;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
gegl_init (NULL, NULL);
|
||||||
|
|
||||||
memset (&args, 0, sizeof (args));
|
memset (&args, 0, sizeof (args));
|
||||||
args.mode = -1;
|
args.mode = -1;
|
||||||
@ -306,13 +307,15 @@ run (const gchar *name,
|
|||||||
static gboolean
|
static gboolean
|
||||||
pluginCore (piArgs *argp)
|
pluginCore (piArgs *argp)
|
||||||
{
|
{
|
||||||
GimpDrawable *drw, *ndrw = NULL;
|
GeglBuffer *src_buffer;
|
||||||
GimpPixelRgn srcPr, dstPr;
|
GeglBuffer *dest_buffer;
|
||||||
|
const Babl *format;
|
||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
gint nl = 0;
|
gint nl = 0;
|
||||||
gint y, i;
|
gint y, i;
|
||||||
gint Y, I, Q;
|
gint Y, I, Q;
|
||||||
gint width, height, bpp;
|
gint width, height;
|
||||||
|
gint bpp;
|
||||||
gint sel_x1, sel_x2, sel_y1, sel_y2;
|
gint sel_x1, sel_x2, sel_y1, sel_y2;
|
||||||
gint prog_interval;
|
gint prog_interval;
|
||||||
guchar *src, *s, *dst, *d;
|
guchar *src, *s, *dst, *d;
|
||||||
@ -323,11 +326,15 @@ pluginCore (piArgs *argp)
|
|||||||
gdouble pr, pg, pb;
|
gdouble pr, pg, pb;
|
||||||
gdouble py;
|
gdouble py;
|
||||||
|
|
||||||
drw = gimp_drawable_get (argp->drawable);
|
width = gimp_drawable_width (argp->drawable);
|
||||||
|
height = gimp_drawable_height (argp->drawable);
|
||||||
|
|
||||||
width = drw->width;
|
if (gimp_drawable_has_alpha (argp->drawable))
|
||||||
height = drw->height;
|
format = babl_format ("R'G'B'A u8");
|
||||||
bpp = drw->bpp;
|
else
|
||||||
|
format = babl_format ("R'G'B' u8");
|
||||||
|
|
||||||
|
bpp = babl_format_get_bytes_per_pixel (format);
|
||||||
|
|
||||||
if (argp->new_layerp)
|
if (argp->new_layerp)
|
||||||
{
|
{
|
||||||
@ -352,12 +359,12 @@ pluginCore (piArgs *argp)
|
|||||||
GIMP_RGBA_IMAGE,
|
GIMP_RGBA_IMAGE,
|
||||||
100,
|
100,
|
||||||
gimp_image_get_default_new_layer_mode (argp->image));
|
gimp_image_get_default_new_layer_mode (argp->image));
|
||||||
ndrw = gimp_drawable_get (nl);
|
|
||||||
gimp_drawable_fill (nl, GIMP_FILL_TRANSPARENT);
|
gimp_drawable_fill (nl, GIMP_FILL_TRANSPARENT);
|
||||||
gimp_image_insert_layer (argp->image, nl, -1, 0);
|
gimp_image_insert_layer (argp->image, nl, -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! gimp_drawable_mask_intersect (drw->drawable_id,
|
if (! gimp_drawable_mask_intersect (argp->drawable,
|
||||||
&sel_x1, &sel_y1, &width, &height))
|
&sel_x1, &sel_y1, &width, &height))
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
@ -366,21 +373,22 @@ pluginCore (piArgs *argp)
|
|||||||
|
|
||||||
src = g_new (guchar, width * height * bpp);
|
src = g_new (guchar, width * height * bpp);
|
||||||
dst = g_new (guchar, width * height * 4);
|
dst = g_new (guchar, width * height * 4);
|
||||||
gimp_pixel_rgn_init (&srcPr, drw, sel_x1, sel_y1, width, height,
|
|
||||||
FALSE, FALSE);
|
src_buffer = gimp_drawable_get_buffer (argp->drawable);
|
||||||
|
|
||||||
if (argp->new_layerp)
|
if (argp->new_layerp)
|
||||||
{
|
{
|
||||||
gimp_pixel_rgn_init (&dstPr, ndrw, sel_x1, sel_y1, width, height,
|
dest_buffer = gimp_drawable_get_buffer (nl);
|
||||||
FALSE, FALSE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gimp_pixel_rgn_init (&dstPr, drw, sel_x1, sel_y1, width, height,
|
dest_buffer = gimp_drawable_get_shadow_buffer (argp->drawable);
|
||||||
TRUE, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_pixel_rgn_get_rect (&srcPr, src, sel_x1, sel_y1, width, height);
|
gegl_buffer_get (src_buffer,
|
||||||
|
GEGL_RECTANGLE (sel_x1, sel_y1, width, height), 1.0,
|
||||||
|
format, src,
|
||||||
|
GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
|
||||||
|
|
||||||
s = src;
|
s = src;
|
||||||
d = dst;
|
d = dst;
|
||||||
@ -551,23 +559,28 @@ pluginCore (piArgs *argp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gimp_progress_update (1.0);
|
|
||||||
|
|
||||||
gimp_pixel_rgn_set_rect (&dstPr, dst, sel_x1, sel_y1, width, height);
|
gegl_buffer_set (dest_buffer,
|
||||||
|
GEGL_RECTANGLE (sel_x1, sel_y1, width, height), 0,
|
||||||
|
format, dst,
|
||||||
|
GEGL_AUTO_ROWSTRIDE);
|
||||||
|
|
||||||
|
gimp_progress_update (1.0);
|
||||||
|
|
||||||
g_free (src);
|
g_free (src);
|
||||||
g_free (dst);
|
g_free (dst);
|
||||||
|
|
||||||
|
g_object_unref (src_buffer);
|
||||||
|
g_object_unref (dest_buffer);
|
||||||
|
|
||||||
if (argp->new_layerp)
|
if (argp->new_layerp)
|
||||||
{
|
{
|
||||||
gimp_drawable_flush (ndrw);
|
|
||||||
gimp_drawable_update (nl, sel_x1, sel_y1, width, height);
|
gimp_drawable_update (nl, sel_x1, sel_y1, width, height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gimp_drawable_flush (drw);
|
gimp_drawable_merge_shadow (argp->drawable, TRUE);
|
||||||
gimp_drawable_merge_shadow (drw->drawable_id, TRUE);
|
gimp_drawable_update (argp->drawable, sel_x1, sel_y1, width, height);
|
||||||
gimp_drawable_update (drw->drawable_id, sel_x1, sel_y1, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
'gradient-map' => { gegl => 1 },
|
'gradient-map' => { gegl => 1 },
|
||||||
'grid' => { ui => 1, gegl => 1 },
|
'grid' => { ui => 1, gegl => 1 },
|
||||||
'guillotine' => {},
|
'guillotine' => {},
|
||||||
'hot' => { ui => 1 },
|
'hot' => { ui => 1, gegl => 1 },
|
||||||
'jigsaw' => { ui => 1, gegl => 1 },
|
'jigsaw' => { ui => 1, gegl => 1 },
|
||||||
'mail' => { ui => 1, optional => 1 },
|
'mail' => { ui => 1, optional => 1 },
|
||||||
'max-rgb' => { ui => 1 },
|
'max-rgb' => { ui => 1 },
|
||||||
|
Reference in New Issue
Block a user