source: libpipi/trunk/pipi/codec.c @ 2632

Last change on this file since 2632 was 2632, checked in by Sam Hocevar, 12 years ago
  • codec.c: bump Imlib2 and OpenCV priorities over SDL.
File size: 1.5 KB
Line 
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/*
16 * codec.c: image I/O functions
17 */
18
19#include <stdio.h>
20#include <stdlib.h>
21
22#include "config.h"
23#include "common.h"
24
25#include "pipi.h"
26#include "pipi_internals.h"
27
28pipi_image_t *pipi_load(const char *name)
29{
30#if USE_IMLIB2
31    return pipi_load_imlib2(name);
32#elif USE_OPENCV
33    return pipi_load_opencv(name);
34#elif USE_SDL
35    return pipi_load_sdl(name);
36#else
37#   error "No imaging library"
38#endif
39}
40
41void pipi_free(pipi_image_t *img)
42{
43    int i;
44
45    for(i = 0; i < PIPI_PIXELS_MAX; i++)
46        if(i != img->codec_format && img->p[i].pixels)
47            free(img->p[i].pixels);
48
49    if(img->codec_priv)
50#if USE_IMLIB2
51        pipi_free_imlib2(img);
52#elif USE_OPENCV
53        pipi_free_opencv(img);
54#elif USE_SDL
55        pipi_free_sdl(img);
56#endif
57
58    free(img);
59}
60
61void pipi_save(pipi_image_t *img, const char *name)
62{
63#if USE_IMLIB2
64    return pipi_save_imlib2(img, name);
65#elif USE_OPENCV
66    return pipi_save_opencv(img, name);
67#elif USE_SDL
68    return pipi_save_sdl(img, name);
69#endif
70}
71
Note: See TracBrowser for help on using the repository browser.