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

« back to all changes in this revision

Viewing changes to components/aggpas/src/pf_bgr24_pre.inc

  • 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
 
// AggPas 2.4 RM3 pixel format definition file
3
 
//
4
 
{ blend_pix_bgr_pre }
5
 
procedure blend_pix_bgr_pre(p : int8u_ptr; cr ,cg ,cb ,alpha ,cover : unsigned ); overload;
6
 
begin
7
 
 alpha:=base_mask - alpha;
8
 
 cover:=(cover + 1 ) shl (base_shift - 8 );
9
 
 
10
 
 order_bgr(pointer(p )^ ).R:=int8u((order_bgr(pointer(p )^ ).R * alpha + cr * cover ) shr base_shift );
11
 
 order_bgr(pointer(p )^ ).G:=int8u((order_bgr(pointer(p )^ ).G * alpha + cg * cover ) shr base_shift );
12
 
 order_bgr(pointer(p )^ ).B:=int8u((order_bgr(pointer(p )^ ).B * alpha + cb * cover ) shr base_shift );
13
 
 
14
 
end;
15
 
 
16
 
{ blend_pix_bgr_pre }
17
 
procedure blend_pix_bgr_pre(p : int8u_ptr; cr ,cg ,cb ,alpha : unsigned ); overload;
18
 
begin
19
 
 alpha:=base_mask - alpha;
20
 
 
21
 
 order_bgr(pointer(p )^ ).R:=int8u(((order_bgr(pointer(p )^ ).R * alpha ) shr base_shift ) + cr );
22
 
 order_bgr(pointer(p )^ ).G:=int8u(((order_bgr(pointer(p )^ ).G * alpha ) shr base_shift ) + cg );
23
 
 order_bgr(pointer(p )^ ).B:=int8u(((order_bgr(pointer(p )^ ).B * alpha ) shr base_shift ) + cb );
24
 
 
25
 
end;
26
 
 
27
 
{ copy_or_blend_pix_bgr_pre }
28
 
procedure copy_or_blend_pix_bgr_pre(p : int8u_ptr; c : aggclr_ptr; cover : unsigned ); overload;
29
 
var
30
 
 alpha : unsigned;
31
 
 
32
 
begin
33
 
 if c.a <> 0 then
34
 
  begin
35
 
   alpha:=(c.a * (cover + 1 ) ) shr 8;
36
 
 
37
 
   if alpha = base_mask then
38
 
    begin
39
 
     order_bgr(pointer(p )^ ).R:=c.r;
40
 
     order_bgr(pointer(p )^ ).G:=c.g;
41
 
     order_bgr(pointer(p )^ ).B:=c.b;
42
 
 
43
 
    end
44
 
   else
45
 
    blend_pix_bgr_pre(p ,c.r ,c.g ,c.b ,alpha ,cover );
46
 
 
47
 
  end;
48
 
 
49
 
end;
50
 
 
51
 
{ copy_or_blend_pix_bgr_pre }
52
 
procedure copy_or_blend_pix_bgr_pre(p : int8u_ptr; c : aggclr_ptr ); overload;
53
 
begin
54
 
 if c.a <> 0 then
55
 
  if c.a = base_mask then
56
 
   begin
57
 
    order_bgr(pointer(p )^ ).R:=c.r;
58
 
    order_bgr(pointer(p )^ ).G:=c.g;
59
 
    order_bgr(pointer(p )^ ).B:=c.b;
60
 
 
61
 
   end
62
 
  else
63
 
   blend_pix_bgr_pre(p ,c.r ,c.g ,c.b ,c.a );
64
 
 
65
 
end;
66
 
 
67
 
{ bgr24_pre_blend_pixel }
68
 
procedure bgr24_pre_blend_pixel(this : pixel_formats_ptr; x ,y : int; c : aggclr_ptr; cover : int8u );
69
 
begin
70
 
 copy_or_blend_pix_bgr_pre(int8u_ptr(ptrcomp(this.m_rbuf.row(y ) ) + x + x + x ) ,c ,cover );
