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

« back to all changes in this revision

Viewing changes to components/aggpas/src/agg_renderer_raster_text.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
 
// 23.06.2006-Milano: ptrcomp adjustments
24
 
// 13.02.2006-Milano: Unit port establishment
25
 
//
26
 
{ agg_renderer_raster_text.pas }
27
 
unit
28
 
 agg_renderer_raster_text ;
29
 
 
30
 
INTERFACE
31
 
 
32
 
{$I agg_mode.inc }
33
 
 
34
 
uses
35
 
 agg_basics ,
36
 
 agg_color ,
37
 
 agg_renderer_base ,
38
 
 agg_renderer_scanline ,
39
 
 agg_scanline ,
40
 
 agg_glyph_raster_bin ;
41
 
 
42
 
{ TYPES DEFINITION }
43
 
type
44
 
 renderer_raster_htext_solid = object
45
 
   m_ren   : renderer_base_ptr;
46
 
   m_glyph : glyph_raster_bin_ptr;
47
 
   m_color : aggclr;
48
 
 
49
 
   constructor Construct(ren : renderer_base_ptr; glyph : glyph_raster_bin_ptr );
50
 
 
51
 
   procedure color_(c : aggclr_ptr );
52
 
   function  _color : aggclr_ptr;
53
 
 
54
 
   procedure render_text(x ,y : double; str : PChar; flip : boolean = false );
55
 
 
56
 
  end;
57
 
 
58
 
 renderer_raster_vtext_solid = object
59
 
   m_ren   : renderer_base_ptr;
60
 
   m_glyph : glyph_raster_bin_ptr;
61
 
   m_color : aggclr;
62
 
 
63
 
   constructor Construct(ren : renderer_base_ptr; glyph : glyph_raster_bin_ptr );
64
 
 
65
 
   procedure color_(c : aggclr_ptr );
66
 
   function  _color : aggclr_ptr;
67
 
 
68
 
   procedure render_text(x ,y : double; str : PChar; flip : boolean = false );
69
 
 
70
 
  end;
71
 
 
72
 
 const_span_ptr = ^const_span;
73
 
 const_span = object
74
 
   x      ,
75
 
   len    : int16;
76
 
   covers : int8u_ptr;
77
 
 
78
 
   constructor Construct(x_ : int; len_ : unsigned; covers_ : int8u_ptr );
79
 
 
80
 
  end;
81
 
 
82
 
 scanline_single_span = object(scanline )
83
 
   m_y    : int;
84
 
   m_span : const_span;
85
 
 
86
 
   constructor Construct(x_ ,y_ : int; len_ : unsigned; covers_ : int8u_ptr );
87
 
 
88
 
   function  y : int; virtual;
89
 
   function  num_spans : unsigned; virtual;
90
 
   function  begin_ : pointer; virtual;
91
 
 
92
 
   function  sz_of_span : unsigned; virtual;
93
 
 
94
 
  end;
95
 
 
96
 
 renderer_raster_htext = object
97
 
   m_ren   : renderer_scanline_ptr;
98
 
   m_glyph : glyph_raster_bin_ptr;
99
 
 
100
 
   constructor Construct(ren : renderer_scanline_ptr; glyph : glyph_raster_bin_ptr );
101
 
 
102
 
   procedure render_text(x ,y : double; str : PChar; flip : boolean = false );
103
 
 
104
 
  end;
105
 
 
106
 
{ GLOBAL PROCEDURES }
107
 
 
108
 
 
109
 
IMPLEMENTATION
110
 
{ LOCAL VARIABLES & CONSTANTS }
111
 
{ UNIT IMPLEMENTATION }
112
 
{ CONSTRUCT }
113
 
constructor renderer_raster_htext_solid.Construct;
114
 
begin
115
 
 m_color.Construct;
116
 
 
117
 
 m_ren  :=ren;
118
 
 m_glyph:=glyph;
119
 
 
120
 
end;
121
 
 
122
 
