本文整理汇总了C#中Pinta.Core.Layer.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Layer.Draw方法的具体用法?C# Layer.Draw怎么用?C# Layer.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pinta.Core.Layer
的用法示例。
在下文中一共展示了Layer.Draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start (BaseEffect effect)
{
if (live_preview_enabled)
throw new InvalidOperationException ("LivePreviewManager.Start() called while live preview is already enabled.");
// Create live preview surface.
// Start rendering.
// Listen for changes to effectConfiguration object, and restart render if needed.
live_preview_enabled = true;
apply_live_preview_flag = false;
cancel_live_preview_flag = false;
layer = PintaCore.Layers.CurrentLayer;
this.effect = effect;
//TODO Use the current tool layer instead.
live_preview_surface = new Cairo.ImageSurface (Cairo.Format.Argb32,
PintaCore.Workspace.ImageSize.Width,
PintaCore.Workspace.ImageSize.Height);
// Handle selection path.
PintaCore.Tools.Commit ();
selection_path = (PintaCore.Layers.ShowSelection) ? PintaCore.Workspace.ActiveDocument.Selection.SelectionPath : null;
render_bounds = (selection_path != null) ? selection_path.GetBounds () : live_preview_surface.GetBounds ();
render_bounds = PintaCore.Workspace.ClampToImageSize (render_bounds);
history_item = new SimpleHistoryItem (effect.Icon, effect.Name);
history_item.TakeSnapshotOfLayer (PintaCore.Layers.CurrentLayerIndex);
// Paint the pre-effect layer surface into into the working surface.
using (var ctx = new Cairo.Context (live_preview_surface)) {
layer.Draw(ctx, layer.Surface, 1);
}
if (effect.EffectData != null)
effect.EffectData.PropertyChanged += EffectData_PropertyChanged;
if (Started != null) {
Started (this, new LivePreviewStartedEventArgs());
}
var settings = new AsyncEffectRenderer.Settings () {
ThreadCount = PintaCore.System.RenderThreads,
TileWidth = render_bounds.Width,
TileHeight = 1,
ThreadPriority = ThreadPriority.BelowNormal
};
Debug.WriteLine (DateTime.Now.ToString("HH:mm:ss:ffff") + "Start Live preview.");
renderer = new Renderer (this, settings);
renderer.Start (effect, layer.Surface, live_preview_surface, render_bounds);
if (effect.IsConfigurable) {
if (!effect.LaunchConfiguration ()) {
PintaCore.Chrome.MainWindowBusy = true;
Cancel ();
} else {
PintaCore.Chrome.MainWindowBusy = true;
Apply ();
}
} else {
PintaCore.Chrome.MainWindowBusy = true;
Apply ();
}
}
示例2: CreateOffsetLayer
private Layer CreateOffsetLayer(Layer original)
{
var offset = OffsetLayer;
offset.Surface.Clear ();
using (var g = new Cairo.Context (offset.Surface)) {
original.Draw(g, original.Surface, 1);
}
offset.BlendMode = original.BlendMode;
offset.Transform.InitMatrix(original.Transform);
offset.Opacity = original.Opacity;
return offset;
}