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.
 
 
 
 
 
 

81 rivejä
2.2 KiB

  1. /*
  2. * libcucul Canvas for ultrafast compositing of Unicode letters
  3. * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #ifndef __CUCUL_INTERNALS_H__
  14. #define __CUCUL_INTERNALS_H__
  15. #if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
  16. # include <inttypes.h>
  17. #elif !defined(CUSTOM_INTTYPES) && !defined(_DOXYGEN_SKIP_ME)
  18. # define CUSTOM_INTTYPES
  19. typedef unsigned char uint8_t;
  20. typedef unsigned short uint16_t;
  21. typedef unsigned long int uint32_t;
  22. typedef long int intptr_t;
  23. typedef long unsigned int uintptr_t;
  24. #endif
  25. struct cucul_canvas
  26. {
  27. /* Canvas size */
  28. unsigned int width, height;
  29. /* Shortcut to the active frame */
  30. uint32_t *chars;
  31. uint32_t *attr;
  32. /* Frame information */
  33. unsigned int frame, framecount;
  34. uint32_t **allchars;
  35. uint32_t **allattr;
  36. /* Painting context */
  37. uint16_t fgcolor;
  38. uint16_t bgcolor;
  39. unsigned int refcount;
  40. };
  41. struct cucul_buffer
  42. {
  43. unsigned long int size;
  44. char *data;
  45. };
  46. /* Bitmap functions */
  47. extern int _cucul_init_dither(void);
  48. extern int _cucul_end_dither(void);
  49. /* Canvas functions */
  50. extern void _cucul_set_canvas_size(cucul_canvas_t *, unsigned int, unsigned int);
  51. extern void _cucul_putchar32(cucul_canvas_t *, int, int, uint32_t);
  52. /* Charset functions */
  53. extern unsigned int _cucul_strlen_utf8(char const *);
  54. extern char const *_cucul_skip_utf8(char const *, unsigned int);
  55. extern uint32_t _cucul_utf8_to_utf32(char const *);
  56. extern uint8_t _cucul_utf32_to_cp437(uint32_t);
  57. extern uint32_t _cucul_cp437_to_utf32(uint8_t);
  58. /* Colour functions */
  59. uint8_t _cucul_argb32_to_ansi8(uint32_t);
  60. uint8_t _cucul_argb32_to_ansi4fg(uint32_t);
  61. uint8_t _cucul_argb32_to_ansi4bg(uint32_t);
  62. uint16_t _cucul_argb32_to_rgb12fg(uint32_t);
  63. uint16_t _cucul_argb32_to_rgb12bg(uint32_t);
  64. uint32_t _cucul_argb32_to_rgb24fg(uint32_t);
  65. uint32_t _cucul_argb32_to_rgb24bg(uint32_t);
  66. void _cucul_argb32_to_argb4(uint32_t, uint8_t[8]);
  67. #endif /* __CUCUL_INTERNALS_H__ */