From cc67c1d3a5f9ee66cce48c68f6b4a3f82f6fae64 Mon Sep 17 00:00:00 2001 From: wanglili12 Date: Sun, 3 Aug 2025 15:04:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=8B=86=E5=88=862?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglili12 --- api/arkui/BuilderNode.d.ts | 178 +-- api/arkui/BuilderNode.static.d.ets | 29 +- api/arkui/Graphics.d.ts | 415 ++----- api/arkui/Graphics.static.d.ets | 1019 +++++++++++++++++ ...resources.d.ets => resources.static.d.ets} | 46 +- 5 files changed, 1175 insertions(+), 512 deletions(-) create mode 100644 api/arkui/Graphics.static.d.ets rename api/arkui/component/{resources.d.ets => resources.static.d.ets} (64%) diff --git a/api/arkui/BuilderNode.d.ts b/api/arkui/BuilderNode.d.ts index 826aee0854..382f2c75f2 100644 --- a/api/arkui/BuilderNode.d.ts +++ b/api/arkui/BuilderNode.d.ts @@ -21,10 +21,6 @@ import { UIContext } from '../@ohos.arkui.UIContext'; import { FrameNode } from './FrameNode'; import { Size } from './Graphics'; -/*** if arkts 1.2 */ -import { TouchEvent } from './component/common'; -import { WrappedBuilder, CustomBuilder, CustomBuilderT } from './component/builder'; -/*** endif */ /** * Render type of the node using for indicating that @@ -60,10 +56,9 @@ For details, see Rendering and Drawing Video and Button Components at the Same L * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ -export declare enum NodeRenderType { +declare enum NodeRenderType { /** * Display type.The node will be shown on the display. * @@ -77,8 +72,7 @@ export declare enum NodeRenderType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ RENDER_TYPE_DISPLAY = 0, @@ -93,8 +87,7 @@ export declare enum NodeRenderType { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ RENDER_TYPE_TEXTURE = 1, } @@ -114,8 +107,7 @@ export declare enum NodeRenderType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export interface RenderOptions { /** @@ -131,8 +123,7 @@ export interface RenderOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ selfIdealSize?: Size; @@ -147,8 +138,7 @@ export interface RenderOptions { * @type { ?NodeRenderType } type - Render type of the node * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ type?: NodeRenderType; @@ -164,8 +154,7 @@ export interface RenderOptions { * @type { ?string } surfaceId - surfaceId of a consumer who can receive the texture of the Node * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ surfaceId?: string; } @@ -178,8 +167,7 @@ export interface RenderOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export interface BuildOptions { @@ -192,8 +180,7 @@ export interface BuildOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ nestingBuilderSupported?: boolean; @@ -564,148 +551,3 @@ export class BuilderNode { */ isDisposed(): boolean; } - -/** - * Defines BuilderNode. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ -export declare class BuilderNode { - /** - * Constructor. - * - * @param { UIContext } uiContext - uiContext used to create the BuilderNode - * @param { RenderOptions } [options] - Render options of the Builder Node - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - constructor(uiContext: UIContext, options?: RenderOptions); - - /** - * Build the BuilderNode with the builder. - * - * @param { WrappedBuilder } builder - Defined the builder will be called to build the node. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - build(builder: WrappedBuilder): void; - - /** - * Build the BuilderNode with the builder. - * - * @param { WrappedBuilder> } builder - Defined the builder will be called to build the node. - * @param { T } arg - Defined the args will be used in the builder. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - build(builder: WrappedBuilder>, arg: T): void; - - /** - * Build the BuilderNode with the builder.Support the type that WrappedBuilder contains builder used different params. - * - * @param { WrappedBuilder> } builder - Defined the builder will be called to build the node. - * @param { T } arg - Defined the args will be used in the builder. - * @param { BuildOptions } options - Defined the options will be used when build. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - build(builder: WrappedBuilder>, arg: T, options: BuildOptions): void; - - /** - * Update the BuilderNode based on the provided parameters. - * - * @param { T } arg - Parameters used to update the BuilderNode, which must match the types required by the builder bound to the BuilderNode. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - update(arg: T): void; - - /** - * Get the FrameNode in BuilderNode. - * - * @returns { FrameNode | null } - Returns a FrameNode inside the BuilderNode, or null if not contained. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getFrameNode(): FrameNode | null; - - /** - * Dispatch touchEvent to targetNode. - * - * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode. - * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false otherwise. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - postTouchEvent(event: TouchEvent): boolean; - - /** - * Dispose the BuilderNode immediately. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - dispose(): void; - - /** - * Reuse the BuilderNode based on the provided parameters. - * - * @param { Record } [param] - Parameters for reusing BuilderNode. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - reuse(param?: Record): void; - - /** - * Recycle the BuilderNode. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - recycle(): void; - - /** - * Notify BuilderNode to update the configuration to trigger a reload of the BuilderNode. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - updateConfiguration(): void; - } \ No newline at end of file diff --git a/api/arkui/BuilderNode.static.d.ets b/api/arkui/BuilderNode.static.d.ets index 84ba76eced..b688a38248 100644 --- a/api/arkui/BuilderNode.static.d.ets +++ b/api/arkui/BuilderNode.static.d.ets @@ -1,3 +1,4 @@ +'use static'; /* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +23,7 @@ import { UIContext } from '../@ohos.arkui.UIContext'; import { FrameNode } from './FrameNode'; import { Size } from './Graphics'; -import { TouchEvent } from './component/common'; +import { TouchEvent, MouseEvent, AxisEvent } from './component/common'; import { WrappedBuilder, CustomBuilder, CustomBuilderT } from './component/builder'; /** @@ -171,8 +172,8 @@ export declare class BuilderNode { * Dispatch touchEvent to targetNode. * * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode. - * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to - * the targetNode,false otherwise. + * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false + * otherwise. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 20 */ @@ -220,6 +221,17 @@ export declare class BuilderNode { */ isDisposed(): boolean; + /** + * Dispatch the event to targetNode. + * + * @param { InputEventType } event - The event which will be sent to the targetNode. + * @returns { boolean } - Returns true if the event has been successfully posted to the targetNode, + * false otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + postInputEvent(event: InputEventType): boolean; + /** * Set if the BuilderNode inherits the freezing policy of the parent CustomComponent, ComponentContent, * or BuilderNode. @@ -230,4 +242,13 @@ export declare class BuilderNode { * @since 20 */ inheritFreezeOptions(enabled: boolean): void; -} \ No newline at end of file +} + +/** + * Defines the event type used for posting. + * + * @typedef { TouchEvent | MouseEvent | AxisEvent } InputEventType + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type InputEventType = TouchEvent | MouseEvent | AxisEvent; diff --git a/api/arkui/Graphics.d.ts b/api/arkui/Graphics.d.ts index a795a8b911..a4f8edb2c6 100644 --- a/api/arkui/Graphics.d.ts +++ b/api/arkui/Graphics.d.ts @@ -21,11 +21,6 @@ import drawing from '../@ohos.graphics.drawing'; import type common2D from '../@ohos.graphics.common2D'; import { Resource } from '../global/resource'; -/*** if arkts 1.2 */ -import { ResourceColor } from './component/units' -import { BorderStyle } from './component/enums' -/*** endif */ - /** * Size info. * Returns the width and height of the component. The default unit is vp, but APIs that use the Size type may specify a @@ -45,8 +40,7 @@ import { BorderStyle } from './component/enums' * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export interface Size { /** @@ -68,8 +62,7 @@ export interface Size { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ width: number; @@ -92,8 +85,7 @@ export interface Size { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ height: number; } @@ -114,16 +106,7 @@ export interface Size { * @atomicservice * @since 12 */ -/** - * Defines DrawContext. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.1&1.2 - */ -export declare class DrawContext { +export class DrawContext { /** * Get size of the DrawContext. @@ -131,8 +114,7 @@ export declare class DrawContext { * @returns { Size } The size of the DrawContext. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ /** * Get size of the DrawContext. @@ -141,8 +123,7 @@ export declare class DrawContext { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ get size(): Size; @@ -153,8 +134,7 @@ export declare class DrawContext { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ get sizeInPixel(): Size; @@ -164,8 +144,7 @@ export declare class DrawContext { * @returns { drawing.Canvas } The canvas of the DrawContext. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ /** * Get canvas of the DrawContext. @@ -174,8 +153,7 @@ export declare class DrawContext { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ get canvas(): drawing.Canvas; } @@ -195,8 +173,7 @@ export declare class DrawContext { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ interface Vector2 { /** @@ -216,10 +193,9 @@ interface Vector2 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - x: number + x: number; /** * Value for y-axis of the vector. @@ -238,10 +214,9 @@ interface Vector2 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - y: number + y: number; } /** @@ -251,8 +226,7 @@ interface Vector2 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ interface Vector2T { @@ -263,10 +237,9 @@ interface Vector2 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - x: T + x: T; /** * Value for y-axis of the vector. @@ -275,10 +248,9 @@ interface Vector2 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - y: T + y: T; } /** @@ -296,8 +268,7 @@ interface Vector2 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ interface Vector3 { /** @@ -317,8 +288,7 @@ interface Vector3 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ x: number; @@ -339,8 +309,7 @@ interface Vector3 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ y: number; @@ -361,8 +330,7 @@ interface Vector3 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ z: number; } @@ -384,8 +352,7 @@ interface Vector3 { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type Matrix4 = [ number, @@ -423,8 +390,7 @@ export type Matrix4 = [ * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type Offset = Vector2; @@ -445,8 +411,7 @@ export type Offset = Vector2; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type Position = Vector2; @@ -457,8 +422,7 @@ export type Position = Vector2; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type PositionT = Vector2T; @@ -481,8 +445,7 @@ export type PositionT = Vector2T; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type Pivot = Vector2; @@ -503,8 +466,7 @@ export type Pivot = Vector2; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type Scale = Vector2; @@ -525,8 +487,7 @@ export type Scale = Vector2; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type Translation = Vector2; @@ -547,8 +508,7 @@ export type Translation = Vector2; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type Rotation = Vector3; @@ -567,8 +527,7 @@ export type Rotation = Vector3; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export declare interface Frame { /** @@ -590,8 +549,7 @@ export declare interface Frame { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ x: number; @@ -614,8 +572,7 @@ export declare interface Frame { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ y: number; @@ -638,8 +595,7 @@ export declare interface Frame { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ width: number; @@ -662,8 +618,7 @@ export declare interface Frame { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ height: number; } @@ -675,8 +630,7 @@ export declare interface Frame { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export interface Edges { /** @@ -686,8 +640,7 @@ export interface Edges { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ left: T, @@ -698,8 +651,7 @@ export interface Edges { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ right: T, @@ -710,8 +662,7 @@ export interface Edges { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ top: T, @@ -722,10 +673,9 @@ export interface Edges { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - bottom: T + bottom: T, } /** @@ -737,17 +687,7 @@ export interface Edges { * @atomicservice * @since 12 */ -/** - * Defines the Length Unit. - * - * @enum { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.1&1.2 - */ -export declare enum LengthUnit { +declare enum LengthUnit { /** * Logical pixel used in Ace1.0. It's based on frontend design width. * For example, when a frontend with 750px design width running on a @@ -756,8 +696,7 @@ export declare enum LengthUnit { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ PX = 0, @@ -767,8 +706,7 @@ export declare enum LengthUnit { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ VP = 1, @@ -779,8 +717,7 @@ export declare enum LengthUnit { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ FP = 2, @@ -791,8 +728,7 @@ export declare enum LengthUnit { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ PERCENT = 3, @@ -802,8 +738,7 @@ export declare enum LengthUnit { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ LPX = 4, } @@ -815,8 +750,7 @@ export declare enum LengthUnit { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export interface SizeT { /** @@ -826,8 +760,7 @@ export interface SizeT { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ width: T; @@ -838,8 +771,7 @@ export interface SizeT { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ height: T; } @@ -851,8 +783,7 @@ export interface SizeT { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export enum LengthMetricsUnit { @@ -862,8 +793,7 @@ export enum LengthMetricsUnit { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ DEFAULT = 0, @@ -873,8 +803,7 @@ export enum LengthMetricsUnit { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ PX = 1 } @@ -888,16 +817,7 @@ export enum LengthMetricsUnit { * @atomicservice * @since 12 */ -/** - * Defines the Length Metrics. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.1&1.2 - */ -export declare class LengthMetrics { +declare class LengthMetrics { /** * Constructor. * If the unit parameter is omitted or explicitly set to undefined, the default unit VP is used. @@ -909,8 +829,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ constructor(value: number, unit?:LengthUnit); @@ -924,8 +843,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static px(value: number): LengthMetrics; @@ -939,8 +857,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static vp(value: number): LengthMetrics; @@ -954,8 +871,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static fp(value: number): LengthMetrics; @@ -970,8 +886,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static percent(value: number): LengthMetrics; @@ -985,8 +900,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static lpx(value: number): LengthMetrics; @@ -1001,8 +915,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static resource(value: Resource): LengthMetrics; @@ -1014,8 +927,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ public unit: LengthUnit; @@ -1026,8 +938,7 @@ export declare class LengthMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ public value: number; } @@ -1040,16 +951,7 @@ export declare class LengthMetrics { * @atomicservice * @since 12 */ -/** - * Defines the ColorMetrics class. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.1&1.2 - */ -export declare class ColorMetrics { +declare class ColorMetrics { /** * Instantiate the ColorMetrics class using color number * @@ -1059,8 +961,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static numeric(value: number): ColorMetrics; @@ -1079,8 +980,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static rgba(red: number, green: number, blue: number, alpha?: number): ColorMetrics; @@ -1114,8 +1014,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ static resourceColor(color: ResourceColor): ColorMetrics; @@ -1128,8 +1027,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ blendColor(overlayColor: ColorMetrics): ColorMetrics; @@ -1142,8 +1040,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ get color(): string; @@ -1155,8 +1052,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ get red(): number; @@ -1168,8 +1064,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ get green(): number; @@ -1181,8 +1076,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ get blue(): number; @@ -1194,8 +1088,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ get alpha(): number; } @@ -1207,8 +1100,7 @@ export declare class ColorMetrics { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ interface Corners { /** @@ -1218,8 +1110,7 @@ interface Corners { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ topLeft: T, @@ -1230,8 +1121,7 @@ interface Corners { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ topRight: T, @@ -1242,8 +1132,7 @@ interface Corners { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ bottomLeft: T, @@ -1254,10 +1143,9 @@ interface Corners { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - bottomRight: T + bottomRight: T, } /** @@ -1267,8 +1155,7 @@ interface Corners { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type CornerRadius = Corners; @@ -1279,8 +1166,7 @@ export type CornerRadius = Corners; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type BorderRadiuses = Corners; @@ -1291,8 +1177,7 @@ export type BorderRadiuses = Corners; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export type Rect = common2D.Rect; @@ -1303,8 +1188,7 @@ export type Rect = common2D.Rect; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export interface RoundRect { /** @@ -1314,8 +1198,7 @@ export interface RoundRect { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ rect: Rect, @@ -1326,10 +1209,9 @@ export interface RoundRect { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - corners: CornerRadius + corners: CornerRadius, } /** @@ -1339,8 +1221,7 @@ export interface RoundRect { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export interface Circle { /** @@ -1350,8 +1231,7 @@ export interface Circle { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ centerX: number, @@ -1362,8 +1242,7 @@ export interface Circle { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ centerY: number, @@ -1375,10 +1254,9 @@ export interface Circle { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - radius: number + radius: number, } /** @@ -1388,8 +1266,7 @@ export interface Circle { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export interface CommandPath { /** @@ -1401,8 +1278,7 @@ export interface CommandPath { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ commands: string } @@ -1413,8 +1289,7 @@ export interface CommandPath { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export declare class ShapeMask { /** @@ -1423,8 +1298,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ constructor(); @@ -1435,8 +1309,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setRectShape(rect: Rect): void; @@ -1447,8 +1320,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setRoundRectShape(roundRect: RoundRect): void; @@ -1459,8 +1331,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setCircleShape(circle: Circle): void; @@ -1471,8 +1342,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setOvalShape(oval: Rect): void; @@ -1483,8 +1353,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setCommandPath(path: CommandPath): void; @@ -1497,8 +1366,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ fillColor: number; @@ -1511,8 +1379,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ strokeColor: number; @@ -1525,8 +1392,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ strokeWidth: number; } @@ -1538,8 +1404,7 @@ export declare class ShapeMask { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export declare class ShapeClip { /** @@ -1548,8 +1413,7 @@ export declare class ShapeClip { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ constructor(); @@ -1560,8 +1424,7 @@ export declare class ShapeClip { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setRectShape(rect: Rect): void; @@ -1572,8 +1435,7 @@ export declare class ShapeClip { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setRoundRectShape(roundRect: RoundRect): void; @@ -1584,8 +1446,7 @@ export declare class ShapeClip { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setCircleShape(circle: Circle): void; @@ -1596,8 +1457,7 @@ export declare class ShapeClip { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setOvalShape(oval: Rect): void; @@ -1608,8 +1468,7 @@ export declare class ShapeClip { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setCommandPath(path: CommandPath): void; } @@ -1625,18 +1484,7 @@ export declare class ShapeClip { * @atomicservice * @since 12 */ -/** - * Obtain a object with all edges are set to the same color. - * - * @param { number } all - The edge color will be set. - * @returns { Edges } - The object with all edges are set to the same color. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.1&1.2 - */ -export declare function edgeColors(all: number): Edges; +export function edgeColors(all: number): Edges; /** * Obtain a object with all edges are set to the same width. @@ -1649,18 +1497,7 @@ export declare function edgeColors(all: number): Edges; * @atomicservice * @since 12 */ -/** - * Obtain a object with all edges are set to the same width. - * - * @param { number } all - The edge width will be set. - * @returns { Edges } - The object with all edges are set to the same width. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.1&1.2 - */ -export declare function edgeWidths(all: number): Edges; +export function edgeWidths(all: number): Edges; /** * Obtain a object with all edges are set to the same style. @@ -1672,18 +1509,7 @@ export declare function edgeWidths(all: number): Edges; * @atomicservice * @since 12 */ -/** - * Obtain a object with all edges are set to the same style. - * - * @param { BorderStyle } all - The edge style will be set. - * @returns { Edges } - The object with all edges are set to the same style. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.1&1.2 - */ -export declare function borderStyles(all: BorderStyle): Edges; +export function borderStyles(all: BorderStyle): Edges; /** * Obtain a BorderRadiuses object with all edges are set to the same radius. @@ -1697,15 +1523,4 @@ export declare function borderStyles(all: BorderStyle): Edges; * @atomicservice * @since 12 */ -/** - * Obtain a BorderRadiuses object with all edges are set to the same radius. - * - * @param { number } all - The edge radius will be set. - * @returns { BorderRadiuses } - The BorderRadiuses object. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.1&1.2 - */ -export declare function borderRadiuses(all: number): BorderRadiuses; +export function borderRadiuses(all: number): BorderRadiuses; diff --git a/api/arkui/Graphics.static.d.ets b/api/arkui/Graphics.static.d.ets new file mode 100644 index 0000000000..237988027b --- /dev/null +++ b/api/arkui/Graphics.static.d.ets @@ -0,0 +1,1019 @@ +'use static'; +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ +import drawing from '../@ohos.graphics.drawing'; +import type common2D from '../@ohos.graphics.common2D'; +import { Resource } from '../global/resource'; +import { ResourceColor } from './component/units'; +import { BorderStyle } from './component/enums'; + +/** + * Size info. + * + * @interface Size + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface Size { + /** + * Get the width of the Size. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + width: number; + + /** + * Get the height of the Size. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + height: number; +} + +/** + * Defines DrawContext. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class DrawContext { + /** + * Get size of the DrawContext. + * + * @returns { Size } The size of the DrawContext. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get size() :Size; + + /** + * Get size of the DrawContext with pixel unit. + * + * @returns { Size } The size of the DrawContext with pixel unit. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get sizeInPixel(): Size; + + /** + * Get canvas of the DrawContext. + * + * @returns { drawing.Canvas } The canvas of the DrawContext. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get canvas(): drawing.Canvas; +} + +/** + * Defined a vector with two values. + * + * @interface Vector2 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +interface Vector2 { + /** + * Value for x-axis of the vector. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + x: number; + + /** + * Value for y-axis of the vector. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + y: number; +} + +/** + * Defined a vector with two T type values. + * + * @interface Vector2T + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +interface Vector2T { + + /** + * Value for x-axis of the vector. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + x: T; + + /** + * Value for y-axis of the vector. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + y: T; +} + +/** + * Defined a vector with three values. + * + * @interface Vector3 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +interface Vector3 { + /** + * Value for x-axis of the vector. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + x: number; + + /** + * Value for y-axis of the vector. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + y: number; + + /** + * Value for z-axis of the vector. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + z: number; +} + +/** + * It's a 4x4 matrix, represent by number[]. + * + * @typedef { [number, number, number, number, number, number, number, number, number, number, number, number, number, + * number, number, number] } Matrix4 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Matrix4 = [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number +]; + +/** + * Offset info. + * + * @typedef { Vector2 } Offset + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Offset = Vector2; + +/** + * Position info. + * + * @typedef { Vector2 } Position + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Position = Vector2; + +/** + * PositionT info. + * @typedef {Vector2T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type PositionT = Vector2T; + +/** + * Pivot info. + * + * @typedef { Vector2 } Pivot + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Pivot = Vector2; + +/** + * Scale info. + * + * @typedef { Vector2 } Scale + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Scale = Vector2; + +/** + * Translation info. + * + * @typedef { Vector2 } Translation + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Translation = Vector2; + +/** + * Rotation info. + * + * @typedef { Vector3 } Rotation + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Rotation = Vector3; + +/** + * Frame info, include the position info and size info. + * + * @interface Frame + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface Frame { + /** + * Position value for x-axis of the frame info. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + x: number; + + /** + * Position value for y-axis of the frame info. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + y: number; + + /** + * Size value for width of the frame info. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + width: number; + + /** + * Size value for height of the frame info. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + height: number; +} + +/** + * Defines the Edge property. + * + * @interface Edges + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface Edges { + /** + * Left property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + left: T; + + /** + * Right property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + right: T; + + /** + * Top property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + top: T; + + /** + * Bottom property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bottom: T; +} + +/** + * Defines the Length Unit. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare enum LengthUnit { + /** + * Logical pixel used in Ace1.0. It's based on frontend design width. + * For example, when a frontend with 750px design width running on a + * device with 1080 pixels width, 1px represents 1.44 pixels. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + PX = 0, + + /** + * Density independent pixels, one vp is one pixel on a 160 dpi screen. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + VP = 1, + + /** + * Scale independent pixels. This is like VP but will be scaled by + * user's font size preference. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + FP = 2, + + /** + * The percentage of either a value from the element's parent or from + * another property of the element itself. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + PERCENT = 3, + + /** + * Logic pixels used in ACE2.0 instead of PX, and PX is the physical pixels in ACE2.0. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + LPX = 4 +} + +/** + * Defines the Size property. + * + * @interface SizeT + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface SizeT { + /** + * Width property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + width: T; + + /** + * Height property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + height: T; +} + +/** + * Enumerates the length metrics unit. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export enum LengthMetricsUnit { + + /** + * The default length metrics unit. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + DEFAULT = 0, + + /** + * The pixel length metrics unit. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + PX = 1 +} + +/** + * Defines the Length Metrics. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class LengthMetrics { + /** + * Constructor. + * + * @param { number } value - The value of length. + * @param { LengthUnit } [unit] - The length unit. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + constructor(value: number, unit?:LengthUnit); + + /** + * Init a lengthMetrics with px unit. + * + * @param { number } value - The value of the length metrics. + * @returns { LengthMetrics } Returns the lengthMetrics object with unit px. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static px(value: number): LengthMetrics; + + /** + * Init a lengthMetrics with vp unit. + * + * @param { number } value - The value of the length metrics. + * @returns { LengthMetrics } - Returns the lengthMetrics object with unit vp. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static vp(value: number): LengthMetrics; + + /** + * Init a lengthMetrics with fp unit. + * + * @param { number } value - The value of the length metrics. + * @returns { LengthMetrics } Returns the lengthMetrics object with unit fp. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static fp(value: number): LengthMetrics; + + /** + * Init a lengthMetrics with percent unit. + * + * @param { number } value - The value of the length metrics. + * @returns { LengthMetrics } Returns the lengthMetrics object with unit percent. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static percent(value: number): LengthMetrics; + + /** + * Init a lengthMetrics with lpx unit. + * + * @param { number } value - The value of the length metrics. + * @returns { LengthMetrics } Returns the lengthMetrics object with unit lpx. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static lpx(value: number): LengthMetrics; + + /** + * Init a lengthMetrics with Resource unit. + * + * @param { Resource } value - The value of the length metrics. + * @returns { LengthMetrics } Returns the lengthMetrics object with unit Resource. + * @throws { BusinessError } 180001 - System resources does not exist. + * @throws { BusinessError } 180002 - The type of system resources is incorrect. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static resource(value: Resource): LengthMetrics; + + /** + * The unit of the LengthMetrics. The default value is VP. + * + * @type { LengthUnit } + * @default VP + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public unit: LengthUnit; + + /** + * The value of the LengthMetrics. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public value: number; +} + +/** + * Defines the ColorMetrics class. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class ColorMetrics { + /** + * Instantiate the ColorMetrics class using color number + * + * @param { number } value - color number + * @returns { ColorMetrics } ColorMetrics class + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static numeric(value: number): ColorMetrics; + + /** + * Instantiate the ColorMetrics class using color rgb + * + * @param { number } red - red value of rgba + * @param { number } green - green value of rgba + * @param { number } blue - blue value of rgba + * @param { number } [alpha] - opacity value of rgba + * @returns { ColorMetrics } ColorMetrics class + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static rgba(red: number, green: number, blue: number, alpha?: number): ColorMetrics; + + /** + * Instantiate the ColorMetrics class using ResourceColor + * + * @param { ResourceColor } color - resource color + * @returns { ColorMetrics } ColorMetrics class + * @throws { BusinessError } 180003 - Failed to obtain the color resource. + * @throws { BusinessError } 401 - Parameter error. Possible cause: + * 1. The type of the input color parameter is not ResourceColor. + * 2. The format of the input color string is not RGB or RGBA. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static resourceColor(color: ResourceColor): ColorMetrics; + + /** + * blend color + * + * @param { ColorMetrics } overlayColor - overlay color + * @returns { ColorMetrics } ColorMetrics class + * @throws { BusinessError } 401 - Parameter error. The type of the input parameter is not ColorMetrics. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + blendColor(overlayColor: ColorMetrics): ColorMetrics; + + /** + * Get color of the ColorMetrics. + * + * @returns { string } The color of the ColorMetrics. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get color(): string; + + /** + * Get red value of the ColorMetrics. + * + * @returns { number } The red value of the ColorMetrics. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get red(): number; + + /** + * Get green value of the ColorMetrics. + * + * @returns { number } The green value of the ColorMetrics. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get green(): number; + + /** + * Get blue value of the ColorMetrics. + * + * @returns { number } The blue value of the ColorMetrics. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get blue(): number; + + /** + * Get opacity value of the ColorMetrics. + * + * @returns { number } The opacity value of the ColorMetrics. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get alpha(): number; +} + +/** + * Defines the Corner property. + * + * @interface Corners + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +interface Corners { + /** + * TopLeft property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + topLeft: T; + + /** + * TopRight property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + topRight: T; + + /** + * BottomLeft property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bottomLeft: T; + + /** + * BottomRight property. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bottomRight: T; +} + +/** + * Defines the Corner radius. + * + * @typedef { Corners } CornerRadius + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type CornerRadius = Corners; + +/** + * BorderRadiuses info. + * + * @typedef { Corners } BorderRadiuses + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type BorderRadiuses = Corners; + +/** + * Rect info. + * + * @typedef { common2D.Rect } Rect + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Rect = common2D.Rect; + +/** + * Defines the RoundRect. + * + * @interface RoundRect + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface RoundRect { + /** + * Rect property. + * + * @type { Rect } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + rect: Rect; + + /** + * Corners property. + * + * @type { CornerRadius } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + corners: CornerRadius; +} + +/** + * Defines the Circle. + * + * @interface Circle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface Circle { + /** + * The x-coordinate of the center of the Circle. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + centerX: number, + + /** + * The y-coordinate of the center of the Circle. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + centerY: number, + + /** + * The radius of the Circle. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + radius: number; +} + +/** + * Defines the CommandPath. + * + * @interface CommandPath + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface CommandPath { + /** + * The commands of CommandPath. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + commands: string; +} + +/** + * Defines ShapeMask. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class ShapeMask { + /** + * Constructor. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + constructor(); + + /** + * Set the rect shape of the ShapeMask. + * + * @param { Rect } rect - The rect shape will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setRectShape(rect: Rect): void; + + /** + * Set the round rect shape of the ShapeMask. + * + * @param { RoundRect } roundRect - The round rect shape will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setRoundRectShape(roundRect: RoundRect): void; + + /** + * Set the circle shape of the ShapeMask. + * + * @param { Circle } circle - The circle shape will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setCircleShape(circle: Circle): void; + + /** + * Set the oval shape of the ShapeMask. + * + * @param { Rect } oval - The oval shape will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setOvalShape(oval: Rect): void; + + /** + * Set the command path of the ShapeMask. + * + * @param { CommandPath } path - The command path will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setCommandPath(path: CommandPath): void; + + /** + * The fill color of the ShapeMask. + * + * @type { number } + * @default 0XFF000000 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + fillColor: number; + + /** + * The stroke color of the ShapeMask. + * + * @type { number } + * @default 0XFF000000 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + strokeColor: number; + + /** + * The stroke width of the ShapeMask. + * + * @type { number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + strokeWidth: number; +} + + +/** + * Define ShapeClip. Record the type and parameters of the shape used for clipping. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class ShapeClip { + /** + * Constructor. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + constructor(); + + /** + * Set the rect shape of the ShapeClip. + * + * @param { Rect } rect - The rect shape will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setRectShape(rect: Rect): void; + + /** + * Set the round rect shape of the ShapeClip. + * + * @param { RoundRect } roundRect - The round rect shape will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setRoundRectShape(roundRect: RoundRect): void; + + /** + * Set the circle shape of the ShapeClip. + * + * @param { Circle } circle - The circle shape will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setCircleShape(circle: Circle): void; + + /** + * Set the oval shape of the ShapeClip. + * + * @param { Rect } oval - The oval shape will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setOvalShape(oval: Rect): void; + + /** + * Set the command path of the ShapeClip. + * + * @param { CommandPath } path - The command path will be set. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setCommandPath(path: CommandPath): void; +} + +/** + * Obtain a object with all edges are set to the same color. + * + * @param { number } all - The edge color will be set. + * @returns { Edges } - The object with all edges are set to the same color. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function edgeColors(all: number): Edges; + +/** + * Obtain a object with all edges are set to the same width. + * + * @param { number } all - The edge width will be set. + * @returns { Edges } - The object with all edges are set to the same width. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function edgeWidths(all: number): Edges; + +/** + * Obtain a object with all edges are set to the same style. + * + * @param { BorderStyle } all - The edge style will be set. + * @returns { Edges } - The object with all edges are set to the same style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function borderStyles(all: BorderStyle): Edges; + +/** + * Obtain a BorderRadiuses object with all edges are set to the same radius. + * + * @param { number } all - The edge radius will be set. + * @returns { BorderRadiuses } - The BorderRadiuses object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function borderRadiuses(all: number): BorderRadiuses; diff --git a/api/arkui/component/resources.d.ets b/api/arkui/component/resources.static.d.ets similarity index 64% rename from api/arkui/component/resources.d.ets rename to api/arkui/component/resources.static.d.ets index 68448421a2..7cc0b41023 100644 --- a/api/arkui/component/resources.d.ets +++ b/api/arkui/component/resources.static.d.ets @@ -1,10 +1,10 @@ /* * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -12,32 +12,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** * @file * @kit ArkUI * @arkts 1.2 */ -import { Resource } from './../../../api/global/resource' - -/** - * Obtain the resource in resources, used by plugin. - * - * @param { string } bundleName - * @param { string } moduleName - * @param { string } name - * @param { Object[] } params - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ -export declare function _r(bundleName: string, moduleName: string, name: string, ...params: Object[]): Resource; +import { Resource } from './../../../api/global/resource'; /** * Obtain the resource in resources, used by plugin. - * + * * @param { number } id - Indicates the id of resource. * @param { number } type - Indicates the type of resource. * @param { string } bundleName - Indicates the name of bundle. @@ -45,31 +31,14 @@ export declare function _r(bundleName: string, moduleName: string, name: string, * @param { Object[] } params - Custom parameters. * @returns { Resource } Returns the resource instance. * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 - * @arkts 1.2 */ export declare function _r( id: number, type: number, bundleName: string, moduleName: string, ...params: Object[]): Resource; /** * Obtain the resource in resources/rawfile, used by plugin. - * - * @param { string } bundleName - * @param { string } moduleName - * @param { string } name - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ -export declare function _rawfile(bundleName: string, moduleName: string, name: string): Resource; - -/** - * Obtain the resource in resources/rawfile, used by plugin. - * + * * @param { number } id - Indicates the id of resource. * @param { number } type - Indicates the type of resource. * @param { string } bundleName - Indicates the name of bundle. @@ -77,10 +46,7 @@ export declare function _rawfile(bundleName: string, moduleName: string, name: s * @param { Object[] } params - Custom parameters. * @returns { Resource } Returns the resource instance. * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 - * @arkts 1.2 */ export declare function _rawfile( id: number, type: number, bundleName: string, moduleName: string, ...params: Object[]): Resource; -- Gitee