提交 3e0a8938 编写于 作者: E ester.zhou

Update docs (14778)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 ed4d9fc5
# @ohos.matrix4 # @ohos.matrix4 (Matrix Transformation)
The **matrix4** module provides APIs for matrix transformation. You can use these APIs to translate, rotate, and scale images. The **matrix4** module provides APIs for matrix transformation. You can use these APIs to translate, rotate, and scale images.
...@@ -19,7 +19,7 @@ import matrix4 from '@ohos.matrix4' ...@@ -19,7 +19,7 @@ import matrix4 from '@ohos.matrix4'
init(array: Array&lt;number&gt;): Matrix4Transit init(array: Array&lt;number&gt;): Matrix4Transit
Matrix constructor, which is used to create a 4x4 matrix by using the input parameter. Column-major order is used. Matrix constructor, which is used to create a 4 x 4 matrix by using the input parameter. Column-major order is used.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
...@@ -33,7 +33,7 @@ Matrix constructor, which is used to create a 4x4 matrix by using the input para ...@@ -33,7 +33,7 @@ Matrix constructor, which is used to create a 4x4 matrix by using the input para
| Type | Description | | Type | Description |
| -------------- | ---------------------------- | | -------------- | ---------------------------- |
| Matrix4Transit | 4x4 matrix object created based on the input parameter.| | Matrix4Transit | 4 x 4 matrix object created based on the input parameter.|
**array** parameters **array** parameters
...@@ -458,7 +458,7 @@ struct Test { ...@@ -458,7 +458,7 @@ struct Test {
.width('600px') .width('600px')
.height('300px') .height('300px')
.margin({ top: 50 }) .margin({ top: 50 })
Text(`Coordinates before matrix transformation: [${this.transformPoint}]`) Text(`Coordinates after matrix transformation: [${this.transformPoint}]`)
.fontSize(16) .fontSize(16)
.margin({ top: 100 }) .margin({ top: 100 })
Image($r("app.media.image")) Image($r("app.media.image"))
......
...@@ -139,56 +139,46 @@ button{ ...@@ -139,56 +139,46 @@ button{
```js ```js
// xxx.js // xxx.js
import promptAction from '@ohos.promptAction'; export default {
export default{ data: {
data:{ animation: '',
animation:'', options: {},
}, frames: {}
onInit(){ },
}, onInit() {
onShow(){ this.options = {
var options = { duration: 1500,
duration: 1500, easing: 'friction',
easing: 'friction', delay: 500,
delay: 500, fill: 'forwards',
fill: 'forwards', iterations: 2,
iterations: 2, direction: 'normal',
direction: 'normal', };
}; this.frames = [
var frames = [ {
{transform: {translate: '-120px -0px'}, opacity: 0.1, offset: 0.0}, transform: {
{transform: {translate: '120px 0px'}, opacity: 1.0, offset: 1.0} translate: '-120px -0px'
]; }, opacity: 0.1, offset: 0.0
this.animation = this.$element('idName').animate(frames, options); },
// handle finish event {
this.animation.onfinish = function(){ transform: {
promptAction.showToast({ translate: '120px 0px'
message: "The animation is finished." }, opacity: 1.0, offset: 1.0
}); }
}; ];
// handle cancel event },
this.animation.oncancel = function(){
promptAction.showToast({ start() {
message: "The animation is canceled." this.animation = this.$element('idName').animate(this.frames, this.options);
}); this.animation.play();
}; },
// handle repeat event cancel() {
this.animation.onrepeat = function(){ this.animation.cancel();
promptAction.showToast({ }
message: "The animation is repeated."
});
};
},
start(){
this.animation.play();
},
cancel(){
this.animation.cancel();
}
} }
``` ```
![animationapi-4](figures/animationapi-4.gif) ![en-us_image_0000001229677045](figures/en-us_image_0000001229677045.gif)
## getBoundingClientRect ## getBoundingClientRect
......
...@@ -118,16 +118,19 @@ In addition to the [universal methods](../arkui-js/js-components-common-methods. ...@@ -118,16 +118,19 @@ In addition to the [universal methods](../arkui-js/js-components-common-methods.
} }
.swiperContent1{ .swiperContent1{
height: 100%; height: 100%;
width: 100%;
justify-content: center; justify-content: center;
background-color: #007dff; background-color: #007dff;
} }
.swiperContent2{ .swiperContent2{
height: 100%; height: 100%;
width: 100%;
justify-content: center; justify-content: center;
background-color: #ff7500; background-color: #ff7500;
} }
.swiperContent3{ .swiperContent3{
height: 100%; height: 100%;
width: 100%;
justify-content: center; justify-content: center;
background-color: #41ba41; background-color: #41ba41;
} }
...@@ -155,4 +158,4 @@ export default { ...@@ -155,4 +158,4 @@ export default {
} }
``` ```
![4-0](figures/4-0.gif) ![en-us_image_0000001167823326](figures/en-us_image_0000001167823326.gif)
...@@ -28,9 +28,9 @@ Not supported ...@@ -28,9 +28,9 @@ Not supported
| end | &lt;time&gt; | 0 | No| Duration after which the animation ends. The value can be ms (ms), s (second), or m (minute). The default value is s (second). Other formats are not supported.| | end | &lt;time&gt; | 0 | No| Duration after which the animation ends. The value can be ms (ms), s (second), or m (minute). The default value is s (second). Other formats are not supported.|
| repeatCount | &lt;number \| indefinite&gt; | 1 | No| Number of times the animation is played. The default value is indefinite. You can set the value to **1** to play the animation only once.| | repeatCount | &lt;number \| indefinite&gt; | 1 | No| Number of times the animation is played. The default value is indefinite. You can set the value to **1** to play the animation only once.|
| fill | &lt;freeze \| remove&gt; | remove | No| State when the animation ends.| | fill | &lt;freeze \| remove&gt; | remove | No| State when the animation ends.|
| calcMode | &lt;discrete \| linear \| paced \| spline&gt; | linear | No| Interpolation mode of the animation.<br>**discrete**: The value of **from** directly jumps to the value of **to**.<br>**linear**: linear.<br>**paced**: linear. After this value is set, the values of **keyTimes** and **keyPoints** are invalid.<br>**spline**: user-defined Bessel curve. The spline point is defined in the **keyTimes** attribute, and the control point of each interval is defined by **keySplines**.| | calcMode | &lt;discrete \| linear \| paced \| spline&gt; | linear | No| Interpolation mode of the animation.<br>**discrete**: The animation directly jumps from the value specified by **from** to the value specified by **to**.<br>**linear**: Linear interpolation between values is used.<br>**paced**: Interpolation that produces an even paced change is used. If this value is set, the values of **keyTimes** and **keyPoints** will not take effect.<br>**spline**: Interpolation is implemented based on a custom Bezier spline. The spline points are defined in the **keyTimes** attribute, and the control points of each interval are defined in the **keySplines** attribute.|
| keyTimes | string | - | No| Start time of the key frame animation. The value ranges from 0 to 1, separated by semicolons (;), for example, **0;0.3;0.8;1**. **keyTimes**, **keySplines**, and **values** are combined to set the key frame animation. The number of **keyTimes** is the same as that of **values**. The number of **keySplines** is the number of **keyTimes** minus 1.| | keyTimes | string | - | No| Start time of the key frame animation. The value is a semicolon-separated list of values ranging from 0 to 1, for example, **0;0.3;0.8;1**. **keyTimes**, **keySplines**, and **values** are combined to set the key frame animation. The number of values defined for **keyTimes** is the same as that for **values**. The number of values defined for **keySplines** is the number of values defined for **keyTimes** minus 1.|
| keySplines | string | - | No| A set of Bessel control points associated with **keyTimes**. You can define the Bessel curves for each key frame. The curves are separated by semicolons (;). The format of the two controls in the curve is x1 y1 x2 y2. For example, **0.5 0 0.5 1; 0.5 0 0.5 1;0.5 0 0.5 1**.| | keySplines | string | - | No| A set of Bezier control points associated with **keyTimes**. You can define the Bezier curves for each key frame, separating them with semicolons (;). The format of the two control points in the curve is x1 y1 x2 y2, for example, **0.5 0 0.5 1; 0.5 0 0.5 1;0.5 0 0.5 1**.|
| by | number | - | No| Relative offset value to add to a specified attribute in the animation. The default value of **from** is the original attribute value.| | by | number | - | No| Relative offset value to add to a specified attribute in the animation. The default value of **from** is the original attribute value.|
| from | string | - | No| Start value of the attribute to which the animation is applied.<br>If the **values** attribute has been set, the **from** attribute is invalid.| | from | string | - | No| Start value of the attribute to which the animation is applied.<br>If the **values** attribute has been set, the **from** attribute is invalid.|
| to | string | - | No| End value of the attribute to which the animation is applied.<br>If the **values** attribute has been set, the **to** attribute is invalid.| | to | string | - | No| End value of the attribute to which the animation is applied.<br>If the **values** attribute has been set, the **to** attribute is invalid.|
...@@ -76,7 +76,7 @@ Not supported ...@@ -76,7 +76,7 @@ Not supported
<div class="container"> <div class="container">
<svg width="400" height="400"> <svg width="400" height="400">
<rect x="20" y="20" width="100" height="100" fill="red" rx="0" ry="20"> <rect x="20" y="20" width="100" height="100" fill="red" rx="0" ry="20">
<animate attributeName="rx" values="0;30" dur="1000" repeatCount="10" fill="freeze" calcMode="linear"></animate> <animate attributeName="rx" values="0;30" dur="1000" repeatCount="indefinite" fill="freeze" calcMode="linear"></animate>
</rect> </rect>
</svg> </svg>
</div> </div>
......
...@@ -91,7 +91,7 @@ The **animate** attributes and the attributes in the following table are support ...@@ -91,7 +91,7 @@ The **animate** attributes and the attributes in the following table are support
``` ```
![animate-transform](figures/animate-transform.gif) ![en-us_image_0000001127285004](figures/en-us_image_0000001127285004.gif)
Animation overlay Animation overlay
...@@ -150,7 +150,7 @@ Animation overlay ...@@ -150,7 +150,7 @@ Animation overlay
``` ```
![animate-transform2](figures/animate-transform2.gif) ![en-us_image_0000001127125192](figures/en-us_image_0000001127125192.gif)
Example of involved components Example of involved components
......
...@@ -27,7 +27,7 @@ Obtains an image from the specified source for subsequent rendering and display. ...@@ -27,7 +27,7 @@ Obtains an image from the specified source for subsequent rendering and display.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Yes | Image source. Both local and online images are supported.<br>When using an image referenced using a relative path, for example, `Image("common/test.jpg")`, the **\<Image>** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.<br>- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.<br>\- Base64 strings are supported. The value format is data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data], where [base64 data] is a Base64 string.<br/>\- Strings with the **datashare://path** prefix are supported, which are used to access the image path provided by a data ability. Before loading images, the application must [request the required permissions](../../file-management/medialibrary-overview.md#requesting-permissions).<br>\- Strings with the **file:///data/storage** prefix are supported, which are used to read image resources in the **files** folder in the installation directory of the application. Ensure that the files in the directory package path have the read permission.| | src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Yes | Image source. Both local and online images are supported.<br>When using an image referenced using a relative path, for example, **Image("common/test.jpg")**, the **\<Image>** component cannot be called across bundles or modules. Therefore, you are advised to use **\$r** to reference image resources that need to be used globally.<br>- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.<br>\- Base64 strings are supported. The value format is data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data], where [base64 data] is a Base64 string.<br/>\- Strings with the **datashare://path** prefix are supported, which are used to access the image path provided by a data ability. Before loading images, the application must [request the required permissions](../../file-management/medialibrary-overview.md#requesting-permissions).<br>\- Strings with the **file:///data/storage** prefix are supported, which are used to read image resources in the **files** folder in the installation directory of the application. Ensure that the files in the directory package path have the read permission.|
## Attributes ## Attributes
...@@ -40,7 +40,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -40,7 +40,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | Whether the image is repeated.<br>Default value: **ImageRepeat.NoRepeat**<br>**NOTE**<br>This attribute is not applicable to SVG images.| | objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | Whether the image is repeated.<br>Default value: **ImageRepeat.NoRepeat**<br>**NOTE**<br>This attribute is not applicable to SVG images.|
| interpolation | [ImageInterpolation](#imageinterpolation) | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.<br>Default value: **ImageInterpolation.None**<br>**NOTE**<br>This attribute is not applicable to SVG images.<br>This attribute is not applicable to **PixelMap** objects.| | interpolation | [ImageInterpolation](#imageinterpolation) | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.<br>Default value: **ImageInterpolation.None**<br>**NOTE**<br>This attribute is not applicable to SVG images.<br>This attribute is not applicable to **PixelMap** objects.|
| renderMode | [ImageRenderMode](#imagerendermode) | Rendering mode of the image.<br>Default value: **ImageRenderMode.Original**<br>**NOTE**<br>This attribute is not applicable to SVG images.| | renderMode | [ImageRenderMode](#imagerendermode) | Rendering mode of the image.<br>Default value: **ImageRenderMode.Original**<br>**NOTE**<br>This attribute is not applicable to SVG images.|
| sourceSize | {<br>width: number,<br>height: number<br>} | Size of the decoded image. The original image is decoded into a **pixelMap** of the specified size, in px.<br>**NOTE**<br>This attribute is not applicable to **PixelMap** objects.| | sourceSize | {<br>width: number,<br>height: number<br>} | Size of the decoded image. The original image is decoded into a **pixelMap** of the specified size, in px.<br>**NOTE**<br>This attribute is not applicable to **PixelMap** objects or SVG images.|
| matchTextDirection | boolean | Whether to display the image in the system language direction. When this parameter is set to true, the image is horizontally flipped in the right-to-left (RTL) language context.<br>Default value: **false** | | matchTextDirection | boolean | Whether to display the image in the system language direction. When this parameter is set to true, the image is horizontally flipped in the right-to-left (RTL) language context.<br>Default value: **false** |
| fitOriginalSize | boolean | Whether to fit the component to the original size of the image source when the component size is not set.<br>Default value: **false** | | fitOriginalSize | boolean | Whether to fit the component to the original size of the image source when the component size is not set.<br>Default value: **false** |
| fillColor | [ResourceColor](ts-types.md#resourcecolor) | Fill color. This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.| | fillColor | [ResourceColor](ts-types.md#resourcecolor) | Fill color. This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.|
...@@ -52,7 +52,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -52,7 +52,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
> **NOTE** > **NOTE**
> >
> To use shortcut keys to copy the image, the image must be in focus. To enable the image to gain focus, set both the **focusable** and **focusOnTouch** attributes to **true**. > To use shortcut keys to copy the image, the image must be in focus. To enable the image to gain focus, set both the **focusable** and **focusOnTouch** attributes to **true**.
> For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, **animate**, **animateMotion**, and **animateTransform**. > For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, and **animate**.
### ImageInterpolation ### ImageInterpolation
...@@ -99,21 +99,21 @@ struct ImageExample1 { ...@@ -99,21 +99,21 @@ struct ImageExample1 {
Text('default').fontSize(16).fontColor(0xcccccc).height(30) Text('default').fontSize(16).fontColor(0xcccccc).height(30)
Row({ space: 5 }) { Row({ space: 5 }) {
Image($r('app.media.ic_png')) Image($r('app.media.ic_png'))
.width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(110).height(110).border({ width: 1 })
.overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.ic_gif')) Image($r('app.media.ic_gif'))
.width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(110).height(110).border({ width: 1 })
.overlay('gif', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('gif', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.ic_svg')) Image($r('app.media.ic_svg'))
.width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(110).height(110).border({ width: 1 })
.overlay('svg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('svg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
} }
Row({ space: 5 }) { Row({ space: 5 }) {
Image($r('app.media.img_example')) Image($r('app.media.img_example'))
.width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(110).height(110).border({ width: 1 })
.overlay('jpg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('jpg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image(this.src) Image(this.src)
.width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(110).height(110).border({ width: 1 })
.overlay('network', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('network', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
}.margin({ top: 25, bottom: 10 }) }.margin({ top: 25, bottom: 10 })
} }
...@@ -122,25 +122,25 @@ struct ImageExample1 { ...@@ -122,25 +122,25 @@ struct ImageExample1 {
Text('objectFit').fontSize(16).fontColor(0xcccccc).height(30) Text('objectFit').fontSize(16).fontColor(0xcccccc).height(30)
Row({ space: 5 }) { Row({ space: 5 }) {
Image($r('app.media.img_example')) Image($r('app.media.img_example'))
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.objectFit(ImageFit.None).width(110).height(110) .objectFit(ImageFit.None).width(110).height(110)
.overlay('None', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('None', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.img_example')) Image($r('app.media.img_example'))
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.objectFit(ImageFit.Fill).width(110).height(110) .objectFit(ImageFit.Fill).width(110).height(110)
.overlay('Fill', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('Fill', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.img_example')) Image($r('app.media.img_example'))
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.objectFit(ImageFit.Cover).width(110).height(110) .objectFit(ImageFit.Cover).width(110).height(110)
.overlay('Cover', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('Cover', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
} }
Row({ space: 5 }) { Row({ space: 5 }) {
Image($r('app.media.img_example_w250')) Image($r('app.media.img_example_w250'))
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.objectFit(ImageFit.Contain).width(110).height(110) .objectFit(ImageFit.Contain).width(110).height(110)
.overlay('Contain', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('Contain', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.img_example_w250')) Image($r('app.media.img_example_w250'))
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.objectFit(ImageFit.ScaleDown).width(110).height(110) .objectFit(ImageFit.ScaleDown).width(110).height(110)
.overlay('ScaleDown', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('ScaleDown', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
}.margin({ top: 25 }) }.margin({ top: 25 })
...@@ -160,7 +160,7 @@ The default network timeout period is 5 minutes for loading online images. When ...@@ -160,7 +160,7 @@ The default network timeout period is 5 minutes for loading online images. When
```tsx ```tsx
// @ts-nocheck // @ts-nocheck
import http from '@ohos.net.http'; import http from '@ohos.net.http'
import ResponseCode from '@ohos.net.http' import ResponseCode from '@ohos.net.http'
import image from '@ohos.multimedia.image' import image from '@ohos.multimedia.image'
...@@ -198,7 +198,7 @@ struct Index { ...@@ -198,7 +198,7 @@ struct Index {
let code = data.responseCode let code = data.responseCode
if(ResponseCode.ResponseCode.OK == code) { if(ResponseCode.ResponseCode.OK == code) {
let imageSource = image.createImageSource(data.result) let imageSource = image.createImageSource(data.result)
let options = {alphaType: 0, // Transparency let options = {alphaType: 0, // Opacity
editable: false, // Whether the image is editable editable: false, // Whether the image is editable
pixelFormat: 3, // Pixel format pixelFormat: 3, // Pixel format
scaleMode: 1, // Scale mode scaleMode: 1, // Scale mode
...@@ -233,18 +233,18 @@ struct ImageExample2 { ...@@ -233,18 +233,18 @@ struct ImageExample2 {
Row({ space: 50 }) { Row({ space: 50 }) {
Image($r('app.media.img_example')) Image($r('app.media.img_example'))
.renderMode(ImageRenderMode.Original).width(100).height(100) .renderMode(ImageRenderMode.Original).width(100).height(100)
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.overlay('Original', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('Original', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.img_example')) Image($r('app.media.img_example'))
.renderMode(ImageRenderMode.Template).width(100).height(100) .renderMode(ImageRenderMode.Template).width(100).height(100)
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.overlay('Template', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('Template', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
} }
Text('alt').fontSize(12).fontColor(0xcccccc).width('96%').height(30) Text('alt').fontSize(12).fontColor(0xcccccc).width('96%').height(30)
Image('') Image('')
.alt($r('app.media.Image_none')) .alt($r('app.media.Image_none'))
.width(100).height(100).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(100).height(100).border({ width: 1 })
Text('sourceSize').fontSize(12).fontColor(0xcccccc).width('96%') Text('sourceSize').fontSize(12).fontColor(0xcccccc).width('96%')
Row({ space: 50 }) { Row({ space: 50 }) {
...@@ -254,7 +254,7 @@ struct ImageExample2 { ...@@ -254,7 +254,7 @@ struct ImageExample2 {
height: 150 height: 150
}) })
.objectFit(ImageFit.ScaleDown).width('25%').aspectRatio(1) .objectFit(ImageFit.ScaleDown).width('25%').aspectRatio(1)
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.overlay('w:150 h:150', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('w:150 h:150', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.img_example')) Image($r('app.media.img_example'))
.sourceSize({ .sourceSize({
...@@ -262,22 +262,22 @@ struct ImageExample2 { ...@@ -262,22 +262,22 @@ struct ImageExample2 {
height: 200 height: 200
}) })
.objectFit(ImageFit.ScaleDown).width('25%').aspectRatio(1) .objectFit(ImageFit.ScaleDown).width('25%').aspectRatio(1)
.border({ width: 1 }).borderStyle(BorderStyle.Dashed) .border({ width: 1 })
.overlay('w:200 h:200', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('w:200 h:200', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
} }
Text('objectRepeat').fontSize(12).fontColor(0xcccccc).width('96%').height(30) Text('objectRepeat').fontSize(12).fontColor(0xcccccc).width('96%').height(30)
Row({ space: 5 }) { Row({ space: 5 }) {
Image($r('app.media.ic_health_heart')) Image($r('app.media.ic_health_heart'))
.width(120).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(120).height(125).border({ width: 1 })
.objectRepeat(ImageRepeat.XY).objectFit(ImageFit.ScaleDown) .objectRepeat(ImageRepeat.XY).objectFit(ImageFit.ScaleDown)
.overlay('ImageRepeat.XY', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('ImageRepeat.XY', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.ic_health_heart')) Image($r('app.media.ic_health_heart'))
.width(110).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(110).height(125).border({ width: 1 })
.objectRepeat(ImageRepeat.Y).objectFit(ImageFit.ScaleDown) .objectRepeat(ImageRepeat.Y).objectFit(ImageFit.ScaleDown)
.overlay('ImageRepeat.Y', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('ImageRepeat.Y', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.ic_health_heart')) Image($r('app.media.ic_health_heart'))
.width(110).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) .width(110).height(125).border({ width: 1 })
.objectRepeat(ImageRepeat.X).objectFit(ImageFit.ScaleDown) .objectRepeat(ImageRepeat.X).objectFit(ImageFit.ScaleDown)
.overlay('ImageRepeat.X', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('ImageRepeat.X', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
} }
......
...@@ -65,6 +65,7 @@ struct PolygonExample { ...@@ -65,6 +65,7 @@ struct PolygonExample {
Polygon({ width: 100, height: 100 }) Polygon({ width: 100, height: 100 })
.points([[0, 0], [50, 100], [100, 0]]) .points([[0, 0], [50, 100], [100, 0]])
.fill(Color.Green) .fill(Color.Green)
.stroke(Color.Transparent)
// Draw a quadrilateral in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing points are (0, 100) and (100, 100). // Draw a quadrilateral in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing points are (0, 100) and (100, 100).
Polygon().width(100).height(100) Polygon().width(100).height(100)
.points([[0, 0], [0, 100], [100, 100], [100, 0]]) .points([[0, 0], [0, 100], [100, 100], [100, 0]])
...@@ -76,6 +77,7 @@ struct PolygonExample { ...@@ -76,6 +77,7 @@ struct PolygonExample {
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]) .points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.fill(Color.Red) .fill(Color.Red)
.fillOpacity(0.6) .fillOpacity(0.6)
.stroke(Color.Transparent)
}.width('100%').margin({ top: 10 }) }.width('100%').margin({ top: 10 })
} }
} }
......
...@@ -40,7 +40,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -40,7 +40,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.| | fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.| | stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.|
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes. | | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.|
...@@ -66,6 +66,7 @@ struct RectExample { ...@@ -66,6 +66,7 @@ struct RectExample {
// Draw a 90% x 50 rectangle. // Draw a 90% x 50 rectangle.
Rect({ width: '90%', height: 50 }) Rect({ width: '90%', height: 50 })
.fill(Color.Pink) .fill(Color.Pink)
.stroke(Color.Transparent)
// Draw a 90% x 50 rectangle. // Draw a 90% x 50 rectangle.
Rect() Rect()
.width('90%') .width('90%')
...@@ -80,15 +81,18 @@ struct RectExample { ...@@ -80,15 +81,18 @@ struct RectExample {
.radiusHeight(20) .radiusHeight(20)
.radiusWidth(40) .radiusWidth(40)
.fill(Color.Pink) .fill(Color.Pink)
.stroke(Color.Transparent)
// Draw a 90% x 80 rectangle, with the width and height of its rounded corners being both 20. // Draw a 90% x 80 rectangle, with the width and height of its rounded corners being both 20.
Rect({ width: '90%', height: 80 }) Rect({ width: '90%', height: 80 })
.radius(20) .radius(20)
.fill(Color.Pink) .fill(Color.Pink)
.stroke(Color.Transparent)
}.width('100%').margin({ top: 10 }) }.width('100%').margin({ top: 10 })
// Draw a 90% x 50 rectangle, with the width and height of its rounded corners as follows: 40 for the upper left rounded corner, 20 for the upper right rounded corner, 40 for the lower right rounded corner, and 20 for the lower left rounded corner. // Draw a 90% x 50 rectangle, with the width and height of its rounded corners as follows: 40 for the upper left rounded corner, 20 for the upper right rounded corner, 40 for the lower right rounded corner, and 20 for the lower left rounded corner.
Rect({ width: '90%', height: 80 }) Rect({ width: '90%', height: 80 })
.radius([[40, 40], [20, 20], [40, 40], [20, 20]]) .radius([[40, 40], [20, 20], [40, 40], [20, 20]])
.fill(Color.Pink) .fill(Color.Pink)
.stroke(Color.Transparent)
}.width('100%').margin({ top: 5 }) }.width('100%').margin({ top: 5 })
} }
} }
......
...@@ -16,7 +16,7 @@ You can draw an image around a component. ...@@ -16,7 +16,7 @@ You can draw an image around a component.
| Name | Type | Description | | Name | Type | Description |
| ---------- | ---------------------------------------- | --------------------------------------- | | ---------- | ---------------------------------------- | --------------------------------------- |
| source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | Source or gradient color of the border image. | | source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | Source or gradient color of the border image. |
| slice | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Slice width of the border image.<br>Default value: **0** | | slice | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Slice width of the border image.<br>Default value: **0** |
| width | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Width of the border image.<br>Default value: **0** | | width | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Width of the border image.<br>Default value: **0** |
| outset | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Amount by which the border image is extended beyond the border box.<br>Default value: **0** | | outset | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Amount by which the border image is extended beyond the border box.<br>Default value: **0** |
...@@ -33,7 +33,6 @@ You can draw an image around a component. ...@@ -33,7 +33,6 @@ You can draw an image around a component.
| Round | The source image's slices are tiled to fill the border box. Tiles may be compressed when needed.| | Round | The source image's slices are tiled to fill the border box. Tiles may be compressed when needed.|
| Space | The source image's slices are tiled to fill the border box. Extra space will be filled in between tiles. | | Space | The source image's slices are tiled to fill the border box. Extra space will be filled in between tiles. |
## Example ## Example
```ts ```ts
...@@ -85,7 +84,7 @@ struct Index { ...@@ -85,7 +84,7 @@ struct Index {
build() { build() {
Row() { Row() {
Column() { Column() {
Text('This is gradient color.').textAlign(TextAlign.Center).width(68) Text('This is gradient color.').textAlign(TextAlign.Center).height(50).width(200)
.borderImage({ .borderImage({
source: { source: {
angle: 90, angle: 90,
......
...@@ -43,7 +43,7 @@ text{ ...@@ -43,7 +43,7 @@ text{
} }
``` ```
![en-us_image_0000001223287656](figures/en-us_image_0000001223287656.gif) ![en-us_image_0000001234289455](figures/en-us_image_0000001234289455.gif)
## Setting the Index ## Setting the Index
...@@ -82,7 +82,7 @@ text{ ...@@ -82,7 +82,7 @@ text{
} }
``` ```
![en-us_image_0000001267767837](figures/en-us_image_0000001267767837.gif) ![en-us_image_0000001234011019](figures/en-us_image_0000001234011019.gif)
Set the **label** attribute to customize the label for the **\<stepper-item>**. Set the **label** attribute to customize the label for the **\<stepper-item>**.
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
} }
``` ```
![en-us_image_0000001267767841](figures/en-us_image_0000001267767841.gif) ![en-us_image_0000001163531210](figures/en-us_image_0000001163531210.gif)
## Setting Styles ## Setting Styles
...@@ -187,7 +187,7 @@ text{ ...@@ -187,7 +187,7 @@ text{
} }
``` ```
![en-us_image_0000001223287668](figures/en-us_image_0000001223287668.png) ![en-us_image_0000001234130975](figures/en-us_image_0000001234130975.png)
## Adding Events ## Adding Events
...@@ -290,7 +290,7 @@ export default { ...@@ -290,7 +290,7 @@ export default {
} }
``` ```
![en-us_image_0000001267607869](figures/en-us_image_0000001267607869.gif) ![en-us_image_0000001189089950](figures/en-us_image_0000001189089950.gif)
## Example Scenario ## Example Scenario
...@@ -364,8 +364,6 @@ Use a **\<stepper>** component to navigate through the steps. Create a **\<Toggl ...@@ -364,8 +364,6 @@ Use a **\<stepper>** component to navigate through the steps. Create a **\<Toggl
```js ```js
// xxx.js // xxx.js
import promptAction from '@ohos.promptAction';
import router from '@ohos.router';
let myset = new Set(); let myset = new Set();
export default { export default {
data: { data: {
...@@ -404,4 +402,4 @@ export default { ...@@ -404,4 +402,4 @@ export default {
} }
``` ```
![en-us_image_0000001267887817](figures/en-us_image_0000001267887817.gif) ![en-us_image_0000001189249862](figures/en-us_image_0000001189249862.gif)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册