2011-01-14 14:49:45 +00:00
|
|
|
unit fpvtocanvas;
|
|
|
|
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
2011-01-26 20:40:56 +00:00
|
|
|
{$define USE_LCL_CANVAS}
|
|
|
|
|
2011-01-14 14:49:45 +00:00
|
|
|
uses
|
2011-01-26 20:40:56 +00:00
|
|
|
Classes, SysUtils, Math,
|
|
|
|
{$ifdef USE_LCL_CANVAS}
|
|
|
|
Graphics, LCLIntf,
|
|
|
|
{$else}
|
2011-01-14 14:49:45 +00:00
|
|
|
fpcanvas,
|
2011-01-26 20:40:56 +00:00
|
|
|
{$endif}
|
2011-01-14 14:49:45 +00:00
|
|
|
fpvectorial;
|
|
|
|
|
2011-01-26 20:40:56 +00:00
|
|
|
procedure DrawFPVectorialToCanvas(ASource: TvVectorialDocument;
|
|
|
|
{$ifdef USE_LCL_CANVAS}
|
|
|
|
ADest: TCanvas;
|
|
|
|
{$else}
|
|
|
|
ADest: TFPCustomCanvas;
|
|
|
|
{$endif}
|
2011-01-14 14:49:45 +00:00
|
|
|
ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2011-01-26 20:40:56 +00:00
|
|
|
function Rotate2DPoint(P,Fix :TPoint; alpha:double): TPoint;
|
2011-01-26 16:05:00 +00:00
|
|
|
var
|
|
|
|
sinus, cosinus : Extended;
|
|
|
|
begin
|
|
|
|
SinCos(alpha, sinus, cosinus);
|
|
|
|
P.x := P.x - Fix.x;
|
|
|
|
P.y := P.y - Fix.y;
|
|
|
|
result.x := Round(p.x*cosinus + p.y*sinus) + fix.x ;
|
|
|
|
result.y := Round(-p.x*sinus + p.y*cosinus) + Fix.y;
|
2011-01-26 20:40:56 +00:00
|
|
|
end;
|
2011-01-26 16:05:00 +00:00
|
|
|
|
2011-01-26 20:40:56 +00:00
|
|
|
procedure DrawRotatedEllipse(
|
|
|
|
{$ifdef USE_LCL_CANVAS}
|
|
|
|
ADest: TCanvas;
|
|
|
|
{$else}
|
|
|
|
ADest: TFPCustomCanvas;
|
|
|
|
{$endif}
|
|
|
|
CurEllipse: TvEllipse;
|
|
|
|
ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
|
|
|
|
var
|
2011-01-26 16:05:00 +00:00
|
|
|
PointList: array[0..6] of TPoint;
|
|
|
|
f: TPoint;
|
2011-01-26 20:40:56 +00:00
|
|
|
dk, x1, x2, y1, y2: Integer;
|
2011-01-26 16:05:00 +00:00
|
|
|
begin
|
2011-01-26 20:40:56 +00:00
|
|
|
{$ifdef USE_LCL_CANVAS}
|
|
|
|
CurEllipse.CalculateBoundingRectangle();
|
|
|
|
x1 := CurEllipse.BoundingRect.Left;
|
|
|
|
x2 := CurEllipse.BoundingRect.Right;
|
|
|
|
y1 := CurEllipse.BoundingRect.Top;
|
|
|
|
y2 := CurEllipse.BoundingRect.Bottom;
|
|
|
|
|
|
|
|
dk := Round(0.654 * Abs(y2-y1));
|
|
|
|
f.x := Round(CurEllipse.CenterX);
|
|
|
|
f.y := Round(CurEllipse.CenterY - 1);
|
|
|
|
PointList[0] := Rotate2DPoint(Point(x1, f.y), f, CurEllipse.Angle) ; // Startpoint
|
|
|
|
PointList[1] := Rotate2DPoint(Point(x1, f.y - dk), f, CurEllipse.Angle);
|
2011-01-26 16:05:00 +00:00
|
|
|
//Controlpoint of Startpoint first part
|
2011-01-26 20:40:56 +00:00
|
|
|
PointList[2] := Rotate2DPoint(Point(x2- 1, f.y - dk), f, CurEllipse.Angle);
|
2011-01-26 16:05:00 +00:00
|
|
|
//Controlpoint of secondpoint first part
|
2011-01-26 20:40:56 +00:00
|
|
|
PointList[3] := Rotate2DPoint(Point(x2 -1 , f.y), f, CurEllipse.Angle);
|
2011-01-26 16:05:00 +00:00
|
|
|
// Firstpoint of secondpart
|
2011-01-26 20:40:56 +00:00
|
|
|
PointList[4] := Rotate2DPoint(Point(x2-1 , f.y + dk), f, CurEllipse.Angle);
|
2011-01-26 16:05:00 +00:00
|
|
|
// Controllpoint of secondpart firstpoint
|
2011-01-26 20:40:56 +00:00
|
|
|
PointList[5] := Rotate2DPoint(Point(x1, f.y + dk), f, CurEllipse.Angle);
|
2011-01-26 16:05:00 +00:00
|
|
|
// Conrollpoint of secondpart endpoint
|
|
|
|
PointList[6] := PointList[0]; // Endpoint of
|
|
|
|
// Back to the startpoint
|
2011-01-26 20:40:56 +00:00
|
|
|
ADest.PolyBezier(Pointlist[0]);
|
|
|
|
{$endif}
|
2011-01-26 16:05:00 +00:00
|
|
|
end;
|
|
|
|
|
2011-01-14 14:49:45 +00:00
|
|
|
{@@
|
|
|
|
This function draws a FPVectorial vectorial image to a TFPCustomCanvas
|
|
|
|
descendent, such as TCanvas from the LCL.
|
|
|
|
|
|
|
|
Be careful that by default this routine does not execute coordinate transformations,
|
|
|
|
and that FPVectorial works with a start point in the bottom-left corner, with
|
|
|
|
the X growing to the right and the Y growing to the top. This will result in
|
|
|
|
an image in TFPCustomCanvas mirrored in the Y axis in relation with the document
|
|
|
|
as seen in a PDF viewer, for example. This can be easily changed with the
|
|
|
|
provided parameters. To have the standard view of an image viewer one could
|
|
|
|
use this function like this:
|
|
|
|
|
|
|
|
DrawFPVectorialToCanvas(ASource, ADest, 0, ASource.Height, 1.0, -1.0);
|
|
|
|
}
|
2011-01-26 20:40:56 +00:00
|
|
|
procedure DrawFPVectorialToCanvas(ASource: TvVectorialDocument;
|
|
|
|
{$ifdef USE_LCL_CANVAS}
|
|
|
|
ADest: TCanvas;
|
|
|
|
{$else}
|
|
|
|
ADest: TFPCustomCanvas;
|
|
|
|
{$endif}
|
2011-01-14 14:49:45 +00:00
|
|
|
ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
|
2011-02-11 08:44:59 +00:00
|
|
|
|
|
|
|
function CoordToCanvasX(ACoord: Double): Integer;
|
|
|
|
begin
|
|
|
|
Result := Round(ADestX + AmulX * ACoord);
|
|
|
|
end;
|
|
|
|
|
|
|
|
function CoordToCanvasY(ACoord: Double): Integer;
|
|
|
|
begin
|
|
|
|
Result := Round(ADestY + AmulY * ACoord);
|
|
|
|
end;
|
|
|
|
|
2011-01-14 14:49:45 +00:00
|
|
|
var
|
|
|
|
i, j, k: Integer;
|
|
|
|
PosX, PosY: Integer; // Not modified by ADestX, etc
|
|
|
|
CurSegment: TPathSegment;
|
|
|
|
Cur2DSegment: T2DSegment absolute CurSegment;
|
|
|
|
Cur2DBSegment: T2DBezierSegment absolute CurSegment;
|
|
|
|
// For bezier
|
|
|
|
CurX, CurY: Integer; // Not modified by ADestX, etc
|
|
|
|
CurveLength: Integer;
|
|
|
|
t: Double;
|
2011-01-30 15:35:48 +00:00
|
|
|
// For text
|
|
|
|
CurText: TvText;
|
2011-01-25 16:51:57 +00:00
|
|
|
// For entities
|
|
|
|
CurEntity: TvEntity;
|
|
|
|
CurCircle: TvCircle;
|
2011-01-26 16:05:00 +00:00
|
|
|
CurEllipse: TvEllipse;
|
2011-02-12 20:41:31 +00:00
|
|
|
//
|
2011-01-26 20:40:56 +00:00
|
|
|
CurArc: TvCircularArc;
|
2011-02-11 16:24:47 +00:00
|
|
|
FinalStartAngle, FinalEndAngle, tmpAngle: double;
|
2011-02-12 20:06:28 +00:00
|
|
|
BoundsLeft, BoundsTop, BoundsRight, BoundsBottom,
|
|
|
|
IntStartAngle, IntAngleLength: Integer;
|
2011-02-12 20:41:31 +00:00
|
|
|
//
|
2011-02-11 08:44:59 +00:00
|
|
|
CurDim: TvAlignedDimension;
|
2011-02-12 20:41:31 +00:00
|
|
|
Points: array of TPoint;
|
|
|
|
UpperDim, LowerDim: T3DPoint;
|
2011-01-14 14:49:45 +00:00
|
|
|
begin
|
|
|
|
{$ifdef FPVECTORIALDEBUG}
|
|
|
|
WriteLn(':>DrawFPVectorialToCanvas');
|
|
|
|
{$endif}
|
|
|
|
|
|
|
|
PosX := 0;
|
|
|
|
PosY := 0;
|
2011-02-11 16:24:47 +00:00
|
|
|
ADest.Brush.Style := bsClear;
|
2011-01-14 14:49:45 +00:00
|
|
|
|
|
|
|
ADest.MoveTo(ADestX, ADestY);
|
|
|
|
|
2011-01-30 15:35:48 +00:00
|
|
|
// Draws all paths
|
2011-01-14 14:49:45 +00:00
|
|
|
for i := 0 to ASource.PathCount - 1 do
|
|
|
|
begin
|
|
|
|
//WriteLn('i = ', i);
|
|
|
|
ASource.Paths[i].PrepareForSequentialReading;
|
|
|
|
|
|
|
|
for j := 0 to ASource.Paths[i].Len - 1 do
|
|
|
|
begin
|
|
|
|
//WriteLn('j = ', j);
|
|
|
|
CurSegment := TPathSegment(ASource.Paths[i].Next());
|
|
|
|
|
|
|
|
case CurSegment.SegmentType of
|
|
|
|
stMoveTo:
|
|
|
|
begin
|
2011-02-11 16:24:47 +00:00
|
|
|
ADest.MoveTo(CoordToCanvasX(Cur2DSegment.X), CoordToCanvasY(Cur2DSegment.Y));
|
2011-01-14 14:49:45 +00:00
|
|
|
end;
|
|
|
|
st2DLine, st3DLine:
|
|
|
|
begin
|
2011-02-11 16:24:47 +00:00
|
|
|
ADest.LineTo(CoordToCanvasX(Cur2DSegment.X), CoordToCanvasY(Cur2DSegment.Y));
|
2011-01-14 14:49:45 +00:00
|
|
|
end;
|
|
|
|
{ To draw a bezier we need to divide the interval in parts and make
|
|
|
|
lines between this parts }
|
|
|
|
st2DBezier, st3DBezier:
|
|
|
|
begin
|
|
|
|
CurveLength :=
|
|
|
|
Round(sqrt(sqr(Cur2DBSegment.X3 - PosX) + sqr(Cur2DBSegment.Y3 - PosY))) +
|
|
|
|
Round(sqrt(sqr(Cur2DBSegment.X2 - Cur2DBSegment.X3) + sqr(Cur2DBSegment.Y2 - Cur2DBSegment.Y3))) +
|
|
|
|
Round(sqrt(sqr(Cur2DBSegment.X - Cur2DBSegment.X3) + sqr(Cur2DBSegment.Y - Cur2DBSegment.Y3)));
|
|
|
|
|
|
|
|
for k := 1 to CurveLength do
|
|
|
|
begin
|
|
|
|
t := k / CurveLength;
|
|
|
|
CurX := Round(sqr(1 - t) * (1 - t) * PosX + 3 * t * sqr(1 - t) * Cur2DBSegment.X2 + 3 * t * t * (1 - t) * Cur2DBSegment.X3 + t * t * t * Cur2DBSegment.X);
|
|
|
|
CurY := Round(sqr(1 - t) * (1 - t) * PosY + 3 * t * sqr(1 - t) * Cur2DBSegment.Y2 + 3 * t * t * (1 - t) * Cur2DBSegment.Y3 + t * t * t * Cur2DBSegment.Y);
|
2011-02-11 16:24:47 +00:00
|
|
|
ADest.LineTo(CoordToCanvasX(CurX), CoordToCanvasY(CurY));
|
2011-01-14 14:49:45 +00:00
|
|
|
end;
|
|
|
|
PosX := Round(Cur2DBSegment.X);
|
|
|
|
PosY := Round(Cur2DBSegment.Y);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2011-01-30 15:35:48 +00:00
|
|
|
// Draws all entities
|
2011-01-25 16:51:57 +00:00
|
|
|
for i := 0 to ASource.GetEntityCount - 1 do
|
|
|
|
begin
|
|
|
|
CurEntity := ASource.GetEntity(i);
|
|
|
|
if CurEntity is TvCircle then
|
|
|
|
begin
|
2011-01-26 16:05:00 +00:00
|
|
|
CurCircle := CurEntity as TvCircle;
|
2011-01-25 16:51:57 +00:00
|
|
|
ADest.Ellipse(
|
2011-02-11 16:24:47 +00:00
|
|
|
CoordToCanvasX(CurCircle.CenterX - CurCircle.Radius),
|
|
|
|
CoordToCanvasY(CurCircle.CenterY - CurCircle.Radius),
|
|
|
|
CoordToCanvasX(CurCircle.CenterX + CurCircle.Radius),
|
|
|
|
CoordToCanvasY(CurCircle.CenterY + CurCircle.Radius)
|
2011-01-25 16:51:57 +00:00
|
|
|
);
|
2011-01-26 16:05:00 +00:00
|
|
|
end
|
|
|
|
else if CurEntity is TvEllipse then
|
|
|
|
begin
|
|
|
|
CurEllipse := CurEntity as TvEllipse;
|
|
|
|
DrawRotatedEllipse(ADest, CurEllipse);
|
|
|
|
end
|
|
|
|
else if CurEntity is TvCircularArc then
|
|
|
|
begin
|
2011-01-26 20:40:56 +00:00
|
|
|
CurArc := CurEntity as TvCircularArc;
|
|
|
|
{$ifdef USE_LCL_CANVAS}
|
2011-02-10 07:44:38 +00:00
|
|
|
// ToDo: Consider a X axis inversion
|
|
|
|
// If the Y axis is inverted, then we need to mirror our angles as well
|
2011-02-12 20:06:28 +00:00
|
|
|
{ if AMulY > 0 then
|
|
|
|
begin}
|
2011-02-10 07:44:38 +00:00
|
|
|
FinalStartAngle := CurArc.StartAngle;
|
|
|
|
FinalEndAngle := CurArc.EndAngle;
|
2011-02-11 16:24:47 +00:00
|
|
|
BoundsLeft := CoordToCanvasX(CurArc.CenterX - CurArc.Radius);
|
|
|
|
BoundsTop := CoordToCanvasY(CurArc.CenterY - CurArc.Radius);
|
2011-02-12 20:06:28 +00:00
|
|
|
BoundsRight := CoordToCanvasX(CurArc.CenterX + CurArc.Radius);
|
2011-02-11 16:24:47 +00:00
|
|
|
BoundsBottom := CoordToCanvasY(CurArc.CenterY + CurArc.Radius);
|
2011-02-12 20:06:28 +00:00
|
|
|
{ end
|
2011-02-10 07:44:38 +00:00
|
|
|
else // AMulY is negative
|
|
|
|
begin
|
|
|
|
// Inverting the angles generates the correct result for Y axis inversion
|
|
|
|
FinalStartAngle := 360 - 1* CurArc.EndAngle;
|
|
|
|
FinalEndAngle := 360 - 1* CurArc.StartAngle;
|
2011-02-11 16:24:47 +00:00
|
|
|
BoundsLeft := CoordToCanvasX(CurArc.CenterX - CurArc.Radius);
|
|
|
|
BoundsTop := CoordToCanvasY(CurArc.CenterY + CurArc.Radius);
|
2011-02-12 20:06:28 +00:00
|
|
|
BoundsRight := CoordToCanvasX(CurArc.CenterX + CurArc.Radius);
|
2011-02-11 16:24:47 +00:00
|
|
|
BoundsBottom := CoordToCanvasY(CurArc.CenterY - CurArc.Radius);
|
2011-02-12 20:06:28 +00:00
|
|
|
end;}
|
|
|
|
IntStartAngle := Round(16*FinalStartAngle);
|
|
|
|
IntAngleLength := Abs(Round(16*(FinalEndAngle - FinalStartAngle)));
|
2011-01-26 20:40:56 +00:00
|
|
|
// Arc(ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer);
|
|
|
|
ADest.Arc(
|
2011-02-11 16:24:47 +00:00
|
|
|
BoundsLeft, BoundsTop, BoundsRight, BoundsBottom,
|
2011-02-12 20:06:28 +00:00
|
|
|
IntStartAngle, IntAngleLength
|
2011-01-26 20:40:56 +00:00
|
|
|
);
|
2011-02-11 16:24:47 +00:00
|
|
|
// Debug info
|
2011-02-12 20:06:28 +00:00
|
|
|
{ ADest.TextOut(CoordToCanvasX(CurArc.CenterX), CoordToCanvasY(CurArc.CenterY),
|
|
|
|
Format('R=%d S=%d L=%d', [Round(CurArc.Radius*AMulX), Round(FinalStartAngle),
|
|
|
|
Abs(Round((FinalEndAngle - FinalStartAngle)))]));
|
|
|
|
ADest.Pen.Color := TColor($DDDDDD);
|
|
|
|
ADest.Rectangle(
|
|
|
|
BoundsLeft, BoundsTop, BoundsRight, BoundsBottom);
|
|
|
|
ADest.Pen.Color := clBlack;}
|
2011-01-26 20:40:56 +00:00
|
|
|
{$endif}
|
2011-02-11 08:44:59 +00:00
|
|
|
end
|
|
|
|
else if CurEntity is TvAlignedDimension then
|
|
|
|
begin
|
|
|
|
CurDim := CurEntity as TvAlignedDimension;
|
2011-02-12 20:41:31 +00:00
|
|
|
//
|
|
|
|
// Draws this shape:
|
|
|
|
// vertical horizontal
|
|
|
|
// ___
|
|
|
|
// | | or ---| X cm
|
|
|
|
// | --|
|
|
|
|
// Which marks the dimension
|
2011-02-12 20:06:28 +00:00
|
|
|
ADest.MoveTo(CoordToCanvasX(CurDim.BaseRight.X), CoordToCanvasY(CurDim.BaseRight.Y));
|
2011-02-11 08:44:59 +00:00
|
|
|
ADest.LineTo(CoordToCanvasX(CurDim.DimensionRight.X), CoordToCanvasY(CurDim.DimensionRight.Y));
|
|
|
|
ADest.LineTo(CoordToCanvasX(CurDim.DimensionLeft.X), CoordToCanvasY(CurDim.DimensionLeft.Y));
|
2011-02-11 16:24:47 +00:00
|
|
|
ADest.LineTo(CoordToCanvasX(CurDim.BaseLeft.X), CoordToCanvasY(CurDim.BaseLeft.Y));
|
2011-02-12 20:41:31 +00:00
|
|
|
// Now the arrows
|
|
|
|
// horizontal
|
|
|
|
SetLength(Points, 3);
|
|
|
|
if CurDim.DimensionRight.Y = CurDim.DimensionLeft.Y then
|
|
|
|
begin
|
|
|
|
ADest.Brush.Color := clBlack;
|
|
|
|
ADest.Brush.Style := bsSolid;
|
|
|
|
// Left arrow
|
|
|
|
Points[0] := Point(CoordToCanvasX(CurDim.DimensionLeft.X), CoordToCanvasY(CurDim.DimensionLeft.Y));
|
|
|
|
Points[1] := Point(Points[0].X + 7, Points[0].Y - 3);
|
|
|
|
Points[2] := Point(Points[0].X + 7, Points[0].Y + 3);
|
|
|
|
ADest.Polygon(Points);
|
|
|
|
// Right arrow
|
|
|
|
Points[0] := Point(CoordToCanvasX(CurDim.DimensionRight.X), CoordToCanvasY(CurDim.DimensionRight.Y));
|
|
|
|
Points[1] := Point(Points[0].X - 7, Points[0].Y - 3);
|
|
|
|
Points[2] := Point(Points[0].X - 7, Points[0].Y + 3);
|
|
|
|
ADest.Polygon(Points);
|
|
|
|
ADest.Brush.Style := bsClear;
|
|
|
|
// Dimension text
|
|
|
|
Points[0].X := CoordToCanvasX((CurDim.DimensionLeft.X+CurDim.DimensionRight.X)/2);
|
|
|
|
Points[0].Y := CoordToCanvasY(CurDim.DimensionLeft.Y);
|
|
|
|
LowerDim.X := CurDim.DimensionRight.X-CurDim.DimensionLeft.X;
|
2011-02-12 21:12:12 +00:00
|
|
|
ADest.Font.Size := 10;
|
2011-02-12 20:41:31 +00:00
|
|
|
ADest.TextOut(Points[0].X, Points[0].Y, Format('%.1f', [LowerDim.X]));
|
|
|
|
end
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
ADest.Brush.Color := clBlack;
|
|
|
|
ADest.Brush.Style := bsSolid;
|
|
|
|
// There is no upper/lower preference for DimensionLeft/Right, so we need to check
|
|
|
|
if CurDim.DimensionLeft.Y > CurDim.DimensionRight.Y then
|
|
|
|
begin
|
|
|
|
UpperDim := CurDim.DimensionLeft;
|
|
|
|
LowerDim := CurDim.DimensionRight;
|
|
|
|
end
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
UpperDim := CurDim.DimensionRight;
|
|
|
|
LowerDim := CurDim.DimensionLeft;
|
|
|
|
end;
|
|
|
|
// Upper arrow
|
|
|
|
Points[0] := Point(CoordToCanvasX(UpperDim.X), CoordToCanvasY(UpperDim.Y));
|
|
|
|
Points[1] := Point(Points[0].X + Round(AMulX), Points[0].Y - Round(AMulY*3));
|
|
|
|
Points[2] := Point(Points[0].X - Round(AMulX), Points[0].Y - Round(AMulY*3));
|
|
|
|
ADest.Polygon(Points);
|
|
|
|
// Lower arrow
|
|
|
|
Points[0] := Point(CoordToCanvasX(LowerDim.X), CoordToCanvasY(LowerDim.Y));
|
|
|
|
Points[1] := Point(Points[0].X + Round(AMulX), Points[0].Y + Round(AMulY*3));
|
|
|
|
Points[2] := Point(Points[0].X - Round(AMulX), Points[0].Y + Round(AMulY*3));
|
|
|
|
ADest.Polygon(Points);
|
|
|
|
ADest.Brush.Style := bsClear;
|
|
|
|
// Dimension text
|
|
|
|
Points[0].X := CoordToCanvasX(CurDim.DimensionLeft.X);
|
|
|
|
Points[0].Y := CoordToCanvasY((CurDim.DimensionLeft.Y+CurDim.DimensionRight.Y)/2);
|
|
|
|
LowerDim.Y := CurDim.DimensionRight.Y-CurDim.DimensionLeft.Y;
|
|
|
|
if LowerDim.Y < 0 then LowerDim.Y := -1 * LowerDim.Y;
|
2011-02-12 21:12:12 +00:00
|
|
|
ADest.Font.Size := 10;
|
2011-02-12 20:41:31 +00:00
|
|
|
ADest.TextOut(Points[0].X, Points[0].Y, Format('%.1f', [LowerDim.Y]));
|
|
|
|
end;
|
|
|
|
SetLength(Points, 0);
|
2011-02-12 20:06:28 +00:00
|
|
|
{ // Debug info
|
2011-02-11 16:24:47 +00:00
|
|
|
ADest.TextOut(CoordToCanvasX(CurDim.BaseRight.X), CoordToCanvasY(CurDim.BaseRight.Y), 'BR');
|
|
|
|
ADest.TextOut(CoordToCanvasX(CurDim.DimensionRight.X), CoordToCanvasY(CurDim.DimensionRight.Y), 'DR');
|
|
|
|
ADest.TextOut(CoordToCanvasX(CurDim.DimensionLeft.X), CoordToCanvasY(CurDim.DimensionLeft.Y), 'DL');
|
|
|
|
ADest.TextOut(CoordToCanvasX(CurDim.BaseLeft.X), CoordToCanvasY(CurDim.BaseLeft.Y), 'BL');}
|
2011-01-25 16:51:57 +00:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2011-01-30 15:35:48 +00:00
|
|
|
// Draws all text
|
|
|
|
for i := 0 to ASource.GetTextCount - 1 do
|
|
|
|
begin
|
|
|
|
CurText := ASource.GetText(i);
|
2011-02-12 21:02:44 +00:00
|
|
|
ADest.Font.Size := Round(AmulX * CurText.FontSize);
|
2011-01-30 15:35:48 +00:00
|
|
|
ADest.Pen.Style := psSolid;
|
|
|
|
ADest.Pen.Color := clBlack;
|
2011-02-12 21:02:44 +00:00
|
|
|
ADest.Brush.Style := bsClear;
|
|
|
|
LowerDim.Y := CurText.Y + CurText.FontSize;
|
|
|
|
ADest.TextOut(CoordToCanvasX(CurText.X), CoordToCanvasY(LowerDim.Y), CurText.Value);
|
2011-01-30 15:35:48 +00:00
|
|
|
end;
|
|
|
|
|
2011-01-14 14:49:45 +00:00
|
|
|
{$ifdef FPVECTORIALDEBUG}
|
|
|
|
WriteLn(':<DrawFPVectorialToCanvas');
|
|
|
|
{$endif}
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|
|
|
|
|