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


C++ cairo_pattern_create_linear函数代码示例

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


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

示例1: ge_cairo_linear_shade_gradient_pattern

/***********************************************
 * ge_cairo_linear_shade_gradient_pattern - 
 *  
 *   Create A Linear Shade Gradient Pattern
 *   Aka Smooth Shade Gradient, from/to gradient
 *   With End points defined as shades of the
 *   base color
 ***********************************************/
CairoPattern *
ge_cairo_linear_shade_gradient_pattern(CairoColor *base, 
                                       gdouble shade1, 
                                       gdouble shade2, 
                                       gboolean vertical)
{
	CairoPattern * result = g_new0(CairoPattern, 1);

	if (vertical)
	{
		result->scale = GE_DIRECTION_VERTICAL;

		result->handle = cairo_pattern_create_linear(0, 0, 1, 0);
	}
	else
	{
		result->scale = GE_DIRECTION_HORIZONTAL;

		result->handle = cairo_pattern_create_linear(0, 0, 0, 1);
	}

	result->translate = GE_DIRECTION_BOTH;
	result->operator = CAIRO_OPERATOR_SOURCE;

	ge_cairo_pattern_add_color_stop_shade(result->handle, 0, base, shade1);
	ge_cairo_pattern_add_color_stop_shade(result->handle, 1, base, shade2);

	return result;
}
开发者ID:Distrotech,项目名称:gtk-engines,代码行数:37,代码来源:cairo-support.c

示例2: ge_cairo_linear_shade_gradient_pattern

/***********************************************
 * ge_cairo_linear_shade_gradient_pattern - 
 *  
 *   Create A Linear Shade Gradient Pattern
 *   Aka Smooth Shade Gradient, from/to gradient
 *   With End points defined as shades of the
 *   base color
 ***********************************************/
CairoPattern *
ge_cairo_linear_shade_gradient_pattern(CairoColor *base, 
						gdouble shade1, 
						gdouble shade2, 
						gboolean vertical)
{
	CairoPattern * result = g_new0(CairoPattern, 1);
	
	#if  ((CAIRO_VERSION_MAJOR < 1) || ((CAIRO_VERSION_MAJOR == 1) && (CAIRO_VERSION_MINOR < 2)))
		result->type = CAIRO_PATTERN_TYPE_LINEAR;
	#endif

	if (vertical)
	{
		result->scale = GE_DIRECTION_VERTICAL;

		result->handle = cairo_pattern_create_linear(0, 0, 1, 0);
	}
	else
	{
		result->scale = GE_DIRECTION_HORIZONTAL;

		result->handle = cairo_pattern_create_linear(0, 0, 0, 1);
	}

	result->translate = GE_DIRECTION_BOTH;
	result->operator = CAIRO_OPERATOR_SOURCE;

	ge_cairo_pattern_add_color_stop_shade(result->handle, 0, base, shade1);
	ge_cairo_pattern_add_color_stop_shade(result->handle, 1, base, shade2);

	return result;
}
开发者ID:davidhalter-archive,项目名称:ardour,代码行数:41,代码来源:cairo-support.c

示例3: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_pattern_t *pattern;

    cairo_set_source_rgb (cr, 0, 0, 0);
    cairo_paint (cr);

    /* with alpha */
    pattern = cairo_pattern_create_linear (0, 0, 0, height);
    cairo_pattern_add_color_stop_rgba (pattern, 0, 1, 1, 1, .5);
    cairo_pattern_add_color_stop_rgba (pattern, 1, 1, 1, 1, .5);
    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
    cairo_rectangle (cr, 0, 0, width/2, height);
    cairo_fill (cr);

    /* without alpha */
    pattern = cairo_pattern_create_linear (0, 0, 0, height);
    cairo_pattern_add_color_stop_rgb (pattern, 0, 1, 1, 1);
    cairo_pattern_add_color_stop_rgb (pattern, 1, 1, 1, 1);
    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
    cairo_rectangle (cr, width/2, 0, width/2, height);
    cairo_fill (cr);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:AZed,项目名称:cairo,代码行数:28,代码来源:linear-uniform.c

示例4: _ttk_draw_button_hover

