• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Imaging.PropertyItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



PropertyItem类属于System.Drawing.Imaging命名空间,在下文中一共展示了PropertyItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConvertFromMemory

        internal static PropertyItem[] ConvertFromMemory(IntPtr propdata, int count) {
            PropertyItem[] props = new PropertyItem[count];

            for (int i=0; i<count; i++) {
                PropertyItemInternal propcopy = null;
                try {
                    propcopy = (PropertyItemInternal) UnsafeNativeMethods.PtrToStructure(propdata,
                                                  typeof(PropertyItemInternal));

                    props[i] = new PropertyItem();
                    props[i].Id = propcopy.id;
                    props[i].Len = propcopy.len;
                    props[i].Type = propcopy.type;

                    // this calls Marshal.Copy and creates a copy of the original memory into a byte array.
                    props[i].Value = propcopy.Value;
                    
                    propcopy.value = IntPtr.Zero;  // we dont actually own this memory so dont free it.
                }
                finally {
                    if (propcopy != null) {
                        propcopy.Dispose();
                    }
                }
                
				propdata = (IntPtr)((long)propdata + (int)Marshal.SizeOf(typeof(PropertyItemInternal)));
            }

            return props;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:30,代码来源:PropertyItemInternal.cs


示例2: ExifReader

 /// <summary>
 /// Creates a new instance of the ExifReader class initialized with the specified PropertyItem array.
 /// </summary>
 /// <param name="oPropertyItems">Specifies an array of property items to read from.</param>
 public ExifReader(PropertyItem[] oPropertyItems)
 {
     if (oPropertyItems != null)
         m_oPropertyItems = oPropertyItems;
     else
         throw new ArgumentNullException("oPropertyItems", "The specified parameter cannot be null.");
 }
开发者ID:samuraitruong,项目名称:comitdownloader,代码行数:11,代码来源:ExifReader.cs


示例3: ExifProperty

        public ExifProperty(PropertyItem propertyItem)
        {
            if (propertyItem == null) throw new ArgumentNullException("propertyItem");
            item = propertyItem;

            CreateTag();
            CreateValue();
        }
开发者ID:eliudiaz,项目名称:Delta.Imaging,代码行数:8,代码来源:ExifProperty.cs


示例4: getById

        /// <summary>
        /// Returns the first PropertyItem with a matching ID
        /// </summary>
        /// <param name="items"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        protected static PropertyItem getById(PropertyItem[] items, int id)
        {
            for (int i = 0; i < items.Length; i++)
               if (items[i] != null && items[i].Id == id)
                   return items[i];

              return null;
        }
开发者ID:eakova,项目名称:resizer,代码行数:14,代码来源:AnimatedGifs.cs


示例5: GetLoops

 protected static int GetLoops(PropertyItem[] items)
 {
     // http://weblogs.asp.net/justin_rogers/archive/2004/01/19/60424.aspx
       //Property item ID 20737
       PropertyItem pi = getById(items, 20737);
       if (pi == null) return 0;
       //Combine bytes into integers
       return pi.Value[0] + (pi.Value[1] << 8);
 }
开发者ID:eakova,项目名称:resizer,代码行数:9,代码来源:AnimatedGifs.cs


示例6: GetDelays

 protected static int[] GetDelays(PropertyItem[] items)
 {
     //Property item ID 20736 http://bytes.com/groups/net-vb/692099-problem-animated-gifs
       PropertyItem pi = getById(items, 20736);
       if (pi == null) return null;
       //Combine bytes into integers
       int[] vals = new int[pi.Value.Length / 4];
       for (int i = 0; i < pi.Value.Length; i+=4){
           vals[i / 4] = BitConverter.ToInt32(pi.Value, i);
       }
       return vals;
 }
开发者ID:eakova,项目名称:resizer,代码行数:12,代码来源:AnimatedGifs.cs


示例7: SaveThumbnail

		public static void SaveThumbnail(Image thumb, ushort rating, string filePath)
		{
			string thumbPath = GetThumbPath(filePath);
			if (ratingProperty == null)
			{
				System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ThumbUtility));
				ratingProperty = ((System.Drawing.Image)(resources.GetObject("rating"))).GetPropertyItem(18246);
			}
			ratingProperty.Value = BitConverter.GetBytes(rating);
			thumb.SetPropertyItem(ratingProperty);
			thumb.Save(thumbPath, ImageFormat.Jpeg);
		}
开发者ID:ericpony,项目名称:comic-gallery,代码行数:12,代码来源:ThumbUtility.cs


