static PyObject* cairo_blur_gaussian_blur(PyObject* self, PyObject* args) { PycairoSurface* surface = NULL; int radius = 0; if (!PyArg_ParseTuple(args, "Oi", &surface, &radius)) { return NULL; } blur_image_surface(surface->surface, radius); Py_RETURN_NONE; }
static void pool_gen () { gint width = pool_width; gint height = pool_height; gdouble xs, ys; gint i; gdouble area = width * height; if (pool) cairo_surface_destroy(pool); pool = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); cairo_t *cr = cairo_create(pool); cairo_set_source_rgba (cr, 0.5, 0.39, 0.35, 1.0); cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); for (i = 0; i < area; i += 22500) { cairo_set_source_rgba (cr, 0.58, 0.55, 0.47, 1.0); xs = g_random_double_range(0, width-10); ys = g_random_double_range(0, height-15); while (g_random_double_range(0.0, 1.0) < 0.90) { cairo_rectangle (cr, xs, ys, 30, 20); cairo_fill (cr); xs += g_random_double_range(-10, 10); ys += g_random_double_range(-10, 10); } } for (i = 0; i < area; i += 2500) { cairo_set_source_rgba (cr, 0.31, 0.39, 0.35, 1.0); xs = g_random_double_range(0, width-10); ys = g_random_double_range(0, height-15); while (g_random_double_range(0.0, 1.0) < 0.90) { cairo_rectangle (cr, xs, ys, 30, 20); cairo_fill (cr); xs += g_random_double_range(-10, 10); ys += g_random_double_range(-10, 10); } } for (i = 0; i < area; i += 2500) { cairo_set_source_rgba (cr, 0.2, 0.2, 0.27, 1.0); xs = g_random_double_range(0, width-10); ys = g_random_double_range(0, height-15); while (g_random_double_range(0.0, 1.0) < 0.90) { cairo_rectangle (cr, xs, ys, 30, 20); cairo_fill (cr); xs += g_random_double_range(-10, 10); ys += g_random_double_range(-10, 10); } } cairo_destroy(cr); blur_image_surface (pool, 15, width, height); }