new Texture(options)
Texture represents an "image", ready to be rendered to
a renderer, with high efficiency. The efficiency comes
from the fact that a cached image can be renderer faster.
Parameters:
Name | Type | Argument | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Object with the options to instantiate a texture.
Properties
|
- Source:
Members
-
<private> buffer :Grape2D.CanvasRenderer
-
The canvas buffer. It is always a 2D renderer.
Type:
- Source:
-
<private> height :number
-
The height.
Type:
- number
- Source:
-
<private> hheight :number
-
The half width.
Type:
- number
- Source:
-
<private> hwidth :number
-
The half width.
Type:
- number
- Source:
-
<private> width :number
-
The width of the texture.
Type:
- number
- Source:
Methods
-
<static> createFromImage(src, callback) → {Grape2D.Texture}
-
Creates a Texture and loads an image asynchronously.
Parameters:
Name Type Description src
string The complete path to the image. callback
Function A function to be called after the onload event of the image. - Source:
Returns:
The texture object, initialy it has an empty buffer, the buffer will have the image only after the image has done loaded.- Type
- Grape2D.Texture
-
<protected> bufferImage(image)
-
Changes the internal buffer and load an image, with it's current dimensions. The dimensions.
Parameters:
Name Type Description image
Image The DOM image object with the image. The image must be loaded. Unexpected results if not. - Source:
-
getBuffer() → {?}
-
Gets the buffer of the texture.
- Source:
Returns:
The buffer.- Type
- ?
-
getHalfHeight()
-
- Source:
-
getHalfWidth()
-
- Source:
-
getHeight()
-
- Source:
-
getWidth()
-
- Source:
-
render()
-
- Source:
-
setHeight()
-
- Source:
-
setWidth()
-
- Source: