74 righe
1.5 KiB

  1. /*
  2. * libpipi Proper image processing implementation library
  3. * Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. /*
  15. * codec.c: image I/O functions
  16. */
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include "config.h"
  20. #include "common.h"
  21. #include "pipi.h"
  22. #include "pipi_internals.h"
  23. pipi_image_t *pipi_load(const char *name)
  24. {
  25. #if USE_SDL
  26. return pipi_load_sdl(name);
  27. #elif USE_IMLIB2
  28. return pipi_load_imlib2(name);
  29. #elif USE_OPENCV
  30. return pipi_load_opencv(name);
  31. #else
  32. # error "No imaging library"
  33. #endif
  34. }
  35. pipi_image_t *pipi_new(int width, int height)
  36. {
  37. #if USE_SDL
  38. return pipi_new_sdl(width, height);
  39. #elif USE_IMLIB2
  40. return pipi_new_imlib2(width, height);
  41. #elif USE_OPENCV
  42. return pipi_new_opencv(width, height);
  43. #endif
  44. }
  45. void pipi_free(pipi_image_t *img)
  46. {
  47. #if USE_SDL
  48. return pipi_free_sdl(img);
  49. #elif USE_IMLIB2
  50. return pipi_free_imlib2(img);
  51. #elif USE_OPENCV
  52. return pipi_free_opencv(img);
  53. #endif
  54. }
  55. void pipi_save(pipi_image_t *img, const char *name)
  56. {
  57. #if USE_SDL
  58. return pipi_save_sdl(img, name);
  59. #elif USE_IMLIB2
  60. return pipi_save_imlib2(img, name);
  61. #elif USE_OPENCV
  62. return pipi_save_opencv(img, name);
  63. #endif
  64. }