2 * Licensed under the Apache License, Version 2.0 (the "License");
\r
3 * you may not use this file except in compliance with the License.
\r
4 * You may obtain a copy of the License at
\r
6 * http://www.apache.org/licenses/LICENSE-2.0
\r
8 * Unless required by applicable law or agreed to in writing, software
\r
9 * distributed under the License is distributed on an "AS IS" BASIS,
\r
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
11 * See the License for the specific language governing permissions and
\r
12 * limitations under the License.
\r
16 using BitArray = com.google.zxing.common.BitArray;
\r
17 namespace com.google.zxing
\r
20 /// <summary> <p>Encapsulates a generic black-and-white bitmap -- a collection of pixels in two dimensions.
\r
21 /// This unifies many possible representations, like AWT's <code>BufferedImage</code>.</p>
\r
24 /// <author> srowen@google.com (Sean Owen)
\r
26 public interface MonochromeBitmapSource
\r
29 * @param x horizontal offset, from left, of the pixel
\r
30 * @param y vertical offset, from top, of the pixel
\r
31 * @return true iff the pixel at (x,y) is black
\r
33 bool isBlack(int x, int y);
\r
36 * <p>Returns an entire row of black/white pixels as an array of bits, where "true" means "black".
\r
37 * This is a sort of "bulk get" operation intended to enable efficient access in
\r
38 * certain situations.</p>
\r
40 * @param y vertical offset, from top, of the row of pixels
\r
41 * @param row if not null, {@link BitArray} to write pixels into. If null, a new {@link BitArray}
\r
42 * is allocated and returned.
\r
43 * @param startX horizontal offset, from left, from which to start getting pixels
\r
44 * @param getWidth number of pixels to get from the row
\r
45 * @return {@link BitArray} representing the (subset of the) row of pixels. If row parameter
\r
46 * was not null, it is returned.
\r
48 BitArray getBlackRow(int y, BitArray row, int startX, int getWidth);
\r
51 * Entirely analogous to {@link #getBlackRow(int, BitArray, int, int)} but gets a column.
\r
53 BitArray getBlackColumn(int x, BitArray column, int startY, int getHeight);
\r
56 * @return height of underlying image
\r
61 * @return width of underlying image
\r
66 * <p>Estimates black point according to the given method, which is optionally parameterized by
\r
67 * a single int argument. For {@link BlackPointEstimationMethod#ROW_SAMPLING}, this
\r
68 * specifies the row to sample.</p>
\r
70 * <p>The estimated value will be used in subsequent computations that rely on an estimated black
\r
73 * @param method black point estimation method
\r
74 * @param argument method-specific argument
\r
76 void estimateBlackPoint(BlackPointEstimationMethod method, int argument);
\r
79 * @return {@link BlackPointEstimationMethod} representing last sampling method used
\r
81 BlackPointEstimationMethod getLastEstimationMethod();
\r
84 * <p>Optional operation which returns an implementation based on the same underlying
\r
85 * image, but which behaves as if the underlying image had been rotated 90 degrees
\r
86 * counterclockwise. This is useful in the context of 1D barcodes and the
\r
87 * {@link DecodeHintType#TRY_HARDER} decode hint, and is only intended to be
\r
88 * used in non-resource-constrained environments. Hence, implementations
\r
89 * of this class which are only used in resource-constrained mobile environments
\r
90 * don't have a need to implement this.</p>
\r
92 * @throws IllegalArgumentException if not supported
\r
94 MonochromeBitmapSource rotateCounterClockwise();
\r
97 * @return true iff rotation is supported
\r
98 * @see #rotateCounterClockwise()
\r
100 bool isRotateSupported();
\r