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

Last change on this file since 2759 was 2759, checked in by sam, 6 years ago
  • Get rid of the specific error diffusion functions, since our stock kernels work perfectly well.
File size: 1.6 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 "config.h"
20#include "common.h"
21
22#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
25
26#include "pipi.h"
27#include "pipi_internals.h"
28
29pipi_image_t *pipi_load(char const *name)
30{
31    if(!strncmp(name, "random:", 7) ||
32       !strncmp(name, "ediff:", 6) ||
33       !strncmp(name, "bayer:", 6))
34        return pipi_load_stock(name);
35
36#if USE_IMLIB2
37    return pipi_load_imlib2(name);
38#elif USE_OPENCV
39    return pipi_load_opencv(name);
40#elif USE_SDL
41    return pipi_load_sdl(name);
42#else
43#   error "No imaging library"
44#endif
45}
46
47void pipi_free(pipi_image_t *img)
48{
49    int i;
50
51    for(i = 0; i < PIPI_PIXELS_MAX; i++)
52        if(i != img->codec_format && img->p[i].pixels)
53            free(img->p[i].pixels);
54
55    if(img->codec_priv)
56#if USE_IMLIB2
57        pipi_free_imlib2(img);
58#elif USE_OPENCV
59        pipi_free_opencv(img);
60#elif USE_SDL
61        pipi_free_sdl(img);
62#endif
63
64    free(img);
65}
66
67void pipi_save(pipi_image_t *img, const char *name)
68{
69#if USE_IMLIB2
70    return pipi_save_imlib2(img, name);
71#elif USE_OPENCV
72    return pipi_save_opencv(img, name);
73#elif USE_SDL
74    return pipi_save_sdl(img, name);
75#endif
76}
77
Note: See TracBrowser for help on using the repository browser.