API > @blocksuite/blocks > RoughCanvas
Class: RoughCanvas ​
Constructors ​
constructor ​
new RoughCanvas(
canvas
,config
?):RoughCanvas
Parameters ​
Parameter | Type |
---|---|
canvas | HTMLCanvasElement |
config ? | Config |
Returns ​
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:16
Properties ​
canvas ​
private
canvas:HTMLCanvasElement
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:13
ctx ​
private
ctx:CanvasRenderingContext2D
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:14
gen ​
private
gen:RoughGenerator
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:12
Accessors ​
generator ​
get
generator():RoughGenerator
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:123
Methods ​
_drawToContext ​
private
_drawToContext(ctx
,drawing
,fixedDecimals
?,rule
? ='nonzero'
):void
Parameters ​
Parameter | Type | Default value |
---|---|---|
ctx | CanvasRenderingContext2D | undefined |
drawing | OpSet | undefined |
fixedDecimals ? | number | undefined |
rule ? | CanvasFillRule | 'nonzero' |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:85
arc ​
arc(
x
,y
,width
,height
,start
,stop
,closed
=false
,options
?):Drawable
Parameters ​
Parameter | Type | Default value |
---|---|---|
x | number | undefined |
y | number | undefined |
width | number | undefined |
height | number | undefined |
start | number | undefined |
stop | number | undefined |
closed | boolean | false |
options ? | Options | undefined |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:185
circle ​
circle(
x
,y
,diameter
,options
?):Drawable
Parameters ​
Parameter | Type |
---|---|
x | number |
y | number |
diameter | number |
options ? | Options |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:167
curve ​
curve(
points
,options
?):Drawable
Parameters ​
Parameter | Type |
---|---|
points | Point [] |
options ? | Options |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:200
draw ​
draw(
drawable
):void
Parameters ​
Parameter | Type |
---|---|
drawable | Drawable |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:23
ellipse ​
ellipse(
x
,y
,width
,height
,options
?):Drawable
Parameters ​
Parameter | Type |
---|---|
x | number |
y | number |
width | number |
height | number |
options ? | Options |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:155
fillSketch ​
private
fillSketch(ctx
,drawing
,o
):void
Parameters ​
Parameter | Type |
---|---|
ctx | CanvasRenderingContext2D |
drawing | OpSet |
o | ResolvedOptions |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:63
getDefaultOptions ​
getDefaultOptions():
ResolvedOptions
Returns ​
ResolvedOptions
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:127
line ​
line(
x1
,y1
,x2
,y2
,options
?):Drawable
Parameters ​
Parameter | Type |
---|---|
x1 | number |
y1 | number |
x2 | number |
y2 | number |
options ? | Options |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:131
linearPath ​
linearPath(
points
,options
?):Drawable
Parameters ​
Parameter | Type |
---|---|
points | Point [] |
options ? | Options |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:173
path ​
path(
d
,options
?):Drawable
Parameters ​
Parameter | Type |
---|---|
d | string |
options ? | Options |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:206
polygon ​
polygon(
points
,options
?):Drawable
Parameters ​
Parameter | Type |
---|---|
points | Point [] |
options ? | Options |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:179
rectangle ​
rectangle(
x
,y
,width
,height
,options
?):Drawable
Parameters ​
Parameter | Type |
---|---|
x | number |
y | number |
width | number |
height | number |
options ? | Options |
Returns ​
Drawable
Defined In ​
packages/blocks/src/surface-block/rough/canvas.ts:143