提交 966a1f94 编写于 作者: L lixia7819

Merge branch 'master' of gitee.com:lixia7819/docs

...@@ -1074,125 +1074,6 @@ try { ...@@ -1074,125 +1074,6 @@ try {
} }
``` ```
## window.setWaterMarkImage<sup>10+</sup>
setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean, callback: AsyncCallback&lt;void&gt;): void
Show or don't show watermark image. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------- |
| pixelMap | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Watermark image.|
| enable | boolean | Yes | Whether to show watermark image. The value **true** means to show watermark image, and **false** means the opposite.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
| ID| Error Message|
| ------- | --------------------------------------------- |
| 1300003 | This window manager service works abnormally. |
**Example**
```js
import image from '@ohos.multimedia.image';
let pixelMap;
let color = new ArrayBuffer(0);
let initializationOptions = {
size: {
height: 100,
width: 100
}
};
image.createPixelMap(color, initializationOptions)
.then((pixelMap) => {
console.info('Succeeded in creating a pixelmap.');
try {
window.setWaterMarkImage(pixelMap, true, (err) => {
if(err.code) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in showing watermark image.');
});
} catch (exception) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception));
}
}).catch((err) => {
console.error(`createPixelMap failed. Cause: `+ JSON.stringify(err));
});
```
## window.setWaterMarkImage<sup>10+</sup>
setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean): Promise&lt;void&gt;
Show or don't show watermark image. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name| Type | Mandatory | Description |
| ------ | ------- | ---- | -------------------- |
| pixelMap | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Watermark image.|
| enable | boolean | Yes | Whether to show watermark image. The value **true** means to show watermark image, and **false** means the opposite.|
**Return value**
| Type | Description |
| ------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
| ID| Error Message|
| ------- | -------------------------------------------- |
| 1300003 | This window manager service works abnormally. |
**Example**
```js
import image from '@ohos.multimedia.image';
let pixelMap;
let color = new ArrayBuffer(0);
let initializationOptions = {
size: {
height: 100,
width: 100
}
};
image.createPixelMap(color, initializationOptions)
.then((pixelMap) => {
console.info('Succeeded in creating a pixelmap.');
try {
let promise =window.setWaterMarkImage(pixelMap, true, (err) => {
if(err.code) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in showing watermark image.');
});
} catch (exception) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(exception));
}
}).catch((err) => {
console.error(`createPixelMap failed. Cause: `+ JSON.stringify(err));
});
```
## window.create<sup>(deprecated)</sup> ## window.create<sup>(deprecated)</sup>
create(id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): void create(id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): void
......
...@@ -22,12 +22,8 @@ ...@@ -22,12 +22,8 @@
|Added|NA|Module name: ohos.screen<br>Class name: Screen<br>Method or attribute name: readonly sourceMode: ScreenSourceMode;|@ohos.screen.d.ts| |Added|NA|Module name: ohos.screen<br>Class name: Screen<br>Method or attribute name: readonly sourceMode: ScreenSourceMode;|@ohos.screen.d.ts|
|Added|NA|Class name: window<br>Method or attribute name: function setGestureNavigationEnabled(enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| |Added|NA|Class name: window<br>Method or attribute name: function setGestureNavigationEnabled(enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts|
|Added|NA|Class name: window<br>Method or attribute name: function setGestureNavigationEnabled(enable: boolean): Promise\<void>;|@ohos.window.d.ts| |Added|NA|Class name: window<br>Method or attribute name: function setGestureNavigationEnabled(enable: boolean): Promise\<void>;|@ohos.window.d.ts|
|Added|NA|Class name: window<br>Method or attribute name: function setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts|
|Added|NA|Class name: window<br>Method or attribute name: function setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean): Promise\<void>;|@ohos.window.d.ts|
|Added|NA|Class name: window<br>Method or attribute name: function on(type: 'gestureNavigationEnabledChange', callback: Callback\<boolean>): void;|@ohos.window.d.ts| |Added|NA|Class name: window<br>Method or attribute name: function on(type: 'gestureNavigationEnabledChange', callback: Callback\<boolean>): void;|@ohos.window.d.ts|
|Added|NA|Class name: window<br>Method or attribute name: function off(type: 'gestureNavigationEnabledChange', callback?: Callback\<boolean>): void;|@ohos.window.d.ts| |Added|NA|Class name: window<br>Method or attribute name: function off(type: 'gestureNavigationEnabledChange', callback?: Callback\<boolean>): void;|@ohos.window.d.ts|
|Added|NA|Class name: window<br>Method or attribute name: function on(type: 'waterMarkFlagChange', callback: Callback\<boolean>): void;|@ohos.window.d.ts|
|Added|NA|Class name: window<br>Method or attribute name: function off(type: 'waterMarkFlagChange', callback?: Callback\<boolean>): void;|@ohos.window.d.ts|
|Added|NA|Module name: ohos.window<br>Class name: WindowEventType|@ohos.window.d.ts| |Added|NA|Module name: ohos.window<br>Class name: WindowEventType|@ohos.window.d.ts|
|Added|NA|Class name: WindowEventType<br>Method or attribute name: |@ohos.window.d.ts| |Added|NA|Class name: WindowEventType<br>Method or attribute name: |@ohos.window.d.ts|
|Added|NA|Module name: ohos.window<br>Class name: WindowEventType<br>Method or attribute name: WINDOW_SHOWN = 1|@ohos.window.d.ts| |Added|NA|Module name: ohos.window<br>Class name: WindowEventType<br>Method or attribute name: WINDOW_SHOWN = 1|@ohos.window.d.ts|
......
...@@ -1102,33 +1102,17 @@ setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean, callback: AsyncCall ...@@ -1102,33 +1102,17 @@ setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean, callback: AsyncCall
**示例:** **示例:**
```js ```js
import image from '@ohos.multimedia.image'; try {
window.setWaterMarkImage(pixelMap, true, (err) => {
let pixelMap; if(err.code) {
let color = new ArrayBuffer(0); console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
let initializationOptions = { return;
size: {
height: 100,
width: 100
}
};
image.createPixelMap(color, initializationOptions)
.then((pixelMap) => {
console.info('Succeeded in creating a pixelmap.');
try {
window.setWaterMarkImage(pixelMap, true, (err) => {
if(err.code) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
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) => {
console.error(`createPixelMap failed. Cause: `+ JSON.stringify(err));
});
``` ```
## window.setWaterMarkImage<sup>10+</sup> ## window.setWaterMarkImage<sup>10+</sup>
...@@ -1164,33 +1148,16 @@ setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean): Promise&lt;void&gt ...@@ -1164,33 +1148,16 @@ setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean): Promise&lt;void&gt
**示例:** **示例:**
```js ```js
import image from '@ohos.multimedia.image'; try {
let promise = window.setWaterMarkImage(pixelMap, true);
let pixelMap; promise.then(()=> {
let color = new ArrayBuffer(0);
let initializationOptions = {
size: {
height: 100,
width: 100
}
};
image.createPixelMap(color, initializationOptions)
.then((pixelMap) => {
console.info('Succeeded in creating a pixelmap.');
try {
let promise =window.setWaterMarkImage(pixelMap, true, (err) => {
if(err.code) {
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in showing watermark image.'); console.info('Succeeded in showing watermark image.');
}).catch((err)=>{
console.error('Failed to show watermark image. Cause: ' + JSON.stringify(err));
}); });
} 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) => {
console.error(`createPixelMap failed. Cause: `+ JSON.stringify(err));
});
``` ```
## window.create<sup>(deprecated)</sup> ## window.create<sup>(deprecated)</sup>
......
...@@ -22,12 +22,8 @@ ...@@ -22,12 +22,8 @@
|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性:readonly sourceMode: ScreenSourceMode;|@ohos.screen.d.ts| |新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性:readonly sourceMode: ScreenSourceMode;|@ohos.screen.d.ts|
|新增|NA|类名:window<br>方法or属性:function setGestureNavigationEnabled(enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| |新增|NA|类名:window<br>方法or属性:function setGestureNavigationEnabled(enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts|
|新增|NA|类名:window<br>方法or属性:function setGestureNavigationEnabled(enable: boolean): Promise\<void>;|@ohos.window.d.ts| |新增|NA|类名:window<br>方法or属性:function setGestureNavigationEnabled(enable: boolean): Promise\<void>;|@ohos.window.d.ts|
|新增|NA|类名:window<br>方法or属性:function setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts|
|新增|NA|类名:window<br>方法or属性:function setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean): Promise\<void>;|@ohos.window.d.ts|
|新增|NA|类名:window<br>方法or属性:function on(type: 'gestureNavigationEnabledChange', callback: Callback\<boolean>): void;|@ohos.window.d.ts| |新增|NA|类名:window<br>方法or属性:function on(type: 'gestureNavigationEnabledChange', callback: Callback\<boolean>): void;|@ohos.window.d.ts|
|新增|NA|类名:window<br>方法or属性:function off(type: 'gestureNavigationEnabledChange', callback?: Callback\<boolean>): void;|@ohos.window.d.ts| |新增|NA|类名:window<br>方法or属性:function off(type: 'gestureNavigationEnabledChange', callback?: Callback\<boolean>): void;|@ohos.window.d.ts|
|新增|NA|类名:window<br>方法or属性:function on(type: 'waterMarkFlagChange', callback: Callback\<boolean>): void;|@ohos.window.d.ts|
|新增|NA|类名:window<br>方法or属性:function off(type: 'waterMarkFlagChange', callback?: Callback\<boolean>): void;|@ohos.window.d.ts|
|新增|NA|模块名: ohos.window<br>类名: WindowEventType|@ohos.window.d.ts| |新增|NA|模块名: ohos.window<br>类名: WindowEventType|@ohos.window.d.ts|
|新增|NA|类名:WindowEventType<br>方法or属性:|@ohos.window.d.ts| |新增|NA|类名:WindowEventType<br>方法or属性:|@ohos.window.d.ts|
|新增|NA|模块名: ohos.window<br>类名: WindowEventType<br>方法 or 属性:WINDOW_SHOWN = 1|@ohos.window.d.ts| |新增|NA|模块名: ohos.window<br>类名: WindowEventType<br>方法 or 属性:WINDOW_SHOWN = 1|@ohos.window.d.ts|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册