00001 /* 00002 * Copyright 2009 ZXing authors 00003 * Copyright 2011 Robert Theis 00004 * Copyright 2012 Jaime Navarro Santapau 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00027 package edu.uoc.ocr; 00028 00040 public abstract class LuminanceSource { 00041 00042 private final int width; 00043 private final int height; 00044 00045 protected LuminanceSource(int width, int height) { 00046 this.width = width; 00047 this.height = height; 00048 } 00049 00067 public abstract byte[] getRow(int y, byte[] row); 00068 00077 public abstract byte[] getMatrix(); 00078 00082 public final int getWidth() { 00083 return width; 00084 } 00085 00089 public final int getHeight() { 00090 return height; 00091 } 00092 00096 public boolean isCropSupported() { 00097 return true; 00098 } 00099 00115 public LuminanceSource crop(int left, int top, int width, int height) { 00116 throw new RuntimeException( 00117 "This luminance source does not support cropping."); 00118 } 00119 00123 public boolean isRotateSupported() { 00124 return false; 00125 } 00126 00133 public LuminanceSource rotateCounterClockwise() { 00134 throw new RuntimeException( 00135 "This luminance source does not support rotation."); 00136 } 00137 00138 }