📄 rm_st2dbarc.pas
字号:
procedure CalculateSize (var XSize : Integer;
var YSize : Integer);
function CodewordToBitmask (RowNumber : Integer;
Codeword : Integer) : DWord;
procedure ConvertBytesToBase900 (const S : array of byte;
var A : array of integer);
procedure ConvertToBase900 (const S : string;
var A : array of integer;
var LenA : integer);
procedure DrawBarcode; override;
procedure DrawCodeword (RowNumber : Integer;
ColNumber : Integer;
WorkBarHeight : Integer;
Pattern : string);
procedure DrawCodewordBitmask (RowNumber : Integer;
ColNumber : Integer;
WorkBarHeight : Integer;
Bitmask : DWord);
procedure DrawLeftRowIndicator (RowNumber : Integer;
WorkBarHeight : Integer;
NumRows : Integer;
NumCols : Integer);
procedure DrawRightRowIndicator (RowNumber : Integer;
ColNumber : Integer;
WorkBarHeight : Integer;
NumRows : Integer;
NumCols : Integer);
procedure DrawStartPattern (RowNumber : Integer;
WorkBarHeight : Integer);
procedure DrawStopPattern (RowNumber : Integer;
ColNumber : Integer;
WorkBarHeight : Integer);
procedure EncodeBinary (var Position : Integer; CodeLen : Integer);
procedure EncodeNumeric (var Position : Integer; CodeLen : Integer);
procedure EncodeText (var Position : Integer; CodeLen : Integer);
procedure GenerateCodewords; override;
procedure GetNextCharacter (var NewChar : Integer;
var Codeword : Boolean;
var Position : Integer;
CodeLen : Integer);
function GetPDF417ECCLevel : TStPDF417ECCLevels;
function GetRealErrorLevel : Integer;
function GoodForNumericCompaction (Position : Integer;
CodeLen : Integer;
var Count : Integer) : Boolean;
function GoodForTextCompaction (Position : Integer;
CodeLen : Integer;
var Count : Integer) : Boolean;
function IsNumericString (const S : string) : boolean;
procedure SetBarHeight (const v : Integer); override;
procedure SetBarHeightToWidth (const v : Integer); override;
procedure SetBarWidth (const v : Integer); override;
procedure SetNumColumns (const v : Integer);
procedure SetNumRows (const v : Integer);
procedure SetPDF417ECCLevel (const v : TStPDF417ECCLevels);
procedure SetRelativeBarHeight (const v : Boolean); override;
procedure SetTruncated (const v : Boolean);
procedure TextToCodewords;
public
constructor Create (AOwner : TComponent); override;
procedure RenderToResolution (var OutBitmap : TBitmap;
ResX : Integer;
ResY : Integer;
var SizeX : Integer;
var SizeY : Integer); override;
published
property ECCLevel : TStPDF417ECCLevels
read GetPDF417ECCLevel write SetPDF417ECCLevel default ecAuto;
property NumColumns : Integer read FNumColumns write SetNumColumns
default 0;
property NumRows : Integer read FNumRows write SetNumRows
default 0;
property Truncated : Boolean read FTruncated write SetTruncated
default False;
property Alignment;
property BackgroundColor;
property BarCodeHeight;
property BarCodeWidth;
property BarHeight;
property BarHeightToWidth;
property BarWidth;
property Bitmap;
property CaptionLayout;
property Code;
property ExtendedSyntax;
property Height default 81;
property RelativeBarHeight;
property QuietZone;
property Width default 273;
property Caption;
property Color;
property Font;
end;
{ TStMaxiCodeBarcode }
TStMaxiCodeBarcode = class (TStCustom2DBarcode)
private
FMode : TStMaxiCodeMode;
FCodewords : TStMaxiCodeECCData;
FNumCodewords : Integer;
FHighlight : Boolean;
FShowCodewords : Boolean;
FShowAll : Boolean;
FMessage : TStMaxiCodeECCData;
FCarrierCountryCode : Integer;
FCarrierPostalCode : string;
FCarrierServiceClass : Integer;
FAutoScale : Boolean;
FHorPixelsPerMM : Extended;
FVerPixelsPerMM : Extended;
FMaxiHexWidth : Extended;
FMaxiHexHeight : Extended;
FMaxiHexVOffset : Extended;
FMaxiHexHOffset : Extended;
{ Log and AnitLog data for Galois field arithmetic }
FLog : array [0..StMaxiCodeGaloisField] of Integer;
FAntiLog : array [0..StMaxiCodeGaloisField] of Integer;
protected
procedure AddCodeword (Value : Integer);
function CalculateBarCodeWidth (PaintableWidth : Integer) : Integer;
override;
function CalculateBarCodeHeight (PaintableHeight : Integer) : Integer;
override;
procedure DrawBarcode; override;
procedure DrawFinder;
procedure DrawHex (XPos, YPos : Integer);
procedure GenerateCodewords; override;
procedure GenerateECC;
procedure GetNextCharacter (var NewChar : Integer;
var Codeword : Boolean;
var Position : Integer;
CodeLen : Integer);
procedure GetSizes;
procedure GetSizesEx (ResX : Integer; ResY : Integer);
procedure PlotCell (Row : Integer; Col : Integer);
procedure SetAutoScale (const v : Boolean);
procedure SetBarHeight (const v : Integer); override;
procedure SetBarWidth (const v : Integer); override;
procedure SetCarrierCountryCode (const v : Integer);
procedure SetCarrierPostalCode (const v : string);
procedure SetCarrierServiceClass (const v : Integer);
procedure SetMode (const v : TStMaxiCodeMode);
procedure SetHorPixelsPerMM (const v : Extended);
procedure SetVerPixelsPerMM (const v : Extended);
procedure TextToCodewords;
public
constructor Create (AOwner : TComponent); override;
procedure RenderToResolution (var OutBitmap : TBitmap;
ResX : Integer;
ResY : Integer;
var SizeX : Integer;
var SizeY : Integer); override;
published
property AutoScale : Boolean
read FAutoScale write SetAutoScale default True;
property CarrierCountryCode : Integer
read FCarrierCountryCode write SetCarrierCountryCode default 0;
property CarrierPostalCode : string
read FCarrierPostalCode write SetCarrierPostalCode;
property CarrierServiceClass : Integer
read FCarrierServiceClass write SetCarrierServiceClass
default 0;
property HorPixelsPerMM : Extended
read FHorPixelsPerMM write SetHorPixelsPerMM;
property Mode : TStMaxiCodeMode
read FMode write SetMode default cmMode4;
property VerPixelsPerMM : Extended
read FVerPixelsPerMM write SetVerPixelsPerMM;
property Alignment;
property BackgroundColor;
property BarCodeHeight;
property BarCodeWidth;
property BarHeight default 0;
property BarWidth default 0;
property Bitmap;
property CaptionLayout;
property Code;
property ExtendedSyntax;
property Height default 129;
property QuietZone;
property Width default 121;
property Caption;
property Color;
property Font;
end;
implementation
{ PDF417 types and constants }
type
TStPDF417CodewordArray = array [0..2] of array [0..928] of Longint;
const
StPDF417CellWidth = 17;
StPDF417Codewords : TstPDF417CodewordArray =
(($1d5c0, $1eaf0, $1f57c, $1d4e0, $1ea78, $1f53e, $1a8c0, $1d470, $1a860,
$15040, $1a830, $15020, $1adc0, $1d6f0, $1eb7c, $1ace0, $1d678, $1eb3e,
$158c0, $1ac70, $15860, $15dc0, $1aef0, $1d77c, $15ce0, $1ae78, $1d73e,
$15c70, $1ae3c, $15ef0, $1af7c, $15e78, $1af3e, $15f7c, $1f5fa, $1d2e0,
$1e978, $1f4be, $1a4c0, $1d270, $1e93c, $1a460, $1d238, $14840, $1a430,
$1d21c, $14820, $1a418, $14810, $1a6e0, $1d378, $1e9be, $14cc0, $1a670,
$1d33c, $14c60, $1a638, $1d31e, $14c30, $1a61c, $14ee0, $1a778, $1d3be,
$14e70, $1a73c, $14e38, $1a71e, $14f78, $1a7be, $14f3c, $14f1e, $1a2c0,
$1d170, $1e8bc, $1a260, $1d138, $1e89e, $14440, $1a230, $1d11c, $14420,
$1a218, $14410, $14408, $146c0, $1a370, $1d1bc, $14660, $1a338, $1d19e,
$14630, $1a31c, $14618, $1460c, $14770, $1a3bc, $14738, $1a39e, $1471c,
$147bc, $1a160, $1d0b8, $1e85e, $14240, $1a130, $1d09c, $14220, $1a118,
$1d08e, $14210, $1a10c, $14208, $1a106, $14360, $1a1b8, $1d0de, $14330,
$1a19c, $14318, $1a18e, $1430c, $14306, $1a1de, $1438e, $14140, $1a0b0,
$1d05c, $14120, $1a098, $1d04e, $14110, $1a08c, $14108, $1a086, $14104,
$141b0, $14198, $1418c, $140a0, $1d02e, $1a04c, $1a046, $14082, $1cae0,
$1e578, $1f2be, $194c0, $1ca70, $1e53c, $19460, $1ca38, $1e51e, $12840,
$19430, $12820, $196e0, $1cb78, $1e5be, $12cc0, $19670, $1cb3c, $12c60,
$19638, $12c30, $12c18, $12ee0, $19778, $1cbbe, $12e70, $1973c, $12e38,
$12e1c, $12f78, $197be, $12f3c, $12fbe, $1dac0, $1ed70, $1f6bc, $1da60,
$1ed38, $1f69e, $1b440, $1da30, $1ed1c, $1b420, $1da18, $1ed0e, $1b410,
$1da0c, $192c0, $1c970, $1e4bc, $1b6c0, $19260, $1c938, $1e49e, $1b660,
$1db38, $1ed9e, $16c40, $12420, $19218, $1c90e, $16c20, $1b618, $16c10,
$126c0, $19370, $1c9bc, $16ec0, $12660, $19338, $1c99e, $16e60, $1b738,
$1db9e, $16e30, $12618, $16e18, $12770, $193bc, $16f70, $12738, $1939e,
$16f38, $1b79e, $16f1c, $127bc, $16fbc, $1279e, $16f9e, $1d960, $1ecb8,
$1f65e, $1b240, $1d930, $1ec9c, $1b220, $1d918, $1ec8e, $1b210, $1d90c,
$1b208, $1b204, $19160, $1c8b8, $1e45e, $1b360, $19130, $1c89c, $16640,
$12220, $1d99c, $1c88e, $16620, $12210, $1910c, $16610, $1b30c, $19106,
$12204, $12360, $191b8, $1c8de, $16760, $12330, $1919c, $16730, $1b39c,
$1918e, $16718, $1230c, $12306, $123b8, $191de, $167b8, $1239c, $1679c,
$1238e, $1678e, $167de, $1b140, $1d8b0, $1ec5c, $1b120, $1d898, $1ec4e,
$1b110, $1d88c, $1b108, $1d886, $1b104, $1b102, $12140, $190b0, $1c85c,
$16340, $12120, $19098, $1c84e, $16320, $1b198, $1d8ce, $16310, $12108,
$19086, $16308, $1b186, $16304, $121b0, $190dc, $163b0, $12198, $190ce,
$16398, $1b1ce, $1638c, $12186, $16386, $163dc, $163ce, $1b0a0, $1d858,
$1ec2e, $1b090, $1d84c, $1b088, $1d846, $1b084, $1b082, $120a0, $19058,
$1c82e, $161a0, $12090, $1904c, $16190, $1b0cc, $19046, $16188, $12084,
$16184, $12082, $120d8, $161d8, $161cc, $161c6, $1d82c, $1d826, $1b042,
$1902c, $12048, $160c8, $160c4, $160c2, $18ac0, $1c570, $1e2bc, $18a60,
$1c538, $11440, $18a30, $1c51c, $11420, $18a18, $11410, $11408, $116c0,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -