aggpas: 64bit fixes from fpgui aggpas

git-svn-id: trunk@47745 -
This commit is contained in:
mattias 2015-02-13 17:45:09 +00:00
parent 41a6b409a2
commit 80fb2b2367
14 changed files with 321 additions and 249 deletions

View File

@ -47,6 +47,11 @@ begin
end;
{$IFDEF LCLGtk2}
HasFont:=true;
FontFilename:=SetDirSeparators('../../verdana.ttf');
if not FileExistsUTF8(FontFilename) then begin
ShowMessage('file not found: '+FontFilename+' CurDir='+GetCurrentDirUTF8);
HasFont:=false;
end;
{$ELSE}
HasFont:=false;
{$ENDIF}
@ -54,8 +59,6 @@ begin
// paint to agg canvas
with AggLCLCanvas do begin
if HasFont then begin
FontFilename:=SetDirSeparators('../../verdana.ttf');
if not FileExistsUTF8(FontFilename) then raise Exception.Create('file not found: '+FontFilename+' CurDir='+GetCurrentDirUTF8);
Font.LoadFromFile(FontFilename);
Font.Size:=10;
Font.Color:=clBlack;
@ -86,12 +89,14 @@ begin
Pie(220,10,240,30, 230,5, 220,30);
RadialPie(245,10,265,30, 1000,2000);
s:='Font.Size='+IntToStr(Font.Size);
GetTextSize(s,TxtW,TxtH);
TxtX:=10;
TxtY:=40;
FillRect(TxtX,TxtY,TxtX+TxtW,TxtY+TxtH);
TextOut(TxtX,TxtY,s);
if HasFont then begin
s:='Font.Size='+IntToStr(Font.Size);
GetTextSize(s,TxtW,TxtH);
TxtX:=10;
TxtY:=40;
FillRect(TxtX,TxtY,TxtX+TxtW,TxtY+TxtH);
TextOut(TxtX,TxtY,s);
end;
RoundRect(10,80,30,100,15,15);
Polyline([Point(35,80),Point(45,80),Point(55,80),Point(55,90),

View File

@ -3,30 +3,18 @@
// Based on Anti-Grain Geometry
// Copyright (C) 2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Agg2D - Version 1.0 Release Milano 3 (AggPas 2.3 RM3)
// Agg2D - Version 1.0 Release Milano 3 (AggPas 2.4 RM3)
// Pascal Port By: Milan Marusinec alias Milano
// milan@marusinec.sk
// http://www.aggpas.org
// Copyright (c) 2007
// Copyright (c) 2007 - 2008
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// mcseemagg@yahoo.com
// http://www.antigrain.com
//
// [Pascal Port History] -----------------------------------------------------
//
// 22.08.2007-Milano: Unit port establishment
// 23.08.2007-Milano: Porting
// 11.09.2007-Milano: -"-
// 13.09.2007-Milano: -"-, Finished OK
//
{ agg_2D.pas }
unit
agg_2D ;
@ -73,12 +61,10 @@ uses
{$IFDEF AGG2D_USE_FREETYPE }
agg_font_freetype ,
{$ENDIF }
{$IFDEF AGG2D_USE_WINFONTS}
agg_font_win32_tt ,
Windows ,
{$ENDIF }
Math ;
@ -150,11 +136,9 @@ type
{$IFDEF AGG2D_USE_FREETYPE }
FontEngine = font_engine_freetype_int32;
{$ENDIF }
{$IFDEF AGG2D_USE_WINFONTS}
FontEngine = font_engine_win32_tt_int32;
{$ENDIF }
Gradient = (Solid ,Linear ,Radial );
@ -341,6 +325,8 @@ type
procedure clearAll(c : Color ); overload;
procedure clearAll(r ,g ,b : unsigned; a : unsigned = 255 ); overload;
procedure FillAll(c: Color); overload;
procedure FillAll(r, g, b: byte; a: byte = 255); overload;
procedure clearClipBox(c : Color ); overload;
procedure clearClipBox(r ,g ,b : unsigned; a : unsigned = 255 ); overload;
@ -440,7 +426,7 @@ type
rxTop ,ryTop : double ); overload;
procedure ellipse(cx ,cy ,rx ,ry : double );
procedure arc (cx ,cy ,rx ,ry ,start ,sweep : double );
procedure star(cx ,cy ,r1 ,r2 ,startAngle : double; numRays : int );
@ -678,24 +664,24 @@ end;
{ PREMULTIPLY }
procedure Image.premultiply;
//var
// pixf : pixel_formats;
//pixf : pixel_formats;
begin
{ pixfmt_rgba32(pixf ,@renBuf );
pixf.premultiply; {!}
pixf.premultiply; }
end;
{ DEMULTIPLY }
procedure Image.demultiply;
//var
// pixf : pixel_formats;
//pixf : pixel_formats;
begin
{ pixfmt_rgba32(pixf ,@renBuf );
pixf.demultiply; {!}
pixf.demultiply; }
end;
@ -812,20 +798,15 @@ begin
{$IFDEF AGG2D_USE_FREETYPE }
m_fontEngine.Construct;
{$ENDIF }
{$IFDEF AGG2D_USE_WINFONTS}
m_fontDC:=GetDC(0 );
m_fontEngine.Construct(m_fontDC );
{$ENDIF }
{$IFNDEF AGG2D_NO_FONT}
m_fontCacheManager.Construct(@m_fontEngine );
{$ENDIF}
lineCap (m_lineCap );
lineJoin(m_lineJoin );
@ -856,7 +837,6 @@ begin
{$ENDIF}
{$IFDEF AGG2D_USE_WINFONTS }
ReleaseDC(0 ,m_fontDC );
{$ENDIF }
end;
@ -954,6 +934,22 @@ begin
end;
procedure Agg2D.FillAll(c: Color);
var
clr: aggclr;
begin
clr.Construct (c );
m_renBase.fill(@clr );
end;
procedure Agg2D.FillAll(r, g, b: byte; a: byte);
var
clr: Color;
begin
clr.Construct(r, g, b, a);
FillAll(clr);
end;
{ CLEARCLIPBOX }
procedure Agg2D.clearClipBox(c : Color );
var
@ -2112,6 +2108,7 @@ procedure Agg2D.font(
var
b : int;
{$ENDIF}
begin
m_textAngle :=angle;
m_fontHeight :=height;
@ -2129,10 +2126,8 @@ begin
m_fontEngine.height_(height )
else
m_fontEngine.height_(worldToScreen(height ) );
{$ENDIF }
{$IFDEF AGG2D_USE_WINFONTS}
m_fontEngine.hinting_(m_textHints );
if bold then
@ -2144,7 +2139,6 @@ begin
m_fontEngine.create_font_(PChar(fileName ) ,glyph_ren_outline ,height ,0.0 ,b ,italic )
else
m_fontEngine.create_font_(PChar(fileName ) ,glyph_ren_agg_gray8 ,worldToScreen(height) ,0.0 ,b ,italic );
{$ENDIF }
end;
@ -3312,10 +3306,8 @@ function Agg2DUsesFreeType : boolean;
begin
{$IFDEF AGG2D_USE_FREETYPE }
result:=true;
{$ELSE }
result:=false;
{$ENDIF }
end;
@ -3324,14 +3316,10 @@ function Agg2DUsesWin32TrueType: boolean;
begin
{$IFDEF AGG2D_USE_WINFONTS }
result:=true;
{$ELSE }
result:=false;
{$ENDIF }
end;
END.
{!}
end.

View File

@ -38,7 +38,6 @@ uses
{ TYPES DEFINITION }
type
agg_types = (
int8_type ,
@ -150,15 +149,7 @@ type
p32 = record
case integer of
1 : (ptr : pointer );
{$IFDEF CPU64 }
2 : (int : system.int64 );
{$ELSE }
2 : (int : integer );
{$ENDIF }
2 : (int : ptrcomp );
end;
double_ptr_ptr = ^double_ptr;
@ -366,11 +357,11 @@ type
procedure NoP;
{ These implementations have changed to use FPC's Sar*() functions, so should
now support all platforms with ASM code. At a later date these functions
could be removed completely. }
function shr_int8 (i ,shift : int8 ) : int8;
function shr_int16(i ,shift : int16 ) : int16;
function shr_int32(i ,shift : int ) : int;
now support all platforms without the need for ASM code. At a later date these
functions could be removed completely. }
function shr_int8 (i ,shift : int8 ) : int8; inline;
function shr_int16(i ,shift : int16 ) : int16; inline;
function shr_int32(i ,shift : int ) : int; inline;
IMPLEMENTATION
{ UNIT IMPLEMENTATION }
@ -457,7 +448,7 @@ begin
end;
{ NORMALIZE }
function rect.normalize;
function rect.normalize: rect_ptr;
var
t : int;
@ -483,7 +474,7 @@ begin
end;
{ CLIP }
function rect.clip;
function rect.clip(r: rect_ptr): boolean;
begin
if x2 > r.x2 then
x2:=r.x2;
@ -502,7 +493,7 @@ begin
end;
{ IS_VALID }
function rect.is_valid;
function rect.is_valid: boolean;
begin
result:=(x1 <= x2 ) and (y1 <= y2 );
@ -1149,6 +1140,7 @@ var
fr : integer;
get : shortstring;
flg : char;
dth ,
prc ,
err : integer;
@ -1253,6 +1245,7 @@ begin
fr:=trunc(system.frac(val ) );
sc:=_string;
flg:=#0;
dth:=1;
prc:=0;
prf:=#0;
@ -1281,7 +1274,10 @@ begin
_flags :
case src^ of
'-' ,'+' ,'0' ,' ' ,'#' :
;
begin
flg:=src^;
if flg=#0 then ; // ToDo
end;
'1'..'9' :
begin

View File

@ -409,7 +409,7 @@ begin
end;
{ CONSTRUCT }
constructor font_cache_manager.Construct;
constructor font_cache_manager.Construct(engine : font_engine_ptr; max_fonts : unsigned);
begin
m_fonts.Construct(max_fonts );

View File

@ -23,7 +23,7 @@
// 17.09.2007-Milano: Porting & Finished OK
// 16.09.2007-Milano: Unit port establishment
//
{ agg_font_freetype.pas }
unit
agg_font_freetype ;
@ -54,7 +54,7 @@ uses
type
face_name_ptr = ^face_name;
face_name = record
name : char_ptr; //PChar;
name : PChar;
size : unsigned;
end;
@ -834,7 +834,7 @@ begin
m_curves16.approximation_scale_(4.0 );
m_curves32.approximation_scale_(4.0 );
m_last_error:=FT_Init_FreeType(@m_library );
m_last_error:=FT_Init_FreeType(m_library );
if m_last_error = 0 then
m_library_initialized:=true;
@ -906,13 +906,13 @@ begin
idx:=find_face(font_name );
if idx >= 0 then
begin
begin
m_cur_face:=FT_Face_ptr_ptr(ptrcomp(m_faces ) + idx * sizeof(FT_Face_ptr ) )^;
m_name :=PChar(face_name_ptr(ptrcomp(m_face_names ) + idx * sizeof(face_name ) ).name );
end
end
else
begin
begin
if m_num_faces >= m_max_faces then
begin
agg_freemem (pointer(m_face_names.name ) ,m_face_names.size );
@ -977,7 +977,7 @@ begin
end;
end;
end;
if m_last_error = 0 then
begin
@ -1238,7 +1238,7 @@ begin
m_glyph_index:=FT_Get_Char_Index(m_cur_face ,glyph_code );
if m_hinting then
m_last_error:=FT_Load_Glyph(m_cur_face ,m_glyph_index ,FT_LOAD_DEFAULT{} {FT_LOAD_FORCE_AUTOHINT{} )
m_last_error:=FT_Load_Glyph(m_cur_face ,m_glyph_index ,FT_LOAD_DEFAULT {FT_LOAD_FORCE_AUTOHINT} )
else
m_last_error:=FT_Load_Glyph(m_cur_face ,m_glyph_index ,FT_LOAD_NO_HINTING );
@ -1727,5 +1727,5 @@ begin
end;
END.
end.

View File

@ -31,80 +31,138 @@ INTERFACE
{$I agg_mode.inc }
{$packrecords c}
uses
agg_basics ;
{ GLOBAL VARIABLES & CONSTANTS }
type
FT_Encoding = array[0..3 ] of char;
FT_Encoding = array[0..3] of char;
const
{$IFDEF AGG_WINDOWS }
ft_lib = 'freetype.dll';
{$IFDEF WINDOWS }
ft_lib = 'freetype.dll';
{$ENDIF }
{$IFDEF AGG_LINUX }
ft_lib = 'freetype.so';
// Linux, FreeBSD etc.
{$if defined(UNIX) and not defined(darwin)}
ft_lib = 'freetype';
{$ENDIF }
{$IFDEF AGG_MACOSX }
ft_lib = 'libfreetype';
// Mac OS X
{$ifdef darwin}
ft_lib = 'libfreetype';
{$ENDIF }
FT_CURVE_TAG_ON = 1;
FT_CURVE_TAG_CONIC = 0;
FT_CURVE_TAG_CUBIC = 2;
FT_FACE_FLAG_SCALABLE = 1 shl 0;
FT_FACE_FLAG_KERNING = 1 shl 6;
FT_FACE_FLAG_SCALABLE = 1 shl 0;
FT_FACE_FLAG_FIXED_SIZES = 1 shl 1;
FT_FACE_FLAG_FIXED_WIDTH = 1 shl 2;
FT_FACE_FLAG_SFNT = 1 shl 3;
FT_FACE_FLAG_HORIZONTAL = 1 shl 4;
FT_FACE_FLAG_VERTICAL = 1 shl 5;
FT_FACE_FLAG_KERNING = 1 shl 6;
FT_FACE_FLAG_FAST_GLYPHS = 1 shl 7;
FT_FACE_FLAG_MULTIPLE_MASTERS = 1 shl 8;
FT_FACE_FLAG_GLYPH_NAMES = 1 shl 9;
FT_FACE_FLAG_EXTERNAL_STREAM = 1 shl 10;
FT_ENCODING_NONE : FT_Encoding = (#0 ,#0 ,#0 ,#0 );
FT_STYLE_FLAG_ITALIC = 1 shl 0;
FT_STYLE_FLAG_BOLD = 1 shl 1;
FT_LOAD_DEFAULT = $0000;
FT_LOAD_NO_HINTING = $0002;
FT_LOAD_FORCE_AUTOHINT = $0020;
FT_LOAD_DEFAULT = $0000;
FT_LOAD_NO_SCALE = $0001;
FT_LOAD_NO_HINTING = $0002;
FT_LOAD_RENDER = $0004;
FT_LOAD_NO_BITMAP = $0008;
FT_LOAD_VERTICAL_LAYOUT = $0010;
FT_LOAD_FORCE_AUTOHINT = $0020;
FT_LOAD_CROP_BITMAP = $0040;
FT_LOAD_PEDANTIC = $0080;
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH = $0200;
FT_LOAD_NO_RECURSE = $0400;
FT_LOAD_IGNORE_TRANSFORM = $0800;
FT_LOAD_MONOCHROME = $1000;
FT_LOAD_LINEAR_DESIGN = $2000;
FT_RENDER_MODE_NORMAL = 0;
FT_RENDER_MODE_LIGHT = FT_RENDER_MODE_NORMAL + 1;
FT_RENDER_MODE_MONO = FT_RENDER_MODE_LIGHT + 1;
FT_RENDER_MODE_LCD = FT_RENDER_MODE_MONO + 1;
FT_RENDER_MODE_LCD_V = FT_RENDER_MODE_LCD + 1;
FT_RENDER_MODE_MAX = FT_RENDER_MODE_LCD_V + 1;
ft_glyph_format_none = $00000000;
ft_glyph_format_composite = $636F6D70; //comp 099 111 109 112
ft_glyph_format_bitmap = $62697473; //bits 098 105 116 115
ft_glyph_format_outline = $6F75746C; //outl 111 117 116 108
ft_glyph_format_plotter = $706C6F74; //plot 112 108 111 116
FT_KERNING_DEFAULT = 0;
FT_KERNING_UNFITTED = 1;
FT_KERNING_UNSCALED = 2;
FT_ENCODING_NONE : FT_Encoding = (#0 ,#0 ,#0 ,#0 );
FT_ENCODING_MS_SYMBOL : FT_Encoding = 'symb';
FT_ENCODING_UNICODE : FT_Encoding = 'unic';
FT_ENCODING_MS_SJIS : FT_Encoding = 'sjis';
FT_ENCODING_MS_GB2312 : FT_Encoding = 'gb ';
FT_ENCODING_MS_BIG5 : FT_Encoding = 'big5';
FT_ENCODING_MS_WANSUNG : FT_Encoding = 'wans';
FT_ENCODING_MS_JOHAB : FT_Encoding = 'joha';
FT_ENCODING_ADOBE_STANDARD : FT_Encoding = 'ADOB';
FT_ENCODING_ADOBE_EXPERT : FT_Encoding = 'ADBE';
FT_ENCODING_ADOBE_CUSTOM : FT_Encoding = 'ADBC';
FT_ENCODING_ADOBE_LATIN_1 : FT_Encoding = 'lat1';
FT_ENCODING_OLD_LATIN_2 : FT_Encoding = 'lat2';
FT_ENCODING_APPLE_ROMAN : FT_Encoding = 'armn';
ft_glyph_bbox_unscaled = 0; //* return unscaled font units */
ft_glyph_bbox_subpixels = 0; //* return unfitted 26.6 coordinates */
ft_glyph_bbox_gridfit = 1; //* return grid-fitted 26.6 coordinates */
ft_glyph_bbox_truncate = 2; //* return coordinates in integer pixels */
ft_glyph_bbox_pixels = 3; //* return grid-fitted pixel coordinates */
FT_KERNING_DEFAULT = 0;
FT_KERNING_UNFITTED = 1;
FT_KERNING_UNSCALED = 2;
FT_STYLE_FLAG_ITALIC = 1 shl 0;
FT_STYLE_FLAG_BOLD = 1 shl 1;
{ TYPES DEFINITION }
type
FT_Byte = byte;
FT_Short = smallint;
FT_UShort = word;
FT_Int = longint;
FT_UInt = longword;
FT_Int32 = longint;
FT_Long = longint;
FT_ULong = longword;
FT_Fixed = longint;
FT_Pos = longint;
FT_Error = longint;
FT_F26Dot6 = longint;
FT_Byte_ptr = ^FT_Byte;
FT_Short_ptr = ^FT_Short;
FT_Bool = boolean;
FT_FWord = smallint;
FT_UFWord = word;
FT_Char = char;
FT_Byte = byte;
FT_String = char;
FT_Short = smallint;
FT_UShort = word;
FT_Int = longint;
FT_UInt = longword;
FT_Int32 = longint;
{$if defined(cpu64) and not(defined(win64) and defined(cpux86_64))}
FT_Long = int64;
FT_ULong = qword;
FT_Pos = int64;
{$ELSE}
FT_Long = longint;
FT_ULong = longword;
FT_Pos = longint;
{$ENDIF}
FT_F2Dot14 = smallint;
FT_F26Dot6 = longint;
FT_Fixed = FT_Long;
FT_Error = longint;
FT_Pointer = pointer;
FT_Render_Mode = FT_Int;
FT_Byte_ptr = ^FT_Byte;
FT_Short_ptr = ^FT_Short;
FT_Render_Mode = (FT_RENDER_MODE_NORMAL, FT_RENDER_MODE_LIGHT,
FT_RENDER_MODE_MONO, FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V,
FT_RENDER_MODE_MAX);
FT_Library_ptr_ptr = ^FT_Library_ptr;
FT_Library_ptr = ^FT_Library;
FT_Library = packed record
FT_Library = record
end;
FT_Subglyph_ptr = ^FT_Subglyph;
FT_Subglyph = packed record // TODO
FT_Subglyph = record // TODO
end;
FT_Bitmap_Size = record
@ -121,14 +179,14 @@ type
FT_Generic_Finalizer = procedure(AnObject : pointer ); cdecl;
FT_Generic = packed record
FT_Generic = record
data : pointer;
finalizer : FT_Generic_Finalizer;
end;
FT_BBox_ptr = ^FT_BBox;
FT_BBox = packed record
FT_BBox = record
xMin ,
yMin ,
xMax ,
@ -137,14 +195,14 @@ type
end;
FT_Vector_ptr = ^FT_Vector;
FT_Vector = packed record
FT_Vector = record
x ,
y : FT_Pos;
end;
FT_Bitmap_ptr = ^FT_Bitmap;
FT_Bitmap = packed record
FT_Bitmap = record
rows ,
width ,
pitch : FT_Int;
@ -160,7 +218,7 @@ type
end;
FT_Outline_ptr = ^FT_Outline;
FT_Outline = packed record
FT_Outline = record
n_contours ,
n_points : FT_Short;
@ -172,7 +230,7 @@ type
end;
FT_Glyph_Metrics = packed record
FT_Glyph_Metrics = record
width ,
height ,
@ -189,7 +247,7 @@ type
FT_Face_ptr = ^FT_Face;
FT_GlyphSlot_ptr = ^FT_GlyphSlot;
FT_GlyphSlot = packed record
FT_GlyphSlot = record
alibrary : FT_Library_ptr;
face : FT_Face_ptr;
@ -242,7 +300,7 @@ type
end;
FT_Face = packed record
FT_Face = record
num_faces ,
face_index ,
face_flags ,
@ -277,7 +335,7 @@ type
end;
FT_Charmap = packed record
FT_Charmap = record
face : FT_Face_ptr;
encoding : FT_Encoding;
@ -291,7 +349,7 @@ type
function FT_IS_SCALABLE(face : FT_Face_ptr ) : boolean;
function FT_HAS_KERNING(face : FT_Face_ptr ) : boolean;
function FT_Init_FreeType(alibrary : FT_Library_ptr ) : FT_Error; cdecl; external ft_lib name 'FT_Init_FreeType';
function FT_Init_FreeType(var alibrary : FT_Library_ptr ) : FT_Error; cdecl; external ft_lib name 'FT_Init_FreeType';
function FT_Done_FreeType(alibrary : FT_Library_ptr ) : FT_Error; cdecl; external ft_lib name 'FT_Done_FreeType';
@ -351,16 +409,14 @@ end;
{ FT_IS_SCALABLE }
function FT_IS_SCALABLE(face : FT_Face_ptr ) : boolean;
begin
result:=boolean(face.face_flags and FT_FACE_FLAG_SCALABLE );
Result := (face.face_flags and FT_FACE_FLAG_SCALABLE) = 1;
end;
{ FT_HAS_KERNING }
function FT_HAS_KERNING(face : FT_Face_ptr ) : boolean;
begin
result:=boolean(face.face_flags and FT_FACE_FLAG_KERNING );
Result := (face.face_flags and FT_FACE_FLAG_KERNING) = 1;
end;
END.
end.

View File

@ -7,29 +7,29 @@
//----------------------------------------------------------------------------
{$IFDEF CPUPOWERPC }
{$DEFINE AGG_CPU_PPC }
{$ENDIF }
{$IFDEF CPUI386 }
{$DEFINE AGG_CPU_386 }
{$ENDIF }
{$IFDEF CPU386 }
{$DEFINE AGG_CPU_386 }
{$ENDIF }
{$IFDEF CPUx86_64 }
{$DEFINE AGG_CPU_x86_64 }
{$ENDIF }
{$IFDEF FPC }
{$MODE DELPHI }
{$ENDIF }
// OS
{$IFDEF WIN32 }
{$DEFINE AGG_WINDOWS }
{$ENDIF }
{$IFDEF WINDOWS }
@ -46,15 +46,21 @@
{$ENDIF}
{$ENDIF }
{$IFDEF FREEBSD }
{$Warning Experimental FreeBSD support - totally untested! }
{$DEFINE AGG_LINUX }
{$IFNDEF AGG2D_NO_FONT}
{$DEFINE AGG2D_USE_FREETYPE}
{$ENDIF}
{$ENDIF }
{$IFDEF DARWIN }
{$DEFINE AGG_MACOSX }
{$ENDIF }
//----------------------------------------------------------------------------
{$IFDEF AGG_DEBUG }
{$DEFINE AGG_FULL_DEBUG }
{$ENDIF }
//----------------------------------------------------------------------------
@ -72,40 +78,40 @@
{$X+ }{ Extended syntax }
{$IFDEF AGG_FULL_DEBUG }
{$R+ }{ Range checking }
{$I+ }{ IO checking }
{$Q+ }{ Overflow checking }
{$R+ }{ Range checking }
{$I+ }{ IO checking }
{$Q+ }{ Overflow checking }
{$IFNDEF FPC }
{$O- }{ Code Optimization }
{$ENDIF }
{$IFNDEF FPC }
{$O- }{ Code Optimization }
{$ENDIF }
{$D+ }{ Debug Info ON }
{$Y+ }{ References Info ON }
{$D+ }{ Debug Info ON }
{$Y+ }{ References Info ON }
{$ELSE }
{$R- }{ Range checking }
{$I- }{ IO checking }
{$Q- }{ Overflow checking }
{$R- }{ Range checking }
{$I- }{ IO checking }
{$Q- }{ Overflow checking }
{ Code Optimization }
{$IFNDEF FPC }
{$IFDEF AGG_OPTIMIZE }
{$O+ }
{$ELSE }
{$O- }
{ Code Optimization }
{$IFNDEF FPC }
{$IFDEF AGG_OPTIMIZE }
{$O+ }
{$ELSE }
{$O- }
{$ENDIF }
{$ENDIF }
{$ENDIF }
{$D- }{ Debug Info OFF }
{$IFNDEF FPC}
{$Y- }{ References Info OFF }
{$ENDIF}
{$D- }{ Debug Info OFF }
{$IFNDEF FPC}
{$Y- }{ References Info OFF }
{$ENDIF}
{$ENDIF }
{$IFNDEF AGG2D_USE_WINFONTS}
{$IFNDEF AGG2D_USE_FREETYPE}
{$DEFINE AGG2D_NO_FONT}
{$ENDIF}
{$IFNDEF AGG2D_USE_FREETYPE}
{$DEFINE AGG2D_NO_FONT}
{$ENDIF}
{$ENDIF}

View File

@ -1352,21 +1352,21 @@ begin
end;
{ FILLING_RULE }
procedure rasterizer_scanline_aa.filling_rule;
procedure rasterizer_scanline_aa.filling_rule(filling_rule_: filling_rule_e);
begin
m_filling_rule:=filling_rule_;
end;
{ AUTO_CLOSE }
procedure rasterizer_scanline_aa.auto_close;
procedure rasterizer_scanline_aa.auto_close(flag: boolean);
begin
m_auto_close:=flag;
end;
{ CLIP_BOX }
procedure rasterizer_scanline_aa.clip_box;
procedure rasterizer_scanline_aa.clip_box(x1, y1, x2, y2: double);
begin
reset;
@ -1382,7 +1382,7 @@ begin
end;
{ GAMMA }
procedure rasterizer_scanline_aa.gamma;
procedure rasterizer_scanline_aa.gamma(gamma_function: vertex_source_ptr);
var
i : int;
@ -1395,14 +1395,14 @@ begin
end;
{ APPLY_GAMMA }
function rasterizer_scanline_aa.apply_gamma;
function rasterizer_scanline_aa.apply_gamma(cover: unsigned): unsigned;
begin
result:=m_gamma[cover ];
end;
{ MOVE_TO_NO_CLIP }
procedure rasterizer_scanline_aa.move_to_no_clip;
procedure rasterizer_scanline_aa.move_to_no_clip(x, y: int);
begin
if (m_status = status_line_to ) and
m_auto_close then
@ -1418,7 +1418,7 @@ begin
end;
{ LINE_TO_NO_CLIP }
procedure rasterizer_scanline_aa.line_to_no_clip;
procedure rasterizer_scanline_aa.line_to_no_clip(x, y: int);
begin
if m_status <> status_initial then
begin
@ -1455,7 +1455,7 @@ begin
end;
{ CLIP_SEGMENT }
procedure rasterizer_scanline_aa.clip_segment;
procedure rasterizer_scanline_aa.clip_segment(x, y: int);
var
flags ,n : unsigned;
@ -1502,21 +1502,21 @@ begin
end;
{ MOVE_TO_D }
procedure rasterizer_scanline_aa.move_to_d;
procedure rasterizer_scanline_aa.move_to_d(x, y: double);
begin
move_to(poly_coord(x ) ,poly_coord(y ) );
end;
{ LINE_TO_D }
procedure rasterizer_scanline_aa.line_to_d;
procedure rasterizer_scanline_aa.line_to_d(x, y: double);
begin
line_to(poly_coord(x ) ,poly_coord(y ) );
end;
{ MOVE_TO }
procedure rasterizer_scanline_aa.move_to;
procedure rasterizer_scanline_aa.move_to(x, y: int);
begin
if m_clipping then
begin
@ -1545,7 +1545,7 @@ begin
end;
{ LINE_TO }
procedure rasterizer_scanline_aa.line_to;
procedure rasterizer_scanline_aa.line_to(x, y: int);
begin
if m_clipping then
clip_segment(x ,y )
@ -1562,7 +1562,7 @@ begin
end;
{ REWIND_SCANLINES }
function rasterizer_scanline_aa.rewind_scanlines;
function rasterizer_scanline_aa.rewind_scanlines: boolean;
begin
if m_auto_close then
close_polygon;
@ -1583,7 +1583,7 @@ begin
end;
{ SWEEP_SCANLINE }
function rasterizer_scanline_aa.sweep_scanline;
function rasterizer_scanline_aa.sweep_scanline(sl: scanline_ptr): boolean;
var
x ,
area ,
@ -1678,7 +1678,7 @@ begin
end;
{ NAVIGATE_SCANLINE }
function rasterizer_scanline_aa.navigate_scanline;
function rasterizer_scanline_aa.navigate_scanline(y: int): boolean;
begin
if m_auto_close then
close_polygon;
@ -1701,7 +1701,7 @@ begin
end;
{ HIT_TEST }
function rasterizer_scanline_aa.hit_test;
function rasterizer_scanline_aa.hit_test(tx, ty: int): boolean;
var
sl : scanline_hit_test;
@ -1722,35 +1722,35 @@ begin
end;
{ _MIN_X }
function rasterizer_scanline_aa._min_x;
function rasterizer_scanline_aa._min_x: int;
begin
result:=m_outline._min_x;
end;
{ _MIN_Y }
function rasterizer_scanline_aa._min_y;
function rasterizer_scanline_aa._min_y: int;
begin
result:=m_outline._min_y;
end;
{ _MAX_X }
function rasterizer_scanline_aa._max_x;
function rasterizer_scanline_aa._max_x: int;
begin
result:=m_outline._max_x;
end;
{ _MAX_Y }
function rasterizer_scanline_aa._max_y;
function rasterizer_scanline_aa._max_y: int;
begin
result:=m_outline._max_y;
end;
{ CALCULATE_ALPHA }
function rasterizer_scanline_aa.calculate_alpha;
function rasterizer_scanline_aa.calculate_alpha(area: int): unsigned;
var
cover : system.integer;
@ -1779,7 +1779,7 @@ begin
end;
{ ADD_PATH }
procedure rasterizer_scanline_aa.add_path;
procedure rasterizer_scanline_aa.add_path(vs: vertex_source_ptr; path_id: unsigned);
var
cmd : unsigned;
x ,y : double;
@ -1800,7 +1800,7 @@ begin
end;
{ ADD_VERTEX }
procedure rasterizer_scanline_aa.add_vertex;
procedure rasterizer_scanline_aa.add_vertex(x, y: double; cmd: unsigned);
begin
if is_close(cmd ) then
close_polygon

View File

@ -79,6 +79,7 @@ type
function bounding_ymax : int; virtual;
procedure clear(c : aggclr_ptr );
procedure fill(const c: aggclr_ptr);
procedure copy_pixel (x ,y : int; c : aggclr_ptr ); virtual;
procedure blend_pixel(x ,y : int; c : aggclr_ptr; cover : int8u ); virtual;
@ -127,7 +128,7 @@ type
dy : int = 0;
cover : int8u = cover_full );
end;
end;
{ GLOBAL PROCEDURES }
@ -135,7 +136,7 @@ type
IMPLEMENTATION
{ UNIT IMPLEMENTATION }
{ CONSTRUCT }
constructor renderer_base.Construct;
constructor renderer_base.Construct(ren_: pixel_formats_ptr);
var
w ,h : int;
@ -159,28 +160,28 @@ begin
end;
{ REN }
function renderer_base.ren;
function renderer_base.ren: pixel_formats_ptr;
begin
result:=m_ren;
end;
{ WIDTH }
function renderer_base.width;
function renderer_base.width: unsigned;
begin
result:=m_ren._width;
end;
{ HEIGHT }
function renderer_base.height;
function renderer_base.height: unsigned;
begin
result:=m_ren._height;
end;
{ CLIP_BOX_NAKED }
procedure renderer_base.clip_box_naked;
procedure renderer_base.clip_box_naked(x1, y1, x2, y2: int);
begin
m_clip_box.x1:=x1;
m_clip_box.y1:=y1;
@ -190,7 +191,7 @@ begin
end;
{ INBOX }
function renderer_base.inbox;
function renderer_base.inbox(x, y: int): boolean;
begin
result:=
(x >= m_clip_box.x1 ) and
@ -201,7 +202,7 @@ begin
end;
{ CLIP_BOX_ }
function renderer_base.clip_box_;
function renderer_base.clip_box_(x1, y1, x2, y2: int): boolean;
var
cb ,
rc : rect;
@ -232,7 +233,7 @@ begin
end;
{ RESET_CLIPPING }
procedure renderer_base.reset_clipping;
procedure renderer_base.reset_clipping(visibility: boolean);
begin
if visibility then
begin
@ -259,84 +260,84 @@ begin
end;
{ NEXT_CLIP_BOX }
function renderer_base.next_clip_box;
function renderer_base.next_clip_box: boolean;
begin
result:=false;
end;
{ _CLIP_BOX }
function renderer_base._clip_box;
function renderer_base._clip_box: rect_ptr;
begin
result:=@m_clip_box;
end;
{ _XMIN }
function renderer_base._xmin;
function renderer_base._xmin: int;
begin
result:=m_clip_box.x1;
end;
{ _YMIN }
function renderer_base._ymin;
function renderer_base._ymin: int;
begin
result:=m_clip_box.y1;
end;
{ _XMAX }
function renderer_base._xmax;
function renderer_base._xmax: int;
begin
result:=m_clip_box.x2;
end;
{ _YMAX }
function renderer_base._ymax;
function renderer_base._ymax: int;
begin
result:=m_clip_box.y2;
end;
{ BOUNDING_CLIP_BOX }
function renderer_base.bounding_clip_box;
function renderer_base.bounding_clip_box: rect_ptr;
begin
result:=@m_clip_box;
end;
{ BOUNDING_XMIN }
function renderer_base.bounding_xmin;
function renderer_base.bounding_xmin: int;
begin
result:=m_clip_box.x1;
end;
{ BOUNDING_YMIN }
function renderer_base.bounding_ymin;
function renderer_base.bounding_ymin: int;
begin
result:=m_clip_box.y1;
end;
{ BOUNDING_XMAX }
function renderer_base.bounding_xmax;
function renderer_base.bounding_xmax: int;
begin
result:=m_clip_box.x2;
end;
{ BOUNDING_YMAX }
function renderer_base.bounding_ymax;
function renderer_base.bounding_ymax: int;
begin
result:=m_clip_box.y2;
end;
{ CLEAR }
procedure renderer_base.clear;
procedure renderer_base.clear(c: aggclr_ptr);
var
y : unsigned;
@ -348,8 +349,19 @@ begin
end;
procedure renderer_base.fill(const c: aggclr_ptr);
var
y: unsigned;
begin
if (width > 0) and (height > 0) then
begin
for y:=0 to height - 1 do
m_ren.blend_hline(m_ren, 0, y, width, c, cover_mask);
end;
end;
{ COPY_PIXEL }
procedure renderer_base.copy_pixel;
procedure renderer_base.copy_pixel(x, y: int; c: aggclr_ptr);
begin
if inbox(x ,y ) then
m_ren.copy_pixel(m_ren ,x ,y ,c );
@ -357,7 +369,7 @@ begin
end;
{ BLEND_PIXEL }
procedure renderer_base.blend_pixel;
procedure renderer_base.blend_pixel(x, y: int; c: aggclr_ptr; cover: int8u);
begin
if inbox(x ,y ) then
m_ren.blend_pixel(m_ren ,x ,y ,c ,cover );
@ -365,7 +377,7 @@ begin
end;
{ PIXEL }
function renderer_base.pixel;
function renderer_base.pixel(x, y: int): aggclr;
begin
if inbox(x ,y ) then
result:=m_ren.pixel(m_ren ,x ,y )
@ -375,7 +387,7 @@ begin
end;
{ COPY_HLINE }
procedure renderer_base.copy_hline;
procedure renderer_base.copy_hline(x1, y, x2: int; c: aggclr_ptr);
var
t : int;
@ -411,7 +423,7 @@ begin
end;
{ COPY_VLINE }
procedure renderer_base.copy_vline;
procedure renderer_base.copy_vline(x, y1, y2: int; c: aggclr_ptr);
var
t : int;
@ -447,7 +459,7 @@ begin
end;
{ BLEND_HLINE }
procedure renderer_base.blend_hline;
procedure renderer_base.blend_hline(x1, y, x2: int; c: aggclr_ptr; cover: int8u);
var
t : int;
@ -483,7 +495,7 @@ begin
end;
{ BLEND_VLINE }
procedure renderer_base.blend_vline;
procedure renderer_base.blend_vline(x, y1, y2: int; c: aggclr_ptr; cover: int8u);
var
t : int;
@ -519,7 +531,7 @@ begin
end;
{ COPY_BAR }
procedure renderer_base.copy_bar;
procedure renderer_base.copy_bar(x1, y1, x2, y2: int; c: aggclr_ptr);
var
y : int;
rc : rect;
@ -545,7 +557,7 @@ begin
end;
{ BLEND_BAR }
procedure renderer_base.blend_bar;
procedure renderer_base.blend_bar(x1, y1, x2, y2: int; c: aggclr_ptr; cover: int8u);
var
rc : rect;
y : int;
@ -570,13 +582,15 @@ begin
end;
{ SPAN {not_implemented}
function renderer_base.span;
{ SPAN - not_implemented}
{$NOTE renderer_base.span not implemented yet}
function renderer_base.span(x, y: int; len: unsigned): pointer;
begin
end;
{ BLEND_SOLID_HSPAN }
procedure renderer_base.blend_solid_hspan;
procedure renderer_base.blend_solid_hspan(x, y, len: int; c: aggclr_ptr;
covers: int8u_ptr);
begin
if y > _ymax then
exit;
@ -611,7 +625,8 @@ begin
end;
{ BLEND_SOLID_VSPAN }
procedure renderer_base.blend_solid_vspan;
procedure renderer_base.blend_solid_vspan(x, y, len: int; c: aggclr_ptr;
covers: int8u_ptr);
begin
if x > _xmax then
exit;
@ -646,7 +661,7 @@ begin
end;
{ COPY_COLOR_HSPAN }
procedure renderer_base.copy_color_hspan;
procedure renderer_base.copy_color_hspan(x, y, len: int; colors: aggclr_ptr);
var
d : int;
@ -686,7 +701,8 @@ begin
end;
{ BLEND_COLOR_HSPAN }
procedure renderer_base.blend_color_hspan;
procedure renderer_base.blend_color_hspan(x, y, len: int; colors: aggclr_ptr;
covers: int8u_ptr; cover: int8u);
var
d : int;
@ -729,7 +745,8 @@ begin
end;
{ BLEND_COLOR_VSPAN }
procedure renderer_base.blend_color_vspan;
procedure renderer_base.blend_color_vspan(x, y, len: int; colors: aggclr_ptr;
covers: int8u_ptr; cover: int8u);
var
d : int;
@ -771,27 +788,29 @@ begin
end;
{ COPY_COLOR_HSPAN_NO_CLIP {not_implemented}
procedure renderer_base.copy_color_hspan_no_clip;
{ COPY_COLOR_HSPAN_NO_CLIP - not_implemented}
procedure renderer_base.copy_color_hspan_no_clip(x, y, len: int; colors: aggclr_ptr);
begin
end;
{ BLEND_COLOR_HSPAN_NO_CLIP }
procedure renderer_base.blend_color_hspan_no_clip;
procedure renderer_base.blend_color_hspan_no_clip(x, y, len: int; colors: aggclr_ptr;
covers: int8u_ptr; cover: int8u);
begin
m_ren.blend_color_hspan(m_ren ,x ,y ,len ,colors ,covers ,cover );
end;
{ BLEND_COLOR_VSPAN_NO_CLIP }
procedure renderer_base.blend_color_vspan_no_clip;
procedure renderer_base.blend_color_vspan_no_clip(x, y, len: int; colors: aggclr_ptr;
covers: int8u_ptr; cover: int8u);
begin
m_ren.blend_color_vspan(m_ren ,x ,y ,len ,colors ,covers ,cover );
end;
{ CLIP_RECT_AREA }
function renderer_base.clip_rect_area;
function renderer_base.clip_rect_area(dst, src: rect_ptr; wsrc, hsrc: int): rect;
var
rc ,cb : rect;
@ -857,7 +876,8 @@ begin
end;
{ COPY_FROM }
procedure renderer_base.copy_from;
procedure renderer_base.copy_from(src: rendering_buffer_ptr; rect_src_ptr: rect_ptr;
dx: int; dy: int);
var
rsrc ,rdst ,rc : rect;
@ -908,7 +928,8 @@ begin
end;
{ BLEND_FROM }
procedure renderer_base.blend_from;
procedure renderer_base.blend_from(src: pixel_formats_ptr; rect_src_ptr: rect_ptr;
dx: int; dy: int; cover: int8u);
var
rsrc ,rdst ,rc : rect;

View File

@ -62,7 +62,7 @@ type
end;
{ row_ptr_cache_ptr = ^row_ptr_cache;
row_ptr_cache = object(rendering_buffer ){!}
row_ptr_cache = object(rendering_buffer )}
rendering_buffer_ptr = ^rendering_buffer;
rendering_buffer = object
@ -210,7 +210,7 @@ begin
end;
{ _BUF }
function rendering_buffer._buf;
function rendering_buffer._buf: int8u_ptr;
begin
result:=m_buf;

View File

@ -238,36 +238,36 @@ begin
end;
{ WIDHT_ }
procedure vcgen_stroke.width_;
{ WIDTH_ }
procedure vcgen_stroke.width_(w : double );
begin
m_width:=w * 0.5;
end;
{ MITER_LIMIT_ }
procedure vcgen_stroke.miter_limit_;
procedure vcgen_stroke.miter_limit_(ml : double );
begin
m_miter_limit:=ml;
end;
{ MITER_LIMIT_THETA_ }
procedure vcgen_stroke.miter_limit_theta_;
procedure vcgen_stroke.miter_limit_theta_(t : double );
begin
m_miter_limit:=1.0 / Sin(t * 0.5 );
end;
{ INNER_MITER_LIMIT_ }
procedure vcgen_stroke.inner_miter_limit_;
procedure vcgen_stroke.inner_miter_limit_(ml : double );
begin
m_inner_miter_limit:=ml;
end;
{ APPROXIMATION_SCALE_ }
procedure vcgen_stroke.approximation_scale_;
procedure vcgen_stroke.approximation_scale_(as_ : double );
begin
m_approx_scale:=as_;
@ -326,7 +326,7 @@ begin
end;
{ ADD_VERTEX }
procedure vcgen_stroke.add_vertex;
procedure vcgen_stroke.add_vertex(x ,y : double; cmd : unsigned );
var
vd : vertex_dist;
@ -365,7 +365,7 @@ begin
end;
{ REWIND }
procedure vcgen_stroke.rewind;
procedure vcgen_stroke.rewind(path_id : unsigned );
begin
if m_status = initial then
begin
@ -386,7 +386,7 @@ begin
end;
{ VERTEX }
function vcgen_stroke.vertex;
function vcgen_stroke.vertex(x ,y : double_ptr ) : unsigned;
var
c : point_type_ptr;

View File

@ -92,10 +92,10 @@ type
// Possible formats of the rendering buffer. Initially I thought that it's
// reasonable to create the buffer and the rendering functions in
// accordance with the native pixel format of the system because it
// would have no overhead for pixel format conersion.
// would have no overhead for pixel format conversion.
// But eventually I came to a conclusion that having a possibility to
// convert pixel formats on demand is a good idea. First, it was X11 where
// there lots of different formats and visuals and it would be great to
// there are lots of different formats and visuals and it would be great to
// render everything in, say, RGB-24 and display it automatically without
// any additional efforts. The second reason is to have a possibility to
// debug renderers for different pixel formats and colorspaces having only

View File

@ -373,7 +373,7 @@ type
// It's perfect if they can be called anytime.
procedure caption_(cap : shortstring );
// These 3 menthods handle working with images. The image
// These 3 methods handle working with images. The image
// formats are the simplest ones, such as .BMP in Windows or
// .ppm in Linux. In the applications the names of the files
// should not have any file extensions. Method load_img() can

View File

@ -706,7 +706,7 @@ begin
'%s at line ' ,
unsigned(
XML_ErrorString(
XML_GetErrorCode(p ) ) ) );
int(XML_GetErrorCode(p ) ) ) ) );
sprintf(
@msg[StrLen(msg ) ] ,