c++ - Reading Targa File. Missing Dark Colors? -
due being new, can have 2 links , can not post images. sorry inconvenience of having copy+paste addresses
i parsing targa (.tga) image file code similar found @ steinsoft.net/index.php?site=programming/code%20snippets/cpp/no8
after retrieving data unsigned char array, print out log check manually. seems darker colors not being parsed whatever reason.
the simple print code
file.open( save ); //using while( tga.data[ ] != null ) resulted in ~400,000 lines of garbage being appended for( unsigned = 1; <= ( tga.width * tga.height * tga.bytecount ); i++ ) { if( tga.data[ ] == null ) break; file << ( int )tga.data[ ] << ","; if( ( % 3 ) == 0 ) file << "\n"; } file.close( ); example
dark : http://i.stack.imgur.com/qefia.png : http://pastebin.com/8jejwp2w
light : http://i.stack.imgur.com/xntik.png : http://pastebin.com/s2sw0xfm
as can see, line @ top of image not included when dark color (black in instance), there when light (a pink [255,53,204]).
does have information on why may happening?
specs
windows vista
microsoft visual c++ 2010 professional
targa saved 24-bit not compressed.
first of all, why check if data[i]==null? there might 0-pixels (black), keep them in. check if color 0 , exit loop. read pixels no matter value.
Comments
Post a Comment