API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classGraphics

@codexo/exojs / rendering / stable

Immediate-mode 2D shape API backed by Mesh children. Each draw call (e.g. `drawCircle`, `drawRectangle`, `drawLine`) appends a new Mesh child painted with the active fill or stroke style. A style is either a solid Color or a Gradient, assigned through fillStyle / strokeStyle. The fillColor / lineColor accessors are color-only conveniences over those styles. The active `lineWidth` controls stroke thickness for path and outline draws. Path commands (`moveTo`, `lineTo`, `quadraticCurveTo`, etc.) track a cursor point and flush a Mesh on each segment. Gradient styles are rasterized once to a DataTexture via Gradient.toTexture and sampled across each shape's local bounding box, so LinearGradient and RadialGradient render through the same texture path as a textured Mesh. The textures are owned by the Graphics and released on clear / destroy. Call clear to remove all child meshes and reset pen state. Because each shape is a separate Mesh, `Graphics` inherits full filter, blend, tint, and mask support from Container.

38
props
54
methods
9
events
Import
import { Graphics } from '@codexo/exojs'

Immediate-mode 2D shape API backed by Mesh children.

Each draw call (e.g. `drawCircle`, `drawRectangle`, `drawLine`) appends a new Mesh child painted with the active fill or stroke style. A style is either a solid Color or a Gradient, assigned through fillStyle / strokeStyle. The fillColor / lineColor accessors are color-only conveniences over those styles. The active `lineWidth` controls stroke thickness for path and outline draws. Path commands (`moveTo`, `lineTo`, `quadraticCurveTo`, etc.) track a cursor point and flush a Mesh on each segment.

Gradient styles are rasterized once to a DataTexture via Gradient.toTexture and sampled across each shape's local bounding box, so LinearGradient and RadialGradient render through the same texture path as a textured Mesh. The textures are owned by the Graphics and released on clear / destroy.

Call clear to remove all child meshes and reset pen state. Because each shape is a separate Mesh, `Graphics` inherits full filter, blend, tint, and mask support from Container.

Constructors 1
new(): Graphics
Methods 54
_invalidateBoundsCascade(): void
_invalidateChildrenTransform(): void
_invalidateSubtreeTransform(): void
addChild(child: RenderNode): this
addChildAt(child: RenderNode, index: number): this
addFilter(filter: Filter): this
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this
bezierCurveTo(cpX1: number, cpY1: number, cpX2: number, cpY2: number, toX: number, toY: number): this
clear(): this
clearFilters(): this
collidesWith(target: Collidable): CollisionResponse | null
contains(x: number, y: number): boolean
destroy(): void
drawArc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): this
drawCircle(centerX: number, centerY: number, radius: number): this
drawEllipse(centerX: number, centerY: number, radiusX: number, radiusY: number): this
drawLine(startX: number, startY: number, endX: number, endY: number): this
drawPath(path: number[]): this
drawPolygon(path: number[]): this
drawRectangle(x: number, y: number, width: number, height: number): this
drawStar(centerX: number, centerY: number, points: number, radius: number, innerRadius: number, rotation: number): this
getBounds(): Rectangle
getChildAt(index: number): Mesh
getChildIndex(child: RenderNode): number
getGlobalTransform(): Matrix
getLocalBounds(): Rectangle
getNormals(): Vector[]
getTransform(): Matrix
intersectsWith(target: Collidable): boolean
invalidateCache(): this
inView(view: View): boolean
lineTo(toX: number, toY: number): this
move(x: number, y: number): this
moveTo(x: number, y: number): this
project(axis: Vector, result: Interval): Interval
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this
removeChild(child: RenderNode): this
removeChildAt(index: number): this
removeChildren(begin: number, end: number): this
removeFilter(filter: Filter): this
render(backend: RenderBackend): this
rotate(degrees: number): this
setAnchor(x: number, y: number): this
setChildIndex(child: RenderNode, index: number): this
setOrigin(x: number, y: number): this
setPosition(x: number, y: number): this
setRotation(degrees: number): this
setScale(x: number, y: number): this
setSkew(x: number, y: number): this
swapChildren(firstChild: RenderNode, secondChild: RenderNode): this
updateBounds(): this
updateParentTransform(): this
updateTransform(): this
setInternalSpriteFactory(factory: object | null): void
Properties 38
clip: boolean
clipShape: Rectangle | Geometry | null
collisionType: CollisionType
cursor: string | null
draggable: boolean
flags: Flags<SceneNodeTransformFlags>
preserveDrawOrder: boolean
anchor: ObservableVector
bottom: number
cacheAsBitmap: boolean
children: RenderNode[]
cullable: boolean
currentPoint: Vector
fillColor: Color
fillStyle: Color | Gradient
filters: readonly Filter[]
height: number
interactive: boolean
isAlignedBox: boolean
left: number
lineColor: Color
lineWidth: number
mask: MaskSource
origin: ObservableVector
parent: Container | null
position: ObservableVector
right: number
rotation: number
scale: ObservableVector
skewX: number
skewY: number
strokeStyle: Color | Gradient
top: number
visible: boolean
width: number
x: number
y: number
zIndex: number
Events 9
onDrag: Signal<[InteractionEvent]>
onDragEnd: Signal<[InteractionEvent]>
onDragStart: Signal<[InteractionEvent]>
onPointerDown: Signal<[InteractionEvent]>
onPointerMove: Signal<[InteractionEvent]>
onPointerOut: Signal<[InteractionEvent]>
onPointerOver: Signal<[InteractionEvent]>
onPointerTap: Signal<[InteractionEvent]>
onPointerUp: Signal<[InteractionEvent]>
Source