// // libpipi Pathetic image processing interface library // Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org> // All Rights Reserved // // $Id$ // // This library is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it // and/or modify it under the terms of the Do What The Fuck You Want // To Public License, Version 2, as published by Sam Hocevar. See // http://sam.zoy.org/wtfpl/COPYING for more details. // using System; using System.Runtime.InteropServices; using System.Security; namespace Pipi { public class Picture { private IntPtr _picture; [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern IntPtr pipi_load(string s); public Picture(string s) { _picture = pipi_load(s); } [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int pipi_free(IntPtr img); ~Picture() { pipi_free(_picture); } [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern IntPtr pipi_save(IntPtr p, string s); public void Save(string s) { _picture = pipi_save(_picture, s); } [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int pipi_get_image_width(IntPtr img); public int Width { get { return pipi_get_image_width(_picture); } } [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern int pipi_get_image_height(IntPtr img); public int Height { get { return pipi_get_image_height(_picture); } } } }