OSSIM - Open Source Software Image Map
Version 1.9.0 (20180803)
ossim-plugins
potrace
src
curve.h
Go to the documentation of this file.
1
/* Copyright (C) 2001-2015 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
/* the remainder of this structure is special to privcurve, and is
24
used in EPS debug output and special EPS "short coding". These
25
fields are valid only if "alphacurve" is set. */
26
int
alphacurve
;
/* have the following fields been initialized? */
27
dpoint_t
*
vertex
;
/* for POTRACE_CORNER, this equals c[1] */
28
double
*
alpha
;
/* only for POTRACE_CURVETO */
29
double
*
alpha0
;
/* "uncropped" alpha parameter - for debug output only */
30
double
*
beta
;
31
};
32
typedef
struct
privcurve_s
privcurve_t
;
33
34
struct
sums_s
{
35
double
x
;
36
double
y
;
37
double
x2
;
38
double
xy
;
39
double
y2
;
40
};
41
typedef
struct
sums_s
sums_t
;
42
43
/* the path structure is filled in with information about a given path
44
as it is accumulated and passed through the different stages of the
45
Potrace algorithm. Backends only need to read the fcurve and fm
46
fields of this data structure, but debugging backends may read
47
other fields. */
48
struct
potrace_privpath_s
{
49
int
len
;
50
point_t
*
pt
;
/* pt[len]: path as extracted from bitmap */
51
int
*
lon
;
/* lon[len]: (i,lon[i]) = longest straight line from i */
52
53
int
x0
,
y0
;
/* origin for sums */
54
sums_t
*
sums
;
/* sums[len+1]: cache for fast summing */
55
56
int
m
;
/* length of optimal polygon */
57
int
*
po
;
/* po[m]: optimal polygon */
58
59
privcurve_t
curve
;
/* curve[m]: array of curve elements */
60
privcurve_t
ocurve
;
/* ocurve[om]: array of curve elements */
61
privcurve_t
*
fcurve
;
/* final curve: this points to either curve or
62
ocurve. Do not free this separately. */
63
};
64
typedef
struct
potrace_privpath_s
potrace_privpath_t
;
65
66
/* shorter names */
67
typedef
potrace_privpath_t
privpath_t
;
68
typedef
potrace_path_t
path_t
;
69
70
path_t
*
path_new
(
void
);
71
void
path_free
(
path_t
*p);
72
void
pathlist_free
(
path_t
*plist);
73
int
privcurve_init
(
privcurve_t
*
curve
,
int
n
);
74
void
privcurve_to_curve
(
privcurve_t
*pc,
potrace_curve_t
*c);
75
76
#endif
/* CURVE_H */
77
potrace_privpath_s::lon
int * lon
Definition:
curve.h:51
potrace_privpath_s
Definition:
curve.h:48
privcurve_s
Definition:
curve.h:18
privcurve_to_curve
void privcurve_to_curve(privcurve_t *pc, potrace_curve_t *c)
path_free
void path_free(path_t *p)
privcurve_s::alpha
double * alpha
Definition:
curve.h:28
pathlist_free
void pathlist_free(path_t *plist)
potrace_privpath_s::curve
privcurve_t curve
Definition:
curve.h:59
potrace_privpath_s::x0
int x0
Definition:
curve.h:53
path_t
potrace_path_t path_t
Definition:
curve.h:68
dpoint_t
potrace_dpoint_t dpoint_t
Definition:
auxiliary.h:28
privcurve_s::alphacurve
int alphacurve
Definition:
curve.h:26
path_new
path_t * path_new(void)
point_s
Definition:
auxiliary.h:22
potrace_path_s
Definition:
potracelib.h:86
privcurve_s::vertex
dpoint_t * vertex
Definition:
curve.h:27
privcurve_init
int privcurve_init(privcurve_t *curve, int n)
n
os2<< "> n<< " > nendobj n
Definition:
ossimPdfWriter.cpp:532
sums_s::y2
double y2
Definition:
curve.h:39
potrace_privpath_s::ocurve
privcurve_t ocurve
Definition:
curve.h:60
potrace_privpath_s::y0
int y0
Definition:
curve.h:53
privpath_t
potrace_privpath_t privpath_t
Definition:
curve.h:67
auxiliary.h
sums_s::x
double x
Definition:
curve.h:35
potrace_privpath_s::fcurve
privcurve_t * fcurve
Definition:
curve.h:61
sums_s::xy
double xy
Definition:
curve.h:38
sums_s::y
double y
Definition:
curve.h:36
privcurve_s::beta
double * beta
Definition:
curve.h:30
potrace_privpath_s::pt
point_t * pt
Definition:
curve.h:50
potrace_privpath_s::m
int m
Definition:
curve.h:56
potrace_curve_s
Definition:
potracelib.h:77
privcurve_s::c
dpoint_t(* c)[3]
Definition:
curve.h:21
potrace_privpath_s::len
int len
Definition:
curve.h:49
potrace_dpoint_s
Definition:
potracelib.h:66
potrace_privpath_s::sums
sums_t * sums
Definition:
curve.h:54
privcurve_s::alpha0
double * alpha0
Definition:
curve.h:29
privcurve_s::tag
int * tag
Definition:
curve.h:20
privcurve_s::n
int n
Definition:
curve.h:19
sums_s
Definition:
curve.h:34
sums_s::x2
double x2
Definition:
curve.h:37
potrace_privpath_s::po
int * po
Definition:
curve.h:57
Generated on Fri Aug 3 2018 08:46:44 for OSSIM - Open Source Software Image Map by
1.8.14