Partager via


Device.Clear Method (ClearFlags, Color, Single, Int32, array<Rectangle[])

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Clears the viewport or a set of rectangles in the viewport to a specified RGBA color, clears the depth buffer, and erases the stencil buffer.

Namespace:  Microsoft.WindowsMobile.DirectX.Direct3D
Assembly:  Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)

Syntax

'Declaration
Public Sub Clear ( _
    flags As ClearFlags, _
    color As Color, _
    zdepth As Single, _
    stencil As Integer, _
    rectangles As Rectangle() _
)
'Usage
Dim instance As Device
Dim flags As ClearFlags
Dim color As Color
Dim zdepth As Single
Dim stencil As Integer
Dim rectangles As Rectangle()

instance.Clear(flags, color, zdepth, stencil, _
    rectangles)
public void Clear(
    ClearFlags flags,
    Color color,
    float zdepth,
    int stencil,
    Rectangle[] rectangles
)
public:
void Clear(
    ClearFlags flags, 
    Color color, 
    float zdepth, 
    int stencil, 
    array<Rectangle>^ rectangles
)
member Clear : 
        flags:ClearFlags * 
        color:Color * 
        zdepth:float32 * 
        stencil:int * 
        rectangles:Rectangle[] -> unit 

Parameters

  • flags
    Type: Microsoft.WindowsMobile.DirectX.Direct3D.ClearFlags
    The flags that indicate which surfaces to clear. This parameter can be any combination of the following flags, but at least one flag must be used:
    • Stencil: Clears the stencil buffer to the value in the stencil parameter.

    • Target: Clears the render target to the color in the color parameter.

    • ZBuffer: Clears the depth buffer to the value in the zdepth parameter.

  • zdepth
    Type: System.Single
    A new zdepth value that this method stores in the depth buffer. This parameter can be in the range of 0.0 through 1.0 (for z-based or w-based depth buffers). A value of 0.0 represents the nearest distance to the viewer; a value of 1.0 represents the farthest distance.
  • stencil
    Type: System.Int32
    An integer value to store in each stencil-buffer entry. This parameter can be in the range of 0 through 2n-1, where n is the bit depth of the stencil buffer.
  • rectangles
    Type: array<System.Drawing.Rectangle[]
    An array of Rectangle structures that describe the rectangles to clear. To clear the entire surface, set a rectangle to the dimensions of the rendering target. Each rectangle uses screen coordinates that correspond to points on the render target surface. Coordinates are clipped to the bounds of the viewport rectangle.

Exceptions

Exception Condition
InvalidCallException

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

Remarks

This method fails if the ZBuffer or Stencil flags are specified when the render target does not have an attached depth buffer. Similarly, the method fails if the Stencil flag is specified when the depth-buffer format does not contain stencil buffer information.

.NET Framework Security

Platforms

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

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Compact Framework

Supported in: 3.5, 2.0

See Also

Reference

Device Class

Device Members

Clear Overload

Microsoft.WindowsMobile.DirectX.Direct3D Namespace