0

If i load image such as 98x*** which is 3 bytes per pixel, it will create 2 bytes padding there to make it fit in 4 bytes sequences.

Is it possible to use IMG_Load() without generating the padded bytes in the ->pixels raw data?

At the moment i use this to detect how many bytes it has been padded:

int pad = img->pitch - (img->w * img->format->BytesPerPixel);

And if > 0 Then i rebuild new image without the padded bytes... but this is inefficient, so im hoping if theres better fix?

Rookie
  • 3,753
  • 5
  • 33
  • 33
  • What are you passing the image to that can't take an explicit pitch? Also, how do you know that the data isn't stored in the file with padding (as is often the case with uncompressed raster image formats)? – Nicol Bolas Jul 31 '11 at 23:58
  • @nicol, im passing it to my own image functions, the padding is added if i save it with such a format. you happen to know how to replace already existing SDL_Surface pixels data? i cant seem to make that work either... i tried delete[] free() and SDL_FreeSurface() with dozen of tricks... ideas? – Rookie Aug 01 '11 at 00:04

0 Answers0