You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

53 lines
1.0 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. pipi_draw_line(newimg,
  31. rand() , rand() % h,
  32. rand() % w, rand() % h,
  33. rand(),
  34. 1);
  35. }
  36. pipi_save(newimg, dstname);
  37. pipi_free(newimg);
  38. return ret;
  39. }