本文整理汇总了C#中ImageData类的典型用法代码示例。如果您正苦于以下问题:C# ImageData类的具体用法?C# ImageData怎么用?C# ImageData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageData类属于命名空间,在下文中一共展示了ImageData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DownloadAsTexture
IEnumerator DownloadAsTexture(ImageData imageData)
{
Debug.Log ("[JplImageLoader] download next image: " + imageData.Url);
WWW www = new WWW (imageData.Url);
while (www.progress < 1 && onImageLoadingProgress != null) {
onImageLoadingProgress (www.progress);
yield return null;
}
yield return www;
if (www.error == null) {
imageData.Texture = www.texture;
if (onImageLoadingComplete != null) {
onImageLoadingComplete (imageData);
}
} else {
if (onImageLoadingError != null) {
onImageLoadingError (www.error);
}
}
}
示例2: getBought
public void getBought(string name, ImageData[] images)
{
if (name.Equals("wings"))
{
for (int i = 0; i < wings.Count; i++)
{
if ((bool)wings[i])
images[i].buy();
}
}
if (name.Equals("perks"))
{
for (int i = 0; i < perks.Count; i++)
{
if((bool)perks[i])
images[i].buy();
}
}
if (name.Equals("breath"))
{
for (int i = 0; i < breath.Count; i++)
{
if((bool)breath[i])
images[i].buy();
}
}
if (name.Equals("skins"))
{
for (int i = 0; i < skins.Count ; i++)
{
if((bool)skins[i]) images[i].buy();
}
}
}
示例3: Main
static void Main(string[] args)
{
Notification notification = new System.Windows.Desktop.Notification();
notification.HeaderText = "Self-Host Vote";
notification.BodyText = "You have been using this Longhorn build for a few hours now. By using the Vote Now button below, you can vote to let us know what you think of it. To learn more, click this text.";
notification.IsBodyClickable = true;
NotificationButton notificationButton = new NotificationButton();
notificationButton.Text = "Vote Now";
notification.AddButton(notificationButton);
NotificationButton notificationButton1 = new NotificationButton();
notificationButton1.Text = "Later";
notification.AddButton(notificationButton1);
// Image
try
{
FileStream fs = File.Open("ThumbsUp.png", FileMode.Open, FileAccess.Read, FileShare.None);
ImageData imageData = new ImageData(fs);
notification.HeaderIcon = imageData;
}
catch (Exception e) { Console.WriteLine(e); }
notification.Send();
}
示例4: Find
public Point? Find(Bitmap findBitmap)
{
if (sourceImage == null || findBitmap == null)
throw new InvalidOperationException();
findImage = new ImageData(findBitmap);
findImage.PixelMaskTable(this.Variation);
var SourceRect = new Rectangle(new Point(0, 0), sourceImage.Size);
var NeedleRect = new Rectangle(new Point(0, 0), findImage.Size);
if (SourceRect.Contains(NeedleRect))
{
resets = new ManualResetEvent[threads];
Provider = new CoordProvider(sourceImage.Size, NeedleRect.Size);
for (int i = 0; i < threads; i++)
{
resets[i] = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(new WaitCallback(ImageWorker), i);
}
WaitHandle.WaitAll(resets);
return match;
}
return null;
}
示例5: Create
public static CanvasInformation Create(ImageData imageData)
{
var item = Create(imageData.Width, imageData.Height);
item.Context.PutImageData(imageData, 0, 0);
return item;
}
示例6: GrayscaleImage
private string GrayscaleImage(ICanvasRenderingContext2D ctx)
{
var img = new ImageData();
img.src = "pet.jpg";
grayscale(img, ctx);
return @"Originals\Images\grayscale.png";
}
示例7: FromImageData
public static GameImage FromImageData(ImageData imageData)
{
return new GameImage
{
Name = "Google",
URL = imageData.Url
};
}
示例8: GetColors
/// <summary>
/// Gets Color32 array from texture. Generates texture if not present.
/// Origin 0,0 will always be at Unity texture bottom-left.
/// </summary>
/// <param name="imageData">Source ImageData.</param>
/// <returns>Color32 array.</returns>
public static Color32[] GetColors(ImageData imageData)
{
// Generate texture if not present
if (imageData.texture == null)
UpdateTexture(ref imageData);
return imageData.texture.GetPixels32();
}
示例9: ChangeImageData
public void ChangeImageData(ImageData imageData)
{
SetTexture (imageData);
SetDescriptionText (imageData);
SetInfoText (imageData);
loader.Hide ();
}
示例10: ImageDataExport
public ImageDataExport(ImageData data)
{
ImageFile = data.Filename;
Frames = new List<ImageFrameExport>(data.Children.Count);
foreach (var frame in data.Children.Cast<ImageFrame>())
{
Frames.Add(new ImageFrameExport(frame));
}
}
示例11: Apply
public override void Apply(ImageData img)
{
var f = this.pattern;
foreach (var v in img.Params)
{
f = f.Replace("[" + v.Key + "]", v.Value);
}
img.Filename = f;
}
示例12: LTextureList
public LTextureList(Stream ins0)
{
this.imageList = new Dictionary<string, ImageData>(10);
this.autoExpand = false;
this.visible = true;
int index = 0;
string x = "x", y = "y", w = "w", h = "h";
string scale = "scale", src = "src", maskName = "mask", empty = "empty";
string name = "name", filterName = "filter", n = "nearest", l = "linear";
XMLDocument doc = XMLParser.Parse(ins0);
List<XMLElement> images = doc.GetRoot().Find("image");
if (images.Count > 0) {
IEnumerator<XMLElement> it = images.GetEnumerator();
for (; it.MoveNext();) {
XMLElement ele = it.Current;
if (ele != null) {
ImageData data = new ImageData();
data.x = ele.GetIntAttribute(x, 0);
data.y = ele.GetIntAttribute(y, 0);
data.w = ele.GetIntAttribute(w, 0);
data.h = ele.GetIntAttribute(h, 0);
data.scale = ele.GetFloatAttribute(scale, 0);
data.xref = ele.GetAttribute(src, empty);
XMLElement mask = ele.GetChildrenByName(maskName);
if (mask != null) {
int r = mask.GetIntAttribute("r", 0);
int g = mask.GetIntAttribute("g", 0);
int b = mask.GetIntAttribute("b", 0);
int a = mask.GetIntAttribute("a", 0);
data.mask = new LColor(r, g, b, a);
} else {
data.mask = null;
}
string filter = ele.GetAttribute(filterName, n);
if (filter.Equals(n)) {
data.scaleType = 0;
}
if (filter.Equals(l)) {
data.scaleType = 1;
}
data.index = index;
XMLElement parent = ele.GetParent();
if (parent != null) {
CollectionUtils.Put(imageList, parent.GetAttribute(name, empty), data);
index++;
}
}
}
}
this.count = imageList.Count;
this.values = new LTextureObject[count];
}
示例13: CoderSeal
/// <summary>
/// Initializes a new instance of the <see cref="CoderFox"/> class.
/// </summary>
/// <param name="keyPath">A string containing the path to the image that serves as key.</param>
internal CoderSeal(string keyPath)
: base(keyPath)
{
// Get image data
using (Bitmap keyFile = (Bitmap)Bitmap.FromFile(_keyPath))
_imageData = new ImageData(keyFile);
// Set default field values
_colorTracker = ColorCode.Red;
}
示例14: BuildCollabPacket
public static CollabPacket BuildCollabPacket(string message, ImageData imageData)
{
CollabPacket p = new CollabPacket
{
Message = message,
//ImgData = GetByteArrayFromImageData(imageData)
};
return p;
}
示例15: Bitmap
public Bitmap(int w, int h)
{
width = w;
height = h;
canvas = (CanvasElement) Document.GetElementById("canvas");
context = (CanvasRenderingContext2D) canvas.GetContext(CanvasContextId.Render2D); // "2d"
context.GlobalCompositeOperation = CompositeOperation.Copy; // ### it was: CompositeOperation
imagedata = context.CreateImageData(w,1); // w,h
}