| Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
resource |
PIXI.resources.Resource | string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | null |
optional
The current resource to use, for things that aren't Resource objects, will be converted into a Resource. |
||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
optional
Collection of options
|
Extends
Members
-
Currently default cache ID.
-
Flag if BaseTexture has been destroyed.
-
format PIXI.FORMATS
-
The pixel format of the texture
- Default Value:
- PIXI.FORMATS.RGBA
-
The height of the base texture set when the image has loaded
-
Whether or not the texture is a power of two, try to use power of two textures as much as you can
- Default Value:
- false
-
If mipmapping was used for this texture, enable and disable with enableMipmap()
-
Set to true to enable pre-multiplied alpha
- Default Value:
- true
-
Pixel height of the source of this texture
-
Pixel width of the source of this texture
-
The resolution / device pixel ratio of the texture
- Default Value:
- PIXI.settings.RESOLUTION
-
resource PIXI.resources.Resource readonly
-
The resource used by this BaseTexture, there can only be one resource per BaseTexture, but textures can share resources.
-
The scale mode to apply when scaling this texture
- Default Value:
- PIXI.settings.SCALE_MODE
- See:
-
target PIXI.TARGETS
-
The target type
- Default Value:
- PIXI.TARGETS.TEXTURE_2D
-
The collection of alternative cache ids, since some BaseTextures can have more than one ID, short name and longer full URL
-
type PIXI.TYPES
-
The type of resource data
- Default Value:
- PIXI.TYPES.UNSIGNED_BYTE
-
Generally speaking means when resource is loaded.
-
The width of the base texture set when the image has loaded
-
How the texture wraps
Methods
-
Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.
Name Type Description baseTexturePIXI.BaseTexture The BaseTexture to add to the cache.
idstring The id that the BaseTexture will be stored against.
-
PIXI.BaseTexture.from (source, options)PIXI.BaseTexture static
-
Helper function that creates a base texture based on the source you provide. The source can be - image url, image element, canvas element. If the source is an image url or an image element and not in the base texture cache, it will be created and loaded.
Name Type Description sourcestring | HTMLImageElement | HTMLCanvasElement | SVGElement | HTMLVideoElement The source to create base texture from.
optionsobject optional See PIXI.BaseTexture's constructor for options.
Returns:
Type Description PIXI.BaseTexture The new base texture. -
PIXI.BaseTexture.fromBuffer (buffer, width, height, options)PIXI.BaseTexture static
-
Create a new BaseTexture with a BufferResource from a Float32Array. RGBA values are floats from 0 to 1.
Name Type Description bufferFloat32Array | UintArray The optional array to use, if no data is provided, a new Float32Array is created.
widthnumber Width of the resource
heightnumber Height of the resource
optionsobject optional See PIXI.BaseTexture's constructor for options.
Returns:
Type Description PIXI.BaseTexture The resulting new BaseTexture -
PIXI.BaseTexture.removeFromCache (baseTexture)PIXI.BaseTexture | null static
-
Remove a BaseTexture from the global BaseTextureCache.
Name Type Description baseTexturestring | PIXI.BaseTexture id of a BaseTexture to be removed, or a BaseTexture instance itself.
Returns:
Type Description PIXI.BaseTexture | null The BaseTexture that was removed. -
Destroys this base texture. The method stops if resource doesn't want this texture to be destroyed. Removes texture from all caches.
-
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.
Fires:
- PIXI.BaseTexture#event:dispose
-
Get the drawable source, such as HTMLCanvasElement or HTMLImageElement suitable for rendering with CanvasRenderer. Provided by @pixi/canvas-renderer package.
Returns:
Type Description CanvasImageSource Source to render with CanvasRenderer -
Sets real size of baseTexture, preserves current resolution.
Name Type Description realWidthnumber Full rendered width
realHeightnumber Full rendered height
resolutionnumber optional Optionally set resolution
Returns:
Type Description BaseTexture this -
Changes resolution
Name Type Description resolutionnumber optional res
Returns:
Type Description BaseTexture this -
Sets the resource if it wasnt set. Throws error if resource already present
Name Type Description resourcePIXI.resources.Resource that is managing this BaseTexture
Returns:
Type Description BaseTexture this -
Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.
Name Type Description widthnumber Visual width
heightnumber Visual height
resolutionnumber optional Optionally set resolution
Returns:
Type Description BaseTexture this -
Changes style options of BaseTexture
Name Type Description optionsobject scaleModePIXI.SCALE_MODES optional pixi scalemode
mipmapboolean optional enable mipmaps
Returns:
Type Description BaseTexture this -
Invalidates the object. Texture becomes valid if width and height are greater than zero.