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

« back to all changes in this revision

Viewing changes to components/aggpas/src/agg_pixfmt_rgb.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
 
//
22
 
// Adaptation for high precision colors has been sponsored by
23
 
// Liberty Technology Systems, Inc., visit http://lib-sys.com
24
 
//
25
 
// Liberty Technology Systems, Inc. is the provider of
26
 
// PostScript and PDF technology for software developers.
27
 
//
28
 
// [Pascal Port History] -----------------------------------------------------
29
 
//
30
 
// 23.06.2006-Milano: ptrcomp adjustments
31
 
// 18.03.2006-Milano: pf_xxx.inc completed
32
 
// 13.01.2006-Milano: Unit port establishment
33
 
//
34
 
{ agg_pixfmt_rgb.pas }
35
 
unit
36
 
 agg_pixfmt_rgb ;
37
 
 
38
 
INTERFACE
39
 
 
40
 
{$I agg_mode.inc }
41
 
{$Q- }
42
 
{$R- }
43
 
uses
44
 
 agg_basics ,
45
 
 agg_pixfmt ,
46
 
 agg_color ,
47
 
 agg_rendering_buffer ;
48
 
 
49
 
{ GLOBAL PROCEDURES }
50
 
 procedure pixfmt_bgr24(var pixf : pixel_formats; rb : rendering_buffer_ptr );
51
 
 procedure pixfmt_rgb24(var pixf : pixel_formats; rb : rendering_buffer_ptr );
52
 
 
53
 
 procedure pixfmt_bgr24_pre(var pixf : pixel_formats; rb : rendering_buffer_ptr );
54
 
 procedure pixfmt_rgb24_pre(var pixf : pixel_formats; rb : rendering_buffer_ptr );
55
 
 
56
 
 procedure pixfmt_bgr24_gamma(var pixf : pixel_formats; rb : rendering_buffer_ptr; g : gamma_ptr );
57
 
 procedure pixfmt_rgb24_gamma(var pixf : pixel_formats; rb : rendering_buffer_ptr; g : gamma_ptr );
58
 
 
59
 
 
60
 
IMPLEMENTATION
61
 
{ LOCAL VARIABLES & CONSTANTS }
62
 
{ UNIT IMPLEMENTATION }
63
 
{ fmt24_row }
64
 
function fmt24_row(this : pixel_formats_ptr; x ,y : int ) : row_data_type;
65
 
begin
66
 
 result.Construct(
67
 
  x ,this._width - 1 ,
68
 
  int8u_ptr(ptrcomp(this.m_rbuf.row(y ) ) + x * 3 * sizeof(int8u ) ) );
69
 
 
70
 
end;
71
 
 
72
 
{ fmt24_copy_from }
73
 
procedure fmt24_copy_from(this : pixel_formats_ptr; from : rendering_buffer_ptr; xdst ,ydst ,xsrc ,ysrc : int; len : unsigned );
74
 
begin
75
 
 move(
76
 
  int8u_ptr(ptrcomp(from.row(ysrc ) ) + xsrc * 3 * sizeof(int8u ) )^ ,
77
 
  int8u_ptr(ptrcomp(this.m_rbuf.row(ydst ) ) + xdst * 3 * sizeof(int8u ) )^ ,
78
 
  sizeof(int8u ) * 3 * len );
79
 
 
80
 
end;
81
 
 
82
 
{ order24_gamma_dir_apply }
83
 
procedure order24_gamma_dir_apply(this : pixel_formats; p : int8u_ptr );
84
 
begin
85
 
 int8u_ptr(ptrcomp(p ) + this.m_order.R )^:=int8u(this.m_apply.dir(int8u_ptr(ptrcomp(p ) + this.m_order.R )^ ) );
86
 
 int8u_ptr(ptrcomp(p ) + this.m_order.G )^:=int8u(this.m_apply.dir(int8u_ptr(ptrcomp(p ) + this.m_order.G )^ ) );
