1
//----------------------------------------------------------------------------
2
// Anti-Grain Geometry - Version 2.4 (Public License)
3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5
// Anti-Grain Geometry - Version 2.4 Release Milano 3 (AggPas 2.4 RM3)
6
// Pascal Port By: Milan Marusinec alias Milano
8
// http://www.aggpas.org
9
// Copyright (c) 2005-2006
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.
16
//----------------------------------------------------------------------------
17
// Contact: mcseem@antigrain.com
18
// mcseemagg@yahoo.com
19
// http://www.antigrain.com
21
// [Pascal Port History] -----------------------------------------------------
23
// 23.06.2006-Milano: ptrcomp adjustments
24
// 13.02.2006-Milano: Unit port establishment
26
{ agg_glyph_raster_bin.pas }
28
agg_glyph_raster_bin ;
39
glyph_rect_ptr = ^glyph_rect;
47
glyph_raster_bin_ptr = ^glyph_raster_bin;
48
glyph_raster_bin = object
51
m_big_endian : boolean;
53
m_span : array[0..31 ] of int8u;
57
m_glyph_byte_width : unsigned;
59
constructor Construct(font : int8u_ptr );
61
function _font : int8u_ptr;
62
procedure font_(f : int8u_ptr );
64
function height : double;
65
function base_line : double;
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;
71
function value(p : int8u_ptr ) : int16u;
79
{ LOCAL VARIABLES & CONSTANTS }
80
{ UNIT IMPLEMENTATION }
82
constructor glyph_raster_bin.Construct;
91
if byte(pointer(@t )^ ) = 0 then
96
fillchar(m_span ,sizeof(m_span ) ,0 );
101
function glyph_raster_bin._font;
108
procedure glyph_raster_bin.font_;
115
function glyph_raster_bin.height;
117
result:=int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^;
122
function glyph_raster_bin.base_line;
124
result:=int8u_ptr(ptrcomp(m_font ) + 1 * sizeof(int8u ) )^;
129
function glyph_raster_bin.width;
131
start_char ,num_chars ,w ,glyph : unsigned;
136
start_char:=int8u_ptr(ptrcomp(m_font ) + 2 * sizeof(int8u ) )^;
137
num_chars :=int8u_ptr(ptrcomp(m_font ) + 3 * sizeof(int8u ) )^;
143
glyph:=int8u_ptr(str )^;
147
ptrcomp(m_font ) + 4 + num_chars * 2 +
148
value(int8u_ptr(ptrcomp(m_font ) + 4 + (glyph - start_char ) * 2 ) ) );
160
procedure glyph_raster_bin.prepare;
162
start_char ,num_chars : unsigned;
165
start_char:=int8u_ptr(ptrcomp(m_font ) + 2 * sizeof(int8u ) )^;
166
num_chars :=int8u_ptr(ptrcomp(m_font ) + 3 * sizeof(int8u ) )^;
170
ptrcomp(m_font ) + 4 + num_chars * 2 +
171
value(int8u_ptr(ptrcomp(m_font ) + 4 + (glyph - start_char ) * 2 ) ) );
173
m_glyph_width:=m_bits^;
175
inc(ptrcomp(m_bits ) );
177
m_glyph_byte_width:=(m_glyph_width + 7 ) shr 3;
180
r.x2:=r.x1 + m_glyph_width - 1;
186
int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^ +
187
int8u_ptr(ptrcomp(m_font ) + 1 * sizeof(int8u ) )^;
189
r.y2:=r.y1 + int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^ - 1;
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;
205
function glyph_raster_bin.span;
209
j ,val ,nb : unsigned;
212
i:=int8u_ptr(ptrcomp(m_font ) + 0 * sizeof(int8u ) )^ - i - 1;
214
bits:=int8u_ptr(ptrcomp(m_bits ) + i * m_glyph_byte_width );
218
for j:=0 to m_glyph_width - 1 do
220
if val and $80 <> 0 then
221
m_span[j ]:=int8u(cover_full )
223
m_span[j ]:=int8u(cover_none );
231
inc(ptrcomp(bits ) );
245
function glyph_raster_bin.value;
252
int16u_(v ).Low :=int8u_ptr(ptrcomp(p ) + 1 )^;
253
int16u_(v ).High:=p^;
258
int16u_(v ).Low :=p^;
259
int16u_(v ).High:=int8u_ptr(ptrcomp(p ) + 1 )^;