| 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 | * pipi_internals.h: internal types |
|---|
| 17 | */ |
|---|
| 18 | |
|---|
| 19 | #ifndef __PIPI_INTERNALS_H__ |
|---|
| 20 | #define __PIPI_INTERNALS_H__ |
|---|
| 21 | |
|---|
| 22 | #define SET_FLAG_GRAY 0x00000001 |
|---|
| 23 | #define SET_FLAG_WRAP 0x00000002 |
|---|
| 24 | #define SET_FLAG_8BIT 0x00000004 |
|---|
| 25 | |
|---|
| 26 | struct pipi_histogram |
|---|
| 27 | { |
|---|
| 28 | int r_present, g_present, b_present, y_present; |
|---|
| 29 | unsigned int a[256]; |
|---|
| 30 | unsigned int r[256]; |
|---|
| 31 | unsigned int g[256]; |
|---|
| 32 | unsigned int b[256]; |
|---|
| 33 | unsigned int y[256]; |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | /* pipi_image_t: the image structure. This is probably going to be the most |
|---|
| 38 | * complex structure in the library, but right now it only has fairly normal |
|---|
| 39 | * stuff, like width and height and pointers to pixel areas. */ |
|---|
| 40 | struct pipi_image |
|---|
| 41 | { |
|---|
| 42 | int w, h, pitch; |
|---|
| 43 | |
|---|
| 44 | /* A list of internal image flags. |
|---|
| 45 | * wrap: should filters wrap around at edges? |
|---|
| 46 | * u8: are the image samples still 8-bit per channel? */ |
|---|
| 47 | int wrap, u8; |
|---|
| 48 | |
|---|
| 49 | /* Translation vectors for wrap around and tiling. */ |
|---|
| 50 | int wrapx1, wrapy1, wrapx2, wrapy2; |
|---|
| 51 | |
|---|
| 52 | /* List of all possible pixel formats and the last active one. */ |
|---|
| 53 | pipi_pixels_t p[PIPI_PIXELS_MAX]; |
|---|
| 54 | pipi_format_t last_modified; |
|---|
| 55 | |
|---|
| 56 | /* Private data used by the codec */ |
|---|
| 57 | pipi_format_t codec_format; |
|---|
| 58 | void *codec_priv; |
|---|
| 59 | }; |
|---|
| 60 | |
|---|
| 61 | struct pipi_context |
|---|
| 62 | { |
|---|
| 63 | int nimages; |
|---|
| 64 | pipi_image_t *images[1024]; /* FIXME: do dynamic allocation */ |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | #ifdef USE_IMLIB2 |
|---|
| 68 | pipi_image_t *pipi_load_imlib2(const char *name); |
|---|
| 69 | pipi_image_t *pipi_new_imlib2(int width, int height); |
|---|
| 70 | void pipi_free_imlib2(pipi_image_t *img); |
|---|
| 71 | void pipi_save_imlib2(pipi_image_t *img, const char *name); |
|---|
| 72 | #endif |
|---|
| 73 | |
|---|
| 74 | #ifdef USE_OPENCV |
|---|
| 75 | pipi_image_t *pipi_load_opencv(const char *name); |
|---|
| 76 | pipi_image_t *pipi_new_opencv(int width, int height); |
|---|
| 77 | void pipi_free_opencv(pipi_image_t *img); |
|---|
| 78 | void pipi_save_opencv(pipi_image_t *img, const char *name); |
|---|
| 79 | #endif |
|---|
| 80 | |
|---|
| 81 | #ifdef USE_SDL |
|---|
| 82 | pipi_image_t *pipi_load_sdl(const char *name); |
|---|
| 83 | pipi_image_t *pipi_new_sdl(int width, int height); |
|---|
| 84 | void pipi_free_sdl(pipi_image_t *img); |
|---|
| 85 | void pipi_save_sdl(pipi_image_t *img, const char *name); |
|---|
| 86 | #endif |
|---|
| 87 | |
|---|
| 88 | #endif /* __PIPI_INTERNALS_H__ */ |
|---|
| 89 | |
|---|