mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 14:38:01 +02:00
removed $IFDEF VER1 from Martin Smat
git-svn-id: trunk@7473 -
This commit is contained in:
parent
2960cb1df9
commit
90b9862494
@ -22,10 +22,6 @@ unit AllLCLUnits;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$IFDEF VER1_0_10}
|
||||
{$DEFINE DisableFPImage}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
@ -39,7 +35,7 @@ uses
|
||||
FileUtil,
|
||||
// the interface base
|
||||
InterfaceBase,
|
||||
{$IFNDEF DisableFPImage}IntfGraphics,{$ENDIF}
|
||||
IntfGraphics,
|
||||
// components and functions
|
||||
LCLClasses,
|
||||
StdActns, Buttons, Extctrls, Calendar, Clipbrd, Forms, LCLIntf, Spin,
|
||||
|
136
lcl/graphics.pp
136
lcl/graphics.pp
@ -32,22 +32,9 @@ interface
|
||||
{$endif}
|
||||
|
||||
|
||||
{$IFDEF VER1_0_10}
|
||||
{$DEFINE DisableFPImage}
|
||||
{$ENDIF}
|
||||
{$IFNDEF VER1_0}
|
||||
{$DEFINE UseFPCanvas}
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Contnrs, FPCAdds,
|
||||
{$IFNDEF DisableFPImage}
|
||||
FPImage, FPReadPNG, FPWritePNG, FPReadBMP, FPWriteBMP, FPReadPNM, FPWritePNM, IntfGraphics,
|
||||
{$IFDEF UseFPCanvas}
|
||||
FPCanvas,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
FPImage, FPReadPNG, FPWritePNG, FPReadBMP, FPWriteBMP, FPReadPNM, FPWritePNM, IntfGraphics, FPCanvas,
|
||||
AvgLvlTree,
|
||||
LCLStrConsts, LCLType, LCLProc, LMessages, LCLIntf, LResources, LCLResCache,
|
||||
GraphType, GraphMath, InterfaceBase;
|
||||
@ -118,7 +105,6 @@ type
|
||||
SystemFont: Boolean; // Use the system font instead of Canvas Font
|
||||
end;
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
type
|
||||
TPenStyle = TFPPenStyle;
|
||||
TPenMode = TFPPenMode;
|
||||
@ -158,18 +144,7 @@ const
|
||||
bsBDiagonal = FPCanvas.bsBDiagonal;
|
||||
bsCross = FPCanvas.bsCross;
|
||||
bsDiagCross = FPCanvas.bsDiagCross;
|
||||
{$ELSE}
|
||||
type
|
||||
TPenStyle = (psSolid, psDash, psDot, psDashDot, psDashDotDot, psClear,
|
||||
psInsideframe);
|
||||
TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy, pmMergePenNot,
|
||||
pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,pmNotMerge,
|
||||
pmMask, pmNotMask, pmXor, pmNotXor
|
||||
);
|
||||
TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal,
|
||||
bsBDiagonal, bsCross, bsDiagCross);
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
TFillStyle = TGraphicsFillStyle;
|
||||
TFillMode = (fmAlternate, fmWinding);
|
||||
@ -466,11 +441,7 @@ type
|
||||
|
||||
{ TFont }
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
TFont = class(TFPCustomFont)
|
||||
{$ELSE}
|
||||
TFont = class(TGraphicsObject)
|
||||
{$ENDIF}
|
||||
private
|
||||
FCanUTF8: boolean;
|
||||
FHandle: HFont;
|
||||
@ -482,20 +453,12 @@ type
|
||||
FChanged: boolean;
|
||||
FFontHandleCached: boolean;
|
||||
FColor: TColor;
|
||||
{$IFDEF UseFPCanvas}
|
||||
{$ELSE}
|
||||
FFontName: string;
|
||||
FSize: Integer; // Important: because of rounding errors both Size and
|
||||
// Height are stored. This way setting Height and reading
|
||||
// it again will result in the same value
|
||||
{$ENDIF}
|
||||
FHeight: integer; // FHeight = -(FSize * FPixelsPerInch) div 72
|
||||
procedure FreeHandle;
|
||||
procedure GetData(var FontData: TFontData);
|
||||
function IsNameStored: boolean;
|
||||
procedure SetData(const FontData: TFontData);
|
||||
protected
|
||||
{$IFDEF UseFPCanvas}
|
||||
procedure DoAllocateResources; override;
|
||||
procedure DoDeAllocateResources; override;
|
||||
procedure DoCopyProps(From: TFPCanvasHelper); override;
|
||||
@ -504,10 +467,6 @@ type
|
||||
procedure SetSize(AValue: integer); override;
|
||||
procedure SetColor(const NewColor: TColor; const NewFPColor: TFPColor); virtual;
|
||||
procedure SetFPColor(const AValue: TFPColor); override;
|
||||
{$ELSE}
|
||||
procedure SetName(const AValue: string);
|
||||
procedure SetSize(AValue: Integer);
|
||||
{$ENDIF}
|
||||
procedure Changed; override;
|
||||
function GetCharSet: TFontCharSet;
|
||||
function GetHandle: HFONT;
|
||||
@ -523,7 +482,7 @@ type
|
||||
procedure SetPitch(Value: TFontPitch);
|
||||
procedure SetStyle(Value: TFontStyles);
|
||||
public
|
||||
constructor Create; {$IFDEF UseFPCanvas}override;{$ENDIF}
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
procedure Assign(Source: TPersistent); override;
|
||||
procedure Assign(const ALogFont: TLogFont);
|
||||
@ -567,52 +526,34 @@ type
|
||||
constructor Create;
|
||||
end;
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
TPen = class(TFPCustomPen)
|
||||
{$ELSE}
|
||||
TPen = class(TGraphicsObject)
|
||||
{$ENDIF}
|
||||
private
|
||||
FHandle: HPen;
|
||||
FColor: TColor;
|
||||
FPenHandleCached: boolean;
|
||||
{$IFDEF UseFPCanvas}
|
||||
{$ELSE}
|
||||
FWidth: Integer;
|
||||
FStyle: TPenStyle;
|
||||
FMode: TPenMode;
|
||||
{$ENDIF}
|
||||
procedure FreeHandle;
|
||||
protected
|
||||
{$IFDEF UseFPCanvas}
|
||||
procedure DoAllocateResources; override;
|
||||
procedure DoDeAllocateResources; override;
|
||||
procedure DoCopyProps(From: TFPCanvasHelper); override;
|
||||
procedure SetColor(const NewColor: TColor; const NewFPColor: TFPColor); virtual;
|
||||
procedure SetFPColor(const AValue: TFPColor); override;
|
||||
{$ENDIF}
|
||||
function GetHandle: HPEN;
|
||||
procedure SetHandle(const Value: HPEN);
|
||||
procedure SetColor(Value: TColor);
|
||||
procedure SetMode(Value: TPenMode); {$IFDEF UseFPCanvas}override;{$ENDIF}
|
||||
procedure SetStyle(Value: TPenStyle); {$IFDEF UseFPCanvas}override;{$ENDIF}
|
||||
procedure SetWidth(value: Integer); {$IFDEF UseFPCanvas}override;{$ENDIF}
|
||||
procedure SetMode(Value: TPenMode); override;
|
||||
procedure SetStyle(Value: TPenStyle); override;
|
||||
procedure SetWidth(value: Integer); override;
|
||||
public
|
||||
constructor Create; {$IFDEF UseFPCanvas}override;{$ENDIF}
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
procedure Assign(Source: TPersistent); override;
|
||||
property Handle: HPEN read GetHandle write SetHandle;
|
||||
published
|
||||
property Color: TColor read FColor write SetColor default clBlack;
|
||||
{$IFDEF UseFPCanvas}
|
||||
property Mode default pmCopy;
|
||||
property Style default psSolid;
|
||||
property Width default 1;
|
||||
{$ELSE}
|
||||
property Mode: TPenMode read FMode write SetMode default pmCopy;
|
||||
property Style: TPenStyle read FStyle write SetStyle default psSolid;
|
||||
property Width: Integer read FWidth write SetWidth default 1;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
@ -632,48 +573,34 @@ type
|
||||
constructor Create;
|
||||
end;
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
TBrush = class(TFPCustomBrush)
|
||||
{$ELSE}
|
||||
TBrush = class(TGraphicsObject)
|
||||
{$ENDIF}
|
||||
private
|
||||
FHandle: HBrush;
|
||||
FBrushHandleCached: boolean;
|
||||
FColor: TColor;
|
||||
FBitmap: TBitmap;
|
||||
{$IFDEF UseFPCanvas}
|
||||
{$ELSE}
|
||||
FStyle: TBrushStyle;
|
||||
{$ENDIF}
|
||||
procedure FreeHandle;
|
||||
procedure DoChange(var Msg); message LM_CHANGED;
|
||||
protected
|
||||
{$IFDEF UseFPCanvas}
|
||||
procedure DoAllocateResources; override;
|
||||
procedure DoDeAllocateResources; override;
|
||||
procedure DoCopyProps(From: TFPCanvasHelper); override;
|
||||
procedure SetColor(const NewColor: TColor; const NewFPColor: TFPColor); virtual;
|
||||
procedure SetFPColor(const AValue: TFPColor); override;
|
||||
{$ENDIF}
|
||||
function GetHandle: HBRUSH;
|
||||
procedure SetBitmap(Value: TBitmap);
|
||||
procedure SetColor(Value: TColor);
|
||||
procedure SetHandle(const Value: HBRUSH);
|
||||
Procedure SetStyle(Value: TBrushStyle); {$IFDEF UseFPCanvas}override;{$ENDIF}
|
||||
Procedure SetStyle(Value: TBrushStyle); override;
|
||||
public
|
||||
procedure Assign(Source: TPersistent); override;
|
||||
constructor Create; {$IFDEF UseFPCanvas}override;{$ENDIF}
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
property Bitmap: TBitmap read FBitmap write SetBitmap;
|
||||
property Handle: HBRUSH read GetHandle write SetHandle;
|
||||
published
|
||||
property Color: TColor read FColor write SetColor default clWhite;
|
||||
{$IFDEF UseFPCanvas}
|
||||
property Style default bsSolid;
|
||||
{$ELSE}
|
||||
property Style: TBrushStyle read FStyle write SetStyle default bsSolid;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
@ -779,14 +706,12 @@ type
|
||||
procedure GetSupportedSourceMimeTypes(List: TStrings); virtual;
|
||||
function GetDefaultMimeType: string; virtual;
|
||||
class function GetFileExtensions: string; virtual;
|
||||
{$IFNDEF DisableFPImage}
|
||||
class function GetFPReaderForFileExt(
|
||||
const FileExtension: string): TFPCustomImageReaderClass; virtual;
|
||||
class function GetFPWriterForFileExt(
|
||||
const FileExtension: string): TFPCustomImageWriterClass; virtual;
|
||||
class function GetDefaultFPReader: TFPCustomImageReaderClass; virtual;
|
||||
class function GetDefaultFPWriter: TFPCustomImageWriterClass; virtual;
|
||||
{$ENDIF}
|
||||
public
|
||||
property Empty: Boolean read GetEmpty;
|
||||
property Height: Integer read GetHeight write SetHeight;
|
||||
@ -916,11 +841,7 @@ type
|
||||
|
||||
{ TCanvas }
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
TCanvas = class(TFPCustomCanvas)
|
||||
{$ELSE}
|
||||
TCanvas = class(TPersistent)
|
||||
{$ENDIF}
|
||||
private
|
||||
FAutoRedraw: Boolean;
|
||||
FState: TCanvasState;
|
||||
@ -938,10 +859,6 @@ type
|
||||
FPen: TPen;
|
||||
FFont: TFont;
|
||||
FBrush: TBrush;
|
||||
{$IFNDEF UseFPCanvas}
|
||||
FLockCount: Integer;
|
||||
FPenPos: TPoint;
|
||||
{$ENDIF}
|
||||
procedure BrushChanged(ABrush: TObject);
|
||||
procedure FontChanged(AFont: TObject);
|
||||
procedure PenChanged(APen: TObject);
|
||||
@ -953,11 +870,7 @@ type
|
||||
procedure SetLazFont(value: TFont);
|
||||
procedure SetLazPen(value: TPen);
|
||||
procedure SetLazBrush(value: TBrush);
|
||||
{$IFNDEF UseFPCanvas}
|
||||
procedure SetPenPos(const AValue: TPoint);
|
||||
{$ENDIF}
|
||||
procedure SetRegion(Value: TRegion);
|
||||
{$IFDEF UseFPCanvas}
|
||||
protected
|
||||
function DoCreateDefaultFont: TFPCustomFont; override;
|
||||
function DoCreateDefaultPen: TFPCustomPen; override;
|
||||
@ -993,10 +906,8 @@ type
|
||||
const SourceRect: TRect); override;
|
||||
procedure DoDraw(x, y: integer; const Image: TFPCustomImage); override;
|
||||
procedure CheckHelper(AHelper: TFPCanvasHelper); override;
|
||||
{$ELSE}
|
||||
{$ENDIF}
|
||||
protected
|
||||
function GetClipRect: TRect; {$IFDEF UseFPCanvas}override;{$ELSE}virtual;{$ENDIF}
|
||||
function GetClipRect: TRect; override;
|
||||
Function GetPixel(X,Y: Integer): TColor; virtual;
|
||||
procedure CreateBrush; virtual;
|
||||
procedure CreateFont; virtual;
|
||||
@ -1052,24 +963,21 @@ type
|
||||
procedure Pie(EllipseX1,EllipseY1,EllipseX2,EllipseY2,
|
||||
StartX,StartY,EndX,EndY: Integer); virtual;
|
||||
procedure PolyBezier(Points: PPoint; NumPts: Integer;
|
||||
Filled: boolean{$IFNDEF VER1_0} = False{$ENDIF};
|
||||
Continuous: boolean{$IFNDEF VER1_0} = False{$ENDIF}); virtual;
|
||||
Filled: boolean = False;
|
||||
Continuous: boolean = False); virtual;
|
||||
procedure PolyBezier(const Points: array of TPoint;
|
||||
Filled: boolean{$IFNDEF VER1_0} = False{$ENDIF};
|
||||
Continuous: boolean{$IFNDEF VER1_0} = False{$ENDIF});
|
||||
{$ifdef VER1_0}
|
||||
procedure PolyBezier(const Points: array of TPoint);
|
||||
{$endif}
|
||||
Filled: boolean = False;
|
||||
Continuous: boolean = False);
|
||||
procedure Polygon(const Points: array of TPoint;
|
||||
Winding: Boolean;
|
||||
StartIndex: Integer{$IFNDEF VER1_0} = 0{$ENDIF};
|
||||
NumPts: Integer {$IFNDEF VER1_0} = -1{$ENDIF});
|
||||
StartIndex: Integer = 0;
|
||||
NumPts: Integer = -1);
|
||||
procedure Polygon(Points: PPoint; NumPts: Integer;
|
||||
Winding: boolean{$IFNDEF VER1_0} = False{$ENDIF}); virtual;
|
||||
Winding: boolean = False); virtual;
|
||||
Procedure Polygon(const Points: array of TPoint); // already in fpcanvas
|
||||
procedure Polyline(const Points: array of TPoint;
|
||||
StartIndex: Integer;
|
||||
NumPts: Integer {$IFNDEF VER1_0} = -1{$ENDIF});
|
||||
NumPts: Integer = -1);
|
||||
procedure Polyline(Points: PPoint; NumPts: Integer); virtual;
|
||||
procedure Polyline(const Points: array of TPoint); // already in fpcanvas
|
||||
Procedure Rectangle(X1,Y1,X2,Y2: Integer); virtual; // already in fpcanvas
|
||||
@ -1086,10 +994,6 @@ type
|
||||
function HandleAllocated: boolean; virtual;
|
||||
function GetUpdatedHandle(ReqState: TCanvasState): HDC; virtual;
|
||||
public
|
||||
{$IFNDEF UseFPCanvas}
|
||||
property ClipRect: TRect read GetClipRect;
|
||||
property PenPos: TPoint read FPenPos write SetPenPos;
|
||||
{$ENDIF}
|
||||
property Pixels[X, Y: Integer]: TColor read GetPixel write SetPixel;
|
||||
property Handle: HDC read GetHandle write SetHandle;
|
||||
property TextStyle: TTextStyle read FTextStyle write FTextStyle;
|
||||
@ -1721,7 +1625,6 @@ begin
|
||||
Blue := (rgb shr 16) and $000000ff;
|
||||
end;
|
||||
|
||||
{$IFNDEF DisableFPImage}
|
||||
function FPColorToTColor(const FPColor: TFPColor): TColor;
|
||||
begin
|
||||
Result:=((FPColor.Red shr 8) and $ff)
|
||||
@ -1739,7 +1642,6 @@ begin
|
||||
Result.Blue:=Result.Blue+(Result.Blue shr 8);
|
||||
Result.Alpha:=FPImage.alphaOpaque;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$I graphicsobject.inc}
|
||||
{$I graphic.inc}
|
||||
@ -1881,7 +1783,6 @@ begin
|
||||
AStream.Position:=OldPosition;
|
||||
end;
|
||||
|
||||
{$IFNDEF DisableFPImage}
|
||||
procedure TIcon.ReadData(Stream: TStream);
|
||||
var
|
||||
Size: longint;
|
||||
@ -1924,7 +1825,6 @@ begin
|
||||
FBitmaps := TObjectList.create(True);
|
||||
FBitmaps.Add(Bitmap);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure InterfaceFinal;
|
||||
begin
|
||||
|
@ -43,10 +43,6 @@ unit ImgList;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$IFDEF VER1_0_10}
|
||||
{$DEFINE DisableFPImage}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
{$ifdef Trace}
|
||||
@ -55,11 +51,7 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, FPCAdds, LCLStrConsts, LCLIntf, LResources, LCLType,
|
||||
LCLProc, Graphics, GraphType, LCLClasses
|
||||
{$IFNDEF DisableFPImage}
|
||||
,IntfGraphics, FPReadBMP
|
||||
{$ENDIF}
|
||||
;
|
||||
LCLProc, Graphics, GraphType, LCLClasses, IntfGraphics, FPReadBMP;
|
||||
|
||||
type
|
||||
TImageIndex = type integer;
|
||||
@ -165,7 +157,7 @@ type
|
||||
constructor CreateSize(AWidth, AHeight: Integer);
|
||||
procedure Delete(Index: Integer);
|
||||
destructor Destroy; override;
|
||||
procedure Draw(Canvas: TCanvas; X, Y, Index: Integer; Enabled: Boolean{$IFNDEF VER1_0}=True{$ENDIF});
|
||||
procedure Draw(Canvas: TCanvas; X, Y, Index: Integer; Enabled: Boolean = True);
|
||||
procedure GetBitmap(Index: Integer; Image: TBitmap);
|
||||
procedure GetInternalImage(Index: integer; var Image, Mask: TBitmap;
|
||||
var ImageRect: TRect);
|
||||
|
@ -46,11 +46,9 @@ end;
|
||||
procedure TBitMap.Assign(Source: TPersistent);
|
||||
var
|
||||
SrcBitmap: TBitmap;
|
||||
{$IFNDEF DisableFPImage}
|
||||
SrcFPImage: TFPCustomImage;
|
||||
IntfImage: TLazIntfImage;
|
||||
ImgHandle,ImgMaskHandle: HBitmap;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if Source=Self then exit;
|
||||
if Source is TBitmap then begin
|
||||
@ -72,7 +70,6 @@ begin
|
||||
FImage.Reference;
|
||||
//DebugLn('TBitMap.Assign B ',Width,',',Height,' ',HandleAllocated,' RefCount=',FImage.RefCount);
|
||||
Changed(Self);
|
||||
{$IFNDEF DisableFPImage}
|
||||
end else if Source is TFPCustomImage then begin
|
||||
Changing(Self);
|
||||
SrcFPImage:=TFPCustomImage(Source);
|
||||
@ -90,7 +87,6 @@ begin
|
||||
IntfImage.Free;
|
||||
end;
|
||||
Changed(Self);
|
||||
{$ENDIF}
|
||||
end else
|
||||
inherited Assign(Source);
|
||||
end;
|
||||
@ -214,11 +210,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TBitmap.LoadFromDevice(DC: HDC);
|
||||
{$IFDEF DisableFPImage}
|
||||
begin
|
||||
debugln('TBitmap.LoadFromDevice needs FPImage');
|
||||
end;
|
||||
{$ELSE}
|
||||
var
|
||||
IntfImg: TLazIntfImage;
|
||||
ImgHandle, ImgMaskHandle: HBitmap;
|
||||
@ -244,7 +235,6 @@ begin
|
||||
if ImgMaskHandle<>0 then DeleteObject(ImgMaskHandle);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TBitmap.LazarusResourceTypeValid(const ResourceType: string): boolean;
|
||||
begin
|
||||
|
@ -42,16 +42,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
Procedure TBrush.SetColor(Value : TColor);
|
||||
begin
|
||||
if FColor <> Value
|
||||
then begin
|
||||
{$IFDEF UseFPCanvas}
|
||||
SetColor(Value,TColorToFPColor(Value));
|
||||
{$ELSE}
|
||||
FreeHandle;
|
||||
FColor := Value;
|
||||
Changed;
|
||||
{$ENDIF}
|
||||
end;
|
||||
if FColor <> Value then SetColor(Value,TColorToFPColor(Value));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -65,11 +56,7 @@ Procedure TBrush.SetStyle(Value : TBrushStyle);
|
||||
begin
|
||||
if Style <> Value then begin
|
||||
FreeHandle;
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetStyle(Value);
|
||||
{$ELSE}
|
||||
FStyle := Value;
|
||||
{$ENDIF}
|
||||
Changed;
|
||||
end;
|
||||
end;
|
||||
@ -104,12 +91,8 @@ begin
|
||||
FBitmap := nil;
|
||||
FHandle := 0;
|
||||
FColor := clWhite;
|
||||
{$IFDEF UseFPCanvas}
|
||||
DelayAllocate:=true;
|
||||
inherited SetStyle(bsSolid);
|
||||
{$ELSE}
|
||||
FStyle := bsSolid;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -137,11 +120,7 @@ begin
|
||||
if Source is TBrush
|
||||
then begin
|
||||
Bitmap := TBrush(Source).Bitmap;
|
||||
{$IFDEF UseFPCanvas}
|
||||
SetColor(TBrush(Source).Color,TFPCanvasHelper(Source).FPColor);
|
||||
{$ELSE}
|
||||
Color := TBrush(Source).Color;
|
||||
{$ENDIF}
|
||||
Style := TBrush(Source).Style;
|
||||
end
|
||||
else
|
||||
@ -240,7 +219,6 @@ begin
|
||||
Changed;
|
||||
end;
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
procedure TBrush.DoAllocateResources;
|
||||
begin
|
||||
inherited DoAllocateResources;
|
||||
@ -278,7 +256,6 @@ begin
|
||||
if FPColor=AValue then exit;
|
||||
SetColor(FPColorToTColor(AValue),AValue);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
|
@ -210,11 +210,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCanvas.SetInternalPenPos(const Value: TPoint);
|
||||
begin
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetPenPos(Value);
|
||||
{$ELSE}
|
||||
FPenPos:=Value;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -267,7 +263,6 @@ begin
|
||||
FRegion.Assign(Value);
|
||||
end;
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
function TCanvas.DoCreateDefaultFont: TFPCustomFont;
|
||||
begin
|
||||
Result:=TFont.Create;
|
||||
@ -499,7 +494,6 @@ procedure TCanvas.CheckHelper(AHelper: TFPCanvasHelper);
|
||||
begin
|
||||
debugln('TCanvas.CheckHelper ignored for ',DbgSName(AHelper));
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCanvas.Arc
|
||||
@ -621,8 +615,8 @@ end;
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCanvas.PolyBezier(const Points: array of TPoint;
|
||||
Filled: boolean{$IFNDEF VER1_0} = False{$ENDIF};
|
||||
Continuous: boolean{$IFNDEF VER1_0} = False{$ENDIF});
|
||||
Filled: boolean = False;
|
||||
Continuous: boolean = False);
|
||||
var NPoints, i: integer;
|
||||
PointArray: ^TPoint;
|
||||
begin
|
||||
@ -636,8 +630,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCanvas.PolyBezier(Points: PPoint; NumPts: Integer;
|
||||
Filled: boolean{$IFNDEF VER1_0} = False{$ENDIF};
|
||||
Continuous: boolean{$IFNDEF VER1_0} = False{$ENDIF});
|
||||
Filled: boolean = False;
|
||||
Continuous: boolean = False);
|
||||
begin
|
||||
Changing;
|
||||
RequiredState([csHandleValid, csBrushValid, csPenValid]);
|
||||
@ -645,18 +639,6 @@ begin
|
||||
Changed;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCanvas.PolyBezier
|
||||
Params: Points
|
||||
Returns: Nothing
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
{$ifdef VER1_0}
|
||||
procedure TCanvas.PolyBezier(const Points: array of TPoint);
|
||||
begin
|
||||
PolyBezier(Points, False, True);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCanvas.Polygon
|
||||
@ -695,7 +677,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCanvas.Polygon(Points: PPoint; NumPts: Integer;
|
||||
Winding: boolean{$IFNDEF VER1_0} = False{$ENDIF});
|
||||
Winding: boolean = False);
|
||||
begin
|
||||
if NumPts<=0 then exit;
|
||||
Changing;
|
||||
@ -1233,21 +1215,11 @@ end;
|
||||
constructor TCanvas.Create;
|
||||
begin
|
||||
FHandle := 0;
|
||||
{$IFDEF UseFPCanvas}
|
||||
ManageResources := true;
|
||||
{$ENDIF}
|
||||
inherited Create;
|
||||
{$IFDEF UseFPCanvas}
|
||||
FFont := TFont(inherited Font);
|
||||
FPen := TPen(inherited Pen);
|
||||
FBrush := TBrush(inherited Brush);
|
||||
{$ELSE}
|
||||
FFont := TFont.Create;
|
||||
FPen := TPen.Create;
|
||||
FBrush := TBrush.Create;
|
||||
FPenPos := Point(0, 0);
|
||||
FLockCount := 0;
|
||||
{$ENDIF}
|
||||
FFont.OnChange := @FontChanged;
|
||||
FSavedFontHandle := 0;
|
||||
FPen.OnChanging := @PenChanging;
|
||||
@ -1320,21 +1292,14 @@ destructor TCanvas.Destroy;
|
||||
begin
|
||||
//DebugLn('[TCanvas.Destroy] ',ClassName,' Self=',DbgS(Self));
|
||||
Handle := 0;
|
||||
{$IFNDEF UseFPCanvas}
|
||||
FreeThenNil(FFont);
|
||||
FreeThenNil(FPen);
|
||||
FreeThenNil(FBrush);
|
||||
{$ENDIF}
|
||||
FreeThenNil(FRegion);
|
||||
if FLock <> 0 then
|
||||
DeleteCriticalSection(FLock);
|
||||
inherited Destroy;
|
||||
{$IFDEF UseFPCanvas}
|
||||
// set resources to nil, so that dangling pointers are spotted early
|
||||
FFont:=nil;
|
||||
FPen:=nil;
|
||||
FBrush:=nil;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1508,15 +1473,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCanvas.Lock;
|
||||
begin
|
||||
{$IFDEF UseFPCanvas}
|
||||
LockCanvas;
|
||||
{$ELSE}
|
||||
if FLockCount=0 then begin
|
||||
if FLock=0 then InitializeCriticalSection(FLock);
|
||||
EnterCriticalSection(FLock);
|
||||
end;
|
||||
Inc(FLockCount);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1533,15 +1490,7 @@ procedure TCanvas.Unlock;
|
||||
end;
|
||||
|
||||
begin
|
||||
{$IFDEF UseFPCanvas}
|
||||
UnlockCanvas;
|
||||
{$ELSE}
|
||||
Dec(FLockCount);
|
||||
if FLockCount=0 then begin
|
||||
LeaveCriticalSection(FLock);
|
||||
end else if FLockCount<0 then
|
||||
RaiseTooManyUnlock;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -525,13 +525,9 @@ begin
|
||||
FPixelsPerInch:=ScreenInfo.PixelsPerInchX;
|
||||
FPitch:=DefFontData.Pitch;
|
||||
FCharSet:=DefFontData.CharSet;
|
||||
{$IFDEF UseFPCanvas}
|
||||
DelayAllocate:=true;
|
||||
inherited SetName(DefFontData.Name);
|
||||
inherited SetFPColor(colBlack);
|
||||
{$ELSE}
|
||||
FFontName:=DefFontData.Name;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -551,11 +547,7 @@ begin
|
||||
BeginUpdate;
|
||||
try
|
||||
CharSet:= TFont(Source).CharSet;
|
||||
{$IFDEF UseFPCanvas}
|
||||
SetColor(TFont(Source).Color,TFPCanvasHelper(Source).FPColor);
|
||||
{$ELSE}
|
||||
Color := TFont(Source).Color;
|
||||
{$ENDIF}
|
||||
Height := TFont(Source).Height;
|
||||
Name := TFont(Source).Name;
|
||||
Pitch := TFont(Source).Pitch;
|
||||
@ -664,11 +656,7 @@ begin
|
||||
BeginUpdate;
|
||||
try
|
||||
FreeHandle;
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetSize(AValue);
|
||||
{$ELSE}
|
||||
FSize:=AValue;
|
||||
{$ENDIF}
|
||||
FHeight := - (AValue * FPixelsPerInch) div 72;
|
||||
if IsFontNameXLogicalFontDesc(Name) then
|
||||
Name:=ClearXLFDHeight(Name);
|
||||
@ -688,11 +676,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TFont.GetSize: Integer;
|
||||
begin
|
||||
{$IFDEF UseFPCanvas}
|
||||
Result := inherited Size;
|
||||
{$ELSE}
|
||||
Result := FSize;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -760,14 +744,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFont.SetColor(Value : TColor);
|
||||
begin
|
||||
if FColor <> Value then begin
|
||||
{$IFDEF UseFPCanvas}
|
||||
SetColor(Value,TColorToFPColor(Value));
|
||||
{$ELSE}
|
||||
FColor := Value;
|
||||
Changed;
|
||||
{$ENDIF}
|
||||
end;
|
||||
if FColor <> Value then SetColor(Value,TColorToFPColor(Value));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -779,11 +756,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TFont.GetName: string;
|
||||
begin
|
||||
{$IFDEF UseFPCanvas}
|
||||
Result:=inherited Name;
|
||||
{$ELSE}
|
||||
Result:=FFontName;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -793,20 +766,15 @@ end;
|
||||
|
||||
Sets the name of a font
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFont.SetName({$IFNDEF UseFPCanvas}const{$ENDIF}AValue: string);
|
||||
procedure TFont.SetName(AValue: string);
|
||||
begin
|
||||
if Name <> AValue then begin
|
||||
FreeHandle;
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetName(AValue);
|
||||
{$ELSE}
|
||||
FFontName:=AValue;
|
||||
{$ENDIF}
|
||||
Changed;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
procedure TFont.DoAllocateResources;
|
||||
begin
|
||||
inherited DoAllocateResources;
|
||||
@ -879,7 +847,6 @@ begin
|
||||
inherited SetFPColor(NewFPColor);
|
||||
Changed;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFont.Destroy
|
||||
@ -1028,27 +995,18 @@ begin
|
||||
end;
|
||||
|
||||
procedure TFont.SetData(const FontData: TFontData);
|
||||
{$IFDEF UseFPCanvas}
|
||||
var
|
||||
OldStyle: TFontStylesbase;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if (FHandle <> FontData.Handle) or (FHandle=0) then begin
|
||||
{$IFDEF UseFPCanvas}
|
||||
OldStyle:=FStyle;
|
||||
{$ENDIF}
|
||||
FreeHandle;
|
||||
FHandle := FontData.Handle;
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetSize(-(FontData.Height * 72) div FPixelsPerInch);
|
||||
{$ELSE}
|
||||
FSize := -(FontData.Height * 72) div FPixelsPerInch;
|
||||
{$ENDIF}
|
||||
FHeight := FontData.Height;
|
||||
FPitch:=FontData.Pitch;
|
||||
FStyle:=FontData.Style;
|
||||
FCharSet:=FontData.CharSet;
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetName(FontData.Name);
|
||||
bold;
|
||||
if (fsBold in OldStyle)<>(fsBold in FStyle) then
|
||||
@ -1059,9 +1017,6 @@ begin
|
||||
inherited SetFlags(7,fsUnderline in FStyle);
|
||||
if (fsStrikeOut in OldStyle)<>(fsStrikeOut in FStyle) then
|
||||
inherited SetFlags(8,fsStrikeOut in FStyle);
|
||||
{$ELSE}
|
||||
FFontName:=FontData.Name;
|
||||
{$ENDIF}
|
||||
Changed;
|
||||
end;
|
||||
end;
|
||||
|
@ -200,7 +200,6 @@ begin
|
||||
FModified := False;
|
||||
end;
|
||||
|
||||
{$IFNDEF DisableFPImage}
|
||||
function TGraphic.GetFPReaderForFileExt(const FileExtension: string
|
||||
): TFPCustomImageReaderClass;
|
||||
begin
|
||||
@ -222,7 +221,6 @@ function TGraphic.GetDefaultFPWriter: TFPCustomImageWriterClass;
|
||||
begin
|
||||
Result:=nil;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TGraphic.SetTransparent(Value: Boolean);
|
||||
begin
|
||||
|
@ -711,20 +711,6 @@ var
|
||||
i: Integer;
|
||||
Signature: TImageListSignature;
|
||||
begin
|
||||
{$IFDEF DisableFPImage}
|
||||
//Write signature
|
||||
Signature:=SIG_LAZ1;
|
||||
AStream.Write(Signature,SizeOf(Signature));
|
||||
|
||||
//Count of image
|
||||
WriteLRSWord(AStream,Count);
|
||||
|
||||
for i:=0 to Count-1 do
|
||||
begin
|
||||
CurImage:=TBitmap(FImageList[i]);
|
||||
CurImage.WriteStream(AStream,true);
|
||||
end;
|
||||
{$ELSE}
|
||||
//Write signature
|
||||
Signature:=SIG_LAZ2;
|
||||
AStream.Write(Signature,SizeOf(Signature));
|
||||
@ -740,7 +726,6 @@ begin
|
||||
//DebugLn('TCustomImageList.WriteData Position=',AStream.Position,' ',CurImage.Width,',',CurImage.Height);
|
||||
CurImage.WriteNativeStream(AStream,true,bnXPixmap);
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -795,7 +780,6 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFNDEF DisableFPImage}
|
||||
procedure CreateImagesFromRawImage(IntfImage: TLazIntfImage;
|
||||
NewCount: integer);
|
||||
var
|
||||
@ -871,7 +855,6 @@ var
|
||||
MaskIntfImage.Free;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF SaveDelphiImgListStream}
|
||||
procedure SaveImgListStreamToFile;
|
||||
@ -897,9 +880,7 @@ var
|
||||
{$ENDIF}
|
||||
|
||||
var
|
||||
{$IFNDEF DisableFPImage}
|
||||
HasMask: Boolean;
|
||||
{$ENDIF}
|
||||
NewCount: Integer;
|
||||
Size: integer;
|
||||
begin
|
||||
@ -938,13 +919,11 @@ begin
|
||||
FHeight := ReadLRSWord(AStream);
|
||||
//DebugLn('NewHeight=',FHeight);
|
||||
FBKColor := TColor(ReadLRSInteger(AStream));
|
||||
{$IFNDEF DisableFPImage}
|
||||
HasMask := (ReadLRSWord(AStream) and 1) = 1;
|
||||
AStream.ReadDWord; //Skip ?
|
||||
AStream.ReadDWord; //Skip ?
|
||||
|
||||
ReadDelphiImageAndMask(HasMask,NewCount);
|
||||
{$ENDIF}
|
||||
end
|
||||
else begin
|
||||
// D2 has no signature, so restore original position
|
||||
@ -952,9 +931,7 @@ begin
|
||||
Size:=ReadLRSInteger(AStream);
|
||||
NewCount:=ReadLRSInteger(AStream);
|
||||
|
||||
{$IFNDEF DisableFPImage}
|
||||
ReadDelphiImageAndMask(false,NewCount);
|
||||
{$ENDIF}
|
||||
AStream.Position := StreamPos+Size;
|
||||
end;
|
||||
end;
|
||||
|
@ -46,12 +46,7 @@ begin
|
||||
if FColor <> value
|
||||
then begin
|
||||
FreeHandle;
|
||||
{$IFDEF UseFPCanvas}
|
||||
SetColor(Value,TColorToFPColor(Value));
|
||||
{$ELSE}
|
||||
FColor := Value;
|
||||
Changed;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -67,11 +62,7 @@ begin
|
||||
if Style <> Value
|
||||
then begin
|
||||
FreeHandle;
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetStyle(Value);
|
||||
{$ELSE}
|
||||
FStyle:=Value;
|
||||
{$ENDIF}
|
||||
Changed;
|
||||
end;
|
||||
end;
|
||||
@ -88,11 +79,7 @@ begin
|
||||
if Mode <> Value
|
||||
then begin
|
||||
FreeHandle;
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetMode(Value);
|
||||
{$ELSE}
|
||||
FMode:=Value;
|
||||
{$ENDIF}
|
||||
Changed;
|
||||
end;
|
||||
end;
|
||||
@ -109,11 +96,7 @@ begin
|
||||
if Width <> Value
|
||||
then begin
|
||||
FreeHandle;
|
||||
{$IFDEF UseFPCanvas}
|
||||
inherited SetWidth(Value);
|
||||
{$ELSE}
|
||||
FWidth:=Value;
|
||||
{$ENDIF}
|
||||
Changed;
|
||||
end;
|
||||
end;
|
||||
@ -129,17 +112,11 @@ constructor TPen.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FHandle := 0;
|
||||
{$IFDEF UseFPCanvas}
|
||||
DelayAllocate:=true;
|
||||
inherited SetWidth(1);
|
||||
inherited SetStyle(psSolid);
|
||||
inherited SetMode(pmCopy);
|
||||
inherited SetFPColor(colBlack);
|
||||
{$ELSE}
|
||||
FWidth := 1;
|
||||
FStyle := psSolid;
|
||||
FMode := pmCopy;
|
||||
{$ENDIF}
|
||||
Color := clBlack;
|
||||
end;
|
||||
|
||||
@ -168,11 +145,7 @@ begin
|
||||
if Source is TPen
|
||||
then begin
|
||||
Width := TPen(Source).Width;
|
||||
{$IFDEF UseFPCanvas}
|
||||
SetColor(TPen(Source).Color,TFPCanvasHelper(Source).FPColor);
|
||||
{$ELSE}
|
||||
Color := TPen(Source).Color;
|
||||
{$ENDIF}
|
||||
Style := TPen(Source).Style;
|
||||
end
|
||||
else
|
||||
@ -207,13 +180,9 @@ end;
|
||||
function TPen.GetHandle: HPEN;
|
||||
const
|
||||
PEN_STYLES: array[TPenStyle] of Word = (
|
||||
{$IFDEF UseFPCanvas}
|
||||
ps_Solid, ps_Dash, ps_Dot, ps_DashDot, ps_DashDotDot, ps_insideFrame,
|
||||
ps_Solid,{ ToDo ps_Pattern,}
|
||||
ps_NULL
|
||||
{$ELSE}
|
||||
PS_SOLID,PS_DASH,PS_DOT,PS_DASHDOT,PS_DASHDOTDOT,PS_NULL,PS_INSIDEFRAME
|
||||
{$ENDIF}
|
||||
);
|
||||
var
|
||||
LogPen: TLogPen;
|
||||
@ -264,7 +233,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF UseFPCanvas}
|
||||
procedure TPen.DoAllocateResources;
|
||||
begin
|
||||
inherited DoAllocateResources;
|
||||
@ -303,7 +271,6 @@ begin
|
||||
SetColor(FPColorToTColor(AValue),AValue);
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
|
@ -320,7 +320,6 @@ begin
|
||||
Result:=GetPicFileFormats.FindExt(FileExt);
|
||||
end;
|
||||
|
||||
{$IFNDEF DisableFPImage}
|
||||
function GetFPImageReaderForFileExtension(const FileExt: string
|
||||
): TFPCustomImageReaderClass;
|
||||
var
|
||||
@ -344,7 +343,6 @@ begin
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
//--TPicture--------------------------------------------------------------------
|
||||
|
||||
@ -554,10 +552,8 @@ begin
|
||||
SetGraphic(TPicture(Source).Graphic)
|
||||
else if Source is TGraphic then
|
||||
SetGraphic(TGraphic(Source))
|
||||
{$IFNDEF DisableFPImage}
|
||||
else if Source is TFPCustomImage then
|
||||
Bitmap.Assign(Source)
|
||||
{$ENDIF}
|
||||
else
|
||||
inherited Assign(Source);
|
||||
end;
|
||||
|
@ -25,7 +25,6 @@ begin
|
||||
Result:='pbm;pgm;ppm';
|
||||
end;
|
||||
|
||||
{$IFNDEF DisableFPImage}
|
||||
function TPortableAnyMapGraphic.GetDefaultFPReader: TFPCustomImageReaderClass;
|
||||
begin
|
||||
Result:=TFPReaderPNM;
|
||||
@ -35,7 +34,6 @@ function TPortableAnyMapGraphic.GetDefaultFPWriter: TFPCustomImageWriterClass;
|
||||
begin
|
||||
Result:=TFPWriterPNM;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
// included by graphics.pp
|
||||
|
@ -37,21 +37,12 @@
|
||||
unit PostscriptCanvas;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$IFDEF VER1_0_10}
|
||||
{$DEFINE DisableFPImage}
|
||||
{$ENDIF}
|
||||
{$IFNDEF VER1_0}
|
||||
{$DEFINE UseFPCanvas}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Math, Graphics, Forms, GraphMath, GraphType,
|
||||
{$IFNDEF DisableFPImage}
|
||||
FPImage, IntfGraphics,
|
||||
{$ENDIF}
|
||||
Printers, LCLType, LCLIntf;
|
||||
FPImage, IntfGraphics, Printers, LCLType, LCLIntf;
|
||||
|
||||
Type
|
||||
TPostscriptPrinterCanvas = Class(TPrinterCanvas)
|
||||
@ -74,10 +65,7 @@ Type
|
||||
FirstUpdatefont: Boolean;
|
||||
|
||||
procedure WriteHeader(St : String);
|
||||
procedure Write(const St : String; Lst : TstringList{$IFNDEF VER1_0}=nil{$ENDIF}); overload;
|
||||
{$IFDEF VER1_0} //added because fpc 1.0 doesn't have default parameters
|
||||
procedure Write(const St : String); overload;
|
||||
{$ENDIF}
|
||||
procedure Write(const St : String; Lst : TstringList = nil); overload;
|
||||
procedure WriteB(const St : string);
|
||||
procedure ClearBuffer;
|
||||
procedure Write(Lst : TStringList); overload;
|
||||
@ -87,7 +75,7 @@ Type
|
||||
procedure SetPosition(X,Y : Integer);
|
||||
|
||||
procedure UpdateLineWidth;
|
||||
procedure UpdateLineColor(aColor : TColor{$IFNDEF VER1_0}=clNone{$ENDIF});
|
||||
procedure UpdateLineColor(aColor : TColor = clNone);
|
||||
procedure UpdateLineStyle;
|
||||
procedure UpdateFillColor;
|
||||
procedure UpdateFont;
|
||||
@ -116,8 +104,8 @@ Type
|
||||
Procedure LineTo(X1,Y1: Integer); override;
|
||||
procedure Polyline(Points: PPoint; NumPts: Integer); override;
|
||||
procedure PolyBezier(Points: PPoint; NumPts: Integer;
|
||||
Filled: boolean{$IFNDEF VER1_0} = False{$ENDIF};
|
||||
Continuous: boolean{$IFNDEF VER1_0} = False{$ENDIF}); override;
|
||||
Filled: boolean = False;
|
||||
Continuous: boolean = False); override;
|
||||
|
||||
Procedure Rectangle(X1,Y1,X2,Y2: Integer); override;
|
||||
procedure Frame(const ARect: TRect); override; // border using pen
|
||||
@ -126,7 +114,7 @@ Type
|
||||
Procedure FillRect(const ARect: TRect); override;
|
||||
Procedure RoundRect(X1, Y1, X2, Y2: Integer; RX,RY: Integer); override;
|
||||
procedure Polygon(Points: PPoint; NumPts: Integer;
|
||||
Winding: boolean{$IFNDEF VER1_0}=False{$ENDIF}); override;
|
||||
Winding: boolean = False); override;
|
||||
|
||||
procedure Ellipse(x1, y1, x2, y2: Integer); override;
|
||||
procedure Arc(Left,Top,AWidth,AHeight,angle1,angle2: Integer); override;
|
||||
@ -180,15 +168,9 @@ Type
|
||||
|
||||
Const
|
||||
cBrushStyle : Array[TBrushStyle] of String =
|
||||
{$IFDEF UseFPCanvas}
|
||||
('bsClear', 'bsSolid', 'bsBDiagonal',
|
||||
'bsFDiagonal', 'bsCross', 'bsDiagCross',
|
||||
'bsHorizontal', 'bsVertical', 'bsImage', 'bsPattern');
|
||||
{$ELSE}
|
||||
('bsSolid','bsClear','bsHorizontal',
|
||||
'bsVertical','bsFDiagonal',
|
||||
'bsBDiagonal','bsCross','bsDiagCross');
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
cFontPSMetrics : Array[0..12] of TFontPSMetrics =(
|
||||
@ -528,7 +510,7 @@ begin
|
||||
end;
|
||||
|
||||
//Write an instruction in the document
|
||||
procedure TPostscriptPrinterCanvas.Write(const St: String; Lst : TStringList{$IFNDEF VER1_0}=Nil{$ENDIF});
|
||||
procedure TPostscriptPrinterCanvas.Write(const St: String; Lst : TStringList = Nil);
|
||||
begin
|
||||
If not Assigned(Lst) then
|
||||
Lst:=fDocument;
|
||||
@ -536,13 +518,6 @@ begin
|
||||
Lst.Add(St);
|
||||
end;
|
||||
|
||||
{$IFDEF VER1_0}
|
||||
procedure TPostscriptPrinterCanvas.Write(const St: String);
|
||||
begin
|
||||
Write(St, nil);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
//Write data in fBuffer
|
||||
procedure TPostscriptPrinterCanvas.WriteB(const St: string);
|
||||
begin
|
||||
@ -594,7 +569,7 @@ begin
|
||||
end;
|
||||
|
||||
//Init the color of line (pen)
|
||||
procedure TPostscriptPrinterCanvas.UpdateLineColor(aColor : TColor{$IFNDEF VER1_0}=clNone{$ENDIF});
|
||||
procedure TPostscriptPrinterCanvas.UpdateLineColor(aColor : TColor = clNone);
|
||||
Var R,G,B : Real;
|
||||
RGBColor : TColor;
|
||||
begin
|
||||
@ -765,7 +740,7 @@ begin
|
||||
|
||||
if SetBorder and ((Pen.Color<>clNone) and ((Pen.Color<>Brush.Color) or (Brush.Style<>bsSolid))) then
|
||||
begin
|
||||
UpdateLineColor{$IFDEF VER1_0}(clNone){$ENDIF};
|
||||
UpdateLineColor(clNone);
|
||||
UpdateLineWidth;
|
||||
UpdateLineStyle;
|
||||
Write(Lst);
|
||||
@ -781,10 +756,6 @@ end;
|
||||
//Add in Lst, all RGB pixels of SrcGraph picture
|
||||
procedure TPostscriptPrinterCanvas.GetRGBImage(SrcGraph: TGraphic;
|
||||
Lst: TStringList);
|
||||
{$IFDEF DisableFPImage}
|
||||
begin
|
||||
end;
|
||||
{$ELSE}
|
||||
var
|
||||
SrcIntfImg : TLazIntfImage;
|
||||
px, py : Integer;
|
||||
@ -822,7 +793,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TPostscriptPrinterCanvas.CreateHandle;
|
||||
begin
|
||||
@ -1287,7 +1257,7 @@ begin
|
||||
WriteComment(Format('LineTo(%d,%d)',[x1,y1]));
|
||||
SetPosition(X1,Y1);
|
||||
TranslateCoord(X1,Y1);
|
||||
UpdateLineColor{$IFDEF VER1_0}(clNone){$ENDIF};
|
||||
UpdateLineColor(clNone);
|
||||
UpdateLineWidth;
|
||||
UpdateLineStyle;
|
||||
write(Format('%d %d lineto stroke',[X1,Y1]));
|
||||
@ -1319,7 +1289,7 @@ begin
|
||||
|
||||
if (Pen.Color<>clNone) and ((Pen.Color<>Brush.Color) or (Brush.Style<>bsSolid)) then
|
||||
begin
|
||||
UpdateLineColor{$IFDEF VER1_0}(clNone){$ENDIF};
|
||||
UpdateLineColor(clNone);
|
||||
UpdateLineWidth;
|
||||
UpdateLineStyle;
|
||||
Write(Lst);
|
||||
@ -1629,7 +1599,7 @@ begin
|
||||
|
||||
if (Pen.Color<>clNone) and ((Pen.Color<>Brush.Color) or (Brush.Style<>bsSolid)) then
|
||||
begin
|
||||
UpdateLineColor{$IFDEF VER1_0}(clNone){$ENDIF};
|
||||
UpdateLineColor(clNone);
|
||||
UpdateLineWidth;
|
||||
UpdateLineStyle;
|
||||
|
||||
@ -1794,7 +1764,6 @@ begin
|
||||
|
||||
//if not FPImage then draw ab Rectangle because other wise PostScript
|
||||
//interpreter wait infinite some RGB datas
|
||||
{$ifndef DisableFPImage}
|
||||
DrawWidth:=X2-X1;
|
||||
DrawHeight:=Y1-Y2;
|
||||
ClearBuffer;
|
||||
@ -1812,15 +1781,6 @@ begin
|
||||
WriteB('% end of image data');
|
||||
WriteB('grestore');
|
||||
|
||||
{$else}
|
||||
WriteB('newpath');
|
||||
writeB(Format(' %d %d moveto',[X1,Y1]));
|
||||
writeB(Format(' %d %d lineto',[X2,Y1]));
|
||||
writeB(Format(' %d %d lineto',[X2,Y2]));
|
||||
writeB(Format(' %d %d lineto',[X1,Y2]));
|
||||
writeB('closepath');
|
||||
{$endif}
|
||||
|
||||
Write(fBuffer);
|
||||
|
||||
Changed;
|
||||
|
Loading…
Reference in New Issue
Block a user