diff options
Diffstat (limited to 'other/pamx')
-rw-r--r-- | other/pamx/image.c | 92 | ||||
-rw-r--r-- | other/pamx/image.h | 5 |
2 files changed, 0 insertions, 97 deletions
diff --git a/other/pamx/image.c b/other/pamx/image.c index 3aaa8478..d74795cb 100644 --- a/other/pamx/image.c +++ b/other/pamx/image.c @@ -237,95 +237,3 @@ freeImage(Image * const imageP) { free(imageP); } - - - - -static void -fillRow1(struct pam * const pamP, - tuple * const tuplerow, - unsigned char ** const pP) { - - unsigned int col; - - for (col = 0; col < pamP->width; ++col) { - unsigned int plane; - for (plane = 0; plane < pamP->depth; ++plane) - *(*pP)++ = - pnm_scalesample(tuplerow[col][0], pamP->maxval, 255); - } -} - - - -static void -fillRow3(struct pam * const pamP, - tuple * const tuplerow, - unsigned char ** const pP) { - - unsigned int col; - - for (col = 0; col < pamP->width; ++col) { - unsigned int plane; - for (plane = 0; plane < pamP->depth; ++plane) - *(*pP)++ = - pnm_scalesample(tuplerow[col][plane], pamP->maxval, 255); - } -} - - - -Image * -pbmLoad(const char * const fullname, - const char * const name, - bool const verbose) { - - FILE * ifP; - struct pam pam; - Image * imageP; - unsigned int row; - const char * filename; - tuple * tuplerow; - unsigned char * p; - enum {DEPTH_1, DEPTH_3} depth; - - if (STREQ(fullname, "stdin")) - filename = "-"; - else - filename = fullname; - - ifP = pm_openr(filename); - - pnm_readpaminit(ifP, &pam, PAM_STRUCT_SIZE(tuple_type)); - - if (strncmp(pam.tuple_type, "RGB", 3) == 0) { - depth = DEPTH_3; - if (pam.depth < 3) - pm_error("Invalid depth %u for RGB tuple type.", pam.depth); - } else - depth = DEPTH_1; - - imageP = newTrueImage(pam.width, pam.height); - - p = &imageP->data[0]; /* initial value */ - - tuplerow = pnm_allocpamrow(&pam); - - for (row = 0; row < pam.height; ++row) { - pnm_readpamrow(&pam, tuplerow); - - switch (depth) { - case DEPTH_3: - fillRow3(&pam, tuplerow, &p); - break; - case DEPTH_1: - fillRow1(&pam, tuplerow, &p); - break; - } - } - pnm_freepamrow(tuplerow); - - pm_close(ifP); - - return imageP; -} diff --git a/other/pamx/image.h b/other/pamx/image.h index 9c9689ac..32a48c5a 100644 --- a/other/pamx/image.h +++ b/other/pamx/image.h @@ -82,9 +82,4 @@ colorIntensity(unsigned int const red, BlueIntensity[blu / 256]); } -Image * -pbmLoad(const char * const fullname, - const char * const name, - bool const verbose); - #endif |