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

Last change on this file since 2718 was 2718, checked in by Sam Hocevar, 12 years ago
  • Add pipi_invert() to invert an image's colours.
File size: 4.1 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 * pipi.h: the full libpipi public API
17 */
18
19#ifndef __PIPI_H__
20#define __PIPI_H__
21
22#include <stdio.h>
23
24#ifdef __cplusplus
25extern "C"
26{
27#endif
28
29/* pipi_scan_t: this enum is a list of all possible scanning methods when
30 * parsing an image’s pixels. Not all functions support all scanning paths. */
31typedef enum
32{
33    PIPI_SCAN_RASTER = 0,
34    PIPI_SCAN_SERPENTINE = 1
35}
36pipi_scan_t;
37
38/* pipi_format_t: this enum is a list of all possible pixel formats for
39 * our internal images. RGBA32 is the most usual format when an image has
40 * just been loaded, but RGBA_F is a lot better for complex operations. */
41typedef enum
42{
43    PIPI_PIXELS_UNINITIALISED = -1,
44
45    PIPI_PIXELS_RGBA32 = 0,
46    PIPI_PIXELS_BGR24 = 1,
47    PIPI_PIXELS_RGBA_F = 2,
48    PIPI_PIXELS_Y_F = 3,
49
50    PIPI_PIXELS_MAX = 4
51}
52pipi_format_t;
53
54/* pipi_pixels_t: this structure stores a pixel view of an image. */
55typedef struct
56{
57    void *pixels;
58    int w, h, pitch, bpp;
59    size_t bytes;
60}
61pipi_pixels_t;
62
63/* pipi_image_t: the main image type */
64typedef struct pipi_image pipi_image_t;
65
66/* pipi_context_t: the processing stack */
67typedef struct pipi_context pipi_context_t;
68
69
70extern pipi_context_t *pipi_create_context(void);
71extern void pipi_destroy_context(pipi_context_t *);
72extern int pipi_command(pipi_context_t *, char const *, ...);
73
74extern pipi_image_t *pipi_load(char const *);
75extern pipi_image_t *pipi_load_stock(char const *);
76extern pipi_image_t *pipi_new(int, int);
77extern pipi_image_t *pipi_copy(pipi_image_t *);
78extern void pipi_free(pipi_image_t *);
79extern void pipi_save(pipi_image_t *, const char *);
80
81extern pipi_pixels_t *pipi_getpixels(pipi_image_t *, pipi_format_t);
82
83extern double pipi_measure_msd(pipi_image_t *, pipi_image_t *);
84extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *);
85
86extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
87
88extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
89extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
90extern pipi_image_t *pipi_max(pipi_image_t *, pipi_image_t *);
91extern pipi_image_t *pipi_add(pipi_image_t *, pipi_image_t *);
92extern pipi_image_t *pipi_sub(pipi_image_t *, pipi_image_t *);
93extern pipi_image_t *pipi_difference(pipi_image_t *, pipi_image_t *);
94extern pipi_image_t *pipi_multiply(pipi_image_t *, pipi_image_t *);
95extern pipi_image_t *pipi_divide(pipi_image_t *, pipi_image_t *);
96extern pipi_image_t *pipi_screen(pipi_image_t *, pipi_image_t *);
97extern pipi_image_t *pipi_overlay(pipi_image_t *, pipi_image_t *);
98
99extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
100extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
101extern pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *,
102                                            float, float, float, float, float);
103extern pipi_image_t *pipi_box_blur(pipi_image_t *, int);
104extern pipi_image_t *pipi_box_blur_ext(pipi_image_t *, int, int);
105extern pipi_image_t *pipi_autocontrast(pipi_image_t *);
106extern pipi_image_t *pipi_invert(pipi_image_t *);
107
108extern pipi_image_t *pipi_tile(pipi_image_t *, int, int);
109extern int pipi_flood_fill(pipi_image_t *,
110                           int, int, float, float, float, float);
111
112extern pipi_image_t *pipi_dither_floydsteinberg(pipi_image_t *, pipi_scan_t);
113extern pipi_image_t *pipi_dither_jajuni(pipi_image_t *, pipi_scan_t);
114extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
115extern pipi_image_t *pipi_dither_random(pipi_image_t *);
116extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
117extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
118extern void pipi_dither_24to16(pipi_image_t *);
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif /* __PIPI_H__ */
125
Note: See TracBrowser for help on using the repository browser.