source: libcaca/trunk/csharp/Attr.cs @ 2867

Last change on this file since 2867 was 2867, checked in by Sam Hocevar, 11 years ago

Split the C# bindings into separate files.

File size: 1.6 KB
Line 
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
16using System;
17using System.Runtime.InteropServices;
18using System.Security;
19using System.Drawing;
20
21namespace Caca
22{
23    public class Attr
24    {
25        private uint _attr;
26
27        public Attr(uint attr)
28        {
29            _attr = attr;
30        }
31
32        [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
33         SuppressUnmanagedCodeSecurity]
34        private static extern byte caca_attr_to_ansi(uint a);
35        public byte toAnsi()
36        {
37            return caca_attr_to_ansi(_attr);
38        }
39
40        [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
41         SuppressUnmanagedCodeSecurity]
42        private static extern byte caca_attr_to_ansi_fg(uint a);
43        public byte toAnsiFg()
44        {
45            return caca_attr_to_ansi_fg(_attr);
46        }
47
48        [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
49         SuppressUnmanagedCodeSecurity]
50        private static extern byte caca_attr_to_ansi_bg(uint a);
51        public byte toAnsiBg()
52        {
53            return caca_attr_to_ansi_bg(_attr);
54        }
55    }
56}
57
Note: See TracBrowser for help on using the repository browser.