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

C# ImageInfo类代码示例

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

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



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

示例1: Animate

 public static void Animate(Image image, EventHandler onFrameChangedHandler)
 {
     if (image != null)
     {
         ImageInfo item = null;
         lock (image)
         {
             item = new ImageInfo(image);
         }
         StopAnimate(image, onFrameChangedHandler);
         bool isReaderLockHeld = rwImgListLock.IsReaderLockHeld;
         LockCookie lockCookie = new LockCookie();
         threadWriterLockWaitCount++;
         try
         {
             if (isReaderLockHeld)
             {
                 lockCookie = rwImgListLock.UpgradeToWriterLock(-1);
             }
             else
             {
                 rwImgListLock.AcquireWriterLock(-1);
             }
         }
         finally
         {
             threadWriterLockWaitCount--;
         }
         try
         {
             if (item.Animated)
             {
                 if (imageInfoList == null)
                 {
                     imageInfoList = new List<ImageInfo>();
                 }
                 item.FrameChangedHandler = onFrameChangedHandler;
                 imageInfoList.Add(item);
                 if (animationThread == null)
                 {
                     animationThread = new Thread(new ThreadStart(ImageAnimator.AnimateImages50ms));
                     animationThread.Name = typeof(ImageAnimator).Name;
                     animationThread.IsBackground = true;
                     animationThread.Start();
                 }
             }
         }
         finally
         {
             if (isReaderLockHeld)
             {
                 rwImgListLock.DowngradeFromWriterLock(ref lockCookie);
             }
             else
             {
                 rwImgListLock.ReleaseWriterLock();
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:ImageAnimator.cs


示例2: GetImages

        public async Task<ImageInfo[]> GetImages(Match match)
        {
            var id = match.Groups[1].Value;
            var key = "cloudapp-" + id;

            var result = await this._memoryCache.GetOrSet(
                "cloudapp-" + id,
                () => this.Fetch(match.Value)
            ).ConfigureAwait(false);

            ImageInfo i;
            switch (result.item_type)
            {
                case "image":
                    i = new ImageInfo(result.content_url, result.content_url, result.thumbnail_url ?? result.content_url);
                    break;
                case "video":
                    // ThumbnailUrl is probably null.
                    i = new ImageInfo(result.thumbnail_url, result.thumbnail_url, result.thumbnail_url, result.content_url, result.content_url, result.content_url);
                    break;
                default:
                    throw new NotPictureException();
            }

            return new[] { i };
        }
开发者ID:azyobuzin,项目名称:img.azyobuzi.net,代码行数:26,代码来源:CloudApp.cs


示例3: Product

 public Product(string name, decimal unitPrice, Category category, ImageInfo image)
 {
     this.Name = name;
     this.UnitPrice = unitPrice;
     this.Category = category;
     this.Image = image;
 }
开发者ID:snahider,项目名称:Code-Smells-and-Refactoring,代码行数:7,代码来源:Product.cs


示例4: AttachedImage

 public AttachedImage(PlatformClient client, AttachedImageData data)
     : base(client)
 {
     _data = data;
     Image = new ImageInfo(client, data.Image);
     Album = new AlbumInfo(client, data.Album);
 }
开发者ID:namoshika,项目名称:SnkLib.Web.GooglePlus,代码行数:7,代码来源:AttachedImage.cs


示例5: toImgur

        public static ImageInfo toImgur(Bitmap bmp)
        {
            ImageConverter convert = new ImageConverter();
            byte[] toSend = (byte[])convert.ConvertTo(bmp, typeof(byte[]));
            using (WebClient wc = new WebClient())
            {
                NameValueCollection nvc = new NameValueCollection
                {
                    { "image", Convert.ToBase64String(toSend) }
                };
                wc.Headers.Add("Authorization", Imgur.getAuth());
                ImageInfo info = new ImageInfo();
                try  
                {
                    byte[] response = wc.UploadValues("https://api.imgur.com/3/upload.xml", nvc);
                    string res = System.Text.Encoding.Default.GetString(response);

                    var xmlDoc = new System.Xml.XmlDocument();
                    xmlDoc.LoadXml(res);
                    info.link = new Uri(xmlDoc.SelectSingleNode("data/link").InnerText);
                    info.deletehash = xmlDoc.SelectSingleNode("data/deletehash").InnerText;
                    info.id = xmlDoc.SelectSingleNode("data/id").InnerText;
                    info.success = true;
                }
                catch (Exception e)
                {
                    info.success = false;
                    info.ex = e;
                }
                return info;
            }
        }
开发者ID:Enoz,项目名称:InfiniPad,代码行数:32,代码来源:Imgur.cs


示例6: GetImages

        public async Task<ImageInfo[]> GetImages(Match match)
        {
            var username = match.Groups[1].Value;
            var id = match.Groups[2].Value;
            var info = await this._memoryCache.GetOrSet(
                "hatenafotolife-" + username + "/" + id,
                () => this.Fetch(username, id)
            ).ConfigureAwait(false);

            var result = new ImageInfo();
            var baseUri = "http://cdn-ak.f.st-hatena.com/images/fotolife/" + username.Substring(0, 1) + "/" + username + "/" + id.Substring(0, 8) + "/" + id;

            if (info.Extension == "flv")
            {
                result.VideoFull = result.VideoLarge = result.VideoMobile = baseUri + ".flv";
                result.Full = result.Large = baseUri + ".jpg";
            }
            else
            {
                result.Large = baseUri + "." + info.Extension;
                result.Full = info.IsOriginalAvailable
                    ? baseUri + "_original." + info.Extension
                    : result.Large;
            }

            result.Thumb = baseUri + "_120.jpg";

            return new[] { result };
        }
开发者ID:azyobuzin,项目名称:img.azyobuzi.net,代码行数:29,代码来源:HatenaFotolife.cs


示例7: _timer_Tick

 void _timer_Tick(object sender, object e)
 {
     _timer.Stop();
     ImageInfo image = new ImageInfo();
     image.ViewBounds = this.ViewBounds;
     StartDownloadImage(image);
 }
开发者ID:SuperMap,项目名称:iClient-for-Win8,代码行数:7,代码来源:DynamicLayer.cs


示例8: DoIt

        public void DoIt()
        {
            // Get the tool GUID;
            Type t = typeof(SimpleTool);
            GuidAttribute guidAttr = (GuidAttribute)t.GetCustomAttributes(typeof(GuidAttribute), false)[0];
            Guid guid = new Guid(guidAttr.Value);

            // don't redefine the stock tool if it's already in the catalog
            ToolPaletteManager mgr = ToolPaletteManager.Manager;
            if (mgr.StockToolCatalogs.Find(guid) != null)
                return;

            SimpleTool tool = new SimpleTool();
            tool.New();

            Catalog catalog = tool.CreateStockTool("SimpleCatalog");
            Palette palette = tool.CreatePalette(catalog, "SimplePalette");
            Package package = tool.CreateShapeCatalog("*AutoCADShapes");
            tool.CreateFlyoutTool(palette, package, null);
            ImageInfo imageInfo = new ImageInfo();
            imageInfo.ResourceFile = "TOOL1.bmp";
            imageInfo.Size=new System.Drawing.Size(65,65);

            tool.CreateCommandTool(palette, "Line", imageInfo, tool.CmdName);
            tool.CreateTool(palette, "Custom Line",imageInfo);
            mgr.LoadCatalogs();
        }
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:27,代码来源:SimpleToolPaletteExample.cs


示例9: ResizeAsync

        /// <summary>
        ///     Resizes the image presented by the <paramref name="imageData"/> to a <paramref name="newSize"/>.
        /// </summary>
        /// <param name="imageData">
        ///     The binary data of the image to resize.
        /// </param>
        /// <param name="newSize">
        ///     The size to which to resize the image.
        /// </param>
        /// <param name="keepAspectRatio">
        ///     A flag indicating whether to save original aspect ratio.
        /// </param>
        /// <returns>
        ///     The structure which contains binary data of resized image and the actial size of resized image depending on <paramref name="keepAspectRatio"/> value.
        /// </returns>
        /// <exception cref="InvalidOperationException">
        ///     An error occurred during resizing the image.
        /// </exception>
        public static Task<ImageInfo> ResizeAsync(this byte[] imageData, Size newSize, bool keepAspectRatio)
        {
            var result = new ImageInfo();
            var image = imageData.ToBitmap();
            var percentWidth = (double) newSize.Width/(double) image.PixelWidth;
            var percentHeight = (double) newSize.Height/(double) image.PixelHeight;

            ScaleTransform transform;
            if (keepAspectRatio)
            {
                transform = percentWidth < percentHeight
                                ? new ScaleTransform {ScaleX = percentWidth, ScaleY = percentWidth}
                                : new ScaleTransform {ScaleX = percentHeight, ScaleY = percentHeight};
            }
            else
            {
                transform = new ScaleTransform {ScaleX = percentWidth, ScaleY = percentHeight};
            }

            var resizedImage = new TransformedBitmap(image, transform);

            using (var memoryStream = new MemoryStream())
            {
                var jpegEncoder = new JpegBitmapEncoder();
                jpegEncoder.Frames.Add(BitmapFrame.Create(resizedImage));
                jpegEncoder.Save(memoryStream);

                result.Data = memoryStream.ToArray();
                result.Size = new Size(resizedImage.PixelWidth, resizedImage.PixelHeight);
            }

            return Task.FromResult(result);
        }
开发者ID:mdabbagh88,项目名称:UniversalImageLoader,代码行数:51,代码来源:ByteArrayExtension.cs


示例10: ProductImageReturnTheType

        public void ProductImageReturnTheType()
        {
            ImageInfo imageInfo = new ImageInfo("Bike01.jpg");

            string type = imageInfo.ImageType;

            Assert.AreEqual("jpg", type);
        }
开发者ID:snahider,项目名称:Refactoring-Golf,代码行数:8,代码来源:ProductTests.cs


示例11: ResizeImageAction

 public ResizeImageAction(ImageInfo imageInfo, int oldWidth, int oldHeight, int newWidth, int newHeight)
 {
     this.imageInfo = imageInfo;
     this.oldWidth = oldWidth;
     this.oldHeight = oldHeight;
     this.newWidth = newWidth;
     this.newHeight = newHeight;
 }
开发者ID:binarytemple,项目名称:tomboy-image,代码行数:8,代码来源:ResizeImageAction.cs


示例12: GetImageInfo

 public static OpenCLErrorCode GetImageInfo(IMemoryObject image,
                                      ImageInfo paramName,
                                      IntPtr paramValueSize,
                                      InfoBuffer paramValue,
                                      out IntPtr paramValueSizeRet)
 {
     return clGetImageInfo((image as IHandleData).Handle, paramName, paramValueSize, paramValue.Address, out paramValueSizeRet);
 }
开发者ID:Multithread,项目名称:OpenOCL_NET,代码行数:8,代码来源:MemoryHandling.cs


示例13: AfterSetUp

 protected override void AfterSetUp()
 {
     _product = new ProductBuilder().Build();
     _image1 = new ImageInfo("1.png", ImageType.Png);
     _image2 = new ImageInfo("2.jpg", ImageType.Jpeg);
     _product.Images.Add(_image1);
     _product.Images.Add(_image2);
     Session.Save(_product);
 }
开发者ID:kjellski,项目名称:nhibernatetraining,代码行数:9,代码来源:ProductImages.cs


示例14: StartDownloadImage

 void StartDownloadImage(ImageInfo image)
 {
     CancelRequest();
     _cts = new CancellationTokenSource();
     Task.Run(async () =>
     {
         await DownloadImage(image, _cts.Token);
     });
 }
开发者ID:SuperMap,项目名称:iClient-for-Win8,代码行数:9,代码来源:DynamicLayer.cs


示例15: GenerateCrop

        private static void GenerateCrop(Preset preset, string imgUrl, Config config, StringBuilder sbRaw)
        {
            if (string.IsNullOrEmpty(preset.Name))
                return;

            var imgInfo = new ImageInfo(imgUrl);

            var data = new SaveData(sbRaw.ToString());
            imgInfo.GenerateThumbnails(data, config);
        }
开发者ID:jlanchini,项目名称:Starterkits,代码行数:10,代码来源:EventHandlers.cs


示例16: Log

		void Log( ImageInfo imageInfo, bool imageLoaded )
		{
			string msg = String.Format( 
				"{0} - {1} BitmapImage: {2}", 
				++this.logCounter, 
				imageLoaded ? "Loaded" : "Unloaded",
				System.IO.Path.GetFileName( imageInfo.FileName ) );
			this.listBoxLog.Items.Add( msg );
			this.listBoxLog.ScrollIntoView( msg );
			this.listBoxLog.SelectedItem = msg;
		}
开发者ID:jimgraham,项目名称:WPF.JoshSmith,代码行数:11,代码来源:UnloadedManagerPage.xaml.cs


示例17: Xml

        public string Xml(Config config, ImageInfo imageInfo)
        {
            var doc = CreateBaseXmlDocument();
            var root = doc.DocumentElement;

            if (root == null) return null;

            var dateStampNode = doc.CreateNode(XmlNodeType.Attribute, "date", null);
            dateStampNode.Value = imageInfo.DateStamp.ToString("s");
            root.Attributes.SetNamedItem(dateStampNode);

            for (var i = 0; i < Data.Count; i++)
            {
                var crop = (Crop)Data[i];
                var preset = config.Presets[i];

                var newNode = doc.CreateElement("crop");

                var nameNode = doc.CreateNode(XmlNodeType.Attribute, "name", null);
                nameNode.Value = preset.Name;
                newNode.Attributes.SetNamedItem(nameNode);

                var xNode = doc.CreateNode(XmlNodeType.Attribute, "x", null);
                xNode.Value = crop.X.ToString(CultureInfo.InvariantCulture);
                newNode.Attributes.SetNamedItem(xNode);

                var yNode = doc.CreateNode(XmlNodeType.Attribute, "y", null);
                yNode.Value = crop.Y.ToString(CultureInfo.InvariantCulture);
                newNode.Attributes.SetNamedItem(yNode);

                var x2Node = doc.CreateNode(XmlNodeType.Attribute, "x2", null);
                x2Node.Value = crop.X2.ToString(CultureInfo.InvariantCulture);
                newNode.Attributes.SetNamedItem(x2Node);

                var y2Node = doc.CreateNode(XmlNodeType.Attribute, "y2", null);
                y2Node.Value = crop.Y2.ToString(CultureInfo.InvariantCulture);
                newNode.Attributes.SetNamedItem(y2Node);

                if (config.GenerateImages)
                {
                    var urlNode = doc.CreateNode(XmlNodeType.Attribute, "url", null);
                    urlNode.Value = String.Format("{0}/{1}_{2}.jpg",
                                                  imageInfo.RelativePath.Substring(0, imageInfo.RelativePath.LastIndexOf('/')),
                                                  imageInfo.Name,
                                                  preset.Name);
                    newNode.Attributes.SetNamedItem(urlNode);
                }

                root.AppendChild(newNode);
            }

            return doc.InnerXml;
        }
开发者ID:jlanchini,项目名称:Starterkits,代码行数:53,代码来源:SaveData.cs


示例18: Next

    /// <summary>
    /// Returns the next ImageInfo with random width and height
    /// </summary>
    /// <returns></returns>
    public ImageInfo Next()
    {
        int width = _r.Next(_minWidth, _maxWidth);
        int height =
            _r.Next(
                (int)Math.Round(((100 - _maxAspectRatioDeviationPercentage) * width) / (double)100),
                (int)Math.Round(((100 + _maxAspectRatioDeviationPercentage) * width) / (double)100));

        ImageInfo s = new ImageInfo(width, height);

        return s;
    }
开发者ID:Ivony,项目名称:CssSpritesGenerator,代码行数:16,代码来源:RandomSizeGenerator.cs


示例19: Photo

 /// <summary>
 /// Function returns an img tag for a given Photo view model
 /// </summary>
 /// <param name="html">html helper</param>
 /// <param name="model">photo we wish to create the img tag for</param>
 /// <returns>returns an img tag</returns>
 public static MvcHtmlString Photo(this HtmlHelper html, ImageInfo model)
 {
     StringBuilder sb = new StringBuilder();
         if (model != null)
         {
             sb.Append("<img src='" + model.Src);
             sb.Append("' width='" + model.Width);
             sb.Append("' height='" + model.Height);
             sb.Append("' alt='" + model.Alt + "' />");
         }
         return MvcHtmlString.Create(sb.ToString());
 }
开发者ID:Thirlan,项目名称:insideword,代码行数:18,代码来源:HtmlInsideWord.cs


示例20: InitGenerator

 private void InitGenerator()
 {
     //Try to initialize the singleton instance with HD resolution
     try
     {
         GeneratorSingleton.Instance.Initialize(PlatformType.WINDOWS, m_imageInfo);
     }
     catch (GenericEngineErrorException)
     {//If it doesn't succeed, initialize with 640X480
         m_imageInfo = new ImageInfo(ImageResolution.Resolution640x480, Xtr3D.Net.ImageInfo.ImageFormat.RGB888);
         GeneratorSingleton.Instance.Initialize(PlatformType.WINDOWS, m_imageInfo);
     }
 }
开发者ID:chengoldberg,项目名称:extreme-motion-robot,代码行数:13,代码来源:MainWindow.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ImageItem类代码示例发布时间:2022-05-24
下一篇:
C# ImageFrameReadyEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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