read.c 539 B

123456789101112131415161718192021222324252627282930
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <grass/config.h>
  5. #include <grass/gis.h>
  6. #include "pngdriver.h"
  7. void read_image(void)
  8. {
  9. char *p = png.file_name + strlen(png.file_name) - 4;
  10. if (G_strcasecmp(p, ".ppm") == 0) {
  11. read_ppm();
  12. if (png.has_alpha)
  13. read_pgm();
  14. }
  15. else if (G_strcasecmp(p, ".bmp") == 0)
  16. read_bmp();
  17. #ifdef HAVE_PNG_H
  18. else if (G_strcasecmp(p, ".png") == 0)
  19. read_png();
  20. #endif
  21. else
  22. G_fatal_error("read_image: unknown file type: %s", p);
  23. png.modified = 0;
  24. }