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

« back to all changes in this revision

Viewing changes to components/aggpas/src/agg_span_image_resample.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
 
// 05.03.2006-Milano: Unit port establishment
24
 
//
25
 
{ agg_span_image_resample.pas }
26
 
unit
27
 
 agg_span_image_resample ;
28
 
 
29
 
INTERFACE
30
 
 
31
 
{$I agg_mode.inc }
32
 
 
33
 
uses
34
 
 agg_basics ,
35
 
 agg_color ,
36
 
 agg_span_image_filter ,
37
 
 agg_span_interpolator_linear ,
38
 
 agg_rendering_buffer ,
39
 
 agg_span_allocator ,
40
 
 agg_image_filters ;
41
 
 
42
 
{ TYPES DEFINITION }
43
 
type
44
 
 span_image_resample_ptr = ^span_image_resample;
45
 
 span_image_resample = object(span_image_filter )
46
 
   m_scale_limit ,
47
 
   m_blur_x      ,
48
 
   m_blur_y      : int;
49
 
 
50
 
   constructor Construct(alloc : span_allocator_ptr ); overload;
51
 
   constructor Construct(
52
 
                alloc        : span_allocator_ptr;
53
 
                src          : rendering_buffer_ptr;
54
 
                back_color   : aggclr_ptr;
55
 
                interpolator : span_interpolator_ptr;
56
 
                filter       : image_filter_lut_ptr ); overload;
57
 
 
58
 
   function  _scale_limit : int;
59
 
   procedure scale_limit_(v : int );
60
 
 
61
 
   function  _blur_x : double;
62
 
   function  _blur_y : double;
63
 
   procedure blur_x_(v : double );
64
 
   procedure blur_y_(v : double );
65
 
   procedure blur_  (v : double );
66
 
 
67
 
  end;
68
 
 
69
 
 span_image_resample_affine = object(span_image_filter )
70
 
   m_rx     ,
71
 
   m_ry     ,
72
 
   m_rx_inv ,
73
 
   m_ry_inv : int;
74
 
 
75
 
   m_scale_limit ,
76
 
   m_blur_x      ,
77
 
   m_blur_y      : double;
78
 
 
79
 
   constructor Construct(alloc : span_allocator_ptr ); overload;
80
 
   constructor Construct(
81
 
                alloc        : span_allocator_ptr;
82
 
                src          : rendering_buffer_ptr;
83
 
                back_color   : aggclr_ptr;
84
 
                interpolator : span_interpolator_ptr;
85
 
                filter       : image_filter_lut_ptr ); overload;
86
 
 
87
 
   function  _scale_limit : int;
88
 
   procedure scale_limit_(v : int );
89
 
 
90
 
   function  _blur_x : double;
91
 
   function  _blur_y : double;
92
 
   procedure blur_x_(v : double );
93
 
   procedure blur_y_(v : double );
94
 
   procedure blur_  (v : double );
95
 
 
96
 
   procedure prepare(max_span_len : unsigned ); virtual;
97
 
 
98
 
  end;
99
 
 
100
 
{ GLOBAL PROCEDURES }
101
 
 
102
 
 
103
 
IMPLEMENTATION
104
 
{ LOCAL VARIABLES & CONSTANTS }
105
 
{ UNIT IMPLEMENTATION }
106
 
{ CONSTRUCT }
107
 
constructor span_image_resample.Construct(alloc : span_allocator_ptr );
108
 
begin
109
 
 inherited Construct(alloc );
110
 
 
111
 
 m_scale_limit:=20;
112
 
 
113
 
 m_blur_x:=image_subpixel_size;
114
 
 m_blur_y:=image_subpixel_size;
115
 
 
116
 
end;
117
 
 
118
 
{ CONSTRUCT }
119
 
constructor span_image_resample.Construct(
120
 
             alloc        : span_allocator_ptr;
121
 
             src          : rendering_buffer_ptr;
122
 
             back_color   : aggclr_ptr;
123
 
             interpolator : span_interpolator_ptr;
124
 
             filter       : image_filter_lut_ptr );
125
 
begin
126
 
 inherited Construct(alloc ,src ,back_color ,interpolator ,filter );
127
 
 
128
 
 m_scale_limit:=20;
129
 
 
130
 
 m_blur_x:=image_subpixel_size;
131
 
 m_blur_y:=image_subpixel_size;
132
 
 
133
 
end;
134
 
 
135
 
{ _SCALE_LIMIT }
136
 
function span_image_resample._scale_limit;
137
 
begin
138
 
 result:=m_scale_limit;
139
 
 
140
 
end;
141
 
 
142
 
{ SCALE_LIMIT_ }
143
 
procedure span_image_resample.scale_limit_;
144
 
begin
145
 
 m_scale_limit:=v;
146
 
 
147
 
end;
148
 
 
149
 
{ _BLUR_X }
150
 
function span_image_resample._blur_x;
151
 
begin
152
 
 result:=m_blur_x / image_subpixel_size;
153
 
 
154
 
end;
155
 
 
156
 
{ _BLUR_Y }
157
 
function span_image_resample._blur_y;
158
 
begin
159
 
 result:=m_blur_y / image_subpixel_size;
160
 
 
161
 
end;
162
 
 
163
 
{ BLUR_X_ }
164
 
