Search Results

Search found 2 results on 1 pages for 'codefail'.

Page 1/1 | 1 

  • Scaling up an image

    - by codefail
    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(); }

    Read the article

  • staying within boundaries of image?

    - by codefail
    So I am to loop through copyFrom.pixelData and copy it into pixelData. I realize that I need to check the conditions of i and j, and have them not copy past the boundaries of pixelData[x][y], I need another 2 loops for that? I tried this, but was getting segmentation fault.. Is this the right approach? void Image::insert(int xoff, int yoff, const Image& copyFrom, Color notCopy) { for (int x = xoff; x < xoff+copyFrom.width; x++) { for (int y = yoff; y < yoff+copyFrom.height; y++) { for (int i = 0; i<width; i++){ for (int j = 0; j<height; j++){ if (copyFrom.pixelData[i][j].colorDistance(notCopy)>20 ) pixelData[x][y]=copyFrom.pixelData[i][j]; } } } } }

    Read the article

1