void _ttk_draw_button_hover(cairo_t * cr, int x, int y, int width, int height) {
	cairo_save(cr);

	cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
	cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);

	cairo_rounded_rectangle(cr, 2 + x, 2 + y, width - 4, height - 4, 2.0);
	cairo_set_source_rgba(cr, 44.0/255.0, 71.0/255.0, 91.0/255.0, 29.0/255.0);
	cairo_set_line_width(cr, 4);
	cairo_stroke(cr);

	cairo_rounded_rectangle(cr, 2 + x, 2 + y, width - 4, height - 4, 2.0);
	cairo_set_source_rgba(cr, 158.0/255.0, 169.0/255.0, 177.0/255.0, 1.0);
	cairo_set_line_width(cr, 2);
	cairo_stroke(cr);

	{
		cairo_pattern_t * pat = cairo_pattern_create_linear(2 + x, 2 + y, 2 + x, 2 + y + height - 4);
		cairo_pattern_add_color_stop_rgba(pat, 0, 1, 1, 1, 1);
		cairo_pattern_add_color_stop_rgba(pat, 1, 229.0/255.0, 229.0/255.0, 246.0/255.0, 1);
		cairo_rounded_rectangle(cr, 2 + x, 2 + y, width - 4, height - 4, 2.0);
		cairo_set_source(cr, pat);
		cairo_fill(cr);
		cairo_pattern_destroy(pat);
	}

	{
		cairo_pattern_t * pat = cairo_pattern_create_linear(3 + x, 3 + y, 3 + x, 3 + y + height - 4);
		cairo_pattern_add_color_stop_rgba(pat, 0, 252.0/255.0, 252.0/255.0, 254.0/255.0, 1);
		cairo_pattern_add_color_stop_rgba(pat, 1, 212.0/255.0, 223.0/255.0, 251.0/255.0, 1);
		cairo_rounded_rectangle(cr, 3 + x, 3 + y, width - 5, height - 5, 2.0);
		cairo_set_source(cr, pat);
		cairo_fill(cr);
		cairo_pattern_destroy(pat);
	}

	{
		cairo_surface_t * surface = cairo_get_target(cr);
		gfx_context_t fake_context = {
			.width = cairo_image_surface_get_width(surface),
			.height = cairo_image_surface_get_height(surface),
			.depth = 32,
			.buffer = NULL,
			.backbuffer = cairo_image_surface_get_data(surface)
		};

		set_font_face(FONT_SANS_SERIF);
		set_font_size(13);

		char * title = "Button with Hover Highlight";
		int str_width = draw_string_width(title);
		draw_string(&fake_context, (width - str_width) / 2 + x, y + (height) / 2 + 4, rgb(49,49,49), title);
	}

	cairo_restore(cr);
	
}
开发者ID:ijustcode,项目名称:toaruos,代码行数:57,代码来源:ttk-core.c

示例5: clearlooks_glossy_draw_progressbar_trough

static void
clearlooks_glossy_draw_progressbar_trough (cairo_t *cr,
                                    const ClearlooksColors *colors,
                                    const WidgetParameters *params,
                                    int x, int y, int width, int height)
{
	const CairoColor *border = &colors->shade[6];
	CairoColor        shadow;
	cairo_pattern_t  *pattern;
	double           radius = MIN (params->radius, MIN ((height-2.0) / 2.0, (width-2.0) / 2.0));
	
	cairo_save (cr);

	cairo_set_line_width (cr, 1.0);
	
	/* Fill with bg color */
	ge_cairo_set_color (cr, &colors->bg[params->state_type]);
	
	cairo_rectangle (cr, x, y, width, height);
	cairo_fill (cr);

	/* Create trough box */
	ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
	ge_cairo_set_color (cr, &colors->shade[2]);
	cairo_fill (cr);

	/* Draw border */
	ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width-1, height-1, radius, params->corners);
	clearlooks_set_mixed_color (cr, border, &colors->shade[2], 0.3);
	cairo_stroke (cr);

	/* clip the corners of the shadows */
	ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
	cairo_clip (cr);

	ge_shade_color (border, 0.92, &shadow);

	/* Top shadow */
	cairo_rectangle (cr, x+1, y+1, width-2, 4);
	pattern = cairo_pattern_create_linear (x, y, x, y+4);
	cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.3);
	cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.);
	cairo_set_source (cr, pattern);
	cairo_fill (cr);
	cairo_pattern_destroy (pattern);

	/* Left shadow */
	cairo_rectangle (cr, x+1, y+1, 4, height-2);
	pattern = cairo_pattern_create_linear (x, y, x+4, y);
	cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.3);
	cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.);
	cairo_set_source (cr, pattern);
	cairo_fill (cr);
	cairo_pattern_destroy (pattern);

	cairo_restore (cr);
}
开发者ID:DanielAeolusLaude,项目名称:ardour,代码行数:57,代码来源:clearlooks_draw_glossy.c

