#ifndef _FS_OPTIMIZATION_C_H_
#define _FS_OPTIMIZATION_C_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "fx_basic_c.h"
#include "fx_stream_c.h"
#include "fs_file_c.h"


typedef enum _FSOptimizerOptions {
e_FSOptimizerCompressImages  = 0x01,
e_FSOptimizerCleanUp = 0x02,
e_FSOptimizerDiscardObjects = 0x04,
e_FSOptimizerUnembeddedFonts = 0x08,
e_FSOptimizerDiscardUserData = 0x10,
e_FSOptimizerTransparency = 0x20,
}FSOptimizerOptions;



typedef enum _FSImageCompressMode {
e_FSImageCompressHigh = 10003,
e_FSImageCompressjpeg = 10005,
e_FSImageCompressjpeg2000 = 10006,
e_FSImageCompressRetain  = 10007,
e_FSImageCompressZip = 10009,
}FSImageCompressMode;



typedef enum _FSImageCompressQuality {
e_FSImageCompressQualityMinimum = 1,
e_FSImageCompressQualityLow = 2,
e_FSImageCompressQualityMedium = 3,
e_FSImageCompressQualityHigh  = 4,
e_FSImageCompressQualityMaximum  = 5,
e_FSImageCompressQualityLossless = 6,
}FSImageCompressQuality;



typedef enum _FSMonoImageCompressMode {
e_FSMonoImageCompressModeImageCompressCCITT3 = 10001,
e_FSMonoImageCompressModeImageCompressCCITT4 = 10002,
e_FSMonoImageCompressModeImageCompressHigh = 10003,
e_FSMonoImageCompressModeImageCompressjbig2 = 10004,
e_FSMonoImageCompressModeImageCompressRetain  = 10007,
e_FSMonoImageCompressModeImageCompressRunLength = 10008,
e_FSMonoImageCompressModeImageCompressZip = 10009,
}FSMonoImageCompressMode;



typedef enum _FSMonoImageCompressQuality {
e_FSMonoImageCompressQualityImageCompressQualityLossless = 1,
e_FSMonoImageCompressQualityImageCompressQualityLossy = 2,
e_FSMonoImageCompressQualityImageCompressQualityMinimum = 3,
e_FSMonoImageCompressQualityImageCompressQualityLow = 4,
e_FSMonoImageCompressQualityImageCompressQualityMedium = 5,
e_FSMonoImageCompressQualityImageCompressQualityHigh = 6,
e_FSMonoImageCompressQualityImageCompressQualityMaximum = 7,
}FSMonoImageCompressQuality;



typedef enum _FSStretchMode {
e_FSStretchDefault = -1,
e_FSStretchOff = 0x00,
e_FSStretchInterpol = 0x20,
e_FSStretchDownsample = 0x04,
e_FSStretchBicubic = 0x80,
e_FSStretchNoSmooth = 0x100,
}FSStretchMode;



typedef enum _FSCleanUpOptions {
e_FSCleanUpUseFlateForNonEncodedStream  = 0x01,
e_FSCleanUpUseFlateInsteadOfLZW = 0x02,
e_FSCleanUpRemoveInvalidBookmarks = 0x04,
e_FSCleanUpRemoveInvalidLinks = 0x08,
e_FSCleanUpDiscardUnreferencedNamedDes = 0x10,
e_FSCleanUpOptPageContent = 0x20,
}FSCleanUpOptions;



typedef enum _FSDiscardObjectsOptions {
e_FSDiscardObjectsFormActions  = 0x01,
e_FSDiscardObjectsFlattenFormFields = 0x02,
e_FSDiscardObjectsJavaScriptActions = 0x04,
e_FSDiscardObjectsEmbeddedPageThumbnails = 0x08,
e_FSDiscardObjectsEmbeddedPrintSettings = 0x10,
e_FSDiscardObjectsBookmarks = 0x20,
e_FSDiscardObjectsAlternateImages = 0x40,
e_FSDiscardObjectsDocumentTags = 0x80,
e_FSDiscardObjectsEmbeddedSearchIndex = 0x100,
e_FSDiscardObjectsDetectAndMergeImageFragment = 0x200,
e_FSDiscardObjectsSmoothlinestocurves = 0x400,
}FSDiscardObjectsOptions;



