1 /* 2 * Copyright (c) 2025 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 RENDER_SERVICE_CLIENT_CORE_MODIFIER_NG_GEOMETRY_RS_TRANSFORM_MODIFIER_H 17 #define RENDER_SERVICE_CLIENT_CORE_MODIFIER_NG_GEOMETRY_RS_TRANSFORM_MODIFIER_H 18 19 #include "modifier_ng/rs_modifier_ng.h" 20 21 namespace OHOS::Rosen::ModifierNG { 22 class RSC_EXPORT RSTransformModifier : public RSModifier { 23 public: 24 RSTransformModifier() = default; 25 ~RSTransformModifier() override = default; 26 27 static inline constexpr auto Type = RSModifierType::TRANSFORM; GetType()28 RSModifierType GetType() const override 29 { 30 return Type; 31 }; 32 MarkNodeDirty()33 void MarkNodeDirty() override 34 { 35 if (auto node = node_.lock()) { 36 node->MarkDirty(NodeDirtyType::GEOMETRY, true); 37 } 38 } 39 40 void ApplyGeometry(const std::shared_ptr<RSObjAbsGeometry>& geometry); 41 42 void SetSandBox(std::optional<Vector2f> parentPosition); 43 void SetPositionZ(float positionZ); 44 void SetPositionZApplicableCamera3D(bool isApplicable); 45 void SetPivot(const Vector2f& pivot, bool animatable = true); 46 void SetPivotZ(float pivotZ); 47 std::optional<Vector2f> GetSandBox() const; 48 float GetPositionZ() const; 49 bool GetPositionZApplicableCamera3D() const; 50 Vector2f GetPivot() const; 51 float GetPivotZ() const; 52 53 void SetQuaternion(const Quaternion& quaternion); 54 void SetRotation(float degree); 55 void SetRotationX(float degree); 56 void SetRotationY(float degree); 57 Quaternion GetQuaternion() const; 58 float GetRotation() const; 59 float GetRotationX() const; 60 float GetRotationY() const; 61 62 void SetCameraDistance(float cameraDistance); 63 void SetTranslate(const Vector2f& translate); 64 void SetTranslateZ(float translate); 65 float GetCameraDistance() const; 66 Vector2f GetTranslate() const; 67 float GetTranslateZ() const; 68 69 void SetScale(const Vector2f& scale); 70 void SetScaleZ(float scaleZ); 71 void SetSkew(const Vector3f& skew); 72 void SetPersp(const Vector4f& persp); 73 Vector2f GetScale() const; 74 float GetScaleZ() const; 75 Vector3f GetSkew() const; 76 Vector4f GetPersp() const; 77 }; 78 } // namespace OHOS::Rosen::ModifierNG 79 #endif // RENDER_SERVICE_CLIENT_CORE_MODIFIER_NG_GEOMETRY_RS_TRANSFORM_MODIFIER_H 80