app: remove blend_region()
This commit is contained in:
@ -24,73 +24,6 @@
|
|||||||
#define __PAINT_FUNCS_GENERIC_H__
|
#define __PAINT_FUNCS_GENERIC_H__
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* blend_pixels patched 8-24-05 to fix bug #163721. Note that this change
|
|
||||||
* causes the function to treat src1 and src2 asymmetrically. This gives the
|
|
||||||
* right behavior for the smudge tool, which is the only user of this function
|
|
||||||
* at the time of patching. If you want to use the function for something
|
|
||||||
* else, caveat emptor.
|
|
||||||
*/
|
|
||||||
inline void
|
|
||||||
blend_pixels (const guchar *src1,
|
|
||||||
const guchar *src2,
|
|
||||||
guchar *dest,
|
|
||||||
guchar blend,
|
|
||||||
guint w,
|
|
||||||
guint bytes)
|
|
||||||
{
|
|
||||||
if (HAS_ALPHA (bytes))
|
|
||||||
{
|
|
||||||
const guint blend1 = 255 - blend;
|
|
||||||
const guint blend2 = blend + 1;
|
|
||||||
const guint c = bytes - 1;
|
|
||||||
|
|
||||||
while (w--)
|
|
||||||
{
|
|
||||||
const gint a1 = blend1 * src1[c];
|
|
||||||
const gint a2 = blend2 * src2[c];
|
|
||||||
const gint a = a1 + a2;
|
|
||||||
guint b;
|
|
||||||
|
|
||||||
if (!a)
|
|
||||||
{
|
|
||||||
for (b = 0; b < bytes; b++)
|
|
||||||
dest[b] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (b = 0; b < c; b++)
|
|
||||||
dest[b] =
|
|
||||||
src1[b] + (src1[b] * a1 + src2[b] * a2 - a * src1[b]) / a;
|
|
||||||
|
|
||||||
dest[c] = a >> 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
src1 += bytes;
|
|
||||||
src2 += bytes;
|
|
||||||
dest += bytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const guchar blend1 = 255 - blend;
|
|
||||||
|
|
||||||
while (w--)
|
|
||||||
{
|
|
||||||
guint b;
|
|
||||||
|
|
||||||
for (b = 0; b < bytes; b++)
|
|
||||||
dest[b] =
|
|
||||||
src1[b] + (src1[b] * blend1 + src2[b] * blend - src1[b] * 255) / 255;
|
|
||||||
|
|
||||||
src1 += bytes;
|
|
||||||
src2 += bytes;
|
|
||||||
dest += bytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
replace_pixels (const guchar *src1,
|
replace_pixels (const guchar *src1,
|
||||||
const guchar *src2,
|
const guchar *src2,
|
||||||
|
@ -1644,35 +1644,6 @@ color_erase_inten_pixels (const guchar *src1,
|
|||||||
/* REGION FUNCTIONS */
|
/* REGION FUNCTIONS */
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
|
|
||||||
void
|
|
||||||
blend_region (PixelRegion *src1,
|
|
||||||
PixelRegion *src2,
|
|
||||||
PixelRegion *dest,
|
|
||||||
guchar blend)
|
|
||||||
{
|
|
||||||
gpointer pr;
|
|
||||||
|
|
||||||
for (pr = pixel_regions_register (3, src1, src2, dest);
|
|
||||||
pr != NULL;
|
|
||||||
pr = pixel_regions_process (pr))
|
|
||||||
{
|
|
||||||
const guchar *s1 = src1->data;
|
|
||||||
const guchar *s2 = src2->data;
|
|
||||||
guchar *d = dest->data;
|
|
||||||
gint h = src1->h;
|
|
||||||
|
|
||||||
while (h --)
|
|
||||||
{
|
|
||||||
blend_pixels (s1, s2, d, blend, src1->w, src1->bytes);
|
|
||||||
|
|
||||||
s1 += src1->rowstride;
|
|
||||||
s2 += src2->rowstride;
|
|
||||||
d += dest->rowstride;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
convolve_region (PixelRegion *srcR,
|
convolve_region (PixelRegion *srcR,
|
||||||
PixelRegion *destR,
|
PixelRegion *destR,
|
||||||
|
@ -19,15 +19,6 @@
|
|||||||
#define __PAINT_FUNCS_H__
|
#define __PAINT_FUNCS_H__
|
||||||
|
|
||||||
|
|
||||||
/* Paint functions */
|
|
||||||
|
|
||||||
void blend_pixels (const guchar *src1,
|
|
||||||
const guchar *src2,
|
|
||||||
guchar *dest,
|
|
||||||
guchar blend,
|
|
||||||
guint w,
|
|
||||||
guint bytes);
|
|
||||||
|
|
||||||
/* apply the mask data to the alpha channel of the pixel data */
|
/* apply the mask data to the alpha channel of the pixel data */
|
||||||
void apply_mask_to_alpha_channel (guchar *src,
|
void apply_mask_to_alpha_channel (guchar *src,
|
||||||
const guchar *mask,
|
const guchar *mask,
|
||||||
@ -243,11 +234,6 @@ void paint_funcs_color_erase_helper (GimpRGB *src,
|
|||||||
|
|
||||||
/* Region functions */
|
/* Region functions */
|
||||||
|
|
||||||
void blend_region (PixelRegion *src1,
|
|
||||||
PixelRegion *src2,
|
|
||||||
PixelRegion *dest,
|
|
||||||
guchar blend);
|
|
||||||
|
|
||||||
void convolve_region (PixelRegion *srcR,
|
void convolve_region (PixelRegion *srcR,
|
||||||
PixelRegion *destR,
|
PixelRegion *destR,
|
||||||
const gfloat *matrix,
|
const gfloat *matrix,
|
||||||
|
Reference in New Issue
Block a user