Sign in to follow this  

Getting the pixel data of a sprite after scale, filter etc

Recommended Posts

I know how to get the raw pixel data of the original texture of an image sprite, but is there a way to get the pixel data of the sprite just before it is composited with all of the other elements, but after it has been altered by scaling, filters, etc?

renderer.extract.pixels(mysprite) seems to just return the original texture no matter what transformations have been performed on the sprite.

Share this post

Link to post
Share on other sites

I'm writing this as a favor for a public school teacher.

I have an image of a geographical map with a bunch of "hot" areas that I want to be able to individually detect clicks on.

My plan is to use different bitmap masks to represent each different area so they can scale to fit the browser window bounds along with the image. Then I was going to use pixels() to detect the alpha values of the mask pixel the mouse cursor is over.

Is there a smarter way to do arbitrary click-area detection that doesn't use pixels()?

Thank you for your help! 

Share this post

Link to post
Share on other sites

yes, i should, all resizes are handled with coordinates transformation (toLocal/toGlobal stuff)

in case something fails, check if interactionManager actually has correct coords of mouse, "renderer.plugins.interaction.somethingsomething" , you can override positioning function if you need :

Edited by ivan.popelyshev

Share this post

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.