本文整理汇总了C#中Picture.GetImage方法的典型用法代码示例。如果您正苦于以下问题:C# Picture.GetImage方法的具体用法?C# Picture.GetImage怎么用?C# Picture.GetImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Picture
的用法示例。
在下文中一共展示了Picture.GetImage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PicturePreviewModel
/// <summary>
/// Constructor
/// </summary>
public PicturePreviewModel(Picture picture)
{
Title = picture.Name;
Created = picture.Date.ToString();
Resolution = picture.Height.ToString() + "x" + picture.Width.ToString();
// load source of the image
ImageSource = new BitmapImage();
System.IO.Stream stream = picture.GetImage();
ImageSource.SetSource(stream);
}
示例2: MediaFile
public MediaFile(string filePath, Picture image)
{
this.filePath = filePath;
this.fileName = System.IO.Path.GetFileName(this.filePath);
this.type = MimeTypeMapper.GetMimeType(fileName);
this.size = image.GetImage().Length;
this.lastModifiedDate = image.Date.ToString();
}
示例3: MediaFile
public MediaFile(string filePath, Picture image)
{
this.FilePath = filePath;
this.FileName = System.IO.Path.GetFileName(this.FilePath);
this.Type = MimeTypeMapper.GetMimeType(FileName);
this.Size = image.GetImage().Length;
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
this.LastModifiedDate = storage.GetLastWriteTime(filePath).DateTime.ToString();
}
}
示例4: AddImageToCanvas
private void AddImageToCanvas(int indexer, Picture picture, int noOnVertical, int noOnHorizontal, int maxCount, DynamicImageCanvas mainCanvas, MyPhoneLockScreen.Model.Point point)
{
GC.Collect();
GC.WaitForPendingFinalizers();
bool isCompleted = false;
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
try
{
var actualheight = Application.Current.Host.Content.ActualHeight;
var actualwidth = Application.Current.Host.Content.ActualWidth;
actualheight = actualheight > 800 ? 800 : actualheight;
actualwidth = actualwidth > 480 ? 480 : actualwidth;
//Create and save Dynamic Image
var imageHeight = actualheight / noOnVertical;
var imageWidth = actualwidth / noOnHorizontal;
var left = (point.X * imageWidth) + (15 * point.X);
var top = (point.Y * imageHeight) + (15 * point.Y);
var image = new Image();
var imag = new BitmapImage();
imag.DecodePixelHeight = (int)imageHeight;
imag.DecodePixelWidth = (int)imageWidth;
imag.SetSource(picture.GetImage());
image.Source = imag;
image.Height = imageHeight;
image.Width = imageWidth;
mainCanvas.AddImage(image, left, top);
image = null;
imag = null;
}
catch (Exception ex)
{
Debug.WriteLine(ex.StackTrace);
}
finally
{
isCompleted = true;
}
});
while (true)
{
if (isCompleted)
break;
}
}
示例5: GetImage
private BitmapImage GetImage(Picture picture)
{
BitmapImage image = new BitmapImage();
image.CreateOptions = BitmapCreateOptions.None;
image.SetSource(picture.GetImage());
return image;
}
示例6: ShowPicture
public void ShowPicture(Picture picture)
{
lock (this)
{
if (m_Picture != picture && picture != null)
{
m_Picture = picture;
System.Drawing.Bitmap bitmap = m_Picture.GetImage(m_DataType);
if (bitmap != null)
{
m_Image.Source = Utils.CreateBitmapSourceFromBitmap(bitmap);
m_numberOfMbInRow = bitmap.Width >> 4;
m_numberOfMbInCol = bitmap.Height >> 4;
m_numberOfMb = (m_numberOfMbInRow * m_numberOfMbInCol);
if (m_LastSelectedMacroblockAddress != -1)
{
double mbWidth, mbHeight;
int mbX, mbY;
GetMbPosition(m_LastSelectedMacroblockAddress, out mbX, out mbY, out mbWidth, out mbHeight);
SelectMB(mbX, mbY, m_LastSelectedMacroblockAddress, mbWidth, mbHeight, true, true);
}
}
}
}
}
示例7: UploadPhoto
/// <summary>
/// Uploads the given picture to the server.
/// </summary>
/// <param name="picture">A Media Library picture.</param>
private void UploadPhoto(Picture picture)
{
// Load the photo taken with the camera into memory.
Stream imageStream = picture.GetImage();
int imageSize = (int)imageStream.Length;
BinaryReader binReader = new BinaryReader(imageStream);
byte[] imageBytes = new byte[imageSize];
int count = binReader.Read(imageBytes, 0, (int)imageSize);
binReader.Close();
// Upload the image to the server.
App.ServerConnection.UploadPhoto(
(int) App.LoginUserID,
imageBytes,
new EventDelegates.HTTPResponseDelegate(UploadSucceeded),
new EventDelegates.HTTPFailDelegate(UploadFailed));
}