当前位置: 首页>>代码示例>>C#>>正文


C# TranslateTransform.Transform方法代码示例

本文整理汇总了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();
            }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:20,代码来源:BackImageManager.cs

示例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));
        }
开发者ID:purdue-cs-groups,项目名称:cs307-project01,代码行数:18,代码来源:CropPageLandscapeOrientation.xaml.cs

示例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();
            }
        }
开发者ID:rheza,项目名称:ezNote,代码行数:50,代码来源:SettingPage.xaml.cs


注:本文中的System.Windows.Media.TranslateTransform.Transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。