protected internal Binarizer(LuminanceSource source) { if (source == null) { throw new System.ArgumentException("Source must be non-null."); } this.source = source; }
/// <summary> Creates a new object with the same type as this Binarizer implementation, but with pristine /// state. This is needed because Binarizer implementations may be stateful, e.g. keeping a cache /// of 1 bit data. See Effective Java for why we can't use Java's clone() method. /// /// </summary> /// <param name="source">The LuminanceSource this Binarizer will operate on. /// </param> /// <returns> A new concrete Binarizer implementation object. /// </returns> public abstract Binarizer createBinarizer(LuminanceSource source);
/// <summary> Returns a new object with rotated image data. Only callable if isRotateSupported() is true. /// /// </summary> /// <returns> A rotated version of this object. /// </returns> public BinaryBitmap rotateCounterClockwise() { LuminanceSource newSource = binarizer.LuminanceSource.rotateCounterClockwise(); return(new BinaryBitmap(binarizer.createBinarizer(newSource))); }
/// <summary> Returns a new object with cropped image data. Implementations may keep a reference to the /// original data rather than a copy. Only callable if isCropSupported() is true. /// /// </summary> /// <param name="left">The left coordinate, 0 <= left < getWidth(). /// </param> /// <param name="top">The top coordinate, 0 <= top <= getHeight(). /// </param> /// <param name="width">The width of the rectangle to crop. /// </param> /// <param name="height">The height of the rectangle to crop. /// </param> /// <returns> A cropped version of this object. /// </returns> public BinaryBitmap crop(int left, int top, int width, int height) { LuminanceSource newSource = binarizer.LuminanceSource.crop(left, top, width, height); return(new BinaryBitmap(binarizer.createBinarizer(newSource))); }