@compass-framework/core 1.2.56 → 1.2.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/@types/AbsoluteLayout.d.ts +6 -0
  2. package/@types/AccelerateDecelerateInterpolator.d.ts +3 -0
  3. package/@types/AccelerateInterpolator.d.ts +3 -0
  4. package/@types/Adapter.d.ts +6 -0
  5. package/@types/AlphaAnimation.d.ts +6 -1
  6. package/@types/Animation.d.ts +15 -2
  7. package/@types/AnimationSet.d.ts +5 -1
  8. package/@types/Animator.d.ts +12 -0
  9. package/@types/Application.d.ts +50 -11
  10. package/@types/ApplicationWindow.d.ts +9 -5
  11. package/@types/ArrayAdapter.d.ts +3 -0
  12. package/@types/Assets.d.ts +3 -0
  13. package/@types/AttributeSet.d.ts +5 -2
  14. package/@types/BaseAdapter.d.ts +3 -0
  15. package/@types/BlendMode.ts +150 -0
  16. package/@types/BounceInterpolator.d.ts +3 -0
  17. package/@types/Button.d.ts +3 -0
  18. package/@types/Canvas.d.ts +46 -60
  19. package/@types/Color.d.ts +40 -30
  20. package/@types/ColorDrawable.d.ts +5 -1
  21. package/@types/ColorFilter.ts +15 -0
  22. package/@types/Configuration.d.ts +3 -0
  23. package/@types/Context.d.ts +21 -3
  24. package/@types/ContextUtils.d.ts +3 -0
  25. package/@types/CornerPathEffect.d.ts +26 -0
  26. package/@types/CornersDrawable.d.ts +15 -6
  27. package/@types/CycleInterpolator.d.ts +3 -0
  28. package/@types/DecelerateInterpolator.d.ts +3 -0
  29. package/@types/DisplayMetrics.d.ts +3 -0
  30. package/@types/DoubleClick.d.ts +3 -0
  31. package/@types/DoubleClickListener.d.ts +6 -0
  32. package/@types/Drawable.d.ts +20 -5
  33. package/@types/EditRichText.d.ts +3 -0
  34. package/@types/EditText.d.ts +3 -0
  35. package/@types/Editable.d.ts +6 -0
  36. package/@types/Environment.ts +3 -0
  37. package/@types/FrameLayout.d.ts +8 -2
  38. package/@types/FreezeAbsoluteLayout.d.ts +6 -0
  39. package/@types/FreezeLayoutViewGroup.d.ts +3 -0
  40. package/@types/Gravity.d.ts +3 -0
  41. package/@types/GridLayout.d.ts +6 -0
  42. package/@types/GridLayoutAnimationController.d.ts +3 -0
  43. package/@types/GridView.d.ts +3 -0
  44. package/@types/HorizontalScrollView.ts +3 -0
  45. package/@types/Image.d.ts +28 -0
  46. package/@types/ImageDrawable.ts +43 -0
  47. package/@types/ImageFilter.ts +13 -0
  48. package/@types/ImageView.d.ts +9 -0
  49. package/@types/InputMethodService.d.ts +6 -0
  50. package/@types/Interpolator.d.ts +6 -0
  51. package/@types/KeyEvent.d.ts +3 -0
  52. package/@types/LayerDrawable.d.ts +6 -2
  53. package/@types/LayoutAnimationController.d.ts +9 -0
  54. package/@types/LayoutInflater.ts +3 -0
  55. package/@types/LinearGradient.d.ts +22 -2
  56. package/@types/LinearGradientDrawable.d.ts +3 -0
  57. package/@types/LinearInterpolator.d.ts +3 -0
  58. package/@types/LinearLayout.d.ts +6 -0
  59. package/@types/ListAdapter.d.ts +6 -0
  60. package/@types/ListView.d.ts +3 -0
  61. package/@types/Matrix.d.ts +110 -53
  62. package/@types/MotionEvent.d.ts +9 -0
  63. package/@types/{ICursor.d.ts → MouseCursor.ts} +18 -7
  64. package/@types/Outline.d.ts +6 -2
  65. package/@types/Paint.d.ts +141 -76
  66. package/@types/Path.d.ts +86 -44
  67. package/@types/PathEffect.ts +7 -1
  68. package/@types/Picture.d.ts +24 -15
  69. package/@types/PictureDrawable.d.ts +7 -5
  70. package/@types/PixelFormat.ts +3 -0
  71. package/@types/PopupWindow.d.ts +9 -6
  72. package/@types/PropertyValuesHolder.d.ts +3 -0
  73. package/@types/Rect.d.ts +66 -43
  74. package/@types/RelativeLayout.d.ts +6 -0
  75. package/@types/RendererBackend.ts +8 -0
  76. package/@types/Resolver.ts +7 -2
  77. package/@types/Resources.d.ts +3 -0
  78. package/@types/ResourcesInflater.d.ts +3 -0
  79. package/@types/RotateAnimation.d.ts +7 -3
  80. package/@types/ScaleAnimation.d.ts +7 -3
  81. package/@types/ScrollView.d.ts +3 -0
  82. package/@types/Shader.d.ts +15 -1
  83. package/@types/Shadow.d.ts +32 -6
  84. package/@types/Slot.d.ts +9 -0
  85. package/@types/Surface.d.ts +32 -0
  86. package/@types/SurfaceProvider.d.ts +25 -0
  87. package/@types/TabBarLayout.d.ts +12 -0
  88. package/@types/TableLayout.d.ts +6 -0
  89. package/@types/TableRow.d.ts +6 -0
  90. package/@types/TextView.d.ts +3 -0
  91. package/@types/Theme.d.ts +9 -0
  92. package/@types/TimeInterpolator.d.ts +6 -0
  93. package/@types/Transformation.d.ts +6 -0
  94. package/@types/TranslateAnimation.d.ts +6 -2
  95. package/@types/TypeEvaluator.d.ts +3 -0
  96. package/@types/Typeface.d.ts +21 -3
  97. package/@types/TypefaceFactory.d.ts +40 -4
  98. package/@types/ValueAnimator.d.ts +12 -0
  99. package/@types/View.d.ts +66 -0
  100. package/@types/ViewGroup.d.ts +9 -0
  101. package/@types/ViewGroupOverlay.d.ts +3 -0
  102. package/@types/ViewOutlineProvider.d.ts +3 -0
  103. package/@types/ViewOverlay.d.ts +3 -0
  104. package/@types/ViewParent.d.ts +6 -0
  105. package/@types/ViewSlot.d.ts +3 -0
  106. package/@types/ViewTreeObserver.d.ts +27 -0
  107. package/@types/{IWindow.d.ts → Window.d.ts} +10 -4
  108. package/@types/WindowManager.d.ts +14 -6
  109. package/@types/XMLLayoutParser.d.ts +3 -0
  110. package/@types/XMLResourcesParser.d.ts +3 -0
  111. package/@types/XMLViewFactoryRegistry.d.ts +18 -0
  112. package/index.d.ts +111 -113
  113. package/package.json +2 -2
  114. package/@types/ApplicationBoot.ts +0 -10
  115. package/@types/ApplicationContext.d.ts +0 -3
  116. package/@types/ApplicationFrame.d.ts +0 -33
  117. package/@types/ApplicationFrameContext.ts +0 -5
  118. package/@types/ApplicationFrameObserver.d.ts +0 -17
  119. package/@types/ApplicationFrameSettings.ts +0 -5
  120. package/@types/ApplicationManifest.d.ts +0 -5
  121. package/@types/Bitmap.d.ts +0 -7
  122. package/@types/BitmapDrawable.d.ts +0 -31
  123. package/@types/CornerPathEffect.ts +0 -7
  124. package/@types/InputMethodServer.ts +0 -1
  125. package/@types/Readying.ts +0 -3
  126. package/@types/StackLayout.d.ts +0 -9
  127. package/@types/WindowContext.d.ts +0 -9
