25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
815 B

  1. #include "config.h"
  2. #include "common.h"
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <pipi.h>
  7. int main(int argc, char *argv[])
  8. {
  9. char *srcname = NULL, *dstname = NULL;
  10. pipi_image_t *img, *newimg;
  11. int ret = 0;
  12. if(argc < 4)
  13. {
  14. fprintf(stderr, "%s: too few arguments\n", argv[0]);
  15. fprintf(stderr, "Usage: %s <src> <x> <y> <dest>\n", argv[0]);
  16. return EXIT_FAILURE;
  17. }
  18. srcname = argv[1];
  19. dstname = argv[4];
  20. img = pipi_load(srcname);
  21. if(!img) {
  22. fprintf(stderr, "Can't open %s for reading\n", srcname);
  23. }
  24. newimg = pipi_copy(img);
  25. pipi_free(img);
  26. ret = pipi_flood_fill(newimg, atoi(argv[2]), atoi(argv[3]), 1, 0, 0, 1);
  27. if(!ret) pipi_save(newimg, dstname);
  28. pipi_free(newimg);
  29. return ret;
  30. }