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

59 lines
1.2 KiB

  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 count = 10000;
  12. int ret = 0;
  13. if(argc < 2)
  14. {
  15. fprintf(stderr, "%s: too few arguments\n", argv[0]);
  16. fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]);
  17. return EXIT_FAILURE;
  18. }
  19. srcname = argv[1];
  20. dstname = argv[2];
  21. img = pipi_load(srcname);
  22. if(!img) {
  23. fprintf(stderr, "Can't open %s for reading\n", srcname);
  24. }
  25. newimg = pipi_copy(img);
  26. pipi_free(img);
  27. int w = pipi_get_image_width(newimg);
  28. int h = pipi_get_image_height(newimg);
  29. while(count--)
  30. {
  31. pipi_draw_line(newimg,
  32. rand() % w, rand() % h,
  33. rand() % w, rand() % h,
  34. rand(),
  35. 0);
  36. pipi_draw_line(newimg,
  37. rand() % w, rand() % h,
  38. rand() % w, rand() % h,
  39. rand(),
  40. 1);
  41. }
  42. pipi_save(newimg, dstname);
  43. pipi_free(newimg);
  44. return ret;
  45. }