use of java.awt.image.ImageProducer in project jdk8u_jdk by JetBrains.
the class WindowsLookAndFeel method getDisabledIcon.
/**
* {@inheritDoc}
*
* @since 1.6
*/
public Icon getDisabledIcon(JComponent component, Icon icon) {
// in particular by the WindowsFileChooserUI class)
if (icon != null && component != null && Boolean.TRUE.equals(component.getClientProperty(HI_RES_DISABLED_ICON_CLIENT_KEY)) && icon.getIconWidth() > 0 && icon.getIconHeight() > 0) {
BufferedImage img = new BufferedImage(icon.getIconWidth(), icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(component, img.getGraphics(), 0, 0);
ImageFilter filter = new RGBGrayFilter();
ImageProducer producer = new FilteredImageSource(img.getSource(), filter);
Image resultImage = component.createImage(producer);
return new ImageIconUIResource(resultImage);
}
return super.getDisabledIcon(component, icon);
}
use of java.awt.image.ImageProducer in project cayenne by apache.
the class FilteredIconFactory method createIcon.
public static Icon createIcon(Icon icon, FilterType filterType) {
if (icon != null && icon.getIconWidth() > 0 && icon.getIconHeight() > 0) {
BufferedImage img = new BufferedImage(icon.getIconWidth(), icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(DUMMY, img.getGraphics(), 0, 0);
ImageProducer producer = new FilteredImageSource(img.getSource(), filterType.filter);
Image resultImage = DUMMY.createImage(producer);
return new ImageIcon(resultImage);
}
return null;
}
use of java.awt.image.ImageProducer in project processdash by dtuma.
the class BufferedIcon method applyFilter.
public void applyFilter(RGBImageFilter filter) {
ImageProducer prod = new FilteredImageSource(getImage().getSource(), filter);
setImage(Toolkit.getDefaultToolkit().createImage(prod));
}
use of java.awt.image.ImageProducer in project rt.equinox.framework by eclipse.
the class URLHandlerTests method testImageProducer.
public void testImageProducer() throws IOException {
URL testImage = getClass().getResource("debug.gif");
Object content = testImage.getContent();
assertTrue("Wrong content type: " + content.getClass().getName(), content instanceof ImageProducer);
}
use of java.awt.image.ImageProducer in project bioformats by openmicroscopy.
the class LegacyQTReader method initFile.
// -- Internal FormatReader API methods --
/* @see loci.formats.FormatReader#initFile(String) */
@Override
protected void initFile(String id) throws FormatException, IOException {
LOGGER.info("Checking for QuickTime Java");
if (tools == null) {
tools = new LegacyQTTools();
r = tools.getUniverse();
}
tools.checkQTLibrary();
super.initFile(id);
LOGGER.info("Reading movie dimensions");
try {
r.exec("QTSession.open()");
// open movie file
Location file = new Location(id);
r.setVar("path", file.getAbsolutePath());
r.exec("qtf = new QTFile(path)");
r.exec("openMovieFile = OpenMovieFile.asRead(qtf)");
r.exec("m = Movie.fromFile(openMovieFile)");
int numTracks = ((Integer) r.exec("m.getTrackCount()")).intValue();
int trackMostLikely = 0;
int trackNum = 0;
while (++trackNum <= numTracks && trackMostLikely == 0) {
r.setVar("trackNum", trackNum);
r.exec("imageTrack = m.getTrack(trackNum)");
r.exec("d = imageTrack.getSize()");
Integer w = (Integer) r.exec("d.getWidth()");
if (w.intValue() > 0)
trackMostLikely = trackNum;
}
r.setVar("trackMostLikely", trackMostLikely);
r.exec("imageTrack = m.getTrack(trackMostLikely)");
r.exec("d = imageTrack.getSize()");
Integer w = (Integer) r.exec("d.getWidth()");
Integer h = (Integer) r.exec("d.getHeight()");
r.exec("moviePlayer = new MoviePlayer(m)");
r.setVar("dim", new Dimension(w.intValue(), h.intValue()));
ImageProducer qtip = (ImageProducer) r.exec("qtip = new QTImageProducer(moviePlayer, dim)");
image = Toolkit.getDefaultToolkit().createImage(qtip);
r.setVar("zero", 0);
r.setVar("one", 1f);
r.exec("timeInfo = new TimeInfo(zero, zero)");
r.exec("moviePlayer.setTime(zero)");
Vector<Integer> v = new Vector<Integer>();
int time = 0;
Integer q = new Integer(time);
do {
v.add(q);
r.exec("timeInfo = imageTrack.getNextInterestingTime(" + "StdQTConstants.nextTimeMediaSample, timeInfo.time, one)");
q = (Integer) r.getVar("timeInfo.time");
time = q.intValue();
} while (time >= 0);
CoreMetadata m = core.get(0);
m.imageCount = v.size();
times = new int[getImageCount()];
for (int i = 0; i < times.length; i++) {
q = v.elementAt(i);
times[i] = q.intValue();
}
LOGGER.info("Populating metadata");
BufferedImage img = AWTImageTools.makeBuffered(image);
m.sizeX = img.getWidth();
m.sizeY = img.getHeight();
m.sizeZ = 1;
m.sizeC = img.getRaster().getNumBands();
m.sizeT = getImageCount();
m.pixelType = AWTImageTools.getPixelType(img);
m.dimensionOrder = "XYCTZ";
m.rgb = true;
m.interleaved = false;
m.littleEndian = false;
m.indexed = false;
m.falseColor = false;
MetadataStore store = makeFilterMetadata();
MetadataTools.populatePixels(store, this);
} catch (ReflectException e) {
throw new FormatException("Open movie failed", e);
}
}
Aggregations