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


C# FrameDimension.Equals方法代码示例

本文整理汇总了C#中System.Drawing.Imaging.FrameDimension.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# FrameDimension.Equals方法的具体用法?C# FrameDimension.Equals怎么用?C# FrameDimension.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Imaging.FrameDimension的用法示例。


在下文中一共展示了FrameDimension.Equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Empty

		public void Empty ()
		{
			FrameDimension fd = new FrameDimension (Guid.Empty);
			Assert.AreEqual ("00000000-0000-0000-0000-000000000000", fd.Guid.ToString (), "Guid");
			Assert.AreEqual (Guid.Empty.GetHashCode (), fd.GetHashCode (), "GetHashCode");
			Assert.AreEqual ("[FrameDimension: 00000000-0000-0000-0000-000000000000]", fd.ToString (), "ToString");

			Assert.IsTrue (fd.Equals (new FrameDimension (Guid.Empty)), "Equals(Empty)");
			Assert.IsFalse (fd.Equals (null), "Equals(null)");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:FrameDimensionTest.cs

示例2: Equals

		public void Equals ()
		{
			FrameDimension fd = new FrameDimension (new Guid ("7462dc86-6180-4c7e-8e3f-ee7333a7a483"));
			// equals
			Assert.IsTrue (fd.Equals (FrameDimension.Page), "Page");
			// but ToString differs!
			Assert.AreEqual ("[FrameDimension: 7462dc86-6180-4c7e-8e3f-ee7333a7a483]", fd.ToString (), "ToString");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:FrameDimensionTest.cs

示例3: EnsureSave

        internal static void EnsureSave(Image image, string filename, Stream dataStream) {

            if (image.RawFormat.Equals(ImageFormat.Gif)) {
                bool animatedGif = false;

                Guid[] dimensions = image.FrameDimensionsList;
                foreach (Guid guid in dimensions) {
                    FrameDimension dimension = new FrameDimension(guid);
                    if (dimension.Equals(FrameDimension.Time)) {
                        animatedGif = image.GetFrameCount(FrameDimension.Time) > 1;
                        break;
                    }
                }


                if (animatedGif) {
                    try {
                        Stream created = null;
                        long lastPos = 0;
                        if (dataStream != null) {
                            lastPos = dataStream.Position;
                            dataStream.Position = 0;
                        }

                        try {
                            if (dataStream == null) {
                                created = dataStream = File.OpenRead(filename);
                            }

                            image.rawData = new byte[(int)dataStream.Length];
                            dataStream.Read(image.rawData, 0, (int)dataStream.Length);
                        }
                        finally {
                            if (created != null) {
                                created.Close();
                            }
                            else {
                                dataStream.Position = lastPos;
                            }
                        }
                    }
                    // possible exceptions for reading the filename
                    catch (UnauthorizedAccessException) {
                    }
                    catch (DirectoryNotFoundException) {
                    }
                    catch (IOException) {
                    }
                    // possible exceptions for setting/getting the position inside dataStream
                    catch (NotSupportedException) {
                    }
                    catch (ObjectDisposedException) {
                    }
                    // possible exception when reading stuff into dataStream
                    catch (ArgumentException) {
                    }
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:59,代码来源:Image.cs

示例4: CanAnimate

        /// <devdoc>
        ///    Whether or not the image has multiple time-based frames.
        /// </devdoc>
        public static bool CanAnimate(Image image) {
            if( image == null ) {
                return false;
            }

            // See comment in the class header about locking the image ref.
            lock( image ) {
                Guid[] dimensions = image.FrameDimensionsList;
                    
                foreach (Guid guid in dimensions) {
                    FrameDimension dimension = new FrameDimension(guid);
                    if (dimension.Equals(FrameDimension.Time)) {
                        return image.GetFrameCount(FrameDimension.Time) > 1;
                    }
                }
            }

            return false;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:22,代码来源:ImageAnimator.cs

示例5: EnsureSave

 internal static void EnsureSave(Image image, string filename, Stream dataStream)
 {
     if (image.RawFormat.Equals(ImageFormat.Gif))
     {
         bool flag = false;
         foreach (Guid guid in image.FrameDimensionsList)
         {
             FrameDimension dimension = new FrameDimension(guid);
             if (dimension.Equals(FrameDimension.Time))
             {
                 flag = image.GetFrameCount(FrameDimension.Time) > 1;
                 break;
             }
         }
         if (flag)
         {
             try
             {
                 Stream stream = null;
                 long position = 0L;
                 if (dataStream != null)
                 {
                     position = dataStream.Position;
                     dataStream.Position = 0L;
                 }
                 try
                 {
                     if (dataStream == null)
                     {
                         stream = dataStream = File.OpenRead(filename);
                     }
                     image.rawData = new byte[(int) dataStream.Length];
                     dataStream.Read(image.rawData, 0, (int) dataStream.Length);
                 }
                 finally
                 {
                     if (stream != null)
                     {
                         stream.Close();
                     }
                     else
                     {
                         dataStream.Position = position;
                     }
                 }
             }
             catch (UnauthorizedAccessException)
             {
             }
             catch (DirectoryNotFoundException)
             {
             }
             catch (IOException)
             {
             }
             catch (NotSupportedException)
             {
             }
             catch (ObjectDisposedException)
             {
             }
             catch (ArgumentException)
             {
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:67,代码来源:Image.cs

示例6: CanAnimate

 public static bool CanAnimate(Image image)
 {
     if (image != null)
     {
         lock (image)
         {
             foreach (Guid guid in image.FrameDimensionsList)
             {
                 FrameDimension dimension = new FrameDimension(guid);
                 if (dimension.Equals(FrameDimension.Time))
                 {
                     return (image.GetFrameCount(FrameDimension.Time) > 1);
                 }
             }
         }
     }
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:ImageAnimator.cs


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