err.... no setbuffer for pixmap?

BlitzMax Forums/BlitzMax Programming/err.... no setbuffer for pixmap?

Robert Cummings(Posted 2005) [#1]
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?


Perturbatio(Posted 2005) [#2]



Beaker(Posted 2005) [#3]
[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



Dreamora(Posted 2005) [#4]
You could use the TPixmap paste method to copy from pixmap to pixmap as well ...


Beaker(Posted 2005) [#5]
How do you use the paste method?


Dreamora(Posted 2005) [#6]
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.


Robert Cummings(Posted 2005) [#7]
OOh thanks all. Wish it was documented.


Beaker(Posted 2005) [#8]
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



ImaginaryHuman(Posted 2005) [#9]
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.


Beaker(Posted 2005) [#10]
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.


Hotcakes(Posted 2005) [#11]
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?


taxlerendiosk(Posted 2005) [#12]
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.


Robert Cummings(Posted 2005) [#13]
There will be no handbags drawn in my threads thankyouverymuchta :)

Pasting is fine, both methods work great for me.


TartanTangerine (was Indiepath)(Posted 2005) [#14]
Rob, Skid made a comment that 1.11 uses the Blt commands you might want to wait until then.


Robert Cummings(Posted 2005) [#15]
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?