Class: Image#

Hierarchy#

Constructors#

constructor#

new Image(file: string, sizeX: number, sizeY: number, sizeZ: number, posX: number, posY: number, posZ: number, originX: number, originY: number, originZ: number, imageType: ImageType): Image

Creates a new image, the first ID given being 0 and then counting upwards (0, 1, 2, 3, ...). Multiple images with the same type are drawn in their order of creation, meaning that the image created first is drawn below the image created after.

Parameters:#

NameTypeDescription
filestringThe path to the image. The image itself should have its border alpha-ed out completely. If an invalid path is specified CreateImage returns image(-1).
sizeXnumberThe x-dimensions of the image.
sizeYnumberThe y-dimensions of the image.
sizeZnumberThe z-dimensions of the image.
posXnumberThe x-cooridnate of where to create the image. This is the bottom left corner of the image.
posYnumberThe y-cooridnate of where to create the image. This is the bottom left corner of the image.
posZnumberThe z-cooridnate of where to create the image.
originXnumberMoves the origin (bottom left corner) of the image from posX in negative X-direction.
originYnumberMoves the origin (bottom left corner) of the image from posY in negative Y-direction.
originZnumberMoves the origin (bottom left corner) of the image from posZ in negative Z-direction.
imageTypeImageType

Returns: Image

Defined in: handles/image.ts:24

Properties#

handle#

• Readonly handle: image

Inherited from: Handle.handle

Defined in: handles/handle.ts:6

Accessors#

id#

id(): number

Get the unique ID of the handle. The ID is recycled once you destroy the object.

Returns: number

The unique ID of a handle object.

Defined in: handles/handle.ts:18

Methods#

destroy#

destroy(): void

Destroys the image specified and recycles the handle ID of that image instantly (no ref counting for images).

bug May crash the game if an invalid image is used (null, before the first image is created).

Returns: void

Defined in: handles/image.ts:66


setAboveWater#

setAboveWater(flag: boolean, useWaterAlpha: boolean): void

Every ImageType other than Selection doesnt seem to appear above water.

Parameters:#

NameTypeDescription
flagbooleanDraws the specified image above the water if the flag is true.
useWaterAlphaboolean

Returns: void

Defined in: handles/image.ts:75


setColor#

setColor(red: number, green: number, blue: number, alpha: number): void

Valid values for all channels range from 0 to 255.

Parameters:#

NameType
rednumber
greennumber
bluenumber
alphanumber

Returns: void

Defined in: handles/image.ts:82


setConstantHeight#

setConstantHeight(flag: boolean, height: number): void

This is the only function that is able to modify an image's z-offset.

Parameters:#

NameTypeDescription
flagboolean
heightnumberThe z-offset of the image.

Returns: void

Defined in: handles/image.ts:91


setPosition#

setPosition(x: number, y: number, z: number): void

Sets the X/Y position of the provided image. This is the bottom left corner of the image, unless you used values form originX/Y/Z in the constructor other than 0, in which case the bottom left corner is moved further into negative X/Y/Z direction.

Parameters:#

NameType
xnumber
ynumber
znumber

Returns: void

Defined in: handles/image.ts:100


setRender#

setRender(flag: boolean): void

Enable or disable the rendering of the image.

Parameters:#

NameTypeDescription
flagbooleanrender if true, don't render if false

Returns: void

Defined in: handles/image.ts:108


setType#

setType(imageType: ImageType): void

Change image's type.

Parameters:#

NameTypeDescription
imageTypeImageTypeInfluence the order in which images are drawn above one another.

Returns: void

Defined in: handles/image.ts:116


show#

show(flag: boolean): void

Show or hide the image depending on boolean flag. Seems like a redundant function in the light of SetImageRender(Always).

Parameters:#

NameTypeDescription
flagbooleantrue shows, false hides

Returns: void

Defined in: handles/image.ts:125


fromHandle#

static fromHandle(handle: image): Image

Parameters:#

NameType
handleimage

Returns: Image

Defined in: handles/image.ts:129