<commit_before>/*
 * Copyright 2007 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.zxing;

import com.google.zxing.common.BitArray;

/**
 * <p>Encapsulates a generic black-and-white bitmap -- a collection of pixels in two dimensions.
 * This unifies many possible representations, like AWT's <code>BufferedImage</code>.</p>
 *
 * @author <EMAIL> (<NAME>)
 */
public interface MonochromeBitmapSource {

  /**
   * @param x horizontal offset, from left, of the pixel
   * @param y vertical offset, from top, of the pixel
   * @return true iff the pixel at (x,y) is black
   */
  boolean isBlack(int x, int y);

  /**
   * <p>Returns an entire row of black/white pixels as an array of bits, where "true" means "black".
   * This is a sort of "bulk get" operation intended to enable efficient access in
   * certain situations.</p>
   *
   * @param y vertical offset, from top, of the row of pixels
   * @param row if not null, {@link BitArray} to write pixels into. If null, a new {@link BitArray}
   * is allocated and returned.
   * @param startX horizontal offset, from left, from which to start getting pixels
   * @param getWidth number of pixels to get from the row
   * @return {@link BitArray} representing the (subset of the) row of pixels. If row parameter
   *         was not null, it is returned.
   */
  BitArray getBlackRow(int y, BitArray row, int startX, int getWidth);

  /**
   * @return height of underlying image
   */
  int getHeight();

  /**
   * @return width of underlying image
   */
  int getWidth();

  /**
   * <p>Estimates black point according to the given method, which is optionally parameterized by
   * a single int argument. For {@link BlackPointEstimationMethod#ROW_SAMPLING}, this
   * specifies the row to sample.</p>
   *
   * <p>The estimated value will be used in subsequent computations that rely on an estimated black
   * point.</p>
   *
   * @param method black point estimation method
   * @param argument method-specific argument
   */
  void estimateBlackPoint(BlackPointEstimationMethod method, int argument);

  /**
   * @return {@link BlackPointEstimationMethod} representing last sampling method used
   */
  BlackPointEstimationMethod getLastEstimationMethod();

  /**
   * <p>Optional operation which returns an implementation based on the same underlying
   * image, but which behaves as if the underlying image had been rotated 90 degrees
   * counterclockwise. This is useful in the context of 1D barcodes and the<commit_msg>Oops, forgot to include in last commit<commit_after>/*
 * Copyright 2007 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.zxing;

import com.google.zxing.common.BitArray;

/**
 * <p>Encapsulates a generic black-and-white bitmap -- a collection of pixels in two dimensions.
 * This unifies many possible representations, like AWT's <code>BufferedImage</code>.</p>
 *
 * @author <EMAIL> (<NAME>)
 */
public interface MonochromeBitmapSource {

  /**
   * @param x horizontal offset, from left, of the pixel
   * @param y vertical offset, from top, of the pixel
   * @return true iff the pixel at (x,y) is black
   */
  boolean isBlack(int x, int y);

  /**
   * <p>Returns an entire row of black/white pixels as an array of bits, where "true" means "black".
   * This is a sort of "bulk get" operation intended to enable efficient access in
   * certain situations.</p>
   *
   * @param y vertical offset, from top, of the row of pixels
   * @param row if not null, {@link BitArray} to write pixels into. If null, a new {@link BitArray}
   * is allocated and returned.
   * @param startX horizontal offset, from left, from which to start getting pixels
   * @param getWidth number of pixels to get from the row
   * @return {@link BitArray} representing the (subset of the) row of pixels. If row parameter
   *         was not null, it is returned.
   */
  BitArray getBlackRow(int y, BitArray row, int startX, int getWidth);

  /**
   * @return height of underlying image
   */
  int getHeight();

  /**
   * @return width of underlying image
   */
  int getWidth();

  /**
   * <p>Estimates black point according to the given method, which is optionally parameterized by
   * a single int argument. For {@link BlackPointEstimationMethod#ROW_SAMPLING}, this
   * specifies the row to sample.</p>
   *
   * <p>The estimated value will be used in subsequent computations that rely on an estimated black
   * point.</p>
   *
   * @param method black point estimation method
   * @param argument method-specific argument
   */
  void estimateBlackPoint(BlackPointEstimationMethod method, int argument) throws ReaderException;

  /**
   * @return {@link BlackPointEstimationMethod} representing last sampling method used
   */
  BlackPointEstimationMethod getLastEstimationMethod();

  /**
   * <p>Optional operation which returns an implementation based on the same underlying
   * image, but which behaves as if the underlying image had been rotated 90 degrees
   * counterclockwise. This is useful in the context of 1D barcodes and the
{'fraction_non_alphanumeric': 0.0843432689158205, 'fraction_numerical': 0.0036030134294136916, 'mean_word_length': 3.507011070110701, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5212492', 'n_tokens_mistral': 1668, 'n_tokens_neox': 1618, 'n_words': 763}