ScBarcodeGenerator Struct Reference

Public Member Functions

ScBarcodeGeneratorsc_barcode_generator_new (ScRecognitionContext const *context, ScSymbology symbology, ScError *out_error)
 
ScBarcodeGeneratorsc_barcode_generator_new_with_options (ScRecognitionContext const *context, ScSymbology symbology, char const *json_options, ScError *out_error)
 
void sc_barcode_generator_set_options (ScBarcodeGenerator *generator, char const *json_options, ScError *out_error)
 
void sc_barcode_generator_free (ScBarcodeGenerator *generator)
 
ScImageBuffersc_barcode_generator_generate (ScBarcodeGenerator const *generator, uint8_t const *data, size_t data_length, ScEncodingArray const encoding, ScError *out_error)
 

Detailed Description

A 1d/2d barcode generator.

Barcode generators are classes that encode a sequence of bytes into an image in the form of a barcode/2d code that then can be read by a barcode scanner.

Since
5.8.0

Member Function Documentation

ScBarcodeGenerator * sc_barcode_generator_new ( ScRecognitionContext const *  context,
ScSymbology  symbology,
ScError out_error 
)

Create a new barcode generator instance for the given symbology.

The barcode generator is initialized with default options for the symbology. If you want to pass other options during construction, use sc_barcode_generator_new_with_options.

Parameters
contextThe recognition context. Must not be null.
symbologyBarcode symbology to generate
out_errorOptional error output object. Can be null.

Upon failure, out_error is filled with a more specific reason for failure and must be freed again using sc_error_free.

Returns
The newly created generator, or null in case of error.
Since
5.8.0
ScBarcodeGenerator * sc_barcode_generator_new_with_options ( ScRecognitionContext const *  context,
ScSymbology  symbology,
char const *  json_options,
ScError out_error 
)

Create a new barcode generator instance for the given symbology and options.

Parameters
contextThe recognition context. Must not be null.
symbologyBarcode symbology to generate.
json_optionsConfiguration options in JSON format.
out_errorOptional error output object. Can be null.

Upon failure, out_error is filled with a more specific reason for failure and must be freed again using sc_error_free.

Returns
The newly created generator, or null in case of error.
Since
5.8.0
void sc_barcode_generator_set_options ( ScBarcodeGenerator generator,
char const *  json_options,
ScError out_error 
)

sets the options on a given barcode generator

Parameters
generatorThe barcode generator. Must not be null.
json_optionsConfiguration options in JSON format.
out_errorOptional error output object. Can be null.

Upon failure, out_error is filled with a more specific reason for failure and must be freed again using sc_error_free.

Since
5.8.0

For a description of the JSON format understood by this function, see Barcode Generator Settings JSON format.

void sc_barcode_generator_free ( ScBarcodeGenerator generator)

Free a previously instantiated barcode generator. May be null.

Parameters
generatorThe barcode generator to free. Can be null.
Since
5.8.0
ScImageBuffer * sc_barcode_generator_generate ( ScBarcodeGenerator const *  generator,
uint8_t const *  data,
size_t  data_length,
ScEncodingArray const  encoding,
ScError out_error 
)

Generates an image containing a barcode encoding the provided data.

Parameters
generatorthe generator instance, must not be null
dataPointer to the beginning of the input data.
data_lengththe number of bytes of the input data.
encodingoptional array that describes what encoding to use for which part of the data. It's possible to pass NULL as this parameter.
out_errorUpon failure contains a more detailed reason for failure. In case of error, this must be freed again using sc_error_free.
Returns
The image RGBA generated by the barcode generator.
Since
5.8.0

The documentation for this struct was generated from the following file: