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

« back to all changes in this revision

Viewing changes to components/aggpas/src/agg_glyph_raster_bin.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_glyph_raster_bin.pas }
27
 
unit
28
 
 agg_glyph_raster_bin ;
29
 
 
30
 
INTERFACE
31
 
 
32
 
{$I agg_mode.inc }
33
 
 
34
 
uses
35
 
 agg_basics ;
36
 
 
37
 
{ TYPES DEFINITION }
38
 
type
39
 
 glyph_rect_ptr = ^glyph_rect;
40
 
 glyph_rect = record
41
 
   x1 ,y1 ,x2 ,y2 : int;
42
 
 
43
 
   dx ,dy : double;
44
 
 
45
 
  end;
46
 
 
47
 
 glyph_raster_bin_ptr = ^glyph_raster_bin;
48
 
 glyph_raster_bin = object
49
 
   m_font : int8u_ptr;
50
 
 
51
 
   m_big_endian : boolean;
52
 
 
53
 
   m_span : array[0..31 ] of int8u;
54
 
   m_bits : int8u_ptr;
55
 
 
56
 
   m_glyph_width      ,
57
 
   m_glyph_byte_width : unsigned;
58
 
 
59
 
   constructor Construct(font : int8u_ptr );
60
 
 
61
 
   function  _font : int8u_ptr;
62
 
   procedure font_(f : int8u_ptr );
63
 
 
64
 
   function  height : double;
65
 
   function  base_line : double;
66
 
 
67
 
   function  width  (str : PChar ) : double;
68
 
   procedure prepare(r : glyph_rect_ptr; x ,y : double; glyph : unsigned; flip : boolean );
69
 
   function  span   (i : unsigned ) : int8u_ptr;
70
 
 
71
 
   function  value(p : int8u_ptr ) : int16u;
72
 
 
73
 
  end;
74
 
 
75
 
{ GLOBAL PROCEDURES }
76
 
 
77
 
 
78
 
IMPLEMENTATION
79
 
{ LOCAL VARIABLES & CONSTANTS }
80
 
{ UNIT IMPLEMENTATION }
81
 
{ CONSTRUCT }
82
 
constructor glyph_raster_bin.Construct;
83
 
var
84
 
 t : int;
85
 
 
86
 
begin
87
 
 m_font:=font;
88
 
 
89
 
 t:=1;
90
 
 
91
 
 if byte(pointer(@t )^ ) = 0 then
92
 
  m_big_endian:=true
93
 
 else
94
 
  m_big_endian:=false;
95
 
 
96
 
 fillchar(m_span ,sizeof(m_span ) ,0 );
97
 
 
98
 
end;
99
 
 
100
 
{ _FONT }
101
 
function glyph_raster_bin._font;
102
 
begin
103
 
 result:=m_font;
104
 
 
105
 
end;
106
 
 
107
 
{ FONT_ }
108
 
procedure glyph_raster_bin.font_;
109
 
begin
110
 
 m_font:=f;
111
 
 
112
 
end;
113
 
 
114
 
{ HEIGHT }
115
 
function glyph_raster_bin.height;
116
 
begin
117
 
 result:=int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^;
118
 
 
119
 
end;
120
 
 
121
 
{ BASE_LINE }
122
 
function glyph_raster_bin.base_line;
123
 
begin
124
 
 result:=int8u_ptr(ptrcomp(m_font ) + 1 * sizeof(int8u ) )^;
125
 
 
126
 
end;
127
 
 
128
 
{ WIDTH }
129
 
function glyph_raster_bin.width;
130
 
var
131
 
 start_char ,num_chars ,w ,glyph : unsigned;
132
 
 
133
 
 bits : int8u_ptr;
134
 
 
135
 
begin
136
 
 start_char:=int8u_ptr(ptrcomp(m_font ) + 2 * sizeof(int8u ) )^;
137
 
 num_chars :=int8u_ptr(ptrcomp(m_font ) + 3 * sizeof(int8u ) )^;
138
 
 
139
 
 w:=0;
140
 
 
141
 
 while str <> #0 do
142
 
  begin
143
 
   glyph:=int8u_ptr(str )^;
144
 
 
145
 
   bits:=
