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


C# ImageType类代码示例

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


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


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