void gimp_channel_select_polygon (GimpChannel *channel, const gchar *undo_desc, gint n_points, GimpVector2 *points, GimpChannelOps op, gboolean antialias, gboolean feather, gdouble feather_radius_x, gdouble feather_radius_y, gboolean push_undo) { GimpScanConvert *scan_convert; g_return_if_fail (GIMP_IS_CHANNEL (channel)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel))); g_return_if_fail (undo_desc != NULL); scan_convert = gimp_scan_convert_new (); gimp_scan_convert_add_polyline (scan_convert, n_points, points, TRUE); gimp_channel_select_scan_convert (channel, undo_desc, scan_convert, 0, 0, op, antialias, feather, feather_radius_x, feather_radius_y, push_undo); gimp_scan_convert_free (scan_convert); }
void gimp_channel_select_vectors (GimpChannel *channel, const gchar *undo_desc, GimpVectors *vectors, GimpChannelOps op, gboolean antialias, gboolean feather, gdouble feather_radius_x, gdouble feather_radius_y, gboolean push_undo) { const GimpBezierDesc *bezier; g_return_if_fail (GIMP_IS_CHANNEL (channel)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel))); g_return_if_fail (undo_desc != NULL); g_return_if_fail (GIMP_IS_VECTORS (vectors)); bezier = gimp_vectors_get_bezier (vectors); if (bezier && bezier->num_data > 4) { GimpScanConvert *scan_convert; scan_convert = gimp_scan_convert_new (); gimp_scan_convert_add_bezier (scan_convert, bezier); gimp_channel_select_scan_convert (channel, undo_desc, scan_convert, 0, 0, op, antialias, feather, feather_radius_x, feather_radius_y, push_undo); gimp_scan_convert_free (scan_convert); } }
void gimp_channel_select_vectors (GimpChannel *channel, const gchar *undo_desc, GimpVectors *vectors, GimpChannelOps op, gboolean antialias, gboolean feather, gdouble feather_radius_x, gdouble feather_radius_y, gboolean push_undo) { GimpScanConvert *scan_convert; GList *stroke; gboolean coords_added = FALSE; g_return_if_fail (GIMP_IS_CHANNEL (channel)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel))); g_return_if_fail (undo_desc != NULL); g_return_if_fail (GIMP_IS_VECTORS (vectors)); scan_convert = gimp_scan_convert_new (); for (stroke = vectors->strokes; stroke; stroke = stroke->next) { GArray *coords; gboolean closed; coords = gimp_stroke_interpolate (GIMP_STROKE (stroke->data), 1.0, &closed); if (coords && coords->len) { GimpVector2 *points; gint i; points = g_new0 (GimpVector2, coords->len); for (i = 0; i < coords->len; i++) { points[i].x = g_array_index (coords, GimpCoords, i).x; points[i].y = g_array_index (coords, GimpCoords, i).y; } gimp_scan_convert_add_polyline (scan_convert, coords->len, points, TRUE); coords_added = TRUE; g_free (points); } if (coords) g_array_free (coords, TRUE); } if (coords_added) gimp_channel_select_scan_convert (channel, undo_desc, scan_convert, 0, 0, op, antialias, feather, feather_radius_x, feather_radius_y, push_undo); gimp_scan_convert_free (scan_convert); }