146
 
    int8u_ptr(
147
 
     ptrcomp(m_font ) + 4 + num_chars * 2 +
148
 
     value(int8u_ptr(ptrcomp(m_font ) + 4 + (glyph - start_char ) * 2 ) ) );
149
 
 
150
 
   inc(w ,bits^ );
151
 
   inc(ptrcomp(str ) );
152
 
 
153
 
  end;
154
 
 
155
 
 result:=w;
156
 
 
157
 
end;
158
 
 
159
 
{ PREPARE }
160
 
procedure glyph_raster_bin.prepare;
161
 
var
162
 
 start_char ,num_chars : unsigned;
163
 
 
164
 
begin
165
 
 start_char:=int8u_ptr(ptrcomp(m_font ) + 2 * sizeof(int8u ) )^;
166
 
 num_chars :=int8u_ptr(ptrcomp(m_font ) + 3 * sizeof(int8u ) )^;
167
 
 
168
 
 m_bits:=
169
 
  int8u_ptr(
170
 
   ptrcomp(m_font ) + 4 + num_chars * 2 +
171
 
   value(int8u_ptr(ptrcomp(m_font ) + 4 + (glyph - start_char ) * 2 ) ) );
172
 
 
173
 
 m_glyph_width:=m_bits^;
174
 
 
175
 
 inc(ptrcomp(m_bits ) );
176
 
 
177
 
 m_glyph_byte_width:=(m_glyph_width + 7 ) shr 3;
178
 
 
179
 
 r.x1:=trunc(x );
180
 
 r.x2:=r.x1 + m_glyph_width - 1;
181
 
 
182
 
 if flip then
183
 
  begin
184
 
   r.y1:=
185
 
    trunc(y ) -
186
 
    int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^ +
187
 
    int8u_ptr(ptrcomp(m_font ) + 1 * sizeof(int8u ) )^;
188
 
 
189
 
   r.y2:=r.y1 + int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^ - 1;
190
 
 
191
 
  end
192
 
 else
193
 
  begin
194
 
   r.y1:=trunc(y ) - int8u_ptr(ptrcomp(m_font ) + 1 * sizeof(int8u ) )^ + 1;
195
 
   r.y2:=r.y1 + int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^ - 1;
196
 
 
197
 
  end;
198
 
 
199
 
 r.dx:=m_glyph_width;
200
 
 r.dy:=0;
201
 
 
202
 
end;
203
 
 
204
 
{ SPAN }
205
 
function glyph_raster_bin.span;
206
 
var
207
 
 bits : int8u_ptr;
208
 
 
209
 
 j ,val ,nb : unsigned;
210
 
 
211
 
begin
212
 
 i:=int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^ - i - 1;
213
 
 
214
 
 bits:=int8u_ptr(ptrcomp(m_bits ) + i * m_glyph_byte_width );
215
 
 val :=bits^;
216
 
 nb  :=0;
217
 
 
218
 
 for j:=0 to m_glyph_width - 1 do
219
 
  begin
220
 
   if val and $80 <> 0 then
221
 
    m_span[j ]:=int8u(cover_full )
222
 
   else
223
 
    m_span[j ]:=int8u(cover_none );
224
 
 
225
 
   val:=val shl 1;
226
 
 
227
 
   inc(nb );
228
 
 
229
 
   if nb >= 8 then
230
 
    begin
231
 
     inc(ptrcomp(bits ) );
232
 
 
233
 
     val:=bits^;
234
 
     nb :=0;
235
 
 
236
 
    end;
237
 
 
238
 
  end;
239
 
 
240
 
 result:=@m_span[0 ];
241
 
 
242
 
end;
243
 
 
244
 
{ VALUE }
245
 
function glyph_raster_bin.value;
246
 
var
247
 
 v : int16u;
248
 
 
249
 
begin
250
 
 if m_big_endian then
251
 
  begin
252
 
   int16u_(v ).Low :=int8u_ptr(ptrcomp(p ) + 1 )^;
253
 
   int16u_(v ).High:=p^;
254
 
 
255
 
  end
256
 
 else
257
 
  begin
258
 
   int16u_(v ).Low :=p^;
259
 
   int16u_(v ).High:=int8u_ptr(ptrcomp(p ) + 1 )^;
260
 
 
261
 
  end;
262
 
 
263
 
 result:=v;
264
 
 
265
 
end;
266
 
 
267
 
END.
268