|
- /*
- * libpipi Proper image processing implementation library
- * Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
- * All Rights Reserved
- *
- * $Id$
- *
- * This library is free software. It comes without any warranty, to
- * the extent permitted by applicable law. You can redistribute it
- * and/or modify it under the terms of the Do What The Fuck You Want
- * To Public License, Version 2, as published by Sam Hocevar. See
- * http://sam.zoy.org/wtfpl/COPYING for more details.
- */
-
- /*
- * pipi.h: the full libpipi public API
- */
-
- #ifndef __PIPI_H__
- #define __PIPI_H__
-
- #include <stdio.h>
- #include <string.h>
-
- #ifdef __cplusplus
- extern "C"
- {
- #endif
-
- /* pipi_scan_t: this enum is a list of all possible scanning methods when
- * parsing an image’s pixels. Not all functions support all scanning paths. */
- typedef enum
- {
- PIPI_SCAN_RASTER = 0,
- PIPI_SCAN_SERPENTINE = 1
- }
- pipi_scan_t;
-
- /* pipi_format_t: this enum is a list of all possible pixel formats for
- * our internal images. RGBA32 is the most usual format when an image has
- * just been loaded, but RGBA_F is a lot better for complex operations. */
- typedef enum
- {
- PIPI_PIXELS_UNINITIALISED = -1,
-
- PIPI_PIXELS_RGBA_C = 0,
- PIPI_PIXELS_BGR_C = 1,
- PIPI_PIXELS_RGBA_F = 2,
- PIPI_PIXELS_Y_F = 3,
-
- PIPI_PIXELS_MASK_C = 4,
-
- PIPI_PIXELS_MAX = 5
- }
- pipi_format_t;
-
- struct pixel_u32
- {
- uint8_t r, g, b, a;
- };
- struct pixel_float
- {
- float r, g, b, a;
- };
-
- typedef struct
- {
- union
- {
- struct pixel_u32 pixel_u32;
- struct pixel_float pixel_float;
- };
- }
- pipi_pixel_t;
-
- /* pipi_pixels_t: this structure stores a pixel view of an image. */
- typedef struct
- {
- void *pixels;
- int w, h, pitch, bpp;
- size_t bytes;
- }
- pipi_pixels_t;
-
- /* pipi_image_t: the main image type */
- typedef struct pipi_image pipi_image_t;
-
- /* pipi_context_t: the processing stack */
- typedef struct pipi_context pipi_context_t;
-
-
- extern pipi_context_t *pipi_create_context(void);
- extern void pipi_destroy_context(pipi_context_t *);
- extern int pipi_command(pipi_context_t *, char const *, ...);
-
- extern pipi_image_t *pipi_load(char const *);
- extern pipi_image_t *pipi_load_stock(char const *);
- extern pipi_image_t *pipi_new(int, int);
- extern pipi_image_t *pipi_copy(pipi_image_t *);
- extern void pipi_free(pipi_image_t *);
- extern void pipi_save(pipi_image_t *, const char *);
-
- extern pipi_pixels_t *pipi_getpixels(pipi_image_t *, pipi_format_t);
- extern int pipi_get_image_width(pipi_image_t *img);
- extern int pipi_get_image_height(pipi_image_t *img);
- extern int pipi_get_image_pitch(pipi_image_t *img);
-
- extern double pipi_measure_msd(pipi_image_t *, pipi_image_t *);
- extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *);
-
- extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
-
- extern pipi_image_t *pipi_render_random(int, int);
- extern pipi_image_t *pipi_render_bayer(int, int);
- extern pipi_image_t *pipi_render_halftone(int, int);
-
- extern pipi_image_t *pipi_rgb(pipi_image_t *, pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_red(pipi_image_t *);
- extern pipi_image_t *pipi_green(pipi_image_t *);
- extern pipi_image_t *pipi_blue(pipi_image_t *);
- extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_max(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_add(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_sub(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_difference(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_multiply(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_divide(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_screen(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_overlay(pipi_image_t *, pipi_image_t *);
-
- extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
- extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
- extern pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *,
- float, float, float, float, float);
- extern pipi_image_t *pipi_box_blur(pipi_image_t *, int);
- extern pipi_image_t *pipi_box_blur_ext(pipi_image_t *, int, int);
- extern pipi_image_t *pipi_brightness(pipi_image_t *, double);
- extern pipi_image_t *pipi_contrast(pipi_image_t *, double);
- extern pipi_image_t *pipi_autocontrast(pipi_image_t *);
- extern pipi_image_t *pipi_invert(pipi_image_t *);
- extern pipi_image_t *pipi_threshold(pipi_image_t *, double);
- extern pipi_image_t *pipi_hflip(pipi_image_t *);
- extern pipi_image_t *pipi_vflip(pipi_image_t *);
- extern pipi_image_t *pipi_rotate90(pipi_image_t *);
- extern pipi_image_t *pipi_rotate180(pipi_image_t *);
- extern pipi_image_t *pipi_rotate270(pipi_image_t *);
- extern pipi_image_t *pipi_median(pipi_image_t *, int);
- extern pipi_image_t *pipi_median_ext(pipi_image_t *, int, int);
- extern pipi_image_t *pipi_dilate(pipi_image_t *);
- extern pipi_image_t *pipi_erode(pipi_image_t *);
-
- extern pipi_image_t *pipi_order(pipi_image_t *);
-
- extern pipi_image_t *pipi_tile(pipi_image_t *, int, int);
- extern int pipi_flood_fill(pipi_image_t *,
- int, int, float, float, float, float);
- extern int pipi_draw_line(pipi_image_t *, int, int, int, int, uint32_t, int);
- extern int pipi_draw_polyline(pipi_image_t *, int const[], int const[],
- int , uint32_t, int);
- extern int pipi_draw_bezier4(pipi_image_t *,int, int, int, int, int, int, int, int, uint32_t, int, int);
- extern pipi_image_t *pipi_reduce(pipi_image_t *, int, double const *);
-
- extern pipi_image_t *pipi_dither_ediff(pipi_image_t *, pipi_image_t *,
- pipi_scan_t);
- extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
- extern pipi_image_t *pipi_dither_halftone(pipi_image_t *, double, double);
- extern pipi_image_t *pipi_dither_random(pipi_image_t *);
- extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
- extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
- extern void pipi_dither_24to16(pipi_image_t *);
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __PIPI_H__ */
|