deps: the ink layer of a scanned page, and a check that can see it - #14
Merged
Conversation
The workbench was eight releases behind on the renderer, so none of the work on scanned pages reached anybody. render v0.19.0 brings the JBIG2 mask that gives a scanned page's ink its shape, the JPEG 2000 background under it, and optional content; gfx v0.15.0 brings the JBIG2 decoder those go through. Handed a real scanned document, the browser check then said the page never arrived. It had. It counted a pixel as dark when its three channels sum to under 240 — an average under 80, which is nearly black. That is the right question for telling a lit control from an unlit one, which is what it was written for. It is the wrong question for a page: scanned text scaled down to fit a window is GREY. The same page counts 1805 pixels dark by luminance and 9 by that sum, and the empty workbench's own strip and borders have 453, which the page then covers. So a correctly drawn scanned document read as never having arrived. The canvas now also counts ink — dark the way text is dark — and a document is seen to arrive when the canvas changed, more of it is drawn on than before, and there is more ink than the workbench's own furniture. Nearly black is still counted, and still used for what it is good at. Checked both ways: the synthetic document still passes, and a 1556x2439 scanned medical page now opens and saves back out at 3 106 224 bytes. 100% statement coverage, go vet and -race clean, the wasm build, and the browser check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The workbench was eight releases behind on the renderer, so none of the work on scanned pages reached anybody. render v0.19.0 brings the JBIG2 mask that gives a scanned page's ink its shape, the JPEG 2000 background under it, and optional content; gfx v0.15.0 brings the JBIG2 decoder those go through.
Handed a real scanned document, the browser check then said the page never arrived. It had.
It counted a pixel as dark when its three channels sum to under 240 — an average under 80, which is nearly black. That is the right question for telling a lit control from an unlit one, which is what it was written for. It is the wrong question for a page: scanned text scaled down to fit a window is grey.
The page covers that furniture, so a correctly drawn scanned document read as never having arrived.
The canvas now also counts ink — dark the way text is dark — and a document is seen to arrive when the canvas changed, more of it is drawn on than before, and there is more ink than the workbench's own furniture. Nearly black is still counted, and still used for what it is good at.
Checked both ways: the synthetic document still passes, and a 1556x2439 scanned medical page now opens and saves back out at 3 106 224 bytes.
Supersedes #13, which stopped at render v0.14.0.