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 SkiaCamera() noexcept; ~SkiaCamera()32 ~SkiaCamera() override {} GetType()33 AdapterType GetType() const override 34 { 35 return AdapterType::SKIA_ADAPTER; 36 } 37 38 void Save() override; 39 void Restore() override; 40 41 void Translate(scalar x, scalar y, scalar z) override; 42 void RotateX(scalar deg) override; 43 void RotateY(scalar deg) override; 44 void RotateZ(scalar deg) override; 45 46 void SetCameraPos(scalar x, scalar y, scalar z) override; 47 scalar GetCameraPosX() const override; 48 scalar GetCameraPosY() const override; 49 scalar GetCameraPosZ() const override; 50 51 void ApplyToMatrix(Matrix& m) override; 52 53 private: 54 Sk3DView view_; 55 }; 56 } // namespace Drawing 57 } // namespace Rosen 58 } // namespace OHOS 59 #endif