public void refreshBackground(boolean backgroundInFront) { //Boundary for Background Selection setColor(0x444444); drawRect((w*2)-12, 276, (w*2)+4, (h*2)+4); setColor(0x999999); drawRect((w*2)-11, 277, (w*2)+2, (h*2)+2); setRoi((w*2)-10, 278, w*2, h*2);//Paints the Background Color Color bg = Toolbar.getBackgroundColor(); setColor(bg); fill(); if (backgroundInFront) drawLabel("B", bg, w*4-18, 278+h*2); }
void flipper() { //Paints the Flipper Button int xa = 90; int ya = 272; setColor(0x000000); drawLine(xa, ya, xa+9, ya+9);//Main Body drawLine(xa+1, ya, xa+9, ya+8); drawLine(xa, ya+1, xa+8, ya+9); drawLine(xa, ya, xa, ya+5);//Upper Arrow drawLine(xa+1, ya+1, xa+1, ya+6); drawLine(xa, ya, xa+5, ya); drawLine(xa+1, ya+1, xa+6, ya+1); drawLine(xa+9, ya+9, xa+9, ya+4);//Lower Arrow drawLine(xa+8, ya+8, xa+8, ya+3); drawLine(xa+9, ya+9, xa+4, ya+9); drawLine(xa+8, ya+8, xa+3, ya+8); }
void drawColors(int colorWidth, int colorHeight, int columns, int rows) { w = colorWidth; h = colorHeight; setColor(0xffffff); setRoi(0, 0, 110, 320); fill(); drawRamp(); resetBW(); flipper(); drawLine(0, 256, 110, 256); refreshBackground(false); refreshForeground(false); setRoi(x*(int)(w/2), y*(int)(h/2), (int)w/2, (int)h/2); setColor(c); fill(); drawSpectrum(h); resetRoi();
private void drawLabel(String label, Color c, int x, int y) { int intensity = (c.getRed()+c.getGreen()+c.getBlue())/3; c = intensity<128?Color.white:Color.black; setColor(c); drawString(label, x, y); }
addKeyListener(IJ.getInstance()); setLayout(new BorderLayout()); ColorGenerator cg = new ColorGenerator(width, height, new int[width*height]); cg.drawColors(colorWidth, colorHeight, columns, rows); Canvas colorCanvas = new ColorCanvas(width, height, null, cg); Panel panel = new Panel();
public void paint(Graphics g) { g.drawImage(ip.createImage(), 0, 0, null); }
void drawColors(int colorWidth, int colorHeight, int columns, int rows) { w = colorWidth; h = colorHeight; setColor(0xffffff); setRoi(0, 0, 110, 320); fill(); drawRamp(); resetBW(); flipper(); drawLine(0, 256, 110, 256); refreshBackground(false); refreshForeground(false); setRoi(x*(int)(w/2), y*(int)(h/2), (int)w/2, (int)h/2); setColor(c); fill(); drawSpectrum(h); resetRoi();
private void drawLabel(String label, Color c, int x, int y) { int intensity = (c.getRed()+c.getGreen()+c.getBlue())/3; c = intensity<128?Color.white:Color.black; setColor(c); drawString(label, x, y); }
addKeyListener(IJ.getInstance()); setLayout(new BorderLayout()); ColorGenerator cg = new ColorGenerator(width, height, new int[width*height]); cg.drawColors(colorWidth, colorHeight, columns, rows); Canvas colorCanvas = new ColorCanvas(width, height, null, cg); Panel panel = new Panel();
public void paint(Graphics g) { g.drawImage(ip.createImage(), 0, 0, null); }
void drawSpectrum(double h) { Color c; for ( int x=5; x<7; x++) { for ( int y=0; y<32; y++) { float hue = (float)(y/(2*h)-.15); c = Color.getHSBColor(hue, 1f, 1f); setRoi(x*(int)(w/2), y*(int)(h/2), (int)w/2, (int)h/2); setColor(c); fill(); } } setRoi(55, 32, 22, 16); //Solid red setColor(0xff0000); fill(); setRoi(55, 120, 22, 16); //Solid green setColor(0x00ff00); fill(); setRoi(55, 208, 22, 16); //Solid blue setColor(0x0000ff); fill(); setRoi(55, 80, 22, 8); //Solid yellow setColor(0xffff00); fill(); setRoi(55, 168, 22, 8); //Solid cyan setColor(0x00ffff); fill(); setRoi(55, 248, 22, 8); //Solid magenta setColor(0xff00ff); fill(); }
void flipper() { //Paints the Flipper Button int xa = 90; int ya = 272; setColor(0x000000); drawLine(xa, ya, xa+9, ya+9);//Main Body drawLine(xa+1, ya, xa+9, ya+8); drawLine(xa, ya+1, xa+8, ya+9); drawLine(xa, ya, xa, ya+5);//Upper Arrow drawLine(xa+1, ya+1, xa+1, ya+6); drawLine(xa, ya, xa+5, ya); drawLine(xa+1, ya+1, xa+6, ya+1); drawLine(xa+9, ya+9, xa+9, ya+4);//Lower Arrow drawLine(xa+8, ya+8, xa+8, ya+3); drawLine(xa+9, ya+9, xa+4, ya+9); drawLine(xa+8, ya+8, xa+3, ya+8); }
void drawSpectrum(double h) { Color c; for ( int x=5; x<7; x++) { for ( int y=0; y<32; y++) { float hue = (float)(y/(2*h)-.15); c = Color.getHSBColor(hue, 1f, 1f); setRoi(x*(int)(w/2), y*(int)(h/2), (int)w/2, (int)h/2); setColor(c); fill(); } } setRoi(55, 32, 22, 16); //Solid red setColor(0xff0000); fill(); setRoi(55, 120, 22, 16); //Solid green setColor(0x00ff00); fill(); setRoi(55, 208, 22, 16); //Solid blue setColor(0x0000ff); fill(); setRoi(55, 80, 22, 8); //Solid yellow setColor(0xffff00); fill(); setRoi(55, 168, 22, 8); //Solid cyan setColor(0x00ffff); fill(); setRoi(55, 248, 22, 8); //Solid magenta setColor(0xff00ff); fill(); }
public void refreshForeground(boolean backgroundInFront) { //Boundary for Foreground Selection setColor(0x444444); drawRect(8, 266, (w*2)+4, (h*2)+4); setColor(0x999999); drawRect(9, 267, (w*2)+2, (h*2)+2); setRoi(10, 268, w*2, h*2); //Paints the Foreground Color Color fg = Toolbar.getForegroundColor(); setColor(fg); fill(); if (backgroundInFront) drawLabel("F", fg, 12, 268+14); }
public void refreshBackground(boolean backgroundInFront) { //Boundary for Background Selection setColor(0x444444); drawRect((w*2)-12, 276, (w*2)+4, (h*2)+4); setColor(0x999999); drawRect((w*2)-11, 277, (w*2)+2, (h*2)+2); setRoi((w*2)-10, 278, w*2, h*2);//Paints the Background Color Color bg = Toolbar.getBackgroundColor(); setColor(bg); fill(); if (backgroundInFront) drawLabel("B", bg, w*4-18, 278+h*2); }
public void refreshForeground(boolean backgroundInFront) { //Boundary for Foreground Selection setColor(0x444444); drawRect(8, 266, (w*2)+4, (h*2)+4); setColor(0x999999); drawRect(9, 267, (w*2)+2, (h*2)+2); setRoi(10, 268, w*2, h*2); //Paints the Foreground Color Color fg = Toolbar.getForegroundColor(); setColor(fg); fill(); if (backgroundInFront) drawLabel("F", fg, 12, 268+14); }