SurfaceLoader.FromFile Method |
Language: |
Loads a surface from a file.
Visual Basic Public Shared Sub FromFile( _
ByVal destSurface As Surface, _
ByVal destRectangle As Rectangle, _
ByVal srcFile As String, _
ByVal srcRectangle As Rectangle, _
ByVal filter As Filter, _
ByVal colorKey As Integer, _
ByRef srcInformation As ImageInformation _
)C# public static void FromFile(
Surface destSurface,
Rectangle destRectangle,
string srcFile,
Rectangle srcRectangle,
Filter filter,
int colorKey,
ref ImageInformation srcInformation
);C++ public:
static void FromFile(
Surface^ destSurface,
Rectangle destRectangle,
String^ srcFile,
Rectangle srcRectangle,
Filter filter,
int colorKey,
ImageInformation% srcInformation
);JScript public static function FromFile(
destSurface : Surface,
destRectangle : Rectangle,
srcFile : String,
srcRectangle : Rectangle,
filter : Filter,
colorKey : int,
srcInformation : ImageInformation
);
destSurface Microsoft.DirectX.Direct3D.Surface
A Surface object that represents the destination surface.destRectangle System.Drawing.Rectangle
A Rectangle object that represents the destination rectangle.srcFile System.String
String that contains the source file name.srcRectangle System.Drawing.Rectangle
A Rectangle 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.srcInformation Microsoft.DirectX.Direct3D.ImageInformation
[ref] An ImageInformation structure that represents the source image information.
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.FromFile 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.
Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center