blob: 744461903d81164a4586649d7fe659d6978dd4cb [file] [log] [blame]
Dan Sinclair1770c022016-03-14 14:14:16 -04001// 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
Dan Sinclaire7786682017-03-29 15:18:41 -04007#ifndef FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
8#define FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
Dan Sinclair1770c022016-03-14 14:14:16 -04009
dsinclaira52ab742016-09-29 13:59:29 -070010#include "core/fxcrt/fx_system.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040011
12class CBC_CommonBitArray;
13
14class CBC_CommonBitMatrix {
15 public:
16 CBC_CommonBitMatrix();
Lei Zhang1b228802017-04-05 18:42:22 -070017 ~CBC_CommonBitMatrix();
weili29b8ad02016-06-14 18:20:04 -070018
Lei Zhang1b228802017-04-05 18:42:22 -070019 void Init(int32_t dimension);
20 void Init(int32_t width, int32_t height);
weili29b8ad02016-06-14 18:20:04 -070021
Lei Zhang1b228802017-04-05 18:42:22 -070022 bool Get(int32_t x, int32_t y) const;
Dan Sinclair1770c022016-03-14 14:14:16 -040023 void Set(int32_t x, int32_t y);
24 void Flip(int32_t x, int32_t y);
25 void Clear();
Lei Zhang1b228802017-04-05 18:42:22 -070026 bool SetRegion(int32_t left, int32_t top, int32_t width, int32_t height);
Dan Sinclair1770c022016-03-14 14:14:16 -040027 CBC_CommonBitArray* GetRow(int32_t y, CBC_CommonBitArray* row);
28 void SetRow(int32_t y, CBC_CommonBitArray* row);
29 CBC_CommonBitArray* GetCol(int32_t y, CBC_CommonBitArray* row);
30 void SetCol(int32_t y, CBC_CommonBitArray* col);
Lei Zhang1b228802017-04-05 18:42:22 -070031 int32_t GetWidth() const;
32 int32_t GetHeight() const;
33 int32_t GetRowSize() const;
Dan Sinclair1770c022016-03-14 14:14:16 -040034 int32_t* GetBits();
35
36 private:
Lei Zhang1b228802017-04-05 18:42:22 -070037 int32_t m_width = 0;
38 int32_t m_height = 0;
39 int32_t m_rowSize = 0;
40 int32_t* m_bits = nullptr;
Dan Sinclair1770c022016-03-14 14:14:16 -040041};
42
Dan Sinclaire7786682017-03-29 15:18:41 -040043#endif // FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_