~ubuntu-branches/ubuntu/wily/tupi/wily-proposed

« back to all changes in this revision

Viewing changes to 3rdparty/potrace/curve.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-05-13 09:53:35 UTC
  • mfrom: (8.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130513095335-3iqdvt9ne07ia25v
Tags: 0.2+git01-1
* Upload to unstable.
* Removed unnecessary versioned Build-Depends.
* Removed obsolete "DM-Upload-Allowed".
* Added Vcs links to collab-maint.
* Standards updated to version 3.9.4.
* Corrected "libavutil51"-->"libavutil-dev" in Build-Depends.
* Updated debian/watch (corrected URL, removed comments).
* Updated get-orig-source (can work from any directory).
* Updated my email address; bumped copyright years.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2001-2005 Peter Selinger.
2
 
   This file is part of potrace. It is free software and it is covered
3
 
   by the GNU General Public License. See the file COPYING for details. */
4
 
 
5
 
#ifndef CURVE_H
6
 
#define CURVE_H
7
 
 
8
 
#include "auxiliary.h"
9
 
 
10
 
/* vertex is c[1] for tag=POTRACE_CORNER, and the intersection of
11
 
   .c[-1][2]..c[0] and c[1]..c[2] for tag=POTRACE_CURVETO. alpha is only
12
 
   defined for tag=POTRACE_CURVETO and is the alpha parameter of the curve:
13
 
   .c[-1][2]..c[0] = alpha*(.c[-1][2]..vertex), and
14
 
   c[2]..c[1] = alpha*(c[2]..vertex).
15
 
   Beta is so that (.beta[i])[.vertex[i],.vertex[i+1]] = .c[i][2].
16
 
*/
17
 
 
18
 
struct privcurve_s {
19
 
  int n;            /* number of segments */
20
 
  int *tag;         /* tag[n]: POTRACE_CORNER or POTRACE_CURVETO */
21
 
  dpoint_t (*c)[3]; /* c[n][i]: control points. 
22
 
                       c[n][0] is unused for tag[n]=POTRACE_CORNER */
23
 
  dpoint_t *vertex; /* for POTRACE_CORNER, this equals c[1] */
24
 
  double *alpha;    /* only for POTRACE_CURVETO */
25
 
  double *alpha0;   /* "uncropped" alpha parameter - for debug output only */
26
 
  double *beta;
27
 
};
28
 
typedef struct privcurve_s privcurve_t;
29
 
 
30
 
struct sums_s {
31
 
  double x;
32
 
  double y;
33
 
  double x2;
34
 
  double xy;
35
 
  double y2;
36
 
};
37
 
typedef struct sums_s sums_t;
38
 
 
39
 
/* the path structure is filled in with information about a given path
40
 
   as it is accumulated and passed through the different stages of the
41
 
   potrace algorithm. Backends only need to read the fcurve and fm
42
 
   fields of this data structure, but debugging backends may read
43
 
   other fields. */
44
 
struct potrace_privpath_s {
45
 
  int len;
46
 
  point_t *pt;     /* pt[len]: path as extracted from bitmap */
47
 
  int *lon;        /* lon[len]: (i,lon[i]) = longest straight line from i */
48
 
 
49
 
  int x0, y0;      /* origin for sums */
50
 
  sums_t *sums;    /* sums[len+1]: cache for fast summing */
51
 
 
52
 
  int m;           /* length of optimal polygon */
53
 
  int *po;         /* po[m]: optimal polygon */
54
 
 
55
 
  privcurve_t curve;   /* curve[m]: array of curve elements */
56
 
  privcurve_t ocurve;  /* ocurve[om]: array of curve elements */
57
 
  privcurve_t *fcurve;  /* final curve: this points to either curve or
58
 
                       ocurve. Do not free this separately. */
59
 
};
60
 
typedef struct potrace_privpath_s potrace_privpath_t;
61
 
 
62
 
/* shorter names */
63
 
typedef potrace_privpath_t privpath_t;
64
 
typedef potrace_path_t path_t;
65
 
 
66
 
path_t *path_new(void);
67
 
void path_free(path_t *p);
68
 
void pathlist_free(path_t *plist);
69
 
int privcurve_init(privcurve_t *curve, int n);
70
 
void privcurve_free_members(privcurve_t *curve);
71
 
void privcurve_to_curve(privcurve_t *pc, potrace_curve_t *c);
72
 
 
73
 
#endif /* CURVE_H */
74