Module Extract-PIXI.Extract
type t;The extract manager provides functionality to export content from the renderers. An instance of this class is automatically created by default, and can be found at renderer.plugins.extract
let create: renderer:rendererOpaque => t;creates a new extract instance
- parameter renderer
a reference to the current renderer
let base64: t => ?target:[ `DisplayObject(displayObjectOpaque) | `RenderTexture(renderTextureOpaque) ] => ?quality:float => unit => string;Will return a a base64 encoded string of this target. It works by calling Extract.getCanvas and then running toDataURL on that
- parameter target
A displayObject or renderTexture to convert. If left empty will use the main renderer
- parameter format
Image format, e.g. "image/jpeg" or "image/webp"
- parameter quality
JPEG or Webp compression from 0 to 1. Default is 0.92
- returns
A base64 encoded string of the texture.
let canvas: t => target:[ `DisplayObject(displayObjectOpaque) | `RenderTexture(renderTextureOpaque) ] => Webapi.Dom.HtmlElement.t;Creates a Canvas element, renders this target to it and then returns it
- parameter target
A displayObject or renderTexture to convert. If left empty will use the main renderer
- returns
A Canvas element with the texture rendered on
let destroy: t => unit;Destroys the extract
let image: t => ?target:[ `DisplayObject(displayObjectOpaque) | `RenderTexture(renderTextureOpaque) ] => ?format:string => ?quality:float => unit => Webapi.Dom.HtmlImageElement.t;Will return a HTML Image of the target
- parameter target
A displayObject or renderTexture to convert. If left empty will use the main renderer
- parameter format
Image format, e.g. "image/jpeg" or "image/webp"
- parameter quality
JPEG or Webp compression from 0 to 1. Default is 0.92
- returns
HTML Image of the target
let pixels: t => target:[ `DisplayObject(displayObjectOpaque) | `RenderTexture(renderTextureOpaque) ] => Js.Typed_array.Uint8Array.t;Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included)
- parameter target
A displayObject or renderTexture to convert. If left empty will use the main renderer
- returns
one-dimensional array containing the pixel data of the entire texture