pub trait Writer {
fn encode(
&self,
contents: &str,
format: &BarcodeFormat,
width: i32,
height: i32
) -> Result<BitMatrix, Exceptions>;
fn encode_with_hints(
&self,
contents: &str,
format: &BarcodeFormat,
width: i32,
height: i32,
hints: &EncodingHintDictionary
) -> Result<BitMatrix, Exceptions>;
}Expand description
The base class for all objects which encode/generate a barcode image.
@author dswitkin@google.com (Daniel Switkin)
Required Methods§
sourcefn encode(
&self,
contents: &str,
format: &BarcodeFormat,
width: i32,
height: i32
) -> Result<BitMatrix, Exceptions>
fn encode(
&self,
contents: &str,
format: &BarcodeFormat,
width: i32,
height: i32
) -> Result<BitMatrix, Exceptions>
Encode a barcode using the default settings.
@param contents The contents to encode in the barcode @param format The barcode format to generate @param width The preferred width in pixels @param height The preferred height in pixels @return {@link BitMatrix} representing encoded barcode image @throws WriterException if contents cannot be encoded legally in a format
sourcefn encode_with_hints(
&self,
contents: &str,
format: &BarcodeFormat,
width: i32,
height: i32,
hints: &EncodingHintDictionary
) -> Result<BitMatrix, Exceptions>
fn encode_with_hints(
&self,
contents: &str,
format: &BarcodeFormat,
width: i32,
height: i32,
hints: &EncodingHintDictionary
) -> Result<BitMatrix, Exceptions>
@param contents The contents to encode in the barcode @param format The barcode format to generate @param width The preferred width in pixels @param height The preferred height in pixels @param hints Additional parameters to supply to the encoder @return {@link BitMatrix} representing encoded barcode image @throws WriterException if contents cannot be encoded legally in a format