1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SCAN_PARAMETERS_H 17 #define SCAN_PARAMETERS_H 18 19 #include <vector> 20 #include "parcel.h" 21 #include "scan_constant.h" 22 23 namespace OHOS::Scan { 24 class ScanParameters final : public Parcelable { 25 public: 26 explicit ScanParameters(); 27 ScanParameters(const ScanParameters &right); 28 ScanParameters &operator=(const ScanParameters &right); 29 virtual ~ScanParameters(); 30 31 void Reset(); 32 void Dump(); 33 34 void SetFormat(const ScanFrame &format); 35 void SetLastFrame(const bool &lastFrame); 36 void SetBytesPerLine(const int32_t &bytesPerLine); 37 void SetPixelsPerLine(const int32_t &pixelsPerLine); 38 void SetLines(const int32_t &lines); 39 void SetDepth(const int32_t &depth); 40 41 [[nodiscard]] ScanFrame GetFormat() const; 42 [[nodiscard]] bool GetLastFrame() const; 43 [[nodiscard]] int32_t GetBytesPerLine() const; 44 [[nodiscard]] int32_t GetPixelsPerLine() const; 45 [[nodiscard]] int32_t GetLines() const; 46 [[nodiscard]] int32_t GetDepth() const; 47 48 virtual bool Marshalling(Parcel &parcel) const override; 49 static std::shared_ptr<ScanParameters> Unmarshalling(Parcel &parcel); 50 private: 51 void ReadFromParcel(Parcel &parcel); 52 53 private: 54 ScanFrame format_; 55 bool lastFrame_; 56 int32_t bytesPerLine_; 57 int32_t pixelsPerLine_; 58 int32_t lines_; 59 int32_t depth_; 60 }; 61 } // namespace OHOS::Scan 62 #endif // SCAN_PARAMETERS_H 63