Changeset 2753 for libpipi


Ignore:
Timestamp:
Aug 23, 2008, 11:11:10 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • rgb.c: implement pipi_rgb(), to combine three RGB channels.
Location:
libpipi/trunk
Files:
1 added
4 edited

Legend:

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

    r2751 r2753  
    4646
    4747combine_sources = \
     48        combine/rgb.c \
    4849        combine/mean.c \
    4950        combine/minmax.c \
  • libpipi/trunk/pipi/context.c

    r2752 r2753  
    374374        pipi_free(tmp);
    375375    }
     376    else if(!strcmp(cmd, "rgb"))
     377    {
     378        pipi_image_t *dst;
     379
     380        if(ctx->nimages < 3)
     381            return -1;
     382        dst = pipi_rgb(ctx->images[ctx->nimages - 3],
     383                       ctx->images[ctx->nimages - 2],
     384                       ctx->images[ctx->nimages - 1]);
     385        if(dst == NULL)
     386            return -1;
     387        pipi_free(ctx->images[ctx->nimages - 3]);
     388        pipi_free(ctx->images[ctx->nimages - 2]);
     389        pipi_free(ctx->images[ctx->nimages - 1]);
     390        ctx->images[ctx->nimages - 3] = dst;
     391        ctx->nimages -= 2;
     392    }
    376393    else if(!strcmp(cmd, "mean"))
    377394    {
  • libpipi/trunk/pipi/pipi.h

    r2751 r2753  
    106106extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
    107107
     108extern pipi_image_t *pipi_rgb(pipi_image_t *, pipi_image_t *, pipi_image_t *);
    108109extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
    109110extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
  • libpipi/trunk/src/pipi.c

    r2752 r2753  
    169169                return EXIT_FAILURE;
    170170        }
     171        else if(!strcmp(argv[0], "--rgb"))
     172        {
     173            if(pipi_command(ctx, "rgb") != 0)
     174                return EXIT_FAILURE;
     175        }
    171176        else if(!strcmp(argv[0], "--mean"))
    172177        {
Note: See TracChangeset for help on using the changeset viewer.