87
 
 int8u_ptr(ptrcomp(p ) + this.m_order.B )^:=int8u(this.m_apply.dir(int8u_ptr(ptrcomp(p ) + this.m_order.B )^ ) );
88
 
 
89
 
end;
90
 
 
91
 
{ order24_gamma_inv_apply }
92
 
procedure order24_gamma_inv_apply(this : pixel_formats; p : int8u_ptr );
93
 
begin
94
 
 int8u_ptr(ptrcomp(p ) + this.m_order.R )^:=int8u(this.m_apply.inv(int8u_ptr(ptrcomp(p ) + this.m_order.R )^ ) );
95
 
 int8u_ptr(ptrcomp(p ) + this.m_order.G )^:=int8u(this.m_apply.inv(int8u_ptr(ptrcomp(p ) + this.m_order.G )^ ) );
96
 
 int8u_ptr(ptrcomp(p ) + this.m_order.B )^:=int8u(this.m_apply.inv(int8u_ptr(ptrcomp(p ) + this.m_order.B )^ ) );
97
 
 
98
 
end;
99
 
 
100
 
{ order24_for_each_pixel }
101
 
procedure order24_for_each_pixel(this : pixel_formats_ptr; f : func_apply_gamma );
102
 
var
103
 
 y ,len : unsigned;
104
 
 
105
 
 p : int8u_ptr;
106
 
 
107
 
begin
108
 
 y:=0;
109
 
 
110
 
 while y < this._height do
111
 
  begin
112
 
   len:=this._width;
113
 
 
114
 
   p:=this.m_rbuf.row(y );
115
 
 
116
 
   repeat
117
 
    f(this ,p );
118
 
 
119
 
    inc(ptrcomp(p ) ,3 );
120
 
    dec(len );
121
 
 
122
 
   until len = 0;
123
 
 
124
 
   inc(y );
125
 
 
126
 
  end;
127
 
 
128
 
end;
129
 
 
130
 
{$I pf_bgr24.inc }
131
 
 
132
 
{ PIXFMT_BGR24 }
133
 
procedure pixfmt_bgr24;
134
 
begin
135
 
 pixf.Construct(rb );
136
 
 
137
 
 pixf.m_order:=bgr_order;
138
 
 
139
 
 pixf.m_pix_width:=3;
140
 
 
141
 
 pixf.copy_pixel :=@bgr24_copy_pixel;
142
 
 pixf.blend_pixel:=@bgr24_blend_pixel;
143
 
 
144
 
 pixf.pixel:=@bgr24_pixel;
145
 
 pixf.row  :=@fmt24_row;
146
 
 
147
 
 pixf.copy_hline:=@bgr24_copy_hline;
148
 
 pixf.copy_vline:=@bgr24_copy_vline;
149
 
 
150
 
 pixf.blend_hline:=@bgr24_blend_hline;
151
 
 pixf.blend_vline:=@bgr24_blend_vline;
152
 
 
153
 
 pixf.blend_solid_hspan:=@bgr24_blend_solid_hspan;
154
 
 pixf.blend_solid_vspan:=@bgr24_blend_solid_vspan;
155
 
 
156
 
 pixf.copy_color_hspan:=@bgr24_copy_color_hspan;
157
 
 pixf.copy_color_vspan:=@bgr24_copy_color_vspan;
158
 
 
159
 
 pixf.blend_color_hspan:=@bgr24_blend_color_hspan;
160
 
 pixf.blend_color_vspan:=@bgr24_blend_color_vspan;
161
 
 
162
 
 pixf.copy_from :=@fmt24_copy_from;
163
 
 pixf.blend_from:=@bgr24_blend_from;
164
 
 
165
 
 pixf.blend_from_color:=@bgr24_blend_from_color;
166
 
 pixf.blend_from_lut  :=@bgr24_blend_from_lut;
167
 
 
168
 
 pixf.for_each_pixel :=@order24_for_each_pixel;
