Scaled pixmaps

BlitzMax Forums/BlitzMax Programming/Scaled pixmaps

This was requested.
Not sure how useable speedwise it is but any comments welcome.
SuperStrict
Function ce_drawpixmap(pixmap:TPixmap,xpos:Float,ypos:Float)
	Local xscale:Float,yscale:Float
	GetScale(xscale,yscale)
	Local scaled_pixmap:TPixmap=ResizePixmap(pixmap,pixmap.width*xscale,pixmap.height*yscale)
	DrawPixmap scaled_pixmap,xpos,ypos
End Function
Graphics 800,600
Local mypixmap:TPixmap=LoadPixmap("max.png")
SetScale 2.0,4.0
ce_drawpixmap(mypixmap,256,0)
DrawPixmap mypixmap,0,0
Flip
WaitKey()


Try calling glPixelZoom(XZoom:Float,YZoom:Float), e.g.
glPixelZoom(2.0,2.0)

before calling DrawPixmap() - it will zoom it on the fly.

I tried that and it seems just as quick (slow) on my machine as the method above. As it is OGL only it would need compiler directives so I went for simplicity and using native commands.

The reason it's probably the same speed is due to the bottleneck of the graphics bus when you send the same amount of data across it. DrawPixels() is totally CPU and bus speed dependent. Maybe then the only speedup you could do is write your own faster pixmap scaling algorithm, and while you're at it, might as well make it rotate as well. See my pixmap rotation code in another thread.