typedef enum _FSDiscardUserDataOptions {
e_FSDiscardUserDataAllAnnotsFormsAndMultimedia  = 0x01,
e_FSDiscardUserDataExternalCrossReferences = 0x02,
e_FSDiscardUserDataDocumentInfoAndMetaData = 0x04,
e_FSDiscardUserDataFileAttchments = 0x08,
e_FSDiscardUserDataPrivateDataOfOtherApp = 0x10,
e_FSDiscardUserDataLayer = 0x20,
e_FSDiscardUserAllData = 0x40,
}FSDiscardUserDataOptions;



typedef enum _FSScannedImageCompressMode {
e_FSScannedImageCompressHigh = 1,
e_FSScannedImageCompressjpeg = 2,
e_FSScannedImageCompressjpeg2000LossLess = 3,
e_FSScannedImageCompressjpeg2000Lossy = 4,
}FSScannedImageCompressMode;



typedef enum _FSScannedMonoImageCompressMode {
e_FSScannedMonoImageCompressjbig2Lossy = 1,
e_FSScannedMonoImageCompressjbig2LossLess = 2,
e_FSScannedMonoImageCompressCCITT4 = 3,
e_FSScannedMonoImageCompressHigh = 4,
}FSScannedMonoImageCompressMode;



typedef enum _FSTransparencyMode {
e_FSTransparencyModeLowResolution = 0,
e_FSTransparencyModeMediumResolution = 1,
e_FSTransparencyModeHighResolution = 2,
}FSTransparencyMode;


typedef struct _FSAuditSpaceSize {
  FS_UINT32 content_streams;
  FS_UINT32 images;
  FS_UINT32 fonts;
  FS_UINT32 bookmarks;
  FS_UINT32 x_object_forms;
  FS_UINT32 structure_infos;
  FS_UINT32 acroforms;
  FS_UINT32 link_annots;
  FS_UINT32 named_destnations;
  FS_UINT32 color_space;
  FS_UINT32 pattern_infos;
  FS_UINT32 piece_infos;
  FS_UINT32 comments_and_3d_contents;
  FS_UINT32 shading_pattern_infos;
  FS_UINT32 extend_graphics_states;
  FS_UINT32 cross_ref_tables;
  FS_UINT32 thumbs;
  FS_UINT32 embed_files;
  FS_UINT32 web_infos;
}FSAuditSpaceSize;

typedef struct _FSImageCompressionCallback {
  void* user_data;
  void (*Release)(void* user_data);
  FSStreamCallback* (*GetTemporaryFileStream)(void* user_data, const FS_BITMAP_HANDLE bitmap);
  
}FSImageCompressionCallback;

