Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
FactorRescalingRequest.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 namespace SiliconStudio.TextureConverter.Requests
4 {
5  /// <summary>
6  /// Request a texture to be rescale according to the given factor, new size will be : width = width * widthFactor and height = height * heightFactor
7  /// </summary>
8  internal class FactorRescalingRequest : RescalingRequest
9  {
10 
11  /// <summary>
12  /// The width factor
13  /// </summary>
14  private float widthFactor;
15 
16  /// <summary>
17  /// The height factor
18  /// </summary>
19  private float heightFactor;
20 
21  /// <summary>
22  /// Initializes a new instance of the <see cref="FactorRescalingRequest"/> class.
23  /// </summary>
24  /// <param name="widthFactor">The width factor.</param>
25  /// <param name="heightFactor">The height factor.</param>
26  /// <param name="filter">The filter.</param>
27  public FactorRescalingRequest(float widthFactor, float heightFactor, Filter.Rescaling filter) : base(filter)
28  {
29  this.widthFactor = widthFactor;
30  this.heightFactor = heightFactor;
31  }
32 
33  public override int ComputeWidth(TexImage texImage)
34  {
35  return (int)(texImage.Width * widthFactor);
36  }
37 
38  public override int ComputeHeight(TexImage texImage)
39  {
40  return (int)(texImage.Height * heightFactor);
41  }
42  }
43 }