GreyscaleRotatedLuminanceSource: implemented getMatrix()
[zxing.git] / cpp / core / src / zxing / LuminanceSource.h
index e23621e..bbcfa26 100644 (file)
@@ -1,9 +1,10 @@
+#ifndef __LUMINANCESOURCE_H__
+#define __LUMINANCESOURCE_H__
 /*
  *  LuminanceSource.h
  *  zxing
  *
- *  Created by Ralf Kistner on 16/10/2009.
- *  Copyright 2008 ZXing authors All rights reserved.
+ *  Copyright 2010 ZXing authors All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef LUMINANCESOURCE_H_
-#define LUMINANCESOURCE_H_
-
 #include <zxing/common/Counted.h>
+#include <string.h>
 
 namespace zxing {
 
@@ -30,11 +29,19 @@ public:
   LuminanceSource();
   virtual ~LuminanceSource();
 
-  virtual int getWidth() = 0;
-  virtual int getHeight() = 0;
+  virtual int getWidth() const = 0;
+  virtual int getHeight() const = 0;
+
+  // Callers take ownership of the returned memory and must call delete [] on it themselves.
+  virtual unsigned char* getRow(int y, unsigned char* row) = 0;
+  virtual unsigned char* getMatrix();
+
+  virtual bool isCropSupported() const;
+  virtual Ref<LuminanceSource> crop(int left, int top, int width, int height);
+
+  virtual bool isRotateSupported() const;
+  virtual Ref<LuminanceSource> rotateCounterClockwise();
 
-  virtual unsigned char getPixel(int x, int y) = 0;
-  virtual unsigned char* copyMatrix();
 };
 
 }