169
 
 pixf.gamma_dir_apply:=@order24_gamma_dir_apply;
170
 
 pixf.gamma_inv_apply:=@order24_gamma_inv_apply;
171
 
 
172
 
end;
173
 
 
174
 
{$I pf_rgb24.inc }
175
 
 
176
 
{ PIXFMT_RGB24 }
177
 
procedure pixfmt_rgb24;
178
 
begin
179
 
 pixf.Construct(rb );
180
 
 
181
 
 pixf.m_order:=rgb_order;
182
 
 
183
 
 pixf.m_pix_width:=3;
184
 
 
185
 
 pixf.copy_pixel :=@rgb24_copy_pixel;
186
 
 pixf.blend_pixel:=@rgb24_blend_pixel;
187
 
 
188
 
 pixf.pixel:=@rgb24_pixel;
189
 
 pixf.row  :=@fmt24_row;
190
 
 
191
 
 pixf.copy_hline:=@rgb24_copy_hline;
192
 
 pixf.copy_vline:=@rgb24_copy_vline;
193
 
 
194
 
 pixf.blend_hline:=@rgb24_blend_hline;
195
 
 pixf.blend_vline:=@rgb24_blend_vline;
196
 
 
197
 
 pixf.blend_solid_hspan:=@rgb24_blend_solid_hspan;
198
 
 pixf.blend_solid_vspan:=@rgb24_blend_solid_vspan;
199
 
 
200
 
 pixf.copy_color_hspan:=@rgb24_copy_color_hspan;
201
 
 pixf.copy_color_vspan:=@rgb24_copy_color_vspan;
202
 
 
203
 
 pixf.blend_color_hspan:=@rgb24_blend_color_hspan;
204
 
 pixf.blend_color_vspan:=@rgb24_blend_color_vspan;
205
 
 
206
 
 pixf.copy_from :=@fmt24_copy_from;
207
 
 pixf.blend_from:=@rgb24_blend_from;
208
 
 
209
 
 pixf.blend_from_color:=@rgb24_blend_from_color;
210
 
 pixf.blend_from_lut  :=@rgb24_blend_from_lut;
211
 
 
212
 
 pixf.for_each_pixel :=@order24_for_each_pixel;
213
 
 pixf.gamma_dir_apply:=@order24_gamma_dir_apply;
214
 
 pixf.gamma_inv_apply:=@order24_gamma_inv_apply;
215
 
 
216
 
end;
217
 
 
218
 
{$I pf_bgr24_pre.inc }
219
 
 
220
 
{ PIXFMT_BGR24_PRE }
221
 
procedure pixfmt_bgr24_pre;
222
 
begin
223
 
 pixf.Construct(rb );
224
 
 
225
 
 pixf.m_order:=bgr_order;
226
 
 
227
 
 pixf.m_pix_width:=3;
228
 
 
229
 
 pixf.copy_pixel :=@bgr24_copy_pixel;
230
 
 pixf.blend_pixel:=@bgr24_pre_blend_pixel;
231
 
 
232
 
 pixf.pixel:=@bgr24_pixel;
233
 
 pixf.row  :=@fmt24_row;
234
 
 
235
 
 pixf.copy_hline:=@bgr24_copy_hline;
236
 
 pixf.copy_vline:=@bgr24_copy_vline;
237
 
 
238
 
 pixf.blend_hline:=@bgr24_pre_blend_hline;
239
 
 pixf.blend_vline:=@bgr24_pre_blend_vline;
240
 
 
241
 
 pixf.blend_solid_hspan:=@bgr24_pre_blend_solid_hspan;
242
 
 pixf.blend_solid_vspan:=@bgr24_pre_blend_solid_vspan;
243
 
 
244
 
 pixf.copy_color_hspan:=@bgr24_copy_color_hspan;
245
 
 pixf.copy_color_vspan:=@bgr24_copy_color_vspan;
246
 
 
247
 
 pixf.blend_color_hspan:=@bgr24_pre_blend_color_hspan;
