/* * libpipi Proper image processing implementation library * Copyright (c) 2004-2008 Sam Hocevar * All Rights Reserved * * $Id$ * * This library is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */ /* * codec.c: image I/O functions */ #include #include #include "config.h" #include "common.h" #include "pipi.h" #include "pipi_internals.h" pipi_image_t *pipi_load(const char *name) { #if USE_SDL return pipi_load_sdl(name); #elif USE_IMLIB2 return pipi_load_imlib2(name); #elif USE_OPENCV return pipi_load_opencv(name); #else # error "No imaging library" #endif } pipi_image_t *pipi_new(int width, int height) { #if USE_SDL return pipi_new_sdl(width, height); #elif USE_IMLIB2 return pipi_new_imlib2(width, height); #elif USE_OPENCV return pipi_new_opencv(width, height); #endif } void pipi_free(pipi_image_t *img) { unsigned int i; for(i = 0; i < PIPI_PIXELS_MAX; i++) if(i != img->codec_format && img->p[i].pixels) free(img->p[i].pixels); #if USE_SDL return pipi_free_sdl(img); #elif USE_IMLIB2 return pipi_free_imlib2(img); #elif USE_OPENCV return pipi_free_opencv(img); #endif } void pipi_save(pipi_image_t *img, const char *name) { #if USE_SDL return pipi_save_sdl(img, name); #elif USE_IMLIB2 return pipi_save_imlib2(img, name); #elif USE_OPENCV return pipi_save_opencv(img, name); #endif }