2011-04-28 29 views
0

hi 我從optionMenuScreen獲得了一個bitmapImage,並且想在GamePlayScreen中使用它。 我必須將其轉換爲texture2d嗎? 怎麼樣?例如請... 在什麼類? 如何更改位圖大小或在其紋理後更改它? 感謝xna如何使用來自photoChooser的位圖?

+0

以及如何獲取system.drawing類? – gooteis 2011-04-28 17:18:14

回答

1

由於PhotoResult.ChosenPhoto是甲流,我會嘗試使用不支持在手機上Texture2D.FromStreammsdn

System.Drawing中。

+0

但這是一個靜態的方法,所以你不能用它做很多。或者你或你有其他想法? – gooteis 2011-04-28 20:56:22

+0

這是什麼意思Goote?如果你有一個包含有效PNG或JPG的流,你可以使用FromStream作爲Texture2D加載它。 – eodabash 2011-04-28 22:21:13

+0

好吧,但我如何初始化graphicsDevice設備? void photoChooserTask_Completed(object sender,PhotoResult result){if(result.TaskResult == TaskResult.OK){bmp = new BitmapImage(); bmp.SetSource(result.ChosenPhoto); photoRecieved = Texture2D.FromStream(device,result.ChosenPhoto); }} – gooteis 2011-04-29 12:55:23