~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to components/aggpas/src/agg_span_interpolator_linear.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//----------------------------------------------------------------------------
2
 
// Anti-Grain Geometry - Version 2.4 (Public License)
3
 
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
4
 
//
5
 
// Anti-Grain Geometry - Version 2.4 Release Milano 3 (AggPas 2.4 RM3)
6
 
// Pascal Port By: Milan Marusinec alias Milano
7
 
//                 milan@marusinec.sk
8
 
//                 http://www.aggpas.org
9
 
// Copyright (c) 2005-2006
10
 
//
11
 
// Permission to copy, use, modify, sell and distribute this software
12
 
// is granted provided this copyright notice appears in all copies.
13
 
// This software is provided "as is" without express or implied
14
 
// warranty, and with no claim as to its suitability for any purpose.
15
 
//
16
 
//----------------------------------------------------------------------------
17
 
// Contact: mcseem@antigrain.com
18
 
//          mcseemagg@yahoo.com
19
 
//          http://www.antigrain.com
20
 
//
21
 
// [Pascal Port History] -----------------------------------------------------
22
 
//
23
 
// 27.01.2006-Milano: Unit port establishment
24
 
//
25
 
{ agg_span_interpolator_linear.pas }
26
 
unit
27
 
 agg_span_interpolator_linear ;
28
 
 
29
 
INTERFACE
30
 
 
31
 
{$I agg_mode.inc }
32
 
{$Q- }
33
 
{$R- }
34
 
uses
35
 
 agg_basics ,
36
 
 agg_dda_line ,
37
 
 agg_trans_affine ;
38
 
 
39
 
{ TYPES DEFINITION }
40
 
type
41
 
 span_interpolator_ptr = ^span_interpolator;
42
 
 span_interpolator = object
43
 
   subpixel_shift ,
44
 
   subpixel_size  : unsigned;
45
 
 
46
 
   constructor Construct(SS : unsigned = 8 );
47
 
 
48
 
   function  _transformer : trans_affine_ptr; virtual; abstract;
49
 
   procedure transformer_(trans : trans_affine_ptr ); virtual; abstract;
50
 
 
51
 
   procedure begin_(x ,y  : double; len : unsigned ); virtual; abstract;
52
 
 
53
 
   procedure resynchronize(xe ,ye : double; len : unsigned ); virtual; abstract;
54
 
 
55
 
   procedure inc_operator; virtual; abstract;
56
 
   procedure coordinates(x ,y : int_ptr ); virtual; abstract;
57
 
 
58
 
   procedure local_scale(x ,y : int_ptr ); virtual;
59
 
 
60
 
  end;
61
 
 
62
 
//================================================span_interpolator_linear
63
 
 span_interpolator_linear_ptr = ^span_interpolator_linear;
64
 
 span_interpolator_linear = object(span_interpolator )
65
 
   m_trans : trans_affine_ptr;
66
 
   m_li_x  ,
67
 
   m_li_y  : dda2_line_interpolator;
68
 
 
69
 
   constructor Construct(SS : unsigned = 8 ); overload;
70
 
   constructor Construct(trans : trans_affine_ptr; SS : unsigned = 8 ); overload;
71
 
   constructor Construct(trans : trans_affine_ptr; x ,y : double; len : unsigned; SS : unsigned = 8 ); overload;
72
 
 
73
 
   function  _transformer : trans_affine_ptr; virtual;
74
 
   procedure transformer_(trans : trans_affine_ptr ); virtual;
75
 
 
76
 
   procedure begin_(x ,y  : double; len : unsigned ); virtual;
77
 
 
78
 
   procedure resynchronize(xe ,ye : double; len : unsigned ); virtual;
79
 
 
80
 
   procedure inc_operator; virtual;
81
 
   procedure coordinates(x ,y : int_ptr ); virtual;
82
 
 
83
 
  end;
84
 
 
85
 
//=====================================span_interpolator_linear_subdiv
86
 
 span_interpolator_linear_subdiv = object(span_interpolator )
87
 
   m_subdiv_shift ,
88
 
   m_subdiv_size  ,
89
 
   m_subdiv_mask  : unsigned;
90
 
 
91
 
   m_trans : trans_affine_ptr;
92
 
   m_li_x  ,
93
 
   m_li_y  : dda2_line_interpolator;
94
 
 
95
 
   m_src_x : int;
96
 
   m_src_y : double;
97
 
   m_pos   ,
98
 
   m_len   : unsigned;
99
 
 
100
 
   constructor Construct(SS : unsigned = 8 ); overload;
101
 
   constructor Construct(trans : trans_affine_ptr; subdiv_shift : unsigned = 4; SS : unsigned = 8 ); overload;
102
 
   constructor Construct(trans : trans_affine_ptr; x ,y : double; len : unsigned; subdiv_shift : unsigned = 4; SS : unsigned = 8 ); overload;
103
 
 
104
 
   function  _transformer : trans_affine_ptr; virtual;
