How To create a Timage in realtime
BlitzMax Forums/BlitzMax Beginners Area/How To create a Timage in realtime
| ||
I mean, i dont want to load a pitmap and then make it a timage from it, i want to create an white oval for example, and make a timage from that oval so i can manipulate it in many ways. What is faster? to drawoval each frame or to make a timage from the oval drawn?. Thanks. |
| ||
Look at the CreateImage() and GrabImage() commands. I'd expect blitting an image to be faster than drawing a geometric shape but there's only one way to find out for sure ;) |
| ||
Let me see if i get it right: Createimage makes an empty timage with its width and height. Grabimage copyies a piece of the backbuffer using a timage width and height at a certain x and y coords and pastes it into a timage. Something like a cookie cutter?. So, if i want a white masked circle i would need to draw it before any image is drawn on the backbuffer, and use the cls color matching the mask color, right?. Thanks again. |
| ||
is this something like what your after? images used: bg.png http://www.mediafire.com/?jvdy4gwjdtm fg.png http://www.mediafire.com/?fjrlvjjrwcb mask.png http://www.mediafire.com/?mmzylhxkdb1 EDIT: after rereading the thread instead of just skimming over it, it doesn't look like this is exactly what you need. but i hope still helps somewhat. |
| ||
Let me see if i get it right: Createimage makes an empty timage with its width and height. Grabimage copyies a piece of the backbuffer using a timage width and height at a certain x and y coords and pastes it into a timage. Something like a cookie cutter?. So, if i want a white masked circle i would need to draw it before any image is drawn on the backbuffer, and use the cls color matching the mask color, right?. That's pretty much it, except the mask defaults to black so, using MASKBLEND to draw the image, you'll get a masked oval regardless of the background colour. OOP-fied example: |
| ||
Thanks both, very usefull code, now i get it, thanks again. |