diff options
| author | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-03-21 15:33:29 +0000 |
|---|---|---|
| committer | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-03-21 15:33:29 +0000 |
| commit | af2e0e8755b811c715ed853a1d148a9bab7f9373 (patch) | |
| tree | 7c78a4c6a0a4c0859e21622131b130db9081bdbf /packages/fcl-image | |
| parent | 577868c7f80acb692afe2569fca29d7ee18de7f3 (diff) | |
| download | fpc-af2e0e8755b811c715ed853a1d148a9bab7f9373.tar.gz | |
* Added some missing functions to FPCanvas and added TFont.Orientation
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@17162 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-image')
| -rw-r--r-- | packages/fcl-image/src/fpcanvas.inc | 69 | ||||
| -rw-r--r-- | packages/fcl-image/src/fpcanvas.pp | 21 | ||||
| -rw-r--r-- | packages/fcl-image/src/fpfont.inc | 11 |
3 files changed, 100 insertions, 1 deletions
diff --git a/packages/fcl-image/src/fpcanvas.inc b/packages/fcl-image/src/fpcanvas.inc index 99784a8e8d..b3729fb5c3 100644 --- a/packages/fcl-image/src/fpcanvas.inc +++ b/packages/fcl-image/src/fpcanvas.inc @@ -402,6 +402,56 @@ begin FPenPos := points[high(points)]; end; +procedure TFPCustomCanvas.RadialPie(x1, y1, x2, y2, StartAngle16Deg, Angle16DegLength: Integer); + +begin + DoRadialPie(X1, y1, x2, y2, StartAngle16Deg, Angle16DegLength); +end; + +procedure TFPCustomCanvas.DoRadialPie(x1, y1, x2, y2, StartAngle16Deg, Angle16DegLength: Integer); + +begin + // To be implemented +end; + +procedure TFPCustomCanvas.DoPolyBezier(Points: PPoint; NumPts: Integer; + Filled: boolean = False; + Continuous: boolean = False); + +begin + // To be implemented +end; + +procedure TFPCustomCanvas.PolyBezier(Points: PPoint; NumPts: Integer; + Filled: boolean = False; + Continuous: boolean = False); +begin + DoPolyBezier(Points,NumPts,Filled,Continuous); +end; + +procedure TFPCustomCanvas.PolyBezier(const Points: array of TPoint; + Filled: boolean = False; + Continuous: boolean = False); +var + NPoints{, i}: integer; +// PointArray: ^TPoint; +begin + NPoints:=High(Points)-Low(Points)+1; + if NPoints>0 then + DoPolyBezier(@Points[Low(Points)],NPoints,Filled,Continuous); +{ + NPoints:=High(Points)-Low(Points)+1; + if NPoints<=0 then exit; + GetMem(PointArray,SizeOf(TPoint)*NPoints); + try + for i:=0 to NPoints-1 do + PointArray[i]:=Points[i+Low(Points)]; + DoPolyBezier(PointArray, NPoints, Filled, Continuous); + finally + FreeMem(PointArray); + end;} +end; + procedure TFPCustomCanvas.Clear; var r : TRect; begin @@ -500,6 +550,25 @@ begin Rectangle (Rect(left,top,right,bottom)); end; +procedure TFPCustomCanvas.FillRect(const ARect: TRect); + +begin + if (Brush.style <> bsClear) then + begin + if not (brush is TFPCustomDrawBrush) then + DoRectangleFill (ARect) + else + with ARect do + TFPCustomDrawBrush(Brush).Rectangle (left,top,right,bottom); + end; +end; + +procedure TFPCustomCanvas.FillRect(X1,Y1,X2,Y2: Integer); + +begin + FillRect (Rect(X1,Y1,X2,Y2)); +end; + procedure TFPCustomCanvas.Rectangle (const Bounds:TRect); var np,nb,dp,db,pb : boolean; begin diff --git a/packages/fcl-image/src/fpcanvas.pp b/packages/fcl-image/src/fpcanvas.pp index 6c82cae7f7..c9ca814463 100644 --- a/packages/fcl-image/src/fpcanvas.pp +++ b/packages/fcl-image/src/fpcanvas.pp @@ -24,6 +24,7 @@ const type + PPoint = ^TPoint; TFPCanvasException = class (Exception); TFPPenException = class (TFPCanvasException); TFPBrushException = class (TFPCanvasException); @@ -82,11 +83,14 @@ type TFPCustomFont = class (TFPCanvasHelper) private FName : string; + FOrientation, FSize : integer; protected procedure DoCopyProps (From:TFPCanvasHelper); override; procedure SetName (AValue:string); virtual; procedure SetSize (AValue:integer); virtual; + procedure SetOrientation (AValue:integer); virtual; + function GetOrientation : Integer; public function CopyFont : TFPCustomFont; // Creates a copy of the font with all properties the same, but not allocated @@ -99,6 +103,8 @@ type property Italic : boolean index 6 read GetFlags write SetFlags; property Underline : boolean index 7 read GetFlags write SetFlags; property StrikeTrough : boolean index 8 read GetFlags write SetFlags; + property Orientation: Integer read GetOrientation write SetOrientation default 0; + end; TFPCustomFontClass = class of TFPCustomFont; @@ -255,6 +261,10 @@ type procedure DoLine (x1,y1,x2,y2:integer); virtual; abstract; procedure DoCopyRect (x,y:integer; canvas:TFPCustomCanvas; Const SourceRect:TRect); virtual; abstract; procedure DoDraw (x,y:integer; Const image:TFPCustomImage); virtual; abstract; + procedure DoRadialPie(x1, y1, x2, y2, StartAngle16Deg, Angle16DegLength: Integer); virtual; + procedure DoPolyBezier(Points: PPoint; NumPts: Integer; + Filled: boolean = False; + Continuous: boolean = False); virtual; procedure CheckHelper (AHelper:TFPCanvasHelper); virtual; procedure AddHelper (AHelper:TFPCanvasHelper); public @@ -277,8 +287,17 @@ type procedure EllipseC (x,y:integer; rx,ry:longword); procedure Polygon (Const points:array of TPoint); procedure Polyline (Const points:array of TPoint); - procedure Rectangle (Const Bounds:TRect); + procedure RadialPie(x1, y1, x2, y2, StartAngle16Deg, Angle16DegLength: Integer); + procedure PolyBezier(Points: PPoint; NumPts: Integer; + Filled: boolean = False; + Continuous: boolean = False); + procedure PolyBezier(const Points: array of TPoint; + Filled: boolean = False; + Continuous: boolean = False); + procedure Rectangle (Const Bounds : TRect); procedure Rectangle (left,top,right,bottom:integer); + procedure FillRect(const ARect: TRect); + procedure FillRect(X1,Y1,X2,Y2: Integer); // using brush procedure FloodFill (x,y:integer); procedure Clear; diff --git a/packages/fcl-image/src/fpfont.inc b/packages/fcl-image/src/fpfont.inc index a63f435fb6..b61c78a448 100644 --- a/packages/fcl-image/src/fpfont.inc +++ b/packages/fcl-image/src/fpfont.inc @@ -24,6 +24,17 @@ begin FSize := AValue; end; +procedure TFPCustomFont.SetOrientation (AValue:integer); +begin + FOrientation := AValue; +end; + +function TFPCustomFont.GetOrientation : Integer; +begin + Result := FOrientation; +end; + + procedure TFPCustomFont.DoCopyProps (From:TFPCanvasHelper); begin with from as TFPCustomFont do |
