本文整理汇总了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>();
}
示例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;
}
示例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))
{
}
示例4: ChangeFormat
public static Stream ChangeFormat(FileInfo sourceFileInfo, ImageType newType)
{
using (var fs = sourceFileInfo.OpenRead())
{
return ChangeFormat(fs, newType);
}
}
示例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;
}
}
示例6: ImageServer
public ImageServer(ImageType imageType, int imageSize, string actorid)
{
imageType_ = imageType;
imageSize_ = imageSize;
actorID = actorid;
}
示例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...
}
示例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");
}
}
示例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);
}
示例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;
}
示例11: PaintedImage
public PaintedImage( ImageType image ) : base( 0xFF3 )
{
Weight = 1.0;
Hue = 0x8FD;
m_Image = image;
}
示例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;
}
}
示例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());
}
示例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('.');
}
}
示例15: ImageInfo
public ImageInfo(String url, ImageType type, int width, int height)
{
Url = url;
Type = type;
Width = width;
Height = height;
}