71
 
 
72
 
end;
73
 
 
74
 
{ bgr24_pre_blend_hline }
75
 
procedure bgr24_pre_blend_hline(this : pixel_formats_ptr; x ,y : int; len : unsigned; c : aggclr_ptr; cover : int8u );
76
 
var
77
 
 p : int8u_ptr;
78
 
 
79
 
 alpha : unsigned;
80
 
 
81
 
begin
82
 
 if c.a <> 0 then
83
 
  begin
84
 
   p:=int8u_ptr(ptrcomp(this.m_rbuf.row(y ) ) + x + x + x );
85
 
 
86
 
   alpha:=(c.a * (cover + 1 ) ) shr 8;
87
 
 
88
 
   if alpha = base_mask then
89
 
    repeat
90
 
     order_bgr(pointer(p )^ ).R:=c.r;
91
 
     order_bgr(pointer(p )^ ).G:=c.g;
92
 
     order_bgr(pointer(p )^ ).B:=c.b;
93
 
 
94
 
     inc(ptrcomp(p ) ,3 );
95
 
     dec(len );
96
 
 
97
 
    until len = 0
98
 
   else
99
 
    repeat
100
 
     blend_pix_bgr_pre(p ,c.r ,c.g ,c.b ,alpha );
101
 
 
102
 
     inc(ptrcomp(p ) ,3 );
103
 
     dec(len );
104
 
 
105
 
    until len = 0;
106
 
 
107
 
  end;
108
 
 
109
 
end;
110
 
 
111
 
{ bgr24_pre_blend_vline }
112
 
procedure bgr24_pre_blend_vline(this : pixel_formats_ptr; x ,y : int; len : unsigned; c : aggclr_ptr; cover : int8u );
113
 
var
114
 
 p : int8u_ptr;
115
 
 
116
 
 alpha : unsigned;
117
 
 
118
 
begin
119
 
 if c.a <> 0 then
120
 
  begin
121
 
   p:=int8u_ptr(ptrcomp(this.m_rbuf.row(y ) ) + x + x + x );
122
 
 
123
 
   alpha:=(c.a * (cover + 1 ) ) shr 8;
124
 
 
125
 
   if alpha = base_mask then
126
 
    repeat
127
 
     order_bgr(pointer(p )^ ).R:=c.r;
128
 
     order_bgr(pointer(p )^ ).G:=c.g;
129
 
     order_bgr(pointer(p )^ ).B:=c.b;
130
 
 
131
 
     p:=int8u_ptr(this.m_rbuf.next_row(p ) );
132
 
 
133
 
     dec(len );
134
 
 
135
 
    until len = 0
136
 
   else
137
 
    repeat
138
 
     blend_pix_bgr_pre(p ,c.r ,c.g ,c.b ,alpha ,cover );
139
 
 
140
 
     p:=int8u_ptr(this.m_rbuf.next_row(p ) );
141
 
 
142
 
     dec(len );
143
 
 
144
 
    until len = 0;
145
 
 
146
 
  end;
147
 
 
148
 
end;
149
 
 
150
 
{ bgr24_pre_blend_solid_hspan }
151
 
procedure bgr24_pre_blend_solid_hspan(this : pixel_formats_ptr; x ,y : int; len : unsigned; c : aggclr_ptr; covers : int8u_ptr );
152
 
var
153
 
 p : int8u_ptr;
154
 
 
155
 
 alpha : unsigned;
156
 
 
157
 
begin
158
 
 if c.a <> 0 then
159
 
  begin
160
 
   p:=int8u_ptr(ptrcomp(this.m_rbuf.row(y ) ) + x + x + x );
161
 
 
162
 
   repeat
163
 
    alpha:=(c.a * (covers^ + 1 ) ) shr 8;
164
 
 
165
 
    if alpha = base_mask then
166
 
     begin
167
 
      order_bgr(pointer(p )^ ).R:=c.r;
168
 
      order_bgr(pointer(p )^ ).G:=c.g;
