|
|
@@ -131,6 +131,32 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...) |
|
|
|
pipi_free(src); |
|
|
|
ctx->images[ctx->nimages - 1] = dst; |
|
|
|
} |
|
|
|
else if(!strcmp(cmd, "geometry")) |
|
|
|
{ |
|
|
|
pipi_image_t *src, *dst; |
|
|
|
char const *arg; |
|
|
|
va_list ap; |
|
|
|
int w, h; |
|
|
|
|
|
|
|
if(ctx->nimages < 1) |
|
|
|
return -1; |
|
|
|
va_start(ap, cmd); |
|
|
|
arg = va_arg(ap, char const *); |
|
|
|
va_end(ap); |
|
|
|
w = atoi(arg); |
|
|
|
arg = strchr(arg, 'x'); |
|
|
|
if(!arg) |
|
|
|
return -1; |
|
|
|
h = atoi(arg + 1); |
|
|
|
if(w <= 0 || h <= 0) |
|
|
|
return -1; |
|
|
|
src = ctx->images[ctx->nimages - 1]; |
|
|
|
dst = pipi_resize(src, w, h); |
|
|
|
if(dst == NULL) |
|
|
|
return -1; |
|
|
|
pipi_free(src); |
|
|
|
ctx->images[ctx->nimages - 1] = dst; |
|
|
|
} |
|
|
|
else if(!strcmp(cmd, "mean")) |
|
|
|
{ |
|
|
|
pipi_image_t *dst; |
|
|
|