{ COLOR_ }
123
 
procedure renderer_raster_htext_solid.color_;
124
 
begin
125
 
 m_color:=c^;
126
 
 
127
 
end;
128
 
 
129
 
{ _COLOR }
130
 
function renderer_raster_htext_solid._color;
131
 
begin
132
 
 result:=@m_color;
133
 
 
134
 
end;
135
 
 
136
 
{ RENDER_TEXT }
137
 
procedure renderer_raster_htext_solid.render_text;
138
 
var
139
 
 r : glyph_rect;
140
 
 i : int;
141
 
 
142
 
begin
143
 
 while int8u_ptr(str )^ <> 0 do
144
 
  begin
145
 
   m_glyph.prepare(@r ,x ,y ,int8u_ptr(str )^ ,flip );
146
 
 
147
 
   if r.x2 >= r.x1 then
148
 
    if flip then
149
 
     begin
150
 
      i:=r.y1;
151
 
 
152
 
      while i <= r.y2 do
153
 
       begin
154
 
        m_ren.blend_solid_hspan(
155
 
         r.x1 ,i ,r.x2 - r.x1 + 1 ,
156
 
         @m_color ,
157
 
         m_glyph.span(r.y2 - i ) );
158
 
 
159
 
        inc(i );
160
 
 
161
 
       end;
162
 
 
163
 
     end
164
 
    else
165
 
     begin
166
 
      i:=r.y1;
167
 
 
168
 
      while i <= r.y2 do
169
 
       begin
170
 
        m_ren.blend_solid_hspan(
171
 
         r.x1 ,i ,r.x2 - r.x1 + 1 ,
172
 
         @m_color ,
173
 
         m_glyph.span(i - r.y1 ) );
174
 
 
175
 
        inc(i );
176
 
 
177
 
       end;
178
 
 
179
 
     end;
180
 
 
181
 
   x:=x + r.dx;
182
 
   y:=y + r.dy;
183
 
 
184
 
   inc(ptrcomp(str ) );
185
 
 
186
 
  end;
187
 
 
188
 
end;
189
 
 
190
 
{ CONSTRUCT }
191
 
constructor renderer_raster_vtext_solid.Construct;
192
 
begin
193
 
 m_color.Construct;
194
 
 
195
 
 m_ren  :=ren;
196
 
 m_glyph:=glyph;
197
 
 
198
 
end;
199
 
 
200
 
{ COLOR_ }
201
 
procedure renderer_raster_vtext_solid.color_;
202
 
begin
203
 
 m_color:=c^;
204
 
 
205
 
end;
206
 
 
207
 
{ _COLOR }
208
 
function renderer_raster_vtext_solid._color;
209
 
begin
210
 
 result:=@m_color;
211
 
 
212
 
end;
213
 
 
214
 
{ RENDER_TEXT }
215
 
procedure renderer_raster_vtext_solid.render_text;
216
 
var
217
 
 r : glyph_rect;
218
 
 i : int;
219
 
 
220
 
begin
221
 
 while int8u_ptr(str )^ <> 0 do
222
 
  begin
223
 
   m_glyph.prepare(@r ,x ,y ,int8u_ptr(str )^ ,flip );
224
 
 
225
 
   if r.x2 >= r.x1 then
226
 
    if flip then
227
 
     begin
228
 
      i:=r.y1;
229
 
 
230
 
      while i <= r.y2 do
231
 
       begin
232
 
        m_ren.blend_solid_vspan(
233
 
         i ,r.x1 ,r.x2 - r.x1 + 1 ,
234
 
         @m_color ,
235
 
         m_glyph.span(i - r.y1 ) );
236
 
 
237
 
        inc(i );
238
 
 
239
 
       end;
240
 
 
241
 
     end
242
 
    else
243
 
     begin
244
 
      i:=r.y1;
245
 
 
246
 
      while i <= r.y2 do
247
 
       begin
