Exemple #1
0
        /// <summary>
        /// Composes a DrawingLayer with another DrawingLayer.  
        /// This allows for things like scaling, blending, 2D and 3D transformations
        /// </summary>
        /// <param name="layer">The DrawingLayer that is used as the input</param>
        /// <param name="sourceArea">The area over the input DrawingLayer</param>
        /// <param name="destinationArea">The output area to draw the source area</param>
        /// <param name="rotationTransform">The rotation parameters</param>
        /// <param name="tint">The color to tint the source layer on to the output</param>
        public void ComposeDrawingLayer(DrawingLayer layer, ref RectangleF sourceArea, ref RectangleF destinationArea, ref RotationParameters rotationTransform, ref Color4 tint)
        {
            m_drawStateManagement.DrawPreamble();

            /* Get the current draw data to fill.  We avoid creating new object instances
             * for the GC to have to delete */
            var spriteRenderData = m_spriteRenderer.GetCurrentRenderData();

            /* Copy all the primitive transform data to the spriteRenderData */

            float xDestination = destinationArea.X;
            float yDestination = destinationArea.Y;

            spriteRenderData.drawData.Translation.X = xDestination;
            spriteRenderData.drawData.Translation.Y = yDestination;

            spriteRenderData.drawData.Rotate.X = rotationTransform.RotateX;
            spriteRenderData.drawData.Rotate.Y = rotationTransform.RotateY;
            spriteRenderData.drawData.Rotate.Z = rotationTransform.RotateZ;

            spriteRenderData.drawData.Scale.X = destinationArea.Width / sourceArea.Width;
            spriteRenderData.drawData.Scale.Y = destinationArea.Height / sourceArea.Height;

            spriteRenderData.drawData.DrawRect.X = sourceArea.X;
            spriteRenderData.drawData.DrawRect.Y = sourceArea.Y;
            spriteRenderData.drawData.DrawRect.Z = sourceArea.Width;
            spriteRenderData.drawData.DrawRect.W = sourceArea.Height;

            spriteRenderData.drawData.RotationCenter = rotationTransform.RotationCenter.InternalVector2;

            spriteRenderData.drawData.Color = tint.InternalColor4;
            spriteRenderData.texture = layer.RenderTargetTexture;

            /* Add (queue) the drawing data to the sprite renderer */
            m_spriteRenderer.AddRenderData(spriteRenderData);
        }
 /// <summary>
 /// Composes a DrawingLayer with another DrawingLayer.  
 /// This allows for things like scaling, blending, 2D and 3D transformations
 /// </summary>
 /// <param name="layer">The DrawingLayer that is used as the input</param>
 /// <param name="sourceArea">The area over the input DrawingLayer</param>
 /// <param name="destinationArea">The output area to draw the source area</param>
 /// <param name="rotationTransform">The rotation parameters</param>
 /// <param name="tint">The color to tint the source layer on to the output</param>
 public void ComposeLayer(DrawingLayer layer, RectangleF sourceArea, RectangleF destinationArea, RotationParameters rotationTransform, Color4 tint)
 {
     m_directCanvasFactory.Compose(layer, sourceArea, destinationArea, rotationTransform, tint);
 }
Exemple #3
0
 /// <summary>
 /// Composes a DrawingLayer with another DrawingLayer.  
 /// This allows for things like scaling, blending, 2D and 3D transformations
 /// </summary>
 /// <param name="layer">The DrawingLayer that is used as the input</param>
 /// <param name="sourceArea">The area over the input DrawingLayer</param>
 /// <param name="destinationArea">The output area to draw the source area</param>
 /// <param name="rotationTransform">The rotation parameters</param>
 /// <param name="tint">The color to tint the source layer on to the output</param>
 public void ComposeDrawingLayer(DrawingLayer layer, RectangleF sourceArea, RectangleF destinationArea, RotationParameters rotationTransform, Color4 tint)
 {
     ComposeDrawingLayer(layer, ref sourceArea, ref destinationArea, ref rotationTransform, ref tint);
 }
        /// <summary>
        /// Composes a DrawingLayer with another DrawingLayer.  
        /// This allows for things like scaling, blending, 2D and 3D transformations
        /// </summary>
        /// <param name="layer">The DrawingLayer that is used as the input</param>
        /// <param name="sourceArea">The area over the input DrawingLayer</param>
        /// <param name="destinationArea">The output area to draw the source area</param>
        /// <param name="rotationTransform">The rotation parameters</param>
        /// <param name="tint">The color to tint the source layer on to the output</param>
        internal void Compose(DrawingLayer layer, RectangleF sourceArea, RectangleF destinationArea, RotationParameters rotationTransform, Color4 tint)
        {
            m_composeStateManagement.DrawPreamble();

            m_composer.ComposeDrawingLayer(layer, sourceArea, destinationArea, rotationTransform, tint);
        }