|
|
@@ -62,7 +62,7 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...) |
|
|
|
char const *file; |
|
|
|
va_list ap; |
|
|
|
|
|
|
|
if(ctx->nimages <= 0) |
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
ctx->nimages--; |
|
|
|
va_start(ap, cmd); |
|
|
@@ -77,7 +77,7 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...) |
|
|
|
char const *method; |
|
|
|
va_list ap; |
|
|
|
|
|
|
|
if(ctx->nimages <= 0) |
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
va_start(ap, cmd); |
|
|
|
method = va_arg(ap, char const *); |
|
|
@@ -119,7 +119,7 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...) |
|
|
|
char const *arg; |
|
|
|
va_list ap; |
|
|
|
|
|
|
|
if(ctx->nimages <= 0) |
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
va_start(ap, cmd); |
|
|
|
arg = va_arg(ap, char const *); |
|
|
@@ -208,14 +208,14 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...) |
|
|
|
} |
|
|
|
else if(!strcmp(cmd, "wrap")) |
|
|
|
{ |
|
|
|
if(ctx->nimages <= 0) |
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
ctx->images[ctx->nimages - 1]->wrap = 1; |
|
|
|
} |
|
|
|
else if(!strcmp(cmd, "autocontrast")) |
|
|
|
{ |
|
|
|
pipi_image_t *tmp; |
|
|
|
if(ctx->nimages <= 0) |
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
tmp = ctx->images[ctx->nimages - 1]; |
|
|
|
ctx->images[ctx->nimages - 1] = pipi_autocontrast(tmp); |
|
|
@@ -223,24 +223,33 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...) |
|
|
|
} |
|
|
|
else if(!strcmp(cmd, "gray")) |
|
|
|
{ |
|
|
|
if(ctx->nimages <= 0) |
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
pipi_getpixels(ctx->images[ctx->nimages - 1], PIPI_PIXELS_Y_F); |
|
|
|
} |
|
|
|
else if(!strcmp(cmd, "free")) |
|
|
|
{ |
|
|
|
if(ctx->nimages <= 0) |
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
ctx->nimages--; |
|
|
|
pipi_free(ctx->images[ctx->nimages]); |
|
|
|
} |
|
|
|
else if(!strcmp(cmd, "dup")) |
|
|
|
{ |
|
|
|
if(ctx->nimages <= 0) |
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
ctx->images[ctx->nimages] = pipi_copy(ctx->images[ctx->nimages - 1]); |
|
|
|
ctx->nimages++; |
|
|
|
} |
|
|
|
else if(!strcmp(cmd, "swap")) |
|
|
|
{ |
|
|
|
pipi_image_t *tmp; |
|
|
|
if(ctx->nimages < 2) |
|
|
|
return -1; |
|
|
|
tmp = ctx->images[ctx->nimages - 1]; |
|
|
|
ctx->images[ctx->nimages - 1] = ctx->images[ctx->nimages - 2]; |
|
|
|
ctx->images[ctx->nimages - 2] = tmp; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return -1; |
|
|
|