mirror of https://github.com/GNOME/gimp.git
app: remove extract_from_region() and its helper functions
This commit is contained in:
parent
f45df7fe35
commit
bc75626d99
|
@ -1639,97 +1639,6 @@ color_erase_inten_pixels (const guchar *src1,
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
extract_from_inten_pixels (guchar *src,
|
||||
guchar *dest,
|
||||
const guchar *mask,
|
||||
const guchar *bg,
|
||||
gboolean cut,
|
||||
guint length,
|
||||
guint src_bytes,
|
||||
guint dest_bytes)
|
||||
{
|
||||
const gint alpha = HAS_ALPHA (src_bytes) ? src_bytes - 1 : src_bytes;
|
||||
const guchar *m = mask ? mask : &no_mask;
|
||||
gint b;
|
||||
gint tmp;
|
||||
|
||||
while (length --)
|
||||
{
|
||||
for (b = 0; b < alpha; b++)
|
||||
dest[b] = src[b];
|
||||
|
||||
if (HAS_ALPHA (src_bytes))
|
||||
{
|
||||
dest[alpha] = INT_MULT (*m, src[alpha], tmp);
|
||||
if (cut)
|
||||
src[alpha] = INT_MULT ((255 - *m), src[alpha], tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HAS_ALPHA (dest_bytes))
|
||||
dest[alpha] = *m;
|
||||
|
||||
if (cut)
|
||||
for (b = 0; b < src_bytes; b++)
|
||||
src[b] = INT_BLEND (bg[b], src[b], *m, tmp);
|
||||
}
|
||||
|
||||
if (mask)
|
||||
m++;
|
||||
|
||||
src += src_bytes;
|
||||
dest += dest_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
extract_from_indexed_pixels (guchar *src,
|
||||
guchar *dest,
|
||||
const guchar *mask,
|
||||
const guchar *cmap,
|
||||
const guchar *bg,
|
||||
gboolean cut,
|
||||
guint length,
|
||||
guint src_bytes,
|
||||
guint dest_bytes)
|
||||
{
|
||||
const guchar *m = mask ? mask : &no_mask;
|
||||
gint b;
|
||||
gint t;
|
||||
|
||||
while (length --)
|
||||
{
|
||||
gint index = src[0] * 3;
|
||||
|
||||
for (b = 0; b < 3; b++)
|
||||
dest[b] = cmap[index + b];
|
||||
|
||||
if (HAS_ALPHA (src_bytes))
|
||||
{
|
||||
dest[3] = INT_MULT (*m, src[1], t);
|
||||
if (cut)
|
||||
src[1] = INT_MULT ((255 - *m), src[1], t);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HAS_ALPHA (dest_bytes))
|
||||
dest[3] = *m;
|
||||
|
||||
if (cut)
|
||||
src[0] = (*m > 127) ? bg[0] : src[0];
|
||||
}
|
||||
|
||||
if (mask)
|
||||
m++;
|
||||
|
||||
src += src_bytes;
|
||||
dest += dest_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
/* REGION FUNCTIONS */
|
||||
/**************************************************/
|
||||
|
@ -1862,51 +1771,6 @@ add_alpha_region (PixelRegion *src,
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
extract_from_region (PixelRegion *src,
|
||||
PixelRegion *dest,
|
||||
PixelRegion *mask,
|
||||
const guchar *cmap,
|
||||
const guchar *bg,
|
||||
GimpImageBaseType type,
|
||||
gboolean cut)
|
||||
{
|
||||
gpointer pr;
|
||||
|
||||
for (pr = pixel_regions_register (3, src, dest, mask);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
const guchar *m = mask ? mask->data : NULL;
|
||||
guchar *s = src->data;
|
||||
guchar *d = dest->data;
|
||||
gint h = src->h;
|
||||
|
||||
while (h --)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GIMP_RGB:
|
||||
case GIMP_GRAY:
|
||||
extract_from_inten_pixels (s, d, m, bg, cut, src->w,
|
||||
src->bytes, dest->bytes);
|
||||
break;
|
||||
|
||||
case GIMP_INDEXED:
|
||||
extract_from_indexed_pixels (s, d, m, cmap, bg, cut, src->w,
|
||||
src->bytes, dest->bytes);
|
||||
break;
|
||||
}
|
||||
|
||||
s += src->rowstride;
|
||||
d += dest->rowstride;
|
||||
if (mask)
|
||||
m += mask->rowstride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
convolve_region (PixelRegion *srcR,
|
||||
PixelRegion *destR,
|
||||
|
|
|
@ -273,32 +273,6 @@ void paint_funcs_color_erase_helper (GimpRGB *src,
|
|||
const GimpRGB *color);
|
||||
|
||||
|
||||
/* extract information from intensity pixels based on
|
||||
* a mask.
|
||||
*/
|
||||
void extract_from_inten_pixels (guchar *src,
|
||||
guchar *dest,
|
||||
const guchar *mask,
|
||||
const guchar *bg,
|
||||
gboolean cut,
|
||||
guint length,
|
||||
guint src_bytes,
|
||||
guint dest_bytes);
|
||||
|
||||
/* extract information from indexed pixels based on
|
||||
* a mask.
|
||||
*/
|
||||
void extract_from_indexed_pixels (guchar *src,
|
||||
guchar *dest,
|
||||
const guchar *mask,
|
||||
const guchar *cmap,
|
||||
const guchar *bg,
|
||||
gboolean cut,
|
||||
guint length,
|
||||
guint src_bytes,
|
||||
guint dest_bytes);
|
||||
|
||||
|
||||
/* Region functions */
|
||||
|
||||
void color_region (PixelRegion *dest,
|
||||
|
@ -319,14 +293,6 @@ void extract_alpha_region (PixelRegion *src,
|
|||
PixelRegion *mask,
|
||||
PixelRegion *dest);
|
||||
|
||||
void extract_from_region (PixelRegion *src,
|
||||
PixelRegion *dest,
|
||||
PixelRegion *mask,
|
||||
const guchar *cmap,
|
||||
const guchar *bg,
|
||||
GimpImageBaseType type,
|
||||
gboolean cut);
|
||||
|
||||
void convolve_region (PixelRegion *srcR,
|
||||
PixelRegion *destR,
|
||||
const gfloat *matrix,
|
||||
|
|
Loading…
Reference in New Issue