示例6: cp_drawBackground

/*
 * Function resposible for drawing the plot background based on the settings
 * defined at CP_Context *ctx
 * 		@ctx:
 * 			CP_Context which point to the plot context.
 *
 * This function uses the following settings:
 * 	- bgGradient: pointer to a CP_Gradient structure. This structure defines
 * 	the gradient settings.
 * 	- bgColor: pointer to a CP_Color structure. This structure defines the flat
 * 	color to be used in the background
 *
 * If both pointers point to some contents C-CairoPlot will prefer to use a
 * Gradient over a flat color.
 * If none color is supported (neither flat or gradient) this function draws a
 * default background.
 *
 */
void cp_drawBackground(CP_Context *ctx)
{
	// Gradient Color
	if (ctx->bgGradient != NULL)
	{
		// TODO: Gradients should let users define the "orientation"
		// (left to right, right to left, up to down ou down to up) and the
		// gradient type (liner, radial or mesh)
		// mesh demo: https://gist.github.com/3159434
		cairo_pattern_t *pat;
		CP_Gradient *iter;
		pat = cairo_pattern_create_linear(0.5, 0.0, 0.5, 1);
		
		for (iter=ctx->bgGradient; iter; iter=iter->next)
			cairo_pattern_add_color_stop_rgba(pat, iter->position,
					iter->color->red, iter->color->green,
					iter->color->blue, iter->color->alpha);

		cairo_rectangle(ctx->cr, 0.0, 0.0, 1.0, 1.0);
		cairo_set_source(ctx->cr, pat);
		cairo_fill(ctx->cr);
		cairo_pattern_destroy(pat);
		return;
	}
	// Flat color
	else if (ctx->bgColor != NULL)
	{
		cairo_set_source_rgba(ctx->cr, ctx->bgColor->red,
				ctx->bgColor->green, ctx->bgColor->blue,
				ctx->bgColor->alpha);
		cairo_rectangle(ctx->cr, 0, 0, 1, 1);
		cairo_fill(ctx->cr);
	}
	else
	{
		// Default Color
		cairo_pattern_t *pat;
		pat = cairo_pattern_create_linear(0.5, 0.0, 0.5, 1);
		cairo_pattern_add_color_stop_rgba(pat, 0.0, 1.0, 1.0, 1.0, 1.0);
		cairo_pattern_add_color_stop_rgba(pat, 1.0, 0.9, 0.9, 0.9, 1.0);
		cairo_rectangle(ctx->cr, 0.0, 0.0, 1.0, 1.0);
		cairo_set_source(ctx->cr, pat);
		cairo_fill(ctx->cr);
		cairo_pattern_destroy(pat);
		return;
	}

}
开发者ID:magnunleno,项目名称:C-CairoPlot,代码行数:66,代码来源:plot.c

示例7: update_background

static void
update_background (ClutterActor       *tex,
                   const ClutterColor *color,
                   gfloat              width,
                   gfloat              height)
{
  cairo_t *cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (tex));
  cairo_pattern_t *pat;
  gfloat x, y;

