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


C# Cairo.GetTarget方法代码示例

本文整理汇总了C#中Cairo.GetTarget方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.GetTarget方法的具体用法?C# Cairo.GetTarget怎么用?C# Cairo.GetTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cairo的用法示例。


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

示例1: CreateSurfaceForPixbuf

        public static Surface CreateSurfaceForPixbuf (Cairo.Context cr, Gdk.Pixbuf pixbuf)
        {
	    Surface surface = cr.GetTarget ().CreateSimilar (cr.GetTarget ().Content, pixbuf.Width, pixbuf.Height);
            Cairo.Context surface_cr = new Context (surface);
            Gdk.CairoHelper.SetSourcePixbuf (surface_cr, pixbuf, 0, 0);
            surface_cr.Paint ();
            ((IDisposable)surface_cr).Dispose ();
            return surface;
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:9,代码来源:CairoExtensions.cs

示例2: SurfaceWrapper

		public SurfaceWrapper (Cairo.Context similar, Gdk.Pixbuf source)
		{
			Cairo.Surface surface;
			// There is a bug in Cairo for OSX right now that prevents creating additional accellerated surfaces.
			if (Platform.IsMac) {
				surface = new QuartzSurface (Format.ARGB32, source.Width, source.Height);
			} else if (Platform.IsWindows) {
				using (var t = similar.GetTarget ()) {
					surface = t.CreateSimilar (Content.ColorAlpha, source.Width, source.Height);
				}
			} else {
				surface = new ImageSurface (Format.ARGB32, source.Width, source.Height);
			}

			using (Context context = new Context (surface)) {
				Gdk.CairoHelper.SetSourcePixbuf (context, source, 0, 0);
				context.Paint ();
			}

			Surface = surface;
			Width = source.Width;
			Height = source.Height;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:23,代码来源:CairoExtensions.cs

示例3: DisposeContext

        public static void DisposeContext (Cairo.Context cr)
        {
	    ((IDisposable)cr.GetTarget ()).Dispose ();
            ((IDisposable)cr).Dispose ();
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:5,代码来源:CairoExtensions.cs

示例4: CreateScene

        private Surface CreateScene(Cairo.Context window_cr, ImageSurface image, int reflect)
        {
            var target = window_cr.GetTarget ();
            Surface surface = target.CreateSimilar (target.Content,
                image.Width, image.Height + reflect);
            using (var cr = new Context (surface)) {

                cr.Save ();

                cr.SetSource (image);
                cr.Paint ();

                cr.Rectangle (0, image.Height, image.Width, reflect);
                cr.Clip ();

                Matrix matrix = new Matrix ();
                matrix.InitScale (1, -1);
                matrix.Translate (0, -(2 * image.Height) + 1);
                cr.Transform (matrix);

                cr.SetSource (image);
                cr.Paint ();

                cr.Restore ();

                Color bg_transparent = BackgroundColor;
                bg_transparent.A = 0.65;

                using (var mask = new LinearGradient (0, image.Height, 0, image.Height + reflect)) {
                    mask.AddColorStop (0, bg_transparent);
                    mask.AddColorStop (1, BackgroundColor);

                    cr.Rectangle (0, image.Height, image.Width, reflect);
                    cr.SetSource (mask);
                    cr.Fill ();
                }

            }
            return surface;
        }
开发者ID:dufoli,项目名称:banshee,代码行数:40,代码来源:LargeTrackInfoDisplay.cs

示例5: CreateSurfaceForPixbuf

 public static Surface CreateSurfaceForPixbuf(Cairo.Context cr, Gdk.Pixbuf pixbuf)
 {
     var target = cr.GetTarget ();
     Surface surface = target.CreateSimilar (target.Content, pixbuf.Width, pixbuf.Height);
     using (var surface_cr = new Context (surface)) {
         Gdk.CairoHelper.SetSourcePixbuf (surface_cr, pixbuf, 0.0, 0.0);
         surface_cr.Paint ();
     }
     return surface;
 }
开发者ID:GNOME,项目名称:hyena,代码行数:10,代码来源:CairoExtensions.cs


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