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


C# Imaging.PropertyItem类代码示例

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


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


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