169
 
      order_bgr(pointer(p )^ ).B:=c.b;
170
 
 
171
 
     end
172
 
    else
173
 
     blend_pix_bgr_pre(p ,c.r ,c.g ,c.b ,alpha ,covers^ );
174
 
 
175
 
    inc(ptrcomp(p ) ,3 );
176
 
    inc(ptrcomp(covers ) );
177
 
    dec(len );
178
 
 
179
 
   until len = 0;
180
 
 
181
 
  end;
182
 
 
183
 
end;
184
 
 
185
 
{ bgr24_pre_blend_solid_vspan }
186
 
procedure bgr24_pre_blend_solid_vspan(this : pixel_formats_ptr; x ,y : int; len : unsigned; c : aggclr_ptr; covers : int8u_ptr );
187
 
var
188
 
 p : int8u_ptr;
189
 
 
190
 
 alpha : unsigned;
191
 
 
192
 
begin
193
 
 if c.a <> 0 then
194
 
  begin
195
 
   p:=int8u_ptr(ptrcomp(this.m_rbuf.row(y ) ) + x + x + x );
196
 
 
197
 
   repeat
198
 
    alpha:=(c.a * (covers^ + 1 ) ) shr 8;
199
 
 
200
 
    if alpha = base_mask then
201
 
     begin
202
 
      order_bgr(pointer(p )^ ).R:=c.r;
203
 
      order_bgr(pointer(p )^ ).G:=c.g;
204
 
      order_bgr(pointer(p )^ ).B:=c.b;
205
 
 
206
 
     end
207
 
    else
208
 
     blend_pix_bgr_pre(p ,c.r ,c.g ,c.b ,alpha,covers^ );
209
 
 
210
 
    p:=int8u_ptr(this.m_rbuf.next_row(p ) );
211
 
 
212
 
    inc(ptrcomp(covers ) );
213
 
    dec(len );
214
 
 
215
 
   until len = 0;
216
 
 
217
 
  end;
218
 
 
219
 
end;
220
 
 
221
 
{ bgr24_pre_blend_color_hspan }
222
 
procedure bgr24_pre_blend_color_hspan(this : pixel_formats_ptr; x ,y : int; len : unsigned; colors : aggclr_ptr; covers : int8u_ptr; cover : int8u );
223
 
var
224
 
 p : int8u_ptr;
225
 
 
226
 
begin
227
 
 p:=int8u_ptr(ptrcomp(this.m_rbuf.row(y ) ) + x + x + x );
228
 
 
229
 
 if covers <> NIL then
230
 
  repeat
231
 
   copy_or_blend_pix_bgr_pre(p ,colors ,covers^ );
232
 
 
233
 
   inc(ptrcomp(colors ) ,sizeof(aggclr ) );
234
 
   inc(ptrcomp(covers ) ,sizeof(int8u ) );
235
 
   inc(ptrcomp(p ) ,3 );
236
 
   dec(len );
237
 
 
238
 
  until len = 0
239
 
 else
240
 
  if cover = 255 then
241
 
   repeat
242
 
    copy_or_blend_pix_bgr_pre(p ,colors );
243
 
 
244
 
    inc(ptrcomp(colors ) ,sizeof(aggclr ) );
245
 
    inc(ptrcomp(p ) ,3 );
246
 
    dec(len );
247
 
 
248
 
   until len = 0
249
 
  else
250
 
   repeat
251
 
    copy_or_blend_pix_bgr_pre(p ,colors ,cover );
252
 
 
253
 
    inc(ptrcomp(colors ) ,sizeof(aggclr ) );
254
 
    inc(ptrcomp(p ) ,3 );
255
 
    dec(len );
256
 
 
257
 
   until len = 0;
258
 
 
259
 
end;
260
 
 
261
 
{ bgr24_pre_blend_color_vspan }
262
 
procedure bgr24_pre_blend_color_vspan(this : pixel_formats_ptr; x ,y : int; len : unsigned; colors : aggclr_ptr; covers : int8u_ptr; cover : int8u );
263
 
