本文整理汇总了C++中TimePoint::get_time方法的典型用法代码示例。如果您正苦于以下问题:C++ TimePoint::get_time方法的具体用法?C++ TimePoint::get_time怎么用?C++ TimePoint::get_time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimePoint
的用法示例。
在下文中一共展示了TimePoint::get_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: x
void
CellRenderer_TimeTrack::render_vfunc(
const ::Cairo::RefPtr< ::Cairo::Context>& cr,
Gtk::Widget& /* widget */,
const Gdk::Rectangle& /* background_area */,
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState /* flags */)
{
if(!cr)
return;
Glib::RefPtr<Gtk::Adjustment> adjustment=get_adjustment();
// Gtk::StateType state = Gtk::STATE_ACTIVE;
// Gtk::ShadowType shadow;
Gdk::Color
change_time_color("#008800"),
curr_time_color("#0000ff"),
inactive_color("#000000"),
keyframe_color("#a07f7f");
Gdk::Color activepoint_color[2];
activepoint_color[0]=Gdk::Color("#ff0000");
activepoint_color[1]=Gdk::Color("#00ff00");
synfig::Canvas::Handle canvas(property_canvas().get_value());
synfigapp::ValueDesc value_desc = property_value_desc().get_value();
synfig::ValueNode *base_value = value_desc.get_value_node().get();
// synfig::ValueNode_Animated *value_node=dynamic_cast<synfig::ValueNode_Animated*>(base_value);
synfig::ValueNode_DynamicList *parent_value_node(0);
if(property_value_desc().get_value().parent_is_value_node())
parent_value_node=dynamic_cast<synfig::ValueNode_DynamicList*>(property_value_desc().get_value().get_parent_value_node().get());
// If the canvas is defined, then load up the keyframes
if(canvas)
{
const synfig::KeyframeList& keyframe_list(canvas->keyframe_list());
synfig::KeyframeList::const_iterator iter;
for(iter=keyframe_list.begin();iter!=keyframe_list.end();++iter)
{
if(!iter->get_time().is_valid())
continue;
const int x((int)((float)cell_area.get_width()/(adjustment->get_upper()-adjustment->get_lower())*(iter->get_time()-adjustment->get_lower())));
if(iter->get_time()>=adjustment->get_lower() && iter->get_time()<adjustment->get_upper())
{
cr->set_source_rgb(keyframe_color.get_red_p(), keyframe_color.get_green_p(), keyframe_color.get_blue_p());
cr->rectangle(cell_area.get_x()+x, cell_area.get_y(), 1, cell_area.get_height()+1);
cr->fill();
}
}
}
const synfig::Time time_offset = get_time_offset_from_vdesc(value_desc);
const synfig::Time time_dilation = get_time_dilation_from_vdesc(value_desc);
Gdk::Rectangle area(cell_area);
float lower = adjustment->get_lower(),
upper = adjustment->get_upper();
//render time points where value changed
{
std::set<Time> times;
get_change_times_from_vdesc(value_desc, times);
for(std::set<Time>::const_iterator i = times.begin(); i != times.end(); ++i)
{
//find the coordinate in the drawable space...
Time t_orig = *i;
if(!t_orig.is_valid()) continue;
Time t = t_orig - time_offset;
if (time_dilation!=0)
t = t / time_dilation;
if(t<adjustment->get_lower() || t>adjustment->get_upper()) continue;
const int w = 1;
const int h = (area.get_height() - 2)/2;
const int x = area.get_x() + (int)((t-lower)*area.get_width()/(upper-lower));
const int y = area.get_y() + (area.get_height() - h)/2;
cr->rectangle(x, y, w, h);
cr->set_source_rgb(
change_time_color.get_red_p(),
change_time_color.get_green_p(),
change_time_color.get_blue_p() );
cr->fill();
}
}
//render all the time points that exist
{
const synfig::Node::time_set *tset = get_times_from_vdesc(value_desc);
if(tset)
{
synfig::Node::time_set::const_iterator i = tset->begin(), end = tset->end();
bool valselected = sel_value.get_value_node() == base_value && !sel_times.empty();
float cfps = get_canvas()->rend_desc().get_frame_rate();
//.........这里部分代码省略.........