Scale image ?
BlitzMax Forums/BlitzMax Programming/Scale image ?
| ||
Hi Is there a method to scale an image ??? i have try resize pixmap but i don't use pixmap , but timage. |
| ||
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 |
| ||
Many thanks ! |
| ||
I hope that mark integrate this stuff ... |
| ||
Hi :) I have made a function to resize an image .... It's a little bit rock n roll :) But it work :) |
| ||
Surely you don't have to do that one pixel at a time? |
| ||
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? |
| ||
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). |
| ||
If you have another way to resize easily an image .... :) post it :) |
| ||
Filax, why would you want to do this? SetScale will scale the images (Textured Quads) as they are drawn. |
| ||
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 |
| ||
Hum hum Thanks ! :) it's a really simple method ! It's a little bit obscur for me the difference between image and pixmap... |
| ||
Hum hum Thanks ! :) it's a really simple method ! I don't understand Images are held on the gfx card, thus fast to draw to the display (fastest).very well for the moment the difference between image and pixmap ... 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!. |
| ||
Hum hum ok ! |