diff --git a/components/aggpas/lazarus/example/unit2.pas b/components/aggpas/lazarus/example/unit2.pas index 6941ea250d..a8b3f4d943 100644 --- a/components/aggpas/lazarus/example/unit2.pas +++ b/components/aggpas/lazarus/example/unit2.pas @@ -53,6 +53,9 @@ begin Line(12,12,22,22); FillRect(40,10,50,20); + Ellipse(55,10,65,20); + + GradientFill(Rect(70,10,80,20),clRed,clBlue,gdVertical); end; // convert to LCL native pixel format @@ -69,6 +72,7 @@ begin Line(24,24,34,34); FillRect(40,22,50,32); + Ellipse(55,22,65,32); end; end; diff --git a/components/aggpas/src/agg_lcl.pas b/components/aggpas/src/agg_lcl.pas index 9f6416955b..b2d46dbecc 100755 --- a/components/aggpas/src/agg_lcl.pas +++ b/components/aggpas/src/agg_lcl.pas @@ -101,12 +101,20 @@ type procedure Changing; virtual; procedure Changed; virtual; + // extra drawing methods (there are more in the ancestor TFPCustomCanvas) + //procedure Arc(ALeft, ATop, ARight, ABottom, angle1, angle2: Integer); virtual; + //procedure Arc(ALeft, ATop, ARight, ABottom, SX, SY, EX, EY: Integer); virtual; + procedure FillRect(const ARect: TRect); virtual; procedure FillRect(X1,Y1,X2,Y2: Integer); + + procedure GradientFill(ARect: TRect; AStart, AStop: TColor; ADirection: TGradientDirection); end; procedure InitAggPasRawImageDescriptor(APixelFormat: TAggFPImgPixelFormat; AWidth, AHeight: cardinal; out Desc: TRawImageDescription); +function AggToLCLColor(const c: TAggColor): TColor; +function LCLToAggColor(const c: TColor): TAggColor; implementation @@ -140,6 +148,17 @@ begin end; end; +function AggToLCLColor(const c: TAggColor): TColor; +begin + Result:=RGBToColor(c.r,c.g,c.b); +end; + +function LCLToAggColor(const c: TColor): TAggColor; +begin + Result.a:=0; + RedGreenBlue(ColorToRGB(c),Result.r,Result.g,Result.b); +end; + { TAggLCLCanvas } function TAggLCLCanvas.DoCreateDefaultBrush: TFPCustomBrush; @@ -249,6 +268,15 @@ begin AggDrawPath(AGG_FillOnly); end; +procedure TAggLCLCanvas.GradientFill(ARect: TRect; AStart, AStop: TColor; + ADirection: TGradientDirection); +begin + raise Exception.Create('TAggLCLCanvas.GradientFill ToDo'); + AggFillLinearGradient(ARect.Left,ARect.Top,ARect.Right,ARect.Bottom, + LCLToAggColor(AStart),LCLToAggColor(AStop)); + FillRect(ARect); +end; + { TAggLCLBrush } procedure TAggLCLBrush.SetColor(const AValue: TColor);