/* === G L O B A L S ======================================================= */
SYNFIG_LAYER_INIT(FilledRect);
-SYNFIG_LAYER_SET_NAME(FilledRect,"rectangle");
-SYNFIG_LAYER_SET_LOCAL_NAME(FilledRect,N_("Rectangle"));
-SYNFIG_LAYER_SET_CATEGORY(FilledRect,N_("Geometry"));
+SYNFIG_LAYER_SET_NAME(FilledRect,"filled_rectangle");
+SYNFIG_LAYER_SET_LOCAL_NAME(FilledRect,N_("Filled Rectangle"));
+SYNFIG_LAYER_SET_CATEGORY(FilledRect,N_("Example"));
SYNFIG_LAYER_SET_VERSION(FilledRect,"0.1");
SYNFIG_LAYER_SET_CVS_ID(FilledRect,"$Id$");
ret.push_back(ParamDesc("point1")
.set_local_name(_("Point 1"))
+ .set_box("point2")
);
ret.push_back(ParamDesc("point2")
return ret;
}
+synfig::Layer::Handle
+FilledRect::hit_check(synfig::Context context, const synfig::Point &point)const
+{
+ Color clr;
+ Real amt;
+
+ if (!get_color(point,clr,amt))
+ return context.hit_check(point);
+
+ synfig::Layer::Handle tmp;
+
+ if (get_blend_method()==Color::BLEND_BEHIND && (tmp=context.hit_check(point)))
+ return tmp;
+
+ if (Color::is_onto(get_blend_method()) && !(context.hit_check(point)))
+ return 0;
+
+ return const_cast<FilledRect*>(this);
+}
+
bool
FilledRect::get_color(const Point &pos, Color &out, Real &outamount) const
{
//the bounds of the rectangle
Point p[2] = {point1,point2};
- if((p[0][0] > p[1][0]) ^ wpp < 0)
+ if((p[0][0] > p[1][0]) ^ (wpp < 0))
{
swap(p[0][0],p[1][0]);
}
- if((p[0][1] > p[1][1]) ^ hpp < 0)
+ if((p[0][1] > p[1][1]) ^ (hpp < 0))
{
swap(p[0][1],p[1][1]);
}