VectorLib Coordinate Bug PB573
VectorLib Coordinate Bug PB573
VectorLib Coordinate Bug PB573
Here's an explanation, since it's all rather convoluted.
Now finally after developing the Vector based Rotate and Mirror tool my findings.
https://www.purebasic.fr/english/viewto ... 12&t=77009
Thread because the bug :
https://www.purebasic.fr/english/viewto ... =5&t=76988
A basic problem is that the coordinate origin is offset by one pixel.
So you have to set MovePathCursor(-1, -1) like this to get to zero.
Therefore the Vector output starts at 1, 1, not at 0, 0
This results in problems with truncated image edges when rotating, for example, because the drawing area is
ends 1 pixel outside a given plane.
You can compensate this by setting the path cursor accordingly.
Up to now, however, everyone had failed in the handling, because everything seems very suspect.
FlipCoordinates has a real bug.
I think it is due to the Vector Lib.
The coordinate origin shifts x and y by an amount of +-1, depending on the dimensions of the source plane.
For example, at 340*340 there is no offset, but at 420*420 there is. ( Try simple different values )
420*421 is OK 420*422 gives an offset,
422> then goes again, until at some point it doesn't. (As far as I can remember these sizes )
Horizontal mirroring, for example, gets an offset when the tarp is enlarged vertically and vice versa.
Absolutely no pattern or coherence can be found in this.
On Linux and Mac everything works fine, except that the zero coordinate is not correct either.
Here's an explanation, since it's all rather convoluted.
Now finally after developing the Vector based Rotate and Mirror tool my findings.
https://www.purebasic.fr/english/viewto ... 12&t=77009
Thread because the bug :
https://www.purebasic.fr/english/viewto ... =5&t=76988
A basic problem is that the coordinate origin is offset by one pixel.
So you have to set MovePathCursor(-1, -1) like this to get to zero.
Therefore the Vector output starts at 1, 1, not at 0, 0
This results in problems with truncated image edges when rotating, for example, because the drawing area is
ends 1 pixel outside a given plane.
You can compensate this by setting the path cursor accordingly.
Up to now, however, everyone had failed in the handling, because everything seems very suspect.
FlipCoordinates has a real bug.
I think it is due to the Vector Lib.
The coordinate origin shifts x and y by an amount of +-1, depending on the dimensions of the source plane.
For example, at 340*340 there is no offset, but at 420*420 there is. ( Try simple different values )
420*421 is OK 420*422 gives an offset,
422> then goes again, until at some point it doesn't. (As far as I can remember these sizes )
Horizontal mirroring, for example, gets an offset when the tarp is enlarged vertically and vice versa.
Absolutely no pattern or coherence can be found in this.
On Linux and Mac everything works fine, except that the zero coordinate is not correct either.
Last edited by Saki on Sun Apr 18, 2021 3:32 pm, edited 1 time in total.
地球上の平和
Re: VectorLib Zero Coordinate Bug PB573
How did you come to this conclusion?Saki wrote:A basic problem is that the coordinate origin is offset by one pixel.
So you have to set MovePathCursor(-1, -1) like this to get to zero.
Therefore the Vector output starts at 1, 1, not at 0, 0
In this example, the image is exactly drawn at (0,0) when I use MovePathCursor(0,0):
Code: Select all
Enumeration
#Window
#Gadget
#VectorImage
#Image
EndEnumeration
If CreateImage(#Image, 16, 16, 32, #PB_Image_Transparent)
If StartDrawing(ImageOutput(#Image))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(1,1,6,6,$FF00FF00)
Box(9,1,6,6,$FFFF0000)
Box(1,9,6,6,$FF0000FF)
StopDrawing()
EndIf
EndIf
If CreateImage(#VectorImage, 16, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#VectorImage))
MovePathCursor(0, 0)
DrawVectorImage(ImageID(#Image))
StopVectorDrawing()
EndIf
EndIf
ResizeImage(#VectorImage, ImageWidth(#VectorImage)*16, ImageHeight(#VectorImage)*16, #PB_Image_Raw)
OpenWindow(#Window, 0, 0, ImageWidth(#VectorImage), ImageHeight(#VectorImage), "MovePathCursor", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
ImageGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), ImageID(#VectorImage))
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
Here the box is drawn correctly, but not the image:
Code: Select all
Enumeration
#Window
#Gadget
#VectorImage
#Image
EndEnumeration
If CreateImage(#Image, 16, 16, 32, #PB_Image_Transparent)
If StartDrawing(ImageOutput(#Image))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(1,1,6,6,$FF00FF00)
Box(9,1,6,6,$FFFF0000)
Box(1,9,6,6,$FF0000FF)
StopDrawing()
EndIf
EndIf
If CreateImage(#VectorImage, 16, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#VectorImage))
RotateCoordinates(8, 8, 180)
MovePathCursor(0, 0)
DrawVectorImage(ImageID(#Image))
MovePathCursor(0, 0)
AddPathBox(1,1,14,14,#PB_Path_Relative)
VectorSourceColor($40808080)
FillPath()
StopVectorDrawing()
EndIf
EndIf
ResizeImage(#VectorImage, ImageWidth(#VectorImage)*16, ImageHeight(#VectorImage)*16, #PB_Image_Raw)
OpenWindow(#Window, 0, 0, ImageWidth(#VectorImage), ImageHeight(#VectorImage), "MovePathCursor", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
ImageGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), ImageID(#VectorImage))
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
You mide change your title.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: VectorLib Zero Coordinate Bug PB573
I agree with this, since the effect is then the same.
It's hard to see through what exactly is happening.
Keep in mind that, as far as I know, everyone has failed so far to get an error-free rotation.
It is important to start the discussion to define the error exactly.
Define it exactly.
Then try FlipCoordinates()
If you can uncover the mathematical relationships for the failure, you are the king on the balcony.
It's hard to see through what exactly is happening.
Keep in mind that, as far as I know, everyone has failed so far to get an error-free rotation.
It is important to start the discussion to define the error exactly.
Define it exactly.
Then try FlipCoordinates()
If you can uncover the mathematical relationships for the failure, you are the king on the balcony.
Last edited by Saki on Sat Apr 03, 2021 12:53 am, edited 1 time in total.
地球上の平和
Re: VectorLib Zero Coordinate Bug PB573
It is even more strange, because it seems like, some angles are working fine.
Here in this example I added a slider to change the rotation of coordinates between 85° and 95°.
Only 90° is drawed correctly. For larger or smaller angles you can see the "shift" by 1px.
Here in this example I added a slider to change the rotation of coordinates between 85° and 95°.
Only 90° is drawed correctly. For larger or smaller angles you can see the "shift" by 1px.
Code: Select all
Enumeration
#Window
#Gadget
#VectorImage
#Image
#TrackBarGadget
#TextGadget
EndEnumeration
Global Time.i = ElapsedMilliseconds()
If CreateImage(#Image, 16, 16, 32, #PB_Image_Transparent)
If StartDrawing(ImageOutput(#Image))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(1,1,6,6,$FF00FF00)
Box(9,1,6,6,$FFFF0000)
Box(1,9,6,6,$FF0000FF)
StopDrawing()
EndIf
EndIf
Procedure Update(Angle.i)
If CreateImage(#VectorImage, 16, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#VectorImage))
RotateCoordinates(8, 8, Angle)
MovePathCursor(0, 0)
DrawVectorImage(ImageID(#Image))
MovePathCursor(0, 0)
AddPathBox(1,1,14,14,#PB_Path_Relative)
VectorSourceColor($40808080)
FillPath()
StopVectorDrawing()
EndIf
EndIf
ResizeImage(#VectorImage, ImageWidth(#VectorImage)*16, ImageHeight(#VectorImage)*16, #PB_Image_Raw)
ImageGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), ImageID(#VectorImage))
EndProcedure
OpenWindow(#Window, 0, 0, 16*16, 16*16 + 30, "MovePathCursor", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
Update(90)
TrackBarGadget(#TrackBarGadget, 0, 16*16, 200, 30, 85, 95, #PB_TrackBar_Ticks)
SetGadgetState(#TrackBarGadget, 90)
TextGadget(#TextGadget, 200, 16*16, 56, 30, "90°")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #TrackBarGadget
Update(GetGadgetState(#TrackBarGadget))
SetGadgetText(#TextGadget, Str(GetGadgetState(#TrackBarGadget))+"°")
EndSelect
EndSelect
ForEver
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: VectorLib Zero Coordinate Bug PB573
Yes, it is.
I have tried to uncover the mathematical relationships:
Whenever I thought it was working, it occurred again:
After two days, I now have no nerfs for it.
So I thought I'd give my info and findings, since others may see things I'm missing.
The first and best step would probably be to update the Vector Lib under Windows OS.
I have tried to uncover the mathematical relationships:
Whenever I thought it was working, it occurred again:
After two days, I now have no nerfs for it.
So I thought I'd give my info and findings, since others may see things I'm missing.
The first and best step would probably be to update the Vector Lib under Windows OS.
地球上の平和
VectorLib Zero Coordinate Bug PB573
Hi STARGÅTE,
Nice method to test rotation; slightly modified your example.
Instead of chasing the missing pixels, it helped to follow the centre point.
Didn’t spend more then 10 minutes on it, so I’m not sure if this is the path to a complete resolution, but it seems to solve the rotation problem with this example.
Nice method to test rotation; slightly modified your example.
Instead of chasing the missing pixels, it helped to follow the centre point.
Didn’t spend more then 10 minutes on it, so I’m not sure if this is the path to a complete resolution, but it seems to solve the rotation problem with this example.
Code: Select all
Enumeration
#Window
#Gadget
#VectorImage
#Image
#TrackBarGadget
#TextGadget
EndEnumeration
If CreateImage(#Image, 16, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#Image))
AddPathBox(1, 1, 6, 6)
VectorSourceColor($FF00FF00)
FillPath()
AddPathBox(9, 1, 6, 6)
VectorSourceColor($FFFF0000)
FillPath()
AddPathCircle(8, 8, 1)
VectorSourceColor($FF000000)
FillPath()
AddPathBox(1, 9, 6, 6)
VectorSourceColor($FF0000FF)
FillPath()
AddPathBox(9, 9, 6, 6)
VectorSourceColor($FF00FFFF)
FillPath()
StopVectorDrawing()
EndIf
EndIf
Procedure Update(Angle.d)
If CreateImage(#VectorImage, 16, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#VectorImage))
Select Angle
Case 90
RotateCoordinates(8, 8, Angle)
Case 180
RotateCoordinates(7.5, 7.5, Angle - 0.1)
Default
RotateCoordinates(7.5, 7.5, Angle)
EndSelect
MovePathCursor(0, 0)
DrawVectorImage(ImageID(#Image))
StopVectorDrawing()
EndIf
EndIf
ResizeImage(#VectorImage, ImageWidth(#VectorImage) * 16, ImageHeight(#VectorImage) * 16, #PB_Image_Raw)
ImageGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), ImageID(#VectorImage))
EndProcedure
OpenWindow(#Window, 0, 0, 16 * 16, 16 * 16 + 40, "RotateCoordinates", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
Update(180)
TrackBarGadget(#TrackBarGadget, 10, 16 * 16, 200, 30, 0, 360, #PB_TrackBar_Ticks)
SetGadgetState(#TrackBarGadget, 180)
TextGadget(#TextGadget, 210, 16 * 16, 56, 30, "180°")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #TrackBarGadget
Update(GetGadgetState(#TrackBarGadget))
SetGadgetText(#TextGadget, Str(GetGadgetState(#TrackBarGadget)) + "°")
EndSelect
EndSelect
ForEver
Re: VectorLib Zero Coordinate Bug PB573
After all, rotating was not the problem.
The problem was that you can't mirror images of any size.
The problem was that you can't mirror images of any size.
地球上の平和
VectorLib Zero Coordinate Bug PB573
viewtopic.php?p=568240#p568240Saki/walbus wrote:After all, rotating was not the problem.
viewtopic.php?p=568242#p568242Saki/walbus wrote:This results in problems with truncated image edges when rotating
viewtopic.php?p=568244#p568244STARGÅTE wrote:On the other hand you are right, that something is strange during rotation
viewtopic.php?p=568245#p568245Saki/walbus wrote:Keep in mind that, as far as I know, everyone has failed so far to get an error-free rotation.
viewtopic.php?f=5&t=76988STARGÅTE wrote:Here in this example I added a slider to change the rotation of coordinates between 85° and 95°.
Only 90° is drawed correctly. For larger or smaller angles you can see the "shift" by 1px.
IdeasVacuum wrote:Vector Lib: Rotate: Lost Pixels
Re: VectorLib Zero Coordinate Bug PB573
As you may have noticed my rotation works, only the mirroring not.
Make a working all size mirroring !
Make a working all size mirroring !
地球上の平和
Re: VectorLib Zero Coordinate Bug PB573
Maybe the following example can help correct the problem in future releases of PureBasic.
Sticking with the same principle of a half pixel discrepancy, FlipX/Y was included to work naturally with degrees of 0, 90, 180, 270, 360.
- didn’t spend more then 30 minutes on it, so I’m not sure if this is the path to a complete resolution.
Sticking with the same principle of a half pixel discrepancy, FlipX/Y was included to work naturally with degrees of 0, 90, 180, 270, 360.
- didn’t spend more then 30 minutes on it, so I’m not sure if this is the path to a complete resolution.
Code: Select all
Enumeration
#Window
#Gadget
#VectorImage
#Image
#TrackBarGadget
#TextGadget
#CheckBoxGadget1
#CheckBoxGadget2
EndEnumeration
If CreateImage(#Image, 16, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#Image))
AddPathBox(1, 1, 6, 6)
VectorSourceColor($FF00FF00)
FillPath()
AddPathBox(9, 1, 6, 6)
VectorSourceColor($FFFF0000)
FillPath()
AddPathCircle(8, 8, 1)
VectorSourceColor($FF000000)
FillPath()
AddPathBox(1, 9, 6, 6)
VectorSourceColor($FF0000FF)
FillPath()
AddPathBox(9, 9, 6, 6)
VectorSourceColor($FF00FFFF)
FillPath()
StopVectorDrawing()
EndIf
EndIf
Procedure Update(Angle.d)
FlipX = GetGadgetState(#CheckBoxGadget1)
FlipY = GetGadgetState(#CheckBoxGadget2)
If CreateImage(#VectorImage, 16, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#VectorImage))
Select #True
Case Bool(Angle = 180)
RotateCoordinates(7.5, 7.5, Angle - 0.1)
Case Bool(Angle = 360 And (FlipX Or FlipY))
RotateCoordinates(7.5, 7.5, Angle - 0.1)
Default
RotateCoordinates(7.5, 7.5, Angle)
EndSelect
Select Angle
Case 0
Select #True
Case Bool(FlipX And FlipY)
FlipCoordinatesX(8)
FlipCoordinatesY(8)
Case FlipX
FlipCoordinatesX(8)
Case FlipY
FlipCoordinatesY(8)
EndSelect
Case 90
Select #True
Case Bool(FlipX And FlipY)
FlipCoordinatesX(8)
FlipCoordinatesY(7.5)
FlipCoordinatesX(8)
FlipCoordinatesY(8)
Case FlipX
FlipCoordinatesX(8)
FlipCoordinatesY(7.5)
FlipCoordinatesY(8)
Case FlipY
FlipCoordinatesY(7.5)
Default
FlipCoordinatesX(8)
FlipCoordinatesY(7.5)
EndSelect
Case 270
Select #True
Case Bool(FlipX And FlipY)
FlipCoordinatesX(7.5)
FlipCoordinatesY(7.5)
Case FlipX
FlipCoordinatesY(7.5)
Case FlipY
FlipCoordinatesX(7.5)
EndSelect
Default
Select #True
Case Bool(FlipX And FlipY)
FlipCoordinatesX(7.5)
FlipCoordinatesY(7.5)
Case FlipX
FlipCoordinatesX(7.5)
Case FlipY
FlipCoordinatesY(7.5)
EndSelect
EndSelect
MovePathCursor(0, 0)
DrawVectorImage(ImageID(#Image))
StopVectorDrawing()
EndIf
EndIf
ResizeImage(#VectorImage, ImageWidth(#VectorImage) * 16, ImageHeight(#VectorImage) * 16, #PB_Image_Raw)
ImageGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), ImageID(#VectorImage))
EndProcedure
OpenWindow(#Window, 0, 0, 16 * 16, 16 * 16 + 80, "RotateCoordinates", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
TrackBarGadget(#TrackBarGadget, 10, 16 * 16, 200, 30, 0, 360, #PB_TrackBar_Ticks)
SetGadgetState(#TrackBarGadget, 180)
TextGadget(#TextGadget, 210, 16 * 16, 56, 30, "180°")
CheckBoxGadget(#CheckBoxGadget1, 50, 16 * 16 + 40, 60, 20, "Flip X")
CheckBoxGadget(#CheckBoxGadget2, 150, 16 * 16 + 40, 60, 20, "Flip Y")
Update(180)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #TrackBarGadget
Update(GetGadgetState(#TrackBarGadget))
SetGadgetText(#TextGadget, Str(GetGadgetState(#TrackBarGadget)) + "°")
Case #CheckBoxGadget1, #CheckBoxGadget2
Update(GetGadgetState(#TrackBarGadget))
EndSelect
EndSelect
ForEver
Re: VectorLib Zero Coordinate Bug PB573
I don't know now if the behavior with AddPathBox() is the same as with DrawVectorImage()
With DrawVectorImage() the offset changes depending on the width and height of the image completely unpredictable, that's the problem.
Even if you mirror horizontally, the vertical offset changes when the image height changes.
But not with every change.
The values where this happens cannot be calculated.
With DrawVectorImage() the offset changes depending on the width and height of the image completely unpredictable, that's the problem.
Even if you mirror horizontally, the vertical offset changes when the image height changes.
But not with every change.
The values where this happens cannot be calculated.
地球上の平和
Re: VectorLib Zero Coordinate Bug PB573
Not sure what your animation is proving?
This next example modifies the width of the vector image and its rotation center point and flip X coordinate; fix of a half pixel discrepancy still applies.
Obviously this doesn't take all images sizes into consideration, but it is a starting point.
The example provided by STARGÅTE creates an image with AddPathBox, but DrawVectorImage is used during the rotation, that was the point.Saki/walbus wrote:I don't know now if the behavior with AddPathBox() is the same as with DrawVectorImage()
With DrawVectorImage() the offset changes depending on the width and height of the image completely unpredictable, that's the problem.
My previous examples proves that DrawVectorImage of equal sizes can be calculated and fixed.STARGÅTE wrote:... something is strange during rotation, but it is an issue with DrawVectorImage().
Here the box is drawn correctly, but not the image:
This next example modifies the width of the vector image and its rotation center point and flip X coordinate; fix of a half pixel discrepancy still applies.
Obviously this doesn't take all images sizes into consideration, but it is a starting point.
Code: Select all
Enumeration
#Window
#Gadget
#VectorImage
#Image
#TrackBarGadget
#TextGadget
#CheckBoxGadget1
#CheckBoxGadget2
EndEnumeration
If CreateImage(#Image, 32, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#Image))
AddPathBox(1, 1, 12, 6)
VectorSourceColor($FF00FF00)
FillPath()
AddPathBox(19, 1, 12, 6)
VectorSourceColor($FFFF0000)
FillPath()
AddPathCircle(16, 8, 1)
VectorSourceColor($FF000000)
FillPath()
AddPathBox(1, 9, 12, 6)
VectorSourceColor($FF0000FF)
FillPath()
AddPathBox(19, 9, 12, 6)
VectorSourceColor($FF00FFFF)
FillPath()
StopVectorDrawing()
EndIf
EndIf
Procedure Update(Angle.d)
FlipX = GetGadgetState(#CheckBoxGadget1)
FlipY = GetGadgetState(#CheckBoxGadget2)
If CreateImage(#VectorImage, 32, 16, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#VectorImage))
Select #True
Case Bool(Angle = 180)
RotateCoordinates(15.5, 7.5, Angle - 0.1)
Case Bool(Angle = 360 And (FlipX Or FlipY))
RotateCoordinates(15.5, 7.5, Angle - 0.1)
Default
RotateCoordinates(15.5, 7.5, Angle)
EndSelect
Select Angle
Case 0
Select #True
Case Bool(FlipX And FlipY)
FlipCoordinatesX(16)
FlipCoordinatesY(8)
Case FlipX
FlipCoordinatesX(16)
Case FlipY
FlipCoordinatesY(8)
EndSelect
Case 90
Select #True
Case Bool(FlipX And FlipY)
FlipCoordinatesX(16)
FlipCoordinatesY(7.5)
FlipCoordinatesX(16)
FlipCoordinatesY(8)
Case FlipX
FlipCoordinatesX(16)
FlipCoordinatesY(7.5)
FlipCoordinatesY(8)
Case FlipY
FlipCoordinatesY(7.5)
Default
FlipCoordinatesX(16)
FlipCoordinatesY(7.5)
EndSelect
Case 270
Select #True
Case Bool(FlipX And FlipY)
FlipCoordinatesX(15.5)
FlipCoordinatesY(7.5)
Case FlipX
FlipCoordinatesY(7.5)
Case FlipY
FlipCoordinatesX(15.5)
EndSelect
Default
Select #True
Case Bool(FlipX And FlipY)
FlipCoordinatesX(15.5)
FlipCoordinatesY(7.5)
Case FlipX
FlipCoordinatesX(15.5)
Case FlipY
FlipCoordinatesY(7.5)
EndSelect
EndSelect
MovePathCursor(0, 0)
DrawVectorImage(ImageID(#Image))
StopVectorDrawing()
EndIf
EndIf
ResizeImage(#VectorImage, ImageWidth(#VectorImage) * 16, ImageHeight(#VectorImage) * 16, #PB_Image_Raw)
ImageGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), ImageID(#VectorImage))
EndProcedure
OpenWindow(#Window, 0, 0, 16 * 32, 16 * 16 + 80, "RotateCoordinates", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
TrackBarGadget(#TrackBarGadget, 10, 16 * 16, 200, 30, 0, 360, #PB_TrackBar_Ticks)
SetGadgetState(#TrackBarGadget, 180)
TextGadget(#TextGadget, 210, 16 * 16, 56, 30, "180°")
CheckBoxGadget(#CheckBoxGadget1, 50, 16 * 16 + 40, 60, 20, "Flip X")
CheckBoxGadget(#CheckBoxGadget2, 150, 16 * 16 + 40, 60, 20, "Flip Y")
Update(180)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #TrackBarGadget
Update(GetGadgetState(#TrackBarGadget))
SetGadgetText(#TextGadget, Str(GetGadgetState(#TrackBarGadget)) + "°")
Case #CheckBoxGadget1, #CheckBoxGadget2
Update(GetGadgetState(#TrackBarGadget))
EndSelect
EndSelect
ForEver
Last edited by JHPJHP on Sun Apr 04, 2021 9:46 pm, edited 1 time in total.
Re: VectorLib Zero Coordinate Bug PB573
Well, you can see the problem in the gif.
There is no way to predict when which offset is needed.
Under Linux and Mac there is no problem, no offset is needed.
There is no way to predict when which offset is needed.
Under Linux and Mac there is no problem, no offset is needed.
地球上の平和
VectorLib Zero Coordinate Bug PB573
I'm done testing, but for anyone interested, logic would dictate (if my examples hold true) that any image of varying width and height can be placed into an image of equal width and height.
The patch used in my second post should compensate for the discrepancy during rotation and flip; no predicting necessary.
The patch used in my second post should compensate for the discrepancy during rotation and flip; no predicting necessary.
Re: VectorLib Zero Coordinate Bug PB573
Unfortunately, I do not believe it.
I had tried all conceivable variants.
In the end, it was just annoying and time consuming.
I think, the lib should be updated.
But anyway, many thanks for your effort.
I had tried all conceivable variants.
In the end, it was just annoying and time consuming.
I think, the lib should be updated.
But anyway, many thanks for your effort.
地球上の平和