'Shrink image using C++
I've been trying to shrink an image just using C++. I am quite new to this language.
This is what I have and it works but there is a problem where it leaves unwanted pixels behind.
Rgb temp;
float scale = 0.8;
for(int y = 0; y < h*scale; y++)
{
int scaleY = (int)(y/scale);
for(int x = 0; x < w*scale; x++) {
int scaleX = (int) (x / scale);
temp = pixels[x + y * w];
pixels[x + y * w] = pixels[scaleX + scaleY * w];
pixels[scaleX + scaleY * w] = temp;
}
}
I have been looking online and haven't found many examples that just use basic C++. I'd appreciate any help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
