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.
 
 
 
 
 
 

56 regels
1.6 KiB

  1. /*
  2. * libcaca .NET bindings for libcaca
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
  4. * 2007 Sam Hocevar <sam@hocevar.net>
  5. * All Rights Reserved
  6. *
  7. * This library is free software. It comes without any warranty, to
  8. * the extent permitted by applicable law. You can redistribute it
  9. * and/or modify it under the terms of the Do What The Fuck You Want
  10. * To Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. using System;
  14. using System.Runtime.InteropServices;
  15. using System.Security;
  16. using System.Drawing;
  17. namespace Caca
  18. {
  19. public class Attr
  20. {
  21. private uint _attr;
  22. public Attr(uint attr)
  23. {
  24. _attr = attr;
  25. }
  26. [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
  27. SuppressUnmanagedCodeSecurity]
  28. private static extern byte caca_attr_to_ansi(uint a);
  29. public byte toAnsi()
  30. {
  31. return caca_attr_to_ansi(_attr);
  32. }
  33. [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
  34. SuppressUnmanagedCodeSecurity]
  35. private static extern byte caca_attr_to_ansi_fg(uint a);
  36. public byte toAnsiFg()
  37. {
  38. return caca_attr_to_ansi_fg(_attr);
  39. }
  40. [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
  41. SuppressUnmanagedCodeSecurity]
  42. private static extern byte caca_attr_to_ansi_bg(uint a);
  43. public byte toAnsiBg()
  44. {
  45. return caca_attr_to_ansi_bg(_attr);
  46. }
  47. }
  48. }