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 "draw/canvas.h" 20 #include "image/bitmap.h" 21 #include "pipeline/rs_recording_canvas.h" 22 #include "render/rs_pixel_map_util.h" 23 #include "utils/matrix.h" 24 25 namespace OHOS { 26 namespace MMI { 27 namespace { 28 constexpr int32_t DEFAULT_LIFESPAN { -1 }; 29 } // namespace 30 31 class KnuckleDivergentPoint { 32 public: 33 explicit KnuckleDivergentPoint(std::shared_ptr<OHOS::Media::PixelMap> pixelMap); 34 ~KnuckleDivergentPoint() = default; 35 void Update(); 36 void Clear(); 37 void Draw(Rosen::ExtendRecordingCanvas* canvas); 38 void Reset(double pointX, double pointY); 39 bool IsEnded() const; 40 41 private: 42 double moveVelocityX_ { 0.0 }; 43 double moveVelocityY_ { 0.0 }; 44 double pointX_ { 0.0 }; 45 double pointY_ { 0.0 }; 46 int32_t lifespan_ { DEFAULT_LIFESPAN }; 47 std::shared_ptr<OHOS::Media::PixelMap> traceShadow_ { nullptr }; 48 Rosen::Drawing::Matrix traceMatrix_; 49 OHOS::Rosen::Drawing::Brush brush_; 50 }; 51 } // namespace MMI 52 } // namespace OHOS 53 #endif // KNUCKLE_GIVERGENT_POINT_H 54