index.html
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="//riccardoscalco.github.io/textures/textures.min.js"></script>
<style>
body{
margin:0;
padding:0;
}
</style>
</head>
<body>
<svg width=960 height=500 style="background:lightblue">
<rect class="shape" width=200 height=200 x=100 y=100 style="fill:white">
</rect>
<circle class="shape" cx=100 cy=100 r=177 style="fill:white">
</circle>
</svg>
<script>
var t = textures.lines().thicker();
d3.select("svg").call(t);
d3.select(".shape").style("fill", t.url());
</script>
</body>