javax.swing.GrayFilter Java Examples

The following examples show how to use javax.swing.GrayFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LRIcon.java    From scelight with Apache License 2.0 6 votes vote down vote up
@Override
public Image getGrayedImage( final boolean cache ) {
	Image grayedImage = this.grayedImage;
	if ( grayedImage == null ) {
		grayedImage = GrayFilter.createDisabledImage( get( cache ).getImage() );
		if ( cache )
			this.grayedImage = grayedImage;
		
		// The Java image API uses asynchronous image processing, wait for the grayed image to complete
		// in order to avoid empty images being displayed!
		final int id = ID_GENERATOR.getAndIncrement();
		MEDIA_TRACKER.addImage( grayedImage, id );
		try {
			MEDIA_TRACKER.waitForID( id );
		} catch ( final InterruptedException ie ) {
			LEnv.LOGGER.warning( "Image conversion (graying) interrupted!", ie );
		} finally {
			MEDIA_TRACKER.removeImage( grayedImage, id );
		}
	}
	
	return grayedImage;
}
 
Example #2
Source File: BiFeatureNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public java.awt.Image getIcon( int type ){        
    if( biFeature instanceof BiFeature.Descriptor  && biAnalyser.isNullDescriptor() ) {
        //setIconBase( biFeature.getIconBase(true));
        return GrayFilter.createDisabledImage(super.getIcon(type));
    }
    if( ( biFeature instanceof BiFeature.Property || biFeature instanceof BiFeature.IdxProperty ) && biAnalyser.isNullProperties() ) {
        //setIconBase( biFeature.getIconBase(true));
        return GrayFilter.createDisabledImage(super.getIcon(type));
    }
    if( biFeature instanceof BiFeature.EventSet && biAnalyser.isNullEventSets() ) {
        //setIconBase( biFeature.getIconBase(true));
        return GrayFilter.createDisabledImage(super.getIcon(type));
    }
    if( biFeature instanceof BiFeature.Method && biAnalyser.isNullMethods() ) {
        //setIconBase( biFeature.getIconBase(true));
        return GrayFilter.createDisabledImage(super.getIcon(type));
    }
    //setIconBase( biFeature.getIconBase(false));
    return super.getIcon(type);
}
 
Example #3
Source File: NimbusLookAndFeel.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #4
Source File: NimbusLookAndFeel.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #5
Source File: NimbusLookAndFeel.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #6
Source File: MultiResolutionDisabledImageTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testMRDisabledImage(Image image) throws Exception {

        Image disabledImage = GrayFilter.createDisabledImage(image);
        MediaTracker mediaTracker = new MediaTracker(new JLabel());
        mediaTracker.addImage(disabledImage, 0);
        mediaTracker.waitForID(0);

        BufferedImage buffImage = new BufferedImage(IMAGE_SIZE,
                                                    IMAGE_SIZE,
                                                    BufferedImage.TYPE_INT_RGB);

        int x = IMAGE_SIZE / 2;
        int y = IMAGE_SIZE / 2;

        Graphics2D g = buffImage.createGraphics();

        g.scale(1, 1);
        g.drawImage(disabledImage, 0, 0, null);
        int rgb1x = buffImage.getRGB(x, y);

        g.scale(2, 2);
        g.drawImage(disabledImage, 0, 0, null);
        int rgb2x = buffImage.getRGB(x, y);

        g.dispose();

        if (rgb1x == rgb2x) {
            throw new RuntimeException("Disabled image is the same for the base"
                    + "image and the resolution variant");
        }

    }
 
Example #7
Source File: NimbusLookAndFeel.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #8
Source File: ImageView.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private Image getImage(boolean enabled) {
    Image img = getImage();
    if (! enabled) {
        if (disabledImage == null) {
            disabledImage = GrayFilter.createDisabledImage(img);
        }
        img = disabledImage;
    }
    return img;
}
 
