#if defined _img_included
  #endinput
#endif
#define _img_included

enum
{
	ORIGINAL = -1,
	SCE_PCMCT24 = 1,
	SCE_PCMCT32 = 0,
	SCE_PCMT8   = 19,
};

enum
{
	IMGDEC_BUSY = 0,
	IMGDEC_OK = 1,
	IMGDEC_ERROR = -1,
};

enum
{
	IMGTRIM_BUSY = 0,
	IMGTRIM_OK = 1,
	IMGTRIM_ERROR = -1,
};

enum
{
	IMGDEC_FLAG_NONE = 0,
	IMGDEC_FLAG_INDIRECT = 1<<0,
	IMGDEC_FLAG_KEEP_ASPECT = 1<<1,
	IMGDEC_FLAG_CANCEL_CACHE = 1<<2,
};

native imgDecStart( const _filepath_[], _width_=0, _height_=0, _pixelformat_=ORIGINAL, _priority_=100, _flag_ = IMGDEC_FLAG_NONE );
native imgTrimStart( x, y, w, h );
native imgDecSync();
native imgTrimSync();

native imgWidth();
native imgHeight();
native imgOrgWidth();
native imgOrgHeight();
native imgPixelFormat();

native imgTexWidth();
native imgTexHeight();
native imgTexOrgWidth();
native imgTexOrgHeight();
native imgTexPixelFormat();
native texture: imgTexID();  // デコードされたテクスチャのID

native imgKeepTex(texture:tex);  // テクスチャIDを退避リストに追加
native imgReleaseTex(texture:tex);  // // 退避リスト中のテクスチャIDを解放

native texture: imgGetResource(resourceid);

enum
{
	TEX_NOUSE_0 = 0,
	TEX_STAR,
	TEX_GRID,
	TEX_NOUSE_1,
	TEX_NOUSE_2,
	TEX_SPIN,

	TEX_BTN_R,
	TEX_BTN_D,
	TEX_BTN_U,
	TEX_BTN_L,

	TEX_FOCUS,

	TEX_BAR1,
	TEX_BAR2,
	TEX_BAR3,

	TEX_RADIO,
	TEX_NOUSE_3,

	TEX_EDITBOX,

	TEX_BUSY,
	TEX_BIFF,

    TEX_SCROLLBAR1,
    TEX_SCROLLBAR2,
    TEX_SCROLLBAR3,

    TEX_WINDOW1,

	TEX_CHECK0,
	TEX_CHECK1,

	TEX_BTN_L1,
	TEX_BTN_R1,
	TEX_PSBBLOGO,

	TEX_BUTTON0,
	TEX_BUTTON1,
};

// デコード終了を、ブロッキングで待つ
stock imgDecWait()
{
	for(;;){
		new ret = imgDecSync();
		if( ret != IMGDEC_BUSY ) return ret;
		sleep ;
	}
	return 0 ;
}

// トリミング終了を、ブロッキングで待つ
stock imgTrimWait()
{
	for(;;){
		new ret = imgTrimSync();
		if( ret != IMGTRIM_BUSY ) return ret;
		sleep ;
	}
	return 0 ;
}
