Change color of image pixel #1386
-
Is there a way to set the pixel color of an image other than shaders? Thanks for the help. |
Beta Was this translation helpful? Give feedback.
Answered by
RobDangerous
Jan 13, 2022
Replies: 1 comment 1 reply
-
You can use lock/unlock to change an image but you have to write all the pixels and don't get access to their old values that way. You can access the original data by calling Image.at when the image is set to readable (see https://github.com/Kha-Samples/TPlayer/blob/master/khafile.js for how to do that for images that are handled by the Assets class). But all of that is highly discouraged because it is super-slow, use shaders instead if you can. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
RobDangerous
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use lock/unlock to change an image but you have to write all the pixels and don't get access to their old values that way. You can access the original data by calling Image.at when the image is set to readable (see https://github.com/Kha-Samples/TPlayer/blob/master/khafile.js for how to do that for images that are handled by the Assets class). But all of that is highly discouraged because it is super-slow, use shaders instead if you can.