Writer.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. import BitMatrix from './common/BitMatrix';
  2. import BarcodeFormat from './BarcodeFormat';
  3. import EncodeHintType from './EncodeHintType';
  4. export default Writer;
  5. /**
  6. * The base class for all objects which encode/generate a barcode image.
  7. *
  8. * @author dswitkin@google.com (Daniel Switkin)
  9. */
  10. interface Writer {
  11. /**
  12. * Encode a barcode using the default settings.
  13. *
  14. * @param contents The contents to encode in the barcode
  15. * @param format The barcode format to generate
  16. * @param width The preferred width in pixels
  17. * @param height The preferred height in pixels
  18. * @return {@link BitMatrix} representing encoded barcode image
  19. * @throws WriterException if contents cannot be encoded legally in a format
  20. */
  21. /**
  22. * @param contents The contents to encode in the barcode
  23. * @param format The barcode format to generate
  24. * @param width The preferred width in pixels
  25. * @param height The preferred height in pixels
  26. * @param hints Additional parameters to supply to the encoder
  27. * @return {@link BitMatrix} representing encoded barcode image
  28. * @throws WriterException if contents cannot be encoded legally in a format
  29. */
  30. encode(contents: string, format: BarcodeFormat, width: number, height: number, hints: Map<EncodeHintType, any>): BitMatrix;
  31. }