D2Clear command

Requires: Direct2D.lg32

Purpose

Clears the render target's drawing area to the specified color.

Syntax

D2Clear [argbcolor]

argbcolor: integer

Description

Clears the render target's surface with the specified color in argbcolor or, when omitted, in the current background color. The background color can be set using D2Color, D2RGBColor, or D2BackColor.

Example

'

' D2Clear sample (dpi-unaware)

'

$Library "direct2d"

Global Object Win1RT

OpenW 1, 0, 0, 320, 260, ~15

Set Win1RT = D2GetRT()   ' DC render target

Do

Sleep

Until Me Is Nothing

 

Sub Win_1_Paint

D2BeginDraw Win1RT

// Drawing on the render target's surface

D2Clear D2C_Wheat

D2EndDraw

EndSub

 

Sub Win_1_ReSize

D2ResizeRT Win1RT, _X, _Y

EndSub

Remarks

This command requires an active render target, either set with D2BeginDraw or D2SetRT.

This is the only command that uses the background color, all other drawing commands draw transparently and don't use the background color D2BackColor. D2Clear must be placed between the D2BeginDraw and D2EndDraw commands.

See Also

D2BackColor, D2Color, D2RGBColor

{Created by Sjouke Hamstra; Last updated: 04/03/2021 by James Gaite}