本文整理汇总了C#中Gdk.Rectangle.ToGdkRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.ToGdkRectangle方法的具体用法?C# Rectangle.ToGdkRectangle怎么用?C# Rectangle.ToGdkRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Rectangle
的用法示例。
在下文中一共展示了Rectangle.ToGdkRectangle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render (List<Layer> layers, Cairo.ImageSurface dst, Gdk.Point offset)
{
dst.Flush ();
// Our rectangle of interest
var r = new Gdk.Rectangle (offset, dst.GetBounds ().Size).ToCairoRectangle ();
using (var g = new Cairo.Context (dst)) {
// Create the transparent checkerboard background
g.Translate (-offset.X, -offset.Y);
g.FillRectangle (r, tranparent_pattern, new Cairo.PointD (offset.X, offset.Y));
for (var i = 0; i < layers.Count; i++) {
var layer = layers[i];
// If we're in LivePreview, substitute current layer with the preview layer
if (layer == PintaCore.Layers.CurrentLayer && PintaCore.LivePreview.IsEnabled)
layer = CreateLivePreviewLayer (layer);
// If the layer is offset, handle it here
if (!layer.Transform.IsIdentity ())
layer = CreateOffsetLayer (layer);
// No need to resize the surface if we're at 100% zoom
if (scale_factor.Ratio == 1)
layer.Draw (g, layer.Surface, layer.Opacity, false);
else {
using (var scaled = new Cairo.ImageSurface (Cairo.Format.Argb32, dst.Width, dst.Height)) {
g.Save ();
// Have to undo the translate set above
g.Translate (offset.X, offset.Y);
CopyScaled (layer.Surface, scaled, r.ToGdkRectangle ());
layer.Draw (g, scaled, layer.Opacity, false);
g.Restore ();
}
}
}
}
// If we are at least 200% and grid is requested, draw it
if (enable_pixel_grid && PintaCore.Actions.View.PixelGrid.Active && scale_factor.Ratio <= 0.5d)
RenderPixelGrid (dst, offset);
dst.MarkDirty ();
}