UI. AutoBitmap

AutoBitmap A class is a display object that represents a bitmap image or draws a graph.

Encapsulates the location, width, height, and layout of the grid for use by the UI component.

Constructor

new AutoBitmap()

Extends

Member

height :Number

Represents the height of the display object, in pixels.

sizeGrid :Array

The valid scaling mesh data for the current instance.

If set to null, the entire display object will be scaled normally when any scaling conversion is applied.

Data format: top margin, right margin, lower margin, left margin, repeat padding (value 0: no repeat fill, 1: repeat fill).

  • Such as: [4,4,4,4,1]

sizeGrid

  1. top margin
  2. Right distance
  3. margin-bottom
  4. left
  5. Repeat padding (value 0: no repeat fill, 1: repeat fill)
  6. *

    When defined sizeGrid Property, the display object is split to sizeGrid

    • The area above the rectangle
    • The top right corner outside the rectangle
    • The area on the left of the rectangle
    • The area on the right of the rectangle
    • The lower left corner of the rectangle
    • The area under the rectangle
    • The lower right corner of the rectangle
    • The upper left corner of the rectangle
    • *
    At the same time also support 3 grids, such as 0,4,0,4,1 for 3 level grids, 4,0,4,0,1 vertical grids 3, 3 grids performance than the 9 house price. *

source :Texture

Texture resources for objects.
See:
  • resource.Texture

width :Number

Represents the width of the display object, in pixels.

Methods

alpha(value)

Set transparency.
Inherited From:
Parameters:
Name Type Description
value Number Transparency.

clear()

Overrides:

clearCache()

Clear command cache.

clipRect(x, y, width, height)

Sets the clipping area, which does not display coordinates beyond the clipping area.
Inherited From:
Parameters:
Name Type Description
x Number X axis offset.
y Number Y axis offset.
width Number Width.
height Number Height.

destroy()

Destroy this object.

Overrides:

drawCircle(x, y, radius, fillColor, lineColoropt, lineWidthopt)

Draw circles.
Inherited From:
Parameters:
Name Type Attributes Default Description
x Number Dot X axis position.
y Number Dot Y axis position.
radius Number Radius.
fillColor Object Fill in the color or fill the gradient object of the drawing.
lineColor Object <optional>
null lineColor (optional) border color, or the gradient object that fills the drawing.
lineWidth Number <optional>
1 lineWidth (optional) border width.

drawCurves(x, y, points, lineColor, lineWidthopt)

Draw a series of curves.
Inherited From:
Parameters:
Name Type Attributes Default Description
x Number Start drawing the X axis position.
y Number Start drawing the Y axis position.
points Array A set of points in a line segment [controlX, controlY, anchorX, anchorY...] .
lineColor Object Line segment color, or fill the drawing gradient object.
lineWidth Number <optional>
1 lineWidth (optional) line width.

drawImage(tex, xopt, yopt, widthopt, heightopt)

Inherited From:
Parameters:
Name Type Attributes Default Description
tex Texture
x Number <optional>
0 x
y Number <optional>
0 y
width Number <optional>
0 width
height Number <optional>
0 height

drawLine(fromX, fromY, toX, toY, lineColor, lineWidthopt)

Draw a line.
Inherited From:
Parameters:
Name Type Attributes Default Description
fromX Number X axis start position.
fromY Number Y axis start position.
toX Number X axis end position.
toY Number Y axis end position.
lineColor String Colour.
lineWidth Number <optional>
1 lineWidth (optional) line width.

drawLines(x, y, points, lineColor, lineWidthopt)

Draw a series of lines.
Inherited From:
Parameters:
Name Type Attributes Default Description
x Number Start drawing the X axis position.
y Number Start drawing the Y axis position.
points Array A set of points of a line segment. Format: [x1,y1,x2,y2,x3,y3...] .
lineColor Object Line segment color, or fill the drawing gradient object.
lineWidth Number <optional>
1 lineWidth (optional) line width.

drawPath(x, y, paths, brushopt, penopt)

