GPU - image
Drawable Image, not modifiable, convert to imageData to modify.
- Available since: GPU: v1.0.0, LIKO-12: v0.6.0
- Last updated in: GPU: v1.0.0, LIKO-12: v0.8.0
Methods:
image:data
Returns the imagedata object of this image, which can be used to set and get pixels of the image.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
This function is fast, unlike imagedata:image()
imgdata = image:data()
Returns:
- imgdata (GPU/imageData): The imagedata object of this image.
image:draw
Draws the image on the screen.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
image:draw(x, y, r, sw, sh, q)
Arguments:
- [x] (number) (Default:
0
): The top-left image corner x position. - [y] (number) (Default:
0
): The top-left image corner y position. - [r] (number) (Default:
0
): The image rotation in radians. - [sw] (number) (Default:
1
): The image width scale. - [sh] (number) (Default:
1
): The image height scale. - [q] (GPU/quad) (Default:
nil
): Optional, A quad to draw the image with, check GPU.quad for more info.
image:height
Returns the image height.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
height = image:height()
Returns:
- height (number): The image height in pixels.
image:quad
Creates a new quad passing the image dimensions automatically.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
q = image:quad(x, y, width, height)
Arguments:
- <x> (number): The x coord of the quad's top-left corner.
- <y> (number): The y coord of the quad's top-left corner.
- <width> (number): The width of the quad.
- <height> (number): The height of the quad.
Returns:
- q (GPU/quad): The created quad.
image:refresh
Reloads the Image's contents from the ImageData used to create the image.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
image:refresh()
image:size
Returns the image dimensions.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
width, height = image:size()
Returns:
- width (number): The image width in pixels.
- height (number): The image height in pixels.
image:type
Gets the type of the object as a string.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
type = image:type()
Returns:
- type (string): The object type, (GPU.image).
image:typeOf
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
For GPUImg, it returns true for the folowing types: 'GPU', 'image', 'GPU.image', 'LK12'
bool = image:typeOf(type)
Arguments:
- <type> (string): The name of the type to check for.
Returns:
- bool (boolean): True if the object is of the specified type, false otherwise.
image:width
Returns the image width.
- Available since: image: v1.0.0, LIKO-12: v0.6.0
- Last updated in: image: v1.0.0, LIKO-12: v0.6.0
width = image:width()
Returns:
- width (number): The image width in pixels.