コード例 #1
0
        private void Init()
        {
            DevILAPI.ilInit();
            DevILAPI.iluInit();
            byte result = DevILAPI.ilutRenderer(DevILAPI.ILUT_WIN32);

            if (result != 1)
            {
                throw new Exception("Unable to initialize 'ilutRenderer' for Win32.");
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates an Image object from the specified file.
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public System.Drawing.Image LoadImage(string file)
        {
            int hDC = 0;

            System.Drawing.Image img;
            System.IntPtr        hBitmap;

            hBitmap = DevILAPI.ilutWinLoadImage(System.Runtime.InteropServices.Marshal.StringToCoTaskMemAnsi(file), hDC);
            img     = System.Drawing.Image.FromHbitmap(hBitmap);
            GDI.DeleteObject(hBitmap);

            return(img);
        }
コード例 #3
0
 /// <summary>
 /// Releases the resources used by the DevIL DLL.
 /// </summary>
 public void Dispose()
 {
     DevILAPI.ilShutDown();
 }
コード例 #4
0
        /// <summary>
        /// Creates a Win32 bitmap (hBitmap) from the specified file.
        /// </summary>
        /// <param name="file">image location</param>
        /// <returns>Hbitmap</returns>
        public System.IntPtr LoadHBitmap(string file)
        {
            int hDC = 0;

            return(DevILAPI.ilutWinLoadImage(System.Runtime.InteropServices.Marshal.StringToCoTaskMemAnsi(file), hDC));
        }