Logo Search packages:      
Sourcecode: inkscape version File versions

flood-context.cpp File Reference


Detailed Description

Bucket fill drawing context, works by bitmap filling an area on a rendered version of the current display and then tracing the result using potrace.

Definition in file flood-context.cpp.

#include <gdk/gdkkeysyms.h>
#include <queue>
#include <deque>
#include "macros.h"
#include "display/sp-canvas.h"
#include "document.h"
#include "sp-namedview.h"
#include "sp-object.h"
#include "sp-rect.h"
#include "selection.h"
#include "desktop-handles.h"
#include "desktop.h"
#include "desktop-style.h"
#include "message-stack.h"
#include "message-context.h"
#include "pixmaps/cursor-paintbucket.xpm"
#include "flood-context.h"
#include "sp-metrics.h"
#include <glibmm/i18n.h>
#include "object-edit.h"
#include "xml/repr.h"
#include "xml/node-event-vector.h"
#include "preferences.h"
#include "context-fns.h"
#include "rubberband.h"
#include "shape-editor.h"
#include "display/nr-arena-item.h"
#include "display/nr-arena.h"
#include "display/nr-arena-image.h"
#include "display/canvas-arena.h"
#include "libnr/nr-pixops.h"
#include "libnr/nr-matrix-translate-ops.h"
#include "libnr/nr-scale-ops.h"
#include "libnr/nr-scale-translate-ops.h"
#include "libnr/nr-translate-matrix-ops.h"
#include "libnr/nr-translate-scale-ops.h"
#include "libnr/nr-matrix-ops.h"
#include <2geom/pathvector.h>
#include "sp-item.h"
#include "sp-root.h"
#include "sp-defs.h"
#include "sp-path.h"
#include "splivarot.h"
#include "livarot/Path.h"
#include "livarot/Shape.h"
#include "svg/svg.h"
#include "color.h"
#include "trace/trace.h"
#include "trace/imagemap.h"
#include "trace/potrace/inkscape-potrace.h"

Go to the source code of this file.

Classes

struct  bitmap_coords_info

Defines

#define __SP_FLOOD_CONTEXT_C__
#define PAINT_DIRECTION_ALL   15
#define PAINT_DIRECTION_DOWN   8
#define PAINT_DIRECTION_LEFT   1
#define PAINT_DIRECTION_RIGHT   2
#define PAINT_DIRECTION_UP   4

Enumerations

enum  {
  PIXEL_CHECKED = 1, PIXEL_QUEUED = 2, PIXEL_PAINTABLE = 4, PIXEL_NOT_PAINTABLE = 8,
  PIXEL_COLORED = 16
}
enum  ScanlineCheckResult { SCANLINE_CHECK_OK, SCANLINE_CHECK_ABORTED, SCANLINE_CHECK_BOUNDARY }
 The possible return states of perform_bitmap_scanline_check().

Functions

static bool check_if_pixel_is_paintable (guchar *px, unsigned char *trace_t, int x, int y, unsigned char *orig_color, bitmap_coords_info bci)
 Check if a pixel can be included in the fill.
static void clear_pixel_paintability (unsigned char *t)
static bool compare_pixels (unsigned char *check, unsigned char *orig, unsigned char *merged_orig_pixel, unsigned char *dtc, int threshold, PaintBucketChannels method)
 Compare a pixel in a pixel buffer with another pixel to determine if a point should be included in the fill operation.
static bool coords_in_range (unsigned int x, unsigned int y, bitmap_coords_info bci)
 Determine if the provided coordinates are within the pixel buffer limits.
static void do_trace (bitmap_coords_info bci, guchar *trace_px, SPDesktop *desktop, Geom::Matrix transform, unsigned int min_x, unsigned int max_x, unsigned int min_y, unsigned int max_y, bool union_with_selection)
 Perform the bitmap-to-vector tracing and place the traced path onto the document.
GList * flood_autogap_dropdown_items_list ()
 Generate the list of autogap selection entries.
GList * flood_channels_dropdown_items_list ()
 Generate the list of trace channel selection entries.
void flood_channels_set_channels (gint channels)
unsigned char * get_pixel (guchar *px, int x, int y, int width)
 Get the pointer to a pixel in a pixel buffer.
unsigned char * get_trace_pixel (guchar *trace_px, int x, int y, int width)
static bool is_pixel_checked (unsigned char *t)
static bool is_pixel_colored (unsigned char *t)
static bool is_pixel_paintability_checked (unsigned char *t)
static bool is_pixel_paintable (unsigned char *t)
static bool is_pixel_queued (unsigned char *t)
static void mark_pixel_checked (unsigned char *t)
static void mark_pixel_colored (unsigned char *t)
static void mark_pixel_not_paintable (unsigned char *t)
static void mark_pixel_paintable (unsigned char *t)
static void mark_pixel_queued (unsigned char *t)
static void mark_pixel_unchecked (unsigned char *t)
static void merge_pixel_with_background (unsigned char *orig, unsigned char *bg, unsigned char *base)
 Merge a pixel with the background color.
static unsigned int paint_pixel (guchar *px, guchar *trace_px, unsigned char *orig_color, bitmap_coords_info bci, unsigned char *original_point_trace_t)
 Paint a pixel or a square (if autogap is enabled) on the trace pixel buffer.
static ScanlineCheckResult perform_bitmap_scanline_check (std::deque< Geom::Point > *fill_queue, guchar *px, guchar *trace_px, unsigned char *orig_color, bitmap_coords_info bci, unsigned int *min_x, unsigned int *max_x)
 Scan a row in the rendered pixel buffer and add points to the fill queue as necessary.
static void push_point_onto_queue (std::deque< Geom::Point > *fill_queue, unsigned int max_queue_size, unsigned char *trace_t, unsigned int x, unsigned int y)
 Push a point to be checked onto the bottom of the rendered pixel buffer check queue.
static void shift_point_onto_queue (std::deque< Geom::Point > *fill_queue, unsigned int max_queue_size, unsigned char *trace_t, unsigned int x, unsigned int y)
 Shift a point to be checked onto the top of the rendered pixel buffer check queue.
static bool sort_fill_queue_horizontal (Geom::Point a, Geom::Point b)
 Sort the rendered pixel buffer check queue horizontally.
static bool sort_fill_queue_vertical (Geom::Point a, Geom::Point b)
 Sort the rendered pixel buffer check queue vertically.
static void sp_flood_context_class_init (SPFloodContextClass *klass)
static void sp_flood_context_dispose (GObject *object)
GtkType sp_flood_context_get_type ()
static void sp_flood_context_init (SPFloodContext *flood_context)
static gint sp_flood_context_item_handler (SPEventContext *event_context, SPItem *item, GdkEvent *event)
static gint sp_flood_context_root_handler (SPEventContext *event_context, GdkEvent *event)
void sp_flood_context_selection_changed (Inkscape::Selection *selection, gpointer data)
 Callback that processes the "changed" signal on the selection; destroys old and creates new knotholder.
static void sp_flood_context_setup (SPEventContext *ec)
static void sp_flood_do_flood_fill (SPEventContext *event_context, GdkEvent *event, bool union_with_selection, bool is_point_fill, bool is_touch_fill)
 Perform a flood fill operation.
static void sp_flood_finish (SPFloodContext *rc)

Variables

static SPEventContextClassparent_class


Generated by  Doxygen 1.6.0   Back to index