/** * Creates a new image of the same type which also has the same shape. This is the same as calling * {@link #createNew(int, int)} with this image's width and height. * * @return new image with the same shape as this. */ public T createSameShape() { return createNew(width,height); }
/** * If the output has not been declared a new instance is declared. If an instance of the output * is provided its bounds are checked. */ public static <T extends ImageBase<T>> T checkDeclare(T input, T output) { if (output == null) { output = (T) input.createNew(input.width, input.height); } else if (output.width != input.width || output.height != input.height) throw new IllegalArgumentException("Width and/or height of input and output do not match. "+input.width+"x"+input.height+" "+output.width+"x"+output.height); return output; }
larger[i] = img.createNew(img.getWidth() + 10, img.getHeight() + 12);
temp = (T)input.createNew(1,1);