本文整理汇总了C#中System.Windows.Media.TranslateTransform.Transform方法的典型用法代码示例。如果您正苦于以下问题:C# TranslateTransform.Transform方法的具体用法?C# TranslateTransform.Transform怎么用?C# TranslateTransform.Transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.TranslateTransform
的用法示例。
在下文中一共展示了TranslateTransform.Transform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPoints
private static Point[] GetPoints(Random rand, double size, double margin, int numStars, Tuple<Vector[], int> vectorField)
{
//NOTE: Can't go all the way to the edge, stars would get cut off (the caller has to know the margin so it can properly overlap the images)
double reducedSize = size - (margin * 2);
Point[] points = Enumerable.Range(0, numStars).
Select(o => new Point(rand.NextDouble(reducedSize), rand.NextDouble(reducedSize))).
ToArray();
if (vectorField != null)
{
points = AdjustPoints(points, reducedSize, vectorField.Item1, vectorField.Item2);
}
Transform transform = new TranslateTransform(margin, margin);
return points.
Select(o => transform.Transform(o)).
ToArray();
}
示例2: CropPhoto
private void CropPhoto()
{
int x0 = (int)originalPhoto.Margin.Right;
int xDisplacement = x0 - current;
WriteableBitmap wb = new WriteableBitmap((int)cropArea.Width, (int)cropArea.Height);
TranslateTransform t = new TranslateTransform();
t.X = xDisplacement;
Point p = new Point((int)cropArea.Width, (int)cropArea.Height);
t.Transform(p);
wb.Render(originalPhoto, t);
wb.Invalidate();
cropped.Source = wb;
MainPage.isLandscape = true;
NavigationService.Navigate(new Uri("/EditPicture.xaml", UriKind.Relative));
}
示例3: SaveToIsolatedStorage
public void SaveToIsolatedStorage(Stream imageStream, string fileName)
{
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
if (myIsolatedStorage.FileExists(fileName))
{
myIsolatedStorage.DeleteFile(fileName);
}
IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(fileName);
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(imageStream);
Image beforeCrop = new Image();
Image afterCrop = new Image();
if (bitmap.PixelWidth > bitmap.PixelHeight)
{
afterCrop.Width = 800;
afterCrop.Height = 480;
}
else
{
afterCrop.Width = 480;
afterCrop.Height = 800;
}
beforeCrop.Source = bitmap;
WriteableBitmap wb = new WriteableBitmap((int)afterCrop.Width, (int)afterCrop.Height);
Transform t = new TranslateTransform();
Point p = new Point((int)afterCrop.Width, (int)afterCrop.Height);
t.Transform(p);
wb.Render(beforeCrop, t);
wb.Invalidate();
afterCrop.Source = wb;
wb.SaveJpeg(fileStream, (int)afterCrop.Width, (int)afterCrop.Height, 0, 100);
fileStream.Close();
}
}