本文整理汇总了C#中Canvas.LoadTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.LoadTexture方法的具体用法?C# Canvas.LoadTexture怎么用?C# Canvas.LoadTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas.LoadTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
/// <summary>
/// Creates a texture from a specified filename (if specified). Creates a plane
/// mesh (DirectX mesh object). Mesh size is the texture size.
/// </summary>
/// <param name="canvas">A GLCore Canvas object.</param>
public override void Initialize(Canvas canvas)
{
if (_filename.Length > 0)
{
_texture = canvas.LoadTexture(_filename, out _texture_width, out _texture_height);
}
verts = new CustomVertex.PositionNormalTextured[4];
verts[0] = new CustomVertex.PositionNormalTextured(new Vector3(0, _texture_height, 0f), new Vector3(1, 1, 1), 0, 0);
verts[1] = new CustomVertex.PositionNormalTextured(new Vector3(0, 0, 0), new Vector3(1, 1, 1), 0, 1);
verts[2] = new CustomVertex.PositionNormalTextured(new Vector3(_texture_width, _texture_height, 0), new Vector3(1, 1, 1), 1, 0);
verts[3] = new CustomVertex.PositionNormalTextured(new Vector3(_texture_width, 0, 0), new Vector3(1, 1, 1), 1, 1);
Geometry.ComputeBoundingBox(verts, CustomVertex.PositionNormalTextured.Format, out min, out max);
}
示例2: Texture
public override void Texture(Canvas canvas)
{
int hardware_width;
int hardware_height;
if (_filename.Length > 0)
{
_texture = canvas.LoadTexture(_filename, out _texture_width, out _texture_height);
_internal_rect.Width = _texture_width;
_internal_rect.Height = _texture_height;
using (Surface s = _texture.GetSurfaceLevel(0))
{
hardware_height = s.Description.Height;
hardware_width = s.Description.Width;
}
_XScaleCoeff = (float)_texture_width / (float)hardware_width;
_YScaleCoeff = (float)_texture_height / (float)hardware_height;
SetScale(1, 1, 1);
}
}