Example #9
Source File: NimbusLookAndFeel.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #10
Source File: NimbusLookAndFeel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #11
Source File: NimbusLookAndFeel.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #12
Source File: NimbusLookAndFeel.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #13
Source File: NimbusLookAndFeel.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #14
Source File: MultiResolutionDisabledImageTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void testMRDisabledImage(Image image) throws Exception {

        Image disabledImage = GrayFilter.createDisabledImage(image);
        MediaTracker mediaTracker = new MediaTracker(new JLabel());
        mediaTracker.addImage(disabledImage, 0);
        mediaTracker.waitForID(0);

        BufferedImage buffImage = new BufferedImage(IMAGE_SIZE,
                                                    IMAGE_SIZE,
                                                    BufferedImage.TYPE_INT_RGB);

        int x = IMAGE_SIZE / 2;
        int y = IMAGE_SIZE / 2;

        Graphics2D g = buffImage.createGraphics();

        g.scale(1, 1);
        g.drawImage(disabledImage, 0, 0, null);
        int rgb1x = buffImage.getRGB(x, y);

        g.scale(2, 2);
        g.drawImage(disabledImage, 0, 0, null);
        int rgb2x = buffImage.getRGB(x, y);

        g.dispose();

        if (rgb1x == rgb2x) {
            throw new RuntimeException("Disabled image is the same for the base"
                    + "image and the resolution variant");
        }

    }
 
Example #15
Source File: NimbusLookAndFeel.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #16
Source File: ImageView.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private Image getImage(boolean enabled) {
    Image img = getImage();
    if (! enabled) {
        if (disabledImage == null) {
            disabledImage = GrayFilter.createDisabledImage(img);
        }
        img = disabledImage;
    }
    return img;
}
 
Example #17
Source File: NimbusLookAndFeel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #18
Source File: NimbusLookAndFeel.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #19
Source File: NimbusLookAndFeel.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #20
Source File: BiNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public java.awt.Image getOpenedIcon( int type ){
    if( key == BiFeature.Descriptor.class && biAnalyser.isNullDescriptor() )
        return GrayFilter.createDisabledImage(super.getIcon(type));
    if( key == BiFeature.Property.class && biAnalyser.isNullProperties() )
        return GrayFilter.createDisabledImage(super.getIcon(type));
    if( key == BiFeature.EventSet.class && biAnalyser.isNullEventSets() )
        return GrayFilter.createDisabledImage(super.getIcon(type));
    if( key == BiFeature.Method.class && biAnalyser.isNullMethods() )
        return GrayFilter.createDisabledImage(super.getIcon(type));

    return super.getOpenedIcon(type);
}
 
Example #21
Source File: BiNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public java.awt.Image getIcon( int type ){
    if( key == BiFeature.Descriptor.class && biAnalyser.isNullDescriptor() )
        return GrayFilter.createDisabledImage(super.getIcon(type));
    if( key == BiFeature.Property.class && biAnalyser.isNullProperties() )
        return GrayFilter.createDisabledImage(super.getIcon(type));
    if( key == BiFeature.EventSet.class && biAnalyser.isNullEventSets() )
        return GrayFilter.createDisabledImage(super.getIcon(type));
    if( key == BiFeature.Method.class && biAnalyser.isNullMethods() )
        return GrayFilter.createDisabledImage(super.getIcon(type));

    return super.getIcon(type);
}
 
Example #22
Source File: NimbusLookAndFeel.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #23
Source File: NimbusLookAndFeel.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #24
Source File: NimbusLookAndFeel.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #25
Source File: NimbusLookAndFeel.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example #26
Source File: ImageUtil.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static Image compare(BufferedImage golden, BufferedImage actual, Map<ImageCompParam, Integer> p) {

		Map<ImageCompParam, Integer> params = mergeDefaultCompParams(p);

		// prepare image for indicating potential mismatched blocks
		BufferedImage noMatch = imageToBufferedImage(actual);
		Graphics2D gc = noMatch.createGraphics();
		gc.setColor(Color.RED);

		// convert to gray images
		golden = imageToBufferedImage(GrayFilter.createDisabledImage(golden));
		actual = imageToBufferedImage(GrayFilter.createDisabledImage(actual));

		// get block size
		int goldenBlockXSize = (int)(golden.getWidth() / params.get(ImageCompParam.XBLOCKS));
		int goldenBlockYSize = (int)(golden.getHeight() / params.get(ImageCompParam.YBLOCKS));
		int actualBlockXSize = (int)(actual.getWidth() / params.get(ImageCompParam.XBLOCKS));
		int actualBlockYSize = (int)(actual.getHeight() / params.get(ImageCompParam.YBLOCKS));

		boolean match = true;

		// traverse and compare respective blocks of both images
		for (int y = 0; y < params.get(ImageCompParam.YBLOCKS); y++) {
			if (params.get(ImageCompParam.DEBUG) > 0) System.out.print("|");
			for (int x = 0; x < params.get(ImageCompParam.XBLOCKS); x++) {
				int goldenBrightness = getAverageBrightness(golden.getSubimage(x*goldenBlockXSize, y*goldenBlockYSize, goldenBlockXSize - 1, goldenBlockYSize - 1), params);
				int actualBrightness = getAverageBrightness(actual.getSubimage(x*actualBlockXSize, y*actualBlockYSize, actualBlockXSize - 1, actualBlockYSize - 1), params);
				int diff = Math.abs(goldenBrightness - actualBrightness);
				if (diff > params.get(ImageCompParam.TOLERANCE)) {
					// the difference in a certain region has passed the threshold value
					// draw an indicator on the change image to show where the change was detected
					gc.drawRect(x*actualBlockXSize, y*actualBlockYSize, actualBlockXSize - 1, actualBlockYSize - 1);
					match = false;
				}
				if (params.get(ImageCompParam.DEBUG) == 1) System.out.print((diff > params.get(ImageCompParam.TOLERANCE) ? "X" : " "));
				if (params.get(ImageCompParam.DEBUG) == 2) System.out.print(diff + (x < params.get(ImageCompParam.XBLOCKS) - 1 ? "," : ""));
			}
			if (params.get(ImageCompParam.DEBUG) > 0) System.out.println("|");
		}

		return match ? null : noMatch;
	}
 
