Changeset 3547


Ignore:
Timestamp:
Jul 9, 2009, 1:38:46 AM (11 years ago)
Author:
Sam Hocevar
Message:

Implement pipi_blit().

Location:
libpipi/trunk/pipi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/Makefile.am

    r3546 r3547  
    6060
    6161combine_sources = \
     62        combine/blit.c \
    6263        combine/rgb.c \
    6364        combine/merge.c \
  • libpipi/trunk/pipi/context.c

    r3546 r3547  
    8080        { "combine", 0 },
    8181        { "split", 0 },
     82        { "blit", 1 },
    8283        { "mean", 0 },
    8384        { "merge", 1 },
     
    462463        ctx->nimages -= 2;
    463464    }
     465    else if(!strcmp(cmd, "blit"))
     466    {
     467        pipi_image_t *dst;
     468        char const *arg;
     469        va_list ap;
     470        int x, y;
     471
     472        if(ctx->nimages < 2)
     473            return -1;
     474        va_start(ap, cmd);
     475        arg = va_arg(ap, char const *);
     476        va_end(ap);
     477        x = atoi(arg);
     478        arg = strchr(arg, 'x');
     479        if(!arg)
     480            return -1;
     481        y = atoi(arg + 1);
     482
     483        dst = pipi_blit(ctx->images[ctx->nimages - 2],
     484                        ctx->images[ctx->nimages - 1], x, y);
     485        if(dst == NULL)
     486            return -1;
     487        pipi_free(ctx->images[ctx->nimages - 2]);
     488        pipi_free(ctx->images[ctx->nimages - 1]);
     489        ctx->images[ctx->nimages - 2] = dst;
     490        ctx->nimages--;
     491    }
    464492    else if(!strcmp(cmd, "merge"))
    465493    {
  • libpipi/trunk/pipi/pipi.h

    r3546 r3547  
    168168__extern pipi_image_t *pipi_green(pipi_image_t *);
    169169__extern pipi_image_t *pipi_blue(pipi_image_t *);
     170__extern pipi_image_t *pipi_blit(pipi_image_t *, pipi_image_t *, int, int);
    170171__extern pipi_image_t *pipi_merge(pipi_image_t *, pipi_image_t *, double);
    171172__extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
Note: See TracChangeset for help on using the changeset viewer.