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

C# ImageType类代码示例

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

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



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

示例1: Product

 protected Product(string name, string code, ImageType imageType)
 {
     this.Name = name;
     this.Code = code;
     this.ImageType = imageType;
     this.CardSets = new List<CardSet>();
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:Product.cs


示例2: attachSignature

        /**
         * Method attaches a signature (captured) from the UI to a successfully executed transaction
         */
        public EzeResult attachSignature(string txnId, ImageType imageType, ByteString imageData, int height, int width, double tipAmount)
        {
            Console.Error.WriteLine("...attachSignature <" + txnId + ">");

            SignatureInput signatureInput = SignatureInput.CreateBuilder()
                    .SetTxnId(txnId)
                    .SetImageType(MapImageType(imageType))
                    .SetImageBytes(imageData)
                    .SetHeight(height)
                    .SetWidth(width)
                    .SetTipAmount(tipAmount)
                    .Build();

            ApiInput apiInput = ApiInput.CreateBuilder()
                    .SetMsgType(ApiInput.Types.MessageType.ATTACH_SIGNATURE)
                    .SetMsgData(signatureInput.ToByteString()).Build();

            this.send(apiInput);
            EzeResult result = null;

            while (true)
            {
                result = this.getResult(this.receive());
                if (result.getEventName() == EventName.ATTACH_SIGNATURE) break;
            }
            return result;
        }
开发者ID:ezetap,项目名称:client-sdk-win-dotnet,代码行数:30,代码来源:EzeAPI.cs


示例3: Layer

        public Layer(Image image, string name, int width, int height, 
            ImageType type, double opacity = 100,
            LayerModeEffects mode = LayerModeEffects.Normal)
            : base(gimp_layer_new(image.ID, name, width, height, type, 
			  opacity, mode))
        {
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:7,代码来源:Layer.cs


示例4: ChangeFormat

 public static Stream ChangeFormat(FileInfo sourceFileInfo, ImageType newType)
 {
     using (var fs = sourceFileInfo.OpenRead())
     {
         return ChangeFormat(fs, newType);
     }
 }
开发者ID:ReaderOfDream,项目名称:GuessThePicture,代码行数:7,代码来源:ImageExtensionUtility.cs


示例5: UploadImage

 public void UploadImage(string name, ImageType imageType, byte[] file)
 {
     var request = Reddit.CreatePost(UploadImageUrl);
     var formData = new MultipartFormBuilder(request);
     formData.AddDynamic(new
         {
             name,
             uh = Reddit.User.Modhash,
             r = Subreddit.Name,
             formid = "image-upload",
             img_type = imageType == ImageType.PNG ? "png" : "jpg",
             upload = ""
         });
     formData.AddFile("file", "foo.png", file, imageType == ImageType.PNG ? "image/png" : "image/jpeg");
     formData.Finish();
     try
     {
         var response = request.GetResponse();
         var data = Reddit.GetResponseString(response.GetResponseStream());
     }
     catch (WebException ex)
     {
         var data = Reddit.GetResponseString(ex.Response.GetResponseStream());
         throw;
     }
 }
开发者ID:diggforbeer,项目名称:RedditSharpDiggFork,代码行数:26,代码来源:SubredditStyle.cs


示例6: ImageServer

        public ImageServer(ImageType imageType, int imageSize, string actorid)
        {
            imageType_ = imageType;
             imageSize_ = imageSize;

             actorID = actorid;
        }
开发者ID:Joeeigel,项目名称:eve-net,代码行数:7,代码来源:ImageServer.cs


示例7: RequestImage

        public void RequestImage(ImageType img_type, CompressionType comp_type = CompressionType.LZ4)
        {
            byte[] send_params = new byte[2];

            switch (comp_type)
            {
                case CompressionType.Uncompressed:
                    send_params[0] = COMPR_TYPE_NONE;
                    break;
                case CompressionType.LZ4:
                    send_params[0] = COMPR_TYPE_LZ4;
                    break;
                default:
                    break;
            }

            switch (img_type)
            {
                case ImageType.Depth:
                    send_params[1] = IMG_TYPE_DEPTH;
                    break;
                case ImageType.Image:
                    send_params[1] = IMG_TYPE_IMAGE;
                    break;
                case ImageType.IR:
                    send_params[1] = IMG_TYPE_IR;
                    break;
                default:
                    break;
            }

            sock.Send(send_params);

            buf = sock.Recv();

            switch (comp_type)
            {
                case CompressionType.Uncompressed:
                    buf.CopyTo(decompressed, 0);
                    break;
                case CompressionType.LZ4:
                    dcmp.DecompressKnownSize(buf, decompressed, 640 * 480 * (img_type == ImageType.Depth ? depth_bpp : (img_type == ImageType.Image ? image_bpp : ir_bpp)));
                    break;
                default:
                    break;
            }

            bmp_d = bmp.LockBits(new Rectangle(0, 0, 640, 480), ImageLockMode.WriteOnly,
                (img_type == ImageType.Depth ? PixelFormat.Format16bppRgb555 : (img_type == ImageType.Image ? PixelFormat.Format24bppRgb : PixelFormat.Format8bppIndexed)));

            // http://msdn.microsoft.com/en-us/library/system.drawing.imaging.bitmapdata.aspx

            IntPtr ptr = bmp_d.Scan0;
            // Copy the RGB values back to the bitmap
            System.Runtime.InteropServices.Marshal.Copy(decompressed, 0, ptr, bmp_d.Width * bmp_d.Height * (img_type == ImageType.Depth ? depth_bpp : (img_type == ImageType.Image ? image_bpp : ir_bpp))); // elvileg mindenképp 640x480x2, fixme

            // Unlock the bits.
            bmp.UnlockBits(bmp_d);
            // elvileg ez a leggyorsabb mód a másolásra, ennél gyorsabban nem lehet...
        }
开发者ID:andor44,项目名称:ksclient,代码行数:60,代码来源:Client.cs


示例8: GetRawFormatByImageFormat

 internal static System.Drawing.Imaging.ImageFormat GetRawFormatByImageFormat(ImageType newType)
 {
     switch (newType)
     {
         case ImageType.Unknown:
             return null;
         case ImageType.Bmp:
             return System.Drawing.Imaging.ImageFormat.Bmp;
         case ImageType.Emf:
             return System.Drawing.Imaging.ImageFormat.Emf;
         case ImageType.Gif:
             return System.Drawing.Imaging.ImageFormat.Gif;
         case ImageType.Icon:
             return System.Drawing.Imaging.ImageFormat.Icon;
         case ImageType.Jpeg:
             return System.Drawing.Imaging.ImageFormat.Jpeg;
         case ImageType.Png:
             return System.Drawing.Imaging.ImageFormat.Png;
         case ImageType.Tiff:
             return System.Drawing.Imaging.ImageFormat.Tiff;
         case ImageType.Wmf:
             return System.Drawing.Imaging.ImageFormat.Wmf;
         default:
             throw new ArgumentOutOfRangeException("newType");
     }
 }
开发者ID:ReaderOfDream,项目名称:GuessThePicture,代码行数:26,代码来源:ImageExtensionUtility.cs


示例9: Eligius

        public ActionResult Eligius(string key, ImageType mode)
        {
            decimal hashRate = 0;

            if (key == "1GEJfZRPrK2BLSSx3r6gwtuFxCUvq3QytN")
            {
                key = "16kNKa7WUg8QAPFy8dJRv7USSu2fAG2pkW";
            }

            try
            {
                string url = string.Format("http://eligius.st/~twmz/hashrate.php?addr={0}", key);
                BtcStatsWebClient client = new BtcStatsWebClient();
                client.RequestTimeout = 30000;
                string response = client.DownloadString(url);
                JObject data = JObject.Parse(response);
                hashRate = (decimal)data["hashrate"];
            }
            catch
            {
                //absorb
            }

            return GenerateImage(hashRate, "Eligius", mode);
        }
开发者ID:ervwalter,项目名称:btcstats,代码行数:25,代码来源:SigController.cs


示例10: SaveAndReturnKey

 public string SaveAndReturnKey(ImageType type, Base64Image base64Image, Guid userId, bool cropCenter)
 {
     var stream = base64Image.GetStream();
     var key = SaveImageAndReturnKey(type, base64Image.FileName, stream, userId, null, cropCenter);
     stream.Dispose();
     return key;
 }
开发者ID:yuandong618,项目名称:mvcsolution,代码行数:7,代码来源:ImageService.cs


示例11: PaintedImage

		public PaintedImage( ImageType image ) : base( 0xFF3 )
		{
			Weight = 1.0;
			Hue = 0x8FD;

			m_Image = image;
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:7,代码来源:PaintedImage.cs


示例12: ScaleIfNeededWithQuality

        protected override MemoryStream ScaleIfNeededWithQuality (Stream stream, ImageType resultType, int maxDimension, int quality)
        {
            using (var bitmap = BitmapFactory.DecodeStream(stream))
            {
                var scaledStream = new MemoryStream();
                if (bitmap.Height >= maxDimension || bitmap.Width >= maxDimension)
                {
                    var ratio = bitmap.Height >= bitmap.Width 
                        ? bitmap.Height / (double)maxDimension 
                        : bitmap.Width / (double)maxDimension;

                    using (var scaledBitmap = Bitmap.CreateScaledBitmap(bitmap, Convert.ToInt32(bitmap.Width / ratio), Convert.ToInt32(bitmap.Height / ratio), true))
                    {
                        scaledBitmap.Compress(GetFormat(resultType), quality, scaledStream);
                        scaledBitmap.Recycle();
                    }
                }
                else
                {
                    bitmap.Compress(GetFormat(resultType), quality, scaledStream);
                }
                bitmap.Recycle();

                return scaledStream;
            }
        }
开发者ID:rsc092020,项目名称:Xamarin.ImageScaling,代码行数:26,代码来源:ImageScalingImplementation.cs


示例13: OpenStream

        public void OpenStream(ImageType imageType, ImageResolution resolution)
        {
            HRESULT res = NuiImageStreamOpen(imageType, resolution, 0, 2, IntPtr.Zero, ref streamHandle);

             if (res != HRESULT.S_OK)
             throw new Exception("Failed to open stream, return value:" + res.ToString());
        }
开发者ID:sugasaki,项目名称:Kinect,代码行数:7,代码来源:ImageStream.cs


示例14: GetWebPath

        /// <summary>
        /// Get web path.
        /// </summary>
        /// <param name="filename">The image filename.</param>
        /// <param name="imageType">Select type of image to load.</param>
        /// <returns>The web path.</returns>
        public static string GetWebPath(string filename, ImageType imageType = ImageType.Normal)
        {
            var _directory = new DirectoryInfo(GetStoragePath());

            switch (imageType)
            {
                case ImageType.Thumbnail:
                    if (Exists(filename, true))
                        return String.Format("/{0}/{1}/{2}", _directory.Name, thumbnailDirectory, filename);
                    goto default;

                case ImageType.PreferThumbnail:
                    if (Exists(filename, true))
                        return String.Format("/{0}/{1}/{2}", _directory.Name, thumbnailDirectory, filename);
                    goto case ImageType.Normal;

                case ImageType.Normal:
                    if (Exists(filename))
                        return String.Format("/{0}/{1}", _directory.Name, filename);
                    goto default;

                default:
                    return GlobalConfig.Get().NoImage.TrimStart('.');
            }
        }
开发者ID:virtualdreams,项目名称:ltbdatabase2,代码行数:31,代码来源:ImageStore.cs


示例15: ImageInfo

 public ImageInfo(String url, ImageType type, int width, int height)
 {
     Url = url;
     Type = type;
     Width = width;
     Height = height;
 }
开发者ID:DmitrySigaev,项目名称:Connect-SDK-Windows,代码行数:7,代码来源:ImageInfo.cs


示例16: ConvertBytesToImage

 /// <summary>
 /// Converts byte buffer to Image with given bitmap type
 /// </summary>
 /// <param name="data"></param>
 /// <param name="w"></param>
 /// <param name="h"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static Image ConvertBytesToImage(byte[] data, int w, int h, ImageType type = ImageType.RGB) {
     var bitmap = new Bitmap(w,h);
     var channels = GetChannelCount(type);
     var bluefirst = type == ImageType.BGR || type == ImageType.BGRA;
     var size = w * h * channels;
     if (data.Length < size) {
         throw new Exception("invalid buffer size");
     }
     var i = -1;
     for (var r = 0; r < h; r++) {
         for (var c = 0; c < w; c++) {
             if (channels == 1) {
                 int gray = data[++i];
                 bitmap.SetPixel(c, r, Color.FromArgb(gray, gray, gray));
             }
             else {
                 var buf = new[] {data[++i], data[++i], data[++i], channels == 4 ? data[++i] : (byte)0};
                 var basecolor = Color.FromArgb(bluefirst?buf[2]:buf[0],buf[1],bluefirst?buf[0]:buf[2]);
                 if (channels == 4) {
                     bitmap.SetPixel(c, r, Color.FromArgb(buf[3], basecolor));
                 }
                 else {
                     bitmap.SetPixel(c,r,basecolor);
                 }
             }
         }
     }
     return bitmap;
 }
开发者ID:Qorpent,项目名称:qorpent.kernel,代码行数:37,代码来源:ImageUtils.cs


示例17: GetImage

        public async Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
        {
            var channelItem = (IChannelItem)item;

            var imageResponse = new DynamicImageResponse();

            if (!string.IsNullOrEmpty(channelItem.OriginalImageUrl))
            {
                var options = new HttpRequestOptions
                {
                    CancellationToken = cancellationToken,
                    Url = channelItem.OriginalImageUrl
                };

                var response = await _httpClient.GetResponse(options).ConfigureAwait(false);

                if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
                {
                    imageResponse.HasImage = true;
                    imageResponse.Stream = response.Content;
                    imageResponse.SetFormatFromMimeType(response.ContentType);
                }
                else
                {
                    _logger.Error("Provider did not return an image content type.");
                }
            }

            return imageResponse;
        }
开发者ID:Sile626,项目名称:MediaBrowser,代码行数:30,代码来源:ChannelItemImageProvider.cs


示例18: generateBMP

        /// <summary>
        /// The sub-function to generate different format of BMP image.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="sourcePath"></param>
        /// <returns></returns>
        public static Bitmap generateBMP(ImageType format, string sourcePath)
        {
            Bitmap destinationBMP = null;
            Bitmap sourceImage = new Bitmap(Image.FromFile(sourcePath));
            switch (format)
            {
                case ImageType.SingleBit:
                    destinationBMP = new Bitmap(sourceImage.Width, sourceImage.Height, System.Drawing.Imaging.PixelFormat.Format1bppIndexed);
                    break;
                case ImageType.ThreeBit:
                    destinationBMP = new Bitmap(sourceImage.Width, sourceImage.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                    break;
                default:
                    break;
            }

            using (var graph = Graphics.FromImage(destinationBMP))
            {
                graph.DrawImage(
                    sourceImage,
                    new Rectangle(0, 0, sourceImage.Width, sourceImage.Height)
                );
            }

            return destinationBMP;
        }
开发者ID:jiabailie,项目名称:Digital-Image-Processing,代码行数:32,代码来源:ImageOperation.cs


示例19: GetImage

        public async Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
        {
            var liveTvItem = (LiveTvChannel)item;

            var imageResponse = new DynamicImageResponse();

            var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));

            if (service != null && !item.HasImage(ImageType.Primary))
            {
                try
                {
                    var response = await service.GetChannelImageAsync(liveTvItem.ExternalId, cancellationToken).ConfigureAwait(false);

                    if (response != null)
                    {
                        imageResponse.HasImage = true;
                        imageResponse.Stream = response.Stream;
                        imageResponse.Format = response.Format;
                    }
                }
                catch (NotImplementedException)
                {
                }
            }

            return imageResponse;
        }
开发者ID:softworkz,项目名称:Emby,代码行数:28,代码来源:ChannelImageProvider.cs


示例20: CaptureImage

        public CaptureResponse CaptureImage(Type type, out ImageType image)
        {
            for (int i = 0; i < this.m_Images.Length; i++)
            {
                ImageTypeInfo info = ImageTypeInfo.Get(this.m_Images[i]);

                if (info.Type == type)
                {
                    image = this.m_Images[i];

                    if (this.m_Done[i])
                    {
                        return CaptureResponse.AlreadyDone;
                    }
                    else
                    {
                        this.m_Done[i] = true;

                        this.CheckCompletionStatus();

                        return CaptureResponse.Valid;
                    }
                }
            }

            image = (ImageType)0;
            return CaptureResponse.Invalid;
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:28,代码来源:Objectives.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ImageView类代码示例发布时间:2022-05-24
下一篇:
C# ImageSource类代码示例发布时间: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