GimpMybrushSurface * gimp_mypaint_surface_new (GeglBuffer *buffer, GimpComponentMask component_mask, GeglBuffer *paint_mask, gint paint_mask_x, gint paint_mask_y) { GimpMybrushSurface *surface = g_malloc0 (sizeof (GimpMybrushSurface)); mypaint_surface_init ((MyPaintSurface *)surface); surface->surface.get_color = gimp_mypaint_surface_get_color; surface->surface.draw_dab = gimp_mypaint_surface_draw_dab; surface->surface.begin_atomic = gimp_mypaint_surface_begin_atomic; surface->surface.end_atomic = gimp_mypaint_surface_end_atomic; surface->surface.destroy = gimp_mypaint_surface_destroy; surface->component_mask = component_mask; surface->buffer = g_object_ref (buffer); if (paint_mask) surface->paint_mask = g_object_ref (paint_mask); else surface->paint_mask = NULL; surface->paint_mask_x = paint_mask_x; surface->paint_mask_y = paint_mask_y; surface->dirty = *GEGL_RECTANGLE (0, 0, 0, 0); return surface; }
/** * mypaint_tiled_surface_init: (skip) * * Initialize the surface, passing in implementations of the tile backend. * Note: Only intended to be called from subclasses of #MyPaintTiledSurface **/ void mypaint_tiled_surface_init(MyPaintTiledSurface *self, MyPaintTileRequestStartFunction tile_request_start, MyPaintTileRequestEndFunction tile_request_end) { mypaint_surface_init(&self->parent); self->parent.draw_dab = draw_dab; self->parent.get_color = get_color; self->parent.begin_atomic = begin_atomic_default; self->parent.end_atomic = end_atomic_default; self->tile_request_end = tile_request_end; self->tile_request_start = tile_request_start; self->tile_size = MYPAINT_TILE_SIZE; self->threadsafe_tile_requests = FALSE; self->dirty_bbox.x = 0; self->dirty_bbox.y = 0; self->dirty_bbox.width = 0; self->dirty_bbox.height = 0; self->surface_do_symmetry = FALSE; self->surface_center_x = 0.0f; self->operation_queue = operation_queue_new(); }