 Timestamp:
 Nov 27, 2007, 1:58:24 AM (13 years ago)
 Location:
 libcaca/trunk/csharp
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

libcaca/trunk/csharp/Cucul.cs
r2078 r2080 331 331 SuppressUnmanagedCodeSecurity] 332 332 private static extern int cucul_draw_line(IntPtr cv, int x1, int y1, 333 int x2, int y2, int c);334 public int drawLine(Point p1, Point p2, int c)333 int x2, int y2, uint c); 334 public int drawLine(Point p1, Point p2, uint c) 335 335 { 336 336 return cucul_draw_line(_cv, p1.X, p1.Y, p2.X, p2.Y, c); … … 339 339 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 340 340 SuppressUnmanagedCodeSecurity] 341 private static extern int cucul_draw_polyline(IntPtr cv, int[] x, int[] y, int n, IntPtr c); 342 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 343 SuppressUnmanagedCodeSecurity] 344 private static extern int cucul_draw_thin_line(IntPtr cv, int x1, int y1, int x2, int y2); 345 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 346 SuppressUnmanagedCodeSecurity] 347 private static extern int cucul_draw_thin_polyline(IntPtr cv, int[] x, int[] y, int n); 341 private static extern int cucul_draw_polyline(IntPtr cv, int[] x, 342 int[] y, int n, uint c); 343 public int drawPolyline(Point[] lp, uint c) 344 { 345 int[] lx = new int[lp.Length]; 346 int[] ly = new int[lp.Length]; 347 for(int i = 0; i < lp.Length; i++) 348 { 349 lx[i] = lp[i].X; 350 ly[i] = lp[i].Y; 351 } 352 return cucul_draw_polyline(_cv, lx, ly, lp.Length  1, c); 353 } 354 355 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 356 SuppressUnmanagedCodeSecurity] 357 private static extern int cucul_draw_thin_line(IntPtr cv, int x1, 358 int y1, int x2, int y2); 359 public int drawThinLine(Point p1, Point p2) 360 { 361 return cucul_draw_thin_line(_cv, p1.X, p1.Y, p2.X, p2.Y); 362 } 363 364 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 365 SuppressUnmanagedCodeSecurity] 366 private static extern int cucul_draw_thin_polyline(IntPtr cv, int[] x, 367 int[] y, int n); 368 public int drawThinPolyline(Point[] lp) 369 { 370 int[] lx = new int[lp.Length]; 371 int[] ly = new int[lp.Length]; 372 for(int i = 0; i < lp.Length; i++) 373 { 374 lx[i] = lp[i].X; 375 ly[i] = lp[i].Y; 376 } 377 return cucul_draw_thin_polyline(_cv, lx, ly, lp.Length  1); 378 } 379 380 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 381 SuppressUnmanagedCodeSecurity] 382 private static extern int cucul_draw_circle(IntPtr cv, int x, int y, 383 int r, uint c); 384 public int drawCircle(Point p1, int r, uint c) 385 { 386 return cucul_draw_circle(_cv, p1.X, p1.Y, r, c); 387 } 388 389 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 390 SuppressUnmanagedCodeSecurity] 391 private static extern int cucul_draw_ellipse(IntPtr cv, int x, int y, 392 int a, int b, uint c); 393 public int drawEllipse(Point p1, int a, int b, uint c) 394 { 395 return cucul_draw_ellipse(_cv, p1.X, p1.Y, a, b, c); 396 } 397 398 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 399 SuppressUnmanagedCodeSecurity] 400 private static extern int cucul_draw_thin_ellipse(IntPtr cv, 401 int x, int y, 402 int a, int b); 403 public int drawThinEllipse(Point p1, int a, int b) 404 { 405 return cucul_draw_thin_ellipse(_cv, p1.X, p1.Y, a, b); 406 } 407 408 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 409 SuppressUnmanagedCodeSecurity] 410 private static extern int cucul_fill_ellipse(IntPtr cv, int x, int y, 411 int a, int b, uint c); 412 public int fillEllipse(Point p1, int a, int b, uint c) 413 { 414 return cucul_fill_ellipse(_cv, p1.X, p1.Y, a, b, c); 415 } 416 417 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 418 SuppressUnmanagedCodeSecurity] 419 private static extern int cucul_draw_box(IntPtr cv, int x, int y, 420 int w, int h, uint c); 421 public int drawBox(Rectangle r, uint c) 422 { 423 return cucul_draw_box(_cv, r.X, r.Y, r.Width, r.Height, c); 424 } 425 426 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 427 SuppressUnmanagedCodeSecurity] 428 private static extern int cucul_draw_thin_box(IntPtr cv, int x, int y, 429 int w, int h); 430 public int drawThinBox(Rectangle r) 431 { 432 return cucul_draw_thin_box(_cv, r.X, r.Y, r.Width, r.Height); 433 } 434 435 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 436 SuppressUnmanagedCodeSecurity] 437 private static extern int cucul_draw_cp437_box(IntPtr cv, int x, int y, 438 int w, int h); 439 public int drawCp437Box(Rectangle r) 440 { 441 return cucul_draw_cp437_box(_cv, r.X, r.Y, r.Width, r.Height); 442 } 443 444 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 445 SuppressUnmanagedCodeSecurity] 446 private static extern int cucul_fill_box(IntPtr cv, int x, int y, 447 int w, int h, uint c); 448 public int fillBox(Rectangle r, uint c) 449 { 450 return cucul_fill_box(_cv, r.X, r.Y, r.Width, r.Height, c); 451 } 452 453 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 454 SuppressUnmanagedCodeSecurity] 455 private static extern int cucul_draw_triangle(IntPtr cv, int x1, 456 int y1, int x2, int y2, 457 int x3, int y3, uint c); 458 public int drawTriangle(Point p1, Point p2, Point p3, uint c) 459 { 460 return cucul_draw_triangle(_cv, p1.X, p1.Y, p2.X, p2.Y, 461 p3.X, p3.Y, c); 462 } 463 464 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 465 SuppressUnmanagedCodeSecurity] 466 private static extern int cucul_draw_thin_triangle(IntPtr cv, 467 int x1, int y1, 468 int x2, int y2, 469 int x3, int y3); 470 public int drawThinTriangle(Point p1, Point p2, Point p3) 471 { 472 return cucul_draw_thin_triangle(_cv, p1.X, p1.Y, p2.X, p2.Y, 473 p3.X, p3.Y); 474 } 475 476 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), 477 SuppressUnmanagedCodeSecurity] 478 private static extern int cucul_fill_triangle(IntPtr cv, int x1, 479 int y1, int x2, int y2, 480 int x3, int y3, uint c); 481 public int fillTriangle(Point p1, Point p2, Point p3, uint c) 482 { 483 return cucul_fill_triangle(_cv, p1.X, p1.Y, p2.X, p2.Y, 484 p3.X, p3.Y, c); 485 } 348 486 349 487 /* frame handling */ 
libcaca/trunk/csharp/test.cs
r2078 r2080 76 76 drawLine(p1 + new Size(0, 2), p2 + new Size(0, 2), ''); 77 77 drawLine(p1 + new Size(0, 1), p2 + new Size(0, 1), '*'); 78 drawLine(p1, p2,'#');78 drawLine(p1, p2, '#'); 79 79 drawLine(p1 + new Size(0, 1), p2 + new Size(0, 1), '*'); 80 80 drawLine(p1 + new Size(0, 2), p2 + new Size(0, 2), ''); … … 134 134 135 135 dp.EventLoop(); 136 } 137 } 136 138 137 /* Force deletion of our instances for fun */138 dp.Dispose();139 cv.Dispose();140 }141 142 }
Note: See TracChangeset
for help on using the changeset viewer.