86 int src_rowstride, dest_rowstride;
87 int src_bpp, dest_bpp;
89 guchar *src_pixels, *dest_pixels;
95 x_offset = (blur_radius * 4) / 5;
98 y_offset = (blur_radius * 4) / 5;
101 width = gdk_pixbuf_get_width (src) + blur_radius * 2 + x_offset;
102 height = gdk_pixbuf_get_height (src) + blur_radius * 2 + y_offset;
104 dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
TRUE,
105 gdk_pixbuf_get_bits_per_sample (src),
107 gdk_pixbuf_fill (dest, 0);
108 src_pixels = gdk_pixbuf_get_pixels (src);
109 src_rowstride = gdk_pixbuf_get_rowstride (src);
110 src_bpp = gdk_pixbuf_get_has_alpha (src) ? 4 : 3;
112 dest_pixels = gdk_pixbuf_get_pixels (dest);
113 dest_rowstride = gdk_pixbuf_get_rowstride (dest);
114 dest_bpp = gdk_pixbuf_get_has_alpha (dest) ? 4 : 3;
116 for (y = 0; y < height; y++)
118 for (x = 0; x < width; x++)
120 int sumr = 0, sumg = 0, sumb = 0, suma = 0;
122 for (i = 0; i < filter->
size; i++)
124 for (j = 0; j < filter->
size; j++)
128 src_y = -(blur_radius + x_offset) + y - (filter->
size >> 1) + i;
129 src_x = -(blur_radius + y_offset) + x - (filter->
size >> 1) + j;
131 if (src_y < 0 || src_y > gdk_pixbuf_get_height (src) ||
132 src_x < 0 || src_x > gdk_pixbuf_get_width (src))
135 sumr += src_pixels [src_y * src_rowstride +
136 src_x * src_bpp + 0] *
137 filter->
data [i * filter->
size + j];
138 sumg += src_pixels [src_y * src_rowstride +
139 src_x * src_bpp + 1] *
140 filter->
data [i * filter->
size + j];
142 sumb += src_pixels [src_y * src_rowstride +
143 src_x * src_bpp + 2] *
144 filter->
data [i * filter->
size + j];
147 suma += src_pixels [src_y * src_rowstride +
148 src_x * src_bpp + 3] *
149 filter->
data [i * filter->
size + j];
157 dest_pixels [y * dest_rowstride +
158 x * dest_bpp + 3] = (suma * opacity) / (filter->
size * filter->
size);