You've already forked lazarus-ccr
Continues fixing the rendering of documents with negative coords
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1515 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -536,6 +536,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// In DXF the EndAngle is always greater then the StartAngle.
|
||||||
|
// If it isn't then sum 360 to it to make sure we don't get wrong results
|
||||||
|
if EndAngle < StartAngle then EndAngle := EndAngle + 360;
|
||||||
|
|
||||||
// Position fixing for documents with negative coordinates
|
// Position fixing for documents with negative coordinates
|
||||||
CenterX := CenterX - DOC_OFFSET.X;
|
CenterX := CenterX - DOC_OFFSET.X;
|
||||||
CenterY := CenterY - DOC_OFFSET.Y;
|
CenterY := CenterY - DOC_OFFSET.Y;
|
||||||
|
@ -25,6 +25,10 @@ procedure DrawFPVectorialToCanvas(ASource: TvVectorialDocument;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{$ifndef Windows}
|
||||||
|
{$define FPVECTORIALDEBUG}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
function Rotate2DPoint(P,Fix :TPoint; alpha:double): TPoint;
|
function Rotate2DPoint(P,Fix :TPoint; alpha:double): TPoint;
|
||||||
var
|
var
|
||||||
sinus, cosinus : Extended;
|
sinus, cosinus : Extended;
|
||||||
@ -212,27 +216,25 @@ begin
|
|||||||
{$ifdef USE_LCL_CANVAS}
|
{$ifdef USE_LCL_CANVAS}
|
||||||
// ToDo: Consider a X axis inversion
|
// ToDo: Consider a X axis inversion
|
||||||
// If the Y axis is inverted, then we need to mirror our angles as well
|
// If the Y axis is inverted, then we need to mirror our angles as well
|
||||||
{ if AMulY > 0 then
|
|
||||||
begin}
|
|
||||||
FinalStartAngle := CurArc.StartAngle;
|
|
||||||
FinalEndAngle := CurArc.EndAngle;
|
|
||||||
BoundsLeft := CoordToCanvasX(CurArc.CenterX - CurArc.Radius);
|
BoundsLeft := CoordToCanvasX(CurArc.CenterX - CurArc.Radius);
|
||||||
BoundsTop := CoordToCanvasY(CurArc.CenterY - CurArc.Radius);
|
BoundsTop := CoordToCanvasY(CurArc.CenterY - CurArc.Radius);
|
||||||
BoundsRight := CoordToCanvasX(CurArc.CenterX + CurArc.Radius);
|
BoundsRight := CoordToCanvasX(CurArc.CenterX + CurArc.Radius);
|
||||||
BoundsBottom := CoordToCanvasY(CurArc.CenterY + CurArc.Radius);
|
BoundsBottom := CoordToCanvasY(CurArc.CenterY + CurArc.Radius);
|
||||||
|
{if AMulY > 0 then
|
||||||
|
begin}
|
||||||
|
FinalStartAngle := CurArc.StartAngle;
|
||||||
|
FinalEndAngle := CurArc.EndAngle;
|
||||||
{end
|
{end
|
||||||
else // AMulY is negative
|
else // AMulY is negative
|
||||||
begin
|
begin
|
||||||
// Inverting the angles generates the correct result for Y axis inversion
|
// Inverting the angles generates the correct result for Y axis inversion
|
||||||
FinalStartAngle := 360 - 1* CurArc.EndAngle;
|
if CurArc.EndAngle = 0 then FinalStartAngle := 0
|
||||||
FinalEndAngle := 360 - 1* CurArc.StartAngle;
|
else FinalStartAngle := 360 - 1* CurArc.EndAngle;
|
||||||
BoundsLeft := CoordToCanvasX(CurArc.CenterX - CurArc.Radius);
|
if CurArc.StartAngle = 0 then FinalEndAngle := 0
|
||||||
BoundsTop := CoordToCanvasY(CurArc.CenterY + CurArc.Radius);
|
else FinalEndAngle := 360 - 1* CurArc.StartAngle;
|
||||||
BoundsRight := CoordToCanvasX(CurArc.CenterX + CurArc.Radius);
|
|
||||||
BoundsBottom := CoordToCanvasY(CurArc.CenterY - CurArc.Radius);
|
|
||||||
end;}
|
end;}
|
||||||
IntStartAngle := Round(16*FinalStartAngle);
|
IntStartAngle := Round(16*FinalStartAngle);
|
||||||
IntAngleLength := Abs(Round(16*(FinalEndAngle - FinalStartAngle)));
|
IntAngleLength := Round(16*(FinalEndAngle - FinalStartAngle));
|
||||||
// On Gtk2 and Carbon, the Left really needs to be to the Left of the Right position
|
// On Gtk2 and Carbon, the Left really needs to be to the Left of the Right position
|
||||||
// The same for the Top and Bottom
|
// The same for the Top and Bottom
|
||||||
// On Windows it works fine either way
|
// On Windows it works fine either way
|
||||||
@ -251,6 +253,10 @@ begin
|
|||||||
BoundsBottom := IntTmp;
|
BoundsBottom := IntTmp;
|
||||||
end;
|
end;
|
||||||
// Arc(ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer);
|
// Arc(ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer);
|
||||||
|
{$ifdef FPVECTORIALDEBUG}
|
||||||
|
WriteLn(Format('Drawing Arc Center=%f,%f Radius=%f StartAngle=%f AngleLength=%f',
|
||||||
|
[CurArc.CenterX, CurArc.CenterY, CurArc.Radius, IntStartAngle/16, IntAngleLength/16]));
|
||||||
|
{$endif}
|
||||||
ADest.Arc(
|
ADest.Arc(
|
||||||
BoundsLeft, BoundsTop, BoundsRight, BoundsBottom,
|
BoundsLeft, BoundsTop, BoundsRight, BoundsBottom,
|
||||||
IntStartAngle, IntAngleLength
|
IntStartAngle, IntAngleLength
|
||||||
|
Reference in New Issue
Block a user