XNA 2D图像的Draw方法 和 图片旋转
2010-12-21 17:14
288 查看
public void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle? sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth); 一个参数一个参数过: texture:需要渲染的2d纹理, destinationRectangle:目标位置及大小, sourceRectangle:原位置及大小,null代表整个图像大小, color:通道色, rotation:旋转度(弧度) origin:原点位置(相对于texture), effects:控制水平和垂直翻转特效, layerDepth:层, 要图片旋转就设置rotation这个参数, 范例(顺时针旋转45度): modelHRotation = MathHelper.PiOver4; spriteBatch.Draw(t2d, new Rectangle(32, 32, 32, 32), null, Color.White, modelHRotation, new Vector2(16, 16), SpriteEffects.None, 0); //32(位置X),32(位置Y),32(图宽),32(图高)。 (16,16),16为32一半,所以以中心点为中心,旋转45°,若为(0,0),则以图片左上角旋转45°。
相关文章推荐
- Direct2D (39) : 使用 IDWriteTextLayout.Draw() 方法绘制文本
- VC++ 在使用 CImage 的Draw 输入一个图像时,有时候会造成图像失真严重,解决的方法如下
- XNA-SpriteBatch.Draw()的重载方法
- 图像中2D形状的表示方法总结
- Unity2D 减低DrawCall基础方法
- 多种方法显示2D图像序列
- Android异步加载图像小结(含线程池,缓存方法)
- 图像傅立叶变换(二维傅立叶变换fourier, 二维DFT, 2d-fft)的原理和物理意义
- 图像增强方法----光照(亮度)规整-Gamma校正
- XNA-2D-绘图文本和图片
- 增加动态的2D/3D图形控件Vectordraw Developer Framework 支持10多种矢量格式和多种离散格式
- 图像分割方法概述
- Android中几种图像特效处理方法
- HTML drawimage方法 拍摄的为什么失真 总结的几个方法
- opencv截取图像中某一区域的方法
- 在VC下显示JPEG、GIF格式图像的一种简便方法
- D3D中2D图片的绘制两种方法
- MFC和ATL共享的新类CImage为图像处理提供了许多相应的处理方法
- Unity 2D两种常用判断点击的方法
- XNA:2D图元与3D模型共存时的渲染问题