Sketch
Constructors
Sketch
()
Creates a new instance of the sketch
Properties
styleNames
:string[]
get
Gets list of style names
bounds
:Rect
get
Gets a bounded rectangle
Methods
defineStyle
(name: string, style: TShapeStyle) ⇨ ShapeStyle
Creates a named style in the sketch
copyStyles
(source: Sketch) ⇨ void
Copies style from a source sketch to the current sketch
cloneStyles
(source: Sketch) ⇨ void
Creates new instance of styles from a source sketch and copies those to the current sketch
getStyle
(name: string) ⇨ ShapeStyle
Gets a style by the name
clear
() ⇨ void
Deletes all shapes from the sketch
rect
(style: ShapeStyleTypes, rect: TRect) ⇨ Rectangle
Creates a rectangle by specified parameters
rects
(style: ShapeStyleTypes | ShapeStyleTypes[] | ShapeStyleTypes[][], rect: TRect, cols: number = 1, rows: number = 1, options?: TRectDrawOptions) ⇨ Rectangle[]
Creates a grid of rectangles by specified parameters
polyrect
(style: ShapeStyleTypes, rect: PolyRect) ⇨ PolyRectangle
Creates a non-AABB rectangle by specified parameters
polygon
(style: ShapeStyleTypes, points: TPoint[]) ⇨ Polygon
Creates a polygon by specified parameters
dots
(style: ShapeStyleTypes, points: TPoint[], radius: number = 1) ⇨ Polydots
Creates dots by specified parameters
arrows
(style: ShapeStyleTypes, segments: TSegment[], options?: TCreateArrowOptions) ⇨ Arrows
Creates arrows by specified parameters
roundedrect
(style: ShapeStyleTypes, rect: TRect, radii?: number | number[]) ⇨ RoundedRectangle
Creates a rounded rectangle by specified parameters
circle
(style: ShapeStyleTypes, center: TPoint, radius: number) ⇨ Circle
Creates a circle by specified parameters
line
(style: ShapeStyleTypes, p0: TPoint, p1: TPoint) ⇨ Line
Creates a line by specified parameters
vline
(style: ShapeStyleTypes, p: TPoint, height: number) ⇨ VLine
Creates a vertical line by specified parameters
hline
(style: ShapeStyleTypes, p: TPoint, width: number) ⇨ HLine
Creates a horizontal line by specified parameters
segmentline
(style: ShapeStyleTypes, startPoint: TPoint) ⇨ SegmentLine
Creates a line from segments line by specified parameters
setPixel
(style: ShapeStyleTypes, point: TPoint) ⇨ Pixel
Creates a pixel by specified parameters
draw
(surface: Surface) ⇨ void
Draws a sketch on the surface
toSurface
(width?: number, height?: number, coordinateSystem?: CoordinateSystem) ⇨ Surface
Creates a surface from the sketch
toPattern
(repetition: "repeat" | "repeat-x" | "repeat-y" | "no-repeat", width?: number, height?: number, coordinateSystem?: CoordinateSystem) ⇨ Surface
Creates a pattern from the sketch