Image.Builder
com.jsmacrosce.jsmacros.client.api.classes.render.components.Image.Builder
Builds an image element for an overlay. Destination dimensions and texture-region dimensions are configured independently; texture dimensions default to 256 by 256.
Position and destination dimensions default to zero, tint to opaque white, rotation to zero, and rotation about the center to true. Without an identifier, the built image has no texture to draw.
const draw = Hud.createDraw2D();
draw.imageBuilder("minecraft:item/diamond").pos(10, 10).size(16, 16).buildAndAdd();
draw.register();Nested type declared in Image.
Constructors
new Image.Builder
Methods
alpha
Parameters:
alpha: the alpha value of the color
color
Parameters:
color: the color of the image
Parameters:
r: the red component of the colorg: the green component of the colorb: the blue component of the color
a separately as alpha.Parameters:
r: the red component of the colorg: the green component of the colorb: the blue component of the colora: the alpha component of the color
Parameters:
color: the color of the imagealpha: the alpha value of the color
createElement
fromCustomImage
Parameters:
customImage: the custom image to use
getAlpha
getColor
getHeight
getIdentifier
getImageX
getImageY
getParentHeight
getParentHeight(): int#getParentWidth
getParentWidth(): int#getRegionHeight
getRegionWidth
getRotation
[-180, 180).getScaledHeight
getScaledHeight(): int#getScaledLeft
getScaledLeft(): int#getScaledTop
getScaledTop(): int#getScaledWidth
getScaledWidth(): int#getTextureHeight
getTextureWidth
getWidth
getX
fromCustomImage resets it to zero.getY
fromCustomImage resets it to zero.getZIndex
height
Parameters:
height: the height of the image
identifier
Parameters:
identifier: the identifier of the image to use
imagePos
Parameters:
imageX: the x position in the image texture to start drawing fromimageY: the y position in the image texture to start drawing from
imageX
Parameters:
imageX: the x position in the image texture to start drawing from
imageY
Parameters:
imageY: the y position in the image texture to start drawing from
isRotatingCenter
true.true if this image should be rotated around its center, false otherwise.moveTo
moveTo(int x, int y): Image.Builder#Parameters:
x: the new x positiony: the new y position
pos
Parameters:
x: the x position of the imagey: the y position of the image
regionHeight
Parameters:
regionHeight: the height of the region to draw
regions
Parameters:
x: the x position in the image texture to start drawing fromy: the y position in the image texture to start drawing fromwidth: the width of the region to drawheight: the height of the region to draw
regions(int x, int y, int width, int height, int textureWidth, int textureHeight): Image.BuilderSince1.8.4#Parameters:
x: the x position in the image texture to start drawing fromy: the y position in the image texture to start drawing fromwidth: the width of the region to drawheight: the height of the region to drawtextureWidth: the width of the used texturetextureHeight: the height of the used texture
regionSize
Parameters:
regionWidth: the width of the region to drawregionHeight: the height of the region to draw
regionWidth
Parameters:
regionWidth: the width of the region to draw
rotateCenter
Parameters:
rotateCenter: whether the image should be rotated around its center
rotation
[-180, 180).Parameters:
rotation: the rotation (clockwise) of the image in degrees
size
Parameters:
width: the width of the imageheight: the height of the image
textureHeight
Parameters:
textureHeight: the height of the used texture
textureSize
Parameters:
textureWidth: the width of the used texturetextureHeight: the height of the used texture
textureWidth
Parameters:
textureWidth: the width of the used texture
width
Parameters:
width: the width of the image
x
Parameters:
x: the x position of the image
y
Parameters:
y: the y position of the image
zIndex
Parameters:
zIndex: the z-index of the image