Archived

This topic is now archived and is closed to further replies.

Jumpman

scalling bitmaps via software

Recommended Posts

I have just done a software strech routine for my texture manager which will strech a raw BMP (24/32 bit) to any size.. at the moment it is just using a linear way to expand (or shrink) it.. is there any documentation I can be pointed which explains how averaging works or some better way to strech the data without coping the same data all the time.. (if that makes sence).. here is how I am currently doing it..
// scale the raw image data to the new size..
//
GLubyte *TextureLoader::ScaleTGA(GLubyte *pImgData, GLuint oldWidth, GLuint oldHeight, GLuint Bpp, GLuint newWidth, GLuint newHeight)
{
	GLuint	x, y;
	GLubyte	*pNewImgData;

	// allocated the some memory for the new texture
	pNewImgData = (GLubyte *)malloc(newWidth * newHeight * Bpp);					
	
	// work out the stepping values to use in the scalling..
	float stepX = (float)oldWidth / (float)newWidth;
	float stepY = (float)oldHeight / (float)newHeight;

	float	fX, fY;

	fY = 0;

	// if 24 bit (RGB)
	if (Bpp == 3)
	{
		for (y=0; y
Jumpman - Under Construction

Share this post


Link to post
Share on other sites