105
 
   procedure transformer_(trans : trans_affine_ptr ); virtual;
106
 
 
107
 
   function  _subdiv_shift : unsigned;
108
 
   procedure subdiv_shift_(shift : unsigned );
109
 
 
110
 
   procedure begin_(x ,y  : double; len : unsigned ); virtual;
111
 
 
112
 
   procedure inc_operator; virtual;
113
 
   procedure coordinates(x ,y : int_ptr ); virtual;
114
 
 
115
 
  end;
116
 
 
117
 
{ GLOBAL PROCEDURES }
118
 
 
119
 
 
120
 
IMPLEMENTATION
121
 
{ LOCAL VARIABLES & CONSTANTS }
122
 
{ UNIT IMPLEMENTATION }
123
 
{ CONSTRUCT }
124
 
constructor span_interpolator.Construct;
125
 
begin
126
 
 subpixel_shift:=SS;
127
 
 subpixel_size :=1 shl subpixel_shift;
128
 
 
129
 
end;
130
 
 
131
 
{ LOCAL_SCALE }
132
 
procedure span_interpolator.local_scale;
133
 
begin
134
 
end;
135
 
 
136
 
{ CONSTRUCT }
137
 
constructor span_interpolator_linear.Construct(SS : unsigned = 8 );
138
 
begin
139
 
 inherited Construct(SS );
140
 
 
141
 
end;
142
 
 
143
 
{ CONSTRUCT }
144
 
constructor span_interpolator_linear.Construct(trans : trans_affine_ptr; SS : unsigned = 8 );
145
 
begin
146
 
 Construct(SS );
147
 
 
148
 
 m_trans:=trans;
149
 
 
150
 
end;
151
 
 
152
 
{ CONSTRUCT }
153
 
constructor span_interpolator_linear.Construct(trans : trans_affine_ptr; x ,y : double; len : unsigned; SS : unsigned = 8 );
154
 
begin
155
 
 Construct(trans ,SS );
156
 
 
157
 
 begin_(x ,y ,len );
158
 
 
159
 
end;
160
 
 
161
 
{ _TRANSFORMER }
162
 
function span_interpolator_linear._transformer;
163
 
begin
164
 
 result:=m_trans;
165
 
 
166
 
end;
167
 
 
168
 
{ TRANSFORMER_ }
169
 
procedure span_interpolator_linear.transformer_;
170
 
begin
171
 
 m_trans:=trans;
172
 
 
173
 
end;
174
 
 
175
 
{ BEGIN_ }
176
 
procedure span_interpolator_linear.begin_;
177
 
var
178
 
 tx ,ty : double;
179
 
 
180
 
 x1 ,y1 ,x2 ,y2 : int;
181
 
 
182
 
begin
183
 
 tx:=x;
184
 
 ty:=y;
185
 
 
186
 
 m_trans.transform(m_trans ,@tx ,@ty );
187
 
 
188
 
 x1:=trunc(tx * subpixel_size );
189
 
 y1:=trunc(ty * subpixel_size );
190
 
 
191
 
 tx:=x + len;
192
 
 ty:=y;
193
 
 
194
 
 m_trans.transform(m_trans ,@tx ,@ty );
195
 
 
196
 
 x2:=trunc(tx * subpixel_size );
197
 
 y2:=trunc(ty * subpixel_size );
198
 
 
199
 
 m_li_x.Construct(x1 ,x2 ,len );
200
 
 m_li_y.Construct(y1 ,y2 ,len );
201
 
 
202
 
end;
203
 
 
204
 
{ RESYNCHRONIZE }
205
 
procedure span_interpolator_linear.resynchronize;
206
 
begin
207
 
 m_trans.transform(m_trans ,@xe ,@ye );
208
 
 
209
 
 m_li_x.Construct(m_li_x._y ,trunc(xe * subpixel_size ) ,len );
210
 
 m_li_y.Construct(m_li_y._y ,trunc(ye * subpixel_size ) ,len );
211
 
 
212
 
end;
213
 
 
214
 
{ INC_OPERATOR }
215
 
procedure span_interpolator_linear.inc_operator;
216
 
begin
217
 
 m_li_x.plus_operator;
218
 
 m_li_y.plus_operator;
219
 
 
220
 
end;
221
 
 
222
 
{ COORDINATES }
223
 
procedure span_interpolator_linear.coordinates;
224
 
begin
225
 
 x^:=m_li_x._y;
226
 
 y^:=m_li_y._y;
227
 
 
228
 
end;
229
 
 
230
 
{ CONSTRUCT }
231
 
constructor span_interpolator_linear_subdiv.Construct(SS : unsigned = 8 );
232
 
begin
233
 
 inherited Construct(SS );
234
 
 
235
 
 m_subdiv_shift:=4;
236
 
 m_subdiv_size :=1 shl m_subdiv_shift;
237
 
 m_subdiv_mask :=m_subdiv_size - 1;
238
 
 
239
 
