mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-02 15:39:38 +01:00
fpvectorial: Make top/left coordinates default of wmf reader. Fix entity ApplyXXXToCanvas methods crashing if ADest=nil. Fix polyline in wmf reader.
git-svn-id: trunk@52885 -
This commit is contained in:
parent
3bcb9092eb
commit
523e0080fa
@ -1399,7 +1399,7 @@ type
|
||||
function GenerateDebugTree(ADestRoutine: TvDebugAddItemProc; APageItem: Pointer): Pointer; override;
|
||||
end;
|
||||
|
||||
TvVectorialReaderFlag = (vrfSVG_UseBottomLeftCoords, vrfWMF_UseTopLeftCoords);
|
||||
TvVectorialReaderFlag = (vrfSVG_UseBottomLeftCoords, vrfWMF_UseBottomLeftCoords);
|
||||
TvVectorialReaderFlags = set of TvVectorialReaderFlag;
|
||||
|
||||
TvVectorialReaderSettings = record
|
||||
@ -3869,6 +3869,8 @@ end;
|
||||
procedure TvEntityWithPen.ApplyPenToCanvas(ADest: TFPCustomCanvas;
|
||||
ARenderInfo: TvRenderInfo; APen: TvPen);
|
||||
begin
|
||||
if ADest = nil then
|
||||
exit;
|
||||
ADest.Pen.FPColor := AdjustColorToBackground(APen.Color, ARenderInfo);
|
||||
ADest.Pen.Width := Max(1, APen.Width); // wp: why was here "1;//APen.Width;" ???
|
||||
ADest.Pen.Style := APen.Style;
|
||||
@ -3917,6 +3919,8 @@ end;
|
||||
procedure TvEntityWithPenAndBrush.ApplyBrushToCanvas(ADest: TFPCustomCanvas;
|
||||
ABrush: PvBrush);
|
||||
begin
|
||||
if ADest = nil then
|
||||
exit;
|
||||
ADest.Brush.FPColor := ABrush^.Color;
|
||||
ADest.Brush.Style := ABrush^.Style;
|
||||
end;
|
||||
@ -4543,6 +4547,8 @@ var
|
||||
{$endif}
|
||||
lFPColor: TFPColor;
|
||||
begin
|
||||
if ADest = nil then
|
||||
exit;
|
||||
ADest.Font.Name := AFont.Name;
|
||||
if AFont.Size = 0 then AFont.Size := 10;
|
||||
ADest.Font.Size := Round(AmulX * AFont.Size);
|
||||
|
||||
@ -711,8 +711,8 @@ const
|
||||
var
|
||||
n: Integer;
|
||||
i, j: Integer;
|
||||
poly: TvPolygon;
|
||||
pts: Array of T3DPoint;
|
||||
path: TPath;
|
||||
begin
|
||||
n := AParams[0];
|
||||
SetLength(pts, n);
|
||||
@ -727,21 +727,21 @@ begin
|
||||
pts[n] := pts[0];
|
||||
end;
|
||||
|
||||
poly := TvPolygon.Create(APage);
|
||||
poly.Points := pts;
|
||||
poly.Pen := FCurrPen;
|
||||
APage.StartPath(pts[0].X, pts[0].Y);
|
||||
for i:=1 to n-1 do
|
||||
APage.AddLineToPath(pts[i].x, pts[i].y);
|
||||
path := APage.EndPath;
|
||||
path.Pen := FCurrPen;
|
||||
if AFilled then
|
||||
poly.Brush := FCurrBrush
|
||||
path.Brush := FCurrBrush
|
||||
else begin
|
||||
poly.Brush.Style := bsClear;
|
||||
poly.Brush.Kind := bkSimpleBrush;
|
||||
path.Brush.Style := bsClear;
|
||||
path.Brush.Kind := bkSimpleBrush;
|
||||
end;
|
||||
case FCurrPolyFillMode of
|
||||
ALTERNATE : poly.WindingRule := vcmEvenOddRule;
|
||||
WINDING : poly.WindingRule := vcmNonZeroWindingRule;
|
||||
ALTERNATE : path.WindingRule := vcmEvenOddRule;
|
||||
WINDING : path.WindingRule := vcmNonZeroWindingRule;
|
||||
end;
|
||||
|
||||
APage.AddEntity(poly);
|
||||
end;
|
||||
|
||||
procedure TvWMFVectorialReader.ReadPolyPolygon(APage: TvVectorialPage;
|
||||
@ -798,7 +798,7 @@ var
|
||||
page: TvVectorialPage;
|
||||
prevX, prevY: Word;
|
||||
begin
|
||||
page := AData.AddPage(vrfWMF_UseTopLeftCoords in Settings.VecReaderFlags);
|
||||
page := AData.AddPage(not (vrfWMF_UseBottomLeftCoords in Settings.VecReaderFlags));
|
||||
|
||||
while AStream.Position < AStream.Size do begin
|
||||
// Store the stream position where the current record begins
|
||||
@ -1333,10 +1333,9 @@ function TvWMFVectorialReader.ScaleY(y: Integer): Double;
|
||||
begin
|
||||
// Result := ScaleSizeY(y - FWindowOrigin.Y); // there is probably an issue with y direction
|
||||
|
||||
if (vrfWMF_UseTopLeftCoords in Settings.VecReaderFlags) then
|
||||
Result := ScaleSizeY(y - FWindowOrigin.Y)
|
||||
else
|
||||
Result := FPageHeight - ScaleSizeY(y);
|
||||
if (vrfWMF_UseBottomLeftCoords in Settings.VecReaderFlags) then
|
||||
Result := FPageHeight - ScaleSizeY(y) else
|
||||
Result := ScaleSizeY(y - FWindowOrigin.Y);
|
||||
|
||||
// Result := FPageHeight - ScaleSizeY(y);
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user