本文整理汇总了C#中System.Windows.Media.Imaging.WriteableBitmap.Rotate方法的典型用法代码示例。如果您正苦于以下问题:C# WriteableBitmap.Rotate方法的具体用法?C# WriteableBitmap.Rotate怎么用?C# WriteableBitmap.Rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Imaging.WriteableBitmap
的用法示例。
在下文中一共展示了WriteableBitmap.Rotate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNavigatedTo
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
try
{
msg = NavigationContext.QueryString["msg"];
WriteableBitmap wbmp;
IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication();
if (iso.FileExists(msg))
{
using (IsolatedStorageFileStream stream = iso.OpenFile(msg, FileMode.Open, FileAccess.Read))
{
image.SetSource(stream);
}
}
else
image = null;
if (image != null)
{
wbmp = new WriteableBitmap(image);
wbmp = wbmp.Rotate(90);
imageView.Source = wbmp;
}
}
catch (KeyNotFoundException ex)
{
//do nothing
}
}
示例2: ShowImage
public ShowImage()
{
InitializeComponent();
bmp1 = (BitmapImage) PhoneApplicationService.Current.State["image"];
//bg.ImageSource = bmp1;
bmp = new WriteableBitmap(bmp1);
bmp = bmp.Rotate(90);
bg.ImageSource = bmp;
txt.Text = "width = " + bmp1.PixelWidth.ToString() + " height = " + bmp1.PixelHeight.ToString();
utils = new Utils(bmp1.PixelWidth, bmp1.PixelHeight);
}
示例3: GetMetadata
public void GetMetadata(BitmapFile file, WriteableBitmap writeableBitmap)
{
Exiv2Helper exiv2Helper = new Exiv2Helper();
try
{
exiv2Helper.Load(file.FileItem.FileName, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight);
file.Metadata.Clear();
foreach (var exiv2Data in exiv2Helper.Tags)
{
file.Metadata.Add(new DictionaryItem() {Name = exiv2Data.Value.Tag, Value = exiv2Data.Value.Value});
}
if (ServiceProvider.Settings.ShowFocusPoints)
{
writeableBitmap.Lock();
foreach (Rect focuspoint in exiv2Helper.Focuspoints)
{
DrawRect(writeableBitmap, (int) focuspoint.X, (int) focuspoint.Y,
(int) (focuspoint.X + focuspoint.Width),
(int) (focuspoint.Y + focuspoint.Height), Colors.Aqua,
ServiceProvider.Settings.LowMemoryUsage ? 2 : 7);
}
writeableBitmap.Unlock();
}
if (exiv2Helper.Tags.ContainsKey("Exif.Image.Orientation") && !file.FileItem.IsRaw)
{
if (exiv2Helper.Tags["Exif.Image.Orientation"].Value == "bottom, right")
writeableBitmap = writeableBitmap.Rotate(180);
if (exiv2Helper.Tags["Exif.Image.Orientation"].Value == "right, top")
writeableBitmap = writeableBitmap.Rotate(90);
if (exiv2Helper.Tags["Exif.Image.Orientation"].Value == "left, bottom")
writeableBitmap = writeableBitmap.Rotate(270);
}
if (ServiceProvider.Settings.RotateIndex != 0)
{
switch (ServiceProvider.Settings.RotateIndex)
{
case 1:
writeableBitmap = writeableBitmap.Rotate(90);
break;
case 2:
writeableBitmap = writeableBitmap.Rotate(180);
break;
case 3:
writeableBitmap = writeableBitmap.Rotate(270);
break;
}
}
}
catch (Exception exception)
{
Log.Error("Error loading metadata ", exception);
}
writeableBitmap.Freeze();
file.DisplayImage = writeableBitmap;
file.InfoLabel = Path.GetFileName(file.FileItem.FileName);
file.InfoLabel += String.Format(" | {0}x{1}", exiv2Helper.Width, exiv2Helper.Height);
if (exiv2Helper.Tags.ContainsKey("Exif.Photo.ExposureTime"))
file.InfoLabel += " | E " + exiv2Helper.Tags["Exif.Photo.ExposureTime"].Value;
if (exiv2Helper.Tags.ContainsKey("Exif.Photo.FNumber"))
file.InfoLabel += " | " + exiv2Helper.Tags["Exif.Photo.FNumber"].Value;
if (exiv2Helper.Tags.ContainsKey("Exif.Photo.ISOSpeedRatings"))
file.InfoLabel += " | ISO " + exiv2Helper.Tags["Exif.Photo.ISOSpeedRatings"].Value;
if (exiv2Helper.Tags.ContainsKey("Exif.Photo.ExposureBiasValue"))
file.InfoLabel += " | " + exiv2Helper.Tags["Exif.Photo.ExposureBiasValue"].Value;
if (exiv2Helper.Tags.ContainsKey("Exif.Photo.FocalLength"))
file.InfoLabel += " | " + exiv2Helper.Tags["Exif.Photo.FocalLength"].Value;
}
示例4: PanoramaItem_Loaded
private void PanoramaItem_Loaded(object sender, RoutedEventArgs e)
{
IList<BitmapImage> isoImages = getImages();
IList<Image> images = new List<Image>();
images.Add(image6);
images.Add(image7);
images.Add(image8);
images.Add(image9);
images.Add(image10);
images.Add(image11);
WriteableBitmap wmp;
for (int i = 0; i < isoImages.Count; i++)
{
if (isoImages[i] != null)
{
wmp = new WriteableBitmap(isoImages[i]);
wmp = wmp.Rotate(90);
images[i].Source = wmp;
}
else
{
images[i].Source = isoImages[i];
}
}
}
示例5: PhoneApplicationPage_Loaded
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
IList<BitmapImage> isoImages = getImages();
IList<Image> images = new List<Image>();
images.Add(image1);
images.Add(image2);
images.Add(image3);
images.Add(image4);
images.Add(image5);
images.Add(image6);
WriteableBitmap wmp;
for (int i = 0; i < isoImages.Count; i++)
{
if (isoImages[i] != null)
{
wmp = new WriteableBitmap(isoImages[i]);
wmp = wmp.Rotate(90);
images[i].Source = wmp;
}
else
{
images[i].Source = isoImages[i];
}
}
}
示例6: TransformBitmapByCameraTypeAndPageOrientation
public static WriteableBitmap TransformBitmapByCameraTypeAndPageOrientation(WriteableBitmap writeableBmp, CameraType cameraType, PageOrientation orientation)
{
if (cameraType == CameraType.FrontFacing)
{
if (orientation == PageOrientation.LandscapeRight)
{
}
else if (orientation == PageOrientation.LandscapeLeft)
{
writeableBmp = writeableBmp.Rotate(180);
}
else if (orientation == PageOrientation.PortraitUp)
{
writeableBmp = writeableBmp.Rotate(90);
}
writeableBmp = writeableBmp.Flip(WriteableBitmapExtensions.FlipMode.Horizontal);
}
else
{
if (orientation == PageOrientation.LandscapeRight)
{
writeableBmp = writeableBmp.Rotate(180);
}
else if (orientation == PageOrientation.LandscapeLeft)
{
}
else if (orientation == PageOrientation.PortraitUp)
{
writeableBmp = writeableBmp.Rotate(90);
}
}
return writeableBmp;
}
示例7: ctask_Completed
void ctask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK && e.ChosenPhoto != null)
{
bm = new WriteableBitmap(canvas1, null);
int width = bm.PixelWidth;
int height = bm.PixelHeight;
//Take JPEG stream and decode into a WriteableBitmap object
bm = PictureDecoder.DecodeJpeg(e.ChosenPhoto, height, width);
bm = bm.Rotate(1);
//Collapse visibility on the progress bar once writeable bitmap is visible.
//progressBar1.Visibility = Visibility.Collapsed;
//Populate image control with WriteableBitmap object.
bm.Invalidate();
updateCanvasFromWBM(bm);
//Once writeable bitmap has been rendered, the crop button
//is enabled.
//btnCrop.IsEnabled = true;
//textStatus.Text = "Tap the crop button to proceed";
makeToast("Success!", "Loaded picture");
}
else
{
makeToast("Uh oh", "Couldn't load picture");
}
}