Created
January 22, 2021 09:31
-
-
Save mutterer/b4193c05cbe4ad6cce1fd88c891cf7d4 to your computer and use it in GitHub Desktop.
Scrolls some demo text in ImageJ tool icons
This file contains 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
// scrolls some demo text in tool icons | |
// install then press play icon | |
function start() { | |
setBatchMode(1); | |
call("ij.gui.Toolbar.setIcon", "T0 Action Tool", "D00"); | |
id = makeTemplate("ImageJ "+IJ.getFullVersion); | |
width=getWidth-24; | |
for (w=0;w<width*2;w=w+2){ | |
for (t=0;t<7;t++) { | |
call("ij.gui.Toolbar.setIcon", "T"+t+" Action Tool", getIcon(id,(t*24+w)%width)); | |
wait(4); | |
} | |
} | |
} | |
function getIcon(template,x0) { | |
selectImage(template); | |
ts = 'N44'; | |
for (x=x0; x<(x0+24); x++) { | |
for (y=0; y<24; y++) { | |
if (getPixel(x,y)==0) | |
ts = ts+"D"+toExtHex(x-x0)+toExtHex(y); | |
} | |
} | |
return ts; | |
} | |
function toExtHex(n) { | |
if (n>15) return fromCharCode(0x66+n-15); | |
else return toHex(n); | |
} | |
function makeTemplate(s) { | |
newImage("Untitled", "RGB White", 24*12, 24, 1); | |
setForegroundColor(255, 0, 0); | |
setFont("SansSerif", 18, ""); | |
setColor("black"); | |
drawString(s,24,24); | |
run("8-bit Color", "number=2"); | |
return getImageID; | |
} | |
macro"T0 Action Tool - C393N44H000nnc"{start();} | |
macro"T1 Action Tool - C000 "{} | |
macro"T2 Action Tool - C000 "{} | |
macro"T3 Action Tool - C000 "{} | |
macro"T4 Action Tool - C000 "{} | |
macro"T5 Action Tool - C000 "{} | |
macro"T6 Action Tool - C000 "{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment