Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
DefaultImageRenderer.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="ImageElement"/>.
11  /// </summary>
12  internal class DefaultImageRenderer : ElementRenderer
13  {
14  public DefaultImageRenderer(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 image = (ImageElement)element;
24  var imageColor = element.RenderOpacity * Color.White;
25 
26  if(image.Source == null)
27  return;
28 
29  Batch.DrawImage(image.Source.Texture, image.Source.TextureAlpha, ref image.WorldMatrixInternal, ref image.Source.RegionInternal,
30  ref element.RenderSizeInternal, ref image.Source.BordersInternal, ref imageColor, context.DepthBias, image.Source.Orientation);
31  }
32  }
33 }
A service registry is a IServiceProvider that provides methods to register and unregister services...
Represents a control that displays an image.
Definition: ImageElement.cs:14
Android.Widget.Orientation Orientation
Definition: Section.cs:9