Scaling up an image

Posted by codefail on Stack Overflow See other posts from Stack Overflow or by codefail
Published on 2010-04-15T20:54:11Z Indexed on 2010/04/15 21:03 UTC
Read the original article Hit count: 277

Filed under:
|
|

How do I fulfill the condition "returns the entire scaled up image"

If I am coding this correctly, scaleColor handles individual colors, getRed handles the red, etc. I am multiplying this by the input, numTimes, which will create a new image that is scaled up it.

This scaled up (increase size) is to be returned.

This is what I have.

Image Image::scaleUp(int numTimes) const
{
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            pixelData[x][y].scaleColor(pixelData[x][y].scaleRed(pixelData[x][y].getRed()*numTimes));
            pixelData[x][y].scaleColor(pixelData[x][y].scaleGreen(pixelData[x][y].getGreen()*numTimes));
            pixelData[x][y].scaleColor(pixelData[x][y].scaleBlue(pixelData[x][y].getBlue()*numTimes));
        }
    }
    //return Image();
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about homework