mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-06 12:32:52 +02:00
fpvectorial - svg: Fixes text X and Y coordinates, both were wrong, now it seams to work correct
git-svn-id: trunk@44400 -
This commit is contained in:
parent
1dc7cf5dab
commit
d1e547a07d
@ -1316,6 +1316,8 @@ type
|
|||||||
{ Drawing methods }
|
{ Drawing methods }
|
||||||
procedure PositionEntitySubparts(ADest: TFPCustomCanvas; ABaseX, ABaseY: Double);
|
procedure PositionEntitySubparts(ADest: TFPCustomCanvas; ABaseX, ABaseY: Double);
|
||||||
procedure DrawBackground(ADest: TFPCustomCanvas);
|
procedure DrawBackground(ADest: TFPCustomCanvas);
|
||||||
|
procedure RenderPageBorder(ADest: TFPCustomCanvas;
|
||||||
|
ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
|
||||||
procedure Render(ADest: TFPCustomCanvas;
|
procedure Render(ADest: TFPCustomCanvas;
|
||||||
ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
|
ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
|
||||||
{ Debug methods }
|
{ Debug methods }
|
||||||
@ -5330,7 +5332,7 @@ begin
|
|||||||
|
|
||||||
OldTextX := lText.X;
|
OldTextX := lText.X;
|
||||||
OldTextY := lText.Y;
|
OldTextY := lText.Y;
|
||||||
lText.X := lText.Y + X + lCurWidth;
|
lText.X := lText.X + X + lCurWidth;
|
||||||
lText.Y := lText.Y + Y;
|
lText.Y := lText.Y + Y;
|
||||||
|
|
||||||
lText.Render(ADest, ARenderInfo, ADestX, ADestY, AMulX, AMuly);
|
lText.Render(ADest, ARenderInfo, ADestX, ADestY, AMulX, AMuly);
|
||||||
@ -6165,6 +6167,37 @@ begin
|
|||||||
ADest.Pen.Style := psSolid;
|
ADest.Pen.Style := psSolid;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TvVectorialPage.RenderPageBorder(ADest: TFPCustomCanvas;
|
||||||
|
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;
|
||||||
|
|
||||||
|
var
|
||||||
|
lLeft, lTop, lRight, lBottom: Integer;
|
||||||
|
begin
|
||||||
|
// Fix the min/max values
|
||||||
|
if MinX = MaxX then MaxX := MinX + Width;
|
||||||
|
if MinY = MaxY then MaxY := MinY + Height;
|
||||||
|
|
||||||
|
lLeft := CoordToCanvasX(MinX);
|
||||||
|
lTop := CoordToCanvasY(MinY);
|
||||||
|
lRight := CoordToCanvasX(MaxX);
|
||||||
|
lBottom := CoordToCanvasY(MaxY);
|
||||||
|
|
||||||
|
ADest.Brush.Style := bsClear;
|
||||||
|
ADest.Pen.FPColor := colBlack;
|
||||||
|
ADest.Pen.Style := psSolid;
|
||||||
|
ADest.Rectangle(lLeft, lTop, lRight, lBottom);
|
||||||
|
end;
|
||||||
|
|
||||||
{@@
|
{@@
|
||||||
This function draws a FPVectorial vectorial page to a TFPCustomCanvas
|
This function draws a FPVectorial vectorial page to a TFPCustomCanvas
|
||||||
descendent, such as TCanvas from the LCL.
|
descendent, such as TCanvas from the LCL.
|
||||||
@ -6913,7 +6946,8 @@ begin
|
|||||||
for i:=0 to FPages.Count-1 do
|
for i:=0 to FPages.Count-1 do
|
||||||
begin
|
begin
|
||||||
p := TvPage(FPages[i]);
|
p := TvPage(FPages[i]);
|
||||||
lPageItem := ADestRoutine(Format('Page %d', [i]), nil);
|
lPageItem := ADestRoutine(Format('Page %d Width=%f Height=%f MinX=%f MaxX=%f MinY=%f MaxY=%f',
|
||||||
|
[i, p.Width, p.Height, p.MinX, p.MaxX, p.MinY, p.MaxY]), nil);
|
||||||
p.GenerateDebugTree(ADestRoutine, lPageItem);
|
p.GenerateDebugTree(ADestRoutine, lPageItem);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -2413,7 +2413,7 @@ var
|
|||||||
lCurStyle.ApplyIntoEntity(ADest);
|
lCurStyle.ApplyIntoEntity(ADest);
|
||||||
if lCurStyle.PositionSet then
|
if lCurStyle.PositionSet then
|
||||||
begin
|
begin
|
||||||
ADest.X := ADest.X + lCurStyle.X; // or substitute completely ?
|
ADest.X := ADest.X + lCurStyle.X;
|
||||||
ADest.Y := ADest.Y + lCurStyle.Y;
|
ADest.Y := ADest.Y + lCurStyle.Y;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2441,6 +2441,7 @@ var
|
|||||||
begin
|
begin
|
||||||
lNodeName := lCurNode.Attributes.Item[j].NodeName;
|
lNodeName := lCurNode.Attributes.Item[j].NodeName;
|
||||||
lNodeValue := lCurNode.Attributes.Item[j].NodeValue;
|
lNodeValue := lCurNode.Attributes.Item[j].NodeValue;
|
||||||
|
lNodeName := LowerCase(lNodeName);
|
||||||
if lNodeName = 'x' then
|
if lNodeName = 'x' then
|
||||||
begin
|
begin
|
||||||
lCurStyle.PositionSet := True;
|
lCurStyle.PositionSet := True;
|
||||||
@ -2449,7 +2450,7 @@ var
|
|||||||
else if lNodeName = 'y' then
|
else if lNodeName = 'y' then
|
||||||
begin
|
begin
|
||||||
lCurStyle.PositionSet := True;
|
lCurStyle.PositionSet := True;
|
||||||
lCurStyle.Y := StringWithUnitToFloat(lNodeValue, sckY);
|
lCurStyle.Y := StringWithUnitToFloat(lNodeValue, sckY) - lParagraph.Y;
|
||||||
end
|
end
|
||||||
//else if lNodeName = 'id' then
|
//else if lNodeName = 'id' then
|
||||||
// lText.Name := lNodeValue
|
// lText.Name := lNodeValue
|
||||||
|
Loading…
Reference in New Issue
Block a user