Draw into Pixmap?
BlitzMax Forums/BlitzMax Programming/Draw into Pixmap?
| ||
Ok, here is the deal 1) i do a LoadAnimImage 2) i load a binary file & run through the bytes (=the map tiles) 3) i render the map of 9 layers using DrawImage What i want is to create 9 new images, and IN THERE draw instead. So i can toggle these layers, and do not have to redraw the tiles each time. The maps are 608x576 I thoughd todo this using pixmap, but i seem to get stuck there... |
| ||
These are the main commands you'll be needing:'Create a pixmap with alpha (you won't see the alpha respected when putting pixmap on backbuffer -- convert to image first) CompositePixmap:TPixmap = CreatePixmap(608,576,PF_RGBA8888) 'Load your tile(s) Tile:TPixmap = LoadPixmap("whatever.png") 'Paste your tile(s) onto the composite pixmap CompositePixmap.Paste(Tile,whateverX,whateverY) 'Convert to image CompositeImage:TImage = LoadImage(CompositePixmap) |
| ||
Thanks for the help. tough, Problem here is that i work with tilesets. So i need to clip the source, or find a way to copy 1 tile from the tileset, and paste that into the pixmap. That is why i used LoadAnimImage. |
| ||
It's unfortunate that there's no DrawPixmapRect() (at least not to my knowledge*) so you'll either have to draw then GrabPixmap() each image or not store them as a tilestrip in the first place. *EDIT: Aha! There's pixmap.Window(x,y,width,height), as mentioned here and also this nice twist on the paste method: destPixmap.Paste(sourceAnimImage.Lock(frame, 1, 0), destX, destY), as mentioned here. |
| ||
Cool! Im gonne check that out. -Edit- I found what i was looking for here: http://www.blitzbasic.com/Community/posts.php?topic=74153#828522 It also handles transperancy of both the source and destination images together with brightness! |