+ // colour image
+ if (hasAlpha)
+ {
+ for ( int column = 0; column < imageWidth; column++ )
+ {
+ buf[column*4 ] = ptr[column*3 ];
+ buf[column*4 + 1] = ptr[column*3 + 1];
+ buf[column*4 + 2] = ptr[column*3 + 2];
+ buf[column*4 + 3] = image->GetAlpha(column, row);
+ }
+ }
+ else
+ {
+ memcpy(buf, ptr, imageWidth * 3);
+ }