D2Preset Command

Requires: Direct2D.lg32

Purpose

Sets a graphic point using the specified color or the current background color.

Syntax

D2Preset x!, y!, [,argbcolor]

x!, y!: single expression
argbcolor: integer expression

Description

D2Preset x, y, argbcolor sets a graphic point at the coordinates x and y in color argbcolor. When argbcolor is omitted the current background color, the D2BkColor setting, is used.

The GB Direct2D library defines the Direct2D ARGB color constants for many colors. The names of these ARGB color constants start with D2C_ and are formatted as D2C_Colorname. An alternative is to use the ARGB conversion function.

Example

'

' D2Preset sample (dpi-unaware)

'

$Library "direct2d"

Global Object Win1RT

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

Set Win1RT = D2GetRT()   ' DC render target

Ocx Timer tmr

tmr.Interval = 50

tmr.Enabled = True

Do

Sleep

Until Me Is Nothing

 

Sub tmr_Timer

D2BeginDraw Win1RT

D2Preset Rand(_X), Rand(_Y), Rand(_C)

D2EndDraw

EndSub

 

Sub Win_1_Paint

D2BeginDraw Win1RT, D2C_White

D2EndDraw

EndSub

 

Sub Win_1_ReSize

D2ResizeRT Win1RT, _X, _Y

EndSub

Remarks

D2Preset is the only Direct2D command that uses the D2BkColor setting.

See Also

D2Pset, D2Plot, D2Color, D2RGBColor, D2BkColor

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