source: pwntcha/trunk/src/common.h @ 448

Last change on this file since 448 was 448, checked in by Sam Hocevar, 17 years ago
  • Use font_load_* for all decoders.
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1/*
2 * commin.h: common stuff
3 * $Id: common.h 448 2005-01-10 15:31:33Z 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 */
13struct image
14{
15    int width, height, pitch, channels;
16    unsigned char *pixels;
17    void *priv;
18};
19
20/* font structure */
21struct font
22{
23    struct image *img;
24    struct glyph
25    {
26        int xmin, xmax, ymin, ymax;
27        int count; /* Black pixel count */
28        char c;
29    } *glyphs;
30    int size;
31};
32
33/* global variables */
34extern char *argv0;
35extern char *share;
36
37/* debug function */
38void dprintf(const char *fmt, ...);
39
40/* available CAPTCHA decoders */
41char *decode_authimage(struct image *img);
42char *decode_clubic(struct image *img);
43char *decode_linuxfr(struct image *img);
44char *decode_phpbb(struct image *img);
45char *decode_scode(struct image *img);
46char *decode_slashdot(struct image *img);
47char *decode_vbulletin(struct image *img);
48char *decode_xanga(struct image *img);
49char *decode_test(struct image *img);
50
51/* image operations */
52struct image *image_load(const char *name);
53struct image *image_new(int width, int height);
54struct image *image_dup(struct image *img);
55void image_free(struct image *img);
56void image_save(struct image *img, const char *name);
57void image_swap(struct image *img1, struct image *img2);
58int getgray(struct image *img, int x, int y, int *g);
59int getpixel(struct image *img, int x, int y, int *r, int *g, int *b);
60int setpixel(struct image *img, int x, int y, int r, int g, int b);
61
62/* font operations */
63struct font *font_load_fixed(char *file, char *chars);
64struct font *font_load_variable(char *file, char *chars);
65void font_free(struct font *font);
66
67/* image filters */
68void filter_flood_fill(struct image *img, int x, int y, int r, int g, int b);
69void filter_fill_holes(struct image *img);
70void filter_scale(struct image *img, float ratio);
71void filter_black_stuff(struct image *img);
72void filter_detect_lines(struct image *img);
73void filter_equalize(struct image *img, int threshold);
74void filter_trick(struct image *img);
75void filter_smooth(struct image *img);
76void filter_median(struct image *img);
77void filter_contrast(struct image *img);
78void filter_crop(struct image *img, int xmin, int ymin, int xmax, int ymax);
79int filter_count(struct image *img);
80
Note: See TracBrowser for help on using the repository browser.