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 FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_ARKUI_RECT_H 17 #define FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_ARKUI_RECT_H 18 19 #include <iomanip> 20 21 namespace OHOS::Ace { 22 class RectF { 23 public: 24 RectF() = default; 25 ~RectF() = default; 26 RectF(float x,float y,float width,float height)27 RectF(float x, float y, float width, float height) 28 { 29 SetRect(x, y, width, height); 30 } 31 SetRect(float x,float y,float width,float height)32 void SetRect(float x, float y, float width, float height) 33 { 34 x_ = x; 35 y_ = y; 36 width_ = width; 37 height_ = height; 38 } 39 GetX()40 float GetX() const 41 { 42 return x_; 43 } 44 GetY()45 float GetY() const 46 { 47 return y_; 48 } 49 Width()50 float Width() const 51 { 52 return width_; 53 } 54 Height()55 float Height() const 56 { 57 return height_; 58 } 59 60 private: 61 float x_ = 0.0f; 62 float y_ = 0.0f; 63 float width_ = 0.0f; 64 float height_ = 0.0f; 65 }; 66 } // namespace OHOS::Ace 67 #endif // FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_ARKUI_RECT_H 68