當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。