Module BaseTexture-PIXI

type t = Js.t(PIXI.C1.baseTexture);

A Texture stores the information that represents an image. All textures have a base texture, which contains information about the source. Therefore you can have many textures all using a single BaseTexture

let _createOptions: ?⁠mipmap:int => ?⁠anisotropicLevel:int => ?⁠wrapMode:int => ?⁠scaleMode:int => ?⁠format:int => ?⁠_type:int => ?⁠target:int => ?⁠alphaMode:int => ?⁠width:float => ?⁠height:float => ?⁠resolution:float => ?⁠resourceOptions:Js.t({. }) => unit => Js.t({. mipmap: Js.undefined(int), anisotropicLevel: Js.undefined(int), wrapMode: Js.undefined(int), scaleMode: Js.undefined(int), format: Js.undefined(int), _type: Js.undefined(int), target: Js.undefined(int), alphaMode: Js.undefined(int), width: Js.undefined(float), height: Js.undefined(float), resolution: Js.undefined(float), resourceOptions: Js.undefined(Js.t({. })), });
let createOptions: ?⁠mipmap:PIXI.MIPMAP_MODES.t => ?⁠anisotropicLevel:int => ?⁠wrapMode:PIXI.WRAP_MODES.t => ?⁠scaleMode:PIXI.SCALE_MODES.t => ?⁠format:PIXI.FORMATS.t => ?⁠_type:PIXI.TYPES.t => ?⁠target:PIXI.TARGETS.t => ?⁠alphaMode:PIXI.ALPHA_MODES.t => ?⁠width:float => ?⁠height:float => ?⁠resolution:float => ?⁠resourceOptions:Js.t({. }) => unit => Js.t({. _type: Js.undefined(int), alphaMode: Js.undefined(int), anisotropicLevel: Js.undefined(int), format: Js.undefined(int), height: Js.undefined(float), mipmap: Js.undefined(int), resolution: Js.undefined(float), resourceOptions: Js.undefined(Js.t({. })), scaleMode: Js.undefined(int), target: Js.undefined(int), width: Js.undefined(float), wrapMode: Js.undefined(int), });

create collection of options for base texture creation

parameter mipmap

If mipmapping is enabled for texture

parameter anisotropicLevel

Anisotropic filtering level of texture

parameter wrapMode

Wrap mode for textures

parameter scaleMode

Default scale mode, linear, nearest

parameter format

GL format type

parameter _type

GL data type

parameter target

GL texture target

parameter alphaMode

Pre multiply the image alpha

parameter width

Width of the texture

parameter height

Height of the texture

parameter resolution

Resolution of the base texture

parameter resourceOptions

Optional resource options

module Impl: { ... };
include Impl;
let _create: ?⁠resource:[ `Resource(PIXI.Resource.t) | `String(string) | `HTMLImageElement(Webapi.Dom.HtmlImageElement.t) | `HTMLCanvasElement(Webapi.Dom.Element.t) | `HTMLVideoElement(Webapi.Dom.Element.t) ] => ?⁠options:'a => unit => t;
let create: resource:[ `HTMLCanvasElement(Webapi.Dom.Element.t) | `HTMLImageElement(Webapi.Dom.HtmlImageElement.t) | `HTMLVideoElement(Webapi.Dom.Element.t) | `Resource(PIXI.Resource.t) | `String(string) ] => ?⁠options:Js.t({. _type: Js.undefined(int), alphaMode: Js.undefined(int), anisotropicLevel: Js.undefined(int), format: Js.undefined(int), height: Js.undefined(float), mipmap: Js.undefined(int), resolution: Js.undefined(float), resourceOptions: Js.undefined(Js.t({. })), scaleMode: Js.undefined(int), target: Js.undefined(int), width: Js.undefined(float), wrapMode: Js.undefined(int), }) => unit => t;

creates a new base texture

see /bs-pixi/PIXI/BaseTexture-PIXI/#val-createOptions

