Placing image frames onto pixmaps

BlitzMax Forums/BlitzMax Programming/Placing image frames onto pixmaps

Is it possible to paste tiles/frames (from one image) onto a pixmap?

I'm able to place individual images onto a pixmap, using pixmap_image.paste(image,X,Y), but each image is loaded separately.

Have I missed a command to paste a certain frame from an anim_image (multiple frame image) onto the pixmap? eg. pixmap_image.paste(image,X,Y,FRAME)

If there's not a single command, has anyone created a function to do this?

See this function:

http://www.blitzmax.com/Community/posts.php?topic=72617#811598


bye
MB

That certainly looks like it will fit the bill :)

Cheers MichaelB

You can use:

pixmap.window(x,y,w,h)

to extract a smaller frame from a pixmap into a larger pixmap, but the first image would need to be loaded as a pixmap first!

Not exactly what you asked for but I have found it useful!

destPixmap.Paste(sourceAnimImage.Lock(frame, 1, 0), destX, destY)


This could be cleaned up
Graphics 800,600
Local fromimage:timage=LoadAnimImage("test_item.png",128,128,0,3)
Local toimage:timage=LoadImage("max.png")
paste_image_cell(fromimage ,0 ,0, 1 , toimage)
DrawImage toimage,0,0
Flip
WaitKey()
Function paste_image_cell(fromimage:timage , from_x:Int = 0 , from_y:Int = 0 , from_frame:Int , toimage:timage , to_frame:Int = 0)
	Local to_pixmap:tpixmap = toimage.pixmaps[to_frame]
	Local from_pixmap:tpixmap=fromimage.pixmaps[from_frame]
            To_pixmap.paste(from_pixmap,from_x,from_y)
End Function


Am I right that none of your functions allows "drawing" the source on the destination?

I think of alpha-channels...

Yours seems (untested) like a "replacement" of a certain part of an image/pixmap.


bye
MB

Yep, its pixmap.paste with a frame number as requested in the initial post.
<edit> this sorta works for Render-To-Texture.

Ooh! I've just noticed the extra replies.

I shall try these all out and use the easiest that gives the result I want.

Thanks to everyone. :D

Of course if anyone has further info, just post below. :)