source: libpipi/trunk/pipi/pipi_internals.h @ 3343

Last change on this file since 3343 was 3343, checked in by Sam Hocevar, 12 years ago

Got rid of the modular codec stuff. All codecs should work the same way.

File size: 3.2 KB
Line 
1/*
2 *  libpipi       Pathetic image processing interface 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 *  pipi_internals.h: internal types
17 */
18
19#ifndef __PIPI_INTERNALS_H__
20#define __PIPI_INTERNALS_H__
21
22#include "pipi_stubs.h"
23
24#define SET_FLAG_GRAY 0x00000001
25#define SET_FLAG_WRAP 0x00000002
26#define SET_FLAG_8BIT 0x00000004
27
28struct pipi_histogram
29{
30    int r_present, g_present, b_present, y_present;
31    unsigned int a[256];
32    unsigned int r[256];
33    unsigned int g[256];
34    unsigned int b[256];
35    unsigned int y[256];
36};
37
38#ifdef USE_TILES
39#define TILE_SIZE 128
40
41struct pipi_tile
42{
43    int x, y;
44    int zoom;
45
46    int refcount;
47
48    pipi_format_t fmt;
49    int plane;
50    union { uint8_t *u8; float *f; double *d; } data;
51    union { uint8_t u8[1]; float f[1]; double d[1]; } align;
52};
53#endif /* USE_TILES */
54
55/* pipi_image_t: the image structure. This is probably going to be the most
56 * complex structure in the library, but right now it only has fairly normal
57 * stuff, like width and height and pointers to pixel areas. */
58struct pipi_image
59{
60    int w, h, pitch;
61
62#ifdef USE_TILES
63    pipi_tile_t **tiles;
64    int ntiles;
65#endif /* USE_TILES */
66
67    /* A list of internal image flags.
68     *  wrap: should filters wrap around at edges?
69     *  u8: are the image samples still 8-bit per channel? */
70    int wrap, u8;
71
72    /* Translation vectors for wrap around and tiling. */
73    int wrapx1, wrapy1, wrapx2, wrapy2;
74
75    /* List of all possible pixel formats and the last active one. */
76    pipi_pixels_t p[PIPI_PIXELS_MAX];
77    pipi_format_t last_modified;
78
79    /* Private data used by the codec */
80    pipi_format_t codec_format;
81    void *codec_priv;
82    int (*codec_free)(pipi_image_t *);
83};
84
85struct pipi_context
86{
87    int nimages;
88    pipi_image_t *images[1024]; /* FIXME: do dynamic allocation */
89};
90
91#ifdef USE_IMLIB2
92pipi_image_t *pipi_load_imlib2(const char *name);
93int pipi_save_imlib2(pipi_image_t *img, const char *name);
94#endif
95
96#ifdef USE_OPENCV
97pipi_image_t *pipi_load_opencv(const char *name);
98int pipi_save_opencv(pipi_image_t *img, const char *name);
99#endif
100
101#ifdef USE_SDL
102pipi_image_t *pipi_load_sdl(const char *name);
103int pipi_save_sdl(pipi_image_t *img, const char *name);
104#endif
105
106#ifdef USE_GDIPLUS
107pipi_image_t *pipi_load_gdiplus(const char *name);
108int pipi_save_gdiplus(pipi_image_t *img, const char *name);
109#endif
110
111#ifdef USE_GDI
112pipi_image_t *pipi_load_gdi(const char *name);
113int pipi_save_gdi(pipi_image_t *img, const char *name);
114#endif
115
116#ifdef USE_COCOA
117pipi_image_t *pipi_load_coreimage(const char *name);
118int pipi_save_coreimage(pipi_image_t *img, const char *name);
119#endif
120
121#ifdef USE_JPEG
122pipi_image_t *pipi_load_jpeg(const char *name);
123int pipi_save_jpeg(pipi_image_t *img, const char *name);
124#endif
125
126pipi_image_t *pipi_load_oric(const char *name);
127int pipi_save_oric(pipi_image_t *img, const char *name);
128
129#endif /* __PIPI_INTERNALS_H__ */
130
Note: See TracBrowser for help on using the repository browser.