Table of Contents

Class OneDimensionalCodeWriter

Namespace
ZXing.OneD
Assembly
zxing.dll

Encapsulates functionality and implementation that is common to one-dimensional barcodes.

dsbnatut@gmail.com (Kazuki Nishiura)
public abstract class OneDimensionalCodeWriter : Writer
Inheritance
OneDimensionalCodeWriter
Implements
Derived
Inherited Members

Constructors

OneDimensionalCodeWriter()

protected OneDimensionalCodeWriter()

Properties

DefaultMargin

Gets the default margin.

public int DefaultMargin { get; }

Property Value

int

SupportedWriteFormats

returns supported formats

protected abstract IList<BarcodeFormat> SupportedWriteFormats { get; }

Property Value

IList<BarcodeFormat>

Methods

CalculateChecksumDigitModulo10(string)

Calculates the checksum digit modulo10.

public static string CalculateChecksumDigitModulo10(string contents)

Parameters

contents string

The contents.

Returns

string

appendPattern(bool[], int, int[], bool)

Appends the given pattern to the target array starting at pos.

protected static int appendPattern(bool[] target, int pos, int[] pattern, bool startColor)

Parameters

target bool[]

encode black/white pattern into this array

pos int

position to start encoding at in target

pattern int[]

lengths of black/white runs to encode

startColor bool

starting color - false for white, true for black

Returns

int

the number of elements added to target.

checkNumeric(string)

Throw ArgumentException if input contains characters other than digits 0-9.

protected static void checkNumeric(string contents)

Parameters

contents string

string to check for numeric characters

Exceptions

ArgumentException

if input contains characters other than digits 0-9.

encode(string)

Encode the contents to boolean array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included.

public abstract bool[] encode(string contents)

Parameters

contents string

barcode contents to encode

Returns

bool[]

a bool[] of horizontal pixels (false = white, true = black)

encode(string, IDictionary<EncodeHintType, object>)

Can be overwritten if the encode requires to read the hints map. Otherwise it defaults to {@code encode}.

protected virtual bool[] encode(string contents, IDictionary<EncodeHintType, object> hints)

Parameters

contents string

barcode contents to encode

hints IDictionary<EncodeHintType, object>

encoding hints

Returns

bool[]

a bool[] of horizontal pixels (false = white, true = black)

encode(string, BarcodeFormat, int, int)

Encode a barcode using the default settings.

public BitMatrix encode(string contents, BarcodeFormat format, int width, int height)

Parameters

contents string

The contents to encode in the barcode

format BarcodeFormat

The barcode format to generate

width int

The preferred width in pixels

height int

The preferred height in pixels

Returns

BitMatrix

The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white)

encode(string, BarcodeFormat, int, int, IDictionary<EncodeHintType, object>)

Encode the contents following specified format. {@code width} and {@code height} are required size. This method may return bigger size {@code BitMatrix} when specified size is too small. The user can set both {@code width} and {@code height} to zero to get minimum size barcode. If negative value is set to {@code width} or {@code height}, {@code IllegalArgumentException} is thrown.

public virtual BitMatrix encode(string contents, BarcodeFormat format, int width, int height, IDictionary<EncodeHintType, object> hints)

Parameters

contents string
format BarcodeFormat
width int
height int
hints IDictionary<EncodeHintType, object>

Returns

BitMatrix