(int mode)
| 518 | } |
| 519 | |
| 520 | public synchronized void setMode(int mode) { |
| 521 | if (mode<COMPOSITE || mode>GRAYSCALE) |
| 522 | return; |
| 523 | if (mode==COMPOSITE && getNChannels()>MAX_CHANNELS) |
| 524 | mode = COLOR; |
| 525 | if (!(mode==COMPOSITE && mode==this.mode)) { |
| 526 | for (int i=0; i<MAX_CHANNELS; i++) |
| 527 | active[i] = true; |
| 528 | } |
| 529 | if (this.mode!=COMPOSITE && mode==COMPOSITE) |
| 530 | img = null; |
| 531 | this.mode = mode; |
| 532 | if (mode==COLOR || mode==GRAYSCALE) { |
| 533 | if (cip!=null) { |
| 534 | for (int i=0; i<cip.length; i++) { |
| 535 | if (cip[i]!=null) cip[i].setPixels(null); |
| 536 | cip[i] = null; |
| 537 | } |
| 538 | } |
| 539 | cip = null; |
| 540 | rgbPixels = null; |
| 541 | awtImage = null; |
| 542 | currentChannel = -1; |
| 543 | } |
| 544 | if (mode==GRAYSCALE || mode==TRANSPARENT) |
| 545 | ip.setColorModel(ip.getDefaultColorModel()); |
| 546 | Channels.updateChannels(); |
| 547 | } |
| 548 | |
| 549 | public int getMode() { |
| 550 | return mode; |
no test coverage detected