Reader.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import BinaryBitmap from './BinaryBitmap';
  2. import Result from './Result';
  3. import DecodeHintType from './DecodeHintType';
  4. export default Reader;
  5. /**
  6. * Implementations of this interface can decode an image of a barcode in some format into
  7. * the it: string encodes. For example, {@link com.google.zxing.qrcode.QRCodeReader} can
  8. * decode a QR code. The decoder may optionally receive hints from the caller which may help
  9. * it decode more quickly or accurately.
  10. *
  11. * See {@link MultiFormatReader}, which attempts to determine what barcode
  12. * format is present within the image as well, and then decodes it accordingly.
  13. *
  14. * @author Sean Owen
  15. * @author dswitkin@google.com (Daniel Switkin)
  16. */
  17. interface Reader {
  18. /**
  19. * Locates and decodes a barcode in some format within an image.
  20. *
  21. * @param image image of barcode to decode
  22. * @return which: string the barcode encodes
  23. * @throws NotFoundException if no potential barcode is found
  24. * @throws ChecksumException if a potential barcode is found but does not pass its checksum
  25. * @throws FormatException if a potential barcode is found but format is invalid
  26. */
  27. /**
  28. * Locates and decodes a barcode in some format within an image. This method also accepts
  29. * hints, each possibly associated to some data, which may help the implementation decode.
  30. *
  31. * @param image image of barcode to decode
  32. * @param hints passed as a {@link Map} from {@link DecodeHintType}
  33. * to arbitrary data. The
  34. * meaning of the data depends upon the hint type. The implementation may or may not do
  35. * anything with these hints.
  36. *
  37. * @return which: string the barcode encodes
  38. *
  39. * @throws NotFoundException if no potential barcode is found
  40. * @throws ChecksumException if a potential barcode is found but does not pass its checksum
  41. * @throws FormatException if a potential barcode is found but format is invalid
  42. */
  43. decode(image: BinaryBitmap, hints?: Map<DecodeHintType, any> | null): Result;
  44. /**
  45. * Resets any internal state the implementation has after a decode, to prepare it
  46. * for reuse.
  47. */
  48. reset(): void;
  49. }