result.append("(" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + " x " + getHeight() + ")"); return result.toString();
private int calcDelta(CssContext cssCtx, LineBox line, BoxDistance boxDistance) { BlockBox floated = boxDistance.getBox(); Rectangle rect = floated.getBorderEdge(floated.getAbsX(), floated.getAbsY(), cssCtx); int bottom = rect.y + rect.height; return bottom - line.getAbsY(); }
result.append("(" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + " x " + getHeight() + ")"); return result.toString();
public void paintReplacedElement(RenderingContext c, BlockBox box) { ReplacedElement replaced = box.getReplacedElement(); if (replaced instanceof SwingReplacedElement) { Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); translate(contentBounds.x, contentBounds.y); JComponent component = ((SwingReplacedElement)box.getReplacedElement()).getJComponent(); component.print(_graphics); translate(-contentBounds.x, -contentBounds.y); } else if (replaced instanceof ImageReplacedElement) { Image image = ((ImageReplacedElement)replaced).getImage(); Point location = replaced.getLocation(); _graphics.drawImage( image, (int)location.getX(), (int)location.getY(), null); } }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); ReplacedElement element = box.getReplacedElement(); outputDevice.drawImage( ((ITextImageElement)element).getImage(), contentBounds.x, contentBounds.y); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); ReplacedElement element = box.getReplacedElement(); outputDevice.drawImage( ((ITextImageElement)element).getImage(), contentBounds.x, contentBounds.y); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); ReplacedElement element = box.getReplacedElement(); outputDevice.drawImage( ((ITextImageElement)element).getImage(), contentBounds.x, contentBounds.y); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); ReplacedElement element = box.getReplacedElement(); outputDevice.drawImage( ((ITextImageElement)element).getImage(), contentBounds.x, contentBounds.y); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); ReplacedElement element = box.getReplacedElement(); outputDevice.drawImage( ((ITextImageElement)element).getImage(), contentBounds.x, contentBounds.y); }
public void paintReplacedElement(RenderingContext c, BlockBox box) { ReplacedElement replaced = box.getReplacedElement(); if (replaced instanceof SwingReplacedElement) { Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); JComponent component = ((SwingReplacedElement)box.getReplacedElement()).getJComponent(); RootPanel canvas = (RootPanel)c.getCanvas(); CellRendererPane pane = canvas.getCellRendererPane(); pane.paintComponent(_graphics, component, canvas, contentBounds.x, contentBounds.y, contentBounds.width, contentBounds.height,true); } else if (replaced instanceof ImageReplacedElement) { Image image = ((ImageReplacedElement)replaced).getImage(); Point location = replaced.getLocation(); _graphics.drawImage( image, (int)location.getX(), (int)location.getY(), null); } }
private static int getReferenceX(RenderingContext c, BlockBox box) { MarkerData markerData = box.getMarkerData(); if (markerData.getReferenceLine() != null) { return markerData.getReferenceLine().getAbsX(); } else { return box.getAbsX() + (int)box.getMargin(c).left(); } }
private static int getReferenceX(RenderingContext c, BlockBox box) { MarkerData markerData = box.getMarkerData(); if (markerData.getReferenceLine() != null) { return markerData.getReferenceLine().getAbsX(); } else { return box.getAbsX() + (int)box.getMargin(c).left(); } }
Rectangle contentBounds = replaced.getContentAreaEdge( replaced.getAbsX(), replaced.getAbsY(), c); // Minor hack: It's inconvenient to adjust for margins, border, padding during // layout so just do it here. Point loc = replaced.getReplacedElement().getLocation(); if (contentBounds.x != loc.x || contentBounds.y != loc.y) { replaced.getReplacedElement().setLocation(contentBounds.x, contentBounds.y); } if (! c.isInteractive() || replaced.getReplacedElement().isRequiresInteractivePaint()) { c.getOutputDevice().paintReplacedElement(c, replaced); } } public boolean isRootLayer() {
private void paintReplacedElement(RenderingContext c, BlockBox replaced) { Rectangle contentBounds = replaced.getContentAreaEdge( replaced.getAbsX(), replaced.getAbsY(), c); // Minor hack: It's inconvenient to adjust for margins, border, padding during // layout so just do it here. Point loc = replaced.getReplacedElement().getLocation(); if (contentBounds.x != loc.x || contentBounds.y != loc.y) { replaced.getReplacedElement().setLocation(contentBounds.x, contentBounds.y); } if (! c.isInteractive() || replaced.getReplacedElement().isRequiresInteractivePaint()) { c.getOutputDevice().paintReplacedElement(c, replaced); } }
@Override public void paint(RenderingContext renderingContext, ITextOutputDevice outputDevice, BlockBox blockBox) { PdfContentByte cb = outputDevice.getWriter().getDirectContent(); float width = (float) (cssWidth / outputDevice.getDotsPerPoint()); float height = (float) (cssHeight / outputDevice.getDotsPerPoint()); PdfTemplate template = cb.createTemplate(width, height); Graphics2D g2d = template.createGraphics(width, height); PrintTranscoder prm = new PrintTranscoder(); TranscoderInput ti = new TranscoderInput(svg); prm.transcode(ti, null); PageFormat pg = new PageFormat(); Paper pp = new Paper(); pp.setSize(width, height); pp.setImageableArea(0, 0, width, height); pg.setPaper(pp); prm.print(g2d, pg, 0); g2d.dispose(); PageBox page = renderingContext.getPage(); float x = blockBox.getAbsX() + page.getMarginBorderPadding(renderingContext, CalculatedStyle.LEFT); float y = (page.getBottom() - (blockBox.getAbsY() + cssHeight)) + page.getMarginBorderPadding( renderingContext, CalculatedStyle.BOTTOM); x /= outputDevice.getDotsPerPoint(); y /= outputDevice.getDotsPerPoint(); cb.addTemplate(template, x, y); }
public int calcInlineBaseline(CssContext c) { if (isReplaced() && getReplacedElement().hasBaseline()) { Rectangle bounds = getContentAreaEdge(getAbsX(), getAbsY(), c); return bounds.y + getReplacedElement().getBaseline() - getAbsY(); } else { LineBox lastLine = findLastLineBox(); if (lastLine == null) { return getHeight(); } else { return lastLine.getAbsY() + lastLine.getBaseline() - getAbsY(); } } }
public int calcInlineBaseline(CssContext c) { if (isReplaced() && getReplacedElement().hasBaseline()) { Rectangle bounds = getContentAreaEdge(getAbsX(), getAbsY(), c); return bounds.y + getReplacedElement().getBaseline() - getAbsY(); } else { LineBox lastLine = findLastLineBox(); if (lastLine == null) { return getHeight(); } else { return lastLine.getAbsY() + lastLine.getBaseline() - getAbsY(); } } }
@SuppressWarnings("deprecation") @Override public void paint(RenderingContext renderingContext, ITextOutputDevice outputDevice, BlockBox blockBox) { PdfContentByte cb = outputDevice.getWriter().getDirectContent(); float width = (float) (this.cssWidth / outputDevice.getDotsPerPoint()); float height = (float) (this.cssHeight / outputDevice.getDotsPerPoint()); PdfTemplate template = cb.createTemplate(width, height); Graphics2D g2d = template.createGraphics(width, height); PrintTranscoder prm = new PrintTranscoder(); TranscoderInput ti = new TranscoderInput(this.svg); prm.transcode(ti, null); PageFormat pg = new PageFormat(); Paper pp = new Paper(); pp.setSize(width, height); pp.setImageableArea(0, 0, width, height); pg.setPaper(pp); prm.print(g2d, pg, 0); g2d.dispose(); PageBox page = renderingContext.getPage(); float x = blockBox.getAbsX() + page.getMarginBorderPadding(renderingContext, CalculatedStyle.LEFT); float y = (page.getBottom() - (blockBox.getAbsY() + this.cssHeight)) + page.getMarginBorderPadding(renderingContext, CalculatedStyle.BOTTOM); x /= outputDevice.getDotsPerPoint(); y /= outputDevice.getDotsPerPoint(); cb.addTemplate(template, x, y); }