1 /* 2 * Copyright (c) 2021 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 SKIA_CAMERA_H 17 #define SKIA_CAMERA_H 18 19 #include "include/utils/SkCamera.h" 20 21 #include "engine_adapter/impl_interface/camera_impl.h" 22 #include "utils/matrix.h" 23 #include "utils/scalar.h" 24 25 namespace OHOS { 26 namespace Rosen { 27 namespace Drawing { 28 class SkiaCamera : public CameraImpl { 29 public: 30 static inline constexpr AdapterType TYPE = AdapterType::SKIA_ADAPTER; 31 32 SkiaCamera() noexcept; ~SkiaCamera()33 ~SkiaCamera() override {} 34 GetType()35 AdapterType GetType() const override 36 { 37 return AdapterType::SKIA_ADAPTER; 38 } 39 40 void Save() override; 41 void Restore() override; 42 43 void Translate(scalar x, scalar y, scalar z) override; 44 void RotateX(scalar deg) override; 45 void RotateY(scalar deg) override; 46 void RotateZ(scalar deg) override; 47 48 void SetCameraPos(scalar x, scalar y, scalar z) override; 49 scalar GetCameraPosX() const override; 50 scalar GetCameraPosY() const override; 51 scalar GetCameraPosZ() const override; 52 53 void ApplyToMatrix(Matrix& m) override; 54 55 private: 56 Sk3DView view_; 57 }; 58 } // namespace Drawing 59 } // namespace Rosen 60 } // namespace OHOS 61 #endif