source: libpipi/trunk/examples/floodfill.c

Last change on this file was 2902, checked in by Sam Hocevar, 14 years ago

Support C99 types on Win32 through the same hacks as in libcaca.

File size: 795 bytes
Line 
1#include "config.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6
7#include <pipi.h>
8
9int main(int argc, char *argv[])
10{
11    char *srcname = NULL, *dstname = NULL;
12    pipi_image_t *img, *newimg;
13    int ret = 0;
14    if(argc < 4)
15    {
16        fprintf(stderr, "%s: too few arguments\n", argv[0]);
17        fprintf(stderr, "Usage: %s <src> <x> <y> <dest>\n", argv[0]);
18        return EXIT_FAILURE;
19    }
20
21    srcname = argv[1];
22    dstname = argv[4];
23
24    img = pipi_load(srcname);
25
26    if(!img) {
27        fprintf(stderr, "Can't open %s for reading\n", srcname);
28    }
29
30    newimg = pipi_copy(img);
31    pipi_free(img);
32    ret = pipi_flood_fill(newimg, atoi(argv[2]), atoi(argv[3]), 1, 0, 0, 1);
33
34    if(!ret) pipi_save(newimg, dstname);
35
36
37    pipi_free(newimg);
38
39    return ret;
40}
41
Note: See TracBrowser for help on using the repository browser.