1 /* 2 * Copyright (c) 2023 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 RS_XFORM_H 17 #define RS_XFORM_H 18 19 #include <cmath> 20 #include <stdint.h> 21 #include <string> 22 23 #include "utils/scalar.h" 24 25 namespace OHOS { 26 namespace Rosen { 27 namespace Drawing { 28 struct RSXform { MakeRSXform29 static RSXform Make(scalar cos, scalar sin, scalar tx, scalar ty) 30 { 31 RSXform xform = { cos, sin, tx, ty }; 32 return xform; 33 } 34 DumpRSXform35 inline void Dump(std::string& out) const 36 { 37 out += "[cos:" + std::to_string(cos_); 38 out += " sin:" + std::to_string(sin_); 39 out += " tx:" + std::to_string(tx_); 40 out += " ty:" + std::to_string(ty_); 41 out += ']'; 42 } 43 44 scalar cos_; 45 scalar sin_; 46 scalar tx_; 47 scalar ty_; 48 }; 49 } // namespace Drawing 50 } // namespace Rosen 51 } // namespace OHOS 52 #endif