当前位置: 首页>>代码示例>>C#>>正文


C# BitmapSource.Freeze方法代码示例

本文整理汇总了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();
                    }
                }

            }
        }
开发者ID:bjcy,项目名称:wpfScope,代码行数:36,代码来源:DimensionsAnalyzer.cs

示例2: VideoFrame

 public VideoFrame(BitmapSource snapshot, TimeSpan mediaTime)
 {
     Snapshot = snapshot;
     MediaTime = mediaTime;
     snapshot.Freeze();
 }
开发者ID:fivesixty,项目名称:StandaloneMB,代码行数:6,代码来源:MediaDetectorElement.cs

示例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
     {
     }
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:25,代码来源:UnifiedModelSystemInterface.xaml.cs

示例4: UserProfileControl

 static UserProfileControl()
 {
     _Fallback = new BitmapImage(new Uri("pack://application:,,,/Inbox2.UI.Resources;component/icons/inbox-icon.png"));
     _Fallback.Freeze();
 }
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:5,代码来源:UserProfileControl.xaml.cs

示例5: InsertSource

 public static void InsertSource(string imagePath, BitmapSource source)
 {
     ClearCache(imagePath);
     source.Freeze();
     images[imagePath] = source;
 }
开发者ID:Tesserex,项目名称:C--MegaMan-Engine,代码行数:6,代码来源:SpriteBitmapCache.cs

示例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();
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:9,代码来源:BitmapBasedGraph.cs

示例7: NoteIconConverter

 static NoteIconConverter()
 {
     _Fallback = new BitmapImage(new Uri("pack://application:,,,/Inbox2.UI.Resources;component/icons/icon_forlater.png"));
     _Fallback.Freeze();
 }
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:5,代码来源:ResourceConverters.cs

示例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;
 }
开发者ID:Mrding,项目名称:Ribbon,代码行数:10,代码来源:GIFImage.cs

示例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;
 }
开发者ID:GuzziMP,项目名称:my-films,代码行数:27,代码来源:Picture.cs

示例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();
            }
        }
开发者ID:raouldc,项目名称:OptiDev,代码行数:40,代码来源:Twitter.cs

示例11: Freeze

 private BitmapSource Freeze(BitmapSource apply)
 {
     apply.Freeze();
     return apply;
 }
开发者ID:SuperJMN,项目名称:Glass,代码行数:5,代码来源:LeadToolsZoneBasedBarcodeReader.cs


注:本文中的System.Windows.Media.Imaging.BitmapSource.Freeze方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。