typedef struct _Point
{
- int x;
- int y;
+ double x;
+ double y;
}Point;
static
}
static void
-_find_ellipse_coords(int x, int y, int w, int h, double angle, double length,
- Point* start_point, Point *end_point)
+_find_ellipse_coords(double x, double y, double w, double h, double angle, double length,
+ Point* start_point, Point *end_point)
{
if (!w || !h )
{
return;
}
- int w2 = w / 2;
- int h2 = h / 2;
+ double w2 = w / 2;
+ double h2 = h / 2;
double angles[2] = { angle, angle + length };
Point *points[2] = { start_point, end_point };
// top quadrants
if (quadrant == 0 || quadrant == 1)
py = -py;
- int cx = x+w/2;
- int cy = y+h/2;
+ double cx = x+w/2;
+ double cy = y+h/2;
points[i]->x = cx + w2 * px;
points[i]->y = cy + h2 * py;
}
//// The return value is the starting point of the arc
static
-Point _curves_for_arc(int x, int y, int w, int h,
+Point _curves_for_arc(double x, double y, double w, double h,
double start_angle, double sweep_length,
Point *curves, int *point_count)
{
*point_count = 0;
- int w2 = w / 2;
- int w2k = w2 * PATH_KAPPA;
+ double w2 = w / 2;
+ double w2k = w2 * PATH_KAPPA;
- int h2 = h / 2;
- int h2k = h2 * PATH_KAPPA;
+ double h2 = h / 2;
+ double h2k = h2 * PATH_KAPPA;
Point points[16] =
{
{
int point_count;
Point pts[15];
- // FIXME: make the radius even, as the default
- // renderer unable to generate a perfect arc in case of odd radius.
- // remove the below line once the rle generation is fixed for the same.
- if (((int)w & 1)) w = w-1;
- if (((int)h & 1)) h = h-1;
Point curve_start = _curves_for_arc(x, y, w, h, start_angle, sweep_length, pts, &point_count);
int i;
double xc, double yc, double radius)
{
_efl_gfx_shape_append_arc(obj, pd, xc - radius, yc - radius, 2*radius, 2*radius, 0, 360);
-#if 0
- _efl_gfx_shape_append_move_to(obj, pd, xc - radius, yc);
- _efl_gfx_shape_append_arc_to(obj, pd, xc + radius, yc, radius, radius, 0, EINA_TRUE, EINA_TRUE);
- _efl_gfx_shape_append_arc_to(obj, pd, xc - radius, yc, radius, radius, 0, EINA_TRUE, EINA_TRUE);
-#endif
}
static void
double x, double y, double w, double h,
double rx, double ry)
{
+ if (!rx || !ry)
+ {
+ _efl_gfx_shape_append_move_to(obj, pd, x, y);
+ _efl_gfx_shape_append_line_to(obj, pd, x + w, y);
+ _efl_gfx_shape_append_line_to(obj, pd, x + w, y + h);
+ _efl_gfx_shape_append_line_to(obj, pd, x, y + h);
+ _efl_gfx_shape_append_close(obj, pd);
+
+ return;
+ }
// clamp the rx and ry radius value.
rx = 2*rx;
ry = 2*ry;
_efl_gfx_shape_append_arc(obj, pd, x + w - rx, y, rx, ry, 90, -90);
_efl_gfx_shape_append_arc(obj, pd, x + w - rx, y + h - ry, rx, ry, 0, -90);
_efl_gfx_shape_append_arc(obj, pd, x, y + h - ry, rx, ry, 270, -90);
-#if 0
- // clamp the x and y radius value.
- if (rx > w/2) rx = w/2;
- if (ry > h/2) ry = h/2;
-
- _efl_gfx_shape_append_move_to(obj, pd, x, y + ry);
- // Top left corner
- _efl_gfx_shape_append_arc_to(obj, pd, x + rx, y, rx, ry, 0, EINA_FALSE, EINA_TRUE);
- _efl_gfx_shape_append_line_to(obj, pd, x + w - rx, y);
- // Top right corner
- _efl_gfx_shape_append_arc_to(obj, pd, x + w, y + ry, rx, ry, 0, EINA_FALSE, EINA_TRUE);
- _efl_gfx_shape_append_line_to(obj, pd, x + w, y + h - ry);
- // Bottom right corner
- _efl_gfx_shape_append_arc_to(obj, pd, x + w - rx, y + h, rx, ry, 0, EINA_FALSE, EINA_TRUE);
- _efl_gfx_shape_append_line_to(obj, pd, x + rx, y + h);
- // Bottom left corner
- _efl_gfx_shape_append_arc_to(obj, pd, x, y + h - ry, rx, ry, 0, EINA_FALSE, EINA_TRUE);
-#endif
_efl_gfx_shape_append_close(obj, pd);
}