- I design games on Canvas.
- Now, I can load images and draw them onto screen. And I can load pixel data to handle, change color by using getRGB(rgb, 0, imageWidth, 0, 0, imageWidth, imageHeight).
- But I think this way is not good, because it use a lot memory when I get RGB data of an image. Now, I want to know:
1. There are any other ways to change color of an image.
2. How is an image stored in my Apps.
3. I think that when I load an image using Image.createImage(string). It will load data of the image, it load color index of each pixel, right? and color index will determine RGB value in color palette.
EX: one is an index to determine yellow color(it mean one is color index and yellow is RGB value); and when I use Image.createImage(string), it will store one, not yellow (it mean this method create an image with pixel data is color index, not RGB value). this is right or wrong? if my idea is right, and I want to change color of an image, I can replace yellow with other color on color palette. And it will spend a little memory. Is it right or wrong?
Thankyou and best regards,
Pham Son Truong