248
 
 pixf.blend_color_vspan:=@bgr24_pre_blend_color_vspan;
249
 
 
250
 
 pixf.copy_from :=@fmt24_copy_from;
251
 
 pixf.blend_from:=@bgr24_pre_blend_from;
252
 
 
253
 
 pixf.blend_from_color:=@bgr24_pre_blend_from_color;
254
 
 pixf.blend_from_lut  :=@bgr24_pre_blend_from_lut;
255
 
 
256
 
 pixf.for_each_pixel :=@order24_for_each_pixel;
257
 
 pixf.gamma_dir_apply:=@order24_gamma_dir_apply;
258
 
 pixf.gamma_inv_apply:=@order24_gamma_inv_apply;
259
 
 
260
 
end;
261
 
 
262
 
{$I pf_rgb24_pre.inc }
263
 
 
264
 
{ PIXFMT_RGB24_PRE }
265
 
procedure pixfmt_rgb24_pre;
266
 
begin
267
 
 pixf.Construct(rb );
268
 
 
269
 
 pixf.m_order:=rgb_order;
270
 
 
271
 
 pixf.m_pix_width:=3;
272
 
 
273
 
 pixf.copy_pixel :=@rgb24_copy_pixel;
274
 
 pixf.blend_pixel:=@rgb24_pre_blend_pixel;
275
 
 
276
 
 pixf.pixel:=@rgb24_pixel;
277
 
 pixf.row  :=@fmt24_row;
278
 
 
279
 
 pixf.copy_hline:=@rgb24_copy_hline;
280
 
 pixf.copy_vline:=@rgb24_copy_vline;
281
 
 
282
 
 pixf.blend_hline:=@rgb24_pre_blend_hline;
283
 
 pixf.blend_vline:=@rgb24_pre_blend_vline;
284
 
 
285
 
 pixf.blend_solid_hspan:=@rgb24_pre_blend_solid_hspan;
286
 
 pixf.blend_solid_vspan:=@rgb24_pre_blend_solid_vspan;
287
 
 
288
 
 pixf.copy_color_hspan:=@rgb24_copy_color_hspan;
289
 
 pixf.copy_color_vspan:=@rgb24_copy_color_vspan;
290
 
 
291
 
 pixf.blend_color_hspan:=@rgb24_pre_blend_color_hspan;
292
 
 pixf.blend_color_vspan:=@rgb24_pre_blend_color_vspan;
293
 
 
294
 
 pixf.copy_from :=@fmt24_copy_from;
295
 
 pixf.blend_from:=@rgb24_pre_blend_from;
296
 
 
297
 
 pixf.blend_from_color:=@rgb24_pre_blend_from_color;
298
 
 pixf.blend_from_lut  :=@rgb24_pre_blend_from_lut;
299
 
 
300
 
 pixf.for_each_pixel :=@order24_for_each_pixel;
301
 
 pixf.gamma_dir_apply:=@order24_gamma_dir_apply;
302
 
 pixf.gamma_inv_apply:=@order24_gamma_inv_apply;
303
 
 
304
 
end;
305
 
 
306
 
{$I pf_bgr24_gamma.inc }
307
 
 
308
 
{ PIXFMT_BGR24_GAMMA }
309
 
procedure pixfmt_bgr24_gamma;
310
 
begin
311
 
 pixf.Construct(rb );
312
 
 
313
 
 pixf.m_order:=bgr_order;
314
 
 pixf.m_gamma:=g;
315
 
 
316
 
 pixf.m_pix_width:=3;
317
 
 
318
 
 pixf.copy_pixel :=@bgr24_copy_pixel;
319
 
 pixf.blend_pixel:=@bgr24_gamma_blend_pixel;
320
 
 
321
 
 pixf.pixel:=@bgr24_pixel;
322
 
 pixf.row  :=@fmt24_row;
323
 
 
324
 
 pixf.copy_hline:=@bgr24_copy_hline;