#define BG_ROUND_RADIUS         12

  x = y = 0;

  cairo_move_to (cr, BG_ROUND_RADIUS, y);
  cairo_line_to (cr, width - BG_ROUND_RADIUS, y);
  cairo_curve_to (cr, width, y, width, y, width, BG_ROUND_RADIUS);
  cairo_line_to (cr, width, height - BG_ROUND_RADIUS);
  cairo_curve_to (cr, width, height, width, height, width - BG_ROUND_RADIUS, height);
  cairo_line_to (cr, BG_ROUND_RADIUS, height);
  cairo_curve_to (cr, x, height, x, height, x, height - BG_ROUND_RADIUS);
  cairo_line_to (cr, x, BG_ROUND_RADIUS);
  cairo_curve_to (cr, x, y, x, y, BG_ROUND_RADIUS, y);

  cairo_close_path (cr);

  clutter_cairo_set_source_color (cr, color);
  cairo_stroke (cr);

  x += 4;
  y += 4;
  width -= 4;
  height -= 4;

  cairo_move_to (cr, BG_ROUND_RADIUS, y);
  cairo_line_to (cr, width - BG_ROUND_RADIUS, y);
  cairo_curve_to (cr, width, y, width, y, width, BG_ROUND_RADIUS);
  cairo_line_to (cr, width, height - BG_ROUND_RADIUS);
  cairo_curve_to (cr, width, height, width, height, width - BG_ROUND_RADIUS, height);
  cairo_line_to (cr, BG_ROUND_RADIUS, height);
  cairo_curve_to (cr, x, height, x, height, x, height - BG_ROUND_RADIUS);
  cairo_line_to (cr, x, BG_ROUND_RADIUS);
  cairo_curve_to (cr, x, y, x, y, BG_ROUND_RADIUS, y);

  cairo_close_path (cr);

  pat = cairo_pattern_create_linear (0, 0, 0, height);
  cairo_pattern_add_color_stop_rgba (pat, 1, .85, .85, .85, 1);
  cairo_pattern_add_color_stop_rgba (pat, .95, 1, 1, 1, 1);
  cairo_pattern_add_color_stop_rgba (pat, .05, 1, 1, 1, 1);
  cairo_pattern_add_color_stop_rgba (pat, 0, .85, .85, .85, 1);

  cairo_set_source (cr, pat);
  cairo_fill (cr);

  cairo_pattern_destroy (pat);
  cairo_destroy (cr);

#undef BG_ROUND_RADIUS
}
开发者ID:spatulasnout,项目名称:clutter,代码行数:60,代码来源:test-bin-layout.c

示例8: cairo_rectangle

void Taskbar::Draw(cairo_t *cr)
{
    static double start_colour = 0.8;
    static double end_colour = 0.7;
    int m_colour = 0xf0f0f0;

    cairo_pattern_t     *pattern;
    double              red = ((m_colour >> 16) & 0xff) / 255.0;
    double              green = ((m_colour >> 8) & 0xff) / 255.0;
    double              blue = ((m_colour) & 0xff) / 255.0;

    cairo_rectangle(cr, 0.5, 0.5, m_draw_size.m_width-1.0, m_draw_size.m_height-1.0);

    pattern = cairo_pattern_create_linear(0, 0, 0, m_draw_size.m_height);
    cairo_pattern_add_color_stop_rgb(pattern, 0.0, start_colour*red, start_colour*green, start_colour*blue);
    cairo_pattern_add_color_stop_rgb(pattern, 1.0, end_colour*red, end_colour*green, end_colour*blue);

    /* Fill with our pattern */
    cairo_set_source(cr, pattern);
    cairo_fill(cr);

    /* Destroy the pattern */
    cairo_pattern_destroy(pattern);

    // Now draw a line at the bottom
    const double bound_colour = 0.5;
    cairo_set_source_rgb(cr, bound_colour, bound_colour, bound_colour);
    cairo_set_line_width(cr, 1.0);
    cairo_move_to(cr, 0.5, m_draw_size.m_height-0.5);
    cairo_line_to(cr, m_draw_size.m_width-0.5, m_draw_size.m_height-0.5);
    cairo_stroke(cr);

    drawChild(cr);
}
开发者ID:gerryg400,项目名称:anvilos,代码行数:34,代码来源:Taskbar.cpp

示例9: clearlooks_inverted_draw_menubaritem

