D2Plot command

Requires: Direct2D.lg32

Purpose

Draws a rounded dot using the specified D2Brush or a brush created from the the current foreground color.

Syntax

D2Plot x!, y! [,D2Brush]

x!, y!: float expression
D2Brush: Object expression

Description

Draws a rounded dot at x,y in device-independent pixels. By default, the dot is drawn using a solid color brush created from the current foreground color D2ForeColor. If the application passes a D2Brush object the dot is painted with that brush.

Example

'

' D2Plot sample (Dpi-unaware)

'

$Library "direct2d"

Global Object Win1RT

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

Set Win1RT = D2GetRT()

Do

Sleep

Until Me Is Nothing

 

Sub Win_1_Paint

' Only clear the window render target

D2BeginDraw Win1RT

D2Clear D2C_Yellow

D2EndDraw

EndSub

 

Sub Win_1_MouseMove(Button&, Shift&, x!, y!)

D2BeginDraw Win1RT

D2Plot x!, y!

D2EndDraw

EndSub

This second example plots a sine curve.

'

' D2PlotSin sample

'

$Library "direct2d"

Global Object RT1

OpenW 1, 0, 0, 400, 260, ~15

' A window render target scaling 360x200

Set RT1 = D2GetRT(Me, Me.hWnd, 360, 200)

Do

Sleep

Until Me Is Nothing

 

Sub Win_1_Paint

D2BeginDraw RT1

D2Clear D2C_Wheat

Local Int i

For i = 0 To 360

D2Plot i, 100 + SinQ(i) * 40

Next

D2EndDraw

EndSub

Remarks

D2Plot invokes ID2D1RenderTarget::DrawLine passing the coordinates x!,y!,x!,y! and a line width of 1 DIP.

D2PSet draws a square dot.

All drawing commands must be placed between D2BeginDraw and D2EndDraw.

See Also

D2PSet, D2RGBColor, D2Color

{Created by Sjouke Hamstra; Last updated: 16/05/2020 by James Gaite}