📄 freeimage.pas
字号:
);
// Upsampling / downsampling filters. Constants used in FreeImage_Rescale.
FREE_IMAGE_FILTER = (
FILTER_BOX = 0, // Box, pulse, Fourier window, 1st order (constant) b-spline
FILTER_BICUBIC = 1, // Mitchell & Netravali's two-param cubic filter
FILTER_BILINEAR = 2, // Bilinear filter
FILTER_BSPLINE = 3, // 4th order (cubic) b-spline
FILTER_CATMULLROM = 4, // Catmull-Rom spline, Overhauser spline
FILTER_LANCZOS3 = 5 // Lanczos3 filter
);
// Color channels. Constants used in color manipulation routines.
FREE_IMAGE_COLOR_CHANNEL = (
FICC_RGB = 0, // Use red, green and blue channels
FICC_RED = 1, // Use red channel
FICC_GREEN = 2, // Use green channel
FICC_BLUE = 3, // Use blue channel
FICC_ALPHA = 4, // Use alpha channel
FICC_BLACK = 5, // Use black channel
FICC_REAL = 6, // Complex images: use real part
FICC_IMAG = 7, // Complex images: use imaginary part
FICC_MAG = 8, // Complex images: use magnitude
FICC_PHASE = 9 // Complex images: use phase
);
// --------------------------------------------------------------------------
// MetaData support ---------------------------------------------------------
// --------------------------------------------------------------------------
type
// Tag data type information (based on TIFF specifications)
FREE_IMAGE_MDTYPE = (
FIDT_NOTYPE = 0, // placeholder
FIDT_BYTE = 1, // 8-bit unsigned integer
FIDT_ASCII = 2, // 8-bit bytes w/ last byte null
FIDT_SHORT = 3, // 16-bit unsigned integer
FIDT_LONG = 4, // 32-bit unsigned integer
FIDT_RATIONAL = 5, // 64-bit unsigned fraction
FIDT_SBYTE = 6, // 8-bit signed integer
FIDT_UNDEFINED = 7, // 8-bit untyped data
FIDT_SSHORT = 8, // 16-bit signed integer
FIDT_SLONG = 9, // 32-bit signed integer
FIDT_SRATIONAL = 10, // 64-bit signed fraction
FIDT_FLOAT = 11, // 32-bit IEEE floating point
FIDT_DOUBLE = 12, // 64-bit IEEE floating point
FIDT_IFD = 13 // 32-bit unsigned integer (offset)
);
// Metadata models supported by FreeImage
FREE_IMAGE_MDMODEL = (
FIMD_NODATA = -1,
FIMD_COMMENTS = 0, // single comment or keywords
FIMD_EXIF_MAIN = 1, // Exif-TIFF metadata
FIMD_EXIF_EXIF = 2, // Exif-specific metadata
FIMD_EXIF_GPS = 3, // Exif GPS metadata
FIMD_EXIF_MAKERNOTE = 4, // Exif maker note metadata
FIMD_EXIF_INTEROP = 5, // Exif interoperability metadata
FIMD_IPTC = 6, // IPTC/NAA metadata
FIMD_XMP = 7, // Abobe XMP metadata
FIMD_GEOTIFF = 8, // GeoTIFF metadata (to be implemented)
FIMD_CUSTOM = 9 // Used to attach other metadata types to a dib
);
// Handle to a metadata model
FIMETADATA = record
data: Pointer;
end;
PFIMETADATA = ^FIMETADATA;
// Handle to a FreeImage tag
FITAG = record
data: Pointer;
end;
PFITAG = ^FITAG;
// --------------------------------------------------------------------------
// File IO routines ---------------------------------------------------------
// --------------------------------------------------------------------------
type
FI_Handle = Pointer;
PCardinal = ^Cardinal;
PInt = ^Integer;
FI_ReadProc = function(buffer : pointer; size : Cardinal; count : Cardinal; handle : fi_handle) : PCardinal; stdcall;
FI_WriteProc = function(buffer : pointer; size, count : Cardinal; handle : fi_handle) : PCardinal; stdcall;
FI_SeekProc = function(handle : fi_handle; offset : longint; origin : integer) : pint; stdcall;
FI_TellProc = function(handle : fi_handle) : PCardinal; stdcall;
FreeImageIO = packed record
read_proc : FI_ReadProc; // pointer to the function used to read data
write_proc: FI_WriteProc; // pointer to the function used to write data
seek_proc : FI_SeekProc; // pointer to the function used to seek
tell_proc : FI_TellProc; // pointer to the function used to aquire the current position
end;
PFreeImageIO = ^FreeImageIO;
// Handle to a memory I/O stream
FIMEMORY = record
data: Pointer;
end;
PFIMEMORY = ^FIMEMORY;
const
// constants used in FreeImage_Seek for Origin parameter
SEEK_SET = 0;
SEEK_CUR = 1;
SEEK_END = 2;
// --------------------------------------------------------------------------
// Plugin routines ----------------------------------------------------------
// --------------------------------------------------------------------------
type
PPluginStruct = ^PluginStruct;
FI_InitProc = procedure(Plugin: PPluginStruct; Format_ID: Integer); stdcall;
FI_FormatProc = function: PChar; stdcall;
FI_DescriptionProc = function: PChar; stdcall;
FI_ExtensionListProc = function: PChar; stdcall;
FI_RegExprProc = function: PChar; stdcall;
FI_OpenProc = function(IO: PFreeImageIO; Handle: FI_Handle; Read: Boolean): Pointer; stdcall;
FI_CloseProc = procedure(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer); stdcall;
FI_PageCountProc = function(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer): Integer; stdcall;
FI_PageCapabilityProc = function(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer): integer; stdcall;
FI_LoadProc = function(IO: PFreeImageIO; Handle: FI_Handle; Page, Flags: Integer; data: pointer): PFIBITMAP; stdcall;
FI_SaveProc = function(IO: PFreeImageIO; Dib: PFIBITMAP; Handle: FI_Handle; Page, Flags: Integer; Data: Pointer): Boolean; stdcall;
FI_ValidateProc = function(IO: PFreeImageIO; Handle: FI_Handle): Boolean; stdcall;
FI_MimeProc = function: PChar; stdcall;
FI_SupportsExportBPPProc = function(Bpp: integer): boolean; stdcall;
FI_SupportsExportTypeProc = function(AType: FREE_IMAGE_TYPE): Boolean; stdcall;
FI_SupportsICCProfilesProc = function: Boolean; stdcall;
PluginStruct = record
format_proc: FI_FormatProc;
description_proc: FI_DescriptionProc;
extension_proc: FI_ExtensionListProc;
regexpr_proc: FI_RegExprProc;
open_proc: FI_OpenProc;
close_proc: FI_CloseProc;
pagecount_proc: FI_PageCountProc;
pagecapability_proc: FI_PageCapabilityProc;
load_proc: FI_LoadProc;
save_proc: FI_SaveProc;
validate_proc: FI_ValidateProc;
mime_proc: FI_MimeProc;
supports_export_bpp_proc: FI_SupportsExportBPPProc;
supports_export_type_proc: FI_SupportsExportTypeProc;
supports_icc_profiles_proc: FI_SupportsICCProfilesProc;
end;
// --------------------------------------------------------------------------
// Load/Save flag constants -------------------------------------------------
// --------------------------------------------------------------------------
const
BMP_DEFAULT = 0;
BMP_SAVE_RLE = 1;
CUT_DEFAULT = 0;
DDS_DEFAULT = 0;
GIF_DEFAULT = 0;
ICO_DEFAULT = 0;
ICO_MAKEALPHA = 0; // convert to 32bpp and create an alpha channel from the AND-mask when loading
IFF_DEFAULT = 0;
JPEG_DEFAULT = 0;
JPEG_FAST = 1;
JPEG_ACCURATE = 2;
JPEG_QUALITYSUPERB = $0080;
JPEG_QUALITYGOOD = $0100;
JPEG_QUALITYNORMAL = $0200;
JPEG_QUALITYAVERAGE = $0400;
JPEG_QUALITYBAD = $0800;
JPEG_CMYK = $1000; // load separated CMYK "as is" (use | to combine with other flags)
KOALA_DEFAULT = 0;
LBM_DEFAULT = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -