1 | /* |
---|
2 | * commin.h: common stuff |
---|
3 | * $Id: common.h 446 2005-01-10 13:21:50Z sam $ |
---|
4 | * |
---|
5 | * Copyright: (c) 2004 Sam Hocevar <sam@zoy.org> |
---|
6 | * This program is free software; you can redistribute it and/or |
---|
7 | * modify it under the terms of the Do What The Fuck You Want To |
---|
8 | * Public License as published by Banlu Kemiyatorn. See |
---|
9 | * http://sam.zoy.org/projects/COPYING.WTFPL for more details. |
---|
10 | */ |
---|
11 | |
---|
12 | /* image structure */ |
---|
13 | struct image |
---|
14 | { |
---|
15 | int width, height, pitch, channels; |
---|
16 | unsigned char *pixels; |
---|
17 | void *priv; |
---|
18 | }; |
---|
19 | |
---|
20 | /* font structure */ |
---|
21 | struct font |
---|
22 | { |
---|
23 | struct image *img; |
---|
24 | struct glyph |
---|
25 | { |
---|
26 | int xmin, xmax, ymin, ymax; |
---|
27 | int count; /* Black pixel count */ |
---|
28 | } *glyphs; |
---|
29 | }; |
---|
30 | |
---|
31 | /* global variables */ |
---|
32 | extern char *argv0; |
---|
33 | extern char *share; |
---|
34 | |
---|
35 | /* debug function */ |
---|
36 | void dprintf(const char *fmt, ...); |
---|
37 | |
---|
38 | /* available CAPTCHA decoders */ |
---|
39 | char *decode_authimage(struct image *img); |
---|
40 | char *decode_clubic(struct image *img); |
---|
41 | char *decode_linuxfr(struct image *img); |
---|
42 | char *decode_phpbb(struct image *img); |
---|
43 | char *decode_scode(struct image *img); |
---|
44 | char *decode_slashdot(struct image *img); |
---|
45 | char *decode_vbulletin(struct image *img); |
---|
46 | char *decode_xanga(struct image *img); |
---|
47 | char *decode_test(struct image *img); |
---|
48 | |
---|
49 | /* image operations */ |
---|
50 | struct image *image_load(const char *name); |
---|
51 | struct image *image_new(int width, int height); |
---|
52 | struct image *image_dup(struct image *img); |
---|
53 | void image_free(struct image *img); |
---|
54 | void image_save(struct image *img, const char *name); |
---|
55 | void image_swap(struct image *img1, struct image *img2); |
---|
56 | int getgray(struct image *img, int x, int y, int *g); |
---|
57 | int getpixel(struct image *img, int x, int y, int *r, int *g, int *b); |
---|
58 | int setpixel(struct image *img, int x, int y, int r, int g, int b); |
---|
59 | |
---|
60 | /* image filters */ |
---|
61 | void filter_flood_fill(struct image *img, int x, int y, int r, int g, int b); |
---|
62 | void filter_fill_holes(struct image *img); |
---|
63 | void filter_scale(struct image *img, float ratio); |
---|
64 | void filter_black_stuff(struct image *img); |
---|
65 | void filter_detect_lines(struct image *img); |
---|
66 | void filter_equalize(struct image *img, int threshold); |
---|
67 | void filter_trick(struct image *img); |
---|
68 | void filter_smooth(struct image *img); |
---|
69 | void filter_median(struct image *img); |
---|
70 | void filter_contrast(struct image *img); |
---|
71 | void filter_crop(struct image *img, int xmin, int ymin, int xmax, int ymax); |
---|
72 | int filter_count(struct image *img); |
---|
73 | |
---|