// helper inline void doubleRow(const int *src, int *dest, int wSrc) { for (int y = 0, y2 = 0; y < wSrc; y++, y2 += 2) { dest[y2] = dest[y2+1] = src[y]; } } // Here's the; main routine. // src = from bitmap // dest = to bitmap // wSrc = width of the source (in pixels) // hSrc = height of the source (in pixels) // strideSrc = stride of the source (in pixels) // strideDest = stride of the destination (in pixels) void resizeDouble(const int *src, int *dest, int wSrc, int hSrc, int strideSrc, int strideDest) { for (int x = 0; x < hSrc; x++) { doubleRow(src, dest, wSrc); dest = &dest[strideDest]; doubleRow(src, dest, wSrc); dest = &dest[strideDest]; src = &src[strideSrc]; } }
Programming Tips - How can I double the width and height of an image?
Date: 2015aug19
Language: C/C++
Q. How can I double the width and height of an image?
A.