2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FGrpFloatRectangle.h
20 * @brief This is the header file for the %FloatRectangle class.
22 * This header file contains the declarations of the %FloatRectangle class.
25 #ifndef _FGRP_FLOAT_RECTANGLE_H_
26 #define _FGRP_FLOAT_RECTANGLE_H_
28 #include <FBaseObject.h>
30 namespace Tizen { namespace Graphics
36 * @class FloatRectangle
37 * @brief This class abstracts a rectangular region.
41 * The %FloatRectangle class represents a rectangular region in a coordinate space, which is specified by the rectangle
42 * object's top-left point (x, y) in the coordinate space, along with its width and height.
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/graphics/shapes.htm">Shapes</a>.
46 class _OSP_EXPORT_ FloatRectangle
47 : public Tizen::Base::Object
51 * This is the default constructor for this class. @n
52 * It initializes an instance of %FloatRectangle with all its attributes set to @c 0.f.
56 * @remarks The attribute value is @c 0 when initialized.
61 * This is the copy constructor for the %FloatRectangle class.
65 * @param[in] rhs An instance of %FloatRectangle
67 FloatRectangle(const FloatRectangle& rhs);
70 * Initializes an instance of %FloatRectangle with the specified location and dimension.
74 * @param[in] x The x-coordinate of the top-left corner of the rectangle
75 * @param[in] y The y-coordinate of the top-left corner of the rectangle
76 * @param[in] width The width of the rectangle
77 * @param[in] height The height of the rectangle
80 FloatRectangle(float x, float y, float width, float height);
83 * Initializes an instance of %FloatRectangle at the location specified by @c point and
84 * with dimension specified by @c dim.
88 * @param[in] point The location of the top-left corner of the rectangle
89 * @param[in] dim The width and height of the rectangle
91 FloatRectangle(const FloatPoint& point, const FloatDimension& dim);
94 * This is the destructor for this class.
98 virtual ~FloatRectangle(void);
101 * This is the default assignment operator for this class.
105 * @param[in] rhs An instance of %FloatRectangle
107 FloatRectangle& operator=(const FloatRectangle& rhs);
110 * Checks whether the location and dimension of the current instance of %FloatRectangle match those of the
111 * specified instance of %FloatRectangle.
115 * @return @c true if the location and dimension of the current instance match those of the specified instance, @n
117 * @param[in] rhs An instance of %FloatRectangle
119 bool operator==(const FloatRectangle& rhs) const;
122 * Checks whether the location and dimension of the current instance of %FloatRectangle do not match those of the
123 * specified instance of %FloatRectangle.
127 * @return @c true if the location and dimension of the current instance do not match those of the specified instance, @n
129 * @param[in] rhs An instance of %FloatRectangle
131 bool operator!=(const FloatRectangle& rhs) const;
134 * Checks whether the specified point lies inside the current instance of %FloatRectangle.
138 * @return @c true if the location represented by @c point lies inside the current instance of %FloatRectangle, @n
140 * @param[in] point An instance of FloatPoint
142 bool Contains(const FloatPoint& point) const;
145 * Checks whether the value of the current instance of %FloatRectangle equals the value of the specified instance of
150 * @return @c true if the value of the current instance of %FloatRectangle equals the value of the specified instance of %FloatRectangle, @n
152 * @param[in] rhs An instance of %FloatRectangle
153 * @remarks The %FloatRectangle class has a semantic value, which means that the Equals() method checks whether the
154 * two instances have the same location and size.
156 virtual bool Equals(const Tizen::Base::Object& rhs) const;
159 * Gets the hash value of the current instance.
163 * @return The hash value of the current instance
164 * @remarks Two equal instances must return the same hash value. For better performance,
165 * the used hash function must generate a random distribution for all inputs.
167 virtual int GetHashCode(void) const;
170 * Gets the intersection of the current instance and the specified instance of %FloatRectangle. @n
171 * If the two instances of %FloatRectangle do not intersect, empty instance is returned.
175 * @param[in] rect An instance of %FloatRectangle
177 FloatRectangle GetIntersection(const FloatRectangle& rect) const;
180 * Checks whether the current instance of %FloatRectangle intersects with the specified instance of %FloatRectangle.
184 * @return @c true if the current instance of %FloatRectangle intersects with the specified instance of %FloatRectangle, @n
186 * @param[in] rect An instance of %FloatRectangle
189 bool IsIntersected(const FloatRectangle& rect) const;
192 * Gets the union of the current instance and the specified instance of %FloatRectangle.
196 * @return An instance of %FloatRectangle containing the union of the two rectangles
197 * @param[in] rect An instance of %FloatRectangle
199 FloatRectangle GetUnion(const FloatRectangle& rect) const;
202 * Gets the coordinates of the point at the bottom-right corner of the rectangle.
206 * @return The coordinates of the point at the bottom-right corner of the rectangle
208 FloatPoint GetBottomRight(void) const;
211 * Gets the coordinates of the point at the top-left corner of the rectangle.
215 * @return The coordinates of the point at the top-left corner of the rectangle
217 FloatPoint GetTopLeft(void) const;
220 * Checks whether this %FloatRectangle is empty. @n
221 * A %FloatRectangle is empty if its width or its height is less than or equal to @c 0.
225 * @return @c true if this rectangle is empty, @n
228 bool IsEmpty(void) const;
231 * Sets the size of this %FloatRectangle to match the specified FloatDimension.
235 * @param[in] dim The new size for FloatDimension
237 void SetSize(const FloatDimension& dim);
240 * Sets the size of this %FloatRectangle to match the specified dimension.
244 * @param[in] width The new width
245 * @param[in] height The new height
247 void SetSize(float width, float height);
250 * Sets the position of this %FloatRectangle to the specified point.
254 * @param[in] point The new position
256 void SetPosition(const FloatPoint& point);
259 * Sets the location of the current instance of %FloatRectangle with the specified values of the
260 * x and y coordinates of the top-left corner point.
264 * @param[in] x The new x-coordinate
265 * @param[in] y The new y-coordinate
267 void SetPosition(float x, float y);
270 * Sets the location and the dimensions of the current instance of %FloatRectangle with the specified x and y
271 * coordinates of the top-left corner point and the specified dimensions.
275 * @param[in] x The new x-coordinate
276 * @param[in] y The new y-coordinate
277 * @param[in] width The new width
278 * @param[in] height The new height
280 void SetBounds(float x, float y, float width, float height);
283 * Sets the location and the dimensions of the current instance of %FloatRectangle with the specified location and
288 * @param[in] point An instance of FloatPoint
289 * @param[in] dim An instance of FloatDimension
291 void SetBounds(const FloatPoint& point, const FloatDimension& dim);
294 * Translates this %FloatRectangle to the new point by the specified distance along the x-axis and y-axis.
298 * @param[in] deltaX The distance to move this %FloatRectangle along the x-axis
299 * @param[in] deltaY The distance to move this %FloatRectangle along the y-axis
301 void Translate(float deltaX, float deltaY);
305 * The x-coordinate of the top-left corner of the rectangle.
312 * The y-coordinate of the top-left corner of the rectangle.
319 * The width of this rectangle.
326 * The height of this rectangle.
333 friend class _FloatRectangleImpl;
336 // This variable is for internal use only.
337 // Using this variable can cause behavioral, security-related, and consistency-related issues in the application.
341 class _FloatRectangleImpl* __pImpl;
345 }} // Tizen::Graphics
347 #endif // _FGRP_FLOAT_RECTANGLE_H_