Committed C# port from Mohamad
[zxing.git] / csharp / MonochromeBitmapSource.cs
1 /*\r
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
5 *\r
6 *      http://www.apache.org/licenses/LICENSE-2.0\r
7 *\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
13 */\r
14 \r
15 using System;\r
16 using BitArray = com.google.zxing.common.BitArray;\r
17 namespace com.google.zxing\r
18 {\r
19 \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
22     /// \r
23     /// </summary>\r
24     /// <author>  srowen@google.com (Sean Owen)\r
25     /// </author>\r
26     public interface MonochromeBitmapSource\r
27     { \r
28         /**\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
32        */\r
33       bool isBlack(int x, int y);\r
34 \r
35       /**\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
39        *\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
47        */\r
48       BitArray getBlackRow(int y, BitArray row, int startX, int getWidth);\r
49 \r
50       /**\r
51        * Entirely analogous to {@link #getBlackRow(int, BitArray, int, int)} but gets a column.\r
52        */\r
53       BitArray getBlackColumn(int x, BitArray column, int startY, int getHeight);\r
54 \r
55       /**\r
56        * @return height of underlying image\r
57        */\r
58       int getHeight();\r
59 \r
60       /**\r
61        * @return width of underlying image\r
62        */\r
63       int getWidth();\r
64 \r
65       /**\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
69        *\r
70        * <p>The estimated value will be used in subsequent computations that rely on an estimated black\r
71        * point.</p>\r
72        *\r
73        * @param method black point estimation method\r
74        * @param argument method-specific argument\r
75        */\r
76       void estimateBlackPoint(BlackPointEstimationMethod method, int argument);\r
77 \r
78       /**\r
79        * @return {@link BlackPointEstimationMethod} representing last sampling method used\r
80        */\r
81       BlackPointEstimationMethod getLastEstimationMethod();\r
82 \r
83       /**\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
91        *\r
92        * @throws IllegalArgumentException if not supported\r
93        */\r
94       MonochromeBitmapSource rotateCounterClockwise();\r
95 \r
96       /**\r
97        * @return true iff rotation is supported\r
98        * @see #rotateCounterClockwise()\r
99        */\r
100       bool isRotateSupported();\r
101 \r
102         \r
103     }\r
104 }