248
 
        m_ren.blend_solid_vspan(
249
 
         i ,r.x1 ,r.x2 - r.x1 + 1 ,
250
 
         @m_color ,
251
 
         m_glyph.span(r.y2 - i ) );
252
 
 
253
 
        inc(i );
254
 
 
255
 
       end;
256
 
 
257
 
     end;
258
 
 
259
 
   x:=x + r.dx;
260
 
   y:=y + r.dy;
261
 
 
262
 
   inc(ptrcomp(str ) );
263
 
 
264
 
  end;
265
 
 
266
 
end;
267
 
 
268
 
{ CONSTRUCT }
269
 
constructor const_span.Construct;
270
 
begin
271
 
 x     :=x_;
272
 
 len   :=len_;
273
 
 covers:=covers_;
274
 
 
275
 
end;
276
 
 
277
 
{ CONSTRUCT }
278
 
constructor scanline_single_span.Construct;
279
 
begin
280
 
 m_y:=y_;
281
 
 
282
 
 m_span.Construct(x_ ,len_ ,covers_ );
283
 
 
284
 
end;
285
 
 
286
 
{ Y }
287
 
function scanline_single_span.y;
288
 
begin
289
 
 result:=m_y;
290
 
 
291
 
end;
292
 
 
293
 
{ NUM_SPANS }
294
 
function scanline_single_span.num_spans;
295
 
begin
296
 
 result:=1;
297
 
 
298
 
end;
299
 
 
300
 
{ BEGIN_ }
301
 
function scanline_single_span.begin_;
302
 
begin
303
 
 result:=@m_span;
304
 
 
305
 
end;
306
 
 
307
 
{ SZ_OF_SPAN }
308
 
function scanline_single_span.sz_of_span;
309
 
begin
310
 
 result:=sizeof(const_span );
311
 
 
312
 
end;
313
 
 
314
 
{ CONSTRUCT }
315
 
constructor renderer_raster_htext.Construct;
316
 
begin
317
 
 m_ren  :=ren;
318
 
 m_glyph:=glyph;
319
 
 
320
 
end;
321
 
 
322
 
{ RENDER_TEXT }
323
 
procedure renderer_raster_htext.render_text;
324
 
var
325
 
 r : glyph_rect;
326
 
 i : int;
327
 
 s : scanline_single_span;
328
 
 
329
 
begin
330
 
 while int8u_ptr(str )^ <> 0 do
331
 
  begin
332
 
   m_glyph.prepare(@r ,x ,y ,int8u_ptr(str )^ ,flip );
333
 
 
334
 
   if r.x2 >= r.x1 then
335
 
    begin
336
 
     m_ren.prepare(r.x2 - r.x1 + 1 );
337
 
 
338
 
     if flip then
339
 
      begin
340
 
       i:=r.y1;
341
 
 
342
 
       while i <= r.y2 do
343
 
        begin
344
 
         s.Construct(
345
 
          r.x1 ,i ,r.x2 - r.x1 + 1 ,
346
 
          m_glyph.span(r.y2 - i ) );
347
 
 
348
 
         m_ren.render(@s ); 
349
 
 
350
 
         inc(i );
351
 
 
352
 
        end;
353
 
 
354
 
      end
355
 
     else
356
 
      begin
357
 
       i:=r.y1;
358
 
 
359
 
       while i <= r.y2 do
360
 
        begin
361
 
         s.Construct(
362
 
          r.x1 ,i ,(r.x2 - r.x1 + 1 ) ,
363
 
          m_glyph.span(i - r.y1 ) );
364
 
 
365
 
         m_ren.render(@s ); 
366
 
 
367
 
         inc(i );
368
 
 
369
 
        end;
370
 
 
371
 
      end;
372
 
 
373
 
    end;
374
 
 
375
 
   x:=x + r.dx;
376
 
   y:=y + r.dy;
377
 
 
378
 
   inc(ptrcomp(str ) );
379
 
 
380
 
  end;
381
 
 
382
 
end;
383
 
 
384
 
END.
385