#include "eina_types.h"
+/**
+ * @addtogroup Eina_Rectangle_Group Rectangle
+ *
+ * @brief These functions provide rectangle management.
+ *
+ * @{
+ */
+
/**
* @addtogroup Eina_Tools_Group Tools
*
static inline void eina_rectangle_rescale_in(const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) EINA_ARG_NONNULL(1, 2, 3);
static inline void eina_rectangle_rescale_out(const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) EINA_ARG_NONNULL(1, 2, 3);
+
+/**
+ * @brief Add a rectangle in a new pool.
+ *
+ * @param w The width of the rectangle.
+ * @param h The height of the rectangle.
+ * @return A newly allocated pool on success, @c NULL otherwise.
+ *
+ * This function adds the rectangle of size (@p width, @p height) to a
+ * new pool. If the pool can not be created, @c NULL is
+ * returned. Otherwise the newly allocated pool is returned.
+ */
EAPI Eina_Rectangle_Pool *eina_rectangle_pool_new(int w, int h) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
+
+/**
+ * @brief Return the pool of the given rectangle.
+ *
+ * @param rect The rectangle.
+ * @return The pool of the given rectangle.
+ *
+ * This function returns the pool in which @p rect is. If @p rect is
+ * @c NULL, @c NULL is returned.
+ */
EAPI Eina_Rectangle_Pool *eina_rectangle_pool_get(Eina_Rectangle *rect) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
+
+/**
+ * @brief Return the width and height of the given pool.
+ *
+ * @param pool The pool.
+ * @param w The returned width.
+ * @param h The returned height.
+ * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
+ *
+ * This function returns the width and height of @p pool and store
+ * them in respectively @p w and @p h if they are not @c NULL. If
+ * @p pool is @c NULL, #EINA_FALSE is returned. Otherwise #EINA_TRUE is
+ * returned.
+ */
EAPI Eina_Bool eina_rectangle_pool_geometry_get(Eina_Rectangle_Pool *pool, int *w, int *h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
+
+/**
+ * @brief Get the data from the given pool.
+ *
+ * @param pool The pool.
+ * @return The returned data.
+ *
+ * This function gets the data from @p pool set by
+ * eina_rectangle_pool_data_set(). If @p pool is @c NULL, this
+ * function returns @c NULL.
+ */
EAPI void *eina_rectangle_pool_data_get(Eina_Rectangle_Pool *pool) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
+
+/**
+ * @brief Set the data to the given pool.
+ *
+ * @param pool The pool.
+ * @param data The data to set.
+ *
+ * This function sets @p data to @p pool. If @p pool is @c NULL, this
+ * function does nothing.
+ */
EAPI void eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data) EINA_ARG_NONNULL(1);
+
+/**
+ * @brief Free the given pool.
+ *
+ * @param pool The pool to free.
+ *
+ * This function frees the allocated data of @p pool. If @p pool is
+ * @c NULL, ths function returned immediately.
+ */
EAPI void eina_rectangle_pool_free(Eina_Rectangle_Pool *pool) EINA_ARG_NONNULL(1);
+
+/**
+ * @brief Return the number of rectangles in the given pool.
+ *
+ * @param pool The pool.
+ * @return The number of rectangles in the pool.
+ *
+ * This function returns the number of rectangles in @p pool.
+ */
EAPI int eina_rectangle_pool_count(Eina_Rectangle_Pool *pool) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
+
+/**
+ * @brief Request a rectangle of given size in the given pool.
+ *
+ * @param pool The pool.
+ * @param w The width of the rectangle to request.
+ * @param h The height of the rectangle to request.
+ * @return The requested rectangle on success, @c NULL otherwise.
+ *
+ * This function retrieve from @p pool the rectangle of width @p w and
+ * height @p h. If @p pool is @c NULL, or @p w or @p h are non-positive,
+ * the function returns @c NULL. If @p w or @p h are greater than the
+ * pool size, the function returns @c NULL. On success, the function
+ * returns the rectangle which matches the size (@p w, @p h).
+ * Otherwise it returns @c NULL.
+ */
EAPI Eina_Rectangle *eina_rectangle_pool_request(Eina_Rectangle_Pool *pool, int w, int h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
+
+/**
+ * @brief Remove the given rectangle from the pool.
+ *
+ * @param rect The rectangle to remove from the pool.
+ *
+ * This function removes @p rect from the pool. If @p rect is
+ * @c NULL, the function returns immediately. Otherwise it remoes @p
+ * rect from the pool.
+ */
EAPI void eina_rectangle_pool_release(Eina_Rectangle *rect) EINA_ARG_NONNULL(1);
/**
(Rectangle)->w = W; \
(Rectangle)->h = H;
+
+/**
+ * @brief Create a new rectangle.
+ *
+ * @param x The X coordinate of the top left corner of the rectangle.
+ * @param y The Y coordinate of the top left corner of the rectangle.
+ * @param w The width of the rectangle.
+ * @param h The height of the rectangle.
+ * @return The new rectangle on success, @ NULL otherwise.
+ *
+ * This function creates a rectangle which top left corner has the
+ * coordinates (@p x, @p y), with height @p w and height @p h and adds
+ * it to the rectangles pool. No check is done on @p w and @p h. This
+ * function returns a new rectangle on success, @c NULL otherwhise.
+ */
EAPI Eina_Rectangle *eina_rectangle_new(int x, int y, int w, int h) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
+
+/**
+ * @brief Free the given rectangle.
+ *
+ * @param rect The rectangle to free.
+ *
+ * This function removes @p rect from the rectangles pool.
+ */
EAPI void eina_rectangle_free(Eina_Rectangle *rect) EINA_ARG_NONNULL(1);
#include "eina_inline_rectangle.x"
* @}
*/
+/**
+ * @}
+ */
+
#endif /*_EINA_RECTANGLE_H_*/
* API *
*============================================================================*/
-/**
- * @addtogroup Eina_Rectangle_Group Rectangle
- *
- * @brief These functions provide rectangle management.
- *
- * @{
- */
-
-/**
- * @brief Create a new rectangle.
- *
- * @param x The X coordinate of the top left corner of the rectangle.
- * @param y The Y coordinate of the top left corner of the rectangle.
- * @param w The width of the rectangle.
- * @param h The height of the rectangle.
- * @return The new rectangle on success, @ NULL otherwise.
- *
- * This function creates a rectangle which top left corner has the
- * coordinates (@p x, @p y), with height @p w and height @p h and adds
- * it to the rectangles pool. No check is done on @p w and @p h. This
- * function returns a new rectangle on success, @c NULL otherwhise.
- */
EAPI Eina_Rectangle *
eina_rectangle_new(int x, int y, int w, int h)
{
return rect;
}
-/**
- * @brief Free the given rectangle.
- *
- * @param rect The rectangle to free.
- *
- * This function removes @p rect from the rectangles pool.
- */
EAPI void
eina_rectangle_free(Eina_Rectangle *rect)
{
}
}
-/**
- * @brief Add a rectangle in a new pool.
- *
- * @param w The width of the rectangle.
- * @param h The height of the rectangle.
- * @return A newly allocated pool on success, @c NULL otherwise.
- *
- * This function adds the rectangle of size (@p width, @p height) to a
- * new pool. If the pool can not be created, @c NULL is
- * returned. Otherwise the newly allocated pool is returned.
- */
EAPI Eina_Rectangle_Pool *
eina_rectangle_pool_new(int w, int h)
{
return new;
}
-/**
- * @brief Free the given pool.
- *
- * @param pool The pool to free.
- *
- * This function frees the allocated data of @p pool. If @p pool is
- * @c NULL, ths function returned immediately.
- */
EAPI void
eina_rectangle_pool_free(Eina_Rectangle_Pool *pool)
{
MAGIC_FREE(pool);
}
-/**
- * @brief Return the number of rectangles in the given pool.
- *
- * @param pool The pool.
- * @return The number of rectangles in the pool.
- *
- * This function returns the number of rectangles in @p pool.
- */
EAPI int
eina_rectangle_pool_count(Eina_Rectangle_Pool *pool)
{
return pool->references;
}
-/**
- * @brief Request a rectangle of given size in the given pool.
- *
- * @param pool The pool.
- * @param w The width of the rectangle to request.
- * @param h The height of the rectangle to request.
- * @return The requested rectangle on success, @c NULL otherwise.
- *
- * This function retrieve from @p pool the rectangle of width @p w and
- * height @p h. If @p pool is @c NULL, or @p w or @p h are non-positive,
- * the function returns @c NULL. If @p w or @p h are greater than the
- * pool size, the function returns @c NULL. On success, the function
- * returns the rectangle which matches the size (@p w, @p h).
- * Otherwise it returns @c NULL.
- */
EAPI Eina_Rectangle *
eina_rectangle_pool_request(Eina_Rectangle_Pool *pool, int w, int h)
{
return rect;
}
-/**
- * @brief Remove the given rectangle from the pool.
- *
- * @param rect The rectangle to remove from the pool.
- *
- * This function removes @p rect from the pool. If @p rect is
- * @c NULL, the function returns immediately. Otherwise it remoes @p
- * rect from the pool.
- */
EAPI void
eina_rectangle_pool_release(Eina_Rectangle *rect)
{
}
}
-/**
- * @brief Return the pool of the given rectangle.
- *
- * @param rect The rectangle.
- * @return The pool of the given rectangle.
- *
- * This function returns the pool in which @p rect is. If @p rect is
- * @c NULL, @c NULL is returned.
- */
EAPI Eina_Rectangle_Pool *
eina_rectangle_pool_get(Eina_Rectangle *rect)
{
return era->pool;
}
-/**
- * @brief Set the data to the given pool.
- *
- * @param pool The pool.
- * @param data The data to set.
- *
- * This function sets @p data to @p pool. If @p pool is @c NULL, this
- * function does nothing.
- */
EAPI void
eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data)
{
pool->data = (void *)data;
}
-/**
- * @brief Get the data from the given pool.
- *
- * @param pool The pool.
- * @return The returned data.
- *
- * This function gets the data from @p pool set by
- * eina_rectangle_pool_data_set(). If @p pool is @c NULL, this
- * function returns @c NULL.
- */
EAPI void *
eina_rectangle_pool_data_get(Eina_Rectangle_Pool *pool)
{
return pool->data;
}
-/**
- * @brief Return the width and height of the given pool.
- *
- * @param pool The pool.
- * @param w The returned width.
- * @param h The returned height.
- * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
- *
- * This function returns the width and height of @p pool and store
- * them in respectively @p w and @p h if they are not @c NULL. If
- * @p pool is @c NULL, #EINA_FALSE is returned. Otherwise #EINA_TRUE is
- * returned.
- */
EAPI Eina_Bool
eina_rectangle_pool_geometry_get(Eina_Rectangle_Pool *pool, int *w, int *h)
{
return EINA_TRUE;
}
-
-/**
- * @}
- */