示例#1
0
	virtual void do_draw_overlay( const ui::paint_event_t& event) const
	{
		RAMEN_ASSERT( node()->composition());

		move2d_node_t::matrix3_type lm( param_->matrix_at_frame( node()->composition()->frame(), node()->aspect_ratio()));

		Imath::V2f p = get_absolute_value<Imath::V2f>( param_->center_param());
	    p = p * lm;
		p.x *= node()->aspect_ratio();

		gl_line_width( default_line_width());
	    manipulators::draw_xy_axes( p, 70 / event.pixel_scale, 70 / event.pixel_scale,
									get_value<float>( param_->rotate_param()),
									event.aspect_ratio / node()->aspect_ratio(),
									  ui::palette_t::instance().color("x_axis"),
									  ui::palette_t::instance().color("y_axis"), event.pixel_scale);

	    manipulators::draw_cross( p, 3 / event.pixel_scale, 3 / event.pixel_scale, default_color(), event.pixel_scale);
		manipulators::draw_ellipse( p, 7 / event.pixel_scale, 7 / event.pixel_scale, Imath::Color3c( 255, 255, 255), 20);

		// draw the boundary
		move2d_node_t::matrix3_type gm( node()->global_matrix());
		gm *= move2d_node_t::matrix3_type().setScale( move2d_node_t::vector2_type( node()->aspect_ratio(), 1));

	    Imath::Box2i bbox( node()->format());
		++bbox.max.x;
		++bbox.max.y;

		float offset = manipulators::shadow_offset( event.pixel_scale);
		gl_line_width( manipulator_t::default_line_width());
		gl_point_size( manipulator_t::default_control_point_size());

		// shadow
		gl_color3ub( 0, 0, 0);
	    gl_begin( GL_LINE_LOOP);
			manipulators::gl_transformed_box( bbox, gm, offset);
	    gl_end();

		// color
		gl_color( manipulator_t::default_color());
	    gl_begin( GL_LINE_LOOP);
			manipulators::gl_transformed_box( bbox, gm);
	    gl_end();
	}
示例#2
0
void quad_manipulator_t::do_draw_overlay( const ui::paint_event_t& event) const
{	
	boost::array<Imath::V2f, 4> dst_pts;
	get_corners( dst_pts, event.aspect_ratio);

	gl_line_width( default_line_width());
	gl_point_size( default_control_point_size());	
	// shadow
	float off = manipulators::shadow_offset( event.pixel_scale);
	gl_color3ub( 0, 0, 0);
	gl_begin( GL_LINE_LOOP);
		for( int i = 0; i < 4; ++i)
			gl_vertex2f( dst_pts[i].x + off, dst_pts[i].y + off);
	gl_end();

	gl_begin( GL_POINTS);
		for( int i = 0; i < 4; ++i)
			gl_vertex2f( dst_pts[i].x + off, dst_pts[i].y + off);
	gl_end();
	
	// color	
	gl_color( default_color());
	gl_begin( GL_LINE_LOOP);
		for( int i = 0; i < 4; ++i)
			gl_vertex2f( dst_pts[i].x, dst_pts[i].y);
	gl_end();

	// draw corners
	gl_begin( GL_POINTS);
	for( int i = 0; i < 4; ++i)
	{
		if( i != picked_corner_)
			gl_vertex2f( dst_pts[i].x, dst_pts[i].y);
	}
	gl_end();
	
	for( int i = 0; i < 4; ++i)
	{
		if( i == picked_corner_)
			manipulators::draw_small_box( dst_pts[i], 3 / event.pixel_scale);
	}
}