本文整理汇总了C#中Cairo.ImageSurface.GetBounds方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.ImageSurface.GetBounds方法的具体用法?C# Cairo.ImageSurface.GetBounds怎么用?C# Cairo.ImageSurface.GetBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.ImageSurface
的用法示例。
在下文中一共展示了Cairo.ImageSurface.GetBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ();
}
}