![]() |
![]() |
![]() |
Device.CreateOffscreenPlainSurface Method |
Language: |
Creates an off-screen surface.
Visual Basic .NET Public Function CreateOffscreenPlainSurface( _
ByVal width As Integer, _
ByVal height As Integer, _
ByVal format As Format, _
ByVal pool As Pool _
) As SurfaceC# public Surface CreateOffscreenPlainSurface(
int width,
int height,
Format format,
Pool pool
);Managed C++ public: Surface* CreateOffscreenPlainSurface(
int width,
int height,
Format format,
Pool pool
);JScript .NET public function CreateOffscreenPlainSurface(
width : int,
height : int,
format : Format,
pool : Pool
) : Surface;
width System.Int32. Width of the surface in pixels. height System.Int32. Height of the surface in pixels. format Microsoft.DirectX.Direct3D.Format. Format of the surface. For more information, see Format. pool Microsoft.DirectX.Direct3D.Pool. Surface pool type. For more information, see Pool.
Microsoft.DirectX.Direct3D.Surface . The Surface object that is created.
The Default pool is appropriate for use with Device.StretchRectangle and Device.ColorFill.
The Managed pool is not allowed when creating an off-screen plain surface. For more information about memory pools, see Pool.
Off-screen plain surfaces are always lockable, regardless of their pool type.
Exceptions
InvalidCallException The method call is invalid. For example, a parameter might contain an invalid value.
Copy a Texture
This example demonstrates how to copy a texture.
A texture is loaded from a file and duplicated, and all of its AliceBlue color is replaced with transparent black. An area that is ten pixels square from the top right corner of the texture is copied.
In the following C# code example, device is assumed to be the rendering Device, and FlagColorsInverted.bmp is assumed to be in the current directory.
[C#]
using Microsoft.DirectX.Direct3D; using System.Drawing; Surface s = null; PaletteEntry[] pal = new PaletteEntry[256]; // Set up the surface for our surface loader. s = device.CreateOffscreenPlainSurface(32, 32, Format.A8R8G8B8, Pool.Default); Surface k = TextureLoader.FromFile(device, "FlagColorsInverted.bmp").GetSurfaceLevel(0); SurfaceLoader.FromSurface(s, out pal, new Rectangle(0,0,9,9), k, out pal, new Rectangle(0,0,9,9), Filter.Box, Color.AliceBlue.ToArgb());
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center