use mode structs in Point.c

This commit is contained in:
Yay295 2024-04-21 22:36:23 -05:00
parent 26b8178f08
commit f2fac0b39e

View File

@ -128,7 +128,7 @@ im_point_32_8(Imaging imOut, Imaging imIn, im_point_context *context) {
} }
Imaging Imaging
ImagingPoint(Imaging imIn, const char *mode, const void *table) { ImagingPoint(Imaging imIn, const Mode *mode, const void *table) {
/* lookup table transform */ /* lookup table transform */
ImagingSectionCookie cookie; ImagingSectionCookie cookie;
@ -145,10 +145,10 @@ ImagingPoint(Imaging imIn, const char *mode, const void *table) {
} }
if (imIn->type != IMAGING_TYPE_UINT8) { if (imIn->type != IMAGING_TYPE_UINT8) {
if (imIn->type != IMAGING_TYPE_INT32 || strcmp(mode, "L") != 0) { if (imIn->type != IMAGING_TYPE_INT32 || mode != IMAGING_MODE_L) {
goto mode_mismatch; goto mode_mismatch;
} }
} else if (!imIn->image8 && strcmp(imIn->mode, mode) != 0) { } else if (!imIn->image8 && imIn->mode != mode) {
goto mode_mismatch; goto mode_mismatch;
} }
@ -209,8 +209,8 @@ ImagingPointTransform(Imaging imIn, double scale, double offset) {
Imaging imOut; Imaging imOut;
int x, y; int x, y;
if (!imIn || (strcmp(imIn->mode, "I") != 0 && strcmp(imIn->mode, "I;16") != 0 && if (!imIn || (imIn->mode != IMAGING_MODE_I &&
strcmp(imIn->mode, "F") != 0)) { imIn->mode != IMAGING_MODE_I_16 && imIn->mode != IMAGING_MODE_F)) {
return (Imaging)ImagingError_ModeError(); return (Imaging)ImagingError_ModeError();
} }
@ -244,7 +244,7 @@ ImagingPointTransform(Imaging imIn, double scale, double offset) {
ImagingSectionLeave(&cookie); ImagingSectionLeave(&cookie);
break; break;
case IMAGING_TYPE_SPECIAL: case IMAGING_TYPE_SPECIAL:
if (strcmp(imIn->mode, "I;16") == 0) { if (imIn->mode == IMAGING_MODE_I_16) {
ImagingSectionEnter(&cookie); ImagingSectionEnter(&cookie);
for (y = 0; y < imIn->ysize; y++) { for (y = 0; y < imIn->ysize; y++) {
char *in = (char *)imIn->image[y]; char *in = (char *)imIn->image[y];