Trait rxing::oned::OneDimensionalCodeWriter
source · 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§
sourcefn encode_oned(&self, contents: &str) -> Result<Vec<bool>>
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§
sourcefn encode_oned_with_hints(
&self,
contents: &str,
_hints: &EncodingHintDictionary
) -> Result<Vec<bool>>
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)
fn getSupportedWriteFormats(&self) -> Option<Vec<BarcodeFormat>>
sourcefn renderRXingResult(
code: &[bool],
width: i32,
height: i32,
sidesMargin: u32
) -> Result<BitMatrix>
fn renderRXingResult( code: &[bool], width: i32, height: i32, sidesMargin: u32 ) -> Result<BitMatrix>
@return a byte array of horizontal pixels (0 = white, 1 = black)
sourcefn checkNumeric(contents: &str) -> Result<()>
fn checkNumeric(contents: &str) -> Result<()>
@param contents string to check for numeric characters @throws IllegalArgumentException if input contains characters other than digits 0-9.
sourcefn appendPattern<T: TryInto<usize> + Copy>(
target: &mut [bool],
pos: usize,
pattern: &[T],
startColor: bool
) -> u32
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.