{"action":"created","issue":{"url":"https://api.github.com/repos/openlayers/ol3/issues/4241","labels_url":"https://api.github.com/repos/openlayers/ol3/issues/4241/labels{/name}","comments_url":"https://api.github.com/repos/openlayers/ol3/issues/4241/comments","events_url":"https://api.github.com/repos/openlayers/ol3/issues/4241/events","html_url":"https://github.com/openlayers/ol3/pull/4241","id":110603929,"number":4241,"title":"Add generic Fill rendering as per #2208","user":{"login":"RouquinBlanc","id":12514040,"avatar_url":"https://avatars.githubusercontent.com/u/12514040?v=3","gravatar_id":"","url":"https://api.github.com/users/RouquinBlanc","html_url":"https://github.com/RouquinBlanc","followers_url":"https://api.github.com/users/RouquinBlanc/followers","following_url":"https://api.github.com/users/RouquinBlanc/following{/other_user}","gists_url":"https://api.github.com/users/RouquinBlanc/gists{/gist_id}","starred_url":"https://api.github.com/users/RouquinBlanc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RouquinBlanc/subscriptions","organizations_url":"https://api.github.com/users/RouquinBlanc/orgs","repos_url":"https://api.github.com/users/RouquinBlanc/repos","events_url":"https://api.github.com/users/RouquinBlanc/events{/privacy}","received_events_url":"https://api.github.com/users/RouquinBlanc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-09T07:42:24Z","updated_at":"2016-01-05T02:01:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openlayers/ol3/pulls/4241","html_url":"https://github.com/openlayers/ol3/pull/4241","diff_url":"https://github.com/openlayers/ol3/pull/4241.diff","patch_url":"https://github.com/openlayers/ol3/pull/4241.patch"},"body":"Hi,\r\n\r\nThis adds the capability for an ol.style.Fill to render something else than a simple color.\r\n\r\nTaking as a building block the MrPl0p and his nice https://github.com/MrPl0p/ol3-aswcr as discussed in  #2208, I extracted all the image processing and simply added a 'renderer' function, which can fill in anything.\r\n\r\nFor example, look at what it does if you want filling with stripes:\r\nhttp://jsfiddle.net/dykko7mw/1/\r\n![screen shot 2015-10-09 at 09 37 41](https://cloud.githubusercontent.com/assets/12514040/10388358/7c8cb636-6e69-11e5-9787-077b74033e8e.png)\r\n\r\nThe code would be:\r\n\r\n```js\r\n...\r\nnew ol.style.Fill({\r\n    renderer: makeRedStripes\r\n});\r\n\r\nfunction makeRedStripes (context_) {\r\n    var height = 100,\r\n        width  = 56,\r\n        x,\r\n        ctx,\r\n    $pattern = $('<canvas>')\r\n        .attr('height', height)\r\n        .attr('width', width)[0];\r\n\r\n    ctx = $pattern.getContext('2d');\r\n    ctx.strokeStyle = 'rgba(255, 0, 0, 0.15)';\r\n    ctx.lineWidth = 3;\r\n\r\n    x = 0;\r\n    while(x < width * 2) {\r\n        ctx.beginPath();\r\n        ctx.moveTo(ctx.lineWidth + x, - 1);\r\n        ctx.lineTo(ctx.lineWidth + x - 50, height + 1);\r\n        ctx.stroke();\r\n        x += 7;\r\n    }\r\n    \r\n    return context_.createPattern($pattern, 'repeat');\r\n}\r\n...\r\n```\r\n\r\nNot sure if it can be integrated this way directly, but at least it gives you guys a base to work on.\r\nThanks for all the great work on OL3!\r\n\r\nCheers\r\nJonathan"},"comment":{"url":"https://api.github.com/repos/openlayers/ol3/issues/comments/168870145","html_url":"https://github.com/openlayers/ol3/pull/4241#issuecomment-168870145","issue_url":"https://api.github.com/repos/openlayers/ol3/issues/4241","id":168870145,"user":{"login":"bjnsn","id":791610,"avatar_url":"https://avatars.githubusercontent.com/u/791610?v=3","gravatar_id":"","url":"https://api.github.com/users/bjnsn","html_url":"https://github.com/bjnsn","followers_url":"https://api.github.com/users/bjnsn/followers","following_url":"https://api.github.com/users/bjnsn/following{/other_user}","gists_url":"https://api.github.com/users/bjnsn/gists{/gist_id}","starred_url":"https://api.github.com/users/bjnsn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjnsn/subscriptions","organizations_url":"https://api.github.com/users/bjnsn/orgs","repos_url":"https://api.github.com/users/bjnsn/repos","events_url":"https://api.github.com/users/bjnsn/events{/privacy}","received_events_url":"https://api.github.com/users/bjnsn/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T02:01:06Z","updated_at":"2016-01-05T02:01:06Z","body":"@ahocevar Added pull-request (https://github.com/RouquinBlanc/ol3/pull/1) to @RouquinBlanc's repository which I believe addresses the concern about this pull-request you noted in <a href=\"#issuecomment-149038204\">your comment</a> \r\n\r\n"}}