コード例 #1
0
ファイル: FixedSOMImage.cs プロジェクト: sjyanxin/WPFSource
        public static FixedSOMImage Create(FixedPage page, Path path, FixedNode fixedNode) 
        {
            Debug.Assert(path.Fill is ImageBrush);
            ImageSource source = ((ImageBrush)(path.Fill)).ImageSource;
            Uri imageUri = null; 
            if (source is BitmapImage)
            { 
                BitmapImage imageSource = source as BitmapImage; 
                imageUri = imageSource.UriSource;
            } 
            else if (source is BitmapFrame)
            {
                BitmapFrame imageSource = source as BitmapFrame;
                imageUri = new Uri(imageSource.ToString(), UriKind.RelativeOrAbsolute); 
            }
 
            Rect sourceRect = path.Data.Bounds; 
            GeneralTransform trans = path.TransformToAncestor(page);
            return new FixedSOMImage(sourceRect, trans, imageUri, fixedNode, path); 
        }