void (double scale) { source = RetinaImage.createFrom(supplyImage(scale, IMAGE_SIZE, IMAGE_SIZE, IMAGE_QUARTER_COLORS, false).first, JreHiDpiUtil.isJreHiDPIEnabled() ? scale : 1, null); // // 1) draw one to one // TestColor[] colors = new TestColor[] { new TestColor(0, 0), new TestColor(1, 0), new TestColor(0, 1), new TestColor(1, 1), }; testDrawImage(dest = new Dest(scale), bounds(), bounds(), colors); testDrawImage(dest = new Dest(scale), null, bounds(), colors); testDrawImage(dest = new Dest(scale), bounds(), null, colors); testDrawImage(dest = new Dest(scale), null, null, colors); testDrawImage(dest = new Dest(scale), new Rectangle(0, 0, -1, -1), new Rectangle(0, 0, -1, -1), colors); // // 2) scale the 4th quarter to the whole dest // colors = new TestColor[] { new TestColor(IMAGE_QUARTER_COLORS[3], 0, 0), new TestColor(IMAGE_QUARTER_COLORS[3], 1, 0), new TestColor(IMAGE_QUARTER_COLORS[3], 0, 1), new TestColor(IMAGE_QUARTER_COLORS[3], 1, 1), }; testDrawImage(dest = new Dest(scale), new Rectangle(0, 0, -1, -1), new Rectangle(JBUIScale.scale(IMAGE_QUARTER_SIZE), JBUIScale.scale(IMAGE_QUARTER_SIZE), -1, -1), colors); // // 3) draw random quarter to random quarter, all the rest quarter colors should remain DEST_SURFACE_COLOR // colors = new TestColor[] { new TestColor(DEST_SURFACE_COLOR, 0, 0), new TestColor(DEST_SURFACE_COLOR, 1, 0), new TestColor(DEST_SURFACE_COLOR, 0, 1), new TestColor(DEST_SURFACE_COLOR, 1, 1), }; int srcCol = (int)floor(Math.random() + 0.5); int srcRow = (int)floor(Math.random() + 0.5); int dstCol = (int)floor(Math.random() + 0.5); int dstRow = (int)floor(Math.random() + 0.5); colors[dstRow * 2 + dstCol] = new TestColor(srcCol, srcRow, dstCol, dstRow); // replace the random quarter testDrawImage(dest = new Dest(scale), bounds(dstCol, dstRow), bounds(srcCol, srcRow), colors); }