|
@@ -124,12 +124,16 @@ type
|
|
procedure DrawElBackground(El: TFresnelElement; Params: TBorderAndBackground); override;
|
|
procedure DrawElBackground(El: TFresnelElement; Params: TBorderAndBackground); override;
|
|
procedure DrawElBorder(El: TFresnelElement; Params: TBorderAndBackground); override;
|
|
procedure DrawElBorder(El: TFresnelElement; Params: TBorderAndBackground); override;
|
|
procedure DrawTextShadow(const aLeft, aTop: TFresnelLength; const FreSkiaFont: TFresnelSkiaFont;
|
|
procedure DrawTextShadow(const aLeft, aTop: TFresnelLength; const FreSkiaFont: TFresnelSkiaFont;
|
|
- const aColor: TFPColor; const aRadius: TFresnelLength; const aTextBlob: ISkTextBlob);
|
|
|
|
|
|
+ const aColor: TFPColor; const aRadius: TFresnelLength; const aTextBlob: ISkTextBlob); virtual;
|
|
Public
|
|
Public
|
|
|
|
+ procedure Arc(const aColor: TFPColor; aCenter, aRadii: TFresnelPoint;
|
|
|
|
+ aStartAngle: Double=0; aStopAngle: Double=DoublePi); override;
|
|
procedure DrawImage(const aLeft, aTop, aWidth, aHeight: TFresnelLength;
|
|
procedure DrawImage(const aLeft, aTop, aWidth, aHeight: TFresnelLength;
|
|
const aImage: TFPCustomImage); override;
|
|
const aImage: TFPCustomImage); override;
|
|
procedure FillRect(const aColor: TFPColor; const aRect: TFresnelRect); override;
|
|
procedure FillRect(const aColor: TFPColor; const aRect: TFresnelRect); override;
|
|
procedure Line(const aColor: TFPColor; const x1, y1, x2, y2: TFresnelLength); override;
|
|
procedure Line(const aColor: TFPColor; const x1, y1, x2, y2: TFresnelLength); override;
|
|
|
|
+ procedure RoundRect(const aColor: TFPColor; const aRect: TFresnelRoundRect;
|
|
|
|
+ Fill: Boolean); override;
|
|
procedure TextOut(const aLeft, aTop: TFresnelLength;
|
|
procedure TextOut(const aLeft, aTop: TFresnelLength;
|
|
const aFont: IFresnelFont; const aColor: TFPColor;
|
|
const aFont: IFresnelFont; const aColor: TFPColor;
|
|
const aText: string); override;
|
|
const aText: string); override;
|
|
@@ -593,7 +597,7 @@ var
|
|
Color1, Color2: TAlphaColor;
|
|
Color1, Color2: TAlphaColor;
|
|
Shader: ISkShader;
|
|
Shader: ISkShader;
|
|
SkPaint: ISkPaint;
|
|
SkPaint: ISkPaint;
|
|
- Oval: ISkRoundRect;
|
|
|
|
|
|
+ RoundR: ISkRoundRect;
|
|
SkiaParams : TSkiaBorderAndBackground Absolute Params;
|
|
SkiaParams : TSkiaBorderAndBackground Absolute Params;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -631,9 +635,9 @@ begin
|
|
|
|
|
|
if Params.HasRadius then
|
|
if Params.HasRadius then
|
|
begin
|
|
begin
|
|
- Oval:=TSkRoundRect.Create;
|
|
|
|
- Oval.SetRect(r,SkiaParams.Radii);
|
|
|
|
- Canvas.DrawRoundRect(Oval, SkPaint);
|
|
|
|
|
|
+ RoundR:=TSkRoundRect.Create;
|
|
|
|
+ RoundR.SetRect(r,SkiaParams.Radii);
|
|
|
|
+ Canvas.DrawRoundRect(RoundR, SkPaint);
|
|
end else begin
|
|
end else begin
|
|
Canvas.DrawRect(r, SkPaint);
|
|
Canvas.DrawRect(r, SkPaint);
|
|
end;
|
|
end;
|
|
@@ -736,6 +740,30 @@ begin
|
|
Canvas.DrawLine(Origin.X+x1,Origin.Y+y1,Origin.X+x2,Origin.Y+y2, SkPaint);
|
|
Canvas.DrawLine(Origin.X+x1,Origin.Y+y1,Origin.X+x2,Origin.Y+y2, SkPaint);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TFresnelSkiaRenderer.RoundRect(const aColor: TFPColor;
|
|
|
|
+ const aRect: TFresnelRoundRect; Fill: Boolean);
|
|
|
|
+var
|
|
|
|
+ c: TFresnelCSSCorner;
|
|
|
|
+ Radii: TSkRoundRectRadii;
|
|
|
|
+ SkPaint: ISkPaint;
|
|
|
|
+ RR: TRectF;
|
|
|
|
+ RoundR: ISkRoundRect;
|
|
|
|
+begin
|
|
|
|
+ if Fill then
|
|
|
|
+ SkPaint:=TSkPaint.Create(TSkPaintStyle.Fill)
|
|
|
|
+ else
|
|
|
|
+ SkPaint:=TSkPaint.Create(TSkPaintStyle.Stroke);
|
|
|
|
+ SkPaint.setColor(FPColorToSkia(aColor));
|
|
|
|
+
|
|
|
|
+ for c in TFresnelCSSCorner do
|
|
|
|
+ Radii[CSSToSkRoundRectCorner[c]]:=aRect.Radius[c].GetPointF;
|
|
|
|
+ RR:=aRect.Box.GetRectF;
|
|
|
|
+
|
|
|
|
+ RoundR:=TSkRoundRect.Create;
|
|
|
|
+ RoundR.SetRect(RR,Radii);
|
|
|
|
+ Canvas.DrawRoundRect(RoundR, SkPaint);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TFresnelSkiaRenderer.TextOut(const aLeft, aTop: TFresnelLength;
|
|
procedure TFresnelSkiaRenderer.TextOut(const aLeft, aTop: TFresnelLength;
|
|
const aFont: IFresnelFont; const aColor: TFPColor; const aText: string);
|
|
const aFont: IFresnelFont; const aColor: TFPColor; const aText: string);
|
|
var
|
|
var
|
|
@@ -783,6 +811,18 @@ begin
|
|
Canvas.DrawTextBlob(aTextBlob, X, Y, SkPaint);
|
|
Canvas.DrawTextBlob(aTextBlob, X, Y, SkPaint);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TFresnelSkiaRenderer.Arc(const aColor: TFPColor; aCenter,
|
|
|
|
+ aRadii: TFresnelPoint; aStartAngle: Double; aStopAngle: Double);
|
|
|
|
+var
|
|
|
|
+ Oval: TRectF;
|
|
|
|
+ SkPaint: ISkPaint;
|
|
|
|
+begin
|
|
|
|
+ SkPaint:=TSkPaint.Create(TSkPaintStyle.Stroke);
|
|
|
|
+ SkPaint.setColor(FPColorToSkia(aColor));
|
|
|
|
+ Oval:=RectF(aCenter.X-aRadii.X,aCenter.Y-aRadii.Y,aCenter.X+aRadii.X,aCenter.Y+aRadii.Y);
|
|
|
|
+ Canvas.DrawArc(Oval,aStartAngle,aStopAngle-aStartAngle,false,SkPaint);
|
|
|
|
+end;
|
|
|
|
+
|
|
constructor TFresnelSkiaRenderer.Create(AOwner: TComponent);
|
|
constructor TFresnelSkiaRenderer.Create(AOwner: TComponent);
|
|
begin
|
|
begin
|
|
inherited Create(AOwner);
|
|
inherited Create(AOwner);
|