apsexton / bateman-ocr

Tools and experiments in the OCR of the Bateman Manuscripts
ISC License
0 stars 5 forks source link

Add toggle action to switch between loaded image and generated image #7

Open apsexton opened 8 years ago

apsexton commented 8 years ago

Add a toggle action with an appropriate accelerator key, and connect it to the menu and the toolbar to switch between displaying the loaded image in the canvas and not displaying a generated image.

The idea is that, if an image has been loaded, then this action becomes enabled. Then triggering it, by clicking on the button, will disable drawing the image on the canvas and instead not draw anything else in its place. In a later task this will be changed to generating and drawing a different image.

If the action is triggered again, it goes back to displaying the loaded image (the image does not need to be reloaded, merely redrawn)

Care should be taken to only have the toggle action enabled when an image is loaded.

kevinshen100 commented 8 years ago

Hi, Could I have a clarification on what this button does when it is enabled? I don't quite understand what you mean by "disable drawing the image on the canvas and instead not draw anything else in its place." Do you mean clearing out the canvas and making it blank?

apsexton commented 8 years ago

This is in preparation for issue #8. The idea is that there are two ways to display the same image, one is to display the image of the full page that was loaded from the image file. The second is to draw all the connected components (CCs)that were extracted from the page image in their correct places. The toggle feature switches from one way to the other. Once the page image and all the CC images have been loaded, switching via the toggle should be very quick and doing so should very quickly and visibly show any errors in drawing the CCs.

For the current task, simply either draw or not draw the page image when repainting the canvas depending on the current state of the toggle.