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

Last change on this file since 446 was 446, checked in by Sam Hocevar, 18 years ago
  • src/common.h: new font structure.
  • src/slashdot.c: use new font structure, removed FACTOR.
  • extras/makefont.c: we add spaces in the string ourselves.
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
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 */
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    } *glyphs;
29};
30
31/* global variables */
32extern char *argv0;
33extern char *share;
34
35/* debug function */
36void dprintf(const char *fmt, ...);
37
38/* available CAPTCHA decoders */
39char *decode_authimage(struct image *img);
40char *decode_clubic(struct image *img);
41char *decode_linuxfr(struct image *img);
42char *decode_phpbb(struct image *img);
43char *decode_scode(struct image *img);
44char *decode_slashdot(struct image *img);
45char *decode_vbulletin(struct image *img);
46char *decode_xanga(struct image *img);
47char *decode_test(struct image *img);
48
49/* image operations */
50struct image *image_load(const char *name);
51struct image *image_new(int width, int height);
52struct image *image_dup(struct image *img);
53void image_free(struct image *img);
54void image_save(struct image *img, const char *name);
55void image_swap(struct image *img1, struct image *img2);
56int getgray(struct image *img, int x, int y, int *g);
57int getpixel(struct image *img, int x, int y, int *r, int *g, int *b);
58int setpixel(struct image *img, int x, int y, int r, int g, int b);
59
60/* image filters */
61void filter_flood_fill(struct image *img, int x, int y, int r, int g, int b);
62void filter_fill_holes(struct image *img);
63void filter_scale(struct image *img, float ratio);
64void filter_black_stuff(struct image *img);
65void filter_detect_lines(struct image *img);
66void filter_equalize(struct image *img, int threshold);
67void filter_trick(struct image *img);
68void filter_smooth(struct image *img);
69void filter_median(struct image *img);
70void filter_contrast(struct image *img);
71void filter_crop(struct image *img, int xmin, int ymin, int xmax, int ymax);
72int filter_count(struct image *img);
73
Note: See TracBrowser for help on using the repository browser.