static void determineOutputType(const struct pam * const underlayPamP, const struct pam * const overlayPamP, struct pam * const composedPamP) { BaseTupletype const baseTupletype = commonTupletype(underlayPamP->tuple_type, overlayPamP->tuple_type); composedPamP->height = underlayPamP->height; composedPamP->width = underlayPamP->width; composedPamP->format = commonFormat(underlayPamP->format, overlayPamP->format); composedPamP->plainformat = FALSE; composedPamP->maxval = pm_lcm(underlayPamP->maxval, overlayPamP->maxval, 1, PNM_OVERALLMAXVAL); composedPamP->visual = true; composedPamP->color_depth = (baseTupletype == TT_RGB ? 3 : 1); composedPamP->have_opacity = underlayPamP->have_opacity; composedPamP->opacity_plane = (baseTupletype == TT_RGB ? 3 : 1); composedPamP->depth = (baseTupletype == TT_RGB ? 3 : 1) + (underlayPamP->have_opacity ? 1 : 0); determineOutputTupleType(baseTupletype, underlayPamP->have_opacity, composedPamP->tuple_type, sizeof(composedPamP->tuple_type)); }
static void determineOutputType(struct pam * const composedPamP, struct pam * const underlayPamP, struct pam * const overlayPamP) { composedPamP->height = underlayPamP->height; composedPamP->width = underlayPamP->width; composedPamP->format = commonFormat(underlayPamP->format, overlayPamP->format); composedPamP->plainformat = FALSE; commonTupletype(underlayPamP->tuple_type, overlayPamP->tuple_type, composedPamP->tuple_type, sizeof(composedPamP->tuple_type)); composedPamP->maxval = pm_lcm(underlayPamP->maxval, overlayPamP->maxval, 1, PNM_OVERALLMAXVAL); if (strcmp(composedPamP->tuple_type, "RGB") == 0) composedPamP->depth = 3; else if (strcmp(composedPamP->tuple_type, "GRAYSCALE") == 0) composedPamP->depth = 1; else if (strcmp(composedPamP->tuple_type, "BLACKANDWHITE") == 0) composedPamP->depth = 1; else /* Results are undefined for this case, so we just do something safe */ composedPamP->depth = MIN(underlayPamP->depth, overlayPamP->depth); }