25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Attr.cs 1.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. * $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. }