I'm playing around with libpng, but I,m having problems allocating space. Heres what the manual says:
Now, if I do this:Quote:
After you have called png_read_png(), you can retrieve the image data with
row_pointers = png_get_rows(png_ptr, info_ptr);
where row_pointers is an array of pointers to the pixel data for each row:
png_bytep row_pointers[height];
I get errors on the second an third row about incompatible assignment/pointer types.Code:png_bytep row_pointers[height+1]; //? is this right pointer type
row_pointers = png_get_rows(png_ptr, info_ptr); //Allcoate memory
png_read_image(png_ptr, row_pointers); //Read data
If I do this:
It compiles but segfaults at the first line. Anyone know what I am meant to be oing with these pointer things here? Cheers.Code:png_bytep *row_pointers[height+1]; //segfaults here
*row_pointers = png_get_rows(png_ptr, info_ptr);
png_read_image(png_ptr,* row_pointers);