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_GIVERGENT_POINT_H 17 #define KNUCKLE_GIVERGENT_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 namespace { 25 constexpr int32_t DEFAULT_LIFESPAN { -1 }; 26 } // namespace 27 28 class KnuckleDivergentPoint { 29 public: 30 explicit KnuckleDivergentPoint(std::shared_ptr<OHOS::Media::PixelMap> pixelMap); 31 ~KnuckleDivergentPoint() = default; 32 void Update(); 33 void Clear(); 34 void Draw(Rosen::ExtendRecordingCanvas* canvas); 35 void Reset(double pointX, double pointY); 36 bool IsEnded() const; 37 38 private: 39 double moveVelocityX_ { 0.0 }; 40 double moveVelocityY_ { 0.0 }; 41 double pointX_ { 0.0 }; 42 double pointY_ { 0.0 }; 43 int32_t lifespan_ { DEFAULT_LIFESPAN }; 44 std::shared_ptr<OHOS::Media::PixelMap> traceShadow_ { nullptr }; 45 Rosen::Drawing::Matrix traceMatrix_; 46 OHOS::Rosen::Drawing::Brush brush_; 47 }; 48 } // namespace MMI 49 } // namespace OHOS 50 #endif // KNUCKLE_GIVERGENT_POINT_H 51