当前位置: 首页>>代码示例>>C++>>正文


C++ pango_layout_set_font_description函数代码示例

本文整理汇总了C++中pango_layout_set_font_description函数的典型用法代码示例。如果您正苦于以下问题:C++ pango_layout_set_font_description函数的具体用法?C++ pango_layout_set_font_description怎么用?C++ pango_layout_set_font_description使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pango_layout_set_font_description函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: F1035_13204

/* {EV_FONT_IMP}.string_size */
EIF_REFERENCE F1035_13204 (EIF_REFERENCE Current, EIF_REFERENCE arg1)
{
	GTCX
	EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
	EIF_POINTER loc2 = (EIF_POINTER) 0;
	EIF_POINTER loc3 = (EIF_POINTER) 0;
	EIF_POINTER loc4 = (EIF_POINTER) 0;
	EIF_POINTER loc5 = (EIF_POINTER) 0;
	EIF_INTEGER_32 loc6 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc7 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc8 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc9 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc10 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc11 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc12 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc13 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc14 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc15 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc16 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc17 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc18 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc19 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc20 = (EIF_INTEGER_32) 0;
	EIF_REFERENCE loc21 = (EIF_REFERENCE) 0;
	EIF_POINTER tp1;
	EIF_POINTER tp2;
	EIF_INTEGER_32 ti4_1;
	EIF_REFERENCE Result = ((EIF_REFERENCE) 0);
	
	RTLD;
	
	RTLI(5);
	RTLR(0,loc21);
	RTLR(1,Current);
	RTLR(2,loc1);
	RTLR(3,arg1);
	RTLR(4,Result);
	
	RTGC;
	loc21 = RTOSCF(13229,F1035_13229,(Current));
	loc1 = F1049_13651(RTCV(loc21), arg1);
	loc2 = RTOSCF(8093,F791_8093,(RTCV(loc21)));
	tp1 = *(EIF_POINTER *)(RTCV(loc1)+ _PTROFF_0_1_0_1_0_0_);
	ti4_1 = *(EIF_INTEGER_32 *)(RTCV(loc1)+ _LNGOFF_0_1_0_0_);
	pango_layout_set_text((PangoLayout*) loc2, (char*) tp1, (int) ti4_1);
	tp1 = *(EIF_POINTER *)(Current+ _PTROFF_3_2_0_8_0_0_);
	pango_layout_set_font_description((PangoLayout*) loc2, (PangoFontDescription*) tp1);
	loc4 = (EIF_POINTER) calloc (sizeof(PangoRectangle), 1);
	loc5 = RTOSCF(13207,F1035_13207,(Current));
	pango_layout_get_pixel_extents((PangoLayout*) loc2, (PangoRectangle*) loc4, (PangoRectangle*) loc5);
	loc3 = F791_8094(RTCV(loc21));
	loc20 = (EIF_INTEGER_32) pango_layout_iter_get_baseline((PangoLayoutIter*) loc3);
	ti4_1 = (EIF_INTEGER_32) PANGO_SCALE;
	loc20 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc20 / ti4_1);
	pango_layout_iter_free((PangoLayoutIter*) loc3);
	loc6 = (EIF_INTEGER_32) (((PangoRectangle *)loc5)->x);
	loc7 = (EIF_INTEGER_32) (((PangoRectangle *)loc5)->y);
	loc8 = (EIF_INTEGER_32) (((PangoRectangle *)loc5)->width);
	loc9 = (EIF_INTEGER_32) (((PangoRectangle *)loc5)->height);
	loc10 = (EIF_INTEGER_32) (((PangoRectangle *)loc4)->x);
	loc11 = (EIF_INTEGER_32) (((PangoRectangle *)loc4)->y);
	loc12 = (EIF_INTEGER_32) (((PangoRectangle *)loc4)->width);
	loc13 = (EIF_INTEGER_32) (((PangoRectangle *)loc4)->height);
	loc14 = (EIF_INTEGER_32) loc8;
	loc15 = (EIF_INTEGER_32) loc9;
	if ((EIF_BOOLEAN) (loc12 > ((EIF_INTEGER_32) 0L))) {
		loc16 = (EIF_INTEGER_32) loc10;
		loc17 = (EIF_INTEGER_32) (EIF_INTEGER_32) ((EIF_INTEGER_32) (loc16 + loc12) - loc8);
	}
	if ((EIF_BOOLEAN) (loc13 > ((EIF_INTEGER_32) 0L))) {
		loc18 = (EIF_INTEGER_32) loc11;
		loc19 = (EIF_INTEGER_32) (EIF_INTEGER_32) ((EIF_INTEGER_32) (loc18 + loc13) - loc9);
	}
	Result = RTOSCF(13205,F1035_13205,(Current));
	ti4_1 = eif_max_int32 (loc14,((EIF_INTEGER_32) 1L));
	F842_8563(RTCV(Result), ti4_1, ((EIF_INTEGER_32) 1L));
	ti4_1 = eif_max_int32 (loc15,((EIF_INTEGER_32) 1L));
	F842_8563(RTCV(Result), ti4_1, ((EIF_INTEGER_32) 2L));
	F842_8563(RTCV(Result), loc16, ((EIF_INTEGER_32) 3L));
	F842_8563(RTCV(Result), loc17, ((EIF_INTEGER_32) 4L));
	F842_8563(RTCV(Result), loc20, ((EIF_INTEGER_32) 5L));
	F842_8563(RTCV(Result), loc18, ((EIF_INTEGER_32) 6L));
	F842_8563(RTCV(Result), loc19, ((EIF_INTEGER_32) 7L));
	free(loc4);
	{
	/* INLINED CODE (default_pointer) */
	tp1 = (EIF_POINTER)  0;
	/* END INLINED CODE */
	}
	tp2 = tp1;
	pango_layout_set_font_description((PangoLayout*) loc2, (PangoFontDescription*) tp2);
	RTLE;
	return Result;
}
开发者ID:yehongbing,项目名称:Eiffel-Projects,代码行数:95,代码来源:ev669.c

示例2: gtk_graph_smith_plot_axes

