You've already forked lazarus-ccr
First commit. Tested on Windows only. It provides 5 controls under the "Laz Barcodes 2D" tab.
* QR code * MicroQR * Aztec * Aztec Rune * DataMatrix git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1758 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
BIN
components/lazbarcodes/images/tbarcodeaztec.png
Normal file
BIN
components/lazbarcodes/images/tbarcodeaztec.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 203 B |
BIN
components/lazbarcodes/images/tbarcodeaztecrune.png
Normal file
BIN
components/lazbarcodes/images/tbarcodeaztecrune.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 138 B |
BIN
components/lazbarcodes/images/tbarcodedatamatrix.png
Normal file
BIN
components/lazbarcodes/images/tbarcodedatamatrix.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 189 B |
BIN
components/lazbarcodes/images/tbarcodemicroqr.png
Normal file
BIN
components/lazbarcodes/images/tbarcodemicroqr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 B |
BIN
components/lazbarcodes/images/tbarcodeqr.png
Normal file
BIN
components/lazbarcodes/images/tbarcodeqr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 199 B |
50
components/lazbarcodes/packages/lazbarcodes.lpk
Normal file
50
components/lazbarcodes/packages/lazbarcodes.lpk
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<CONFIG>
|
||||||
|
<Package Version="4">
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Name Value="lazbarcodes"/>
|
||||||
|
<Author Value="José Mejuto"/>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="10"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<SearchPaths>
|
||||||
|
<OtherUnitFiles Value="..\src"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<UseMsgFile Value="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Description Value="Provides barcode 1D and 2D generation based in the 'C' zint library."/>
|
||||||
|
<Version Major="1"/>
|
||||||
|
<Files Count="1">
|
||||||
|
<Item1>
|
||||||
|
<Filename Value="..\src\ubarcodes.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="ubarcodes"/>
|
||||||
|
</Item1>
|
||||||
|
</Files>
|
||||||
|
<Type Value="RunAndDesignTime"/>
|
||||||
|
<RequiredPkgs Count="3">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="lazbarcodes_runtimeonly"/>
|
||||||
|
<MinVersion Major="1" Valid="True"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="LCLBase"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<PackageName Value="FCL"/>
|
||||||
|
</Item3>
|
||||||
|
</RequiredPkgs>
|
||||||
|
<UsageOptions>
|
||||||
|
<UnitPath Value="$(PkgOutDir)"/>
|
||||||
|
</UsageOptions>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
</PublishOptions>
|
||||||
|
</Package>
|
||||||
|
</CONFIG>
|
21
components/lazbarcodes/packages/lazbarcodes.pas
Normal file
21
components/lazbarcodes/packages/lazbarcodes.pas
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{ This file was automatically created by Lazarus. Do not edit!
|
||||||
|
This source is only used to compile and install the package.
|
||||||
|
}
|
||||||
|
|
||||||
|
unit lazbarcodes;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
ubarcodes, LazarusPackageIntf;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
begin
|
||||||
|
RegisterUnit('ubarcodes', @ubarcodes.Register);
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
RegisterPackage('lazbarcodes', @Register);
|
||||||
|
end.
|
77
components/lazbarcodes/packages/lazbarcodes_runtimeonly.lpk
Normal file
77
components/lazbarcodes/packages/lazbarcodes_runtimeonly.lpk
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<CONFIG>
|
||||||
|
<Package Version="4">
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Name Value="lazbarcodes_runtimeonly"/>
|
||||||
|
<Author Value="José Mejuto"/>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="10"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<SearchPaths>
|
||||||
|
<OtherUnitFiles Value="..\src"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<UseMsgFile Value="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Description Value="Provides barcode 1D and 2D generation based in the 'C' zint library."/>
|
||||||
|
<License Value="GNU General Public License version 3.0 (GPLv3)"/>
|
||||||
|
<Version Major="1"/>
|
||||||
|
<Files Count="9">
|
||||||
|
<Item1>
|
||||||
|
<Filename Value="..\src\zint.pp"/>
|
||||||
|
<UnitName Value="zint"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Filename Value="..\src\uaztec.pas"/>
|
||||||
|
<UnitName Value="uaztec"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Filename Value="..\src\ubasic.pas"/>
|
||||||
|
<UnitName Value="ubasic"/>
|
||||||
|
</Item3>
|
||||||
|
<Item4>
|
||||||
|
<Filename Value="..\src\udatamatrix.pas"/>
|
||||||
|
<UnitName Value="udatamatrix"/>
|
||||||
|
</Item4>
|
||||||
|
<Item5>
|
||||||
|
<Filename Value="..\src\uhelper.pas"/>
|
||||||
|
<UnitName Value="uhelper"/>
|
||||||
|
</Item5>
|
||||||
|
<Item6>
|
||||||
|
<Filename Value="..\src\uqr.pas"/>
|
||||||
|
<UnitName Value="uqr"/>
|
||||||
|
</Item6>
|
||||||
|
<Item7>
|
||||||
|
<Filename Value="..\src\ureedsolomon.pas"/>
|
||||||
|
<UnitName Value="ureedsolomon"/>
|
||||||
|
</Item7>
|
||||||
|
<Item8>
|
||||||
|
<Filename Value="..\src\urender.pas"/>
|
||||||
|
<UnitName Value="urender"/>
|
||||||
|
</Item8>
|
||||||
|
<Item9>
|
||||||
|
<Filename Value="..\src\usjis.pas"/>
|
||||||
|
<UnitName Value="usjis"/>
|
||||||
|
</Item9>
|
||||||
|
</Files>
|
||||||
|
<RequiredPkgs Count="2">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="LCLBase"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="FCL"/>
|
||||||
|
</Item2>
|
||||||
|
</RequiredPkgs>
|
||||||
|
<UsageOptions>
|
||||||
|
<UnitPath Value="$(PkgOutDir)"/>
|
||||||
|
</UsageOptions>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
</PublishOptions>
|
||||||
|
</Package>
|
||||||
|
</CONFIG>
|
14
components/lazbarcodes/packages/lazbarcodes_runtimeonly.pas
Normal file
14
components/lazbarcodes/packages/lazbarcodes_runtimeonly.pas
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{ This file was automatically created by Lazarus. Do not edit!
|
||||||
|
This source is only used to compile and install the package.
|
||||||
|
}
|
||||||
|
|
||||||
|
unit lazbarcodes_runtimeonly;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
zint, uaztec, ubasic, udatamatrix, uhelper, uqr, ureedsolomon, urender, usjis;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
22
components/lazbarcodes/src/lazbarcodes.pas
Normal file
22
components/lazbarcodes/src/lazbarcodes.pas
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{ This file was automatically created by Lazarus. Do not edit!
|
||||||
|
This source is only used to compile and install the package.
|
||||||
|
}
|
||||||
|
|
||||||
|
unit lazbarcodes;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
zint, uaztec, ubasic, udatamatrix, uhelper, uqr, ureedsolomon, urender,
|
||||||
|
usjis, ubarcodes, LazarusPackageIntf;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
begin
|
||||||
|
RegisterUnit('ubarcodes', @ubarcodes.Register);
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
RegisterPackage('lazbarcodes', @Register);
|
||||||
|
end.
|
10
components/lazbarcodes/src/tbarcodeaztec.lrs
Normal file
10
components/lazbarcodes/src/tbarcodeaztec.lrs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
LazarusResources.Add('tbarcodeaztec','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0#21#8#2#0#0#0'&u2'#193#0#0
|
||||||
|
+#0#146'IDATx'#156#165#145#11#10#128'0'#12'C{'#255'K+'#226#152#237'kR'#17#3
|
||||||
|
+#142#209#207#242'1'#142#127#136#235#139'u'#222#216#21'\P\g'#30#202'sv'#161'r'
|
||||||
|
+#8#182#168#0#1'u'#201#134'4'#146'_'#164#255#238#211'9'#167#216#238'y'#6'_A<'
|
||||||
|
+#210#237#148'b'#31#26'R'#212#254#231#228'dK'#235#135#194#225'd~'#162#161#248
|
||||||
|
+#179#199#226#31'>'#157#255#137#31'l.'#127'J'#19#165#17'4'#229#168#228#14'Z/'
|
||||||
|
+#250'e'#28'Z'#255#158#176'>'#235#254'3'#211#151'K'#219#252#11#193#223'5;]'
|
||||||
|
+#165#168#226#251#128#19#236#248#12#31'X'#10'[q'#0#0#0#0'IEND'#174'B`'#130
|
||||||
|
]);
|
8
components/lazbarcodes/src/tbarcodeaztecrune.lrs
Normal file
8
components/lazbarcodes/src/tbarcodeaztecrune.lrs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
LazarusResources.Add('tbarcodeaztecrune','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0#21#8#2#0#0#0'&u2'#193#0#0
|
||||||
|
+#0'QIDATx'#156#189#148'I'#14#0' '#8#3#249#255#167#245#214#152#176#148'Hu'#142
|
||||||
|
+#208'!p'#193#214#12#211#248#230'@='#214#16#200'|'#202#27#159#31#28#250'h'#212
|
||||||
|
+#187#156'1'#169'_$'#178#233'R'#223'''P'#28#249#180#251#204#15#249#226#215#16
|
||||||
|
+#191#143#218#239#224#15#20#253#159'k6'#235#244#3'('#147#160'.|'#0#0#0#0'IEND'
|
||||||
|
+#174'B`'#130
|
||||||
|
]);
|
10
components/lazbarcodes/src/tbarcodedatamatrix.lrs
Normal file
10
components/lazbarcodes/src/tbarcodedatamatrix.lrs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
LazarusResources.Add('tbarcodedatamatrix','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0#21#8#2#0#0#0'&u2'#193#0#0
|
||||||
|
+#0#132'IDATx'#156#165#146#11#10#128'0'#12'C{'#255'KO'#196#129'5'#191'!'#13'8'
|
||||||
|
+':'#182#152#246'i'#173#153#234'~*'#173#135#163#190'y'#234'ns'#219#183#128#156
|
||||||
|
+#174#254'Rw'#138#7#178#29#167#143#31#156'0'#142#13#176#131#197#201'u>gB/P'#8
|
||||||
|
+#191#228#23#16'j?S'#228#238','#127#246#232'd'#200#31#249'a'#21#156'I'#130#159
|
||||||
|
+#196#230'p'#166'|'#219'-'#255#26#1'o'#230#130#249#185#17#6#132#243#243#189'#'
|
||||||
|
+#203#244#253#224#30#143#169#243#127'i'#251''''#186#0#208#138#166'v0'#27'oM'#0
|
||||||
|
+#0#0#0'IEND'#174'B`'#130
|
||||||
|
]);
|
10
components/lazbarcodes/src/tbarcodemicroqr.lrs
Normal file
10
components/lazbarcodes/src/tbarcodemicroqr.lrs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
LazarusResources.Add('tbarcodemicroqr','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0#21#8#2#0#0#0'&u2'#193#0#0
|
||||||
|
+#0#137'IDATx'#156#181#145#139#10#128'0'#8'E'#253#255#159'^D'#209#244'>'#28
|
||||||
|
+#163#18#138#161'^'#31#199#24#239','#206#207#216#21#130'?:s'#160#20#142'Y'#26
|
||||||
|
+'z'#148'Z'#144#202#25'O'#185#236#153'i'#189#30'4b'#192#127#245#240#200'[l'
|
||||||
|
+#243#3#10'E'#223#220'O'#234#11#191#222#220'E'#238'(o'#200#171'.'#248#201#152
|
||||||
|
+';'#7'f'#230#152#235#198#3#174#251#243#170'0'#151#237#207#8#154#1#245#229'%'
|
||||||
|
+#209'A'#128'?'#210'3'#213'F,'#248'3'#30#30#164#211'K`'#2'u'#245#216#253#183
|
||||||
|
+#236#0#242#191#30#13'!j_/'#0#0#0#0'IEND'#174'B`'#130
|
||||||
|
]);
|
10
components/lazbarcodes/src/tbarcodeqr.lrs
Normal file
10
components/lazbarcodes/src/tbarcodeqr.lrs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
LazarusResources.Add('TBarcodeQR','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0#21#8#2#0#0#0'&u2'#193#0#0
|
||||||
|
+#0#142'IDATx'#156#165#147#1#10#128'0'#12#3#253#255#167'''"L'#151'\2'#193#130
|
||||||
|
+'"k'#218'&'#233'<'#198#191'8'#174#199#194#15'#'#236'N,-_h'#249#0#24#22'L'#196
|
||||||
|
+'<L'#176'M='#20#164'z'#231'/'#169#198#31#221#242'7'#251#199#139'Yq'#17'&>'
|
||||||
|
+#149'm'#137#151':'#223#167#185#249#172'_lK'#132'y;'#146#198'^'#133'H'#219#127
|
||||||
|
+'j'#202#243#157'm'#241#255#233'2'#200#234#164#194#137'l'#238#159#162#189'{'
|
||||||
|
+#215#191#141#252'c'#216']`Q'#157#191'k'#225#253#185#127#238'%'#187#251']*'
|
||||||
|
+#198#9'Nm'#27#16' W'#213#132#0#0#0#0'IEND'#174'B`'#130
|
||||||
|
]);
|
2802
components/lazbarcodes/src/uaztec.pas
Normal file
2802
components/lazbarcodes/src/uaztec.pas
Normal file
File diff suppressed because it is too large
Load Diff
439
components/lazbarcodes/src/ubarcodes.pas
Normal file
439
components/lazbarcodes/src/ubarcodes.pas
Normal file
@@ -0,0 +1,439 @@
|
|||||||
|
unit ubarcodes;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Controls, LResources, Graphics,
|
||||||
|
ubasic,uqr,zint,urender,uaztec,udatamatrix;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
TBarcodeQR_ECCLevel= (eBarcodeQR_ECCLevel_Auto=0,
|
||||||
|
eBarcodeQR_ECCLevel_L=1,eBarcodeQR_ECCLevel_M=2,
|
||||||
|
eBarcodeQR_ECCLevel_Q=3,eBarcodeQR_ECCLevel_H=4);
|
||||||
|
TBarcodeAztecRune_Value= 0..999;
|
||||||
|
|
||||||
|
{ TLazBarcodeCustomBase }
|
||||||
|
|
||||||
|
TLazBarcodeCustomBase=class(TGraphicControl)
|
||||||
|
private
|
||||||
|
mIsPainting: Boolean;
|
||||||
|
function GetStrictSize: Boolean;
|
||||||
|
procedure SetStrictSize(const AValue: Boolean);
|
||||||
|
function GetBackgroundColor: TColor;
|
||||||
|
function GetForegroundColor: TColor;
|
||||||
|
procedure SetBackgroundColor(const AValue: TColor);
|
||||||
|
procedure SetForegroundColor(const AValue: TColor);
|
||||||
|
protected
|
||||||
|
FQR: PointerTo_zint_symbol;
|
||||||
|
FLastErrorString: UTF8String;
|
||||||
|
FBackgroundColor: TColor;
|
||||||
|
FForegroundColor: TColor;
|
||||||
|
FStrictSize: Boolean;
|
||||||
|
procedure GenerateAndInvalidate;
|
||||||
|
procedure Paint; override;
|
||||||
|
procedure Resize; override;
|
||||||
|
procedure intfPaintOnCanvas(const aTargetCanvas: TCanvas; const aRect: TRect);
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure PaintOnCanvas(const aTargetCanvas: TCanvas; const aRect: TRect);
|
||||||
|
procedure Generate; virtual; abstract;
|
||||||
|
published
|
||||||
|
property StrictSize: Boolean read GetStrictSize write SetStrictSize;
|
||||||
|
property BackgroundColor: TColor read GetBackgroundColor write SetBackgroundColor default clWhite;
|
||||||
|
property ForegroundColor: TColor read GetForegroundColor write SetForegroundColor default clBlack;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TLazBarcodeCustomText }
|
||||||
|
|
||||||
|
TLazBarcodeCustomText=class(TLazBarcodeCustomBase)
|
||||||
|
private
|
||||||
|
function GetText: UTF8String;
|
||||||
|
procedure SetText(const AValue: UTF8String);
|
||||||
|
protected
|
||||||
|
FText: UTF8String;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
published
|
||||||
|
property Text: UTF8String read GetText write SetText;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeQR }
|
||||||
|
|
||||||
|
TBarcodeQR=class(TLazBarcodeCustomText)
|
||||||
|
private
|
||||||
|
procedure SetECCLevel(const AValue: TBarcodeQR_ECCLevel);
|
||||||
|
protected
|
||||||
|
FECCLevel: TBarcodeQR_ECCLevel;
|
||||||
|
procedure UpdateECCLevel;
|
||||||
|
public
|
||||||
|
procedure Generate; override;
|
||||||
|
published
|
||||||
|
property ECCLevel: TBarcodeQR_ECCLevel read FECCLevel write SetECCLevel default eBarcodeQR_ECCLevel_Auto;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeMicroQR }
|
||||||
|
|
||||||
|
TBarcodeMicroQR=class(TBarcodeQR)
|
||||||
|
private
|
||||||
|
protected
|
||||||
|
public
|
||||||
|
procedure Generate; override;
|
||||||
|
published
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeAztec }
|
||||||
|
|
||||||
|
TBarcodeAztec=class(TLazBarcodeCustomText)
|
||||||
|
private
|
||||||
|
protected
|
||||||
|
public
|
||||||
|
procedure Generate; override;
|
||||||
|
published
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeAztecRune }
|
||||||
|
|
||||||
|
TBarcodeAztecRune=class(TLazBarcodeCustomBase)
|
||||||
|
private
|
||||||
|
procedure SetValue(const AValue: TBarcodeAztecRune_Value);
|
||||||
|
protected
|
||||||
|
FValue: TBarcodeAztecRune_Value;
|
||||||
|
public
|
||||||
|
procedure Generate; override;
|
||||||
|
published
|
||||||
|
property Value: TBarcodeAztecRune_Value read FValue write SetValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeDataMatrix }
|
||||||
|
|
||||||
|
TBarcodeDataMatrix=class(TLazBarcodeCustomText)
|
||||||
|
private
|
||||||
|
protected
|
||||||
|
public
|
||||||
|
procedure Generate; override;
|
||||||
|
published
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
begin
|
||||||
|
{$I tbarcodeqr.lrs}
|
||||||
|
RegisterComponents('Laz Barcodes 2D',[TBarcodeQR]);
|
||||||
|
{$I tbarcodemicroqr.lrs}
|
||||||
|
RegisterComponents('Laz Barcodes 2D',[TBarcodeMicroQR]);
|
||||||
|
{$I tbarcodeaztec.lrs}
|
||||||
|
RegisterComponents('Laz Barcodes 2D',[TBarcodeAztec]);
|
||||||
|
{$I tbarcodeaztecrune.lrs}
|
||||||
|
RegisterComponents('Laz Barcodes 2D',[TBarcodeAztecRune]);
|
||||||
|
{$I tbarcodedatamatrix.lrs}
|
||||||
|
RegisterComponents('Laz Barcodes 2D',[TBarcodeDataMatrix]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeDataMatrix }
|
||||||
|
|
||||||
|
procedure TBarcodeDataMatrix.Generate;
|
||||||
|
var
|
||||||
|
ErrorCode: integer;
|
||||||
|
begin
|
||||||
|
if Assigned(FQR) then begin
|
||||||
|
ZBarcode_Delete(FQR);
|
||||||
|
FQR:=nil;
|
||||||
|
end;
|
||||||
|
if Length(FText)>0 then begin
|
||||||
|
FQR:=ZBarcode_Create();
|
||||||
|
with FQR^ do begin
|
||||||
|
border_width:=1;
|
||||||
|
end;
|
||||||
|
ErrorCode:=dmatrix(FQR,@FText[1],Length(FText));
|
||||||
|
if ErrorCode<>0 then begin
|
||||||
|
FLastErrorString:=FQR^.errtxt;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeAztecRune }
|
||||||
|
|
||||||
|
procedure TBarcodeAztecRune.SetValue(const AValue: TBarcodeAztecRune_Value);
|
||||||
|
begin
|
||||||
|
if FValue=AValue then exit;
|
||||||
|
FValue:=AValue;
|
||||||
|
GenerateAndInvalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBarcodeAztecRune.Generate;
|
||||||
|
var
|
||||||
|
ErrorCode: integer;
|
||||||
|
NumberText: ansistring;
|
||||||
|
begin
|
||||||
|
if Assigned(FQR) then begin
|
||||||
|
ZBarcode_Delete(FQR);
|
||||||
|
FQR:=nil;
|
||||||
|
end;
|
||||||
|
NumberText:=IntToStr(FValue);
|
||||||
|
if (Length(NumberText)>0) and (Length(NumberText)<=3) then begin
|
||||||
|
FQR:=ZBarcode_Create();
|
||||||
|
with FQR^ do begin
|
||||||
|
border_width:=0;
|
||||||
|
end;
|
||||||
|
ErrorCode:=aztec_runes(FQR,@NumberText[1],Length(NumberText));
|
||||||
|
if ErrorCode<>0 then begin
|
||||||
|
FLastErrorString:=FQR^.errtxt;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeAztec }
|
||||||
|
|
||||||
|
procedure TBarcodeAztec.Generate;
|
||||||
|
var
|
||||||
|
ErrorCode: integer;
|
||||||
|
begin
|
||||||
|
if Assigned(FQR) then begin
|
||||||
|
ZBarcode_Delete(FQR);
|
||||||
|
FQR:=nil;
|
||||||
|
end;
|
||||||
|
if Length(FText)>0 then begin
|
||||||
|
FQR:=ZBarcode_Create();
|
||||||
|
with FQR^ do begin
|
||||||
|
border_width:=0;
|
||||||
|
end;
|
||||||
|
ErrorCode:=aztec(FQR,@FText[1],Length(FText));
|
||||||
|
if ErrorCode<>0 then begin
|
||||||
|
FLastErrorString:=FQR^.errtxt;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TLazBarcodeCustomBase }
|
||||||
|
|
||||||
|
function TLazBarcodeCustomBase.GetStrictSize: Boolean;
|
||||||
|
begin
|
||||||
|
Result:=FStrictSize;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomBase.SetStrictSize(const AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FStrictSize<>AValue then begin
|
||||||
|
FStrictSize:=AValue;
|
||||||
|
GenerateAndInvalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLazBarcodeCustomBase.GetBackgroundColor: TColor;
|
||||||
|
begin
|
||||||
|
Result:=FBackgroundColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLazBarcodeCustomBase.GetForegroundColor: TColor;
|
||||||
|
begin
|
||||||
|
Result:=FForegroundColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomBase.SetBackgroundColor(const AValue: TColor);
|
||||||
|
begin
|
||||||
|
if FBackgroundColor<>AValue then begin
|
||||||
|
FBackgroundColor:=AValue;
|
||||||
|
GenerateAndInvalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomBase.SetForegroundColor(const AValue: TColor);
|
||||||
|
begin
|
||||||
|
if FForegroundColor<>AValue then begin
|
||||||
|
FForegroundColor:=AValue;
|
||||||
|
GenerateAndInvalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomBase.GenerateAndInvalidate;
|
||||||
|
begin
|
||||||
|
Generate;
|
||||||
|
Self.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomBase.Paint;
|
||||||
|
begin
|
||||||
|
if mIsPainting then exit;
|
||||||
|
mIsPainting:=true;
|
||||||
|
intfPaintOnCanvas(Canvas, self.ClientRect);
|
||||||
|
mIsPainting:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomBase.Resize;
|
||||||
|
begin
|
||||||
|
inherited Resize;
|
||||||
|
Generate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TLazBarcodeCustomBase.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
FBackgroundColor:=clWhite;
|
||||||
|
FForegroundColor:=clBlack;
|
||||||
|
FStrictSize:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TLazBarcodeCustomBase.Destroy;
|
||||||
|
begin
|
||||||
|
if Assigned(FQR) then begin
|
||||||
|
ZBarcode_Delete(FQR);
|
||||||
|
FQR:=nil;
|
||||||
|
end;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomBase.PaintOnCanvas(const aTargetCanvas: TCanvas;
|
||||||
|
const aRect: TRect);
|
||||||
|
begin
|
||||||
|
//Destroy rendering
|
||||||
|
Generate;
|
||||||
|
//Create new rendering
|
||||||
|
intfPaintOnCanvas(aTargetCanvas,aRect);
|
||||||
|
//Destroy rendering, new rendering generated when paint called.
|
||||||
|
Generate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomBase.intfPaintOnCanvas(const aTargetCanvas: TCanvas;
|
||||||
|
const aRect: TRect);
|
||||||
|
var
|
||||||
|
ErrorCode: integer;
|
||||||
|
Line: PointerTo_zint_render_line;
|
||||||
|
BaseX,BaseY: integer;
|
||||||
|
X,Y: integer;
|
||||||
|
procedure ClearBackground;
|
||||||
|
begin
|
||||||
|
aTargetCanvas.Brush.Color:=FBackgroundColor;
|
||||||
|
aTargetCanvas.FillRect(aRect);
|
||||||
|
end;
|
||||||
|
begin
|
||||||
|
if not aTargetCanvas.HandleAllocated then exit;
|
||||||
|
if not Assigned(FQR) then begin
|
||||||
|
ClearBackground;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if not Assigned(FQR^.rendered) then begin
|
||||||
|
X:=aRect.Right-aRect.Left+1;
|
||||||
|
Y:=aRect.Bottom-aRect.Top+1;
|
||||||
|
if not FStrictSize then begin
|
||||||
|
ErrorCode:=render_plot(FQR,X,Y);
|
||||||
|
end else begin
|
||||||
|
BaseX:=FQR^.width+FQR^.border_width*2;
|
||||||
|
BaseY:=FQR^.rows+FQR^.border_width*2;
|
||||||
|
ErrorCode:=render_plot(FQR,X-(X mod BaseX),(Y-(Y mod BaseY)));
|
||||||
|
end;
|
||||||
|
if ErrorCode<>1 then begin
|
||||||
|
FLastErrorString:=FQR^.errtxt;
|
||||||
|
exit;
|
||||||
|
end else begin
|
||||||
|
FLastErrorString:='';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if Assigned(FQR^.rendered) then begin
|
||||||
|
Line:=FQR^.rendered^.lines;
|
||||||
|
ClearBackground;
|
||||||
|
aTargetCanvas.Brush.Color:=FForegroundColor;
|
||||||
|
while Assigned(Line) do begin
|
||||||
|
aTargetCanvas.FillRect( round(Line^.x)+aRect.Left,round(Line^.y)+aRect.Top,
|
||||||
|
round(Line^.x+Line^.width)+aRect.Left,round(Line^.y+Line^.length)+aRect.Top);
|
||||||
|
Line:=Line^.next;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLazBarcodeCustomText.GetText: UTF8String;
|
||||||
|
begin
|
||||||
|
Result:=FText;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazBarcodeCustomText.SetText(const AValue: UTF8String);
|
||||||
|
begin
|
||||||
|
if FText<>AValue then begin
|
||||||
|
FText:=AValue;
|
||||||
|
GenerateAndInvalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TLazBarcodeCustomText.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
FText:=ClassName;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeQR }
|
||||||
|
|
||||||
|
procedure TBarcodeQR.SetECCLevel(const AValue: TBarcodeQR_ECCLevel);
|
||||||
|
begin
|
||||||
|
if FECCLevel=AValue then exit;
|
||||||
|
FECCLevel:=AValue;
|
||||||
|
GenerateAndInvalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBarcodeQR.UpdateECCLevel;
|
||||||
|
begin
|
||||||
|
case FECCLevel of
|
||||||
|
eBarcodeQR_ECCLevel_L: FQR^.option_1:=1;
|
||||||
|
eBarcodeQR_ECCLevel_M: FQR^.option_1:=2;
|
||||||
|
eBarcodeQR_ECCLevel_Q: FQR^.option_1:=3;
|
||||||
|
eBarcodeQR_ECCLevel_H: FQR^.option_1:=4;
|
||||||
|
else begin
|
||||||
|
FQR^.option_1:=0;
|
||||||
|
FECCLevel:=eBarcodeQR_ECCLevel_Auto;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBarcodeQR.Generate;
|
||||||
|
var
|
||||||
|
ErrorCode: integer;
|
||||||
|
begin
|
||||||
|
if Assigned(FQR) then begin
|
||||||
|
ZBarcode_Delete(FQR);
|
||||||
|
FQR:=nil;
|
||||||
|
end;
|
||||||
|
FQR:=ZBarcode_Create();
|
||||||
|
with FQR^ do begin
|
||||||
|
border_width:=4;
|
||||||
|
end;
|
||||||
|
UpdateECCLevel;
|
||||||
|
ErrorCode:=qr_code(FQR,@FText[1],Length(FText));
|
||||||
|
if ErrorCode<>0 then begin
|
||||||
|
FLastErrorString:=FQR^.errtxt;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBarcodeMicroQR }
|
||||||
|
|
||||||
|
procedure TBarcodeMicroQR.Generate;
|
||||||
|
var
|
||||||
|
ErrorCode: integer;
|
||||||
|
begin
|
||||||
|
if Assigned(FQR) then begin
|
||||||
|
ZBarcode_Delete(FQR);
|
||||||
|
FQR:=nil;
|
||||||
|
end;
|
||||||
|
FQR:=ZBarcode_Create();
|
||||||
|
with FQR^ do begin
|
||||||
|
border_width:=4;
|
||||||
|
end;
|
||||||
|
UpdateECCLevel;
|
||||||
|
ErrorCode:=microqr(FQR,@FText[1],Length(FText));
|
||||||
|
if ErrorCode<>0 then begin
|
||||||
|
FLastErrorString:=FQR^.errtxt;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
120
components/lazbarcodes/src/ubasic.pas
Normal file
120
components/lazbarcodes/src/ubasic.pas
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
unit ubasic;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils,zint,uhelper;
|
||||||
|
|
||||||
|
function ZBarcode_Create(): PointerTo_zint_symbol;
|
||||||
|
procedure ZBarcode_Clear(symbol: PointerTo_zint_symbol);
|
||||||
|
procedure ZBarcode_Delete(symbol: PointerTo_zint_symbol);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function ZBarcode_Create(): PointerTo_zint_symbol;
|
||||||
|
var
|
||||||
|
symbol: PointerTo_zint_symbol;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
symbol := GetMem (SizeOf (zint_symbol));
|
||||||
|
if not Assigned(symbol) then
|
||||||
|
begin
|
||||||
|
exit (nil);
|
||||||
|
end;
|
||||||
|
FillByte(symbol^, SizeOf (zint_symbol),0);
|
||||||
|
symbol^.symbology := BARCODE_CODE128;
|
||||||
|
symbol^.height := 0;
|
||||||
|
symbol^.whitespace_width := 0;
|
||||||
|
symbol^.border_width := 0;
|
||||||
|
symbol^.output_options := 0;
|
||||||
|
symbol^.rows := 0;
|
||||||
|
symbol^.width := 0;
|
||||||
|
strcpy (symbol^.fgcolour, '000000');
|
||||||
|
strcpy (symbol^.bgcolour, 'ffffff');
|
||||||
|
strcpy (symbol^.outfile, '');
|
||||||
|
symbol^.scale := 1.0;
|
||||||
|
symbol^.option_1 := -1;
|
||||||
|
symbol^.option_2 := 0;
|
||||||
|
symbol^.option_3 := 928;
|
||||||
|
symbol^.show_hrt := 1;
|
||||||
|
symbol^.input_mode := DATA_MODE;
|
||||||
|
strcpy (symbol^.primary, '');
|
||||||
|
FillByte (symbol^.encoded_data[0][0], SizeOf (symbol^.encoded_data),0);
|
||||||
|
i := 0;
|
||||||
|
while i < 178 do
|
||||||
|
begin
|
||||||
|
symbol^.row_height[i] := 0;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
symbol^.bitmap := nil;
|
||||||
|
symbol^.bitmap_width := 0;
|
||||||
|
symbol^.bitmap_height := 0;
|
||||||
|
exit (symbol);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ZBarcode_Clear(symbol: PointerTo_zint_symbol);
|
||||||
|
var
|
||||||
|
j: Integer;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
while i < symbol^.rows do
|
||||||
|
begin
|
||||||
|
j := 0;
|
||||||
|
while j < symbol^.width do
|
||||||
|
begin
|
||||||
|
unset_module (symbol, i, j);
|
||||||
|
Inc (j);
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
symbol^.rows := 0;
|
||||||
|
symbol^.width := 0;
|
||||||
|
symbol^.text[0] := 0;
|
||||||
|
symbol^.errtxt[0] := #0;
|
||||||
|
if Assigned(symbol^.bitmap) then
|
||||||
|
begin
|
||||||
|
FreeMem (symbol^.bitmap);
|
||||||
|
end;
|
||||||
|
symbol^.bitmap := nil;
|
||||||
|
symbol^.bitmap_width := 0;
|
||||||
|
symbol^.bitmap_height := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ZBarcode_Delete(symbol: PointerTo_zint_symbol);
|
||||||
|
var
|
||||||
|
l: PointerTo_zint_render_line;
|
||||||
|
line: PointerTo_zint_render_line;
|
||||||
|
s: PointerTo_zint_render_string;
|
||||||
|
TheString: PointerTo_zint_render_string;
|
||||||
|
begin
|
||||||
|
if Boolean(symbol^.bitmap <> nil) then
|
||||||
|
begin
|
||||||
|
FreeMem (symbol^.bitmap);
|
||||||
|
end;
|
||||||
|
if Boolean(symbol^.rendered <> nil) then
|
||||||
|
begin
|
||||||
|
line := symbol^.rendered^.lines;
|
||||||
|
while Assigned(line) do
|
||||||
|
begin
|
||||||
|
l := line;
|
||||||
|
line := line^.next;
|
||||||
|
FreeMem (l);
|
||||||
|
end;
|
||||||
|
TheString := symbol^.rendered^.strings;
|
||||||
|
while Assigned(TheString) do
|
||||||
|
begin
|
||||||
|
s := TheString;
|
||||||
|
TheString := TheString^.next;
|
||||||
|
FreeMem (s^.text);
|
||||||
|
FreeMem (s);
|
||||||
|
end;
|
||||||
|
FreeMem (symbol^.rendered);
|
||||||
|
end;
|
||||||
|
FreeMem (symbol);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
1329
components/lazbarcodes/src/udatamatrix.pas
Normal file
1329
components/lazbarcodes/src/udatamatrix.pas
Normal file
File diff suppressed because it is too large
Load Diff
485
components/lazbarcodes/src/uhelper.pas
Normal file
485
components/lazbarcodes/src/uhelper.pas
Normal file
@@ -0,0 +1,485 @@
|
|||||||
|
unit uhelper;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses sysutils,zint;
|
||||||
|
|
||||||
|
const RHODIUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:';
|
||||||
|
const NEON = '0123456789';
|
||||||
|
|
||||||
|
function IsTrue(aBoolean: Boolean): Boolean;
|
||||||
|
function IsTrue(aInteger: Integer): Boolean;
|
||||||
|
function iif(const aBoolean: integer; const aCh1,aCh2: pchar): pchar;
|
||||||
|
function iif(const aBoolean: integer; const aCh1,aCh2: char): char;
|
||||||
|
function iif(const aBoolean: Boolean; const aV1,aV2: Word): word;
|
||||||
|
procedure concat(const aText: pchar; const aChar: char);
|
||||||
|
procedure concat(const aText: pchar; const aText2: pchar);
|
||||||
|
procedure concat(var aText: array of char; const aText2: pchar);
|
||||||
|
procedure strcpy(const aText: pchar; const aText2: pchar);
|
||||||
|
procedure strcpy(var aText: array of char; const aText2: pchar); overload;
|
||||||
|
function posn(const aText: pchar; const aChar: Char): integer;
|
||||||
|
function strlen(const aText: array of char): integer;
|
||||||
|
function is_sane(test_string: PChar; source: PBYTE; length: Integer): Integer;
|
||||||
|
function utf8toutf16(symbol: PointerTo_zint_symbol; source: PBYTE; vals: PInteger; length: PInteger): Integer;
|
||||||
|
procedure set_module(symbol: PointerTo_zint_symbol; y_coord: Integer; x_coord: Integer);
|
||||||
|
procedure unset_module(symbol: PointerTo_zint_symbol; y_coord: Integer; x_coord: Integer);
|
||||||
|
function module_is_set(symbol: PointerTo_zint_symbol; y_coord: Integer; x_coord: Integer): Boolean;
|
||||||
|
function PostInc(var v: integer): integer;
|
||||||
|
function PostDec(var v: integer): integer;
|
||||||
|
function is_extendable(symbology: Integer): Boolean;
|
||||||
|
function is_stackable(symbology: Integer): Boolean;
|
||||||
|
function NotBoolean(const aValue: integer): Boolean;
|
||||||
|
function NotBoolean(const aValue: Boolean): Boolean;
|
||||||
|
function latin1_process(symbol: PointerTo_zint_symbol; source: PBYTE; preprocessed: PBYTE; length: PInteger): Integer;
|
||||||
|
function ctoi(c: char): integer;
|
||||||
|
function ctoi(c: BYTE): integer;
|
||||||
|
function BooleanNot(const aValue: integer): Boolean;
|
||||||
|
procedure memset(const p: Pointer; const aValue: BYTE; const aSize: integer);
|
||||||
|
function istwodigits(source: PBYTE; position: Integer): Boolean;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function istwodigits(source: PBYTE; position: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
if (Char(source[position]) in ['0'..'9']) and (Char(source[position+1]) in ['0'..'9']) then begin
|
||||||
|
Result:=true;
|
||||||
|
end else begin
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function PostInc(var v: integer): integer;
|
||||||
|
begin
|
||||||
|
Result:=v;
|
||||||
|
inc(v);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function PostDec(var v: integer): integer;
|
||||||
|
begin
|
||||||
|
Result:=v;
|
||||||
|
Dec(v);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function IsTrue(aBoolean: Boolean): Boolean;
|
||||||
|
begin
|
||||||
|
Result:=aBoolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function IsTrue(aInteger: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
if aInteger=0 then Result:=false else Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function iif(const aBoolean: integer; const aCh1, aCh2: pchar): pchar;
|
||||||
|
begin
|
||||||
|
if aBoolean=0 then begin
|
||||||
|
Result:=aCh2;
|
||||||
|
end else begin
|
||||||
|
Result:=aCh1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function iif(const aBoolean: integer; const aCh1,aCh2: char): char;
|
||||||
|
begin
|
||||||
|
if aBoolean=0 then begin
|
||||||
|
Result:=aCh2;
|
||||||
|
end else begin
|
||||||
|
Result:=aCh1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function iif(const aBoolean: Boolean; const aV1,aV2: Word): word;
|
||||||
|
begin
|
||||||
|
if aBoolean then Result:=aV1 else Result:=aV2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure concat(const aText: pchar; const aChar: char);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
i:=sysutils.strlen(aText);
|
||||||
|
aText[i]:=aChar;
|
||||||
|
inc(i);
|
||||||
|
aText[i]:=#0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure concat(const aText: pchar; const aText2: pchar);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
i:=sysutils.strlen(aText);
|
||||||
|
move(aText2^,aText[i],sysutils.strlen(aText2)+1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure concat(var aText: array of char; const aText2: pchar);
|
||||||
|
begin
|
||||||
|
concat(pchar(@aText[0]),aText2);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure strcpy(const aText: pchar; const aText2: pchar);
|
||||||
|
begin
|
||||||
|
move(aText2^,aText^,sysutils.strlen(aText2)+1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure strcpy(var aText: array of char; const aText2: pchar);
|
||||||
|
begin
|
||||||
|
move(aText2^,aText[0],sysutils.strlen(aText2)+1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function posn(const aText: pchar; const aChar: Char): integer;
|
||||||
|
var
|
||||||
|
p: Pchar;
|
||||||
|
c: integer;
|
||||||
|
begin
|
||||||
|
p:=aText;
|
||||||
|
c:=0;
|
||||||
|
while p^<>#0 do begin
|
||||||
|
if p^<>aChar then begin
|
||||||
|
inc(c);
|
||||||
|
inc(p);
|
||||||
|
end else begin
|
||||||
|
Exit(c);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function strlen(const aText: array of char): integer;
|
||||||
|
begin
|
||||||
|
Result:=sysutils.strlen(pchar(@aText[0]));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function is_sane(test_string: PChar; source: PBYTE; length: Integer): Integer;
|
||||||
|
var
|
||||||
|
latch: Boolean;
|
||||||
|
j: Cardinal;
|
||||||
|
i: Integer;
|
||||||
|
lt: Cardinal;
|
||||||
|
begin
|
||||||
|
{INITCODE} lt := sysutils.strlen (test_string);
|
||||||
|
i := 0;
|
||||||
|
while i < length do
|
||||||
|
begin
|
||||||
|
latch := FALSE;
|
||||||
|
j := 0;
|
||||||
|
while j < lt do
|
||||||
|
begin
|
||||||
|
if Boolean(source[i] = BYTE(test_string[j])) then
|
||||||
|
begin
|
||||||
|
latch := TRUE;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
Inc (j);
|
||||||
|
end;
|
||||||
|
if Boolean(NotBoolean (latch)) then
|
||||||
|
begin
|
||||||
|
exit (ERROR_INVALID_DATA);
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
exit (0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function utf8toutf16(symbol: PointerTo_zint_symbol; source: PBYTE; vals: PInteger; length: PInteger): Integer;
|
||||||
|
var
|
||||||
|
error_number: Integer;
|
||||||
|
jpos: Integer;
|
||||||
|
bpos: Integer;
|
||||||
|
next: Integer;
|
||||||
|
begin
|
||||||
|
bpos := 0;
|
||||||
|
jpos := 0;
|
||||||
|
error_number := 0;
|
||||||
|
next := 0;
|
||||||
|
repeat
|
||||||
|
if source[bpos] <= $7F then
|
||||||
|
begin
|
||||||
|
vals[jpos] := source[bpos];
|
||||||
|
next := bpos + 1;
|
||||||
|
Inc (jpos);
|
||||||
|
end else begin
|
||||||
|
if (source[bpos] >= $80) and (source[bpos] <= $BF) then
|
||||||
|
begin
|
||||||
|
strcpy (symbol^.errtxt, 'Corrupt Unicode data');
|
||||||
|
exit (ERROR_INVALID_DATA);
|
||||||
|
end;
|
||||||
|
if (source[bpos] >= $C0) and (source[bpos] <= $C1) then
|
||||||
|
begin
|
||||||
|
strcpy (symbol^.errtxt, 'Overlong encoding not supported');
|
||||||
|
exit (ERROR_INVALID_DATA);
|
||||||
|
end;
|
||||||
|
if (source[bpos] >= $C2) and (source[bpos] <= $DF) then
|
||||||
|
begin
|
||||||
|
vals[jpos] := ((source[bpos] and $1F) shl 6) + (source[bpos + 1] and $3F);
|
||||||
|
next := bpos + 2;
|
||||||
|
Inc (jpos);
|
||||||
|
end else begin
|
||||||
|
if (source[bpos] >= $E0) and (source[bpos] <= $EF) then
|
||||||
|
begin
|
||||||
|
vals[jpos] := ((source[bpos] and $0F) shl 12) + ((source[bpos + 1] and $3F) shl 6) + (source[bpos + 2] and $3F);
|
||||||
|
next := bpos + 3;
|
||||||
|
Inc (jpos);
|
||||||
|
end else begin
|
||||||
|
if source[bpos] >= $F0 then
|
||||||
|
begin
|
||||||
|
strcpy (symbol^.errtxt, 'Unicode sequences of more than 3 bytes not supported');
|
||||||
|
exit (ERROR_INVALID_DATA);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
bpos := next;
|
||||||
|
until not (bpos < length^);
|
||||||
|
length^ := jpos;
|
||||||
|
exit (error_number);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function module_is_set(symbol: PointerTo_zint_symbol; y_coord: Integer; x_coord: Integer): Boolean;
|
||||||
|
var
|
||||||
|
x_sub: Integer;
|
||||||
|
x_char: Integer;
|
||||||
|
begin
|
||||||
|
x_char := x_coord div 7;
|
||||||
|
x_sub := x_coord mod 7;
|
||||||
|
{$PUSH}{$R-}
|
||||||
|
Result:=((symbol^.encoded_data[y_coord][x_coord div 7] shr (x_coord mod 7)) and 1)<>0;
|
||||||
|
{$POP}
|
||||||
|
exit;
|
||||||
|
|
||||||
|
Result:=false;
|
||||||
|
case x_sub of
|
||||||
|
0: if Boolean((symbol^.encoded_data[y_coord][x_char] and $01) <> 0) then
|
||||||
|
begin
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
1: if Boolean((symbol^.encoded_data[y_coord][x_char] and $02) <> 0) then
|
||||||
|
begin
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
2: if Boolean((symbol^.encoded_data[y_coord][x_char] and $04) <> 0) then
|
||||||
|
begin
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
3: if Boolean((symbol^.encoded_data[y_coord][x_char] and $08) <> 0) then
|
||||||
|
begin
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
4: if Boolean((symbol^.encoded_data[y_coord][x_char] and $10) <> 0) then
|
||||||
|
begin
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
5: if Boolean((symbol^.encoded_data[y_coord][x_char] and $20) <> 0) then
|
||||||
|
begin
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
6: if Boolean((symbol^.encoded_data[y_coord][x_char] and $40) <> 0) then
|
||||||
|
begin
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
result:=false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure set_module(symbol: PointerTo_zint_symbol; y_coord: Integer; x_coord: Integer);
|
||||||
|
var
|
||||||
|
x_sub: Integer;
|
||||||
|
x_char: Integer;
|
||||||
|
begin
|
||||||
|
x_char := x_coord div 7;
|
||||||
|
x_sub := x_coord mod 7;
|
||||||
|
case x_sub of
|
||||||
|
0: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] + $01;
|
||||||
|
1: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] + $02;
|
||||||
|
2: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] + $04;
|
||||||
|
3: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] + $08;
|
||||||
|
4: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] + $10;
|
||||||
|
5: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] + $20;
|
||||||
|
6: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] + $40;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure unset_module(symbol: PointerTo_zint_symbol; y_coord: Integer; x_coord: Integer);
|
||||||
|
var
|
||||||
|
x_sub: Integer;
|
||||||
|
x_char: Integer;
|
||||||
|
begin
|
||||||
|
x_char := x_coord div 7;
|
||||||
|
x_sub := x_coord mod 7;
|
||||||
|
case x_sub of
|
||||||
|
0: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] - $01;
|
||||||
|
1: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] - $02;
|
||||||
|
2: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] - $04;
|
||||||
|
3: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] - $08;
|
||||||
|
4: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] - $10;
|
||||||
|
5: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] - $20;
|
||||||
|
6: symbol^.encoded_data[y_coord][x_char] := symbol^.encoded_data[y_coord][x_char] - $40;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure to_upper(a: PBYTE);
|
||||||
|
begin
|
||||||
|
while a^<>0 do begin
|
||||||
|
if char(a^) in ['a'..'z'] then begin
|
||||||
|
a^:=BYTE(upCase(char(a^)));
|
||||||
|
end;
|
||||||
|
inc(a);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ctoi(c: char): integer;
|
||||||
|
begin
|
||||||
|
if c in ['0'..'9'] then begin
|
||||||
|
Result:=BYTE(c)-48;
|
||||||
|
end else begin
|
||||||
|
Result:=-1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ctoi(c: BYTE): integer;
|
||||||
|
begin
|
||||||
|
Result:=ctoi(char(c));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function BooleanNot(const aValue: integer): Boolean;
|
||||||
|
begin
|
||||||
|
Result:=NotBoolean(aValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure memset(const p: Pointer; const aValue: BYTE; const aSize: integer);
|
||||||
|
begin
|
||||||
|
FillByte(PBYTE(p)^,aSize,aValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function is_extendable(symbology: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
if symbology = BARCODE_EANX then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_UPCA then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_UPCE then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_ISBNX then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_UPCA_CC then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_UPCE_CC then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_EANX_CC then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
exit (false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function is_stackable(symbology: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
if symbology < BARCODE_PDF417 then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_CODE128B then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_ISBNX then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_EAN14 then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_NVE18 then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_KOREAPOST then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_PLESSEY then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_TELEPEN_NUM then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_ITF14 then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
if symbology = BARCODE_CODE32 then
|
||||||
|
begin
|
||||||
|
exit (true);
|
||||||
|
end;
|
||||||
|
exit (false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function NotBoolean(const aValue: integer): Boolean;
|
||||||
|
begin
|
||||||
|
if aValue=0 then Result:=true else Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function NotBoolean(const aValue: Boolean): Boolean;
|
||||||
|
begin
|
||||||
|
if aValue=false then Result:=true else Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function latin1_process(symbol: PointerTo_zint_symbol; source: PBYTE; preprocessed: PBYTE; length: PInteger): Integer;
|
||||||
|
var
|
||||||
|
next: Integer;
|
||||||
|
i: Integer;
|
||||||
|
j: Integer;
|
||||||
|
begin
|
||||||
|
j := 0;
|
||||||
|
i := 0;
|
||||||
|
repeat
|
||||||
|
next := -1;
|
||||||
|
if Boolean(source[i] < 128) then
|
||||||
|
begin
|
||||||
|
preprocessed[j] := source[i];
|
||||||
|
Inc (j);
|
||||||
|
next := i + 1;
|
||||||
|
end else begin
|
||||||
|
if Boolean(source[i] = $C2) then
|
||||||
|
begin
|
||||||
|
preprocessed[j] := source[i + 1];
|
||||||
|
Inc (j);
|
||||||
|
next := i + 2;
|
||||||
|
end;
|
||||||
|
if Boolean(source[i] = $C3) then
|
||||||
|
begin
|
||||||
|
preprocessed[j] := source[i + 1] + 64;
|
||||||
|
Inc (j);
|
||||||
|
next := i + 2;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if Boolean(next = -1) then
|
||||||
|
begin
|
||||||
|
strcpy (symbol^.errtxt, 'error: Invalid character in input string (only Latin-1 characters supported)');
|
||||||
|
exit (ERROR_INVALID_DATA);
|
||||||
|
end;
|
||||||
|
i := next;
|
||||||
|
until not (i < length^);
|
||||||
|
preprocessed[j] := 0;
|
||||||
|
length^ := j;
|
||||||
|
exit (0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
3507
components/lazbarcodes/src/uqr.pas
Normal file
3507
components/lazbarcodes/src/uqr.pas
Normal file
File diff suppressed because it is too large
Load Diff
172
components/lazbarcodes/src/ureedsolomon.pas
Normal file
172
components/lazbarcodes/src/ureedsolomon.pas
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
unit ureedsolomon;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
procedure rs_init_gf(poly: Integer);
|
||||||
|
procedure rs_init_code(nsym: Integer; index: Integer);
|
||||||
|
procedure rs_encode(len: Integer; data: PBYTE; res: PBYTE);
|
||||||
|
procedure rs_encode_long(len: Integer; data: PCardinal; res: PCardinal);
|
||||||
|
procedure rs_free();
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
// gfpoly: integer;
|
||||||
|
// symsize: integer; // in bits
|
||||||
|
logmod: integer; // 2**symsize - 1
|
||||||
|
rlen: integer;
|
||||||
|
|
||||||
|
logt: PInteger = nil;
|
||||||
|
alog: PInteger = nil;
|
||||||
|
rspoly: PInteger = nil;
|
||||||
|
|
||||||
|
procedure rs_init_gf(poly: Integer);
|
||||||
|
var
|
||||||
|
b: Integer;
|
||||||
|
p: Integer;
|
||||||
|
v: Integer;
|
||||||
|
m: Integer;
|
||||||
|
begin
|
||||||
|
b := 1;
|
||||||
|
m := 0;
|
||||||
|
while b <= poly do
|
||||||
|
begin
|
||||||
|
Inc (m);
|
||||||
|
b := b shl 1;
|
||||||
|
end;
|
||||||
|
b := b shr 1;
|
||||||
|
Dec (m);
|
||||||
|
// gfpoly := poly;
|
||||||
|
// symsize := m;
|
||||||
|
logmod := (1 shl m) - 1;
|
||||||
|
logt := PInteger (GetMem (SizeOf (Integer) * (logmod + 1)));
|
||||||
|
alog := PInteger (GetMem (SizeOf (Integer) * logmod));
|
||||||
|
p := 1;
|
||||||
|
v := 0;
|
||||||
|
while v < logmod do
|
||||||
|
begin
|
||||||
|
alog[v] := p;
|
||||||
|
logt[p] := v;
|
||||||
|
p := p shl 1;
|
||||||
|
if (p and b)<>0 then
|
||||||
|
begin
|
||||||
|
p:=p xor poly;
|
||||||
|
end;
|
||||||
|
Inc (v);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure rs_init_code(nsym: Integer; index: Integer);
|
||||||
|
var
|
||||||
|
k: Integer;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
rspoly := PInteger (GetMem (SizeOf (Integer) * (nsym + 1)));
|
||||||
|
rlen := nsym;
|
||||||
|
rspoly[0] := 1;
|
||||||
|
i := 1;
|
||||||
|
while i <= nsym do
|
||||||
|
begin
|
||||||
|
rspoly[i] := 1;
|
||||||
|
k := i - 1;
|
||||||
|
while k > 0 do
|
||||||
|
begin
|
||||||
|
if rspoly[k]<>0 then
|
||||||
|
begin
|
||||||
|
rspoly[k] := alog[(logt[rspoly[k]] + index) mod logmod];
|
||||||
|
end;
|
||||||
|
rspoly[k] := rspoly[k] xor rspoly[k - 1];
|
||||||
|
Dec (k);
|
||||||
|
end;
|
||||||
|
rspoly[0] := alog[(logt[rspoly[0]] + index) mod logmod];
|
||||||
|
Inc (index);
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure rs_encode(len: Integer; data: PBYTE; res: PBYTE);
|
||||||
|
var
|
||||||
|
k: Integer;
|
||||||
|
m: Integer;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
while i < rlen do
|
||||||
|
begin
|
||||||
|
res[i] := 0;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
i := 0;
|
||||||
|
while i < len do
|
||||||
|
begin
|
||||||
|
m := res[rlen - 1] xor data[i];
|
||||||
|
k := rlen - 1;
|
||||||
|
while k > 0 do
|
||||||
|
begin
|
||||||
|
if (m<>0) and (rspoly[k]<>0) then
|
||||||
|
begin
|
||||||
|
res[k] := integer(res[k - 1]) xor alog[(logt[m] + logt[rspoly[k]]) mod logmod];
|
||||||
|
end else begin
|
||||||
|
res[k] := integer(res[k - 1]);
|
||||||
|
end;
|
||||||
|
Dec (k);
|
||||||
|
end;
|
||||||
|
if (m<>0) and (rspoly[0]<>0) then
|
||||||
|
begin
|
||||||
|
res[0] := alog[(logt[m] + logt[rspoly[0]]) mod logmod];
|
||||||
|
end else begin
|
||||||
|
res[0] := 0;
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure rs_encode_long(len: Integer; data: PCardinal; res: PCardinal);
|
||||||
|
var
|
||||||
|
k: Integer;
|
||||||
|
m: Integer;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
while i < rlen do
|
||||||
|
begin
|
||||||
|
res[i] := 0;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
i := 0;
|
||||||
|
while i < len do
|
||||||
|
begin
|
||||||
|
m := res[rlen - 1] xor data[i];
|
||||||
|
k := rlen - 1;
|
||||||
|
while k > 0 do
|
||||||
|
begin
|
||||||
|
if (m<>0) and (rspoly[k]<>0) then
|
||||||
|
begin
|
||||||
|
res[k] := Integer(res[k - 1]) xor alog[(logt[m] + logt[rspoly[k]]) mod logmod];
|
||||||
|
end else begin
|
||||||
|
res[k] := res[k - 1];
|
||||||
|
end;
|
||||||
|
Dec (k);
|
||||||
|
end;
|
||||||
|
if (m<>0) and (rspoly[0]<>0) then
|
||||||
|
begin
|
||||||
|
res[0] := alog[(logt[m] + logt[rspoly[0]]) mod logmod];
|
||||||
|
end else begin
|
||||||
|
res[0] := 0;
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure rs_free();
|
||||||
|
begin
|
||||||
|
freeMem (logt);
|
||||||
|
freeMem (alog);
|
||||||
|
freeMem (rspoly);
|
||||||
|
rspoly := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
782
components/lazbarcodes/src/urender.pas
Normal file
782
components/lazbarcodes/src/urender.pas
Normal file
@@ -0,0 +1,782 @@
|
|||||||
|
unit urender;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils,zint,uhelper;
|
||||||
|
|
||||||
|
function render_plot_create_line(x: Single; y: Single; width: Single; length: Single): PointerTo_zint_render_line;
|
||||||
|
function render_plot_add_line(symbol: PointerTo_zint_symbol; line: PointerTo_zint_render_line; last_line: PointerTo_PointerTo_zint_render_line): Integer;
|
||||||
|
function render_plot_create_ring(x: Single; y: Single; radius: Single; line_width: Single): PointerTo_zint_render_ring;
|
||||||
|
function render_plot_add_ring(symbol: PointerTo_zint_symbol; ring: PointerTo_zint_render_ring; last_ring: PointerTo_PointerTo_zint_render_ring): Integer;
|
||||||
|
function render_plot_create_hexagon(x: Single; y: Single): PointerTo_zint_render_hexagon;
|
||||||
|
function render_plot_add_hexagon(symbol: PointerTo_zint_symbol; hexagon: PointerTo_zint_render_hexagon; last_hexagon: PointerTo_PointerTo_zint_render_hexagon): Integer;
|
||||||
|
function render_plot_add_string(symbol: PointerTo_zint_symbol; text: PBYTE; x: Single; y: Single; fsize: Single; width: Single; last_string: PointerTo_PointerTo_zint_render_string): Integer;
|
||||||
|
function render_plot(symbol: PointerTo_zint_symbol; width: Single; height: Single): Integer;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
const GL_CONST=2.8346;
|
||||||
|
|
||||||
|
function render_plot(symbol: PointerTo_zint_symbol; width: Single; height: Single): Integer;
|
||||||
|
var
|
||||||
|
render: PointerTo_zint_render;
|
||||||
|
last_line: PointerTo_zint_render_line = nil;
|
||||||
|
line: PointerTo_zint_render_line = nil;
|
||||||
|
last_string: PointerTo_zint_render_string = nil;
|
||||||
|
//last_ring: PointerTo_zint_render_ring = nil;
|
||||||
|
//ring: PointerTo_zint_render_ring = nil;
|
||||||
|
//last_hexagon: PointerTo_zint_render_hexagon = nil;
|
||||||
|
//hexagon: PointerTo_zint_render_hexagon = nil;
|
||||||
|
this_row: Integer;
|
||||||
|
latch: Integer;
|
||||||
|
block_width: Integer;
|
||||||
|
r: Integer;
|
||||||
|
i: Integer;
|
||||||
|
row_posn: Single = 0.0;
|
||||||
|
row_height: Single = 0.0;
|
||||||
|
preset_height: Single = 0.0;
|
||||||
|
large_bar_height: Single = 0.0;
|
||||||
|
textwidth: Single = 0.0;
|
||||||
|
textpos: Single = 0.0;
|
||||||
|
addon_width_x: Integer;
|
||||||
|
main_symbol_width_x: Integer;
|
||||||
|
textdone: Integer;
|
||||||
|
yoffset: Integer;
|
||||||
|
xoffset: Integer;
|
||||||
|
text_height: Integer;
|
||||||
|
text_offset: Integer;
|
||||||
|
textpart: array [0..10-1] of Char;
|
||||||
|
addon: array [0..6-1] of Char;
|
||||||
|
total_area_width_x: Integer;
|
||||||
|
total_symbol_width_x: Integer;
|
||||||
|
symbol_lead_in: Integer;
|
||||||
|
large_bar_count: Integer;
|
||||||
|
addon_text_posn: Single;
|
||||||
|
default_text_posn: Single;
|
||||||
|
scaler: Single;
|
||||||
|
//locale: pchar = nil;
|
||||||
|
hide_text: Integer = 0;
|
||||||
|
required_aspect: Single;
|
||||||
|
symbol_aspect: Single = 1;
|
||||||
|
x_dimension: Single;
|
||||||
|
upceanflag: Integer = 0;
|
||||||
|
addon_latch: Integer = 0;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
{INITCODE} last_line := nil;
|
||||||
|
{INITCODE} line := nil;
|
||||||
|
{INITCODE} last_string := nil;
|
||||||
|
//{INITCODE} last_ring := nil;
|
||||||
|
//{INITCODE} ring := nil;
|
||||||
|
//{INITCODE} last_hexagon := nil;
|
||||||
|
//{INITCODE} hexagon := nil;
|
||||||
|
{INITCODE} row_posn := 0.0;
|
||||||
|
{INITCODE} row_height := 0.0;
|
||||||
|
{INITCODE} preset_height := 0.0;
|
||||||
|
{INITCODE} large_bar_height := 0.0;
|
||||||
|
{INITCODE} textwidth := 0.0;
|
||||||
|
{INITCODE} textpos := 0.0;
|
||||||
|
//{INITCODE} locale := nil;
|
||||||
|
{INITCODE} hide_text := 0;
|
||||||
|
{INITCODE} symbol_aspect := 1;
|
||||||
|
{INITCODE} upceanflag := 0;
|
||||||
|
GetMem(Symbol^.rendered,sizeof(zint_render));
|
||||||
|
render:=Symbol^.rendered;
|
||||||
|
|
||||||
|
render^.lines := nil;
|
||||||
|
render^.strings := nil;
|
||||||
|
render^.rings := nil;
|
||||||
|
render^.hexagons := nil;
|
||||||
|
// locale := setlocale (LC_ALL, 'C');
|
||||||
|
row_height := 0;
|
||||||
|
textdone := 0;
|
||||||
|
textpos := 0.0;
|
||||||
|
main_symbol_width_x := symbol^.width;
|
||||||
|
addon[0]:=#0;
|
||||||
|
strcpy (addon, '');
|
||||||
|
symbol_lead_in := 0;
|
||||||
|
addon_text_posn := 0.0;
|
||||||
|
addon_width_x := 0;
|
||||||
|
latch := 0;
|
||||||
|
r := 0;
|
||||||
|
if IsTrue(is_extendable (symbol^.symbology)) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
while i < sysutils.strlen (@symbol^.text[0]) do
|
||||||
|
begin
|
||||||
|
if IsTrue(latch = 1) then
|
||||||
|
begin
|
||||||
|
addon[r] := char(symbol^.text[i]);
|
||||||
|
Inc (r);
|
||||||
|
end;
|
||||||
|
if IsTrue(char(symbol^.text[i]) = '+') then
|
||||||
|
begin
|
||||||
|
latch := 1;
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
addon[r] := #0;
|
||||||
|
if (symbol^.show_hrt=0) or (sysutils.strlen (@symbol^.text[0]) = 0) then
|
||||||
|
begin
|
||||||
|
hide_text := 1;
|
||||||
|
text_offset := 0;
|
||||||
|
text_height := 0;
|
||||||
|
end else begin
|
||||||
|
text_height := 9;
|
||||||
|
text_offset := 2;
|
||||||
|
end;
|
||||||
|
while not (module_is_set (symbol, symbol^.rows - 1, symbol_lead_in)) do
|
||||||
|
begin
|
||||||
|
Inc (symbol_lead_in);
|
||||||
|
end;
|
||||||
|
if IsTrue(((((((symbol^.symbology = BARCODE_EANX)) and ((symbol^.rows = 1)))) or ((symbol^.symbology = BARCODE_EANX_CC)))) or ((symbol^.symbology = BARCODE_ISBNX))) then
|
||||||
|
begin
|
||||||
|
case sysutils.strlen (@symbol^.text[0]) of
|
||||||
|
13,
|
||||||
|
16,
|
||||||
|
19:
|
||||||
|
begin
|
||||||
|
if IsTrue(symbol^.whitespace_width = 0) then
|
||||||
|
begin
|
||||||
|
symbol^.whitespace_width := 10;
|
||||||
|
end;
|
||||||
|
main_symbol_width_x := 96 + symbol_lead_in;
|
||||||
|
upceanflag := 13;
|
||||||
|
end;
|
||||||
|
2:
|
||||||
|
begin
|
||||||
|
main_symbol_width_x := 22 + symbol_lead_in;
|
||||||
|
upceanflag := 2;
|
||||||
|
end;
|
||||||
|
5:
|
||||||
|
begin
|
||||||
|
main_symbol_width_x := 49 + symbol_lead_in;
|
||||||
|
upceanflag := 5;
|
||||||
|
end;
|
||||||
|
otherwise
|
||||||
|
begin
|
||||||
|
main_symbol_width_x := 68 + symbol_lead_in;
|
||||||
|
upceanflag := 8;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
case sysutils.strlen (@symbol^.text[0]) of
|
||||||
|
11,
|
||||||
|
16: addon_width_x := 31;
|
||||||
|
14,
|
||||||
|
19: addon_width_x := 58;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if IsTrue(((((symbol^.symbology = BARCODE_UPCA)) and ((symbol^.rows = 1)))) or ((symbol^.symbology = BARCODE_UPCA_CC))) then
|
||||||
|
begin
|
||||||
|
upceanflag := 12;
|
||||||
|
if Boolean(symbol^.whitespace_width < 10) then
|
||||||
|
begin
|
||||||
|
symbol^.whitespace_width := 10;
|
||||||
|
main_symbol_width_x := 96 + symbol_lead_in;
|
||||||
|
end;
|
||||||
|
case sysutils.strlen (@symbol^.text[0]) of
|
||||||
|
15: addon_width_x := 31;
|
||||||
|
18: addon_width_x := 58;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if Boolean(((((symbol^.symbology = BARCODE_UPCE)) and ((symbol^.rows = 1)))) or ((symbol^.symbology = BARCODE_UPCE_CC))) then
|
||||||
|
begin
|
||||||
|
upceanflag := 6;
|
||||||
|
if symbol^.whitespace_width = 0 then
|
||||||
|
begin
|
||||||
|
symbol^.whitespace_width := 10;
|
||||||
|
main_symbol_width_x := 51 + symbol_lead_in;
|
||||||
|
end;
|
||||||
|
case sysutils.strlen (@symbol^.text[0]) of
|
||||||
|
11: addon_width_x := 31;
|
||||||
|
14: addon_width_x := 58;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
total_symbol_width_x := main_symbol_width_x + addon_width_x;
|
||||||
|
total_area_width_x := total_symbol_width_x + (2 * (symbol^.border_width + symbol^.whitespace_width));
|
||||||
|
xoffset := symbol^.border_width + symbol^.whitespace_width;
|
||||||
|
yoffset := symbol^.border_width;
|
||||||
|
large_bar_count := 0;
|
||||||
|
preset_height := 0.0;
|
||||||
|
i := 0;
|
||||||
|
while i < symbol^.rows do
|
||||||
|
begin
|
||||||
|
preset_height := preset_height + (symbol^.row_height[i]);
|
||||||
|
if symbol^.row_height[i] = 0 then
|
||||||
|
begin
|
||||||
|
Inc (large_bar_count);
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
if large_bar_count = 0 then
|
||||||
|
begin
|
||||||
|
required_aspect := width / height;
|
||||||
|
symbol_aspect := (total_symbol_width_x + (2 * xoffset)) / (preset_height + (2 * yoffset) + text_offset + text_height);
|
||||||
|
symbol^.height := trunc(preset_height);
|
||||||
|
if required_aspect > symbol_aspect then
|
||||||
|
begin
|
||||||
|
scaler := height / (preset_height + (2 * yoffset) + text_offset + text_height);
|
||||||
|
render^.width := symbol_aspect * height;
|
||||||
|
render^.height := height;
|
||||||
|
end else begin
|
||||||
|
scaler := width / (total_symbol_width_x + (2 * xoffset));
|
||||||
|
render^.width := width;
|
||||||
|
render^.height := width / symbol_aspect;
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
scaler := width / (total_symbol_width_x + (2 * xoffset));
|
||||||
|
symbol^.height := Trunc((height / scaler) - ((2 * yoffset) + text_offset + text_height));
|
||||||
|
render^.width := width;
|
||||||
|
render^.height := height;
|
||||||
|
end;
|
||||||
|
if large_bar_count=0 then begin
|
||||||
|
large_bar_height:=0;
|
||||||
|
end else begin
|
||||||
|
large_bar_height := (symbol^.height - preset_height) / large_bar_count;
|
||||||
|
end;
|
||||||
|
if ((symbol^.output_options and BARCODE_BOX) <> 0) or ((symbol^.output_options and BARCODE_BIND) <> 0) then
|
||||||
|
begin
|
||||||
|
default_text_posn := (symbol^.height + text_offset + symbol^.border_width + symbol^.border_width) * scaler;
|
||||||
|
end else begin
|
||||||
|
default_text_posn := (symbol^.height + text_offset + symbol^.border_width) * scaler;
|
||||||
|
end;
|
||||||
|
x_dimension := render^.width / total_area_width_x;
|
||||||
|
x_dimension := x_dimension / GL_CONST;
|
||||||
|
|
||||||
|
|
||||||
|
if render^.height < ((x_dimension * ((2 * symbol^.border_width) + text_offset + text_height)) + 2.0) * GL_CONST then
|
||||||
|
begin
|
||||||
|
render^.height := ((x_dimension * ((2 * symbol^.border_width) + text_offset + text_height)) + 2.0) * GL_CONST;
|
||||||
|
end;
|
||||||
|
if render^.width < (2.0 * GL_CONST) then
|
||||||
|
begin
|
||||||
|
render^.width := (2.0 * GL_CONST);
|
||||||
|
end;
|
||||||
|
if symbol^.symbology = BARCODE_CODABAR then
|
||||||
|
begin
|
||||||
|
if x_dimension < 0.191 then
|
||||||
|
begin
|
||||||
|
render^.width := 0.191 * GL_CONST * total_area_width_x;
|
||||||
|
end;
|
||||||
|
if render^.height < ((x_dimension * ((2 * symbol^.border_width) + text_offset + text_height)) + 5.0) * GL_CONST then
|
||||||
|
begin
|
||||||
|
render^.height := ((x_dimension * ((2 * symbol^.border_width) + text_offset + text_height)) + 5.0) * GL_CONST;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if symbol^.symbology = BARCODE_CODE49 then
|
||||||
|
begin
|
||||||
|
if x_dimension < 0.191 then
|
||||||
|
begin
|
||||||
|
render^.width := 0.191 * GL_CONST * total_area_width_x;
|
||||||
|
render^.height := render^.width / symbol_aspect;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if upceanflag <> 0 then
|
||||||
|
begin
|
||||||
|
render^.width := 0.330 * GL_CONST * total_area_width_x;
|
||||||
|
case upceanflag of
|
||||||
|
6,
|
||||||
|
12,
|
||||||
|
13: render^.height := ((0.330 * ((2 * symbol^.border_width) + text_offset + text_height)) + 22.85) * GL_CONST;
|
||||||
|
8: render^.height := ((0.330 * ((2 * symbol^.border_width) + text_offset + text_height)) + 18.23) * GL_CONST;
|
||||||
|
otherwise
|
||||||
|
render^.height := ((0.330 * ((2 * symbol^.border_width) + text_offset + text_height)) + 21.10) * GL_CONST;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
(*
|
||||||
|
if Boolean(symbol^.symbology = BARCODE_ONECODE) then
|
||||||
|
begin
|
||||||
|
render^.width := <*Error: Missing expression 191 *> * GL_CONST * total_area_width_x;
|
||||||
|
render^.height := <*Error: Missing expression 191 *> * GL_CONST;
|
||||||
|
end;
|
||||||
|
if Boolean(((symbol^.symbology = BARCODE_POSTNET)) or ((symbol^.symbology = BARCODE_PLANET))) then
|
||||||
|
begin
|
||||||
|
render^.width := <*Error: Missing expression 191 *> * GL_CONST * total_area_width_x;
|
||||||
|
render^.height := <*Error: Missing expression 191 *> * GL_CONST;
|
||||||
|
end;
|
||||||
|
if Boolean(((((symbol^.symbology = BARCODE_AUSPOST)) or ((symbol^.symbology = BARCODE_AUSREPLY)))) or ((((symbol^.symbology = BARCODE_AUSROUTE)) or ((symbol^.symbology = BARCODE_AUSREDIRECT))))) then
|
||||||
|
begin
|
||||||
|
render^.width := <*Error: Missing expression 191 *> * GL_CONST * total_area_width_x;
|
||||||
|
render^.height := <*Error: Missing expression 191 *> * GL_CONST;
|
||||||
|
end;
|
||||||
|
if Boolean(((symbol^.symbology = BARCODE_RM4SCC)) or ((symbol^.symbology = BARCODE_KIX))) then
|
||||||
|
begin
|
||||||
|
render^.width := <*Error: Missing expression 191 *> * GL_CONST * total_area_width_x;
|
||||||
|
render^.height := <*Error: Missing expression 191 *> * GL_CONST;
|
||||||
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
|
if symbol^.symbology = BARCODE_MAXICODE then
|
||||||
|
begin
|
||||||
|
(* scaler := GL_CONST;
|
||||||
|
render^.width := <*Error: Missing expression 191 *> * scaler;
|
||||||
|
render^.height := <*Error: Missing expression 191 *> * scaler;
|
||||||
|
ring := render_plot_create_ring (<*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler);
|
||||||
|
render_plot_add_ring (symbol, ring, @last_ring);
|
||||||
|
ring := render_plot_create_ring (<*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler);
|
||||||
|
render_plot_add_ring (symbol, ring, @last_ring);
|
||||||
|
ring := render_plot_create_ring (<*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler, <*Error: Missing expression 191 *> * scaler);
|
||||||
|
render_plot_add_ring (symbol, ring, @last_ring);
|
||||||
|
r := 0;
|
||||||
|
while r < symbol^.rows do
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
while i < symbol^.width do
|
||||||
|
begin
|
||||||
|
if Boolean(module_is_set (symbol, r, i)) then
|
||||||
|
begin
|
||||||
|
hexagon := render_plot_create_hexagon (((i * <*Error: Missing expression 191 *>) + (iif (r and 1,<*Error: Missing expression 191 *>,<*Error: Missing expression 191 *>))) * scaler, ((r * <*Error: Missing expression 191 *>) + <*Error: Missing expression 191 *>) * scaler);
|
||||||
|
render_plot_add_hexagon (symbol, hexagon, @last_hexagon);
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
Inc (r);
|
||||||
|
end;*)
|
||||||
|
end else begin
|
||||||
|
{INITCODE} addon_latch := 0;
|
||||||
|
r := 0;
|
||||||
|
while r < symbol^.rows do
|
||||||
|
begin
|
||||||
|
this_row := r;
|
||||||
|
if symbol^.row_height[this_row] = 0 then
|
||||||
|
begin
|
||||||
|
row_height := large_bar_height;
|
||||||
|
end else begin
|
||||||
|
row_height := symbol^.row_height[this_row];
|
||||||
|
end;
|
||||||
|
row_posn := 0;
|
||||||
|
i := 0;
|
||||||
|
while i < r do
|
||||||
|
begin
|
||||||
|
if symbol^.row_height[i] = 0 then
|
||||||
|
begin
|
||||||
|
row_posn := row_posn + large_bar_height;
|
||||||
|
end else begin
|
||||||
|
row_posn := row_posn + (symbol^.row_height[i]);
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
row_posn := row_posn + yoffset;
|
||||||
|
i := 0;
|
||||||
|
if module_is_set (symbol, this_row, 0) then
|
||||||
|
begin
|
||||||
|
latch := 1;
|
||||||
|
end else begin
|
||||||
|
latch := 0;
|
||||||
|
end;
|
||||||
|
repeat
|
||||||
|
block_width := 0;
|
||||||
|
repeat
|
||||||
|
Inc (block_width);
|
||||||
|
until (module_is_set (symbol, this_row, i + block_width) <> module_is_set (symbol, this_row, i));
|
||||||
|
if (((addon_latch = 0)) and ((r = (symbol^.rows - 1)))) and ((i > main_symbol_width_x)) then
|
||||||
|
begin
|
||||||
|
addon_text_posn := row_posn * scaler;
|
||||||
|
addon_latch := 1;
|
||||||
|
end;
|
||||||
|
if latch = 1 then
|
||||||
|
begin
|
||||||
|
if addon_latch = 0 then
|
||||||
|
begin
|
||||||
|
line := render_plot_create_line ((i + xoffset) * scaler, (row_posn) * scaler, block_width * scaler, row_height * scaler);
|
||||||
|
end else begin
|
||||||
|
line := render_plot_create_line ((i + xoffset) * scaler, (row_posn + 10.0) * scaler, block_width * scaler, (row_height - 5.0) * scaler);
|
||||||
|
end;
|
||||||
|
latch := 0;
|
||||||
|
render_plot_add_line (symbol, line, @last_line);
|
||||||
|
end else begin
|
||||||
|
latch := 1;
|
||||||
|
end;
|
||||||
|
i := i + block_width;
|
||||||
|
until not (i < symbol^.width);
|
||||||
|
Inc (r);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
xoffset := xoffset - symbol_lead_in;
|
||||||
|
row_posn := (row_posn + large_bar_height) * scaler;
|
||||||
|
if NotBoolean(hide_text) then
|
||||||
|
begin
|
||||||
|
if upceanflag = 8 then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
line := symbol^.rendered^.lines;
|
||||||
|
while line <> nil do
|
||||||
|
begin
|
||||||
|
case i of
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
10,
|
||||||
|
11,
|
||||||
|
20,
|
||||||
|
21: line^.length := line^.length + ((5.0 * scaler));
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
line := line^.next;
|
||||||
|
end;
|
||||||
|
i := 0;
|
||||||
|
while i < 4 do
|
||||||
|
begin
|
||||||
|
textpart[i] := char(symbol^.text[i]);
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
textpart[4] := #0;
|
||||||
|
textpos := 17;
|
||||||
|
textwidth := 4.0 * 8.5;
|
||||||
|
render_plot_add_string (symbol, PBYTE (@textpart[0]), (textpos + xoffset) * scaler, default_text_posn, 11.0 * scaler, textwidth * scaler, @last_string);
|
||||||
|
i := 0;
|
||||||
|
while i < 4 do
|
||||||
|
begin
|
||||||
|
textpart[i] := char(symbol^.text[i + 4]);
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
textpart[4] := #0;
|
||||||
|
textpos := 50;
|
||||||
|
render_plot_add_string (symbol, PBYTE (@textpart[0]), (textpos + xoffset) * scaler, default_text_posn, 11.0 * scaler, textwidth * scaler, @last_string);
|
||||||
|
textdone := 1;
|
||||||
|
case strlen (addon) of
|
||||||
|
2:
|
||||||
|
begin
|
||||||
|
textpos := xoffset + 86;
|
||||||
|
textwidth := 2.0 * 8.5;
|
||||||
|
render_plot_add_string (symbol, PBYTE (@addon[0]), textpos * scaler, addon_text_posn * scaler, 11.0 * scaler, textwidth * scaler, @last_string);
|
||||||
|
end;
|
||||||
|
5:
|
||||||
|
begin
|
||||||
|
textpos := xoffset + 100;
|
||||||
|
textwidth := 5.0 * 8.5;
|
||||||
|
render_plot_add_string (symbol, PBYTE (@addon[0]), textpos * scaler, addon_text_posn * scaler, 11.0 * scaler, textwidth * scaler, @last_string);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
(*
|
||||||
|
if Boolean(upceanflag = 13) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
line := symbol^.rendered^.lines;
|
||||||
|
while line <> nil do
|
||||||
|
begin
|
||||||
|
case i of
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
14,
|
||||||
|
15,
|
||||||
|
28,
|
||||||
|
29: line^.length := line^.length + ((<*Error: Missing expression 191 *> * scaler));
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
line := line^.next;
|
||||||
|
end;
|
||||||
|
textpart[0] := symbol^.text[0];
|
||||||
|
textpart[1] := '\0';
|
||||||
|
textpos := -5;
|
||||||
|
textwidth := <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
i := 0;
|
||||||
|
while i < 6 do
|
||||||
|
begin
|
||||||
|
textpart[i] := symbol^.text[i + 1];
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
textpart[6] := '\0';
|
||||||
|
textpos := 25;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
i := 0;
|
||||||
|
while i < 6 do
|
||||||
|
begin
|
||||||
|
textpart[i] := symbol^.text[i + 7];
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
textpart[6] := '\0';
|
||||||
|
textpos := 72;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
textdone := 1;
|
||||||
|
case strlen (addon) of
|
||||||
|
2:
|
||||||
|
begin
|
||||||
|
textpos := xoffset + 114;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (addon), textpos * scaler, addon_text_posn * scaler, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
end;
|
||||||
|
5:
|
||||||
|
begin
|
||||||
|
textpos := xoffset + 128;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (addon), textpos * scaler, addon_text_posn * scaler, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
*)
|
||||||
|
(*
|
||||||
|
if Boolean(upceanflag = 12) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
line := symbol^.rendered^.lines;
|
||||||
|
while line <> nil do
|
||||||
|
begin
|
||||||
|
case i of
|
||||||
|
0:
|
||||||
|
1:
|
||||||
|
2:
|
||||||
|
3:
|
||||||
|
14:
|
||||||
|
15:
|
||||||
|
26:
|
||||||
|
27:
|
||||||
|
28:
|
||||||
|
29: line^.length := line^.length + ((<*Error: Missing expression 191 *> * scaler));
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
line := line^.next;
|
||||||
|
end;
|
||||||
|
textpart[0] := symbol^.text[0];
|
||||||
|
textpart[1] := '\0';
|
||||||
|
textpos := -5;
|
||||||
|
textwidth := <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn + (<*Error: Missing expression 191 *> * scaler), <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
i := 0;
|
||||||
|
while i < 5 do
|
||||||
|
begin
|
||||||
|
textpart[i] := symbol^.text[i + 1];
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
textpart[5] := '\0';
|
||||||
|
textpos := 27;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
i := 0;
|
||||||
|
while i < 5 do
|
||||||
|
begin
|
||||||
|
textpart[i] := symbol^.text[i + 6];
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
textpos := 68;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
textpart[0] := symbol^.text[11];
|
||||||
|
textpart[1] := '\0';
|
||||||
|
textpos := 100;
|
||||||
|
textwidth := <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn + (<*Error: Missing expression 191 *> * scaler), <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
textdone := 1;
|
||||||
|
case strlen (addon) of
|
||||||
|
2:
|
||||||
|
begin
|
||||||
|
textpos := xoffset + 116;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (addon), textpos * scaler, addon_text_posn * scaler, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
end;
|
||||||
|
5:
|
||||||
|
begin
|
||||||
|
textpos := xoffset + 130;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (addon), textpos * scaler, addon_text_posn * scaler, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
*)
|
||||||
|
(*
|
||||||
|
if Boolean(upceanflag = 6) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
line := symbol^.rendered^.lines;
|
||||||
|
while line <> nil do
|
||||||
|
begin
|
||||||
|
case i of
|
||||||
|
0:
|
||||||
|
1:
|
||||||
|
14:
|
||||||
|
15:
|
||||||
|
16: line^.length := line^.length + ((<*Error: Missing expression 191 *> * scaler));
|
||||||
|
end;
|
||||||
|
Inc (i);
|
||||||
|
line := line^.next;
|
||||||
|
end;
|
||||||
|
textpart[0] := symbol^.text[0];
|
||||||
|
textpart[1] := '\0';
|
||||||
|
textpos := -5;
|
||||||
|
textwidth := <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn + (<*Error: Missing expression 191 *> * scaler), <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
i := 0;
|
||||||
|
while i < 6 do
|
||||||
|
begin
|
||||||
|
textpart[i] := symbol^.text[i + 1];
|
||||||
|
Inc (i);
|
||||||
|
end;
|
||||||
|
textpart[6] := '\0';
|
||||||
|
textpos := 24;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
textpart[0] := symbol^.text[7];
|
||||||
|
textpart[1] := '\0';
|
||||||
|
textpos := 55;
|
||||||
|
textwidth := <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (textpart), (textpos + xoffset) * scaler, default_text_posn + (<*Error: Missing expression 191 *> * scaler), <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
textdone := 1;
|
||||||
|
case strlen (addon) of
|
||||||
|
2:
|
||||||
|
begin
|
||||||
|
textpos := xoffset + 70;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (addon), textpos * scaler, addon_text_posn * scaler, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
end;
|
||||||
|
5:
|
||||||
|
begin
|
||||||
|
textpos := xoffset + 84;
|
||||||
|
textwidth := <*Error: Missing expression 191 *> * <*Error: Missing expression 191 *>;
|
||||||
|
render_plot_add_string (symbol, PBYTE (addon), textpos * scaler, addon_text_posn * scaler, <*Error: Missing expression 191 *> * scaler, textwidth * scaler, @last_string);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
*)
|
||||||
|
if textdone = 0 then
|
||||||
|
begin
|
||||||
|
render_plot_add_string (symbol, symbol^.text, ((symbol^.width / 2.0) + xoffset) * scaler, default_text_posn, 9.0 * scaler, 0.0, @last_string);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
case symbol^.symbology of
|
||||||
|
BARCODE_MAXICODE:
|
||||||
|
begin
|
||||||
|
//Do nothing...
|
||||||
|
end;
|
||||||
|
otherwise
|
||||||
|
begin
|
||||||
|
if (symbol^.output_options and BARCODE_BIND) <> 0 then
|
||||||
|
begin
|
||||||
|
if (symbol^.rows > 1) and is_stackable (symbol^.symbology) then
|
||||||
|
begin
|
||||||
|
r := 1;
|
||||||
|
while r < symbol^.rows do
|
||||||
|
begin
|
||||||
|
line := render_plot_create_line (xoffset * scaler, ((r * row_height) + yoffset - 1) * scaler, symbol^.width * scaler, 2.0 * scaler);
|
||||||
|
render_plot_add_line (symbol, line, @last_line);
|
||||||
|
Inc (r);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if (((symbol^.output_options and BARCODE_BOX) <> 0)) or (((symbol^.output_options and BARCODE_BIND) <> 0)) then
|
||||||
|
begin
|
||||||
|
line := render_plot_create_line (0, 0, (symbol^.width + xoffset + xoffset) * scaler, symbol^.border_width * scaler);
|
||||||
|
render_plot_add_line (symbol, line, @last_line);
|
||||||
|
line := render_plot_create_line (0, (symbol^.height + symbol^.border_width) * scaler, (symbol^.width + xoffset + xoffset) * scaler, symbol^.border_width * scaler);
|
||||||
|
render_plot_add_line (symbol, line, @last_line);
|
||||||
|
end;
|
||||||
|
if (symbol^.output_options and BARCODE_BOX) <> 0 then
|
||||||
|
begin
|
||||||
|
line := render_plot_create_line (0, 0, symbol^.border_width * scaler, (symbol^.height + (2 * symbol^.border_width)) * scaler);
|
||||||
|
render_plot_add_line (symbol, line, @last_line);
|
||||||
|
line := render_plot_create_line ((symbol^.width + xoffset + xoffset - symbol^.border_width) * scaler, 0, symbol^.border_width * scaler, (symbol^.height + (2 * symbol^.border_width)) * scaler);
|
||||||
|
render_plot_add_line (symbol, line, @last_line);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
(*
|
||||||
|
if Boolean(locale) then
|
||||||
|
begin
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
end;
|
||||||
|
*)
|
||||||
|
Result:=1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function render_plot_create_line(x: Single; y: Single; width: Single; length: Single): PointerTo_zint_render_line;
|
||||||
|
var
|
||||||
|
line: PointerTo_zint_render_line;
|
||||||
|
begin
|
||||||
|
line := GetMem (SizeOf (zint_render_line));
|
||||||
|
line^.next := nil;
|
||||||
|
line^.x := x;
|
||||||
|
line^.y := y;
|
||||||
|
line^.width := width;
|
||||||
|
line^.length := length;
|
||||||
|
exit (line);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function render_plot_add_line(symbol: PointerTo_zint_symbol; line: PointerTo_zint_render_line; last_line: PointerTo_PointerTo_zint_render_line): Integer;
|
||||||
|
begin
|
||||||
|
if last_line^<>nil then
|
||||||
|
begin
|
||||||
|
(last_line^)^.next := line;
|
||||||
|
end else begin
|
||||||
|
symbol^.rendered^.lines := line;
|
||||||
|
end;
|
||||||
|
last_line^ := line;
|
||||||
|
exit (1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function render_plot_create_ring(x: Single; y: Single; radius: Single; line_width: Single): PointerTo_zint_render_ring;
|
||||||
|
var
|
||||||
|
ring: PointerTo_zint_render_ring;
|
||||||
|
begin
|
||||||
|
ring := GetMem (SizeOf (zint_render_ring));
|
||||||
|
ring^.next := nil;
|
||||||
|
ring^.x := x;
|
||||||
|
ring^.y := y;
|
||||||
|
ring^.radius := radius;
|
||||||
|
ring^.line_width := line_width;
|
||||||
|
exit (ring);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function render_plot_add_ring(symbol: PointerTo_zint_symbol; ring: PointerTo_zint_render_ring; last_ring: PointerTo_PointerTo_zint_render_ring): Integer;
|
||||||
|
begin
|
||||||
|
if last_ring^<>nil then
|
||||||
|
begin
|
||||||
|
(last_ring^)^.next := ring;
|
||||||
|
end else begin
|
||||||
|
symbol^.rendered^.rings := ring;
|
||||||
|
end;
|
||||||
|
last_ring^ := ring;
|
||||||
|
exit (1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function render_plot_create_hexagon(x: Single; y: Single): PointerTo_zint_render_hexagon;
|
||||||
|
var
|
||||||
|
hexagon: PointerTo_zint_render_hexagon;
|
||||||
|
begin
|
||||||
|
hexagon := GetMem (SizeOf (zint_render_hexagon));
|
||||||
|
hexagon^.next := nil;
|
||||||
|
hexagon^.x := x;
|
||||||
|
hexagon^.y := y;
|
||||||
|
exit (hexagon);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function render_plot_add_hexagon(symbol: PointerTo_zint_symbol; hexagon: PointerTo_zint_render_hexagon; last_hexagon: PointerTo_PointerTo_zint_render_hexagon): Integer;
|
||||||
|
begin
|
||||||
|
if last_hexagon^<>nil then
|
||||||
|
begin
|
||||||
|
(last_hexagon^)^.next := hexagon;
|
||||||
|
end else begin
|
||||||
|
symbol^.rendered^.hexagons := hexagon;
|
||||||
|
end;
|
||||||
|
last_hexagon^ := hexagon;
|
||||||
|
exit (1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function render_plot_add_string(symbol: PointerTo_zint_symbol; text: PBYTE; x: Single; y: Single; fsize: Single; width: Single; last_string: PointerTo_PointerTo_zint_render_string): Integer;
|
||||||
|
var
|
||||||
|
pstring: PointerTo_zint_render_string;
|
||||||
|
begin
|
||||||
|
pstring := GetMem (SizeOf (zint_render_string));
|
||||||
|
pstring^.next := nil;
|
||||||
|
pstring^.x := x;
|
||||||
|
pstring^.y := y;
|
||||||
|
pstring^.width := width;
|
||||||
|
pstring^.fsize := fsize;
|
||||||
|
pstring^.length := sysutils.strlen (pchar(text));
|
||||||
|
pstring^.text := GetMem (SizeOf (BYTE) * (sysutils.strlen (pchar(text)) + 1));
|
||||||
|
strcpy (pchar(pstring^.text), pchar(text));
|
||||||
|
if last_string^<>nil then
|
||||||
|
begin
|
||||||
|
(last_string^)^.next := pstring;
|
||||||
|
end else begin
|
||||||
|
symbol^.rendered^.strings := pstring;
|
||||||
|
end;
|
||||||
|
last_string^ := pstring;
|
||||||
|
exit (1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
6857
components/lazbarcodes/src/usjis.pas
Normal file
6857
components/lazbarcodes/src/usjis.pas
Normal file
File diff suppressed because it is too large
Load Diff
245
components/lazbarcodes/src/zint.pp
Normal file
245
components/lazbarcodes/src/zint.pp
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
|
||||||
|
unit zint;
|
||||||
|
interface
|
||||||
|
|
||||||
|
{
|
||||||
|
Automatically converted by H2Pas 1.0.0 from zint.h
|
||||||
|
The following command line parameters were used:
|
||||||
|
zint.h
|
||||||
|
}
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
//{$PACKRECORDS C}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
|
{ zint.h - definitions for libzint
|
||||||
|
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2009 Robin Stuart <robin@zint.org.uk>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
}
|
||||||
|
{$ifndef ZINT_H}
|
||||||
|
{$define ZINT_H}
|
||||||
|
{ C++ extern C conditionnal removed }
|
||||||
|
{ __cplusplus }
|
||||||
|
{ Pointer to next line }
|
||||||
|
|
||||||
|
type
|
||||||
|
zint_render_line = record
|
||||||
|
x : single;
|
||||||
|
y : single;
|
||||||
|
length : single;
|
||||||
|
width : single;
|
||||||
|
next : ^zint_render_line;
|
||||||
|
end;
|
||||||
|
PointerTo_zint_render_line=^zint_render_line;
|
||||||
|
PointerTo_PointerTo_zint_render_line=^PointerTo_zint_render_line;
|
||||||
|
|
||||||
|
{ Suggested string width, may be 0 if none recommended }
|
||||||
|
{ Pointer to next character }
|
||||||
|
zint_render_string = record
|
||||||
|
x : single;
|
||||||
|
y : single;
|
||||||
|
fsize : single;
|
||||||
|
width : single;
|
||||||
|
length : longint;
|
||||||
|
text : ^byte;
|
||||||
|
next : ^zint_render_string;
|
||||||
|
end;
|
||||||
|
PointerTo_zint_render_string=^zint_render_string;
|
||||||
|
PointerTo_PointerTo_zint_render_string=^PointerTo_zint_render_string;
|
||||||
|
|
||||||
|
{ Pointer to next ring }
|
||||||
|
zint_render_ring = record
|
||||||
|
x : single;
|
||||||
|
y : single;
|
||||||
|
radius : single;
|
||||||
|
line_width : single;
|
||||||
|
next : ^zint_render_ring;
|
||||||
|
end;
|
||||||
|
PointerTo_zint_render_ring=^zint_render_ring;
|
||||||
|
PointerTo_PointerTo_zint_render_ring=^PointerTo_zint_render_ring;
|
||||||
|
|
||||||
|
{ Pointer to next hexagon }
|
||||||
|
zint_render_hexagon = record
|
||||||
|
x : single;
|
||||||
|
y : single;
|
||||||
|
next : ^zint_render_hexagon;
|
||||||
|
end;
|
||||||
|
PointerTo_zint_render_hexagon=^zint_render_hexagon;
|
||||||
|
PointerTo_PointerTo_zint_render_hexagon=^PointerTo_zint_render_hexagon;
|
||||||
|
|
||||||
|
{ Pointer to first line }
|
||||||
|
{ Pointer to first string }
|
||||||
|
{ Pointer to first ring }
|
||||||
|
{ Pointer to first hexagon }
|
||||||
|
zint_render = record
|
||||||
|
width : single;
|
||||||
|
height : single;
|
||||||
|
lines : ^zint_render_line;
|
||||||
|
strings : ^zint_render_string;
|
||||||
|
rings : ^zint_render_ring;
|
||||||
|
hexagons : ^zint_render_hexagon;
|
||||||
|
end;
|
||||||
|
PointerTo_zint_render=^zint_render;
|
||||||
|
|
||||||
|
{ Largest symbol is 177x177 QR Code }
|
||||||
|
zint_symbol = record
|
||||||
|
symbology : longint;
|
||||||
|
height : longint;
|
||||||
|
whitespace_width : longint;
|
||||||
|
border_width : longint;
|
||||||
|
output_options : longint;
|
||||||
|
fgcolour : array[0..9] of char;
|
||||||
|
bgcolour : array[0..9] of char;
|
||||||
|
outfile : array[0..255] of char;
|
||||||
|
scale : single;
|
||||||
|
option_1 : longint;
|
||||||
|
option_2 : longint;
|
||||||
|
option_3 : longint;
|
||||||
|
show_hrt : longint;
|
||||||
|
input_mode : longint;
|
||||||
|
text : array[0..127] of byte;
|
||||||
|
rows : longint;
|
||||||
|
width : longint;
|
||||||
|
primary : array[0..127] of char;
|
||||||
|
encoded_data : array[0..177] of array[0..142] of byte;
|
||||||
|
row_height : array[0..177] of longint;
|
||||||
|
errtxt : array[0..99] of char;
|
||||||
|
bitmap : ^char;
|
||||||
|
bitmap_width : longint;
|
||||||
|
bitmap_height : longint;
|
||||||
|
rendered : ^zint_render;
|
||||||
|
end;
|
||||||
|
|
||||||
|
PointerTo_zint_symbol=^zint_symbol;
|
||||||
|
{ Tbarcode 7 codes }
|
||||||
|
|
||||||
|
const
|
||||||
|
BARCODE_CODE11 = 1;
|
||||||
|
BARCODE_C25MATRIX = 2;
|
||||||
|
BARCODE_C25INTER = 3;
|
||||||
|
BARCODE_C25IATA = 4;
|
||||||
|
BARCODE_C25LOGIC = 6;
|
||||||
|
BARCODE_C25IND = 7;
|
||||||
|
BARCODE_CODE39 = 8;
|
||||||
|
BARCODE_EXCODE39 = 9;
|
||||||
|
BARCODE_EANX = 13;
|
||||||
|
BARCODE_EAN128 = 16;
|
||||||
|
BARCODE_CODABAR = 18;
|
||||||
|
BARCODE_CODE128 = 20;
|
||||||
|
BARCODE_DPLEIT = 21;
|
||||||
|
BARCODE_DPIDENT = 22;
|
||||||
|
BARCODE_CODE16K = 23;
|
||||||
|
BARCODE_CODE49 = 24;
|
||||||
|
BARCODE_CODE93 = 25;
|
||||||
|
BARCODE_FLAT = 28;
|
||||||
|
BARCODE_RSS14 = 29;
|
||||||
|
BARCODE_RSS_LTD = 30;
|
||||||
|
BARCODE_RSS_EXP = 31;
|
||||||
|
BARCODE_TELEPEN = 32;
|
||||||
|
BARCODE_UPCA = 34;
|
||||||
|
BARCODE_UPCE = 37;
|
||||||
|
BARCODE_POSTNET = 40;
|
||||||
|
BARCODE_MSI_PLESSEY = 47;
|
||||||
|
BARCODE_FIM = 49;
|
||||||
|
BARCODE_LOGMARS = 50;
|
||||||
|
BARCODE_PHARMA = 51;
|
||||||
|
BARCODE_PZN = 52;
|
||||||
|
BARCODE_PHARMA_TWO = 53;
|
||||||
|
BARCODE_PDF417 = 55;
|
||||||
|
BARCODE_PDF417TRUNC = 56;
|
||||||
|
BARCODE_MAXICODE = 57;
|
||||||
|
BARCODE_QRCODE = 58;
|
||||||
|
BARCODE_CODE128B = 60;
|
||||||
|
BARCODE_AUSPOST = 63;
|
||||||
|
BARCODE_AUSREPLY = 66;
|
||||||
|
BARCODE_AUSROUTE = 67;
|
||||||
|
BARCODE_AUSREDIRECT = 68;
|
||||||
|
BARCODE_ISBNX = 69;
|
||||||
|
BARCODE_RM4SCC = 70;
|
||||||
|
BARCODE_DATAMATRIX = 71;
|
||||||
|
BARCODE_EAN14 = 72;
|
||||||
|
BARCODE_CODABLOCKF = 74;
|
||||||
|
BARCODE_NVE18 = 75;
|
||||||
|
BARCODE_JAPANPOST = 76;
|
||||||
|
BARCODE_KOREAPOST = 77;
|
||||||
|
BARCODE_RSS14STACK = 79;
|
||||||
|
BARCODE_RSS14STACK_OMNI = 80;
|
||||||
|
BARCODE_RSS_EXPSTACK = 81;
|
||||||
|
BARCODE_PLANET = 82;
|
||||||
|
BARCODE_MICROPDF417 = 84;
|
||||||
|
BARCODE_ONECODE = 85;
|
||||||
|
BARCODE_PLESSEY = 86;
|
||||||
|
{ Tbarcode 8 codes }
|
||||||
|
BARCODE_TELEPEN_NUM = 87;
|
||||||
|
BARCODE_ITF14 = 89;
|
||||||
|
BARCODE_KIX = 90;
|
||||||
|
BARCODE_AZTEC = 92;
|
||||||
|
BARCODE_DAFT = 93;
|
||||||
|
BARCODE_MICROQR = 97;
|
||||||
|
{ Tbarcode 9 codes }
|
||||||
|
BARCODE_HIBC_128 = 98;
|
||||||
|
BARCODE_HIBC_39 = 99;
|
||||||
|
BARCODE_HIBC_DM = 102;
|
||||||
|
BARCODE_HIBC_QR = 104;
|
||||||
|
BARCODE_HIBC_PDF = 106;
|
||||||
|
BARCODE_HIBC_MICPDF = 108;
|
||||||
|
BARCODE_HIBC_BLOCKF = 110;
|
||||||
|
BARCODE_HIBC_AZTEC = 112;
|
||||||
|
{ Zint specific }
|
||||||
|
BARCODE_AZRUNE = 128;
|
||||||
|
BARCODE_CODE32 = 129;
|
||||||
|
BARCODE_EANX_CC = 130;
|
||||||
|
BARCODE_EAN128_CC = 131;
|
||||||
|
BARCODE_RSS14_CC = 132;
|
||||||
|
BARCODE_RSS_LTD_CC = 133;
|
||||||
|
BARCODE_RSS_EXP_CC = 134;
|
||||||
|
BARCODE_UPCA_CC = 135;
|
||||||
|
BARCODE_UPCE_CC = 136;
|
||||||
|
BARCODE_RSS14STACK_CC = 137;
|
||||||
|
BARCODE_RSS14_OMNI_CC = 138;
|
||||||
|
BARCODE_RSS_EXPSTACK_CC = 139;
|
||||||
|
BARCODE_CHANNEL = 140;
|
||||||
|
BARCODE_CODEONE = 141;
|
||||||
|
BARCODE_GRIDMATRIX = 142;
|
||||||
|
BARCODE_NO_ASCII = 1;
|
||||||
|
BARCODE_BIND = 2;
|
||||||
|
BARCODE_BOX = 4;
|
||||||
|
BARCODE_STDOUT = 8;
|
||||||
|
READER_INIT = 16;
|
||||||
|
SMALL_TEXT = 32;
|
||||||
|
DATA_MODE = 0;
|
||||||
|
UNICODE_MODE = 1;
|
||||||
|
GS1_MODE = 2;
|
||||||
|
KANJI_MODE = 3;
|
||||||
|
SJIS_MODE = 4;
|
||||||
|
DM_SQUARE = 100;
|
||||||
|
WARN_INVALID_OPTION = 2;
|
||||||
|
ERROR_TOO_LONG = 5;
|
||||||
|
ERROR_INVALID_DATA = 6;
|
||||||
|
ERROR_INVALID_CHECK = 7;
|
||||||
|
ERROR_INVALID_OPTION = 8;
|
||||||
|
ERROR_ENCODING_PROBLEM = 9;
|
||||||
|
ERROR_FILE_ACCESS = 10;
|
||||||
|
ERROR_MEMORY = 11;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
Reference in New Issue
Block a user