FMX TPath für SVG Patchen - Delphi-PRAXiS

General News

Summary

Wird irgendwie nur nicht verwendet. Die sieht so aus für Q: Delphi-Quellcode: TPathData.QuadCurveTo( ControlPoint, EndPoint: TPointF); OneThird = 1 / 3; TwoThirds = 2 / 3; LP, CP1, CP2: TPointF; LP := LastPoint; CP1.X := OneThird * LP.X + TwoThirds * ControlPoint.X; CP1.Y := OneThird * LP.Y + TwoThirds * ControlPoint.Y; CP2.X := TwoThirds * ControlPoint.X + OneThird * EndPoint.X; CP2.Y := TwoThirds * ControlPoint.Y + OneThird * EndPoint.Y; CurveTo(CP1, CP2, EndPoint); ; Ich habe dann mal darauf aufbauend folgende weitere methoden "abgeleitet": Für q: für T: Delphi-Quellcode: TPathData.SmoothQuadCurveTo( EndPoint: TPointF); ControlPoint1: TPointF; Count > 2 ControlPoint1 := LastPoint + (LastPoint - FPathData[FPathData.Count - 2].Point) ControlPoint1 := LastPoint; QuadCurveTo(ControlPoint1, EndPoint); ; für t: Delphi-Quellcode: TPathData.SmoothQuadCurveToRel( EndPoint: TPointF); ControlPoint1: TPointF; Count > 2 ControlPoint1 := LastPoint + (LastPoint - FPathData[FPathData.Count - 2].Point) ControlPoint1 := LastPoint; QuadCurveToRel(ControlPoint1, EndPoint); ; Und dann entsprechend TPathData.SetPathString gepatcht Delphi-Quellcode: TPathData.SetPathString( Value: ); Builder, TokenBuilder: TStringBuilder; PathString, Tokens: ; Radius, CurvePoint1, CurvePoint2, TempPoint: TPointF; Large, Sweet: Boolean; Pos, I, LastLength: Integer; Angle: Single; Token: Char; Builder := TStringBuilder.Create; TokenBuilder := TStringBuilder.Create; I := 0 Value.Length - 1 Value.Chars[I].IsInArray([#9, #10, #13]) Builder.Append( ) Builder.Append(Value.Chars[I]); ; PathString := Builder.ToString; FPathData.Clear; Pos := 0; LastLength := -1; (Builder.Length > Pos) (LastLength <> Pos) LastLength := Pos; Tokens := GetTokensFromString(PathString, Pos); TokenBuilder.Clear; TokenBuilder.Append(Tokens); TokenBuilder.Length > 0 Token := TokenBuilder.Chars[0]; TokenBuilder.Remove(0, 1); Token , : ClosePath; : MoveTo(GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) LineTo(GetPointFromString(PathString, Pos)); ; : MoveToRel(GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) LineToRel(GetPointFromString(PathString, Pos)); ; : LineTo(GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) LineTo(GetPointFromString(PathString, Pos)); ; : LineToRel(GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) LineToRel(GetPointFromString(PathString, Pos)); ; : CurvePoint1 := GetPointFromString(PathString, Pos); CurvePoint2 := GetPointFromString(PathString, Pos); CurveTo(CurvePoint1, CurvePoint2, GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) CurvePoint1 := GetPointFromString(PathString, Pos); CurvePoint2 := GetPointFromString(PathString, Pos); CurveTo(CurvePoint1, CurvePoint2, GetPointFromString(PathString, Pos)); ; ; : CurvePoint1 := GetPointFromString(PathString, Pos); CurvePoint2 := GetPointFromString(PathString, Pos); CurveToRel(CurvePoint1, CurvePoint2, GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) CurvePoint1 := GetPointFromString(PathString, Pos); CurvePoint2 := GetPointFromString(PathString, Pos); CurveToRel(CurvePoint1, CurvePoint2, GetPointFromString(PathString, Pos)); ; ; : CurvePoint2 := GetPointFromString(PathString, Pos); SmoothCurveTo(CurvePoint2, GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) CurvePoint2 := GetPointFromString(PathString, Pos); SmoothCurveTo(CurvePoint2, GetPointFromString(PathString, Pos)); ; ; : CurvePoint2 := GetPointFromString(PathString, Pos); SmoothCurveToRel(CurvePoint2, GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) CurvePoint2 := GetPointFromString(PathString, Pos); SmoothCurveToRel(CurvePoint2, GetPointFromString(PathString, Pos)); ; ; : HLineTo(StrToFloat(GetNumberFromString(PathString, Pos), USFormatSettings)); : HLineToRel(StrToFloat(GetNumberFromString(PathString, Pos), USFormatSettings)); : VLineTo(StrToFloat(GetNumberFromString(PathString, Pos), USFormatSettings)); : VLineToRel(StrToFloat(GetNumberFromString(PathString, Pos), USFormatSettings)); : CurvePoint1 := GetPointFromString(PathString, Pos); QuadCurveTo(CurvePoint1, GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) CurvePoint1 := GetPointFromString(PathString, Pos); QuadCurveTo(CurvePoint1, GetPointFromString(PathString, Pos)); ; ; : CurvePoint1 := GetPointFromString(PathString, Pos); QuadCurveToRel(CurvePoint1, GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) CurvePoint1 := GetPointFromString(PathString, Pos); QuadCurveToRel(CurvePoint1, GetPointFromString(PathString, Pos)); ; ; : SmoothQuadCurveTo(GetPointFromString(PathString, Pos)); HasRelativeOffset(PathString, Pos) SmoothQuadCurveTo(GetPointFromString(PathString, Pos)); ; : CurvePoint2 := GetPointFromString(PathString, Pos); SmoothCurveToRel(CurvePoint2, CurvePoint2); HasRelativeOffset(PathString, Pos) CurvePoint2 := GetPointFromString(PathString, Pos); SmoothCurveToRel(CurvePoint2, CurvePoint2); ; ; , : Count > 0 CurvePoint1 := FPathData[FPathData.Count - 1].Point CurvePoint1 := TPointF.Zero; Radius := GetPointFromString(PathString, Pos); Angle := StrToFloat(GetNumberFromString(PathString, Pos), USFormatSettings); TempPoint := GetPointFromString(PathString, Pos); Large := TempPoint.X = 1; Sweet := TempPoint.Y = 1; CurvePoint2 := GetPointFromString(PathString, Pos); Token = CurvePoint2 := CurvePoint1 + CurvePoint2; AddArcSvg(CurvePoint1, Radius, Angle, Large, Sweet, CurvePoint2); ; ; ; ; DoChanged; TokenBuilder.Free; Builder.Free; ; ; Dann geht das hier Delphi-Quellcode: Path2.Data.Data := + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ; Keine Ahnung wie man macht das es im Objekt Inspector oder zur designzeit schon funktioniert. Und feedback oder direkt Verbesserungen! Es gibt FMX.Graphics.TPathData.QuadCurveTo(const ControlPoint, EndPoint: TPointF);Wird irgendwie nur nicht verwendet.Die sieht so aus für Q:Ich habe dann mal darauf aufbauend folgende weitere methoden "abgeleitet":Für q:für T:für t:Und dann entsprechend TPathData.SetPathString gepatchtDann geht das hierKeine Ahnung wie man macht das es im Objekt Inspector oder zur designzeit schon funktioniert.Probiert es aus , bitte. Und feedback oder direkt Verbesserungen!

Classifications

industries
Retail
applications
No applications detected

AskAI Classifications

Labels
No AI classifications detected

Linked Companies