No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

58 líneas
1.7 KiB

  1. // MyClass.cs created with MonoDevelop
  2. // User: sam at 13:14 04/10/2008
  3. //
  4. // To change standard headers go to Edit->Preferences->Coding->Standard Headers
  5. //
  6. using System;
  7. using System.Runtime.InteropServices;
  8. using System.Security;
  9. namespace Pipi
  10. {
  11. public class Picture
  12. {
  13. private IntPtr _picture;
  14. [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl),
  15. SuppressUnmanagedCodeSecurity]
  16. private static extern IntPtr pipi_load(string s);
  17. public Picture(string s)
  18. {
  19. _picture = pipi_load(s);
  20. }
  21. [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl),
  22. SuppressUnmanagedCodeSecurity]
  23. private static extern int pipi_free(IntPtr img);
  24. ~Picture()
  25. {
  26. pipi_free(_picture);
  27. }
  28. [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl),
  29. SuppressUnmanagedCodeSecurity]
  30. private static extern IntPtr pipi_save(IntPtr p, string s);
  31. public void Save(string s)
  32. {
  33. _picture = pipi_save(_picture, s);
  34. }
  35. [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl),
  36. SuppressUnmanagedCodeSecurity]
  37. private static extern int pipi_get_image_width(IntPtr img);
  38. public int Width
  39. {
  40. get { return pipi_get_image_width(_picture); }
  41. }
  42. [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl),
  43. SuppressUnmanagedCodeSecurity]
  44. private static extern int pipi_get_image_height(IntPtr img);
  45. public int Height
  46. {
  47. get { return pipi_get_image_height(_picture); }
  48. }
  49. }
  50. }