mirror of
https://github.com/glest/glest-source.git
synced 2025-10-01 09:56:41 +02:00
- updated error handling to be more flexible so we can display better error details (like bad tga file, etc)
This commit is contained in:
@@ -66,133 +66,143 @@ static inline std::vector<string> getExtensionStrings() {
|
||||
TGAReader3D::TGAReader3D(): FileReader<Pixmap3D>(getExtensionStrings()) {}
|
||||
|
||||
Pixmap3D* TGAReader3D::read(ifstream& in, const string& path, Pixmap3D* ret) const {
|
||||
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||
//read header
|
||||
TargaFileHeader fileHeader;
|
||||
in.read((char*)&fileHeader, sizeof(TargaFileHeader));
|
||||
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
|
||||
if(bigEndianSystem == true) {
|
||||
fileHeader.bitsPerPixel = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.bitsPerPixel);
|
||||
fileHeader.colourMapDepth = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapDepth);
|
||||
fileHeader.colourMapLength = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapDepth);
|
||||
fileHeader.colourMapOrigin = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapOrigin);
|
||||
fileHeader.colourMapType = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapType);
|
||||
fileHeader.dataTypeCode = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.dataTypeCode);
|
||||
fileHeader.height = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.height);
|
||||
fileHeader.idLength = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.idLength);
|
||||
fileHeader.imageDescriptor = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.imageDescriptor);
|
||||
fileHeader.width = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.width);
|
||||
}
|
||||
|
||||
if (!in.good()) {
|
||||
throw megaglest_runtime_error(path + " could not be read");
|
||||
}
|
||||
|
||||
//check that we can load this tga file
|
||||
if(fileHeader.idLength!=0){
|
||||
throw megaglest_runtime_error(path + ": id field is not 0");
|
||||
}
|
||||
|
||||
if(fileHeader.dataTypeCode!=tgaUncompressedRgb && fileHeader.dataTypeCode!=tgaUncompressedBw){
|
||||
throw megaglest_runtime_error(path + ": only uncompressed BW and RGB targa images are supported");
|
||||
}
|
||||
|
||||
//check bits per pixel
|
||||
if(fileHeader.bitsPerPixel!=8 && fileHeader.bitsPerPixel!=24 && fileHeader.bitsPerPixel!=32){
|
||||
throw megaglest_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported");
|
||||
}
|
||||
|
||||
const int h = fileHeader.height;
|
||||
const int w = fileHeader.width;
|
||||
const int d = ret->getD();
|
||||
const int slice = ret->getSlice();
|
||||
const int fileComponents= fileHeader.bitsPerPixel/8;
|
||||
const int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
|
||||
//std::cout << "TGA-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << " slice:" << ret->getSlice() << std::endl;
|
||||
if(ret->getPixels() == NULL){
|
||||
ret->init(w,h,d, picComponents);
|
||||
}
|
||||
uint8* pixels = ret->getPixels();
|
||||
if(slice > 0) {
|
||||
pixels = &pixels[slice*w*h*picComponents];
|
||||
}
|
||||
//read file
|
||||
for(int i=0; i<h*w*picComponents; i+=picComponents){
|
||||
uint8 r=0, g=0, b=0, a=0, l=0;
|
||||
|
||||
if(fileComponents==1){
|
||||
in.read((char*)&l,1);
|
||||
if(bigEndianSystem == true) {
|
||||
l = Shared::PlatformByteOrder::fromCommonEndian(l);
|
||||
}
|
||||
|
||||
r= l;
|
||||
g= l;
|
||||
b= l;
|
||||
a= 255;
|
||||
//printf("In [%s] line: %d\n",__FILE__,__LINE__);
|
||||
// try {
|
||||
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||
//read header
|
||||
TargaFileHeader fileHeader;
|
||||
in.read((char*)&fileHeader, sizeof(TargaFileHeader));
|
||||
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
|
||||
if(bigEndianSystem == true) {
|
||||
fileHeader.bitsPerPixel = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.bitsPerPixel);
|
||||
fileHeader.colourMapDepth = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapDepth);
|
||||
fileHeader.colourMapLength = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapDepth);
|
||||
fileHeader.colourMapOrigin = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapOrigin);
|
||||
fileHeader.colourMapType = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapType);
|
||||
fileHeader.dataTypeCode = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.dataTypeCode);
|
||||
fileHeader.height = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.height);
|
||||
fileHeader.idLength = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.idLength);
|
||||
fileHeader.imageDescriptor = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.imageDescriptor);
|
||||
fileHeader.width = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.width);
|
||||
}
|
||||
else{
|
||||
in.read((char*)&b, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
b = Shared::PlatformByteOrder::fromCommonEndian(b);
|
||||
}
|
||||
|
||||
in.read((char*)&g, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
g = Shared::PlatformByteOrder::fromCommonEndian(g);
|
||||
}
|
||||
if (!in.good()) {
|
||||
throw megaglest_runtime_error(path + " could not be read",true);
|
||||
}
|
||||
|
||||
in.read((char*)&r, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
r = Shared::PlatformByteOrder::fromCommonEndian(r);
|
||||
}
|
||||
//check that we can load this tga file
|
||||
if(fileHeader.idLength!=0){
|
||||
throw megaglest_runtime_error(path + ": id field is not 0",true);
|
||||
}
|
||||
|
||||
if(fileComponents==4){
|
||||
in.read((char*)&a, 1);
|
||||
if(fileHeader.dataTypeCode!=tgaUncompressedRgb && fileHeader.dataTypeCode!=tgaUncompressedBw){
|
||||
throw megaglest_runtime_error(path + ": only uncompressed BW and RGB targa images are supported",true);
|
||||
}
|
||||
|
||||
//check bits per pixel
|
||||
if(fileHeader.bitsPerPixel!=8 && fileHeader.bitsPerPixel!=24 && fileHeader.bitsPerPixel!=32){
|
||||
throw megaglest_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported",true);
|
||||
}
|
||||
|
||||
const int h = fileHeader.height;
|
||||
const int w = fileHeader.width;
|
||||
const int d = ret->getD();
|
||||
const int slice = ret->getSlice();
|
||||
const int fileComponents= fileHeader.bitsPerPixel/8;
|
||||
const int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
|
||||
//std::cout << "TGA-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << " slice:" << ret->getSlice() << std::endl;
|
||||
if(ret->getPixels() == NULL){
|
||||
ret->init(w,h,d, picComponents);
|
||||
}
|
||||
uint8* pixels = ret->getPixels();
|
||||
if(slice > 0) {
|
||||
pixels = &pixels[slice*w*h*picComponents];
|
||||
}
|
||||
//read file
|
||||
for(int i=0; i<h*w*picComponents; i+=picComponents){
|
||||
uint8 r=0, g=0, b=0, a=0, l=0;
|
||||
|
||||
if(fileComponents==1){
|
||||
in.read((char*)&l,1);
|
||||
if(bigEndianSystem == true) {
|
||||
a = Shared::PlatformByteOrder::fromCommonEndian(a);
|
||||
l = Shared::PlatformByteOrder::fromCommonEndian(l);
|
||||
}
|
||||
|
||||
} else {
|
||||
r= l;
|
||||
g= l;
|
||||
b= l;
|
||||
a= 255;
|
||||
}
|
||||
l= (r+g+b)/3;
|
||||
}
|
||||
//if (!in.good()) {
|
||||
// return NULL;
|
||||
//}
|
||||
else{
|
||||
in.read((char*)&b, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
b = Shared::PlatformByteOrder::fromCommonEndian(b);
|
||||
}
|
||||
|
||||
switch(picComponents){
|
||||
case 1:
|
||||
pixels[i]= l;
|
||||
in.read((char*)&g, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
g = Shared::PlatformByteOrder::fromCommonEndian(g);
|
||||
}
|
||||
|
||||
in.read((char*)&r, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
r = Shared::PlatformByteOrder::fromCommonEndian(r);
|
||||
}
|
||||
|
||||
if(fileComponents==4){
|
||||
in.read((char*)&a, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
a = Shared::PlatformByteOrder::fromCommonEndian(a);
|
||||
}
|
||||
|
||||
} else {
|
||||
a= 255;
|
||||
}
|
||||
l= (r+g+b)/3;
|
||||
}
|
||||
//if (!in.good()) {
|
||||
// return NULL;
|
||||
//}
|
||||
|
||||
switch(picComponents){
|
||||
case 1:
|
||||
pixels[i]= l;
|
||||
break;
|
||||
case 3:
|
||||
pixels[i]= r;
|
||||
pixels[i+1]= g;
|
||||
pixels[i+2]= b;
|
||||
break;
|
||||
case 4:
|
||||
pixels[i]= r;
|
||||
pixels[i+1]= g;
|
||||
pixels[i+2]= b;
|
||||
pixels[i+3]= a;
|
||||
break;
|
||||
case 3:
|
||||
pixels[i]= r;
|
||||
pixels[i+1]= g;
|
||||
pixels[i+2]= b;
|
||||
break;
|
||||
case 4:
|
||||
pixels[i]= r;
|
||||
pixels[i+1]= g;
|
||||
pixels[i+2]= b;
|
||||
pixels[i+3]= a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*for(int i = 0; i < w*h*picComponents; ++i) {
|
||||
if (i%39 == 0) std::cout << std::endl;
|
||||
int first = pixels[i]/16;
|
||||
if (first < 10)
|
||||
std:: cout << first;
|
||||
else
|
||||
std::cout << (char)('A'+(first-10));
|
||||
first = pixels[i]%16;
|
||||
if (first < 10)
|
||||
std:: cout << first;
|
||||
else
|
||||
std::cout << (char)('A'+(first-10));
|
||||
std::cout << " ";
|
||||
}*/
|
||||
/*for(int i = 0; i < w*h*picComponents; ++i) {
|
||||
if (i%39 == 0) std::cout << std::endl;
|
||||
int first = pixels[i]/16;
|
||||
if (first < 10)
|
||||
std:: cout << first;
|
||||
else
|
||||
std::cout << (char)('A'+(first-10));
|
||||
first = pixels[i]%16;
|
||||
if (first < 10)
|
||||
std:: cout << first;
|
||||
else
|
||||
std::cout << (char)('A'+(first-10));
|
||||
std::cout << " ";
|
||||
}*/
|
||||
|
||||
// }
|
||||
// catch(exception& ex) {
|
||||
// char szBuf[8096]="";
|
||||
// snprintf(szBuf,8096,"Error in [%s] on line: %d msg: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,ex.what());
|
||||
// throw megaglest_runtime_error(szBuf);
|
||||
// }
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -200,125 +210,137 @@ Pixmap3D* TGAReader3D::read(ifstream& in, const string& path, Pixmap3D* ret) con
|
||||
TGAReader::TGAReader(): FileReader<Pixmap2D>(getExtensionStrings()) {}
|
||||
|
||||
Pixmap2D* TGAReader::read(ifstream& in, const string& path, Pixmap2D* ret) const {
|
||||
//read header
|
||||
TargaFileHeader fileHeader;
|
||||
in.read((char*)&fileHeader, sizeof(TargaFileHeader));
|
||||
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
|
||||
if(bigEndianSystem == true) {
|
||||
fileHeader.bitsPerPixel = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.bitsPerPixel);
|
||||
fileHeader.colourMapDepth = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapDepth);
|
||||
fileHeader.colourMapLength = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapDepth);
|
||||
fileHeader.colourMapOrigin = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapOrigin);
|
||||
fileHeader.colourMapType = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapType);
|
||||
fileHeader.dataTypeCode = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.dataTypeCode);
|
||||
fileHeader.height = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.height);
|
||||
fileHeader.idLength = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.idLength);
|
||||
fileHeader.imageDescriptor = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.imageDescriptor);
|
||||
fileHeader.width = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.width);
|
||||
}
|
||||
|
||||
if (!in.good()) {
|
||||
throw megaglest_runtime_error(path + " could not be read");
|
||||
}
|
||||
|
||||
//check that we can load this tga file
|
||||
if(fileHeader.idLength!=0){
|
||||
throw megaglest_runtime_error(path + ": id field is not 0");
|
||||
}
|
||||
|
||||
if(fileHeader.dataTypeCode!=tgaUncompressedRgb && fileHeader.dataTypeCode!=tgaUncompressedBw){
|
||||
throw megaglest_runtime_error(path + ": only uncompressed BW and RGB targa images are supported");
|
||||
}
|
||||
|
||||
//check bits per pixel
|
||||
if(fileHeader.bitsPerPixel!=8 && fileHeader.bitsPerPixel!=24 && fileHeader.bitsPerPixel!=32){
|
||||
throw megaglest_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported");
|
||||
}
|
||||
|
||||
const int h = fileHeader.height;
|
||||
const int w = fileHeader.width;
|
||||
const int fileComponents= fileHeader.bitsPerPixel/8;
|
||||
const int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
|
||||
//std::cout << "TGA-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
|
||||
ret->init(w,h,picComponents);
|
||||
uint8* pixels = ret->getPixels();
|
||||
//read file
|
||||
for(int i=0; i<h*w*picComponents; i+=picComponents){
|
||||
uint8 r=0, g=0, b=0, a=0, l=0;
|
||||
|
||||
if(fileComponents==1){
|
||||
in.read((char*)&l,1);
|
||||
if(bigEndianSystem == true) {
|
||||
l = Shared::PlatformByteOrder::fromCommonEndian(l);
|
||||
}
|
||||
|
||||
r= l;
|
||||
g= l;
|
||||
b= l;
|
||||
a= 255;
|
||||
//printf("In [%s] line: %d\n",__FILE__,__LINE__);
|
||||
//try {
|
||||
//read header
|
||||
TargaFileHeader fileHeader;
|
||||
in.read((char*)&fileHeader, sizeof(TargaFileHeader));
|
||||
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
|
||||
if(bigEndianSystem == true) {
|
||||
fileHeader.bitsPerPixel = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.bitsPerPixel);
|
||||
fileHeader.colourMapDepth = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapDepth);
|
||||
fileHeader.colourMapLength = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapDepth);
|
||||
fileHeader.colourMapOrigin = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapOrigin);
|
||||
fileHeader.colourMapType = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.colourMapType);
|
||||
fileHeader.dataTypeCode = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.dataTypeCode);
|
||||
fileHeader.height = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.height);
|
||||
fileHeader.idLength = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.idLength);
|
||||
fileHeader.imageDescriptor = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.imageDescriptor);
|
||||
fileHeader.width = Shared::PlatformByteOrder::fromCommonEndian(fileHeader.width);
|
||||
}
|
||||
else{
|
||||
in.read((char*)&b, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
b = Shared::PlatformByteOrder::fromCommonEndian(b);
|
||||
}
|
||||
|
||||
in.read((char*)&g, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
g = Shared::PlatformByteOrder::fromCommonEndian(g);
|
||||
}
|
||||
if (!in.good()) {
|
||||
throw megaglest_runtime_error(path + " could not be read",true);
|
||||
}
|
||||
|
||||
in.read((char*)&r, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
r = Shared::PlatformByteOrder::fromCommonEndian(r);
|
||||
}
|
||||
//check that we can load this tga file
|
||||
if(fileHeader.idLength!=0){
|
||||
throw megaglest_runtime_error(path + ": id field is not 0",true);
|
||||
}
|
||||
|
||||
if(fileComponents==4){
|
||||
in.read((char*)&a, 1);
|
||||
if(fileHeader.dataTypeCode!=tgaUncompressedRgb && fileHeader.dataTypeCode!=tgaUncompressedBw){
|
||||
throw megaglest_runtime_error(path + ": only uncompressed BW and RGB targa images are supported",true);
|
||||
}
|
||||
|
||||
//check bits per pixel
|
||||
if(fileHeader.bitsPerPixel!=8 && fileHeader.bitsPerPixel!=24 && fileHeader.bitsPerPixel!=32){
|
||||
throw megaglest_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported",true);
|
||||
}
|
||||
|
||||
const int h = fileHeader.height;
|
||||
const int w = fileHeader.width;
|
||||
const int fileComponents= fileHeader.bitsPerPixel/8;
|
||||
const int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
|
||||
//std::cout << "TGA-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
|
||||
ret->init(w,h,picComponents);
|
||||
uint8* pixels = ret->getPixels();
|
||||
//read file
|
||||
for(int i=0; i<h*w*picComponents; i+=picComponents){
|
||||
uint8 r=0, g=0, b=0, a=0, l=0;
|
||||
|
||||
if(fileComponents==1){
|
||||
in.read((char*)&l,1);
|
||||
if(bigEndianSystem == true) {
|
||||
a = Shared::PlatformByteOrder::fromCommonEndian(a);
|
||||
l = Shared::PlatformByteOrder::fromCommonEndian(l);
|
||||
}
|
||||
|
||||
} else {
|
||||
r= l;
|
||||
g= l;
|
||||
b= l;
|
||||
a= 255;
|
||||
}
|
||||
l= (r+g+b)/3;
|
||||
}
|
||||
if (!in.good()) {
|
||||
return NULL;
|
||||
}
|
||||
else{
|
||||
in.read((char*)&b, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
b = Shared::PlatformByteOrder::fromCommonEndian(b);
|
||||
}
|
||||
|
||||
switch(picComponents){
|
||||
case 1:
|
||||
pixels[i]= l;
|
||||
in.read((char*)&g, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
g = Shared::PlatformByteOrder::fromCommonEndian(g);
|
||||
}
|
||||
|
||||
in.read((char*)&r, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
r = Shared::PlatformByteOrder::fromCommonEndian(r);
|
||||
}
|
||||
|
||||
if(fileComponents==4){
|
||||
in.read((char*)&a, 1);
|
||||
if(bigEndianSystem == true) {
|
||||
a = Shared::PlatformByteOrder::fromCommonEndian(a);
|
||||
}
|
||||
|
||||
} else {
|
||||
a= 255;
|
||||
}
|
||||
l= (r+g+b)/3;
|
||||
}
|
||||
if (!in.good()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch(picComponents){
|
||||
case 1:
|
||||
pixels[i]= l;
|
||||
break;
|
||||
case 3:
|
||||
pixels[i]= r;
|
||||
pixels[i+1]= g;
|
||||
pixels[i+2]= b;
|
||||
break;
|
||||
case 4:
|
||||
pixels[i]= r;
|
||||
pixels[i+1]= g;
|
||||
pixels[i+2]= b;
|
||||
pixels[i+3]= a;
|
||||
break;
|
||||
case 3:
|
||||
pixels[i]= r;
|
||||
pixels[i+1]= g;
|
||||
pixels[i+2]= b;
|
||||
break;
|
||||
case 4:
|
||||
pixels[i]= r;
|
||||
pixels[i+1]= g;
|
||||
pixels[i+2]= b;
|
||||
pixels[i+3]= a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*for(int i = 0; i < w*h*picComponents; ++i) {
|
||||
if (i%39 == 0) std::cout << std::endl;
|
||||
int first = pixels[i]/16;
|
||||
if (first < 10)
|
||||
std:: cout << first;
|
||||
else
|
||||
std::cout << (char)('A'+(first-10));
|
||||
first = pixels[i]%16;
|
||||
if (first < 10)
|
||||
std:: cout << first;
|
||||
else
|
||||
std::cout << (char)('A'+(first-10));
|
||||
std::cout << " ";
|
||||
}*/
|
||||
/*for(int i = 0; i < w*h*picComponents; ++i) {
|
||||
if (i%39 == 0) std::cout << std::endl;
|
||||
int first = pixels[i]/16;
|
||||
if (first < 10)
|
||||
std:: cout << first;
|
||||
else
|
||||
std::cout << (char)('A'+(first-10));
|
||||
first = pixels[i]%16;
|
||||
if (first < 10)
|
||||
std:: cout << first;
|
||||
else
|
||||
std::cout << (char)('A'+(first-10));
|
||||
std::cout << " ";
|
||||
}*/
|
||||
// }
|
||||
// catch(exception& ex) {
|
||||
// //printf("In [%s] line: %d msf [%s]\n",__FILE__,__LINE__,ex.what());
|
||||
// //abort();
|
||||
// char szBuf[8096]="";
|
||||
// snprintf(szBuf,8096,"Error in [%s] on line: %d msg: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,ex.what());
|
||||
// throw megaglest_runtime_error(szBuf);
|
||||
// }
|
||||
|
||||
//printf("In [%s] line: %d\n",__FILE__,__LINE__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user