_blurrow (guchar* pixels,
gint width,
gint height,
+ gint rowstride,
gint channels,
gint line,
gint alpha,
gint index;
guchar* scanline;
- scanline = &(pixels[line * width * channels]);
+ scanline = &pixels[line * rowstride];
zR = *scanline << zprec;
zG = *(scanline + 1) << zprec;
_blurcol (guchar* pixels,
gint width,
gint height,
+ gint rowstride,
gint channels,
gint x,
gint alpha,
zB = *((guchar*) ptr + 2) << zprec;
zA = *((guchar*) ptr + 3) << zprec;
- for (index = width; index < (height - 1) * width; index += width)
- _blurinner ((guchar*) &ptr[index * channels],
+ for (index = 0; index < height; index++)
+ _blurinner (&ptr[index * rowstride],
&zR,
&zG,
&zB,
aprec,
zprec);
- for (index = (height - 2) * width; index >= 0; index -= width)
- _blurinner ((guchar*) &ptr[index * channels],
+ for (index = height - 2; index >= 0; index--)
+ _blurinner (&ptr[index * rowstride],
&zR,
&zG,
&zB,
* @pixels: image data
* @width: image width
* @height: image height
+ * @rowstride: image rowstride
* @channels: image channels
* @radius: kernel radius
* @aprec: precision of alpha parameter in fixed-point format 0.aprec
_expblur (guchar* pixels,
gint width,
gint height,
+ gint rowstride,
gint channels,
double radius,
gint aprec,
_blurrow (pixels,
width,
height,
+ rowstride,
channels,
row,
alpha,
_blurcol (pixels,
width,
height,
+ rowstride,
channels,
col,
alpha,
double radius)
{
cairo_format_t format;
- guchar* pixels;
- guint width;
- guint height;
g_return_if_fail (surface != NULL);
g_return_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE);
format = cairo_image_surface_get_format (surface);
- g_return_if_fail (format == CAIRO_FORMAT_A8 ||
- format == CAIRO_FORMAT_RGB24 ||
+ g_return_if_fail (format == CAIRO_FORMAT_RGB24 ||
format == CAIRO_FORMAT_ARGB32);
if (radius == 0)
/* Before we mess with the surface execute any pending drawing. */
cairo_surface_flush (surface);
- pixels = cairo_image_surface_get_data (surface);
- width = cairo_image_surface_get_width (surface);
- height = cairo_image_surface_get_height (surface);
- format = cairo_image_surface_get_format (surface);
-
- switch (format)
- {
- case CAIRO_FORMAT_ARGB32:
- _expblur (pixels, width, height, 4, radius, 16, 7);
- break;
- case CAIRO_FORMAT_RGB24:
- _expblur (pixels, width, height, 3, radius, 16, 7);
- break;
- case CAIRO_FORMAT_A8:
- _expblur (pixels, width, height, 1, radius, 16, 7);
- break;
- default:
- break;
- }
+ _expblur (cairo_image_surface_get_data (surface),
+ cairo_image_surface_get_width (surface),
+ cairo_image_surface_get_height (surface),
+ cairo_image_surface_get_stride (surface),
+ 4,
+ radius,
+ 16,
+ 7);
/* Inform cairo we altered the surfaces contents. */
cairo_surface_mark_dirty (surface);