@Override public Figure createDefaultFigure() { final ImageFigure figure = new ImageFigure(); figure.setTransformable(false); initDefaultSettings(figure); return figure; }
@Override public void update() { log.debug("Updating image figure: " + this); final Image image = datasetView.getScreenImage().image(); final BufferedImage bufImage = AWTImageTools.makeBuffered(image); figure.setBounds(new Rectangle2D.Double(0, 0, bufImage.getWidth(), bufImage.getHeight())); figure.setBufferedImage(bufImage); }
@Override public void dispose() { getFigure().requestRemove(); }
/** * Sets the buffered image. * This clears the image data. */ @Override public void setBufferedImage(BufferedImage image) { willChange(); this.imageData = null; this.bufferedImage = image; changed(); }
/** * Transforms the figure. * @param tx The transformation. */ @Override public void transform(AffineTransform tx) { Point2D.Double anchor = getStartPoint(); Point2D.Double lead = getEndPoint(); setBounds( (Point2D.Double) tx.transform(anchor, anchor), (Point2D.Double) tx.transform(lead, lead)); } // ATTRIBUTES
public DatasetFigureView(final SwingImageDisplayViewer displayViewer, final DatasetView datasetView) { setContext(datasetView.getContext()); this.datasetView = datasetView; final JHotDrawImageCanvas canvas = displayViewer.getCanvas(); final Drawing drawing = canvas.getDrawing(); figure = new ImageFigure(); figure.setSelectable(false); figure.setTransformable(false); final Dataset dataset = datasetView.getData(); final double minX = dataset.getImgPlus().realMin(0); final double minY = dataset.getImgPlus().realMin(1); final double maxX = dataset.getImgPlus().realMax(0); final double maxY = dataset.getImgPlus().realMax(1); figure.setBounds(new Point2D.Double(minX, minY), new Point2D.Double(maxX, maxY)); drawing.add(figure); }
icon.paintIcon(null, g, 0, 0); g.dispose(); ImageFigure imf = new ImageFigure(); imf.setBufferedImage(bimg); imf.set(STROKE_COLOR, null); imf.setBounds(new Point2D.Double(0, 0), new Point2D.Double(icon.getIconWidth(), icon.getIconHeight()));
figure.set(AttributeKeys.FILL_COLOR, new Color(0, 0, 0, 0)); final RegionOfInterest roi = overlay.getData().getRegionOfInterest(); if (roi != null) { Raster.createRaster(sm, db, new java.awt.Point(0, 0)); img.setData(raster); figure.setBounds(new Rectangle2D.Double(minX, minY, w, h)); figure.setBufferedImage(img);
@Override protected void drawFigure(Graphics2D g) { if (get(FILL_COLOR) != null) { g.setColor(get(FILL_COLOR)); drawFill(g); } drawImage(g); if (get(STROKE_COLOR) != null && get(STROKE_WIDTH) > 0d) { g.setStroke(AttributeKeys.getStroke(this)); g.setColor(get(STROKE_COLOR)); drawStroke(g); } if (get(TEXT_COLOR) != null) { if (get(TEXT_SHADOW_COLOR) != null && get(TEXT_SHADOW_OFFSET) != null) { Dimension2DDouble d = get(TEXT_SHADOW_OFFSET); g.translate(d.width, d.height); g.setColor(get(TEXT_SHADOW_COLOR)); drawText(g); g.translate(-d.width, -d.height); } g.setColor(get(TEXT_COLOR)); drawText(g); } }
/** * Configure Drawing object to support copy and paste. */ @SuppressWarnings("unchecked") private void initDrawing(Drawing d) { d.setInputFormats((java.util.List<InputFormat>) Collections.EMPTY_LIST); d.setOutputFormats((java.util.List<OutputFormat>) Collections.EMPTY_LIST); DOMStorableInputOutputFormat ioFormat = new DOMStorableInputOutputFormat( new NetFactory()); d.addInputFormat(ioFormat); d.addInputFormat(new ImageInputFormat(new ImageFigure())); d.addInputFormat(new TextInputFormat(new TextFigure())); d.addOutputFormat(ioFormat); d.addOutputFormat(new ImageOutputFormat()); }
public DatasetFigureView(final SwingImageDisplayViewer displayViewer, final DatasetView datasetView) { this.datasetView = datasetView; final JHotDrawImageCanvas canvas = displayViewer.getCanvas(); final Drawing drawing = canvas.getDrawing(); figure = new ImageFigure(); figure.setSelectable(false); figure.setTransformable(false); final Dataset dataset = datasetView.getData(); final double minX = dataset.getImgPlus().realMin(0); final double minY = dataset.getImgPlus().realMin(1); final double maxX = dataset.getImgPlus().realMax(0); final double maxY = dataset.getImgPlus().realMax(1); figure.setBounds(new Point2D.Double(minX, minY), new Point2D.Double(maxX, maxY)); drawing.add(figure); final ImageJ context = dataset.getContext(); final EventService eventService = context.getService(EventService.class); subscribers = eventService.subscribe(this); }
/** * Configure Drawing object to support copy and paste. */ @SuppressWarnings("unchecked") private void initDrawing(Drawing d) { d.setInputFormats((java.util.List<InputFormat>) Collections.EMPTY_LIST); d.setOutputFormats((java.util.List<OutputFormat>) Collections.EMPTY_LIST); DOMStorableInputOutputFormat ioFormat = new DOMStorableInputOutputFormat( new DrawFigureFactory()); d.addInputFormat(ioFormat); d.addInputFormat(new ImageInputFormat(new ImageFigure())); d.addInputFormat(new TextInputFormat(new TextFigure())); d.addOutputFormat(ioFormat); d.addOutputFormat(new ImageOutputFormat()); }
/** * Sets the image data. * This clears the buffered image. * <p> * Note: For performance reasons this method stores a reference to the * imageData array instead of cloning it. Do not modify the image data array * after invoking this method. */ public void setImageData(byte[] imageData) { willChange(); this.imageData = imageData; this.bufferedImage = null; changed(); }
@Override public void update() { final LogService log = datasetView.getData().getContext().getService(LogService.class); log.debug("Updating image figure: " + this); final Image image = datasetView.getScreenImage().image(); final BufferedImage bufImage = AWTImageTools.makeBuffered(image); figure.setBounds(new Rectangle2D.Double(0, 0, bufImage.getWidth(), bufImage.getHeight())); figure.setBufferedImage(bufImage); }
/** * Creates a new Drawing for this view. */ protected Drawing createDrawing() { Drawing drawing = new QuadTreeDrawing(); DOMStorableInputOutputFormat ioFormat = new DOMStorableInputOutputFormat(new DrawFigureFactory()); drawing.addInputFormat(ioFormat); ImageFigure prototype = new ImageFigure(); drawing.addInputFormat(new ImageInputFormat(prototype)); drawing.addInputFormat(new TextInputFormat(new TextFigure())); TextAreaFigure taf = new TextAreaFigure(); taf.setBounds(new Point2D.Double(10,10), new Point2D.Double(60,40)); drawing.addInputFormat(new TextInputFormat(taf)); drawing.addOutputFormat(ioFormat); drawing.addOutputFormat(new ImageOutputFormat()); return drawing; }
/** * Sets the image. * * @param imageData The image data. If this is null, a buffered image must * be provided. * @param bufferedImage An image constructed from the imageData. If this * is null, imageData must be provided. */ @Override public void setImage(byte[] imageData, BufferedImage bufferedImage) { willChange(); this.imageData = imageData; this.bufferedImage = bufferedImage; changed(); }
@Override public void dispose() { getFigure().requestRemove(); }
ButtonFactory.addToolTo(tb, editor, new TextCreationTool(new TextFigure()), "edit.createText", labels); ButtonFactory.addToolTo(tb, editor, new TextAreaCreationTool(new TextAreaFigure()), "edit.createTextArea", labels); ButtonFactory.addToolTo(tb, editor, new ImageTool(new ImageFigure()), "edit.createImage", labels);