Draw path.
Inherited From:
Parameters:
Name Type Attributes Default Description
x Number Start drawing the X axis position.
y Number Start drawing the Y axis position.
paths Array Path collection, the path supports the following format: [["moveTo",x,y] , ["lineTo",x,y] , ["arcTo",x1,y1,x2,y2,r] , ["closePath"] ].
brush Object <optional>
null brush (optional) a brush definition that supports the following settings {fillStyle}.
pen Object <optional>
null pen (optional) brush definition, support the following settings {strokeStyle, lineWidth, lineJoin, lineCap, miterLimit}.

drawPie(x, y, radius, startAngle, endAngle, fillColor, lineColoropt, lineWidthopt)

Fan plotting.
Inherited From:
Parameters:
Name Type Attributes Default Description
x Number Start drawing the X axis position.
y Number Start drawing the Y axis position.
radius Number Fan radius.
startAngle Number Starting angle.
endAngle Number End angle.
fillColor Object Fill in the color or fill the gradient object of the drawing.
lineColor Object <optional>
null lineColor (optional) border color, or the gradient object that fills the drawing.
lineWidth Number <optional>
1 lineWidth (optional) border width.

drawPoly(x, y, points, fillColor, lineColoropt, lineWidthopt)

Draw polygons.
Inherited From:
Parameters:
Name Type Attributes Default Description
x Number Start drawing the X axis position.
y Number Start drawing the Y axis position.
points Array Set of points of a polygon.
fillColor Object Fill in the color or fill the gradient object of the drawing.
lineColor Object <optional>
null lineColor (optional) border color, or the gradient object that fills the drawing.
lineWidth Number <optional>
1 lineWidth (optional) border width.

drawRect(x, y, width, height, fillColor, lineColoropt, lineWidthopt)

Draw rectangle.
Inherited From:
Parameters:
Name Type Attributes Default Description
x Number Start drawing the X axis position.
y Number Start drawing the Y axis position.
width Number Rectangular width.
height Number Rectangle height.
fillColor Object Fill in the color or fill the gradient object of the drawing.
lineColor Object <optional>
null lineColor (optional) border color, or the gradient object that fills the drawing.
lineWidth Number <optional>
1 lineWidth (optional) border width.

drawTexture(tex, xopt, yopt, widthopt, heightopt, mopt, alphaopt)

Draw texture.
Inherited From:
Parameters:
Name Type Attributes Default Description
tex Texture Grain.
x Number <optional>
0 x (optional) X axis offset.
y Number <optional>
0 y (optional) Y axis offset.
width Number <optional>
0 width Width (optional).
height Number <optional>
0 height (optional) height.
m Matrix <optional>
null m (optional) matrix information.
alpha Number <optional>
1 alpha (optional) transparency.

drawTextures(tex, pos)

Batch render the same texture.
Inherited From:
Parameters:
Name Type Description
tex Texture Grain.
pos Array Draw times and coordinates.

drawTriangles(tex, x, y, vertices, indices, uvData, matrixopt)

Draw a set of triangles
Inherited From:
Parameters:
Name Type Attributes Default Description
tex Texture Grain.
x Number X axis offset.
y Number Y axis offset.
vertices Float32Array Vertex array.
indices Float32Array Vertex index.
uvData Uint16Array UV data
matrix Matrix <optional>
null matrix Scaling matrix.

fillBorderText(text, x, y, font, fillColor, borderColor, lineWidth, textAlign)

Draw "filled and edged" text on canvas.
Inherited From:
Parameters:
Name Type Description
text Object Text that is output on canvas.
x Number Start drawing the X coordinates of the text (relative to the canvas).
y Number Start drawing the Y coordinates of the text (relative to the canvas).
font String Define fonts and font sizes, such as "20px Arial"".
fillColor String Define text colors, such as "#ff0000"".
borderColor String Defines border text colors.
lineWidth Number Border line width.
textAlign String Text alignment, optional values: 'left', 'center', 'right'".

fillText(text, x, y, font, color, textAlign)