示例8: SetPropertyItems

        public static void SetPropertyItems(Image image, PropertyItem[] items)
        {
            PropertyItem[] pis = image.PropertyItems;

            foreach (PropertyItem pi in pis)
            {
                image.RemovePropertyItem(pi.Id);
            }

            foreach (PropertyItem pi in items)
            {
                image.SetPropertyItem(pi);
            }
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:14,代码来源:PdnGraphics.cs


示例9: GetPropertyItem

 public static PropertyItem GetPropertyItem(int id, string value)
 {
     if (propertyItem == null)
     {
         System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PropertyItemProvider));
         Bitmap bmp = (Bitmap)resources.GetObject("propertyitemcontainer");
         propertyItem = bmp.GetPropertyItem(bmp.PropertyIdList[0]);
         propertyItem.Type = 2; // string
     }
     propertyItem.Id = id;
     System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
     propertyItem.Value = encoding.GetBytes(value + " ");
     propertyItem.Len = value.Length + 1;
     return propertyItem;
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:15,代码来源:PropertyItemProvider.cs


示例10: DecodeAsciiValue

        public static string DecodeAsciiValue(PropertyItem pi)
        {
            if (pi.Type != (short)ExifTagType.Ascii)
            {
                throw new ArgumentException("pi.Type != ExifTagType.Ascii");
            }
            
            string data = System.Text.Encoding.ASCII.GetString(pi.Value);
            if (data[data.Length - 1] == '\0')
            {
                data = data.Substring(0, data.Length - 1);
            }

            return data;
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:15,代码来源:Exif.cs


示例11: ClonePropertyItem

        /// <summary>
        /// Copies the given PropertyItem.
        /// </summary>
        /// <param name="pi">The PropertyItem to clone.</param>
        /// <returns>A copy of the given PropertyItem.</returns>
        public static PropertyItem ClonePropertyItem(PropertyItem pi)
        {
            byte[] valueClone;

            if (pi.Value == null)
            {
                valueClone = new byte[0];
            }
            else
            {
                valueClone = (byte[])pi.Value.Clone();
            }

            PropertyItem2 pi2 = new PropertyItem2(pi.Id, pi.Len, pi.Type, valueClone);
            return pi2.ToPropertyItem();
        }
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:21,代码来源:PdnGraphics.cs


示例12: ConvertFromPropertyItem

        internal static PropertyItemInternal ConvertFromPropertyItem(PropertyItem propItem) {
            PropertyItemInternal propItemInternal = new PropertyItemInternal();
            propItemInternal.id = propItem.Id;
            propItemInternal.len = 0;
            propItemInternal.type = propItem.Type;

            byte[] propItemValue = propItem.Value;
            if (propItemValue != null) {
                int length = propItemValue.Length;
                propItemInternal.len = length;
                propItemInternal.value = Marshal.AllocHGlobal(length);
                Marshal.Copy(propItemValue, 0, propItemInternal.value, length);
            }

            return propItemInternal;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:16,代码来源:PropertyItemInternal.cs


示例13: ConvertFromPropertyItem

 internal static PropertyItemInternal ConvertFromPropertyItem(PropertyItem propItem)
 {
     PropertyItemInternal internal2 = new PropertyItemInternal {
         id = propItem.Id,
         len = 0,
         type = propItem.Type
     };
     byte[] source = propItem.Value;
     if (source != null)
     {
         int length = source.Length;
         internal2.len = length;
         internal2.value = Marshal.AllocHGlobal(length);
         Marshal.Copy(source, 0, internal2.value, length);
     }
     return internal2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:PropertyItemInternal.cs


示例14: ExifProperty

        /// <summary>
        /// Initializes a new instance of the ExifProperty class.
        /// It's marked internal  as it's not intended to be instantiated independently outside of the library.
        /// </summary>
        /// <param name="propertyItem">The PropertyItem to base the object on</param>
        /// <param name="parentReader">The parent ExifReader</param>
        internal ExifProperty(PropertyItem propertyItem, ExifReader parentReader)
        {
            this.parentReader = parentReader;
            this.propertyItem = propertyItem;
            this.isUnknown = !Enum.IsDefined(typeof(PropertyTagId), this.RawExifTagId);

            var customFormatter = this.parentReader.QueryForCustomPropertyFormatter(this.RawExifTagId);

            if (customFormatter == null)
            {
                this.propertyFormatter = ExifPropertyFormatterProvider.GetExifPropertyFormatter(this.ExifTag);
            }
            else
            {
                this.propertyFormatter = customFormatter;
                this.hasCustomFormatter = true;
            }
        }
开发者ID:priceLiu,项目名称:exif,代码行数:24,代码来源:ExifProperty.cs


示例15: GetValueOfType

 private static string GetValueOfType(PropertyItem propItem)
 {
     switch (propItem.Type)
     {
     case 1:
         return EXIFMetaDataService.GetValueOfType1(propItem.Value);
     case 2:
         return EXIFMetaDataService.GetValueOfType2(propItem.Value);
     case 3:
         return EXIFMetaDataService.GetValueOfType3(propItem.Value);
     case 4:
         return EXIFMetaDataService.GetValueOfType4(propItem.Value);
     case 5:
         return EXIFMetaDataService.GetValueOfType5(propItem.Value);
     case 7:
         return EXIFMetaDataService.GetValueOfType7(propItem.Value, propItem.Id);
     }
     return string.Empty;
 }
开发者ID:hbulzy,项目名称:SYS,代码行数:19,代码来源:EXIFMetaDataService.cs


示例16: ConvertFromMemory

 internal static PropertyItem[] ConvertFromMemory(IntPtr propdata, int count)
 {
     PropertyItem[] itemArray = new PropertyItem[count];
     for (int i = 0; i < count; i++)
     {
         using (PropertyItemInternal internal2 = null)
         {
             internal2 = (PropertyItemInternal) UnsafeNativeMethods.PtrToStructure(propdata, typeof(PropertyItemInternal));
             itemArray[i] = new PropertyItem();
             itemArray[i].Id = internal2.id;
             itemArray[i].Len = internal2.len;
             itemArray[i].Type = internal2.type;
             itemArray[i].Value = internal2.Value;
             internal2.value = IntPtr.Zero;
         }
         propdata = (IntPtr) (((long) propdata) + Marshal.SizeOf(typeof(PropertyItemInternal)));
     }
     return itemArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:PropertyItemInternal.cs


示例17: DecodeByteValue

        public static byte DecodeByteValue(PropertyItem pi)
        {
            if (pi.Type != (short)ExifTagType.Byte)
            {
                throw new ArgumentException("pi.Type != ExifTagType.Byte");
            }

            if (pi.Value.Length != 1)
            {
                throw new ArgumentException("pi.Value.Length != 1");
            }

            if (pi.Len != 1)
            {
                throw new ArgumentException("pi.Length != 1");
            }

            return pi.Value[0];
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:19,代码来源:Exif.cs


示例18: PropertyTypeAndSize

		static string PropertyTypeAndSize(PropertyItem item) {
			int	divide;

			switch((PropertyTagType)item.Type) {
				case PropertyTagType.Byte:	divide = 1; break;
				case PropertyTagType.Long:	divide = 4; break;
				case PropertyTagType.Rational:	divide = 8; break;
				case PropertyTagType.Short:	divide = 2; break;
				case PropertyTagType.SRational:	divide = 4; break;
				default:			divide = 0; break;
			}
			if ((divide != 0) && ((item.Len / divide) > 1)) {
				return String.Format("{0}[{1}]", Enum.GetName(typeof(PropertyTagType), item.Type).ToString(), item.Len / divide);
			}

			return Enum.GetName(typeof(PropertyTagType), item.Type);
		}
开发者ID:yaoshuyin,项目名称:csharp,代码行数:17,代码来源:img.cs


示例19: ExifGpsToFloat

        private static float ExifGpsToFloat(PropertyItem propItemRef, PropertyItem propItem)
        {
            uint degreesNumerator = BitConverter.ToUInt32(propItem.Value, 0);
            uint degreesDenominator = BitConverter.ToUInt32(propItem.Value, 4);
            float degrees = degreesNumerator / (float)degreesDenominator;

            uint minutesNumerator = BitConverter.ToUInt32(propItem.Value, 8);
            uint minutesDenominator = BitConverter.ToUInt32(propItem.Value, 12);
            float minutes = minutesNumerator / (float)minutesDenominator;

            uint secondsNumerator = BitConverter.ToUInt32(propItem.Value, 16);
            uint secondsDenominator = BitConverter.ToUInt32(propItem.Value, 20);
            float seconds = secondsNumerator / (float)secondsDenominator;

            float coorditate = degrees + (minutes / 60f) + (seconds / 3600f);
            string gpsRef = System.Text.Encoding.ASCII.GetString(new byte[1] { propItemRef.Value[0] }); //N, S, E, or W
            if (gpsRef == "S" || gpsRef == "W")
                coorditate = 0 - coorditate;
            return coorditate;
        }
开发者ID:ratRenRao,项目名称:PhotoOrganizer,代码行数:20,代码来源:PictureData.cs


示例20: DecodeSLongValue

        public static int DecodeSLongValue(PropertyItem pi)
        {
            if (pi.Type != (short)ExifTagType.SLong)
            {
                throw new ArgumentException("pi.Type != ExifTagType.SLong");
            }

            if (pi.Value.Length != 4)
            {
                throw new ArgumentException("pi.Value.Length != 4");
            }

            if (pi.Len != 4)
            {
                throw new ArgumentException("pi.Length != 4");
            }

            return pi.Value[0] + (pi.Value[1] << 8) + (pi.Value[2] << 16) + (pi.Value[3] << 24);
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:19,代码来源:Exif.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Printing.Margins类代码示例发布时间:2022-05-26
下一篇:
C# Imaging.Metafile类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap