1 /* 2 * Copyright (c) 2024 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_PATTERNS_TEXT_FIELD_TEXT_FIELD_FOREGROUND_MODIFIER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TEXT_FIELD_TEXT_FIELD_FOREGROUND_MODIFIER_H 18 19 #include "base/memory/ace_type.h" 20 #include "base/utils/utils.h" 21 #include "core/components_ng/base/modifier.h" 22 #include "core/components_ng/pattern/pattern.h" 23 #include "core/components_ng/render/drawing.h" 24 25 namespace OHOS::Ace::NG { 26 class TextFieldForegroundModifier : public ForegroundModifier { 27 DECLARE_ACE_TYPE(TextFieldForegroundModifier, ForegroundModifier); 28 29 public: 30 explicit TextFieldForegroundModifier(const WeakPtr<OHOS::Ace::NG::Pattern>& pattern); 31 ~TextFieldForegroundModifier() override = default; 32 33 void onDraw(DrawingContext& context) override; 34 SetInnerBorderWidth(float value)35 void SetInnerBorderWidth(float value) 36 { 37 CHECK_NULL_VOID(innerBorderWidth_); 38 innerBorderWidth_->Set(value); 39 } 40 41 private: 42 std::vector<RSPoint> MakeRRadius(const BorderRadiusProperty& border, float borderWidth) const; 43 WeakPtr<Pattern> pattern_; 44 45 RefPtr<PropertyFloat> innerBorderWidth_; 46 ACE_DISALLOW_COPY_AND_MOVE(TextFieldForegroundModifier); 47 }; 48 } // namespace OHOS::Ace::NG 49 50 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TEXT_FIELD_TEXT_FIELD_FOREGROUND_MODIFIER_H 51