Draw text on canvas.
Inherited From:
Parameters:
Name Type Description
text String Text that is output on canvas.
x Number Start drawing the X coordinates of the text (relative to the canvas).
y Number Start drawing the Y coordinates of the text (relative to the canvas).
font String Define the font size and font, such as "20px Arial"".
color String Define text colors, such as "#ff0000"".
textAlign String Text alignment, optional values: 'left', 'center', 'right'".

fillTexture(tex, x, y, widthopt, heightopt, typeopt, offsetopt)

Fill it with texture.
Inherited From:
Parameters:
Name Type Attributes Default Description
tex Texture Grain.
x Number X axis offset.
y Number Y axis offset.
width Number <optional>
0 width Width (optional).
height Number <optional>
0 height (optional) height.
type String <optional>
"repeat" type (optional) fill type repeat|repeat-x|repeat-y|no-repeat
offset Point <optional>
null offset (optional) texture texture offset

getBounds(realSize) → {Rectangle}

To get the position and width of the information matrix (high consumption compared with CPU, frequent use will cause Carlton, with as little as possible).
Inherited From:
Parameters:
Name Type Description
realSize Boolean (optional) use the true size of the picture, and defaults to false
Returns:
Type:
Rectangle
A Rectangle object consisting of position and width.

loadImage(url, xopt, yopt, widthopt, heightopt, completeopt)

Load and display a picture.
Inherited From:
Parameters:
Name Type Attributes Default Description
url String Picture address.
x Number <optional>
0 x (optional) displays the x position of the picture.
y Number <optional>
0 y (optional) displays the Y position of the picture.
width Number <optional>
0 width (optional) display the width of the picture, set to 0, which indicates the default width of the picture.
height Number <optional>
0 height (optional) display the height of the picture, set to 0, which indicates the default height to use the picture.
complete function <optional>
null complete (optional) the load completes the callback.

restore()

The path state and properties that have been saved before returning.
Inherited From:

rotate(angle, pivotXopt, pivotYopt)

Rotate current drawing. (recommend using transform, higher performance)
Inherited From:
Parameters:
Name Type Attributes Default Description
angle Number Angle of rotation, in radians.
pivotX Number <optional>
0 pivotX (optional) horizontal axis point coordinates.
pivotY Number <optional>
0 pivotY (optional) vertical axis point coordinates.

save()

Save the status of the current environment.
Inherited From:

scale(scaleX, scaleY, pivotXopt, pivotYopt)

Zoom current drawing to larger or smaller. (recommend using transform, higher performance)
Inherited From:
Parameters:
Name Type Attributes Default Description
scaleX Number Horizontal scaling.
scaleY Number Vertical scaling.
pivotX Number <optional>
0 pivotX (optional) horizontal axis point coordinates.
pivotY Number <optional>
0 pivotY (optional) vertical axis point coordinates.

strokeText(text, x, y, font, color, lineWidth, textAlign)

The text is drawn on the canvas (no coloring). The default color for the text is black.
Inherited From:
Parameters:
Name Type Description
text Object Text that is output on canvas.
x Number Start drawing the X coordinates of the text (relative to the canvas).
y Number Start drawing the Y coordinates of the text (relative to the canvas).
font String Define fonts and font sizes, such as "20px Arial"".
color String Define text colors, such as "#ff0000"".
lineWidth Number Line width.
textAlign String Text alignment, optional values: 'left', 'center', 'right'".

transform(mat, pivotXopt, pivotYopt)

Replace the current transformation matrix of the drawing.
Inherited From:
Parameters:
Name Type Attributes Default Description
mat Matrix Matrix.
pivotX Number <optional>
0 pivotX (optional) horizontal axis point coordinates.
pivotY Number <optional>
0 pivotY (optional) vertical axis point coordinates.

translate(x, y)

Remapping the (0,0) position on the canvas.
Inherited From:
Parameters:
Name Type Description
x Number The value added to the horizontal coordinate (x).
y Number The value added to the vertical coordinate (Y).