Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

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