Module Graphics-PIXI.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.