/* This file was generated by scramble.py. */
#ifndef _PCODE_HEADER_GUARD_IMAGE_
#define _PCODE_HEADER_GUARD_IMAGE_
#ifndef __cplusplus
typedef enum ImageType ImageType;
#endif
#ifndef __cplusplus
typedef enum ScaleType ScaleType;
#endif
typedef struct Color Color;
typedef struct Image Image;
#include "config.h"
#include "tiff.h"
#include "jpeg.h"
enum ImageType
{
    IT_FLOAT,
    IT_INT,
    IT_BYTE,
    IT_RGB,
};
enum ScaleType
{
    IST_NEAREST,
    IST_BILINEAR,
    IST_BICUBIC,
    /* IST_AVERAGE */
};
struct Color
{
    B r, g, b;
};
struct Image
{
    char *path, *name;
    int type;
    union
    {
        V *v;
        int *i;
        B *b;
        Color *rgb;
    } data;
    int w, h;
    int row;
    int bytes;
    int rowbytes;
    Image *parent;
};
void image_move(Image *image, int x, int y, int w, int h);
Image * image_window(Image *parent, int x, int y, int w, int h);
Image * image_new(B *data, int w, int h, ImageType type);
Image * image_half_v(Image const *src);
Image * image_copy(Image const *src);
void image_transfer(Image const *src, Image *target, int sx, int sy, int tx, int ty, int w, int h);
Image * image_copy_crop(Image const *src, int x, int y, int w, int h);
void image_del(Image *image);
void image_set_path(Image *image, char const *path, int auto_name);
Image * image_new_b(B *data, int w, int h);
Image * image_new_undef_b(int w, int h);
Image * image_new_undef_i(int w, int h);
Image * image_new_undef_f(int w, int h);
Image * image_new_undef_rgb(int w, int h);
V image_mean_area(Image *im, int x, int y, int w, int h);
V image_variance_area(Image *im, int x, int y, int w, int h);
B get_near_pixel(Image *image, int x, int y);
B getpixel_bilinear(Image *image, double x, double y);
B getpixel_bicubic(Image *image, double x, double y);
Image * scale_image(Image *image, int neww, int newh, ScaleType how);
V * duplicate_image(V *image, int w, int h);
void shift_multiply_image(Image *image, V shift, V factor);
void threshold_below(Image *image, int threshold, int value);
void threshold_above(Image *image, int threshold, int value);
void invert(Image *image);
Image * cumulate(Image *image, int cw, int ch);
int bounds_bigger_than_threshold(Image *image, int threshold, int *x, int *y, int *x_, int *y_);
V * new_image(int w, int h);
V * binarize(V *image, int w, int h, V threshold);
void stretch_min_max(Image *image, V newmin, V newmax);
Image * BtoV(Image const *image);
Image * BtoRGB(Image const *image);
Image * VtoB(Image const *image);
Image * image_load_b(char const *filename);
int longest_horizontal_run(Image *image, int border, int threshold);
int longest_vertical_run(Image *image, int border, int threshold);
void set_output_prefix(char const *new_prefix);
void set_output_basename(char const *new_basename);
void get_image_name(Image const *image, char const *name, char *out);
void get_image_name_algo_ext(Image const *image, char const *name, char const *algo, char const *ext, char *out);
void get_image_name_algo(Image const *image, char const *name, char const *algo, char *out);
void get_image_name_algo_key_ext(Image const *image, char const *name, char const *algo, char const *key, char const *ext, char *out);
void get_image_name_algo_key(Image const *image, char const *name, char const *algo, char const *key, char *out);
#endif
/* This file was generated by scramble.py. */