Example #27
Source File: ImageInfoReader.java    From WorldGrower with GNU General Public License v3.0 4 votes vote down vote up
private BufferedImage createGhostImage(Image image) {
	ImageFilter filter = new GrayFilter(true, 50);  
	ImageProducer producer = new FilteredImageSource(image.getSource(), filter);  
	Image toolkitImage = Toolkit.getDefaultToolkit().createImage(producer);  
	return ImageUtils.toBufferedImage(toolkitImage);
}
 
Example #28
Source File: FuzzyImageDifferenceCalculator.java    From recheck with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ImageDifference compare( BufferedImage img1, BufferedImage img2 ) {
	if ( img1 == null ) {
		if ( img2 == null ) {
			return new ImageDifference( 1.0, null, FuzzyImageDifferenceCalculator.class );
		}
		return new ImageDifference( 0.0, img2, FuzzyImageDifferenceCalculator.class );
	}
	if ( img2 == null ) {
		return new ImageDifference( 0.0, img1, FuzzyImageDifferenceCalculator.class );
	}
	img1 = toBufferedImage( scaleProportionallyToMaxWidthHeight( img1, 800, 600 ) );
	img1 = toBufferedImage( scaleToSameSize( img1, img2 ) );
	img2 = toBufferedImage( scaleToSameSize( img2, img1 ) );
	final BufferedImage differenceImage = toBufferedImage( img2 );
	final Graphics2D gc = differenceImage.createGraphics();
	gc.setColor( Color.RED );
	// convert to gray images.
	img1 = toBufferedImage( GrayFilter.createDisabledImage( img1 ) );
	img2 = toBufferedImage( GrayFilter.createDisabledImage( img2 ) );
	// set to a match by default, if a change is found then flag non-match
	int numdiffs = 0;
	final int numRows = (int) Math.ceil( img1.getHeight() / (float) blockSize );
	final int numCols = (int) Math.ceil( img1.getWidth() / (float) blockSize );
	// loop through whole image and compare individual blocks of images
	StringBuilder textual = new StringBuilder();
	for ( int row = 0; row < numRows; row++ ) {
		textual.append( "|" );
		for ( int col = 0; col < numCols; col++ ) {
			final int b1 = getAverageBrightness( getSubImage( img1, col, row ) );
			final int b2 = getAverageBrightness( getSubImage( img2, col, row ) );
			final int diff = Math.abs( b1 - b2 );
			if ( diff > sensitivity ) {
				// the difference in a certain region has passed the threshold value
				// draw an indicator on the change image to show where change was detected.
				// TODO Merge borders of neighboring blocks
				gc.drawRect( col * blockSize, row * blockSize, blockSize - 1, blockSize - 1 );
				numdiffs++;
			}
			textual.append( diff > sensitivity ? "X" : " " );
		}
		textual.append( "|" );
		logger.warn( textual.toString() );
		textual = new StringBuilder();
	}
	if ( numdiffs == 0 ) {
		// ensure no rounding errors...
		return new ImageDifference( 1.0, differenceImage, FuzzyImageDifferenceCalculator.class );
	}
	final int total = numRows * numCols;
	final double match = (total - numdiffs) / (double) total;
	return new ImageDifference( match, differenceImage, FuzzyImageDifferenceCalculator.class );
}
 
Example #29
Source File: ProjectsSelector.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private static Icon disabledIcon(Icon icon) {
    return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage()));
}
 
Example #30
Source File: Utils.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Icon disabledIcon(Icon icon) {
    return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage()));
}