1 /* 2 * Copyright (c) 2022-2023 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PATTERNLOCK_PATTERNLOCK_PAINT_METHOD_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PATTERNLOCK_PATTERNLOCK_PAINT_METHOD_H 18 19 #include <vector> 20 21 #include "base/geometry/dimension.h" 22 #include "base/geometry/ng/offset_t.h" 23 #include "base/memory/ace_type.h" 24 #include "base/memory/referenced.h" 25 #include "base/utils/macros.h" 26 #include "base/utils/noncopyable.h" 27 #include "base/utils/utils.h" 28 #include "core/components_ng/pattern/patternlock/patternlock_modifier.h" 29 #include "core/components_ng/pattern/patternlock/patternlock_paint_property.h" 30 #include "core/components_ng/render/node_paint_method.h" 31 #include "core/components_ng/render/paint_wrapper.h" 32 33 namespace OHOS::Ace::NG { 34 class ACE_EXPORT PatternLockPaintMethod : public NodePaintMethod { 35 DECLARE_ACE_TYPE(PatternLockPaintMethod, NodePaintMethod); 36 37 public: PatternLockPaintMethod(const OffsetF & cellCenter,bool isMoveEventValid,const std::vector<PatternLockCell> & choosePoint,const RefPtr<PatternLockModifier> & patternlockModifier)38 PatternLockPaintMethod(const OffsetF& cellCenter, bool isMoveEventValid, 39 const std::vector<PatternLockCell>& choosePoint, const RefPtr<PatternLockModifier>& patternlockModifier) 40 : cellCenter_(cellCenter), isMoveEventValid_(isMoveEventValid), choosePoint_(choosePoint), 41 patternlockModifier_(patternlockModifier) 42 {} 43 44 ~PatternLockPaintMethod() override = default; 45 GetContentModifier(PaintWrapper * paintWrapper)46 RefPtr<Modifier> GetContentModifier(PaintWrapper* paintWrapper) override 47 { 48 CHECK_NULL_RETURN(patternlockModifier_, nullptr); 49 return patternlockModifier_; 50 } 51 52 void UpdateContentModifier(PaintWrapper* paintWrapper) override; 53 54 private: 55 void GetThemeProp(); 56 57 float sideLength_ = 0.0f; 58 float scaleActiveCircleRadius_ = 1.0f; 59 float scaleBackgroundCircleRadius_ = 1.0f; 60 float scaleWaveCircleRadiusStart_ = 1.0f; 61 float scaleWaveCircleRadiusEnd_ = 1.0f; 62 float hoverRadiusScale_ = 1.0f; 63 64 Dimension circleRadius_; 65 Color regularColor_; 66 Color selectedColor_; 67 Color activeColor_; 68 Color pathColor_; 69 Color wrongColor_; 70 Color correctColor_; 71 Color hoverColor_; 72 Color activeCircleColor_; 73 Dimension pathStrokeWidth_; 74 Dimension activeCircleRadius_; 75 Dimension backgroundCircleRadius_; 76 77 OffsetF cellCenter_; 78 bool isMoveEventValid_ = false; 79 bool enableWaveEffect_ = true; 80 bool enableForeground_ = false; 81 std::vector<PatternLockCell> choosePoint_; 82 RefPtr<PatternLockModifier> patternlockModifier_; 83 84 ACE_DISALLOW_COPY_AND_MOVE(PatternLockPaintMethod); 85 }; 86 } // namespace OHOS::Ace::NG 87 88 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PATTERNLOCK_PATTERNLOCK_PAINT_METHOD_H 89