本文整理汇总了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;
}
示例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;
}
示例3: DisposeContext
public static void DisposeContext (Cairo.Context cr)
{
((IDisposable)cr.GetTarget ()).Dispose ();
((IDisposable)cr).Dispose ();
}
示例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;
}
示例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;
}