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