X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fexample%2Ffilledrect.cpp;h=329012f3330cb731b99c7a4c18ccc354419440cb;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=ca5b988f87c04a980783fd0142b147b4d4a7b281;hpb=003ec710291bf258b8ce357edc15804347f71cb8;p=synfig.git diff --git a/synfig-core/trunk/src/modules/example/filledrect.cpp b/synfig-core/trunk/src/modules/example/filledrect.cpp index ca5b988..329012f 100644 --- a/synfig-core/trunk/src/modules/example/filledrect.cpp +++ b/synfig-core/trunk/src/modules/example/filledrect.cpp @@ -53,9 +53,9 @@ using namespace synfig; /* === 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$"); @@ -119,6 +119,7 @@ FilledRect::get_param_vocab()const ret.push_back(ParamDesc("point1") .set_local_name(_("Point 1")) + .set_box("point2") ); ret.push_back(ParamDesc("point2") @@ -144,6 +145,26 @@ FilledRect::get_param_vocab()const 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(this); +} + bool FilledRect::get_color(const Point &pos, Color &out, Real &outamount) const {