end;
240
 
 
241
 
{ CONSTRUCT }
242
 
constructor span_interpolator_linear_subdiv.Construct(trans : trans_affine_ptr; subdiv_shift : unsigned = 4; SS : unsigned = 8 );
243
 
begin
244
 
 inherited Construct(SS );
245
 
 
246
 
 m_subdiv_shift:=subdiv_shift;
247
 
 m_subdiv_size :=1 shl m_subdiv_shift;
248
 
 m_subdiv_mask :=m_subdiv_size - 1;
249
 
 
250
 
 m_trans:=trans;
251
 
 
252
 
end;
253
 
 
254
 
{ CONSTRUCT }
255
 
constructor span_interpolator_linear_subdiv.Construct(trans : trans_affine_ptr; x ,y : double; len : unsigned; subdiv_shift : unsigned = 4; SS : unsigned = 8 );
256
 
begin
257
 
 Construct(trans ,subdiv_shift ,SS );
258
 
 
259
 
 begin_(x ,y ,len );
260
 
 
261
 
end;
262
 
 
263
 
{ _TRANSFORMER }
264
 
function span_interpolator_linear_subdiv._transformer;
265
 
begin
266
 
 result:=m_trans;
267
 
 
268
 
end;
269
 
 
270
 
{ TRANSFORMER_ }
271
 
procedure span_interpolator_linear_subdiv.transformer_;
272
 
begin
273
 
 m_trans:=trans;
274
 
 
275
 
end;
276
 
 
277
 
{ _SUBDIV_SHIFT }
278
 
function span_interpolator_linear_subdiv._subdiv_shift;
279
 
begin
280
 
 result:=m_subdiv_shift;
281
 
 
282
 
end;
283
 
 
284
 
{ SUBDIV_SHIFT_ }
285
 
procedure span_interpolator_linear_subdiv.subdiv_shift_;
286
 
begin
287
 
 m_subdiv_shift:=shift;
288
 
 m_subdiv_size :=1 shl m_subdiv_shift;
289
 
 m_subdiv_mask :=m_subdiv_size - 1;
290
 
 
291
 
end;
292
 
 
293
 
{ BEGIN_ }
294
 
procedure span_interpolator_linear_subdiv.begin_;
295
 
var
296
 
 tx ,ty : double;
297
 
 x1 ,y1 : int;
298
 
 
299
 
begin
300
 
 m_pos  :=1;
301
 
 m_src_x:=trunc(x * subpixel_size ) + subpixel_size;
302
 
 m_src_y:=y;
303
 
 m_len  :=len;
304
 
 
305
 
 if len > m_subdiv_size then
306
 
  len:=m_subdiv_size;
307
 
 
308
 
 tx:=x;
309
 
 ty:=y;
310
 
 
311
 
 m_trans.transform(m_trans ,@tx ,@ty );
312
 
 
313
 
 x1:=trunc(tx * subpixel_size );
314
 
 y1:=trunc(ty * subpixel_size );
315
 
 
316
 
 tx:=x + len;
317
 
 ty:=y;
318
 
 
319
 
 m_trans.transform(m_trans ,@tx ,@ty );
320
 
 
321
 
 m_li_x.Construct(x1 ,trunc(tx * subpixel_size ) ,len );
322
 
 m_li_y.Construct(y1 ,trunc(ty * subpixel_size ) ,len );
323
 
 
324
 
end;
325
 
 
326
 
{ INC_OPERATOR }
327
 
procedure span_interpolator_linear_subdiv.inc_operator;
328
 
var
329
 
 tx ,ty : double;
330
 
 
331
 
 len : unsigned;
332
 
 
333
 
begin
334
 
 m_li_x.plus_operator;
335
 
 m_li_y.plus_operator;
336
 
 
337
 
 if m_pos >= m_subdiv_size then
338
 
  begin
339
 
   len:=m_len;
340
 
 
341
 
   if len > m_subdiv_size then
342
 
    len:=m_subdiv_size;
343
 
 
344
 
   tx:=m_src_x / subpixel_size + len;
345
 
   ty:=m_src_y;
346
 
 
347
 
   m_trans.transform(m_trans ,@tx ,@ty );
348
 
 
349
 
   m_li_x.Construct(m_li_x._y ,trunc(tx * subpixel_size ) ,len );
350
 
   m_li_y.Construct(m_li_y._y ,trunc(ty * subpixel_size ) ,len );
351
 
 
352
 
   m_pos:=0;
353
 
 
354
 
  end;
355
 
 
356
 
 inc(m_src_x ,subpixel_size );
357
 
 inc(m_pos );
358
 
 dec(m_len );
359
 
 
360
 
end;
361
 
 
362
 
{ COORDINATES }
363
 
procedure span_interpolator_linear_subdiv.coordinates;
364
 
begin
365
 
 x^:=m_li_x._y;
366
 
 y^:=m_li_y._y;
367
 
 
368
 
end;
369
 
 
370
 
END.
371