How to draw a line

Obtain a canvas and a line primitive (with the configured default style).
OpenMap4u om4u = new OpenMap4u();
...
SetAreaOfInterestOrDrawOrWriteable myCanvas =  om4u.getCanvas(4, 1);
...
Line myLine = om4u.get(Line.class);
Set the line from a start to an end point (xStart, yStart, xEnd, yEnd).
myLine.line(.25, .125, 3.75, 0.75);
 
Draw the line
myCanvas.draw(myLine);
Write the result
canvas.write("myLine.png");
Which results in the following output.
the result
But wait you can do it much faster and simpler with the fluent builder pattern
myCanvas.draw(
  om4u.get(Line.class).line(.25, .125, 3.75, 0.75)
).write("myLine.png");