Update . Since this answer was posted, now (starting from 2015/02) there is a local setTransform() in the CanvasPattern instance CanvasPattern (see specifications ). It may not be available in all browsers (only Firefox supports it when it was written).
Method 1
You can compensate for the main canvas and add the delta value to the actual position of the line:
var offsetX = 10, offsetY = 10; ctx.translate(offsetX, offsetY); ctx.lineTo(x - offsetX, y - offsetY);
Example
(The demo only shows the transformed pattern, but of course you usually move the line along with it).

etc .. so you cancel the transfer for the line itself. But it introduces some overhead, since the coordinates must be calculated every time if you can not cache the resulting value.
Method 2
Another way I can think of is to create a sample template. That is, for the canvas of the template, repeat the point so that when you move it beyond its border, it repeats in the opposite direction.
For example, the first square is a normal template, the second is an offset template described as method two, and the third image uses an offset template to fill, indicating that it will work.
The key is that the two patterns are the same size and the first pattern is repeated in this second version. The second version can be used as a fill on the main one.
Example 2
Animated Example 3

var ctx = demo.getContext('2d'), pattern; // create the pattern ctx.fillStyle = 'red'; ctx.arc(25, 25, 22, 0, 2*Math.PI); ctx.fill(); // offset and repeat first pattern to base for second pattern ctx = demo2.getContext('2d'); pattern = ctx.createPattern(demo, 'repeat'); ctx.translate(25, 25); ctx.fillStyle = pattern; ctx.fillRect(-25, -25, 50, 50); // use second pattern to fill main canvas ctx = demo3.getContext('2d'); pattern = ctx.createPattern(demo2, 'repeat'); ctx.fillStyle = pattern; ctx.fillRect(0, 0, 200, 200);