提交 b88fd394 编写于 作者: L lixia7819

增加安全水印接口说明文档

Signed-off-by: Nlixia7819 <lixia110@huawei.com>
上级 7f81a3ea
...@@ -1056,6 +1056,7 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc ...@@ -1056,6 +1056,7 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
| ID| Error Message| | ID| Error Message|
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 1300002 | This window state is abnormal. |
| 1300003 | This window manager service works abnormally. | | 1300003 | This window manager service works abnormally. |
**Example** **Example**
...@@ -1109,26 +1110,25 @@ let initializationOptions = { ...@@ -1109,26 +1110,25 @@ let initializationOptions = {
size: { size: {
height: 100, height: 100,
width: 100 width: 100
} }
}; };
image.createPixelMap(color, initializationOptions) image.createPixelMap(color, initializationOptions)
.then((pixelMap) => { .then((pixelMap) => {
console.info('Succeeded in creating a pixelmap.'); console.info('Succeeded in creating a pixelmap.');
try { try {
window.setWaterMarkImage(pixelMap, true, (err) => { window.setWaterMarkImage(pixelMap, true, (err) => {
if(err.code) { if(err.code) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err)); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in showing watermark image.'); console.info('Succeeded in showing watermark image.');
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception)); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception));
} }
}) }).catch((err) => {
.catch((err) => { console.error(`createPixelMap failed. Cause: `+ JSON.stringify(err));
console.error(`createPixelMap failed, code is ${err.code}, message is ${err.message}`); });
});
``` ```
## window.setWaterMarkImage<sup>10+</sup> ## window.setWaterMarkImage<sup>10+</sup>
...@@ -1171,26 +1171,25 @@ let initializationOptions = { ...@@ -1171,26 +1171,25 @@ let initializationOptions = {
size: { size: {
height: 100, height: 100,
width: 100 width: 100
} }
}; };
image.createPixelMap(color, initializationOptions) image.createPixelMap(color, initializationOptions)
.then((pixelMap) => { .then((pixelMap) => {
console.info('Succeeded in creating a pixelmap.'); console.info('Succeeded in creating a pixelmap.');
try { try {
let promise =window.setWaterMarkImage(pixelMap, true, (err) => { let promise =window.setWaterMarkImage(pixelMap, true, (err) => {
if(err.code) { if(err.code) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err)); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in showing watermark image.'); console.info('Succeeded in showing watermark image.');
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception)); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception));
} }
}) }).catch((err) => {
.catch((err) => { console.error(`createPixelMap failed. Cause: `+ JSON.stringify(err));
console.error(`createPixelMap failed, code is ${err.code}, message is ${err.message}`); });
});
``` ```
## window.create<sup>(deprecated)</sup> ## window.create<sup>(deprecated)</sup>
......
...@@ -1110,26 +1110,25 @@ let initializationOptions = { ...@@ -1110,26 +1110,25 @@ let initializationOptions = {
size: { size: {
height: 100, height: 100,
width: 100 width: 100
} }
}; };
image.createPixelMap(color, initializationOptions) image.createPixelMap(color, initializationOptions)
.then((pixelMap) => { .then((pixelMap) => {
console.info('Succeeded in creating a pixelmap.'); console.info('Succeeded in creating a pixelmap.');
try { try {
window.setWaterMarkImage(pixelMap, true, (err) => { window.setWaterMarkImage(pixelMap, true, (err) => {
if(err.code) { if(err.code) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err)); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in showing watermark image.'); console.info('Succeeded in showing watermark image.');
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception)); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception));
} }
}) }).catch((err) => {
.catch((err) => { console.error(`createPixelMap failed. Cause: `+ JSON.stringify(err));
console.error(`createPixelMap failed, code is ${err.code}, message is ${err.message}`); });
});
``` ```
## window.setWaterMarkImage<sup>10+</sup> ## window.setWaterMarkImage<sup>10+</sup>
...@@ -1173,26 +1172,25 @@ let initializationOptions = { ...@@ -1173,26 +1172,25 @@ let initializationOptions = {
size: { size: {
height: 100, height: 100,
width: 100 width: 100
} }
}; };
image.createPixelMap(color, initializationOptions) image.createPixelMap(color, initializationOptions)
.then((pixelMap) => { .then((pixelMap) => {
console.info('Succeeded in creating a pixelmap.'); console.info('Succeeded in creating a pixelmap.');
try { try {
let promise =window.setWaterMarkImage(pixelMap, true, (err) => { let promise =window.setWaterMarkImage(pixelMap, true, (err) => {
if(err.code) { if(err.code) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err)); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in showing watermark image.'); console.info('Succeeded in showing watermark image.');
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception)); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception));
} }
}) }).catch((err) => {
.catch((err) => { console.error(`createPixelMap failed. Cause: `+ JSON.stringify(err));
console.error(`createPixelMap failed, code is ${err.code}, message is ${err.message}`); });
});
``` ```
## window.create<sup>(deprecated)</sup> ## window.create<sup>(deprecated)</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册