/***************************************************************************************************
FastExternals Plug-in Interface Header

Copyright © John Paul Chacha. All Rights Reserved.

This source code file, which has been provided by John Paul Chacha as part of his software product
for use only by licensed users of that product, includes proprietary information of John Paul Chacha

USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS OF THE LICENSE AGREEMENT FURNISHED WITH
THE PRODUCT

IN PARTICULAR, JOHN PAUL CHACHA SHALL BE FREE FROM ANY CLAIMS OR LIABILITIES ARISING OUT OF THE USE
OR MISUSE OF THIS FILE AND/OR ITS CONTENTS
***************************************************************************************************/
#pragma once

//--------------------------------------------------------------------------------------------------
#include "imagedefs.h"
#include "layerdefs.h"
#include "metadefs.h"


//==================================================================================================



/***************************************************************************************************
****************************************************************************************************
****************************************************************************************************

                                          GLOBAL DEFINES

****************************************************************************************************
****************************************************************************************************
***************************************************************************************************/



//==================================================================================================

#define PLUGIN_INTERFACE_NAME					L"FastExternals™"
#define PLUGIN_INTERFACE_VERSION				((3<<16)+47) // 06-Oct-2025
#define PLUGIN_INTERFACE_VERSION$				L"3 rev 47"
#define PLUGIN_INTERFACE_MIN_VER				((3<<16)+47) // 06-Oct-2025

#define PLUGIN_APITYPE_INVALID					0x00000000
#define PLUGIN_APITYPE_FILE						0x00000001
#define PLUGIN_APITYPE_DEVICE					0x00000002
#define PLUGIN_APITYPE_EFFECT					0x00000004
#define PLUGIN_APITYPE_GEN_AI					0x00000008
#define PLUGIN_APITYPE_ENGINE					0x00000100

#define PLUGIN_IMGTYPE_COMPOSITE				0x0000
#define PLUGIN_IMGTYPE_IMAGELIST				0x0001
#define PLUGIN_IMGTYPE_FRAMEANIM				0x0002
#define PLUGIN_IMGTYPE_OBJECTANIM				0x0003

#define PLUGIN_IMGSUBTYPE_NORMAL				0x0000
#define PLUGIN_IMGSUBTYPE_CLIPPED				0x0001
#define PLUGIN_IMGSUBTYPE_MIPMAP				0x0001
#define PLUGIN_IMGSUBTYPE_ONIONSKIN				0x0001
#define PLUGIN_IMGSUBTYPE_STEREO				0x0002

#define PLUGIN_HOSTFLAG_RESIZE					0x0001 //host may return resized image if necessary
#define PLUGIN_HOSTFLAG_NO_SAVE					0x0002 //ask host to treat file format as read-only
#define PLUGIN_HOSTFLAG_MORE_TIME				0x0004 //ask host to defer time-out (e.g. plug-in was showing UI)
#define PLUGIN_HOSTFLAG_WANT_THUMB				0x0100 //plug-in may return a thumbnail
#define PLUGIN_HOSTFLAG_SKIP_META				0x0200 //plug-in may omit metadata
#define PLUGIN_HOSTFLAG_SKIP_ANIM				0x0400 //plug-in may omit animation

#define PLUGIN_WARN_LAYER_COUNT					0x0001 //layers exceed allowed maximum
#define PLUGIN_WARN_LAYER_TYPE					0x0002 //bad or unknown layer type found
#define PLUGIN_WARN_BLEND_MODE					0x0004 //bad or unknown blend mode found
#define PLUGIN_WARN_IMAGE_DATA					0x0008 //bad or unknown image data found
#define PLUGIN_WARN_ALPHA_DROP					0x0010 //transparency info removed
#define PLUGIN_WARN_THUMB_ONLY					0x0020 //thumbnail only, no other data
#define PLUGIN_WARN_AUTO_RESIZE					0x0040 //auto-resized to usable dimensions
#define PLUGIN_WARN_NONSTANDARD					0x0080 //non-standard extension/feature used
#define PLUGIN_WARN_TIMEOUT						0x0100 //the operation timed out
#define PLUGIN_WARN_FILEEXT_BAD					0x0200 //file extension doesn't match contents
#define PLUGIN_WARN_FILEEXT_NUL					0x0400 //file extension doesn't exist

//--------------------------------------------------------------------------------------------------
#define PLUGIN_MAX_LAYER_WIDTH					(64*1024)
#define PLUGIN_MAX_LAYER_COUNT					1024
#define PLUGIN_MAX_LAYER_PIXELS					(250*1000*1000)
#define PLUGIN_MAX_TOTAL_PIXELS					(640*1000*1000)

//--------------------------------------------------------------------------------------------------
#define PLUGIN_OKAY								1	//success

#define PLUGIN_ERR_FAILED						0	//general failure

#define PLUGIN_ERR_NO_SUPPORT					-1	//not supported
#define PLUGIN_ERR_NO_FEATURE					-2	//supported but feature not implemented
#define PLUGIN_ERR_NO_IMAGE						-3	//file is valid but doesn't contain an image
#define PLUGIN_ERR_NO_COMPONENT					-4	//external component not found
#define PLUGIN_ERR_COMPONENT_FAIL				-5	//failure in external component
#define PLUGIN_ERR_SYS_REQ						-6	//system requirements
#define PLUGIN_ERR_DEVICE						-7	//I/O device error
#define PLUGIN_ERR_NETWORK						-8	//I/O network error
#define PLUGIN_ERR_SYNTAX						-9	//syntax error

#define PLUGIN_ERR_BAD_HOST						-10	//host service not found
#define PLUGIN_ERR_BAD_PARAM					-11	//host parameter invalid
#define PLUGIN_ERR_BAD_IMAGE					-12	//invalid image
#define PLUGIN_ERR_BAD_WIDTH					-13	//unsupported image size
#define PLUGIN_ERR_BAD_MODE						-14	//unsupported image mode
#define PLUGIN_ERR_NOT_FLAT						-15	//image not flat (has layers)
#define PLUGIN_ERR_HOST_RESPONSE				-16	//unexpected host response
#define PLUGIN_ERR_ILLOGICAL					-17	//no logical result/interpretation
#define PLUGIN_ERR_BAD_CONFIG					-18	//invalid configuration

#define PLUGIN_ERR_OUT_OF_MEM					-20	//out of memory
#define PLUGIN_ERR_END_OF_DATA					-23	//unexpected end of data
#define PLUGIN_ERR_CODEC_DATA					-24	//codec error, unknown
#define PLUGIN_ERR_BITMAP_ERR					-25	//bitmap error, unknown
#define PLUGIN_ERR_BITMAP_NUL					-26	//bitmap error, empty
#define PLUGIN_ERR_BITMAP_BIG					-27	//bitmap error, too big

#define PLUGIN_ERR_INTERNAL_U 					-30	//internal error, unspecified
#define PLUGIN_ERR_INTERNAL_1 					-31	//internal error, type #1
#define PLUGIN_ERR_INTERNAL_2 					-32	//internal error, type #2
#define PLUGIN_ERR_INTERNAL_3 					-33	//internal error, type #3
#define PLUGIN_ERR_INTERNAL_4 					-34	//internal error, type #4

