#ifndef _FS_IMAGE_C_H_
#define _FS_IMAGE_C_H_

#ifdef __cplusplus
extern "C" {
#endif



typedef enum _FSDIBFormat {
e_FSDIBInvalid = 0,
e_FSDIB1bpp = 0x001,
e_FSDIBRgb = 0x018,
e_FSDIBRgb32 = 0x020,
e_FSDIBArgb = 0x220,
e_FSDIBCmyk = 0x420,
e_FSDIB8bppMask = 0x108,
e_FSDIB8bpp = 0x008,
e_FSDIB8bppGray = 0x1008,
e_FSDIBAbgr = 0x222,
e_FSDIBRgb565 = 0x565,
}FSDIBFormat;



typedef enum _FSImageType {
e_FSImageTypeUnknown  =  -1,
e_FSNone  =  0,
e_FSBMP  =  1,
e_FSJPG  =  2,
e_FSPNG  =  3,
e_FSGIF  =  4,
e_FSTIF  =  5,
e_FSJPX  =  6,
e_FSJBIG2  =  8,
e_FSWEBP  =  9,
}FSImageType;



typedef enum _FSInterpolationFlag {
e_FSDownsample = 0x01,
e_FSQuadratic = 0x02,
e_FSBicubic = 0x04,
}FSInterpolationFlag;



typedef enum _FSOrientation {
e_FSOrientationNone = 0,
e_FSOrientationOrientationNormal = 1,
e_FSOrientationFlipH = 2,
e_FSOrientationRotate180 = 3,
e_FSOrientationFlipV = 4,
e_FSOrientationRotate90FlipH = 5,
e_FSOrientationRotate90 = 6,
e_FSOrientationRotate270FlipH = 7,
e_FSOrientationRotate270 = 8,
}FSOrientation;


FSErrorCode FSDK_Bitmap_Create(int width, int height, FSDIBFormat format, FS_UINT8* buffer, int pitch, FS_BITMAP_HANDLE* bitmap_return_value);
FSErrorCode FSDK_Bitmap_Create0(FS_BITMAP_HANDLE* bitmap_return_value);
FSErrorCode FSDK_Bitmap_Release(FS_BITMAP_HANDLE bitmap_handle);
FSErrorCode FSDK_Bitmap_IsEmpty(FS_BITMAP_HANDLE bitmap_handle, FS_BOOL* return_value);
FSErrorCode FSDK_Bitmap_Clone(FS_BITMAP_HANDLE bitmap_handle, const FSRectI* clip_rect, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Bitmap_GetWidth(FS_BITMAP_HANDLE bitmap_handle, int* return_value);
FSErrorCode FSDK_Bitmap_GetHeight(FS_BITMAP_HANDLE bitmap_handle, int* return_value);
FSErrorCode FSDK_Bitmap_GetPitch(FS_BITMAP_HANDLE bitmap_handle, int* return_value);
FSErrorCode FSDK_Bitmap_GetBpp(FS_BITMAP_HANDLE bitmap_handle, int* return_value);
FSErrorCode FSDK_Bitmap_GetBuffer(FS_BITMAP_HANDLE bitmap_handle, const  FS_UINT8** return_value);
FSErrorCode FSDK_Bitmap_GetFormat(FS_BITMAP_HANDLE bitmap_handle, FSDIBFormat* return_value);
FSErrorCode FSDK_Bitmap_FillRect(FS_BITMAP_HANDLE bitmap_handle, FSDK_ARGB color, const FSRectI* rect);
FSErrorCode FSDK_Bitmap_ConvertFormat(FS_BITMAP_HANDLE bitmap_handle, FSDIBFormat format, void* icc_transform, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Bitmap_CalculateBBoxByColor(FS_BITMAP_HANDLE bitmap_handle, FSDK_ARGB backgroud_color, FSRectI* return_value);
FSErrorCode FSDK_Bitmap_DetectBBoxByColorDiffer(FS_BITMAP_HANDLE bitmap_handle, int detection_size, int color_differ, FSRectI* return_value);
FSErrorCode FSDK_Bitmap_SwapXY(FS_BITMAP_HANDLE bitmap_handle, FS_BOOL is_flip_horz, FS_BOOL is_flip_vert, const FSRectI* clip_rect, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Bitmap_Flip(FS_BITMAP_HANDLE bitmap_handle, FS_BOOL is_flip_horz, FS_BOOL is_flip_vert, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Bitmap_StretchTo(FS_BITMAP_HANDLE bitmap_handle, int dest_width, int dest_height, FSInterpolationFlag flag,
                   const FSRectI* clip_rect, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Bitmap_TransformTo(FS_BITMAP_HANDLE bitmap_handle, const FSMatrix matrix, FSInterpolationFlag flag,
                     int out_left, int out_top, const FSRectI* clip_rect, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Bitmap_GetMask(FS_BITMAP_HANDLE bitmap_handle, const FSRectI* clip_rect, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Bitmap_ConvertToMono(FS_BITMAP_HANDLE bitmap_handle, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Image_Create(FS_IMAGE_HANDLE* image_return_value);
FSErrorCode FSDK_Image_Create0(const wchar_t* path, FS_IMAGE_HANDLE* image_return_value);
FSErrorCode FSDK_Image_Create1(const void* buffer, size_t length, FS_IMAGE_HANDLE* image_return_value);
FSErrorCode FSDK_Image_Create2( FSReaderCallback* file_read, FS_IMAGE_HANDLE* image_return_value);
FSErrorCode FSDK_Image_Release(FS_IMAGE_HANDLE image_handle);
FSErrorCode FSDK_Image_IsEmpty(FS_IMAGE_HANDLE image_handle, FS_BOOL* return_value);
FSErrorCode FSDK_Image_GetType(FS_IMAGE_HANDLE image_handle, FSImageType* return_value);
FSErrorCode FSDK_Image_GetWidth(FS_IMAGE_HANDLE image_handle, int* return_value);
FSErrorCode FSDK_Image_GetHeight(FS_IMAGE_HANDLE image_handle, int* return_value);
FSErrorCode FSDK_Image_GetFrameCount(FS_IMAGE_HANDLE image_handle, int* return_value);
FSErrorCode FSDK_Image_GetFrameBitmap(FS_IMAGE_HANDLE image_handle, int index, FS_BITMAP_HANDLE* return_value);
FSErrorCode FSDK_Image_GetXDPI(FS_IMAGE_HANDLE image_handle, int* return_value);
FSErrorCode FSDK_Image_GetYDPI(FS_IMAGE_HANDLE image_handle, int* return_value);
FSErrorCode FSDK_Image_AddFrame(FS_IMAGE_HANDLE image_handle, const FS_BITMAP_HANDLE bitmap, FS_BOOL* return_value);
FSErrorCode FSDK_Image_SetDPIs(FS_IMAGE_HANDLE image_handle, int x_dpi, int y_dpi);
FSErrorCode FSDK_Image_SaveAs(FS_IMAGE_HANDLE image_handle, const wchar_t* file_path, FS_BOOL* return_value);
FSErrorCode FSDK_Image_SaveAs0(FS_IMAGE_HANDLE image_handle,  FSStreamCallback* file, const wchar_t* file_extension, FS_BOOL* return_value);
FSErrorCode FSDK_Image_GetOrientation(FS_IMAGE_HANDLE image_handle, FSOrientation* return_value);
#ifdef __cplusplus
}
#endif
#endif
