I’m trying to improve use of the paintbrush tool in a custom application.
The documentation that I find on the web does not agree with the behavior I’m seeing. So…I would appreciate a few pointers. So far, we are using the standard ImageJ interface to select colors, paintbrush widths, and draw. No custom plugin…yet. I think a few one-keystroke shortcuts should do the trick. My user wants to switch easily among 3 different paintbrush diameters, and two colors. Ideally, I’d like to provide 1 keystroke shortcuts for “small, medium, large” and “black, white”. The version I’m using pops up a dialog box that requires typing in the paintbrush width. It does not seem to record. Changing colors is less critical - my user typically uses the “dropper” tool to select a color (it’s a binary image). So…any hints on how to write a macro, or other flavor of shortcut that can: a) select “paintbrush width = 10” / 25 / 50 or b) select “paintbrush color = 255” / 0 My goal is to keep the cursor in one spot, and one hand on the keyboard, for one-keystroke commands. Pointing and clicking, or (worse) typing a number, is to be avoided, if possible. -- Kenneth Sloan [hidden email] "La lutte elle-même vers les sommets suffit à remplir un coeur d'homme; il faut imaginer Sisyphe heureux." -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On May 15, 2014, at 3:09 PM, Kenneth Sloan wrote:
> I’m trying to improve use of the paintbrush tool in a custom application. > The documentation that I find on the web does not agree with the behavior I’m seeing. > So…I would appreciate a few pointers. > > So far, we are using the standard ImageJ interface to select colors, paintbrush widths, and > draw. No custom plugin…yet. I think a few one-keystroke shortcuts should do the trick. > > My user wants to switch easily among 3 different paintbrush diameters, and two > colors. Ideally, I’d like to provide 1 keystroke shortcuts for “small, medium, large” and “black, white”. Here is a macro set that sets the brush size to 10 when you type "1", 25 when you type "2" and 50 when you type "3", and it sets the color to black when you type "4" and to white when you type "5". It works with the built in brush tool that is installed by selecting "Brush" from the toolbars's ">>" menu. It requires the latest ImageJ daily build (1.49b2). macro "Small [1]" {call("ij.plugin.tool.BrushTool.setBrushWidth",10);} macro "Medium [2]" {call("ij.plugin.tool.BrushTool.setBrushWidth",25);} macro "Large [3]" {call("ij.plugin.tool.BrushTool.setBrushWidth",50);} macro "Black [4]" {setForegroundColor(0,0,0);} macro "White [5]" {setForegroundColor(255,255,255);} -wayne > The version I’m using pops up a dialog box that requires typing in the paintbrush width. It does > not seem to record. > > Changing colors is less critical - my user typically uses the “dropper” tool to select a color > (it’s a binary image). > > So…any hints on how to write a macro, or other flavor of shortcut that can: > > a) select “paintbrush width = 10” / 25 / 50 > or > b) select “paintbrush color = 255” / 0 > > My goal is to keep the cursor in one spot, and one hand on the keyboard, for one-keystroke commands. > Pointing and clicking, or (worse) typing a number, is to be avoided, if possible. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |