本文整理汇总了C++中synfig::Context类的典型用法代码示例。如果您正苦于以下问题:C++ Context类的具体用法?C++ Context怎么用?C++ Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Context类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: counter
synfig::Layer::Handle
Layer_PasteCanvas::hit_check(synfig::Context context, const synfig::Point &pos)const
{
if(depth==MAX_DEPTH)return 0;
depth_counter counter(depth);
Transformation transformation(get_summary_transformation());
bool children_lock=param_children_lock.get(bool(true));
ContextParams cp(context.get_params());
apply_z_range_to_params(cp);
if (canvas) {
Point target_pos = transformation.back_transform(pos);
if(canvas && get_amount() && canvas->get_context(cp).get_color(target_pos).get_a()>=0.25)
{
if(!children_lock)
{
return canvas->get_context(cp).hit_check(target_pos);
}
return const_cast<Layer_PasteCanvas*>(this);
}
}
return context.hit_check(pos);
}
示例2: cp
synfig::Layer::Handle
Layer_PasteCanvas::hit_check(synfig::Context context, const synfig::Point &pos)const
{
if(depth==MAX_DEPTH)return 0;depth_counter counter(depth);
Vector origin=param_origin.get(Vector());
Vector focus=param_focus.get(Vector());
Real zoom=param_zoom.get(Real());
bool children_lock=param_children_lock.get(bool(true));
ContextParams cp(context.get_params());
cp.z_range=param_z_range.get(bool());
cp.z_range_position=param_z_range_position.get(Real());
cp.z_range_depth=param_z_range_depth.get(Real());
cp.z_range_blur=param_z_range_blur.get(Real());
if (canvas) {
Point target_pos=(pos-focus-origin)/exp(zoom)+focus;
if(canvas && get_amount() && canvas->get_context(cp).get_color(target_pos).get_a()>=0.25)
{
if(!children_lock)
{
return canvas->get_context(cp).hit_check(target_pos);
}
return const_cast<Layer_PasteCanvas*>(this);
}
}
return context.hit_check(pos);
}
示例3:
synfig::Layer::Handle
LinearGradient::hit_check(synfig::Context context, const synfig::Point &point)const
{
if(get_blend_method()==Color::BLEND_STRAIGHT && get_amount()>=0.5)
return const_cast<LinearGradient*>(this);
if(get_amount()==0.0)
return context.hit_check(point);
if((get_blend_method()==Color::BLEND_STRAIGHT || get_blend_method()==Color::BLEND_COMPOSITE) && color_func(point).get_a()>0.5)
return const_cast<LinearGradient*>(this);
return context.hit_check(point);
}
示例4:
Layer::Handle
Layer_MeshTransform::hit_check(synfig::Context context, const synfig::Point &point)const
{
Vector v;
return mesh.transform_coord_world_to_texture(point, v)
? context.hit_check(v)
: Layer::Handle();
}
示例5:
synfig::Layer::Handle
SimpleCircle::hit_check(synfig::Context context, const synfig::Point &pos)const
{
if((pos-center).mag()<radius)
return const_cast<SimpleCircle*>(this);
else
return context.hit_check(pos);
}
示例6: density
synfig::Layer::Handle
Metaballs::hit_check(synfig::Context context, const synfig::Point &point)const
{
Real density(totaldensity(point));
if (density <= 0 || density > 1 || get_amount() == 0)
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<Metaballs*>(this);
}
示例7: npos
synfig::Layer::Handle
Layer_Stretch::hit_check(synfig::Context context, const synfig::Point &pos)const
{
Vector amount=param_amount.get(Vector());
Point center=param_center.get(Point());
Point npos(pos);
npos[0]=(npos[0]-center[0])/amount[0]+center[0];
npos[1]=(npos[1]-center[1])/amount[1]+center[1];
return context.hit_check(npos);
}
示例8:
synfig::Layer::Handle
NoiseDistort::hit_check(synfig::Context context, const synfig::Point &point)const
{
if(get_blend_method()==Color::BLEND_STRAIGHT && get_amount()>=0.5)
return const_cast<NoiseDistort*>(this);
if(get_amount()==0.0)
return context.hit_check(point);
if(color_func(point,0,context).get_a()>0.5)
return const_cast<NoiseDistort*>(this);
return synfig::Layer::Handle();
}
示例9:
synfig::Layer::Handle
SimpleCircle::hit_check(synfig::Context context, const synfig::Point &pos)const
{
Point center=param_center.get(Point());
Real radius=param_radius.get(Real());
if((pos-center).mag()<radius)
return const_cast<SimpleCircle*>(this);
else
return context.hit_check(pos);
}
示例10:
synfig::Layer::Handle
XORPattern::hit_check(synfig::Context context, const synfig::Point &getpos)const
{
// if we have a zero amount
if(get_amount()==0.0)
// then the click passes down to our context
return context.hit_check(getpos);
synfig::Layer::Handle tmp;
// if we are behind the context, and the click hits something in the context
if(get_blend_method()==Color::BLEND_BEHIND && (tmp=context.hit_check(getpos)))
// then return the thing it hit in the context
return tmp;
// if we're using an 'onto' blend method and the click missed the context
if(Color::is_onto(get_blend_method()) && !(tmp=context.hit_check(getpos)))
// then it misses everything
return 0;
// otherwise the click hit us, since we're the size of the whole plane
return const_cast<XORPattern*>(this);
}
示例11: point
synfig::Layer::Handle
Layer_SphereDistort::hit_check(synfig::Context context, const synfig::Point &pos)const
{
Vector center=param_center.get(Vector());
double radius=param_radius.get(double());
double percent=param_amount.get(double());
int type=param_type.get(int());
bool clip=param_clip.get(bool());
bool clipped;
Point point(sphtrans(pos,center,radius,percent,type,clipped));
if(clip && clipped)
return 0;
return context.hit_check(point);
}
示例12: newpos
synfig::Layer::Handle
Warp::hit_check(synfig::Context context, const synfig::Point &p)const
{
Point src_tl=param_src_tl.get(Point());
Point src_br=param_src_br.get(Point());
bool clip=param_clip.get(bool());
Point newpos(transform_forward(p));
if(clip)
{
Rect rect(src_tl,src_br);
if(!rect.is_inside(newpos))
return 0;
}
return context.hit_check(newpos);
}
示例13:
synfig::Layer::Handle
Layer_Bitmap::hit_check(synfig::Context context, const synfig::Point &pos)const
{
Point surface_pos;
surface_pos=pos-tl;
surface_pos[0]/=br[0]-tl[0];
if(surface_pos[0]<=1.0 && surface_pos[0]>=0.0)
{
surface_pos[1]/=br[1]-tl[1];
if(surface_pos[1]<=1.0 && surface_pos[1]>=0.0)
{
return const_cast<Layer_Bitmap*>(this);
}
}
return context.hit_check(pos);
}
示例14:
synfig::Layer::Handle
Layer_PasteCanvas::hit_check(synfig::Context context, const synfig::Point &pos)const
{
if(depth==MAX_DEPTH)return 0;depth_counter counter(depth);
if (canvas) {
Point target_pos=(pos-focus-origin)/exp(zoom)+focus;
if(canvas && get_amount() && canvas->get_context().get_color(target_pos).get_a()>=0.25)
{
if(!children_lock)
{
return canvas->get_context().hit_check(target_pos);
}
return const_cast<Layer_PasteCanvas*>(this);
}
}
return context.hit_check(pos);
}
示例15:
synfig::Layer::Handle
CurveWarp::hit_check(synfig::Context context, const synfig::Point &point)const
{
return context.hit_check(transform(point));
}