pub trait OneDimensionalCodeWriter: Writer {
    // Required method
    fn encode_oned(&self, contents: &str) -> Result<Vec<bool>>;

    // Provided methods
    fn encode_oned_with_hints(
        &self,
        contents: &str,
        _hints: &EncodingHintDictionary
    ) -> Result<Vec<bool>> { ... }
    fn getSupportedWriteFormats(&self) -> Option<Vec<BarcodeFormat>> { ... }
    fn renderRXingResult(
        code: &[bool],
        width: i32,
        height: i32,
        sidesMargin: u32
    ) -> Result<BitMatrix> { ... }
    fn checkNumeric(contents: &str) -> Result<()> { ... }
    fn appendPattern<T: TryInto<usize> + Copy>(
        target: &mut [bool],
        pos: usize,
        pattern: &[T],
        startColor: bool
    ) -> u32 { ... }
    fn getDefaultMargin(&self) -> u32 { ... }
}
Expand description

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

@author dsbnatut@gmail.com (Kazuki Nishiura)

Required Methods§

source

fn encode_oned(&self, contents: &str) -> Result<Vec<bool>>

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.

@param contents barcode contents to encode @return a {@code boolean[]} of horizontal pixels (false = white, true = black)

Provided Methods§

source

fn encode_oned_with_hints( &self, contents: &str, _hints: &EncodingHintDictionary ) -> Result<Vec<bool>>

Can be overwritten if the encode requires to read the hints map. Otherwise it defaults to {@code encode}. @param contents barcode contents to encode @param hints encoding hints @return a {@code boolean[]} of horizontal pixels (false = white, true = black)

source

fn getSupportedWriteFormats(&self) -> Option<Vec<BarcodeFormat>>

source

fn renderRXingResult( code: &[bool], width: i32, height: i32, sidesMargin: u32 ) -> Result<BitMatrix>

@return a byte array of horizontal pixels (0 = white, 1 = black)

source

fn checkNumeric(contents: &str) -> Result<()>

@param contents string to check for numeric characters @throws IllegalArgumentException if input contains characters other than digits 0-9.

source

fn appendPattern<T: TryInto<usize> + Copy>( target: &mut [bool], pos: usize, pattern: &[T], startColor: bool ) -> u32

@param target encode black/white pattern into this array @param pos position to start encoding at in {@code target} @param pattern lengths of black/white runs to encode @param startColor starting color - false for white, true for black @return the number of elements added to target.

source

fn getDefaultMargin(&self) -> u32

Implementors§