本文整理汇总了C#中Gtk.ShapeCombineMask方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.ShapeCombineMask方法的具体用法?C# Gtk.ShapeCombineMask怎么用?C# Gtk.ShapeCombineMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.ShapeCombineMask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModifyWindowShape
/// <summary>
/// this function modifies a window shape
/// </summary>
/// <param name="bmp">
/// the bitmap that has the shape of the window. <see cref="System.Drawing.Bitmap"/>
/// </param>
/// <param name="window">
/// the window to apply the shape change <see cref="Gtk.Window"/>
/// </param>
/// <returns>
/// true if it succeded, either return false <see cref="System.Boolean"/>
/// </returns>
public static bool ModifyWindowShape( System.Drawing.Bitmap bmp, Gtk.Window window )
{
bool ret = false;
try
{
//save bitmap to stream
System.IO.MemoryStream stream = new System.IO.MemoryStream();
bmp.Save( stream, System.Drawing.Imaging.ImageFormat.Png );
//verry important: put stream on position 0
stream.Position = 0;
//get the pixmap mask
Gdk.Pixbuf buf = new Gdk.Pixbuf( stream, bmp.Width, bmp.Height );
Gdk.Pixmap map1, map2;
buf.RenderPixmapAndMask( out map1, out map2, 255 );
//shape combine window
window.ShapeCombineMask( map2, 0, 0 );
//dispose
buf.Dispose();
map1.Dispose();
map2.Dispose();
bmp.Dispose();
//if evrything is ok return true;
ret = true;
}
catch(Exception ex)
{
Console.WriteLine( ex.Message + "\r\n" + ex.StackTrace );
}
return ret;
}
示例2: SetWindowShape
public static void SetWindowShape(Gtk.Window w, Gtk.Image image)
{
Pixmap pixmap, pixmask;
image.Pixbuf.RenderPixmapAndMask (out pixmap, out pixmask, 1);
w.ShapeCombineMask (pixmask, 0, 0);
}
示例3: SetWindowShapeFromPixbuf
public static void SetWindowShapeFromPixbuf(Gtk.Window w, Gdk.Pixbuf pixbuf)
{
Pixmap pixmap, pixmask;
pixbuf.RenderPixmapAndMask (out pixmap, out pixmask, 1);
w.ShapeCombineMask (pixmask, 0, 0);
}