Thank netmaestro, believe me it happens. I tried some squares on different parts of the screen and colors are all alright.
It's not a problem of color but a problem of geometry. Because squares are displayed as rectangles.
Thank Little John, i tried your advice, but it's the same problem.
->
Squares are displayed as rectangles and rectangles (using my excentricity variable, see the code under please) are shown as squares.
-> I've used the
parametric equation of circle, see the code under please -> same problem.
-> I've used CanvasVectorOutput() with
#PB_Unit_Pixel, #PB_Unit_Point, #PB_Unit_Inch and #PB_Unit_Millimeter -> same problem.
-> I've used the
windows api with gDrawing_v0.85b2, here
viewtopic.php?t=46987 -> same problem.
-> i've used the
Bresenham's algorithm and the Andre's algorithm, here
https://www.purebasic.fr/french/viewtop ... =6&t=11172 -> same problem.
So, i guess it's not a purebasic problem.
I guess Windows or the graphic card driver do something during the execution of the .exe...
But it's a problem.
Maybe, pixels are displayed as rectangle and not as a square ?
How can i code this thing to know that ?
Code: Select all
; OS = Windows
; dpiX=1.0, dpiY=1.0, compiled with the option dpi aware or not.
; zoom 100%
; Resolution: 1024x768
ExamineDesktops()
ResolutionX.d=DesktopWidth(0)
ResolutionY.d=DesktopHeight(0)
Excentricity.d = ResolutionY/ResolutionX
; Excentricity.d = 1.0
If OpenWindow(0, 0, 0, 600, 600, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 600, 600)
If StartVectorDrawing(CanvasVectorOutput(0))
;cross
MovePathCursor(300,0)
AddPathLine(300, 600)
MovePathCursor(0,300)
AddPathLine(600, 300)
StrokePath(1)
;red circle -> shown as an ellipse in my screen
MovePathCursor(300, 300)
AddPathCircle(300, 300, 200)
VectorSourceColor(RGBA(255, 0, 0, 255))
StrokePath(3)
;blue ellipse -> shown as a circle !
MovePathCursor(300, 300)
AddPathEllipse(300, 300, 300*Excentricity, 300)
VectorSourceColor(RGBA(0, 0, 255, 255))
StrokePath(3)
;marroon square shown as a rectangle
AddPathBox(50, 50, 200, 200)
VectorSourceColor(RGBA(128, 0, 0, 255))
StrokePath(3)
;Yellow rectangle shown as a square
AddPathBox(50, 50, 200*Excentricity, 200)
VectorSourceColor(RGBA(255, 255, 0, 255))
StrokePath(3)
StopVectorDrawing()
EndIf
;green Parametric equations of circle -> shown as an ellipse
StartDrawing(CanvasOutput(0))
i.d=0
Repeat
a.d=Radian(i)
x.d = 300 + 195*Cos(a)
y.d = 300 + 195*Sin(a)
Circle(x,y,2,#Green)
i=i+1
Until i>360
;magenta Parametric equations of ellipse -> shown as a circle
i.d=0
Repeat
a.d=Radian(i)
x.d = 300 + 190*Cos(a)*Excentricity
y.d = 300 + 190*Sin(a)
Circle(x,y,2,#Magenta)
i=i+1
Until i>360
StopDrawing()
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
Thanks.
M.