Copy a region out of a Pixmap
BlitzMax Forums/BlitzMax Beginners Area/Copy a region out of a Pixmap| 
 | ||
| Hello! Another newb question from me: If a pixmap I have loaded up is wider than 340 pixels I want the pixmap being replaced by the first 0-340 pixels. So the new pixmap is only 340 in width of the original larger image. No resizing. Just simple "copy" out. tmppixmap=LoadPixmap("MyLargeImage.jpg") If tmppixmap.width > 340 Then tmppixmap=tmppixmap.copy ...???? endif How can I do this? Thanks, Grisu | 
| 
 | ||
| manually copy pixels thought the pixel commands would be the way to go. (and it would be 0 - 339 if it has a width of 340) | 
| 
 | ||
| But isn't read/writepixel aweful slow? Isn't there something like CopyImagRect in bmx? | 
| 
 | ||
| Drawimage rect which can be saved as pixmap You'd need to check the size being copied is smaller than the actual image w/h... 
Function tg_copyimagerect:TImage(image:TImage,x1:Int,y1:Int,x2:Int,y2:Int)
    Return LoadImage(PixmapWindow(LockImage(image),x1,y1,x2,y2))
End Function
 | 
| 
 | ||
| Thanks, have it now: tmppixmap=PixmapWindow(tmppixmap,0,0,340,340) Nothing is faster than that... :) |