Beispiel #1
0
static void add_clock_to_frame( mlt_producer producer, mlt_frame frame, time_info* info )
{
	mlt_profile profile = mlt_service_profile( MLT_PRODUCER_SERVICE( producer ) );
	mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( producer );
	uint8_t* image = NULL;
	mlt_image_format format = mlt_image_rgb24a;
	int size = 0;
	int width = profile->width;
	int height = profile->height;
	int line_width = LINE_WIDTH_RATIO * (width > height ? height : width) / 100;
	int radius = (width > height ? height : width) / 2;
	char* direction = mlt_properties_get( producer_properties, "direction" );
	int clock_angle = 0;

	mlt_frame_get_image( frame, &image, &format, &width, &height, 1 );

	// Calculate the angle for the clock.
	int frames = info->frames;
	if( !strcmp( direction, "down" ) )
	{
		frames = info->fps - info->frames - 1;
	}
	clock_angle = (frames + 1) * 360 / info->fps;

	draw_clock( image, profile, clock_angle, line_width );
	draw_cross( image, profile, line_width );
	draw_ring( image, profile, ( radius * OUTER_RING_RATIO ) / 100, line_width );
	draw_ring( image, profile, ( radius * INNER_RING_RATIO ) / 100, line_width );

	size = mlt_image_format_size( format, width, height, NULL );
	mlt_frame_set_image( frame, image, size, mlt_pool_release );
}
void ShZshapeManager::draw_shape(const char* content)
{
	if (content == "cube")
	{
		draw_cube();
	}

	if (content == "cylinder")
	{
		draw_cylinder();
	}

	if (content == "pipe")
	{
		draw_pipe();
	}

	if (content == "cone")
	{
		draw_cone();
	}

	if (content == "circle")
	{
		draw_circle();
	}

	if (content == "ring")
	{
		draw_ring();
	}

	if (content == "pyramid")
	{
		draw_pyramid();
	}

	if (content == "triangle")
	{
		draw_triangle();
	}

	if (content == "rectangle")
	{
		draw_rectangle();
	}

	if (content == "polygon")
	{
		draw_polygon();
	}

	if (content == "multigonalStar")
	{
		draw_multigonalStar();
	}
}
void GeomDrawBox::draw_polygon(cairo_t *cr, OGRPolygon *poly, double scale, double x, double y, double height)
{
  const OGRLinearRing *ring = poly->getExteriorRing();
  if (ring->getNumPoints() > 0)
  {
    OGRRawPoint *points = new OGRRawPoint[ring->getNumPoints()];
    ring->getPoints(points);

    draw_ring(cr, points, ring->getNumPoints(), scale, x, y, height);
    cairo_set_line_width(cr, 1);
    cairo_set_source_rgb(cr, 0, 0, 0);
    cairo_stroke_preserve(cr);
    cairo_set_source_rgb(cr, 0.8, 0.8, 0.8);
    cairo_fill(cr);

    cairo_set_source_rgb(cr, 1, 0, 0);
    draw_ring_vertices(cr, points, ring->getNumPoints(), scale, x, y, height);

    delete []points;
  }
}
Beispiel #4
0
void
get_cb (chordID next) 
{
  draw_ring ();
  if (get_queue.size ()) {
    chordID n = get_queue.pop_front ();
    f_node *nu = nodes[n];
    if (nu)
      update (nu);
  } else {
    f_node *node_next = nodes[next];
    if (node_next == NULL)
      node_next = nodes.first ();
    if (node_next) {
      update (node_next);
      node_next = nodes.next (node_next);
      if (node_next == NULL) 
	node_next = nodes.first ();
      next = node_next->ID;
    } // else no nodes, keep calling get_cb until there are some
  }

  delaycb (0, 1000*1000*interval, wrap (&get_cb, next));
}