/** * Scales a sampleable by the given factor. The position of the origin is fixed. * * @param factor the factor to scale by * @param base the sampleable to scale * @return the scaled sampleable */ public static Sampleable scale(double factor, Sampleable base) { BoundingBox bb = base.getBoundingBox(); return new AbstractSampleable( factor * bb.top(), factor * bb.bottom(), factor * bb.left(), factor * bb.right()) { @Override public Color getColorAt(Point<Double> point) { return base.getColorAt(point.scaleBy(1 / factor)); } }; }