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