FSErrorCode FSDK_Optimizer_Optimize(const FS_PDFDOC_HANDLE doc,const FS_OPTIMIZERSETTINGS_HANDLE settings, FSPauseCallback* pause, FS_PROGRESSIVE_HANDLE* return_value);
FSErrorCode FSDK_Optimizer_StartSubsetEmbedFont(const FS_PDFDOC_HANDLE doc, FSPauseCallback* pause, FS_PROGRESSIVE_HANDLE* return_value);
FSErrorCode FSDK_Optimizer_OptimizeScannedPDF(const FS_PDFDOC_HANDLE doc, const FS_OPTIMIZESCANNEDPDFSETTINGS_HANDLE settings, FSImageCompressionCallback* image_compress_callback, FSPauseCallback* pause, FS_PROGRESSIVE_HANDLE* return_value);
FSErrorCode FSDK_Optimizer_ComputeAuditSpace(const FS_PDFDOC_HANDLE doc, FSAuditSpaceSize* return_value);
FSErrorCode FSDK_ImageSettings_Create(FS_IMAGESETTINGS_HANDLE* imagesettings_return_value);
FSErrorCode FSDK_ImageSettings_Release(FS_IMAGESETTINGS_HANDLE imagesettings_handle);
FSErrorCode FSDK_ImageSettings_IsEmpty(FS_IMAGESETTINGS_HANDLE imagesettings_handle, FS_BOOL* return_value);
FSErrorCode FSDK_ImageSettings_SetStretchMode(FS_IMAGESETTINGS_HANDLE imagesettings_handle, FSStretchMode mode);
FSErrorCode FSDK_ImageSettings_SetImageDPI(FS_IMAGESETTINGS_HANDLE imagesettings_handle, FS_INT32 dpi);
FSErrorCode FSDK_ImageSettings_SetImageDPILimit(FS_IMAGESETTINGS_HANDLE imagesettings_handle, int dpi_limit);
FSErrorCode FSDK_ImageSettings_SetCompressionMode(FS_IMAGESETTINGS_HANDLE imagesettings_handle, FSImageCompressMode mode);
FSErrorCode FSDK_ImageSettings_SetQuality(FS_IMAGESETTINGS_HANDLE imagesettings_handle, FSImageCompressQuality quality);
FSErrorCode FSDK_ImageSettings_SetBackgroundDownScale(FS_IMAGESETTINGS_HANDLE imagesettings_handle, FS_INT32 down_scale);
FSErrorCode FSDK_ImageSettings_SetForegroundDownScale(FS_IMAGESETTINGS_HANDLE imagesettings_handle, FS_INT32 down_scale);
FSErrorCode FSDK_ImageSettings_SetTextSensitivity(FS_IMAGESETTINGS_HANDLE imagesettings_handle, FS_INT32 text_sensitivity);
FSErrorCode FSDK_ImageSettings_SetTileSize(FS_IMAGESETTINGS_HANDLE imagesettings_handle, int size);
FSErrorCode FSDK_MonoImageSettings_Create(FS_MONOIMAGESETTINGS_HANDLE* monoimagesettings_return_value);
FSErrorCode FSDK_MonoImageSettings_Release(FS_MONOIMAGESETTINGS_HANDLE monoimagesettings_handle);
FSErrorCode FSDK_MonoImageSettings_IsEmpty(FS_MONOIMAGESETTINGS_HANDLE monoimagesettings_handle, FS_BOOL* return_value);
FSErrorCode FSDK_MonoImageSettings_SetImageDPI(FS_MONOIMAGESETTINGS_HANDLE monoimagesettings_handle, FS_INT32 dpi);
FSErrorCode FSDK_MonoImageSettings_SetImageDPILimit(FS_MONOIMAGESETTINGS_HANDLE monoimagesettings_handle, int dpi_limit);
FSErrorCode FSDK_MonoImageSettings_SetCompressionMode(FS_MONOIMAGESETTINGS_HANDLE monoimagesettings_handle, FSMonoImageCompressMode mode);
FSErrorCode FSDK_MonoImageSettings_SetStretchMode(FS_MONOIMAGESETTINGS_HANDLE monoimagesettings_handle, FSStretchMode mode);
FSErrorCode FSDK_MonoImageSettings_SetQuality(FS_MONOIMAGESETTINGS_HANDLE monoimagesettings_handle, FSMonoImageCompressQuality quality);
FSErrorCode FSDK_UnembeddedFontSettings_Create(FS_UNEMBEDDEDFONTSETTINGS_HANDLE* unembeddedfontsettings_return_value);
FSErrorCode FSDK_UnembeddedFontSettings_Release(FS_UNEMBEDDEDFONTSETTINGS_HANDLE unembeddedfontsettings_handle);
FSErrorCode FSDK_UnembeddedFontSettings_IsEmpty(FS_UNEMBEDDEDFONTSETTINGS_HANDLE unembeddedfontsettings_handle, FS_BOOL* return_value);
FSErrorCode FSDK_UnembeddedFontSettings_SetSubsetAllEmFonts(FS_UNEMBEDDEDFONTSETTINGS_HANDLE unembeddedfontsettings_handle, FS_BOOL is_subset_all_emb_fonts);
FSErrorCode FSDK_UnembeddedFontSettings_SetUnembeddedFontNameArray(FS_UNEMBEDDEDFONTSETTINGS_HANDLE unembeddedfontsettings_handle, const FS_WSTR* wstringarray, FS_UINT32 array_length_font_name_array);
FSErrorCode FSDK_OptimizerSettings_Create(FS_OPTIMIZERSETTINGS_HANDLE* optimizersettings_return_value);
FSErrorCode FSDK_OptimizerSettings_Release(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle);
FSErrorCode FSDK_OptimizerSettings_IsEmpty(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle, FS_BOOL* return_value);
FSErrorCode FSDK_OptimizerSettings_SetOptimizerOptions(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle, FS_UINT32 optimize_options);
FSErrorCode FSDK_OptimizerSettings_SetColorGrayImageSettings(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle, const FS_IMAGESETTINGS_HANDLE settings);
FSErrorCode FSDK_OptimizerSettings_SetColorImageSettings(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle, const FS_IMAGESETTINGS_HANDLE settings);
FSErrorCode FSDK_OptimizerSettings_SetGrayscaleImageSettings(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle, const FS_IMAGESETTINGS_HANDLE settings);
FSErrorCode FSDK_OptimizerSettings_SetMonoImageSettings(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle, const FS_MONOIMAGESETTINGS_HANDLE settings);
FSErrorCode FSDK_OptimizerSettings_SetUnembeddedFontSettings(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle, const FS_UNEMBEDDEDFONTSETTINGS_HANDLE settings);
FSErrorCode FSDK_OptimizerSettings_SetCleanUpOptions(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle,  FS_UINT32 clean_up_options);
FSErrorCode FSDK_OptimizerSettings_SetDiscardObjectsOptions(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle,  FS_UINT32 discard_objects_options);
FSErrorCode FSDK_OptimizerSettings_SetDiscardUserDataOptions(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle,  FS_UINT32 discard_userdata_options);
FSErrorCode FSDK_OptimizerSettings_SetTransparencyMode(FS_OPTIMIZERSETTINGS_HANDLE optimizersettings_handle, FSTransparencyMode transparency_mode);
FSErrorCode FSDK_OptimizeScannedPDFSettings_Create(FS_OPTIMIZESCANNEDPDFSETTINGS_HANDLE* optimizescannedpdfsettings_return_value);
FSErrorCode FSDK_OptimizeScannedPDFSettings_Release(FS_OPTIMIZESCANNEDPDFSETTINGS_HANDLE optimizescannedpdfsettings_handle);
FSErrorCode FSDK_OptimizeScannedPDFSettings_IsEmpty(FS_OPTIMIZESCANNEDPDFSETTINGS_HANDLE optimizescannedpdfsettings_handle, FS_BOOL* return_value);
FSErrorCode FSDK_OptimizeScannedPDFSettings_SetOptimizedPages(FS_OPTIMIZESCANNEDPDFSETTINGS_HANDLE optimizescannedpdfsettings_handle, const FS_RANGE_HANDLE pages);
FSErrorCode FSDK_OptimizeScannedPDFSettings_SetColorGrayImageCompressionMode(FS_OPTIMIZESCANNEDPDFSETTINGS_HANDLE optimizescannedpdfsettings_handle, FSScannedImageCompressMode mode);
FSErrorCode FSDK_OptimizeScannedPDFSettings_SetColorGrayImageCompressionQuality(FS_OPTIMIZESCANNEDPDFSETTINGS_HANDLE optimizescannedpdfsettings_handle,  FS_UINT32 quality);
FSErrorCode FSDK_OptimizeScannedPDFSettings_SetMonoImageCompressionMode(FS_OPTIMIZESCANNEDPDFSETTINGS_HANDLE optimizescannedpdfsettings_handle, FSScannedMonoImageCompressMode mode);
#ifdef __cplusplus
}
#endif
#endif
