1 /* 2 * Copyright (c) 2021-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_TEXT_OVERLAY_ROSEN_RENDER_TEXT_OVERLAY_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEXT_OVERLAY_ROSEN_RENDER_TEXT_OVERLAY_H 18 19 #ifndef USE_ROSEN_DRAWING 20 #include "include/core/SkCanvas.h" 21 #endif 22 23 #include "core/components/text_overlay/render_text_overlay.h" 24 #include "core/pipeline/base/rosen_render_context.h" 25 26 namespace OHOS::Ace { 27 28 class RosenRenderTextOverlay final : public RenderTextOverlay { 29 DECLARE_ACE_TYPE(RosenRenderTextOverlay, RenderTextOverlay) 30 31 public: 32 RosenRenderTextOverlay() = default; 33 ~RosenRenderTextOverlay() override = default; 34 35 void Paint(RenderContext& context, const Offset& offset) override; 36 37 private: 38 void PaintHandles(RenderContext& context) const; 39 #ifndef USE_ROSEN_DRAWING 40 void PaintHandle(SkCanvas* skCanvas, Offset centerOffset, bool isLeftHandle = false) const; 41 #else 42 void PaintHandle(RSCanvas* canvas, Offset centerOffset, bool isLeftHandle = false) const; 43 #endif 44 void PaintMagnifier(RenderContext& context); 45 #ifndef USE_ROSEN_DRAWING 46 void PaintClipLine(SkCanvas* skCanvas, SkPaint paint); 47 #else 48 void PaintClipLine(RSCanvas* canvas, RSPen pen); 49 #endif 50 void PaintMore(RenderContext& context); 51 void InitMoreButtonPaintColor(); 52 Offset CalculateMoreButtonCenter(); 53 bool CheckNeedPaintMore(); 54 bool NeedAdjustStartHandle(); 55 bool NeedAdjustEndHandle(); 56 void AdjustForAnimation(); 57 58 Color clipColor_ = Color::WHITE; 59 Color arrowColor_ = Color::BLACK; 60 }; 61 62 } // namespace OHOS::Ace 63 64 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEXT_OVERLAY_ROSEN_RENDER_TEXT_OVERLAY_H 65