LuminanceSource.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
  2. #ifndef __LUMINANCESOURCE_H__
  3. #define __LUMINANCESOURCE_H__
  4. /*
  5. * LuminanceSource.h
  6. * zxing
  7. *
  8. * Copyright 2010 ZXing authors All rights reserved.
  9. *
  10. * Licensed under the Apache License, Version 2.0 (the "License");
  11. * you may not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS,
  18. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. */
  22. #include <zxing/common/Counted.h>
  23. #include <zxing/common/Array.h>
  24. #include <string.h>
  25. namespace zxing {
  26. class LuminanceSource : public Counted {
  27. private:
  28. const int width;
  29. const int height;
  30. public:
  31. LuminanceSource(int width, int height);
  32. virtual ~LuminanceSource();
  33. int getWidth() const { return width; }
  34. int getHeight() const { return height; }
  35. // Callers take ownership of the returned memory and must call delete [] on it themselves.
  36. virtual ArrayRef<char> getRow(int y, ArrayRef<char> row) const = 0;
  37. virtual ArrayRef<char> getMatrix() const = 0;
  38. virtual bool isCropSupported() const;
  39. virtual Ref<LuminanceSource> crop(int left, int top, int width, int height) const;
  40. virtual bool isRotateSupported() const;
  41. virtual Ref<LuminanceSource> invert() const;
  42. virtual Ref<LuminanceSource> rotateCounterClockwise() const;
  43. operator std::string () const;
  44. };
  45. }
  46. #endif /* LUMINANCESOURCE_H_ */