procedure span_image_resample.blur_x_;
165
 
begin
166
 
 m_blur_x:=trunc(v * image_subpixel_size + 0.5 );
167
 
 
168
 
end;
169
 
 
170
 
{ BLUR_Y_ }
171
 
procedure span_image_resample.blur_y_;
172
 
begin
173
 
 m_blur_y:=trunc(v * image_subpixel_size + 0.5 );
174
 
 
175
 
end;
176
 
 
177
 
{ BLUR_ }
178
 
procedure span_image_resample.blur_;
179
 
begin
180
 
 m_blur_x:=trunc(v * image_subpixel_size + 0.5 );
181
 
 m_blur_y:=m_blur_x;
182
 
 
183
 
end;
184
 
 
185
 
{ CONSTRUCT }
186
 
constructor span_image_resample_affine.Construct(alloc : span_allocator_ptr );
187
 
begin
188
 
 inherited Construct(alloc );
189
 
 
190
 
 m_scale_limit:=200.0;
191
 
 
192
 
 m_blur_x:=1.0;
193
 
 m_blur_y:=1.0;
194
 
 
195
 
end;
196
 
 
197
 
{ CONSTRUCT }
198
 
constructor span_image_resample_affine.Construct(
199
 
             alloc        : span_allocator_ptr;
200
 
             src          : rendering_buffer_ptr;
201
 
             back_color   : aggclr_ptr;
202
 
             interpolator : span_interpolator_ptr;
203
 
             filter       : image_filter_lut_ptr );
204
 
begin
205
 
 inherited Construct(alloc ,src ,back_color ,interpolator ,filter );
206
 
 
207
 
 m_scale_limit:=200.0;
208
 
 
209
 
 m_blur_x:=1.0;
210
 
 m_blur_y:=1.0;
211
 
 
212
 
end;
213
 
 
214
 
{ _SCALE_LIMIT }
215
 
function span_image_resample_affine._scale_limit;
216
 
begin
217
 
 result:=trunc(m_scale_limit );
218
 
 
219
 
end;
220
 
 
221
 
{ SCALE_LIMIT_ }
222
 
procedure span_image_resample_affine.scale_limit_;
223
 
begin
224
 
 m_scale_limit:=v;
225
 
 
226
 
end;
227
 
 
228
 
{ _BLUR_X }
229
 
function span_image_resample_affine._blur_x;
230
 
begin
231
 
 result:=m_blur_x;
232
 
 
233
 
end;
234
 
 
235
 
{ _BLUR_Y }
236
 
function span_image_resample_affine._blur_y;
237
 
begin
238
 
 result:=m_blur_y;
239
 
 
240
 
end;
241
 
 
242
 
{ BLUR_X_ }
243
 
procedure span_image_resample_affine.blur_x_;
244
 
begin
245
 
 m_blur_x:=v;
246
 
 
247
 
end;
248
 
 
249
 
{ BLUR_Y_ }
250
 
procedure span_image_resample_affine.blur_y_;
251
 
begin
252
 
 m_blur_y:=v;
253
 
 
254
 
end;
255
 
 
256
 
{ BLUR_ }
257
 
procedure span_image_resample_affine.blur_;
258
 
begin
259
 
 m_blur_x:=v;
260
 
 m_blur_y:=v;
261
 
 
262
 
end;
263
 
 
264
 
{ PREPARE }
265
 
procedure span_image_resample_affine.prepare;
266
 
var
267
 
 scale_x ,scale_y : double;
268
 
 
269
 
begin
270
 
 inherited prepare(max_span_len );
271
 
 
272
 
 _interpolator._transformer.scaling_abs(@scale_x ,@scale_y );
273
 
 
274
 
 m_rx    :=image_subpixel_size;
275
 
 m_ry    :=image_subpixel_size;
276
 
 m_rx_inv:=image_subpixel_size;
277
 
 m_ry_inv:=image_subpixel_size;
278
 
 
279
 
 scale_x:=scale_x * m_blur_x;
280
 
 scale_y:=scale_y * m_blur_y;
281
 
 
282
 
 if scale_x * scale_y > m_scale_limit then
283
 
  begin
284
 
   scale_x:=scale_x * m_scale_limit / (scale_x * scale_y );
285
 
   scale_y:=scale_y * m_scale_limit / (scale_x * scale_y );
286
 
 
287
 
  end;
288
 
 
289
 
 if scale_x > 1.0001 then
290
 
  begin
291
 
   if scale_x > m_scale_limit then
292
 
    scale_x:=m_scale_limit;
293
 
 
294
 
   m_rx    :=trunc(scale_x * image_subpixel_size + 0.5 );
295
 
   m_rx_inv:=trunc(1.0 / scale_x * image_subpixel_size + 0.5);
296
 
 
297
 
  end;
298
 
 
299
 
 if scale_y > 1.0001 then
300
 
  begin
301
 
   if scale_y > m_scale_limit then
302
 
    scale_y:=m_scale_limit;
303
 
 
304
 
   m_ry    :=trunc(scale_y * image_subpixel_size + 0.5 );
305
 
   m_ry_inv:=trunc(1.0 / scale_y * image_subpixel_size + 0.5 );
306
 
 
307
 
  end;
308
 
 
309
 
end;
310
 
 
311
 
END.
312