LayoutManager { public static MultiShapeLayout multiShapeLayout(final Dimension canvas, final List<Tuple<Dimension, HorizontalCoverageLayoutSpec>> shapes) { return new MultiShapeLayout( canvas, mlist(shapes).map(new Function<Tuple<Dimension, HorizontalCoverageLayoutSpec>, Layout>() { @Override public Layout apply(Tuple<Dimension, HorizontalCoverageLayoutSpec> a) { return calcLayout(canvas, a.getA(), a.getB()); } }).value()); } private  LayoutManager(); static TwoShapeLayout twoShapeLayout(Dimension canvas,
                                              Dimension upper,
                                              Dimension lower,
                                              TwoShapeLayouts.TwoShapeLayoutSpec spec); static MultiShapeLayout multiShapeLayout(final Dimension canvas,
                                                  final List<Tuple<Dimension, HorizontalCoverageLayoutSpec>> shapes); static MultiShapeLayout absoluteMultiShapeLayout(
          final Dimension canvas,
          final List<Tuple<Dimension, AbsolutePositionLayoutSpec>> shapes); static int limitMax(double v, int max); static int limitMin(double v, int min); static boolean fits(Dimension into, Dimension shape); static int area(Dimension a); static Dimension max(Dimension a, Dimension b); static double aspectRatio(Dimension a); static boolean overlap(Layout a, Layout b); static int left(Layout a); static int right(Layout a); static int top(Layout a); static int bottom(Layout a); static Offset offset(Anchor a, Dimension dim); static Dimension scale(Dimension limit, Dimension shape, double scale); static Dimension scaleToFit(Dimension canvas, Dimension d); static boolean between(int a, int b, int x);  }
@Test public void testMultiShapeLayoutTwoVideoAndWatermark() { final Dimension canvas = dimension(1900, 1080); final Dimension upper = dimension(1024, 768); final Dimension lower = dimension(1280, 720); final Dimension watermark = dimension(80, 80); final double upperCoverage = 0.3; final double lowerCoverage = 0.7; final double watermarkCoverage = 0.05; LayoutManager.multiShapeLayout( canvas, list(tuple(lower, new HorizontalCoverageLayoutSpec(anchorOffset(Anchors.BOTTOM_RIGHT, Anchors.BOTTOM_RIGHT, 0, 0), lowerCoverage)), tuple(upper, new HorizontalCoverageLayoutSpec( anchorOffset(Anchors.TOP_LEFT, Anchors.TOP_LEFT, 0, 0), upperCoverage)), tuple(watermark, new HorizontalCoverageLayoutSpec( anchorOffset(Anchors.TOP_RIGHT, Anchors.TOP_RIGHT, 20, 20), watermarkCoverage)))); }