• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_RENDER_ADAPTER_MASK_PROGRESS_MOON_PROGRESS_MODIFIER_H
16 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_RENDER_ADAPTER_MASK_PROGRESS_MOON_PROGRESS_MODIFIER_H
17 
18 #include "core/components/common/properties/color.h"
19 #include "core/components_ng/base/modifier.h"
20 
21 namespace OHOS::Ace::NG {
22 class MoonProgressModifier : public OverlayModifier {
23 public:
24     MoonProgressModifier();
25     ~MoonProgressModifier() override = default;
26 
27     void onDraw(DrawingContext& context) override;
28 
29     void SetMaskColor(LinearColor color);
30     void SetValue(float value);
31     void SetMaxValue(float value);
32     float GetMaxValue();
33     void InitRatio();
34     void SetMoonAnimate(float value) const;
35     void SetBigRadius(const SizeF& frameSize);
36 
37 private:
38     void PaintSquareMoon(RSCanvas& canvas, const SizeF& frameSize) const;
39 
40     // Animatable
41     RefPtr<AnimatablePropertyColor> maskColor_;
42     RefPtr<AnimatablePropertyFloat> ratio_;
43     RefPtr<AnimatablePropertyFloat> value_;
44     // No animatable
45     RefPtr<PropertyFloat> maxValue_;
46     // Others
47     float bigRadius_ = .0f;
48     float smallRadius_ = .0f;
49 };
50 } // namespace OHOS::Ace::NG
51 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_RENDER_ADAPTER_MASK_PROGRESS_MOON_PROGRESS_MODIFIER_H
52