(inner) convertCanvas2Base64(canvas, type) → {string}
将canvas转成base64
参数说明:
Name | Type | Default | Description |
---|---|---|---|
canvas |
Element | DOM元素,canvas |
|
type |
string |
image/png
|
图片格式,默认是image/png |
Returns:
base64
- Type
- string
(async, inner) drawCanvas(style, content) → {HTMLElement}
绘制一个canvas的内容
参数说明:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
style |
object | 整个canvas的样式 Properties
|
||||||||||||||||||||||||
content |
Array | 需要绘制内容 |
Returns:
canvas元素
- Type
- HTMLElement
(async, inner) drawContent(context, style, contentList)
重新绘制标签内容
参数说明:
Name | Type | Description |
---|---|---|
context |
Object | canvas 2D 渲染环境 |
style |
Object | 样式配置参数 |
contentList |
object | 内容清单 |
(inner) drawTextToImage(text, style)
根据文字输出canvas
参数说明:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
text |
string | 文字 |
||||||||||||||||||||||||||||||||||||
style |
object | 样式 Properties
|
Returns:
Canvas
(inner) isBase64(str)
是否为base64格式
参数说明:
Name | Type | Description |
---|---|---|
str |
待判断字符串 |
Returns:
返回布尔值,为base64格式则返回true,否则返回false
(inner) loadImageAsBase64(url, callback)
通过url读取图片并转成base64
参数说明:
Name | Type | Description |
---|---|---|
url |
string | 图片链接 |
callback |
function | 回调函数 |
(inner) loadImg(url, resourcePath) → {object}
加载图片
参数说明:
Name | Type | Default | Description |
---|---|---|---|
url |
string | 图片链接地址 |
|
resourcePath |
string |
https://mapdata.bj.bcebos.com
|
root路径,可选,默认值'https://mapdata.bj.bcebos.com' |
Returns:
promise
- Type
- object
(inner) roundRect(ctx, x, y, w, h, r)
利用canvas绘制矩形框
参数说明:
Name | Type | Description |
---|---|---|
ctx |
Object | canvasContainer CanvasRenderingContext2D |
x |
number | 左侧开始位置 |
y |
number | 上侧开始位置 |
w |
number | 宽度 |
h |
number | 高度 |
r |
number | 圆角半径 |
module: 图片工具