本文整理汇总了C#中Cairo.ImageSurface.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.ImageSurface.Destroy方法的具体用法?C# Cairo.ImageSurface.Destroy怎么用?C# Cairo.ImageSurface.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.ImageSurface
的用法示例。
在下文中一共展示了Cairo.ImageSurface.Destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public void Save(string file)
{
Cairo.ImageSurface s = new Cairo.ImageSurface (Cairo.Format.Rgb24, project.Details.Width, project.Details.Height);
Cairo.Context cr = new Cairo.Context (s);
bool previous = asynchronous;
asynchronous = false;
Draw (cr, null);
asynchronous = previous;
s.WriteToPng (file);
((IDisposable)cr).Dispose ();
s.Destroy ();
}
示例2: GenerateMenus
string GenerateMenus()
{
StringBuilder sb = new StringBuilder (2048);
Cairo.ImageSurface shigh = new Cairo.ImageSurface (Cairo.Format.ARGB32, project.Details.Width, project.Details.Height);
Cairo.Context chight = new Cairo.Context (shigh);
Cairo.ImageSurface snormal = new Cairo.ImageSurface (Cairo.Format.ARGB32, project.Details.Width, project.Details.Height);
Cairo.Context cnormal = new Cairo.Context (snormal);
for (int i = 0; i < project.Buttons.Count; i++)
{
Button button = (Button)project.Buttons [i];
sb.Append (" <button name = \"button" + i + "\"\n");
sb.Append (" x0 = \"" + project.Buttons[i].X + "\"\n");
sb.Append (" y0 = \"" + project.Buttons[i].Y + "\"\n");
sb.Append (" x1 = \"" + (project.Buttons[i].X + button.DrawingBoxWidth) + "\"\n");
sb.Append (" y1 = \"" + (project.Buttons[i].Y + button.DrawingBoxHeight) + "\"\n");
sb.Append (" down = \"ActionDown\"\n");
sb.Append (" up = \"ActionUp\"\n");
sb.Append (" />\n");
DrawButtons (button, chight, cnormal);
}
// Quantize the images given
{
// See: http://www.cairographics.org/manual/bindings-surfaces.html
byte [] pixels_normal = QuantizeSurface (snormal);
Cairo.ImageSurface snormal_quantized = new Cairo.ImageSurface (ref pixels_normal, snormal.Format, snormal.Width, snormal.Height, snormal.Stride);
byte [] pixels_high = QuantizeSurface (shigh);
Cairo.ImageSurface shigh_quantized = new Cairo.ImageSurface (ref pixels_high, shigh.Format, shigh.Width, shigh.Height, shigh.Stride);
snormal_quantized.WriteToPng (project.FileToFullPath (menu_normal));
shigh_quantized.WriteToPng (project.FileToFullPath (menu_highlight));
snormal_quantized.Destroy ();
shigh_quantized.Destroy ();
}
if (Mistelix.Debugging)
{
snormal.WriteToPng (project.FileToFullPath ("menu_normal_unquantized.png"));
shigh.WriteToPng (project.FileToFullPath ("menu_highlight_unquantized.png"));
}
((IDisposable)cnormal).Dispose ();
((IDisposable)chight).Dispose ();
shigh.Destroy ();
snormal.Destroy ();
return sb.ToString ();
}