Changing graphics within an array
BlitzMax Forums/BlitzMax Programming/Changing graphics within an array
| ||
Hi guys! Working on a project that has me stumped (obviously, or else I wouldn't be asking for help!). I've got an array with different graphic objects loaded into it (using GrabPixMap). How can I change the color of an graphic within the array? Do I have to draw something out in a backbuffer and re-grab it, or is there a way to change the pixel colors without going thru all that? BTW, it's just two-color graphical images stuffed into this array. Any help would be appreciated! |
| ||
You'd have to convert a TImage to a Pixmap (see LockImage()), then modify it manually pixel-by-pixel, then UnlockImage(). |
| ||
If they're simple two-colour images, then wouldn't SetColor() be adequate? |
| ||
Use ReadPixel to figure out what color the pixel currently is, and WritePixel to change it to something else. If you truly have your graphic in an array, you can also change values directly with e.g. MyPictures[15] would be the 16th pixel. It depends if you made it a byte array or an int array as to how you'd read and alter them. |