static void
clearlooks_inverted_draw_menubaritem (cairo_t *cr,
                          const ClearlooksColors          *colors,
                          const WidgetParameters          *widget,
                          int x, int y, int width, int height)
{
	CairoColor *fill = (CairoColor*)&colors->spot[1];
	CairoColor fill_shade;
	CairoColor border = colors->spot[2];
	cairo_pattern_t *pattern;
	
	ge_shade_color (&border, 1.05, &border);
	ge_shade_color (fill, 0.85, &fill_shade);
	
	cairo_set_line_width (cr, 1.0);
	ge_cairo_rounded_rectangle (cr, x + 0.5, y + 0.5, width - 1, height, widget->radius, widget->corners);

	pattern = cairo_pattern_create_linear (x, y, x, y + height);
	cairo_pattern_add_color_stop_rgb (pattern, 0, fill_shade.r, fill_shade.g, fill_shade.b);
	cairo_pattern_add_color_stop_rgb (pattern, 1.0,   fill->r, fill->g, fill->b);

	cairo_set_source (cr, pattern);
	cairo_fill_preserve  (cr);
	cairo_pattern_destroy (pattern);

	ge_cairo_set_color (cr, &border);
	cairo_stroke_preserve (cr);
}
开发者ID:TALAPCH1,项目名称:LXDE-configuration,代码行数:28,代码来源:clearlooks_draw_inverted.c

示例10: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_pattern_t *pattern;

    cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
    cairo_paint (cr);

    cairo_save (cr);

    pattern = cairo_pattern_create_linear (0, 0, 10.0, 0);

    cairo_pattern_add_color_stop_rgb (pattern, 0.0,
				      0.0, 0.0, 1.0);
    cairo_pattern_add_color_stop_rgb (pattern, 1.0,
				      1.0, 0.0, 0.0);
    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REFLECT);

    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
    cairo_rectangle (cr, 0.0, 0.0, WIDTH, HEIGHT);
    cairo_fill (cr);

    cairo_restore (cr);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:27,代码来源:linear-gradient-reflect.c

示例11: terranova_draw_candy_selected_cell

static void
terranova_draw_candy_selected_cell (cairo_t                  *cr,
                                    const terranovaColors   *colors,
                                    const WidgetParameters   *params,
                                    int x, int y, int width, int height)
{
    cairo_save (cr);

    cairo_translate (cr, x, y);

    cairo_pattern_t *pattern;

    CairoColor fill = colors->bg[params->state_type];
    CairoColor shade1, shade2;
    tn_shade_color (&fill, 0.96, &shade1);
    tn_shade_color (&fill, 1.10, &shade2);

    pattern	= cairo_pattern_create_linear (0, 0, 0, height);
    cairo_pattern_add_color_stop_rgb (pattern, 0.00, shade1.r, shade1.g, shade1.b);
    cairo_pattern_add_color_stop_rgb (pattern, 0.35, shade1.r, shade1.g, shade1.b);
    cairo_pattern_add_color_stop_rgb (pattern, 0.65, shade2.r, shade2.g, shade2.b);
    cairo_pattern_add_color_stop_rgb (pattern, 1.00, shade2.r, shade2.g, shade2.b);

    cairo_set_source (cr, pattern);
    cairo_rectangle  (cr, 0, 0, width, height);
    cairo_fill       (cr);
    cairo_pattern_destroy (pattern);

    cairo_restore (cr);
}
开发者ID:Nanolx,项目名称:TerraNova-GTK2,代码行数:30,代码来源:terranova_draw_candy.c

示例12: terranova_draw_candy_list_view_header

static void
terranova_draw_candy_list_view_header (cairo_t *cr,
                                       const terranovaColors          *colors,
                                       const WidgetParameters          *params,
                                       const ListViewHeaderParameters  *header,
                                       int x, int y, int width, int height)
{
    const CairoColor *fill = &colors->bg[GTK_STATE_NORMAL];
    cairo_pattern_t *pattern;

    cairo_translate (cr, x, y);

    CairoColor shade1, shade2;
    tn_shade_color (fill, 0.96, &shade1);
    tn_shade_color (fill, 1.10, &shade2);

    pattern	= cairo_pattern_create_linear (0, 0, 0, height);
    cairo_pattern_add_color_stop_rgb (pattern, 0.00, shade1.r, shade1.g, shade1.b);
    cairo_pattern_add_color_stop_rgb (pattern, 0.35, shade1.r, shade1.g, shade1.b);
    cairo_pattern_add_color_stop_rgb (pattern, 0.65, shade2.r, shade2.g, shade2.b);
    cairo_pattern_add_color_stop_rgb (pattern, 1.00, shade2.r, shade2.g, shade2.b);
    cairo_set_source (cr, pattern);
    cairo_rectangle (cr, 0, 0, width, height);
    cairo_fill (cr);
    cairo_pattern_destroy (pattern);

}
开发者ID:Nanolx,项目名称:TerraNova-GTK2,代码行数:27,代码来源:terranova_draw_candy.c

