|
|
|
@ -26,11 +26,25 @@ DNG::~DNG() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Run-time detection if we are little- or big-endian.
|
|
|
|
|
*/
|
|
|
|
|
int DNG::IsBigEndian(void) {
|
|
|
|
|
int i = 1;
|
|
|
|
|
return ! *((char *)&i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Sets the file name of the DNG file to be written. Returns -1 on
|
|
|
|
|
failure, 0 on success.
|
|
|
|
|
*/
|
|
|
|
|
int DNG::setFile(char * file) {
|
|
|
|
|
/*
|
|
|
|
|
w = write
|
|
|
|
|
l = little endian
|
|
|
|
|
b = big endian
|
|
|
|
|
-> if neither l or b is given, data is written in native CPU format
|
|
|
|
|
*/
|
|
|
|
|
if (!(tif = TIFFOpen(file, "w"))) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
@ -139,7 +153,7 @@ int DNG::writeFile(void * data) {
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_CFA);
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFAREPEATPATTERNDIM, CFARepeatPattern);
|
|
|
|
|
// 0 = Red, 1 = Green, 2 = Blue
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFAPATTERN, "\001\000\002\001"); // GRGB
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFAPATTERN, "\001\000\002\001"); // GRBG
|
|
|
|
|
}
|
|
|
|
|
else if(ColorID == DNG_COLORID_RGB) {
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
|
|
|
|