var
264
 
 p : int8u_ptr;
265
 
 
266
 
begin
267
 
 p:=int8u_ptr(ptrcomp(this.m_rbuf.row(y ) ) + x + x + x );
268
 
 
269
 
 if covers <> NIL then
270
 
  repeat
271
 
   copy_or_blend_pix_bgr_pre(p ,colors ,covers^ );
272
 
 
273
 
   inc(ptrcomp(colors ) ,sizeof(aggclr ) );
274
 
   inc(ptrcomp(covers ) ,sizeof(int8u ) );
275
 
 
276
 
   p:=int8u_ptr(this.m_rbuf.next_row(p ) );
277
 
 
278
 
   dec(len );
279
 
 
280
 
  until len = 0
281
 
 else
282
 
  if cover = 255 then
283
 
   repeat
284
 
    copy_or_blend_pix_bgr_pre(p ,colors );
285
 
 
286
 
    inc(ptrcomp(colors ) ,sizeof(aggclr ) );
287
 
 
288
 
    p:=int8u_ptr(this.m_rbuf.next_row(p ) );
289
 
 
290
 
    dec(len );
291
 
 
292
 
   until len = 0
293
 
  else
294
 
   repeat
295
 
    copy_or_blend_pix_bgr_pre(p ,colors ,cover );
296
 
 
297
 
    inc(ptrcomp(colors ) ,sizeof(aggclr ) );
298
 
 
299
 
    p:=int8u_ptr(this.m_rbuf.next_row(p ) );
300
 
 
301
 
    dec(len );
302
 
 
303
 
   until len = 0;
304
 
 
305
 
end;
306
 
 
307
 
{ bgr24_pre_blend_from }
308
 
procedure bgr24_pre_blend_from(this : pixel_formats_ptr; from : pixel_formats_ptr; psrc_ : int8u_ptr; xdst ,ydst ,xsrc ,ysrc : int; len : unsigned; cover : int8u );
309
 
var
310
 
 psrc ,pdst : int8u_ptr;
311
 
 
312
 
 color : aggclr;
313
 
 alpha : unsigned;
314
 
 
315
 
begin
316
 
 psrc:=psrc_;
317
 
 pdst:=int8u_ptr(ptrcomp(this.m_rbuf.row(ydst ) ) + xdst * 3 * sizeof(int8u ) );
318
 
 
319
 
 if cover = 255 then
320
 
  repeat
321
 
   alpha:=int8u_ptr(ptrcomp(psrc ) + from.m_order.A )^;
322
 
 
323
 
   if alpha <> 0 then
324
 
    if alpha = base_mask then
325
 
     begin
326
 
      order_bgr(pointer(pdst )^ ).R:=int8u_ptr(ptrcomp(psrc ) + from.m_order.R )^;
327
 
      order_bgr(pointer(pdst )^ ).G:=int8u_ptr(ptrcomp(psrc ) + from.m_order.G )^;
328
 
      order_bgr(pointer(pdst )^ ).B:=int8u_ptr(ptrcomp(psrc ) + from.m_order.B )^;
329
 
 
330
 
     end
331
 
    else
332
 
     blend_pix_bgr_pre(
333
 
      pdst ,
334
 
      int8u_ptr(ptrcomp(psrc ) + from.m_order.R )^ ,
335
 
      int8u_ptr(ptrcomp(psrc ) + from.m_order.G )^ ,
336
 
      int8u_ptr(ptrcomp(psrc ) + from.m_order.B )^ ,
337
 
      alpha );
338
 
 
339
 
   inc(ptrcomp(psrc ) ,4 );
340
 
   inc(ptrcomp(pdst ) ,3 );
341
 
   dec(len );
342
 
 
343
 
  until len = 0
344
 
 else
345
 
  repeat
