| 1 |
/* |
| 2 |
* libcaca .NET bindings for libcaca |
| 3 |
* Copyright (c) 2006 Jean-Yves Lamoureux <[email protected]> |
| 4 |
* 2007 Sam Hocevar <[email protected]> |
| 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://www.wtfpl.net/ for more details. |
| 12 |
*/ |
| 13 |
|
| 14 |
using System; |
| 15 |
using System.Runtime.InteropServices; |
| 16 |
using System.Security; |
| 17 |
using System.Drawing; |
| 18 |
|
| 19 |
namespace Caca |
| 20 |
{ |
| 21 |
public class Attr |
| 22 |
{ |
| 23 |
private uint _attr; |
| 24 |
|
| 25 |
public Attr(uint attr) |
| 26 |
{ |
| 27 |
_attr = attr; |
| 28 |
} |
| 29 |
|
| 30 |
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), |
| 31 |
SuppressUnmanagedCodeSecurity] |
| 32 |
private static extern byte caca_attr_to_ansi(uint a); |
| 33 |
public byte toAnsi() |
| 34 |
{ |
| 35 |
return caca_attr_to_ansi(_attr); |
| 36 |
} |
| 37 |
|
| 38 |
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), |
| 39 |
SuppressUnmanagedCodeSecurity] |
| 40 |
private static extern byte caca_attr_to_ansi_fg(uint a); |
| 41 |
public byte toAnsiFg() |
| 42 |
{ |
| 43 |
return caca_attr_to_ansi_fg(_attr); |
| 44 |
} |
| 45 |
|
| 46 |
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), |
| 47 |
SuppressUnmanagedCodeSecurity] |
| 48 |
private static extern byte caca_attr_to_ansi_bg(uint a); |
| 49 |
public byte toAnsiBg() |
| 50 |
{ |
| 51 |
return caca_attr_to_ansi_bg(_attr); |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
|