TextureLoader.FromStream-Methode (Device, Stream)
Dieser Dokumentation für die Vorschau nur ist und in späteren Versionen geändert. Leere Themen wurden als Platzhalter eingefügt.]
Erstellt eine Textur aus einer Datei im Arbeitsspeicher.
Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)
Syntax
'Declaration
Public Shared Function FromStream ( _
device As Device, _
stream As Stream _
) As Texture
'Usage
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
Parameter
- device
Typ: Microsoft.WindowsMobile.DirectX.Direct3D.Device
Das Gerät die Textur zugeordnet.
- stream
Typ: System.IO.Stream
Der Stream, aus denen die Struktur erstellt werden soll.
Rückgabewert
Typ: Microsoft.WindowsMobile.DirectX.Direct3D.Texture
Das Objekt erstellte Textur.
Ausnahmen
Ausnahme | Bedingung |
---|---|
InvalidCallException | Der Methodenaufruf ist ungültig.Beispielsweise kann eine Methode Parameter einen ungültigen Wert enthalten. |
OutOfMemoryException | Direct3D konnte nicht genügend Speicher um den Aufruf vollständig auszuführen. |
Hinweise
Diese Methode unterstützt die folgenden Dateiformate: .bmp, .DDS, .jpg, .PNG und GIF.
Beispiele
Im folgenden Beispiel wird der FromStream(Device, Stream)-Methodenüberladung veranschaulicht.
' 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-Sicherheit
- Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter Verwenden von Bibliotheken aus teilweise vertrauenswürdigem Code.
Plattformen
Windows CE, Windows Mobile für Smartphone, Windows Mobile für Pocket PC
Die .NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET framework.
Versionsinformationen
.NET Compact Framework
Unterstützt in: 3.5, 2.0