grabpixmap
BlitzMax Forums/BlitzMax Beginners Area/grabpixmap
| ||
I have been able to store multi-images in a single .png but I can't find a way to get a sub image out to draw. grabpixmap seem to be the right command to select a sub image that I want to draw. Then I want to draw the sub image to a specific place. The followinf code get the muti-images loaded: Local image:timage Local x,y Global pixmap:TPixmap Graphics 800,600 image=LoadImage(LoadPixmapPNG("cimage.png")) DrawImage image,0,0 Now what do I do to get and draw a sub image from this load to a specific location on the screen |
| ||
PixmapWindow is probably what you need. |
| ||
DrawImageRect? |
| ||
thanks, I will look at it I am trying get around not have an array for images |
| ||
drawImageRect draws the all the images in small rectangle not a single image subset |
| ||
LoadAnimImage? |
| ||
Thank FlameDuck. This code worked load_image=LoadAnimImage:TImage( ("cimage.png"),71,96,0,52,flags=-1 ) DrawImage load_image,0,0 Flip WaitKey End This should allow for an array based indexing of these images and screen placement Also for annimation storage |
| ||
Thank FlameDuck. This code worked load_image=LoadAnimImage:TImage( ("cimage.png"),71,96,0,52,flags=-1 ) DrawImage load_image,0,0 Flip WaitKey End This should allow for an array based indexing of these images and screen placement Also for annimation storage |
| ||
load_image=LoadAnimImage:TImage( ("cimage.png"),71,96,0,52,flags=-1 ) You can remove the highlighted bit in the above code. 'Flags' is the parameter name, -1 is its default value. So if anything it should read "....0,52,-1", but you can just omit the -1 completely. I'm surprised your code didn't throw a type conversion error. |
| ||
I can only get 15 images from from the stored .png which has 56 image. I did this by a "for" loop that changed the cell first cell parameter from 0 to 14 anything higher caused an error. No error raised on the number of cells. thank gfk for comment |
| ||
That's what the 'frame' parameter of DrawImage() is for... Strict Graphics 800, 600, 0 Local image:TImage = LoadAnimImage("cimage.png", 71, 96, 0, 56) For Local currentFrame=0 To 55 Cls DrawText "Frame " + currentFrame, 12, 12 DrawImage image, 100, 100, currentFrame Flip Delay(1000) Next End |
| ||
works great thanks Ian |