- Timestamp:
- Nov 18, 2006, 12:25:50 PM (16 years ago)
- Location:
- libcaca/trunk/DotNet
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/DotNet/Cucul.cs
r943 r1422 19 19 20 20 21 22 21 namespace libCucul 23 22 { 24 public unsafe class Cucul : IDisposable 23 24 public unsafe class Cucul : IDisposable 25 25 { 26 26 /* Fixme */ 27 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 27 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 28 28 public static extern IntPtr cucul_create_canvas(int w, int h); 29 29 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] … … 43 43 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 44 44 public static extern Int32 cucul_putchar(IntPtr qq, int x, int y, char c); 45 /* [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 46 public static extern Int32 cucul_putstr(IntPtr qq, int, int, String);*/ 45 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 46 public static extern Int32 cucul_putstr(IntPtr qq, int x , int y, String c); 47 47 48 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 48 49 public static extern Int32 cucul_clear_canvas(IntPtr qq); … … 58 59 public static extern Int32 cucul_draw_thin_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n); 59 60 60 61 62 63 64 /* 65 char const *cucul_get_color_name(unsigned int); 66 int cucul_putstr(IntPtr *, int, int, char const *); 67 int cucul_printf(IntPtr *, int, int, char const *, ...); 68 */ 69 61 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 62 public static extern Int32 cucul_gotoxy(IntPtr qq, Int32 x, Int32 y); 63 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 64 public static extern Int32 cucul_get_cursor_x(IntPtr qq); 65 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 66 public static extern Int32 cucul_get_cursor_y(IntPtr qq); 67 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 68 public static extern Int32 cucul_put_char(IntPtr qq, Int32 x, Int32 y, Int32 c); 69 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 70 public static extern Int32 cucul_get_char(IntPtr qq, Int32 x, Int32 y); 71 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 72 public static extern Int32 cucul_put_str(IntPtr qq, Int32 x, Int32 y, string c); 73 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 74 public static extern Int32 cucul_get_attr(IntPtr qq, Int32 x, Int32 y); 75 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 76 public static extern Int32 cucul_set_attr(IntPtr qq, Int32 a); 77 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 78 public static extern Int32 cucul_put_attr(IntPtr qq, Int32 x, Int32 y, Int32 a); 79 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 80 public static extern Int32 cucul_set_color_ansi(IntPtr qq, Int32 fg, Int32 bg); 81 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 82 public static extern Int32 cucul_set_color_argb(IntPtr qq, Int32 fg, Int32 bg); 83 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 84 public static extern Int32 cucul_set_canvas_handle(IntPtr qq, Int32 x, Int32 y); 85 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 86 public static extern Int32 cucul_get_canvas_handle_x(IntPtr qq); 87 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 88 public static extern Int32 cucul_get_canvas_handle_y(IntPtr qq); 89 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 90 public static extern Int32 cucul_set_canvas_boundaries(IntPtr qq, Int32 x, Int32 y, 91 Int32 h, Int32 w); 92 93 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 94 public static extern Int32 cucul_invert(IntPtr qq); 95 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 96 public static extern Int32 cucul_flip(IntPtr qq); 97 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 98 public static extern Int32 cucul_flop(IntPtr qq); 99 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 100 public static extern Int32 cucul_rotate(IntPtr qq); 101 102 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 103 public static extern Int32 cucul_attr_to_ansi(Int64 a); 104 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 105 public static extern Int32 cucul_attr_to_ansi_fg(Int64 a); 106 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 107 public static extern Int32 cucul_attr_to_ansi_bg(Int64 a); 108 109 110 111 /* Constants */ 112 113 public const Int32 CUCUL_BLACK = 0x00; /**< The colour index for black. */ 114 public const Int32 CUCUL_BLUE = 0x01; /**< The colour index for blue. */ 115 public const Int32 CUCUL_GREEN = 0x02; /**< The colour index for green. */ 116 public const Int32 CUCUL_CYAN = 0x03; /**< The colour index for cyan. */ 117 public const Int32 CUCUL_RED = 0x04; /**< The colour index for red. */ 118 public const Int32 CUCUL_MAGENTA = 0x05; /**< The colour index for magenta. */ 119 public const Int32 CUCUL_BROWN = 0x06; /**< The colour index for brown. */ 120 public const Int32 CUCUL_LIGHTGRAY = 0x07; /**< The colour index for light gray. */ 121 public const Int32 CUCUL_DARKGRAY = 0x08; /**< The colour index for dark gray. */ 122 public const Int32 CUCUL_LIGHTBLUE = 0x09; /**< The colour index for blue. */ 123 public const Int32 CUCUL_LIGHTGREEN = 0x0a; /**< The colour index for light green. */ 124 public const Int32 CUCUL_LIGHTCYAN = 0x0b; /**< The colour index for light cyan. */ 125 public const Int32 CUCUL_LIGHTRED = 0x0c; /**< The colour index for light red. */ 126 public const Int32 CUCUL_LIGHTMAGENTA = 0x0d; /**< The colour index for light magenta. */ 127 public const Int32 CUCUL_YELLOW = 0x0e; /**< The colour index for yellow. */ 128 public const Int32 CUCUL_WHITE = 0x0f; /**< The colour index for white. */ 129 public const Int32 CUCUL_DEFAULT = 0x10; /**< The output driver's default colour. */ 130 public const Int32 CUCUL_TRANSPARENT = 0x20; /**< The transparent colour. */ 131 132 public const Int32 CUCUL_BOLD = 0x01; /**< The style mask for bold. */ 133 public const Int32 CUCUL_ITALICS = 0x02; /**< The style mask for italics. */ 134 public const Int32 CUCUL_UNDERLINE = 0x04; /**< The style mask for underline. */ 135 public const Int32 CUCUL_BLINK = 0x08; /**< The style mask for blink. */ 70 136 71 137 … … 125 191 return cucul_draw_line(qq, x1, y1, x2, y2, c); 126 192 } 127 128 129 130 131 132 133 /* 134 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 135 public static extern Int32 cucul_draw_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n, IntPtr c); 136 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 137 public static extern Int32 cucul_draw_thin_line(IntPtr qq, Int32 x1, Int32 y1, Int32 x2, Int32 y2); 138 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 139 public static extern Int32 cucul_draw_thin_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n); 140 */ 193 public Int32 putStr(Int32 x, Int32 y, string c) 194 { 195 return cucul_putstr(qq, x, y, c); 196 } 197 public Int32 gotoXY(Int32 x, Int32 y) 198 { 199 return cucul_gotoxy(qq, x, y); 200 } 201 public Int32 getCursorX() 202 { 203 return cucul_get_cursor_x(qq); 204 } 205 public Int32 getCursorY() 206 { 207 return cucul_get_cursor_y(qq); 208 } 209 public Int32 getChar(Int32 x, Int32 y) 210 { 211 return cucul_get_char(qq, x, y); 212 } 213 public Int32 getAttr(Int32 x, Int32 y) 214 { 215 return cucul_get_attr(qq, x, y); 216 } 217 public Int32 setAttr(Int32 a) 218 { 219 return cucul_set_attr(qq, a); 220 } 221 public Int32 setAttr(Int32 x, Int32 y, Int32 a) 222 { 223 return cucul_put_attr(qq, x, y, a); 224 } 225 public Int32 setColorANSI(Int32 fg, Int32 bg) 226 { 227 return cucul_set_color_ansi(qq, fg, bg); 228 } 229 public Int32 setColorARGB(Int32 fg, Int32 bg) 230 { 231 return cucul_set_color_ansi(qq, fg, bg); 232 } 233 public Int32 setCanvasHandle(Int32 x, Int32 y) 234 { 235 return cucul_set_canvas_handle(qq, x, y); 236 } 237 public Int32 getCanvasHandleX() 238 { 239 return cucul_get_canvas_handle_x(qq); 240 } 241 public Int32 getCanvasHandleY() 242 { 243 return cucul_get_canvas_handle_y(qq); 244 } 245 public Int32 setCanvasHandleY(Int32 x, Int32 y, Int32 h, Int32 w) 246 { 247 return cucul_set_canvas_boundaries(qq, x, y, h, w); 248 } 249 250 251 public Int32 Invert() 252 { 253 return cucul_invert(qq); 254 } 255 public Int32 Flip() 256 { 257 return cucul_flip(qq); 258 } 259 public Int32 Flop() 260 { 261 return cucul_flop(qq); 262 } 263 public Int32 Rotate() 264 { 265 return cucul_rotate(qq); 266 } 267 268 public Int32 AttrToANSI(Int64 a) 269 { 270 return cucul_attr_to_ansi(a); 271 } 272 public Int32 AttrToANSIFg(Int64 a) 273 { 274 return cucul_attr_to_ansi_fg(a); 275 } 276 public Int32 AttrToANSIBg(Int64 a) 277 { 278 return cucul_attr_to_ansi_bg(a); 279 } 280 281 282 283 284 285 286 141 287 142 288 -
libcaca/trunk/DotNet/test.cs
r1245 r1422 40 40 qq.putChar(0,0, 'J'); 41 41 42 qq.setColor(Cucul.CUCUL_BLUE, Cucul.CUCUL_RED); 42 43 qq.drawLine(10, 15, 45, 27, "#"); 43 44 45 qq.putStr(10, 10, "Hello from .NET"); 44 46 47 48 Console.WriteLine("Char at 0,0 : {0}", qq.getChar(0,0)); 49 50 qq.Flip(); 45 51 46 52 /* We have a proper canvas, let's display it using Caca */
Note: See TracChangeset
for help on using the changeset viewer.