2009-06-07 23:34:20 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef HAVE_CONFIG_H */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
|
|
|
#include "ecore_x_private.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* [x] XCreateRegion
|
|
|
|
* [ ] XPolygonRegion
|
|
|
|
* [x] XSetRegion
|
|
|
|
* [x] XDestroyRegion
|
|
|
|
*
|
|
|
|
* [x] XOffsetRegion
|
|
|
|
* [ ] XShrinkRegion
|
|
|
|
*
|
|
|
|
* [ ] XClipBox
|
|
|
|
* [x] XIntersectRegion
|
|
|
|
* [x] XUnionRegion
|
|
|
|
* [x] XUnionRectWithRegion
|
|
|
|
* [x] XSubtractRegion
|
|
|
|
* [ ] XXorRegion
|
|
|
|
*
|
|
|
|
* [x] XEmptyRegion
|
|
|
|
* [x] XEqualRegion
|
|
|
|
*
|
|
|
|
* [x] XPointInRegion
|
|
|
|
* [x] XRectInRegion
|
|
|
|
*/
|
|
|
|
|
|
|
|
EAPI Ecore_X_XRegion *
|
|
|
|
ecore_x_xregion_new()
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2009-06-07 23:34:20 -07:00
|
|
|
return (Ecore_X_XRegion *)XCreateRegion();
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_new */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_x_xregion_free(Ecore_X_XRegion *region)
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2009-06-07 23:34:20 -07:00
|
|
|
if (!region)
|
2010-07-27 22:23:42 -07:00
|
|
|
return;
|
2009-06-07 23:34:20 -07:00
|
|
|
|
|
|
|
XDestroyRegion((Region)region);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_free */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2009-06-07 23:34:20 -07:00
|
|
|
ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-09-26 10:49:05 -07:00
|
|
|
return XSetRegion(_ecore_x_disp, gc, (Region)region) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_set */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2009-06-07 23:34:20 -07:00
|
|
|
if (!region)
|
2010-07-27 22:23:42 -07:00
|
|
|
return;
|
2009-06-07 23:34:20 -07:00
|
|
|
|
|
|
|
/* return value not used */
|
|
|
|
XOffsetRegion((Region)region, x, y);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_translate */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_xregion_intersect(Ecore_X_XRegion *dst,
|
|
|
|
Ecore_X_XRegion *r1,
|
|
|
|
Ecore_X_XRegion *r2)
|
2009-06-07 23:34:20 -07:00
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-09-26 10:49:05 -07:00
|
|
|
return XIntersectRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_intersect */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_xregion_union(Ecore_X_XRegion *dst,
|
|
|
|
Ecore_X_XRegion *r1,
|
|
|
|
Ecore_X_XRegion *r2)
|
2009-06-07 23:34:20 -07:00
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-09-26 10:49:05 -07:00
|
|
|
return XUnionRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_union */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
|
|
|
|
Ecore_X_XRegion *src,
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Rectangle *rect)
|
2009-06-07 23:34:20 -07:00
|
|
|
{
|
|
|
|
XRectangle xr;
|
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2009-06-07 23:34:20 -07:00
|
|
|
xr.x = rect->x;
|
|
|
|
xr.y = rect->y;
|
|
|
|
xr.width = rect->width;
|
|
|
|
xr.height = rect->height;
|
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
return XUnionRectWithRegion(&xr, (Region)src, (Region)dst) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_union_rect */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_xregion_subtract(Ecore_X_XRegion *dst,
|
|
|
|
Ecore_X_XRegion *rm,
|
|
|
|
Ecore_X_XRegion *rs)
|
2009-06-07 23:34:20 -07:00
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-09-26 10:49:05 -07:00
|
|
|
return XSubtractRegion((Region)rm, (Region)rs, (Region)dst) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_subtract */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2009-06-07 23:34:20 -07:00
|
|
|
ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
|
|
|
|
{
|
|
|
|
if (!region)
|
2010-09-26 10:49:05 -07:00
|
|
|
return EINA_TRUE;
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-09-26 10:49:05 -07:00
|
|
|
return !XEmptyRegion((Region)region) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_is_empty */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2009-06-07 23:34:20 -07:00
|
|
|
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
|
|
|
|
{
|
|
|
|
if (!r1 || !r2)
|
2010-09-26 10:49:05 -07:00
|
|
|
return EINA_FALSE;
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-09-26 10:49:05 -07:00
|
|
|
return XEqualRegion((Region)r1, (Region)r1) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_is_equal */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2009-06-07 23:34:20 -07:00
|
|
|
ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
|
|
|
|
{
|
|
|
|
if (!region)
|
2010-09-26 10:49:05 -07:00
|
|
|
return EINA_FALSE;
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-09-26 10:49:05 -07:00
|
|
|
return XPointInRegion((Region)region, x, y) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_point_contain */
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-09-26 10:49:05 -07:00
|
|
|
EAPI Eina_Bool
|
2009-06-07 23:34:20 -07:00
|
|
|
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
|
|
|
|
{
|
|
|
|
if (!region || !rect)
|
2010-09-26 10:49:05 -07:00
|
|
|
return EINA_FALSE;
|
2009-06-07 23:34:20 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-27 22:23:42 -07:00
|
|
|
return XRectInRegion((Region)region,
|
|
|
|
rect->x,
|
|
|
|
rect->y,
|
|
|
|
rect->width,
|
2010-09-26 10:49:05 -07:00
|
|
|
rect->height) ? EINA_TRUE : EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_xregion_rect_contain */
|
|
|
|
|