#define PLUGIN_ERR_FILE_OPEN_R					-40	//cannot open for read
#define PLUGIN_ERR_FILE_OPEN_W					-41	//cannot open for write
#define PLUGIN_ERR_FILE_READ					-42	//error reading data
#define PLUGIN_ERR_FILE_WRITE					-43	//error writing data
#define PLUGIN_ERR_FILE_CORRUPT					-44	//invalid data in file
#define PLUGIN_ERR_FILE_INFO					-45	//cannot get file information

#define PLUGIN_ERR_DATA_PROTECT					-50	//data protection fault
#define PLUGIN_ERR_HOST_DAMAGED					-51	//host damaged and needs reinstall

#define PLUGIN_ERR_ACCESS_DENIED				-70	//access denied
#define PLUGIN_ERR_CREDIT_LIMIT					-71	//insufficient credit
#define PLUGIN_ERR_BANDWIDTH_LIMIT				-72	//exceeded usage limit

#define PLUGIN_ERR_NOT_AN_IMAGE					-90	//file is certainly known not to be an image
#define PLUGIN_ERR_PASSWORD						-96	//cancelled by password restriction
#define PLUGIN_ERR_NO_LICENSE					-97	//cancelled by license restriction
#define PLUGIN_ERR_TIMEOUT						-98	//cancelled by timeout
#define PLUGIN_ERR_USER_CANCEL					-99	//cancelled by the user

//--------------------------------------------------------------------------------------------------
#define PLUGIN_INFOTYPE_ERROR					0x0000 // error hint
#define PLUGIN_INFOTYPE_CODEC					0x0001 // CODEC details
#define PLUGIN_INFOTYPE_SAVEEXT					0x0100 // preferred extension for save operation

//--------------------------------------------------------------------------------------------------
#define PLUGIN_DIALOG_ID_ABOUT					0x0000
#define PLUGIN_DIALOG_ID_CONFIG					0x0001
#define PLUGIN_DIALOG_ID_HELP 					0x0002

//--------------------------------------------------------------------------------------------------
#define PLUGIN_FLT_XFORM_ROTATE_090				0x0001
#define PLUGIN_FLT_XFORM_ROTATE_180				0x0002
#define PLUGIN_FLT_XFORM_ROTATE_270				0x0003
#define PLUGIN_FLT_XFORM_FLIP_H					0x0004
#define PLUGIN_FLT_XFORM_FLIP_V					0x0005
#define PLUGIN_FLT_XFORM_TRANSPOSE 				0x0006
#define PLUGIN_FLT_XFORM_TRANSVERSE				0x0007

//--------------------------------------------------------------------------------------------------
#define PLUGIN_EFX_FLAGS_HIDE_GUI				0x0001

//--------------------------------------------------------------------------------------------------
#define PLUGIN_GAI_LOAD_OPTION_IMAGE			0x00
#define PLUGIN_GAI_LOAD_OPTION_OPAQUE			0x01
#define PLUGIN_GAI_LOAD_OPTION_MASK				0x02
#define PLUGIN_GAI_LOAD_OPTION_HARDMASK			0x03

#define PLUGIN_GAI_PROMPT_SIMPLE_CREATE			0x00
#define PLUGIN_GAI_PROMPT_SIMPLE_MODIFY			0x01
#define PLUGIN_GAI_PROMPT_SIMPLE_REMOVE			0x02
#define PLUGIN_GAI_PROMPT_MASKED_MODIFY			0x03
#define PLUGIN_GAI_PROMPT_MASKED_REMOVE			0x04

//==================================================================================================

struct plg_CONFIGDATA
{
	const wchar_t*		name;
	wchar_t				value[1024];
};

//--------------------------------------------------------------------------------------------------

//==================================================================================================



/***************************************************************************************************
****************************************************************************************************
****************************************************************************************************

                                          HELPER MACROS

****************************************************************************************************
****************************************************************************************************
***************************************************************************************************/



//==================================================================================================

//--------------------------------------------------------------------------------------------------
//Macro for converting pixels between ARGB and ABGR
#define plg_swap_rgb(c)				(((c)&0xff00ff00)|(((c)>>16)&0x000000ff)|(((c)<<16)&0x00ff0000))

//--------------------------------------------------------------------------------------------------
//Macro for restricting a value to a given set of limits
#define plg_limit_value(a,lo,hi)	{ if((a)<(lo)){a=(lo);} else if((a)>(hi)){a=(hi);} }

//--------------------------------------------------------------------------------------------------
//Macro for checking a value against a given set of limits
#define plg_not_in_range(a,lo,hi)	((a<(lo))||(a>(hi)))

//--------------------------------------------------------------------------------------------------
//Default background colors
#define PLG_BACKCOLOR_DARK_GREY		0x00485460

//--------------------------------------------------------------------------------------------------
#ifndef _DEBUG 
	#define DebugBreak()			static_assert(false, "ERROR: DebugBreak() in release build!!!")
#endif 


//==================================================================================================



/***************************************************************************************************
****************************************************************************************************
****************************************************************************************************

                         CALLBACK SUITE STRUCTS FOR "BASIC PI" INTERFACES

****************************************************************************************************
****************************************************************************************************
***************************************************************************************************/



//==================================================================================================

//--------------------------------------------------------------------------------------------------
//Shared components and defines
//--------------------------------------------------------------------------------------------------

#define PLUGIN_TEST_PI_VERSION(v_hst,v_plg)		((v_hst>=v_plg)&&(HIWORD(v_hst)==HIWORD(v_plg)))


//--------------------------------------------------------------------------------------------------
//pi_StateStore
//--------------------------------------------------------------------------------------------------
#define PI_STATESTORE_VERSION					0x00030001 // 22 Oct 2025

#ifndef __cplusplus
	typedef	struct pi_STATESTORE				pi_STATESTORE;
#endif

