{"action":"created","issue":{"url":"https://api.github.com/repos/paperjs/paper.js/issues/735","labels_url":"https://api.github.com/repos/paperjs/paper.js/issues/735/labels{/name}","comments_url":"https://api.github.com/repos/paperjs/paper.js/issues/735/comments","events_url":"https://api.github.com/repos/paperjs/paper.js/issues/735/events","html_url":"https://github.com/paperjs/paper.js/issues/735","id":96224989,"number":735,"title":"Blend Modes are lost when rasterising","user":{"login":"nicholaswmin","id":3926463,"avatar_url":"https://avatars.githubusercontent.com/u/3926463?v=3","gravatar_id":"","url":"https://api.github.com/users/nicholaswmin","html_url":"https://github.com/nicholaswmin","followers_url":"https://api.github.com/users/nicholaswmin/followers","following_url":"https://api.github.com/users/nicholaswmin/following{/other_user}","gists_url":"https://api.github.com/users/nicholaswmin/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholaswmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholaswmin/subscriptions","organizations_url":"https://api.github.com/users/nicholaswmin/orgs","repos_url":"https://api.github.com/users/nicholaswmin/repos","events_url":"https://api.github.com/users/nicholaswmin/events{/privacy}","received_events_url":"https://api.github.com/users/nicholaswmin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-21T04:40:10Z","updated_at":"2015-07-23T09:52:40Z","closed_at":null,"body":"#### Test case ####\r\n\r\n- Create an element (e.g a `Circle`)\r\n- Create another element (e.g a `Rectangle`)\r\n- Make sure the 2 items overlap\r\n- Set `blendMode` of overlapping element(top-most) to e.g: *'destination-out'*\r\n\r\n- Rasterise both elements\r\n- Remove the original elements keeping only their raster copies\r\n\r\n##### Expected Result ####\r\n- The top-most element should appear to be erasing the bottom element (due to `destination-out` blend-mode). \r\n\r\n##### Actual Result ####\r\n- Top-most element does not erase the bottom element\r\n- **Rasters do not retain the blend-mode property.**\r\n\r\n=====\r\n\r\n#### Test Sketch ####\r\n\r\nhttp://sketch.paperjs.org/#S/VVLBbqMwEP2VERfSKE2yUntJtYc05RCpTapAL116MDAJVuwxMt4i7Wr/fceGlgSkEfjNmzczz38jEhqjVZSe0ZV1NItKU/n/xXSaE0whfnxOdk/wsn9KUnjepxnsd3BYp1ly2L6vs+1+F0OW8PFmnSaBEcKWQBDg8WisA2dA6saaTwSLVKGVdIIGLYNaUImzntMxLFrH8B8EoRSgQo3kWuhqJKgMIVRWdJ7tatSBJKjiotrX5jNpwVh5kiQUlKaR2M7HnrIaYZumb8kKHhX3cat51BZaRO1bLBCUaV2fe/EY8pWH1oaqOU0XOeW0WAQIS+e77wSFYZFzMadPYXvoJxB28CpcPT/wv6CTwsmP++UMOADH5TKEm4ecPGF+lEptjDKWqXGhRHmOH0a52NfnJcSheq8TJO2l0kba8lrmjr/ug0iffS1jsYpHqPALeuH9eIi35HilThq6Nb/dVy+HwSzvR2FcPU7cI0wN03ybOvHaY7ffWYPmdV5Q8MYOdo/GNjweSIe6HdbV+z+5mOzixL98rQuL4twYydcpWv36+Pcf\r\n \r\n=====\r\n\r\n#### Notes ####\r\n\r\n- As a performance optimisation, I `rasterise()` all elements on my board and retain only their `Raster` copies(I remove the original elements).\r\n- I tried here to build an Eraser Tool, using the `blendMode: 'destination-out'` trick.\r\n- When I `rasterize()` the eraser paths and removed the original `Path`, the `blendMode` property no longer applied thus the erasing was lost\r\n\r\n\r\nThanks\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/paperjs/paper.js/issues/comments/124037394","html_url":"https://github.com/paperjs/paper.js/issues/735#issuecomment-124037394","issue_url":"https://api.github.com/repos/paperjs/paper.js/issues/735","id":124037394,"user":{"login":"lehni","id":213275,"avatar_url":"https://avatars.githubusercontent.com/u/213275?v=3","gravatar_id":"","url":"https://api.github.com/users/lehni","html_url":"https://github.com/lehni","followers_url":"https://api.github.com/users/lehni/followers","following_url":"https://api.github.com/users/lehni/following{/other_user}","gists_url":"https://api.github.com/users/lehni/gists{/gist_id}","starred_url":"https://api.github.com/users/lehni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lehni/subscriptions","organizations_url":"https://api.github.com/users/lehni/orgs","repos_url":"https://api.github.com/users/lehni/repos","events_url":"https://api.github.com/users/lehni/events{/privacy}","received_events_url":"https://api.github.com/users/lehni/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T09:52:40Z","updated_at":"2015-07-23T09:52:40Z","body":"That's not a bug. It happens because the blend modes are used when rasterizing each item individually. The resulting rasters have their #blendMode set to normal. If you put them together into a group and raster the group, you'll get the correct appearance. Since that's not what you want, I'd suggest rasterizing them both with blendMode set to normal, then setting the eraser's blendMode afterwards on the resulting raster.\r\n\r\nWould that work for you?"}}