Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2c814d66
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2c814d66
编写于
9月 21, 2022
作者:
G
Gloria
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update docs against 9597
Signed-off-by: wusongqing<wusongqing@huawei.com>
上级
11a50470
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
59 addition
and
55 deletion
+59
-55
en/application-dev/reference/apis/js-apis-effectKit.md
en/application-dev/reference/apis/js-apis-effectKit.md
+59
-55
未找到文件。
en/application-dev/reference/apis/js-apis-effectKit.md
浏览文件 @
2c814d66
...
@@ -40,13 +40,14 @@ Creates a **Filter** instance based on the pixel map.
...
@@ -40,13 +40,14 @@ Creates a **Filter** instance based on the pixel map.
**Example**
**Example**
```
js
```
js
import
image
from
"
@ohos.multimedia.image
"
import
image
from
"
@ohos.multimedia.image
"
;
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
;
let
bufferArr
=
new
Uint8Array
(
color
)
;
image
.
createPixelMap
(
color
,
opts
)
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
.
then
((
pixelMap
)
=>
{
image
.
createPixelMap
(
color
,
opts
)
.
then
((
pixelMap
)
=>
{
let
headFilter
=
effectKit
.
createEffect
(
pixelMap
)
let
headFilter
=
effectKit
.
createEffect
(
pixelMap
);
})
})
```
```
## effectKit.createColorPicker
## effectKit.createColorPicker
...
@@ -72,14 +73,15 @@ Creates a **ColorPicker** instance based on the pixel map. This API uses a promi
...
@@ -72,14 +73,15 @@ Creates a **ColorPicker** instance based on the pixel map. This API uses a promi
**Example**
**Example**
```
js
```
js
import
image
from
"
@ohos.multimedia.image
"
import
image
from
"
@ohos.multimedia.image
"
;
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
;
let
bufferArr
=
new
Uint8Array
(
color
)
;
image
.
createPixelMap
(
color
,
opts
,
(
pixelMap
)
=>
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
effectKit
.
createColorPicker
(
pixelMap
).
then
(
colorPicker
=>
{
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelMap
)
=>
{
console
.
info
(
"
color picker=
"
+
colorPicker
);
effectKit
.
createColorPicker
(
pixelMap
).
then
(
colorPicker
=>
{
})
console
.
info
(
"
color picker=
"
+
colorPicker
);
.
catch
(
ex
=>
console
.
error
(
"
.error=
"
+
ex
.
toString
()))
})
.
catch
(
ex
=>
console
.
error
(
"
.error=
"
+
ex
.
toString
()))
})
})
```
```
...
@@ -101,17 +103,19 @@ Creates a **ColorPicker** instance based on the pixel map. This API uses an asyn
...
@@ -101,17 +103,19 @@ Creates a **ColorPicker** instance based on the pixel map. This API uses an asyn
**Example**
**Example**
```
js
```
js
import
image
from
"
@ohos.multimedia.image
"
import
image
from
"
@ohos.multimedia.image
"
;
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
let
bufferArr
=
new
Uint8Array
(
color
);
image
.
createPixelMap
(
color
,
opts
,
(
pixelMap
)
=>
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
effectKit
.
createColorPicker
(
pixelMap
,
(
error
,
colorPicker
)
=>
{
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelMap
)
=>
{
if
(
error
)
{
effectKit
.
createColorPicker
(
pixelMap
,
(
error
,
colorPicker
)
=>
{
console
.
log
(
'
Failed to create color picker.
'
);
if
(
error
)
{
}
else
{
console
.
log
(
'
Failed to create color picker.
'
);
console
.
log
(
'
Succeeded in creating color picker.
'
);
}
else
{
}
console
.
log
(
'
Succeeded in creating color picker.
'
);
})
}
})
})
})
```
```
...
@@ -150,7 +154,7 @@ Obtains the main color of the image and writes the result to a **[Color](#color)
...
@@ -150,7 +154,7 @@ Obtains the main color of the image and writes the result to a **[Color](#color)
```
js
```
js
colorPicker
.
getMainColor
().
then
(
color
=>
{
colorPicker
.
getMainColor
().
then
(
color
=>
{
console
.
log
(
'
Succeeded in getting main color.
'
)
console
.
log
(
'
Succeeded in getting main color.
'
)
;
console
.
info
(
"
color[ARGB]=
"
+
color
.
alpha
+
"
,
"
+
color
.
red
+
"
,
"
+
color
.
green
+
"
,
"
+
color
.
blue
);
console
.
info
(
"
color[ARGB]=
"
+
color
.
alpha
+
"
,
"
+
color
.
red
+
"
,
"
+
color
.
green
+
"
,
"
+
color
.
blue
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
Failed to get main color.
'
);
console
.
log
(
'
Failed to get main color.
'
);
...
@@ -205,17 +209,17 @@ Adds the blur effect to the filter linked list, and returns the head node of the
...
@@ -205,17 +209,17 @@ Adds the blur effect to the filter linked list, and returns the head node of the
**Example**
**Example**
```
js
```
js
import
image
from
"
@ohos.multimedia.image
"
import
image
from
"
@ohos.multimedia.image
"
;
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
image
.
createPixelMap
(
color
,
opts
)
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelMap
)
=>
{
.
then
((
pixelMap
)
=>
{
let
radius
=
5
;
let
radius
=
5
;
let
headFilter
=
effectKit
.
createEffect
(
pixelMap
);
let
headFilter
=
effectKit
.
createEffect
(
pixelMap
)
if
(
headFilter
!=
null
)
{
if
(
headFilter
!=
null
)
{
headFilter
.
blur
(
radius
);
headFilter
.
blur
(
radius
)
}
}
})
})
```
```
### brightness
### brightness
...
@@ -241,17 +245,17 @@ Adds the brightness effect to the filter linked list, and returns the head node
...
@@ -241,17 +245,17 @@ Adds the brightness effect to the filter linked list, and returns the head node
**Example**
**Example**
```
js
```
js
import
image
from
"
@ohos.multimedia.image
"
import
image
from
"
@ohos.multimedia.image
"
;
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
image
.
createPixelMap
(
color
,
opts
)
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelMap
)
=>
{
.
then
((
pixelMap
)
=>
{
let
bright
=
0.5
;
let
bright
=
0.5
;
let
headFilter
=
effectKit
.
createEffect
(
pixelMap
);
let
headFilter
=
effectKit
.
createEffect
(
pixelMap
)
if
(
headFilter
!=
null
)
{
if
(
headFilter
!=
null
)
{
headFilter
.
brightness
(
bright
);
headFilter
.
brightness
(
bright
)
}
}
})
})
```
```
### grayscale
### grayscale
...
@@ -271,16 +275,16 @@ Adds the grayscale effect to the filter linked list, and returns the head node o
...
@@ -271,16 +275,16 @@ Adds the grayscale effect to the filter linked list, and returns the head node o
**Example**
**Example**
```
js
```
js
import
image
from
"
@ohos.multimedia.image
"
import
image
from
"
@ohos.multimedia.image
"
;
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
image
.
createPixelMap
(
color
,
opts
)
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelMap
)
=>
{
.
then
((
pixelMap
)
=>
{
let
headFilter
=
effectKit
.
createEffect
(
pixelMap
);
let
headFilter
=
effectKit
.
createEffect
(
pixelMap
)
if
(
headFilter
!=
null
)
{
if
(
headFilter
!=
null
)
{
headFilter
.
grayscale
();
headFilter
.
grayscale
()
}
}
})
})
```
```
### getPixelMap
### getPixelMap
...
@@ -300,11 +304,11 @@ Obtains **image.PixelMap** of the source image to which the filter linked list i
...
@@ -300,11 +304,11 @@ Obtains **image.PixelMap** of the source image to which the filter linked list i
**Example**
**Example**
```
js
```
js
import
image
from
"
@ohos.multimedia.image
"
import
image
from
"
@ohos.multimedia.image
"
;
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
image
.
createPixelMap
(
color
,
opts
)
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelMap
)
=>
{
.
then
((
pixelMap
)
=>
{
let
pixel
=
effectKit
.
createEffect
(
pixelMap
).
grayscale
().
getPixelMap
();
let
pixel
=
effectKit
.
createEffect
(
pixelMap
).
grayscale
().
getPixelMap
()
})
})
```
```
Miykael_xxm
🚴
@xiongjiamu
mentioned in commit
6a44e045
·
9月 24, 2022
mentioned in commit
6a44e045
mentioned in commit 6a44e045661fa00efb98e2d73752f124f3771803
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录