• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 KNUCKLE_GLOW_POINT_H
17 #define KNUCKLE_GLOW_POINT_H
18 
19 #include "pipeline/rs_recording_canvas.h"
20 #include "render/rs_pixel_map_util.h"
21 
22 namespace OHOS {
23 namespace MMI {
24 class KnuckleGlowPoint {
25 public:
26     explicit KnuckleGlowPoint(std::shared_ptr<OHOS::Media::PixelMap> pixelMap);
27     ~KnuckleGlowPoint() = default;
28     void Update();
29     void Draw(Rosen::ExtendRecordingCanvas* canvas);
30     void Reset(double pointX, double pointY, float lifespanOffset);
31     bool IsEnded() const;
32 
33 private:
34     void UpdateMatrix();
35     int64_t GetNanoTime() const;
36 
37     double lifespan_ { -1.0 };
38     double pointX_ { 0.0 };
39     double pointY_ { 0.0 };
40     int64_t lastUpdateTimeMillis_ { 0 };
41     float traceSize_ { 0.f };
42 
43     Rosen::Drawing::Matrix traceMatrix_;
44     std::shared_ptr<OHOS::Media::PixelMap> traceShadow_ { nullptr };
45     OHOS::Rosen::Drawing::Brush brush_;
46 };
47 } // namespace MMI
48 } // namespace OHOS
49 #endif // KNUCKLE_GLOW_POINT_H
50