|
|
有2张图,想把它们重叠在一起显示。
当然下面的图要大一点显示。
我的问题是,如何来实现重叠显示呢?
下面是一部分程序,各位给出个主意好吗?先谢了。
1.定义部分
// 纹理
private Texture imageTexture = null;
// 图形文件名
private string imageFileName = "xxx.png";
// 大小
private Size imageSize;
2.纹理生成处理部分
ImageInformation imageInfo = new ImageInformation();
// 生成纹理
this.imageTexture = TextureLoader.FromFile( this.device,
this.imageFileName,
0,
0,
1,
0,
Format.A8R8G8B8,
Pool.Managed,
Filter.None,
Filter.None,
0,
ref imageInfo);
// 大小设定
this.imageSize = new Size(imageInfo.Width, imageInfo.Height);
3.纹理显示部分
Matrix scale = new Matrix();
scale.Scale(1.0f, 1.0f, 0.0f);
Matrix preScale = this.sprite.Transform;
this.sprite.Transform = scale;
Rectangle drawRect = new Rectangle( 100, 100, 300, 300);
this.sprite.Draw( this.imageTexture,
Rectangle.Empty,
new Vector3(0.0f, 0.0f, 0.0f),
new Vector3((float)drawRect.X / scale.M11, (float)drawRect.Y / scale.M22, 0.0f),
Color.FromArgb(255, 255, 255, 255)
);
this.sprite.Transform = preScale;
|
|