示例13: _eventd_nd_cairo_image_and_icon_draw_background

static void
_eventd_nd_cairo_image_and_icon_draw_background(cairo_t *cr, cairo_surface_t *image, cairo_surface_t *icon, EventdNdStyle *style, gint width, gint height)
{
    gint padding;

    padding = eventd_nd_style_get_bubble_padding(style);

    if ( image != NULL )
        _eventd_nd_cairo_surface_draw(cr, image, padding, padding);

    if ( icon != NULL )
    {
        gint x1, x2, y;
        cairo_pattern_t *mask;

        x2 = width - padding;
        x1 = x2 - cairo_image_surface_get_width(icon);
        y = _eventd_nd_cairo_get_valign(eventd_nd_style_get_icon_anchor(style), height, padding, cairo_image_surface_get_height(icon));

        mask = cairo_pattern_create_linear(x1, 0, x2, 0);
        cairo_pattern_add_color_stop_rgba(mask, 0, 0, 0, 0, 0);
        cairo_pattern_add_color_stop_rgba(mask, eventd_nd_style_get_icon_fade_width(style), 0, 0, 0, 1);

        cairo_set_source_surface(cr, icon, x1, y);
        cairo_mask(cr, mask);
        cairo_surface_destroy(icon);
    }
}
开发者ID:Keruspe,项目名称:eventd,代码行数:28,代码来源:icon.c

示例14: fill_background

/* Fill background */
static void
fill_background(GtkWidget *widget, WindowData *windata, cairo_t *cr)
{
	float alpha;
	if (windata->enable_transparency)
		alpha = BACKGROUND_OPACITY;
	else
		alpha = 1.0;

	cairo_pattern_t *pattern;
	pattern = cairo_pattern_create_linear (0, 0, 0, windata->height);
	cairo_pattern_add_color_stop_rgba (pattern, 0, 
        19/255.0, 19/255.0, 19/255.0, alpha);
	cairo_pattern_add_color_stop_rgba (pattern, GRADIENT_CENTER, 
        19/255.0, 19/255.0, 19/255.0, alpha);
	cairo_pattern_add_color_stop_rgba (pattern, 1, 
        19/255.0, 19/255.0, 19/255.0, alpha);
	cairo_set_source (cr, pattern);
	cairo_pattern_destroy (pattern);
	
    nodoka_rounded_rectangle (cr, 0, 8, windata->width-8,
        windata->height-8, 6);

	cairo_fill (cr);	
}
开发者ID:VictorCabello,项目名称:mate-notification-daemon,代码行数:26,代码来源:coco-theme.c

示例15: on_draw

static gboolean
on_draw(JoyBubble *image, cairo_t *cr, G_GNUC_UNUSED gpointer data)
{
	gint width = joy_bubble_get_width(image) - 2;
	gint height = joy_bubble_get_height(image) - 2;
	double aspect = 0.75;
	double corner_radius = height / 30.;
	double radius = corner_radius / aspect;
	double degrees = M_PI / 180.;
	cairo_translate(cr, 1., 1.);
	/* background */
	cairo_arc(cr, width - radius, radius, radius, -90 * degrees, 0);
	cairo_arc(cr, width - radius, height - radius, radius, 0,
			90 * degrees);
	cairo_arc(cr, radius, height - radius, radius, 90 * degrees,
			180 * degrees);
	cairo_arc(cr, radius, radius, radius, 180 * degrees, 270 * degrees);
	cairo_close_path(cr);
	cairo_pattern_t *pat = cairo_pattern_create_linear(0, 0, 0, height);
	cairo_pattern_add_color_stop_rgba(pat, 0., 1., 1., 1., 0.85);
	cairo_pattern_add_color_stop_rgba(pat, 0.25, 0.39, 0.58, 0.93, 0.85);
	cairo_set_source(cr, pat);
	cairo_pattern_destroy(pat);
	cairo_fill_preserve(cr);
	/* outline */
	cairo_set_source_rgba(cr, 1., 1., 1., 1.);
	cairo_set_line_width(cr, 2.);
	cairo_stroke(cr);
	return TRUE;
}
开发者ID:msteinert,项目名称:joybubbles,代码行数:30,代码来源:joybubbles-test.c


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