Scale image ?

BlitzMax Forums/BlitzMax Programming/Scale image ?

Filax(Posted 2005) [#1]
Hi

Is there a method to scale an image ??? i have try resize
pixmap but i don't use pixmap , but timage.


Shagwana(Posted 2005) [#2]
Check out the "SetScale" command, it will change the size of the image being drawn to the display. Its a state machine too, so dont forget to reset it after you have used it like "SetScale 1.0,1.0".

Examples of use
SetScale 2.0,2.0 '2x the size
SetScale 6.0,6.0 '6x the size
SetScale 0.5,0.5 'Half size
SetScale 0.25,0.25 'Quater size
SetScale 1.0,1.0 'Normal size



Filax(Posted 2005) [#3]
Many thanks !


Filax(Posted 2005) [#4]
I hope that mark integrate this stuff ...


Filax(Posted 2005) [#5]
Hi :)

I have made a function to resize an image .... It's a little bit rock n roll :)
But it work :)




ImaginaryHuman(Posted 2005) [#6]
Surely you don't have to do that one pixel at a time?


Oddball(Posted 2005) [#7]
Surely you can access an image's pixmap by using the LockImage command. Then simple use the ResizePixmap command. Or have I got that wrong?


Hotcakes(Posted 2005) [#8]
SetScale (covered in the Max2D documentation) is the global, realtime/runtime way to scale an image (using 3D acceleration), however if you want to resize an image permanently, you can do so on a pixmap using ResizePixmap (covered in the Pixmap documentation).


Filax(Posted 2005) [#9]
If you have another way to resize easily an image .... :) post it :)


TartanTangerine (was Indiepath)(Posted 2005) [#10]
Filax, why would you want to do this?

SetScale will scale the images (Textured Quads) as they are drawn.


Oddball(Posted 2005) [#11]
If you have another way to resize easily an image .... :) post it :)
SkidRacer posted this in the code archive.
Function ResizeImage:TImage(image:TImage,width,height)
	Local pix:TPixmap=LockImage(image)
	pix=ResizePixmap(pix,width,height)
	UnlockImage(image)	
	Return LoadImage(pix)
End Function



Filax(Posted 2005) [#12]
Hum hum Thanks ! :) it's a really simple method !

It's a little bit obscur for me the difference between image and pixmap...


Shagwana(Posted 2005) [#13]
Hum hum Thanks ! :) it's a really simple method ! I don't understand
very well for the moment the difference between image and pixmap ...
Images are held on the gfx card, thus fast to draw to the display (fastest).
Pixmaps are held in system memory, thus need to be copied over to the gfx card before being drawn to the display (slower).

Images can't be altered, as gfx card memory tends to be faster to read from (drawing) then to write too (downloading a image from gfx card).
Pixmaps can be altered as you like as there held in system memory.

Its possible to convert a pixmap to an image via the image=loadimage(pixmap) command!.


Filax(Posted 2005) [#14]
Hum hum ok !