tiff2pdf: normalizePoint() macro to normalize the white point
This commit is contained in:
parent
dbc90f9374
commit
bd49c5810f
@ -4933,6 +4933,16 @@ tsize_t t2p_write_pdf_xobject_stream_dict(ttile_t tile,
|
||||
return(written);
|
||||
}
|
||||
|
||||
|
||||
/* used to normalize the White Point */
|
||||
#define normalizePoint(x,y,z) do { \
|
||||
if (y != 0.0F) { \
|
||||
x /= y; \
|
||||
z /= y; \
|
||||
y = 1.0F; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* This function writes a PDF Image XObject Colorspace name to output.
|
||||
*/
|
||||
@ -4993,11 +5003,7 @@ tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
|
||||
X_W = t2p->tiff_whitechromaticities[0];
|
||||
Y_W = t2p->tiff_whitechromaticities[1];
|
||||
Z_W = 1.0F - (X_W + Y_W);
|
||||
if (Y_W != 0.0F) {
|
||||
X_W /= Y_W;
|
||||
Z_W /= Y_W;
|
||||
Y_W = 1.0F;
|
||||
}
|
||||
normalizePoint(X_W, Y_W, Z_W);
|
||||
buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
||||
check_snprintf_ret(t2p, buflen, buffer);
|
||||
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
||||
@ -5126,11 +5132,7 @@ tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
|
||||
X_W = t2p->tiff_whitechromaticities[0];
|
||||
Y_W = t2p->tiff_whitechromaticities[1];
|
||||
Z_W = 1.0F - (X_W + Y_W);
|
||||
if (Y_W != 0.0F) {
|
||||
X_W /= Y_W;
|
||||
Z_W /= Y_W;
|
||||
Y_W = 1.0F;
|
||||
}
|
||||
normalizePoint(X_W, Y_W, Z_W);
|
||||
}
|
||||
if(t2p->pdf_colorspace & T2P_CS_CALRGB){
|
||||
written += t2pWriteFile(output, (tdata_t) "/CalRGB ", 8);
|
||||
@ -5155,11 +5157,7 @@ tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
|
||||
X_W = (X_R * R) + (X_G * G) + (X_B * B);
|
||||
Y_W = (Y_R * R) + (Y_G * G) + (Y_B * B);
|
||||
Z_W = (Z_R * R) + (Z_G * G) + (Z_B * B);
|
||||
if (Y_W != 0.0F) {
|
||||
X_W /= Y_W;
|
||||
Z_W /= Y_W;
|
||||
Y_W = 1.0;
|
||||
}
|
||||
normalizePoint(X_W, Y_W, Z_W);
|
||||
}
|
||||
written += t2pWriteFile(output, (tdata_t) "<< \n", 4);
|
||||
if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
|
||||
|
Loading…
Reference in New Issue
Block a user