/* Smith.c: Routines for plotting Smith charts */
void gtk_graph_smith_plot_axes(GtkGraph *graph)
{
gint i ;
gint x, y, w, h;
gfloat ri[] = {0.2, 0.5, 1.0, 2.0, 5.0}, rxl[]={0.20, 0.5, 1, 2, 5}, coeff1, r, store, arc_angle;
gfloat yend, xend; // The x and y co-ordinates of the end of the reactance lines
gchar label[10];
gint text_width, text_height;
gint xpos = 0, ypos = 0;		// X and Y co-ordinate locations of radial labels

PangoFontDescription *fontdesc = NULL;
PangoLayout *layout = NULL;

g_return_if_fail (graph != NULL);
g_return_if_fail (GTK_IS_GRAPH (graph));
g_return_if_fail (GTK_WIDGET_REALIZED (graph));
g_return_if_fail (graph->graph_type == SMITH);

fontdesc = pango_font_description_from_string("Sans 10");
layout = gtk_widget_create_pango_layout(GTK_WIDGET(graph), NULL);
pango_layout_set_font_description(layout, fontdesc);

/* Plot the concentric grid */

centre_x = user_origin_x + user_width / 2;
centre_y = user_origin_y + user_width / 2;
gdk_draw_arc(buffer, Gridcontext, FALSE, centre_x - graph->dependant->scale_factor, centre_y - graph->dependant->scale_factor, 2.0 * graph->dependant->scale_factor, 2.0 * graph->dependant->scale_factor, 0, 23040);

for (i = 0 ; i < 5 ; i++)
	{
/* Draw the circles of Constant Resistance */
	coeff1 = ri[i] / (1.0+ri[i]);
	r = 1.0 / (ri[i] + 1.0);
	x = centre_x + (gint)((coeff1 - r) * graph->dependant->scale_factor);
	y = centre_y - (gint) (r * graph->dependant->scale_factor);
	w = 2.0 * r * graph->dependant->scale_factor;
	h = 2.0 * r * graph->dependant->scale_factor;
	gdk_draw_arc(buffer, Gridcontext, FALSE, x, y, w, h, 0, 23039);
		
	g_snprintf(label, 10, "%.0f", ri[i] * graph->smith_Z0);
    pango_layout_set_text(layout, label, -1);
    pango_layout_get_pixel_size(layout, &text_width, &text_height);
	xpos = x - text_width / 2;
	ypos = centre_y ;
	gdk_draw_layout(buffer, BandWcontext, xpos, ypos, layout);

/* Draw the circles of Constant Reactance */

	r = 1.0 / rxl[i];
	x = centre_x + (gint) ((1 - r) * graph->dependant->scale_factor);
	w = 2.0 * r * graph->dependant->scale_factor;
	h = 2.0 * r * graph->dependant->scale_factor;

/* Now Label the Constant Reactance curves */
	g_snprintf(label, 10, "+j%0.f", rxl[i]*graph->smith_Z0);
    pango_layout_set_text(layout, label, -1);
    pango_layout_get_pixel_size(layout, &text_width, &text_height);
	store = 2.0 * r/(r*r + 1);
	yend = store * (gfloat)(graph->dependant->scale_factor);
	xend = sqrt(1 - store*store) * (gfloat)(graph->dependant->scale_factor);
	
	switch(i)
		{
		case 0:
		case 1:
			g_snprintf(label, 10, "+j%0.f", rxl[i]*graph->smith_Z0);
			pango_layout_set_text(layout, label, -1);
			pango_layout_get_pixel_size(layout, &text_width, &text_height);
			ypos = centre_y - (gint)yend;
			xpos = centre_x - (gint)xend;
			gdk_draw_layout(buffer, BandWcontext, xpos - text_width, ypos - text_height, layout);
			g_snprintf(label, 10, "-j%0.f", rxl[i]*graph->smith_Z0);
			pango_layout_set_text(layout, label, -1);
			ypos = centre_y + (gint)yend;
			gdk_draw_layout(buffer, BandWcontext, xpos - text_width, ypos, layout);
			arc_angle = atan((gfloat)(centre_x + graph->dependant->scale_factor - xpos)/(gfloat)((centre_y + r * graph->dependant->scale_factor)-ypos)) *180.0 / 3.141592654;
			gdk_draw_arc(buffer, Gridcontext, FALSE, x, centre_y, w, h, 5760, (gint)(arc_angle * 64.0)); // Capacitive Circles
			gdk_draw_arc(buffer, Gridcontext, FALSE, x, centre_y - (gint) ((2 *r) * graph->dependant->scale_factor), w, h, 17280 - (gint) (arc_angle*64.0), (gint) (arc_angle*64.0));	// Inductive Circles
			break;
		case 2:
			g_snprintf(label, 10, "+j%0.f", rxl[i]*graph->smith_Z0);
			pango_layout_set_text(layout, label, -1);
			pango_layout_get_pixel_size(layout, &text_width, &text_height);
			ypos = centre_y - (gint)yend;
			xpos = centre_x - (gint)xend;
			gdk_draw_layout(buffer, BandWcontext, xpos - text_width/2, ypos - text_height, layout);
			g_snprintf(label, 10, "-j%0.f", rxl[i]*graph->smith_Z0);
			pango_layout_set_text(layout, label, -1);
			ypos = centre_y + yend;
			gdk_draw_layout(buffer, BandWcontext, xpos - text_width/2, ypos, layout);
			arc_angle = atan((gfloat)(centre_x + graph->dependant->scale_factor - xpos)/(gfloat)(ypos - (centre_y + r * graph->dependant->scale_factor))) *180.0 / 3.141592654;
			gdk_draw_arc(buffer, Gridcontext, FALSE, x, centre_y, w, h, 5760, (gint) (arc_angle*64.0)); // Capacitive Circles
			gdk_draw_arc(buffer, Gridcontext, FALSE, x, centre_y - (gint) ((2 *r) * graph->dependant->scale_factor), w, h, 17280 - (gint) (arc_angle*64.0), (gint) (arc_angle*64.0));	// Inductive Circles
			break;
		case 3:
		case 4:
			g_snprintf(label, 10, "+j%0.f", rxl[i]*graph->smith_Z0);
			pango_layout_set_text(layout, label, -1);
			pango_layout_get_pixel_size(layout, &text_width, &text_height);
//.........这里部分代码省略.........
开发者ID:benmwebb,项目名称:coot,代码行数:101,代码来源:smith.c

示例3: HYFont2PangoFontDesc

void _HYPlatformGraphicPane::_SetFont (_HYFont f)
{
	HYFont2PangoFontDesc(f,theFont);
	pango_layout_set_font_description (textLayout, theFont ); // ref ?
	_ResetCharGlyphs ();
}
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:6,代码来源:HYPlatformGraphicPane.cpp

示例4: lowlight_draw


//.........这里部分代码省略.........
  cairo_set_line_width(cr, DT_PIXEL_APPLY_DPI(2.));
  cairo_set_source_rgba(cr, .7, .7, .7, 1.0);

  p = *(dt_iop_lowlight_params_t *)self->params;
  dt_draw_curve_set_point(c->transition_curve, 0, p.transition_x[DT_IOP_LOWLIGHT_BANDS - 2] - 1.0,
                          p.transition_y[0]);
  for(int k = 0; k < DT_IOP_LOWLIGHT_BANDS; k++)
    dt_draw_curve_set_point(c->transition_curve, k + 1, p.transition_x[k], p.transition_y[k]);
  dt_draw_curve_set_point(c->transition_curve, DT_IOP_LOWLIGHT_BANDS + 1, p.transition_x[1] + 1.0,
                          p.transition_y[DT_IOP_LOWLIGHT_BANDS - 1]);
  dt_draw_curve_calc_values(c->transition_curve, 0.0, 1.0, DT_IOP_LOWLIGHT_RES, c->draw_xs, c->draw_ys);
  cairo_move_to(cr, 0 * width / (float)(DT_IOP_LOWLIGHT_RES - 1), -height * c->draw_ys[0]);
  for(int k = 1; k < DT_IOP_LOWLIGHT_RES; k++)
    cairo_line_to(cr, k * width / (float)(DT_IOP_LOWLIGHT_RES - 1), -height * c->draw_ys[k]);
  cairo_stroke(cr);

  // draw dots on knots
  cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
  cairo_set_line_width(cr, DT_PIXEL_APPLY_DPI(1.));
  for(int k = 0; k < DT_IOP_LOWLIGHT_BANDS; k++)
  {
    cairo_arc(cr, width * p.transition_x[k], -height * p.transition_y[k], DT_PIXEL_APPLY_DPI(3.0), 0.0,
              2.0 * M_PI);
    if(c->x_move == k)
      cairo_fill(cr);
    else
      cairo_stroke(cr);
  }

  if(c->mouse_y > 0 || c->dragging)
  {
    // draw min/max, if selected
    cairo_set_source_rgba(cr, .7, .7, .7, .6);
    cairo_move_to(cr, 0, -height * c->draw_min_ys[0]);
    for(int k = 1; k < DT_IOP_LOWLIGHT_RES; k++)
      cairo_line_to(cr, k * width / (float)(DT_IOP_LOWLIGHT_RES - 1), -height * c->draw_min_ys[k]);
    for(int k = DT_IOP_LOWLIGHT_RES - 1; k >= 0; k--)
      cairo_line_to(cr, k * width / (float)(DT_IOP_LOWLIGHT_RES - 1), -height * c->draw_max_ys[k]);
    cairo_close_path(cr);
    cairo_fill(cr);
    // draw mouse focus circle
    cairo_set_source_rgba(cr, .9, .9, .9, .5);
    const float pos = DT_IOP_LOWLIGHT_RES * c->mouse_x;
    int k = (int)pos;
    const float f = k - pos;
    if(k >= DT_IOP_LOWLIGHT_RES - 1) k = DT_IOP_LOWLIGHT_RES - 2;
    float ht = -height * (f * c->draw_ys[k] + (1 - f) * c->draw_ys[k + 1]);
    cairo_arc(cr, c->mouse_x * width, ht, c->mouse_radius * width, 0, 2. * M_PI);
    cairo_stroke(cr);
  }

  cairo_restore(cr);

  cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);

  // draw labels:
  PangoLayout *layout;
  PangoRectangle ink;
  PangoFontDescription *desc = pango_font_description_copy_static(darktable.bauhaus->pango_font_desc);
  pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
  pango_font_description_set_absolute_size(desc,(.06 * height) * PANGO_SCALE);
  layout = pango_cairo_create_layout(cr);
  pango_layout_set_font_description(layout, desc);
  cairo_set_source_rgb(cr, .1, .1, .1);

  pango_layout_set_text(layout, _("dark"), -1);
  pango_layout_get_pixel_extents(layout, &ink, NULL);
  cairo_move_to(cr, .02 * width - ink.y, .5 * (height + ink.width));
  cairo_save(cr);
  cairo_rotate(cr, -M_PI * .5f);
  pango_cairo_show_layout(cr, layout);
  cairo_restore(cr);

  pango_layout_set_text(layout, _("bright"), -1);
  pango_layout_get_pixel_extents(layout, &ink, NULL);
  cairo_move_to(cr, .98 * width - ink.height, .5 * (height + ink.width));
  cairo_save(cr);
  cairo_rotate(cr, -M_PI * .5f);
  pango_cairo_show_layout(cr, layout);
  cairo_restore(cr);


  pango_layout_set_text(layout, _("day vision"), -1);
  pango_layout_get_pixel_extents(layout, &ink, NULL);
  cairo_move_to(cr, .5 * (width - ink.width), .08 * height - ink.height);
  pango_cairo_show_layout(cr, layout);

  pango_layout_set_text(layout, _("night vision"), -1);
  pango_layout_get_pixel_extents(layout, &ink, NULL);
  cairo_move_to(cr, .5 * (width - ink.width), .97 * height - ink.height);
  pango_cairo_show_layout(cr, layout);

  pango_font_description_free(desc);
  g_object_unref(layout);
  cairo_destroy(cr);
  cairo_set_source_surface(crf, cst, 0, 0);
  cairo_paint(crf);
  cairo_surface_destroy(cst);
  return TRUE;
}
开发者ID:CChiappa,项目名称:darktable,代码行数:101,代码来源:lowlight.c

示例5: draw_info_header

static void
draw_info_header (GtkPrintContext *context,
                  cairo_t         *cr,
                  PrintData       *data)
{
  PangoLayout          *layout;
  PangoFontDescription *desc;
  gdouble               text_height;
  gdouble               text_width;
  gdouble               fname_text_width;
  gint                  layout_height;
  gint                  layout_width;
  gchar                 date_buffer[100];
  GDate                *date;
  const gchar          *name_str;
  GimpParasite         *parasite;
  const gchar          *end_ptr;
  gchar                *filename;
  gdouble               cr_width;

  cairo_save (cr);

  cr_width  = gtk_print_context_get_width (context);
  cairo_rectangle (cr, 0, 0, cr_width, HEADER_HEIGHT);
  cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
  cairo_fill_preserve (cr);

  cairo_set_source_rgb (cr, 0, 0, 0);
  cairo_set_line_width (cr, 1);
  cairo_stroke (cr);

  layout = gtk_print_context_create_pango_layout (context);

  desc = pango_font_description_from_string ("sans 14");
  pango_layout_set_font_description (layout, desc);
  pango_font_description_free (desc);

  pango_layout_set_width (layout, -1);
  pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);

  /* image name */
  pango_layout_set_text (layout, gimp_image_get_name (data->image_id), -1);

  pango_layout_get_size (layout, &layout_width, &layout_height);
  text_height = (gdouble) layout_height / PANGO_SCALE;

  cairo_move_to (cr, 0.02 * cr_width,  (HEADER_HEIGHT - text_height) / 5);
  pango_cairo_show_layout (cr, layout);

  /* user name */
  name_str = g_get_real_name ();
  if (name_str && g_utf8_validate (name_str, -1, &end_ptr))
    {
      pango_layout_set_text (layout, name_str, -1);

      pango_layout_get_size (layout, &layout_width, &layout_height);
      text_height = (gdouble) layout_height / PANGO_SCALE;
      text_width = (gdouble) layout_width / PANGO_SCALE;

      cairo_move_to (cr, 0.5 * cr_width - 0.5 * text_width,
                     (HEADER_HEIGHT - text_height) / 5);
      pango_cairo_show_layout (cr, layout);
    }

  /* date */
  date = g_date_new ();
  g_date_set_time_t (date, time (NULL));
  g_date_strftime (date_buffer, 100, "%x", date);
  g_date_free (date);
  pango_layout_set_text (layout, date_buffer, -1);

  pango_layout_get_size (layout, &layout_width, &layout_height);
  text_height = (gdouble) layout_height / PANGO_SCALE;
  text_width = (gdouble) layout_width / PANGO_SCALE;

  cairo_move_to (cr,
                 0.98 * cr_width - text_width,
                 (HEADER_HEIGHT - text_height) / 5);
  pango_cairo_show_layout (cr, layout);

  /* file name if any */
  filename = gimp_image_get_filename (data->image_id);

  if (filename)
    {
      pango_layout_set_text (layout,
                             gimp_filename_to_utf8 (filename), -1);
      g_free (filename);

      pango_layout_get_size (layout, &layout_width, &layout_height);
      text_height = (gdouble) layout_height / PANGO_SCALE;
      fname_text_width = (gdouble) layout_width / PANGO_SCALE;

      cairo_move_to (cr,
                     0.02 * cr_width,  4 * (HEADER_HEIGHT - text_height) / 5);
      pango_cairo_show_layout (cr, layout);
    }
  else
    {
      fname_text_width = 0;
//.........这里部分代码省略.........
开发者ID:Minoos,项目名称:gimp,代码行数:101,代码来源:print-draw-page.c

示例6: set_font_size

// set font size
static void set_font_size(PangoLayout *layout, PangoFontDescription *font, int font_size) {
  pango_font_description_set_size(font, font_size*PANGO_SCALE);
  pango_layout_set_font_description(layout, font);
}
开发者ID:nanu-c,项目名称:LiVES,代码行数:5,代码来源:puretext.c

示例7: cd_rssreader_show_dialog

void cd_rssreader_show_dialog (GldiModuleInstance *myApplet)
{
    if (myData.pDialog != NULL)  // on detruit le dialogue actuel.
    {
        gldi_object_unref (GLDI_OBJECT(myData.pDialog));
        myData.pDialog = NULL;
        return;
    }
    gldi_dialogs_remove_on_icon (myIcon);  // on enleve tout autre dialogue (message d'erreur).

    if (myData.pItemList != NULL && myData.pItemList->next != NULL && (myData.pItemList->next->next != NULL || ! myData.bError))  // on construit le dialogue contenant toutes les infos.
    {
        // On construit le widget GTK qui contient les lignes avec les liens.
        GtkWidget *pVBox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);  // le widget qu'on va inserer dans le dialogue.
        GtkWidget *pScrolledWindow = gtk_scrolled_window_new (NULL, NULL);
        g_object_set (pScrolledWindow, "height-request", 250, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (pScrolledWindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
#if GTK_CHECK_VERSION (3, 8, 0)
        gtk_container_add (GTK_CONTAINER (pScrolledWindow), pVBox);
#else
        gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (pScrolledWindow), pVBox);
#endif

        PangoLayout *pLayout = pango_cairo_create_layout (myDrawContext);
        PangoFontDescription *fd = pango_font_description_from_string ("");
        pango_layout_set_font_description (pLayout, fd);

        int w = MIN (600, g_desktopGeometry.Xscreen.width / g_desktopGeometry.iNbScreens / 2);  // we don't know on which screen is place the container...
        gchar *cLine;
        GtkWidget *pLinkButton, *pAlign;
        CDRssItem *pItem;
        GList *it;
        for (it = myData.pItemList->next; it != NULL; it = it->next)
        {
            pItem = it->data;
            if (pItem->cTitle == NULL)
                continue;

            cLine = g_strdup (pItem->cTitle);
            cd_rssreader_cut_line (cLine, pLayout, w);

            if (pItem->cLink != NULL)
                pLinkButton = gtk_link_button_new_with_label (pItem->cLink, cLine);
            else
                pLinkButton = gtk_label_new (cLine);
            g_free (cLine);

            pAlign = gtk_alignment_new (0., 0.5, 0., 0.);
            gtk_container_add (GTK_CONTAINER (pAlign), pLinkButton);
            gtk_box_pack_start (GTK_BOX (pVBox), pAlign, FALSE, FALSE, 0);

            if (pItem->cDescription != NULL)
            {
                cLine = g_strdup (pItem->cDescription);
                cd_rssreader_cut_line (cLine, pLayout, w);
                pLinkButton = gtk_label_new (cLine);
                gtk_label_set_selectable (GTK_LABEL (pLinkButton), TRUE);
                g_free (cLine);

                pAlign = gtk_alignment_new (0., 0.5, 0., 0.);
                gtk_alignment_set_padding (GTK_ALIGNMENT (pAlign), 0, 0, 20, 0);
                gtk_container_add (GTK_CONTAINER (pAlign), pLinkButton);
                gtk_box_pack_start (GTK_BOX (pVBox), pAlign, FALSE, FALSE, 0);
            }

            if (pItem->cAuthor != NULL)
            {
                gchar *by = g_strdup_printf ("  [by %s]", pItem->cAuthor);
                pLinkButton = gtk_label_new (by);
                g_free (by);

                pAlign = gtk_alignment_new (0., 0.5, 0., 0.);
                gtk_alignment_set_padding (GTK_ALIGNMENT (pAlign), 0, 0, 40, 0);
                gtk_container_add (GTK_CONTAINER (pAlign), pLinkButton);
                gtk_box_pack_start (GTK_BOX (pVBox), pAlign, FALSE, FALSE, 0);
            }

            if (pItem->cDate != NULL)
            {
                pLinkButton = gtk_label_new (pItem->cDate);

                pAlign = gtk_alignment_new (1., 0.5, 0., 0.);
                gtk_alignment_set_padding (GTK_ALIGNMENT (pAlign), 0, 0, 40, 0);
                gtk_container_add (GTK_CONTAINER (pAlign), pLinkButton);
                gtk_box_pack_start (GTK_BOX (pVBox), pAlign, FALSE, FALSE, 0);
            }
        }
        pango_font_description_free (fd);

        pItem = myData.pItemList->data;  // le nom du flux en titre du dialogue.

        // on affiche le dialogue.
        myData.pDialog = gldi_dialog_show (pItem->cTitle,
                                           myIcon, myContainer,
                                           0,
                                           myDock ? "same icon" : MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE,
                                           pScrolledWindow,
                                           NULL,
                                           myApplet,
                                           (GFreeFunc)_on_dialog_destroyed);
//.........这里部分代码省略.........
开发者ID:kheuton,项目名称:cairo-dock-plug-ins,代码行数:101,代码来源:applet-rss.c

示例8: ppg_rt_graph_size_allocate

/**
 * ppg_rt_graph_size_allocate:
 * @graph: (in): A #PpgRtGraph.
 *
 * Handle the "size-allocate" signal for the #PpgRtGraph. Adjust the
 * sizing of various surfaces to match the new size.
 *
 * Returns: None.
 * Side effects: None.
 */
static void
ppg_rt_graph_size_allocate (GtkWidget     *widget,
                            GtkAllocation *alloc)
{
	PpgRtGraphPrivate *priv;
	PangoLayout *layout;
	PpgRtGraph *graph = (PpgRtGraph *)widget;
	GdkWindow *window;
	cairo_t *cr;
	gdouble each;

	g_return_if_fail(PPG_IS_RT_GRAPH(graph));

	priv = graph->priv;

	/*
	 * Chain up to allow Gtk to perform the resize.
	 */
	GTK_WIDGET_CLASS(ppg_rt_graph_parent_class)->size_allocate(widget, alloc);

	/*
	 * Get our window to create our suraces and such.
	 */
	window = gtk_widget_get_window(widget);
	if (!window) {
		return;
	}

	/*
	 * Cleanup after previous cairo surfaces.
	 */
	ppg_clear_pointer(&priv->foreground, cairo_surface_destroy);
	ppg_clear_pointer(&priv->background, cairo_surface_destroy);

	/*
	 * Determine the font height so we can draw our labels.
	 */
	cr = gdk_cairo_create(window);
	layout = pango_cairo_create_layout(cr);
	pango_layout_set_font_description(layout, priv->font_desc);
	pango_layout_set_text(layout, "XXXXXXXXX", -1);
	pango_layout_get_pixel_size(layout, &priv->label_width,
	                            &priv->label_height);
	g_object_unref(layout);
	cairo_destroy(cr);

	/*
	 * Setup ring buffer defaults.
	 */
	priv->offset_time = 0.0;

	/*
	 * Determine the visible data area.
	 */
	priv->content_area.x = 1 + priv->label_width;
	priv->content_area.y = 1;
	priv->content_area.width = alloc->width - priv->label_width - 2;
	priv->content_area.height = alloc->height
	                          - (LABEL_YPAD * 2)
	                          - priv->label_height
	                          - 2;

	/*
	 * Determine the data area including buffer area.
	 */
	each = priv->content_area.width / priv->n_seconds;
	priv->data_area.x = 0;
	priv->data_area.y = 0;
	priv->data_area.width = priv->content_area.width +
	                        ceil(priv->n_buffered * each);
	priv->data_area.height = priv->content_area.height;

	/*
	 * Create new cairo surface for drawing the background.
	 */
	priv->background =
		gdk_window_create_similar_surface(window,
		                                  CAIRO_CONTENT_COLOR_ALPHA,
		                                  alloc->width, alloc->height);

	/*
	 * Create new cairo surface for drawing the foreground. This matches the
	 * size of the content area plus enough space for the buffered region.
	 */
	priv->foreground =
		gdk_window_create_similar_surface(window,
		                                  CAIRO_CONTENT_COLOR_ALPHA,
		                                  priv->data_area.width,
		                                  priv->data_area.height);

//.........这里部分代码省略.........
开发者ID:chergert,项目名称:perfkit,代码行数:101,代码来源:ppg-rt-graph.c

示例9: assert


//.........这里部分代码省略.........
  if ((option != (const char *) NULL) && (IsMagickTrue(option) != MagickFalse))
    pango_layout_set_justify(layout,1);
  option=GetImageOption(image_info,"caption:single-paragraph");
  if ((option != (const char *) NULL) && (IsMagickTrue(option) != MagickFalse))
    pango_layout_set_single_paragraph_mode(layout,1);
  option=GetImageOption(image_info,"caption:wrap");
  if (option != (const char *) NULL)
    {
      if (LocaleCompare(option,"char") == 0)
        pango_layout_set_wrap(layout,PANGO_WRAP_CHAR);
      if (LocaleCompare(option,"word") == 0)
        pango_layout_set_wrap(layout,PANGO_WRAP_WORD);
      if (LocaleCompare(option,"word-char") == 0)
        pango_layout_set_wrap(layout,PANGO_WRAP_WORD_CHAR);
    }
  option=GetImageOption(image_info,"caption:indent");
  if (option != (const char *) NULL)
    pango_layout_set_indent(layout,(StringToLong(option)*image->x_resolution*
      PANGO_SCALE+36)/72);
  switch (draw_info->align)
  {
    case CenterAlign: align=PANGO_ALIGN_CENTER; break;
    case RightAlign: align=PANGO_ALIGN_RIGHT; break;
    case LeftAlign:
    default: align=PANGO_ALIGN_LEFT; break;
  }
  if ((align != PANGO_ALIGN_CENTER) &&
      (draw_info->direction == RightToLeftDirection))
    align=(PangoAlignment) (PANGO_ALIGN_LEFT+PANGO_ALIGN_RIGHT-align);
  pango_layout_set_alignment(layout,align);
  description=pango_font_description_from_string(draw_info->font ==
    (char *) NULL ? "helvetica" : draw_info->font);
  pango_font_description_set_size(description,PANGO_SCALE*draw_info->pointsize);
  pango_layout_set_font_description(layout,description);
  pango_font_description_free(description);
  property=InterpretImageProperties(image_info,image,image_info->filename);
  (void) SetImageProperty(image,"caption",property);
  property=DestroyString(property);
  caption=ConstantString(GetImageProperty(image,"caption"));
  /*
    Render caption.
  */
  option=GetImageOption(image_info,"caption:markup");
  if ((option != (const char *) NULL) && (IsMagickTrue(option) != MagickFalse))
    pango_layout_set_markup(layout,caption,-1);
  else
    pango_layout_set_text(layout,caption,-1);
  pango_layout_context_changed(layout);
  page.x=0;
  page.y=0;
  if (image_info->page != (char *) NULL)
    (void) ParseAbsoluteGeometry(image_info->page,&page);
  if (image->columns == 0)
    {
      pango_layout_get_pixel_extents(layout,NULL,&extent);
      image->columns=extent.x+extent.width;
    }
  else
    {
      image->columns-=2*page.x;
      pango_layout_set_width(layout,(PANGO_SCALE*image->columns*
        image->x_resolution+36.0)/72.0);
    }
  if (image->rows == 0)
    {
      pango_layout_get_pixel_extents(layout,NULL,&extent);
开发者ID:nfma,项目名称:configuration,代码行数:67,代码来源:caption.c

示例10: main


//.........这里部分代码省略.........
   * cogl_get_rectangle_indices() is a convenience function for
   * accessing internal index buffers that can be shared.
   */
  data.indices = cogl_get_rectangle_indices (ctx, 6 /* n_rectangles */);
  data.prim = cogl_primitive_new_p3t2 (ctx, COGL_VERTICES_MODE_TRIANGLES,
                                       G_N_ELEMENTS (vertices),
                                       vertices);
  /* Each face will have 6 indices so we have 6 * 6 indices in total... */
  cogl_primitive_set_indices (data.prim,
                              data.indices,
                              6 * 6);

  /* Load a jpeg crate texture from a file */
  printf ("crate.jpg (CC by-nc-nd http://bit.ly/9kP45T) ShadowRunner27 http://bit.ly/m1YXLh\n");
  data.texture = cogl_texture_new_from_file (COGL_EXAMPLES_DATA "crate.jpg",
                                             COGL_TEXTURE_NO_SLICING,
                                             COGL_PIXEL_FORMAT_ANY,
                                             &error);
  if (!data.texture)
    g_error ("Failed to load texture: %s", error->message);

  /* a CoglPipeline conceptually describes all the state for vertex
   * processing, fragment processing and blending geometry. When
   * drawing the geometry for the crate this pipeline says to sample a
   * single texture during fragment processing... */
  data.crate_pipeline = cogl_pipeline_new (ctx);
  cogl_pipeline_set_layer_texture (data.crate_pipeline, 0, data.texture);

  /* Since the box is made of multiple triangles that will overlap
   * when drawn and we don't control the order they are drawn in, we
   * enable depth testing to make sure that triangles that shouldn't
   * be visible get culled by the GPU. */
  cogl_depth_state_init (&depth_state);
  cogl_depth_state_set_test_enabled (&depth_state, TRUE);

  cogl_pipeline_set_depth_state (data.crate_pipeline, &depth_state, NULL);

  /* Setup a Pango font map and context */

  data.pango_font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new (ctx));

  cogl_pango_font_map_set_use_mipmapping (data.pango_font_map, TRUE);

  data.pango_context =
    pango_font_map_create_context (PANGO_FONT_MAP (data.pango_font_map));

  data.pango_font_desc = pango_font_description_new ();
  pango_font_description_set_family (data.pango_font_desc, "Sans");
  pango_font_description_set_size (data.pango_font_desc, 30 * PANGO_SCALE);

  /* Setup the "Hello Cogl" text */

  data.hello_label = pango_layout_new (data.pango_context);
  pango_layout_set_font_description (data.hello_label, data.pango_font_desc);
  pango_layout_set_text (data.hello_label, "Hello Cogl", -1);

  pango_layout_get_extents (data.hello_label, NULL, &hello_label_size);
  data.hello_label_width = PANGO_PIXELS (hello_label_size.width);
  data.hello_label_height = PANGO_PIXELS (hello_label_size.height);

  data.swap_ready = TRUE;

  has_swap_notify =
    cogl_has_feature (ctx, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT);

  if (has_swap_notify)
    cogl_onscreen_add_swap_buffers_callback (COGL_ONSCREEN (fb),
                                             swap_notify_cb,
                                             &data);

  while (1)
    {
      CoglPollFD *poll_fds;
      int n_poll_fds;
      int64_t timeout;

      if (data.swap_ready)
        {
          paint (&data);
          cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
        }

      cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout);

      if (!has_swap_notify)
        {
          /* If the winsys doesn't support swap event notification
             then we'll just redraw constantly */
          data.swap_ready = TRUE;
          timeout = 0;
        }

      g_poll ((GPollFD *) poll_fds, n_poll_fds,
              timeout == -1 ? -1 : timeout / 1000);

      cogl_poll_dispatch (ctx, poll_fds, n_poll_fds);
    }

  return 0;
}
开发者ID:ChrisCummins,项目名称:cogl,代码行数:101,代码来源:cogl-crate.c

示例11: ppg_rt_graph_render_background

/**
 * ppg_rt_graph_render_background:
 * @graph: (in): A #PpgRtGraph.
 *
 * Render the background of the graph.
 *
 * Returns: None.
 * Side effects: None.
 */
static void
ppg_rt_graph_render_background (PpgRtGraph *graph)
{
	static const gdouble dashes[] = { 1.0, 2.0 };
	PpgRtGraphPrivate *priv;
	GtkStateType state;
	PangoLayout *layout;
	GtkWidget *widget = (GtkWidget *)graph;
	GtkStyle *style;
	cairo_t *cr;
	gdouble value;
	gdouble x;
	gdouble y;
	gchar *text;
	gchar label[32];
	guint n_lines;
	gint i;
	gint height;
	gint width;

	g_return_if_fail(PPG_IS_RT_GRAPH(graph));

	priv = graph->priv;

	/*
	 * Retrieve required resources.
	 */
	style = gtk_widget_get_style(widget);
	state = gtk_widget_get_state(widget);
	cr = cairo_create(priv->background);

	/*
	 * Set background color to the styles light color.
	 */
	gdk_cairo_set_source_color(cr, &style->light[state]);
	cairo_rectangle(cr,
	                priv->content_area.x + 0.5,
	                priv->content_area.y + 0.5,
	                priv->content_area.width - 1.0,
	                priv->content_area.height - 1.0);
	cairo_fill(cr);

	/*
	 * Stroke the outer line or the graph to the styles foreground
	 * color.
	 */
	gdk_cairo_set_source_color(cr, &style->fg[state]);
	cairo_set_line_width(cr, 1.0);
	cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0);
	cairo_rectangle(cr,
	                priv->content_area.x + 0.5,
	                priv->content_area.y + 0.5,
	                priv->content_area.width - 1.0,
	                priv->content_area.height - 1.0);
	cairo_stroke(cr);

	layout = pango_cairo_create_layout(cr);
	pango_layout_set_font_description(layout, priv->font_desc);

	/*
	 * Stroke the inner vertical grid lines of the graph to the styles
	 * foreground color. Draw the label at the bottom.
	 */
	n_lines = ppg_rt_graph_get_n_x_lines(graph);
	for (i = 0; i <= n_lines; i++) {
		x = priv->content_area.x +
		    floor(priv->content_area.width / ((gdouble)n_lines + 1) * i) +
		    0.5;
		y = priv->content_area.y + 1.5;

		/*
		 * Don't draw the first line.
		 */
		if (i != 0) {
			cairo_move_to(cr, x, y);
			cairo_line_to(cr, x, y + priv->content_area.height - 3.0);
			cairo_stroke(cr);
		}

		/*
		 * Time labels for X axis.
		 */
		value = floor(priv->n_seconds / (n_lines + 1.0) * (n_lines + 1 - i));
		g_snprintf(label, sizeof label, "%d", (gint)value);
		pango_layout_set_text(layout, label, -1);
		y = priv->content_area.y + priv->content_area.height + LABEL_YPAD;
		cairo_move_to(cr, x, y);
		pango_cairo_show_layout(cr, layout);
	}

	/*
//.........这里部分代码省略.........
开发者ID:chergert,项目名称:perfkit,代码行数:101,代码来源:ppg-rt-graph.c

示例12: simplet_lithograph_add_placement

// Create and add a placement to the current lithograph if it doesn't overlap
// with current labels.
void
simplet_lithograph_add_placement(simplet_lithograph_t *litho,
  OGRFeatureH feature, simplet_list_t *styles, cairo_t *proj_ctx) {

  simplet_style_t *field = simplet_lookup_style(styles, "text-field");
  if(!field) return;

  OGRFeatureDefnH defn;
  if(!(defn = OGR_F_GetDefnRef(feature))) return;

  int idx = OGR_FD_GetFieldIndex(defn, (const char*) field->arg);
  if(idx < 0) return;

  // Find the largest sub geometry of a particular multi-geometry.
  OGRGeometryH super = OGR_F_GetGeometryRef(feature);
  OGRGeometryH geom = super;
  double area = 0.0;
  switch(wkbFlatten(OGR_G_GetGeometryType(super))) {
    case wkbMultiPolygon:
    case wkbGeometryCollection:
      for(int i = 0; i < OGR_G_GetGeometryCount(super); i++) {
        OGRGeometryH subgeom = OGR_G_GetGeometryRef(super, i);
        if(subgeom == NULL) continue;
        double ar = OGR_G_Area(subgeom);
        if(ar > area) {
          geom = subgeom;
          area = ar;
        }
      }
      break;
    default:
      ;
  }

  // Find the center of our geometry. This sometimes throws an invalid geometry
  // error, so there is a slight bug here somehow.
  OGRGeometryH center;
  if(!(center = OGR_G_CreateGeometry(wkbPoint))) return;
  if(OGR_G_Centroid(geom, center) == OGRERR_FAILURE) {
    OGR_G_DestroyGeometry(center);
    return;
  }

  // Turn font hinting off
  cairo_font_options_t *opts;
  if(!(opts = cairo_font_options_create())){
    OGR_G_DestroyGeometry(center);
    return;
  }

  cairo_font_options_set_hint_style(opts, CAIRO_HINT_STYLE_NONE);
  cairo_font_options_set_hint_metrics(opts, CAIRO_HINT_METRICS_OFF);
  pango_cairo_context_set_font_options(litho->pango_ctx, opts);
  cairo_font_options_destroy(opts);

  // Get the field containing the text for the label.
  char *txt = simplet_copy_string(OGR_F_GetFieldAsString(feature, idx));
  PangoLayout *layout = pango_layout_new(litho->pango_ctx);
  pango_layout_set_text(layout, txt, -1);
  free(txt);

  // Grab the font to use and apply tracking.
  simplet_style_t *font = simplet_lookup_style(styles, "font");
  simplet_apply_styles(layout, styles, "letter-spacing", NULL);

  const char *font_family;

  if(!font)
    font_family = "helvetica 12px";
  else
    font_family = font->arg;

  PangoFontDescription *desc = pango_font_description_from_string(font_family);
  pango_layout_set_font_description(layout, desc);
  pango_font_description_free(desc);

  double x = OGR_G_GetX(center, 0), y = OGR_G_GetY(center, 0);
  cairo_user_to_device(proj_ctx, &x, &y);

  // Finally try the placement and test for overlaps.
  try_and_insert_placement(litho, layout, x, y);
  OGR_G_DestroyGeometry(center);
}
开发者ID:ashaw,项目名称:simple-tiles,代码行数:85,代码来源:text.c

示例13: biji_note_obj_get_icon

static GdkPixbuf *
biji_note_obj_get_icon (BijiItem *item)
{
  GdkRGBA               note_color;
  const gchar           *text;
  cairo_t               *cr;
  PangoLayout           *layout;
  PangoFontDescription  *desc;
  GdkPixbuf             *ret = NULL;
  cairo_surface_t       *surface = NULL;
  GtkBorder              frame_slice = { 4, 3, 3, 6 };

  BijiNoteObj *note = BIJI_NOTE_OBJ (item);

  if (note->priv->icon)
    return note->priv->icon;

  /* Create & Draw surface */
  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                        BIJI_ICON_WIDTH,
                                        BIJI_ICON_HEIGHT) ;
  cr = cairo_create (surface);

  /* Background */
  cairo_rectangle (cr, 0, 0, BIJI_ICON_WIDTH, BIJI_ICON_HEIGHT);
  if (biji_note_obj_get_rgba (note, &note_color))
    gdk_cairo_set_source_rgba (cr, &note_color);

  cairo_fill (cr);

  /* Text */
  text = biji_note_id_get_content (note->priv->id);
  if (text != NULL)
  {
    cairo_translate (cr, 10, 10);
    layout = pango_cairo_create_layout (cr);

    pango_layout_set_width (layout, 180000 );
    pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
    pango_layout_set_height (layout, 180000 ) ;

    pango_layout_set_text (layout, text, -1);
    desc = pango_font_description_from_string (BIJI_ICON_FONT);
    pango_layout_set_font_description (layout, desc);
    pango_font_description_free (desc);

    cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
    pango_cairo_update_layout (cr, layout);
    pango_cairo_show_layout (cr, layout);

    g_object_unref (layout);
  }

  cairo_destroy (cr);

  ret = gdk_pixbuf_get_from_surface (surface,
                                     0, 0,
                                     BIJI_ICON_WIDTH,
                                     BIJI_ICON_HEIGHT);
  cairo_surface_destroy (surface);

  note->priv->icon = gd_embed_image_in_frame (ret, "resource:///org/gnome/bijiben/thumbnail-frame.png",
                                              &frame_slice, &frame_slice);
  g_clear_object (&ret);

  return note->priv->icon;
}
开发者ID:Abdillah,项目名称:bijiben,代码行数:67,代码来源:biji-note-obj.c

示例14: gtk_widget_create_pango_layout

void ExternalPortModel::setPort(const char* szPort)
{
    if(!szPort)
        return;
   
    strPort = szPort;

    PangoLayout *layout = gtk_widget_create_pango_layout((GtkWidget*)parentWindow->gobj(), 
                            szPort);
    int text_w, text_h;
    PangoFontDescription *fontdesc = pango_font_description_from_string(FONT_DESC);
    pango_layout_set_font_description (layout, fontdesc);
    pango_layout_get_pixel_size (layout, &text_w, &text_h);

    width = text_w + H_MARGINE*2 + PORT_DEPTH;
    height = text_h + V_MARGINE*2;
    
    if(type == INPUTD)
    {
        Goocanvas::Points points(5);
        points.set_coordinate(0, 0, 0);
        points.set_coordinate(1, width, 0);
        points.set_coordinate(2, width, height);
        points.set_coordinate(3, 0, height);
        points.set_coordinate(4, PORT_DEPTH, height/2.0);
        poly->property_points().set_value(points);
        shadow->property_points().set_value(points);
    }
    else
    {
        Goocanvas::Points points(5);
        points.set_coordinate(0, 0, 0);
        points.set_coordinate(1, width-PORT_DEPTH, 0);
        points.set_coordinate(2, width, height/2.0);
        points.set_coordinate(3, width-PORT_DEPTH, height);
        points.set_coordinate(4, 0, height);
        poly->property_points().set_value(points);
        shadow->property_points().set_value(points);
    }

    text->property_text() = szPort;
    text->property_x().set_value(PORT_DEPTH+H_MARGINE/2.0);
    text->property_y().set_value(height/2.0 - text_h/2.0);
    updateArrowCoordination();
    
    // updating all connections from/to this port 
    Application* application = parentWindow->manager.getKnowledgeBase()->getApplication();
    std::vector<ArrowModel*>::iterator itr;   
    if(type == OUTPUTD)
    {
        for(itr = sourceArrows.begin(); itr!= sourceArrows.end(); itr++)
        {
            Connection* pConnection = (*itr)->getConnection();
            Connection con = *pConnection;
            con.setFrom(szPort);
            parentWindow->manager.getKnowledgeBase()->updateConnectionOfApplication(application, *pConnection, con);
            pConnection->setFrom(szPort);
        }            
    }
    else
    {
        for(itr = destinationArrows.begin(); itr!= destinationArrows.end(); itr++)
        {
            Connection* pConnection = (*itr)->getConnection();
            Connection con = *pConnection;
            con.setTo(szPort);
            parentWindow->manager.getKnowledgeBase()->updateConnectionOfApplication(application, *pConnection, con);
            pConnection->setTo(szPort);
        }            
    }
}
开发者ID:SibghatullahSheikh,项目名称:yarp,代码行数:71,代码来源:ext_port_model.cpp

示例15: render_logo

static void
render_logo (void)
{
  ClutterActor *image;
  ClutterActor *text, *text_shadow;
  ClutterActor *desc, *desc_shadow;
  ClutterColor actor_color = {0xff,0xff,0xff,0xff};
  ClutterColor shadow_color = {0x00, 0x00, 0x00, 0x88};
  ClutterActor *text_group;
  static gint width, height;
  gint size;
  gfloat stage_w, stage_h;
  PangoFontDescription *pfd;
  PangoLayout *layout;
  PangoContext *context;

  gchar *nibbles = _("Nibbles");
  /* Translators: This string will be included in the intro screen, so don't make sure it fits! */
  gchar *description = _("A worm game for MATE.");

  logo = clutter_group_new ();
  text_group = clutter_group_new ();

  if (!logo_pixmap)
    gnibbles_load_logo (properties->tilesize);

  image = gtk_clutter_texture_new_from_pixbuf (logo_pixmap);

  stage_w = board->width * properties->tilesize;
  stage_h = board->height * properties->tilesize;

  clutter_actor_set_size (CLUTTER_ACTOR (image), stage_w, stage_h);

  clutter_actor_set_position (CLUTTER_ACTOR (image), 0, 0);
  clutter_actor_show (image);

  text = clutter_text_new ();
  clutter_text_set_color (CLUTTER_TEXT (text), &actor_color);

  context = gdk_pango_context_get ();
  layout = clutter_text_get_layout (CLUTTER_TEXT (text));
  pfd = pango_context_get_font_description (context);
  size = pango_font_description_get_size (pfd);

  pango_font_description_set_size (pfd, (size * stage_w) / 100);
  pango_font_description_set_family (pfd, "Sans");
  pango_font_description_set_weight(pfd, PANGO_WEIGHT_BOLD);
  pango_layout_set_font_description (layout, pfd);
  pango_layout_set_text (layout, nibbles, -1);
  pango_layout_get_pixel_size (layout, &width, &height);

  text_shadow = clutter_text_new ();
  clutter_text_set_color (CLUTTER_TEXT (text_shadow), &shadow_color);

  layout = clutter_text_get_layout (CLUTTER_TEXT (text_shadow));
  pango_layout_set_font_description (layout, pfd);
  pango_layout_set_text (layout, nibbles, -1);

  clutter_actor_set_position (CLUTTER_ACTOR (text),
                              (stage_w - width) * 0.5 ,
                              stage_h * .72);
  clutter_actor_set_position (CLUTTER_ACTOR (text_shadow),
                              (stage_w - width) * 0.5 + 5,
                              stage_h * .72 + 5);

  desc = clutter_text_new ();
  layout = clutter_text_get_layout (CLUTTER_TEXT (desc));

  clutter_text_set_color (CLUTTER_TEXT (desc), &actor_color);
  pango_font_description_set_size (pfd, (size * stage_w) / 400);
  pango_layout_set_font_description (layout, pfd);
  pango_layout_set_text (layout, description, -1);
  pango_layout_get_pixel_size(layout, &width, &height);

  desc_shadow = clutter_text_new ();
  layout = clutter_text_get_layout (CLUTTER_TEXT (desc_shadow));
  clutter_text_set_color (CLUTTER_TEXT (desc_shadow), &shadow_color);

  pango_font_description_set_size (pfd, (size * stage_w) / 400);
  pango_layout_set_font_description (layout, pfd);
  pango_layout_set_text (layout, description, -1);

  clutter_actor_set_position (CLUTTER_ACTOR (desc),
                              (stage_w - width) * 0.5,
                              stage_h* .93);
  clutter_actor_set_position (CLUTTER_ACTOR (desc_shadow),
                              (stage_w - width) * 0.5 + 3,
                              stage_h * .93 + 3);

  clutter_container_add (CLUTTER_CONTAINER (text_group),
                         CLUTTER_ACTOR (text_shadow),
                         CLUTTER_ACTOR (text),
                         CLUTTER_ACTOR (desc_shadow),
                         CLUTTER_ACTOR (desc),
                         NULL);
  clutter_container_add (CLUTTER_CONTAINER (logo),
                         CLUTTER_ACTOR (image),
                         CLUTTER_ACTOR (text_group),
                         NULL);

//.........这里部分代码省略.........
开发者ID:gfunkmonk2,项目名称:mate-games,代码行数:101,代码来源:main.c


注:本文中的pango_layout_set_font_description函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。