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.
 
 
 
 
 
 

98 lines
2.0 KiB

  1. /*
  2. * libcaca Colour ASCII-Art library
  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. /*
  14. * This file contains the libcaca raw input and output driver
  15. */
  16. #include "config.h"
  17. #include "common.h"
  18. #if !defined(__KERNEL__)
  19. # include <stdio.h>
  20. #endif
  21. #include "caca.h"
  22. #include "caca_internals.h"
  23. #include "cucul.h"
  24. #include "cucul_internals.h"
  25. static int raw_init_graphics(caca_display_t *dp)
  26. {
  27. return 0;
  28. }
  29. static int raw_end_graphics(caca_display_t *dp)
  30. {
  31. return 0;
  32. }
  33. static int raw_set_display_title(caca_display_t *dp, char const *title)
  34. {
  35. return -1;
  36. }
  37. static unsigned int raw_get_display_width(caca_display_t *dp)
  38. {
  39. return 0;
  40. }
  41. static unsigned int raw_get_display_height(caca_display_t *dp)
  42. {
  43. return 0;
  44. }
  45. static void raw_display(caca_display_t *dp)
  46. {
  47. cucul_buffer_t *buffer;
  48. buffer = cucul_export_canvas(dp->cv, "caca");
  49. fwrite(cucul_get_buffer_data(buffer),
  50. cucul_get_buffer_size(buffer), 1, stdout);
  51. fflush(stdout);
  52. cucul_free_buffer(buffer);
  53. }
  54. static void raw_handle_resize(caca_display_t *dp)
  55. {
  56. ;
  57. }
  58. static int raw_get_event(caca_display_t *dp, caca_event_t *ev)
  59. {
  60. ev->type = CACA_EVENT_NONE;
  61. return 0;
  62. }
  63. /*
  64. * Driver initialisation
  65. */
  66. int raw_install(caca_display_t *dp)
  67. {
  68. dp->drv.driver = CACA_DRIVER_RAW;
  69. dp->drv.init_graphics = raw_init_graphics;
  70. dp->drv.end_graphics = raw_end_graphics;
  71. dp->drv.set_display_title = raw_set_display_title;
  72. dp->drv.get_display_width = raw_get_display_width;
  73. dp->drv.get_display_height = raw_get_display_height;
  74. dp->drv.display = raw_display;
  75. dp->drv.handle_resize = raw_handle_resize;
  76. dp->drv.get_event = raw_get_event;
  77. dp->drv.set_mouse = NULL;
  78. return 0;
  79. }