using System ;
using System.Collections.Generic ;
using System.Runtime.InteropServices ;
using System.Text ;


namespace DxLibDLL
{


	public static partial class DX
	{


		public sealed class SoftImage : Handler< SoftImage >
		{

			internal static SoftImage FromHandle( int handle )
			{
				SoftImage handler = FindHandler( handle ) ;

				if( handler != null )
				{
					return handler ;
				}
				else
				{
					handler = new SoftImage( handle ) ;
					AddHandler( handle, handler ) ;
					return handler ;
				}
			}

			private SoftImage( int handle ) : base( handle )
			{
			}

			internal protected override sealed void DestructHandler( int handle )
			{
				lock( DX.locker )
				{
					int result = dx_DeleteSoftImage( handle ) ;
				}
			}

		#if UNICODE
			[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
		#else
			[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
		#endif
			private static extern int dx_DeleteSoftImage( int SIHandle ) ;
		}


		/// <summary> ソフトウエアで扱うイメージの解放 </summary>
		public static void DeleteSoftImage( SoftImage SIHandle )
		{
			SoftImage.Dispose( SIHandle ) ;
		}
	}
}
