SurfaceLoader.FromStream(Surface,PaletteEntry,Stream,Int32,Rectangle,Filter,Int32) Method (Microsoft.DirectX.Direct3D)

Loads a surface from a stream.

Definition

Visual Basic Public Shared Sub FromStream( _
    ByVal destSurface As Surface, _
    ByRef destPalette As PaletteEntry, _
    ByVal stream As StreamLeave Site, _
    ByVal readBytes As Integer, _
    ByVal srcRectangle As RectangleLeave Site, _
    ByVal filter As Filter, _
    ByVal colorKey As Integer _
)
C# public static void FromStream(
    Surface destSurface,
    out PaletteEntry destPalette,
    StreamLeave Site stream,
    int readBytes,
    RectangleLeave Site srcRectangle,
    Filter filter,
    int colorKey
);
C++ public:
static void FromStream(
    SurfacedestSurface,
    [Out] PaletteEntrydestPalette,
    StreamLeave Sitestream,
    int readBytes,
    RectangleLeave Site srcRectangle,
    Filter filter,
    int colorKey
);
JScript public static function FromStream(
    destSurface : Surface,
    destPalette : PaletteEntry,
    stream : StreamLeave Site,
    readBytes : int,
    srcRectangle : RectangleLeave Site,
    filter : Filter,
    colorKey : int
);

Parameters

destSurface Microsoft.DirectX.Direct3D.Surface
A Surface object that represents the destination surface.
destPalette Microsoft.DirectX.Direct3D.PaletteEntry[]
A PaletteEntry array that contains the destination palette entries.
stream System.IO.Stream
A StreamLeave Site object that contains the source surface data.
readBytes System.Int32
Size, in bytes, of the stream data in memory.
srcRectangle System.Drawing.Rectangle
A RectangleLeave Site object that represents the source rectangle.
filter Microsoft.DirectX.Direct3D.Filter
One or more members of the Filter enumeration that control how the image is filtered.
colorKey System.Int32
Integer value that represents the color to replace with transparent black, or 0 to disable the colorKey. This value is always a 32-bit ARGB color, regardless of the source image format. alpha is significant and should usually be set to 0xFF for opaque color keys. Thus, for opaque black, the value is equal to 0xFF000000.

Remarks

This method handles conversion to and from compressed texture formats and supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. For more information, see ImageFileFormat.

Writing to a surface level other than zero does not cause the dirty rectangle to be updated. If SurfaceLoader.FromStream is called and the surface is not already dirty (which is unlikely under normal usage scenarios), the application must explicitly call Texture.AddDirtyRect on the surface.

Exceptions

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

InvalidDataException

The data is invalid.