Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Rescale image (scale up or down)

Author
Message
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 24th Aug 2009 02:10 Edited at: 24th Aug 2009 02:11
This was written in dbpro slightly modified for being a utility outside of a bigger project of mine.

this code will load an image of anysize (could be a huge photo or a small 12x12 photo)

what size do you want? as long as your display mode is big enough this method will work from 640x480 default on regular screen resolution.

if you have a texture that is say 1024x768
and you need an image size of 200x200 boom done

if you have a texture that is say 10x176
and you want it to be 400x400 boom done

lol

anyways you get the idea and if you read threw there is a spot that will resave the image to your desired size




SMD3DInteractive
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 16th Oct 2009 01:13 Edited at: 16th Oct 2009 01:14
Nice code. When scaling up does it take an average colour or just use a neighbouring pixel's colour?
Did you know you can use COPY BITMAP a,ax1,ay1,ax2,ay2,b,bx1,by1,bx2,by2 to scale bitmaps in the same way?

TGC Forum - converting error messages into sarcasm since 2002.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 17th Oct 2009 03:53
oh?...lol i had no idea!


um when scaling up it rounds off to the nearest value so the odd pixel would get duplicated..

and thanks! but its too bad i didnt know about the bitmap scaling or i could have skipped some coding.....lol

SMD3DInteractive
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 31st Oct 2009 04:30
I'm sure you learnt something in the process so it's not time wasted
Maybe yours is better than the copying method, I haven't tested them.

TGC Forum - converting error messages into sarcasm since 2002.

Login to post a reply

Server time is: 2024-05-05 08:11:07
Your offset time is: 2024-05-05 08:11:07