• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_TEXT_TEXT_PAINT_METHOD_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_TEXT_TEXT_PAINT_METHOD_H
18 
19 #include <utility>
20 
21 #include "base/memory/ace_type.h"
22 #include "base/memory/referenced.h"
23 #include "base/utils/macros.h"
24 #include "base/utils/utils.h"
25 #include "core/components_ng/pattern/text/text_content_modifier.h"
26 #include "core/components_ng/pattern/text/text_layout_property.h"
27 #include "core/components_ng/pattern/text/text_overlay_modifier.h"
28 #include "core/components_ng/render/node_paint_method.h"
29 #include "core/components_ng/render/paragraph.h"
30 
31 namespace OHOS::Ace::NG {
32 class ACE_EXPORT TextPaintMethod : public NodePaintMethod {
33     DECLARE_ACE_TYPE(TextPaintMethod, NodePaintMethod)
34 public:
35     TextPaintMethod(const WeakPtr<Pattern>& pattern, RefPtr<Paragraph> paragraph, float baselineOffset,
36         RefPtr<TextContentModifier> textContentModifier, RefPtr<TextOverlayModifier> textOverlayModifier);
37 
38     ~TextPaintMethod() override = default;
39 
40     RefPtr<Modifier> GetContentModifier(PaintWrapper* paintWrapper) override;
41     void UpdateContentModifier(PaintWrapper* paintWrapper) override;
42 
43     RefPtr<Modifier> GetOverlayModifier(PaintWrapper* paintWrapper) override;
44     void UpdateOverlayModifier(PaintWrapper* paintWrapper) override;
45 
46 private:
47     WeakPtr<Pattern> pattern_;
48     RefPtr<Paragraph> paragraph_;
49     float baselineOffset_;
50 
51     RefPtr<TextContentModifier> textContentModifier_;
52     RefPtr<TextOverlayModifier> textOverlayModifier_;
53 
54     ACE_DISALLOW_COPY_AND_MOVE(TextPaintMethod);
55 };
56 
57 } // namespace OHOS::Ace::NG
58 
59 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_TEXT_TEXT_PAINT_METHOD_H
60