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_SWIPER_ROSEN_RENDER_SWIPER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_SWIPER_ROSEN_RENDER_SWIPER_H 18 19 #include "core/components/swiper/render_swiper.h" 20 #include "core/components_ng/render/drawing.h" 21 22 namespace OHOS::Ace { 23 class RosenRenderSwiper : public RenderSwiper { 24 DECLARE_ACE_TYPE(RosenRenderSwiper, RenderSwiper); 25 26 public: 27 void Update(const RefPtr<Component>& component) override; 28 void Paint(RenderContext& context, const Offset& offset) override; 29 30 private: 31 void UpdateIndicator() override; 32 void PaintIndicator(RenderContext& context, const Offset& offset); 33 void PaintMask(RenderContext& context, const Offset& offset) const; 34 void LayoutDigitalIndicator(); 35 void CanvasDrawIndicator(RenderContext& context, const Offset& offset); 36 void PaintFade(RenderContext& context, const Offset& offset); 37 void PaintShadow(RSCanvas* canvas, const Offset& offset); 38 IndicatorProperties PrepareIndicatorProperties() const; 39 40 void DrawIndicator(RenderContext& context, const Offset& offset); 41 void DrawIndicatorHoverBackground(RenderContext& context, const Offset& offset); 42 void DrawIndicatorBackground(RenderContext& context, const Offset& offset); 43 void DrawIndicatorItems(RenderContext& context, const Offset& offset); 44 void DrawIndicatorFocus(RenderContext& context, const Offset& offset); 45 46 void GetRRect(RSRoundRect& rRect, double& startOffset, double& endOffset, const Offset& offset); 47 bool HideIndicatorPoint(int32_t index, const IndicatorOffsetInfo& pointInfo, const Offset& offset); 48 void GetIndicatorPointMoveOffset(int32_t index, Offset& animationMove); 49 void InitMoveRange(); 50 51 RefPtr<RenderText> renderDigitalIndicator_; 52 53 int32_t moveStartIndex_ = 0; 54 int32_t moveEndIndex_ = 0; 55 }; 56 57 } // namespace OHOS::Ace 58 59 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_SWIPER_ROSEN_RENDER_SWIPER_H 60