From 502ddd5d42de4a28d00771a3925dfd0860f8326c Mon Sep 17 00:00:00 2001 From: wp_xyz Date: Thu, 19 Jan 2023 23:49:40 +0100 Subject: [PATCH] fpvectorial: Fix rotation of shapes. Add rotation tests to visualtests. --- components/fpvectorial/fpvectorial.pas | 147 ++--- components/fpvectorial/svgvectorialreader.pas | 4 +- components/fpvectorial/svgvectorialwriter.pas | 27 +- .../fpvectorial/tests/vt_arcs_circular.inc | 266 ++++++++ .../fpvectorial/tests/vt_arcs_elliptical.inc | 266 ++++++++ .../tests/vt_arcs_elliptical_rotated.inc | 267 ++++++++ .../fpvectorial/tests/vt_complexshapes.inc | 56 ++ components/fpvectorial/tests/vt_gradients.inc | 51 ++ .../fpvectorial/tests/vt_simpleshapes.inc | 62 ++ components/fpvectorial/tests/vt_text.inc | 83 +++ components/fpvectorial/tests/vtmain.pas | 601 +++++------------- components/fpvectorial/tests/vtprimitives.pas | 517 ++++----------- 12 files changed, 1384 insertions(+), 963 deletions(-) create mode 100644 components/fpvectorial/tests/vt_arcs_circular.inc create mode 100644 components/fpvectorial/tests/vt_arcs_elliptical.inc create mode 100644 components/fpvectorial/tests/vt_arcs_elliptical_rotated.inc create mode 100644 components/fpvectorial/tests/vt_complexshapes.inc create mode 100644 components/fpvectorial/tests/vt_gradients.inc create mode 100644 components/fpvectorial/tests/vt_simpleshapes.inc create mode 100644 components/fpvectorial/tests/vt_text.inc diff --git a/components/fpvectorial/fpvectorial.pas b/components/fpvectorial/fpvectorial.pas index 53473c22c9..a740547dff 100644 --- a/components/fpvectorial/fpvectorial.pas +++ b/components/fpvectorial/fpvectorial.pas @@ -333,7 +333,7 @@ type function GetStartPoint(out APoint: T3DPoint): Boolean; // edition methods procedure Move(ADeltaX, ADeltaY: Double); virtual; - procedure Rotate(AAngle: Double; ABase: T3DPoint); virtual; // Angle in radians + procedure Rotate(AAngle: Double; ABase: T3DPoint); virtual; // Angle in radians, >0 counter-clockwise function GenerateDebugTree(ADestRoutine: TvDebugAddItemProc; APageItem: Pointer): Pointer; virtual; // rendering procedure AddToPoints(ADestX, ADestY: Integer; AMulX, AMulY: Double; var Points: TPointsArray); virtual; @@ -524,7 +524,7 @@ type function GetSubpartCount: Integer; virtual; procedure PositionSubparts(constref ARenderInfo: TvRenderInfo; ABaseX, ABaseY: Double); virtual; procedure Scale(ADeltaScaleX, ADeltaScaleY: Double); virtual; - procedure Rotate(AAngle: Double; ABase: T3DPoint); virtual; // Angle in radians + procedure Rotate(AAngle: Double; ABase: T3DPoint); virtual; // Angle in radians, >0 counter-clockwise // ADoDraw = False means that no drawing will actually be done, only the size info will be filled in ARenderInfo procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); virtual; function AdjustColorToBackground(AColor: TFPColor; ARenderInfo: TvRenderInfo): TFPColor; @@ -610,7 +610,7 @@ type procedure ApplyFontToCanvas(ARenderInfo: TvRenderInfo); overload; procedure ApplyFontToCanvas(ARenderInfo: TvRenderInfo; AFont: TvFont); overload; procedure AssignFont(AFont: TvFont); - procedure Rotate(AAngle: Double; ABase: T3DPoint); override; // Angle in radians + procedure Rotate(AAngle: Double; ABase: T3DPoint); override; // Angle in radians, >0 counter-clockwise procedure Scale(ADeltaScaleX, ADeltaScaleY: Double); override; procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); override; function GenerateDebugTree(ADestRoutine: TvDebugAddItemProc; APageItem: Pointer): Pointer; override; @@ -663,7 +663,7 @@ type procedure MoveSubpart(ADeltaX, ADeltaY: Double; ASubpart: Cardinal); override; function MoveToSubpart(ASubpart: Cardinal): TPathSegment; function GetSubpartCount: Integer; override; - procedure Rotate(AAngle: Double; ABase: T3DPoint); override; // Angle in radians + procedure Rotate(AAngle: Double; ABase: T3DPoint); override; // Angle in radians, >0 counter-clockwise procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); override; procedure RenderInternalPolygon(constref ARenderInfo: TvRenderInfo); function GenerateDebugTree(ADestRoutine: TvDebugAddItemProc; APageItem: Pointer): Pointer; override; @@ -738,7 +738,7 @@ type Radius: Double; procedure CalculateBoundingBox(constref ARenderInfo: TvRenderInfo; out ALeft, ATop, ARight, ABottom: Double); override; procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); override; - procedure Rotate(AAngle: Double; ABase: T3DPoint); override; // Angle in radians + procedure Rotate(AAngle: Double; ABase: T3DPoint); override; // Angle in radians, >0 counter-clockwise end; {@@ @@ -749,7 +749,7 @@ type TvCircularArc = class(TvEntityWithPenAndBrush) public Radius: Double; - {@@ The Angle is measured in degrees in relation to the positive X axis } + {@@ The Angle is measured in degrees in relation to the positive X axis, > 0 counter-clockwise } StartAngle, EndAngle: Double; procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); override; end; @@ -766,13 +766,14 @@ type // Mandatory fields HorzHalfAxis: Double; // This half-axis is the horizontal one when Angle=0 VertHalfAxis: Double; // This half-axis is the vertical one when Angle=0 - {@@ The Angle is measured in radians in relation to the positive X axis } + {@@ The Angle is measured in radians in relation to the positive X axis and + counter-clockwise direction. } Angle: Double; function GetLineIntersectionPoints(ACoord: Double; ACoordIsX: Boolean): TDoubleDynArray; override; function TryToSelect(APos: TPoint; var ASubpart: Cardinal; ASnapFlexibility: Integer = 5): TvFindEntityResult; override; procedure CalculateBoundingBox(constref ARenderInfo: TvRenderInfo; out ALeft, ATop, ARight, ABottom: Double); override; procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); override; - procedure Rotate(AAngle: Double; ABase: T3DPoint); override; // Angle in radians + procedure Rotate(AAngle: Double; ABase: T3DPoint); override; end; { TvRectangle } @@ -788,12 +789,12 @@ type CX, CY, CZ: Double; // CX = width, CY = height, CZ = depth // Corner rounding, zero indicates no rounding RX, RY: Double; - // The Angle is measured in radians relative to the positive X axis. + // The Angle is measured in radians relative to the positive X axis, >0 if counter-clockwise // Center of rotation is (X,Y). Angle: Double; procedure CalculateBoundingBox(constref ARenderInfo: TvRenderInfo; out ALeft, ATop, ARight, ABottom: Double); override; procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); override; - procedure Rotate(AAngle: Double; ABase: T3DPoint); override; // Angle in radians + procedure Rotate(AAngle: Double; ABase: T3DPoint); override; function GenerateDebugTree(ADestRoutine: TvDebugAddItemProc; APageItem: Pointer): Pointer; override; end; @@ -807,6 +808,7 @@ type Points: array of T3DPoint; procedure CalculateBoundingBox(constref ARenderInfo: TvRenderInfo; out ALeft, ATop, ARight, ABottom: Double); override; procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); override; + procedure Rotate(AAngle: Double; ABase: T3DPoint); override; end; {@@ @@ -2997,15 +2999,17 @@ var begin inherited Rotate(AAngle, ABase); - p := fpvutils.Rotate3DPointInXY(E1, ABase, AAngle); + XRotation := XRotation + AAngle; + + p := fpvutils.Rotate3DPointInXY(E1, ABase, -AAngle); E1.X := p.X; E1.Y := p.Y; - p := fpvutils.Rotate3DPointInXY(E2, ABase, AAngle); + p := fpvutils.Rotate3DPointInXY(E2, ABase, -AAngle); E2.X := p.X; E2.Y := p.Y; - p := fpvutils.Rotate3DPointInXY(Make2dPoint(CX, CY), ABase, AAngle); + p := fpvutils.Rotate3DPointInXY(Make2dPoint(CX, CY), ABase, -AAngle); CX := p.X; CY := p.Y; end; @@ -3390,7 +3394,7 @@ var lRes: T3DPoint; begin inherited Rotate(AAngle, ABase); - lRes := fpvutils.Rotate3DPointInXY(Make3DPoint(X, Y), ABase, AAngle); + lRes := fpvutils.Rotate3DPointInXY(Make3DPoint(X, Y), ABase, -AAngle); X := lRes.X; Y := lRes.Y; end; @@ -3455,11 +3459,11 @@ var begin inherited Rotate(AAngle, ABase); - p := fpvutils.Rotate3DPointInXY(Make3DPoint(X2, Y2), ABase, AAngle); + p := fpvutils.Rotate3DPointInXY(Make3DPoint(X2, Y2), ABase, -AAngle); X2 := p.X; Y2 := p.Y; - p := fpvutils.Rotate3DPointInXY(Make3DPoint(X3, Y3), ABase, AAngle); + p := fpvutils.Rotate3DPointInXY(Make3DPoint(X3, Y3), ABase, -AAngle); X3 := p.X; Y3 := p.Y; end; @@ -4479,7 +4483,7 @@ begin bkVerticalGradient, bkOtherLinearGradient: begin - // calculate gradient vector + // Calculate gradient vector CalcGradientVector(gv1, gv2, lRect, ADestX, ADestY, AMulX, AMulY); // Draw the gradient DrawPolygonBrushLinearGradient(ARenderInfo, polyPoints, polystarts, lRect, gv1, gv2); @@ -4500,84 +4504,6 @@ begin tmpPath.Free; end; end; -(* -{ Fills the entity's shape with a gradient. - Assumes that the boundary is in fpv units and provides parameters (ADestX, - ADestY, AMulX, AMulY) for conversion to canvas pixels. } -procedure TvEntityWithPenAndBrush.DrawBrushGradient(ADest: TFPCustomCanvas; - var ARenderInfo: TvRenderInfo; x1, y1, x2, y2: Integer; - ADestX: Integer; ADestY: Integer; AMulX: Double; AMulY: Double); - - function CoordToCanvasX(ACoord: Double): Integer; - begin - Result := Round(ADestX + AmulX * ACoord); - end; - - function CoordToCanvasY(ACoord: Double): Integer; - begin - Result := Round(ADestY + AmulY * ACoord); - end; - - function CanvasToCoordY(ACanvas: Integer): Double; - begin - Result := (ACanvas - ADestY) / AmulY; - end; - - function CanvasToCoordX(ACanvas: Integer): Double; - begin - Result := (ACanvas - ADestX) / AmulX; - end; - -var - i, j: Integer; - lPoints: TDoubleDynArray; - lCanvasPts: array[0..1] of Integer; - lColor, lColor1, lColor2: TFPColor; -begin - if not (Brush.Kind in [bkVerticalGradient, bkHorizontalGradient]) then - Exit; - - lColor1 := Brush.Gradient_colors[1].Color; - lColor2 := Brush.Gradient_colors[0].Color; - if Brush.Kind = bkVerticalGradient then - begin - for i := y1 to y2 do - begin - lPoints := GetLineIntersectionPoints(CanvasToCoordY(i), False); - if Length(lPoints) < 2 then Continue; - lColor := MixColors(lColor1, lColor2, i-y1, y2-y1); - ADest.Pen.FPColor := lColor; - ADest.Pen.Style := psSolid; - j := 0; - while j < Length(lPoints) do - begin - lCanvasPts[0] := CoordToCanvasX(lPoints[j]); - lCanvasPts[1] := CoordToCanvasX(lPoints[j+1]); - ADest.Line(lCanvasPts[0], i, lCanvasPts[1], i); - inc(j, 2); - end; - end; - end - else if Brush.Kind = bkHorizontalGradient then - begin - for i := x1 to x2 do - begin - lPoints := GetLineIntersectionPoints(CanvasToCoordX(i), True); - if Length(lPoints) < 2 then Continue; - lColor := MixColors(lColor1, lColor2, i-x1, x2-x1); - ADest.Pen.FPColor := lColor; - ADest.Pen.Style := psSolid; - j := 0; - while (j+1 < Length(lPoints)) do - begin - lCanvasPts[0] := CoordToCanvasY(lPoints[j]); - lCanvasPts[1] := CoordToCanvasY(lPoints[j+1]); - ADest.Line(i, lCanvasPts[0], i, lCanvasPts[1]); - inc(j , 2); - end; - end; - end; -end; *) procedure TvEntityWithPenAndBrush.DrawBrush(var ARenderInfo: TvRenderInfo); var @@ -4588,8 +4514,8 @@ var AMulY: Double absolute ARenderInfo.MulY; // tmpPath: TPath; - polypoints: TPointsArray; - polystarts: TIntegerDynArray; + polypoints: TPointsArray = nil; + polystarts: TIntegerDynArray = nil; begin tmpPath := CreatePath; if tmpPath = nil then @@ -4689,7 +4615,7 @@ end; procedure TvEntityWithPenBrushAndFont.Rotate(AAngle: Double; ABase: T3DPoint); begin inherited Rotate(AAngle, ABase); - Font.Orientation := RadToDeg(AAngle); + Font.Orientation := -RadToDeg(AAngle); end; procedure TvEntityWithPenBrushAndFont.Scale(ADeltaScaleX, ADeltaScaleY: Double); @@ -6421,7 +6347,7 @@ end; function TvRectangle.CreatePath: TPath; var - pts: T3dPointsArray; + pts: T3dPointsArray = nil; ctr: T3dPoint; j: Integer; phi, lYAdj: Double; @@ -6443,12 +6369,12 @@ begin end else begin - SetLength(pts, 5); - pts[0] := Make3dPoint(X, Y); - pts[1] := Make3dPoint(X+CX, Y); - pts[2] := Make3dPoint(X+CX, Y+lYAdj*CY); - pts[3] := Make3dPoint(X, Y+lYAdj*CY); - pts[4] := Make3dPoint(X, Y); + SetLength(pts, 5); { 0,4 1 } + pts[0] := Make3dPoint(X, Y); { } + pts[1] := Make3dPoint(X+CX, Y); { } + pts[2] := Make3dPoint(X+CX, Y+lYAdj*CY); { } + pts[3] := Make3dPoint(X, Y+lYAdj*CY); { } + pts[4] := Make3dPoint(X, Y); { 3 2 } end; ctr := Make3DPoint(X, Y); // Rotation center phi := -Angle; // Angle must be inverted due to sign convention in Rotate3DPointInXY @@ -6672,6 +6598,17 @@ begin end; end; +procedure TvPolygon.Rotate(AAngle: Double; ABase: T3DPoint); +var + ref: T3dPoint; + i: Integer; +begin + ref := Rotate3dPointInXY(Make3dPoint(X, Y), ABase, -AAngle); + X := ref.X; + Y := ref.Y; + for i := 0 to High(Points) do + Points[i] := Rotate3dPointInXY(Points[i], ABase, -AAngle); +end; { TvAlignedDimension } diff --git a/components/fpvectorial/svgvectorialreader.pas b/components/fpvectorial/svgvectorialreader.pas index f989aae514..028a401bec 100644 --- a/components/fpvectorial/svgvectorialreader.pas +++ b/components/fpvectorial/svgvectorialreader.pas @@ -1250,8 +1250,7 @@ begin end else if lFunctionName = 'rotate' then begin - lMRotate := -DegToRad(lMatrixElements[0]); - // "-" because of orientation of svg coordinate system + lMRotate := DegToRad(lMatrixElements[0]) * AData.GetTopLeftCoords_Adjustment; lMTranslateX := 0; lMTranslateY := 0; if Length(lMatrixElements) > 1 then @@ -2986,6 +2985,7 @@ begin for i := 0 to ANode.Attributes.Length - 1 do begin lNodeName := ANode.Attributes.Item[i].NodeName; + lNodeValue := ANode.Attributes.Item[i].NodeValue; if lNodeName = 'style' then ReadSVGStyle(AData, lNodeValue, lRect) else if IsAttributeFromStyle(lNodeName) then diff --git a/components/fpvectorial/svgvectorialwriter.pas b/components/fpvectorial/svgvectorialwriter.pas index a791204276..94fcaf9c22 100644 --- a/components/fpvectorial/svgvectorialwriter.pas +++ b/components/fpvectorial/svgvectorialwriter.pas @@ -336,14 +336,24 @@ var cy: Double = 0.0; rx: Double = 0.0; ry: double = 0.0; - ellipseStr: string; + transformStr: string = ''; + ellipseStr: String; begin ConvertFPVCoordinatesToSVGCoordinates(APage, AEllipse.X, AEllipse.Y, cx, cy); ConvertFPVSizeToSVGSize(AEllipse.HorzHalfAxis, AEllipse.VertHalfAxis, rx, ry); - ellipseStr := Format(' ', [ + if AEllipse.Angle <> 0 then + begin + transformStr := Format('transform="rotate(%.2f %g %g)"', [ + RadToDeg(AEllipse.Angle) * APage.GetTopLeftCoords_Adjustment, + cx, + cy + ], FPointSeparator); + end; + ellipseStr := Format(' ', [ cx, cy, rx, ry, GetPenAsXMLStyle(AEllipse.Pen), - GetBrushAsXMLStyle(AEllipse.Brush) + GetBrushAsXMLStyle(AEllipse.Brush), + transformStr ], FPointSeparator); AStrings.Add(ellipseStr); end; @@ -609,6 +619,7 @@ var ry: Double = 0.0; rectStr: string; styleStr: String; + transformStr: String = ''; begin ConvertFPVCoordinatesToSVGCoordinates(APage, ARectangle.X, ARectangle.Y, cx, cy); ConvertFPVSizeToSVGSize(ARectangle.CX, ARectangle.CY, w, h); @@ -619,11 +630,19 @@ begin rectStr := rectStr + Format(' rx="%g"', [rx], FPointSeparator); if ry <> 0 then rectStr := rectStr + Format(' ry="%g"', [ry], FPointSeparator); + if ARectangle.Angle <> 0 then + begin + transformStr := Format(' transform="rotate(%.2f %g %g)"', [ + RadToDeg(ARectangle.Angle) * APage.GetTopLeftCoords_Adjustment, + cx, + cy + ], FPointSeparator); + end; styleStr := Format(' style="%s %s"', [ GetPenAsXMLStyle(ARectangle.Pen), GetBrushAsXMLStyle(ARectangle.Brush) ]); - rectStr := rectStr + styleStr + '/>'; + rectStr := rectStr + styleStr + transformStr + '/>'; AStrings.Add(rectStr); end; diff --git a/components/fpvectorial/tests/vt_arcs_circular.inc b/components/fpvectorial/tests/vt_arcs_circular.inc new file mode 100644 index 0000000000..3af41339c7 --- /dev/null +++ b/components/fpvectorial/tests/vt_arcs_circular.inc @@ -0,0 +1,266 @@ +{ Include file for "Arcs" > "Circular" tests. Used by vtmain.pas. } + +node1 := Tree.Items.AddChild(mainnode, 'circular'); + +node2 := Tree.Items.AddChild(node1, 'clockwise from point 1 to point 2'); + + node := Tree.Items.AddChild(node2, 'Quadrant I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q1_rot30ccw.png', $00010200)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q1.png', $0200)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q1_rot30cw.png', $00020200)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q12_rot30ccw.png', $00010201)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q12.png', $0201)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q12_rot30cw.png', $00020201)); + + node := Tree.Items.AddChild(node2, 'Quadrant II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q2_rot30ccw.png', $00010202)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q2.png', $0202)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q2_rot30cw.png', $00020202)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q23_rot30ccw.png', $00010203)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q23.png', $0203)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q23_rot30cw.png', $00020203)); + + node := Tree.Items.AddChild(node2, 'Quadrant III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q3_rot30ccw.png', $00010204)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q3.png', $0204)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q3_rot30cw.png', $00020204)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q34_rot30ccw.png', $00010205)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q34.png', $0205)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q34_rot30cw.png', $00020205)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q4_rot30ccw.png', $00010206)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q4.png', $0206)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q4_rot30cw.png', $00020206)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q41_rot30ccw.png', $00010207)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q41.png', $0207)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q41_rot30cw.png', $00020207)); + + node := Tree.Items.AddChild(node2, 'Quadrant I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q1_rot30ccw.png', $00010300)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q1.png', $0300)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q1_rot30cw.png', $00020300)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q12_rot30ccw.png', $00010301)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q12.png', $0301)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q12_rot30cw.png', $00020301)); + + node := Tree.Items.AddChild(node2, 'Quadrant II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q2_rot30ccw.png', $00010302)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q2.png', $0302)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q2_rot30cw.png', $00020302)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q23_rot30ccw.png', $00010303)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q23.png', $0303)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q23_rot30cw.png', $00020303)); + + node := Tree.Items.AddChild(node2, 'Quadrant III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q3_rot30ccw.png', $00010304)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q3.png', $0304)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q3_rot30cw.png', $00020304)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q34_rot30ccw.png', $00010305)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q34.png', $0305)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q34_rot30cw.png', $00020305)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q4_rot30ccw.png', $00010306)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q4.png', $0306)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q4_rot30cw.png', $00020306)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q41_rot30ccw.png', $00010307)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_cw_q41.png', $0307)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_cw_q41_rot30cw.png', $00020307)); + +// ----------------------------------------------------------------------------- + +node2 := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2'); + + node := Tree.Items.AddChild(node2, 'Quadrant I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q1_rot30ccw.png', $00010000)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q1.png', $0000)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q1_rot30cw.png', $00020000)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q12_rot30ccw.png', $00010001)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q12.png', $0001)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q12_rot30cw.png', $00020001)); + + node := Tree.Items.AddChild(node2, 'Quadrant II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q2_rot30ccw.png', $00010002)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q2.png', $0002)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q2_rot30cw.png', $00020002)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q23_rot30ccw.png', $00010003)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q23.png', $0003)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q23_rot30cw.png', $00020003)); + + node := Tree.Items.AddChild(node2, 'Quadrant III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q3_rot30ccw.png', $00010004)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q3.png', $0004)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q3_rot30cw.png', $00020004)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q34_rot30ccw.png', $00010005)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q34.png', $0005)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q34_rot30cw.png', $00020005)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q4_rot30ccw.png', $00010006)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q4.png', $0006)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q4_rot30cw.png', $0002006)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q41_rot30ccw.png', $0001007)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q41.png', $0007)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q41_rot30cw.png', $00020007)); + + node := Tree.Items.AddChild(node2, 'Quadrant I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q1_rot30ccw.png', $00010100)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q1.png', $0100)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q1_rot30cw.png', $00020100)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q12_rot30ccw.png', $00010101)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q12.png', $0101)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q12_rot30cw.png', $00020101)); + + node := Tree.Items.AddChild(node2, 'Quadrant II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q2_rot30ccw.png', $00010102)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q2.png', $0102)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q2_rot30cw.png', $00020102)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q23_rot30ccw.png', $00010103)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q23.png', $0103)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q23_rot30cw.png', $00020103)); + + node := Tree.Items.AddChild(node2, 'Quadrant III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q3_rot30ccw.png', $00010304)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q3.png', $0104)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q3_rot30cw.png', $00020104)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q34_rot30ccw.png', $00010105)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q34.png', $0105)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q34_rot30cw.png', $00020105)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q4_rot30ccw.png', $00010106)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q4.png', $0106)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q4_rot30cw.png', $00020106)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q41_rot30ccw.png', $00010107)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q41.png', $0107)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ccw_q41_rot30cw.png', $00020107)); + diff --git a/components/fpvectorial/tests/vt_arcs_elliptical.inc b/components/fpvectorial/tests/vt_arcs_elliptical.inc new file mode 100644 index 0000000000..2fe9ebc422 --- /dev/null +++ b/components/fpvectorial/tests/vt_arcs_elliptical.inc @@ -0,0 +1,266 @@ +{ Include file for "Arcs" > "Elliptical" tests. Used by vtmain.pas. } + +node1 := Tree.Items.AddChild(mainnode, 'elliptical'); + +node2 := Tree.Items.AddChild(node1, 'clockwise from point 1 to point 2'); + + node := Tree.Items.AddChild(node2, 'Quadrant I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1_rot30ccw.png', $00011200)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1.png', $1200)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1_rot30cw.png', $00021200)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12_rot30ccw.png', $00011201)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12.png', $1201)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12_rot30cw.png', $00021201)); + + node := Tree.Items.AddChild(node2, 'Quadrant II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2_rot30ccw.png', $00011202)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2.png', $1202)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2_rot30cw.png', $00021202)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23_rot30ccw.png', $00011203)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23.png', $1203)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23_rot30cw.png', $00021203)); + + node := Tree.Items.AddChild(node2, 'Quadrant III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3_rot30ccw.png', $00011204)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3.png', $1204)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3_rot30cw.png', $00021204)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34_rot30ccw.png', $00011205)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34.png', $1205)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34_rot30cw.png', $00021205)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4_rot30ccw.png', $00011206)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4.png', $1206)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4_rot30cw.png', $00021206)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41_rot30ccw.png', $00011207)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41.png', $1207)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41_rot30cw.png', $00021207)); + + node := Tree.Items.AddChild(node2, 'Quadrant I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1_rot30ccw.png', $00011300)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1.png', $1300)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1_rot30cw.png', $00021300)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12_rot30ccw.png', $00011301)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12.png', $1301)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12_rot30cw.png', $00021301)); + + node := Tree.Items.AddChild(node2, 'Quadrant II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2_rot30ccw.png', $00011302)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2.png', $1302)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2_rot30cw.png', $00021302)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23_rot30ccw.png', $00011303)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23.png', $1303)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23_rot30cw.png', $00021303)); + + node := Tree.Items.AddChild(node2, 'Quadrant III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3_rot30ccw.png', $00011304)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3.png', $1304)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3_rot30cw.png', $00021304)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34_rot30ccw.png', $00011305)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34.png', $1305)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34_rot30cw.png', $00021305)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4_rot30ccw.png', $00011306)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4.png', $1306)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4_rot30cw.png', $00021306)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41_rot30ccw.png', $00011307)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41.png', $1307)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41_rot30cw.png', $00021307)); + +// ----------------------------------------------------------------------------- + +node2 := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2'); + + node := Tree.Items.AddChild(node2, 'Quadrant I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1_rot30ccw.png', $00011000)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1.png', $1000)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1_rot30cw.png', $00021000)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12_rot30ccw.png', $00011001)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12.png', $1001)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12_rot30cw.png', $00021001)); + + node := Tree.Items.AddChild(node2, 'Quadrant II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2_rot30ccw.png', $00011002)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2.png', $1002)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2_rot30cw.png', $00021002)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23_rot30ccw.png', $00011003)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23.png', $1003)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23_rot30cw.png', $00021003)); + + node := Tree.Items.AddChild(node2, 'Quadrant III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3_rot30ccw.png', $00011004)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3.png', $1004)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3_rot30cw.png', $00021004)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34_rot30ccw.png', $00011005)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34.png', $1005)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34_rot30cw.png', $00021005)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4_rot30ccw.png', $00011006)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4.png', $1006)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4_rot30cw.png', $00021006)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41_rot30ccw.png', $00011007)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41.png', $1007)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41_rot30cw.png', $00021007)); + + node := Tree.Items.AddChild(node2, 'Quadrant I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1_rot30ccw.png', $00011100)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1.png', $1100)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1_rot30cw.png', $00021100)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12_rot30ccw.png', $00011101)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12.png', $1101)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12_rot30cw.png', $00021101)); + + node := Tree.Items.AddChild(node2, 'Quadrant II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2_rot30ccw.png', $00011102)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2.png', $1102)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2_rot30cw.png', $00021102)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23_rot30ccw.png', $00011103)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23.png', $1103)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23_rot30cw.png', $00021103)); + + node := Tree.Items.AddChild(node2, 'Quadrant III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3_rot30ccw.png', $00011104)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3.png', $1104)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3_rot30cw.png', $00021104)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34_rot30ccw.png', $00011105)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34.png', $1105)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34_rot30cw.png', $00021105)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4_rot30ccw.png', $00011106)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4.png', $1106)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4_rot30cw.png', $00021106)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CCW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41_rot30ccw.png', $00011107)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41.png', $1107)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30° CW', + TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41_rot30cw.png', $00021107)); + diff --git a/components/fpvectorial/tests/vt_arcs_elliptical_rotated.inc b/components/fpvectorial/tests/vt_arcs_elliptical_rotated.inc new file mode 100644 index 0000000000..e4b3915935 --- /dev/null +++ b/components/fpvectorial/tests/vt_arcs_elliptical_rotated.inc @@ -0,0 +1,267 @@ +{ Include file for "Arcs" > "Elliptical rotated" tests. Used by vtmain.pas. } + +node1 := Tree.Items.AddChild(mainnode, 'elliptical, rotated by 30deg around center'); + +node2 := Tree.Items.AddChild(node1, 'clockwise from point 1 to point 2'); + + node := Tree.Items.AddChild(node2, 'Quadrant I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1_rot30ccw.png', $00012200)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1.png', $2200)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1_rot30cw.png', $00022200)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12_rot30ccw.png', $00012201)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12.png', $2201)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12_rot30cw.png', $00022201)); + + node := Tree.Items.AddChild(node2, 'Quadrant II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2_rot30ccw.png', $00012202)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2.png', $2202)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2_rot30cw.png', $00022202)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23_rot30ccw.png', $00012203)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23.png', $2203)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23_rot30cw.png', $00022203)); + + node := Tree.Items.AddChild(node2, 'Quadrant III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3_rot30ccw.png', $00012204)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3.png', $2204)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3_rot30cw.png', $00022204)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34_rot30ccw.png', $00012205)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34.png', $2205)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34_rot30cw.png', $00022205)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4_rot30ccw.png', $00012206)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4.png', $2206)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4_rot30cw.png', $00022206)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41_rot30ccw.png', $00012207)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41.png', $2207)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41_rot30cw.png', $00022207)); + + node := Tree.Items.AddChild(node2, 'Quadrant I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1_rot30ccw.png', $00012300)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1.png', $2300)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1_rot30cw.png', $00022300)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12_rot30ccw.png', $00012301)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12.png', $2301)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12_rot30cw.png', $00022301)); + + node := Tree.Items.AddChild(node2, 'Quadrant II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2_rot30ccw.png', $00012302)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2.png', $2302)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2_rot30cw.png', $00022302)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23_rot30ccw.png', $00012303)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23.png', $2303)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23_rot30cw.png', $00022303)); + + node := Tree.Items.AddChild(node2, 'Quadrant III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3_rot30ccw.png', $00012304)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3.png', $2304)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3_rot30cw.png', $00022304)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34_rot30ccw.png', $00012305)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34.png', $2305)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34_rot30cw.png', $00022305)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4_rot30ccw.png', $00012306)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4.png', $2306)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4_rot30cw.png', $00022306)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41_rot30ccw.png', $00021307)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41.png', $2307)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41_rot30cw.png', $00022307)); + +// ----------------------------------------------------------------------------- + +node2 := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2'); + + node := Tree.Items.AddChild(node2, 'Quadrant I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1_rot30ccw.png', $00012000)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1.png', $2000)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1_rot30cw.png', $00022000)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12_rot30ccw.png', $00012001)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12.png', $2001)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12_rot30cw.png', $00022001)); + + node := Tree.Items.AddChild(node2, 'Quadrant II'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2_rot30ccw.png', $00012002)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2.png', $2002)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2_rot30cw.png', $00022002)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23_rot30ccw.png', $00012003)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23.png', $2003)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23_rot30cw.png', $00022003)); + + node := Tree.Items.AddChild(node2, 'Quadrant III'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3_rot30ccw.png', $00012004)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3.png', $2004)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3_rot30cw.png', $00022004)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34_rot30ccw.png', $00012005)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34.png', $2005)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34_rot30cw.png', $00022005)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4_rot30ccw.png', $00012006)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4.png', $2006)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4_rot30cw.png', $00022006)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41_rot30ccw.png', $00012007)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41.png', $2007)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41_rot30cw.png', $00022007)); + + node := Tree.Items.AddChild(node2, 'Quadrant I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1_rot30ccw.png', $00012100)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1.png', $2100)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1_rot30cw.png', $00022100)); + + node := Tree.Items.AddChild(node2, 'Quadrant I+II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12_rot30ccw.png', $00012101)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12.png', $2101)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12_rot30cw.png', $00022101)); + + node := Tree.Items.AddChild(node2, 'Quadrant II, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2_rot30ccw.png', $00012102)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2.png', $2102)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2_rot30cw.png', $00022102)); + + node := Tree.Items.AddChild(node2, 'Quadrant II+III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23_rot30ccw.png', $00012103)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23.png', $2103)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23_rot30cw.png', $00022103)); + + node := Tree.Items.AddChild(node2, 'Quadrant III, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3_rot30ccw.png', $00012104)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3.png', $2104)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3_rot30cw.png', $00022104)); + + node := Tree.Items.AddChild(node2, 'Quadrant III+IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34_rot30ccw.png', $00012105)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34.png', $2105)); + Tree.Items.AddChildObject(node, 'rotated around(10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34_rot30cw.png', $00022105)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4_rot30ccw.png', $00012106)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4.png', $2106)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4_rot30cw.png', $000212106)); + + node := Tree.Items.AddChild(node2, 'Quadrant IV+I, reverse'); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41_rot30ccw.png', $00012107)); + Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41.png', $2107)); + Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41_rot30cw.png', $00022107)); + + diff --git a/components/fpvectorial/tests/vt_complexshapes.inc b/components/fpvectorial/tests/vt_complexshapes.inc new file mode 100644 index 0000000000..f03e5c6cfa --- /dev/null +++ b/components/fpvectorial/tests/vt_complexshapes.inc @@ -0,0 +1,56 @@ +{ Include file for "Complex shapes" tests. Used by vtmain.pas. } + +// Path with hole (solid fill) +node := Tree.Items.AddChild(mainnode, 'Path with hole (solid fill)'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Path_Hole, 'path_hole_solid.png_rot30ccw.png', $00010000)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Path_Hole, 'path_hole_solid.png', $00000000)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Path_Hole, 'path_hole_solid.png_rot30cw.png', $00020000)); + +// Path with hole (gradient fill) +node := Tree.Items.AddChild(mainnode, 'Path with hole (gradient fill)'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Path_Hole, 'path_hole_gradient_rot30ccw.png', $00010003)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Path_Hole, 'path_hole_gradient.png', $00000003)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Path_Hole, 'path_hole_gradient_rot30cw.png', $00020003)); + +// Self-intersecting polygon (solid fill, even-odd rule) - tip at bottom +node := Tree.Items.AddChild(mainnode, 'Self-intersecting polygon (solid fill, even-odd rule) - tip at bottom'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_solid_eo_rot30ccw.png', $00010000)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_solid_eo.png', $00000000)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_solid_eo_rot30cw.png', $00020000)); + +// Self-intersecting polygon (gradient fill, even-odd rule) - tip at bottom +node := Tree.Items.AddChild(mainnode, 'Self-intersecting polygon (gradient fill, even-odd rule) - tip at bottom'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_gradient_eo_rot30ccw.png', $00010003)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_gradient_eo.png', $00000003)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_gradient_eo_rot30cw.png', $00020003)); + +// Self-intersecting polygon (solid fill, nonzero winding rule) - tip at bottom +node := Tree.Items.AddChild(mainnode, 'Self-intersecting polygon (solid fill, nonzero winding rule) - tip at bottom'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_solid_nzw_rot30ccw.png', $00010100)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_solid_nzw.png', $00000100)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_solid_nzw_rot30cw.png', $00020100)); + +// Self-intersecting polygon (gradient fill, nonzero winding rule) - tip at bottom +node := Tree.Items.AddChild(mainnode, 'Self-intersecting polygon (gradient fill, nonzero winding rule) - tip at bottom'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_gradient_nzw_rot30ccw.png', $00010103)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_gradient_nzw.png', $00000103)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_SelfIntersectingPoly, 'selfintersecting_poly_gradient_nzw_rot30cw.png', $00020103)); + diff --git a/components/fpvectorial/tests/vt_gradients.inc b/components/fpvectorial/tests/vt_gradients.inc new file mode 100644 index 0000000000..1f01db324a --- /dev/null +++ b/components/fpvectorial/tests/vt_gradients.inc @@ -0,0 +1,51 @@ +{ Include file for "Gradients" tests. Used by vtmain.pas. } + +node := Tree.Items.AddChild(mainnode, 'horizontal'); +Tree.Items.AddChildObject(node, 'Circle', + TRenderParams.Create(@Render_Shape, 'circle_gradienthor.png', $0101)); +Tree.Items.AddChildObject(node, 'Ellipse', + TRenderParams.Create(@Render_Shape, 'ellipse_gradienthor.png', $0201)); +Tree.Items.AddChildObject(node, 'Rectangle', + TRenderParams.Create(@Render_Shape, 'rect_gradienthor.png', $0301)); +Tree.Items.AddChildObject(node, 'Rounded rectangle', + TRenderParams.Create(@Render_Shape, 'rounded_rect_gradienthor.png', $0401)); +Tree.Items.AddChildObject(node, 'Polygon', + TRenderParams.Create(@Render_Shape, 'polygon_gradienthor.png', $0501)); + +node := Tree.Items.AddChild(mainnode, 'vertical'); +Tree.Items.AddChildObject(node, 'Circle', + TRenderParams.Create(@Render_Shape, 'circle_gradientvert.png', $0102)); +Tree.Items.AddChildObject(node, 'Ellipse', + TRenderParams.Create(@Render_Shape, 'ellipse_gradientvert.png', $0202)); +Tree.Items.AddChildObject(node, 'Rectangle', + TRenderParams.Create(@Render_Shape, 'rect_gradientvert.png', $0302)); +Tree.Items.AddChildObject(node, 'Rounded rectangle', + TRenderParams.Create(@Render_Shape, 'rounded_rect_gradientvert.png', $0402)); +Tree.Items.AddChildObject(node, 'Polygon', + TRenderParams.Create(@Render_Shape, 'polygon_gradientvert.png', $0502)); + +node := Tree.Items.AddChild(mainnode, 'linear'); +Tree.Items.AddChildObject(node, 'Circle', + TRenderParams.Create(@Render_Shape, 'circle_gradientlinear.png', $0103)); +Tree.Items.AddChildObject(node, 'Ellipse', + TRenderParams.Create(@Render_Shape, 'ellipse_gradientlinear.png', $0203)); +Tree.Items.AddChildObject(node, 'Rectangle', + TRenderParams.Create(@Render_Shape, 'rect_gradientlinear.png', $0303)); +Tree.Items.AddChildObject(node, 'Rounded rectangle', + TRenderParams.Create(@Render_Shape, 'rounded_rect_gradientlinear.png', $0403)); +Tree.Items.AddChildObject(node, 'Polygon', + TRenderParams.Create(@Render_Shape, 'polygon_gradientlinear.png', $0503)); + +node := Tree.Items.AddChild(mainnode, 'radial'); +Tree.Items.AddChildObject(node, 'Circle', + TRenderParams.Create(@Render_Shape, 'circle_gradientradial.png', $0104)); +Tree.Items.AddChildObject(node, 'Ellipse', + TRenderParams.Create(@Render_Shape, 'ellipse_gradientradial.png', $0204)); +Tree.Items.AddChildObject(node, 'Rectangle', + TRenderParams.Create(@Render_Shape, 'rect_gradientradial.png', $0304)); +Tree.Items.AddChildObject(node, 'Rounded rectangle', + TRenderParams.Create(@Render_Shape, 'rounded_rect_gradientradial.png', $0404)); +Tree.Items.AddChildObject(node, 'Polygon', + TRenderParams.Create(@Render_Shape, 'polygon_gradientradial.png', $0504)); + + diff --git a/components/fpvectorial/tests/vt_simpleshapes.inc b/components/fpvectorial/tests/vt_simpleshapes.inc new file mode 100644 index 0000000000..857f66bd8f --- /dev/null +++ b/components/fpvectorial/tests/vt_simpleshapes.inc @@ -0,0 +1,62 @@ +{ Include file for "Simple shapes" tests. Used by vtmain.pas. } + +// Circle +node := Tree.Items.AddChild(mainnode, 'Circle (solid) - moved up'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Shape, 'circle_solid_rot30ccw.png', $00010100)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Shape, 'circle_solid.png', $0100)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Shape, 'circle_solid_rot30cw.png', $00020100)); + +// Ellipse +node := Tree.Items.AddChild(mainnode, 'Ellipse (solid) - moved up'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Shape, 'ellipse_solid_rot30ccw.png', $00010200)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Shape, 'ellipse_solid.png', $0200)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Shape, 'ellipse_solid_rot30cw.png', $00020200)); + +// Rectangle +node := Tree.Items.AddChild(mainnode, 'Rectangle (solid) - moved up'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Shape, 'rect_solid_rot30ccw.png', $00010300)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Shape, 'rect_solid.png', $0300)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Shape, 'rect_solid_rot30cw.png', $00020300)); + +// Rounded rectangle +node := Tree.Items.AddChild(mainnode, 'Rounded rectangle (solid) - moved up'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Shape, 'rounded_rect_solid_rot30ccw.png', $00010400)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Shape, 'rounded_rect_solid.png', $0400)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Shape, 'rounded_rect_solid_rot30cw.png', $00020400)); + +// Polygon +node := Tree.Items.AddChild(mainnode, 'Polygon (solid) - moved up'); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CCW', + TRenderParams.Create(@Render_Shape, 'polygon_solid_rot30ccw.png', $000100500)); +Tree.Items.AddChildObject(node, 'normal', + TRenderParams.Create(@Render_Shape, 'polygon_solid.png', $0500)); +Tree.Items.AddChildObject(node, 'rotated around (10,10) by 30deg CW', + TRenderParams.Create(@Render_Shape, 'polygon_solid_rot30cw.png', $000200500)); +(* + +node := Tree.Items.AddChild(node0, 'normal'); +Tree.Items.AddChildObject(node, 'Circle (solid) - moved up', + TRenderParams.Create(@Render_Shape, 'circle_solid.png', $0100)); +Tree.Items.AddChildObject(node, 'Ellipse (solid) - moved up', + TRenderParams.Create(@Render_Shape, 'ellipse_solid.png', $0200)); +Tree.Items.AddChildObject(node, 'Rectangle(solid) - moved up', + TRenderParams.Create(@Render_Shape, 'rect_solid.png', $0300)); +Tree.Items.AddChildObject(node, 'Rounded rectangle (solid) - moved up', + TRenderParams.Create(@Render_Shape, 'rounded_rect_solid.png', $0400)); +Tree.Items.AddChildObject(node, 'Polygon (solid) - moved up', + TRenderParams.Create(@Render_Shape, 'polygon_solid.png', $0500)); + + *) + diff --git a/components/fpvectorial/tests/vt_text.inc b/components/fpvectorial/tests/vt_text.inc new file mode 100644 index 0000000000..d077b9af62 --- /dev/null +++ b/components/fpvectorial/tests/vt_text.inc @@ -0,0 +1,83 @@ +{ Include file for "Text" tests. Used by vtmain.pas. } + +// single line +node1 := Tree.Items.AddChild(mainnode, 'single line'); + +node := Tree.Items.AddChild(node1, 'horizontal'); +Tree.Items.AddChildObject(node, 'left aligned', + TRenderParams.Create(@Render_Text, 'text_left.png', $0000)); +Tree.Items.AddChildObject(node, 'centered', + TRenderParams.Create(@Render_Text, 'text_center.png', $0001)); +Tree.Items.AddChildObject(node, 'right aligned', + TRenderParams.Create(@Render_Text, 'text_right.png', $0002)); + +node := Tree.Items.AddChild(node1, 'rotated by 30 deg'); +Tree.Items.AddChildObject(node, 'left aligned', + TRenderParams.Create(@Render_Text, 'text_left_30.png', $1000)); +Tree.Items.AddChildObject(node, 'centered', + TRenderParams.Create(@Render_Text, 'text_center_30.png', $1001)); +Tree.Items.AddChildObject(node, 'right aligned', + TRenderParams.Create(@Render_Text, 'text_right_30.png', $1002)); + +node := Tree.Items.AddChild(node1, 'vertical (90 deg, upward)'); +Tree.Items.AddChildObject(node, 'left aligned', + TRenderParams.Create(@Render_Text, 'text_left_90.png', $2000)); +Tree.Items.AddChildObject(node, 'centered', + TRenderParams.Create(@Render_Text, 'text_center_90.png', $2001)); +Tree.Items.AddChildObject(node, 'right aligned', + TRenderParams.Create(@Render_Text, 'text_right_90.png', $2002)); + +node := Tree.Items.AddChild(node1, 'vertical (-90 deg, downward)'); +Tree.Items.AddChildObject(node, 'left aligned', + TRenderParams.Create(@Render_Text, 'text_left_m90.png', $3000)); +Tree.Items.AddChildObject(node, 'centered', + TRenderParams.Create(@Render_Text, 'text_center_m90.png', $3001)); +Tree.Items.AddChildObject(node, 'right aligned', + TRenderParams.Create(@Render_Text, 'text_right_m90.png', $3002)); + +// two lines +node1 := Tree.Items.AddChild(mainnode, 'two lines'); + +node := Tree.Items.AddChild(node1, 'horizontal'); +Tree.Items.AddChildObject(node, 'left aligned', + TRenderParams.Create(@Render_2Lines, 'text2_left.png', $0000)); +Tree.Items.AddChildObject(node, 'centered', + TRenderParams.Create(@Render_2Lines, 'text2_center.png', $0001)); +Tree.Items.AddChildObject(node, 'right aligned', + TRenderParams.Create(@Render_2Lines, 'text2_right.png', $0002)); + +node := Tree.Items.AddChild(node1, 'rotated by 30 deg'); +Tree.Items.AddChildObject(node, 'left aligned', + TRenderParams.Create(@Render_2Lines, 'text2_left_30.png', $1000)); +Tree.Items.AddChildObject(node, 'centered', + TRenderParams.Create(@Render_2Lines, 'text2_center_30.png', $1001)); +Tree.Items.AddChildObject(node, 'right aligned', + TRenderParams.Create(@Render_2Lines, 'text2_right_30.png', $1002)); + +node := Tree.Items.AddChild(node1, 'vertical (90 deg, upward)'); +Tree.Items.AddChildObject(node, 'left aligned', + TRenderParams.Create(@Render_2Lines, 'text2_left_90.png', $2000)); +Tree.Items.AddChildObject(node, 'centered', + TRenderParams.Create(@Render_2Lines, 'text2_center_90.png', $2001)); +Tree.Items.AddChildObject(node, 'right aligned', + TRenderParams.Create(@Render_2Lines, 'text2_right_90.png', $2002)); + +node := Tree.Items.AddChild(node1, 'vertical (-90 deg, downward)'); +Tree.Items.AddChildObject(node, 'left aligned', + TRenderParams.Create(@Render_2Lines, 'text2_left_m90.png', $3000)); +Tree.Items.AddChildObject(node, 'centered', + TRenderParams.Create(@Render_2Lines, 'text2_center_m90.png', $3001)); +Tree.Items.AddChildObject(node, 'right aligned', + TRenderParams.Create(@Render_2Lines, 'text2_right_m90.png', $3002)); + +// Fonts +node := Tree.Items.AddChild(mainnode, 'Fonts'); + +Tree.Items.AddChildObject(node, 'Times New Roman + Courier New', + TRenderParams.Create(@Render_Text_Fonts, 'text_fonts.png')); + +// Text colors +Tree.Items.AddChildObject(mainnode, 'Text colors', + TRenderParams.Create(@Render_Text_Colors, 'text_colors.png')); + + diff --git a/components/fpvectorial/tests/vtmain.pas b/components/fpvectorial/tests/vtmain.pas index 8fcef1e864..1e9f399794 100644 --- a/components/fpvectorial/tests/vtmain.pas +++ b/components/fpvectorial/tests/vtmain.pas @@ -100,18 +100,8 @@ type procedure Render_Shape(APage: TvVectorialPage; AIntParam: Integer); // Complex shapes - procedure Render_Path_Hole_SolidFill(APage: TvVectorialPage; - AIntParam: Integer); - procedure Render_Path_Hole_GradientFill(APage: TvVectorialPage; - AIntParam: Integer); - procedure Render_SelfIntersectingPoly_SolidFill_EvenOdd(APage: TvVectorialPage; - AIntParam: Integer); - procedure Render_SelfIntersectingPoly_GradientFill_EvenOdd(APage: TvVectorialPage; - AIntParam: Integer); - procedure Render_SelfIntersectingPoly_SolidFill_NonZeroWinding(APage: TvVectorialPage; - AIntParam: Integer); - procedure Render_SelfIntersectingPoly_GradientFill_NonZeroWinding(APage: TvVectorialPage; - AIntParam: Integer); + procedure Render_Path_Hole(APage: TvVectorialPage; AIntParam: Integer); + procedure Render_SelfIntersectingPoly(APage: TvVectorialPage; AIntParam: Integer); // Arcs procedure Render_Arc(APage: TvVectorialPage; AIntParam: Integer); @@ -401,424 +391,87 @@ end; procedure TMainForm.Populate; var - node, node0, node1: TTreeNode; + mainNode: TTreeNode; + node, node0, node1, node2: TTreeNode; // needed by include files begin Tree.Items.Clear; { --------------------------------------------------} - node := Tree.Items.AddChild(nil, 'Simple shapes'); + mainnode := Tree.Items.AddChild(nil, 'Simple shapes'); { --------------------------------------------------} - Tree.Items.AddChildObject(node, 'Circle (solid) - move up', - TRenderParams.Create(@Render_Shape, 'circle_solid.png', $0100)); - Tree.Items.AddChildObject(node, 'Ellipse (solid) - moved up', - TRenderParams.Create(@Render_Shape, 'ellipse_solid.png', $0200)); - Tree.Items.AddChildObject(node, 'Rectangle(solid) - moved up', - TRenderParams.Create(@Render_Shape, 'rect_solid.png', $0300)); - Tree.Items.AddChildObject(node, 'Rounded rectangle (solid) - moved up', - TRenderParams.Create(@Render_Shape, 'rounded_rect_solid.png', $0400)); - Tree.Items.AddChildObject(node, 'Polygon (solid) - moved up', - TRenderParams.Create(@Render_Shape, 'polygon_solid.png', $0500)); + {$I vt_simpleshapes.inc} { --------------------------------------------------} - node := Tree.Items.AddChild(nil, 'Complex shapes'); + mainnode := Tree.Items.AddChild(nil, 'Complex shapes'); { --------------------------------------------------} - Tree.Items.AddChildObject(node, 'Path with hole (solid fill)', - TRenderParams.Create(@Render_Path_Hole_SolidFill, 'path_hole_solid.png')); - Tree.Items.AddChildObject(node, 'Path with hole (gradient fill)', - TRenderParams.Create(@Render_Path_Hole_GradientFill, 'path_hole_gradient.png')); - Tree.Items.AddChildObject(node, 'Self-intersecting polygon (solid fill, even-odd rule) - tip at bottom', - TRenderParams.Create(@Render_SelfIntersectingPoly_SolidFill_EvenOdd, 'selfintersecting_poly_solid_eo.png')); - Tree.Items.AddChildObject(node, 'Self-intersecting polygon (gradient fill, even-odd rule) - tip at bottom', - TRenderParams.Create(@Render_SelfIntersectingPoly_GradientFill_EvenOdd, 'selfintersecting_poly_gradient_eo.png')); - Tree.Items.AddChildObject(node, 'Self-intersecting polygon (solid fill, nonzero winding rule) - tip at bottom', - TRenderParams.Create(@Render_SelfIntersectingPoly_SolidFill_NonZeroWinding, 'selfintersecting_poly_solid_nzw.png')); - Tree.Items.AddChildObject(node, 'Self-intersecting polygon (gradient fill, nonzero winding rule) - tip at bottom', - TRenderParams.Create(@Render_SelfIntersectingPoly_GradientFill_NonZeroWinding, 'selfintersecting_poly_gradient_nzw.png')); + {$I vt_complexshapes.inc} { -----------------------------------------} - node0 := Tree.Items.AddChild(nil, 'Arcs'); + mainnode := Tree.Items.AddChild(nil, 'Arcs'); { -----------------------------------------} - node1 := Tree.Items.AddChild(node0, 'circular'); - node := Tree.Items.AddChild(node1, 'clockwise from point 1 to point 2'); - Tree.Items.AddChildObject(node, 'Quadrant I', - TRenderParams.Create(@Render_Arc, 'arc_cw_q1.png', $0200)); - Tree.Items.AddChildObject(node, 'Quadrant I+II', - TRenderParams.Create(@Render_Arc, 'arc_cw_q12.png', $0201)); - Tree.Items.AddChildObject(node, 'Quadrant II', - TRenderParams.Create(@Render_Arc, 'arc_cw_q2.png', $0202)); - Tree.Items.AddChildObject(node, 'Quadrant II+III', - TRenderParams.Create(@Render_Arc, 'arc_cw_q23.png', $0203)); - Tree.Items.AddChildObject(node, 'Quadrant III', - TRenderParams.Create(@Render_Arc, 'arc_cw_q3.png', $0204)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV', - TRenderParams.Create(@Render_Arc, 'arc_cw_q34.png', $0205)); - Tree.Items.AddChildObject(node, 'Quadrant IV', - TRenderParams.Create(@Render_Arc, 'arc_cw_q4.png', $0206)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I', - TRenderParams.Create(@Render_Arc, 'arc_cw_q41.png', $0207)); - - Tree.Items.AddChildObject(node, 'Quadrant I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_cw_q1r.png', $0300)); - Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_cw_q12r.png', $0301)); - Tree.Items.AddChildObject(node, 'Quadrant II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_cw_q2r.png', $0302)); - Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_cw_q23r.png', $0303)); - Tree.Items.AddChildObject(node, 'Quadrant III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_cw_q3r.png', $0304)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_cw_q34r.png', $0305)); - Tree.Items.AddChildObject(node, 'Quadrant IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_cw_q4r.png', $0306)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_cw_q41r.png', $0307)); - - node := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2'); - Tree.Items.AddChildObject(node, 'Quadrant I', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q1.png', $0000)); - Tree.Items.AddChildObject(node, 'Quadrant I+II', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q12.png', $0001)); - Tree.Items.AddChildObject(node, 'Quadrant II', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q2.png', $0002)); - Tree.Items.AddChildObject(node, 'Quadrant II+III', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q23.png', $0003)); - Tree.Items.AddChildObject(node, 'Quadrant III', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q3.png', $0004)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q34.png', $0005)); - Tree.Items.AddChildObject(node, 'Quadrant IV', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q4.png', $0006)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q41.png', $0007)); - - Tree.Items.AddChildObject(node, 'Quadrant I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q1r.png', $0100)); - Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q12r.png', $0101)); - Tree.Items.AddChildObject(node, 'Quadrant II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q2r.png', $0102)); - Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q23r.png', $0103)); - Tree.Items.AddChildObject(node, 'Quadrant III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q3r.png', $0104)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q34r.png', $0105)); - Tree.Items.AddChildObject(node, 'Quadrant IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q4r.png', $0106)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ccw_q41r.png', $0107)); - - node1 := Tree.Items.AddChild(node0, 'elliptical'); - node := Tree.Items.AddChild(node1, 'clockwise from point 1 to point 2'); - Tree.Items.AddChildObject(node, 'Quadrant I', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1.png', $1200)); - Tree.Items.AddChildObject(node, 'Quadrant I+II', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12.png', $1201)); - Tree.Items.AddChildObject(node, 'Quadrant II', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2.png', $1202)); - Tree.Items.AddChildObject(node, 'Quadrant II+III', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23.png', $1203)); - Tree.Items.AddChildObject(node, 'Quadrant III', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3.png', $1204)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34.png', $1205)); - Tree.Items.AddChildObject(node, 'Quadrant IV', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4.png', $1206)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41.png', $1207)); - - Tree.Items.AddChildObject(node, 'Quadrant I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1r.png', $1300)); - Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12r.png', $1301)); - Tree.Items.AddChildObject(node, 'Quadrant II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2r.png', $1302)); - Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23r.png', $1303)); - Tree.Items.AddChildObject(node, 'Quadrant III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3r.png', $1304)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34r.png', $1305)); - Tree.Items.AddChildObject(node, 'Quadrant IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4r.png', $1306)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41r.png', $1307)); - - node := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2'); - Tree.Items.AddChildObject(node, 'Quadrant I', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1.png', $1000)); - Tree.Items.AddChildObject(node, 'Quadrant I+II', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12.png', $1001)); - Tree.Items.AddChildObject(node, 'Quadrant II', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2.png', $1002)); - Tree.Items.AddChildObject(node, 'Quadrant II+III', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23.png', $1003)); - Tree.Items.AddChildObject(node, 'Quadrant III', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3.png', $1004)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34.png', $1005)); - Tree.Items.AddChildObject(node, 'Quadrant IV', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4.png', $1006)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41.png', $1007)); - - Tree.Items.AddChildObject(node, 'Quadrant I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1r.png', $1100)); - Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12r.png', $1101)); - Tree.Items.AddChildObject(node, 'Quadrant II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2r.png', $1102)); - Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23r.png', $1103)); - Tree.Items.AddChildObject(node, 'Quadrant III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3r.png', $1104)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34r.png', $1105)); - Tree.Items.AddChildObject(node, 'Quadrant IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4r.png', $1106)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41r.png', $1107)); - - node1 := Tree.Items.AddChild(node0, 'elliptical, rotated 30deg'); - node := Tree.Items.AddChild(node1, 'clockwise from point 1 to point 2'); - Tree.Items.AddChildObject(node, 'Quadrant I', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1.png', $2200)); - Tree.Items.AddChildObject(node, 'Quadrant I+II', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12.png', $2201)); - Tree.Items.AddChildObject(node, 'Quadrant II', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2.png', $2202)); - Tree.Items.AddChildObject(node, 'Quadrant II+III', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23.png', $2203)); - Tree.Items.AddChildObject(node, 'Quadrant III', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3.png', $2204)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34.png', $2205)); - Tree.Items.AddChildObject(node, 'Quadrant IV', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4.png', $2206)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41.png', $2207)); - - Tree.Items.AddChildObject(node, 'Quadrant I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1r.png', $2300)); - Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12r.png', $2301)); - Tree.Items.AddChildObject(node, 'Quadrant II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2r.png', $2302)); - Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23r.png', $2303)); - Tree.Items.AddChildObject(node, 'Quadrant III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3r.png', $2304)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34r.png', $2305)); - Tree.Items.AddChildObject(node, 'Quadrant IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4r.png', $2306)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41r.png', $2307)); - - node := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2'); - Tree.Items.AddChildObject(node, 'Quadrant I', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1.png', $2000)); - Tree.Items.AddChildObject(node, 'Quadrant I+II', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12.png', $2001)); - Tree.Items.AddChildObject(node, 'Quadrant II', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2.png', $2002)); - Tree.Items.AddChildObject(node, 'Quadrant II+III', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23.png', $2003)); - Tree.Items.AddChildObject(node, 'Quadrant III', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3.png', $2004)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34.png', $2005)); - Tree.Items.AddChildObject(node, 'Quadrant IV', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4.png', $2006)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41.png', $2007)); - - Tree.Items.AddChildObject(node, 'Quadrant I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1r.png', $2100)); - Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12r.png', $2101)); - Tree.Items.AddChildObject(node, 'Quadrant II, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2r.png', $2102)); - Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23r.png', $2103)); - Tree.Items.AddChildObject(node, 'Quadrant III, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3r.png', $2104)); - Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34r.png', $2105)); - Tree.Items.AddChildObject(node, 'Quadrant IV, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4r.png', $2106)); - Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse', - TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41r.png', $2107)); + {$I vt_arcs_circular.inc} + {$I vt_arcs_elliptical.inc} + {$I vt_arcs_elliptical_rotated.inc} { -----------------------------------------------} node := Tree.Items.AddChild(nil, 'Bezier'); { -----------------------------------------------} - Tree.Items.AddChildObject(node, 'Single segment', + Tree.Items.AddChildObject(node, 'Single segment (rotated around (10,10) by 30° CCW)', + TRenderParams.Create(@Render_Bezier, 'bezier_rot30ccw.png', $00010000)); + Tree.Items.AddChildObject(node, 'Single segment (normal)', TRenderParams.Create(@Render_Bezier, 'bezier.png')); + Tree.Items.AddChildObject(node, 'Single segment (rotated around (10,10) by 30° CW)', + TRenderParams.Create(@Render_Bezier, 'bezier_rot30cw.png', $00020000)); { -----------------------------------------------} - node0 := Tree.Items.AddChild(nil, 'Gradients'); + mainnode := Tree.Items.AddChild(nil, 'Gradients'); { -----------------------------------------------} - node := Tree.Items.AddChild(node0, 'horizontal'); - Tree.Items.AddChildObject(node, 'Circle', - TRenderParams.Create(@Render_Shape, 'circle_gradienthor.png', $0101)); - Tree.Items.AddChildObject(node, 'Ellipse', - TRenderParams.Create(@Render_Shape, 'ellipse_gradienthor.png', $0201)); - Tree.Items.AddChildObject(node, 'Rectangle', - TRenderParams.Create(@Render_Shape, 'rect_gradienthor.png', $0301)); - Tree.Items.AddChildObject(node, 'Rounded rectangle', - TRenderParams.Create(@Render_Shape, 'rounded_rect_gradienthor.png', $0401)); - Tree.Items.AddChildObject(node, 'Polygon', - TRenderParams.Create(@Render_Shape, 'polygon_gradienthor.png', $0501)); - - node := Tree.Items.AddChild(node0, 'vertical'); - Tree.Items.AddChildObject(node, 'Circle', - TRenderParams.Create(@Render_Shape, 'circle_gradientvert.png', $0102)); - Tree.Items.AddChildObject(node, 'Ellipse', - TRenderParams.Create(@Render_Shape, 'ellipse_gradientvert.png', $0202)); - Tree.Items.AddChildObject(node, 'Rectangle', - TRenderParams.Create(@Render_Shape, 'rect_gradientvert.png', $0302)); - Tree.Items.AddChildObject(node, 'Rounded rectangle', - TRenderParams.Create(@Render_Shape, 'rounded_rect_gradientvert.png', $0402)); - Tree.Items.AddChildObject(node, 'Polygon', - TRenderParams.Create(@Render_Shape, 'polygon_gradientvert.png', $0502)); - - node := Tree.Items.AddChild(node0, 'linear'); - Tree.Items.AddChildObject(node, 'Circle', - TRenderParams.Create(@Render_Shape, 'circle_gradientlinear.png', $0103)); - Tree.Items.AddChildObject(node, 'Ellipse', - TRenderParams.Create(@Render_Shape, 'ellipse_gradientlinear.png', $0203)); - Tree.Items.AddChildObject(node, 'Rectangle', - TRenderParams.Create(@Render_Shape, 'rect_gradientlinear.png', $0303)); - Tree.Items.AddChildObject(node, 'Rounded rectangle', - TRenderParams.Create(@Render_Shape, 'rounded_rect_gradientlinear.png', $0403)); - Tree.Items.AddChildObject(node, 'Polygon', - TRenderParams.Create(@Render_Shape, 'polygon_gradientlinear.png', $0503)); - - node := Tree.Items.AddChild(node0, 'radial'); - Tree.Items.AddChildObject(node, 'Circle', - TRenderParams.Create(@Render_Shape, 'circle_gradientradial.png', $0104)); - Tree.Items.AddChildObject(node, 'Ellipse', - TRenderParams.Create(@Render_Shape, 'ellipse_gradientradial.png', $0204)); - Tree.Items.AddChildObject(node, 'Rectangle', - TRenderParams.Create(@Render_Shape, 'rect_gradientradial.png', $0304)); - Tree.Items.AddChildObject(node, 'Rounded rectangle', - TRenderParams.Create(@Render_Shape, 'rounded_rect_gradientradial.png', $0404)); - Tree.Items.AddChildObject(node, 'Polygon', - TRenderParams.Create(@Render_Shape, 'polygon_gradientradial.png', $0504)); + {$I vt_gradients.inc} { -----------------------------------------------} - node0 := Tree.Items.AddChild(nil, 'Text'); + mainnode := Tree.Items.AddChild(nil, 'Text'); { -----------------------------------------------} - node1 := Tree.Items.AddChild(node0, 'single line'); - - node := Tree.Items.AddChild(node1, 'horizontal'); - Tree.Items.AddChildObject(node, 'left aligned', - TRenderParams.Create(@Render_Text, 'text_left.png', $0000)); - Tree.Items.AddChildObject(node, 'centered', - TRenderParams.Create(@Render_Text, 'text_center.png', $0001)); - Tree.Items.AddChildObject(node, 'right aligned', - TRenderParams.Create(@Render_Text, 'text_right.png', $0002)); - - node := Tree.Items.AddChild(node1, 'rotated by 30 deg'); - Tree.Items.AddChildObject(node, 'left aligned', - TRenderParams.Create(@Render_Text, 'text_left_30.png', $1000)); - Tree.Items.AddChildObject(node, 'centered', - TRenderParams.Create(@Render_Text, 'text_center_30.png', $1001)); - Tree.Items.AddChildObject(node, 'right aligned', - TRenderParams.Create(@Render_Text, 'text_right_30.png', $1002)); - - node := Tree.Items.AddChild(node1, 'vertical (90 deg, upward)'); - Tree.Items.AddChildObject(node, 'left aligned', - TRenderParams.Create(@Render_Text, 'text_left_90.png', $2000)); - Tree.Items.AddChildObject(node, 'centered', - TRenderParams.Create(@Render_Text, 'text_center_90.png', $2001)); - Tree.Items.AddChildObject(node, 'right aligned', - TRenderParams.Create(@Render_Text, 'text_right_90.png', $2002)); - - node := Tree.Items.AddChild(node1, 'vertical (-90 deg, downward)'); - Tree.Items.AddChildObject(node, 'left aligned', - TRenderParams.Create(@Render_Text, 'text_left_m90.png', $3000)); - Tree.Items.AddChildObject(node, 'centered', - TRenderParams.Create(@Render_Text, 'text_center_m90.png', $3001)); - Tree.Items.AddChildObject(node, 'right aligned', - TRenderParams.Create(@Render_Text, 'text_right_m90.png', $3002)); - - // ---- - node1 := Tree.Items.AddChild(node0, 'two lines'); - - node := Tree.Items.AddChild(node1, 'horizontal'); - Tree.Items.AddChildObject(node, 'left aligned', - TRenderParams.Create(@Render_2Lines, 'text2_left.png', $0000)); - Tree.Items.AddChildObject(node, 'centered', - TRenderParams.Create(@Render_2Lines, 'text2_center.png', $0001)); - Tree.Items.AddChildObject(node, 'right aligned', - TRenderParams.Create(@Render_2Lines, 'text2_right.png', $0002)); - - node := Tree.Items.AddChild(node1, 'rotated by 30 deg'); - Tree.Items.AddChildObject(node, 'left aligned', - TRenderParams.Create(@Render_2Lines, 'text2_left_30.png', $1000)); - Tree.Items.AddChildObject(node, 'centered', - TRenderParams.Create(@Render_2Lines, 'text2_center_30.png', $1001)); - Tree.Items.AddChildObject(node, 'right aligned', - TRenderParams.Create(@Render_2Lines, 'text2_right_30.png', $1002)); - - node := Tree.Items.AddChild(node1, 'vertical (90 deg, upward)'); - Tree.Items.AddChildObject(node, 'left aligned', - TRenderParams.Create(@Render_2Lines, 'text2_left_90.png', $2000)); - Tree.Items.AddChildObject(node, 'centered', - TRenderParams.Create(@Render_2Lines, 'text2_center_90.png', $2001)); - Tree.Items.AddChildObject(node, 'right aligned', - TRenderParams.Create(@Render_2Lines, 'text2_right_90.png', $2002)); - - node := Tree.Items.AddChild(node1, 'vertical (-90 deg, downward)'); - Tree.Items.AddChildObject(node, 'left aligned', - TRenderParams.Create(@Render_2Lines, 'text2_left_m90.png', $3000)); - Tree.Items.AddChildObject(node, 'centered', - TRenderParams.Create(@Render_2Lines, 'text2_center_m90.png', $3001)); - Tree.Items.AddChildObject(node, 'right aligned', - TRenderParams.Create(@Render_2Lines, 'text2_right_m90.png', $3002)); - - // ---- - node := Tree.Items.AddChild(node0, 'Fonts'); - Tree.Items.AddChildObject(node, 'Times New Roman + Courier New', - TRenderParams.Create(@Render_Text_Fonts, 'text_fonts.png')); - Tree.Items.AddChildObject(node0, 'Text colors', - TRenderParams.Create(@Render_Text_Colors, 'text_colors.png')); + {$I vt_text.inc} end; procedure TMainForm.Render_Shape(APage: TvVectorialPage; AIntParam: Integer); -{ AIntParam and $00FF = 0 --> solid fill - 1 --> horizontal gradient - 2 --> vertical gradient - 3 --> linear gradient - 4 --> radial gradient - AIntParam and $FF00 = $0100 --> circle - $0200 --> ellipse - $0300 --> rectangle - $0400 --> rounded rect - $0500 --> polygon (triangle) } +{ AIntParam and $000000FF = $00000000 --> solid fill + $00000001 --> horizontal gradient + $00000002 --> vertical gradient + $00000003 --> linear gradient + $00000004 --> radial gradient + AIntParam and $0000FF00 = $00000100 --> circle + $00000200 --> ellipse + $00000300 --> rectangle + $00000400 --> rounded rect + $00000500 --> polygon (triangle) + AIntParam and $000F0000 = $00010000 --> rotation of entire shape by 30°C + $00020000 --> rotation of entire shape by -30°C +} var ent: TvEntityWithPenAndBrush; begin - case AIntParam and $FF00 of - $0100: ent := CreateStdCircle(APage); - $0200: ent := CreateStdEllipse(APage); - $0300: ent := CreateStdRect(APage); - $0400: ent := CreateStdRoundedRect(APage); - $0500: ent := CreateStdPolygon(APage); + case AIntParam and $0000FF00 of + $00000100: ent := CreateStdCircle(APage); + $00000200: ent := CreateStdEllipse(APage); + $00000300: ent := CreateStdRect(APage); + $00000400: ent := CreateStdRoundedRect(APage); + $00000500: ent := CreateStdPolygon(APage); else raise Exception.Create('Shape not supported.'); end; - case AIntParam and $00FF of - $0000: ent.Brush := StdSolidBrush; - $0001: ent.Brush := StdHorizGradientBrush; - $0002: ent.Brush := StdVertGradientBrush; - $0003: ent.Brush := StdLinearGradientBrush; - $0004: ent.Brush := StdRadialGradientBrush; + case AIntParam and $000000FF of + $00000000: ent.Brush := StdSolidBrush(colRed); + $00000001: ent.Brush := StdHorizGradientBrush(colYellow, colRed); + $00000002: ent.Brush := StdVertGradientBrush(colYellow, colRed); + $00000003: ent.Brush := StdLinearGradientBrush(colYellow, colRed); + $00000004: ent.Brush := StdRadialGradientBrush(colYellow, colRed); else raise Exception.Create('Brush not supported'); end; + case AIntParam and $000F0000 of + $00010000: Rotate(APage, ent, 30); + $00020000: Rotate(APage, ent, -30); + end; APage.AddEntity(ent); end; @@ -836,7 +489,10 @@ procedure TMainForm.Render_Arc(APage: TvVectorialPage; AIntParam: Integer); // $0006 --> quarter 4 // $0007 --> quarter 4+1 // AIntParam and $0100 = $0100 --> start and end points exchanged -// AIntParan and $0200 = $0200 --> clockwise +// AIntParam and $0200 = $0200 --> clockwise +// +// AIntParam and $000F0000 = $00010000 --> rotation by 30°C +// $00020000 --> rotation by -30°C const ROT_ANGLE = 30; RY_MULT = 0.6; @@ -848,6 +504,8 @@ var p: T3dPoint; x1, y1, x2, y2, rx, ry: Double; startAngle, endAngle, phi: Double; + arc: TPath; + txt1, txt2: TvText; begin isReversed := AIntParam and $0100 <> 0; isClockwise := AIntParam and $0200 <> 0; @@ -875,9 +533,25 @@ begin end; if isReversed then - CreateArc(APage, x2, y2, x1, y1, CX, CY, rx, ry, phi, isClockwise) + CreateArc(APage, x2, y2, x1, y1, CX, CY, rx, ry, phi, isClockwise, arc, txt1, txt2) else - CreateArc(APage, x1, y1, x2, y2, CX, CY, rx, ry, phi, isClockwise); + CreateArc(APage, x1, y1, x2, y2, CX, CY, rx, ry, phi, isClockwise, arc, txt1, txt2); + + case AIntParam and $000F0000 of + $00010000: + begin + Rotate(APage, arc, 30); + Rotate(APage, txt1, 30); + Rotate(APage, txt2, 30); + end; + $00020000: + begin + Rotate(APage, arc, -30); + Rotate(APage, txt1, -30); + Rotate(APage, txt2, -30); + end; + end; + end; procedure TMainForm.Render_Bezier(APage: TvVectorialpage; AIntParam: Integer); @@ -890,74 +564,99 @@ const Y3 = 70; X4 = 90; Y4 = 25; +var + bezier, line1, line2: TPath; + txt1, txt2, txt3, txt4: TvText; begin - CreateBezier(APage, X1,Y1, X2,Y2, X3,Y3, X4,Y4); + CreateBezier(APage, X1,Y1, X2,Y2, X3,Y3, X4,Y4, bezier, line1, line2, txt1, txt2, txt3, txt4); + + case AIntParam and $000F0000 of + $00010000: + begin + Rotate(APage, bezier, 30); + Rotate(APage, line1, 30); + Rotate(APage, line2, 30); + Rotate(APage, txt1, 30); + Rotate(APage, txt2, 30); + Rotate(APage, txt3, 30); + Rotate(APage, txt4, 30); + end; + $00020000: + begin + Rotate(APage, bezier, -30); + Rotate(APage, line1, -30); + Rotate(APage, line2, -30); + Rotate(APage, txt1, -30); + Rotate(APage, txt2, -30); + Rotate(APage, txt3, -30); + Rotate(APage, txt4, -30); + end; + end; + end; -procedure TMainForm.Render_Path_Hole_SolidFill(APage: TvVectorialPage; +procedure TMainForm.Render_Path_Hole(APage: TvVectorialPage; AIntParam: Integer); +{ AIntParam and $000000FF = $00000000 --> solid fill + $00000001 --> horizontal gradient + $00000002 --> vertical gradient + $00000003 --> linear gradient + $00000004 --> radial gradient + AIntParam and $000F0000 = $00010000 --> rotation of entire shape by 30°C + $00020000 --> rotation of entire shape by -30°C +} var obj: TPath; begin obj := CreatePathWithHole(APage); // no need to AddEntity! - obj.Brush.Color := colYellow; - obj.Brush.Style := bsSolid; obj.Pen.Width := 3; obj.Pen.Color := colBlue; + case AIntParam and $000000FF of + $00000000: obj.Brush := StdSolidBrush(colYellow); + $00000001: obj.Brush := StdHorizGradientBrush(colYellow, colRed); + $00000002: obj.Brush := StdVertGradientBrush(colYellow, colRed); + $00000003: obj.Brush := StdLinearGradientBrush(colYellow, colRed); + $00000004: obj.Brush := StdRadialGradientBrush(colYellow, colRed); + else raise Exception.Create('Brush not supported'); + end; + case AIntParam and $000F0000 of + $00010000: Rotate(APage, obj, 30); + $00020000: Rotate(APage, obj, -30); + end; end; -procedure TMainForm.Render_Path_Hole_GradientFill(APage: TvVectorialPage; +procedure TMainForm.Render_SelfIntersectingPoly(APage: TvVectorialPage; AIntParam: Integer); -var - obj: TPath; -begin - obj := CreatePathWithHole(APage); // No need to AddEntity! - obj.Brush := StdLinearGradientBrush; - obj.Pen.Width := 3; - obj.Pen.Color := colBlue; -end; - -procedure TMainForm.Render_SelfIntersectingPoly_SolidFill_EvenOdd( - APage: TvVectorialPage; AIntParam: Integer); +{ AIntParam and $0000000F = $00000000 --> solid fill + $00000001 --> horizontal gradient + $00000002 --> vertical gradient + $00000003 --> linear gradient + $00000004 --> radial gradient + AIntParam and $00000F00 = $00000000 --> even-odd rule + $00000100 --> non-zero winding rule + AIntParam and $000F0000 = $00010000 --> rotation of entire shape by 30°C + $00020000 --> rotation of entire shape by -30°C +} var obj: TvPolygon; begin obj := CreateStdSelfIntersectingPolygon(APage); - obj.WindingRule := vcmEvenOddRule; - obj.Brush := StdSolidBrush; - APage.AddEntity(obj); -end; - -procedure TMainForm.Render_SelfIntersectingPoly_GradientFill_EvenOdd( - APage: TvVectorialPage; AIntParam: Integer); -var - obj: TvPolygon; -begin - obj := CreateStdSelfIntersectingPolygon(APage); - obj.Brush := StdHorizGradientBrush; - obj.WindingRule := vcmEvenOddRule; - APage.AddEntity(obj); -end; - -procedure TMainForm.Render_SelfIntersectingPoly_SolidFill_NonZeroWinding( - APage: TvVectorialPage; AIntParam: Integer); -var - obj: TvPolygon; -begin - obj := CreateStdSelfIntersectingPolygon(APage); - obj.WindingRule := vcmNonZeroWindingRule; - obj.Brush := StdSolidBrush; - APage.AddEntity(obj); -end; - -procedure TMainForm.Render_SelfIntersectingPoly_GradientFill_NonZeroWinding( - APage: TvVectorialPage; AIntParam: Integer); -var - obj: TvPolygon; -begin - obj := CreateStdSelfIntersectingPolygon(APage); - obj.Brush := StdHorizGradientBrush; - obj.WindingRule := vcmNonzeroWindingRule; + case AIntParam and $0000000F of + $00000000: obj.Brush := StdSolidBrush(colRed); + $00000001: obj.Brush := StdHorizGradientBrush(colBlue, colWhite); + $00000002: obj.Brush := StdVertGradientBrush(colBlue, colWhite); + $00000003: obj.Brush := StdLinearGradientBrush(colBlue, colWhite); + $00000004: obj.Brush := StdRadialGradientBrush(colBlue, colWhite); + else raise Exception.Create('Brush not supported'); + end; + case AIntParam and $00000F00 of + $00000000: obj.WindingRule := vcmEvenOddRule; + $00000100: obj.WindingRule := vcmNonZeroWindingRule; + end; + case AIntParam and $000F0000 of + $00010000: Rotate(APage, obj, 30); + $00020000: Rotate(APage, obj, -30); + end; APage.AddEntity(obj); end; diff --git a/components/fpvectorial/tests/vtprimitives.pas b/components/fpvectorial/tests/vtprimitives.pas index a3d986d4a6..e7e38f9e7b 100644 --- a/components/fpvectorial/tests/vtprimitives.pas +++ b/components/fpvectorial/tests/vtprimitives.pas @@ -12,9 +12,10 @@ function CreateEllipse(APage: TvVectorialPage; X1, Y1, X2, Y2: Double): TvEllips function CreateRectangle(APage: TvVectorialPage; X1, Y1, X2, Y2: Double): TvRectangle; function CreateRoundedRect(APage: TvVectorialPage; X1, Y1, X2, Y2, RX, RY: Double): TvRectangle; function CreatePolygon(APage: TvVectorialPage; const APoints: array of T3DPoint): TvPolygon; -function CreateArc(APage: TvVectorialPage; X1,Y1, X2,Y2, CX,CY, RX, RY, Angle: Double; - Clockwise: Boolean): TPath; -function CreateBezier(APage: TvVectorialPage; X1,Y1, X2,Y2, X3,Y3, X4,Y4: Double): TPath; +procedure CreateArc(APage: TvVectorialPage; X1,Y1, X2,Y2, CX,CY, RX, RY, Angle: Double; + Clockwise: Boolean; out Arc: TPath; out Txt1, Txt2: TvText); +procedure CreateBezier(APage: TvVectorialPage; X1,Y1, X2,Y2, X3,Y3, X4,Y4: Double; + out Bezier, Line1, Line2: TPath; out Txt1, Txt2, Txt3, Txt4: TvText); function CreateSimpleBrush(AStyle: TFPBrushStyle; AColor: TFPColor): TvBrush; overload; function CreateSimpleBrush(AStyle: TFPBrushStyle): TvBrush; overload; @@ -32,12 +33,14 @@ function CreateStdPolygon(APage: TvVectorialPage): TvPolygon; function CreateStdSelfIntersectingPolygon(APage: TvVectorialPage): TvPolygon; function CreatePathWithHole(APage: TvVectorialPage): TPath; -function StdSolidBrush: TvBrush; -function StdHorizGradientBrush: TvBrush; -function StdVertGradientBrush: TvBrush; -function StdLinearGradientBrush: TvBrush; -function StdRadialGradientBrush: TvBrush; -function StdPen: TvPen; +function StdSolidBrush(AColor: TFPColor): TvBrush; +function StdHorizGradientBrush(AColor1, AColor2: TFPColor): TvBrush; +function StdVertGradientBrush(AColor1, AColor2: TFPColor): TvBrush; +function StdLinearGradientBrush(AColor1, AColor2: TFPColor): TvBrush; +function StdRadialGradientBrush(AColor1, AColor2: TFPColor): TvBrush; +function StdPen(AColor: TFPColor; AWidth: Integer): TvPen; + +procedure Rotate(APage: TvVectorialPage; AShape: TvEntity; Angle: Double); const PAGE_SIZE = 100; @@ -127,10 +130,8 @@ begin Result.Pen := CreatePen(psSolid, 1, colBlack); end; -function CreateArc(APage: TvVectorialPage; X1,Y1, X2,Y2, CX,CY, RX, RY, Angle: Double; - Clockwise: Boolean): TPath; -var - txt: TvText; +procedure CreateArc(APage: TvVectorialPage; X1,Y1, X2,Y2, CX,CY, RX, RY, Angle: Double; + Clockwise: Boolean; out Arc: TPath; out Txt1, Txt2: TvText); begin if APage.UseTopLeftCoordinates then begin Y1 := PAGE_SIZE - Y1; @@ -142,26 +143,27 @@ begin APage.StartPath(X1, Y1); APage.AddEllipticalArcWithCenterToPath(RX, RY, Angle, X2, Y2, CX, CY, Clockwise); - Result := APage.EndPath; - Result.Pen := StdPen; + Arc := APage.EndPath; + Arc.Pen := StdPen(colBlack, 4); - txt := TvText.Create(APage); - txt.Value.Add('1'); - txt.X := X1; - txt.Y := Y1; - txt.Font.Color := colRed; - APage.AddEntity(txt); + Txt1 := TvText.Create(APage); + Txt1.Value.Add('1'); + Txt1.X := X1; + Txt1.Y := Y1; + Txt1.Font.Color := colRed; + APage.AddEntity(Txt1); - txt := TvText.Create(APage); - txt.Value.Add('2'); - txt.X := X2; - txt.Y := Y2; - txt.Font.Color := colRed; - APage.AddEntity(txt); + Txt2 := TvText.Create(APage); + Txt2.Value.Add('2'); + Txt2.X := X2; + Txt2.Y := Y2; + Txt2.Font.Color := colRed; + APage.AddEntity(Txt2); end; -function CreateBezier(APage: TvVectorialPage; - X1,Y1, X2,Y2, X3,Y3, X4,Y4: Double): TPath; +procedure CreateBezier(APage: TvVectorialPage; + X1,Y1, X2,Y2, X3,Y3, X4,Y4: Double; + out Bezier, Line1, Line2: TPath; out Txt1, Txt2, Txt3, Txt4: TvText); var txt: TvText; begin @@ -173,44 +175,48 @@ begin end; APage.StartPath(X1, Y1); APage.AddBezierToPath(X2,Y2, X3,Y3, X4,Y4); - Result := APage.EndPath; - Result.Pen := StdPen; + Bezier := APage.EndPath; + Bezier.Pen := StdPen(colBlack, 4); APage.StartPath(X1, Y1); APage.AddLineToPath(X2, Y2); - APage.Endpath.Pen.Color := colRed; + Line1 := APage.EndPath; + Line1.Pen.Color := colRed; + Line1.Name := 'Line1'; - APage.StartPath(X4,Y4); + APage.StartPath(X4, Y4); APage.AddLineToPath(X3, Y3); - APage.EndPath.Pen.Color := colRed; + Line2 := APage.EndPath; + Line2.Pen.Color := colRed; + Line2.Name := 'Line2'; - txt := TvText.Create(APage); - txt.Value.Add('1'); - txt.X := X1; - txt.Y := Y1; - txt.Font.Color := colRed; - APage.AddEntity(txt); + Txt1 := TvText.Create(APage); + Txt1.Value.Add('1'); + Txt1.X := X1; + Txt1.Y := Y1; + Txt1.Font.Color := colRed; + APage.AddEntity(Txt1); - txt := TvText.Create(APage); - txt.Value.Add('2'); - txt.X := X2; - txt.Y := Y2; - txt.Font.Color := colRed; - APage.AddEntity(txt); + Txt2 := TvText.Create(APage); + Txt2.Value.Add('2'); + Txt2.X := X2; + Txt2.Y := Y2; + Txt2.Font.Color := colRed; + APage.AddEntity(Txt2); - txt := TvText.Create(APage); - txt.Value.Add('3'); - txt.X := X3; - txt.Y := Y3; - txt.Font.Color := colRed; - APage.AddEntity(txt); + Txt3 := TvText.Create(APage); + Txt3.Value.Add('3'); + Txt3.X := X3; + Txt3.Y := Y3; + Txt3.Font.Color := colRed; + APage.AddEntity(Txt3); - txt := TvText.Create(APage); - txt.Value.Add('4'); - txt.X := X4; - txt.Y := Y4; - txt.Font.Color := colRed; - APage.AddEntity(txt); + Txt4 := TvText.Create(APage); + Txt4.Value.Add('4'); + Txt4.X := X4; + Txt4.Y := Y4; + Txt4.Font.Color := colRed; + APage.AddEntity(Txt4); end; @@ -289,7 +295,7 @@ begin if APage.UseTopLeftCoordinates then Result := CreateCircle(APage, CENTER_X, PAGE_SIZE - CENTER_Y, RADIUS) else Result := CreateCircle(APage, CENTER_X, CENTER_Y, RADIUS); - Result.Pen := StdPen; + Result.Pen := StdPen(colBlack, 4); end; { An ellipse shifted up } @@ -297,7 +303,7 @@ function CreateStdEllipse(APage: TvVectorialPage): TvEllipse; begin Result := CreateEllipse(APage, 10, 30, 90, 80); // CreateEllipse will invert the axis if needed - Result.Pen := StdPen; + Result.Pen := StdPen(colBlack, 4); end; { A rectangle shifted up } @@ -310,7 +316,7 @@ const begin Result := CreateRectangle(APage, LEFT, TOP, RIGHT, BOTTOM); // CreateRect will invert the y axis if needed - Result.Pen := StdPen; + Result.Pen := StdPen(colBlack, 4); end; { A rounded rectangle shifted up } @@ -325,7 +331,7 @@ const begin Result := CreateRoundedRect(APage,LEFT, TOP, RIGHT, BOTTOM, RX, RY); // CreateRect will invert the y axis if needed - Result.Pen := StdPen; + Result.Pen := StdPen(colBlack, 4); end; { A triangle as polygon, base line at bottom } @@ -342,7 +348,7 @@ begin for i:=0 to High(pts) do pts[i].Y := PAGE_SIZE - pts[i].Y; Result := CreatePolygon(APage, pts); - Result.Pen := StdPen; + Result.Pen := StdPen(colBlack, 4); end; { A star-like self-intersecting polygon, tip at bottom } @@ -361,7 +367,7 @@ begin for i:=0 to High(pts) do pts[i].Y := PAGE_SIZE - pts[i].Y; Result := CreatePolygon(APage, pts); - Result.Pen := StdPen; + Result.Pen := StdPen(colBlack, 4); end; function CreatePathWithHole(APage: TvVectorialPage): TPath; @@ -391,374 +397,83 @@ begin APage.AddLineToPath(INNER_POINTS[i].X, INNER_POINTS[i].Y); end; Result := APage.EndPath; - Result.Pen := StdPen; + Result.Pen := StdPen(colBlack, 4); end; - (* -{ Quarter circle in quadrant I } -function CreateStdCircArcQ1(APage: TvVectorialPage; - Clockwise, Reverse: Boolean): TPath; -const - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 30.0; - X1 = CX + RX; - Y1 = CY; - X2 = CX; - Y2 = CY + RY; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, 0, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, 0, Clockwise); -end; - -{ Quarter circle reaching from quadrant I into quadrant II} -function CreateStdCircArcQ12(APage: TvVectorialPage; - Clockwise, Reverse: Boolean): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 30.0; - X1 = CX + RX/SQRT2; - Y1 = CY + RY/SQRT2; - X2 = CX - RX/SQRT2; - Y2 = CY + RY/SQRT2; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, 0, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, 0, Clockwise); -end; - -{ Quarter circle in quadrant II } -function CreateStdCircArcQ2(APage: TvVectorialPage; Clockwise: Boolean): TPath; -const - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 30.0; - X1 = CX; - Y1 = CY + RY; - X2 = CX - RX; - Y2 = CY; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, 0, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, 0, Clockwise); -end; - -{ Quarter circle reaching from quadrant II into quadrant III} -function CreateStdCircArcQ23(APage: TvVectorialPage; Clockwise: Boolean): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 30.0; - X1 = CX - RX/SQRT2; - Y1 = CY + RY/SQRT2; - X2 = CX - RX/SQRT2; - Y2 = CY - RY/SQRT2; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, 0, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, 0, Clockwise); -end; - -{ Quarter circle in quadrant III } -function CreateStdCircArcQ3(APage: TvVectorialPage; Clockwise: Boolean): TPath; -const - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 30.0; - X1 = CX - RX; - Y1 = CY; - X2 = CX; - Y2 = CY - RY; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, 0, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, 0, Clockwise); -end; - -{ Quarter circle reaching from quadrant III into quadrant IV} -function CreateStdCircArcQ34(APage: TvVectorialPage; Clockwise: Boolean): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 30.0; - X1 = CX - RX/SQRT2; - Y1 = CY - RY/SQRT2; - X2 = CX + RX/SQRT2; - Y2 = CY - RY/SQRT2; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, 0, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, 0, Clockwise); -end; - -{ Quarter circle in quadrant IV } -function CreateStdCircArcQ4(APage: TvVectorialPage; Clockwise: Boolean): TPath; -const - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 30.0; - X1 = CX; - Y1 = CY - RY; - X2 = CX + RX; - Y2 = CY; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, 0, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, 0, Clockwise); -end; - -{ Quarter circle reaching from quadrant IV into quadrant I} -function CreateStdCircArcQ41(APage: TvVectorialPage; Clockwise: Boolean): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 30.0; - X1 = CX + RX/SQRT2; - Y1 = CY - RY/SQRT2; - X2 = CX + RX/SQRT2; - Y2 = CY + RY/SQRT2; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, 0, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, 0, Clockwise); -end; - -function CreateStdEllArcQ1(APage: TvVectorialPage; - Clockwise, Reverse: Boolean; Angle: Double): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 20.0; - X1 = CX + RX; - Y1 = CY; - X2 = CX; - Y2 = CY + RY; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, Angle, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, Angle, Clockwise); -end; - -function CreateStdEllArcQ12(APage: TvVectorialPage; - Clockwise, Reverse: Boolean; Angle: Double): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 20.0; - X1 = CX + RX/SQRT2; - Y1 = CY + RY/SQRT2; - X2 = CX - RX/SQRT2; - Y2 = CY + RY/SQRT2; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, Angle, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, Angle, Clockwise); -end; - -function CreateStdEllArcQ2(APage: TvVectorialPage; - Clockwise, Reverse: Boolean; Angle: Double): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 20.0; - X1 = CX; - Y1 = CY + RY; - X2 = CX - RX; - Y2 = CY; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, Angle, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, Angle, Clockwise); -end; - -function CreateStdEllArcQ23(APage: TvVectorialPage; - Clockwise, Reverse: Boolean; Angle: Double): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 20.0; - X1 = CX - RX/SQRT2; - Y1 = CY + RY/SQRT2; - X2 = CX - RX/SQRT2; - Y2 = CY - RY/SQRT2; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, Angle, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, Angle, Clockwise); -end; - -function CreateStdEllArcQ3(APage: TvVectorialPage; - Clockwise, Reverse: Boolean; Angle: Double): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 20.0; - X1 = CX - RX; - Y1 = CY; - X2 = CX; - Y2 = CY - RY; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, Angle, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, Angle, Clockwise); -end; - -function CreateStdEllArcQ34(APage: TvVectorialPage; - Clockwise, Reverse: Boolean; Angle: Double): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 20.0; - X1 = CX - RX/SQRT2; - Y1 = CY - RY/SQRT2; - X2 = CX + RX/SQRT2; - Y2 = CY - RY/SQRT2; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, Angle, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, Angle, Clockwise); -end; - -function CreateStdEllArcQ4(APage: TvVectorialPage; - Clockwise, Reverse: Boolean; Angle: Double): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 20.0; - X1 = CX; - Y1 = CY - RY; - X2 = CX + RX; - Y2 = CY; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, Angle, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, Angle, Clockwise); -end; - -function CreateStdEllArcQ41(APage: TvVectorialPage; - Clockwise, Reverse: Boolean; Angle: Double): TPath; -const - SQRT2 = 1.4142135623731; - CX = 50.0; - CY = 55.0; - RX = 30.0; - RY = 20.0; - X1 = CX + RX/SQRT2; - Y1 = CY - RY/SQRT2; - X2 = CX + RX/SQRT2; - Y2 = CY + RY/SQRT2; -begin - if Reverse then - Result := CreateArc(APage, X2, Y2, X1, Y1, CX, CY, RX, RY, Angle, Clockwise) - else - Result := CreateArc(APage, X1, Y1, X2, Y2, CX, CY, RX, RY, Angle, Clockwise); -end; - *) { ---- } -function StdSolidBrush: TvBrush; +function StdSolidBrush(AColor: TFPColor): TvBrush; begin - Result := CreateSimpleBrush(bsSolid, colRed); + Result := CreateSimpleBrush(bsSolid, AColor); end; -function StdHorizGradientBrush: TvBrush; +function StdHorizGradientBrush(AColor1, AColor2: TFPColor): TvBrush; begin Result := CreateLinearGradientBrush(Point2D(0, 0), Point2D(1, 0), [gfRelStartX, gfRelEndX, gfRelStartY, gfRelEndY], - colBlue, colWhite); + AColor1, AColor2); end; -{ A vertical gradient, yellow at top, red at bottom } -function StdVertGradientBrush: TvBrush; +{ A vertical gradient, AColor1 at top, AColor2 at bottom } +function StdVertGradientBrush(AColor1, AColor2: TFPColor): TvBrush; var P1, P2: T2DPoint; begin - {if APage.UseTopLeftCoordinates then begin - P1 := Point2D(0, 1); - P2 := Point2D(0, 0); - end else - } - begin - P1 := Point2D(0, 0); - P2 := Point2D(0, 1); - end; + P1 := Point2D(0, 0); + P2 := Point2D(0, 1); Result := CreateLinearGradientBrush(P1, P2, [gfRelStartX, gfRelEndX, gfRelStartY, gfRelEndY], - colYellow, colRed); + AColor1, AColor2); end; -{ A diagonal gradient running from bottom/left (yellow) to top/right (red) } -function StdLinearGradientBrush: TvBrush; +{ A diagonal gradient running from bottom/left (AColor1) to top/right (AColor) } +function StdLinearGradientBrush(AColor1, AColor2: TFPColor): TvBrush; var P1, P2: T2DPoint; begin - { - if APage.UseTopLeftCoordinates then begin - P1 := Point2D(0, 1); - P2 := Point2D(1, 0); - end else - } - begin - P1 := Point2D(0, 0); - P2 := Point2D(1, 1); - end; + P1 := Point2D(0, 0); + P2 := Point2D(1, 1); Result := CreateLinearGradientBrush(Point2D(0, 0), Point2D(1, 1), [gfRelStartX, gfRelEndX, gfRelStartY, gfRelEndY], - colYellow, colRed); + AColor1, AColor2); end; -function StdRadialGradientBrush: TvBrush; +function StdRadialGradientBrush(AColor1, AColor2: TFPColor): TvBrush; begin Result := CreateRadialGradientBrush(0.5, 0.5, 0.5, 0.5, 0.5, - colRed, colYellow); + AColor1, AColor2); end; -function StdPen: TvPen; +function StdPen(AColor: TFPColor; AWidth: Integer): TvPen; begin - Result := CreatePen(psSolid, 4, colBlack); + Result := CreatePen(psSolid, AWidth, AColor); +end; + +procedure Rotate(APage: TvVectorialPage; AShape: TvEntity; Angle: Double); +var + p: T3dPoint; + ctr: T3dPoint; // Center of rotation + phi: Double; // Rotation angle in radians +begin; + ctr.X := 10; + phi := DegToRad(Angle); + if APage.UseTopLeftCoordinates then + begin + ctr.Y := PAGE_SIZE - 10; + phi := -phi; + end else + ctr.Y := 10; + + if AShape is TvText then + begin + // TvText has no Rotate method since it has no Angle element. + // --> The reference point cannot be rotated in space by TvText itself, + // we must do it separately. + p := Rotate3DPointInXY(Make3dPoint(AShape.X, AShape.Y), ctr, -phi); + AShape.X := p.X; + AShape.Y := p.Y; + end else + AShape.Rotate(phi, ctr); end; end.