/** * Converts the supplied point from coordinates relative to the specified layer to screen * coordinates. The results are stored into {@code into}, which is returned for convenience. */ public static Point layerToScreen(Layer layer, XY point, Point into) { return layerToParent(layer, null, point, into); }
/** * Converts the supplied point from coordinates relative to the specified * child layer to coordinates relative to the specified parent layer. */ public static Point layerToParent(Layer layer, Layer parent, float x, float y) { Point into = new Point(x, y); return layerToParent(layer, parent, into, into); }
/** Helper function for {@link #totalBounds}. */ protected static void addBounds (Layer root, Layer l, Rectangle bounds, Point scratch) { float w = l.width(), h = l.height(); if (w != 0 || h != 0) { // grow bounds bounds.add(LayerUtil.layerToParent(l, root, scratch.set(0, 0), scratch)); bounds.add(LayerUtil.layerToParent(l, root, scratch.set(w, h), scratch)); } if (l instanceof GroupLayer) { GroupLayer group = (GroupLayer) l; for (int ii = 0, ll = group.children(); ii < ll; ++ii) { addBounds(root, group.childAt(ii), bounds, scratch); } } } }