private boolean intersectsAggregateBounds(Shape clip, Box box) { if (clip == null) { return true; } PaintingInfo info = box.getPaintingInfo(); if (info == null) { return false; } Rectangle bounds = info.getAggregateBounds(); return clip.intersects(bounds); }
private boolean intersectsAggregateBounds(Shape clip, Box box) { if (clip == null) { return true; } PaintingInfo info = box.getPaintingInfo(); if (info == null) { return false; } Rectangle bounds = info.getAggregateBounds(); return clip.intersects(bounds); }
private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle((float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
private com.itextpdf.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.itextpdf.text.Rectangle result = new com.itextpdf.text.Rectangle((float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle((float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle( (float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle( (float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
/** * Renders according to scale factor * * @param c the RenderingContext to use * @param root The Layer to render */ protected void doRender(RenderingContext c, Layer root) { Graphics2D g = ((Java2DOutputDevice) c.getOutputDevice()).getGraphics(); if (!(g instanceof PrinterGraphics) && isOpaque()) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); } AffineTransform current = g.getTransform(); PaintingInfo pI = root.getMaster().getPaintingInfo(); Dimension layoutSize = pI.getOuterMarginCorner(); calculateScaleAccordingToPolicy(layoutSize); if (lastLayoutSize == null) { lastLayoutSize = layoutSize; setPreferredSize(new Dimension((int) (lastLayoutSize.width * scale), (int) (lastLayoutSize.height * scale))); revalidate(); } g.transform(AffineTransform.getScaleInstance(scale, scale)); super.doRender(c, root); g.setTransform(current); }
public Box find(CssContext cssCtx, int absX, int absY, boolean findAnonymous) { PaintingInfo pI = getPaintingInfo(); if (pI != null && ! pI.getAggregateBounds().contains(absX, absY)) { return null; } Box result = null; for (int i = 0; i < getChildCount(); i++) { Box child = getChild(i); result = child.find(cssCtx, absX, absY, findAnonymous); if (result != null) { return result; } } Rectangle edge = getContentAreaEdge(getAbsX(), getAbsY(), cssCtx); return edge.contains(absX, absY) && getStyle().isVisible() ? this : null; }
/** * Renders according to scale factor * * @param c the RenderingContext to use * @param root The Layer to render */ protected void doRender(RenderingContext c, Layer root) { Graphics2D g = ((Java2DOutputDevice) c.getOutputDevice()).getGraphics(); if (!(g instanceof PrinterGraphics) && isOpaque()) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); } AffineTransform current = g.getTransform(); PaintingInfo pI = root.getMaster().getPaintingInfo(); Dimension layoutSize = pI.getOuterMarginCorner(); calculateScaleAccordingToPolicy(layoutSize); if (lastLayoutSize == null) { lastLayoutSize = layoutSize; setPreferredSize(new Dimension((int) (lastLayoutSize.width * scale), (int) (lastLayoutSize.height * scale))); revalidate(); } g.transform(AffineTransform.getScaleInstance(scale, scale)); super.doRender(c, root); g.setTransform(current); }
public Box find(CssContext cssCtx, int absX, int absY, boolean findAnonymous) { PaintingInfo pI = getPaintingInfo(); if (pI != null && ! pI.getAggregateBounds().contains(absX, absY)) { return null; } Box result = null; for (int i = 0; i < getChildCount(); i++) { Box child = getChild(i); result = child.find(cssCtx, absX, absY, findAnonymous); if (result != null) { return result; } } Rectangle edge = getContentAreaEdge(getAbsX(), getAbsY(), cssCtx); return edge.contains(absX, absY) && getStyle().isVisible() ? this : null; }
public void paintRootElementBackground(RenderingContext c) { PaintingInfo pI = getPaintingInfo(); if (pI != null) { if (getStyle().isHasBackground()) { paintRootElementBackground(c, pI); } else if (getChildCount() > 0) { Box body = getChild(0); body.paintRootElementBackground(c, pI); } } }
public void paintRootElementBackground(RenderingContext c) { PaintingInfo pI = getPaintingInfo(); if (pI != null) { if (getStyle().isHasBackground()) { paintRootElementBackground(c, pI); } else if (getChildCount() > 0) { Box body = getChild(0); body.paintRootElementBackground(c, pI); } } }
(container.getPaintingInfo() == null && container.intersects(c, clip))) { inlineContent.add(container); ((LineBox)container).addAllChildren(inlineContent, layer); if (container.getLayer() == null || !(container instanceof BlockBox)) { if (intersectsAggregateBounds || (container.getPaintingInfo() == null && container.intersects(c, clip))) { blockContent.add(container); if (container.getStyle().isTable() && c instanceof RenderingContext) { // HACK if (container.getPaintingInfo() == null || intersectsAggregateBounds) { if (container.getLayer() == null || container == layer.getMaster()) { for (int i = 0; i < container.getChildCount(); i++) {
public PaintingInfo calcPaintingInfo(CssContext c, boolean useCache) { PaintingInfo cached = getPaintingInfo(); if (cached != null && useCache) { return cached; } final PaintingInfo result = new PaintingInfo(); Rectangle bounds = getMarginEdge(getAbsX(), getAbsY(), c, 0, 0); result.setOuterMarginCorner( new Dimension(bounds.x + bounds.width, bounds.y + bounds.height)); result.setAggregateBounds(getPaintingClipEdge(c)); calcChildPaintingInfo(c, result, useCache); setPaintingInfo(result); return result; }
(container.getPaintingInfo() == null && container.intersects(c, clip))) { inlineContent.add(container); ((LineBox)container).addAllChildren(inlineContent, layer); if (container.getLayer() == null || !(container instanceof BlockBox)) { if (intersectsAggregateBounds || (container.getPaintingInfo() == null && container.intersects(c, clip))) { blockContent.add(container); if (container.getStyle().isTable() && c instanceof RenderingContext) { // HACK if (container.getPaintingInfo() == null || intersectsAggregateBounds) { if (container.getLayer() == null || container == layer.getMaster()) { for (int i = 0; i < container.getChildCount(); i++) {
_previouslyHovered.restyle(c); PaintingInfo paintInfo = _previouslyHovered.getPaintingInfo(); PaintingInfo paintInfo = target.getPaintingInfo();
getMaster().calcPaintingInfo(c, true); PaintingInfo result = (PaintingInfo)getMaster().getPaintingInfo().copyOf(); List children = getChildren(); for (int i = 0; i < children.size(); i++) { Layer child = (Layer)children.get(i); if (child.getMaster().getStyle().isFixed()) { continue; } else if (child.getMaster().getStyle().isAbsolute()) { PaintingInfo info = child.calcPaintingDimension(c); moveIfGreater(result.getOuterMarginCorner(), info.getOuterMarginCorner()); } } return result; } public void positionChildren(LayoutContext c) {
private PaintingInfo calcPaintingDimension(LayoutContext c) { getMaster().calcPaintingInfo(c, true); PaintingInfo result = (PaintingInfo)getMaster().getPaintingInfo().copyOf(); List children = getChildren(); for (int i = 0; i < children.size(); i++) { Layer child = (Layer)children.get(i); if (child.getMaster().getStyle().isFixed()) { continue; } else if (child.getMaster().getStyle().isAbsolute()) { PaintingInfo info = child.calcPaintingDimension(c); moveIfGreater(result.getOuterMarginCorner(), info.getOuterMarginCorner()); } } return result; }
public PaintingInfo calcPaintingInfo(CssContext c, boolean useCache) { PaintingInfo cached = getPaintingInfo(); if (cached != null && useCache) { return cached; } final PaintingInfo result = new PaintingInfo(); Rectangle bounds = getMarginEdge(getAbsX(), getAbsY(), c, 0, 0); result.setOuterMarginCorner( new Dimension(bounds.x + bounds.width, bounds.y + bounds.height)); result.setAggregateBounds(getPaintingClipEdge(c)); if (!getStyle().isOverflowApplies() || getStyle().isOverflowVisible()) { calcChildPaintingInfo(c, result, useCache); } setPaintingInfo(result); return result; }