List of usage examples for java.awt Graphics drawImage
public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
From source file:ImagePanel.java
public void paintComponent(Graphics g) { super.paintComponent(g); if (image.getImage() != null) g.drawImage(image.getImage(), margin, margin, this); }
From source file:MainClass.java
public void paint(Graphics g) { g.drawImage(i, 10, 10, this); // regular if (j != null) g.drawImage(j, 250, 10, this); // average }
From source file:org.stanwood.nwn2.gui.view.UIIconView.java
@Override public void paintUIObject(Graphics g) { int x = getX(); int y = getY(); try {// w w w.j a v a 2 s .c om BufferedImage img = getIconManager().getIcon(icon.getImg()); int width = getWidth(); int height = getHeight(); if (img.getHeight() != height && img.getWidth() != width) { Image newImg = img.getScaledInstance(width, height, Image.SCALE_SMOOTH); img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics ig = img.getGraphics(); ig.drawImage(newImg, 0, 0, null); } if (icon.getColor() != null) { Color colour = getColor(icon.getColor()); for (int w = 0; w < img.getWidth(); w++) { for (int h = 0; h < img.getHeight(); h++) { Color rgb = ColorUtil.blend(new Color(img.getRGB(w, h)), colour); img.setRGB(w, h, rgb.getRGB()); } } } g.drawImage(img, x, y, null); } catch (Exception e) { log.error(e.getMessage()); drawMissingIcon(x, y, getWidth(), getHeight(), g); } }
From source file:ArrowIcon.java
public void paintIcon(Component c, Graphics g, int x, int y) { g.drawImage(getArrowImage(), x, y, c); }
From source file:examples.monalisa.gui.EvolutionRunnable.java
public void run() { try {//from ww w . j a v a2 s . c o m JFreeChart chart = m_view.getChart(); XYSeriesCollection sc = (XYSeriesCollection) chart.getXYPlot().getDataset(); XYSeries series = sc.getSeries(0); series.clear(); if (m_genotype == null) { int populationSize = m_conf.getPopulationSize(); Population pop = new Population(m_conf, populationSize); for (int i = 0; i < populationSize; i++) { pop.addChromosome(GAInitialChromosomeFactory.create(m_conf)); } m_genotype = new Genotype(m_conf, pop); } // while (m_view.isEvolutionActivated()) { m_genotype.evolve(); if (m_conf.getGenerationNr() % 25 == 0) { IChromosome best = m_genotype.getFittestChromosome(); series.add(m_conf.getGenerationNr(), best.getFitnessValue()); BufferedImage image = m_conf.getPhenotypeExpresser().express(best); Graphics g = m_view.getFittestDrawingView().getMainPanel().getGraphics(); g.drawImage(image, 0, 0, m_view.getFittestDrawingView()); } } } catch (InvalidConfigurationException e) { e.printStackTrace(); System.exit(-1); } }
From source file:Main.java
License:asdf
public void paint(Graphics g, JComponent c) { FontMetrics metrics = c.getFontMetrics(g.getFont()); g.setColor(c.getForeground());//from ww w. ja v a2 s . co m g.drawString(((JToolTip) c).getTipText(), 1, 1); g.drawImage(new ImageIcon("yourImage").getImage(), 1, metrics.getHeight(), c); }
From source file:SaveImage.java
public void paint(Graphics g) { filterImage(); g.drawImage(biFiltered, 0, 0, null); }
From source file:unikn.dbis.univis.explorer.VSplashScreen.java
/** * @see JFrame#paint(java.awt.Graphics)// w ww .j a v a 2 s. com */ public void paint(Graphics g) { super.paint(g); g.drawImage(image, 0, 0, this); }
From source file:MainClass.java
public void paint(Graphics g) { if (im != null) g.drawImage(im, 0, 0, this); }
From source file:org.polymap.core.data.image.ImageGrayscaleProcessor.java
protected Image grayscale(Image image) { long start = System.currentTimeMillis(); // load image data new javax.swing.ImageIcon(image).getImage(); if (!(image instanceof BufferedImage)) { BufferedImage bimage = new BufferedImage(image.getHeight(null), image.getWidth(null), BufferedImage.TYPE_4BYTE_ABGR); Graphics g = bimage.getGraphics(); g.drawImage(image, 0, 0, null); g.dispose();//from w w w. j a v a2 s .com image = bimage; } // grayscale ColorConvertOp filter = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null); BufferedImage grayImage = new BufferedImage(image.getHeight(null), image.getWidth(null), BufferedImage.TYPE_4BYTE_ABGR); Graphics g = grayImage.getGraphics(); filter.filter((BufferedImage) image, grayImage); g.dispose(); log.info("Gray scaling took: " + (System.currentTimeMillis() - start) + "ms"); return grayImage; }