本文整理汇总了C#中System.Windows.Media.Imaging.BitmapSource.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# BitmapSource.Freeze方法的具体用法?C# BitmapSource.Freeze怎么用?C# BitmapSource.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Imaging.BitmapSource
的用法示例。
在下文中一共展示了BitmapSource.Freeze方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateScreenshot
/// <summary>
/// Updates the bitmap and the dimensions calculation.
/// </summary>
/// <param name="bmp">The bitmap to use to calculate guidelines.</param>
private void UpdateScreenshot(Bitmap bmp)
{
if (bmp != null)
{
lock (_bitmapLock)
{
IntPtr hbitmap = IntPtr.Zero;
try
{
ScreenshotBitmap = bmp;
hbitmap = bmp.GetHbitmap();
ScreenshotImage = Imaging.CreateBitmapSourceFromHBitmap(hbitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
if (ScreenshotImage != null) { ScreenshotImage.Freeze(); }
UpdateGuidelines();
}
catch (Exception e)
{
#if DEBUG
System.Diagnostics.Debug.WriteLine(e);
#endif
}
finally
{
if (hbitmap != IntPtr.Zero) { Win32API.DeleteObject(hbitmap); }
GC.Collect();
}
}
}
}
示例2: VideoFrame
public VideoFrame(BitmapSource snapshot, TimeSpan mediaTime)
{
Snapshot = snapshot;
MediaTime = mediaTime;
snapshot.Freeze();
}
示例3: UnifiedModelSystemInterface
static UnifiedModelSystemInterface()
{
try
{
try
{
ModuleIcon = CreateBitmapCache("pack://application:,,,/XTMF.Gui;component/Resources/Settings.png");
ModuleIcon.Freeze();
ListIcon = CreateBitmapCache("pack://application:,,,/XTMF.Gui;component/Resources/Plus.png");
ListIcon.Freeze();
}
catch
{
}
HighlightColour = (Color)Application.Current.TryFindResource("SelectionBlue");
FocusColour = (Color)Application.Current.TryFindResource("FocusColour");
ControlBackgroundColour = (Color)Application.Current.TryFindResource("ControlBackgroundColour");
AddingYellow = (Color)Application.Current.TryFindResource("AddingYellow");
InformationGreen = (Color)Application.Current.TryFindResource("InformationGreen");
WarningRed = (Color)Application.Current.TryFindResource("WarningRed");
}
catch
{
}
}
示例4: UserProfileControl
static UserProfileControl()
{
_Fallback = new BitmapImage(new Uri("pack://application:,,,/Inbox2.UI.Resources;component/icons/inbox-icon.png"));
_Fallback.Freeze();
}
示例5: InsertSource
public static void InsertSource(string imagePath, BitmapSource source)
{
ClearCache(imagePath);
source.Freeze();
images[imagePath] = source;
}
示例6: RenderResult
/// <summary>Constructs successul rendering result</summary>
/// <param name="request">Source request</param>
/// <param name="result">Rendered bitmap</param>
public RenderResult(RenderRequest request, BitmapSource result)
{
this.bitmap = result;
this.request = request;
result.Freeze();
}
示例7: NoteIconConverter
static NoteIconConverter()
{
_Fallback = new BitmapImage(new Uri("pack://application:,,,/Inbox2.UI.Resources;component/icons/icon_forlater.png"));
_Fallback.Freeze();
}
示例8: GetBitmapSource
private BitmapSource GetBitmapSource()
{
IntPtr inptr = _bitmap.GetHbitmap();
_bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(
inptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
DeleteObject(inptr);
if (!_bitmapSource.IsFrozen && _bitmapSource.CanFreeze)
_bitmapSource.Freeze();
return _bitmapSource;
}
示例9: MetaOrientation
private static BitmapSource MetaOrientation(BitmapMetadata meta, BitmapSource ret)
{
double angle = 0.0;
if (meta != null && ret != null)
{
if (meta.GetQuery("/app1/ifd/{ushort=274}") != null)
Picture.orientation = (Picture.ExifOrientations)Enum.Parse(typeof(Picture.ExifOrientations), meta.GetQuery("/app1/ifd/{ushort=274}").ToString());
switch (Picture.orientation)
{
case Picture.ExifOrientations.Rotate180:
angle = 180.0;
break;
case Picture.ExifOrientations.Rotate270:
angle = 90.0;
break;
case Picture.ExifOrientations.Rotate90:
angle = -90.0;
break;
}
if (angle != 0.0)
{
ret = (BitmapSource)new TransformedBitmap(ret.Clone(), (Transform)new RotateTransform(angle));
ret.Freeze();
}
}
return ret;
}
示例10: postTweet
/// <summary>
/// Post a message and image (from the webcam), Posts are made to @nzokdat
/// </summary>
/// <param name="message"></param>
/// <param name="bitsource"></param>
/// <param name="depO"></param>
public void postTweet(String message, BitmapSource bitsource, DependencyObject depO)
{
try
{
(Window.GetWindow(depO) as TopWindow).StopTimer();
//twitter service
bitsource.Freeze();
var frame = BitmapFrame.Create(bitsource);
PngBitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(frame);
byte[] data;
using (MemoryStream ms = new MemoryStream())
{
encoder.Save(ms);
data = ms.ToArray();
}
Stream stream = new MemoryStream(data);
List<Object> args = new List<Object>();
args.Add(message);
args.Add(bitsource);
args.Add(stream);
timer = depO;
worker.DoWork += m_oWorker_DoWork;
worker.RunWorkerAsync(args);
}
catch (Exception)
{
(Window.GetWindow(depO) as TopWindow).StartTimer();
}
}
示例11: Freeze
private BitmapSource Freeze(BitmapSource apply)
{
apply.Freeze();
return apply;
}