#pragma pack(push)
#pragma pack(1)
	struct pi_STATESTORE
	{
		unsigned long	version;
		unsigned long	host_id;
	//8
		int (__cdecl*	temporary_read )(const wchar_t* name,void* data,int size);
		int (__cdecl*	temporary_write)(const wchar_t* name,void* data,int size);
		int (__cdecl*	temporary_size )(const wchar_t* name);
		void*			temporary_unused; //do not touch
	//24
		int (__cdecl*	permanent_read )(const wchar_t* name,void* data,int size);
		int (__cdecl*	permanent_write)(const wchar_t* name,void* data,int size);
		int (__cdecl*	permanent_size )(const wchar_t* name);
		void*			permanent_unused; //do not touch
	//40
		int (__cdecl*	encrypted_read )(const wchar_t* name,void* data,int size);
		int (__cdecl*	encrypted_write)(const wchar_t* name,void* data,int size);
		int (__cdecl*	encrypted_size )(const wchar_t* name);
		void*			encrypted_unused; //do not touch
	//56
		unsigned char	reserved_x[1024-56]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//pi_BasicQuery
//--------------------------------------------------------------------------------------------------
#define PI_BASICQUERY_VERSION					0x00010005 // 28 Aug 2023

#ifndef __cplusplus
	typedef	struct pi_BASICQUERY				pi_BASICQUERY;
#endif

#pragma pack(push)
#pragma pack(1)
	struct pi_BASICQUERY
	{
		unsigned long	version;
		unsigned long	host_id;
	//8
		void* (__cdecl*   get_PI )(pi_BASICQUERY* self,const wchar_t* name);
		HMODULE (__cdecl* get_lib)(pi_BASICQUERY* self,const wchar_t* name);
	//16
		int (__cdecl*	get_flag)(pi_BASICQUERY* self,const wchar_t* name);
		int (__cdecl*	set_flag)(pi_BASICQUERY* self,const wchar_t* name,bool value);
	//24
		int (__cdecl*	get_long)(pi_BASICQUERY* self,const wchar_t* name,long* value);
		int (__cdecl*	set_long)(pi_BASICQUERY* self,const wchar_t* name,long  value);
	//32
		int (__cdecl*	get_str )(pi_BASICQUERY* self,const wchar_t* name,wchar_t* str,int len);
		int (__cdecl*	set_str )(pi_BASICQUERY* self,const wchar_t* name,const wchar_t* str);
	//40
		int (__cdecl*	get_data)(pi_BASICQUERY* self,const wchar_t* name,void* data,int size);
		int (__cdecl*	set_data)(pi_BASICQUERY* self,const wchar_t* name,const void* data,int size);
	//48
		unsigned char	reserved_x[1024-48]; //do not touch
	};
#pragma pack(pop)

#define PI_BQ_PI_STATESTORE						L"pi_StateStore"
#define PI_BQ_PI_METAMARKUP						L"pi_MetaMarkup"
#define PI_BQ_PI_BASICQUERY						L"pi_BasicQuery"
#define PI_BQ_PI_BASICIMAGE						L"pi_BasicImage"
#define PI_BQ_PI_BASICCOLOR						L"pi_BasicColor"
#define PI_BQ_PI_BASICUTILS						L"pi_BasicUtils"
#define PI_BQ_PI_BASICVIDEO						L"pi_BasicVideo"
#define PI_BQ_PI_FORWARDING						L"pi_Forwarding"

#define PI_BQ_FLAG_CPU_MMX  					L"cpu.has_MMX"
#define PI_BQ_FLAG_CPU_SSE1						L"cpu.has_SSE1"
#define PI_BQ_FLAG_CPU_SSE2						L"cpu.has_SSE2"
#define PI_BQ_FLAG_CPU_SSE3						L"cpu.has_SSE3"
#define PI_BQ_FLAG_CPU_sSSE3					L"cpu.has_sSSE3"
#define PI_BQ_FLAG_CPU_SSE41					L"cpu.has_SSE41"
#define PI_BQ_FLAG_CPU_SSE42					L"cpu.has_SSE42"
#define PI_BQ_FLAG_CPU_AVX1						L"cpu.has_AVX1"
#define PI_BQ_FLAG_CPU_AVX2						L"cpu.has_AVX2"
#define PI_BQ_FLAG_CPU_POPCNT					L"cpu.has_POPCNT"

#define PI_BQ_LONG_CPU_CORES  					L"cpu.num_cores"
#define PI_BQ_LONG_CPU_THREADS					L"cpu.num_threads"
#define PI_BQ_LONG_PROGRESS						L"progress.value"		// 0..10000

#define PI_BQ_STR_HOST_NAME  					L"host.name"
#define PI_BQ_STR_HOST_VERSION					L"host.version"
#define PI_BQ_STR_HOST_TEMP_DIR					L"host.temp_dir"
#define PI_BQ_STR_HOST_TEMP_ROOT				L"host.temp_root_dir"
#define PI_BQ_STR_HOST_DOCS_DIR					L"host.docs_dir"
#define PI_BQ_STR_PROGRESS						L"progress.string"
#define PI_BQ_STR_AUTHOR_NAME					L"config.author_name"
#define PI_BQ_STR_ICM_CMYK_FILE					L"icm.cmyk_file"
#define PI_BQ_STR_WORKSPACE_FILE				L"workspace.file"


//--------------------------------------------------------------------------------------------------
//pi_BasicImage
//--------------------------------------------------------------------------------------------------
#define PI_BASICIMAGE_VERSION					0x00020001 // 11 Nov 2025

#ifndef __cplusplus
	typedef	struct pibi_IMAGE					pibi_IMAGE;
	typedef	struct pibi_RECT					pibi_RECT;
	typedef	struct pibi_FILEINFO				pibi_FILEINFO;
	typedef	struct pi_BASICIMAGE				pi_BASICIMAGE;
#endif

#pragma pack(push)
#pragma pack(1)
	struct pibi_IMAGE
	{
		unsigned long	width;
		unsigned long	height;
		unsigned long	pitch;
		unsigned long	unused;
		unsigned long*	p_pix;
		void*			reserved; //do not touch
	};
	struct pibi_RECT
	{
		long	x0;
		long	y0;
		long	x1;
		long	y1;
		bool	valid;
	};
	struct pibi_FILEINFO
	{
		HWND			hwnd;
		const wchar_t*	file;
		const void*		memfile_data;
		unsigned long	memfile_size;
		const wchar_t*	memfile_type_hint; // e.g. ".jpg"
		void*			metadata_ptr;
		unsigned long	metadata_size;
		bool			get_metadata;
		bool			is_known;
		bool			bad_host;
		bool			partial;
		unsigned long	reserved_0;
		const wchar_t*	config_str;
		int (__cdecl*	progress_func)(int done,int total,void* priv);
		void*			progress_priv;
		wchar_t			err_msg[256];
	};
	struct pibi_DOWNSAMPLE
	{
		pibi_IMAGE*		target;
		unsigned long	org_w;
		unsigned long	org_h;
		unsigned long	status;
		void*			reserved; //do not touch
	};
#pragma pack(pop)

#pragma pack(push)
#pragma pack(1)
	struct pi_BASICIMAGE
	{
		unsigned long	version;
		unsigned long	host_id;
	//8
		int (__cdecl*	create)(pibi_IMAGE* img,int width,int height);
		int (__cdecl*	virtualize)(pibi_IMAGE* img,int width,int height,int pitch,unsigned long* p_pix);
		int (__cdecl*	destroy)(pibi_IMAGE* img);
		int (__cdecl*	test)(pibi_IMAGE* img);
	//24
		int (__cdecl*	lock)(pibi_IMAGE* img);
		int (__cdecl*	unlock)(pibi_IMAGE* img);
	//32
		HDC (__cdecl*	gdi_getDC)(pibi_IMAGE* img);
		int (__cdecl*	gdi_freeDC)(pibi_IMAGE* img,HDC* hdc);
		HBITMAP (__cdecl* gdi_makeHBMP)(pibi_IMAGE* img);
		void*			reserved_0; //do not touch
	//48
		int (__cdecl*	set_clip_rect)(pibi_RECT* rect);
		int (__cdecl*	get_clip_rect)(pibi_RECT* rect);
		void*			reserved_1[2]; //do not touch
	//64
		int (__cdecl*	load_file)(pibi_IMAGE* img,pibi_FILEINFO* info);
		int (__cdecl*	save_file)(pibi_IMAGE* img,pibi_FILEINFO* info);
		int (__cdecl*	load_resource)(pibi_IMAGE* img,HINSTANCE h_inst,LPCTSTR res_id,bool alpha);
		void*			reserved_2; //do not touch
	//80
		int (__cdecl*	copy)(pibi_IMAGE* img,pibi_IMAGE* src);
		int (__cdecl*	resize)(pibi_IMAGE* img,int width,int height);
		int (__cdecl*	flip)(pibi_IMAGE* img,unsigned long options);
		int (__cdecl*	rotate)(pibi_IMAGE* img,int direction);
	//96
		int (__cdecl*	fill)(
							pibi_IMAGE* img,int x0,int y0,int x1,int y1,
							unsigned long color1,unsigned long color2,
							unsigned long color3,unsigned long color4,
							unsigned long options,int param1,int param2);
		int (__cdecl*	blit)(
							pibi_IMAGE* dst,int dx0,int dy0,int dx1,int dy1,
							pibi_IMAGE* src,int sx0,int sy0,int sx1,int sy1,
							unsigned long options,unsigned long rop_param);
		int (__cdecl*	quad_blit)(
							pibi_IMAGE* dst,int x0,int y0,int x1,int y1,int x2,int y2,int x3,int y3,
							pibi_IMAGE* src,int sx0,int sy0,int sx1,int sy1,
							unsigned long options,unsigned long rop_param);
		int (__cdecl*	blit_DC)(
							HDC hdc,int dx0,int dy0,int dx1,int dy1,
							pibi_IMAGE* src,int sx0,int sy0,int sx1,int sy1,
							unsigned long options);
	//112
		int (__cdecl*	translate)(
							pibi_IMAGE* img,int x0,int y0,int x1,int y1,
							const unsigned char *lut_b,const unsigned char *lut_g,
							const unsigned char *lut_r,const unsigned char *lut_a,
							unsigned long options,const void* param);
		int (__cdecl*	convolute)(
							pibi_IMAGE* dst,int x0,int y0,int x1,int y1,
							pibi_IMAGE* src,const double *matrix,int mat_cols,int mat_rows,
							unsigned long mask,unsigned long options);
		int (__cdecl*	compare)(pibi_IMAGE* i_new,pibi_IMAGE* i_org,int limit,pibi_RECT *rt_diff);
		void*			reserved_3; //do not touch
	//128
		int (__cdecl*	polar)(
							pibi_IMAGE* dst,int x0,int y0,int x1,int y1,
							pibi_IMAGE* src,int center_x,int center_y,unsigned long options);
		void*			reserved_4[3]; //do not touch
	//144
		int (__cdecl*	downsample_init)(pibi_DOWNSAMPLE* obj,pibi_IMAGE* dst,int org_w,int org_h,
							unsigned long options);
		int (__cdecl*	downsample_push)(pibi_DOWNSAMPLE* obj,unsigned long* p_scan);
		int (__cdecl*	downsample_exit)(pibi_DOWNSAMPLE* obj);
		void*			reserved_5; //do not touch
	//160
		int (__cdecl*	convert_alpha)(pibi_IMAGE* img,unsigned long options);
		unsigned long	(__cdecl* get_highlighter)(pibi_IMAGE* img);
		void*			reserved_6[2]; //do not touch
	//176
		unsigned char	reserved_x[1024-176]; //do not touch
	};
#pragma pack(pop)

//flags for the "options" parameter of ::blit()
#define PI_BI_BLIT_BLOCKY						0x00000000
#define PI_BI_BLIT_STRETCH						0x00000001
#define PI_BI_BLIT_MAXQUALITY					0x00000002
#define PI_BI_BLIT_ALPHABLEND					0x00000010
#define PI_BI_BLIT_RASTEROP  					0x00000020
#define PI_BI_BLIT_CLIPAREA  					0x00000040
#define PI_BI_BLIT_TILE_xxx						0x00030000
	#define PI_BI_BLIT_TILE_NORMAL				0x00010000
	#define PI_BI_BLIT_TILE_INVERT				0x00020000
#define PI_BI_BLIT_STRETCH_MAX_Q				(PI_BI_BLIT_STRETCH|PI_BI_BLIT_MAXQUALITY)

//flags for the "options" parameter of ::flip()
#define PI_BI_FLIP_HORZ							0x00000001
#define PI_BI_FLIP_VERT							0x00000002

//flags for the "options" parameter of ::fill()
//also used for "rop_param" for ::blit(...,PI_BI_BLIT_RASTEROP)
#define PI_BI_FILL_SHAPE_xxx					0x0000000f
	#define PI_BI_FILL_RECTANGLE				0x00000000
	#define PI_BI_FILL_ELLIPSE					0x00000001
	#define PI_BI_FILL_ROUNDRECT				0x00000002
#define PI_BI_FILL_ALPHABLEND					0x00000010
#define PI_BI_FILL_GRADIENT						0x00000020
#define PI_BI_FILL_CLIPAREA  					0x00000040
#define PI_BI_FILL_RASTEROP_xxx					0x00ff0000
	#define PI_BI_FILL_RASTEROP_NONE            0x00000000
	#define PI_BI_FILL_RASTEROP_OR              0x00010000
	#define PI_BI_FILL_RASTEROP_AND             0x00020000
	#define PI_BI_FILL_RASTEROP_XOR             0x00030000
	#define PI_BI_FILL_RASTEROP_ADD             0x00040000
	#define PI_BI_FILL_RASTEROP_SUB             0x00050000
	#define PI_BI_FILL_RASTEROP_INC             0x00060000
	#define PI_BI_FILL_RASTEROP_DEC             0x00070000
	#define PI_BI_FILL_RASTEROP_MUL             0x00080000
	#define PI_BI_FILL_RASTEROP_DIV             0x00090000
	#define PI_BI_FILL_RASTEROP_OFF             0x000a0000
	#define PI_BI_FILL_RASTEROP_MIN             0x000b0000
	#define PI_BI_FILL_RASTEROP_MAX             0x000c0000
	#define PI_BI_FILL_RASTEROP_DIFF            0x000d0000
	#define PI_BI_FILL_RASTEROP_OUT             0x000e0000
	#define PI_BI_FILL_RASTEROP_TEX1            0x000f0000
	#define PI_BI_FILL_RASTEROP_TEX2            0x00100000
	#define PI_BI_FILL_RASTEROP_SCRN            0x00110000
	#define PI_BI_FILL_RASTEROP_OVER            0x00120000
	#define PI_BI_FILL_RASTEROP_DODG            0x00130000
	#define PI_BI_FILL_RASTEROP_BURN            0x00140000
	#define PI_BI_FILL_RASTEROP_LUM             0x00150000
	#define PI_BI_FILL_RASTEROP_CLR             0x00160000
	#define PI_BI_FILL_RASTEROP_HUE             0x00170000
	#define PI_BI_FILL_RASTEROP_SAT             0x00180000
	#define PI_BI_FILL_RASTEROP_VAL             0x00190000
	#define PI_BI_FILL_RASTEROP_LIT             0x001a0000
	#define PI_BI_FILL_RASTEROP_LMSK            0x007c0000
	#define PI_BI_FILL_RASTEROP_MASK            0x007d0000

//flags for the "options" parameter of ::convert_alpha()
#define PI_BI_ALPHA_KEEP						0x00000000
#define PI_BI_ALPHA_REMOVE						0x00000001
#define PI_BI_ALPHA_INVERT						0x00000002	//invert
#define PI_BI_ALPHA_PREMULTIPLY					0x00000003	//invert then premultiply
#define PI_BI_ALPHA_UNMULTIPLY					0x00000004	//unmultiply then invert
#define PI_BI_POLAR_SET_TO_FF					0x00000005

//flags for the "options" parameter of ::polar()
#define PI_BI_POLAR_XY_TO_RQ					0x00000000
#define PI_BI_POLAR_RQ_TO_XY					0x00000001
#define PI_BI_POLAR_INVERT_RQ					0x00000002
#define PI_BI_POLAR_ACCURATE					0x00004000

//flags for the "options" parameter of ::downsample_init()
#define PI_BI_DNSAMP_OPT_INVERT					0x00000001
#define PI_BI_DNSAMP_OPT_MAX_Q					0x00000002
#define PI_BI_DNSAMP_OPT_DRAFT					0x00000004

//values for the "status" member of pibi_DOWNSAMPLE
#define PI_BI_DNSAMP_STATUS_OKAY				0x00000000
#define PI_BI_DNSAMP_STATUS_COMPLETE			0x00000001
#define PI_BI_DNSAMP_STATUS_BAD_PARAM			0x00000002
#define PI_BI_DNSAMP_STATUS_BAD_IMAGE			0x00000003
#define PI_BI_DNSAMP_STATUS_BAD_SOURCE			0x00000004
#define PI_BI_DNSAMP_STATUS_OUT_OF_MEM			0x00000005



//--------------------------------------------------------------------------------------------------
//pi_BasicColor
//--------------------------------------------------------------------------------------------------
#define PI_BASICCOLOR_VERSION					0x0001000a // 18 Jan 2025

#ifndef __cplusplus
	typedef	struct pi_BASICCOLOR				pi_BASICCOLOR;
#endif

#pragma pack(push)
#pragma pack(1)
	struct pi_BASICCOLOR
	{
		unsigned long	version;
		unsigned long	host_id;
	//8
		int	(__cdecl*	convert)(unsigned long* p_pix,unsigned long count,
							unsigned long csflags_src,void* icc_xfrm_src,
							unsigned long csflags_dst,void* icc_xfrm_dst);
		int	(__cdecl*	read_rgb)(unsigned long* p_pix,const unsigned char* p_rgb,
							unsigned long count,unsigned long bpp,unsigned long flags);
		int	(__cdecl*	transform)(unsigned long* p_pix,const float* matrix_5x4);
		void*			reserved_0; //do not touch
	//24
		void* (__cdecl*	icc_xfrm_load)(void* data,unsigned long size,const wchar_t* file);
		int	(__cdecl*	icc_xfrm_free)(void* p_icc_xfrm);
	//32
		unsigned char	reserved_x[1024-32]; //do not touch
	};
#pragma pack(pop)

//flags for "cp_in" and "cp_out" in ::convert()
#define PI_BC_CONVERT_CS_RGB					0x00000000
#define PI_BC_CONVERT_CS_YUV					0x00000001
#define PI_BC_CONVERT_CS_CMY					0x00000002
#define PI_BC_CONVERT_CS_CMYK					0x00000003
#define PI_BC_CONVERT_CS_HSL					0x00000004
#define PI_BC_CONVERT_CS_HSV					0x00000005
#define PI_BC_CONVERT_CS_HHSL					0x00000006
#define PI_BC_CONVERT_CS_HHSV					0x00000007
#define PI_BC_CONVERT_CS_LAB					0x00000008
#define PI_BC_CONVERT_CS_XYZ					0x00000009
#define PI_BC_CONVERT_CS_xxxx					0x0000000f
#define PI_BC_CONVERT_OPT_INVERT				0x00001000
#define PI_BC_CONVERT_OPT_xxxx					0x0000f000

//flags for "flags" in ::read_rgb()
#define PI_BC_READRGB_LSB_IS_RED				0x00000001
#define PI_BC_READRGB_HI_BIT_FIRST				0x00000002 //highest bit first for <8 bpp
#define PI_BC_READRGB_DONT_EXPAND				0x00000004 //don't expand grays for <8 bpp
#define PI_BC_READRGB_BIG_ENDIAN				0x00000008 //treat words as big-endian
#define PI_BC_READRGB_FORCE_GRAY				0x00000010 //treat all bit-depths as grayscale
#define PI_BC_READRGB_ALPHA_KEEP				0x00000000
#define PI_BC_READRGB_ALPHA_DROP				0x00001000
#define PI_BC_READRGB_ALPHA_INVERT				0x00002000
#define PI_BC_READRGB_ALPHA_PREMUL				0x00003000 //output is inverted and premultiplied
#define PI_BC_READRGB_ALPHA_UNMULT				0x00004000 //input is inverted and premultiplied
#define PI_BC_READRGB_ALPHA_xxxx				0x0000f000



//--------------------------------------------------------------------------------------------------
//pi_MetaMarkup
//--------------------------------------------------------------------------------------------------
#define PI_METAMARKUP_VERSION					0x00010003

#ifndef __cplusplus
	typedef	struct pimm_MARK					pimm_MARK;
	typedef	struct pi_METAMARKUP				pi_METAMARKUP;
#endif

#pragma pack(push)
#pragma pack(1)
	struct pimm_MARK
	{
		char*			data;
		unsigned long	size;
		char*			raw_data;
		unsigned long	raw_size;
	};
#pragma pack(pop)

#pragma pack(push)
#pragma pack(1)
	struct pi_METAMARKUP
	{
		unsigned long	version;
		unsigned long	host_id;
	//8
		int (__cdecl*	create )(pimm_MARK* mark);
		int (__cdecl*	import )(pimm_MARK* mark,const void* data,unsigned long size);
		int (__cdecl*	destroy)(pimm_MARK* mark);
		int (__cdecl*	append )(pimm_MARK* mark,const char* fragment);
		int (__cdecl*	get_tag)(pimm_MARK* mark,const char* tag,char* value,unsigned long size);
		int (__cdecl*	set_tag)(pimm_MARK* mark,const char* tag,const char* value);
		int (__cdecl*	bpp_get)(pimm_MARK* mark,unsigned int* bpp);
		int (__cdecl*	bpp_set)(pimm_MARK* mark,unsigned int bpp);
		int (__cdecl*	exif_get)(pimm_MARK* mark,void** exif,unsigned long* sz_exif);
		int (__cdecl*	exif_set)(pimm_MARK* mark,const void* exif,unsigned long sz_exif);
		int (__cdecl*	exif_loadXMP)(pimm_MARK* mark,const char* xmp_str,int limit_or_zero);
	//52
		unsigned char	reserved_x[1024-52]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//pi_BasicUtils
//--------------------------------------------------------------------------------------------------
#define PI_BASICUTILS_VERSION					0x00010005 // 12 Oct 2025

#ifndef __cplusplus
	typedef	struct pi_BASICUTILS				pi_BASICUTILS;
#endif

#pragma pack(push)
#pragma pack(1)
	struct pibu_HTTPreq
	{
		const wchar_t*	url;
		char*			p_response;
		unsigned long	sz_response;
		char*			p_post_data;
		unsigned long	sz_post_data;
		const wchar_t*	extra_headers;
		void*			reserved[6]; //do not touch
		wchar_t*		err;
		unsigned long	sz_err;
		int (__cdecl*	progress_func)(int done,int total,void* priv);
		void*			progress_priv;
	};
#pragma pack(pop)

#pragma pack(push)
#pragma pack(1)
	struct pi_BASICUTILS
	{
		unsigned long	version;
		unsigned long	host_id;
	//8
		int (__cdecl*	lang_TranslateCore)(wchar_t* out,int size,const wchar_t* in);
		int (__cdecl*	lang_SetWindowText)(HWND hwnd,const wchar_t* str);
		int (__cdecl*	lang_TranslateWindow)(HWND hwnd);
		void*			reserved_0; //do not touch
	//24
		unsigned char	reserved_1[64-24]; //do not touch
	//64
		int (__cdecl*	http_SendRequest)(pibu_HTTPreq* http,bool allow_insecure);
		int (__cdecl*	http_Download)(pibu_HTTPreq* http,wchar_t* local,int sz_local);
		void*			reserved_2; //do not touch
		void*			reserved_3; //do not touch
	//80
		unsigned char	reserved_x[1024-80]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//pi_BasicVideo
//--------------------------------------------------------------------------------------------------
#define PI_BASICVIDEO_VERSION					0x00010005 // 30 Aug 2023

#ifndef __cplusplus
	typedef	struct pi_BASICVIDEO				pi_BASICVIDEO;
#endif

#pragma pack(push)
#pragma pack(1)
	struct pi_BASICVIDEO
	{
		unsigned long	version;
		unsigned long	host_id;
	//8
		void* (__cdecl*	init)(int timeout_ms,int* err_code);
		int (__cdecl*	free)(void** context);
		int (__cdecl*	load)(void* context,const wchar_t* path,unsigned long flags,int* err_code);
		int (__cdecl*	unload)(void* context);
		int (__cdecl*	grab)(void* context,int frame_id,unsigned long flags,pibi_IMAGE* image);
		int (__cdecl*	keepalive)(void* context);
		int (__cdecl*	set_timeout)(void* context,int time_ms);
		int (__cdecl*	get_length)(void* context,int* time_ms);
		int (__cdecl*	get_frame_count)(void* context,int* count);
		int (__cdecl*	get_frame_rate)(void* context,double* rate);
		int (__cdecl*	get_codec_name)(void* context,wchar_t* name,int sz_name);
		int (__cdecl*	get_provider_name)(void* context,wchar_t* name,int sz_name);
	//56
		unsigned char	reserved_x[1024-56]; //do not touch
	};
#pragma pack(pop)

//flags for "flags" in ::load()

#define PI_BV_LOAD_DEFAULT						0x00000000
#define PI_BV_LOAD_PREFER_OWN_CODEC				0x00000001 //try own codecs before system codecs

//flags for "flags" in ::grab()
#define PI_BV_GRAB_DEFAULT						0x00000000
#define PI_BV_GRAB_USE_PREROLL					0x00000001
#define PI_BV_GRAB_NO_SHARED_IMAGE				0x00000002 //get standalone image instead of shared



//--------------------------------------------------------------------------------------------------
//pi_Forwarding
//--------------------------------------------------------------------------------------------------
#define PI_FORWARDING_VERSION					0x00010002 // 22 Oct 2025

#ifndef __cplusplus
	typedef	struct pi_FORWARDING				pi_FORWARDING;
#endif

#pragma pack(push)
#pragma pack(1)
	struct pi_FORWARDING
	{
		unsigned long	version;
		unsigned long	host_id;
	//8
		int (__cdecl*	fwd_LoadImage)(const wchar_t* plg_name,void* p_flt_IMAGE_L,int* plg_ret);
	//12
		unsigned char	reserved_x[1024-12]; //do not touch
	};
#pragma pack(pop)



//==================================================================================================



/***************************************************************************************************
****************************************************************************************************
****************************************************************************************************

                                 FastExternals(TM) CORE STRUCTS

****************************************************************************************************
****************************************************************************************************
***************************************************************************************************/



//==================================================================================================

//--------------------------------------------------------------------------------------------------
//plg_INFO
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct plg_INFO						plg_INFO;
#endif

#pragma pack(push)
#pragma pack(1)
	struct plg_INFO
	{
		unsigned long	api_type;		// PLUGIN_APITYPE_* flags
		unsigned long	api_version;	// PLUGIN_INTERFACE_VERSION
		unsigned long	api_flags;		// do not touch
		unsigned long	api_extra;		// do not touch
	//16
		unsigned long	plg_version;	// plug-in's version number
		unsigned long	plg_options;	// plug-in's options
		unsigned long	plg_flags;		// do not touch
		unsigned long	plg_extra;		// do not touch
	//32
		wchar_t			plg_name[64];	// plug-in's name
		wchar_t			plg_author[64];	// plug-in's author
	//288
		unsigned char	reserved_x[1024-288]; // do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//plg_DIALOG
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct plg_DIALOG					plg_DIALOG;
#endif

#pragma pack(push)
#pragma pack(1)
	struct plg_DIALOG
	{
		HWND			hwnd;
		unsigned long	dialog_id;
		unsigned long	param_1;
		unsigned long	param_2;
	//16
		unsigned char	reserved_1[256-16]; //do not touch
	//256
		pi_STATESTORE*	pi_StateStore;
		pi_METAMARKUP*	pi_MetaMarkup;
		pi_BASICQUERY*	pi_BasicQuery;
		pi_BASICIMAGE*	pi_BasicImage;
		pi_BASICCOLOR*	pi_BasicColor;
		pi_BASICUTILS*	pi_BasicUtils;
	//280
		unsigned char	reserved_x[1024-280]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//flt_IMAGE_L
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct flt_IMAGE_L					flt_IMAGE_L;
#endif

#pragma pack(push)
#pragma pack(1)
	struct flt_IMAGE_L
	{
		unsigned long	width;
		unsigned long	height;
		unsigned long	pitch;
		unsigned long*	lp_pix;
	//16
		const wchar_t*	file;
		HWND			hwnd;
		int				(__cdecl* create)(flt_IMAGE_L* self);
		unsigned short	host_flags;
		unsigned char	img_type;
		unsigned char	img_subtype;
	//32
		unsigned long	layer_count;
		short			x_pos;
		short			y_pos;
		wchar_t			name[32];
		unsigned short	options;
		unsigned short	frame_delay;
		unsigned char	group_id;
		unsigned char	transparency;
		unsigned char	unused_2[18];
	//128
		unsigned char*	meta_data;
		int				(__cdecl* meta_write)(flt_IMAGE_L* self,const char* type,int size);
	//136
		unsigned char	reserved_1[256-136-(6*4)]; //do not touch
		int				(__cdecl* get_config)(flt_IMAGE_L* self,plg_CONFIGDATA* config);
		int				(__cdecl* set_infostr)(flt_IMAGE_L* self,int type,const wchar_t* info);
		int				(__cdecl* set_progress)(flt_IMAGE_L* self,int done,int total);
		int				host_response;
		unsigned short	warnings;
		unsigned char	reserved_2[2]; //do not touch
		unsigned long	timeout;
	//256
		pi_STATESTORE*	pi_StateStore;
		pi_METAMARKUP*	pi_MetaMarkup;
		pi_BASICQUERY*	pi_BasicQuery;
		pi_BASICIMAGE*	pi_BasicImage;
		pi_BASICCOLOR*	pi_BasicColor;
		pi_BASICUTILS*	pi_BasicUtils;
	//280
		unsigned char	reserved_x[1024-280]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//flt_CHECK_L
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct flt_CHECK_L					flt_CHECK_L;
#endif

#pragma pack(push)
#pragma pack(1)
	struct flt_CHECK_L
	{
		wchar_t			extension[32];
	//64
		unsigned long	hdr_size;
		unsigned char	hdr_data[32];
	//100
		unsigned char	reserved_1[124-100]; //do not touch
	//124
		unsigned char	level_image;
		unsigned char	level_layer;
		unsigned char	level_other;
		unsigned char	support_flags;
	};
#pragma pack(pop)

#define SUPPORT_FLAG_IS_BRIDGE					0x00000001
#define SUPPORT_FLAG_DEMOTE_ME					0x00000002



//--------------------------------------------------------------------------------------------------
//flt_IMAGE_S
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct flt_IMAGE_S					flt_IMAGE_S;
#endif

#pragma pack(push)
#pragma pack(1)
	struct flt_IMAGE_S
	{
		unsigned long	width;
		unsigned long	height;
		unsigned long	pitch;
		unsigned long*	lp_pix;
	//16
		const wchar_t*	file;
		HWND			hwnd;
		int				(__cdecl* select)(flt_IMAGE_S* self,int layer_id);
		unsigned short	host_flags;
		unsigned char	img_type;
		unsigned char	img_subtype;
	//32
		unsigned long	layer_count;
		short			x_pos;
		short			y_pos;
		wchar_t			name[32];
		unsigned short	options;
		unsigned short	frame_delay;
		unsigned char	group_id;
		unsigned char	transparency;
		unsigned char	unused_2[18];
	//128
		unsigned char*	meta_data;
		int				(__cdecl* meta_read)(flt_IMAGE_S* self,const char* type);
	//136
		unsigned char	reserved_1[256-136-(6*4)]; //do not touch
		int				(__cdecl* get_config)(flt_IMAGE_S* self,plg_CONFIGDATA* config);
		int				(__cdecl* set_infostr)(flt_IMAGE_S* self,int type,const wchar_t* info);
		int				(__cdecl* set_progress)(flt_IMAGE_S* self,int done,int total);
		int				host_response;
		unsigned short	warnings;
		unsigned char	reserved_2[2]; //do not touch
		unsigned long	timeout;
	//256
		pi_STATESTORE*	pi_StateStore;
		pi_METAMARKUP*	pi_MetaMarkup;
		pi_BASICQUERY*	pi_BasicQuery;
		pi_BASICIMAGE*	pi_BasicImage;
		pi_BASICCOLOR*	pi_BasicColor;
		pi_BASICUTILS*	pi_BasicUtils;
	//280
		unsigned char	reserved_x[1024-280]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//flt_CHECK_S
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct flt_CHECK_S					flt_CHECK_S;
#endif

#pragma pack(push)
#pragma pack(1)
	struct flt_CHECK_S
	{
		wchar_t			extension[32];
	//64
		unsigned char	reserved_1[124-64]; //do not touch
	//124
		unsigned char	level_image;
		unsigned char	level_layer;
		unsigned char	level_other;
		unsigned char	support_flags;
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//flt_IMAGE_X
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct flt_IMAGE_X					flt_IMAGE_X;
#endif

#pragma pack(push)
#pragma pack(1)
	struct flt_IMAGE_X
	{
		const wchar_t*	file;
		HWND			hwnd;
		unsigned long	xform_id;
		unsigned long	xform_id2;
	//16
		unsigned char	reserved_1[256-16-(6*4)]; //do not touch
		int				(__cdecl* get_config)(flt_IMAGE_X* self,plg_CONFIGDATA* config);
		int				(__cdecl* set_infostr)(flt_IMAGE_X* self,int type,const wchar_t* info);
		int				(__cdecl* set_progress)(flt_IMAGE_X* self,int done,int total);
		int				host_response;
		unsigned short	warnings;
		unsigned char	reserved_2[2]; //do not touch
		unsigned long	timeout;
	//256
		pi_STATESTORE*	pi_StateStore;
		pi_METAMARKUP*	pi_MetaMarkup;
		pi_BASICQUERY*	pi_BasicQuery;
		pi_BASICIMAGE*	pi_BasicImage;
		pi_BASICCOLOR*	pi_BasicColor;
		pi_BASICUTILS*	pi_BasicUtils;
	//280
		unsigned char	reserved_x[1024-280]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//dev_IMAGE_R
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct dev_IMAGE_R					dev_IMAGE_R;
#endif

#pragma pack(push)
#pragma pack(1)
	struct dev_IMAGE_R
	{
		unsigned long	width;
		unsigned long	height;
		unsigned long	pitch;
		unsigned long*	lp_pix;
	//16
		wchar_t*		title_or_path;
		HWND			hwnd;
		int				(__cdecl* create)(dev_IMAGE_R* self);
		unsigned short	host_flags;
		unsigned char	img_type;
		unsigned char	img_subtype;
	//32
		unsigned long	layer_count;
		short			x_pos;
		short			y_pos;
		wchar_t			name[32];
		unsigned short	options;
		unsigned short	frame_delay;
		unsigned char	group_id;
		unsigned char	transparency;
		unsigned char	unused_1[18];
	//128
		unsigned char*	meta_data;
		int				(__cdecl* meta_write)(dev_IMAGE_R* self,const char* type,int size);
	//136
		unsigned char	reserved_1[256-136-(6*4)]; //do not touch
		int				(__cdecl* get_config)(dev_IMAGE_R* self,plg_CONFIGDATA* config);
		int				(__cdecl* set_infostr)(dev_IMAGE_R* self,int type,const wchar_t* info);
		int				(__cdecl* set_progress)(dev_IMAGE_R* self,int done,int total);
		int				host_response;
		unsigned short	warnings;
		unsigned char	reserved_2[2]; //do not touch
		unsigned long	timeout;
	//256
		pi_STATESTORE*	pi_StateStore;
		pi_METAMARKUP*	pi_MetaMarkup;
		pi_BASICQUERY*	pi_BasicQuery;
		pi_BASICIMAGE*	pi_BasicImage;
		pi_BASICCOLOR*	pi_BasicColor;
		pi_BASICUTILS*	pi_BasicUtils;
	//280
		unsigned char	reserved_x[1024-280]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//dev_IMAGE_S
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct dev_IMAGE_S					dev_IMAGE_S;
#endif

#pragma pack(push)
#pragma pack(1)
	struct dev_IMAGE_S
	{
		unsigned long	width;
		unsigned long	height;
		unsigned long	pitch;
		unsigned long*	lp_pix;
	//16
		const wchar_t*	title_or_path;
		HWND			hwnd;
		int				(__cdecl* select)(dev_IMAGE_S* self,int layer_id);
		unsigned short	host_flags;
		unsigned char	img_type;
		unsigned char	img_subtype;
	//32
		unsigned long	layer_count;
		short			x_pos;
		short			y_pos;
		wchar_t			name[32];
		unsigned short	options;
		unsigned short	frame_delay;
		unsigned char	group_id;
		unsigned char	transparency;
		unsigned char	unused_1[18];
	//128
		unsigned char*	meta_data;
		int				(__cdecl* meta_read)(dev_IMAGE_S* self,const char* type);
	//136
		unsigned char	reserved_1[256-136-(6*4)]; //do not touch
		int				(__cdecl* get_config)(dev_IMAGE_S* self,plg_CONFIGDATA* config);
		int				(__cdecl* set_infostr)(dev_IMAGE_S* self,int type,const wchar_t* info);
		int				(__cdecl* set_progress)(dev_IMAGE_S* self,int done,int total);
		int				host_response;
		unsigned short	warnings;
		unsigned char	reserved_2[2]; //do not touch
		unsigned long	timeout;
	//256
		pi_STATESTORE*	pi_StateStore;
		pi_METAMARKUP*	pi_MetaMarkup;
		pi_BASICQUERY*	pi_BasicQuery;
		pi_BASICIMAGE*	pi_BasicImage;
		pi_BASICCOLOR*	pi_BasicColor;
		pi_BASICUTILS*	pi_BasicUtils;
	//280
		unsigned char	reserved_x[1024-280]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//efx_IMAGE_T
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct efx_IMAGE_T					efx_IMAGE_T;
#endif

#pragma pack(push)
#pragma pack(1)
	struct efx_IMAGE_T
	{
		unsigned long	width;
		unsigned long	height;
		unsigned long	pitch;
		unsigned long*	lp_pix;
	//16
		HWND			hwnd;
		unsigned long	flags;
	//24
		int				(__cdecl* lock   )(efx_IMAGE_T* self);
		int				(__cdecl* unlock )(efx_IMAGE_T* self);
		int				(__cdecl* load   )(efx_IMAGE_T* self);
		int				(__cdecl* realloc)(efx_IMAGE_T* self);
		int				(__cdecl* refresh)(efx_IMAGE_T* self);
		void*			unused_0;
	//48
		unsigned long	color_1;
		unsigned long	color_2;
		unsigned long	unused_1[6];
	//80
		int				(__cdecl* dock)(efx_IMAGE_T* self,HWND hwnd);
		void*			unused_2[3];
	//96
		unsigned char	reserved_0[128-96-4]; //do not touch
		unsigned long	unused_3;
	//128
		unsigned char*	meta_data;
		int				(__cdecl* meta_query)(efx_IMAGE_T* self,const char* type,int size);
	//136
		unsigned char	reserved_1[256-136-(6*4)]; //do not touch
		int				(__cdecl* get_config)(efx_IMAGE_T* self,plg_CONFIGDATA* config);
		int				(__cdecl* set_infostr)(efx_IMAGE_T* self,int type,const wchar_t* info);
		int				(__cdecl* set_progress)(efx_IMAGE_T* self,int done,int total);
		int				host_response;
		unsigned short	warnings;
		unsigned char	reserved_2[2]; //do not touch
		unsigned long	timeout;
	//256
		pi_STATESTORE*	pi_StateStore;
		pi_METAMARKUP*	pi_MetaMarkup;
		pi_BASICQUERY*	pi_BasicQuery;
		pi_BASICIMAGE*	pi_BasicImage;
		pi_BASICCOLOR*	pi_BasicColor;
		pi_BASICUTILS*	pi_BasicUtils;
	//280
		unsigned char	reserved_x[1024-280]; //do not touch
	};
#pragma pack(pop)



//--------------------------------------------------------------------------------------------------
//gai_IMAGE_P
//--------------------------------------------------------------------------------------------------
#ifndef __cplusplus
	typedef	struct gai_IMAGE_P					gai_IMAGE_P;
#endif

#pragma pack(push)
#pragma pack(1)
	struct gai_IMAGE_P
	{
		unsigned long	width;
		unsigned long	height;
		unsigned long	pitch;
		unsigned long*	lp_pix;
	//16
		HWND			hwnd;
		unsigned long	flags;
	//24
		int				(__cdecl* lock   )(gai_IMAGE_P* self);
		int				(__cdecl* unlock )(gai_IMAGE_P* self);
		int				(__cdecl* load   )(gai_IMAGE_P* self,int option);
		int				(__cdecl* realloc)(gai_IMAGE_P* self);
		void*			unused_0[2];
	//48
		const wchar_t*	prompt_text;
		unsigned char	prompt_type;
		unsigned char	unused_1[3];
		unsigned long	req_width;
		unsigned long	req_height;
		unsigned long	unused_2[4];
	//80
		void*			unused_3[4];
	//96
		unsigned char	reserved_0[128-96-4]; //do not touch
		unsigned long	unused_4;
	//128
		unsigned char*	meta_data;
		int				(__cdecl* meta_query)(gai_IMAGE_P* self,const char* type,int size);
	//136
		unsigned char	reserved_1[256-136-(6*4)]; //do not touch
		int				(__cdecl* get_config)(gai_IMAGE_P* self,plg_CONFIGDATA* config);
		int				(__cdecl* set_infostr)(gai_IMAGE_P* self,int type,const wchar_t* info);
		int				(__cdecl* set_progress)(gai_IMAGE_P* self,int done,int total);
		int				host_response;
		unsigned short	warnings;
		unsigned char	reserved_2[2]; //do not touch
		unsigned long	timeout;
	//256
		pi_STATESTORE*	pi_StateStore;
		pi_METAMARKUP*	pi_MetaMarkup;
		pi_BASICQUERY*	pi_BasicQuery;
		pi_BASICIMAGE*	pi_BasicImage;
		pi_BASICCOLOR*	pi_BasicColor;
		pi_BASICUTILS*	pi_BasicUtils;
	//280
		unsigned char	reserved_x[1024-280]; //do not touch
	};
#pragma pack(pop)



//==================================================================================================



/***************************************************************************************************
****************************************************************************************************
****************************************************************************************************

                           FastExternals(TM) CORE FUNCTION PROTOTYPES

****************************************************************************************************
****************************************************************************************************
***************************************************************************************************/



//==================================================================================================

//--------------------------------------------------------------------------------------------------
//functions for all plug-ins
typedef int (__cdecl* FUNC_PLG_INFO  )(plg_INFO*  );
typedef int (__cdecl* FUNC_PLG_DIALOG)(plg_DIALOG*);

//--------------------------------------------------------------------------------------------------
//functions for file format plug-ins
typedef int (__cdecl* FUNC_FLT_LOADIMAGE)(flt_IMAGE_L*);
typedef int (__cdecl* FUNC_FLT_SAVEIMAGE)(flt_IMAGE_S*);
typedef int (__cdecl* FUNC_FLT_CHECKLOAD)(flt_CHECK_L*);
typedef int (__cdecl* FUNC_FLT_CHECKSAVE)(flt_CHECK_S*);
typedef int (__cdecl* FUNC_FLT_XFRMIMAGE)(flt_IMAGE_X*);

//--------------------------------------------------------------------------------------------------
//functions for device plug-ins
typedef int (__cdecl* FUNC_DEV_READIMAGE)(dev_IMAGE_R*);
typedef int (__cdecl* FUNC_DEV_SENDIMAGE)(dev_IMAGE_S*);

//--------------------------------------------------------------------------------------------------
//functions for effects plug-ins
typedef int (__cdecl* FUNC_EFX_DO_EFFECT)(efx_IMAGE_T*);

//--------------------------------------------------------------------------------------------------
//functions for generative AI plug-ins
typedef int (__cdecl* FUNC_GAI_DO_PROMPT)(gai_IMAGE_P*);

//==================================================================================================



//==================================================================================================
//==================================================================================================
