次の方法で共有


TextureLoader.FromStream メソッド (Device, Stream)

[このドキュメントはプレビュー版であり、後のリリースで変更されることがあります。 空白のトピックは、プレースホルダーとして挿入されています。]

メモリ内のファイルからテクスチャを作成します。

名前空間:  Microsoft.WindowsMobile.DirectX.Direct3D
アセンブリ:  Microsoft.WindowsMobile.DirectX (Microsoft.WindowsMobile.DirectX.dll 内)

構文

'宣言
Public Shared Function FromStream ( _
    device As Device, _
    stream As Stream _
) As Texture
'使用
Dim device As Device
Dim stream As Stream
Dim returnValue As Texture

returnValue = TextureLoader.FromStream(device, _
    stream)
public static Texture FromStream(
    Device device,
    Stream stream
)
public:
static Texture^ FromStream(
    Device^ device, 
    Stream^ stream
)
static member FromStream : 
        device:Device * 
        stream:Stream -> Texture 

パラメーター

  • stream
    型 : System.IO.Stream
    テクスチャの作成元のストリーム。

戻り値

型 : Microsoft.WindowsMobile.DirectX.Direct3D.Texture
作成されたテクスチャ オブジェクト。

例外

例外 条件
InvalidCallException

メソッドの呼び出しが無効です。たとえば、メソッドのパラメーターに無効な値が含まれている場合などです。

OutOfMemoryException

Direct3D で、呼び出しを完了するために十分なメモリを割り当てられませんでした。

解説

このメソッドは、次のファイル形式をサポートします。.bmp、.dds、.jpg、.png、および.gif です。

FromStream(Device, Stream) メソッド オーバーロードを使用する例を次に示します。

' This code example is taken from the' Direct3D Mobile Texture Sample included with the' .NET Compact Framework samples.
' Called whenever the rendering device is reset.FriendSub OnResetDevice(ByVal sender AsObject, ByVal e As EventArgs)
    Dim dev As Device = CType(sender, Device)
    ' Turn off culling, so we see the front and back of the triangle.
    dev.RenderState.CullMode = Cull.None
    ' Turn off D3D lighting.
    dev.RenderState.Lighting = False    ' Turn on the ZBuffer.
    dev.RenderState.ZBufferEnable = True    ' Turn on perspective correction for textures.    ' This provides a more accurate visual at the cost    ' of a small performance overhead.
    dev.RenderState.TexturePerspective = True    ' Now create the texture.
    texture = TextureLoader.FromStream(dev, _
      [Assembly].GetExecutingAssembly().GetManifestResourceStream("Texture.Content.Banana.bmp"))

EndSub
// This code example is taken from the// Direct3D Mobile Texture Sample included with the// .NET Compact Framework samples.// Called whenever the rendering device is reset.void OnResetDevice(object sender, EventArgs e)
{
    Device dev = (Device)sender;
    // Turn off culling, so we see the front and back of the triangle
    dev.RenderState.CullMode = Cull.None;
    // Turn off D3D lighting
    dev.RenderState.Lighting = false;
    // Turn on the ZBuffer
    dev.RenderState.ZBufferEnable = true;
    // Turn on perspective correction for textures// This provides a more accurate visual at the cost// of a small performance overhead
    dev.RenderState.TexturePerspective = true;
    // Now create our texture

    texture = TextureLoader.FromStream(dev,
        Assembly.GetExecutingAssembly().GetManifestResourceStream(
        "Texture.Content.Banana.bmp"));
}

.NET Framework セキュリティ

プラットフォーム

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。 サポートされているバージョンについては、「.NET フレームワークのシステム要件」を参照してください。

バージョン情報

.NET Compact Framework

サポート対象 : 3.5、2.0

参照

参照

TextureLoader クラス

TextureLoader メンバー

FromStream オーバーロード

Microsoft.WindowsMobile.DirectX.Direct3D 名前空間