예제 #1
0
static dl_code_e text_render_transparent(void * pcom,
					 dl_context_t * context)
{
  struct text_command * c = pcom;  

  ///$$$
  //  text_set_properties(0,16,1);

  text_set_color(c->a * context->color.a, c->r * context->color.r,
		 c->g * context->color.g, c->b * context->color.b);
  text_draw_str(context->trans[0][0] * c->x + context->trans[3][0],
		context->trans[1][1] * c->y + context->trans[3][1],
		context->trans[2][2] * c->z + context->trans[3][2],
		c->text);
  return DL_COMMAND_OK;
}
예제 #2
0
파일: subtitle.c 프로젝트: iizukanao/picam
/**
 * Initializes the timestamp library with a font file and face index.
 */
void subtitle_init(const char *font_file, long face_index, int points, int dpi) {
  if (text_id != -1) {
    text_destroy(text_id);
  }

  text_id = text_create(
    font_file, face_index,
    points,
    dpi
  );
  text_set_stroke_color(text_id, 0x000000);
  text_set_letter_spacing(text_id, 1);
  text_set_color(text_id, 0xffffff);
  text_set_layout(text_id,
      LAYOUT_ALIGN_BOTTOM | LAYOUT_ALIGN_CENTER, // layout alignment for the box
      0, // horizontal margin from the right edge
      30); // vertical margin from the bottom edge
  text_set_align(text_id, TEXT_ALIGN_CENTER); // text alignment inside the box
}
예제 #3
0
파일: flow.c 프로젝트: brunetton/dia
static void
flow_update_data(Flow *flow)
{
  Connection *conn = &flow->connection;
  DiaObject *obj = &conn->object;
  Rectangle rect;
  Color* color = NULL;
  
  if (connpoint_is_autogap(flow->connection.endpoint_handles[0].connected_to) ||
      connpoint_is_autogap(flow->connection.endpoint_handles[1].connected_to)) {
    connection_adjust_for_autogap(conn);
  }
  obj->position = conn->endpoints[0];

  switch (flow->type) {
  case FLOW_ENERGY:
    color = &flow_color_energy ;
    break ;
  case FLOW_MATERIAL:
    color = &flow_color_material ;
    break ;
  case FLOW_SIGNAL:
    color = &flow_color_signal ;
    break ;
  }
  text_set_color( flow->text, color ) ;

  flow->text->position = flow->textpos;
  flow->text_handle.pos = flow->textpos;

  connection_update_handles(conn);

  /* Boundingbox: */
  connection_update_boundingbox(conn);

  /* Add boundingbox for text: */
  text_calc_boundingbox(flow->text, &rect) ;
  rectangle_union(&obj->bounding_box, &rect);
}
예제 #4
0
static dl_code_e scrolltext_render_transparent(void * pcom,
					       dl_context_t * context)
{
  struct scrolltext_command * c = pcom;
  float x, xs;

  /* Set text color */
  text_set_color(c->a * context->color.a, c->r * context->color.r,
		 c->g * context->color.g, c->b * context->color.b);

  xs = c->xs;
  x = c->x + xs;
  text_draw_str(context->trans[0][0] *    x + context->trans[3][0],
		context->trans[1][1] * c->y + context->trans[3][1],
		context->trans[2][2] * c->z + context->trans[3][2],
		c->text);

  /* Scroll */
  if (c->spd) {
    xs -= c->spd;

    switch (c->pingpong) {

      /* ping-pong when text is outside window */
    case 1: 
      if (c->spd > 0) {
	/* scrolling to the left */
	float xlim = xs + c->w;
	if (xlim < 0) {
	  c->spd = -c->spd; /* Change dir */
	  xs -= xlim;
	}
      } else {
	/* scrolling to the right */
	float xlim = xs - c->window;
	if (xlim > 0) {
	  c->spd = -c->spd; /* Change dir */
	  xs -= xlim;
	}
      }
      break;

      /* ping-pong keep text inside window */
    case 2:
      if (c->spd > 0) {
	/* scrolling to the left */
	float xlim = xs + c->w - c->window;
	if (xlim < 0) {
	  c->spd = -c->spd; /* Change dir */
	  xs -= xlim;
	}
      } else {
	/* scrolling to the right */
	float xlim = xs;
	if (xlim > 0) {
	  c->spd = -c->spd; /* Change dir */
	  xs = 0;
	}
      }
      break;

      /* Loop at start */
    default:
      if (c->spd > 0) {
	/* scrolling to the left */
	float xlim = xs + c->w;
	if (xlim < 0) {
	  xs = c->window + xlim; /* reset outside to the right */
	}
      } else {
	/* scrolling to the right */
	float xlim = xs - c->window;
	if (xlim > 0) {
	  xs = -c->w + xlim; /* reset outside to the left */
	}
      }
      break;
    }

    c->xs = xs;
  }

  return DL_COMMAND_OK;
}
예제 #5
0
파일: subtitle.c 프로젝트: iizukanao/picam
/**
 * Sets text color.
 */
void subtitle_set_color(int color) {
  text_set_color(text_id, color);
}