コード例 #1
0
        public void ConfigureSpriteVisual()
        {
            var l = new Windows.Graphics.SizeInt32();

            l.Height = TILESIZE * 10000;
            l.Width  = TILESIZE * 10000;

            drawingSurface = comositionGraphicsDevice.CreateVirtualDrawingSurface(l, DirectXPixelFormat.B8G8R8A8UIntNormalized, DirectXAlphaMode.Premultiplied);

            surfaceBrush         = compositor.CreateSurfaceBrush(drawingSurface);
            surfaceBrush.Stretch = CompositionStretch.None;
            surfaceBrush.HorizontalAlignmentRatio = 0;
            surfaceBrush.VerticalAlignmentRatio   = 0;
            surfaceBrush.TransformMatrix          = System.Numerics.Matrix3x2.CreateTranslation(20.0f, 20.0f);

            myDrawingVisual.Brush = surfaceBrush;
            surfaceBrush.Offset   = new System.Numerics.Vector2(0, 0);
        }
        internal void ConfigureSpriteVisual(double width, double height)
        {
            var size = new SizeInt32
            {
                Height = (int)width,
                Width  = (int)height
            };

            _drawingSurface = _comositionGraphicsDevice.CreateVirtualDrawingSurface(
                size,
                DirectXPixelFormat.B8G8R8A8UIntNormalized,
                DirectXAlphaMode.Premultiplied);

            _surfaceBrush         = _compositor.CreateSurfaceBrush(_drawingSurface);
            _surfaceBrush.Stretch = CompositionStretch.None;
            _surfaceBrush.HorizontalAlignmentRatio = 0;
            _surfaceBrush.VerticalAlignmentRatio   = 0;
            _surfaceBrush.TransformMatrix          = Matrix3x2.CreateTranslation(0, 0);

            _myDrawingVisual.Brush = _surfaceBrush;
            _surfaceBrush.Offset   = new Vector2(0, 0);
        }