1/* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { OffscreenCanvasRenderingContext2D } from './viewmodel' 17 18/** 19 * Sets the interval for repeatedly calling a function. 20 * 21 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 22 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 23 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 24 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. 25 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 26 * @returns { number } Returns the timer ID. 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @since 3 29 */ 30export declare function setInterval(handler: Function | string, delay: number, ...arguments: any[]): number; 31 32/** 33 * Sets a timer after which a function will be executed. 34 * 35 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 36 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 37 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 38 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. 39 * If this parameter is left empty, default value "0" will be used, which means that the function will be called immediately or as soon as possible. 40 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 41 * @returns { number } Returns the timer ID. 42 * @syscap SystemCapability.ArkUI.ArkUI.Full 43 * @since 3 44 */ 45export declare function setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number; 46 47/** 48 * Sets a vsync after which a function will be executed. 49 * 50 * @param { Function } handler - Indicates the function to be called when the vsync trigger. 51 * @returns { number } 52 * @syscap SystemCapability.ArkUI.ArkUI.Full 53 * @since 3 54 */ 55export declare function requestAnimationFrame(handler: Function): number; 56 57/** 58 * Cancels the vsync callback set by "requestAnimationFrame()". 59 * 60 * @param { number } requestId - Indicates the vsync callback ID returned by "requestAnimationFrame()". 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @since 3 63 */ 64export declare function cancelAnimationFrame(requestId: number): void; 65 66/** 67 * Cancels the interval set by " setInterval()". 68 * 69 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". 70 * @syscap SystemCapability.ArkUI.ArkUI.Full 71 * @since 3 72 */ 73export declare function clearInterval(intervalID?: number): void; 74 75/** 76 * Cancels the timer set by "setTimeout()". 77 * 78 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". 79 * @syscap SystemCapability.ArkUI.ArkUI.Full 80 * @since 3 81 */ 82export declare function clearTimeout(timeoutID?: number): void; 83 84/** 85 * Get the java interface instance. The java instance needs to register, otherwise it cannot be obtained. 86 * After obtaining the instance, you can call the function with the same name on the Java side. 87 * 88 * @param { string } [name] - Java interface name, including package path, such as com.example.test.timeinterfaceimpl. 89 * @returns { any } A promise object is returned. The resolve callback is the object of PA. 90 * The reject callback returns the object containing code and error data. 91 * @syscap SystemCapability.ArkUI.ArkUI.Full 92 * @since 5 93 * @deprecated since 8 94 */ 95export declare function createLocalParticleAbility(name?: string): any; 96 97/** 98 * Defining syscap function. 99 * 100 * @param { string } syscap 101 * @returns { boolean } 102 * @syscap SystemCapability.ArkUI.ArkUI.Full 103 * @since 8 104 */ 105export declare function canIUse(syscap: string): boolean; 106 107/** 108 * Obtain the objects exposed in app.js 109 * 110 * @returns { object } 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @since 6 113 */ 114export declare function getApp(): object; 115 116/** 117 * You can create an Image object by calling new Image(). 118 * 119 * @syscap SystemCapability.ArkUI.ArkUI.Full 120 * @since 4 121 */ 122export declare class Image { 123 /** 124 * Network address or local resource. The internal URI is supported. 125 * 126 * @type { string } 127 * @syscap SystemCapability.ArkUI.ArkUI.Full 128 * @since 4 129 */ 130 src: string; 131 /** 132 * Image width. 133 * 134 * @type { ?number } 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @since 4 137 */ 138 width?: number; 139 /** 140 * Image height. 141 * 142 * @type { ?number } 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @since 4 145 */ 146 height?: number; 147 /** 148 * Called when an image is successfully loaded. This function has no parameter. 149 * 150 * @type { ?function } 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @since 4 153 */ 154 onload?: () => void; 155 /** 156 * Called when an image fails to be loaded. This function has no parameter. 157 * 158 * @type { ?function } 159 * @syscap SystemCapability.ArkUI.ArkUI.Full 160 * @since 4 161 */ 162 onerror?: () => void; 163} 164 165/** 166 * An ImageData object is a common object that stores the actual pixel data of a Canvas object. 167 * 168 * @syscap SystemCapability.ArkUI.ArkUI.Full 169 * @since 4 170 */ 171export declare class ImageData { 172 /** 173 * Actual width of the ImageData object, in pixels. 174 * 175 * @type { number } 176 * @syscap SystemCapability.ArkUI.ArkUI.Full 177 * @since 4 178 */ 179 width: number; 180 /** 181 * Actual height of the ImageData object, in pixels. 182 * 183 * @type { number } 184 * @syscap SystemCapability.ArkUI.ArkUI.Full 185 * @since 4 186 */ 187 height: number; 188 /** 189 * A one-dimensional array of color values. The color values are sorted in the RGBA order and represented by integers from 0 to 255. 190 * 191 * @type { Uint8ClampedArray } 192 * @syscap SystemCapability.ArkUI.ArkUI.Full 193 * @since 4 194 */ 195 data: Uint8ClampedArray; 196} 197 198/** 199 * OffscreenCanvas provides a Canvas object that can be rendered off-screen. 200 * It works in both window and Web worker environments. 201 * 202 * @syscap SystemCapability.ArkUI.ArkUI.Full 203 * @since 7 204 */ 205export declare class OffscreenCanvas { 206 /** 207 * The width of the offScreen Canvas object 208 * The height of the offScreen Canvas object 209 * 210 * @param { number } width 211 * @param { number } height 212 * @syscap SystemCapability.ArkUI.ArkUI.Full 213 * @since 7 214 */ 215 constructor(width: number, height: number); 216 217 /** 218 * The width of the offScreen Canvas object 219 * 220 * @type { number } 221 * @syscap SystemCapability.ArkUI.ArkUI.Full 222 * @since 7 223 */ 224 width: number; 225 226 /** 227 * The height of the offScreen Canvas object 228 * 229 * @type { number } 230 * @syscap SystemCapability.ArkUI.ArkUI.Full 231 * @since 7 232 */ 233 height: number; 234 235 /** 236 * Gets the context object for off-screen drawing. 237 * 238 * @param { "2d" } contextId - creates a CanvasRenderingContext2D object representing a two-dimensional rendering context. 239 * @param { CanvasRenderingContext2DSettings } [options] - object representing a three-dimensional rendering context. 240 * @returns { OffscreenCanvasRenderingContext2D } a render canvas for the offScreen Canvas object. 241 * @syscap SystemCapability.ArkUI.ArkUI.Full 242 * @since 7 243 */ 244 getContext(contextId: "2d", options?: CanvasRenderingContext2DSettings): OffscreenCanvasRenderingContext2D; 245 246 /** 247 * Converts the draw contents of the current off-screen draw object to a string in the form of a Blob. 248 * 249 * @param { string } [type] - indicating the image format. 250 * @param { number } [quality] - between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. 251 * @returns { string } A Promise returning a Blob object representing the image contained in the canvas. 252 * @syscap SystemCapability.ArkUI.ArkUI.Full 253 * @since 7 254 */ 255 toDataURL(type?: string, quality?: number): string; 256 257 /** 258 * Converts the draw content in the current off-screen draw object to a Bitmap object. 259 * 260 * @returns { ImageBitmap } Returns An ImageBitmap object. 261 * @syscap SystemCapability.ArkUI.ArkUI.Full 262 * @since 7 263 */ 264 transferToImageBitmap(): ImageBitmap; 265} 266 267/** 268 * Defines the ImageBitmap. 269 * 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @since 7 272 */ 273export declare class ImageBitmap { 274 /** 275 * The height of the Image Bitmap object. 276 * 277 * @type { number } 278 * @syscap SystemCapability.ArkUI.ArkUI.Full 279 * @since 7 280 */ 281 readonly height: number; 282 283 /** 284 * The width of the Image Bitmap object. 285 * 286 * @type { number } 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @since 7 289 */ 290 readonly width: number; 291} 292 293/** 294 * Conditional compilation for rich equipment 295 * 296 * @syscap SystemCapability.ArkUI.ArkUI.Full 297 * @systemapi 298 * @since 4 299 */ 300export declare const STANDARD: string; 301 302/** 303 * Conditional compilation for lite equipment 304 * 305 * @syscap SystemCapability.ArkUI.ArkUI.Full 306 * @systemapi 307 * @since 4 308 */ 309export declare const LITE: string; 310