1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
8 #define FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 class CBC_BarcodeRow;
14 
15 class CBC_BarcodeMatrix {
16  public:
17   CBC_BarcodeMatrix();
18   CBC_BarcodeMatrix(int32_t height, int32_t width);
19   virtual ~CBC_BarcodeMatrix();
20 
getCurrentRow()21   CBC_BarcodeRow* getCurrentRow() const { return m_matrix[m_currentRow].get(); }
getWidth()22   int32_t getWidth() const { return m_outWidth; }
getHeight()23   int32_t getHeight() const { return m_outHeight; }
24   void set(int32_t x, int32_t y, uint8_t value);
25   void setMatrix(int32_t x, int32_t y, bool black);
26   void startRow();
27   std::vector<uint8_t>& getMatrix();
28   std::vector<uint8_t>& getScaledMatrix(int32_t scale);
29   std::vector<uint8_t>& getScaledMatrix(int32_t xScale, int32_t yScale);
30 
31  private:
32   std::vector<std::unique_ptr<CBC_BarcodeRow>> m_matrix;
33   std::vector<uint8_t> m_matrixOut;
34   int32_t m_currentRow;
35   int32_t m_height;
36   int32_t m_width;
37   int32_t m_outWidth;
38   int32_t m_outHeight;
39 };
40 
41 #endif  // FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
42