次の方法で共有


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

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
)
public void Clear (
    ClearFlags flags, 
    Color color, 
    float zdepth, 
    int stencil, 
    Rectangle[] rectangles
)
public function Clear (
    flags : ClearFlags, 
    color : Color, 
    zdepth : float, 
    stencil : int, 
    rectangles : Rectangle[]
)

Parameters

  • flags
    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.

  • color
    A Color object that represents the color to which the render target surface is cleared.
  • zdepth
    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
    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
    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 type 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

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms

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

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

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

Device Class
Device Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace