c - Why pixels are copied backwards? -
c - Why pixels are copied backwards? -
i have function converts .bmp
.ppm
. since .ppm
doesn't need padding @ end of each row of pixels, have loop skips padding , writes each pixel .ppm
file. however.. copied backwards. rgb->bgr. don't know why, thought fwrite
writes bytes in sequence.
for(h = height*((width*3) + width%4); h>=0; h -= (width*3) + width%4) { fwrite(&bmpdata[p->__index][54 + h], 1, width*3, fp); }
bmpdata
2d buffer containing .bmp
file.
54
offset of pixels starts from.
what doing wrong?
c bitmap buffer pixels
Comments
Post a Comment