In 77f9154 under Linux/GTK3, I am not seeing any graph.
With the changes in simlei@3f48a73 I am seeing a graph. The reason for it not to draw anything must be in using different GC (graphical context) objects with different scaling. This does seem to work under Windows, but not under Linux/GTK3/Cairo.
The newly obtained results on that test branch, however, look like this:

Under windows we have had similar problems. @grthor, do you remember something about that and how it was solved?
I suspect the jagged edges to result from line-with zero which is indicated as the "fastest method": Compare javadoc here: https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html#setLineWidth(int)
If I explicitely setLineWidth(1) e.g., I am getting a smooth, albeit way too thick curve.
And the reason for that is, I suspect, the per-GC-scaling (setTransformation) on multiple GC. When the scaling is too high, the line gets too thick.
Since solving the line thickness easily would require SWT to accept floating-point line thickness -- which it does not -- the only alternative is to scale the curve mathematically, in image space.
I.e. in the code, the polynomial coefficients have to be adapted to the pixel space of the image when rendering. This is for now left to the eager reader as an exercise and may be explored in further versions of this issue :)
First off, though, I need consistent behavior across Linux/GTK3 + Windows.
In 77f9154 under Linux/GTK3, I am not seeing any graph.
With the changes in simlei@3f48a73 I am seeing a graph. The reason for it not to draw anything must be in using different
GC(graphical context) objects with different scaling. This does seem to work under Windows, but not under Linux/GTK3/Cairo.The newly obtained results on that test branch, however, look like this:
Under windows we have had similar problems. @grthor, do you remember something about that and how it was solved?
I suspect the jagged edges to result from line-with zero which is indicated as the "fastest method": Compare javadoc here: https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html#setLineWidth(int)
If I explicitely
setLineWidth(1)e.g., I am getting a smooth, albeit way too thick curve.And the reason for that is, I suspect, the per-GC-scaling (
setTransformation) on multiple GC. When the scaling is too high, the line gets too thick.Since solving the line thickness easily would require SWT to accept floating-point line thickness -- which it does not -- the only alternative is to scale the curve mathematically, in image space.
I.e. in the code, the polynomial coefficients have to be adapted to the pixel space of the image when rendering. This is for now left to the eager reader as an exercise and may be explored in further versions of this issue :)
First off, though, I need consistent behavior across Linux/GTK3 + Windows.