public void propertyChange(PropertyChangeEvent propertyChangeEvent) { image = picker.imageView.getImage(); if(picker.imageView.getImageURL() != null) { imageURL = picker.imageView.getImageURL().toString(); } firePropertyChange(); } });
public void propertyChange(PropertyChangeEvent propertyChangeEvent) { image = picker.imageView.getImage(); firePropertyChange(); } });
/** * Implementation detail. * @param g */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(getImage() != null) { Point2D center = new Point2D.Double(getWidth()/2,getHeight()/2); if(getImageLocation() != null) { center = getImageLocation(); } Point2D loc = new Point2D.Double(); double width = getImage().getWidth(null)*getScale(); double height = getImage().getHeight(null)*getScale(); loc.setLocation(center.getX()-width/2, center.getY()-height/2); g.drawImage(getImage(), (int)loc.getX(), (int)loc.getY(), (int)width,(int)height, null); } }
/** * Implementation detail. * @param g */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(getImage() != null) { Point2D center = new Point2D.Double(getWidth()/2,getHeight()/2); if(getImageLocation() != null) { center = getImageLocation(); } Point2D loc = new Point2D.Double(); double width = getImage().getWidth(null)*getScale(); double height = getImage().getHeight(null)*getScale(); loc.setLocation(center.getX()-width/2, center.getY()-height/2); g.drawImage(getImage(), (int)loc.getX(), (int)loc.getY(), (int)width,(int)height, null); } }
public void propertyChange(PropertyChangeEvent propertyChangeEvent) { image = picker.imageView.getImage(); firePropertyChange(); } });
/** * Implementation detail. * @param g */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(getImage() != null) { Point2D center = new Point2D.Double(getWidth()/2,getHeight()/2); if(getImageLocation() != null) { center = getImageLocation(); } Point2D loc = new Point2D.Double(); double width = getImage().getWidth(null)*getScale(); double height = getImage().getHeight(null)*getScale(); loc.setLocation(center.getX()-width/2, center.getY()-height/2); g.drawImage(getImage(), (int)loc.getX(), (int)loc.getY(), (int)width,(int)height, null); } }
@Override public void actionPerformed(ActionEvent evt) { Image img = getImage(); BufferedImage src = new BufferedImage( img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB); BufferedImage dst = new BufferedImage( img.getHeight(null), img.getWidth(null), BufferedImage.TYPE_INT_ARGB); Graphics2D g = (Graphics2D)src.getGraphics(); try { // smooth scaling g.drawImage(img, 0, 0, null); } finally { g.dispose(); } AffineTransform trans = AffineTransform.getRotateInstance(-Math.PI/2,0,0); trans.translate(-src.getWidth(),0); BufferedImageOp op = new AffineTransformOp(trans, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); op.filter(src,dst); setImage(dst); } };
/** * Implementation detail. * @param g */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(getImage() != null) { Point2D center = new Point2D.Double(getWidth()/2,getHeight()/2); if(getImageLocation() != null) { center = getImageLocation(); } Point2D loc = new Point2D.Double(); double width = getImage().getWidth(null)*getScale(); double height = getImage().getHeight(null)*getScale(); loc.setLocation(center.getX()-width/2, center.getY()-height/2); g.drawImage(getImage(), (int)loc.getX(), (int)loc.getY(), (int)width,(int)height, null); } }
public void actionPerformed(ActionEvent evt) { Image img = getImage(); BufferedImage src = new BufferedImage( img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB); BufferedImage dst = new BufferedImage( img.getHeight(null), img.getWidth(null), BufferedImage.TYPE_INT_ARGB); Graphics2D g = (Graphics2D)src.getGraphics(); try { // smooth scaling g.drawImage(img, 0, 0, null); } finally { g.dispose(); } AffineTransform trans = AffineTransform.getRotateInstance(-Math.PI/2,0,0); trans.translate(-src.getWidth(),0); BufferedImageOp op = new AffineTransformOp(trans, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); op.filter(src,dst); setImage(dst); } };
/** * Implementation detail. * @param g */ protected void paintComponent(Graphics g) { ((Graphics2D)g).setPaint(checkerPaint); //g.setColor(getBackground()); g.fillRect(0,0,getWidth(),getHeight()); if(getImage() != null) { Point2D center = new Point2D.Double(getWidth()/2,getHeight()/2); if(getImageLocation() != null) { center = getImageLocation(); } Point2D loc = new Point2D.Double(); double width = getImage().getWidth(null)*getScale(); double height = getImage().getHeight(null)*getScale(); loc.setLocation(center.getX()-width/2, center.getY()-height/2); g.drawImage(getImage(), (int)loc.getX(), (int)loc.getY(), (int)width,(int)height, null); } }
protected Transferable createTransferable(JComponent c) { JXImageView view = (JXImageView)c; return new ImageTransferable(view.getImage(), view.getExportName(), view.getExportFormat()); }
@Override protected Transferable createTransferable(JComponent c) { JXImageView view = (JXImageView)c; return new ImageTransferable(view.getImage(), view.getExportName(), view.getExportFormat()); }
@Override protected Transferable createTransferable(JComponent c) { JXImageView view = (JXImageView)c; return new ImageTransferable(view.getImage(), view.getExportName(), view.getExportFormat()); }
@Override protected Transferable createTransferable(JComponent c) { JXImageView view = (JXImageView)c; return new ImageTransferable(view.getImage(), view.getExportName(), view.getExportFormat()); }
@Override protected Transferable createTransferable(JComponent c) { JXImageView view = (JXImageView)c; return new ImageTransferable(view.getImage(), view.getExportName(), view.getExportFormat()); }
/** * Sets the current image. Can set null if there should be no image show. * @param image the new image to set, or null. */ public void setImage(Image image) { Image oldImage = getImage(); this.image = image; setImageLocation(null); setScale(1.0); firePropertyChange("image",oldImage,image); repaint(); }
/** * Sets the current image. Can set null if there should be no image show. * @param image the new image to set, or null. */ public void setImage(Image image) { Image oldImage = getImage(); this.image = image; setImageLocation(null); setScale(1.0); firePropertyChange("image",oldImage,image); repaint(); }
/** * Sets the current image. Can set null if there should be no image show. * @param image the new image to set, or null. */ public void setImage(Image image) { Image oldImage = getImage(); this.image = image; setImageLocation(null); setScale(1.0); firePropertyChange("image",oldImage,image); repaint(); }
/** * Sets the current image. Can set null if there should be no image show. * @param image the new image to set, or null. */ public void setImage(Image image) { Image oldImage = getImage(); this.image = image; setImageLocation(null); setScale(1.0); firePropertyChange("image",oldImage,image); repaint(); }
/** * Sets the current image. Can set null if there should be no image show. * @param image the new image to set, or null. */ public void setImage(Image image) { Image oldImage = getImage(); this.image = image; setImageLocation(null); setScale(1.0); firePropertyChange("image",oldImage,image); repaint(); }