Generalized convenience utilities for PIXI.
Example
// Extend PIXI's internal Event Emitter.
class MyEmitter extends PIXI.utils.EventEmitter {
constructor() {
super();
console.log("Emitter created!");
}
}
// Get info on current device
console.log(PIXI.utils.isMobile);
// Convert hex color to string
console.log(PIXI.utils.hex2string(0xff00ff)); // returns: "#ff00ff"
Classes
Namespaces
Members
-
maps premultiply flag and blendMode to adjusted blendMode
Methods
-
Removes all textures from cache, but does not destroy them
-
changes blendMode according to texture format
Name Type Description blendModenumber supposed blend mode
premultipliedboolean whether source is premultiplied
Returns:
Type Description number true blend mode for this texture -
PIXI.utils.decomposeDataUri (dataUri)PIXI.utils~DecomposedDataUri | undefined static
-
Split a data URI into components. Returns undefined if parameter
dataUriis not a valid data URI.Name Type Description dataUristring the data URI to check
Returns:
Type Description PIXI.utils~DecomposedDataUri | undefined The decomposed data uri or undefined -
Destroys all texture in the cache
-
Name Type Default Description verticesArray.<number> A flat array of vertice coordinates
holesArray.<number> optional An array of hole indices
dimensionsnumber 2 optional The number of coordinates per vertice in the input array
Returns:
Type Description Array.<number> Triangulated polygon -
combines rgb and alpha to out array
Name Type Default Description rgbFloat32Array | Array.<number> input rgb
alphanumber alpha param
outFloat32Array optional output
premultiplyboolean true optional do premultiply it
Returns:
Type Description Float32Array vec4 rgba -
premultiplies tint
Name Type Description tintnumber integet RGB
alphanumber floating point alpha (0.0-1.0)
Returns:
Type Description number tint multiplied by alpha -
converts integer tint and float alpha to vec4 form, premultiplies by default
Name Type Default Description tintnumber input tint
alphanumber alpha param
outFloat32Array optional output
premultiplyboolean true optional do premultiply it
Returns:
Type Description Float32Array vec4 rgba -
get the resolution / device pixel ratio of an asset by looking for the prefix used by spritesheets and image urls
Name Type Default Description urlstring the image path
defaultValuenumber 1 optional the defaultValue if no filename prefix is set.
Returns:
Type Description number resolution / device pixel ratio of an asset -
- See:
-
- PIXI.SVGResource.getSize
-
Converts a hex color number to an [R, G, B] array
Name Type Default Description hexnumber The number to convert
outArray.<number> [] optional If supplied, this array will be used rather than returning a new one
Returns:
Type Description Array.<number> An array representing the [R, G, B] of the color. -
Converts a hex color number to a string.
Name Type Description hexnumber Number in hex
Returns:
Type Description string The string color. -
Returns:
Type Description Object -
Helper for checking for webgl support
Returns:
Type Description boolean is webgl supported -
Returns:
Type Description Object -
Converts a color as an [R, G, B] array to a hex number
Name Type Description rgbArray.<number> rgb array
Returns:
Type Description number The color number -
Logs out the version and renderer information for this running instance of PIXI. If you don't want to see this message you can run
PIXI.utils.skipHello()before creating your renderer. Keep in mind that doing that will forever makes you a jerk face.Name Type Description typestring The string renderer type to log.
-
Returns sign of number
Name Type Description nnumber the number to check the sign of
Returns:
Type Description number 0 if nis 0, -1 ifnis negative, 1 ifnis positive -
Skips the hello message of renderers that are created after this is run.
-
Gets the next unique identifier
Returns:
Type Description number The next unique identifier to use.
Type Definitions
-
Typedef for decomposeDataUri return object.
Properties:
Name Type Description MediamediaType type, eg.
imageSubsubType type, eg.
pngDataencoding encoding, eg.
base64Thedata actual data