source: libpipi/trunk/pipi/pipi.h @ 2865

Last change on this file since 2865 was 2865, checked in by Sam Hocevar, 11 years ago

pipi.c: add pipi_get_version().

File size: 7.1 KB
Line 
1/*
2 *  libpipi       Pathetic image processing interface library
3 *  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
4 *                2008 Jean-Yves Lamoureux <jylam@lnxscene.org
5 *                All Rights Reserved
6 *
7 *  $Id$
8 *
9 *  This library is free software. It comes without any warranty, to
10 *  the extent permitted by applicable law. You can redistribute it
11 *  and/or modify it under the terms of the Do What The Fuck You Want
12 *  To Public License, Version 2, as published by Sam Hocevar. See
13 *  http://sam.zoy.org/wtfpl/COPYING for more details.
14 */
15
16/*
17 * pipi.h: the full libpipi public API
18 */
19
20#ifndef __PIPI_H__
21#define __PIPI_H__
22
23#include <stdio.h>
24#include <string.h>
25#include <stdint.h>
26
27#ifdef __cplusplus
28extern "C"
29{
30#endif
31
32/* pipi_scan_t: this enum is a list of all possible scanning methods when
33 * parsing an image’s pixels. Not all functions support all scanning paths. */
34typedef enum
35{
36    PIPI_SCAN_RASTER = 0,
37    PIPI_SCAN_SERPENTINE = 1
38}
39pipi_scan_t;
40
41/* pipi_format_t: this enum is a list of all possible pixel formats for
42 * our internal images. RGBA32 is the most usual format when an image has
43 * just been loaded, but RGBA_F is a lot better for complex operations. */
44typedef enum
45{
46    PIPI_PIXELS_UNINITIALISED = -1,
47
48    PIPI_PIXELS_RGBA_C = 0,
49    PIPI_PIXELS_BGR_C = 1,
50    PIPI_PIXELS_RGBA_F = 2,
51    PIPI_PIXELS_Y_F = 3,
52
53    PIPI_PIXELS_MASK_C = 4,
54
55    PIPI_PIXELS_MAX = 5
56}
57pipi_format_t;
58
59
60typedef enum
61{
62    PIPI_COLOR_R = 1,
63    PIPI_COLOR_G = 2,
64    PIPI_COLOR_B = 4,
65    PIPI_COLOR_A = 8,
66    PIPI_COLOR_Y = 16
67}
68pipi_color_flag_t;
69
70struct pixel_u32
71{
72    uint8_t r, g, b, a;
73};
74struct pixel_float
75{
76    float r, g, b, a;
77};
78
79typedef struct
80{
81    union
82    {
83        struct pixel_float pixel_float;
84        struct pixel_u32   pixel_u32;
85    };
86}
87pipi_pixel_t;
88
89/* pipi_pixels_t: this structure stores a pixel view of an image. */
90typedef struct
91{
92    void *pixels;
93    int w, h, pitch, bpp;
94    size_t bytes;
95}
96pipi_pixels_t;
97
98/* pipi_image_t: the main image type */
99typedef struct pipi_image pipi_image_t;
100
101/* pipi_context_t: the processing stack */
102typedef struct pipi_context pipi_context_t;
103
104/* pipi_histogram_t: the histogram type */
105typedef struct pipi_histogram pipi_histogram_t;
106
107/* pipi_command_t: the command type */
108typedef struct
109{
110    char const *name;
111    int argc;
112}
113pipi_command_t;
114
115extern pipi_pixel_t *pipi_get_color_from_string(const char* s);
116
117char const * pipi_get_version(void);
118
119extern pipi_context_t *pipi_create_context(void);
120extern void pipi_destroy_context(pipi_context_t *);
121extern pipi_command_t const *pipi_get_command_list(void);
122extern int pipi_command(pipi_context_t *, char const *, ...);
123
124extern pipi_image_t *pipi_load(char const *);
125extern pipi_image_t *pipi_load_stock(char const *);
126extern pipi_image_t *pipi_new(int, int);
127extern pipi_image_t *pipi_copy(pipi_image_t *);
128extern void pipi_free(pipi_image_t *);
129extern int pipi_save(pipi_image_t *, const char *);
130
131extern void pipi_set_gamma(double);
132extern pipi_pixels_t *pipi_getpixels(pipi_image_t *, pipi_format_t);
133extern int pipi_get_image_width(pipi_image_t *img);
134extern int pipi_get_image_height(pipi_image_t *img);
135extern int pipi_get_image_pitch(pipi_image_t *img);
136extern int pipi_get_image_last_modified(pipi_image_t *img);
137extern const char* pipi_get_format_name(int format);
138
139
140extern double pipi_measure_msd(pipi_image_t *, pipi_image_t *);
141extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *);
142
143extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
144
145extern pipi_image_t *pipi_render_random(int, int);
146extern pipi_image_t *pipi_render_bayer(int, int);
147extern pipi_image_t *pipi_render_halftone(int, int);
148
149extern pipi_image_t *pipi_rgb(pipi_image_t *, pipi_image_t *, pipi_image_t *);
150extern pipi_image_t *pipi_red(pipi_image_t *);
151extern pipi_image_t *pipi_green(pipi_image_t *);
152extern pipi_image_t *pipi_blue(pipi_image_t *);
153extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
154extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
155extern pipi_image_t *pipi_max(pipi_image_t *, pipi_image_t *);
156extern pipi_image_t *pipi_add(pipi_image_t *, pipi_image_t *);
157extern pipi_image_t *pipi_sub(pipi_image_t *, pipi_image_t *);
158extern pipi_image_t *pipi_difference(pipi_image_t *, pipi_image_t *);
159extern pipi_image_t *pipi_multiply(pipi_image_t *, pipi_image_t *);
160extern pipi_image_t *pipi_divide(pipi_image_t *, pipi_image_t *);
161extern pipi_image_t *pipi_screen(pipi_image_t *, pipi_image_t *);
162extern pipi_image_t *pipi_overlay(pipi_image_t *, pipi_image_t *);
163
164extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
165extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
166extern pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *,
167                                            float, float, float, float, float);
168extern pipi_image_t *pipi_box_blur(pipi_image_t *, int);
169extern pipi_image_t *pipi_box_blur_ext(pipi_image_t *, int, int);
170extern pipi_image_t *pipi_brightness(pipi_image_t *, double);
171extern pipi_image_t *pipi_contrast(pipi_image_t *, double);
172extern pipi_image_t *pipi_autocontrast(pipi_image_t *);
173extern pipi_image_t *pipi_invert(pipi_image_t *);
174extern pipi_image_t *pipi_threshold(pipi_image_t *, double);
175extern pipi_image_t *pipi_hflip(pipi_image_t *);
176extern pipi_image_t *pipi_vflip(pipi_image_t *);
177extern pipi_image_t *pipi_rotate90(pipi_image_t *);
178extern pipi_image_t *pipi_rotate180(pipi_image_t *);
179extern pipi_image_t *pipi_rotate270(pipi_image_t *);
180extern pipi_image_t *pipi_median(pipi_image_t *, int);
181extern pipi_image_t *pipi_median_ext(pipi_image_t *, int, int);
182extern pipi_image_t *pipi_dilate(pipi_image_t *);
183extern pipi_image_t *pipi_erode(pipi_image_t *);
184
185extern pipi_image_t *pipi_order(pipi_image_t *);
186
187extern pipi_image_t *pipi_tile(pipi_image_t *, int, int);
188extern int pipi_flood_fill(pipi_image_t *,
189                           int, int, float, float, float, float);
190extern int pipi_draw_line(pipi_image_t *, int, int, int, int, uint32_t, int);
191extern int pipi_draw_polyline(pipi_image_t *, int const[], int const[],
192                              int , uint32_t, int);
193extern int pipi_draw_bezier4(pipi_image_t *,int, int, int, int, int, int, int, int, uint32_t, int, int);
194extern pipi_image_t *pipi_reduce(pipi_image_t *, int, double const *);
195
196extern pipi_image_t *pipi_dither_ediff(pipi_image_t *, pipi_image_t *,
197                                       pipi_scan_t);
198extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
199extern pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *, pipi_image_t *,
200                                             double, double);
201extern pipi_image_t *pipi_dither_halftone(pipi_image_t *, double, double);
202extern pipi_image_t *pipi_dither_random(pipi_image_t *);
203extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
204extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
205extern void pipi_dither_24to16(pipi_image_t *);
206
207extern pipi_histogram_t* pipi_new_histogram(void);
208extern int pipi_get_image_histogram(pipi_image_t *, pipi_histogram_t *, int);
209extern int pipi_free_histogram(pipi_histogram_t*);
210extern int pipi_render_histogram(pipi_image_t *, pipi_histogram_t*, int);
211
212
213#ifdef __cplusplus
214}
215#endif
216
217#endif /* __PIPI_H__ */
218
Note: See TracBrowser for help on using the repository browser.