View Full Version : Bitmap Scaling
12-25-2002, 11:28 PM
Hello, I'm building a CTextures class (C++)
I'm now looking for some informations/algo to perform a linear or other type of scaling on bitmap 32bpp. (The fastest one if it is possible)
My bitmap pixel are stocked into an array of RGBQUAD.
Any idea ?
12-26-2002, 06:51 PM
if you are just displaying a scaled pic, Opengl will do it for you. Just make the quad with the texture on it bigger.
if you want to scale it in memory to save for later use, the simplest way is linear interpolation.
say you have a pic that is 50x50 and want to make it 75x75. 75 / 50 = 1.5. Which means you need to draw each pixel 1.5 times in both directions. Yes I know you cant draw half a pixel but you can have an extra variable that adds up the decimal part and when it goes over 1, draw another pixel.
This is NOT the prettiest way but its the easiest. Its what I used in the DOS days.
[This message has been edited by chxfryer (edited 12-26-2002).]
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.