325
 
 pixf.copy_vline:=@bgr24_copy_vline;
326
 
 
327
 
 pixf.blend_hline:=@bgr24_gamma_blend_hline;
328
 
 pixf.blend_vline:=@bgr24_gamma_blend_vline;
329
 
 
330
 
 pixf.blend_solid_hspan:=@bgr24_gamma_blend_solid_hspan;
331
 
 pixf.blend_solid_vspan:=@bgr24_gamma_blend_solid_vspan;
332
 
 
333
 
 pixf.copy_color_hspan:=@bgr24_copy_color_hspan;
334
 
 pixf.copy_color_vspan:=@bgr24_copy_color_vspan;
335
 
 
336
 
 pixf.blend_color_hspan:=@bgr24_gamma_blend_color_hspan;
337
 
 pixf.blend_color_vspan:=@bgr24_gamma_blend_color_vspan;
338
 
 
339
 
 pixf.copy_from :=@fmt24_copy_from;
340
 
 pixf.blend_from:=@bgr24_gamma_blend_from;
341
 
 
342
 
 pixf.blend_from_color:=@bgr24_gamma_blend_from_color;
343
 
 pixf.blend_from_lut  :=@bgr24_gamma_blend_from_lut;
344
 
 
345
 
 pixf.for_each_pixel :=@order24_for_each_pixel;
346
 
 pixf.gamma_dir_apply:=@order24_gamma_dir_apply;
347
 
 pixf.gamma_inv_apply:=@order24_gamma_inv_apply;
348
 
 
349
 
end;
350
 
 
351
 
{$I pf_rgb24_gamma.inc }
352
 
 
353
 
{ PIXFMT_RGB24_GAMMA }
354
 
procedure pixfmt_rgb24_gamma;
355
 
begin
356
 
 pixf.Construct(rb );
357
 
 
358
 
 pixf.m_order:=rgb_order;
359
 
 pixf.m_gamma:=g;
360
 
 
361
 
 pixf.m_pix_width:=3;
362
 
 
363
 
 pixf.copy_pixel :=@rgb24_copy_pixel;
364
 
 pixf.blend_pixel:=@rgb24_gamma_blend_pixel;
365
 
 
366
 
 pixf.pixel:=@rgb24_pixel;
367
 
 pixf.row  :=@fmt24_row;
368
 
 
369
 
 pixf.copy_hline:=@rgb24_copy_hline;
370
 
 pixf.copy_vline:=@rgb24_copy_vline;
371
 
 
372
 
 pixf.blend_hline:=@rgb24_gamma_blend_hline;
373
 
 pixf.blend_vline:=@rgb24_gamma_blend_vline;
374
 
 
375
 
 pixf.blend_solid_hspan:=@rgb24_gamma_blend_solid_hspan;
376
 
 pixf.blend_solid_vspan:=@rgb24_gamma_blend_solid_vspan;
377
 
 
378
 
 pixf.copy_color_hspan:=@rgb24_copy_color_hspan;
379
 
 pixf.copy_color_vspan:=@rgb24_copy_color_vspan;
380
 
 
381
 
 pixf.blend_color_hspan:=@rgb24_gamma_blend_color_hspan;
382
 
 pixf.blend_color_vspan:=@rgb24_gamma_blend_color_vspan;
383
 
 
384
 
 pixf.copy_from :=@fmt24_copy_from;
385
 
 pixf.blend_from:=@rgb24_gamma_blend_from;
386
 
 
387
 
 pixf.blend_from_color:=@rgb24_gamma_blend_from_color;
388
 
 pixf.blend_from_lut  :=@rgb24_gamma_blend_from_lut;
389
 
 
390
 
 pixf.for_each_pixel :=@order24_for_each_pixel;
391
 
 pixf.gamma_dir_apply:=@order24_gamma_dir_apply;
392
 
 pixf.gamma_inv_apply:=@order24_gamma_inv_apply;
393
 
 
394
 
end;
395
 
 
396
 
END.
397