2 * Copyright 2007 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.google.zxing;
19 import com.google.zxing.common.BitArray;
22 * Encapsulates a generic black-and-white bitmap -- a collection of pixels in two dimensions.
23 * This unifies many possible representations, like AWT's <code>BufferedImage</code>.
25 * @author srowen@google.com (Sean Owen)
27 public interface MonochromeBitmapSource {
30 * @param x horizontal offset, from left, of the pixel
31 * @param y vertical offset, from top, of the pixel
32 * @return true iff the pixel at (x,y) is black
34 boolean isBlack(int x, int y);
37 * Returns an entire row of black/white pixels as an array of bits, where "true" means "black".
38 * This is a sort of "bulk get" operation intended to enable efficient access in
41 * @param y vertical offset, from top, of the row of pixels
42 * @param row if not null, {@link BitArray} to write pixels into. If null, a new {@link BitArray}
43 * is allocated and returned.
44 * @param startX horizontal offset, from left, from which to start getting pixels
45 * @param getWidth number of pixels to get from the row
46 * @return {@link BitArray} representing the (subset of the) row of pixels. If row parameter
47 * was not null, it is returned.
49 BitArray getBlackRow(int y, BitArray row, int startX, int getWidth);
52 * @return height of underlying image
57 * @return width of underlying image