1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
//----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4 (Public License)
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Anti-Grain Geometry - Version 2.4 Release Milano 3 (AggPas 2.4 RM3)
// Pascal Port By: Milan Marusinec alias Milano
// milan@marusinec.sk
// http://www.aggpas.org
// Copyright (c) 2005-2006
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// mcseemagg@yahoo.com
// http://www.antigrain.com
//
// [Pascal Port History] -----------------------------------------------------
//
// 15.01.2006-Milano: Unit port establishment
//
{ agg_rasterizer_outline.pas }
unit
agg_rasterizer_outline ;
INTERFACE
{$I agg_mode.inc }
uses
agg_basics ,
agg_renderer_primitives ,
agg_vertex_source ;
{ TYPES DEFINITION }
type
rasterizer_outline_ptr = ^rasterizer_outline;
rasterizer_outline = object
m_ren : renderer_primitives_ptr;
m_start_x ,
m_start_y : int;
m_vertices : unsigned;
constructor Construct(ren : renderer_primitives_ptr );
procedure move_to(x ,y : int );
procedure line_to(x ,y : int );
procedure move_to_d(x ,y : double );
procedure line_to_d(x ,y : double );
procedure close;
procedure add_vertex(x ,y : double; cmd : unsigned );
procedure add_path (vs : vertex_source_ptr; path_id : unsigned = 0 );
end;
{ GLOBAL PROCEDURES }
IMPLEMENTATION
{ LOCAL VARIABLES & CONSTANTS }
{ UNIT IMPLEMENTATION }
{ CONSTRUCT }
constructor rasterizer_outline.Construct;
begin
m_ren:=ren;
m_start_x:=0;
m_start_y:=0;
m_vertices:=0;
end;
{ MOVE_TO }
procedure rasterizer_outline.move_to;
begin
m_vertices:=1;
m_start_x:=x;
m_start_y:=y;
m_ren.move_to(x ,y );
end;
{ LINE_TO }
procedure rasterizer_outline.line_to;
begin
inc(m_vertices );
m_ren.line_to(x ,y );
end;
{ MOVE_TO_D }
procedure rasterizer_outline.move_to_d;
begin
move_to(m_ren.coord(x ) ,m_ren.coord(y ) );
end;
{ LINE_TO_D }
procedure rasterizer_outline.line_to_d;
begin
line_to(m_ren.coord(x ) ,m_ren.coord(y ) );
end;
{ CLOSE }
procedure rasterizer_outline.close;
begin
if m_vertices > 2 then
line_to(m_start_x ,m_start_y );
m_vertices:=0;
end;
{ ADD_VERTEX }
procedure rasterizer_outline.add_vertex;
begin
if is_move_to(cmd ) then
move_to_d(x ,y )
else
if is_end_poly(cmd ) then
if is_closed(cmd ) then
close
else
else
line_to_d(x ,y );
end;
{ ADD_PATH }
procedure rasterizer_outline.add_path;
var
cmd : unsigned;
x ,y : double;
begin
vs.rewind(path_id );
cmd:=vs.vertex(@x ,@y );
while not is_stop(cmd ) do
begin
add_vertex(x ,y ,cmd );
cmd:=vs.vertex(@x ,@y );
end;
end;
END.
|