@@ -1,8 +1,14 @@
1
1
  import { ViewGroup } from "./ViewGroup";
2
2
 
3
+ /**
4
+ * 绝对定位布局,子视图按指定坐标放置。
5
+ */
3
6
  export declare class AbsoluteLayout extends ViewGroup {}
4
7
 
5
8
  export declare namespace AbsoluteLayout {
9
+ /**
10
+ * AbsoluteLayout 的布局参数,包含子视图的 X/Y 坐标。
11
+ */
6
12
  export class LayoutParams extends ViewGroup.LayoutParams {
7
13
  public getX(): number;
8
14
 
@@ -4,6 +4,9 @@ import {
4
4
  Interpolator,
5
5
  } from "./Interpolator";
6
6
 
7
+ /**
8
+ * 先加速后减速插值器。
9
+ */
7
10
  @Implements(Interpolator)
8
11
  export declare class AccelerateDecelerateInterpolator implements Interpolator {
9
12
  public getInterpolation(input: number): number;
@@ -4,6 +4,9 @@ import {
4
4
  Interpolator,
5
5
  } from "./Interpolator";
6
6
 
7
+ /**
8
+ * 加速插值器。
9
+ */
7
10
  @Implements(Interpolator)
8
11
  export declare class AccelerateInterpolator implements Interpolator {
9
12
  public constructor();
@@ -2,6 +2,9 @@ import { InterfaceTemplate } from "@compass-framework/library";
2
2
  import { View } from "./View";
3
3
  import { ViewGroup } from "./ViewGroup";
4
4
 
5
+ /**
6
+ * 适配器接口,为列表类控件提供数据与视图绑定。
7
+ */
5
8
  export declare interface Adapter {
6
9
  getCount(): number;
7
10
 
@@ -20,6 +23,9 @@ export declare interface Adapter {
20
23
  getItemViewType(position: number): number;
21
24
  }
22
25
 
26
+ /**
27
+ * Adapter 的接口模板实现。
28
+ */
23
29
  export class Adapter extends InterfaceTemplate {
24
30
 
25
31
  }
@@ -1,7 +1,12 @@
1
1
  import { Transformation } from "./Transformation";
2
+ import { Animation } from "./Animation";
3
+ import { Context } from "./Context";
2
4
 
5
+ /**
6
+ * 透明度动画。
7
+ */
3
8
  export declare class AlphaAnimation extends Animation {
4
- public constructor(fromAlpha: number, toAlpha: number);
9
+ public constructor(context: Context, fromAlpha: number, toAlpha: number) ;
5
10
 
6
11
  public applyTransformation(interpolatedTime: number, t: Transformation): void;
7
12
 
@@ -3,7 +3,11 @@ import { Rect } from './Rect';
3
3
  import { Transformation } from './Transformation';
4
4
  import { Interpolator } from './Interpolator';
5
5
  import { AttributeSet } from "./AttributeSet";
6
+ import { Context } from "./Context";
6
7
 
8
+ /**
9
+ * 视图动画的基类。
10
+ */
7
11
  export declare abstract class Animation {
8
12
  public static INFINITE: number;
9
13
  public static RESTART: number;
@@ -16,8 +20,8 @@ export declare abstract class Animation {
16
20
  public static ZORDER_TOP: number;
17
21
  public static ZORDER_BOTTOM: number;
18
22
 
19
- protected constructor();
20
- protected constructor(attribute: AttributeSet);
23
+ protected constructor(context: Context);
24
+ protected constructor(context: Context, attribute: AttributeSet);
21
25
 
22
26
  public clone(): Animation;
23
27
 
@@ -107,7 +111,13 @@ export declare abstract class Animation {
107
111
  public initializeInvalidateRegion(left: number, top: number, right: number, bottom: number): void;
108
112
  }
109
113
 
114
+ /**
115
+ * 视图动画相关类型。
116
+ */
110
117
  export declare namespace Animation {
118
+ /**
119
+ * 动画生命周期监听器。
120
+ */
111
121
  export interface AnimationListener {
112
122
  onAnimationStart(animation: Animation): void
113
123
 
@@ -116,6 +126,9 @@ export declare namespace Animation {
116
126
  onAnimationRepeat(animation: Animation): void;
117
127
  }
118
128
 
129
+ /**
130
+ * 动画生命周期监听器实现类。
131
+ */
119
132
  export class AnimationListener extends InterfaceTemplate {
120
133
 
121
134
  }
@@ -1,7 +1,11 @@
1
1
  import { List } from "@compass-framework/library";
2
2
  import { Animation } from "./Animation";
3
3
  import { Transformation } from "./Transformation";
4
+ import { Context } from "./Context";
4
5
 
6
+ /**
7
+ * 动画集合,可组合多个动画同时播放。
8
+ */
5
9
  export declare class AnimationSet extends Animation {
6
10
  public static PROPERTY_FILL_AFTER_MASK: number;
7
11
  public static PROPERTY_FILL_BEFORE_MASK: number;
@@ -12,7 +16,7 @@ export declare class AnimationSet extends Animation {
12
16
  public static PROPERTY_MORPH_MATRIX_MASK: number;
13
17
  public static PROPERTY_CHANGE_BOUNDS_MASK: number;
14
18
 
15
- public constructor(shareInterpolator: boolean);
19
+ public constructor(context: Context, shareInterpolator: boolean) ;
16
20
 
17
21
  public clone(): AnimationSet;
18
22
 
@@ -2,6 +2,9 @@ import { ArrayList, InterfaceTemplate } from "@compass-framework/library";
2
2
  import { Context } from "./Context";
3
3
  import { TimeInterpolator } from "./TimeInterpolator";
4
4
 
5
+ /**
6
+ * 属性动画的基类。
7
+ */
5
8
  export declare abstract class Animator {
6
9
  public constructor(context: Context);
7
10
 
@@ -40,7 +43,13 @@ export declare abstract class Animator {
40
43
  public setupStartValues(): void;
41
44
  }
42
45
 
46
+ /**
47
+ * 属性动画相关类型。
48
+ */
43
49
  export declare namespace Animator {
50
+ /**
51
+ * 动画器生命周期监听器。
52
+ */
44
53
  export interface AnimatorListener {
45
54
  onAnimationStart(animation: Animator): void;
46
55
 
@@ -51,5 +60,8 @@ export declare namespace Animator {
51
60
  onAnimationRepeat(animation: Animator): void;
52
61
  }
53
62
 
63
+ /**
64
+ * 动画器生命周期监听器实现类。
65
+ */
54
66
  export class AnimatorListener extends InterfaceTemplate {}
55
67
  }
@@ -1,19 +1,58 @@
1
- import { ApplicationContext } from "./ApplicationContext";
2
- import { ApplicationManifest } from "./ApplicationManifest";
3
- import { ApplicationFrame } from "./ApplicationFrame";
1
+ import { Consumer } from "@compass-framework/library";
2
+ import { Context } from "./Context";
3
+ import { RendererBackend } from "./RendererBackend";
4
+ import { Window } from "./Window";
5
+ import { InputMethodService } from "./InputMethodService";
4
6
 
5
- export declare class Application {
6
- public constructor(applicationManifest: ApplicationManifest);
7
+ /**
8
+ * Web 端应用启动配置。
9
+ */
10
+ export interface WebApplicationConfig {
11
+ ime?: () => InputMethodService
12
+ container?: string | HTMLElement
13
+ }
14
+
15
+ /**
16
+ * CanvasKit 渲染后端的应用启动配置。
17
+ */
18
+ export interface CanvaskitApplicationConfig extends WebApplicationConfig {
19
+
20
+ }
7
21
 
8
- public attachFrame(applicationFrame: ApplicationFrame): void;
22
+ /**
23
+ * Node 端应用启动配置。
24
+ */
25
+ export interface NodeApplicationConfig {
26
+ width: number;
27
+ height: number;
28
+ }
9
29
 
10
- public detachFrame(applicationFrame: ApplicationFrame): void;
30
+ /**
31
+ * 应用程序入口与生命周期管理。
32
+ */
33
+ export declare interface Application {
34
+ onReady(consumer: Consumer<Context>): void;
11
35
 
12
- public onInstall(applicationContext: ApplicationContext): void;
36
+ addWindow(window: Window): void;
13
37
 
14
- public onUninstall(): void;
38
+ removeWindow(window: Window): void;
39
+ }
15
40
 
16
- public getApplicationContext(): ApplicationContext;
41
+ /**
42
+ * Application 工厂与配置映射。
43
+ */
44
+ export namespace Application {
45
+ /**
46
+ * 按渲染后端区分的应用配置映射。
47
+ */
48
+ export interface ApplicationConfig {
49
+ [RendererBackend.CanvasKit]: CanvaskitApplicationConfig,
50
+ [RendererBackend.Web]: WebApplicationConfig,
51
+ [RendererBackend.Node]: NodeApplicationConfig,
52
+ }
17
53
 
18
- public getApplicationManifest(): ApplicationManifest;
54
+ /**
55
+ * 按渲染后端创建应用实例。
56
+ */
57
+ export function create<T extends keyof ApplicationConfig>(render: RendererBackend, config: ApplicationConfig[T]): Application;
19
58
  }
@@ -1,14 +1,18 @@
1
1
  import { ArrayList, Implements, XML } from "@compass-framework/library";
2
- import { IWindow } from "./IWindow";
3
2
  import { Resources } from "./Resources";
4
3
  import { View } from "./View";
5
4
  import { WindowContext } from "./WindowContext";
6
- import { ViewGroup } from "./ViewGroup";
7
5
  import { WindowManager } from "./WindowManager";
6
+ import { ViewGroup } from "./ViewGroup";
7
+ import { Context } from "./Context";
8
+ import { Window } from "./Window";
8
9
  import { Configuration } from "./Configuration";
9
10
 
10
- @Implements(IWindow)
11
- export declare class ApplicationWindow implements IWindow {
11
+ /**
12
+ * 应用程序主窗口,承载内容视图与窗口生命周期。
13
+ */
14
+ @Implements(Window)
15
+ export declare class ApplicationWindow implements Window {
12
16
  public constructor();
13
17
  public constructor(context: WindowContext);
14
18
 
@@ -35,7 +39,7 @@ export declare class ApplicationWindow implements IWindow {
35
39
 
36
40
  public getResources(): Resources;
37
41
 
38
- public getWindowContext(): WindowContext;
42
+ public getContext(): Context;
39
43
 
40
44
  public setContentXML(xml: XML): void;
41
45
 
@@ -4,6 +4,9 @@ import { BaseAdapter } from "./BaseAdapter";
4
4
  import { Context } from "./Context";
5
5
  import { ViewGroup } from "./ViewGroup";
6
6
 
7
+ /**
8
+ * 基于数组/列表数据的通用适配器,支持增删排序与变更通知。
9
+ */
7
10
  export declare class ArrayAdapter<T> extends BaseAdapter {
8
11
  public constructor(context: Context, textViewResourceId: number);
9
12
  public constructor(context: Context, resource: number, textViewResourceId: number);
@@ -1,3 +1,6 @@
1
+ /**
2
+ * 资源资产访问,按名称解析资产 ID。
3
+ */
1
4
  export declare class Assets {
2
5
  public getAssetsId(name: string, defaultValue?: number): number;
3
6
  }
@@ -4,6 +4,9 @@ import { PictureDrawable } from "./PictureDrawable";
4
4
  import { Drawable } from "./Drawable";
5
5
  import { ColorDrawable } from "./ColorDrawable";
6
6
 
7
+ /**
8
+ * 属性集合,从资源或布局中按名称读取类型化属性值。
9
+ */
7
10
  export declare abstract class AttributeSet {
8
11
  public abstract getNumber(name: string, defaultValue?: number): number;
9
12
 
@@ -17,8 +20,6 @@ export declare abstract class AttributeSet {
17
20
 
18
21
  public abstract getResources(): Resources;
19
22
 
20
- public abstract getConvert<T, R>(name: string, action: Influence<string, Nullable<R>>, defaultValue?: R): R;
21
-
22
23
  public abstract getText(name: string, defaultValue?: CharSequence): CharSequence;
23
24
 
24
25
  public abstract getDimension(name: string, defaultValue?: number): number;
@@ -29,6 +30,8 @@ export declare abstract class AttributeSet {
29
30
 
30
31
  public abstract getString(name: string, defaultValue?: string): string;
31
32
 
33
+ public abstract getConvert<T, R>(name: string, action: Influence<string, Nullable<R>>, defaultValue?: R): R;
34
+
32
35
  public abstract getDrawable(name: string, defaultValue?: Drawable): Drawable;
33
36
 
34
37
  public abstract getAttributeCount(): number;
@@ -3,6 +3,9 @@ import { ListAdapter } from "./ListAdapter";
3
3
  import { View } from "./View";
4
4
  import { ViewGroup } from "./ViewGroup";
5
5
 
6
+ /**
7
+ * 列表适配器基类,提供 ListAdapter 的默认实现骨架。
8
+ */
6
9
  @Implements(ListAdapter)
7
10
  export declare abstract class BaseAdapter implements ListAdapter {
8
11
  protected constructor();
@@ -0,0 +1,150 @@
1
+ /**
2
+ * 混合模式,控制源像素与目标像素的合成方式。
3
+ */
4
+ export enum BlendMode {
5
+ /**
6
+ * Clears the destination.
7
+ */
8
+ Clear = "clear",
9
+
10
+ /**
11
+ * Replaces the destination with the source.
12
+ */
13
+ Src = "src",
14
+
15
+ /**
16
+ * Preserves the destination and discards the source.
17
+ */
18
+ Dst = "dst",
19
+
20
+ /**
21
+ * Source over destination.
22
+ */
23
+ SrcOver = "src-over",
24
+
25
+ /**
26
+ * Destination over source.
27
+ */
28
+ DstOver = "dst-over",
29
+
30
+ /**
31
+ * Source inside destination.
32
+ */
33
+ SrcIn = "src-in",
34
+
35
+ /**
36
+ * Destination inside source.
37
+ */
38
+ DstIn = "dst-in",
39
+
40
+ /**
41
+ * Source outside destination.
42
+ */
43
+ SrcOut = "src-out",
44
+
45
+ /**
46
+ * Destination outside source.
47
+ */
48
+ DstOut = "dst-out",
49
+
50
+ /**
51
+ * Source atop destination.
52
+ */
53
+ SrcATop = "src-atop",
54
+
55
+ /**
56
+ * Destination atop source.
57
+ */
58
+ DstATop = "dst-atop",
59
+
60
+ /**
61
+ * Exclusive-or source and destination.
62
+ */
63
+ Xor = "xor",
64
+
65
+ /**
66
+ * Adds source and destination.
67
+ */
68
+ Plus = "plus",
69
+
70
+ /**
71
+ * Multiplies source and destination.
72
+ */
73
+ Modulate = "modulate",
74
+
75
+ /**
76
+ * Multiplies source and destination colors.
77
+ */
78
+ Multiply = "multiply",
79
+
80
+ /**
81
+ * Produces the inverse of multiply.
82
+ */
83
+ Screen = "screen",
84
+
85
+ /**
86
+ * Combines multiply and screen.
87
+ */
88
+ Overlay = "overlay",
89
+
90
+ /**
91
+ * Selects the darker color.
92
+ */
93
+ Darken = "darken",
94
+
95
+ /**
96
+ * Selects the lighter color.
97
+ */
98
+ Lighten = "lighten",
99
+
100
+ /**
101
+ * Brightens the destination to reflect the source.
102
+ */
103
+ ColorDodge = "color-dodge",
104
+
105
+ /**
106
+ * Darkens the destination to reflect the source.
107
+ */
108
+ ColorBurn = "color-burn",
109
+
110
+ /**
111
+ * Multiplies or screens depending on the source.
112
+ */
113
+ HardLight = "hard-light",
114
+
115
+ /**
116
+ * Soft-light blend.
117
+ */
118
+ SoftLight = "soft-light",
119
+
120
+ /**
121
+ * Subtracts the darker color from the lighter color.
122
+ */
123
+ Difference = "difference",
124
+
125
+ /**
126
+ * Similar to difference but with lower contrast.
127
+ */
128
+ Exclusion = "exclusion",
129
+
130
+ /**
131
+ * Preserves the hue of the source.
132
+ */
133
+ Hue = "hue",
134
+
135
+ /**
136
+ * Preserves the saturation of the source.
137
+ */
138
+ Saturation = "saturation",
139
+
140
+ /**
141
+ * Uses the hue and saturation of the source and
142
+ * the luminosity of the destination.
143
+ */
144
+ Color = "color",
145
+
146
+ /**
147
+ * Preserves the luminosity of the source.
148
+ */
149
+ Luminosity = "luminosity",
150
+ }
@@ -1,6 +1,9 @@
1
1
  import { Implements } from "@compass-framework/library";
2
2
  import { Interpolator } from "./Interpolator";
3
3
 
4
+ /**
5
+ * 弹跳插值器。
6
+ */
4
7
  @Implements(Interpolator)
5
8
  export declare class BounceInterpolator implements Interpolator {
6
9
  public getInterpolation(t: number): number;
@@ -1,3 +1,6 @@
1
1
  import { TextView } from "./TextView";
2
2
 
3
+ /**
4
+ * 按钮控件,基于 TextView 的可点击交互组件。
5
+ */
3
6
  export declare class Button extends TextView {}
@@ -1,110 +1,96 @@
1
1
  import { CharSequence } from "@compass-framework/library";
2
- import { Paint } from "./Paint";
3
- import { Path } from "./Path";
4
- import { Picture } from "./Picture";
5
2
  import { Rect } from "./Rect";
3
+ import { Paint } from "./Paint";
6
4
  import { Matrix } from "./Matrix";
7
- import { Bitmap } from "./Bitmap";
5
+ import { Path } from "./Path";
6
+ import { Image } from "./Image";
7
+ import { ImageFilter } from "./ImageFilter";
8
8
 
9
- export declare class Canvas {
10
- constructor();
11
- constructor(width: number, height: number);
9
+ /**
10
+ * 画布,提供路径、文本、图像等绘制能力。
11
+ */
12
+ export interface Canvas {
13
+ translate(dx: number, dy: number): void;
12
14
 
13
15
  rotate(degrees: number): void;
14
16
  rotate(degrees: number, px: number, py: number): void;
15
17
 
16
18
  scale(sx: number, sy: number): void;
17
19
 
18
- concat(matrix: Matrix): void;
19
-
20
- translate(dx: number, dy: number): void;
21
-
22
20
  save(): number;
23
21
 
24
22
  restore(): void;
25
23
 
26
- clearCanvas(): void;
24
+ clipRRect(rect: Rect, radius: number): void;
25
+ clipRRect(rect: Rect, ltr: number, lbr: number, rtr: number, rbr: number): void;
26
+ clipRRect(left: number, top: number, right: number, bottom: number, ltr: number, lbr: number, rtr: number, rbr: number): void
27
+
28
+ saveLayer(paint: Paint, filter?: ImageFilter): number;
29
+ saveLayer(left: number, top: number, right: number, bottom: number, paint: Paint): number;
30
+ saveLayer(left:number, top:number, right:number, bottom:number, paint: Paint, filter?: ImageFilter): number;
31
+
32
+ restoreToCount(count: number): void
33
+
27
34
  clearCanvas(rect: Rect): void;
28
- clearCanvas(width: number, height: number): void;
35
+ clearCanvas(left: number, top: number, right: number, bottom: number): void;
29
36
 
30
- setBitmap(bitmap: Bitmap): void;
37
+ getMatrix(): Matrix;
31
38
 
32
39
  getClipBounds(): Rect;
33
40
  getClipBounds(rect: Rect): boolean;
34
41
 
35
- getMatrix(): Matrix;
42
+ getSaveCount(): number
43
+
44
+ clipPath(path: Path): void;
36
45
 
37
46
  getWidth(): number;
38
47
 
39
48
  getHeight(): number;
40
49
 
41
- clipRRect(rect: Rect, radius: number): void;
42
- clipRRect(rect: Rect, ltr: number, lbr: number, rtr: number, rbr: number): void;
43
- clipRRect(left: number, top: number, right: number, bottom: number, ltr: number, lbr: number, rtr: number, rbr: number): void;
44
-
45
- clipPath(path: Path): void;
46
-
47
50
  clipRect(rect: Rect): void;
48
51
  clipRect(left: number, top: number, right: number, bottom: number): void;
49
52
 
53
+ concat(matrix: Matrix): void;
54
+
50
55
  quickReject(rect: Rect): boolean;
51
- quickReject(path: Path): boolean;
56
+ quickReject(rect: Path): boolean;
52
57
  quickReject(left: number, top: number, right: number, bottom: number): boolean;
53
58
 
54
- drawOval(oval: Rect, paint: Paint): void;
55
- drawOval(left: number, top: number, right: number, bottom: number, paint: Paint): void;
59
+ drawArc(oval: Rect, startAngle: number, sweepAngle: number, useCenter: boolean, paint: Paint): void;
60
+ drawArc(left: number, top: number, right: number, bottom: number, startAngle: number, sweepAngle: number, useCenter: boolean, paint: Paint): void;
61
+
62
+ drawDashLines(pts: number[], dash: number[], offset: number, paint: Paint): void;
56
63
 
57
64
  drawRect(rect: Rect, paint: Paint): void;
58
65
  drawRect(left: number, top: number, right: number, bottom: number, paint: Paint): void;
59
66
 
60
- drawLine(sx: number, sy: number, ex: number, ey: number, paint: Paint): void;
61
-
62
- drawLines(pts: number[], paint: Paint): void;
63
-
64
67
  drawPath(path: Path, paint: Paint): void;
65
68
 
66
- drawRRect(rect: Rect, radius: number, paint: Paint): void;
67
- drawRRect(rect: Rect, ltr: number, lbr: number, rtr: number, rbr: number, paint: Paint): void;
68
- drawRRect(left: number, top: number, right: number, bottom: number, ltr: number, lbr: number, rtr: number, rbr: number, paint: Paint): void;
69
-
70
- drawPicture(canvas: Picture): void;
71
- drawPicture(canvas: Picture, dst: Rect): void;
72
- drawPicture(canvas: Picture, dst: Rect, paint: Paint): void;
73
-
74
69
  drawText(text: CharSequence, x: number, y: number, paint: Paint): void;
75
70
  drawText(text: CharSequence, start: number, end: number, x: number, y: number, paint: Paint): void;
76
71
 
77
- drawDashLine(sx: number, sy: number, ex: number, ey: number, dash: number[], offset: number, paint: Paint): void;
72
+ drawCircle(cx: number, cy: number, radius: number, paint: Paint): void;
78
73
 
79
- drawDashLines(pts: number[], dash: number[], offset: number, paint: Paint): void;
74
+ drawLine(sx: number, sy: number, ex: number, ey: number, paint: Paint): void;
80
75
 
81
- drawBitmap(bitmap: Bitmap, pt: number[], paint: Paint): void;
82
- drawBitmap(bitmap: Bitmap, left: number, top: number, paint: Paint): void;
83
- drawBitmap(bitmap: Bitmap, src: Rect, dst: Rect, paint: Paint): void;
76
+ drawLines(pts: number[], paint: Paint): void;
84
77
 
85
- drawCircle(cx: number, cy: number, radius: number, paint: Paint): void;
78
+ drawOval(oval: Rect, paint: Paint): void;
79
+ drawOval(left: number, top: number, right: number, bottom: number, paint: Paint): void;
86
80
 
87
- drawArc(oval: Rect, startAngle: number, sweepAngle: number, useCenter: boolean, paint: Paint): void;
88
- drawArc(left: number, top: number, right: number, bottom: number, startAngle: number, sweepAngle: number, useCenter: boolean, paint: Paint): void;
81
+ drawImage(image: Image, paint: Paint): void;
82
+ drawImage(image: Image, dst: Rect, paint: Paint): void;
83
+ drawImage(image: Image, src: Rect, dst: Rect, paint: Paint): void
89
84
 
90
- drawRGB(rect: Rect, r: number, g: number, b: number): void;
91
- drawRGB(rect: Rect, r: number, g: number, b: number, paint: Paint): void;
92
- drawRGB(left: number, top: number, right: number, bottom: number, r: number, g: number, b: number): void;
93
- drawRGB(left: number, top: number, right: number, bottom: number, r: number, g: number, b: number, paint: Paint): void;
85
+ drawColor(color: number): void;
94
86
 
95
- drawARGB(rect: Rect, a: number, r: number, g: number, b: number): void;
96
- drawARGB(rect: Rect, a: number, r: number, g: number, b: number, paint: Paint): void;
97
- drawARGB(left: number, top: number, right: number, bottom: number, a: number, r: number, g: number, b: number): void;
98
- drawARGB(left: number, top: number, right: number, bottom: number, a: number, r: number, g: number, b: number, paint: Paint): void;
87
+ drawRGB(r: number, g: number, b: number): void;
99
88
 
100
- drawColor(rect: Rect, color: number): void;
101
- drawColor(rect: Rect, color: number, paint: Paint): void;
102
- drawColor(left: number, top: number, right: number, bottom: number, color: number): void;
103
- drawColor(left: number, top: number, right: number, bottom: number, color: number, paint: Paint): void;
104
- }
89
+ drawARGB(a: number, r: number, g: number, b: number): void;
105
90
 
106
- export declare namespace Canvas {
107
- export function build(): Canvas;
91
+ drawRRect(rect: Rect, radius: number, paint: Paint): void;
92
+ drawRRect(rect: Rect, ltr: number, lbr: number, rtr: number, rbr: number, paint: Paint): void
93
+ drawRRect(left: number, top: number, right: number, bottom: number, ltr: number, lbr: number, rtr: number, rbr: number, paint: Paint): void
108
94
 
109
- export function radians(degrees: number): number;
95
+ drawDashLine(sx: number, sy: number, ex: number, ey: number, dash: number[], offset: number, paint: Paint): void;
110
96
  }