You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * commin.h: common stuff
  3. * $Id$
  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. /* image structure */
  13. struct image
  14. {
  15. int width, height, pitch, channels;
  16. unsigned char *pixels;
  17. void *priv;
  18. };
  19. /* font structure */
  20. struct font
  21. {
  22. struct image *img;
  23. struct glyph
  24. {
  25. int xmin, xmax, ymin, ymax;
  26. int count; /* Black pixel count */
  27. char c;
  28. } *glyphs;
  29. int size;
  30. };
  31. /* global variables */
  32. extern char *argv0;
  33. extern char *share;
  34. /* debug function */
  35. void pwnprint(const char *fmt, ...);
  36. /* available CAPTCHA decoders */
  37. char *decode_authimage(struct image *img);
  38. char *decode_clubic(struct image *img);
  39. char *decode_linuxfr(struct image *img);
  40. char *decode_livejournal(struct image *img);
  41. char *decode_paypal(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_tickets(struct image *img);
  46. char *decode_ticketmaster(struct image *img);
  47. char *decode_vbulletin(struct image *img);
  48. char *decode_xanga(struct image *img);
  49. char *decode_test(struct image *img);
  50. /* image operations */
  51. struct image *image_load(const char *name);
  52. struct image *image_new(int width, int height);
  53. struct image *image_dup(struct image *img);
  54. void image_free(struct image *img);
  55. void image_save(struct image *img, const char *name);
  56. void image_swap(struct image *img1, struct image *img2);
  57. int getgray(struct image *img, int x, int y, int *g);
  58. int getpixel(struct image *img, int x, int y, int *r, int *g, int *b);
  59. int setpixel(struct image *img, int x, int y, int r, int g, int b);
  60. /* font operations */
  61. struct font *font_load_fixed(char const *, char const *, char const *);
  62. struct font *font_load_variable(char const *, char const *, char const *);
  63. void font_free(struct font *);
  64. /* image filters */
  65. void filter_flood_fill(struct image *img, int x, int y, int r, int g, int b);
  66. void filter_fill_holes(struct image *img);
  67. void filter_scale(struct image *img, float ratio);
  68. void filter_black_stuff(struct image *img);
  69. void filter_detect_lines(struct image *img);
  70. void filter_threshold(struct image *img, int threshold);
  71. void filter_trick(struct image *img);
  72. void filter_smooth(struct image *img);
  73. void filter_median(struct image *img);
  74. void filter_contrast(struct image *img);
  75. void filter_crop(struct image *img, int xmin, int ymin, int xmax, int ymax);
  76. int filter_count(struct image *img);