JFLib

plat/apple_mac_scan.rs (Apple)#

Source: lib/plat/apple_mac_scan.rs

apple_mac_scan -- (scan.rs) macOS's scan dialog: ImageKit over ImageCaptureCore

  available() -> bool            ImageKit's scanner view is there (Quartz.framework, loaded at
                                 the first use)
  start(title) -> Result         a window of its own: IKDeviceBrowserView (local and network
                                 scanners, no cameras) beside IKScannerDeviceView (the dialog
                                 Preview shows: overview, area, resolution, format, "Scan")
  mac_scan_shown() / mac_scan_close()   (tests) the window on screen, closed as by its close
                                 button

The device chosen in the browser goes to the scanner view (its document UTI set to PNG first;
the view's format menu may change it).  The view scans into a folder of its own below the temp
folder (file-based transfer); the first file it reports is read, removed and answered, and the
window closes.  Closing the window without a scan answers Cancelled; an error of the scan
answers Failed.  Everything runs on the main thread; the delegate is one object for the
process.
  • fn mac_scan_shown() -> bool (tests) the scan window is on screen

  • fn mac_scan_close() -> bool (tests) the scan window closed as by its close button -> false when none is open

Source: docs/API.md in the JFLib repository.