for options BaseTexture.createOptions

parameter resource

The current resource to use, for things that aren't Resource objects, will be converted into a Resource.

parameter options

collection of options

let get_BatchEnabled: Js.t(PIXI.C1.#baseTexture) => int;

number of the texture batch, used by multi-texture renderers

let set_BatchEnabled: Js.t(PIXI.C1.#baseTexture) => int => unit;

number of the texture batch, used by multi-texture renderers

let get_BatchLocation: Js.t(PIXI.C1.#baseTexture) => int;

location inside texture batch, used by multi-texture renderers

let set_BatchLocation: Js.t(PIXI.C1.#baseTexture) => int => unit;

location inside texture batch, used by multi-texture renderers

let _getAlphaMode: Js.t(PIXI.C1.#baseTexture) => int;
let getAlphaMode: Js.t(PIXI.C1.baseTexture) => PIXI.ALPHA_MODES.t;

How to treat premultiplied alpha

let _setAlphaMode: Js.t(PIXI.C1.#baseTexture) => int => unit;
let setAlphaMode: Js.t(PIXI.C1.baseTexture) => PIXI.ALPHA_MODES.t => unit;

How to treat premultiplied alpha

let getAnisotropicLevel: Js.t(PIXI.C1.#baseTexture) => float;

anisotropic filtering level of texture

let setAnisotropicLevel: Js.t(PIXI.C1.#baseTexture) => float => unit;

anisotropic filtering level of texture

let getCacheId: Js.t(PIXI.C1.#baseTexture) => string;

Currently default cache ID

let setCacheId: Js.t(PIXI.C1.#baseTexture) => string => unit;

Currently default cache ID

let getDestroyed: Js.t(PIXI.C1.#baseTexture) => bool;

flag if BaseTexture has been destroyed

let getDirtyId: Js.t(PIXI.C1.#baseTexture) => int;

used by TextureSystem to only update texture to the GPU when needed. Please call update() to increment it

let getFormat: Js.t(PIXI.C1.#baseTexture) => int;

the pixel format of the texture

let getHeight: Js.t(PIXI.C1.#baseTexture) => int;

The height of the base texture set when the image has loaded

let getIsPowerOfTwo: Js.t(PIXI.C1.#baseTexture) => bool;

Whether or not the texture is a power of two, try to use power of two textures as much as you can

let _getMipmap: Js.t(PIXI.C1.#baseTexture) => int;
let getMipmap: Js.t(PIXI.C1.baseTexture) => PIXI.MIPMAP_MODES.t;

Mipmap mode of the texture, affects downscaled images

let _setMipmap: Js.t(PIXI.C1.#baseTexture) => int => unit;
let setMipmap: Js.t(PIXI.C1.baseTexture) => PIXI.MIPMAP_MODES.t => unit;

Mipmap mode of the texture, affects downscaled images

let getRealHeight: Js.t(PIXI.C1.#baseTexture) => float;

Pixel height of the source of this texture

let getRealWeight: Js.t(PIXI.C1.#baseTexture) => float;

Pixel width of the source of this texture

let getResolution: Js.t(PIXI.C1.#baseTexture) => float;

The resolution / device pixel ratio of the texture

let setResolution: Js.t(PIXI.C1.#baseTexture) => float => unit;

The resolution / device pixel ratio of the texture

let getScaleMode: Js.t(PIXI.C1.#baseTexture) => int;

The scale mode to apply when scaling this texture

let setScaleMode: Js.t(PIXI.C1.#baseTexture) => int => unit;

The scale mode to apply when scaling this texture

let _getTarget: Js.t(PIXI.C1.#baseTexture) => int;
let getTarget: Js.t(PIXI.C1.baseTexture) => PIXI.TARGETS.t;

Mipmap mode of the texture, affects downscaled images

let _setTarget: Js.t(PIXI.C1.#baseTexture) => int => unit;
let setTarget: Js.t(PIXI.C1.baseTexture) => PIXI.TARGETS.t => unit;

Mipmap mode of the texture, affects downscaled images

let getTextureCacheIds: Js.t(PIXI.C1.#baseTexture) => array(string);

The collection of alternative cache ids, since some BaseTextures can have more than one ID short name and longer full URL

let getUid: Js.t(PIXI.C1.#baseTexture) => string;

Global unique identifier for this BaseTexture

let getValid: Js.t(PIXI.C1.#baseTexture) => bool;

Generally speaking means when resource is loaded

let getWidth: Js.t(PIXI.C1.#baseTexture) => bool;

The width of the base texture set when the image has loaded

let _getWrapMode: Js.t(PIXI.C1.#baseTexture) => int;
let getWrapMode: Js.t(PIXI.C1.baseTexture) => PIXI.WRAP_MODES.t;

How the texture wraps

let _setWrapMode: Js.t(PIXI.C1.#baseTexture) => int => unit;
let setWrapMode: Js.t(PIXI.C1.baseTexture) => PIXI.WRAP_MODES.t => unit;

How the texture wraps

let destroy: Js.t(PIXI.C1.#baseTexture) => unit;

Destroys this base texture. The method stops if resource doesn't want this texture to be destroyed. Removes texture from all caches.

let dispose: Js.t(PIXI.C1.#baseTexture) => unit;

Frees the texture from WebGL memory without destroying this texture object. This means you can still use the texture later which will upload it to GPU memory again

let _getDrawableSource: Js.t(PIXI.C1.#baseTexture) => Webapi.Dom.HtmlElement.t;
let getDrawableSource: Js.t(PIXI.C1.baseTexture) => PIXI.ICanvasImageSource.t;

Get the drawable source, such as HTMLCanvasElement or HTMLImageElement suitable for rendering with CanvasRenderer. Provided by @pixi/canvas-renderer package

raises Failure

when drawable source is not recognized

returns

Source to render with CanvasRenderer

let setRealSize: Js.t(PIXI.C1.#baseTexture) => realWidth:float => realHeight:float => ?⁠resolution:float => unit => Js.t(PIXI.C1.#baseTexture);

Sets real size of baseTexture, preserves current resolution.

parameter realWidth

Full rendered width

parameter realHeight

Full rendered height

parameter resolution

Optionally set resolution

returns

itself

let setResolution: Js.t(PIXI.C1.#baseTexture) => resolution:float => Js.t(PIXI.C1.#baseTexture);

Changes resolution

parameter resolution

res

returns

itself

let setResource: Js.t(PIXI.C1.#baseTexture) => resource:Js.t(PIXI.C1.#resource) => Js.t(PIXI.C1.#baseTexture);

Sets the resource if it wasn't set. Throws error if resource already present

parameter resource

that is managing this BaseTexture

returns

itself

let setSize: Js.t(PIXI.C1.#baseTexture) => width:float => height:float => ?⁠resolution:float => unit => Js.t(PIXI.C1.#baseTexture);

Changes w/h/resolution. Texture becomes valid if width and height are greater than zero

parameter width

visual width

parameter height

visual height

parameter resolution

(optional) optionally set resolution

returns

itself

let _setStyle: Js.t(PIXI.C1.#baseTexture) => ?⁠scaleMode:int => ?⁠mipmap:int => unit => Js.t(PIXI.C1.#baseTexture);
let setStyle: Js.t(PIXI.C1.baseTexture) => scaleMode:option(PIXI.SCALE_MODES.t) => mipmap:option(PIXI.MIPMAP_MODES.t) => unit => Js.t(PIXI.C1.baseTexture);

Changes style options of BaseTexture

parameter scaleMode

(optional) Pixi scalemode @parm mipmap (optional) enable mipmaps

returns

itself

let update: Js.t(PIXI.C1.#baseTexture) => unit;

Invalidates the object. Texture becomes valid if width and height are greater than zero