本文整理汇总了C#中ImageData类的典型用法代码示例。如果您正苦于以下问题:C# ImageData类的具体用法?C# ImageData怎么用?C# ImageData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageData类属于命名空间,在下文中一共展示了ImageData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
开发者ID:cemrich,项目名称:From-Outer-Space,代码行数:25,代码来源:JplImageLoader.cs
示例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();
}
}
}
开发者ID:Zror,项目名称:DatRepo,代码行数:34,代码来源:SavedData.cs
示例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();
}
开发者ID:nickurt,项目名称:lh-votenow,代码行数:26,代码来源:Class1.cs
示例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;
}
开发者ID:BillTheBest,项目名称:IronAHK,代码行数:29,代码来源:ImageFinder.cs
示例5: Create
public static CanvasInformation Create(ImageData imageData)
{
var item = Create(imageData.Width, imageData.Height);
item.Context.PutImageData(imageData, 0, 0);
return item;
}
开发者ID:dested,项目名称:CTFMMO,代码行数:7,代码来源:CanvasInformation.cs
示例6: GrayscaleImage
private string GrayscaleImage(ICanvasRenderingContext2D ctx)
{
var img = new ImageData();
img.src = "pet.jpg";
grayscale(img, ctx);
return @"Originals\Images\grayscale.png";
}
开发者ID:podlipensky,项目名称:sharpcanvas,代码行数:7,代码来源:Images.cs
示例7: FromImageData
public static GameImage FromImageData(ImageData imageData)
{
return new GameImage
{
Name = "Google",
URL = imageData.Url
};
}
开发者ID:MrLeebo,项目名称:Hackathon,代码行数:8,代码来源:GameImage.cs
示例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();
}
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:14,代码来源:ImageReader.cs
示例9: ChangeImageData
public void ChangeImageData(ImageData imageData)
{
SetTexture (imageData);
SetDescriptionText (imageData);
SetInfoText (imageData);
loader.Hide ();
}
开发者ID:cemrich,项目名称:From-Outer-Space,代码行数:8,代码来源:UiManager.cs
示例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));
}
}
开发者ID:TravisEvashkevich,项目名称:boxer,代码行数:9,代码来源:ImageDataExport.cs
示例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;
}
开发者ID:madeso,项目名称:ImBatch,代码行数:9,代码来源:Rename.cs
示例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];
}
开发者ID:hellogithubtesting,项目名称:LGame,代码行数:56,代码来源:LTextureList.cs
示例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;
}
开发者ID:Zyphrax,项目名称:PixelCryptor,代码行数:14,代码来源:CoderSeal.cs
示例14: BuildCollabPacket
public static CollabPacket BuildCollabPacket(string message, ImageData imageData)
{
CollabPacket p = new CollabPacket
{
Message = message,
//ImgData = GetByteArrayFromImageData(imageData)
};
return p;
}
开发者ID:sczk,项目名称:collab-project,代码行数:10,代码来源:Packet.cs
示例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
}
开发者ID:nippur72,项目名称:Saltarelle.RaytracerDemo,代码行数:10,代码来源:Missing.cs
示例16: SetInfoText
void SetInfoText(ImageData imageData)
{
infoHeadline.text = "Info";
infoText.text = "";
SetInfoTextLine ("Date", imageData.Date);
SetInfoTextLine ("Category", imageData.Category);
SetInfoTextLine ("Mission", imageData.Mission);
SetInfoTextLine ("Views", imageData.Views.ToString ());
SetInfoTextLine ("Credit", imageData.Credit);
}
开发者ID:cemrich,项目名称:From-Outer-Space,代码行数:10,代码来源:UiManager.cs
示例17: Threshold
private static TimeSpan Threshold(ImageData data, int threshold, BackgroundWorker backgroundWorker) {
int i = 0;
int j = 0;
int r = 0;
int g = 0;
int b = 0;
int index = 0;
// Lock the bitmap's bits.
BitmapData bmpData = data.M_bitmap.LockBits(new Rectangle(0, 0, data.M_width, data.M_height), ImageLockMode.ReadWrite, data.M_bitmap.PixelFormat);
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Declare an array to hold the bytes of the bitmap.
int bytes = Math.Abs(bmpData.Stride)*data.M_bitmap.Height;
byte[] rgbValues = new byte[bytes];
// Copy the RGB values into the array.
Marshal.Copy(ptr, rgbValues, 0, bytes);
Stopwatch watch = Stopwatch.StartNew();
#region Algorithm
for (i = 0; i < data.M_width; i++) {
backgroundWorker.ReportProgress(Convert.ToInt32(((double)i/data.M_width)*100));
for (j = 0; j < data.M_height; j++) {
index = (j*bmpData.Stride) + (i*3);
r = rgbValues[index + 2];
g = rgbValues[index + 1];
b = rgbValues[index];
r = r < threshold ? 0 : 255;
g = g < threshold ? 0 : 255;
b = b < threshold ? 0 : 255;
rgbValues[index + 2] = (byte)r;
rgbValues[index + 1] = (byte)g;
rgbValues[index] = (byte)b;
}
}
#endregion
watch.Stop();
TimeSpan elapsedTime = watch.Elapsed;
// Copy the RGB values back to the bitmap
Marshal.Copy(rgbValues, 0, ptr, bytes);
// Unlock the bits.
data.M_bitmap.UnlockBits(bmpData);
return elapsedTime;
}
开发者ID:nlabiris,项目名称:ImageEdit_WPF,代码行数:55,代码来源:AlgorithmsBackup.cs
示例18: OnShown
protected override void OnShown()
{
base.OnShown ();
imagedata = new ImageData ();
formsimage1.DataBindings.Add ("ImageData", imagedata, "Pixdata",
false, DataSourceUpdateMode.OnPropertyChanged);
Pixbuf pixbuf = new Pixbuf ("logo.png");
Pixdata pixdata = new Pixdata ();
pixdata.FromPixbuf (pixbuf, false);
imagedata.Pixdata = pixdata.Serialize();
}
开发者ID:pzsysa,项目名称:gtk-sharp-forms,代码行数:12,代码来源:MainWindow.cs
示例19: sample17
private string sample17(ICanvasRenderingContext2D ctx)
{
// create new image object to use as pattern
IImageData img = new ImageData();
img.src = @"wallpaper.png";
// create pattern
object ptrn = ctx.createPattern(img, "repeat");
ctx.fillStyle = ptrn;
ctx.fillRect(0, 0, 150, 150);
return @"Originals\Images\sample17.png";
}
开发者ID:podlipensky,项目名称:sharpcanvas,代码行数:12,代码来源:Images.cs
示例20: QueueNewImage
private static void QueueNewImage(MemoryStream memoryStream, int height, int width, string source)
{
var img = new ImageData
{
Name = source,
Data = memoryStream.ToArray(),
Height = height,
Width = width,
Timestamp = DateTime.UtcNow
};
var message = new BrokeredMessage(img);
QueueConnector.ImageQueueClient.BeginSend(message, SendComplete, img.FormattedName);
}
开发者ID:rposbo,项目名称:azure-images-resizer,代码行数:13,代码来源:ImageController.cs
注:本文中的ImageData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论