Setting the value of Graphics.Scale doesn’t work as I would expect. It appears to be a “running value”.
- If I set the scale to 2.0 and draw, I expect the size to be doubled. It is.
- If I then set the scale to 1.0 and draw, I expect the size to be normal. It’s not. It’s still doubled.
- The solution I found is to “revert” 2.0 to 1.0 by scaling 0.5, which means setting it to 1.0 doesn’t do anything, because what it does is apply the given value to the current value (running value).
That can’t be right. There’s no way to read the scale values and there’s nothing about this unusual behaviour in the LR. Here’s my test code (Xojo2024r3, Mac Studio M1):
// Draw a red square at scale 1x
g.DrawingColor = Color.Red
g.DrawRectangle( 0,0, 100,100 )
// Draw a blue square at scale 2x
g.Scale( 2.0 ,2.0 )
g.DrawingColor = Color.Blue
g.DrawRectangle( 2,2, 100,100 )
// Draw a green square at scale 1x
'g.Scale( 1.0 ,1.0 ) // <-- This doesn't work
g.Scale( 0.5 ,0.5 ) // <-- This works
g.DrawingColor = Color.Green
g.DrawRectangle( 4,4, 100,100 )
EDIT: after posting this I found elsewhere on the forum that apparently .Scale is part of .Translate … and then the above behaviour makes sense, sort of … But it’s not in the LR (!)
2 posts - 1 participant