Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
DefaultContentDecoratorRenderer.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using SiliconStudio.Core;
4 using SiliconStudio.Core.Mathematics;
5 using SiliconStudio.Paradox.UI.Controls;
6 
7 namespace SiliconStudio.Paradox.UI.Renderers
8 {
9  /// <summary>
10  /// The default renderer for <see cref="ContentDecorator"/>.
11  /// </summary>
12  internal class DefaultContentDecoratorRenderer : ElementRenderer
13  {
14  public DefaultContentDecoratorRenderer(IServiceRegistry services)
15  : base(services)
16  {
17  }
18 
19  public override void RenderColor(UIElement element, UIRenderingContext context)
20  {
21  base.RenderColor(element, context);
22 
23  var decorator = (ContentDecorator)element;
24 
25  if (decorator.BackgroundImage == null)
26  return;
27 
28  var image = decorator.BackgroundImage;
29  var color = decorator.RenderOpacity * Color.White;
30 
31  Batch.DrawImage(image.Texture, image.TextureAlpha, ref decorator.WorldMatrixInternal, ref image.RegionInternal,
32  ref decorator.RenderSizeInternal, ref image.BordersInternal, ref color, context.DepthBias, image.Orientation);
33  }
34  }
35 }
A service registry is a IServiceProvider that provides methods to register and unregister services...
A ContentControl decorating its ContentControl.Content with a background image.
Android.Widget.Orientation Orientation
Definition: Section.cs:9