err.... no setbuffer for pixmap?
BlitzMax Forums/BlitzMax Programming/err.... no setbuffer for pixmap?
| ||
| Hi... I've found Drawpixmap(), which was not under the pixmap section of the docs. Now how do I direct the output of this command? |
| ||
| |
| ||
[After discussion on IRC] Try this:
Graphics 640,480,0
Local png:TPixmap = LoadPixmap("Graphics/bmax160_2.png")
If Not(png)
DebugLog "BUGGER"
End
EndIf
Local png2:Tpixmap = CreatePixmap(512,512,PixmapFormat(png)) 'important to do that last bit
Beaks_CopyPixMap(png, png2, 50,50)
DrawPixmap png2,0,0
Flip
WaitKey
End
Function Beaks_CopyPixMap(frompix:Tpixmap, topix:Tpixmap, x2,y2)
For Local y=0 Until PixmapHeight(frompix)
CopyPixels frompix.PixelPtr(0,y),topix.PixelPtr(x2,y+y2),PixmapFormat(frompix),PixmapWidth(frompix)
Next
End Function |
| ||
| You could use the TPixmap paste method to copy from pixmap to pixmap as well ... |
| ||
| How do you use the paste method? |
| ||
Graphics 800,600,0 SetClsColor 200,0,0 Cls pix1:TPixmap = GrabPixmap (0,0,128,128) SetClsColor 255,255,255 Cls pix2:TPixmap = CreatePixmap(256,256,PF_RGBA8888) pix2.paste(pix1,100,100) DrawPixmap pix2,0,0 Flip WaitKey Paste will copy the source pixmap (pix1) to the actual pixmap (pix2), at the coord X,Y of the actual pixmap. |
| ||
| OOh thanks all. Wish it was documented. |
| ||
Nice find Dreamora. Should you have a PixMapFormat() call like this? :Graphics 800,600,0 SetClsColor 200,0,0 Cls pix1:TPixmap = GrabPixmap (0,0,128,128) SetClsColor 255,255,255 Cls pix2:TPixmap = CreatePixmap(256,256,PixmapFormat(pix1)) pix2.paste(pix1,100,100) DrawPixmap pix2,0,0 Flip WaitKey |
| ||
| Wasn't he asking how to draw to another buffer other than the backbuffer, nothing to do with pasting whatsoever? To which the asnwer would be, again, max doesn't have any other buffers. |
| ||
| Look at my 1st post above. It states that we discussed it on IRC. That is why I posted the code above. One Eyed Jack also thanked us all. Reading the thread might be a good idea in future. |
| ||
| After discussion on IRC Try this: Why do people have to discuss it in IRC, why can't they just use it? That some strange new type of licensing agreement or something? |
| ||
| AngelDaniel: Read the post. His question was "how do I direct the output of DrawPixmap" - pasting is to all intents and purposes the same thing. |
| ||
| There will be no handbags drawn in my threads thankyouverymuchta :) Pasting is fine, both methods work great for me. |
| ||
| Rob, Skid made a comment that 1.11 uses the Blt commands you might want to wait until then. |
| ||
| Oh I didn't know. Well it's all done now, works fine. Does the Blt stuff retain alpha? and will it take care of pixel format differences for me? |