📄 vpdfjpeglib.pas
字号:
{*******************************************************}
{ }
{ This unit is part of the VISPDF VCL library. }
{ Written by R.Husske - ALL RIGHTS RESERVED. }
{ }
{ Copyright (C) 2000-2009, www.vispdf.com }
{ }
{ e-mail: support@vispdf.com }
{ http://www.vispdf.com }
{ }
{*******************************************************}
unit VPDFJpegLib;
interface
uses
Windows, SysUtils;
{$I VisPDFLib.inc }
const
JPEG_LIB_VERSION = 62;
JMSG_STR_PARM_MAX = 80;
JMSG_LENGTH_MAX = 200;
NUM_QUANT_TBLS = 4;
NUM_HUFF_TBLS = 4;
NUM_ARITH_TBLS = 16;
MAX_COMPS_IN_SCAN = 4;
C_MAX_BLOCKS_IN_MCU = 10;
D_MAX_BLOCKS_IN_MCU = 10;
DCTSIZE2 = 64;
JCS_UNKNOWN = 0;
JCS_GRAYSCALE = 1;
JCS_RGB = 2;
JCS_YCbCr = 3;
JCS_CMYK = 4;
JCS_YCCK = 5;
type
{$IFDEF VOLDVERSION}
PPChar = ^PChar;
PPointer = ^Pointer;
{$ENDIF}
PRJpegErrorMgr = ^RJpegErrorMgr;
PRJpegMemoryMgr = Pointer;
PRJpegProgressMgr = Pointer;
PRJpegDestinationMgr = ^RJpegDestinationMgr;
PRJpegSourceMgr = ^RJpegSourceMgr;
PRJpegComponentInfo = ^RJpegComponentInfo;
PRJpegQuantTbl = Pointer;
PRJpegHuffTbl = Pointer;
PRJpegScanInfo = Pointer;
PRJpegCompMaster = Pointer;
PRJpegCMainController = Pointer;
PRJpegCPrepController = Pointer;
PRJpegCCoefController = Pointer;
PRJpegMarkerWriter = Pointer;
PRJpegColorConverter = Pointer;
PRJpegDownsampler = Pointer;
PRJpegForwardDct = Pointer;
PRJpegEntropyEncoder = Pointer;
PRJpegSavedMarker = Pointer;
PRJpegDecompMaster = Pointer;
PRJpegDMainController = Pointer;
PRJpegDCoefController = Pointer;
PRJpegDPosController = Pointer;
PRJpegInputController = Pointer;
PRJpegMarkerReader = Pointer;
PRJpegEntropyDecoder = Pointer;
PRJpegInverseDct = Pointer;
PRJpegUpsampler = Pointer;
PRJpegColorDeconverter = Pointer;
PRJpegColorQuantizer = Pointer;
PRJpegCommonStruct = ^RJpegCommonStruct;
PRJpegCompressStruct = ^RJpegCompressStruct;
PRJpegDecompressStruct = ^RJpegDecompressStruct;
TJpegErrorExit = procedure(cinfo: PRJpegCommonStruct); cdecl;
TJpegEmitMessage = procedure(cinfo: PRJpegCommonStruct; MsgLevel: Integer); cdecl;
TJpegOutputMessage = procedure(cinfo: PRJpegCommonStruct); cdecl;
TJpegFormatMessage = procedure(cinfo: PRJpegCommonStruct; Buffer: Pointer); cdecl;
TJpegResetErrorMgr = procedure(cinfo: PRJpegCommonStruct); cdecl;
RJpegErrorMgrMsgParm = record
case Boolean of
False: (MsgParmI: array[0..7] of Integer);
True: (MsgParmS: array[0..JMSG_STR_PARM_MAX - 1] of AnsiChar);
end;
RJpegErrorMgr = record
ErrorExit: TJpegErrorExit;
EmitMessage: TJpegEmitMessage;
OutputMessage: TJpegOutputMessage;
FormatMessage: TJpegFormatMessage;
ResetErrorMgr: TJpegResetErrorMgr;
MsgCode: Integer;
MsgParm: RJpegErrorMgrMsgParm;
TraceLevel: Integer;
NumWarnings: Integer;
JpegMessageTable: PPChar;
LastJpegMessage: Integer;
AddonMessageTable: PPChar;
FirstAddonMessage: Integer;
LastAddonMessage: Integer;
end;
TJpegInitDestination = procedure(cinfo: PRJpegCompressStruct); cdecl;
TJpegEmptyOutputBuffer = function(cinfo: PRJpegCompressStruct): Boolean; cdecl;
TJpegTermDestination = procedure(cinfo: PRJpegCompressStruct); cdecl;
RJpegDestinationMgr = record
NextOutputByte: Pointer;
FreeInBuffer: Cardinal;
InitDestination: TJpegInitDestination;
EmptyOutputBuffer: TJpegEmptyOutputBuffer;
TermDestination: TJpegTermDestination;
end;
TJpegInitSource = procedure(cinfo: PRJpegDecompressStruct); cdecl;
TJpegFillInputBuffer = function(cinfo: PRJpegDecompressStruct): Boolean; cdecl;
TJpegSkipInputData = procedure(cinfo: PRJpegDecompressStruct; NumBytes: Integer); cdecl;
TJpegResyncToRestart = function(cinfo: PRJpegDecompressStruct; Desired: Integer): Boolean; cdecl;
TJpegTermSource = procedure(cinfo: PRJpegDecompressStruct); cdecl;
RJpegSourceMgr = record
NextInputByte: Pointer;
BytesInBuffer: Cardinal;
InitSource: TJpegInitSource;
FillInputBuffer: TJpegFillInputBuffer;
SkipInputData: TJpegSkipInputData;
ResyncToRestart: TJpegResyncToRestart;
TermSource: TJpegTermSource;
end;
RJpegComponentInfo = record
ComponentId: Integer;
ComponentIndex: Integer;
HSampFactor: Integer;
VSampFactor: Integer;
QuantTblNo: Integer;
DcTblNo: Integer;
AsTblNo: Integer;
WidthInBlocks: Cardinal;
HeightInBlocks: Cardinal;
DctScaledSize: Integer;
DownsampledWidth: Cardinal;
DownsampledHeight: Cardinal;
ComponentNeeded: Boolean;
McuWidth: Integer;
McuHeight: Integer;
McuBlocks: Integer;
McuSampleWidth: Integer;
LastColWidth: Integer;
LastRowHeight: Integer;
QuantTable: PRJpegQuantTbl;
DctTable: Pointer;
end;
RJpegCommonStruct = record
Err: PRJpegErrorMgr;
Mem: PRJpegMemoryMgr;
Progress: PRJpegProgressMgr;
ClientData: Pointer;
IsDecompressor: Boolean;
GlobalState: Integer;
end;
RJpegCompressStruct = record
Err: PRJpegErrorMgr;
Mem: PRJpegMemoryMgr;
Progress: PRJpegProgressMgr;
ClientData: Pointer;
IsDecompressor: Boolean;
GlobalState: Integer;
Dest: PRJpegDestinationMgr;
ImageWidth: Cardinal;
ImageHeight: Cardinal;
InputComponents: Integer;
InColorSpace: Integer;
InputGamme: Double;
DataPrecision: Integer;
NumComponents: Integer;
JpegColorSpace: Integer;
CompInfo: PRJpegComponentInfo;
QuantTblPtrs: array[0..NUM_QUANT_TBLS - 1] of PRJpegQuantTbl;
DcHuffTblPtrs: array[0..NUM_HUFF_TBLS - 1] of PRJpegHuffTbl;
AcHuffTblPtrs: array[0..NUM_HUFF_TBLS - 1] of PRJpegHuffTbl;
ArithDcL: array[0..NUM_ARITH_TBLS - 1] of Byte;
ArithDcU: array[0..NUM_ARITH_TBLS - 1] of Byte;
ArithAcK: array[0..NUM_ARITH_TBLS - 1] of Byte;
NumScans: Integer;
ScanInfo: PRJpegScanInfo;
RawDataIn: Boolean;
ArithCode: Boolean;
OptimizeCoding: Boolean;
CCIR601Sampling: Boolean;
SmoothingFactor: Integer;
DctMethod: Integer;
RestartInterval: Cardinal;
RestartInRows: Integer;
WriteJfifHeader: Boolean;
JfifMajorVersion: Byte;
JFifMinorVersion: Byte;
DensityUnit: Byte;
XDensity: Word;
YDensity: WOrd;
WriteAdobeMarker: Boolean;
NextScanline: Cardinal;
ProgressiveMode: Boolean;
MaxHSampFactor: Integer;
MaxVSampFactor: Integer;
TotalIMCURows: Cardinal;
CompsInScan: Integer;
CurCompInfo: array[0..MAX_COMPS_IN_SCAN - 1] of PRJpegComponentInfo;
MCUsPerRow: Cardinal;
MCUsRowsInScan: Cardinal;
BlocksInMcu: Integer;
MCUMembership: array[0..C_MAX_BLOCKS_IN_MCU - 1] of Integer;
Ss, Se, Ah, Al: Integer;
Master: PRJpegCompMaster;
Main: PRJpegCMainController;
Prep: PRJpegCPrepController;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -