Ianmh Posted October 4, 2017 Share Posted October 4, 2017 Is it possible with or without pixi.js to calculate the number of transparent or solid pixels for a given x/y position? My use case is that I have random trees and I want to calculate the width of their trunk at the base of the tree. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 4, 2017 Share Posted October 4, 2017 If you want access to pixels, its better to save the texture into html5 canvas2d context first, you can manipulate it through https://developer.mozilla.org/ru/docs/Web/API/CanvasRenderingContext2D/getImageData , and then just import into pixi with "BaseTexture.fromCanvas(myCanvas)" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.