Quark
#
Modules #
quark/actionquark/appquark/bubblesquark/bufferquark/checkboxquark/cssquark/ctrquark/defsquark/dialogquark/eventquark/fontquark/fsquark/hashquark/httpquark/indexquark/jsonbquark/keyboardquark/lmdbquark/mediaquark/navquark/netquark/osquark/pathquark/pkgquark/screenquark/statequark/stepperquark/storagequark/testquark/typesquark/uriquark/utilquark/viewquark/windowquark/wsquark/_bufferquark/_commonquark/_decoratorsquark/_eventquark/_extquark/_md5quark/_sha1quark/_sha256quark/_utilquark/_watching
Quark v1.4.0 Documentation
Contents
-
quark/path
- Enum: PathVerb
- Enum: Cap
- Enum: Join
- oval(rect,ccw)
- arc(rect,startAngle,sweepAngle,useCenter,close?)
- rect(rect,ccw?)
- circle(center,radius,ccw?)
- rrect(rect,radius)
- rrectOutline(outside,inside,radius)
- getBoundsFromPoints(pts,ptsLen,matrix?)
-
Class: Path
- Path
- path.ptsLen
- path.verbsLen
- path.isNormalized
- path.isSealed
- path.constructor(move?)
- path.moveTo(to)
- path.lineTo(to)
- path.quadTo(control,to)
- path.cubicTo(control1,control2,to)
- path.ovalTo(rect,ccw?)
- path.rectTo(rect,ccw?)
- path.arcTo(rect,startAngle,sweepAngle,useCenter)
- path.arc(center,radius,startAngle,sweepAngle,useCenter)
- path.close()
- path.concat(path)
- path.ptsAt(index)
- path.verbsAt(index)
- path.getEdgeLines(precision?)
- path.getTriangles(precision?,z?)
- path.getAASideTriangles(width,precision?)
- path.dashPath(stage,offset?)
- path.strokePath(width,cap?,join?,miterLimit?)
- path.normalizedPath(precision?)
- path.transform(matrix)
- path.scale(scale)
- path.seal()
- path.getBounds(matrix?)
- path.copy()
- path.hashCode()
quark/path #
Enum: PathVerb #
PathVerb #
Path verb types
kMovemovekLinestraight linekQuadquadratic bezierkCubiccubic bezierkCloseclose
Enum: Cap #
Cap #
Line cap style
kButtno stroke extensionkRoundadds circlekSquareadds square
Enum: Join #
Join #
Line join style
kMiterextends to miter limitkRoundadds circlekBevelconnects outside edges
oval(rect,ccw) #
Create an oval (ellipse) path.
oval(rect: Rect, ccw: boolean): Path
Parameters:
rect— The bounding rectangle of the oval.ccw— Whether to draw counter-clockwise (CCW).
Returns: A new path representing the oval.
arc(rect,startAngle,sweepAngle,useCenter,close?) #
Create an arc path.
arc(rect: Rect, startAngle: number, sweepAngle: number, useCenter: boolean, close: any, close?: boolean): Path
Parameters:
rect— The bounding rectangle of the arc.startAngle— Start angle in radians.sweepAngle— Sweep angle in radians (positive = clockwise, negative = counter-clockwise).useCenter— Whether to connect the center point to form a pie shape.close— Whether to close the path. Default is false.
Returns: A new path representing the arc.
rect(rect,ccw?) #
Create a rectangular path.
rect(rect: Rect, ccw: any, ccw?: boolean): Path
Parameters:
rect— The rectangle bounds.ccw— Whether to draw counter-clockwise (default: false).
Returns: A new path representing the rectangle.
circle(center,radius,ccw?) #
Create a circular path.
circle(center: Vec2, radius: number, ccw: any, ccw?: boolean): Path
Parameters:
center— Center of the circle.radius— Radius of the circle.ccw— Whether to draw counter-clockwise.
Returns: A new path representing the circle.
rrect(rect,radius) #
Create a rounded rectangle path.
rrect(rect: Rect, radius: BorderRadius): Path
Parameters:
rect— The rectangle bounds.radius— Corner radius values (can define per-corner radii).
Returns: A new path representing the rounded rectangle.
rrectOutline(outside,inside,radius) #
Create an outline path between two rounded rectangles (outer and inner).
rrectOutline(outside: Rect, inside: Rect, radius: BorderRadius): Path
Parameters:
outside— Outer rectangle.inside— Inner rectangle.radius— Corner radius values.
Returns: A new path representing the rounded rectangle outline.
getBoundsFromPoints(pts,ptsLen,matrix?) #
Compute the bounding region from a set of points. Does NOT check if the matrix is an identity matrix.
getBoundsFromPoints(pts: Vec2[], ptsLen: number, matrix: any, matrix?: Mat): Range
Parameters:
pts— The point array.ptsLen— Number of points.matrix— Optional transform matrix.
Returns: The computed region bounds.
Class: Path #
Path #
Represents a geometric path consisting of lines, curves, and shapes.
path.ptsLen #
Number of points in this path.
readonly ptsLen: Uint
path.verbsLen #
Number of verbs (path commands) in this path.
readonly verbsLen: Uint
path.isNormalized #
Whether the path is normalized (curves converted to line segments).
readonly isNormalized: boolean
path.isSealed #
Whether the path is sealed (cannot be modified).
readonly isSealed: boolean
path.constructor(move?) #
Construct a new path.
constructor(move: any, move?: Vec2)
Parameters:
move— Optional initial move-to point.
path.moveTo(to) #
Move the current point without drawing a line.
moveTo(to: Vec2): void
path.lineTo(to) #
Draw a straight line from the current point to the specified point.
lineTo(to: Vec2): void
path.quadTo(control,to) #
Draw a quadratic Bézier curve.
quadTo(control: Vec2, to: Vec2): void
path.cubicTo(control1,control2,to) #
Draw a cubic Bézier curve.
cubicTo(control1: Vec2, control2: Vec2, to: Vec2): void
path.ovalTo(rect,ccw?) #
Add an oval (ellipse) to the path.
ovalTo(rect: Rect, ccw?: boolean): void
path.rectTo(rect,ccw?) #
Add a rectangle to the path.
rectTo(rect: Rect, ccw?: boolean): void
path.arcTo(rect,startAngle,sweepAngle,useCenter) #
Add an arc defined by a bounding rectangle.
arcTo(rect: Rect, startAngle: number, sweepAngle: number, useCenter: boolean): void
Parameters:
rect— Bounding rectangle.startAngle— Start angle in radians.sweepAngle— Sweep angle in radians.useCenter— Whether to connect to the center point.
path.arc(center,radius,startAngle,sweepAngle,useCenter) #
Add an arc defined by center and radius.
arc(center: Vec2, radius: Vec2, startAngle: number, sweepAngle: number, useCenter: boolean): void
Parameters:
center— Center of the arc.radius— Radius or ellipse radii (Vec2 for elliptical arcs).startAngle— Start angle in radians.sweepAngle— Sweep angle in radians.useCenter— Whether to connect to the center point.
path.close() #
Close the current contour (connect last point to first point).
close(): void
path.concat(path) #
Append another path to the end of this one.
concat(path: Path): void
path.ptsAt(index) #
Get the point at the specified index.
ptsAt(index: Uint): Vec2
path.verbsAt(index) #
Get the verb (command) at the specified index.
verbsAt(index: Uint): PathVerb
path.getEdgeLines(precision?) #
Convert curves into line segments and return all edge points.
getEdgeLines(precision: any, precision?: number): Vec2[]
Parameters:
precision— Approximation tolerance (smaller = higher precision, default = 1.0).
Returns: An array of Vec2 representing the edges.
path.getTriangles(precision?,z?) #
Triangulate the filled region of the path.
getTriangles(precision: any, z: any, precision?: number, z?: number): Vec3[]
Parameters:
precision— Approximation tolerance (default = 1.0).z— Optional Z value for the vertices (default = 0).
Returns: An array of Vec3 vertices (each triple = one triangle).
path.getAASideTriangles(width,precision?) #
Generate anti-aliased side triangles and body triangles.
getAASideTriangles(width: number, precision: any, precision?: number): Vec3[]
Parameters:
width— Stroke width.precision— Approximation tolerance (default = 1.0).
Returns: Array of Vec3 triangles for anti-aliased side and body rendering.
path.dashPath(stage,offset?) #
Convert the path into a dashed path.
dashPath(stage: number[], offset: any, offset?: number): Path
Parameters:
stage— An array of segment lengths (e.g. [dash, gap, dash, gap, ...]).Each value represents a **distance along the path** in the same coordinate units. Even indices (0, 2, 4, …) are drawn segments; odd indices are skipped segments.offset— Optional phase offset along the path (default = 0).
Returns: A new path containing the dashed version.
path.strokePath(width,cap?,join?,miterLimit?) #
Generate a stroke path from the current shape.
strokePath(width: number, cap: any, join: any, miterLimit: any, cap?: Cap, join?: Join, miterLimit?: number): Path
Parameters:
width— Stroke width.cap— Line cap style (butt, round, square).join— Line join style (miter, round, bevel).miterLimit— Maximum miter ratio.
Returns: A new path representing the stroked outline.
path.normalizedPath(precision?) #
Flatten path, convert bezier to line segments.
normalizedPath(precision: any, precision?: number): this
Parameters:
precision— this is the scale of the number of segments,the larger the value, the more segments (default is 1.0)
Returns: The flattened path (this).
path.transform(matrix) #
Apply a transformation matrix to the path.
transform(matrix: Mat): void
Parameters:
matrix— Transformation matrix.
path.scale(scale) #
Scale the path by a given factor.
scale(scale: Vec2): void
Parameters:
scale— Scale vector (x, y).
path.seal() #
seal path, after sealed, path data can not be modified
seal(): void
path.getBounds(matrix?) #
Get the path's bounding box.
getBounds(matrix: any, matrix?: Mat): Range
Parameters:
matrix— Optional transform matrix (fast path if identity).
Returns: The bounding region.
path.copy() #
Create a copy of this path.
copy(): Path
Returns: A new Path instance that is a copy of this path.
path.hashCode() #
Generate a hash code for the path.
hashCode(): Int
Returns: The hash code as an integer.