Drawing Images
BlitzMax Forums/BlitzMax Beginners Area/Drawing Images
| ||
If I load an image that is 320x320 and I want to draw a a rectangular portion of that image to the buffer. Lets say from coordinates 16,0-32,32 to position 100,100 on the screen. Then I want to draw another section from 10,0 to 20,10 at position 150,100. How can I do this? Next would be seeing if I could specify a larger destination window to stretch the image. Hope this makes sense.. if not I'll try to make it simpler, but basically I just want to know how to specify source and destination rectangles for an image draw command without using animimages. I see GrabPixMap and DrawPixMap, but theres not much information about them. Also, it sounds like it's going to create a copy of the data contained in the image, I'd rather just keep the needed coordinates and draw the parts on the fly. |
| ||
I think the command you are looking for is: DrawImageRect I think that should work as you describe. |
| ||
Nope, Function DrawImageRect only has a single set of coordinates; therefore it can not provide the ability to specify source and destination rectangles. Basically, I want the ability to make my own drawimage where each frame can be of a different size. |
| ||
you can't, that easy it is. you will have to do a little hack using the TImageFrame type and setting the u0,u1,v0,v1 yourself |
| ||
Maybe I could somehow hack into the Width and height parameters of LoadAnimImage and change them on the fly for each frame. |
| ||
Does this help from the code archives... DrawImageBlock |
| ||
you could do some opengl and set the texture coordinates to your liking. |
| ||
Use SetViewPort to draw a rect on the screen then use DrawImageRect to place the correct portion within the ViewPort. I've done this for a single viewport/imagerect so I imagine it'll work for multiple as well. |
| ||
http://www.blitzbasic.com/Community/posts.php?topic=47526 There are multiple methods of drawing part of an image in that thread. Perhaps one will suit your needs. |
| ||
Thanks, I've decided to mostly hardcode widths and heights for the sprite engine I was working on http://www.blitzmax.com/Community/posts.php?topic=48250, it just makes everything much easier. But this stuff can be usefull for other things. Thank you. |