繁体   English   中英

无法在XNA上显示高分辨率图像

[英]Unable to display High-res images on XNA

我正在使用XNA框架在Kinect上创建一个应用程序。 它会产生问题,当我添加高分辨率图像时,它仅在屏幕上显示一半的图像,而如果是极高分辨率的图像则仅显示图像的25%,但是如果我上传360X480尺寸的图像,它将为我提供完整的图像。

我正在46英寸电视上全屏运行该应用程序。

请告诉我,如果我上传的图像分辨率超过360X480,为什么它不能显示完整的图像。

        public Game1()
         {
             graphics = new GraphicsDeviceManager(this);


             graphics.PreferredBackBufferHeight = 1280;
             graphics.PreferredBackBufferWidth = 720;

             graphics.IsFullScreen = true;

编辑

我正在使用以下代码加载和绘制图像。

defaultShirt= Content.Load<Texture2D>("kurta6");

   currentShirt = defaultShirt;    

  spriteBatch.Draw(currentShirt, new Rectangle
  (shirtXposition + x + 90, shirtYposition +   y + 50, customShirtHeight + 160, 
  customShirtWidth + 140), 
  new Rectangle(0, 0, 480, 360), 
  Color.White, 0, origin, SpriteEffects.None, 1);

我还使用以下方法从数据库添加图像。

        if (_image1Path[i] != "")
        {
            using (System.IO.FileStream stream = new System.IO.FileStream("D:/xampp/htdocs/boutique_cms/" + _image1Path[i], System.IO.FileMode.Open))
            {
                _image1Display[i] = Texture2D.FromStream(GraphicsDevice, stream);

                currentImagePath = _image1Display[i];
            }
        }

谢谢

如上所述,您将矩形切为矩形(0,0,480,360),您需要执行的操作。

这将绘制图像并将其缩放以适合下面指定的区域。

   spriteBatch.Draw(currentShirt, new Rectangle
       (shirtXposition + x + 90, shirtYposition + y + 50, customShirtHeight + 160,
       customShirtWidth + 140), Color.White);

您正在使用rectangle(0,0,480,360)切割图像。 所以您实际上说要从vector2d(0,0)vector2d(480,360)拍摄一张图像,而不是像这样尝试:

 spriteBatch.Draw(texture, new vector2d(x,y), color);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM