~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to plug-ins/sel2path/edge.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* edge.h: declarations for edge traversing.
 
2
 
 
3
Copyright (C) 1992 Free Software Foundation, Inc.
 
4
 
 
5
This program is free software; you can redistribute it and/or modify
 
6
it under the terms of the GNU General Public License as published by
 
7
the Free Software Foundation; either version 2, or (at your option)
 
8
any later version.
 
9
 
 
10
This program is distributed in the hope that it will be useful,
 
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
GNU General Public License for more details.
 
14
 
 
15
You should have received a copy of the GNU General Public License
 
16
along with this program; if not, write to the Free Software
 
17
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
18
 
 
19
#ifndef EDGE_H
 
20
#define EDGE_H
 
21
 
 
22
#include "bitmap.h"
 
23
 
 
24
/* We consider each pixel to consist of four edges, and we travel along
 
25
   edges, instead of through pixel centers.  This is necessary for those
 
26
   unfortunate times when a single pixel is on both an inside and an
 
27
   outside outline.
 
28
   
 
29
   The numbers chosen here are not arbitrary; the code that figures out
 
30
   which edge to move to depends on particular values.  See the
 
31
   `TRY_PIXEL' macro in `edge.c'.  To emphasize this, I've written in the
 
32
   numbers we need for each edge value.  */
 
33
 
 
34
typedef enum
 
35
{
 
36
  top = 1, left = 2, bottom = 3, right = 0, no_edge = 4
 
37
} edge_type;
 
38
 
 
39
/* This choice is also not arbitrary: starting at the top edge makes the
 
40
   code find outside outlines before inside ones, which is certainly
 
41
   what we want.  */
 
42
#define START_EDGE  top
 
43
 
 
44
 
 
45
/* Return the next outline edge on B in EDGE, ROW, and COL.  */
 
46
extern void next_outline_edge (edge_type *edge,
 
47
                               unsigned *row, unsigned *col);
 
48
 
 
49
/* Return the next edge after START on the pixel ROW/COL in B that is
 
50
   unmarked, according to the MARKED array.  */
 
51
extern edge_type next_unmarked_outline_edge (unsigned row, unsigned col,
 
52
                                             edge_type start,
 
53
                                             bitmap_type marked);
 
54
 
 
55
/* Mark the edge E at the pixel ROW/COL in MARKED.  */
 
56
extern void mark_edge (edge_type e, unsigned row, unsigned col,
 
57
                       bitmap_type *marked);
 
58
 
 
59
#endif /* not EDGE_H */