Module Graphics-PIXI

class type _t = { ... }
type t = Js.t(_t);

The Graphics class contains methods used to draw primitive shapes such as lines, circles and rectangles to the display, and to color and fill them. Note that because Graphics can share a GraphicsGeometry with other instances, it is necessary to call destroy() to properly dereference the underlying GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same Graphics instance and call clear() between redraws.

let beginTextureFillOptions: ?⁠texture:Js.t(PIXI.Texture.#_t) => ?⁠color:int => ?⁠alpha:float => ?⁠matrix:Js.t(PIXI.Matrix.#_t) => unit => Js.t({. texture: Js.undefined(Js.t(PIXI.Texture.#_t)), color: Js.undefined(int), alpha: Js.undefined(float), matrix: Js.undefined(Js.t(PIXI.Matrix.#_t)), });
let lineStyleOptions: ?⁠width:float => ?⁠color:int => ?⁠alpha:float => ?⁠alignnment:float => ?⁠native:bool => unit => Js.t({. width: Js.undefined(float), color: Js.undefined(int), alpha: Js.undefined(float), alignnment: Js.undefined(float), native: Js.undefined(bool), });
let lineTextureStyleOptions: ?⁠width:float => ?⁠texture:PIXI.Texture.t => ?⁠color:int => ?⁠alpha:float => ?⁠matrix:PIXI.Matrix.t => ?⁠alignment:float => ?⁠native:bool => unit => Js.t({. width: Js.undefined(float), texture: Js.undefined(PIXI.Texture.t), color: Js.undefined(int), alpha: Js.undefined(float), matrix: Js.undefined(PIXI.Matrix.t), alignment: Js.undefined(float), native: Js.undefined(bool), });
module Impl: { ... };
include PIXI.EventEmitter.Impl;
let create: unit => PIXI.EventEmitter.t;
let eventNames: Js.t(PIXI.EventEmitter._t) => array(string);
let listeners: Js.t(PIXI.EventEmitter._t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => array((Js.t({.. }) => unit));
let listenerCount: Js.t(PIXI.EventEmitter._t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => int;
let emit: Js.t(PIXI.EventEmitter._t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => bool;
let on: Js.t(PIXI.EventEmitter._t as 'd) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('d);
let addListener: Js.t(PIXI.EventEmitter._t as 'd) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('d);
let once: Js.t(PIXI.EventEmitter._t as 'd) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('d);
let removeListener: Js.t(PIXI.EventEmitter._t as 'b) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => ?⁠fn:(Js.t({.. }) => unit) => ?⁠context:Js.t({.. }) => ?⁠once:bool => unit => Js.t('b);
let off: Js.t(PIXI.EventEmitter._t as 'b) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => ?⁠fn:(Js.t({.. }) => unit) => ?⁠context:Js.t({.. }) => ?⁠once:bool => unit => Js.t('b);
let removeAllListeners: Js.t(PIXI.EventEmitter._t as 'b) => ?⁠event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => unit => Js.t('b);
include PIXI.DisplayObject.Impl;
let create: unit => PIXI.DisplayObject.t;
let getAccessible: Js.t(PIXI.C.displayObject) => bool;
let setAccessible: Js.t(PIXI.C.displayObject) => bool => unit;
let getAccessibleChildren: Js.t(PIXI.C.displayObject) => bool;
let setAccessibleChildren: Js.t(PIXI.C.displayObject) => bool => unit;
let getAccessibleHint: Js.t(PIXI.C.displayObject) => string;
let setAccessibleHint: Js.t(PIXI.C.displayObject) => string => unit;
let getAccessibleTitle: Js.t(PIXI.C.displayObject) => Js.Nullable.t(string);
let setAccessibleTitle: Js.t(PIXI.C.displayObject) => Js.Nullable.t(string) => unit;
let getAccessibleType: Js.t(PIXI.C.displayObject) => string;
let setAccessibleType: Js.t(PIXI.C.displayObject) => string => unit;
let getAlpha: Js.t(PIXI.C.displayObject) => float;
let setAlpha: Js.t(PIXI.C.displayObject) => float => unit;
let getAngle: Js.t(PIXI.C.displayObject) => float;
let setAngle: Js.t(PIXI.C.displayObject) => float => unit;
let getButtonMode: Js.t(PIXI.C.displayObject) => bool;
let setButtonMode: Js.t(PIXI.C.displayObject) => bool => unit;
let getCacheAsBitmap: Js.t(PIXI.C.displayObject) => bool;
let setCacheAsBitmap: Js.t(PIXI.C.displayObject) => bool => unit;
let getCursor: Js.t(PIXI.C.displayObject) => string;
let setCursor: Js.t(PIXI.C.displayObject) => string => unit;
let getFilterArea: Js.t(PIXI.C.displayObject) => Js.Nullable.t(Js.t(PIXI.Rectangle._t));
let setFilterArea: Js.t(PIXI.C.displayObject) => Js.Nullable.t(Js.t(PIXI.Rectangle._t)) => unit;
let getFilters: Js.t(PIXI.C.displayObject) => Js.Nullable.t(array(PIXI.Filter.t));
let setFilters: Js.t(PIXI.C.displayObject) => Js.Nullable.t(array(PIXI.Filter.t)) => unit;
let getHitArea: Js.t(PIXI.C.displayObject) => 'hitArea;
let setHitArea: Js.t(PIXI.C.displayObject) => 'hitArea => unit;
let getInteractive: Js.t(PIXI.C.displayObject) => bool;
let setInteractive: Js.t(PIXI.C.displayObject) => bool => unit;
let getIsMask: Js.t(PIXI.C.displayObject) => bool;
let getIsSprite: Js.t(PIXI.C.displayObject) => bool;
let getLocalTransform: Js.t(PIXI.C.displayObject) => Js.t(PIXI.Matrix._t);
let getMask: Js.t(PIXI.C.displayObject) => 'mask;
let setMask: Js.t(PIXI.C.displayObject) => 'mask => unit;
let getName: Js.t(PIXI.C.displayObject) => Js.Nullable.t(string);
let setName: Js.t(PIXI.C.displayObject) => Js.Nullable.t(string) => unit;
let getParent: Js.t(PIXI.C.displayObject) => Js.Nullable.t(PIXI.C.container);
let getPivot: Js.t(PIXI.C.displayObject) => Js.t(PIXI.ObservablePoint._t);
let setPivot: Js.t(PIXI.C.displayObject) => Js.t(PIXI.ObservablePoint._t) => unit;
let getPosition: Js.t(PIXI.C.displayObject) => Js.t(PIXI.ObservablePoint._t);
let setPosition: Js.t(PIXI.C.displayObject) => Js.t(PIXI.ObservablePoint._t) => unit;
let getRenderable: Js.t(PIXI.C.displayObject) => bool;
let setRenderable: Js.t(PIXI.C.displayObject) => bool => unit;
let getRotation: Js.t(PIXI.C.displayObject) => float;
let setRotation: Js.t(PIXI.C.displayObject) => float => unit;
let getScale: Js.t(PIXI.C.displayObject) => Js.t(PIXI.ObservablePoint._t);
let setScale: Js.t(PIXI.C.displayObject) => Js.t(PIXI.ObservablePoint._t) => unit;
let getSkew: Js.t(PIXI.C.displayObject) => Js.t(PIXI.ObservablePoint._t);
let setSkew: Js.t(PIXI.C.displayObject) => Js.t(PIXI.ObservablePoint._t) => unit;
let getTransform: Js.t(PIXI.C.displayObject) => Js.t(PIXI.Transform._t);
let getVisible: Js.t(PIXI.C.displayObject) => bool;
let setVisible: Js.t(PIXI.C.displayObject) => bool => unit;
let getWorldAlpha: Js.t(PIXI.C.displayObject) => float;
let getWorldTransform: Js.t(PIXI.C.displayObject) => Js.t(PIXI.Matrix._t);
let getWorldVisible: Js.t(PIXI.C.displayObject) => bool;
let getX: Js.t(PIXI.C.displayObject) => float;
let setX: Js.t(PIXI.C.displayObject) => float => unit;
let getY: Js.t(PIXI.C.displayObject) => float;
let setY: Js.t(PIXI.C.displayObject) => float => unit;
let getZIndex: Js.t(PIXI.C.displayObject) => float;
let setZIndex: Js.t(PIXI.C.displayObject) => float => unit;
let _recursivePostUpdateTransform: Js.t(PIXI.C.displayObject) => unit;
let destroy: Js.t(PIXI.C.displayObject) => unit;
let getBounds: Js.t(PIXI.C.displayObject) => ?⁠skipUpdate:bool => ?⁠rect:Js.t(PIXI.Rectangle._t) => unit => Js.t(PIXI.Rectangle._t);
let getGlobalPosition: Js.t(PIXI.C.displayObject) => ?⁠point:Js.t(PIXI.Point._t) => ?⁠skipUpdate:bool => unit => Js.t(PIXI.Point._t);
let getLocalBounds: Js.t(PIXI.C.displayObject) => ?⁠rectangle:Js.t(PIXI.Rectangle._t) => unit => Js.t(PIXI.Rectangle._t);
let setContainer: Js.t(PIXI.C.displayObject) => Js.t(PIXI.C.container as 'b) => Js.t('b);
let setTransform: Js.t(PIXI.C.displayObject) => ?⁠x:float => ?⁠y:float => ?⁠scaleX:float => ?⁠scaleY:float => ?⁠rotation:float => ?⁠skewX:float => ?⁠skewY:float => ?⁠pivotX:float => ?⁠pivotY:float => unit => PIXI.DisplayObject.t;
let toGlobal: Js.t(PIXI.C.displayObject) => position:[ `ObservablePoint(PIXI.ObservablePoint.t) | `Point(PIXI.Point.t) ] => ?⁠point:PIXI.Point.t => ?⁠skipUpdate:bool => unit => PIXI.Point.t;
let toLocal: Js.t(PIXI.C.displayObject) => position:[ `ObservablePoint(PIXI.ObservablePoint.t) | `Point(PIXI.Point.t) ] => ?⁠from:PIXI.DisplayObject.t => ?⁠point:PIXI.Point.t => ?⁠skipUpdate:bool => unit => PIXI.Point.t;
let updateTransform: Js.t(PIXI.C.displayObject) => unit;
include PIXI.Container.Impl;
let create: unit => PIXI.Container.t;
let createDestroyOptions: ?⁠children:bool => ?⁠texture:bool => ?⁠baseTexture:bool => unit => Js.t({. baseTexture: Js.undefined(bool), children: Js.undefined(bool), texture: Js.undefined(bool), });
let getChildren: Js.t(PIXI.C.container) => array(Js.t(PIXI.C.displayObject));
let getHeight: Js.t(PIXI.C.container) => float;
let setHeight: Js.t(PIXI.C.container) => float => unit;
let getInteractiveChildren: Js.t(PIXI.C.container) => bool;
let setInteractiveChildren: Js.t(PIXI.C.container) => bool => unit;
let getSortableChildren: Js.t(PIXI.C.container) => bool;
let setSortableChildren: Js.t(PIXI.C.container) => bool => unit;
let getSortDirty: Js.t(PIXI.C.container) => bool;
let setSortDirty: Js.t(PIXI.C.container) => bool => unit;
let getWidth: Js.t(PIXI.C.container) => float;
let setWidth: Js.t(PIXI.C.container) => float => unit;
let addChild: Js.t(PIXI.C.container) => Js.t(PIXI.C.displayObject as 'b) => Js.t('b);
let addChildAt: Js.t(PIXI.C.container) => Js.t(PIXI.C.displayObject as 'b) => index:int => Js.t('b);
let calculateBounds: Js.t(PIXI.C.container) => unit;
let _destroy: Js.t(PIXI.C.container) => ?⁠options:'a => unit => unit;
let destroy: Js.t(PIXI.C.container) => ?⁠options:Js.t({. baseTexture: Js.undefined(bool), children: Js.undefined(bool), texture: Js.undefined(bool), }) => unit => unit;
let getChildAt: Js.t(PIXI.C.container) => int => Js.t(PIXI.C.displayObject);
let getChildByName: Js.t(PIXI.C.container) => string => Js.t(PIXI.C.displayObject);
let getChildIndex: Js.t(PIXI.C.container) => Js.t(PIXI.C.displayObject) => int;
let removeChild: Js.t(PIXI.C.container) => Js.t(PIXI.C.displayObject as 'b) => Js.t('b);
let removeChildAt: Js.t(PIXI.C.container) => int => Js.t(PIXI.C.displayObject);
let removeChildren: Js.t(PIXI.C.container) => ?⁠beginIndex:int => ?⁠endIndex:int => unit => array(Js.t(PIXI.C.displayObject));
let renderCanvas: Js.t(PIXI.C.container) => Js.t(PIXI.AbstractRenderer._t) => unit;
let setChildIndex: Js.t(PIXI.C.container) => int => unit;
let sortChildren: Js.t(PIXI.C.container) => unit;
let swapChildren: Js.t(PIXI.C.container) => Js.t(PIXI.C.displayObject) => Js.t(PIXI.C.displayObject) => unit;
include Impl;
let create: ?⁠geometry:PIXI.GraphicsGeometry.t => unit => t;
let arc: Js.t(_t as 'a) => cx:float => cy:float => radius:float => startAngle:float => endAngle:float => ?⁠anticlockwise:bool => unit => Js.t('a);

The arc method creates an arc/curve (used to create circles, or parts of circles).

parameter cx

The x-coordinate of the center of the circle

parameter cy

The y-coordinate of the center of the circle

parameter radius

The radius of the circle

parameter startAngle

The starting angle, in radians (0 is at the 3 o'clock position of the arc's circle)

parameter endAngle

The ending angle, in radians

parameter anticlockwise

Specifies whether the drawing should be counter-clockwise or clockwise. False is default, and indicates clockwise, while true indicates counter-clockwise.

let arcTo: Js.t(_t as 'a) => x1:float => y1:float => x2:float => y2:float => radius:float => Js.t('a);

The arcTo() method creates an arc/curve between two tangents on the canvas.

parameter x1

The x-coordinate of the first tangent point of the arc

parameter y1

The y-coordinate of the first tangent point of the arc

parameter x2

The x-coordinate of the end of the arc

parameter y2

The y-coordinate of the end of the arc

parameter radius

The radius of the arc

let beginFill: Js.t(_t as 'a) => ?⁠color:int => ?⁠alpha:float => unit => Js.t('a);

Specifies a simple one-color fill that subsequent calls to other Graphics methods (such as lineTo() or drawCircle()) use when drawing.

parameter color

the color of the fill

parameter alpha

the alpha of the fill

let beginHole: Js.t(_t as 'a) => Js.t('a);
let _beginTextureFill: Js.t(_t as 'a) => options:'o => unit => Js.t('a);
let beginTextureFill: Js.t(_t as 'a) => ?⁠options:Js.t({. alpha: Js.undefined(float), color: Js.undefined(int), matrix: Js.undefined(Js.t(PIXI.Matrix._t)), texture: Js.undefined(Js.t(PIXI.Texture._t)), }) => unit => Js.t('a);

Begin the texture fill

parameter options

use Graphics.beginTextureFillOptions

let bezierCurveTo: Js.t(_t as 'a) => cpX:float => cpY:float => cpX2:float => cpY2:float => toX:float => toY:float => Js.t('a);

Calculate the points for a bezier curve and then draws it.

parameter cpX

Control point x

parameter cpY

Control point y

parameter cpX2

Second control point X

parameter cpY2

Second control point Y

parameter toX

Destination point x

parameter toY

Destination point y

let clear: Js.t(_t as 'a) => Js.t('a);

Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.

let clone: Js.t(_t as 'a) => Js.t('a);

Creates a new Graphics object with the same values as this one. Note that the only the properties of the object are cloned, not its transform (position,scale,etc)

let closePath: Js.t(_t as 'a) => Js.t('a);

Closes the current path.

let containsPoint: Js.t(_t) => PIXI.Point.t => bool;

Tests if a point is inside this graphics object

parameter point

point to test

let drawCircle: Js.t(_t as 'a) => x:float => y:float => radius:float => Js.t('a);

Draws a circle.

parameter x

The X coordinate of the center of the circle

parameter y

The Y coordinate of the center of the circle

parameter radius

The radius of the circle

let drawEllipse: Js.t(_t as 'a) => x:float => y:float => width:float => height:float => Js.t('a);

Draws an ellipse.

parameter x

The X coordinate of the center of the ellipse

parameter y

The Y coordinate of the center of the ellipse

parameter width

The half width of the ellipse

parameter height

The half height of the ellipse

let drawPolygon: Js.t(_t as 'a) => [ `Array(array(float)) | `Point(array(PIXI.Point.t)) | `Polygon(PIXI.Polygon.t) ] => Js.t('a);

Draws a polygon using the given path.

parameter The

path data used to construct the polygon.

let drawRect: Js.t(_t as 'a) => x:float => y:float => width:float => height:float => Js.t('a);

Draws a rectangle shape.

parameter x

The X coord of the top-left of the rectangle

parameter y

The Y coord of the top-left of the rectangle

parameter width

The width of the rectangle

parameter height

The height of the rectangle

let drawRoundedRect: Js.t(_t as 'a) => x:float => y:float => width:float => height:float => radius:float => Js.t('a);

Draws a rectangle shape.

parameter x

The X coord of the top-left of the rectangle

parameter y

The Y coord of the top-left of the rectangle

parameter width

The width of the rectangle

parameter height

The height of the rectangle

parameter radius

Radius of the rectangle corners

let drawShape: Js.t(_t as 'a) => [ `Circle(Js.t(PIXI.Circle.#_t)) | `Ellipse(Js.t(PIXI.Ellipse.#_t)) | `Polygon(Js.t(PIXI.Polygon.#_t)) | `Rectangle(Js.t(PIXI.Rectangle.#_t)) | `RoundedRectangle(Js.t(PIXI.RoundedRectangle.#_t)) ] => Js.t('a);

Draw any shape.

parameter shape

shape to draw

let drawStar: Js.t(_t as 'a) => x:float => y:float => points:int => radius:float => ?⁠innerRadius:float => ?⁠rotation:float => unit => Js.t('a);

Draw a star shape with an arbitrary number of points.

parameter x

Center X position of the star

parameter y

Center Y position of the star

parameter points

The number of points of the star, must be > 1

parameter radius

The outer radius of the star

parameter innerRadius

The inner radius between points, default half radius

parameter rotation

The rotation of the star in radians, where 0 is vertical

let endFill: Js.t(_t as 'a) => Js.t('a);

Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.

let endHole: Js.t(_t as 'a) => Js.t('a);

End adding holes to the last draw shape

let generateCanvasTexture: Js.t(_t) => scaleMode:float => resolution:float => PIXI.Texture.t;

Generates a canvas texture. Only available with pixi.js-legacy bundle or the @pixi/canvas-graphics package.

let isFastRect: Js.t(_t) => bool;

True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and masked with gl.scissor.

let lineStyle: Js.t(_t as 'a) => ?⁠width:float => ?⁠color:int => ?⁠alpha:float => ?⁠alignment:float => ?⁠native:bool => unit => Js.t('a);

Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.

let _lineStyleWithOptions: Js.t(_t as 'a) => ?⁠options:'o => unit => Js.t('a);
let lineStyleWithOptions: Js.t(_t as 'a) => ?⁠options:Js.t({. alignnment: Js.undefined(float), alpha: Js.undefined(float), color: Js.undefined(int), native: Js.undefined(bool), width: Js.undefined(float), }) => unit => Js.t('a);

Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.

let _lineTextureStyle: Js.t(_t as 'a) => ?⁠options:'o => unit => Js.t('a);
let lineTextureStyle: Js.t(_t as 'a) => ?⁠options:Js.t({. alignment: Js.undefined(float), alpha: Js.undefined(float), color: Js.undefined(int), matrix: Js.undefined(PIXI.Matrix.t), native: Js.undefined(bool), texture: Js.undefined(PIXI.Texture.t), width: Js.undefined(float), }) => unit => Js.t('a);

Like line style but support texture for line fill.

let lineTo: Js.t(_t as 'a) => x:float => y:float => Js.t('a);

Draws a line using the current line style from the current drawing position to (x, y); The current drawing position is then set to (x, y).

parameter x

the X coordinate to draw to

parameter y

the Y coordinate to draw to

let moveTo: Js.t(_t as 'a) => x:float => y:float => Js.t('a);

Moves the current drawing position to x, y.

parameter x

the X coordinate to move to

parameter y

the Y coordinate to move to

let quadraticCurveTo: Js.t(_t as 'a) => cpX:float => cpY:float => toX:float => toY:float => Js.t('a);

Calculate the points for a quadratic bezier curve and then draws it.

parameter cpX

Control point x

parameter cpY

Control point y

parameter toX

Destination point x

parameter toY

Destination point y

let setMatrix: Js.t(_t as 'a) => Js.t(PIXI.Matrix.#_t) => Js.t('a);

Apply a matrix to the positional data.

parameter matrix

Matrix to use for transform current shape.