/** * Returns the x coordinate of the bottom right position. * * @return the x coordinate of the bottom right position */ public float getMaxX() { return getX() + getWidth(); }
@Override public CanvasSize getGraphicsCanvasSize() { float x1 = Float.MAX_VALUE; float y1 = Float.MAX_VALUE; float x2 = Float.MIN_VALUE; float y2 = Float.MIN_VALUE; for (Renderer r : getManagedEnabledRenderers()) { for (String type : getItemTypes()) { for (Item item : getItems(type)) { if (r.isRendererForitem(item, getProperties())) { CanvasSize cs = r.getCanvasSize(item, getProperties()); x1 = Math.min(x1, cs.getX()); y1 = Math.min(y1, cs.getY()); x2 = Math.max(x2, cs.getMaxX()); y2 = Math.max(y2, cs.getMaxY()); } } } } return new CanvasSize(x1, y1, x2 - x1, y2 - y1); }
this.landscape = landscape; double centerX = cs.getX() + cs.getWidth() / 2; double centerY = cs.getY() + cs.getHeight() / 2;
private CanvasSize getSheetCanvasSize(PreviewModel m) { CanvasSize cs = m.getGraphicsCanvasSize(); float marginPercentage = m.getProperties() .getFloatValue(PreviewProperty.MARGIN); float marginWidth = cs.getWidth() * marginPercentage / 100F; float marginHeight = cs.getHeight() * marginPercentage / 100F; return new CanvasSize( cs.getX() - marginWidth, cs.getY() - marginHeight, cs.getWidth() + 2F * marginWidth, cs.getHeight() + 2F * marginHeight); }
private void fit(CanvasSize cs) { Vector box = new Vector(cs.getWidth(), cs.getHeight()); Vector semiBox = Vector.div(box, 2F); Vector topLeft = new Vector(cs.getX(), cs.getY()); Vector center = new Vector(width / 2F, height / 2F); Vector scaledCenter = Vector.add(topLeft, semiBox); trans.set(center); trans.sub(scaledCenter); } }
"viewBox", String.format(Locale.ENGLISH, "%f %f %f %f", cs.getX(), cs.getY(), cs.getWidth(),