Revision 13355

View differences:

trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/imagenavigator/ImageNavigator.java
27 27
import java.awt.Image;
28 28
import java.awt.Point;
29 29
import java.awt.RenderingHints;
30
import java.awt.color.ColorSpace;
30 31
import java.awt.event.KeyEvent;
31 32
import java.awt.event.KeyListener;
32 33
import java.awt.event.MouseEvent;
......
34 35
import java.awt.event.MouseMotionListener;
35 36
import java.awt.event.MouseWheelEvent;
36 37
import java.awt.event.MouseWheelListener;
38
import java.awt.image.BufferedImage;
39
import java.awt.image.ColorConvertOp;
37 40

  
38 41
import javax.swing.ImageIcon;
39 42
import javax.swing.JComponent;
......
369 372
		updateWidth = getWidgetImage().getWidth(this);
370 373
		updateHeight = getWidgetImage().getHeight(this);
371 374

  
372
		if (!isEnabled()) {
373
			getCacheGraphics().setColor(new Color(224, 224, 224));
374
			getCacheGraphics().fillRect(0, 0, width, height);
375
			return;
376
		}
377
		
378 375
		if (showBackground) {
379 376
			for (int i = 0; (i * 4) <= width; i++) {
380 377
				for (int j = 0; (j * 4) <= height; j++) {
......
451 448
	 * Redibujar el componente en el graphics temporal
452 449
	 */
453 450
	private void redrawBuffer(int x, int y) {
454
		if (!isEnabled()) {
455
			getWidgetGraphics().setColor(new Color(224, 224, 224));
456
			getWidgetGraphics().fillRect(0, 0, width, height);
457
			return;
458
		}
459
		
460 451
		if (showBackground) {
461 452
			for (int i = -2; ((i - 2) * 4) <= width; i++) {
462 453
				for (int j = -2; ((j - 2) * 4) <= height; j++) {
......
495 486

  
496 487
		redrawBuffer(0, 0);
497 488

  
498
		if (image != null)
499
			g.drawImage(image, 0, 0, this);
489
		if (image != null) {
490
			if (isEnabled()) {
491
				g.drawImage(image, 0, 0, this);
492
			} else {
493
				// Dibujar en escala de grises y aclarado para cuando esta inactivo
494
		  	BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
500 495

  
501
//		paintHelp((Graphics2D) g);
496
				Graphics big = bi.createGraphics();
497
				big.drawImage(image, 0, 0, this);
498

  
499
				ColorConvertOp colorConvert = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
500
				colorConvert.filter(bi, bi);
501

  
502
				big.setColor(new Color(255, 255, 255, 164));
503
				big.fillRect(0, 0, width, height);
504

  
505
				g.drawImage(bi, getVisibleRect().x, getVisibleRect().y, this);
506
			}
507
		}
502 508
	}
503 509

  
504 510
	/**

Also available in: Unified diff