346
 
   color.ConstrInt(
347
 
    int8u_ptr(ptrcomp(psrc ) + from.m_order.R )^ ,
348
 
    int8u_ptr(ptrcomp(psrc ) + from.m_order.G )^ ,
349
 
    int8u_ptr(ptrcomp(psrc ) + from.m_order.B )^ ,
350
 
    int8u_ptr(ptrcomp(psrc ) + from.m_order.A )^ );
351
 
 
352
 
   copy_or_blend_pix_bgr_pre(pdst ,@color ,cover );
353
 
 
354
 
   inc(ptrcomp(psrc ) ,4 );
355
 
   inc(ptrcomp(pdst ) ,3 );
356
 
   dec(len );
357
 
 
358
 
  until len = 0;
359
 
 
360
 
end;
361
 
 
362
 
{ bgr24_pre_blend_from_color }
363
 
procedure bgr24_pre_blend_from_color(this : pixel_formats_ptr; from : pixel_formats_ptr; color : aggclr_ptr; xdst ,ydst ,xsrc ,ysrc : int; len : unsigned; cover : int8u );
364
 
var
365
 
 ppsz : unsigned;
366
 
 
367
 
 psrc ,pdst : int8u_ptr;
368
 
 
369
 
begin
370
 
 ppsz:=from._pix_width;
371
 
 psrc:=from.row_ptr(ysrc );
372
 
 
373
 
 if psrc <> NIL then
374
 
  begin
375
 
   pdst:=int8u_ptr(ptrcomp(this.m_rbuf.row_xy(xdst ,ydst ,len ) ) + xdst * 3 * sizeof(int8u ) );
376
 
 
377
 
   repeat
378
 
    copy_or_blend_pix_bgr_pre(
379
 
     pdst ,color ,
380
 
     shr_int32(psrc^ * cover + base_mask ,base_shift ) );
381
 
 
382
 
    inc(ptrcomp(psrc ) ,ppsz );
383
 
    inc(ptrcomp(pdst ) ,3 );
384
 
    dec(len );
385
 
 
386
 
   until len = 0;
387
 
 
388
 
  end;
389
 
 
390
 
end;
391
 
 
392
 
{ bgr24_pre_blend_from_lut }
393
 
procedure bgr24_pre_blend_from_lut(this : pixel_formats_ptr; from : pixel_formats_ptr; color_lut : aggclr_ptr; xdst ,ydst ,xsrc ,ysrc : int; len : unsigned; cover : int8u );
394
 
var
395
 
 ppsz : unsigned;
396
 
 
397
 
 psrc ,pdst : int8u_ptr;
398
 
 
399
 
 color : aggclr_ptr;
400
 
 
401
 
begin
402
 
 ppsz:=from._pix_width;
403
 
 psrc:=from.row_ptr(ysrc );
404
 
 
405
 
 if psrc <> NIL then
406
 
  begin
407
 
   pdst:=int8u_ptr(ptrcomp(this.m_rbuf.row_xy(xdst ,ydst ,len ) ) + xdst * 3 * sizeof(int8u ) );
408
 
 
409
 
   if cover = 255 then
410
 
    repeat
411
 
     color:=aggclr_ptr(ptrcomp(color_lut ) + psrc^ * sizeof(aggclr ) );
412
 
 
413
 
     blend_pix_bgr_pre(pdst ,color.r ,color.g ,color.b ,color.a );
414
 
 
415
 
     inc(ptrcomp(psrc ) ,ppsz );
416
 
     inc(ptrcomp(pdst ) ,3 );
417
 
     dec(len );
418
 
 
419
 
    until len = 0
420
 
   else
421
 
    repeat
422
 
     copy_or_blend_pix_bgr_pre(
423
 
      pdst ,aggclr_ptr(ptrcomp(color_lut ) + psrc^ * sizeof(aggclr ) ) ,cover);
424
 
 
425
 
     inc(ptrcomp(psrc ) ,ppsz );
426
 
     inc(ptrcomp(pdst ) ,3 );
427
 
     dec(len );
428
 
 
429
 
    until len = 0;
430
 
 
431
 
  end;
432
 
 
433
 
end;
434