美素佳儿 litter wizard小游戏
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

15276 linhas
581KB

  1. /**
  2. * @language en_US
  3. * Is debug mode.
  4. * @version Egret 2.5
  5. * @platform Web,Native
  6. */
  7. /**
  8. * @language zh_CN
  9. * 是否为 debug 模式。
  10. * @version Egret 2.5
  11. * @platform Web,Native
  12. */
  13. declare let DEBUG: boolean;
  14. /**
  15. * @language en_US
  16. * Is release mode.
  17. * @version Egret 2.5
  18. * @platform Web,Native
  19. */
  20. /**
  21. * @language zh_CN
  22. * 是否为 release 模式。
  23. * @version Egret 2.5
  24. * @platform Web,Native
  25. */
  26. declare let RELEASE: boolean;
  27. declare namespace egret {
  28. function $error(code: number, ...params: any[]): void;
  29. function $warn(code: number, ...params: any[]): void;
  30. function getString(code: number, ...params: any[]): string;
  31. function $markReadOnly(instance: any, property: string, isProperty?: boolean): void;
  32. function $markCannotUse(instance: any, property: string, defaultVale: any): void;
  33. }
  34. declare namespace egret {
  35. /**
  36. * @language en_US
  37. * Registers the runtime class information for a class.This method adds some strings which represent the class name or
  38. * some interface names to the class definition. After the registration,you can use egret.is() method to do the type checking
  39. * for the instance of this class.<br/>
  40. * Note:If you use the TypeScript programming language, the egret command line tool will automatically generate the registration code line.
  41. * You don't need to manually call this method.
  42. *
  43. * @example the following code shows how to register the runtime class information for the EventDispatcher class and do the type checking:
  44. * <pre>
  45. * egret.registerClass(egret.EventDispatcher,"egret.EventDispatcher",["egret.IEventDispatcher"]);
  46. * let dispatcher = new egret.EventDispatcher();
  47. * egret.log(egret.is(dispatcher, "egret.IEventDispatcher")); //true。
  48. * egret.log(egret.is(dispatcher, "egret.EventDispatcher")); //true。
  49. * egret.log(egret.is(dispatcher, "egret.Bitmap")); //false。
  50. * </pre>
  51. * @param classDefinition the class definition to be registered.
  52. * @param className a unique identification string of the specific class
  53. * @param interfaceNames a list of unique identification string of the specific interfaces.
  54. * @version Egret 2.4
  55. * @platform Web,Native
  56. */
  57. /**
  58. * @language zh_CN
  59. * 为一个类定义注册运行时类信息,用此方法往类定义上注册它自身以及所有接口对应的字符串。
  60. * 在运行时,这个类的实例将可以使用 egret.is() 方法传入一个字符串来判断实例类型。
  61. * @example 以下代码演示了如何为EventDispatcher类注册运行时类信息并判断类型:
  62. * <pre>
  63. * //为egret.EventDispatcher类注册运行时类信息,由于它实现了IEventDispatcher接口,这里应同时传入接口名对应的字符串。
  64. * egret.registerClass(egret.EventDispatcher,"egret.EventDispatcher",["egret.IEventDispatcher"]);
  65. * let dispatcher = new egret.EventDispatcher();
  66. * egret.log(egret.is(dispatcher, "egret.IEventDispatcher")); //true。
  67. * egret.log(egret.is(dispatcher, "egret.EventDispatcher")); //true。
  68. * egret.log(egret.is(dispatcher, "egret.Bitmap")); //false。
  69. * </pre>
  70. * 注意:若您使用 TypeScript 来编写程序,egret 命令行会自动帮您生成类信息注册代码行到最终的 Javascript 文件中。因此您不需要手动调用此方法。
  71. *
  72. * @param classDefinition 要注册的类定义。
  73. * @param className 要注册的类名。
  74. * @param interfaceNames 要注册的类所实现的接口名列表。
  75. * @version Egret 2.4
  76. * @platform Web,Native
  77. */
  78. function registerClass(classDefinition: any, className: string, interfaceNames?: string[]): void;
  79. }
  80. declare function __extends(d: any, b: any): void;
  81. declare let __define: any;
  82. declare namespace egret {
  83. /**
  84. * @language en_US
  85. * The HashObject class is the base class for all objects in the Egret framework.The HashObject
  86. * class includes a hashCode property, which is a unique identification number of the instance.
  87. * @version Egret 2.4
  88. * @platform Web,Native
  89. */
  90. /**
  91. * @language zh_CN
  92. * Egret顶级对象。框架内所有对象的基类,为对象实例提供唯一的hashCode值。
  93. * @version Egret 2.4
  94. * @platform Web,Native
  95. */
  96. interface IHashObject {
  97. /**
  98. * @language en_US
  99. * a unique identification number assigned to this instance.
  100. * @version Egret 2.4
  101. * @platform Web,Native
  102. * @readOnly
  103. */
  104. /**
  105. * @language zh_CN
  106. * 返回此对象唯一的哈希值,用于唯一确定一个对象。hashCode为大于等于1的整数。
  107. * @version Egret 2.4
  108. * @platform Web,Native
  109. * @readOnly
  110. */
  111. hashCode: number;
  112. }
  113. /**
  114. * @private
  115. * 哈希计数
  116. */
  117. let $hashCount: number;
  118. /**
  119. * @language en_US
  120. * The HashObject class is the base class for all objects in the Egret framework.The HashObject
  121. * class includes a hashCode property, which is a unique identification number of the instance.
  122. * @version Egret 2.4
  123. * @platform Web,Native
  124. */
  125. /**
  126. * @language zh_CN
  127. * Egret顶级对象。框架内所有对象的基类,为对象实例提供唯一的hashCode值。
  128. * @version Egret 2.4
  129. * @platform Web,Native
  130. */
  131. class HashObject implements IHashObject {
  132. /**
  133. * @language en_US
  134. * Initializes a HashObject
  135. * @version Egret 2.4
  136. * @platform Web,Native
  137. */
  138. /**
  139. * @language zh_CN
  140. * 创建一个 HashObject 对象
  141. * @version Egret 2.4
  142. * @platform Web,Native
  143. */
  144. constructor();
  145. /**
  146. * @private
  147. */
  148. $hashCode: number;
  149. /**
  150. * @language en_US
  151. * a unique identification number assigned to this instance.
  152. * @version Egret 2.4
  153. * @platform Web,Native
  154. */
  155. /**
  156. * @language zh_CN
  157. * 返回此对象唯一的哈希值,用于唯一确定一个对象。hashCode为大于等于1的整数。
  158. * @version Egret 2.4
  159. * @platform Web,Native
  160. */
  161. hashCode: number;
  162. }
  163. /**
  164. * @private
  165. */
  166. interface AsyncCallback {
  167. onSuccess: (data: any) => any;
  168. onFail: (error: number, data: any) => any;
  169. }
  170. }
  171. declare namespace egret {
  172. /**
  173. * @language en_US
  174. * A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its
  175. * width and its height.<br/>
  176. * The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of
  177. * one property has no effect on the others. However, the right and bottom properties are integrally related to those
  178. * four properties. For example, if you change the value of the right property, the value of the width property changes;
  179. * if you change the bottom property, the value of the height property changes.
  180. * @version Egret 2.4
  181. * @platform Web,Native
  182. * @includeExample egret/geom/Rectangle.ts
  183. */
  184. /**
  185. * @language zh_CN
  186. * Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。<br/>
  187. * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。
  188. * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width
  189. * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。
  190. * @version Egret 2.4
  191. * @platform Web,Native
  192. * @includeExample egret/geom/Rectangle.ts
  193. */
  194. class Rectangle extends HashObject {
  195. /**
  196. * @language en_US
  197. * Releases a rectangle instance to the object pool.
  198. * @version Egret 2.4
  199. * @platform Web,Native
  200. */
  201. /**
  202. * @language zh_CN
  203. * 释放一个Rectangle实例到对象池
  204. * @version Egret 2.4
  205. * @platform Web,Native
  206. */
  207. static release(rect: Rectangle): void;
  208. /**
  209. * @language en_US
  210. * get a rectangle instance from the object pool or create a new one.
  211. * @version Egret 2.4
  212. * @platform Web,Native
  213. */
  214. /**
  215. * @language zh_CN
  216. * 从对象池中取出或创建一个新的Rectangle对象。
  217. * @version Egret 2.4
  218. * @platform Web,Native
  219. */
  220. static create(): Rectangle;
  221. /**
  222. * @language en_US
  223. * Creates a new Rectangle object with the top-left corner specified by the x and y parameters and with the specified
  224. * width and height parameters.
  225. * @param x The x coordinate of the top-left corner of the rectangle.
  226. * @param y The y coordinate of the top-left corner of the rectangle.
  227. * @param width The width of the rectangle, in pixels.
  228. * @param height The height of the rectangle, in pixels.
  229. * @version Egret 2.4
  230. * @platform Web,Native
  231. */
  232. /**
  233. * @language zh_CN
  234. * 创建一个新 Rectangle 对象,其左上角由 x 和 y 参数指定,并具有指定的 width 和 height 参数。
  235. * @param x 矩形左上角的 x 坐标。
  236. * @param y 矩形左上角的 y 坐标。
  237. * @param width 矩形的宽度(以像素为单位)。
  238. * @param height 矩形的高度(以像素为单位)。
  239. * @version Egret 2.4
  240. * @platform Web,Native
  241. */
  242. constructor(x?: number, y?: number, width?: number, height?: number);
  243. /**
  244. * @language en_US
  245. * The x coordinate of the top-left corner of the rectangle.
  246. * @default 0
  247. * @version Egret 2.4
  248. * @platform Web,Native
  249. */
  250. /**
  251. * @language zh_CN
  252. * 矩形左上角的 x 坐标。
  253. * @default 0
  254. * @version Egret 2.4
  255. * @platform Web,Native
  256. */
  257. x: number;
  258. /**
  259. * @language en_US
  260. * The y coordinate of the top-left corner of the rectangle.
  261. * @default 0
  262. * @version Egret 2.4
  263. * @platform Web,Native
  264. */
  265. /**
  266. * @language zh_CN
  267. * 矩形左上角的 y 坐标。
  268. * @default 0
  269. * @version Egret 2.4
  270. * @platform Web,Native
  271. */
  272. y: number;
  273. /**
  274. * @language en_US
  275. * The width of the rectangle, in pixels.
  276. * @default 0
  277. * @version Egret 2.4
  278. * @platform Web,Native
  279. */
  280. /**
  281. * @language zh_CN
  282. * 矩形的宽度(以像素为单位)。
  283. * @default 0
  284. * @version Egret 2.4
  285. * @platform Web,Native
  286. */
  287. width: number;
  288. /**
  289. * @language en_US
  290. * 矩形的高度(以像素为单位)。
  291. * @default 0
  292. * @version Egret 2.4
  293. * @platform Web,Native
  294. */
  295. /**
  296. * @language zh_CN
  297. * The height of the rectangle, in pixels.
  298. * @default 0
  299. * @version Egret 2.4
  300. * @platform Web,Native
  301. */
  302. height: number;
  303. /**
  304. * @language en_US
  305. * The sum of the x and width properties.
  306. * @version Egret 2.4
  307. * @platform Web,Native
  308. */
  309. /**
  310. * @language zh_CN
  311. * x 和 width 属性的和。
  312. * @version Egret 2.4
  313. * @platform Web,Native
  314. */
  315. right: number;
  316. /**
  317. * @language en_US
  318. * The sum of the y and height properties.
  319. * @version Egret 2.4
  320. * @platform Web,Native
  321. */
  322. /**
  323. * @language zh_CN
  324. * y 和 height 属性的和。
  325. * @version Egret 2.4
  326. * @platform Web,Native
  327. */
  328. bottom: number;
  329. /**
  330. * @language en_US
  331. * The x coordinate of the top-left corner of the rectangle. Changing the left property of a Rectangle object has
  332. * no effect on the y and height properties. However it does affect the width property, whereas changing the x value
  333. * does not affect the width property.
  334. * The value of the left property is equal to the value of the x property.
  335. * @version Egret 2.4
  336. * @platform Web,Native
  337. */
  338. /**
  339. * @language zh_CN
  340. * 矩形左上角的 x 坐标。更改 Rectangle 对象的 left 属性对 y 和 height 属性没有影响。但是,它会影响 width 属性,而更改 x 值不会影响 width 属性。
  341. * left 属性的值等于 x 属性的值。
  342. * @version Egret 2.4
  343. * @platform Web,Native
  344. */
  345. left: number;
  346. /**
  347. * @language en_US
  348. * The y coordinate of the top-left corner of the rectangle. Changing the top property of a Rectangle object has
  349. * no effect on the x and width properties. However it does affect the height property, whereas changing the y
  350. * value does not affect the height property.<br/>
  351. * The value of the top property is equal to the value of the y property.
  352. * @version Egret 2.4
  353. * @platform Web,Native
  354. */
  355. /**
  356. * @language zh_CN
  357. * 矩形左上角的 y 坐标。更改 Rectangle 对象的 top 属性对 x 和 width 属性没有影响。但是,它会影响 height 属性,而更改 y 值不会影响 height 属性。<br/>
  358. * top 属性的值等于 y 属性的值。
  359. * @version Egret 2.4
  360. * @platform Web,Native
  361. */
  362. top: number;
  363. /**
  364. * @language en_US
  365. * The location of the Rectangle object's top-left corner, determined by the x and y coordinates of the point.
  366. * @version Egret 2.4
  367. * @platform Web,Native
  368. */
  369. /**
  370. * @language zh_CN
  371. * 由该点的 x 和 y 坐标确定的 Rectangle 对象左上角的位置。
  372. * @version Egret 2.4
  373. * @platform Web,Native
  374. */
  375. topLeft: Point;
  376. /**
  377. * @language en_US
  378. * The location of the Rectangle object's bottom-right corner, determined by the values of the right and bottom properties.
  379. * @version Egret 2.4
  380. * @platform Web,Native
  381. */
  382. /**
  383. * @language zh_CN
  384. * 由 right 和 bottom 属性的值确定的 Rectangle 对象的右下角的位置。
  385. * @version Egret 2.4
  386. * @platform Web,Native
  387. */
  388. bottomRight: Point;
  389. /**
  390. * @language en_US
  391. * Copies all of rectangle data from the source Rectangle object into the calling Rectangle object.
  392. * @param sourceRect The Rectangle object from which to copy the data.
  393. * @version Egret 2.4
  394. * @platform Web,Native
  395. */
  396. /**
  397. * @language zh_CN
  398. * 将源 Rectangle 对象中的所有矩形数据复制到调用方 Rectangle 对象中。
  399. * @param sourceRect 要从中复制数据的 Rectangle 对象。
  400. * @version Egret 2.4
  401. * @platform Web,Native
  402. */
  403. copyFrom(sourceRect: Rectangle): Rectangle;
  404. /**
  405. * @language en_US
  406. * Sets the members of Rectangle to the specified values
  407. * @param x The x coordinate of the top-left corner of the rectangle.
  408. * @param y The y coordinate of the top-left corner of the rectangle.
  409. * @param width The width of the rectangle, in pixels.
  410. * @param height The height of the rectangle, in pixels.
  411. * @version Egret 2.4
  412. * @platform Web,Native
  413. */
  414. /**
  415. * @language zh_CN
  416. * 将 Rectangle 的成员设置为指定值
  417. * @param x 矩形左上角的 x 坐标。
  418. * @param y 矩形左上角的 y 坐标。
  419. * @param width 矩形的宽度(以像素为单位)。
  420. * @param height 矩形的高度(以像素为单位)。
  421. * @version Egret 2.4
  422. * @platform Web,Native
  423. */
  424. setTo(x: number, y: number, width: number, height: number): Rectangle;
  425. /**
  426. * @language en_US
  427. * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.
  428. * @param x The x coordinate (horizontal position) of the point.
  429. * @param y The y coordinate (vertical position) of the point.
  430. * @returns A value of true if the Rectangle object contains the specified point; otherwise false.
  431. * @version Egret 2.4
  432. * @platform Web,Native
  433. */
  434. /**
  435. * @language zh_CN
  436. * 确定由此 Rectangle 对象定义的矩形区域内是否包含指定的点。
  437. * @param x 检测点的x轴
  438. * @param y 检测点的y轴
  439. * @returns 如果检测点位于矩形内,返回true,否则,返回false
  440. * @version Egret 2.4
  441. * @platform Web,Native
  442. */
  443. contains(x: number, y: number): boolean;
  444. /**
  445. * @language en_US
  446. * If the Rectangle object specified in the toIntersect parameter intersects with this Rectangle object, returns
  447. * the area of intersection as a Rectangle object. If the rectangles do not intersect, this method returns an empty
  448. * Rectangle object with its properties set to 0.
  449. * @param toIntersect The Rectangle object to compare against to see if it intersects with this Rectangle object.
  450. * @returns A Rectangle object that equals the area of intersection. If the rectangles do not intersect, this method
  451. * returns an empty Rectangle object; that is, a rectangle with its x, y, width, and height properties set to 0.
  452. * @version Egret 2.4
  453. * @platform Web,Native
  454. */
  455. /**
  456. * @language zh_CN
  457. * 如果在 toIntersect 参数中指定的 Rectangle 对象与此 Rectangle 对象相交,则返回交集区域作为 Rectangle 对象。如果矩形不相交,
  458. * 则此方法返回一个空的 Rectangle 对象,其属性设置为 0。
  459. * @param toIntersect 要对照比较以查看其是否与此 Rectangle 对象相交的 Rectangle 对象。
  460. * @returns 等于交集区域的 Rectangle 对象。如果该矩形不相交,则此方法返回一个空的 Rectangle 对象;即,其 x、y、width 和
  461. * height 属性均设置为 0 的矩形。
  462. * @version Egret 2.4
  463. * @platform Web,Native
  464. */
  465. intersection(toIntersect: Rectangle): Rectangle;
  466. /**
  467. * @language en_US
  468. * Increases the size of the Rectangle object by the specified amounts, in pixels.
  469. * The center point of the Rectangle object stays the same, and its size increases to the left and right by the dx value, and to the top and the bottom by the dy value.
  470. * @param dx The value to be added to the left and the right of the Rectangle object.
  471. * @param dy The value to be added to the top and the bottom of the Rectangle.
  472. * @version Egret 2.4
  473. * @platform Web,Native
  474. */
  475. /**
  476. * @language zh_CN
  477. * 按指定量增加 Rectangle 对象的大小(以像素为单位)
  478. * 保持 Rectangle 对象的中心点不变,使用 dx 值横向增加它的大小,使用 dy 值纵向增加它的大小。
  479. * @param dx Rectangle 对象横向增加的值。
  480. * @param dy Rectangle 对象纵向增加的值。
  481. * @version Egret 2.4
  482. * @platform Web,Native
  483. */
  484. inflate(dx: number, dy: number): void;
  485. /**
  486. * @private
  487. */
  488. $intersectInPlace(clipRect: Rectangle): Rectangle;
  489. /**
  490. * @language en_US
  491. * Determines whether the object specified in the toIntersect parameter intersects with this Rectangle object.
  492. * This method checks the x, y, width, and height properties of the specified Rectangle object to see if it
  493. * intersects with this Rectangle object.
  494. * @param toIntersect The Rectangle object to compare against this Rectangle object.
  495. * @returns A value of true if the specified object intersects with this Rectangle object; otherwise false.
  496. * @version Egret 2.4
  497. * @platform Web,Native
  498. */
  499. /**
  500. * @language zh_CN
  501. * 确定在 toIntersect 参数中指定的对象是否与此 Rectangle 对象相交。此方法检查指定的 Rectangle
  502. * 对象的 x、y、width 和 height 属性,以查看它是否与此 Rectangle 对象相交。
  503. * @param toIntersect 要与此 Rectangle 对象比较的 Rectangle 对象。
  504. * @returns 如果两个矩形相交,返回true,否则返回false
  505. * @version Egret 2.4
  506. * @platform Web,Native
  507. */
  508. intersects(toIntersect: Rectangle): boolean;
  509. /**
  510. * @language en_US
  511. * Determines whether or not this Rectangle object is empty.
  512. * @returns A value of true if the Rectangle object's width or height is less than or equal to 0; otherwise false.
  513. * @version Egret 2.4
  514. * @platform Web,Native
  515. */
  516. /**
  517. * @language zh_CN
  518. * 确定此 Rectangle 对象是否为空。
  519. * @returns 如果 Rectangle 对象的宽度或高度小于等于 0,则返回 true 值,否则返回 false。
  520. * @version Egret 2.4
  521. * @platform Web,Native
  522. */
  523. isEmpty(): boolean;
  524. /**
  525. * @language en_US
  526. * Sets all of the Rectangle object's properties to 0. A Rectangle object is empty if its width or height is less than or equal to 0.
  527. * @version Egret 2.4
  528. * @platform Web,Native
  529. */
  530. /**
  531. * @language zh_CN
  532. * 将 Rectangle 对象的所有属性设置为 0。
  533. * @version Egret 2.4
  534. * @platform Web,Native
  535. */
  536. setEmpty(): void;
  537. /**
  538. * @language en_US
  539. * Returns a new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object.
  540. * @returns A new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object.
  541. * @version Egret 2.4
  542. * @platform Web,Native
  543. */
  544. /**
  545. * @language zh_CN
  546. * 返回一个新的 Rectangle 对象,其 x、y、width 和 height 属性的值与原始 Rectangle 对象的对应值相同。
  547. * @returns 新的 Rectangle 对象,其 x、y、width 和 height 属性的值与原始 Rectangle 对象的对应值相同。
  548. * @version Egret 2.4
  549. * @platform Web,Native
  550. */
  551. clone(): Rectangle;
  552. /**
  553. * @language en_US
  554. * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.
  555. * This method is similar to the Rectangle.contains() method, except that it takes a Point object as a parameter.
  556. * @param point The point, as represented by its x and y coordinates.
  557. * @returns A value of true if the Rectangle object contains the specified point; otherwise false.
  558. * @version Egret 2.4
  559. * @platform Web,Native
  560. */
  561. /**
  562. * @language zh_CN
  563. * 确定由此 Rectangle 对象定义的矩形区域内是否包含指定的点。
  564. * 此方法与 Rectangle.contains() 方法类似,只不过它采用 Point 对象作为参数。
  565. * @param point 包含点对象
  566. * @returns 如果包含,返回true,否则返回false
  567. * @version Egret 2.4
  568. * @platform Web,Native
  569. */
  570. containsPoint(point: Point): boolean;
  571. /**
  572. * @language en_US
  573. * Determines whether the Rectangle object specified by the rect parameter is contained within this Rectangle object.
  574. * A Rectangle object is said to contain another if the second Rectangle object falls entirely within the boundaries of the first.
  575. * @param rect The Rectangle object being checked.
  576. * @returns A value of true if the Rectangle object that you specify is contained by this Rectangle object; otherwise false.
  577. * @version Egret 2.4
  578. * @platform Web,Native
  579. */
  580. /**
  581. * @language zh_CN
  582. * 确定此 Rectangle 对象内是否包含由 rect 参数指定的 Rectangle 对象。
  583. * 如果一个 Rectangle 对象完全在另一个 Rectangle 的边界内,我们说第二个 Rectangle 包含第一个 Rectangle。
  584. * @param rect 所检查的 Rectangle 对象
  585. * @returns 如果此 Rectangle 对象包含您指定的 Rectangle 对象,则返回 true 值,否则返回 false。
  586. * @version Egret 2.4
  587. * @platform Web,Native
  588. */
  589. containsRect(rect: egret.Rectangle): boolean;
  590. /**
  591. * @language en_US
  592. * Determines whether the object specified in the toCompare parameter is equal to this Rectangle object.
  593. * This method compares the x, y, width, and height properties of an object against the same properties of this Rectangle object.
  594. * @param The rectangle to compare to this Rectangle object.
  595. * @returns A value of true if the object has exactly the same values for the x, y, width, and height properties as this Rectangle object; otherwise false.
  596. * @version Egret 2.4
  597. * @platform Web,Native
  598. */
  599. /**
  600. * @language zh_CN
  601. * 确定在 toCompare 参数中指定的对象是否等于此 Rectangle 对象。
  602. * 此方法将某个对象的 x、y、width 和 height 属性与此 Rectangle 对象所对应的相同属性进行比较。
  603. * @param toCompare 要与此 Rectangle 对象进行比较的矩形。
  604. * @returns 如果对象具有与此 Rectangle 对象完全相同的 x、y、width 和 height 属性值,则返回 true 值,否则返回 false。
  605. * @version Egret 2.4
  606. * @platform Web,Native
  607. */
  608. equals(toCompare: Rectangle): boolean;
  609. /**
  610. * @language en_US
  611. * Increases the size of the Rectangle object. This method is similar to the Rectangle.inflate() method except it takes a Point object as a parameter.
  612. * @param point 此 Point 对象的 x 属性用于增加 Rectangle 对象的水平尺寸。y 属性用于增加 Rectangle 对象的垂直尺寸。
  613. * @version Egret 2.4
  614. * @platform Web,Native
  615. */
  616. /**
  617. * @language zh_CN
  618. * 增加 Rectangle 对象的大小。此方法与 Rectangle.inflate() 方法类似,只不过它采用 Point 对象作为参数。
  619. * @param point The x property of this Point object is used to increase the horizontal dimension of the Rectangle object. The y property is used to increase the vertical dimension of the Rectangle object.
  620. * @version Egret 2.4
  621. * @platform Web,Native
  622. */
  623. inflatePoint(point: Point): void;
  624. /**
  625. * @language en_US
  626. * Adjusts the location of the Rectangle object, as determined by its top-left corner, by the specified amounts.
  627. * @param dx Moves the x value of the Rectangle object by this amount.
  628. * @param dy Moves the y value of the Rectangle object by this amount.
  629. * @version Egret 2.4
  630. * @platform Web,Native
  631. */
  632. /**
  633. * @language zh_CN
  634. * 按指定量调整 Rectangle 对象的位置(由其左上角确定)。
  635. * @param dx 将 Rectangle 对象的 x 值移动此数量。
  636. * @param dy 将 Rectangle 对象的 t 值移动此数量。
  637. * @version Egret 2.4
  638. * @platform Web,Native
  639. */
  640. offset(dx: number, dy: number): void;
  641. /**
  642. * @language en_US
  643. * Adjusts the location of the Rectangle object using a Point object as a parameter. This method is similar to the Rectangle.offset() method, except that it takes a Point object as a parameter.
  644. * @param point A Point object to use to offset this Rectangle object.
  645. * @version Egret 2.4
  646. * @platform Web,Native
  647. */
  648. /**
  649. * @language zh_CN
  650. * 将 Point 对象用作参数来调整 Rectangle 对象的位置。此方法与 Rectangle.offset() 方法类似,只不过它采用 Point 对象作为参数。
  651. * @param point 要用于偏移此 Rectangle 对象的 Point 对象。
  652. * @version Egret 2.4
  653. * @platform Web,Native
  654. */
  655. offsetPoint(point: Point): void;
  656. /**
  657. * @language en_US
  658. * Builds and returns a string that lists the horizontal and vertical positions and the width and height of the Rectangle object.
  659. * @returns A string listing the value of each of the following properties of the Rectangle object: x, y, width, and height.
  660. * @version Egret 2.4
  661. * @platform Web,Native
  662. */
  663. /**
  664. * @language zh_CN
  665. * 生成并返回一个字符串,该字符串列出 Rectangle 对象的水平位置和垂直位置以及高度和宽度。
  666. * @returns 一个字符串,它列出了 Rectangle 对象的下列各个属性的值:x、y、width 和 height。
  667. * @version Egret 2.4
  668. * @platform Web,Native
  669. */
  670. toString(): string;
  671. /**
  672. * @language en_US
  673. * Adds two rectangles together to create a new Rectangle object, by filling in the horizontal and vertical space between the two rectangles.
  674. * @param toUnion A Rectangle object to add to this Rectangle object.
  675. * @returns A new Rectangle object that is the union of the two rectangles.
  676. * @version Egret 2.4
  677. * @platform Web,Native
  678. */
  679. /**
  680. * @language zh_CN
  681. * 通过填充两个矩形之间的水平和垂直空间,将这两个矩形组合在一起以创建一个新的 Rectangle 对象。
  682. * @param toUnion 要添加到此 Rectangle 对象的 Rectangle 对象。
  683. * @returns 充当两个矩形的联合的新 Rectangle 对象。
  684. * @version Egret 2.4
  685. * @platform Web,Native
  686. */
  687. union(toUnion: Rectangle): Rectangle;
  688. /**
  689. * @private
  690. */
  691. $getBaseWidth(angle: number): number;
  692. /**
  693. * @private
  694. */
  695. $getBaseHeight(angle: number): number;
  696. }
  697. /**
  698. * @private
  699. * 仅供框架内复用,要防止暴露引用到外部。
  700. */
  701. let $TempRectangle: Rectangle;
  702. }
  703. declare namespace egret {
  704. /**
  705. * @language en_US
  706. * The EventDispatcher class is the base class for all classes that dispatchEvent events. The EventDispatcher class implements
  707. * the IEventDispatcher interface and is the base class for the DisplayObject class. The EventDispatcher class allows
  708. * any object on the display list to be an event target and as such, to use the methods of the IEventDispatcher interface.
  709. * Event targets are an important part of the Egret event model. The event target serves as the focal point for how events
  710. * flow through the display list hierarchy. When an event such as a touch tap, Egret dispatches an event object into the
  711. * event flow from the root of the display list. The event object then makes its way through the display list until it
  712. * reaches the event target, at which point it begins its return trip through the display list. This round-trip journey
  713. * to the event target is conceptually divided into three phases: <br/>
  714. * the capture phase comprises the journey from the root to the last node before the event target's node, the target
  715. * phase comprises only the event target node, and the bubbling phase comprises any subsequent nodes encountered on
  716. * the return trip to the root of the display list. In general, the easiest way for a user-defined class to gain event
  717. * dispatching capabilities is to extend EventDispatcher. If this is impossible (that is, if the class is already extending
  718. * another class), you can instead implement the IEventDispatcher interface, create an EventDispatcher member, and write simple
  719. * hooks to route calls into the aggregated EventDispatcher.
  720. * @see egret.IEventDispatcher
  721. * @version Egret 2.4
  722. * @platform Web,Native
  723. * @includeExample egret/events/EventDispatcher.ts
  724. */
  725. /**
  726. * @language zh_CN
  727. * EventDispatcher 是 Egret 的事件派发器类,负责进行事件的发送和侦听。
  728. * 事件目标是事件如何通过显示列表层次结构这一问题的焦点。当发生鼠标单击、触摸或按键等事件时,
  729. * 框架会将事件对象调度到从显示列表根开始的事件流中。然后该事件对象在显示列表中前进,直到到达事件目标,
  730. * 然后从这一点开始其在显示列表中的回程。在概念上,到事件目标的此往返行程被划分为三个阶段:
  731. * 捕获阶段包括从根到事件目标节点之前的最后一个节点的行程,目标阶段仅包括事件目标节点,冒泡阶段包括回程上遇到的任何后续节点到显示列表的根。
  732. * 通常,使用户定义的类能够调度事件的最简单方法是扩展 EventDispatcher。如果无法扩展(即,如果该类已经扩展了另一个类),则可以实现
  733. * IEventDispatcher 接口,创建 EventDispatcher 成员,并编写一些简单的映射,将调用连接到聚合的 EventDispatcher 中。
  734. * @see egret.IEventDispatcher
  735. * @version Egret 2.4
  736. * @platform Web,Native
  737. * @includeExample egret/events/EventDispatcher.ts
  738. */
  739. class EventDispatcher extends HashObject implements IEventDispatcher {
  740. /**
  741. * @language en_US
  742. * create an instance of the EventDispatcher class.
  743. * @param target The target object for events dispatched to the EventDispatcher object. This parameter is used when
  744. * the EventDispatcher instance is aggregated by a class that implements IEventDispatcher; it is necessary so that the
  745. * containing object can be the target for events. Do not use this parameter in simple cases in which a class extends EventDispatcher.
  746. * @version Egret 2.4
  747. * @platform Web,Native
  748. */
  749. /**
  750. * @language zh_CN
  751. * 创建一个 EventDispatcher 类的实例
  752. * @param target 此 EventDispatcher 所抛出事件对象的 target 指向。此参数主要用于一个实现了 IEventDispatcher 接口的自定义类,
  753. * 以便抛出的事件对象的 target 属性可以指向自定义类自身。请勿在直接继承 EventDispatcher 的情况下使用此参数。
  754. * @version Egret 2.4
  755. * @platform Web,Native
  756. */
  757. constructor(target?: IEventDispatcher);
  758. /**
  759. * @private
  760. */
  761. $EventDispatcher: Object;
  762. /**
  763. * @private
  764. *
  765. * @param useCapture
  766. */
  767. $getEventMap(useCapture?: boolean): any;
  768. /**
  769. * @inheritDoc
  770. * @version Egret 2.4
  771. * @platform Web,Native
  772. */
  773. addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void;
  774. /**
  775. * @inheritDoc
  776. * @version Egret 2.4
  777. * @platform Web,Native
  778. */
  779. once(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void;
  780. /**
  781. * @private
  782. */
  783. $addListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number, dispatchOnce?: boolean): void;
  784. $insertEventBin(list: any[], type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number, dispatchOnce?: boolean): boolean;
  785. /**
  786. * @inheritDoc
  787. * @version Egret 2.4
  788. * @platform Web,Native
  789. */
  790. removeEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean): void;
  791. $removeEventBin(list: any[], listener: Function, thisObject: any): boolean;
  792. /**
  793. * @inheritDoc
  794. * @version Egret 2.4
  795. * @platform Web,Native
  796. */
  797. hasEventListener(type: string): boolean;
  798. /**
  799. * @inheritDoc
  800. * @version Egret 2.4
  801. * @platform Web,Native
  802. */
  803. willTrigger(type: string): boolean;
  804. /**
  805. * @inheritDoc
  806. * @version Egret 2.4
  807. * @platform Web,Native
  808. */
  809. dispatchEvent(event: Event): boolean;
  810. /**
  811. * @private
  812. */
  813. $notifyListener(event: Event, capturePhase: boolean): boolean;
  814. /**
  815. * @language en_US
  816. * Distribute a specified event parameters.
  817. * @param type The type of the event. Event listeners can access this information through the inherited type property.
  818. * @param bubbles Determines whether the Event object bubbles. Event listeners can access this information through
  819. * the inherited bubbles property.
  820. * @param data {any} data
  821. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  822. * @version Egret 2.4
  823. * @platform Web,Native
  824. */
  825. /**
  826. * @language zh_CN
  827. * 派发一个指定参数的事件。
  828. * @param type {string} 事件类型
  829. * @param bubbles {boolean} 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  830. * @param data {any} 事件data
  831. * @param cancelable {boolean} 确定是否可以取消 Event 对象。默认值为 false。
  832. * @version Egret 2.4
  833. * @platform Web,Native
  834. */
  835. dispatchEventWith(type: string, bubbles?: boolean, data?: any, cancelable?: boolean): boolean;
  836. }
  837. }
  838. declare namespace egret.sys {
  839. /**
  840. * @private
  841. * 事件信息对象
  842. */
  843. interface EventBin {
  844. type: string;
  845. /**
  846. * @private
  847. */
  848. listener: Function;
  849. /**
  850. * @private
  851. */
  852. thisObject: any;
  853. /**
  854. * @private
  855. */
  856. priority: number;
  857. /**
  858. * @private
  859. */
  860. target: IEventDispatcher;
  861. /**
  862. * @private
  863. */
  864. useCapture: boolean;
  865. /**
  866. * @private
  867. */
  868. dispatchOnce: boolean;
  869. }
  870. }
  871. declare namespace egret.sys {
  872. /**
  873. * @private
  874. * 显示对象失效标志
  875. */
  876. const enum DisplayObjectFlags {
  877. /**
  878. * @private
  879. * 显示对象自身的绘制区域尺寸失效
  880. */
  881. InvalidContentBounds = 2,
  882. /**
  883. * @private
  884. * 显示对象的矩形区域尺寸失效,包括自身绘制区域和子项的区域集合
  885. */
  886. InvalidBounds = 4,
  887. /**
  888. * @private
  889. * 显示对象的matrix属性失效标志,通常因为scaleX,width等属性发生改变。
  890. */
  891. InvalidMatrix = 8,
  892. /**
  893. * @private
  894. * 显示对象祖代的矩阵失效。
  895. */
  896. InvalidConcatenatedMatrix = 16,
  897. /**
  898. * @private
  899. * 显示对象祖代的逆矩阵失效。
  900. */
  901. InvalidInvertedConcatenatedMatrix = 32,
  902. /**
  903. * @private
  904. * 显示对象祖代的透明度属性失效。
  905. */
  906. InvalidConcatenatedAlpha = 64,
  907. /**
  908. * @private
  909. * DrawData失效,需要重新出发render方法.
  910. */
  911. InvalidRenderNodes = 128,
  912. /**
  913. * @private
  914. * 显示对象自身需要重绘的标志
  915. */
  916. DirtyRender = 256,
  917. /**
  918. * @private
  919. * 子项中已经全部含有DirtyRender标志,无需继续遍历。
  920. */
  921. DirtyChildren = 512,
  922. /**
  923. * @private
  924. * DirtyRender|DirtyChildren
  925. */
  926. Dirty = 768,
  927. /**
  928. * @private
  929. * 显示对象祖代的是否可见属性失效。
  930. */
  931. InvalidConcatenatedVisible = 1024,
  932. /**
  933. * @private
  934. * 添加或删除子项时,需要向子项传递的标志。
  935. */
  936. DownOnAddedOrRemoved = 1648,
  937. /**
  938. * @private
  939. * 显示对象初始化时的标志量
  940. */
  941. InitFlags = 2032,
  942. }
  943. }
  944. declare namespace egret {
  945. /**
  946. * @language en_US
  947. * The DisplayObject class is the base class for all objects that can be placed on the display list. The display list
  948. * manages all objects displayed in the runtime. Use the DisplayObjectContainer class to arrange the display
  949. * objects in the display list. DisplayObjectContainer objects can have child display objects, while other display objects,
  950. * such as Shape and TextField objects, are "leaf" nodes that have only parents and siblings, no children.
  951. * The DisplayObject class supports basic functionality like the x and y position of an object, as well as more advanced
  952. * properties of the object such as its transformation matrix.<br/>
  953. * The DisplayObject class contains several broadcast events.Normally, the target of any particular event is a specific
  954. * DisplayObject instance. For example, the target of an added event is the specific DisplayObject instance that was added
  955. * to the display list. Having a single target restricts the placement of event listeners to that target and in some cases
  956. * the target's ancestors on the display list. With broadcast events, however, the target is not a specific DisplayObject
  957. * instance, but rather all DisplayObject instances, including those that are not on the display list. This means that you
  958. * can add a listener to any DisplayObject instance to listen for broadcast events.
  959. *
  960. * @event egret.Event.ADDED Dispatched when a display object is added to the display list.
  961. * @event egret.Event.ADDED_TO_STAGE Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained.
  962. * @event egret.Event.REMOVED Dispatched when a display object is about to be removed from the display list.
  963. * @event egret.Event.REMOVED_FROM_STAGE Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained.
  964. * @event egret.Event.ENTER_FRAME [broadcast event] Dispatched when the playhead is entering a new frame.
  965. * @event egret.Event.RENDER [broadcast event] Dispatched when the display list is about to be updated and rendered.
  966. * @event egret.TouchEvent.TOUCH_MOVE Dispatched when the user touches the device, and is continuously dispatched until the point of contact is removed.
  967. * @event egret.TouchEvent.TOUCH_BEGIN Dispatched when the user first contacts a touch-enabled device (such as touches a finger to a mobile phone or tablet with a touch screen).
  968. * @event egret.TouchEvent.TOUCH_END Dispatched when the user removes contact with a touch-enabled device (such as lifts a finger off a mobile phone or tablet with a touch screen).
  969. * @event egret.TouchEvent.TOUCH_TAP Dispatched when the user lifts the point of contact over the same DisplayObject instance on which the contact was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display object on a mobile phone or tablet with a touch screen).
  970. * @event egret.TouchEvent.TOUCH_RELEASE_OUTSIDE Dispatched when the user lifts the point of contact over the different DisplayObject instance on which the contact was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display object on a mobile phone or tablet with a touch screen).
  971. * @version Egret 2.4
  972. * @platform Web,Native
  973. * @includeExample egret/display/DisplayObject.ts
  974. */
  975. /**
  976. * @language zh_CN
  977. * DisplayObject 类是可放在显示列表中的所有对象的基类。该显示列表管理运行时中显示的所有对象。使用 DisplayObjectContainer 类排列
  978. * 显示列表中的显示对象。DisplayObjectContainer 对象可以有子显示对象,而其他显示对象(如 Shape 和 TextField 对象)是“叶”节点,没有子项,只有父级和
  979. * 同级。DisplayObject 类有一些基本的属性(如确定坐标位置的 x 和 y 属性),也有一些高级的对象属性(如 Matrix 矩阵变换)。<br/>
  980. * DisplayObject 类包含若干广播事件。通常,任何特定事件的目标均为一个特定的 DisplayObject 实例。例如,added 事件的目标是已添加到显示列表
  981. * 的目标 DisplayObject 实例。若只有一个目标,则会将事件侦听器限制为只能监听在该目标上(在某些情况下,可监听在显示列表中该目标的祖代上)。
  982. * 但是对于广播事件,目标不是特定的 DisplayObject 实例,而是所有 DisplayObject 实例(包括那些不在显示列表中的实例)。这意味着您可以向任何
  983. * DisplayObject 实例添加侦听器来侦听广播事件。
  984. *
  985. * @event egret.Event.ADDED 将显示对象添加到显示列表中时调度。
  986. * @event egret.Event.ADDED_TO_STAGE 在将显示对象直接添加到舞台显示列表或将包含显示对象的子树添加至舞台显示列表中时调度。
  987. * @event egret.Event.REMOVED 将要从显示列表中删除显示对象时调度。
  988. * @event egret.Event.REMOVED_FROM_STAGE 在从显示列表中直接删除显示对象或删除包含显示对象的子树时调度。
  989. * @event egret.Event.ENTER_FRAME [广播事件] 播放头进入新帧时调度。
  990. * @event egret.Event.RENDER [广播事件] 将要更新和呈现显示列表时调度。
  991. * @event egret.TouchEvent.TOUCH_MOVE 当用户触碰设备时进行调度,而且会连续调度,直到接触点被删除。
  992. * @event egret.TouchEvent.TOUCH_BEGIN 当用户第一次触摸启用触摸的设备时(例如,用手指触摸配有触摸屏的移动电话或平板电脑)调度。
  993. * @event egret.TouchEvent.TOUCH_END 当用户移除与启用触摸的设备的接触时(例如,将手指从配有触摸屏的移动电话或平板电脑上抬起)调度。
  994. * @event egret.TouchEvent.TOUCH_TAP 当用户在启用触摸设备上的已启动接触的同一 DisplayObject 实例上抬起接触点时(例如,在配有触摸屏的移动电话或平板电脑的显示对象上的某一点处按下并释放手指)调度。
  995. * @event egret.TouchEvent.TOUCH_RELEASE_OUTSIDE 当用户在启用触摸设备上的已启动接触的不同 DisplayObject 实例上抬起接触点时(例如,在配有触摸屏的移动电话或平板电脑的显示对象上的某一点处按下并释放手指)调度。
  996. * @version Egret 2.4
  997. * @platform Web,Native
  998. * @includeExample egret/display/DisplayObject.ts
  999. */
  1000. class DisplayObject extends EventDispatcher implements sys.Renderable {
  1001. /**
  1002. * @language en_US
  1003. * Initializes a DisplayObject object
  1004. * @version Egret 2.4
  1005. * @platform Web,Native
  1006. */
  1007. /**
  1008. * @language zh_CN
  1009. * 创建一个显示对象
  1010. * @version Egret 2.4
  1011. * @platform Web,Native
  1012. */
  1013. constructor();
  1014. /**
  1015. * @private
  1016. */
  1017. $DisplayObject: Object;
  1018. /**
  1019. * @private
  1020. */
  1021. $displayFlags: number;
  1022. /**
  1023. * @private
  1024. * 添加一个标志量
  1025. */
  1026. $setFlags(flags: number): void;
  1027. /**
  1028. * @private
  1029. * 移除一个标志量
  1030. */
  1031. $removeFlags(flags: number): void;
  1032. /**
  1033. * @private
  1034. * 沿着显示列表向上移除标志量,如果标志量没被设置过就停止移除。
  1035. */
  1036. $removeFlagsUp(flags: number): void;
  1037. /**
  1038. * @private
  1039. * 是否含有指定的所有标志量
  1040. */
  1041. $hasFlags(flags: number): boolean;
  1042. /**
  1043. * @private
  1044. * 沿着显示列表向上传递标志量,如果标志量已经被设置过就停止传递。
  1045. */
  1046. $propagateFlagsUp(flags: number): void;
  1047. /**
  1048. * @private
  1049. * 沿着显示列表向下传递标志量,非容器直接设置自身的flag,此方法会在 DisplayObjectContainer 中被覆盖。
  1050. */
  1051. $propagateFlagsDown(flags: number, cachedBreak?: boolean): void;
  1052. /**
  1053. * @private
  1054. * 是否含有多个标志量其中之一。
  1055. */
  1056. $hasAnyFlags(flags: number): boolean;
  1057. /**
  1058. * @private
  1059. * 是否添加到舞台上,防止重复发送 removed_from_stage 消息
  1060. */
  1061. $hasAddToStage: boolean;
  1062. /**
  1063. * @private
  1064. * 标记矩阵失效
  1065. */
  1066. $invalidateMatrix(): void;
  1067. /**
  1068. * @private
  1069. * 标记这个显示对象在父级容器的位置发生了改变。
  1070. */
  1071. $invalidatePosition(): void;
  1072. /**
  1073. * @private
  1074. * 能够含有子项的类将子项列表存储在这个属性里。
  1075. */
  1076. $children: DisplayObject[];
  1077. /**
  1078. * @language en_US
  1079. * Indicates the instance name of the DisplayObject. The object can be identified in the child list of its parent
  1080. * display object container by calling the getChildByName() method of the display object container.
  1081. * @version Egret 2.4
  1082. * @platform Web,Native
  1083. */
  1084. /**
  1085. * @language zh_CN
  1086. * 表示 DisplayObject 的实例名称。
  1087. * 通过调用父显示对象容器的 getChildByName() 方法,可以在父显示对象容器的子列表中标识该对象。
  1088. * @version Egret 2.4
  1089. * @platform Web,Native
  1090. */
  1091. name: string;
  1092. /**
  1093. * @private
  1094. */
  1095. $parent: DisplayObjectContainer;
  1096. /**
  1097. * @language en_US
  1098. * Indicates the DisplayObjectContainer object that contains this display object. Use the parent property to specify
  1099. * a relative path to display objects that are above the current display object in the display list hierarchy.
  1100. * @version Egret 2.4
  1101. * @platform Web,Native
  1102. */
  1103. /**
  1104. * @language zh_CN
  1105. * 表示包含此显示对象的 DisplayObjectContainer 对象。
  1106. * 使用 parent 属性可以指定高于显示列表层次结构中当前显示对象的显示对象的相对路径。
  1107. * @version Egret 2.4
  1108. * @platform Web,Native
  1109. */
  1110. parent: DisplayObjectContainer;
  1111. /**
  1112. * @private
  1113. * 设置父级显示对象
  1114. */
  1115. $setParent(parent: DisplayObjectContainer): boolean;
  1116. /**
  1117. * @private
  1118. * 显示对象添加到舞台
  1119. */
  1120. $onAddToStage(stage: Stage, nestLevel: number): void;
  1121. /**
  1122. * @private
  1123. * 显示对象从舞台移除
  1124. */
  1125. $onRemoveFromStage(): void;
  1126. /**
  1127. * @private
  1128. */
  1129. $stage: Stage;
  1130. /**
  1131. * @private
  1132. * 这个对象在显示列表中的嵌套深度,舞台为1,它的子项为2,子项的子项为3,以此类推。当对象不在显示列表中时此属性值为0.
  1133. */
  1134. $nestLevel: number;
  1135. /**
  1136. * @language en_US
  1137. * The Stage of the display object. you can create and load multiple display objects into the display list, and
  1138. * the stage property of each display object refers to the same Stage object.<br/>
  1139. * If a display object is not added to the display list, its stage property is set to null.
  1140. * @version Egret 2.4
  1141. * @platform Web,Native
  1142. */
  1143. /**
  1144. * @language zh_CN
  1145. * 显示对象的舞台。
  1146. * 例如,您可以创建多个显示对象并加载到显示列表中,每个显示对象的 stage 属性是指向相同的 Stage 对象。<br/>
  1147. * 如果显示对象未添加到显示列表,则其 stage 属性会设置为 null。
  1148. * @version Egret 2.4
  1149. * @platform Web,Native
  1150. */
  1151. stage: Stage;
  1152. /**
  1153. * @language en_US
  1154. * A Matrix object containing values that alter the scaling, rotation, and translation of the display object.<br/>
  1155. * Note: to change the value of a display object's matrix, you must make a copy of the entire matrix object, then copy
  1156. * the new object into the matrix property of the display object.
  1157. * @example the following code increases the tx value of a display object's matrix
  1158. * <pre>
  1159. * let myMatrix:Matrix = myDisplayObject.matrix;
  1160. * myMatrix.tx += 10;
  1161. * myDisplayObject.matrix = myMatrix;
  1162. * </pre>
  1163. * @version Egret 2.4
  1164. * @platform Web,Native
  1165. */
  1166. /**
  1167. * @language zh_CN
  1168. * 一个 Matrix 对象,其中包含更改显示对象的缩放、旋转和平移的值。<br/>
  1169. * 注意:要改变一个显示对象矩阵的值,您必引用整个矩阵对象,然后将它重新赋值给显示对象的 matrix 属性。
  1170. * @example 以下代码改变了显示对象矩阵的tx属性值:
  1171. * <pre>
  1172. * let myMatrix:Matrix = myDisplayObject.matrix;
  1173. * myMatrix.tx += 10;
  1174. * myDisplayObject.matrix = myMatrix;
  1175. * </pre>
  1176. * @version Egret 2.4
  1177. * @platform Web,Native
  1178. */
  1179. matrix: Matrix;
  1180. /**
  1181. * @private
  1182. * 获取矩阵
  1183. */
  1184. $getMatrix(): Matrix;
  1185. /**
  1186. * @private
  1187. * 设置矩阵
  1188. */
  1189. $setMatrix(matrix: Matrix, needUpdateProperties?: boolean): boolean;
  1190. /**
  1191. * @private
  1192. * 获得这个显示对象以及它所有父级对象的连接矩阵。
  1193. */
  1194. $getConcatenatedMatrix(): Matrix;
  1195. /**
  1196. * @private
  1197. * 获取链接矩阵
  1198. */
  1199. $getInvertedConcatenatedMatrix(): Matrix;
  1200. /**
  1201. * @language en_US
  1202. * Indicates the x coordinate of the DisplayObject instance relative to the local coordinates of the parent
  1203. * DisplayObjectContainer.<br/>
  1204. * If the object is inside a DisplayObjectContainer that has transformations, it is in
  1205. * the local coordinate system of the enclosing DisplayObjectContainer. Thus, for a DisplayObjectContainer
  1206. * rotated 90° counterclockwise, the DisplayObjectContainer's children inherit a coordinate system that is
  1207. * rotated 90° counterclockwise. The object's coordinates refer to the registration point position.
  1208. * @default 0
  1209. * @version Egret 2.4
  1210. * @platform Web,Native
  1211. */
  1212. /**
  1213. * @language zh_CN
  1214. * 表示 DisplayObject 实例相对于父级 DisplayObjectContainer 本地坐标的 x 坐标。<br/>
  1215. * 如果该对象位于具有变形的 DisplayObjectContainer 内,则它也位于包含 DisplayObjectContainer 的本地坐标系中。
  1216. * 因此,对于逆时针旋转 90 度的 DisplayObjectContainer,该 DisplayObjectContainer 的子级将继承逆时针旋转 90 度的坐标系。
  1217. * @default 0
  1218. * @version Egret 2.4
  1219. * @platform Web,Native
  1220. */
  1221. x: number;
  1222. /**
  1223. * @private
  1224. * 获取x坐标
  1225. */
  1226. $getX(): number;
  1227. /**
  1228. * @private
  1229. * 设置x坐标
  1230. */
  1231. $setX(value: number): boolean;
  1232. /**
  1233. * @language en_US
  1234. * Indicates the y coordinate of the DisplayObject instance relative to the local coordinates of the parent
  1235. * DisplayObjectContainer. <br/>
  1236. * If the object is inside a DisplayObjectContainer that has transformations, it is in
  1237. * the local coordinate system of the enclosing DisplayObjectContainer. Thus, for a DisplayObjectContainer rotated
  1238. * 90° counterclockwise, the DisplayObjectContainer's children inherit a coordinate system that is rotated 90°
  1239. * counterclockwise. The object's coordinates refer to the registration point position.
  1240. * @default 0
  1241. * @version Egret 2.4
  1242. * @platform Web,Native
  1243. */
  1244. /**
  1245. * @language zh_CN
  1246. * 表示 DisplayObject 实例相对于父级 DisplayObjectContainer 本地坐标的 y 坐标。<br/>
  1247. * 如果该对象位于具有变形的 DisplayObjectContainer 内,则它也位于包含 DisplayObjectContainer 的本地坐标系中。
  1248. * 因此,对于逆时针旋转 90 度的 DisplayObjectContainer,该 DisplayObjectContainer 的子级将继承逆时针旋转 90 度的坐标系。
  1249. * @default 0
  1250. * @version Egret 2.4
  1251. * @platform Web,Native
  1252. */
  1253. y: number;
  1254. /**
  1255. * @private
  1256. * 获取y坐标
  1257. */
  1258. $getY(): number;
  1259. /**
  1260. * @private
  1261. * 设置y坐标
  1262. */
  1263. $setY(value: number): boolean;
  1264. /**
  1265. * @language en_US
  1266. * Indicates the horizontal scale (percentage) of the object as applied from the registration point. <br/>
  1267. * The default 1.0 equals 100% scale.
  1268. * @default 1
  1269. * @version Egret 2.4
  1270. * @platform Web,Native
  1271. */
  1272. /**
  1273. * @language zh_CN
  1274. * 表示从注册点开始应用的对象的水平缩放比例(百分比)。<br/>
  1275. * 1.0 等于 100% 缩放。
  1276. * @default 1
  1277. * @version Egret 2.4
  1278. * @platform Web,Native
  1279. */
  1280. scaleX: number;
  1281. /**
  1282. * @private
  1283. *
  1284. * @returns
  1285. */
  1286. $getScaleX(): number;
  1287. /**
  1288. * @private
  1289. * 设置水平缩放值
  1290. */
  1291. $setScaleX(value: number): boolean;
  1292. /**
  1293. * @language en_US
  1294. * Indicates the vertical scale (percentage) of an object as applied from the registration point of the object.
  1295. * 1.0 is 100% scale.
  1296. * @default 1
  1297. * @version Egret 2.4
  1298. * @platform Web,Native
  1299. */
  1300. /**
  1301. * @language zh_CN
  1302. * 表示从对象注册点开始应用的对象的垂直缩放比例(百分比)。1.0 是 100% 缩放。
  1303. * @default 1
  1304. * @version Egret 2.4
  1305. * @platform Web,Native
  1306. */
  1307. scaleY: number;
  1308. /**
  1309. * @private
  1310. *
  1311. * @returns
  1312. */
  1313. $getScaleY(): number;
  1314. /**
  1315. * @private
  1316. * 设置垂直缩放值
  1317. */
  1318. $setScaleY(value: number): boolean;
  1319. /**
  1320. * @language en_US
  1321. * Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. Values from
  1322. * 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside
  1323. * this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement
  1324. * myDisplayObject.rotation = 450 is the same as myDisplayObject.rotation = 90.
  1325. * @default 0
  1326. * @version Egret 2.4
  1327. * @platform Web,Native
  1328. */
  1329. /**
  1330. * @language zh_CN
  1331. * 表示 DisplayObject 实例距其原始方向的旋转程度,以度为单位。
  1332. * 从 0 到 180 的值表示顺时针方向旋转;从 0 到 -180 的值表示逆时针方向旋转。对于此范围之外的值,可以通过加上或
  1333. * 减去 360 获得该范围内的值。例如,myDisplayObject.rotation = 450语句与 myDisplayObject.rotation = 90 是相同的。
  1334. * @default 0
  1335. * @version Egret 2.4
  1336. * @platform Web,Native
  1337. */
  1338. rotation: number;
  1339. /**
  1340. * @private
  1341. *
  1342. * @returns
  1343. */
  1344. $getRotation(): number;
  1345. $setRotation(value: number): boolean;
  1346. /**
  1347. * 表示DisplayObject的x方向斜切
  1348. * @member {number} egret.DisplayObject#skewX
  1349. * @default 0
  1350. * @version Egret 2.4
  1351. * @platform Web,Native
  1352. */
  1353. skewX: number;
  1354. /**
  1355. * @private
  1356. *
  1357. * @param value
  1358. */
  1359. $setSkewX(value: number): boolean;
  1360. /**
  1361. * 表示DisplayObject的y方向斜切
  1362. * @member {number} egret.DisplayObject#skewY
  1363. * @default 0
  1364. * @version Egret 2.4
  1365. * @platform Web,Native
  1366. */
  1367. skewY: number;
  1368. /**
  1369. * @private
  1370. *
  1371. * @param value
  1372. */
  1373. $setSkewY(value: number): boolean;
  1374. /**
  1375. * @language en_US
  1376. * Indicates the width of the display object, in pixels. The width is calculated based on the bounds of the content
  1377. * of the display object.
  1378. * @version Egret 2.4
  1379. * @platform Web,Native
  1380. */
  1381. /**
  1382. * @language zh_CN
  1383. * 表示显示对象的宽度,以像素为单位。宽度是根据显示对象内容的范围来计算的。
  1384. * @version Egret 2.4
  1385. * @platform Web,Native
  1386. */
  1387. width: number;
  1388. /**
  1389. * @private
  1390. * 获取显示宽度
  1391. */
  1392. $getWidth(): number;
  1393. /**
  1394. * @private
  1395. *
  1396. * @returns
  1397. */
  1398. $getExplicitWidth(): number;
  1399. /**
  1400. * @private
  1401. * 设置显示宽度
  1402. */
  1403. $setWidth(value: number): boolean;
  1404. /**
  1405. * @language en_US
  1406. * Indicates the height of the display object, in pixels. The height is calculated based on the bounds of the
  1407. * content of the display object.
  1408. * @version Egret 2.4
  1409. * @platform Web,Native
  1410. */
  1411. /**
  1412. * @language zh_CN
  1413. * 表示显示对象的高度,以像素为单位。高度是根据显示对象内容的范围来计算的。
  1414. * @version Egret 2.4
  1415. * @platform Web,Native
  1416. */
  1417. height: number;
  1418. /**
  1419. * @private
  1420. * 获取显示高度
  1421. */
  1422. $getHeight(): number;
  1423. /**
  1424. * @private
  1425. *
  1426. * @returns
  1427. */
  1428. $getExplicitHeight(): number;
  1429. /**
  1430. * @private
  1431. * 设置显示高度
  1432. */
  1433. $setHeight(value: number): boolean;
  1434. /**
  1435. * 测量宽度
  1436. * @returns {number}
  1437. * @member {egret.Rectangle} egret.DisplayObject#measuredWidth
  1438. * @version Egret 2.4
  1439. * @platform Web,Native
  1440. */
  1441. measuredWidth: number;
  1442. /**
  1443. * 测量高度
  1444. * @returns {number}
  1445. * @member {egret.Rectangle} egret.DisplayObject#measuredWidth
  1446. * @version Egret 2.4
  1447. * @platform Web,Native
  1448. */
  1449. measuredHeight: number;
  1450. /**
  1451. * @language en_US
  1452. * X represents the object of which is the anchor.
  1453. * @default 0
  1454. * @version Egret 2.4
  1455. * @platform Web,Native
  1456. */
  1457. /**
  1458. * @language zh_CN
  1459. * 表示从对象绝对锚点X。
  1460. * @default 0
  1461. * @version Egret 2.4
  1462. * @platform Web,Native
  1463. */
  1464. anchorOffsetX: number;
  1465. /**
  1466. * @private
  1467. */
  1468. $getAnchorOffsetX(): boolean;
  1469. /**
  1470. * @private
  1471. *
  1472. * @param value
  1473. * @returns
  1474. */
  1475. $setAnchorOffsetX(value: number): boolean;
  1476. /**
  1477. * @language en_US
  1478. * Y represents the object of which is the anchor.
  1479. * @default 0
  1480. * @version Egret 2.4
  1481. * @platform Web,Native
  1482. */
  1483. /**
  1484. * @language zh_CN
  1485. * 表示从对象绝对锚点Y。
  1486. * @default 0
  1487. * @version Egret 2.4
  1488. * @platform Web,Native
  1489. */
  1490. anchorOffsetY: number;
  1491. /**
  1492. * @private
  1493. */
  1494. $getAnchorOffsetY(): boolean;
  1495. /**
  1496. * @private
  1497. *
  1498. * @param value
  1499. * @returns
  1500. */
  1501. $setAnchorOffsetY(value: number): boolean;
  1502. /**
  1503. * @private
  1504. */
  1505. $visible: boolean;
  1506. /**
  1507. * @language en_US
  1508. * Whether or not the display object is visible. Display objects that are not visible are disabled. For example,
  1509. * if visible=false for an DisplayObject instance, it cannot receive touch or other user input.
  1510. * @default true
  1511. * @version Egret 2.4
  1512. * @platform Web,Native
  1513. */
  1514. /**
  1515. * @language zh_CN
  1516. * 显示对象是否可见。不可见的显示对象将被禁用。例如,如果实例的 visible 为 false,则无法接受触摸或用户交互操作。
  1517. * @default true
  1518. * @version Egret 2.4
  1519. * @platform Web,Native
  1520. */
  1521. visible: boolean;
  1522. $setVisible(value: boolean): boolean;
  1523. /**
  1524. * @private
  1525. * 获取这个显示对象跟它所有父级透明度的乘积
  1526. */
  1527. $getConcatenatedVisible(): boolean;
  1528. /**
  1529. * @private
  1530. * cacheAsBitmap创建的缓存位图节点。
  1531. */
  1532. $displayList: egret.sys.DisplayList;
  1533. /**
  1534. * @language en_US
  1535. * If set to true, Egret runtime caches an internal bitmap representation of the display object. This caching can
  1536. * increase performance for display objects that contain complex vector content. After you set the cacheAsBitmap
  1537. * property to true, the rendering does not change, however the display object performs pixel snapping automatically.
  1538. * The execution speed can be significantly faster depending on the complexity of the content.The cacheAsBitmap
  1539. * property is best used with display objects that have mostly static content and that do not scale and rotate frequently.<br/>
  1540. * Note: The display object will not create the bitmap caching when the memory exceeds the upper limit,even if you set it to true.
  1541. * @default false
  1542. * @version Egret 2.4
  1543. * @platform Web,Native
  1544. */
  1545. /**
  1546. * @language zh_CN
  1547. * 如果设置为 true,则 Egret 运行时将缓存显示对象的内部位图表示形式。此缓存可以提高包含复杂矢量内容的显示对象的性能。
  1548. * 将 cacheAsBitmap 属性设置为 true 后,呈现并不更改,但是,显示对象将自动执行像素贴紧。执行速度可能会大大加快,
  1549. * 具体取决于显示对象内容的复杂性。最好将 cacheAsBitmap 属性与主要具有静态内容且不频繁缩放或旋转的显示对象一起使用。<br/>
  1550. * 注意:在内存超过上限的情况下,即使将 cacheAsBitmap 属性设置为 true,显示对象也不使用位图缓存。
  1551. * @default false
  1552. * @version Egret 2.4
  1553. * @platform Web,Native
  1554. */
  1555. cacheAsBitmap: boolean;
  1556. $setHasDisplayList(value: boolean): void;
  1557. /**
  1558. * @private
  1559. * cacheAsBitmap属性改变
  1560. */
  1561. $cacheAsBitmapChanged(): void;
  1562. /**
  1563. * @private
  1564. */
  1565. $alpha: number;
  1566. /**
  1567. * @language en_US
  1568. * Indicates the alpha transparency value of the object specified. Valid values are 0 (fully transparent) to 1 (fully opaque).
  1569. * The default value is 1. Display objects with alpha set to 0 are active, even though they are invisible.
  1570. * @default 1
  1571. * @version Egret 2.4
  1572. * @platform Web,Native
  1573. */
  1574. /**
  1575. * @language zh_CN
  1576. * 表示指定对象的 Alpha 透明度值。
  1577. * 有效值为 0(完全透明)到 1(完全不透明)。alpha 设置为 0 的显示对象是可触摸的,即使它们不可见。
  1578. * @default 1
  1579. * @version Egret 2.4
  1580. * @platform Web,Native
  1581. */
  1582. alpha: number;
  1583. /**
  1584. * @private
  1585. *
  1586. * @param value
  1587. */
  1588. $setAlpha(value: number): boolean;
  1589. /**
  1590. * @private
  1591. * 获取这个显示对象跟它所有父级透明度的乘积
  1592. */
  1593. $getConcatenatedAlpha(): number;
  1594. /**
  1595. * @private
  1596. * @language en_US
  1597. * The default touchEnabled property of DisplayObject
  1598. * @default false
  1599. * @version Egret 2.5
  1600. * @platform Web,Native
  1601. */
  1602. /**
  1603. * @private
  1604. * @language zh_CN
  1605. * 显示对象默认的 touchEnabled 属性
  1606. * @default false
  1607. * @version Egret 2.5
  1608. * @platform Web,Native
  1609. */
  1610. static defaultTouchEnabled: boolean;
  1611. $touchEnabled: boolean;
  1612. /**
  1613. * @language en_US
  1614. * Specifies whether this object receives touch or other user input. The default value is false, which means that
  1615. * by default any DisplayObject instance that is on the display list cannot receive touch events. If touchEnabled is
  1616. * set to false, the instance does not receive any touch events (or other user input events). Any children of
  1617. * this instance on the display list are not affected. To change the touchEnabled behavior for all children of
  1618. * an object on the display list, use DisplayObjectContainer.touchChildren.
  1619. * @see egret.DisplayObjectContainer#touchChildren
  1620. * @default false
  1621. * @version Egret 2.4
  1622. * @platform Web,Native
  1623. */
  1624. /**
  1625. * @language zh_CN
  1626. * 指定此对象是否接收触摸或其他用户输入。默认值为 false,这表示默认情况下,显示列表上的任何 DisplayObject 实例都不会接收触摸事件或
  1627. * 其他用户输入事件。如果将 touchEnabled 设置为 false,则实例将不接收任何触摸事件(或其他用户输入事件)。显示列表上的该实例的任
  1628. * 何子级都不会受到影响。要更改显示列表上对象的所有子级的 touchEnabled 行为,请使用 DisplayObjectContainer.touchChildren。
  1629. * @see egret.DisplayObjectContainer#touchChildren
  1630. * @default false
  1631. * @version Egret 2.4
  1632. * @platform Web,Native
  1633. */
  1634. touchEnabled: boolean;
  1635. /**
  1636. * @private
  1637. *
  1638. * @returns
  1639. */
  1640. $getTouchEnabled(): boolean;
  1641. /**
  1642. * @private
  1643. */
  1644. $setTouchEnabled(value: boolean): boolean;
  1645. /**
  1646. * @private
  1647. */
  1648. $scrollRect: Rectangle;
  1649. /**
  1650. * @language en_US
  1651. * The scroll rectangle bounds of the display object. The display object is cropped to the size defined by the rectangle,
  1652. * and it scrolls within the rectangle when you change the x and y properties of the scrollRect object. A scrolled display
  1653. * object always scrolls in whole pixel increments.You can scroll an object left and right by setting the x property of
  1654. * the scrollRect Rectangle object. You can scroll an object up and down by setting the y property of the scrollRect
  1655. * Rectangle object. If the display object is rotated 90° and you scroll it left and right, the display object actually
  1656. * scrolls up and down.<br/>
  1657. *
  1658. * Note: to change the value of a display object's scrollRect, you must make a copy of the entire scrollRect object, then copy
  1659. * the new object into the scrollRect property of the display object.
  1660. * @example the following code increases the x value of a display object's scrollRect
  1661. * <pre>
  1662. * let myRectangle:Rectangle = myDisplayObject.scrollRect;
  1663. * myRectangle.x += 10;
  1664. * myDisplayObject.scrollRect = myRectangle;
  1665. * </pre>
  1666. * @version Egret 2.4
  1667. * @platform Web,Native
  1668. */
  1669. /**
  1670. * @language zh_CN
  1671. * 显示对象的滚动矩形范围。显示对象被裁切为矩形定义的大小,当您更改 scrollRect 对象的 x 和 y 属性时,它会在矩形内滚动。
  1672. * 滚动的显示对象始终以整像素为增量进行滚动。您可以通过设置 scrollRect Rectangle 对象的 x 属性来左右滚动对象, 还可以通过设置
  1673. * scrollRect 对象的 y 属性来上下滚动对象。如果显示对象旋转了 90 度,并且您左右滚动它,则实际上显示对象会上下滚动。<br/>
  1674. *
  1675. * 注意:要改变一个显示对象 scrollRect 属性的值,您必引用整个 scrollRect 对象,然后将它重新赋值给显示对象的 scrollRect 属性。
  1676. * @example 以下代码改变了显示对象 scrollRect 的 x 属性值:
  1677. * <pre>
  1678. * let myRectangle:Rectangle = myDisplayObject.scrollRect;
  1679. * myRectangle.x += 10;
  1680. * myDisplayObject.scrollRect = myRectangle;//设置完scrollRect的x、y、width、height值之后,一定要对myDisplayObject重新赋值scrollRect,不然会出问题。
  1681. * </pre>
  1682. * @version Egret 2.4
  1683. * @platform Web,Native
  1684. */
  1685. scrollRect: Rectangle;
  1686. /**
  1687. * @private
  1688. *
  1689. * @param value
  1690. */
  1691. $setScrollRect(value: Rectangle): boolean;
  1692. /**
  1693. * @private
  1694. */
  1695. $blendMode: number;
  1696. /**
  1697. * @language en_US
  1698. * A value from the BlendMode class that specifies which blend mode to use. Determine how a source image (new one)
  1699. * is drawn on the target image (old one).<br/>
  1700. * If you attempt to set this property to an invalid value, Egret runtime set the value to BlendMode.NORMAL.
  1701. * @default egret.BlendMode.NORMAL
  1702. * @see egret.BlendMode
  1703. * @version Egret 2.4
  1704. * @platform Web,Native
  1705. */
  1706. /**
  1707. * @language zh_CN
  1708. * BlendMode 枚举中的一个值,用于指定要使用的混合模式,确定如何将一个源(新的)图像绘制到目标(已有)的图像上<br/>
  1709. * 如果尝试将此属性设置为无效值,则运行时会将此值设置为 BlendMode.NORMAL。
  1710. * @default egret.BlendMode.NORMAL
  1711. * @see egret.BlendMode
  1712. * @version Egret 2.4
  1713. * @platform Web,Native
  1714. */
  1715. blendMode: string;
  1716. /**
  1717. * @private
  1718. * 被遮罩的对象
  1719. */
  1720. $maskedObject: DisplayObject;
  1721. /**
  1722. * @private
  1723. */
  1724. $mask: DisplayObject;
  1725. /**
  1726. * @private
  1727. */
  1728. $maskRect: Rectangle;
  1729. /**
  1730. * @language en_US
  1731. * The calling display object is masked by the specified mask object. To ensure that masking works when the Stage
  1732. * is scaled, the mask display object must be in an active part of the display list. The mask object itself is not drawn.
  1733. * Set mask to null to remove the mask. To be able to scale a mask object, it must be on the display list. To be
  1734. * able to drag a mask object , it must be on the display list.<br/>
  1735. * Note: A single mask object cannot be used to mask more than one calling display object. When the mask is assigned
  1736. * to a second display object, it is removed as the mask of the first object, and that object's mask property becomes null.
  1737. * @version Egret 2.4
  1738. * @platform Web,Native
  1739. */
  1740. /**
  1741. * @language zh_CN
  1742. * 调用显示对象被指定的 mask 对象遮罩。要确保当舞台缩放时蒙版仍然有效,mask 显示对象必须处于显示列表的活动部分。
  1743. * 但不绘制 mask 对象本身。将 mask 设置为 null 可删除蒙版。要能够缩放遮罩对象,它必须在显示列表中。要能够拖动蒙版
  1744. * 对象,它必须在显示列表中。<br/>
  1745. * 注意:单个 mask 对象不能用于遮罩多个执行调用的显示对象。在将 mask 分配给第二个显示对象时,会撤消其作为第一个对象的遮罩,
  1746. * 该对象的 mask 属性将变为 null。
  1747. *
  1748. * 下面例子为 mask 为 Rectangle 类型对象,这种情况下,修改 mask 的值后,一定要对 myDisplayObject 重新赋值 mask,不然会出问题。
  1749. * @example 以下代码改变了显示对象 mask 的 x 属性值:
  1750. * <pre>
  1751. * let myMask:Rectangle = myDisplayObject.mask;
  1752. * myMask.x += 10;
  1753. * myDisplayObject.mask = myMask;//设置完 mask 的x、y、width、height值之后,一定要对myDisplayObject重新赋值 mask,不然会出问题。
  1754. * </pre>
  1755. * @version Egret 2.4
  1756. * @platform Web,Native
  1757. */
  1758. mask: DisplayObject | Rectangle;
  1759. $setMaskRect(value: Rectangle): boolean;
  1760. /**
  1761. * @language en_US
  1762. * An indexed array that contains each filter object currently associated with the display object.
  1763. * @version Egret 3.1.0
  1764. * @platform Web
  1765. */
  1766. /**
  1767. * @language zh_CN
  1768. * 包含当前与显示对象关联的每个滤镜对象的索引数组。
  1769. * @version Egret 3.1.0
  1770. * @platform Web
  1771. */
  1772. filters: Array<Filter>;
  1773. /**
  1774. * @private
  1775. * 获取filters
  1776. */
  1777. $getFilters(): Array<Filter>;
  1778. /**
  1779. * @language en_US
  1780. * Returns a rectangle that defines the area of the display object relative to the coordinate system of the targetCoordinateSpace object.
  1781. * @param targetCoordinateSpace The display object that defines the coordinate system to use.
  1782. * @param resultRect A reusable instance of Rectangle for saving the results. Passing this parameter can reduce the number of reallocate objects
  1783. *, which allows you to get better code execution performance..
  1784. * @returns The rectangle that defines the area of the display object relative to the targetCoordinateSpace object's coordinate system.
  1785. * @version Egret 2.4
  1786. * @platform Web,Native
  1787. */
  1788. /**
  1789. * @language zh_CN
  1790. * 返回一个矩形,该矩形定义相对于 targetCoordinateSpace 对象坐标系的显示对象区域。
  1791. * @param targetCoordinateSpace 定义要使用的坐标系的显示对象。
  1792. * @param resultRect 一个用于存储结果的可复用Rectangle实例,传入此参数能够减少内部创建对象的次数,从而获得更高的运行性能。
  1793. * @returns 定义与 targetCoordinateSpace 对象坐标系统相关的显示对象面积的矩形。
  1794. * @version Egret 2.4
  1795. * @platform Web,Native
  1796. */
  1797. getTransformedBounds(targetCoordinateSpace: DisplayObject, resultRect?: Rectangle): Rectangle;
  1798. /**
  1799. * @language en_US
  1800. * Obtain measurement boundary of display object
  1801. * @param resultRect {Rectangle} Optional. It is used to import Rectangle object for saving results, preventing duplicate object creation.
  1802. * @param calculateAnchor {boolean} Optional. It is used to determine whether to calculate anchor point.
  1803. * @returns {Rectangle}
  1804. * @version Egret 2.4
  1805. * @platform Web,Native
  1806. */
  1807. /**
  1808. * @language zh_CN
  1809. * 获取显示对象的测量边界
  1810. * @param resultRect {Rectangle} 可选参数,传入用于保存结果的Rectangle对象,避免重复创建对象。
  1811. * @param calculateAnchor {boolean} 可选参数,是否会计算锚点。
  1812. * @returns {Rectangle}
  1813. * @version Egret 2.4
  1814. * @platform Web,Native
  1815. */
  1816. getBounds(resultRect?: Rectangle, calculateAnchor?: boolean): egret.Rectangle;
  1817. /**
  1818. * @private
  1819. */
  1820. $getTransformedBounds(targetCoordinateSpace: DisplayObject, resultRect?: Rectangle): Rectangle;
  1821. /**
  1822. * @language en_US
  1823. * Converts the point object from the Stage (global) coordinates to the display object's (local) coordinates.
  1824. * @param stageX the x value in the global coordinates
  1825. * @param stageY the y value in the global coordinates
  1826. * @param resultPoint A reusable instance of Point for saving the results. Passing this parameter can reduce the
  1827. * number of reallocate objects, which allows you to get better code execution performance.
  1828. * @returns A Point object with coordinates relative to the display object.
  1829. * @version Egret 2.4
  1830. * @platform Web,Native
  1831. */
  1832. /**
  1833. * @language zh_CN
  1834. * 将从舞台(全局)坐标转换为显示对象的(本地)坐标。
  1835. * @param stageX 舞台坐标x
  1836. * @param stageY 舞台坐标y
  1837. * @param resultPoint 一个用于存储结果的可复用 Point 实例,传入此参数能够减少内部创建对象的次数,从而获得更高的运行性能。
  1838. * @returns 具有相对于显示对象的坐标的 Point 对象。
  1839. * @version Egret 2.4
  1840. * @platform Web,Native
  1841. */
  1842. globalToLocal(stageX?: number, stageY?: number, resultPoint?: Point): Point;
  1843. /**
  1844. * @language en_US
  1845. * Converts the point object from the display object's (local) coordinates to the Stage (global) coordinates.
  1846. * @param localX the x value in the local coordinates
  1847. * @param localY the x value in the local coordinates
  1848. * @param resultPoint A reusable instance of Point for saving the results. Passing this parameter can reduce the
  1849. * number of reallocate objects, which allows you to get better code execution performance.
  1850. * @returns A Point object with coordinates relative to the Stage.
  1851. * @version Egret 2.4
  1852. * @platform Web,Native
  1853. */
  1854. /**
  1855. * @language zh_CN
  1856. * 将显示对象的(本地)坐标转换为舞台(全局)坐标。
  1857. * @param localX 本地坐标 x
  1858. * @param localY 本地坐标 y
  1859. * @param resultPoint 一个用于存储结果的可复用 Point 实例,传入此参数能够减少内部创建对象的次数,从而获得更高的运行性能。
  1860. * @returns 一个具有相对于舞台坐标的 Point 对象。
  1861. * @version Egret 2.4
  1862. * @platform Web,Native
  1863. */
  1864. localToGlobal(localX?: number, localY?: number, resultPoint?: Point): Point;
  1865. /**
  1866. * @private
  1867. * 标记自身的测量尺寸失效
  1868. */
  1869. $invalidateContentBounds(): void;
  1870. /**
  1871. * @private
  1872. * 获取显示对象占用的矩形区域集合,通常包括自身绘制的测量区域,如果是容器,还包括所有子项占据的区域。
  1873. */
  1874. $getOriginalBounds(): Rectangle;
  1875. /**
  1876. * @private
  1877. * 测量子项占用的矩形区域
  1878. * @param bounds 测量结果存储在这个矩形对象内
  1879. */
  1880. $measureChildBounds(bounds: Rectangle): void;
  1881. /**
  1882. * @private
  1883. */
  1884. $getContentBounds(): Rectangle;
  1885. /**
  1886. * @private
  1887. * 测量自身占用的矩形区域,注意:此测量结果并不包括子项占据的区域。
  1888. * @param bounds 测量结果存储在这个矩形对象内
  1889. */
  1890. $measureContentBounds(bounds: Rectangle): void;
  1891. /**
  1892. * @private
  1893. */
  1894. $parentDisplayList: egret.sys.DisplayList;
  1895. /**
  1896. * @private
  1897. * 标记此显示对象需要重绘。此方法会触发自身的cacheAsBitmap重绘。如果只是矩阵改变,自身显示内容并不改变,应该调用$invalidateTransform().
  1898. * @param notiryChildren 是否标记子项也需要重绘。传入false或不传入,将只标记自身需要重绘。注意:当子项cache时不会继续向下标记
  1899. */
  1900. $invalidate(notifyChildren?: boolean): void;
  1901. /**
  1902. * @private
  1903. * 标记自身以及所有子项在父级中变换叠加的显示内容失效。此方法不会触发自身的cacheAsBitmap重绘。
  1904. * 通常用于矩阵改变或从显示列表添加和移除时。若自身的显示内容已经改变需要重绘,应该调用$invalidate()。
  1905. */
  1906. $invalidateTransform(): void;
  1907. /**
  1908. * @private
  1909. * 渲染节点,不为空表示自身有绘制到屏幕的内容
  1910. */
  1911. $renderNode: sys.RenderNode;
  1912. /**
  1913. * @private
  1914. * 获取渲染节点
  1915. */
  1916. $getRenderNode(): sys.RenderNode;
  1917. /**
  1918. * @private
  1919. * 更新对象在舞台上的显示区域,返回显示区域是否发生改变。
  1920. */
  1921. $update(dirtyRegionPolicy: string, bounds?: Rectangle): boolean;
  1922. private static boundsForUpdate;
  1923. /**
  1924. * @private
  1925. */
  1926. $measureFiltersOffset(): any;
  1927. /**
  1928. * @private
  1929. * 获取相对于指定根节点的连接矩阵。
  1930. * @param root 根节点显示对象
  1931. * @param matrix 目标显示对象相对于舞台的完整连接矩阵。
  1932. */
  1933. $getConcatenatedMatrixAt(root: DisplayObject, matrix: Matrix): void;
  1934. $getConcatenatedAlphaAt(root: DisplayObject, alpha: number): number;
  1935. /**
  1936. * @private
  1937. * 执行渲染,绘制自身到屏幕
  1938. */
  1939. $render(): void;
  1940. /**
  1941. * @private
  1942. */
  1943. $hitTest(stageX: number, stageY: number): DisplayObject;
  1944. /**
  1945. * @language en_US
  1946. * Calculate the display object to determine whether it overlaps or crosses with the points specified by the x and y parameters. The x and y parameters specify the points in the coordinates of the stage, rather than the points in the display object container that contains display objects (except the situation where the display object container is a stage).
  1947. * Note: Don't use accurate pixel collision detection on a large number of objects. Otherwise, this will cause serious performance deterioration.
  1948. * @param x {number} x coordinate of the object to be tested.
  1949. * @param y {number} y coordinate of the object to be tested.
  1950. * @param shapeFlag {boolean} Whether to check the actual pixel of object (true) or check that of border (false).Write realized.
  1951. * @returns {boolean} If display object overlaps or crosses with the specified point, it is true; otherwise, it is false.
  1952. * @version Egret 2.4
  1953. * @platform Web,Native
  1954. */
  1955. /**
  1956. * @language zh_CN
  1957. * 计算显示对象,以确定它是否与 x 和 y 参数指定的点重叠或相交。x 和 y 参数指定舞台的坐标空间中的点,而不是包含显示对象的显示对象容器中的点(除非显示对象容器是舞台)。
  1958. * 注意,不要在大量物体中使用精确碰撞像素检测,这回带来巨大的性能开销
  1959. * @param x {number} 要测试的此对象的 x 坐标。
  1960. * @param y {number} 要测试的此对象的 y 坐标。
  1961. * @param shapeFlag {boolean} 是检查对象 (true) 的实际像素,还是检查边框 (false) 的实际像素。
  1962. * @returns {boolean} 如果显示对象与指定的点重叠或相交,则为 true;否则为 false。
  1963. * @version Egret 2.4
  1964. * @platform Web,Native
  1965. */
  1966. hitTestPoint(x: number, y: number, shapeFlag?: boolean): boolean;
  1967. /**
  1968. * @private
  1969. */
  1970. static $enterFrameCallBackList: DisplayObject[];
  1971. /**
  1972. * @private
  1973. */
  1974. static $renderCallBackList: DisplayObject[];
  1975. /**
  1976. * @private
  1977. */
  1978. $addListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number, dispatchOnce?: boolean): void;
  1979. /**
  1980. * @inheritDoc
  1981. * @version Egret 2.4
  1982. * @platform Web,Native
  1983. */
  1984. removeEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean): void;
  1985. /**
  1986. * @inheritDoc
  1987. * @version Egret 2.4
  1988. * @platform Web,Native
  1989. */
  1990. dispatchEvent(event: Event): boolean;
  1991. /**
  1992. * @private
  1993. * 获取事件流列表。注意:Egret框架的事件流与Flash实现并不一致。
  1994. *
  1995. * 事件流有三个阶段:捕获,目标,冒泡。
  1996. * Flash里默认的的事件监听若不开启useCapture将监听目标和冒泡阶段。若开始capture将只能监听捕获当不包括目标的事件。
  1997. * 可以在Flash中写一个简单的测试:实例化一个非容器显示对象,例如TextField。分别监听useCapture为true和false时的鼠标事件。
  1998. * 点击后将只有useCapture为false的回调函数输出信息。也就带来一个问题「Flash的捕获阶段不能监听到最内层对象本身,只在父级列表有效」。
  1999. *
  2000. * 而HTML里的事件流设置useCapture为true时是能监听到目标阶段的,也就是目标阶段会被触发两次,在捕获和冒泡过程各触发一次。这样可以避免
  2001. * 前面提到的监听捕获无法监听目标本身的问题。
  2002. *
  2003. * Egret最终采用了HTML里目标节点触发两次的事件流方式。
  2004. */
  2005. $getPropagationList(target: DisplayObject): DisplayObject[];
  2006. /**
  2007. * @private
  2008. */
  2009. $dispatchPropagationEvent(event: Event, list: DisplayObject[], targetIndex: number): void;
  2010. /**
  2011. * @inheritDoc
  2012. * @version Egret 2.4
  2013. * @platform Web,Native
  2014. */
  2015. willTrigger(type: string): boolean;
  2016. }
  2017. }
  2018. declare namespace egret {
  2019. /**
  2020. * @language en_US
  2021. * The DisplayObjectContainer class is a basic display list building block: a display list node that can contain children.
  2022. * @version Egret 2.4
  2023. * @platform Web,Native
  2024. * @includeExample egret/display/DisplayObjectContainer.ts
  2025. */
  2026. /**
  2027. * @language zh_CN
  2028. * DisplayObjectContainer 类是基本显示列表构造块:一个可包含子项的显示列表节点。
  2029. * @version Egret 2.4
  2030. * @platform Web,Native
  2031. * @includeExample egret/display/DisplayObjectContainer.ts
  2032. */
  2033. class DisplayObjectContainer extends DisplayObject {
  2034. /**
  2035. * @private
  2036. */
  2037. static $EVENT_ADD_TO_STAGE_LIST: DisplayObject[];
  2038. /**
  2039. * @private
  2040. */
  2041. static $EVENT_REMOVE_FROM_STAGE_LIST: DisplayObject[];
  2042. /**
  2043. * @language en_US
  2044. * Creates a new DisplayObjectContainer instance.
  2045. * @version Egret 2.4
  2046. * @platform Web,Native
  2047. */
  2048. /**
  2049. * @language zh_CN
  2050. * 实例化一个容器
  2051. * @version Egret 2.4
  2052. * @platform Web,Native
  2053. */
  2054. constructor();
  2055. /**
  2056. * @private
  2057. */
  2058. $propagateFlagsDown(flags: sys.DisplayObjectFlags, cachedBreak?: boolean): void;
  2059. /**
  2060. * @language en_US
  2061. * Returns the number of children of this object.
  2062. * @version Egret 2.4
  2063. * @platform Web,Native
  2064. */
  2065. /**
  2066. * @language zh_CN
  2067. * 返回此对象的子项数目。
  2068. * @version Egret 2.4
  2069. * @platform Web,Native
  2070. */
  2071. numChildren: number;
  2072. /**
  2073. * @language en_US
  2074. * Adds a child DisplayObject instance to this DisplayObjectContainer instance. The child is added to the front
  2075. * (top) of all other children in this DisplayObjectContainer instance. (To add a child to a specific index position,
  2076. * use the addChildAt() method.)If you add a child object that already has a different display object container
  2077. * as a parent, the object is removed from the child list of the other display object container.
  2078. * @param child The DisplayObject instance to add as a child of this DisplayObjectContainer instance.
  2079. * @returns 在 child The DisplayObject instance that you pass in the child parameter.
  2080. * @see #addChildAt()
  2081. * @version Egret 2.4
  2082. * @platform Web,Native
  2083. */
  2084. /**
  2085. * @language zh_CN
  2086. * 将一个 DisplayObject 子实例添加到该 DisplayObjectContainer 实例中。子项将被添加到该 DisplayObjectContainer 实例中其他
  2087. * 所有子项的前(上)面。(要将某子项添加到特定索引位置,请使用 addChildAt() 方法。)
  2088. * @param child 要作为该 DisplayObjectContainer 实例的子项添加的 DisplayObject 实例。
  2089. * @returns 在 child 参数中传递的 DisplayObject 实例。
  2090. * @see #addChildAt()
  2091. * @version Egret 2.4
  2092. * @platform Web,Native
  2093. */
  2094. addChild(child: DisplayObject): DisplayObject;
  2095. /**
  2096. * @language en_US
  2097. * Adds a child DisplayObject instance to this DisplayObjectContainer instance. The child is added at the index position
  2098. * specified. An index of 0 represents the back (bottom) of the display list for this DisplayObjectContainer object.
  2099. * If you add a child object that already has a different display object container as a parent, the object is removed
  2100. * from the child list of the other display object container.
  2101. * @param child The DisplayObject instance to add as a child of this DisplayObjectContainer instance.
  2102. * @param index The index position to which the child is added. If you specify a currently occupied index position,
  2103. * the child object that exists at that position and all higher positions are moved up one position in the child list.
  2104. * @returns The DisplayObject instance that you pass in the child parameter.
  2105. * @see #addChild()
  2106. * @version Egret 2.4
  2107. * @platform Web,Native
  2108. */
  2109. /**
  2110. * @language zh_CN
  2111. * 将一个 DisplayObject 子实例添加到该 DisplayObjectContainer 实例中。该子项将被添加到指定的索引位置。索引为 0 表示该
  2112. * DisplayObjectContainer 对象的显示列表的后(底)部。如果添加一个已将其它显示对象容器作为父项的子对象,则会从其它显示对象容器的子列表中删除该对象。
  2113. * @param child 要作为该 DisplayObjectContainer 实例的子项添加的 DisplayObject 实例。
  2114. * @param index 添加该子项的索引位置。 如果指定当前占用的索引位置,则该位置以及所有更高位置上的子对象会在子级列表中上移一个位置。
  2115. * @returns 在 child 参数中传递的 DisplayObject 实例。
  2116. * @see #addChild()
  2117. * @version Egret 2.4
  2118. * @platform Web,Native
  2119. */
  2120. addChildAt(child: DisplayObject, index: number): DisplayObject;
  2121. /**
  2122. * @private
  2123. */
  2124. $doAddChild(child: DisplayObject, index: number, notifyListeners?: boolean): DisplayObject;
  2125. /**
  2126. * @language en_US
  2127. * Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance
  2128. * itself. The search includes the entire display list including this DisplayObjectContainer instance. Grandchildren,
  2129. * great-grandchildren, and so on each return true.
  2130. * @param child The child object to test.
  2131. * @returns true if the child object is a child of the DisplayObjectContainer or the container itself; otherwise false.
  2132. * @version Egret 2.4
  2133. * @platform Web,Native
  2134. */
  2135. /**
  2136. * @language zh_CN
  2137. * 确定指定显示对象是 DisplayObjectContainer 实例的子项还是该实例本身。搜索包括整个显示列表(其中包括此 DisplayObjectContainer 实例)。
  2138. * 孙项、曾孙项等,每项都返回 true。
  2139. * @param child 要测试的子对象。
  2140. * @returns 如果指定的显示对象为 DisplayObjectContainer 该实例本身,则返回true,如果指定的显示对象为当前实例子项,则返回false。
  2141. * @version Egret 2.4
  2142. * @platform Web,Native
  2143. */
  2144. contains(child: DisplayObject): boolean;
  2145. /**
  2146. * @language en_US
  2147. * Returns the child display object instance that exists at the specified index.
  2148. * @param index The index position of the child object.
  2149. * @returns The child display object at the specified index position.
  2150. * @see #getChildByName()
  2151. * @version Egret 2.4
  2152. * @platform Web,Native
  2153. */
  2154. /**
  2155. * @language zh_CN
  2156. * 返回位于指定索引处的子显示对象实例。
  2157. * @param index 子对象的索引位置。
  2158. * @returns 位于指定索引位置处的子显示对象。
  2159. * @see #getChildByName()
  2160. * @version Egret 2.4
  2161. * @platform Web,Native
  2162. */
  2163. getChildAt(index: number): DisplayObject;
  2164. /**
  2165. * @language en_US
  2166. * Returns the index position of a child DisplayObject instance.
  2167. * @param child The DisplayObject instance to identify.
  2168. * @returns The index position of the child display object to identify.
  2169. * @version Egret 2.4
  2170. * @platform Web,Native
  2171. */
  2172. /**
  2173. * @language zh_CN
  2174. * 返回 DisplayObject 的 child 实例的索引位置。
  2175. * @param child 要测试的子对象。
  2176. * @returns 要查找的子显示对象的索引位置。
  2177. * @version Egret 2.4
  2178. * @platform Web,Native
  2179. */
  2180. getChildIndex(child: egret.DisplayObject): number;
  2181. /**
  2182. * @language en_US
  2183. * Returns the child display object that exists with the specified name. If more that one child display object has
  2184. * the specified name, the method returns the first object in the child list.The getChildAt() method is faster than
  2185. * the getChildByName() method. The getChildAt() method accesses a child from a cached array, whereas the getChildByName()
  2186. * method has to traverse a linked list to access a child.
  2187. * @param name The name of the child to return.
  2188. * @returns The child display object with the specified name.
  2189. * @see #getChildAt()
  2190. * @see egret.DisplayObject#name
  2191. * @version Egret 2.4
  2192. * @platform Web,Native
  2193. */
  2194. /**
  2195. * @language zh_CN
  2196. * 返回具有指定名称的子显示对象。如果多个子显示对象具有指定名称,则该方法会返回子级列表中的第一个对象。
  2197. * getChildAt() 方法比 getChildByName() 方法快。getChildAt() 方法从缓存数组中访问子项,而 getChildByName() 方法则必须遍历链接的列表来访问子项。
  2198. * @param name 要返回的子项的名称。
  2199. * @returns 具有指定名称的子显示对象。
  2200. * @see #getChildAt()
  2201. * @see egret.DisplayObject#name
  2202. * @version Egret 2.4
  2203. * @platform Web,Native
  2204. */
  2205. getChildByName(name: string): DisplayObject;
  2206. /**
  2207. * @language en_US
  2208. * Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance.
  2209. * The parent property of the removed child is set to null , and the object is garbage collected if no other references
  2210. * to the child exist. The index positions of any display objects above the child in the DisplayObjectContainer are
  2211. * decreased by 1.
  2212. * @param child The DisplayObject instance to remove.
  2213. * @returns The DisplayObject instance that you pass in the child parameter.
  2214. * @see #removeChildAt()
  2215. * @version Egret 2.4
  2216. * @platform Web,Native
  2217. */
  2218. /**
  2219. * @language zh_CN
  2220. * 从 DisplayObjectContainer 实例的子列表中删除指定的 child DisplayObject 实例。将已删除子项的 parent 属性设置为 null;
  2221. * 如果不存在对该子项的任何其它引用,则将该对象作为垃圾回收。DisplayObjectContainer 中该子项之上的任何显示对象的索引位置都减去 1。
  2222. * @param child 要删除的 DisplayObject 实例。
  2223. * @returns 在 child 参数中传递的 DisplayObject 实例。
  2224. * @see #removeChildAt()
  2225. * @version Egret 2.4
  2226. * @platform Web,Native
  2227. */
  2228. removeChild(child: DisplayObject): DisplayObject;
  2229. /**
  2230. * @language en_US
  2231. * Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer.
  2232. * The parent property of the removed child is set to null, and the object is garbage collected if no other references
  2233. * to the child exist. The index positions of any display objects above the child in the DisplayObjectContainer are decreased by 1.
  2234. * @param index The child index of the DisplayObject to remove.
  2235. * @returns The DisplayObject instance that was removed.
  2236. * @see #removeChild()
  2237. * @version Egret 2.4
  2238. * @platform Web,Native
  2239. */
  2240. /**
  2241. * @language zh_CN
  2242. * 从 DisplayObjectContainer 的子列表中指定的 index 位置删除子 DisplayObject。将已删除子项的 parent 属性设置为 null;
  2243. * 如果没有对该子项的任何其他引用,则将该对象作为垃圾回收。DisplayObjectContainer 中该子项之上的任何显示对象的索引位置都减去 1。
  2244. * @param index 要删除的 DisplayObject 的子索引。
  2245. * @returns 已删除的 DisplayObject 实例。
  2246. * @see #removeChild()
  2247. * @version Egret 2.4
  2248. * @platform Web,Native
  2249. */
  2250. removeChildAt(index: number): DisplayObject;
  2251. /**
  2252. * @private
  2253. */
  2254. $doRemoveChild(index: number, notifyListeners?: boolean): DisplayObject;
  2255. /**
  2256. * @language en_US
  2257. * Changes the position of an existing child in the display object container. This affects the layering of child objects.
  2258. * @param child The child DisplayObject instance for which you want to change the index number.
  2259. * @param index The resulting index number for the child display object.
  2260. * @see #addChildAt()
  2261. * @see #getChildAt()
  2262. * @version Egret 2.4
  2263. * @platform Web,Native
  2264. */
  2265. /**
  2266. * @language zh_CN
  2267. * 更改现有子项在显示对象容器中的位置。这会影响子对象的分层。
  2268. * @param child 要为其更改索引编号的 DisplayObject 子实例。
  2269. * @param index 生成的 child 显示对象的索引编号。当新的索引编号小于0或大于已有子元件数量时,新加入的DisplayObject对象将会放置于最上层。
  2270. * @see #addChildAt()
  2271. * @see #getChildAt()
  2272. * @version Egret 2.4
  2273. * @platform Web,Native
  2274. */
  2275. setChildIndex(child: DisplayObject, index: number): void;
  2276. /**
  2277. * @private
  2278. */
  2279. private doSetChildIndex(child, index);
  2280. /**
  2281. * @language en_US
  2282. * Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child
  2283. * list. All other child objects in the display object container remain in the same index positions.
  2284. * @param index1 The index position of the first child object.
  2285. * @param index2 The index position of the second child object.
  2286. * @see #swapChildren()
  2287. * @version Egret 2.4
  2288. * @platform Web,Native
  2289. */
  2290. /**
  2291. * @language zh_CN
  2292. * 在子级列表中两个指定的索引位置,交换子对象的 Z 轴顺序(前后顺序)。显示对象容器中所有其他子对象的索引位置保持不变。
  2293. * @param index1 第一个子对象的索引位置。
  2294. * @param index2 第二个子对象的索引位置。
  2295. * @see #swapChildren()
  2296. * @version Egret 2.4
  2297. * @platform Web,Native
  2298. */
  2299. swapChildrenAt(index1: number, index2: number): void;
  2300. /**
  2301. * @language en_US
  2302. * Swaps the z-order (front-to-back order) of the two specified child objects. All other child objects in the
  2303. * display object container remain in the same index positions.
  2304. * @param child1 The first child object.
  2305. * @param child2 The second child object.
  2306. * @see #swapChildrenAt()
  2307. * @version Egret 2.4
  2308. * @platform Web,Native
  2309. */
  2310. /**
  2311. * @language zh_CN
  2312. * 交换两个指定子对象的 Z 轴顺序(从前到后顺序)。显示对象容器中所有其他子对象的索引位置保持不变。
  2313. * @param child1 第一个子对象。
  2314. * @param child2 第二个子对象。
  2315. * @see #swapChildrenAt()
  2316. * @version Egret 2.4
  2317. * @platform Web,Native
  2318. */
  2319. swapChildren(child1: DisplayObject, child2: DisplayObject): void;
  2320. /**
  2321. * @private
  2322. */
  2323. private doSwapChildrenAt(index1, index2);
  2324. /**
  2325. * @language en_US
  2326. * Removes all child DisplayObject instances from the child list of the DisplayObjectContainer instance. The parent
  2327. * property of the removed children is set to null , and the objects are garbage collected if no other references to the children exist.
  2328. * @see #removeChild()
  2329. * @see #removeChildAt()
  2330. * @version Egret 2.4
  2331. * @platform Web,Native
  2332. */
  2333. /**
  2334. * @language zh_CN
  2335. * 从 DisplayObjectContainer 实例的子级列表中删除所有 child DisplayObject 实例。
  2336. * @see #removeChild()
  2337. * @see #removeChildAt()
  2338. * @version Egret 2.4
  2339. * @platform Web,Native
  2340. */
  2341. removeChildren(): void;
  2342. /**
  2343. * @private
  2344. * 一个子项被添加到容器内,此方法不仅在操作addChild()时会被回调,在操作setChildIndex()或swapChildren时也会回调。
  2345. * 当子项索引发生改变时,会先触发$childRemoved()方法,然后触发$childAdded()方法。
  2346. */
  2347. $childAdded(child: DisplayObject, index: number): void;
  2348. /**
  2349. * @private
  2350. * 一个子项从容器内移除,此方法不仅在操作removeChild()时会被回调,在操作setChildIndex()或swapChildren时也会回调。
  2351. * 当子项索引发生改变时,会先触发$childRemoved()方法,然后触发$childAdded()方法。
  2352. */
  2353. $childRemoved(child: DisplayObject, index: number): void;
  2354. /**
  2355. * @private
  2356. */
  2357. $onAddToStage(stage: Stage, nestLevel: number): void;
  2358. /**
  2359. * @private
  2360. *
  2361. */
  2362. $onRemoveFromStage(): void;
  2363. /**
  2364. * @private
  2365. */
  2366. $measureChildBounds(bounds: Rectangle): void;
  2367. $touchChildren: boolean;
  2368. /**
  2369. * @language en_US
  2370. * Determines whether or not the children of the object are touch, or user input device, enabled. If an object is
  2371. * enabled, a user can interact with it by using a touch or user input device.
  2372. * @default true
  2373. * @version Egret 2.4
  2374. * @platform Web,Native
  2375. */
  2376. /**
  2377. * @language zh_CN
  2378. * 确定对象的子级是否支持触摸或用户输入设备。如果对象支持触摸或用户输入设备,用户可以通过使用触摸或用户输入设备与之交互。
  2379. * @default true
  2380. * @version Egret 2.4
  2381. * @platform Web,Native
  2382. */
  2383. touchChildren: boolean;
  2384. /**
  2385. * @private
  2386. *
  2387. * @returns
  2388. */
  2389. $getTouchChildren(): boolean;
  2390. /**
  2391. * @private
  2392. */
  2393. $setTouchChildren(value: boolean): boolean;
  2394. /**
  2395. * @private
  2396. * 标记此显示对象需要重绘。此方法会触发自身的cacheAsBitmap重绘。如果只是矩阵改变,自身显示内容并不改变,应该调用$invalidateTransform().
  2397. * @param notiryChildren 是否标记子项也需要重绘。传入false或不传入,将只标记自身需要重绘。通常只有alpha属性改变会需要通知子项重绘。
  2398. */
  2399. $invalidate(notifyChildren?: boolean): void;
  2400. /**
  2401. * @private
  2402. * 标记自身以及所有子项在父级中变换叠加的显示内容失效。此方法不会触发自身的cacheAsBitmap重绘。
  2403. * 通常用于矩阵改变或从显示列表添加和移除时。若自身的显示内容已经改变需要重绘,应该调用$invalidate()。
  2404. */
  2405. $invalidateTransform(): void;
  2406. /**
  2407. * @private
  2408. * 标记所有子项失效,若遇到cacheAsBitmap的节点,直接停止继续遍历其子项.
  2409. */
  2410. private markChildDirty(child, parentCache);
  2411. /**
  2412. * @private
  2413. */
  2414. $cacheAsBitmapChanged(): void;
  2415. /**
  2416. * @private
  2417. */
  2418. private assignParentDisplayList(child, parentCache, newParent);
  2419. /**
  2420. * @private
  2421. */
  2422. $hitTest(stageX: number, stageY: number): DisplayObject;
  2423. /**
  2424. * @private
  2425. * 子项有可能会被cache而导致标记失效。重写此方法,以便在赋值时对子项深度遍历标记脏区域
  2426. */
  2427. $setAlpha(value: number): boolean;
  2428. /**
  2429. * @private
  2430. * 标记所有子项失效,与markChildDirty不同,此方法无视子项是否启用cacheAsBitmap,必须遍历完所有子项.通常只有alpha属性改变需要采用这种操作.
  2431. */
  2432. private $invalidateAllChildren();
  2433. }
  2434. }
  2435. declare namespace egret {
  2436. /**
  2437. * @private
  2438. * @version Egret 2.4
  2439. * @platform Web,Native
  2440. */
  2441. class Filter extends HashObject {
  2442. /**
  2443. * @version Egret 2.4
  2444. * @platform Web,Native
  2445. */
  2446. type: string;
  2447. private $targets;
  2448. $addTarget(target: DisplayObject): void;
  2449. $removeTarget(target: DisplayObject): void;
  2450. protected invalidate(): void;
  2451. /**
  2452. * @private
  2453. */
  2454. $toJson(): string;
  2455. }
  2456. }
  2457. declare namespace egret {
  2458. /**
  2459. * @language en_US
  2460. * SpriteSheet is a mosaic of multiple sub-bitmaps, comprising a plurality of Texture objects.
  2461. * Each Texture object shares the set bitmap of SpriteSheet, but it points to its different areas.
  2462. * On WebGL / OpenGL, this operation can significantly improve performance.
  2463. * At the same time, SpriteSheet can carry out material integration easily to reduce the number of HTTP requests
  2464. * For specification of the SpriteSheet format, see the document https://github.com/egret-labs/egret-core/wiki/Egret-SpriteSheet-Specification
  2465. * @see http://edn.egret.com/cn/docs/page/135 The use of texture packs
  2466. * @version Egret 2.4
  2467. * @platform Web,Native
  2468. * @includeExample egret/display/SpriteSheet.ts
  2469. */
  2470. /**
  2471. * @language zh_CN
  2472. * SpriteSheet 是一张由多个子位图拼接而成的集合位图,它包含多个 Texture 对象。
  2473. * 每一个 Texture 都共享 SpriteSheet 的集合位图,但是指向它的不同的区域。
  2474. * 在WebGL / OpenGL上,这种做法可以显著提升性能
  2475. * 同时,SpriteSheet可以很方便的进行素材整合,降低HTTP请求数量
  2476. * SpriteSheet 格式的具体规范可以参见此文档 https://github.com/egret-labs/egret-core/wiki/Egret-SpriteSheet-Specification
  2477. * @see http://edn.egret.com/cn/docs/page/135 纹理集的使用
  2478. * @version Egret 2.4
  2479. * @platform Web,Native
  2480. * @includeExample egret/display/SpriteSheet.ts
  2481. */
  2482. class SpriteSheet extends HashObject {
  2483. /**
  2484. * @language en_US
  2485. * Create an egret.SpriteSheet object
  2486. * @param texture {Texture} Texture
  2487. * @version Egret 2.4
  2488. * @platform Web,Native
  2489. */
  2490. /**
  2491. * @language zh_CN
  2492. * 创建一个 egret.SpriteSheet 对象
  2493. * @param texture {Texture} 纹理
  2494. * @version Egret 2.4
  2495. * @platform Web,Native
  2496. */
  2497. constructor(texture: Texture);
  2498. /**
  2499. * @private
  2500. * 表示这个SpriteSheet的位图区域在bitmapData上的起始位置x。
  2501. */
  2502. private _bitmapX;
  2503. /**
  2504. * @private
  2505. * 表示这个SpriteSheet的位图区域在bitmapData上的起始位置y。
  2506. */
  2507. private _bitmapY;
  2508. /**
  2509. * @private
  2510. * 共享的位图数据
  2511. */
  2512. $texture: Texture;
  2513. /**
  2514. * @private
  2515. * 纹理缓存字典
  2516. */
  2517. _textureMap: MapLike<Texture>;
  2518. /**
  2519. * @language en_US
  2520. * Obtain a cached Texture object according to the specified texture name
  2521. * @param name {string} Cache the name of this Texture object
  2522. * @returns {egret.Texture} The Texture object
  2523. * @version Egret 2.4
  2524. * @platform Web,Native
  2525. */
  2526. /**
  2527. * @language zh_CN
  2528. * 根据指定纹理名称获取一个缓存的 Texture 对象
  2529. * @param name {string} 缓存这个 Texture 对象所使用的名称
  2530. * @returns {egret.Texture} Texture 对象
  2531. * @version Egret 2.4
  2532. * @platform Web,Native
  2533. */
  2534. getTexture(name: string): Texture;
  2535. /**
  2536. * @language en_US
  2537. * Create a new Texture object for the specified area on SpriteSheet and cache it
  2538. * @param name {string} Cache the name of this Texture object. If the name already exists, the previous Texture object will be overwrited.
  2539. * @param bitmapX {number} Starting coordinate x of texture area on bitmapData
  2540. * @param bitmapY {number} Starting coordinate y of texture area on bitmapData
  2541. * @param bitmapWidth {number} Width of texture area on bitmapData
  2542. * @param bitmapHeight {number} Height of texture area on bitmapData
  2543. * @param offsetX {number} Starting point x for a non-transparent area of the original bitmap
  2544. * @param offsetY {number} Starting point y for a non-transparent area of the original bitmap
  2545. * @param textureWidth {number} Width of the original bitmap. If it is not passed, use the bitmapWidth value.
  2546. * @param textureHeight {number} Height of the original bitmap. If it is not passed, use the bitmapHeight value.
  2547. * @returns {egret.Texture} The created Texture object
  2548. * @version Egret 2.4
  2549. * @platform Web,Native
  2550. */
  2551. /**
  2552. * @language zh_CN
  2553. * 为 SpriteSheet 上的指定区域创建一个新的 Texture 对象并缓存它
  2554. * @param name {string} 缓存这个 Texture 对象所使用的名称,如果名称已存在,将会覆盖之前的 Texture 对象
  2555. * @param bitmapX {number} 纹理区域在 bitmapData 上的起始坐标x
  2556. * @param bitmapY {number} 纹理区域在 bitmapData 上的起始坐标y
  2557. * @param bitmapWidth {number} 纹理区域在 bitmapData 上的宽度
  2558. * @param bitmapHeight {number} 纹理区域在 bitmapData 上的高度
  2559. * @param offsetX {number} 原始位图的非透明区域 x 起始点
  2560. * @param offsetY {number} 原始位图的非透明区域 y 起始点
  2561. * @param textureWidth {number} 原始位图的高度,若不传入,则使用 bitmapWidth 的值。
  2562. * @param textureHeight {number} 原始位图的宽度,若不传入,则使用 bitmapHeight 的值。
  2563. * @returns {egret.Texture} 创建的 Texture 对象
  2564. * @version Egret 2.4
  2565. * @platform Web,Native
  2566. */
  2567. createTexture(name: string, bitmapX: number, bitmapY: number, bitmapWidth: number, bitmapHeight: number, offsetX?: number, offsetY?: number, textureWidth?: number, textureHeight?: number): Texture;
  2568. /**
  2569. * @language en_US
  2570. * dispose texture
  2571. * @version Egret 2.4
  2572. * @platform Web,Native
  2573. */
  2574. /**
  2575. * @language zh_CN
  2576. * 释放纹理
  2577. * @version Egret 2.4
  2578. * @platform Web,Native
  2579. */
  2580. dispose(): void;
  2581. }
  2582. }
  2583. declare namespace egret {
  2584. /**
  2585. * @language en_US
  2586. * The Event class is used as the base class for the creation of Event objects, which are passed as parameters to event
  2587. * listeners when an event occurs.The properties of the Event class carry basic information about an event, such as
  2588. * the event's type or whether the event's default behavior can be canceled. For many events, such as the events represented
  2589. * by the Event class constants, this basic information is sufficient. Other events, however, may require more detailed
  2590. * information. Events associated with a touch tap, for example, need to include additional information about the
  2591. * location of the touch event. You can pass such additional information to event listeners by extending the Event class,
  2592. * which is what the TouchEvent class does. Egret API defines several Event subclasses for common events that require
  2593. * additional information. Events associated with each of the Event subclasses are described in the documentation for
  2594. * each class.The methods of the Event class can be used in event listener functions to affect the behavior of the event
  2595. * object. Some events have an associated default behavior. Your event listener can cancel this behavior by calling the
  2596. * preventDefault() method. You can also make the current event listener the last one to process an event by calling
  2597. * the stopPropagation() or stopImmediatePropagation() method.
  2598. * @see egret.EventDispatcher
  2599. * @version Egret 2.4
  2600. * @platform Web,Native
  2601. * @includeExample egret/events/Event.ts
  2602. * @see http://edn.egret.com/cn/docs/page/798 取消触摸事件
  2603. */
  2604. /**
  2605. * @language zh_CN
  2606. * Event 类作为创建事件实例的基类,当发生事件时,Event 实例将作为参数传递给事件侦听器。Event 类的属性包含有关事件的基本信息,例如事件
  2607. * 的类型或者是否可以取消事件的默认行为。对于许多事件(如由 Event 类常量表示的事件),此基本信息就足够了。但其他事件可能需要更详细的信息。
  2608. * 例如,与触摸关联的事件需要包括有关触摸事件的位置信息。您可以通过扩展 Event 类(TouchEvent 类执行的操作)将此类其他信息传递给事件侦听器。
  2609. * Egret API 为需要其他信息的常见事件定义多个 Event 子类。与每个 Event 子类关联的事件将在每个类的文档中加以介绍。Event 类的方法可以在
  2610. * 事件侦听器函数中使用以影响事件对象的行为。某些事件有关联的默认行为,通过调用 preventDefault() 方法,您的事件侦听器可以取消此行为。
  2611. * 可以通过调用 stopPropagation() 或 stopImmediatePropagation() 方法,将当前事件侦听器作为处理事件的最后一个事件侦听器。
  2612. * @see egret.EventDispatcher
  2613. * @version Egret 2.4
  2614. * @platform Web,Native
  2615. * @includeExample egret/events/Event.ts
  2616. * @see http://edn.egret.com/cn/docs/page/798 取消触摸事件
  2617. */
  2618. class Event extends HashObject {
  2619. /**
  2620. * @language en_US
  2621. * Dispatched when a display object is added to the on stage display list, either directly or through the addition
  2622. * of a sub tree in which the display object is contained.
  2623. * @version Egret 2.4
  2624. * @platform Web,Native
  2625. */
  2626. /**
  2627. * @language zh_CN
  2628. * 在将显示对象直接添加到舞台显示列表或将包含显示对象的子树添加至舞台显示列表中时调度。
  2629. * @version Egret 2.4
  2630. * @platform Web,Native
  2631. */
  2632. static ADDED_TO_STAGE: string;
  2633. /**
  2634. * @language en_US
  2635. * Dispatched when a display object is about to be removed from the display list, either directly or through the removal
  2636. * of a sub tree in which the display object is contained.
  2637. * @version Egret 2.4
  2638. * @platform Web,Native
  2639. */
  2640. /**
  2641. * @language zh_CN
  2642. * 在从显示列表中直接删除显示对象或删除包含显示对象的子树时调度。
  2643. * @version Egret 2.4
  2644. * @platform Web,Native
  2645. */
  2646. static REMOVED_FROM_STAGE: string;
  2647. /**
  2648. * @language en_US
  2649. * Dispatched when a display object is added to the display list.
  2650. * @version Egret 2.4
  2651. * @platform Web,Native
  2652. */
  2653. /**
  2654. * @language zh_CN
  2655. * 将显示对象添加到显示列表中时调度。
  2656. * @version Egret 2.4
  2657. * @platform Web,Native
  2658. */
  2659. static ADDED: string;
  2660. /**
  2661. * @language en_US
  2662. * Dispatched when a display object is about to be removed from the display list.
  2663. * @version Egret 2.4
  2664. * @platform Web,Native
  2665. */
  2666. /**
  2667. * @language zh_CN
  2668. * 将要从显示列表中删除显示对象时调度。
  2669. * @version Egret 2.4
  2670. * @platform Web,Native
  2671. */
  2672. static REMOVED: string;
  2673. /**
  2674. * @language en_US
  2675. * [broadcast event] Dispatched when the playhead is entering a new frame.
  2676. * @version Egret 2.4
  2677. * @platform Web,Native
  2678. */
  2679. /**
  2680. * @language zh_CN
  2681. * [广播事件] 进入新的一帧,监听此事件将会在下一帧开始时触发一次回调。这是一个广播事件,可以在任何一个显示对象上监听,无论它是否在显示列表中。
  2682. * @version Egret 2.4
  2683. * @platform Web,Native
  2684. */
  2685. static ENTER_FRAME: string;
  2686. /**
  2687. * @language en_US
  2688. * Dispatched when the display list is about to be updated and rendered.
  2689. * Note: Every time you want to receive a render event,you must call the stage.invalidate() method.
  2690. * @version Egret 2.4
  2691. * @platform Web,Native
  2692. */
  2693. /**
  2694. * @language zh_CN
  2695. * 渲染事件,监听此事件将会在本帧末即将开始渲染的前一刻触发回调,这是一个广播事件,可以在任何一个显示对象上监听,无论它是否在显示列表中。
  2696. * 注意:每次您希望 Egret 发送 Event.RENDER 事件时,都必须调用 stage.invalidate() 方法,由于每帧只会触发一次屏幕刷新,
  2697. * 若在 Event.RENDER 回调函数执行期间再次调用stage.invalidate(),将会被忽略。
  2698. * @version Egret 2.4
  2699. * @platform Web,Native
  2700. */
  2701. static RENDER: string;
  2702. /**
  2703. * @language en_US
  2704. * Dispatched when the size of stage or UIComponent is changed.
  2705. * @version Egret 2.4
  2706. * @platform Web,Native
  2707. */
  2708. /**
  2709. * @language zh_CN
  2710. * 舞台尺寸或UI组件尺寸发生改变
  2711. * @version Egret 2.4
  2712. * @platform Web,Native
  2713. */
  2714. static RESIZE: string;
  2715. /**
  2716. * @language en_US
  2717. * Dispatched when the value or selection of a property is chaned.
  2718. * @version Egret 2.4
  2719. * @platform Web,Native
  2720. */
  2721. /**
  2722. * @language zh_CN
  2723. * 属性值或状态发生改变。通常是按钮的选中状态,或者列表的选中项索引改变。
  2724. * @version Egret 2.4
  2725. * @platform Web,Native
  2726. */
  2727. static CHANGE: string;
  2728. /**
  2729. * @language en_US
  2730. * Dispatched when the value or selection of a property is going to change.you can cancel this by calling the
  2731. * preventDefault() method.
  2732. * @version Egret 2.4
  2733. * @platform Web,Native
  2734. */
  2735. /**
  2736. * @language zh_CN
  2737. * 属性值或状态即将发生改变,通常是按钮的选中状态,或者列表的选中项索引改变。可以通过调用 preventDefault() 方法阻止索引发生更改。
  2738. * @version Egret 2.4
  2739. * @platform Web,Native
  2740. */
  2741. static CHANGING: string;
  2742. /**
  2743. * @language en_US
  2744. * Dispatched when the net request is complete.
  2745. * @version Egret 2.4
  2746. * @platform Web,Native
  2747. */
  2748. /**
  2749. * @language zh_CN
  2750. * 网络请求加载完成
  2751. * @version Egret 2.4
  2752. * @platform Web,Native
  2753. */
  2754. static COMPLETE: string;
  2755. /**
  2756. * @language en_US
  2757. * Dispatched when loop completed.
  2758. * @version Egret 2.4
  2759. * @platform Web,Native
  2760. */
  2761. /**
  2762. * @language zh_CN
  2763. * 循环完成
  2764. * @version Egret 2.4
  2765. * @platform Web,Native
  2766. */
  2767. static LOOP_COMPLETE: string;
  2768. /**
  2769. * @language en_US
  2770. * Dispatched when the TextInput instance gets focus.
  2771. * @version Egret 2.4
  2772. * @platform Web,Native
  2773. */
  2774. /**
  2775. * @language zh_CN
  2776. * TextInput实例获得焦点
  2777. * @version Egret 2.4
  2778. * @platform Web,Native
  2779. */
  2780. static FOCUS_IN: string;
  2781. /**
  2782. * @language en_US
  2783. * Dispatched when the TextInput instance loses focus.
  2784. * @version Egret 2.4
  2785. * @platform Web,Native
  2786. */
  2787. /**
  2788. * @language zh_CN
  2789. * TextInput实例失去焦点
  2790. * @version Egret 2.4
  2791. * @platform Web,Native
  2792. */
  2793. static FOCUS_OUT: string;
  2794. /**
  2795. * @language en_US
  2796. * Dispatched when the playback is ended.
  2797. * @version Egret 2.4
  2798. * @platform Web,Native
  2799. */
  2800. /**
  2801. * @language zh_CN
  2802. * 动画声音等播放完成
  2803. * @version Egret 2.4
  2804. * @platform Web,Native
  2805. */
  2806. static ENDED: string;
  2807. /**
  2808. * 游戏激活
  2809. * @version Egret 2.4
  2810. * @platform Web,Native
  2811. */
  2812. static ACTIVATE: string;
  2813. /**
  2814. * 取消激活
  2815. * @version Egret 2.4
  2816. * @platform Web,Native
  2817. */
  2818. static DEACTIVATE: string;
  2819. /**
  2820. * Event.CLOSE 常量定义 close 事件对象的 type 属性的值。
  2821. * @version Egret 2.4
  2822. * @platform Web,Native
  2823. */
  2824. static CLOSE: string;
  2825. /**
  2826. * Event.CONNECT 常量定义 connect 事件对象的 type 属性的值。
  2827. * @version Egret 2.4
  2828. * @platform Web,Native
  2829. */
  2830. static CONNECT: string;
  2831. /**
  2832. * Event.LEAVE_STAGE 常量定义 leaveStage 事件对象的 type 属性的值。
  2833. * @version Egret 2.4
  2834. * @platform Web,Native
  2835. */
  2836. static LEAVE_STAGE: string;
  2837. /**
  2838. * Event.SOUND_COMPLETE 常量定义 在声音完成播放后调度。
  2839. * @version Egret 2.4
  2840. * @platform Web,Native
  2841. */
  2842. static SOUND_COMPLETE: string;
  2843. /**
  2844. * @language en_US
  2845. * Creates an Event object to pass as a parameter to event listeners.
  2846. * @param type The type of the event, accessible as Event.type.
  2847. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  2848. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  2849. * @param data the optional data associated with this event
  2850. * @version Egret 2.4
  2851. * @platform Web,Native
  2852. */
  2853. /**
  2854. * @language zh_CN
  2855. * 创建一个作为参数传递给事件侦听器的 Event 对象。
  2856. * @param type 事件的类型,可以作为 Event.type 访问。
  2857. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  2858. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  2859. * @param data 与此事件对象关联的可选数据。
  2860. * @version Egret 2.4
  2861. * @platform Web,Native
  2862. */
  2863. constructor(type: string, bubbles?: boolean, cancelable?: boolean, data?: any);
  2864. /**
  2865. * @language en_US
  2866. * the optional data associated with this event
  2867. * @version Egret 2.4
  2868. * @platform Web,Native
  2869. */
  2870. /**
  2871. * @language zh_CN
  2872. * 与此事件对象关联的可选数据。
  2873. * @version Egret 2.4
  2874. * @platform Web,Native
  2875. */
  2876. data: any;
  2877. /**
  2878. * @private
  2879. */
  2880. $type: string;
  2881. /**
  2882. * @language en_US
  2883. * The type of event. The type is case-sensitive.
  2884. * @version Egret 2.4
  2885. * @platform Web,Native
  2886. */
  2887. /**
  2888. * @language zh_CN
  2889. * 事件的类型。类型区分大小写。
  2890. * @version Egret 2.4
  2891. * @platform Web,Native
  2892. */
  2893. type: string;
  2894. /**
  2895. * @private
  2896. */
  2897. $bubbles: boolean;
  2898. /**
  2899. * @language en_US
  2900. * Indicates whether an event is a bubbling event.
  2901. * @version Egret 2.4
  2902. * @platform Web,Native
  2903. */
  2904. /**
  2905. * @language zh_CN
  2906. * 表示事件是否为冒泡事件。如果事件可以冒泡,则此值为 true;否则为 false。
  2907. * @version Egret 2.4
  2908. * @platform Web,Native
  2909. */
  2910. bubbles: boolean;
  2911. /**
  2912. * @private
  2913. */
  2914. $cancelable: boolean;
  2915. /**
  2916. * @language en_US
  2917. * Indicates whether the behavior associated with the event can be prevented. If the behavior can be
  2918. * canceled, this value is true; otherwise it is false.
  2919. * @see #preventDefault()
  2920. * @version Egret 2.4
  2921. * @platform Web,Native
  2922. */
  2923. /**
  2924. * @language zh_CN
  2925. * 表示是否可以阻止与事件相关联的行为。如果可以取消该行为,则此值为 true;否则为 false。
  2926. * @see #preventDefault()
  2927. * @version Egret 2.4
  2928. * @platform Web,Native
  2929. */
  2930. cancelable: boolean;
  2931. /**
  2932. * @private
  2933. */
  2934. $eventPhase: number;
  2935. /**
  2936. * @language en_US
  2937. * The current phase in the event flow. This property can contain the following numeric values:
  2938. * The capture phase (EventPhase.CAPTURING_PHASE).
  2939. * The target phase (EventPhase.AT_TARGET)
  2940. * The bubbling phase (EventPhase.BUBBLING_PHASE).
  2941. * @see egret.EventPhase
  2942. * @version Egret 2.4
  2943. * @platform Web,Native
  2944. */
  2945. /**
  2946. * @language zh_CN
  2947. * 事件流中的当前阶段。此属性可以包含以下数值:
  2948. * 捕获阶段 (EventPhase.CAPTURING_PHASE)。
  2949. * 目标阶段 (EventPhase.AT_TARGET)。
  2950. * 冒泡阶段 (EventPhase.BUBBLING_PHASE)。
  2951. * @see egret.EventPhase
  2952. * @version Egret 2.4
  2953. * @platform Web,Native
  2954. */
  2955. eventPhase: number;
  2956. /**
  2957. * @private
  2958. */
  2959. $currentTarget: any;
  2960. /**
  2961. * @language en_US
  2962. * The object that is actively processing the Event object with an event listener. For example, if a
  2963. * user clicks an OK button, the current target could be the node containing that button or one of its ancestors
  2964. * that has registered an event listener for that event.
  2965. * @version Egret 2.4
  2966. * @platform Web,Native
  2967. */
  2968. /**
  2969. * @language zh_CN
  2970. * 当前正在使用某个事件侦听器处理 Event 对象的对象。例如,如果用户单击“确定”按钮,
  2971. * 则当前目标可以是包含该按钮的节点,也可以是它的已为该事件注册了事件侦听器的始祖之一。
  2972. * @version Egret 2.4
  2973. * @platform Web,Native
  2974. */
  2975. currentTarget: any;
  2976. /**
  2977. * @private
  2978. */
  2979. $target: any;
  2980. /**
  2981. * @language en_US
  2982. * The event target. This property contains the target node. For example, if a user clicks an OK button,
  2983. * the target node is the display list node containing that button.
  2984. * @version Egret 2.4
  2985. * @platform Web,Native
  2986. */
  2987. /**
  2988. * @language zh_CN
  2989. * 事件目标。此属性包含目标节点。例如,如果用户单击“确定”按钮,则目标节点就是包含该按钮的显示列表节点。
  2990. * @version Egret 2.4
  2991. * @platform Web,Native
  2992. */
  2993. target: any;
  2994. $setTarget(target: any): boolean;
  2995. /**
  2996. * @private
  2997. */
  2998. $isDefaultPrevented: boolean;
  2999. /**
  3000. * @language en_US
  3001. * Checks whether the preventDefault() method has been called on the event. If the preventDefault() method has been
  3002. * called, returns true; otherwise, returns false.
  3003. * @returns If preventDefault() has been called, returns true; otherwise, returns false.
  3004. * @see #preventDefault()
  3005. * @version Egret 2.4
  3006. * @platform Web,Native
  3007. */
  3008. /**
  3009. * @language zh_CN
  3010. * 检查是否已对事件调用 preventDefault() 方法。
  3011. * @returns 如果已调用 preventDefault() 方法,则返回 true;否则返回 false。
  3012. * @see #preventDefault()
  3013. * @version Egret 2.4
  3014. * @platform Web,Native
  3015. */
  3016. isDefaultPrevented(): boolean;
  3017. /**
  3018. * @language en_US
  3019. * Cancels an event's default behavior if that behavior can be canceled.Many events have associated behaviors that
  3020. * are carried out by default. For example, if a user types a character into a text input, the default behavior
  3021. * is that the character is displayed in the text input. Because the TextEvent.TEXT_INPUT event's default behavior
  3022. * can be canceled, you can use the preventDefault() method to prevent the character from appearing.
  3023. * You can use the Event.cancelable property to check whether you can prevent the default behavior associated with
  3024. * a particular event. If the value of Event.cancelable is true, then preventDefault() can be used to cancel the event;
  3025. * otherwise, preventDefault() has no effect.
  3026. * @see #cancelable
  3027. * @see #isDefaultPrevented
  3028. * @version Egret 2.4
  3029. * @platform Web,Native
  3030. */
  3031. /**
  3032. * @language zh_CN
  3033. * 如果可以取消事件的默认行为,则取消该行为。
  3034. * 许多事件都有默认执行的关联行为。例如,如果用户在文本字段中键入一个字符,则默认行为就是在文本字段中显示该字符。
  3035. * 由于可以取消 TextEvent.TEXT_INPUT 事件的默认行为,因此您可以使用 preventDefault() 方法来防止显示该字符。
  3036. * 您可以使用 Event.cancelable 属性来检查是否可以防止与特定事件关联的默认行为。如果 Event.cancelable 的值为 true,
  3037. * 则可以使用 preventDefault() 来取消事件;否则,preventDefault() 无效。
  3038. * @see #cancelable
  3039. * @see #isDefaultPrevented
  3040. * @version Egret 2.4
  3041. * @platform Web,Native
  3042. */
  3043. preventDefault(): void;
  3044. /**
  3045. * @private
  3046. */
  3047. $isPropagationStopped: boolean;
  3048. /**
  3049. * @language en_US
  3050. * Prevents processing of any event listeners in nodes subsequent to the current node in the event flow. This method
  3051. * does not affect any event listeners in the current node (currentTarget). In contrast, the stopImmediatePropagation()
  3052. * method prevents processing of event listeners in both the current node and subsequent nodes. Additional calls to this
  3053. * method have no effect. This method can be called in any phase of the event flow.<br/>
  3054. * Note: This method does not cancel the behavior associated with this event; see preventDefault() for that functionality.
  3055. * @see #stopImmediatePropagation()
  3056. * @see #preventDefault()
  3057. * @version Egret 2.4
  3058. * @platform Web,Native
  3059. */
  3060. /**
  3061. * @language zh_CN
  3062. * 防止对事件流中当前节点的后续节点中的所有事件侦听器进行处理。此方法不会影响当前节点 currentTarget 中的任何事件侦听器。
  3063. * 相比之下,stopImmediatePropagation() 方法可以防止对当前节点中和后续节点中的事件侦听器进行处理。
  3064. * 对此方法的其它调用没有任何效果。可以在事件流的任何阶段中调用此方法。<br/>
  3065. * 注意:此方法不会取消与此事件相关联的行为;有关此功能的信息,请参阅 preventDefault()。
  3066. * @see #stopImmediatePropagation()
  3067. * @see #preventDefault()
  3068. * @version Egret 2.4
  3069. * @platform Web,Native
  3070. */
  3071. stopPropagation(): void;
  3072. /**
  3073. * @private
  3074. */
  3075. $isPropagationImmediateStopped: boolean;
  3076. /**
  3077. * @language en_US
  3078. * Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow.
  3079. * This method takes effect immediately, and it affects event listeners in the current node. In contrast, the
  3080. * stopPropagation() method doesn't take effect until all the event listeners in the current node finish processing.<br/>
  3081. * Note: This method does not cancel the behavior associated with this event; see preventDefault() for that functionality.
  3082. * @see #stopPropagation()
  3083. * @see #preventDefault()
  3084. * @version Egret 2.4
  3085. * @platform Web,Native
  3086. */
  3087. /**
  3088. * @language zh_CN
  3089. * 防止对事件流中当前节点中和所有后续节点中的事件侦听器进行处理。此方法会立即生效,并且会影响当前节点中的事件侦听器。
  3090. * 相比之下,在当前节点中的所有事件侦听器都完成处理之前,stopPropagation() 方法不会生效。<br/>
  3091. * 注意:此方法不会取消与此事件相关联的行为;有关此功能的信息,请参阅 preventDefault()。
  3092. * @see #stopPropagation()
  3093. * @see #preventDefault()
  3094. * @version Egret 2.4
  3095. * @platform Web,Native
  3096. */
  3097. stopImmediatePropagation(): void;
  3098. /**
  3099. * @language en_US
  3100. * This method will be called automatically when you pass the event object as the parameters to the Event.release() method.
  3101. * If your custom event is designed for reusable,you should override this method to make sure all the references to external
  3102. * objects are cleaned. if not,it may cause memory leaking.
  3103. * @see egret.Event.create()
  3104. * @see egret.Event.release()
  3105. * @version Egret 2.4
  3106. * @platform Web,Native
  3107. */
  3108. /**
  3109. * @language zh_CN
  3110. * 当事件实例传递给Event.release()静态方法时,实例上的clean()方法将会被自动调用。
  3111. * 若此自定义事件的实例设计为可以循环复用的,为了避免引起内存泄露,自定义事件需要覆盖此方法来确保实例被缓存前断开对外部对象的一切引用。
  3112. * @see egret.Event.create()
  3113. * @see egret.Event.release()
  3114. * @version Egret 2.4
  3115. * @platform Web,Native
  3116. */
  3117. protected clean(): void;
  3118. /**
  3119. * @language en_US
  3120. * EventDispatcher object using the specified event object thrown Event. Objects thrown objects will be cached in the pool for the next round robin.
  3121. * @param target the event target
  3122. * @param type The type of the event. Event listeners can access this information through the inherited type property.
  3123. * @param bubbles Determines whether the Event object bubbles. Event listeners can access this information through
  3124. * the inherited bubbles property.
  3125. * @param data {any} data
  3126. * @method egret.Event.dispatchEvent
  3127. * @version Egret 2.4
  3128. * @platform Web,Native
  3129. */
  3130. /**
  3131. * @language zh_CN
  3132. * 使用指定的 EventDispatcher 对象来抛出 Event 事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  3133. * @param target {egret.IEventDispatcher} 派发事件目标
  3134. * @param type {string} 事件类型
  3135. * @param bubbles {boolean} 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  3136. * @param data {any} 事件data
  3137. * @method egret.Event.dispatchEvent
  3138. * @version Egret 2.4
  3139. * @platform Web,Native
  3140. */
  3141. static dispatchEvent(target: IEventDispatcher, type: string, bubbles?: boolean, data?: any): boolean;
  3142. /**
  3143. * @private
  3144. *
  3145. * @param EventClass
  3146. * @returns
  3147. */
  3148. static _getPropertyData(EventClass: any): any;
  3149. /**
  3150. * @language en_US
  3151. * Gets one event instance from the object pool or create a new one. We highly recommend using the Event.create()
  3152. * and Event.release() methods to create and release an event object,it can reduce the number of reallocate objects,
  3153. * which allows you to get better code execution performance.<br/>
  3154. * Note: If you want to use this method to initialize your custom event object,you must make sure the constructor
  3155. * of your custom event is the same as the constructor of egret.Event.
  3156. * @param EventClass Event Class。
  3157. * @param type The type of the event, accessible as Event.type.
  3158. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  3159. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  3160. * @example
  3161. * <pre>
  3162. * let event = Event.create(Event,type, bubbles);
  3163. * event.data = data; //optional,initializes custom data here
  3164. * this.dispatchEvent(event);
  3165. * Event.release(event);
  3166. * </pre>
  3167. * @version Egret 2.4
  3168. * @platform Web,Native
  3169. */
  3170. /**
  3171. * @language zh_CN
  3172. * 从对象池中取出或创建一个新的事件实例。我们建议您尽可能使用Event.create()和Event.release() 这一对方法来创建和释放事件对象,
  3173. * 这一对方法会将事件实例在内部缓存下来供下次循环使用,减少对象的创建次数,从而获得更高的代码运行性能。<br/>
  3174. * 注意:若使用此方法来创建自定义事件的实例,自定义的构造函数参数列表必须跟Event类一致。
  3175. * @param EventClass Event类名。
  3176. * @param type 事件的类型,可以作为 Event.type 访问。
  3177. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  3178. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  3179. * @example
  3180. * <pre>
  3181. * let event = Event.create(Event,type, bubbles);
  3182. * event.data = data; //可选,若指定义事件上需要附加其他参数,可以在获取实例后在此处设置。
  3183. * this.dispatchEvent(event);
  3184. * Event.release(event);
  3185. * </pre>
  3186. * @see #clean()
  3187. * @version Egret 2.4
  3188. * @platform Web,Native
  3189. */
  3190. static create<T extends Event>(EventClass: {
  3191. new (type: string, bubbles?: boolean, cancelable?: boolean): T;
  3192. eventPool?: Event[];
  3193. }, type: string, bubbles?: boolean, cancelable?: boolean): T;
  3194. /**
  3195. * @language en_US
  3196. * Releases an event object and cache it into the object pool.We highly recommend using the Event.create()
  3197. * and Event.release() methods to create and release an event object,it can reduce the number of reallocate objects,
  3198. * which allows you to get better code execution performance.<br/>
  3199. * Note: The parameters of this method only accepts an instance created by the Event.create() method.
  3200. * if not,it may throw an error.
  3201. * @example
  3202. * <pre>
  3203. * let event = Event.create(Event,type, bubbles);
  3204. * event.data = data; //optional,initializes custom data here
  3205. * this.dispatchEvent(event);
  3206. * Event.release(event);
  3207. * </pre>
  3208. * @see #clean()
  3209. * @version Egret 2.4
  3210. * @platform Web,Native
  3211. */
  3212. /**
  3213. * @language zh_CN
  3214. * 释放一个事件对象,并缓存到对象池。我们建议您尽可能使用Event.create()和Event.release() 这一对方法来创建和释放事件对象,
  3215. * 这一对方法会将事件实例在内部缓存下来供下次循环使用,减少对象的创建次数,从而获得更高的代码运行性能。<br/>
  3216. * 注意:此方法只能传入由Event.create()创建的事件实例,传入非法对象实例可能会导致报错。
  3217. * @example
  3218. * <pre>
  3219. * let event = Event.create(Event,type, bubbles);
  3220. * event.data = data; //可选,若指定义事件上需要附加其他参数,可以在获取实例后在此处设置。
  3221. * this.dispatchEvent(event);
  3222. * Event.release(event);
  3223. * </pre>
  3224. * @see #clean()
  3225. * @version Egret 2.4
  3226. * @platform Web,Native
  3227. */
  3228. static release(event: Event): void;
  3229. }
  3230. }
  3231. declare namespace egret.sys {
  3232. /**
  3233. * @private
  3234. */
  3235. const enum BitmapKeys {
  3236. bitmapData = 0,
  3237. image = 1,
  3238. bitmapX = 2,
  3239. bitmapY = 3,
  3240. bitmapWidth = 4,
  3241. bitmapHeight = 5,
  3242. offsetX = 6,
  3243. offsetY = 7,
  3244. textureWidth = 8,
  3245. textureHeight = 9,
  3246. smoothing = 10,
  3247. explicitBitmapWidth = 11,
  3248. explicitBitmapHeight = 12,
  3249. sourceWidth = 13,
  3250. sourceHeight = 14,
  3251. }
  3252. }
  3253. declare namespace egret {
  3254. /**
  3255. * @language en_US
  3256. * The Bitmap class represents display objects that represent bitmap images.
  3257. * The Bitmap() constructor allows you to create a Bitmap object that contains a reference to a BitmapData object.
  3258. * After you create a Bitmap object, use the addChild() or addChildAt() method of the parent DisplayObjectContainer
  3259. * instance to place the bitmap on the display list.A Bitmap object can share its texture reference among several
  3260. * Bitmap objects, independent of translation or rotation properties. Because you can create multiple Bitmap objects
  3261. * that reference the same texture object, multiple display objects can use the same complex texture object
  3262. * without incurring the memory overhead of a texture object for each display object instance.
  3263. *
  3264. * @see egret.Texture
  3265. * @version Egret 2.4
  3266. * @platform Web,Native
  3267. * @includeExample egret/display/Bitmap.ts
  3268. */
  3269. /**
  3270. * @language zh_CN
  3271. * Bitmap 类表示用于显示位图图片的显示对象。
  3272. * 利用 Bitmap() 构造函数,可以创建包含对 BitmapData 对象引用的 Bitmap 对象。创建了 Bitmap 对象后,
  3273. * 使用父级 DisplayObjectContainer 实例的 addChild() 或 addChildAt() 方法可以将位图放在显示列表中。
  3274. * 一个 Bitmap 对象可在若干 Bitmap 对象之中共享其 texture 引用,与缩放或旋转属性无关。
  3275. * 由于能够创建引用相同 texture 对象的多个 Bitmap 对象,因此,多个显示对象可以使用相同的 texture 对象,
  3276. * 而不会因为每个显示对象实例使用一个 texture 对象而产生额外内存开销。
  3277. *
  3278. * @see egret.Texture
  3279. * @version Egret 2.4
  3280. * @platform Web,Native
  3281. * @includeExample egret/display/Bitmap.ts
  3282. */
  3283. class Bitmap extends DisplayObject {
  3284. /**
  3285. * @language en_US
  3286. * Initializes a Bitmap object to refer to the specified BitmapData|Texture object.
  3287. * @param value The BitmapData|Texture object being referenced.
  3288. * @version Egret 2.4
  3289. * @platform Web,Native
  3290. */
  3291. /**
  3292. * @language zh_CN
  3293. * 创建一个引用指定 BitmapData|Texture 实例的 Bitmap 对象
  3294. * @param value 被引用的 BitmapData|Texture 实例
  3295. * @version Egret 2.4
  3296. * @platform Web,Native
  3297. */
  3298. constructor(value?: BitmapData | Texture);
  3299. /**
  3300. * @private
  3301. */
  3302. $Bitmap: Object;
  3303. /**
  3304. * @private
  3305. * 显示对象添加到舞台
  3306. */
  3307. $onAddToStage(stage: Stage, nestLevel: number): void;
  3308. /**
  3309. * @private
  3310. * 显示对象从舞台移除
  3311. */
  3312. $onRemoveFromStage(): void;
  3313. /**
  3314. * @language en_US
  3315. * The BitmapData object being referenced.
  3316. * If you pass the constructor of type Texture or last set for texture, this value returns null.
  3317. * @version Egret 2.4
  3318. * @platform Web,Native
  3319. */
  3320. /**
  3321. * @language zh_CN
  3322. * 被引用的 BitmapData 对象。
  3323. * 如果传入构造函数的类型为 Texture 或者最后设置的为 texture,则此值返回 null。
  3324. * @version Egret 2.4
  3325. * @platform Web,Native
  3326. */
  3327. bitmapData: BitmapData;
  3328. /**
  3329. * @language en_US
  3330. * The Texture object being referenced.
  3331. * If you pass the constructor of type BitmapData or last set for bitmapData, this value returns null.
  3332. * @version Egret 2.4
  3333. * @platform Web,Native
  3334. */
  3335. /**
  3336. * @language zh_CN
  3337. * 被引用的 Texture 对象。
  3338. * 如果传入构造函数的类型为 BitmapData 或者最后设置的为 bitmapData,则此值返回 null。
  3339. * @version Egret 2.4
  3340. * @platform Web,Native
  3341. */
  3342. texture: Texture;
  3343. /**
  3344. * @private
  3345. */
  3346. $setBitmapData(value: BitmapData | Texture): boolean;
  3347. /**
  3348. * @private
  3349. */
  3350. $refreshImageData(): void;
  3351. /**
  3352. * @private
  3353. */
  3354. private setImageData(image, bitmapX, bitmapY, bitmapWidth, bitmapHeight, offsetX, offsetY, textureWidth, textureHeight, sourceWidth, sourceHeight);
  3355. /**
  3356. * @private
  3357. */
  3358. $scale9Grid: egret.Rectangle;
  3359. /**
  3360. * @language en_US
  3361. * Represent a Rectangle Area that the 9 scale area of Image.
  3362. * Notice: This property is valid only when <code>fillMode</code>
  3363. * is <code>BitmapFillMode.SCALE</code>.
  3364. *
  3365. * @version Egret 2.4
  3366. * @platform Web,Native
  3367. */
  3368. /**
  3369. * @language zh_CN
  3370. * 矩形区域,它定义素材对象的九个缩放区域。
  3371. * 注意:此属性仅在<code>fillMode</code>为<code>BitmapFillMode.SCALE</code>时有效。
  3372. *
  3373. * @version Egret 2.4
  3374. * @platform Web,Native
  3375. */
  3376. scale9Grid: egret.Rectangle;
  3377. /**
  3378. * @private
  3379. */
  3380. $fillMode: string;
  3381. /**
  3382. * @language en_US
  3383. * Determines how the bitmap fills in the dimensions.
  3384. * <p>When set to <code>BitmapFillMode.REPEAT</code>, the bitmap
  3385. * repeats to fill the region.</p>
  3386. * <p>When set to <code>BitmapFillMode.SCALE</code>, the bitmap
  3387. * stretches to fill the region.</p>
  3388. *
  3389. * @default <code>BitmapFillMode.SCALE</code>
  3390. *
  3391. * @version Egret 2.4
  3392. * @version eui 1.0
  3393. * @platform Web
  3394. */
  3395. /**
  3396. * @language zh_CN
  3397. * 确定位图填充尺寸的方式。
  3398. * <p>设置为 <code>BitmapFillMode.REPEAT</code>时,位图将重复以填充区域。</p>
  3399. * <p>设置为 <code>BitmapFillMode.SCALE</code>时,位图将拉伸以填充区域。</p>
  3400. *
  3401. * @default <code>BitmapFillMode.SCALE</code>
  3402. *
  3403. * @version Egret 2.4
  3404. * @version eui 1.0
  3405. * @platform Web
  3406. */
  3407. fillMode: string;
  3408. $setFillMode(value: string): boolean;
  3409. /**
  3410. * @language en_US
  3411. * The default value of whether or not is smoothed when scaled.
  3412. * When object such as Bitmap is created,smoothing property will be set to this value.
  3413. * @default true。
  3414. * @version Egret 3.0
  3415. * @platform Web
  3416. */
  3417. /**
  3418. * @language zh_CN
  3419. * 控制在缩放时是否进行平滑处理的默认值。
  3420. * 在 Bitmap 等对象创建时,smoothing 属性会被设置为该值。
  3421. * @default true。
  3422. * @version Egret 3.0
  3423. * @platform Web
  3424. */
  3425. static defaultSmoothing: boolean;
  3426. /**
  3427. * @language en_US
  3428. * Whether or not the bitmap is smoothed when scaled.
  3429. * @version Egret 2.4
  3430. * @platform Web
  3431. */
  3432. /**
  3433. * @language zh_CN
  3434. * 控制在缩放时是否对位图进行平滑处理。
  3435. * @version Egret 2.4
  3436. * @platform Web
  3437. */
  3438. smoothing: boolean;
  3439. /**
  3440. * @private
  3441. *
  3442. * @param value
  3443. */
  3444. $setWidth(value: number): boolean;
  3445. /**
  3446. * @private
  3447. *
  3448. * @param value
  3449. */
  3450. $setHeight(value: number): boolean;
  3451. /**
  3452. * @private
  3453. * 获取显示宽度
  3454. */
  3455. $getWidth(): number;
  3456. /**
  3457. * @private
  3458. * 获取显示宽度
  3459. */
  3460. $getHeight(): number;
  3461. /**
  3462. * @private
  3463. */
  3464. $measureContentBounds(bounds: Rectangle): void;
  3465. /**
  3466. * @private
  3467. */
  3468. $render(): void;
  3469. private _pixelHitTest;
  3470. /**
  3471. * @language en_US
  3472. * Specifies whether this object use precise hit testing by checking the alpha value of each pixel.If pixelHitTest
  3473. * is set to true,the transparent area of the bitmap will be touched through.<br/>
  3474. * Note:If the image is loaded from cross origin,that we can't access to the pixel data,so it might cause
  3475. * the pixelHitTest property invalid.
  3476. * @default false
  3477. * @version Egret 2.4
  3478. * @platform Web,Native
  3479. */
  3480. /**
  3481. * @language zh_CN
  3482. * 是否开启精确像素碰撞。设置为true显示对象本身的透明区域将能够被穿透。<br/>
  3483. * 注意:若图片资源是以跨域方式从外部服务器加载的,将无法访问图片的像素数据,而导致此属性失效。
  3484. * @default false
  3485. * @version Egret 2.4
  3486. * @platform Web,Native
  3487. */
  3488. pixelHitTest: boolean;
  3489. $hitTest(stageX: number, stageY: number): DisplayObject;
  3490. /**
  3491. * @private
  3492. */
  3493. private hitTestPixel(stageX, stageY);
  3494. static $drawImage(node: sys.BitmapNode, image: any, bitmapX: number, bitmapY: number, bitmapWidth: number, bitmapHeight: number, offsetX: number, offsetY: number, textureWidth: number, textureHeight: number, destW: number, destH: number, sourceWidth: number, sourceHeight: number, scale9Grid: egret.Rectangle, fillMode: string, smoothing: boolean): void;
  3495. }
  3496. }
  3497. declare namespace egret {
  3498. /**
  3499. * @language en_US
  3500. * The Sprite class is a basic display list building block: a display list node that can contain children.
  3501. * @version Egret 2.4
  3502. * @platform Web,Native
  3503. * @includeExample egret/display/Sprite.ts
  3504. */
  3505. /**
  3506. * @language zh_CN
  3507. * Sprite 类是基本显示列表构造块:一个可包含子项的显示列表节点。
  3508. * @version Egret 2.4
  3509. * @platform Web,Native
  3510. * @includeExample egret/display/Sprite.ts
  3511. */
  3512. class Sprite extends DisplayObjectContainer {
  3513. /**
  3514. * @language en_US
  3515. * Creates a new Sprite instance.
  3516. * @version Egret 2.4
  3517. * @platform Web,Native
  3518. */
  3519. /**
  3520. * @language zh_CN
  3521. * 实例化一个容器
  3522. * @version Egret 2.4
  3523. * @platform Web,Native
  3524. */
  3525. constructor();
  3526. /**
  3527. * @private
  3528. */
  3529. $graphics: Graphics;
  3530. /**
  3531. * @language en_US
  3532. * Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur.
  3533. * @version Egret 2.4
  3534. * @platform Web,Native
  3535. */
  3536. /**
  3537. * @language zh_CN
  3538. * 获取 Shape 中的 Graphics 对象。可通过此对象执行矢量绘图命令。
  3539. * @version Egret 2.4
  3540. * @platform Web,Native
  3541. */
  3542. graphics: Graphics;
  3543. $hitTest(stageX: number, stageY: number): DisplayObject;
  3544. /**
  3545. * @private
  3546. */
  3547. $measureContentBounds(bounds: Rectangle): void;
  3548. /**
  3549. * @private
  3550. */
  3551. $onRemoveFromStage(): void;
  3552. }
  3553. }
  3554. declare namespace egret {
  3555. let $TextureScaleFactor: number;
  3556. /**
  3557. * @language en_US
  3558. * The Texture class encapsulates different image resources on different platforms.
  3559. * In HTML5, resource is an HTMLElement object
  3560. * In OpenGL / WebGL, resource is a texture ID obtained after the GPU is submitted
  3561. * The Texture class encapsulates the details implemented on the underlayer. Developers just need to focus on interfaces
  3562. * @see http://edn.egret.com/cn/docs/page/135 The use of texture packs
  3563. * @see http://edn.egret.com/cn/docs/page/123 Several ways of access to resources
  3564. * @version Egret 2.4
  3565. * @platform Web,Native
  3566. * @includeExample egret/display/Texture.ts
  3567. */
  3568. /**
  3569. * @language zh_CN
  3570. * 纹理类是对不同平台不同的图片资源的封装
  3571. * 在HTML5中,资源是一个HTMLElement对象
  3572. * 在OpenGL / WebGL中,资源是一个提交GPU后获取的纹理id
  3573. * Texture类封装了这些底层实现的细节,开发者只需要关心接口即可
  3574. * @see http://edn.egret.com/cn/docs/page/135 纹理集的使用
  3575. * @see http://edn.egret.com/cn/docs/page/123 获取资源的几种方式
  3576. * @version Egret 2.4
  3577. * @platform Web,Native
  3578. * @includeExample egret/display/Texture.ts
  3579. */
  3580. class Texture extends HashObject {
  3581. /**
  3582. * @language en_US
  3583. * Create an egret.Texture object
  3584. * @version Egret 2.4
  3585. * @platform Web,Native
  3586. */
  3587. /**
  3588. * @language zh_CN
  3589. * 创建一个 egret.Texture 对象
  3590. * @version Egret 2.4
  3591. * @platform Web,Native
  3592. */
  3593. constructor();
  3594. /**
  3595. * @private
  3596. * 表示这个纹理在 bitmapData 上的 x 起始位置
  3597. */
  3598. _bitmapX: number;
  3599. /**
  3600. * @private
  3601. * 表示这个纹理在 bitmapData 上的 y 起始位置
  3602. */
  3603. _bitmapY: number;
  3604. /**
  3605. * @private
  3606. * 表示这个纹理在 bitmapData 上的宽度
  3607. */
  3608. _bitmapWidth: number;
  3609. /**
  3610. * @private
  3611. * 表示这个纹理在 bitmapData 上的高度
  3612. */
  3613. _bitmapHeight: number;
  3614. /**
  3615. * @private
  3616. * 表示这个纹理显示了之后在 x 方向的渲染偏移量
  3617. */
  3618. _offsetX: number;
  3619. /**
  3620. * @private
  3621. * 表示这个纹理显示了之后在 y 方向的渲染偏移量
  3622. */
  3623. _offsetY: number;
  3624. /**
  3625. * @private
  3626. * 纹理宽度
  3627. */
  3628. private _textureWidth;
  3629. /**
  3630. * @language en_US
  3631. * Texture width, read only
  3632. * @version Egret 2.4
  3633. * @platform Web,Native
  3634. */
  3635. /**
  3636. * @language zh_CN
  3637. * 纹理宽度,只读属性,不可以设置
  3638. * @version Egret 2.4
  3639. * @platform Web,Native
  3640. */
  3641. textureWidth: number;
  3642. $getTextureWidth(): number;
  3643. /**
  3644. * @private
  3645. * 纹理高度
  3646. */
  3647. private _textureHeight;
  3648. /**
  3649. * @language en_US
  3650. * Texture height, read only
  3651. * @version Egret 2.4
  3652. * @platform Web,Native
  3653. */
  3654. /**
  3655. * @language zh_CN
  3656. * 纹理高度,只读属性,不可以设置
  3657. * @version Egret 2.4
  3658. * @platform Web,Native
  3659. */
  3660. textureHeight: number;
  3661. $getTextureHeight(): number;
  3662. $getScaleBitmapWidth(): number;
  3663. $getScaleBitmapHeight(): number;
  3664. /**
  3665. * @private
  3666. * 表示bitmapData.width
  3667. */
  3668. _sourceWidth: number;
  3669. /**
  3670. * @private
  3671. * 表示bitmapData.height
  3672. */
  3673. _sourceHeight: number;
  3674. /**
  3675. * @private
  3676. */
  3677. _bitmapData: BitmapData;
  3678. /**
  3679. * @language en_US
  3680. * The BitmapData object being referenced.
  3681. * @version Egret 2.4
  3682. * @platform Web,Native
  3683. */
  3684. /**
  3685. * @language zh_CN
  3686. * 被引用的 BitmapData 对象。
  3687. * @version Egret 2.4
  3688. * @platform Web,Native
  3689. */
  3690. bitmapData: BitmapData;
  3691. /**
  3692. * @language en_US
  3693. * Set the BitmapData object.
  3694. * @version Egret 3.2.1
  3695. * @platform Web,Native
  3696. */
  3697. /**
  3698. * @language zh_CN
  3699. * 设置 BitmapData 对象。
  3700. * @version Egret 3.2.1
  3701. * @platform Web,Native
  3702. */
  3703. _setBitmapData(value: BitmapData): void;
  3704. /**
  3705. * @private
  3706. * 设置Texture数据
  3707. * @param bitmapX
  3708. * @param bitmapY
  3709. * @param bitmapWidth
  3710. * @param bitmapHeight
  3711. * @param offsetX
  3712. * @param offsetY
  3713. * @param textureWidth
  3714. * @param textureHeight
  3715. * @param sourceWidth
  3716. * @param sourceHeight
  3717. */
  3718. $initData(bitmapX: number, bitmapY: number, bitmapWidth: number, bitmapHeight: number, offsetX: number, offsetY: number, textureWidth: number, textureHeight: number, sourceWidth: number, sourceHeight: number): void;
  3719. /**
  3720. * @deprecated
  3721. */
  3722. getPixel32(x: number, y: number): number[];
  3723. /**
  3724. * @language en_US
  3725. * Obtain the color value for the specified pixel region
  3726. * @param x The x coordinate of the pixel region
  3727. * @param y The y coordinate of the pixel region
  3728. * @param width The width of the pixel region
  3729. * @param height The height of the pixel region
  3730. * @returns Specifies the color value for the pixel region
  3731. * @version Egret 3.2.1
  3732. * @platform Web,Native
  3733. */
  3734. /**
  3735. * @language zh_CN
  3736. * 获取指定像素区域的颜色值
  3737. * @param x 像素区域的X轴坐标
  3738. * @param y 像素区域的Y轴坐标
  3739. * @param width 像素点的Y轴坐标
  3740. * @param height 像素点的Y轴坐标
  3741. * @returns 指定像素区域的颜色值
  3742. * @version Egret 3.2.1
  3743. * @platform Web
  3744. */
  3745. getPixels(x: number, y: number, width?: number, height?: number): number[];
  3746. /**
  3747. * @language en_US
  3748. * Convert base64 string, if the picture (or pictures included) cross-border or null
  3749. * @param type Type conversions, such as "image / png"
  3750. * @param rect The need to convert the area
  3751. * @param smoothing Whether to convert data to the smoothing process
  3752. * @returns {any} base64 string
  3753. * @version Egret 2.4
  3754. */
  3755. /**
  3756. * @language zh_CN
  3757. * 转换成base64字符串,如果图片(或者包含的图片)跨域,则返回null
  3758. * @param type 转换的类型,如 "image/png"
  3759. * @param rect 需要转换的区域
  3760. * @returns {any} base64字符串
  3761. * @version Egret 2.4
  3762. */
  3763. toDataURL(type: string, rect?: egret.Rectangle): string;
  3764. /**
  3765. * @language en_US
  3766. * Crop designated area and save it as image.
  3767. * native support only "image / png" and "image / jpeg"; Web browser because of the various implementations are not the same, it is recommended to use only these two kinds.
  3768. * @param type Type conversions, such as "image / png"
  3769. * @param filePath The path name of the image (the home directory for the game's private space, the path can not have "../",Web supports only pass names.)
  3770. * @param rect The need to convert the area
  3771. * @version Egret 2.4
  3772. * @platform Native
  3773. */
  3774. /**
  3775. * @language zh_CN
  3776. * 裁剪指定区域并保存成图片。
  3777. * native只支持 "image/png" 和 "image/jpeg";Web中由于各个浏览器的实现不一样,因此建议也只用这2种。
  3778. * @param type 转换的类型,如 "image/png"
  3779. * @param filePath 图片的名称的路径(主目录为游戏的私有空间,路径中不能有 "../",Web只支持传名称。)
  3780. * @param rect 需要转换的区域
  3781. * @version Egret 2.4
  3782. * @platform Native
  3783. */
  3784. saveToFile(type: string, filePath: string, rect?: egret.Rectangle): void;
  3785. /**
  3786. * @language en_US
  3787. * dispose texture
  3788. * @version Egret 2.4
  3789. * @platform Web,Native
  3790. */
  3791. /**
  3792. * @language zh_CN
  3793. * 释放纹理
  3794. * @version Egret 2.4
  3795. * @platform Web,Native
  3796. */
  3797. dispose(): void;
  3798. }
  3799. }
  3800. declare namespace egret {
  3801. /**
  3802. * @private
  3803. */
  3804. let $locale_strings: any;
  3805. /**
  3806. * @private
  3807. */
  3808. let $language: string;
  3809. }
  3810. declare namespace egret.sys {
  3811. /**
  3812. * @private
  3813. * 全局多语言翻译函数
  3814. * @param code 要查询的字符串代码
  3815. * @param args 替换字符串中{0}标志的参数列表
  3816. * @returns 返回拼接后的字符串
  3817. */
  3818. function tr(code: number, ...args: any[]): string;
  3819. }
  3820. declare namespace egret {
  3821. /**
  3822. * @language en_US
  3823. * The Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal
  3824. * axis and y represents the vertical axis.
  3825. * @version Egret 2.4
  3826. * @platform Web,Native
  3827. * @includeExample egret/geom/Point.ts
  3828. */
  3829. /**
  3830. * @language zh_CN
  3831. * Point 对象表示二维坐标系统中的某个位置,其中 x 表示水平轴,y 表示垂直轴。
  3832. * @version Egret 2.4
  3833. * @platform Web,Native
  3834. * @includeExample egret/geom/Point.ts
  3835. */
  3836. class Point extends HashObject {
  3837. /**
  3838. * @language en_US
  3839. * Releases a point instance to the object pool
  3840. * @version Egret 2.4
  3841. * @platform Web,Native
  3842. */
  3843. /**
  3844. * @language zh_CN
  3845. * 释放一个Point实例到对象池
  3846. * @version Egret 2.4
  3847. * @platform Web,Native
  3848. */
  3849. static release(point: Point): void;
  3850. /**
  3851. * @language en_US
  3852. * get a point instance from the object pool or create a new one.
  3853. * @param x The horizontal coordinate.
  3854. * @param y The vertical coordinate.
  3855. * @version Egret 2.4
  3856. * @platform Web,Native
  3857. */
  3858. /**
  3859. * @language zh_CN
  3860. * 从对象池中取出或创建一个新的Point对象。
  3861. * @param x 该对象的x属性值,默认为0
  3862. * @param y 该对象的y属性值,默认为0
  3863. * @version Egret 2.4
  3864. * @platform Web,Native
  3865. */
  3866. static create(x: number, y: number): Point;
  3867. /**
  3868. * @language en_US
  3869. * Creates a new point. If you pass no parameters to this method, a point is created at (0,0).
  3870. * @param x The horizontal coordinate.
  3871. * @param y The vertical coordinate.
  3872. * @version Egret 2.4
  3873. * @platform Web,Native
  3874. */
  3875. /**
  3876. * @language zh_CN
  3877. * 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。
  3878. * @param x 该对象的x属性值,默认为0
  3879. * @param y 该对象的y属性值,默认为0
  3880. * @version Egret 2.4
  3881. * @platform Web,Native
  3882. */
  3883. constructor(x?: number, y?: number);
  3884. /**
  3885. * @language en_US
  3886. * The horizontal coordinate.
  3887. * @default 0
  3888. * @version Egret 2.4
  3889. * @platform Web,Native
  3890. */
  3891. /**
  3892. * @language zh_CN
  3893. * 该点的水平坐标。
  3894. * @default 0
  3895. * @version Egret 2.4
  3896. * @platform Web,Native
  3897. */
  3898. x: number;
  3899. /**
  3900. * @language en_US
  3901. * The vertical coordinate.
  3902. * @default 0
  3903. * @version Egret 2.4
  3904. * @platform Web,Native
  3905. */
  3906. /**
  3907. * @language zh_CN
  3908. * 该点的垂直坐标。
  3909. * @default 0
  3910. * @version Egret 2.4
  3911. * @platform Web,Native
  3912. */
  3913. y: number;
  3914. /**
  3915. * @language en_US
  3916. * The length of the line segment from (0,0) to this point.
  3917. * @version Egret 2.4
  3918. * @platform Web,Native
  3919. */
  3920. /**
  3921. * @language zh_CN
  3922. * 从 (0,0) 到此点的线段长度。
  3923. * @version Egret 2.4
  3924. * @platform Web,Native
  3925. */
  3926. length: number;
  3927. /**
  3928. * @language en_US
  3929. * Sets the members of Point to the specified values
  3930. * @param x The horizontal coordinate.
  3931. * @param y The vertical coordinate.
  3932. * @version Egret 2.4
  3933. * @platform Web,Native
  3934. */
  3935. /**
  3936. * @language zh_CN
  3937. * 将 Point 的成员设置为指定值
  3938. * @param x 该对象的x属性值
  3939. * @param y 该对象的y属性值
  3940. * @version Egret 2.4
  3941. * @platform Web,Native
  3942. */
  3943. setTo(x: number, y: number): Point;
  3944. /**
  3945. * @language en_US
  3946. * Creates a copy of this Point object.
  3947. * @version Egret 2.4
  3948. * @platform Web,Native
  3949. */
  3950. /**
  3951. * @language zh_CN
  3952. * 克隆点对象
  3953. * @version Egret 2.4
  3954. * @platform Web,Native
  3955. */
  3956. clone(): Point;
  3957. /**
  3958. * @language en_US
  3959. * Determines whether two points are equal. Two points are equal if they have the same x and y values.
  3960. * @param toCompare The point to be compared.
  3961. * @returns A value of true if the object is equal to this Point object; false if it is not equal.
  3962. * @version Egret 2.4
  3963. * @platform Web,Native
  3964. */
  3965. /**
  3966. * @language zh_CN
  3967. * 确定两个点是否相同。如果两个点具有相同的 x 和 y 值,则它们是相同的点。
  3968. * @param toCompare 要比较的点。
  3969. * @returns 如果该对象与此 Point 对象相同,则为 true 值,如果不相同,则为 false。
  3970. * @version Egret 2.4
  3971. * @platform Web,Native
  3972. */
  3973. equals(toCompare: Point): boolean;
  3974. /**
  3975. * @language en_US
  3976. * Returns the distance between pt1 and pt2.
  3977. * @param p1 The first point.
  3978. * @param p2 The second point.
  3979. * @returns The distance between the first and second points.
  3980. * @version Egret 2.4
  3981. * @platform Web,Native
  3982. */
  3983. /**
  3984. * @language zh_CN
  3985. * 返回 pt1 和 pt2 之间的距离。
  3986. * @param p1 第一个点
  3987. * @param p2 第二个点
  3988. * @returns 第一个点和第二个点之间的距离。
  3989. * @version Egret 2.4
  3990. * @platform Web,Native
  3991. */
  3992. static distance(p1: Point, p2: Point): number;
  3993. /**
  3994. * @language en_US
  3995. * Copies all of the point data from the source Point object into the calling Point object.
  3996. * @param sourcePoint The Point object from which to copy the data.
  3997. * @version Egret 2.4
  3998. * @platform Web,Native
  3999. */
  4000. /**
  4001. * @language zh_CN
  4002. * 将源 Point 对象中的所有点数据复制到调用方 Point 对象中。
  4003. * @param sourcePoint 要从中复制数据的 Point 对象。
  4004. * @version Egret 2.4
  4005. * @platform Web,Native
  4006. */
  4007. copyFrom(sourcePoint: Point): void;
  4008. /**
  4009. * @language en_US
  4010. * Adds the coordinates of another point to the coordinates of this point to create a new point.
  4011. * @param v The point to be added.
  4012. * @returns The new point.
  4013. * @version Egret 2.4
  4014. * @platform Web,Native
  4015. */
  4016. /**
  4017. * @language zh_CN
  4018. * 将另一个点的坐标添加到此点的坐标以创建一个新点。
  4019. * @param v 要添加的点。
  4020. * @returns 新点。
  4021. * @version Egret 2.4
  4022. * @platform Web,Native
  4023. */
  4024. add(v: Point): Point;
  4025. /**
  4026. * @language en_US
  4027. * Determines a point between two specified points.
  4028. * The parameter f determines where the new interpolated point is located relative to the two end points specified by parameters pt1 and pt2. The closer the value of the parameter f is to 1.0, the closer the interpolated point is to the first point (parameter pt1). The closer the value of the parameter f is to 0, the closer the interpolated point is to the second point (parameter pt2).
  4029. * @param pt1 The first point.
  4030. * @param pt2 The second point.
  4031. * @param f The level of interpolation between the two points. Indicates where the new point will be, along the line between pt1 and pt2. If f=1, pt1 is returned; if f=0, pt2 is returned.
  4032. * @returns The new interpolated point.
  4033. * @version Egret 2.4
  4034. * @platform Web,Native
  4035. */
  4036. /**
  4037. * @language zh_CN
  4038. * 确定两个指定点之间的点。
  4039. * 参数 f 确定新的内插点相对于参数 pt1 和 pt2 指定的两个端点所处的位置。参数 f 的值越接近 1.0,则内插点就越接近第一个点(参数 pt1)。参数 f 的值越接近 0,则内插点就越接近第二个点(参数 pt2)。
  4040. * @param pt1 第一个点。
  4041. * @param pt2 第二个点。
  4042. * @param f 两个点之间的内插级别。表示新点将位于 pt1 和 pt2 连成的直线上的什么位置。如果 f=1,则返回 pt1;如果 f=0,则返回 pt2。
  4043. * @returns 新的内插点。
  4044. * @version Egret 2.4
  4045. * @platform Web,Native
  4046. */
  4047. static interpolate(pt1: Point, pt2: Point, f: number): Point;
  4048. /**
  4049. * @language en_US
  4050. * Scales the line segment between (0,0) and the current point to a set length.
  4051. * @param thickness The scaling value. For example, if the current point is (0,5), and you normalize it to 1, the point returned is at (0,1).
  4052. * @version Egret 2.4
  4053. * @platform Web,Native
  4054. */
  4055. /**
  4056. * @language zh_CN
  4057. * 将 (0,0) 和当前点之间的线段缩放为设定的长度。
  4058. * @param thickness 缩放值。例如,如果当前点为 (0,5) 并且您将它规范化为 1,则返回的点位于 (0,1) 处。
  4059. * @version Egret 2.4
  4060. * @platform Web,Native
  4061. */
  4062. normalize(thickness: number): void;
  4063. /**
  4064. * @language en_US
  4065. * Offsets the Point object by the specified amount. The value of dx is added to the original value of x to create the new x value. The value of dy is added to the original value of y to create the new y value.
  4066. * @param dx The amount by which to offset the horizontal coordinate, x.
  4067. * @param dy The amount by which to offset the vertical coordinate, y.
  4068. * @version Egret 2.4
  4069. * @platform Web,Native
  4070. */
  4071. /**
  4072. * @language zh_CN
  4073. * 按指定量偏移 Point 对象。dx 的值将添加到 x 的原始值中以创建新的 x 值。dy 的值将添加到 y 的原始值中以创建新的 y 值。
  4074. * @param dx 水平坐标 x 的偏移量。
  4075. * @param dy 水平坐标 y 的偏移量。
  4076. * @version Egret 2.4
  4077. * @platform Web,Native
  4078. */
  4079. offset(dx: number, dy: number): void;
  4080. /**
  4081. * @language en_US
  4082. * Converts a pair of polar coordinates to a Cartesian point coordinate.
  4083. * @param len The length coordinate of the polar pair.
  4084. * @param angle The angle, in radians, of the polar pair.
  4085. * @version Egret 2.4
  4086. * @platform Web,Native
  4087. */
  4088. /**
  4089. * @language zh_CN
  4090. * 将一对极坐标转换为笛卡尔点坐标。
  4091. * @param len 极坐标对的长度。
  4092. * @param angle 极坐标对的角度(以弧度表示)。
  4093. * @version Egret 2.4
  4094. * @platform Web,Native
  4095. */
  4096. static polar(len: number, angle: number): Point;
  4097. /**
  4098. * @language en_US
  4099. * Subtracts the coordinates of another point from the coordinates of this point to create a new point.
  4100. * @param v The point to be subtracted.
  4101. * @returns The new point.
  4102. * @version Egret 2.4
  4103. * @platform Web,Native
  4104. */
  4105. /**
  4106. * @language zh_CN
  4107. * 从此点的坐标中减去另一个点的坐标以创建一个新点。
  4108. * @param v 要减去的点。
  4109. * @returns 新点。
  4110. * @version Egret 2.4
  4111. * @platform Web,Native
  4112. */
  4113. subtract(v: Point): Point;
  4114. /**
  4115. * @language en_US
  4116. * Returns a string that contains the values of the x and y coordinates. The string has the form "(x=x, y=y)", so calling the toString() method for a point at 23,17 would return "(x=23, y=17)".
  4117. * @returns The string representation of the coordinates.
  4118. * @version Egret 2.4
  4119. * @platform Web,Native
  4120. */
  4121. /**
  4122. * @language zh_CN
  4123. * 返回包含 x 和 y 坐标的值的字符串。该字符串的格式为 "(x=x, y=y)",因此为点 23,17 调用 toString() 方法将返回 "(x=23, y=17)"。
  4124. * @returns 坐标的字符串表示形式。
  4125. * @version Egret 2.4
  4126. * @platform Web,Native
  4127. */
  4128. toString(): string;
  4129. }
  4130. /**
  4131. * @private
  4132. * 仅供框架内复用,要防止暴露引用到外部。
  4133. */
  4134. let $TempPoint: Point;
  4135. }
  4136. declare namespace egret.sys {
  4137. /**
  4138. * @private
  4139. * 渲染节点类型
  4140. */
  4141. const enum RenderNodeType {
  4142. /**
  4143. * 位图渲染节点
  4144. */
  4145. BitmapNode = 1,
  4146. /**
  4147. * 文本渲染节点
  4148. */
  4149. TextNode = 2,
  4150. /**
  4151. * 矢量渲染节点
  4152. */
  4153. GraphicsNode = 3,
  4154. /**
  4155. * 组渲染节点
  4156. */
  4157. GroupNode = 4,
  4158. /**
  4159. * 设置矩阵节点
  4160. */
  4161. SetTransformNode = 5,
  4162. /**
  4163. * 设置透明度节点
  4164. */
  4165. SetAlphaNode = 6,
  4166. /**
  4167. * Mesh 节点
  4168. */
  4169. MeshNode = 7,
  4170. }
  4171. /**
  4172. * @private
  4173. * 渲染节点基类
  4174. */
  4175. class RenderNode {
  4176. /**
  4177. * 节点类型..
  4178. */
  4179. type: number;
  4180. /**
  4181. * 是否需要重绘的标志。
  4182. */
  4183. needRedraw: boolean;
  4184. /**
  4185. * 这个对象在舞台上的整体透明度
  4186. */
  4187. renderAlpha: number;
  4188. /**
  4189. * 这个对象在舞台上的透明度
  4190. */
  4191. renderVisible: boolean;
  4192. /**
  4193. * 相对于显示列表根节点或位图缓存根节点上的矩阵对象
  4194. */
  4195. renderMatrix: Matrix;
  4196. /**
  4197. * 此显示对象自身(不包括子项)在显示列表根节点或位图缓存根节点上的显示尺寸。
  4198. */
  4199. renderRegion: sys.Region;
  4200. /**
  4201. * 是否发生移动
  4202. */
  4203. moved: boolean;
  4204. /**
  4205. * 绘制数据
  4206. */
  4207. drawData: any[];
  4208. /**
  4209. * 绘制次数
  4210. */
  4211. protected renderCount: number;
  4212. /**
  4213. * 在显示对象的$render()方法被调用前,自动清空自身的drawData数据。
  4214. */
  4215. cleanBeforeRender(): void;
  4216. $getRenderCount(): number;
  4217. }
  4218. }
  4219. declare namespace egret.sys {
  4220. /**
  4221. * @private
  4222. * 路径类型
  4223. */
  4224. const enum PathType {
  4225. /**
  4226. * 纯色填充路径
  4227. */
  4228. Fill = 1,
  4229. /**
  4230. * 渐变填充路径
  4231. */
  4232. GradientFill = 2,
  4233. /**
  4234. * 线条路径
  4235. */
  4236. Stroke = 3,
  4237. }
  4238. /**
  4239. * @private
  4240. * 2D路径命令
  4241. */
  4242. const enum PathCommand {
  4243. MoveTo = 1,
  4244. LineTo = 2,
  4245. CurveTo = 3,
  4246. CubicCurveTo = 4,
  4247. }
  4248. /**
  4249. * @private
  4250. * 2D路径
  4251. */
  4252. class Path2D {
  4253. /**
  4254. * 路径类型
  4255. */
  4256. type: number;
  4257. $commands: number[];
  4258. $data: number[];
  4259. private commandPosition;
  4260. private dataPosition;
  4261. /**
  4262. * 当前移动到的坐标X
  4263. * 注意:目前只有drawArc之前会被赋值
  4264. */
  4265. $lastX: number;
  4266. /**
  4267. * 当前移动到的坐标Y
  4268. * 注意:目前只有drawArc之前会被赋值
  4269. */
  4270. $lastY: number;
  4271. /**
  4272. * 将当前绘图位置移动到 (x, y)。如果缺少任何一个参数,则此方法将失败,并且当前绘图位置不改变。
  4273. * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
  4274. * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
  4275. */
  4276. moveTo(x: number, y: number): void;
  4277. /**
  4278. * 使用当前线条样式绘制一条从当前绘图位置开始到 (x, y) 结束的直线;当前绘图位置随后会设置为 (x, y)。
  4279. * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
  4280. * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
  4281. */
  4282. lineTo(x: number, y: number): void;
  4283. /**
  4284. * 使用当前线条样式和由 (controlX, controlY) 指定的控制点绘制一条从当前绘图位置开始到 (anchorX, anchorY) 结束的二次贝塞尔曲线。当前绘图位置随后设置为 (anchorX, anchorY)。
  4285. * 如果在调用 moveTo() 方法之前调用了 curveTo() 方法,则当前绘图位置的默认值为 (0, 0)。如果缺少任何一个参数,则此方法将失败,并且当前绘图位置不改变。
  4286. * 绘制的曲线是二次贝塞尔曲线。二次贝塞尔曲线包含两个锚点和一个控制点。该曲线内插这两个锚点,并向控制点弯曲。
  4287. * @param controlX 一个数字,指定控制点相对于父显示对象注册点的水平位置。
  4288. * @param controlY 一个数字,指定控制点相对于父显示对象注册点的垂直位置。
  4289. * @param anchorX 一个数字,指定下一个锚点相对于父显示对象注册点的水平位置。
  4290. * @param anchorY 一个数字,指定下一个锚点相对于父显示对象注册点的垂直位置。
  4291. */
  4292. curveTo(controlX: number, controlY: number, anchorX: number, anchorY: number): void;
  4293. /**
  4294. * 从当前绘图位置到指定的锚点绘制一条三次贝塞尔曲线。三次贝塞尔曲线由两个锚点和两个控制点组成。该曲线内插这两个锚点,并向两个控制点弯曲。
  4295. * @param controlX1 指定首个控制点相对于父显示对象的注册点的水平位置。
  4296. * @param controlY1 指定首个控制点相对于父显示对象的注册点的垂直位置。
  4297. * @param controlX2 指定第二个控制点相对于父显示对象的注册点的水平位置。
  4298. * @param controlY2 指定第二个控制点相对于父显示对象的注册点的垂直位置。
  4299. * @param anchorX 指定锚点相对于父显示对象的注册点的水平位置。
  4300. * @param anchorY 指定锚点相对于父显示对象的注册点的垂直位置。
  4301. */
  4302. cubicCurveTo(controlX1: number, controlY1: number, controlX2: number, controlY2: number, anchorX: number, anchorY: number): void;
  4303. /**
  4304. * 绘制一个矩形
  4305. * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
  4306. * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
  4307. * @param width 矩形的宽度(以像素为单位)。
  4308. * @param height 矩形的高度(以像素为单位)。
  4309. */
  4310. drawRect(x: number, y: number, width: number, height: number): void;
  4311. /**
  4312. * 绘制一个圆角矩形。
  4313. * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
  4314. * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
  4315. * @param width 矩形的宽度(以像素为单位)。
  4316. * @param height 矩形的高度(以像素为单位)。
  4317. * @param ellipseWidth 用于绘制圆角的椭圆的宽度(以像素为单位)。
  4318. * @param ellipseHeight 用于绘制圆角的椭圆的高度(以像素为单位)。 (可选)如果未指定值,则默认值与为 ellipseWidth 参数提供的值相匹配。
  4319. */
  4320. drawRoundRect(x: number, y: number, width: number, height: number, ellipseWidth: number, ellipseHeight?: number): void;
  4321. /**
  4322. * 绘制一个圆。
  4323. * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
  4324. * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
  4325. * @param radius 圆的半径(以像素为单位)。
  4326. */
  4327. drawCircle(x: number, y: number, radius: number): void;
  4328. /**
  4329. * 绘制一个椭圆。
  4330. * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
  4331. * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
  4332. * @param width 矩形的宽度(以像素为单位)。
  4333. * @param height 矩形的高度(以像素为单位)。
  4334. */
  4335. drawEllipse(x: number, y: number, width: number, height: number): void;
  4336. /**
  4337. * 绘制一段圆弧路径。圆弧路径的圆心在 (x, y) 位置,半径为 r ,根据anticlockwise (默认为顺时针)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
  4338. * @param x 圆弧中心(圆心)的 x 轴坐标。
  4339. * @param y 圆弧中心(圆心)的 y 轴坐标。
  4340. * @param radius 圆弧的半径。
  4341. * @param startAngle 圆弧的起始点, x轴方向开始计算,单位以弧度表示。
  4342. * 注意,必须在0~2π之间。
  4343. * @param endAngle 圆弧的终点, 单位以弧度表示。
  4344. * 注意,必须在0~2π之间。
  4345. * @param anticlockwise 如果为 true,逆时针绘制圆弧,反之,顺时针绘制。
  4346. */
  4347. drawArc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): void;
  4348. /**
  4349. * 绘制一段圆弧路径
  4350. * @param x 圆弧中心(圆心)的 x 轴坐标。
  4351. * @param y 圆弧中心(圆心)的 y 轴坐标。
  4352. * @param radiusX 圆弧的半径 x。
  4353. * @param radiusY 圆弧的半径 y。
  4354. * @param startAngle 圆弧的起始点, x轴方向开始计算,单位以弧度表示。
  4355. * 注意:必须为正数。
  4356. * @param endAngle 圆弧的终点, 单位以弧度表示。
  4357. * 注意:与startAngle差值必须在0~2π之间。
  4358. * @param anticlockwise 如果为 true,逆时针绘制圆弧,反之,顺时针绘制。
  4359. * 注意:如果为true,endAngle必须小于startAngle,反之必须大于。
  4360. */
  4361. private arcToBezier(x, y, radiusX, radiusY, startAngle, endAngle, anticlockwise?);
  4362. }
  4363. }
  4364. declare namespace egret {
  4365. /**
  4366. * @language en_US
  4367. * Writes an error message to the console if the assertion is false. If the assertion is true, nothing will happen.
  4368. * @param assertion Any boolean expression. If the assertion is false, the message will get written to the console.
  4369. * @param message the message written to the console
  4370. * @param optionalParams the extra messages written to the console
  4371. */
  4372. /**
  4373. * @language zh_CN
  4374. * 判断参数assertion是否为true,若为false则抛出异常并且在console输出相应信息,反之什么也不做。
  4375. * @param assertion 一个 boolean 表达式,若结果为false,则抛出错误并输出信息。
  4376. * @param message 要输出到控制台的信息
  4377. * @param optionalParams 要输出到控制台的额外可选信息
  4378. */
  4379. function assert(assertion?: boolean, message?: string, ...optionalParams: any[]): void;
  4380. /**
  4381. * @language en_US
  4382. * Writes a warning message to the console.
  4383. * @param message the message written to the console
  4384. * @param optionalParams the extra messages written to the console
  4385. */
  4386. /**
  4387. * @language zh_CN
  4388. * 输出一个警告信息到控制台。
  4389. * @param message 要输出到控制台的信息
  4390. * @param optionalParams 要输出到控制台的额外信息
  4391. */
  4392. function warn(message?: any, ...optionalParams: any[]): void;
  4393. /**
  4394. * @language en_US
  4395. * Writes an error message to the console.
  4396. * @param message the message written to the console
  4397. * @param optionalParams the extra messages written to the console
  4398. */
  4399. /**
  4400. * @language zh_CN
  4401. * 输出一个错误信息到控制台。
  4402. * @param message 要输出到控制台的信息
  4403. * @param optionalParams 要输出到控制台的额外信息
  4404. */
  4405. function error(message?: any, ...optionalParams: any[]): void;
  4406. /**
  4407. * @language en_US
  4408. * Writes an message to the console.
  4409. * @param message the message written to the console
  4410. * @param optionalParams the extra messages written to the console
  4411. */
  4412. /**
  4413. * @language zh_CN
  4414. * 输出一个日志信息到控制台。
  4415. * @param message 要输出到控制台的信息
  4416. * @param optionalParams 要输出到控制台的额外信息
  4417. */
  4418. function log(message?: any, ...optionalParams: any[]): void;
  4419. }
  4420. declare namespace egret {
  4421. /**
  4422. * @private
  4423. */
  4424. interface MapLike<T> {
  4425. [key: string]: T;
  4426. [key: number]: T;
  4427. }
  4428. /**
  4429. * @private
  4430. */
  4431. function createMap<T>(): MapLike<T>;
  4432. }
  4433. declare namespace egret {
  4434. /**
  4435. * @class egret.GlowFilter
  4436. * @classdesc
  4437. * 使用 GlowFilter 类可以对显示对象应用发光效果。在投影滤镜的 distance 和 angle 属性设置为 0 时,发光滤镜与投影滤镜极为相似。
  4438. * @extends egret.Filter
  4439. * @version Egret 3.1.4
  4440. * @platform Web,Native
  4441. */
  4442. class GlowFilter extends Filter {
  4443. /**
  4444. * @private
  4445. */
  4446. $red: number;
  4447. /**
  4448. * @private
  4449. */
  4450. $green: number;
  4451. /**
  4452. * @private
  4453. */
  4454. $blue: number;
  4455. /**
  4456. * @language en_US
  4457. * Initializes a new GlowFilter instance.
  4458. * @method egret.GlowFilter#constructor
  4459. * @param color {number} The color of the glow. Valid values are in the hexadecimal format 0xRRGGBB. The default value is 0xFF0000.
  4460. * @param alpha {number} The alpha transparency value for the color. Valid values are 0 to 1. For example, .25 sets a transparency value of 25%. The default value is 1.
  4461. * @param blurX {number} The amount of horizontal blur. Valid values are 0 to 255 (floating point).
  4462. * @param blurY {number} The amount of vertical blur. Valid values are 0 to 255 (floating point).
  4463. * @param strength {number} The strength of the imprint or spread. The higher the value, the more color is imprinted and the stronger the contrast between the glow and the background. Valid values are 0 to 255.
  4464. * @param quality {number} The number of times to apply the filter.
  4465. * @param inner {boolean} Specifies whether the glow is an inner glow. The value true indicates an inner glow. The default is false, an outer glow (a glow around the outer edges of the object).
  4466. * @param knockout {number} Specifies whether the object has a knockout effect. A value of true makes the object's fill transparent and reveals the background color of the document. The default value is false (no knockout effect).
  4467. * @version Egret 3.1.4
  4468. * @platform Web
  4469. */
  4470. /**
  4471. * @language zh_CN
  4472. * 初始化 GlowFilter 对象
  4473. * @method egret.GlowFilter#constructor
  4474. * @param color {number} 光晕颜色,采用十六进制格式 0xRRGGBB。默认值为 0xFF0000。
  4475. * @param alpha {number} 颜色的 Alpha 透明度值。有效值为 0 到 1。例如,0.25 设置透明度值为 25%。
  4476. * @param blurX {number} 水平模糊量。有效值为 0 到 255(浮点)。
  4477. * @param blurY {number} 垂直模糊量。有效值为 0 到 255(浮点)。
  4478. * @param strength {number} 印记或跨页的强度。该值越高,压印的颜色越深,而且发光与背景之间的对比度也越强。有效值为 0 到 255。
  4479. * @param quality {number} 应用滤镜的次数。暂未实现。
  4480. * @param inner {boolean} 指定发光是否为内侧发光。值 true 指定发光是内侧发光。值 false 指定发光是外侧发光(对象外缘周围的发光)。
  4481. * @param knockout {number} 指定对象是否具有挖空效果。值为 true 将使对象的填充变为透明,并显示文档的背景颜色。
  4482. * @version Egret 3.1.4
  4483. * @platform Web
  4484. */
  4485. constructor(color?: number, alpha?: number, blurX?: number, blurY?: number, strength?: number, quality?: number, inner?: boolean, knockout?: boolean);
  4486. /**
  4487. * @private
  4488. */
  4489. $color: number;
  4490. /**
  4491. * @language en_US
  4492. * The color of the glow.
  4493. * @version Egret 3.1.4
  4494. * @platform Web
  4495. */
  4496. /**
  4497. * @language zh_CN
  4498. * 光晕颜色。
  4499. * @version Egret 3.1.4
  4500. * @platform Web
  4501. */
  4502. color: number;
  4503. /**
  4504. * @private
  4505. */
  4506. $alpha: number;
  4507. /**
  4508. * @language en_US
  4509. * The alpha transparency value for the color.
  4510. * @version Egret 3.1.4
  4511. * @platform Web
  4512. */
  4513. /**
  4514. * @language zh_CN
  4515. * 颜色的 Alpha 透明度值。
  4516. * @version Egret 3.1.4
  4517. * @platform Web
  4518. */
  4519. alpha: number;
  4520. /**
  4521. * @private
  4522. */
  4523. $blurX: number;
  4524. /**
  4525. * @language en_US
  4526. * The amount of horizontal blur.
  4527. * @version Egret 3.1.4
  4528. * @platform Web
  4529. */
  4530. /**
  4531. * @language zh_CN
  4532. * 水平模糊量。
  4533. * @version Egret 3.1.4
  4534. * @platform Web
  4535. */
  4536. blurX: number;
  4537. /**
  4538. * @private
  4539. */
  4540. $blurY: number;
  4541. /**
  4542. * @language en_US
  4543. * The amount of vertical blur.
  4544. * @version Egret 3.1.4
  4545. * @platform Web
  4546. */
  4547. /**
  4548. * @language zh_CN
  4549. * 垂直模糊量。
  4550. * @version Egret 3.1.4
  4551. * @platform Web
  4552. */
  4553. blurY: number;
  4554. /**
  4555. * @private
  4556. */
  4557. $strength: number;
  4558. /**
  4559. * @language en_US
  4560. * The strength of the imprint or spread.
  4561. * @version Egret 3.1.4
  4562. * @platform Web
  4563. */
  4564. /**
  4565. * @language zh_CN
  4566. * 印记或跨页的强度。
  4567. * @version Egret 3.1.4
  4568. * @platform Web
  4569. */
  4570. strength: number;
  4571. /**
  4572. * @private
  4573. */
  4574. $quality: number;
  4575. /**
  4576. * @language en_US
  4577. * The number of times to apply the filter.
  4578. * @version Egret 3.1.4
  4579. * @platform Web
  4580. */
  4581. /**
  4582. * @language zh_CN
  4583. * 应用滤镜的次数。
  4584. * @version Egret 3.1.4
  4585. * @platform Web
  4586. */
  4587. quality: number;
  4588. /**
  4589. * @private
  4590. */
  4591. $inner: boolean;
  4592. /**
  4593. * @language en_US
  4594. * Specifies whether the glow is an inner glow.
  4595. * @version Egret 3.1.4
  4596. * @platform Web
  4597. */
  4598. /**
  4599. * @language zh_CN
  4600. * 指定发光是否为内侧发光。
  4601. * @version Egret 3.1.4
  4602. * @platform Web
  4603. */
  4604. inner: boolean;
  4605. /**
  4606. * @private
  4607. */
  4608. $knockout: boolean;
  4609. /**
  4610. * @language en_US
  4611. * Specifies whether the object has a knockout effect.
  4612. * @version Egret 3.1.4
  4613. * @platform Web
  4614. */
  4615. /**
  4616. * @language zh_CN
  4617. * 指定对象是否具有挖空效果。
  4618. * @version Egret 3.1.4
  4619. * @platform Web
  4620. */
  4621. knockout: boolean;
  4622. /**
  4623. * @private
  4624. */
  4625. $toJson(): string;
  4626. }
  4627. }
  4628. declare namespace egret {
  4629. /**
  4630. * @language en_US
  4631. * The CapsStyle class is an enumeration of constant values that specify the caps style to use in drawing lines.
  4632. * The constants are provided for use as values in the caps parameter of the egret.Graphics.lineStyle() method.
  4633. * @see egret.Graphics#lineStyle()
  4634. * @version Egret 2.5
  4635. * @platform Web,Native
  4636. */
  4637. /**
  4638. * @language zh_CN
  4639. * CapsStyle 类是可指定在绘制线条中使用的端点样式的常量值枚举。常量可用作 egret.Graphics.lineStyle() 方法的 caps 参数中的值。
  4640. * @see egret.Graphics#lineStyle()
  4641. * @version Egret 2.5
  4642. * @platform Web,Native
  4643. */
  4644. const CapsStyle: {
  4645. NONE: string;
  4646. ROUND: string;
  4647. SQUARE: string;
  4648. };
  4649. }
  4650. declare namespace egret {
  4651. /**
  4652. * @language en_US
  4653. * Values for the dirty region policy
  4654. * @version Egret 2.5
  4655. * @platform Web,Native
  4656. */
  4657. /**
  4658. * @language zh_CN
  4659. * 脏矩形策略常量。
  4660. * @version Egret 3.0
  4661. * @platform Web,Native
  4662. */
  4663. const DirtyRegionPolicy: {
  4664. OFF: string;
  4665. ON: string;
  4666. };
  4667. }
  4668. declare namespace egret {
  4669. /**
  4670. * @private
  4671. */
  4672. class WebGLUtils {
  4673. static compileProgram(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string): WebGLProgram;
  4674. static compileFragmentShader(gl: WebGLRenderingContext, shaderSrc: string): WebGLShader;
  4675. static compileVertexShader(gl: WebGLRenderingContext, shaderSrc: string): WebGLShader;
  4676. private static _compileShader(gl, shaderSrc, shaderType);
  4677. private static canUseWebGL;
  4678. static checkCanUseWebGL(): boolean;
  4679. static deleteWebGLTexture(bitmapData: any): void;
  4680. }
  4681. }
  4682. declare namespace egret {
  4683. /**
  4684. * @language en_US
  4685. * The EventPhase class provides values for the eventPhase property of the Event class.
  4686. * @version Egret 2.4
  4687. * @platform Web,Native
  4688. * @includeExample egret/events/EventPhase.ts
  4689. */
  4690. /**
  4691. * @language zh_CN
  4692. * EventPhase 可为 Event 类的 eventPhase 属性提供值。
  4693. * @version Egret 2.4
  4694. * @platform Web,Native
  4695. * @includeExample egret/events/EventPhase.ts
  4696. */
  4697. const enum EventPhase {
  4698. /**
  4699. * @language en_US
  4700. * The capturing phase, which is the first phase of the event flow.
  4701. * @version Egret 2.4
  4702. * @platform Web,Native
  4703. */
  4704. /**
  4705. * @language zh_CN
  4706. * 捕获阶段。
  4707. * @version Egret 2.4
  4708. * @platform Web,Native
  4709. */
  4710. CAPTURING_PHASE = 1,
  4711. /**
  4712. * @language en_US
  4713. * The target phase, which is the second phase of the event flow.
  4714. * @version Egret 2.4
  4715. * @platform Web,Native
  4716. */
  4717. /**
  4718. * @language zh_CN
  4719. * 目标阶段,是事件流的第二个阶段。
  4720. * @version Egret 2.4
  4721. * @platform Web,Native
  4722. */
  4723. AT_TARGET = 2,
  4724. /**
  4725. * @language en_US
  4726. * The bubbling phase, which is the third phase of the event flow.
  4727. * @version Egret 2.4
  4728. * @platform Web,Native
  4729. */
  4730. /**
  4731. * @language zh_CN
  4732. * 冒泡阶段。
  4733. * @version Egret 2.4
  4734. * @platform Web,Native
  4735. */
  4736. BUBBLING_PHASE = 3,
  4737. }
  4738. }
  4739. declare namespace egret {
  4740. /**
  4741. * @language en_US
  4742. * When the user changes the focus from one object in the display list to another object, the object dispatches a FocusEvent object. Currently only supports input text.
  4743. * Focus events: FocusEvent.FOCUS_IN FocusEvent.FOCUS_OUT
  4744. * @version Egret 2.4
  4745. * @platform Web,Native
  4746. */
  4747. /**
  4748. * @language zh_CN
  4749. * 用户将焦点从显示列表中的一个对象更改到另一个对象时,对象将调度 FocusEvent 对象。目前只支持输入文本。
  4750. * 焦点事件:FocusEvent.FOCUS_IN FocusEvent.FOCUS_OUT
  4751. * @version Egret 2.4
  4752. * @platform Web,Native
  4753. */
  4754. class FocusEvent extends egret.Event {
  4755. /**
  4756. * @language en_US
  4757. * Gets focus
  4758. * @version Egret 2.4
  4759. * @platform Web,Native
  4760. */
  4761. /**
  4762. * @language zh_CN
  4763. * 获得焦点
  4764. * @version Egret 2.4
  4765. * @platform Web,Native
  4766. */
  4767. static FOCUS_IN: string;
  4768. /**
  4769. * @language en_US
  4770. * Loses focus
  4771. * @version Egret 2.4
  4772. * @platform Web,Native
  4773. */
  4774. /**
  4775. * @language zh_CN
  4776. * 失去焦点
  4777. * @version Egret 2.4
  4778. * @platform Web,Native
  4779. */
  4780. static FOCUS_OUT: string;
  4781. /**
  4782. * @language en_US
  4783. * Create a egret.FocusEvent objects
  4784. * @param type The type of the event, accessible as Event.type.
  4785. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  4786. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  4787. * @version Egret 2.4
  4788. * @platform Web,Native
  4789. */
  4790. /**
  4791. * @language zh_CN
  4792. * 创建一个 egret.FocusEvent 对象
  4793. * @param type 事件的类型,可以作为 Event.type 访问。
  4794. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  4795. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  4796. * @version Egret 2.4
  4797. * @platform Web,Native
  4798. */
  4799. constructor(type: string, bubbles?: boolean, cancelable?: boolean);
  4800. }
  4801. }
  4802. declare namespace egret {
  4803. /**
  4804. * @language en_US
  4805. * The GeolocationEvent represents the position and altitude of the device on Earth,
  4806. * and show errors occurred while getting the location of the device.
  4807. * @version Egret 2.4
  4808. * @platform Web,Native
  4809. * @includeExample egret/sensor/Geolocation.ts
  4810. * @see http://edn.egret.com/cn/docs/page/662 获取位置信息
  4811. */
  4812. /**
  4813. * @language zh_CN
  4814. * GeolocationEvent 提供设备的地理位置信息和获取位置时发生的错误信息
  4815. * @version Egret 2.4
  4816. * @platform Web,Native
  4817. * @includeExample egret/sensor/Geolocation.ts
  4818. * @see http://edn.egret.com/cn/docs/page/662 获取位置信息
  4819. */
  4820. class GeolocationEvent extends Event {
  4821. /**
  4822. * @language en_US
  4823. * The acquisition of the location information failed because of app don't have permission.
  4824. * @version Egret 2.4
  4825. * @platform Web,Native
  4826. */
  4827. /**
  4828. * @language zh_CN
  4829. * 由于用户拒绝访问位置信息,获取位置信息失败
  4830. * @version Egret 2.4
  4831. * @platform Web,Native
  4832. */
  4833. static PERMISSION_DENIED: string;
  4834. /**
  4835. * @language en_US
  4836. * The acquisition of the location failed because at least one internal source of position returned an internal error.
  4837. * @version Egret 2.4
  4838. * @platform Web,Native
  4839. */
  4840. /**
  4841. * @language zh_CN
  4842. * 设备位置服务不可用或者超时等原因没有得到位置信息
  4843. * @version Egret 2.4
  4844. * @platform Web,Native
  4845. */
  4846. static UNAVAILABLE: string;
  4847. /**
  4848. * @language en_US
  4849. * The position's longitude in decimal degrees.
  4850. * @version Egret 2.4
  4851. * @platform Web,Native
  4852. */
  4853. /**
  4854. * @language zh_CN
  4855. * 当前位置的经度信息
  4856. * @version Egret 2.4
  4857. * @platform Web,Native
  4858. */
  4859. longitude: number;
  4860. /**
  4861. * @language en_US
  4862. * The position's latitude in decimal degrees.
  4863. * @version Egret 2.4
  4864. * @platform Web,Native
  4865. */
  4866. /**
  4867. * @language zh_CN
  4868. * 当前位置的纬度信息
  4869. * @version Egret 2.4
  4870. * @platform Web,Native
  4871. */
  4872. latitude: number;
  4873. /**
  4874. * @language en_US
  4875. * The velocity of the device in meters per second. This value can be null.
  4876. * @version Egret 2.4
  4877. * @platform Web,Native
  4878. */
  4879. /**
  4880. * @language zh_CN
  4881. * 当前设备的速度 单位是 米/秒,这个值可能为 null
  4882. * @version Egret 2.4
  4883. * @platform Web,Native
  4884. */
  4885. speed: number;
  4886. /**
  4887. * @language en_US
  4888. * The direction in which the device is traveling. This value, specified in degrees,
  4889. * indicates how far off from heading due north the device is. 0 degrees represents
  4890. * true true north, and the direction is determined clockwise (which means that east
  4891. * is 90 degrees and west is 270 degrees). If speed is 0, heading is NaN. If the
  4892. * device is unable to provide heading information, this value is null.
  4893. * @version Egret 2.4
  4894. * @platform Web,Native
  4895. */
  4896. /**
  4897. * @language zh_CN
  4898. * 表示设备正在前进的方向,单位是度。heading 表示从正北开始顺时针旋转到当前方向的角度,
  4899. * 比如正东是 90 度,正西是 270 度,如果 speed 是 0,heading 为 NaN。
  4900. * @version Egret 2.4
  4901. * @platform Web,Native
  4902. */
  4903. heading: number;
  4904. /**
  4905. * @language en_US
  4906. * The position's altitude in metres, relative to sea level.
  4907. * This value can be null if the implementation cannot provide the data.
  4908. * @version Egret 2.4
  4909. * @platform Web,Native
  4910. */
  4911. /**
  4912. * @language zh_CN
  4913. * 该位置的海拔信息,如果设备没有实现这个属性时,这个值有可能为 null
  4914. * @version Egret 2.4
  4915. * @platform Web,Native
  4916. */
  4917. altitude: number;
  4918. /**
  4919. * @language en_US
  4920. * The accuracy of the latitude and longitude properties, expressed in meters.
  4921. * @version Egret 2.4
  4922. * @platform Web,Native
  4923. */
  4924. /**
  4925. * @language zh_CN
  4926. * 经纬度的准确性,单位是米
  4927. * @version Egret 2.4
  4928. * @platform Web,Native
  4929. */
  4930. accuracy: number;
  4931. /**
  4932. * @language en_US
  4933. * The accuracy of the altitude expressed in meters. This value can be null.
  4934. * @version Egret 2.4
  4935. * @platform Web,Native
  4936. */
  4937. /**
  4938. * @language zh_CN
  4939. * 该位置海拔信息的准确性,单位是米,这个值有可能为 null
  4940. * @version Egret 2.4
  4941. * @platform Web,Native
  4942. */
  4943. altitudeAccuracy: number;
  4944. /**
  4945. * @language en_US
  4946. * The type of error occurred while get the location of the device. The value could be:
  4947. * @see egret.GeolocationEvent.PERMISSION_DENIED
  4948. * @see egret.GeolocationEvent.UNAVAILABLE
  4949. *
  4950. * @version Egret 2.4
  4951. * @platform Web,Native
  4952. */
  4953. /**
  4954. * @language zh_CN
  4955. * 获取位置信息错误时的错误类型。值可能为:
  4956. * @see egret.GeolocationEvent.PERMISSION_DENIED
  4957. * @see egret.GeolocationEvent.UNAVAILABLE
  4958. *
  4959. * @version Egret 2.4
  4960. * @platform Web,Native
  4961. */
  4962. errorType: string;
  4963. /**
  4964. * @language en_US
  4965. * The error message occurred while get the location of the device.
  4966. * @version Egret 2.4
  4967. * @platform Web,Native
  4968. */
  4969. /**
  4970. * @language zh_CN
  4971. * 获取位置信息错误的错误信息
  4972. * @version Egret 2.4
  4973. * @platform Web,Native
  4974. */
  4975. errorMessage: string;
  4976. }
  4977. }
  4978. declare namespace egret {
  4979. /**
  4980. * @language en_US
  4981. * When a network request returns an HTTP status code, the application dispatches HTTPStatusEvent objects.
  4982. * Before error or completion events will always send HTTPStatusEvent object. HTTPStatusEvent object does not necessarily indicate an error condition; it simply reflects the HTTP status code provided by the network stack (if any).
  4983. * @version Egret 2.4
  4984. * @platform Web,Native
  4985. */
  4986. /**
  4987. * @language zh_CN
  4988. * 在网络请求返回 HTTP 状态代码时,应用程序将调度 HTTPStatusEvent 对象。
  4989. * 在错误或完成事件之前,将始终发送 HTTPStatusEvent 对象。HTTPStatusEvent 对象不一定表示错误条件;它仅反映网络堆栈提供的 HTTP 状态代码(如果有的话)。
  4990. * @version Egret 2.4
  4991. * @platform Web,Native
  4992. */
  4993. class HTTPStatusEvent extends Event {
  4994. /**
  4995. * @language en_US
  4996. * HTTPStatusEvent.HTTP_STATUS constant defines the value of the type property httpStatus event object.
  4997. * @version Egret 2.4
  4998. * @platform Web,Native
  4999. */
  5000. /**
  5001. * @language zh_CN
  5002. * HTTPStatusEvent.HTTP_STATUS 常量定义 httpStatus 事件对象的 type 属性值。
  5003. * @version Egret 2.4
  5004. * @platform Web,Native
  5005. */
  5006. static HTTP_STATUS: string;
  5007. /**
  5008. * @language en_US
  5009. * Create a egret.HTTPStatusEvent objects
  5010. * @param type The type of the event, accessible as Event.type.
  5011. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  5012. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  5013. * @version Egret 2.4
  5014. * @platform Web,Native
  5015. */
  5016. /**
  5017. * @language zh_CN
  5018. * 创建一个 egret.HTTPStatusEvent 对象
  5019. * @param type 事件的类型,可以作为 Event.type 访问。
  5020. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  5021. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  5022. * @version Egret 2.4
  5023. * @platform Web,Native
  5024. */
  5025. constructor(type: string, bubbles?: boolean, cancelable?: boolean);
  5026. /**
  5027. * @private
  5028. */
  5029. private _status;
  5030. /**
  5031. * @language en_US
  5032. * he server returns the HTTP status code.
  5033. * @version Egret 2.4
  5034. * @platform Web,Native
  5035. */
  5036. /**
  5037. * @language zh_CN
  5038. * 由服务器返回的 HTTP 状态代码。
  5039. * @version Egret 2.4
  5040. * @platform Web,Native
  5041. */
  5042. status: number;
  5043. /**
  5044. * @language en_US
  5045. * EventDispatcher object using the specified event object thrown Event. The objects will be thrown in the object cache pool for the next round robin.
  5046. * @param target {egret.IEventDispatcher} Distribute event target
  5047. * @param status {number} The server returns the HTTP status code
  5048. * @version Egret 2.4
  5049. * @platform Web,Native
  5050. */
  5051. /**
  5052. * @language zh_CN
  5053. * 使用指定的EventDispatcher对象来抛出Event事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  5054. * @param target {egret.IEventDispatcher} 派发事件目标
  5055. * @param status {number} 由服务器返回的 HTTP 状态代码
  5056. * @version Egret 2.4
  5057. * @platform Web,Native
  5058. */
  5059. static dispatchHTTPStatusEvent(target: IEventDispatcher, status: number): boolean;
  5060. }
  5061. }
  5062. declare namespace egret {
  5063. /**
  5064. * @language en_US
  5065. * The IEventDispatcher interface defines methods for adding or removing event listeners, checks whether specific types
  5066. * of event listeners are registered, and dispatches events. Event targets are an important part of the Egret event model.
  5067. * The event target serves as the focal point for how events flow through the display list hierarchy. When an event
  5068. * such as a touch tap occurs, an event object is dispatched into the event flow from the root of the display list.
  5069. * The event object makes a round-trip journey to the event target, which is conceptually divided into three phases: <br/>
  5070. * the capture phase includes the journey from the root to the last node before the event target's node; the target
  5071. * phase includes only the event target node; and the bubbling phase includes any subsequent nodes encountered on the
  5072. * return trip to the root of the display list.In general, the easiest way for a user-defined class to gain event
  5073. * dispatching capabilities is to extend EventDispatcher. If this is impossible (that is, if the class is already
  5074. * extending another class), you can instead implement the IEventDispatcher interface, create an EventDispatcher member,
  5075. * and write simple hooks to route calls into the aggregated EventDispatcher.
  5076. * @see egret.EventDispatcher
  5077. * @version Egret 2.4
  5078. * @platform Web,Native
  5079. * @includeExample egret/events/IEventDispatcher.ts
  5080. */
  5081. /**
  5082. * @language zh_CN
  5083. * IEventDispatcher 接口定义用于添加或删除事件侦听器的方法,检查是否已注册特定类型的事件侦听器,并调度事件。
  5084. * 事件目标是 Egret 事件模型的重要组成部分。事件目标是事件如何通过显示列表层次结构这一问题的焦点。当发生触摸轻拍事件时,
  5085. * 会将事件对象调度到从显示列表根开始的事件流中。事件对象进行到事件目标的往返行程,在概念上,此往返行程被划分为三个阶段:<br/>
  5086. * 捕获阶段包括从根到事件目标节点之前的最后一个节点的行程,目标阶段仅包括事件目标节点,冒泡阶段包括到显示列表的根的回程上遇到的任何后续节点。
  5087. * 通常,使用户定义的类能够调度事件的最简单方法是扩展 EventDispatcher。如果无法扩展(即,如果该类已经扩展了另一个类),
  5088. * 则可以实现 IEventDispatcher 接口,创建 EventDispatcher 成员,并编写一些简单的挂钩,将调用连接到聚合的 EventDispatcher 中。
  5089. * @see egret.EventDispatcher
  5090. * @version Egret 2.4
  5091. * @platform Web,Native
  5092. * @includeExample egret/events/IEventDispatcher.ts
  5093. */
  5094. interface IEventDispatcher extends HashObject {
  5095. /**
  5096. * @language en_US
  5097. * Registers an event listener object with an EventDispatcher object so that the listener receives notification of an
  5098. * event. You can register event listeners on all nodes in the display list for a specific type of event, phase,
  5099. * and priority.After you successfully register an event listener, you cannot change its priority through additional
  5100. * calls to on(). To change a listener's priority, you must first call removeEventListener(). Then you can register the
  5101. * listener again with the new priority level.After the listener is registered, subsequent calls to on() with a
  5102. * different value for either type or useCapture result in the creation of a separate listener registration. <br/>
  5103. * When you no longer need an event listener, remove it by calling EventDispatcher.removeEventListener(); otherwise, memory
  5104. * problems might result. Objects with registered event listeners are not automatically removed from memory because
  5105. * the garbage collector does not remove objects that still have references.Copying an EventDispatcher instance does
  5106. * not copy the event listeners attached to it. (If your newly created node needs an event listener, you must attach
  5107. * the listener after creating the node.) However, if you move an EventDispatcher instance, the event listeners attached
  5108. * to it move along with it.If the event listener is being registered on a node while an event is also being processed
  5109. * on this node, the event listener is not triggered during the current phase but may be triggered during a later phase
  5110. * in the event flow, such as the bubbling phase.If an event listener is removed from a node while an event is being
  5111. * processed on the node, it is still triggered by the current actions. After it is removed, the event listener is
  5112. * never invoked again (unless it is registered again for future processing).
  5113. * @param type The type of event.
  5114. * @param listener The listener function that processes the event. This function must accept an event object as
  5115. * its only parameter and must return nothing, as this example shows: function(evt:Event):void The function can
  5116. * have any name.
  5117. * @param thisObject the listener function's "this"
  5118. * @param useCapture Determines whether the listener works in the capture phase or the bubbling phases. If useCapture
  5119. * is set to true, the listener processes the event only during the capture phase and not in the bubbling phase.
  5120. * If useCapture is false, the listener processes the event only during the bubbling phase. To listen for the event
  5121. * in all three phases, call on() twice, once with useCapture set to true, then again with useCapture set to false.
  5122. * @param priority The priority level of the event listener. Priorities are designated by a integer. The higher
  5123. * the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1.
  5124. * If two or more listeners share the same priority, they are processed in the order in which they were added.
  5125. * The default priority is
  5126. * @see #once()
  5127. * @see #removeEventListener()
  5128. * @version Egret 2.4
  5129. * @platform Web,Native
  5130. */
  5131. /**
  5132. * @language zh_CN
  5133. * 使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。可以为特定类型的事件、阶段和优先级在显示列表的所有节
  5134. * 点上注册事件侦听器。成功注册一个事件侦听器后,无法通过额外调用 on() 来更改其优先级。要更改侦听器的优先级,必须
  5135. * 先调用 removeEventListener()。然后,可以使用新的优先级再次注册该侦听器。注册该侦听器后,如果继续调用具有不同 type 或 useCapture
  5136. * 值的 on(),则会创建单独的侦听器注册。<br/>
  5137. * 如果不再需要某个事件侦听器,可调用 EventDispatcher.removeEventListener()
  5138. * 删除它;否则会产生内存问题。由于垃圾回收器不会删除仍包含引用的对象,因此不会从内存中自动删除使用已注册事件侦听器的对象。复制
  5139. * EventDispatcher 实例时并不复制其中附加的事件侦听器。(如果新近创建的节点需要一个事件侦听器,必须在创建该节点后附加该侦听器。)
  5140. * 但是,如果移动 EventDispatcher 实例,则其中附加的事件侦听器也会随之移动。如果在正在处理事件的节点上注册事件侦听器,则不会在当
  5141. * 前阶段触发事件侦听器,但会在事件流的稍后阶段触发,如冒泡阶段。如果从正在处理事件的节点中删除事件侦听器,则该事件侦听器仍由当前操
  5142. * 作触发。删除事件侦听器后,决不会再次调用该事件侦听器(除非再次注册以备将来处理)。
  5143. * @param type 事件的类型。
  5144. * @param listener 处理事件的侦听器函数。此函数必须接受 Event 对象作为其唯一的参数,并且不能返回任何结果,
  5145. * 如下面的示例所示: function(evt:Event):void 函数可以有任何名称。
  5146. * @param thisObject 侦听函数绑定的this对象
  5147. * @param useCapture 确定侦听器是运行于捕获阶段还是运行于冒泡阶段。如果将 useCapture 设置为 true,
  5148. * 则侦听器只在捕获阶段处理事件,而不在冒泡阶段处理事件。如果 useCapture 为 false,则侦听器只在冒泡阶段处理事件。
  5149. * 要在两个阶段都侦听事件,请调用 on() 两次:一次将 useCapture 设置为 true,一次将 useCapture 设置为 false。
  5150. * @param priority 事件侦听器的优先级。优先级由一个带符号的整数指定。数字越大,优先级越高。优先级为 n 的所有侦听器会在
  5151. * 优先级为 n -1 的侦听器之前得到处理。如果两个或更多个侦听器共享相同的优先级,则按照它们的添加顺序进行处理。默认优先级为 0。
  5152. * @see #once()
  5153. * @see #removeEventListener()
  5154. * @version Egret 2.4
  5155. * @platform Web,Native
  5156. */
  5157. addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void;
  5158. /**
  5159. * @language en_US
  5160. * Registers an event listener object with an EventDispatcher object so that the listener receives notification of an
  5161. * event. Different from the on() method,the listener receives notification only once,and then it will be removed
  5162. * automatically.
  5163. * @param type The type of event.
  5164. * @param listener The listener function that processes the event. This function must accept an event object as
  5165. * its only parameter and must return nothing, as this example shows: function(evt:Event):void The function can
  5166. * have any name.
  5167. * @param thisObject the listener function's "this"
  5168. * @param useCapture Determines whether the listener works in the capture phase or the bubbling phases. If useCapture
  5169. * is set to true, the listener processes the event only during the capture phase and not in the bubbling phase.
  5170. * If useCapture is false, the listener processes the event only during the bubbling phase. To listen for the event
  5171. * in all three phases, call on() twice, once with useCapture set to true, then again with useCapture set to false.
  5172. * @param priority The priority level of the event listener. Priorities are designated by a integer. The higher
  5173. * the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1.
  5174. * If two or more listeners share the same priority, they are processed in the order in which they were added.
  5175. * The default priority is
  5176. * @see #on()
  5177. * @see #removeEventListener()
  5178. * @version Egret 2.4
  5179. * @platform Web,Native
  5180. */
  5181. /**
  5182. * @language zh_CN
  5183. * 添加仅回调一次的事件侦听器,此方法与on()方法不同,on()方法会持续产生回调,而此方法在第一次回调时就会自动移除监听。
  5184. * @param type 事件的类型。
  5185. * @param listener 处理事件的侦听器函数。此函数必须接受 Event 对象作为其唯一的参数,并且不能返回任何结果,
  5186. * 如下面的示例所示: function(evt:Event):void 函数可以有任何名称。
  5187. * @param thisObject 侦听函数绑定的this对象
  5188. * @param useCapture 确定侦听器是运行于捕获阶段还是运行于冒泡阶段。如果将 useCapture 设置为 true,
  5189. * 则侦听器只在捕获阶段处理事件,而不在冒泡阶段处理事件。如果 useCapture 为 false,则侦听器只在冒泡阶段处理事件。
  5190. * 要在两个阶段都侦听事件,请调用 once() 两次:一次将 useCapture 设置为 true,一次将 useCapture 设置为 false。
  5191. * @param priority 事件侦听器的优先级。优先级由一个带符号整数指定。数字越大,优先级越高。优先级为 n 的所有侦听器会在
  5192. * 优先级为 n -1 的侦听器之前得到处理。如果两个或更多个侦听器共享相同的优先级,则按照它们的添加顺序进行处理。默认优先级为 0。
  5193. * @see #on()
  5194. * @see #removeEventListener()
  5195. * @version Egret 2.4
  5196. * @platform Web,Native
  5197. */
  5198. once(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void;
  5199. /**
  5200. * @language en_US
  5201. * Removes a listener from the EventDispatcher object. If there is no matching listener registered with the
  5202. * EventDispatcher object, a call to this method has no effect.
  5203. * @param type The type of event.
  5204. * @param listener The listener object to remove.
  5205. * @param thisObject the listener function's "this"
  5206. * @param useCapture Specifies whether the listener was registered for the capture phase or the bubbling phases.
  5207. * If the listener was registered for both the capture phase and the bubbling phases, two calls to removeEventListener()
  5208. * are required to remove both: one call with useCapture set to true, and another call with useCapture set to false.
  5209. * @version Egret 2.4
  5210. * @platform Web,Native
  5211. */
  5212. /**
  5213. * @language zh_CN
  5214. * 从 EventDispatcher 对象中删除侦听器。如果没有向 EventDispatcher 对象注册任何匹配的侦听器,则对此方法的调用没有任何效果。
  5215. * @param type 事件的类型。
  5216. * @param listener 要删除的侦听器对象
  5217. * @param thisObject 侦听函数绑定的this对象
  5218. * @param useCapture 指出是为捕获阶段还是为冒泡阶段注册了侦听器。如果为捕获阶段以及冒泡阶段注册了侦听器,则需要对
  5219. * removeEventListener() 进行两次调用才能将这两个侦听器删除:一次调用将 useCapture 设置为 true,另一次调用将 useCapture 设置为 false。。
  5220. * @version Egret 2.4
  5221. * @platform Web,Native
  5222. */
  5223. removeEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean): void;
  5224. /**
  5225. * @language en_US
  5226. * Checks whether the EventDispatcher object has any listeners registered for a specific type of event. This allows
  5227. * you to determine where an EventDispatcher object has altered handling of an event type in the event flow hierarchy.
  5228. * To determine whether a specific event type will actually trigger an event listener, use IEventDispatcher.willTrigger().
  5229. * The difference between hasEventListener() and willTrigger() is that hasEventListener() examines only the object to
  5230. * which it belongs, whereas willTrigger() examines the entire event flow for the event specified by the type parameter.
  5231. * @param type The type of event.
  5232. * @returns A value of true if a listener of the specified type is registered; false otherwise.
  5233. * @see #willTrigger()
  5234. * @version Egret 2.4
  5235. * @platform Web,Native
  5236. */
  5237. /**
  5238. * @language zh_CN
  5239. * 检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。这样,您就可以确定 EventDispatcher 对象在事件流层次结构中的哪个
  5240. * 位置改变了对事件类型的处理。要确定特定事件类型是否确实会触发事件侦听器,请使用 IEventDispatcher.willTrigger()。hasEventListener()
  5241. * 与 willTrigger() 的区别是:hasEventListener() 只检查它所属的对象,而 willTrigger() 检查整个事件流以查找由 type 参数指定的事件。
  5242. * @param type 事件的类型。
  5243. * @returns 如果指定类型的侦听器已注册,则值为 true;否则,值为 false。
  5244. * @see #willTrigger()
  5245. * @version Egret 2.4
  5246. * @platform Web,Native
  5247. */
  5248. hasEventListener(type: string): boolean;
  5249. /**
  5250. * @language en_US
  5251. * Dispatches an event into the event flow. The event target is the EventDispatcher object upon which dispatchEvent() is called.
  5252. * @param event The event object dispatched into the event flow.
  5253. * @returns A value of true unless preventDefault() is called on the event, in which case it returns false.
  5254. * @version Egret 2.4
  5255. * @platform Web,Native
  5256. */
  5257. /**
  5258. * @language zh_CN
  5259. * 将事件分派到事件流中。事件目标是对其调用 dispatchEvent() 方法的 EventDispatcher 对象。
  5260. * @param event 调度到事件流中的 Event 对象。
  5261. * @returns 如果成功调度了事件,则值为 true。值 false 表示失败或对事件调用了 preventDefault()。
  5262. * @version Egret 2.4
  5263. * @platform Web,Native
  5264. */
  5265. dispatchEvent(event: Event): boolean;
  5266. /**
  5267. * @language en_US
  5268. * Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the
  5269. * specified event type. This method returns true if an event listener is triggered during any phase of the event
  5270. * flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.
  5271. * @param type The type of event.
  5272. * @returns A value of true if a listener of the specified type will be triggered; false otherwise.
  5273. * @see #hasEventListener()
  5274. * @version Egret 2.4
  5275. * @platform Web,Native
  5276. */
  5277. /**
  5278. * @language zh_CN
  5279. * 检查是否用此 EventDispatcher 对象或其任何始祖为指定事件类型注册了事件侦听器。将指定类型的事件调度给此
  5280. * EventDispatcher 对象或其任一后代时,如果在事件流的任何阶段触发了事件侦听器,则此方法返回 true。
  5281. * hasEventListener() 与 willTrigger() 方法的区别是:hasEventListener() 只检查它所属的对象,
  5282. * 而 willTrigger() 方法检查整个事件流以查找由 type 参数指定的事件。
  5283. * @param type 事件类型
  5284. * @returns 是否注册过监听器,如果注册过返回true,反之返回false
  5285. * @see #hasEventListener()
  5286. * @version Egret 2.4
  5287. * @platform Web,Native
  5288. */
  5289. willTrigger(type: string): boolean;
  5290. }
  5291. }
  5292. declare namespace egret {
  5293. /**
  5294. * @language en_US
  5295. * @classdesc IO流事件,当错误导致输入或输出操作失败时调度 IOErrorEvent 对象。
  5296. * @version Egret 2.4
  5297. * @platform Web,Native
  5298. * @includeExample egret/events/IOErrorEvent.ts
  5299. */
  5300. /**
  5301. * @language zh_CN
  5302. * @classdesc IO流事件,当错误导致输入或输出操作失败时调度 IOErrorEvent 对象。
  5303. * @version Egret 2.4
  5304. * @platform Web,Native
  5305. * @includeExample egret/events/IOErrorEvent.ts
  5306. */
  5307. class IOErrorEvent extends Event {
  5308. /**
  5309. * @language en_US
  5310. * io error
  5311. * @version Egret 2.4
  5312. * @platform Web,Native
  5313. */
  5314. /**
  5315. * @language zh_CN
  5316. * io发生错误
  5317. * @version Egret 2.4
  5318. * @platform Web,Native
  5319. */
  5320. static IO_ERROR: string;
  5321. /**
  5322. * @language en_US
  5323. * Create a egret.IOErrorEvent objects
  5324. * @param type {string} Type of event, accessible as Event.type.
  5325. * @param bubbles {boolean} Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  5326. * @param cancelable {boolean} Determine whether the Event object can be canceled. The default value is false.
  5327. * @version Egret 2.4
  5328. * @platform Web,Native
  5329. */
  5330. /**
  5331. * @language zh_CN
  5332. * 创建一个 egret.IOErrorEvent 对象
  5333. * @param type {string} 事件的类型,可以作为 Event.type 访问。
  5334. * @param bubbles {boolean} 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  5335. * @param cancelable {boolean} 确定是否可以取消 Event 对象。默认值为 false。
  5336. * @version Egret 2.4
  5337. * @platform Web,Native
  5338. */
  5339. constructor(type: string, bubbles?: boolean, cancelable?: boolean);
  5340. /**
  5341. * @language en_US
  5342. * EventDispatcher object using the specified event object thrown Event. The objects will be thrown in the object cache pool for the next round robin.
  5343. * @param target {egret.IEventDispatcher} Distribute event target
  5344. * @version Egret 2.4
  5345. * @platform Web,Native
  5346. */
  5347. /**
  5348. * @language zh_CN
  5349. * 使用指定的EventDispatcher对象来抛出Event事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  5350. * @param target {egret.IEventDispatcher} 派发事件目标
  5351. * @version Egret 2.4
  5352. * @platform Web,Native
  5353. */
  5354. static dispatchIOErrorEvent(target: IEventDispatcher): boolean;
  5355. }
  5356. }
  5357. declare namespace egret {
  5358. /**
  5359. * @language en_US
  5360. * MotionEvent represents the device's movement
  5361. * Acceleration and accelerationIncludingGravity to represents the device's acceleration
  5362. * RotationRate to represents the device's rotation
  5363. * @version Egret 2.4
  5364. * @platform Web,Native
  5365. * @includeExample egret/sensor/Motion.ts
  5366. */
  5367. /**
  5368. * @language zh_CN
  5369. * MotionEvent 类呈现设备运动的具体信息
  5370. * Acceleration 和 accelerationIncludingGravity 呈现设备三个维度的加速度信息
  5371. * RotationRate 呈现设备的旋转状态信息
  5372. * @version Egret 2.4
  5373. * @platform Web,Native
  5374. * @includeExample egret/sensor/Motion.ts
  5375. */
  5376. class MotionEvent extends Event {
  5377. /**
  5378. * @language en_US
  5379. * An object giving the acceleration of the device on the three axis X, Y and Z. Acceleration is expressed in m/s2.
  5380. * @version Egret 2.4
  5381. * @platform Web,Native
  5382. */
  5383. /**
  5384. * @language zh_CN
  5385. * acceleration 表示设备在 X Y Z 轴方将的加速度信息,单位是 m/s2,不包含重力
  5386. * @version Egret 2.4
  5387. * @platform Web,Native
  5388. */
  5389. acceleration: DeviceAcceleration;
  5390. /**
  5391. * @language en_US
  5392. * An object giving the acceleration of the device on the three axis X, Y and Z with the effect of gravity. Acceleration is expressed in m/s2.
  5393. * @version Egret 2.4
  5394. * @platform Web,Native
  5395. */
  5396. /**
  5397. * @language zh_CN
  5398. * acceleration 表示设备在 X Y Z 轴方将的加速度信息,单位是 m/s2,包含重力
  5399. * @version Egret 2.4
  5400. * @platform Web,Native
  5401. */
  5402. accelerationIncludingGravity: DeviceAcceleration;
  5403. /**
  5404. * @language en_US
  5405. * An object giving the rate of change of the device's orientation on the three orientation axis alpha, beta and gamma. Rotation rate is express in degrees per seconds.
  5406. * @version Egret 2.4
  5407. * @platform Web,Native
  5408. */
  5409. /**
  5410. * @language zh_CN
  5411. * rotationRate 表示设备在 alpha、 beta 和 gamma 三个轴向的角速度信息,单位是 角度每秒
  5412. * @version Egret 2.4
  5413. * @platform Web,Native
  5414. */
  5415. rotationRate: DeviceRotationRate;
  5416. }
  5417. }
  5418. declare namespace egret {
  5419. /**
  5420. * @language en_US
  5421. * The OrientationEvent provides information from the physical orientation of the device.
  5422. * Note: Currently, Browsers on the iOS and Android does not handle the coordinates the same way.
  5423. * Take care about this while using them.
  5424. * @version Egret 2.4
  5425. * @platform Web,Native
  5426. * @includeExample egret/sensor/DeviceOrientation.ts
  5427. */
  5428. /**
  5429. * @language zh_CN
  5430. * OrientationEvent 提供设备的方向信息
  5431. * 注意: 目前各个浏览器和操作系统处理方向的方式不完全相同,请根据使用场景做相应的校正,
  5432. * 比如使用两次方向数据的变化而不是直接使用方向的值
  5433. * @version Egret 2.4
  5434. * @platform Web,Native
  5435. * @includeExample egret/sensor/DeviceOrientation.ts
  5436. */
  5437. class OrientationEvent extends Event {
  5438. /**
  5439. * @language en_US
  5440. * A number representing the motion of the device around the z axis,
  5441. * express in degrees with values ranging from 0 to 360
  5442. * @version Egret 2.4
  5443. * @platform Web,Native
  5444. */
  5445. /**
  5446. * @language zh_CN
  5447. * 表示设备绕 Z 轴的角度,单位是 角度 范围是 0 到 360
  5448. * @version Egret 2.4
  5449. * @platform Web,Native
  5450. */
  5451. alpha: number;
  5452. /**
  5453. * @language en_US
  5454. * A number representing the motion of the device around the x axis,
  5455. * express in degrees with values ranging from -180 to 180.
  5456. * This represents a front to back motion of the device.
  5457. * @version Egret 2.4
  5458. * @platform Web,Native
  5459. */
  5460. /**
  5461. * @language zh_CN
  5462. * 表示设备绕 X 轴的角度,单位是 角度 范围是 -180 到 180.
  5463. * 这个值表示设备从前向后的旋转状态
  5464. * @version Egret 2.4
  5465. * @platform Web,Native
  5466. */
  5467. beta: number;
  5468. /**
  5469. * @language en_US
  5470. * A number representing the motion of the device around the y axis,
  5471. * express in degrees with values ranging from -90 to 90.
  5472. * This represents a left to right motion of the device.
  5473. * @version Egret 2.4
  5474. * @platform Web,Native
  5475. */
  5476. /**
  5477. * @language zh_CN
  5478. * 表示设备绕 Y 轴的角度,单位是 角度 范围是 -90 到 90.
  5479. * 这个值表示设备从前向后的旋转状态
  5480. * @version Egret 2.4
  5481. * @platform Web,Native
  5482. */
  5483. gamma: number;
  5484. }
  5485. }
  5486. declare namespace egret {
  5487. /**
  5488. * @language en_US
  5489. * When a load operation has begun or a socket has received data, ProgressEvent object is dispatched.
  5490. * There are two types of progress events: ProgressEvent.PROGRESS and ProgressEvent.SOCKET_DATA.
  5491. * @version Egret 2.4
  5492. * @platform Web,Native
  5493. */
  5494. /**
  5495. * @language zh_CN
  5496. * 当加载操作已开始或套接字已接收到数据时,将调度 ProgressEvent 对象。
  5497. * 有两种类型的进程事件:ProgressEvent.PROGRESS 和 ProgressEvent.SOCKET_DATA。
  5498. * @version Egret 2.4
  5499. * @platform Web,Native
  5500. */
  5501. class ProgressEvent extends egret.Event {
  5502. /**
  5503. * @language en_US
  5504. * Changes in the loading progress
  5505. * @version Egret 2.4
  5506. * @platform Web,Native
  5507. */
  5508. /**
  5509. * @language zh_CN
  5510. * 加载进度发生变化
  5511. * @version Egret 2.4
  5512. * @platform Web,Native
  5513. */
  5514. static PROGRESS: string;
  5515. /**
  5516. * @language en_US
  5517. * Get the data
  5518. * @version Egret 2.4
  5519. * @platform Web,Native
  5520. */
  5521. /**
  5522. * @language zh_CN
  5523. * 获取到数据
  5524. * @version Egret 2.4
  5525. * @platform Web,Native
  5526. */
  5527. static SOCKET_DATA: string;
  5528. /**
  5529. * @language en_US
  5530. * Number of items or bytes when the listener processes the event。
  5531. * @version Egret 2.4
  5532. * @platform Web,Native
  5533. */
  5534. /**
  5535. * @language zh_CN
  5536. * 在侦听器处理事件时加载的项数或字节数。
  5537. * @version Egret 2.4
  5538. * @platform Web,Native
  5539. */
  5540. bytesLoaded: number;
  5541. /**
  5542. * @language en_US
  5543. * If the loading process succeeds, the total number or the total number of bytes that will be loaded term.
  5544. * @version Egret 2.4
  5545. * @platform Web,Native
  5546. */
  5547. /**
  5548. * @language zh_CN
  5549. * 如果加载过程成功,将加载的总项数或总字节数。
  5550. * @version Egret 2.4
  5551. * @platform Web,Native
  5552. */
  5553. bytesTotal: number;
  5554. /**
  5555. * @language en_US
  5556. * 创建一个 egret.ProgressEvent 对象
  5557. * @param type The type of the event, accessible as Event.type.
  5558. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  5559. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  5560. * @param bytesLoaded {number} Number of items or bytes loaded
  5561. * @param bytesTotal {number} The total number of items or bytes loaded
  5562. * @version Egret 2.4
  5563. * @platform Web,Native
  5564. */
  5565. /**
  5566. * @language zh_CN
  5567. * 创建一个 egret.ProgressEvent 对象
  5568. * @param type 事件的类型,可以作为 Event.type 访问。
  5569. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  5570. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  5571. * @param bytesLoaded {number} 加载的项数或字节数
  5572. * @param bytesTotal {number} 加载的总项数或总字节数
  5573. * @version Egret 2.4
  5574. * @platform Web,Native
  5575. */
  5576. constructor(type: string, bubbles?: boolean, cancelable?: boolean, bytesLoaded?: number, bytesTotal?: number);
  5577. /**
  5578. * @language en_US
  5579. * EventDispatcher object using the specified event object thrown Event. The objects will be thrown in the object cache pool for the next round robin.
  5580. * @param target {egret.IEventDispatcher} Distribute event target
  5581. * @param type The type of the event, accessible as Event.type.
  5582. * @param bytesLoaded {number} Number of items or bytes loaded
  5583. * @param bytesTotal {number} The total number of items or bytes loaded
  5584. * @version Egret 2.4
  5585. * @platform Web,Native
  5586. */
  5587. /**
  5588. * @language zh_CN
  5589. * 使用指定的EventDispatcher对象来抛出Event事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  5590. * @param target {egret.IEventDispatcher} 派发事件目标
  5591. * @param type {string} 事件类型
  5592. * @param bytesLoaded {number} 加载的项数或字节数
  5593. * @param bytesTotal {number} 加载的总项数或总字节数
  5594. * @version Egret 2.4
  5595. * @platform Web,Native
  5596. */
  5597. static dispatchProgressEvent(target: IEventDispatcher, type: string, bytesLoaded?: number, bytesTotal?: number): boolean;
  5598. }
  5599. }
  5600. declare namespace egret {
  5601. /**
  5602. * @language en_US
  5603. * When the direction of the stage of change, Stage object dispatches StageOrientationEvent object.
  5604. * @version Egret 2.4
  5605. * @platform Web,Native
  5606. * @includeExample egret/events/StageOrientationEvent.ts
  5607. */
  5608. /**
  5609. * @language zh_CN
  5610. * 当舞台的方向更改时,Stage 对象将调度 StageOrientationEvent 对象。
  5611. * @version Egret 2.4
  5612. * @platform Web,Native
  5613. * @includeExample egret/events/StageOrientationEvent.ts
  5614. */
  5615. class StageOrientationEvent extends Event {
  5616. /**
  5617. * @language en_US
  5618. * After screen rotation distribute events.
  5619. * @version Egret 2.4
  5620. * @platform Web,Native
  5621. */
  5622. /**
  5623. * @language zh_CN
  5624. * 屏幕旋转后派发的事件。
  5625. * @version Egret 2.4
  5626. * @platform Web,Native
  5627. */
  5628. static ORIENTATION_CHANGE: string;
  5629. /**
  5630. * @language en_US
  5631. * Creating contains specific information related to the event and the stage direction of StageOrientationEvent object.
  5632. * @param type Event types:StageOrientationEvent.ORIENTATION_CHANGE
  5633. * @param bubbles It indicates whether the Event object participates in the bubbling stage of the event flow.
  5634. * @param cancelable It indicates whether the Event object can be canceled.
  5635. * @version Egret 2.4
  5636. * @platform Web,Native
  5637. */
  5638. /**
  5639. * @language zh_CN
  5640. * 创建包含与舞台方向事件相关的特定信息的 StageOrientationEvent 对象。
  5641. * @param type 事件的类型:StageOrientationEvent.ORIENTATION_CHANGE
  5642. * @param bubbles 表示 Event 对象是否参与事件流的冒泡阶段。
  5643. * @param cancelable 表示是否可以取消 Event 对象。
  5644. * @version Egret 2.4
  5645. * @platform Web,Native
  5646. */
  5647. constructor(type: string, bubbles?: boolean, cancelable?: boolean);
  5648. /**
  5649. * @language en_US
  5650. * 派发一个屏幕旋转的事件。
  5651. * @param target {egret.IEventDispatcher} 派发事件目标
  5652. * @param type {egret.IEventDispatcher} 派发事件类型
  5653. * @version Egret 2.4
  5654. * @platform Web,Native
  5655. */
  5656. /**
  5657. * @language zh_CN
  5658. * 派发一个屏幕旋转的事件。
  5659. * @param target {egret.IEventDispatcher} Distribute event target
  5660. * @param type {egret.IEventDispatcher} Distribute event type
  5661. * @version Egret 2.4
  5662. * @platform Web,Native
  5663. */
  5664. static dispatchStageOrientationEvent(target: IEventDispatcher, type: string): boolean;
  5665. }
  5666. }
  5667. declare namespace egret {
  5668. /**
  5669. * @language en_US
  5670. * When a user clicks a hyperlink rich text object dispatches TextEvent object. Text Event Type: TextEvent.LINK.
  5671. * @version Egret 2.4
  5672. * @platform Web,Native
  5673. * @includeExample egret/events/TextEvent.ts
  5674. */
  5675. /**
  5676. * @language zh_CN
  5677. * 用户在富文本中单击超链接时,对象将调度 TextEvent 对象。文本事件类型:TextEvent.LINK。
  5678. * @version Egret 2.4
  5679. * @platform Web,Native
  5680. * @includeExample egret/events/TextEvent.ts
  5681. */
  5682. class TextEvent extends Event {
  5683. /**
  5684. * @language en_US
  5685. * TextEvent create an object that contains information about text events.
  5686. * @param type Type of event, you can access the TextEvent.type.
  5687. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  5688. * @param cancelable Determine whether the Event object can be canceled. The default value is false.
  5689. * @param text One or more characters of text entered by the user. Event listeners can access this information through the text property.
  5690. * @version Egret 2.4
  5691. * @platform Web,Native
  5692. */
  5693. /**
  5694. * @language zh_CN
  5695. * 创建一个 TextEvent 对象,其中包含有关文本事件的信息。
  5696. * @param type 事件的类型,可以作为 TextEvent.type 访问。
  5697. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  5698. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  5699. * @param text 用户输入的一个或多个文本字符。事件侦听器可以通过 text 属性访问此信息。
  5700. * @version Egret 2.4
  5701. * @platform Web,Native
  5702. */
  5703. constructor(type: string, bubbles?: boolean, cancelable?: boolean, text?: string);
  5704. /**
  5705. * @language en_US
  5706. * It defines the value of the type property of a link event object.
  5707. * @version Egret 2.4
  5708. * @platform Web,Native
  5709. */
  5710. /**
  5711. * @language zh_CN
  5712. * 定义 link 事件对象的 type 属性值。
  5713. * @version Egret 2.4
  5714. * @platform Web,Native
  5715. */
  5716. static LINK: string;
  5717. /**
  5718. * @language en_US
  5719. * In TextEvent.LINK event, event corresponding string.
  5720. * @version Egret 2.4
  5721. * @platform Web,Native
  5722. */
  5723. /**
  5724. * @language zh_CN
  5725. * 在 TextEvent.LINK 事件中,event对应的字符串。
  5726. * @version Egret 2.4
  5727. * @platform Web,Native
  5728. */
  5729. text: string;
  5730. /**
  5731. * @language en_US
  5732. * EventDispatcher object using the specified event object thrown TextEvent. The objects will be thrown in the object cache pool for the next round robin.
  5733. * @param type The type of the event, accessible as Event.type.
  5734. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  5735. * @param text Text TextEvent object assignment
  5736. * @version Egret 2.4
  5737. * @platform Web,Native
  5738. */
  5739. /**
  5740. * @language zh_CN
  5741. * 使用指定的EventDispatcher对象来抛出TextEvent事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  5742. * @param target 派发事件目标
  5743. * @param type 事件类型
  5744. * @param text TextEvent对象的text赋值
  5745. * @version Egret 2.4
  5746. * @platform Web,Native
  5747. */
  5748. static dispatchTextEvent(target: IEventDispatcher, type: string, text: string): boolean;
  5749. }
  5750. }
  5751. declare namespace egret {
  5752. /**
  5753. * @language en_US
  5754. * A Timer object dispatches a TimerEvent objects whenever the Timer object reaches the interval specified by the Timer.delay property.
  5755. * @see egret.Timer
  5756. * @version Egret 2.4
  5757. * @platform Web,Native
  5758. * @includeExample egret/events/TimerEvent.ts
  5759. */
  5760. /**
  5761. * @language zh_CN
  5762. * 每当 Timer 对象达到由 Timer.delay 属性指定的间隔时,Timer 对象即会调度 TimerEvent 对象。
  5763. * @see egret.Timer
  5764. * @version Egret 2.4
  5765. * @platform Web,Native
  5766. * @includeExample egret/events/TimerEvent.ts
  5767. */
  5768. class TimerEvent extends Event {
  5769. /**
  5770. * @language en_US
  5771. * Dispatched whenever a Timer object reaches an interval specified according to the Timer.delay property.
  5772. * @version Egret 2.4
  5773. * @platform Web,Native
  5774. */
  5775. /**
  5776. * @language zh_CN
  5777. * 每当 Timer 对象达到根据 Timer.delay 属性指定的间隔时调度。
  5778. * @version Egret 2.4
  5779. * @platform Web,Native
  5780. */
  5781. static TIMER: string;
  5782. /**
  5783. * @language en_US
  5784. * Dispatched whenever it has completed the number of requests set by Timer.repeatCount.
  5785. * @version Egret 2.4
  5786. * @platform Web,Native
  5787. */
  5788. /**
  5789. * @language zh_CN
  5790. * 每当它完成 Timer.repeatCount 设置的请求数后调度。
  5791. * @version Egret 2.4
  5792. * @platform Web,Native
  5793. */
  5794. static TIMER_COMPLETE: string;
  5795. /**
  5796. * @language en_US
  5797. * Creates an Event object with specific information relevant to timer events.
  5798. * @param type The type of the event. Event listeners can access this information through the inherited type property.
  5799. * @param bubbles Determines whether the Event object bubbles. Event listeners can access this information through
  5800. * the inherited bubbles property.
  5801. * @param cancelable Determines whether the Event object can be canceled. Event listeners can access this information
  5802. * through the inherited cancelable property.
  5803. * @version Egret 2.4
  5804. * @platform Web,Native
  5805. */
  5806. /**
  5807. * @language zh_CN
  5808. * 创建一个 Event 对象,其中包含有关 timer 事件的特定信息。
  5809. * @param type 事件的类型。事件侦听器可以通过继承的 type 属性访问此信息。
  5810. * @param bubbles 确定 Event 对象是否冒泡。事件侦听器可以通过继承的 bubbles 属性访问此信息。
  5811. * @param cancelable 确定是否可以取消 Event 对象。事件侦听器可以通过继承的 cancelable 属性访问此信息。
  5812. * @version Egret 2.4
  5813. * @platform Web,Native
  5814. */
  5815. constructor(type: string, bubbles?: boolean, cancelable?: boolean);
  5816. /**
  5817. * @language en_US
  5818. * Instructs Egret runtime to render after processing of this event completes, if the display list has been modified.
  5819. * @example
  5820. * <pre>
  5821. * function onTimer(event:TimerEvent):void {
  5822. * if (40 < mySp.x && mySp.x < 375) {
  5823. * mySp.x-= 50;
  5824. * } else {
  5825. * mySp.x=374;
  5826. * }
  5827. * event.updateAfterEvent();
  5828. * }
  5829. *
  5830. * let moveTimer:Timer=new Timer(50,250);
  5831. * moveTimer.addEventListener(TimerEvent.TIMER,onTimer);
  5832. * moveTimer.start();
  5833. * </pre>
  5834. * @version Egret 2.4
  5835. * @platform Web,Native
  5836. */
  5837. /**
  5838. * @language zh_CN
  5839. * 如果已修改显示列表,调用此方法将会忽略帧频限制,在此事件处理完成后立即重绘屏幕。
  5840. * @example
  5841. * <pre>
  5842. * function onTimer(event:TimerEvent):void {
  5843. * if (40 < mySp.x && mySp.x < 375) {
  5844. * mySp.x-= 50;
  5845. * } else {
  5846. * mySp.x=374;
  5847. * }
  5848. * event.updateAfterEvent();
  5849. * }
  5850. *
  5851. * let moveTimer:Timer=new Timer(50,250);
  5852. * moveTimer.addEventListener(TimerEvent.TIMER,onTimer);
  5853. * moveTimer.start();
  5854. * </pre>
  5855. * @version Egret 2.4
  5856. * @platform Web,Native
  5857. */
  5858. updateAfterEvent(): void;
  5859. /**
  5860. * @language en_US
  5861. * uses a specified target to dispatchEvent an event. Using this method can reduce the number of
  5862. * reallocate event objects, which allows you to get better code execution performance.
  5863. * @param target the event target
  5864. * @param type The type of the event. Event listeners can access this information through the inherited type property.
  5865. * @param bubbles Determines whether the Event object bubbles. Event listeners can access this information through
  5866. * the inherited bubbles property.
  5867. * @param cancelable Determines whether the Event object can be canceled. Event listeners can access this information
  5868. * through the inherited cancelable property.
  5869. * @see egret.Event.create()
  5870. * @see egret.Event.release()
  5871. * @version Egret 2.4
  5872. * @platform Web,Native
  5873. */
  5874. /**
  5875. * @language zh_CN
  5876. * 使用指定的EventDispatcher对象来抛出事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  5877. * @param target 事件派发目标
  5878. * @param type 事件的类型。事件侦听器可以通过继承的 type 属性访问此信息。
  5879. * @param bubbles 确定 Event 对象是否冒泡。事件侦听器可以通过继承的 bubbles 属性访问此信息。
  5880. * @param cancelable 确定是否可以取消 Event 对象。事件侦听器可以通过继承的 cancelable 属性访问此信息。
  5881. * @see egret.Event.create()
  5882. * @see egret.Event.release()
  5883. * @version Egret 2.4
  5884. * @platform Web,Native
  5885. */
  5886. static dispatchTimerEvent(target: IEventDispatcher, type: string, bubbles?: boolean, cancelable?: boolean): boolean;
  5887. }
  5888. }
  5889. declare namespace egret {
  5890. /**
  5891. * @language en_US
  5892. * A BitmapData object contains an array of pixel data. This data can represent either a fully opaque bitmap or a
  5893. * transparent bitmap that contains alpha channel data. Either type of BitmapData object is stored as a buffer of 32-bit
  5894. * integers. Each 32-bit integer determines the properties of a single pixel in the bitmap.<br/>
  5895. * Each 32-bit integer is a combination of four 8-bit channel values (from 0 to 255) that describe the alpha transparency
  5896. * and the red, green, and blue (ARGB) values of the pixel. (For ARGB values, the most significant byte represents the
  5897. * alpha channel value, followed by red, green, and blue.)
  5898. * @see egret.Bitmap
  5899. * @version Egret 2.4
  5900. * @platform Web,Native
  5901. */
  5902. /**
  5903. * @language zh_CN
  5904. * BitmapData 对象是一个包含像素数据的数组。此数据可以表示完全不透明的位图,或表示包含 Alpha 通道数据的透明位图。
  5905. * 以上任一类型的 BitmapData 对象都作为 32 位整数的缓冲区进行存储。每个 32 位整数确定位图中单个像素的属性。<br/>
  5906. * 每个 32 位整数都是四个 8 位通道值(从 0 到 255)的组合,这些值描述像素的 Alpha 透明度以及红色、绿色、蓝色 (ARGB) 值。
  5907. * (对于 ARGB 值,最高有效字节代表 Alpha 通道值,其后的有效字节分别代表红色、绿色和蓝色通道值。)
  5908. * @see egret.Bitmap
  5909. * @version Egret 2.4
  5910. * @platform Web,Native
  5911. */
  5912. class BitmapData extends HashObject {
  5913. /**
  5914. * @language en_US
  5915. * The width of the bitmap image in pixels.
  5916. * @readOnly
  5917. * @version Egret 2.4
  5918. * @platform Web,Native
  5919. */
  5920. /**
  5921. * @language zh_CN
  5922. * 位图图像的宽度,以像素为单位。
  5923. * @readOnly
  5924. * @version Egret 2.4
  5925. * @platform Web,Native
  5926. */
  5927. width: number;
  5928. /**
  5929. * @language en_US
  5930. * The height of the bitmap image in pixels.
  5931. * @readOnly
  5932. * @version Egret 2.4
  5933. * @platform Web,Native
  5934. */
  5935. /**
  5936. * @language zh_CN
  5937. * 位图图像的高度,以像素为单位。
  5938. * @readOnly
  5939. * @version Egret 2.4
  5940. * @platform Web,Native
  5941. */
  5942. height: number;
  5943. /**
  5944. * @language en_US
  5945. * Original bitmap image.
  5946. * @version Egret 2.4
  5947. * @platform Web,Native
  5948. * @private
  5949. */
  5950. /**
  5951. * @language zh_CN
  5952. * 原始位图图像。
  5953. * @version Egret 2.4
  5954. * @platform Web,Native
  5955. * @private
  5956. */
  5957. source: any;
  5958. /**
  5959. * @language en_US
  5960. * WebGL texture.
  5961. * @version Egret 2.4
  5962. * @platform Web,Native
  5963. * @private
  5964. */
  5965. /**
  5966. * @language zh_CN
  5967. * WebGL纹理。
  5968. * @version Egret 2.4
  5969. * @platform Web,Native
  5970. * @private
  5971. */
  5972. webGLTexture: any;
  5973. /**
  5974. * @language en_US
  5975. * Texture format.
  5976. * @version Egret 2.4
  5977. * @platform Web,Native
  5978. */
  5979. /**
  5980. * @language zh_CN
  5981. * 纹理格式。
  5982. * @version Egret 2.4
  5983. * @platform Web,Native
  5984. */
  5985. format: string;
  5986. /**
  5987. * @private
  5988. * webgl纹理生成后,是否删掉原始图像数据
  5989. */
  5990. $deleteSource: boolean;
  5991. constructor(source: any);
  5992. $dispose(): void;
  5993. private static _displayList;
  5994. static $addDisplayObject(displayObject: DisplayObject, bitmapData: BitmapData | Texture): void;
  5995. static $removeDisplayObject(displayObject: DisplayObject, bitmapData: BitmapData | Texture): void;
  5996. static $invalidate(bitmapData: BitmapData | Texture): void;
  5997. static $dispose(bitmapData: BitmapData | Texture): void;
  5998. }
  5999. }
  6000. declare namespace egret {
  6001. /**
  6002. * @language en_US
  6003. * The TouchEvent class lets you handle events on devices that detect user contact with the device (such as a finger
  6004. * on a touch screen).When a user interacts with a device such as a mobile phone or tablet with a touch screen, the
  6005. * user typically touches the screen with his or her fingers or a pointing device. You can develop applications that
  6006. * respond to basic touch events (such as a single finger tap) with the TouchEvent class. Create event listeners using
  6007. * the event types defined in this class.
  6008. * Note: When objects are nested on the display list, touch events target the deepest possible nested object that is
  6009. * visible in the display list. This object is called the target node. To have a target node's ancestor (an object
  6010. * containing the target node in the display list) receive notification of a touch event, use EventDispatcher.addEventListener()
  6011. * on the ancestor node with the type parameter set to the specific touch event you want to detect.
  6012. *
  6013. * @version Egret 2.4
  6014. * @platform Web,Native
  6015. * @includeExample egret/events/TouchEvent.ts
  6016. */
  6017. /**
  6018. * @language zh_CN
  6019. * 使用 TouchEvent 类,您可以处理设备上那些检测用户与设备之间的接触的事件。
  6020. * 当用户与带有触摸屏的移动电话或平板电脑等设备交互时,用户通常使用手指或指针设备接触屏幕。可使用 TouchEvent
  6021. * 类开发响应基本触摸事件(如单个手指点击)的应用程序。使用此类中定义的事件类型创建事件侦听器。
  6022. * 注意:当对象嵌套在显示列表中时,触摸事件的目标将是显示列表中可见的最深的可能嵌套对象。
  6023. * 此对象称为目标节点。要使目标节点的祖代(祖代是一个包含显示列表中所有目标节点的对象,从舞台到目标节点的父节点均包括在内)
  6024. * 接收触摸事件的通知,请对祖代节点使用 EventDispatcher.on() 并将 type 参数设置为要检测的特定触摸事件。
  6025. *
  6026. * @version Egret 2.4
  6027. * @platform Web,Native
  6028. * @includeExample egret/events/TouchEvent.ts
  6029. */
  6030. class TouchEvent extends Event {
  6031. /**
  6032. * @language en_US
  6033. * Dispatched when the user touches the device, and is continuously dispatched until the point of contact is removed.
  6034. * @version Egret 2.4
  6035. * @platform Web,Native
  6036. */
  6037. /**
  6038. * @language zh_CN
  6039. * 当用户触碰设备时进行调度,而且会连续调度,直到接触点被删除。
  6040. * @version Egret 2.4
  6041. * @platform Web,Native
  6042. */
  6043. static TOUCH_MOVE: string;
  6044. /**
  6045. * @language en_US
  6046. * Dispatched when the user first contacts a touch-enabled device (such as touches a finger to a mobile phone or tablet with a touch screen).
  6047. * @version Egret 2.4
  6048. * @platform Web,Native
  6049. */
  6050. /**
  6051. * @language zh_CN
  6052. * 当用户第一次触摸启用触摸的设备时(例如,用手指触摸配有触摸屏的移动电话或平板电脑)调度。
  6053. * @version Egret 2.4
  6054. * @platform Web,Native
  6055. */
  6056. static TOUCH_BEGIN: string;
  6057. /**
  6058. * @language en_US
  6059. * Dispatched when the user removes contact with a touch-enabled device (such as lifts a finger off a mobile phone
  6060. * or tablet with a touch screen).
  6061. * @version Egret 2.4
  6062. * @platform Web,Native
  6063. */
  6064. /**
  6065. * @language zh_CN
  6066. * 当用户移除与启用触摸的设备的接触时(例如,将手指从配有触摸屏的移动电话或平板电脑上抬起)调度。
  6067. * @version Egret 2.4
  6068. * @platform Web,Native
  6069. */
  6070. static TOUCH_END: string;
  6071. /**
  6072. * @language en_US
  6073. * Dispatched when an event of some kind occurred that canceled the touch.
  6074. * Such as the eui.Scroller will dispatch 'TOUCH_CANCEL' when it start move, the 'TOUCH_END' and 'TOUCH_TAP' will not be triggered.
  6075. * @version Egret 3.0.1
  6076. * @platform Web,Native
  6077. */
  6078. /**
  6079. * @language zh_CN
  6080. * 由于某个事件取消了触摸时触发。比如 eui.Scroller 在开始滚动后会触发 'TOUCH_CANCEL' 事件,不再触发后续的 'TOUCH_END' 和 'TOUCH_TAP' 事件
  6081. * @version Egret 3.0.1
  6082. * @platform Web,Native
  6083. */
  6084. static TOUCH_CANCEL: string;
  6085. /**
  6086. * @language en_US
  6087. * Dispatched when the user lifts the point of contact over the same DisplayObject instance on which the contact
  6088. * was initiated on a touch-enabled device.
  6089. * @version Egret 2.4
  6090. * @platform Web,Native
  6091. */
  6092. /**
  6093. * @language zh_CN
  6094. * 当用户在触摸设备上与开始触摸的同一 DisplayObject 实例上抬起接触点时调度。
  6095. * @version Egret 2.4
  6096. * @platform Web,Native
  6097. */
  6098. static TOUCH_TAP: string;
  6099. /**
  6100. * @language en_US
  6101. * Dispatched when the user lifts the point of contact over the different DisplayObject instance on which the contact
  6102. * was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display
  6103. * object on a mobile phone or tablet with a touch screen).
  6104. * @version Egret 2.4
  6105. * @platform Web,Native
  6106. */
  6107. /**
  6108. * @language zh_CN
  6109. * 当用户在触摸设备上与开始触摸的不同 DisplayObject 实例上抬起接触点时调度。
  6110. * @version Egret 2.4
  6111. * @platform Web,Native
  6112. */
  6113. static TOUCH_RELEASE_OUTSIDE: string;
  6114. /**
  6115. * @deprecated
  6116. * @version Egret 2.4
  6117. * @platform Web,Native
  6118. */
  6119. static TOUCH_ROLL_OUT: string;
  6120. /**
  6121. * @deprecated
  6122. * @version Egret 2.4
  6123. * @platform Web,Native
  6124. */
  6125. static TOUCH_ROLL_OVER: string;
  6126. /**
  6127. * @language en_US
  6128. * Creates an Event object that contains information about touch events.
  6129. * @param type The type of the event, accessible as Event.type.
  6130. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  6131. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  6132. * @param stageX The horizontal coordinate at which the event occurred in global Stage coordinates.
  6133. * @param stageY The vertical coordinate at which the event occurred in global Stage coordinates.
  6134. * @param touchPointID A unique identification number assigned to the touch point.
  6135. * @version Egret 2.4
  6136. * @platform Web,Native
  6137. */
  6138. /**
  6139. * @language zh_CN
  6140. * 创建一个 TouchEvent 对象,其中包含有关Touch事件的信息
  6141. * @param type 事件的类型,可以作为 Event.type 访问。
  6142. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  6143. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  6144. * @param stageX 事件发生点在全局舞台坐标系中的水平坐标
  6145. * @param stageY 事件发生点在全局舞台坐标系中的垂直坐标
  6146. * @param touchPointID 分配给触摸点的唯一标识号
  6147. * @version Egret 2.4
  6148. * @platform Web,Native
  6149. */
  6150. constructor(type: string, bubbles?: boolean, cancelable?: boolean, stageX?: number, stageY?: number, touchPointID?: number);
  6151. /**
  6152. * @private
  6153. */
  6154. $initTo(stageX: number, stageY: number, touchPointID: number): void;
  6155. /**
  6156. * @private
  6157. */
  6158. $stageX: number;
  6159. /**
  6160. * @language en_US
  6161. * The horizontal coordinate at which the event occurred in global Stage coordinates.
  6162. * @version Egret 2.4
  6163. * @platform Web,Native
  6164. */
  6165. /**
  6166. * @language zh_CN
  6167. * 事件发生点在全局舞台坐标中的水平坐标。
  6168. * @version Egret 2.4
  6169. * @platform Web,Native
  6170. */
  6171. stageX: number;
  6172. /**
  6173. * @private
  6174. */
  6175. $stageY: number;
  6176. /**
  6177. * @language en_US
  6178. * The vertical coordinate at which the event occurred in global Stage coordinates.
  6179. * @version Egret 2.4
  6180. * @platform Web,Native
  6181. */
  6182. /**
  6183. * @language zh_CN
  6184. * 事件发生点在全局舞台坐标中的垂直坐标。
  6185. * @version Egret 2.4
  6186. * @platform Web,Native
  6187. */
  6188. stageY: number;
  6189. private _localX;
  6190. /**
  6191. * @language en_US
  6192. * The horizontal coordinate at which the event occurred relative to the display object.
  6193. * @version Egret 2.4
  6194. * @platform Web,Native
  6195. */
  6196. /**
  6197. * @language zh_CN
  6198. * 事件发生点相对于所属显示对象的水平坐标。
  6199. * @version Egret 2.4
  6200. * @platform Web,Native
  6201. */
  6202. localX: number;
  6203. private _localY;
  6204. /**
  6205. * @language en_US
  6206. * The vertical coordinate at which the event occurred relative to the display object.
  6207. * @version Egret 2.4
  6208. * @platform Web,Native
  6209. */
  6210. /**
  6211. * @language zh_CN
  6212. * 事件发生点相对于所属显示对象的垂直坐标。
  6213. * @version Egret 2.4
  6214. * @platform Web,Native
  6215. */
  6216. localY: number;
  6217. private targetChanged;
  6218. /**
  6219. * @private
  6220. */
  6221. private getLocalXY();
  6222. $setTarget(target: any): boolean;
  6223. /**
  6224. * @language en_US
  6225. * A unique identification number assigned to the touch point.
  6226. * @version Egret 2.4
  6227. * @platform Web,Native
  6228. */
  6229. /**
  6230. * @language zh_CN
  6231. * 分配给触摸点的唯一标识号
  6232. * @version Egret 2.4
  6233. * @platform Web,Native
  6234. */
  6235. touchPointID: number;
  6236. /**
  6237. * @language en_US
  6238. * Instructs Egret runtime to render after processing of this event completes, if the display list has been modified.
  6239. * @version Egret 2.4
  6240. * @platform Web,Native
  6241. */
  6242. /**
  6243. * @language zh_CN
  6244. * 如果已修改显示列表,调用此方法将会忽略帧频限制,在此事件处理完成后立即重绘屏幕。
  6245. * @version Egret 2.4
  6246. * @platform Web,Native
  6247. */
  6248. updateAfterEvent(): void;
  6249. /**
  6250. * @language en_US
  6251. * Whether the touch is pressed (true) or not pressed (false).
  6252. * @version Egret 2.4
  6253. * @platform Web,Native
  6254. */
  6255. /**
  6256. * @language zh_CN
  6257. * 表示触摸已按下 (true) 还是未按下 (false)。
  6258. * @version Egret 2.4
  6259. * @platform Web,Native
  6260. */
  6261. touchDown: boolean;
  6262. /**
  6263. * @language en_US
  6264. * uses a specified target to dispatchEvent an event. Using this method can reduce the number of
  6265. * reallocate event objects, which allows you to get better code execution performance.
  6266. * @param target the event target
  6267. * @param type The type of the event, accessible as Event.type.
  6268. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  6269. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  6270. * @param stageX The horizontal coordinate at which the event occurred in global Stage coordinates.
  6271. * @param stageY The vertical coordinate at which the event occurred in global Stage coordinates.
  6272. * @param touchPointID A unique identification number (as an int) assigned to the touch point.
  6273. *
  6274. * @see egret.Event.create()
  6275. * @see egret.Event.release()
  6276. *
  6277. * @version Egret 2.4
  6278. * @platform Web,Native
  6279. */
  6280. /**
  6281. * @language zh_CN
  6282. * 使用指定的EventDispatcher对象来抛出Event事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  6283. * @param target 派发事件目标
  6284. * @param type 事件的类型,可以作为 Event.type 访问。
  6285. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  6286. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  6287. * @param stageX 事件发生点在全局舞台坐标系中的水平坐标
  6288. * @param stageY 事件发生点在全局舞台坐标系中的垂直坐标
  6289. * @param touchPointID 分配给触摸点的唯一标识号
  6290. *
  6291. * @see egret.Event.create()
  6292. * @see egret.Event.release()
  6293. *
  6294. * @version Egret 2.4
  6295. * @platform Web,Native
  6296. */
  6297. static dispatchTouchEvent(target: IEventDispatcher, type: string, bubbles?: boolean, cancelable?: boolean, stageX?: number, stageY?: number, touchPointID?: number, touchDown?: boolean): boolean;
  6298. }
  6299. }
  6300. declare namespace egret {
  6301. /**
  6302. * @language en_US
  6303. * h5 and native interaction.
  6304. * @see http://edn.egret.com/cn/article/index/id/714 Egret basic skills to communicate with Native
  6305. * @version Egret 2.4
  6306. * @platform Web,Native
  6307. * @includeExample egret/external/ExternalInterface.ts
  6308. */
  6309. /**
  6310. * @language zh_CN
  6311. * h5与native交互。
  6312. * @see http://edn.egret.com/cn/article/index/id/714 Egret 与 Native 通信基本技巧
  6313. * @version Egret 2.4
  6314. * @platform Web,Native
  6315. * @includeExample egret/external/ExternalInterface.ts
  6316. */
  6317. interface ExternalInterface {
  6318. }
  6319. let ExternalInterface: {
  6320. /**
  6321. * @language en_US
  6322. * Call functionName, and the value passed to the native.
  6323. * @version Egret 2.4
  6324. * @platform Web,Native
  6325. */
  6326. /**
  6327. * @language zh_CN
  6328. * 调用 functionName,并将value传入到native中。
  6329. * @version Egret 2.4
  6330. * @platform Web,Native
  6331. */
  6332. call(functionName: string, value: string): void;
  6333. /**
  6334. * @language en_US
  6335. * FunctionName callback listener, you need to have to call functionName this field in native rather than such a call.
  6336. * @version Egret 2.4
  6337. * @platform Web,Native
  6338. */
  6339. /**
  6340. * @language zh_CN
  6341. * 监听 functionName 回调,需要在native中有调用 functionName 这个字段,而不是 此类的call。
  6342. * @version Egret 2.4
  6343. * @platform Web,Native
  6344. */
  6345. addCallback(functionName: string, listener: (value: string) => void): void;
  6346. };
  6347. }
  6348. declare namespace egret {
  6349. /**
  6350. * @private
  6351. * @version Egret 2.4
  6352. * @platform Web,Native
  6353. */
  6354. const enum BitmapFilterQuality {
  6355. /**
  6356. * 定义低品质滤镜设置
  6357. * @private
  6358. * @version Egret 2.4
  6359. * @platform Web,Native
  6360. */
  6361. LOW = 1,
  6362. /**
  6363. * 定义中等品质滤镜设置
  6364. * @private
  6365. * @version Egret 2.4
  6366. * @platform Web,Native
  6367. */
  6368. MEDIUM = 2,
  6369. /**
  6370. * 定义高品质滤镜设置
  6371. * @private
  6372. * @version Egret 2.4
  6373. * @platform Web,Native
  6374. */
  6375. HIGH = 3,
  6376. }
  6377. }
  6378. declare namespace egret {
  6379. /**
  6380. * @language en_US
  6381. * The BlurFilter class lets you apply a blur visual effect to display objects. A blur effect softens the details of an image.
  6382. * You can produce blurs that range from a softly unfocused look to a Gaussian blur, a hazy appearance like viewing an image through semi-opaque glass.
  6383. * @version Egret 3.0.1
  6384. * @platform Web
  6385. * @see http://edn.egret.com/cn/docs/page/947#模糊滤镜 模糊滤镜
  6386. */
  6387. /**
  6388. * @language zh_CN
  6389. * 可使用 BlurFilter 类将模糊视觉效果应用于显示对象。模糊效果可以柔化图像的细节。
  6390. * 您可以生成一些模糊效果,范围从创建一个柔化的、未聚焦的外观到高斯模糊(就像通过半透明玻璃查看图像一样的朦胧的外观)。
  6391. * @version Egret 3.1.0
  6392. * @platform Web
  6393. * @see http://edn.egret.com/cn/docs/page/947#模糊滤镜 模糊滤镜
  6394. */
  6395. class BlurFilter extends Filter {
  6396. /**
  6397. * @language en_US
  6398. * Initializes a BlurFilter object.
  6399. * @param blurX {number} The amount of horizontal blur. Valid values are 0 to 255 (floating point).
  6400. * @param blurY {number} The amount of vertical blur. Valid values are 0 to 255 (floating point).
  6401. * @param quality {number} The number of times to apply the filter.
  6402. * @version Egret 3.1.0
  6403. * @platform Web
  6404. */
  6405. /**
  6406. * @language zh_CN
  6407. * 创建一个 BlurFilter 对象。
  6408. * @param blurX {number} 水平模糊量。有效值为 0 到 255(浮点)。
  6409. * @param blurY {number} 垂直模糊量。有效值为 0 到 255(浮点)。
  6410. * @param quality {number} 应用滤镜的次数。暂未实现。
  6411. * @version Egret 3.1.0
  6412. * @platform Web
  6413. */
  6414. constructor(blurX?: number, blurY?: number, quality?: number);
  6415. /**
  6416. * @private
  6417. */
  6418. $quality: number;
  6419. /**
  6420. * @language en_US
  6421. * The amount of horizontal blur.
  6422. * @version Egret 3.1.0
  6423. * @platform Web
  6424. */
  6425. /**
  6426. * @language zh_CN
  6427. * 水平模糊量。
  6428. * @version Egret 3.1.0
  6429. * @platform Web
  6430. */
  6431. blurX: number;
  6432. /**
  6433. * @private
  6434. */
  6435. $blurX: number;
  6436. /**
  6437. * @language en_US
  6438. * The amount of vertical blur.
  6439. * @version Egret 3.1.0
  6440. * @platform Web
  6441. */
  6442. /**
  6443. * @language zh_CN
  6444. * 垂直模糊量。
  6445. * @version Egret 3.1.0
  6446. * @platform Web
  6447. */
  6448. blurY: number;
  6449. /**
  6450. * @private
  6451. */
  6452. $blurY: number;
  6453. /**
  6454. * @private
  6455. */
  6456. $toJson(): string;
  6457. }
  6458. }
  6459. declare namespace egret {
  6460. /**
  6461. * @language en_US
  6462. * The ColorMatrixFilter class lets you apply a 4 x 5 matrix transformation on the RGBA color and alpha values of every pixel in the input image to produce a result with a new set of RGBA color and alpha values.
  6463. * It allows saturation changes, hue rotation, luminance to alpha, and various other effects.
  6464. * @version Egret 3.1.0
  6465. * @platform Web
  6466. * @see http://edn.egret.com/cn/docs/page/947 颜色矩阵滤镜
  6467. */
  6468. /**
  6469. * @language zh_CN
  6470. * 使用 ColorMatrixFilter 类可以将 4 x 5 矩阵转换应用于输入图像上的每个像素的 RGBA 颜色和 Alpha 值,以生成具有一组新的 RGBA 颜色和 Alpha 值的结果。
  6471. * 该类允许饱和度更改、色相旋转、亮度为 Alpha 以及各种其他效果。
  6472. * @version Egret 3.1.0
  6473. * @platform Web
  6474. * @see http://edn.egret.com/cn/docs/page/947 颜色矩阵滤镜
  6475. */
  6476. class ColorMatrixFilter extends Filter {
  6477. /**
  6478. * @private
  6479. */
  6480. $matrix: number[];
  6481. /**
  6482. * @private
  6483. */
  6484. private matrix2;
  6485. /**
  6486. * @language en_US
  6487. * Initializes a ColorMatrixFilter object.
  6488. * @version Egret 3.1.0
  6489. * @platform Web
  6490. */
  6491. /**
  6492. * @language zh_CN
  6493. * 创建一个 ColorMatrixFilter 对象。
  6494. * @version Egret 3.1.0
  6495. * @platform Web
  6496. */
  6497. constructor(matrix?: number[]);
  6498. /**
  6499. * @language en_US
  6500. * A comma delimited list of 20 doubles that comprise a 4x5 matrix applied to the rendered element.
  6501. * The matrix is in row major order -- that is, the first five elements are multipled by the vector [srcR,srcG,srcB,srcA,1] to determine the output red value, the second five determine the output green value, etc.
  6502. * The value must either be an array or comma delimited string of 20 numbers.
  6503. * @version Egret 3.1.0
  6504. * @platform Web
  6505. */
  6506. /**
  6507. * @language zh_CN
  6508. * 构成应用于所呈示的元素的一个 4x5 矩阵的、以逗号分隔的 20 个双精度数的列表。
  6509. * 矩阵以行作为主要顺序,即用第一行五个元素乘以矢量 [srcR,srcG,srcB,srcA,1] 以确定输出的红色值,用第二行的五个元素确定输出的绿色值,等等。
  6510. * 该值必须为 20 个数字组成的数组或以逗号分隔的字符串。
  6511. * @version Egret 3.1.0
  6512. * @platform Web
  6513. */
  6514. matrix: number[];
  6515. /**
  6516. * @private
  6517. */
  6518. private setMatrix(value);
  6519. /**
  6520. * @private
  6521. */
  6522. $toJson(): string;
  6523. }
  6524. }
  6525. declare namespace egret {
  6526. /**
  6527. * @class egret.DropShadowFilter
  6528. * @classdesc
  6529. * 可使用 DropShadowFilter 类向显示对象添加投影。
  6530. * @extends egret.GlowFilter
  6531. * @version Egret 3.1.4
  6532. * @platform Web,Native
  6533. */
  6534. class DropShadowFilter extends GlowFilter {
  6535. /**
  6536. * @language en_US
  6537. * Initializes a new DropShadowFilter instance.
  6538. * @method egret.DropShadowFilter#constructor
  6539. * @param distance {number} The offset distance of the bevel. Valid values are in pixels (floating point).
  6540. * @param angle {number} The angle of the bevel. Valid values are from 0 to 360°.
  6541. * @param color {number} The color of the glow. Valid values are in the hexadecimal format 0xRRGGBB. The default value is 0xFF0000.
  6542. * @param alpha {number} The alpha transparency value for the color. Valid values are 0 to 1. For example, .25 sets a transparency value of 25%. The default value is 1.
  6543. * @param blurX {number} The amount of horizontal blur. Valid values are 0 to 255 (floating point).
  6544. * @param blurY {number} The amount of vertical blur. Valid values are 0 to 255 (floating point).
  6545. * @param strength {number} The strength of the imprint or spread. The higher the value, the more color is imprinted and the stronger the contrast between the glow and the background. Valid values are 0 to 255.
  6546. * @param quality {number} The number of times to apply the filter.
  6547. * @param inner {boolean} Specifies whether the glow is an inner glow. The value true indicates an inner glow. The default is false, an outer glow (a glow around the outer edges of the object).
  6548. * @param knockout {number} Specifies whether the object has a knockout effect. A value of true makes the object's fill transparent and reveals the background color of the document. The default value is false (no knockout effect).
  6549. * @param hideObject {number} Indicates whether or not the object is hidden. The value true indicates that the object itself is not drawn; only the shadow is visible. The default is false, meaning that the object is shown.
  6550. * @version Egret 3.1.4
  6551. * @platform Web
  6552. */
  6553. /**
  6554. * @language zh_CN
  6555. * 初始化 DropShadowFilter 对象
  6556. * @method egret.DropShadowFilter#constructor
  6557. * @param distance {number} 阴影的偏移距离,以像素为单位。
  6558. * @param angle {number} 阴影的角度,0 到 360 度(浮点)。
  6559. * @param color {number} 光晕颜色,采用十六进制格式 0xRRGGBB。默认值为 0xFF0000。
  6560. * @param alpha {number} 颜色的 Alpha 透明度值。有效值为 0 到 1。例如,0.25 设置透明度值为 25%。
  6561. * @param blurX {number} 水平模糊量。有效值为 0 到 255(浮点)。
  6562. * @param blurY {number} 垂直模糊量。有效值为 0 到 255(浮点)。
  6563. * @param strength {number} 印记或跨页的强度。该值越高,压印的颜色越深,而且发光与背景之间的对比度也越强。有效值为 0 到 255。
  6564. * @param quality {number} 应用滤镜的次数。暂未实现。
  6565. * @param inner {boolean} 指定发光是否为内侧发光。值 true 指定发光是内侧发光。值 false 指定发光是外侧发光(对象外缘周围的发光)。
  6566. * @param knockout {number} 指定对象是否具有挖空效果。值为 true 将使对象的填充变为透明,并显示文档的背景颜色。
  6567. * @param hideObject {number} 表示是否隐藏对象。如果值为 true,则表示没有绘制对象本身,只有阴影是可见的。默认值为 false(显示对象)。
  6568. * @version Egret 3.1.4
  6569. * @platform Web
  6570. */
  6571. constructor(distance?: number, angle?: number, color?: number, alpha?: number, blurX?: number, blurY?: number, strength?: number, quality?: number, inner?: boolean, knockout?: boolean, hideObject?: boolean);
  6572. /**
  6573. * @private
  6574. */
  6575. $distance: number;
  6576. /**
  6577. * @language en_US
  6578. * The offset distance of the bevel.
  6579. * @version Egret 3.1.4
  6580. * @platform Web
  6581. */
  6582. /**
  6583. * @language zh_CN
  6584. * 阴影的偏移距离,以像素为单位。
  6585. * @version Egret 3.1.4
  6586. * @platform Web
  6587. */
  6588. distance: number;
  6589. /**
  6590. * @private
  6591. */
  6592. $angle: number;
  6593. /**
  6594. * @language en_US
  6595. * The angle of the bevel.
  6596. * @version Egret 3.1.4
  6597. * @platform Web
  6598. */
  6599. /**
  6600. * @language zh_CN
  6601. * 阴影的角度。
  6602. * @version Egret 3.1.4
  6603. * @platform Web
  6604. */
  6605. angle: number;
  6606. /**
  6607. * @private
  6608. */
  6609. $hideObject: boolean;
  6610. /**
  6611. * @language en_US
  6612. * Indicates whether or not the object is hidden.
  6613. * @version Egret 3.1.4
  6614. * @platform Web
  6615. */
  6616. /**
  6617. * @language zh_CN
  6618. * 表示是否隐藏对象。
  6619. * @version Egret 3.1.4
  6620. * @platform Web
  6621. */
  6622. hideObject: boolean;
  6623. /**
  6624. * @private
  6625. */
  6626. $toJson(): string;
  6627. }
  6628. }
  6629. declare namespace egret {
  6630. /**
  6631. * @language en_US
  6632. * The GradientType class provides values for the type parameter in the beginGradientFill() methods of the egret.Graphics class.
  6633. *
  6634. * @see egret.Graphics#beginGradientFill()
  6635. * @version Egret 2.4
  6636. * @platform Web,Native
  6637. */
  6638. /**
  6639. * @language zh_CN
  6640. * GradientType 类为 egret.Graphics 类的 beginGradientFill() 方法中的 type 参数提供值。
  6641. *
  6642. * @see egret.Graphics#beginGradientFill()
  6643. * @version Egret 2.4
  6644. * @platform Web,Native
  6645. */
  6646. class GradientType {
  6647. /**
  6648. * @language en_US
  6649. * Value used to specify a linear gradient fill.
  6650. * @version Egret 2.4
  6651. * @platform Web,Native
  6652. */
  6653. /**
  6654. * @language zh_CN
  6655. * 用于指定线性渐变填充的值
  6656. * @version Egret 2.4
  6657. * @platform Web,Native
  6658. */
  6659. static LINEAR: string;
  6660. /**
  6661. * @language en_US
  6662. * Value used to specify a radial gradient fill.
  6663. * @version Egret 2.4
  6664. * @platform Web,Native
  6665. */
  6666. /**
  6667. * @language zh_CN
  6668. * 用于指定放射状渐变填充的值
  6669. * @version Egret 2.4
  6670. * @platform Web,Native
  6671. */
  6672. static RADIAL: string;
  6673. }
  6674. }
  6675. declare namespace egret {
  6676. /**
  6677. * @language en_US
  6678. * The Graphics class contains a set of methods for creating vector shape. Display objects that support drawing include Sprite and Shape objects. Each class in these classes includes the graphics attribute that is a Graphics object.
  6679. * The following auxiliary functions are provided for ease of use: drawRect(), drawRoundRect(), drawCircle(), and drawEllipse().
  6680. * @see http://edn.egret.com/cn/docs/page/136 Draw Rectangle
  6681. * @version Egret 2.4
  6682. * @platform Web,Native
  6683. * @includeExample egret/display/Graphics.ts
  6684. */
  6685. /**
  6686. * @language zh_CN
  6687. * Graphics 类包含一组可用来创建矢量形状的方法。支持绘制的显示对象包括 Sprite 和 Shape 对象。这些类中的每一个类都包括 graphics 属性,该属性是一个 Graphics 对象。
  6688. * 以下是为便于使用而提供的一些辅助函数:drawRect()、drawRoundRect()、drawCircle() 和 drawEllipse()。
  6689. * @see http://edn.egret.com/cn/docs/page/136 绘制矩形
  6690. * @version Egret 2.4
  6691. * @platform Web,Native
  6692. * @includeExample egret/display/Graphics.ts
  6693. */
  6694. class Graphics extends HashObject {
  6695. /**
  6696. * @version Egret 2.4
  6697. * @platform Web,Native
  6698. */
  6699. constructor();
  6700. /**
  6701. * @private
  6702. */
  6703. $renderNode: sys.GraphicsNode;
  6704. /**
  6705. * 绑定到的目标显示对象
  6706. */
  6707. private targetDisplay;
  6708. /**
  6709. * @private
  6710. * 设置绑定到的目标显示对象
  6711. */
  6712. $setTarget(target: DisplayObject): void;
  6713. /**
  6714. * 当前移动到的坐标X
  6715. */
  6716. private lastX;
  6717. /**
  6718. * 当前移动到的坐标Y
  6719. */
  6720. private lastY;
  6721. /**
  6722. * 当前正在绘制的填充
  6723. */
  6724. private fillPath;
  6725. /**
  6726. * 当前正在绘制的线条
  6727. */
  6728. private strokePath;
  6729. /**
  6730. * 线条的左上方宽度
  6731. */
  6732. private topLeftStrokeWidth;
  6733. /**
  6734. * 线条的右下方宽度
  6735. */
  6736. private bottomRightStrokeWidth;
  6737. /**
  6738. * 对1像素和3像素特殊处理,向右下角偏移0.5像素,以显示清晰锐利的线条。
  6739. */
  6740. private setStrokeWidth(width);
  6741. /**
  6742. * @language en_US
  6743. * Specify a simple single color fill that will be used for subsequent calls to other Graphics methods (for example, lineTo() and drawCircle()) when drawing.
  6744. * Calling the clear() method will clear the fill.
  6745. * @param color Filled color
  6746. * @param alpha Filled Alpha value
  6747. * @version Egret 2.4
  6748. * @platform Web,Native
  6749. */
  6750. /**
  6751. * @language zh_CN
  6752. * 指定一种简单的单一颜色填充,在绘制时该填充将在随后对其他 Graphics 方法(如 lineTo() 或 drawCircle())的调用中使用。
  6753. * 调用 clear() 方法会清除填充。
  6754. * @param color 填充的颜色
  6755. * @param alpha 填充的 Alpha 值
  6756. * @version Egret 2.4
  6757. * @platform Web,Native
  6758. */
  6759. beginFill(color: number, alpha?: number): void;
  6760. /**
  6761. * @language en_US
  6762. * Specifies a gradient fill used by subsequent calls to other Graphics methods (such as lineTo() or drawCircle()) for the object.
  6763. * Calling the clear() method clears the fill.
  6764. * @param type A value from the GradientType class that specifies which gradient type to use: GradientType.LINEAR or GradientType.RADIAL.
  6765. * @param colors An array of RGB hexadecimal color values used in the gradient; for example, red is 0xFF0000, blue is 0x0000FF, and so on. You can specify up to 15 colors. For each color, specify a corresponding value in the alphas and ratios parameters.
  6766. * @param alphas An array of alpha values for the corresponding colors in the colors array;
  6767. * @param ratios An array of color distribution ratios; valid values are 0-255.
  6768. * @param matrix A transformation matrix as defined by the egret.Matrix class. The egret.Matrix class includes a createGradientBox() method, which lets you conveniently set up the matrix for use with the beginGradientFill() method.
  6769. * @platform Web,Native
  6770. * @version Egret 2.4
  6771. */
  6772. /**
  6773. * @language zh_CN
  6774. * 指定一种渐变填充,用于随后调用对象的其他 Graphics 方法(如 lineTo() 或 drawCircle())。
  6775. * 调用 clear() 方法会清除填充。
  6776. * @param type 用于指定要使用哪种渐变类型的 GradientType 类的值:GradientType.LINEAR 或 GradientType.RADIAL。
  6777. * @param colors 渐变中使用的 RGB 十六进制颜色值的数组(例如,红色为 0xFF0000,蓝色为 0x0000FF,等等)。对于每种颜色,请在 alphas 和 ratios 参数中指定对应值。
  6778. * @param alphas colors 数组中对应颜色的 alpha 值数组。
  6779. * @param ratios 颜色分布比率的数组。有效值为 0 到 255。
  6780. * @param matrix 一个由 egret.Matrix 类定义的转换矩阵。egret.Matrix 类包括 createGradientBox() 方法,通过该方法可以方便地设置矩阵,以便与 beginGradientFill() 方法一起使用
  6781. * @platform Web,Native
  6782. * @version Egret 2.4
  6783. */
  6784. beginGradientFill(type: string, colors: number[], alphas: number[], ratios: number[], matrix?: egret.Matrix): void;
  6785. /**
  6786. * @language en_US
  6787. * Apply fill to the lines and curves added after the previous calling to the beginFill() method.
  6788. * @version Egret 2.4
  6789. * @platform Web,Native
  6790. */
  6791. /**
  6792. * @language zh_CN
  6793. * 对从上一次调用 beginFill()方法之后添加的直线和曲线应用填充。
  6794. * @version Egret 2.4
  6795. * @platform Web,Native
  6796. */
  6797. endFill(): void;
  6798. /**
  6799. * @language en_US
  6800. * Specify a line style that will be used for subsequent calls to Graphics methods such as lineTo() and drawCircle().
  6801. * @param thickness An integer, indicating the thickness of the line in points. Valid values are 0 to 255. If a number is not specified, or if the parameter is undefined, a line is not drawn. If a value less than 0 is passed, the default value is 0. Value 0 indicates hairline thickness; the maximum thickness is 255. If a value greater than 255 is passed, the default value is 255.
  6802. * @param color A hexadecimal color value of the line (for example, red is 0xFF0000, and blue is 0x0000FF, etc.). If no value is specified, the default value is 0x000000 (black). Optional.
  6803. * @param alpha Indicates Alpha value of the line's color. Valid values are 0 to 1. If no value is specified, the default value is 1 (solid). If the value is less than 0, the default value is 0. If the value is greater than 1, the default value is 1.
  6804. * @param pixelHinting A boolean value that specifies whether to hint strokes to full pixels. This affects both the position of anchors of a curve and the line stroke size itself. With pixelHinting set to true, the line width is adjusted to full pixel width. With pixelHinting set to false, disjoints can appear for curves and straight lines.
  6805. * @param scaleMode Specifies the scale mode to be used
  6806. * @param caps Specifies the value of the CapsStyle class of the endpoint type at the end of the line. (default = CapsStyle.ROUND)
  6807. * @param joints Specifies the type of joint appearance of corner. (default = JointStyle.ROUND)
  6808. * @param miterLimit Indicates the limit number of cut miter.
  6809. * @version Egret 2.4
  6810. * @platform Web,Native
  6811. */
  6812. /**
  6813. * @language zh_CN
  6814. * 指定一种线条样式以用于随后对 lineTo() 或 drawCircle() 等 Graphics 方法的调用。
  6815. * @param thickness 一个整数,以点为单位表示线条的粗细,有效值为 0 到 255。如果未指定数字,或者未定义该参数,则不绘制线条。如果传递的值小于 0,则默认值为 0。值 0 表示极细的粗细;最大粗细为 255。如果传递的值大于 255,则默认值为 255。
  6816. * @param color 线条的十六进制颜色值(例如,红色为 0xFF0000,蓝色为 0x0000FF 等)。如果未指明值,则默认值为 0x000000(黑色)。可选。
  6817. * @param alpha 表示线条颜色的 Alpha 值的数字;有效值为 0 到 1。如果未指明值,则默认值为 1(纯色)。如果值小于 0,则默认值为 0。如果值大于 1,则默认值为 1。
  6818. * @param pixelHinting 布尔型值,指定是否提示笔触采用完整像素。它同时影响曲线锚点的位置以及线条笔触大小本身。在 pixelHinting 设置为 true 的情况下,线条宽度会调整到完整像素宽度。在 pixelHinting 设置为 false 的情况下,对于曲线和直线可能会出现脱节。
  6819. * @param scaleMode 用于指定要使用的比例模式
  6820. * @param caps 用于指定线条末端处端点类型的 CapsStyle 类的值。默认值:CapsStyle.ROUND
  6821. * @param joints 指定用于拐角的连接外观的类型。默认值:JointStyle.ROUND
  6822. * @param miterLimit 用于表示剪切斜接的极限值的数字。
  6823. * @version Egret 2.4
  6824. * @platform Web,Native
  6825. */
  6826. lineStyle(thickness?: number, color?: number, alpha?: number, pixelHinting?: boolean, scaleMode?: string, caps?: string, joints?: string, miterLimit?: number): void;
  6827. /**
  6828. * @language en_US
  6829. * Draw a rectangle
  6830. * @param x x position of the center, relative to the registration point of the parent display object (in pixels).
  6831. * @param y y position of the center, relative to the registration point of the parent display object (in pixels).
  6832. * @param width Width of the rectangle (in pixels).
  6833. * @param height Height of the rectangle (in pixels).
  6834. * @version Egret 2.4
  6835. * @platform Web,Native
  6836. */
  6837. /**
  6838. * @language zh_CN
  6839. * 绘制一个矩形
  6840. * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
  6841. * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
  6842. * @param width 矩形的宽度(以像素为单位)。
  6843. * @param height 矩形的高度(以像素为单位)。
  6844. * @version Egret 2.4
  6845. * @platform Web,Native
  6846. */
  6847. drawRect(x: number, y: number, width: number, height: number): void;
  6848. /**
  6849. * @language en_US
  6850. * Draw a rectangle with rounded corners.
  6851. * @param x x position of the center, relative to the registration point of the parent display object (in pixels).
  6852. * @param y y position of the center, relative to the registration point of the parent display object (in pixels).
  6853. * @param width Width of the rectangle (in pixels).
  6854. * @param height Height of the rectangle (in pixels).
  6855. * @param ellipseWidth Width used to draw an ellipse with rounded corners (in pixels).
  6856. * @param ellipseHeight Height used to draw an ellipse with rounded corners (in pixels). (Optional) If no value is specified, the default value matches the value of the ellipseWidth parameter.
  6857. * @version Egret 2.4
  6858. * @platform Web,Native
  6859. */
  6860. /**
  6861. * @language zh_CN
  6862. * 绘制一个圆角矩形。
  6863. * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
  6864. * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
  6865. * @param width 矩形的宽度(以像素为单位)。
  6866. * @param height 矩形的高度(以像素为单位)。
  6867. * @param ellipseWidth 用于绘制圆角的椭圆的宽度(以像素为单位)。
  6868. * @param ellipseHeight 用于绘制圆角的椭圆的高度(以像素为单位)。 (可选)如果未指定值,则默认值与为 ellipseWidth 参数提供的值相匹配。
  6869. * @version Egret 2.4
  6870. * @platform Web,Native
  6871. */
  6872. drawRoundRect(x: number, y: number, width: number, height: number, ellipseWidth: number, ellipseHeight?: number): void;
  6873. /**
  6874. * @language en_US
  6875. * Draw a circle.
  6876. * @param x x position of the center, relative to the registration point of the parent display object (in pixels).
  6877. * @param y y position of the center, relative to the registration point of the parent display object (in pixels).
  6878. * @param r Radius of the circle (in pixels).
  6879. * @version Egret 2.4
  6880. * @platform Web,Native
  6881. */
  6882. /**
  6883. * @language zh_CN
  6884. * 绘制一个圆。
  6885. * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
  6886. * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
  6887. * @param radius 圆的半径(以像素为单位)。
  6888. * @version Egret 2.4
  6889. * @platform Web,Native
  6890. */
  6891. drawCircle(x: number, y: number, radius: number): void;
  6892. /**
  6893. * @language en_US
  6894. * Draw an ellipse.
  6895. * @param x A number indicating the horizontal position, relative to the registration point of the parent display object (in pixels).
  6896. * @param y A number indicating the vertical position, relative to the registration point of the parent display object (in pixels).
  6897. * @param width Width of the rectangle (in pixels).
  6898. * @param height Height of the rectangle (in pixels).
  6899. * @version Egret 2.4
  6900. * @platform Web,Native
  6901. */
  6902. /**
  6903. * @language zh_CN
  6904. * 绘制一个椭圆。
  6905. * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
  6906. * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
  6907. * @param width 矩形的宽度(以像素为单位)。
  6908. * @param height 矩形的高度(以像素为单位)。
  6909. * @version Egret 2.4
  6910. * @platform Web,Native
  6911. */
  6912. drawEllipse(x: number, y: number, width: number, height: number): void;
  6913. /**
  6914. * @language en_US
  6915. * Move the current drawing position to (x, y). If any of these parameters is missed, calling this method will fail and the current drawing position keeps unchanged.
  6916. * @param x A number indicating the horizontal position, relative to the registration point of the parent display object (in pixels).
  6917. * @param y A number indicating the vertical position, relative to the registration point of the parent display object (in pixels).
  6918. * @version Egret 2.4
  6919. * @platform Web,Native
  6920. */
  6921. /**
  6922. * @language zh_CN
  6923. * 将当前绘图位置移动到 (x, y)。如果缺少任何一个参数,则此方法将失败,并且当前绘图位置不改变。
  6924. * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
  6925. * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
  6926. * @version Egret 2.4
  6927. * @platform Web,Native
  6928. */
  6929. moveTo(x: number, y: number): void;
  6930. /**
  6931. * @language en_US
  6932. * Draw a straight line from the current drawing position to (x, y) using the current line style; the current drawing position is then set to (x, y).
  6933. * @param x A number indicating the horizontal position, relative to the registration point of the parent display object (in pixels).
  6934. * @param y A number indicating the vertical position, relative to the registration point of the parent display object (in pixels).
  6935. * @version Egret 2.4
  6936. * @platform Web,Native
  6937. */
  6938. /**
  6939. * @language zh_CN
  6940. * 使用当前线条样式绘制一条从当前绘图位置开始到 (x, y) 结束的直线;当前绘图位置随后会设置为 (x, y)。
  6941. * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
  6942. * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
  6943. * @version Egret 2.4
  6944. * @platform Web,Native
  6945. */
  6946. lineTo(x: number, y: number): void;
  6947. /**
  6948. * @language en_US
  6949. * Draw a quadratic Bezier curve from the current drawing position to (anchorX, anchorY) using the current line style according to the control points specified by (controlX, controlY). The current drawing position is then set to (anchorX, anchorY).
  6950. * If the curveTo() method is called before the moveTo() method, the default value of the current drawing position is (0, 0). If any of these parameters is missed, calling this method will fail and the current drawing position keeps unchanged.
  6951. * The drawn curve is a quadratic Bezier curve. A quadratic Bezier curve contains two anchor points and one control point. The curve interpolates the two anchor points and bends to the control point.
  6952. * @param controlX A number indicating the horizontal position of the control point, relative to the registration point of the parent display object.
  6953. * @param controlY A number indicating the vertical position of the control point, relative to the registration point of the parent display object.
  6954. * @param anchorX A number indicating the horizontal position of the next anchor point, relative to the registration point of the parent display object.
  6955. * @param anchorY A number indicating the vertical position of the next anchor point, relative to the registration point of the parent display object.
  6956. * @version Egret 2.4
  6957. * @platform Web,Native
  6958. */
  6959. /**
  6960. * @language zh_CN
  6961. * 使用当前线条样式和由 (controlX, controlY) 指定的控制点绘制一条从当前绘图位置开始到 (anchorX, anchorY) 结束的二次贝塞尔曲线。当前绘图位置随后设置为 (anchorX, anchorY)。
  6962. * 如果在调用 moveTo() 方法之前调用了 curveTo() 方法,则当前绘图位置的默认值为 (0, 0)。如果缺少任何一个参数,则此方法将失败,并且当前绘图位置不改变。
  6963. * 绘制的曲线是二次贝塞尔曲线。二次贝塞尔曲线包含两个锚点和一个控制点。该曲线内插这两个锚点,并向控制点弯曲。
  6964. * @param controlX 一个数字,指定控制点相对于父显示对象注册点的水平位置。
  6965. * @param controlY 一个数字,指定控制点相对于父显示对象注册点的垂直位置。
  6966. * @param anchorX 一个数字,指定下一个锚点相对于父显示对象注册点的水平位置。
  6967. * @param anchorY 一个数字,指定下一个锚点相对于父显示对象注册点的垂直位置。
  6968. * @version Egret 2.4
  6969. * @platform Web,Native
  6970. */
  6971. curveTo(controlX: number, controlY: number, anchorX: number, anchorY: number): void;
  6972. /**
  6973. * @language en_US
  6974. * Draws a cubic Bezier curve from the current drawing position to the specified anchor. Cubic Bezier curves consist of two anchor points and two control points. The curve interpolates the two anchor points and two control points to the curve.
  6975. * @param controlX1 Specifies the first control point relative to the registration point of the parent display the horizontal position of the object.
  6976. * @param controlY1 Specifies the first control point relative to the registration point of the parent display the vertical position of the object.
  6977. * @param controlX2 Specify the second control point relative to the registration point of the parent display the horizontal position of the object.
  6978. * @param controlY2 Specify the second control point relative to the registration point of the parent display the vertical position of the object.
  6979. * @param anchorX Specifies the anchor point relative to the registration point of the parent display the horizontal position of the object.
  6980. * @param anchorY Specifies the anchor point relative to the registration point of the parent display the vertical position of the object.
  6981. * @version Egret 2.4
  6982. * @platform Web,Native
  6983. */
  6984. /**
  6985. * @language zh_CN
  6986. * 从当前绘图位置到指定的锚点绘制一条三次贝塞尔曲线。三次贝塞尔曲线由两个锚点和两个控制点组成。该曲线内插这两个锚点,并向两个控制点弯曲。
  6987. * @param controlX1 指定首个控制点相对于父显示对象的注册点的水平位置。
  6988. * @param controlY1 指定首个控制点相对于父显示对象的注册点的垂直位置。
  6989. * @param controlX2 指定第二个控制点相对于父显示对象的注册点的水平位置。
  6990. * @param controlY2 指定第二个控制点相对于父显示对象的注册点的垂直位置。
  6991. * @param anchorX 指定锚点相对于父显示对象的注册点的水平位置。
  6992. * @param anchorY 指定锚点相对于父显示对象的注册点的垂直位置。
  6993. * @version Egret 2.4
  6994. * @platform Web,Native
  6995. */
  6996. cubicCurveTo(controlX1: number, controlY1: number, controlX2: number, controlY2: number, anchorX: number, anchorY: number): void;
  6997. /**
  6998. * @language en_US
  6999. * adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending
  7000. * at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
  7001. * @param x The x coordinate of the arc's center.
  7002. * @param y The y coordinate of the arc's center.
  7003. * @param radius The arc's radius.
  7004. * @param startAngle The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.
  7005. * @param endAngle The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.
  7006. * @param anticlockwise if true, causes the arc to be drawn counter-clockwise between the two angles. By default it is drawn clockwise.
  7007. * @version Egret 2.4
  7008. * @platform Web,Native
  7009. */
  7010. /**
  7011. * @language zh_CN
  7012. * 绘制一段圆弧路径。圆弧路径的圆心在 (x, y) 位置,半径为 r ,根据anticlockwise (默认为顺时针)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
  7013. * @param x 圆弧中心(圆心)的 x 轴坐标。
  7014. * @param y 圆弧中心(圆心)的 y 轴坐标。
  7015. * @param radius 圆弧的半径。
  7016. * @param startAngle 圆弧的起始点, x轴方向开始计算,单位以弧度表示。
  7017. * @param endAngle 圆弧的终点, 单位以弧度表示。
  7018. * @param anticlockwise 如果为 true,逆时针绘制圆弧,反之,顺时针绘制。
  7019. * @version Egret 2.4
  7020. * @platform Web,Native
  7021. */
  7022. drawArc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
  7023. /**
  7024. * @private
  7025. * 测量圆弧的矩形大小
  7026. */
  7027. private arcBounds(x, y, radius, startAngle, endAngle);
  7028. /**
  7029. * @language en_US
  7030. * Clear graphics that are drawn to this Graphics object, and reset fill and line style settings.
  7031. * @version Egret 2.4
  7032. * @platform Web,Native
  7033. */
  7034. /**
  7035. * @language zh_CN
  7036. * 清除绘制到此 Graphics 对象的图形,并重置填充和线条样式设置。
  7037. * @version Egret 2.4
  7038. * @platform Web,Native
  7039. */
  7040. clear(): void;
  7041. /**
  7042. * @private
  7043. */
  7044. private minX;
  7045. /**
  7046. * @private
  7047. */
  7048. private minY;
  7049. /**
  7050. * @private
  7051. */
  7052. private maxX;
  7053. /**
  7054. * @private
  7055. */
  7056. private maxY;
  7057. /**
  7058. * @private
  7059. */
  7060. private extendBoundsByPoint(x, y);
  7061. /**
  7062. * @private
  7063. */
  7064. private extendBoundsByX(x);
  7065. /**
  7066. * @private
  7067. */
  7068. private extendBoundsByY(y);
  7069. /**
  7070. * @private
  7071. */
  7072. private updateNodeBounds();
  7073. /**
  7074. * 是否已经包含上一次moveTo的坐标点
  7075. */
  7076. private includeLastPosition;
  7077. /**
  7078. * 更新当前的lineX和lineY值,并标记尺寸失效。
  7079. * @private
  7080. */
  7081. private updatePosition(x, y);
  7082. /**
  7083. * @private
  7084. */
  7085. $measureContentBounds(bounds: Rectangle): void;
  7086. /**
  7087. * @private
  7088. *
  7089. */
  7090. $hitTest(stageX: number, stageY: number): DisplayObject;
  7091. /**
  7092. * @private
  7093. */
  7094. $onRemoveFromStage(): void;
  7095. }
  7096. }
  7097. declare namespace egret {
  7098. /**
  7099. * @language en_US
  7100. * The Matrix class represents a transformation matrix that determines how to map points from one coordinate space to
  7101. * another. You can perform various graphical transformations on a display object by setting the properties of a Matrix
  7102. * object, applying that Matrix object to the matrix property of a display object, These transformation functions include
  7103. * translation (x and y repositioning), rotation, scaling, and skewing.
  7104. * @version Egret 2.4
  7105. * @platform Web,Native
  7106. * @includeExample egret/geom/Matrix.ts
  7107. */
  7108. /**
  7109. * @language zh_CN
  7110. * Matrix 类表示一个转换矩阵,它确定如何将点从一个坐标空间映射到另一个坐标空间。
  7111. * 您可以对一个显示对象执行不同的图形转换,方法是设置 Matrix 对象的属性,将该 Matrix
  7112. * 对象应用于显示对象的 matrix 属性。这些转换函数包括平移(x 和 y 重新定位)、旋转、缩放和倾斜。
  7113. * @version Egret 2.4
  7114. * @platform Web,Native
  7115. * @includeExample egret/geom/Matrix.ts
  7116. */
  7117. class Matrix extends HashObject {
  7118. /**
  7119. * @language en_US
  7120. * Releases a matrix instance to the object pool
  7121. * @param matrix matrix that Needs to be recycled
  7122. * @version Egret 2.4
  7123. * @platform Web,Native
  7124. */
  7125. /**
  7126. * @language zh_CN
  7127. * 释放一个Matrix实例到对象池
  7128. * @param matrix 需要回收的 matrix
  7129. * @version Egret 2.4
  7130. * @platform Web,Native
  7131. */
  7132. static release(matrix: Matrix): void;
  7133. /**
  7134. * @language en_US
  7135. * get a matrix instance from the object pool or create a new one.
  7136. * @version Egret 2.4
  7137. * @platform Web,Native
  7138. */
  7139. /**
  7140. * @language zh_CN
  7141. * 从对象池中取出或创建一个新的Matrix对象。
  7142. * @version Egret 2.4
  7143. * @platform Web,Native
  7144. */
  7145. static create(): Matrix;
  7146. /**
  7147. * @language en_US
  7148. * Creates a new Matrix object with the specified parameters.
  7149. * @param a The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  7150. * @param b The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  7151. * @param c The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  7152. * @param d The value that affects the positioning of pixels along the y axis when scaling or rotating an image..
  7153. * @param tx The distance by which to translate each point along the x axis.
  7154. * @param ty The distance by which to translate each point along the y axis.
  7155. * @version Egret 2.4
  7156. * @platform Web,Native
  7157. */
  7158. /**
  7159. * @language zh_CN
  7160. * 使用指定参数创建一个 Matrix 对象
  7161. * @param a 缩放或旋转图像时影响像素沿 x 轴定位的值。
  7162. * @param b 旋转或倾斜图像时影响像素沿 y 轴定位的值。
  7163. * @param c 旋转或倾斜图像时影响像素沿 x 轴定位的值。
  7164. * @param d 缩放或旋转图像时影响像素沿 y 轴定位的值。
  7165. * @param tx 沿 x 轴平移每个点的距离。
  7166. * @param ty 沿 y 轴平移每个点的距离。
  7167. * @version Egret 2.4
  7168. * @platform Web,Native
  7169. */
  7170. constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
  7171. /**
  7172. * @language en_US
  7173. * The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  7174. * @default 1
  7175. * @version Egret 2.4
  7176. * @platform Web,Native
  7177. */
  7178. /**
  7179. * @language zh_CN
  7180. * 缩放或旋转图像时影响像素沿 x 轴定位的值
  7181. * @default 1
  7182. * @version Egret 2.4
  7183. * @platform Web,Native
  7184. */
  7185. a: number;
  7186. /**
  7187. * @language en_US
  7188. * The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  7189. * @default 0
  7190. * @version Egret 2.4
  7191. * @platform Web,Native
  7192. */
  7193. /**
  7194. * @language zh_CN
  7195. * 旋转或倾斜图像时影响像素沿 y 轴定位的值
  7196. * @default 0
  7197. * @version Egret 2.4
  7198. * @platform Web,Native
  7199. */
  7200. b: number;
  7201. /**
  7202. * @language en_US
  7203. * The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  7204. * @default 0
  7205. * @version Egret 2.4
  7206. * @platform Web,Native
  7207. */
  7208. /**
  7209. * @language zh_CN
  7210. * 旋转或倾斜图像时影响像素沿 x 轴定位的值
  7211. * @default 0
  7212. * @version Egret 2.4
  7213. * @platform Web,Native
  7214. */
  7215. c: number;
  7216. /**
  7217. * @language en_US
  7218. * The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
  7219. * @default 1
  7220. * @version Egret 2.4
  7221. * @platform Web,Native
  7222. */
  7223. /**
  7224. * @language zh_CN
  7225. * 缩放或旋转图像时影响像素沿 y 轴定位的值
  7226. * @default 1
  7227. * @version Egret 2.4
  7228. * @platform Web,Native
  7229. */
  7230. d: number;
  7231. /**
  7232. * @language en_US
  7233. * The distance by which to translate each point along the x axis.
  7234. * @default 0
  7235. * @version Egret 2.4
  7236. * @platform Web,Native
  7237. */
  7238. /**
  7239. * @language zh_CN
  7240. * 沿 x 轴平移每个点的距离
  7241. * @default 0
  7242. * @version Egret 2.4
  7243. * @platform Web,Native
  7244. */
  7245. tx: number;
  7246. /**
  7247. * @language en_US
  7248. * The distance by which to translate each point along the y axis.
  7249. * @default 0
  7250. * @version Egret 2.4
  7251. * @platform Web,Native
  7252. */
  7253. /**
  7254. * @language zh_CN
  7255. * 沿 y 轴平移每个点的距离
  7256. * @default 0
  7257. * @version Egret 2.4
  7258. * @platform Web,Native
  7259. */
  7260. ty: number;
  7261. /**
  7262. * @language en_US
  7263. * Returns a new Matrix object that is a clone of this matrix, with an exact copy of the contained object.
  7264. * @version Egret 2.4
  7265. * @platform Web,Native
  7266. */
  7267. /**
  7268. * @language zh_CN
  7269. * 返回一个新的 Matrix 对象,它是此矩阵的克隆,带有与所含对象完全相同的副本。
  7270. * @version Egret 2.4
  7271. * @platform Web,Native
  7272. */
  7273. clone(): Matrix;
  7274. /**
  7275. * @language en_US
  7276. * Concatenates a matrix with the current matrix, effectively combining the geometric effects of the two. In mathematical
  7277. * terms, concatenating two matrixes is the same as combining them using matrix multiplication.
  7278. * @param other The matrix to be concatenated to the source matrix.
  7279. * @version Egret 2.4
  7280. * @platform Web,Native
  7281. */
  7282. /**
  7283. * @language zh_CN
  7284. * 将某个矩阵与当前矩阵连接,从而将这两个矩阵的几何效果有效地结合在一起。在数学术语中,将两个矩阵连接起来与使用矩阵乘法将它们结合起来是相同的。
  7285. * @param other 要连接到源矩阵的矩阵。
  7286. * @version Egret 2.4
  7287. * @platform Web,Native
  7288. */
  7289. concat(other: Matrix): void;
  7290. /**
  7291. * @language en_US
  7292. * Copies all of the matrix data from the source Point object into the calling Matrix object.
  7293. * @param other The Matrix object from which to copy the data.
  7294. * @version Egret 2.4
  7295. * @platform Web,Native
  7296. */
  7297. /**
  7298. * @language zh_CN
  7299. * 将源 Matrix 对象中的所有矩阵数据复制到调用方 Matrix 对象中。
  7300. * @param other 要拷贝的目标矩阵
  7301. * @version Egret 2.4
  7302. * @platform Web,Native
  7303. */
  7304. copyFrom(other: Matrix): Matrix;
  7305. /**
  7306. * @language en_US
  7307. * Sets each matrix property to a value that causes a null transformation. An object transformed by applying an
  7308. * identity matrix will be identical to the original. After calling the identity() method, the resulting matrix
  7309. * has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
  7310. * @version Egret 2.4
  7311. * @platform Web,Native
  7312. */
  7313. /**
  7314. * @language zh_CN
  7315. * 为每个矩阵属性设置一个值,该值将导致矩阵无转换。通过应用恒等矩阵转换的对象将与原始对象完全相同。
  7316. * 调用 identity() 方法后,生成的矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0 和 ty=0。
  7317. * @version Egret 2.4
  7318. * @platform Web,Native
  7319. */
  7320. identity(): void;
  7321. /**
  7322. * @language en_US
  7323. * Performs the opposite transformation of the original matrix. You can apply an inverted matrix to an object to
  7324. * undo the transformation performed when applying the original matrix.
  7325. * @version Egret 2.4
  7326. * @platform Web,Native
  7327. */
  7328. /**
  7329. * @language zh_CN
  7330. * 执行原始矩阵的逆转换。
  7331. * 您可以将一个逆矩阵应用于对象来撤消在应用原始矩阵时执行的转换。
  7332. * @version Egret 2.4
  7333. * @platform Web,Native
  7334. */
  7335. invert(): void;
  7336. /**
  7337. * @private
  7338. */
  7339. $invertInto(target: Matrix): void;
  7340. /**
  7341. * @language en_US
  7342. * Applies a rotation transformation to the Matrix object.
  7343. * The rotate() method alters the a, b, c, and d properties of the Matrix object.
  7344. * @param angle The rotation angle in radians.
  7345. * @version Egret 2.4
  7346. * @platform Web,Native
  7347. */
  7348. /**
  7349. * @language zh_CN
  7350. * 对 Matrix 对象应用旋转转换。
  7351. * rotate() 方法将更改 Matrix 对象的 a、b、c 和 d 属性。
  7352. * @param angle 以弧度为单位的旋转角度。
  7353. * @version Egret 2.4
  7354. * @platform Web,Native
  7355. */
  7356. rotate(angle: number): void;
  7357. /**
  7358. * @language en_US
  7359. * Applies a scaling transformation to the matrix. The x axis is multiplied by sx, and the y axis it is multiplied by sy.
  7360. * The scale() method alters the a and d properties of the Matrix object.
  7361. * @param sx A multiplier used to scale the object along the x axis.
  7362. * @param sy A multiplier used to scale the object along the y axis.
  7363. * @version Egret 2.4
  7364. * @platform Web,Native
  7365. */
  7366. /**
  7367. * @language zh_CN
  7368. * 对矩阵应用缩放转换。x 轴乘以 sx,y 轴乘以 sy。
  7369. * scale() 方法将更改 Matrix 对象的 a 和 d 属性。
  7370. * @param sx 用于沿 x 轴缩放对象的乘数。
  7371. * @param sy 用于沿 y 轴缩放对象的乘数。
  7372. * @version Egret 2.4
  7373. * @platform Web,Native
  7374. */
  7375. scale(sx: number, sy: number): void;
  7376. /**
  7377. * @language en_US
  7378. * Sets the members of Matrix to the specified values
  7379. * @param a The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  7380. * @param b The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  7381. * @param c The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  7382. * @param d The value that affects the positioning of pixels along the y axis when scaling or rotating an image..
  7383. * @param tx The distance by which to translate each point along the x axis.
  7384. * @param ty The distance by which to translate each point along the y axis.
  7385. * @version Egret 2.4
  7386. * @platform Web,Native
  7387. */
  7388. /**
  7389. * @language zh_CN
  7390. * 将 Matrix 的成员设置为指定值
  7391. * @param a 缩放或旋转图像时影响像素沿 x 轴定位的值。
  7392. * @param b 旋转或倾斜图像时影响像素沿 y 轴定位的值。
  7393. * @param c 旋转或倾斜图像时影响像素沿 x 轴定位的值。
  7394. * @param d 缩放或旋转图像时影响像素沿 y 轴定位的值。
  7395. * @param tx 沿 x 轴平移每个点的距离。
  7396. * @param ty 沿 y 轴平移每个点的距离。
  7397. * @version Egret 2.4
  7398. * @platform Web,Native
  7399. */
  7400. setTo(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
  7401. /**
  7402. * @language en_US
  7403. * Returns the result of applying the geometric transformation represented by the Matrix object to the specified point.
  7404. * @param pointX The x coordinate for which you want to get the result of the Matrix transformation.
  7405. * @param pointY The y coordinate for which you want to get the result of the Matrix transformation.
  7406. * @param resultPoint A reusable instance of Point for saving the results. Passing this parameter can reduce the
  7407. * number of reallocate objects, which allows you to get better code execution performance.
  7408. * @returns The point resulting from applying the Matrix transformation.
  7409. * @version Egret 2.4
  7410. * @platform Web,Native
  7411. */
  7412. /**
  7413. * @language zh_CN
  7414. * 返回将 Matrix 对象表示的几何转换应用于指定点所产生的结果。
  7415. * @param pointX 想要获得其矩阵转换结果的点的x坐标。
  7416. * @param pointY 想要获得其矩阵转换结果的点的y坐标。
  7417. * @param resultPoint 框架建议尽可能减少创建对象次数来优化性能,可以从外部传入一个复用的Point对象来存储结果,若不传入将创建一个新的Point对象返回。
  7418. * @returns 由应用矩阵转换所产生的点。
  7419. * @version Egret 2.4
  7420. * @platform Web,Native
  7421. */
  7422. transformPoint(pointX: number, pointY: number, resultPoint?: Point): Point;
  7423. /**
  7424. * @language en_US
  7425. * Translates the matrix along the x and y axes, as specified by the dx and dy parameters.
  7426. * @param dx The amount of movement along the x axis to the right, in pixels.
  7427. * @param dy The amount of movement down along the y axis, in pixels.
  7428. * @version Egret 2.4
  7429. * @platform Web,Native
  7430. */
  7431. /**
  7432. * @language zh_CN
  7433. * 沿 x 和 y 轴平移矩阵,由 dx 和 dy 参数指定。
  7434. * @param dx 沿 x 轴向右移动的量(以像素为单位)。
  7435. * @param dy 沿 y 轴向下移动的量(以像素为单位)。
  7436. * @version Egret 2.4
  7437. * @platform Web,Native
  7438. */
  7439. translate(dx: number, dy: number): void;
  7440. /**
  7441. * @language en_US
  7442. * Determines whether two matrixes are equal.
  7443. * @param other The matrix to be compared.
  7444. * @returns A value of true if the object is equal to this Matrix object; false if it is not equal.
  7445. * @version Egret 2.4
  7446. * @platform Web,Native
  7447. */
  7448. /**
  7449. * @language zh_CN
  7450. * 是否与另一个矩阵数据相等
  7451. * @param other 要比较的另一个矩阵对象。
  7452. * @returns 是否相等,ture表示相等。
  7453. * @version Egret 2.4
  7454. * @platform Web,Native
  7455. */
  7456. equals(other: Matrix): boolean;
  7457. /**
  7458. * @language en_US
  7459. * prepend matrix
  7460. * @param a The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  7461. * @param b The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  7462. * @param c The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  7463. * @param d The value that affects the positioning of pixels along the y axis when scaling or rotating an image..
  7464. * @param tx The distance by which to translate each point along the x axis.
  7465. * @param ty The distance by which to translate each point along the y axis.
  7466. * @returns matrix
  7467. * @version Egret 2.4
  7468. * @platform Web,Native
  7469. */
  7470. /**
  7471. * @language zh_CN
  7472. * 前置矩阵
  7473. * @param a 缩放或旋转图像时影响像素沿 x 轴定位的值
  7474. * @param b 缩放或旋转图像时影响像素沿 y 轴定位的值
  7475. * @param c 缩放或旋转图像时影响像素沿 x 轴定位的值
  7476. * @param d 缩放或旋转图像时影响像素沿 y 轴定位的值
  7477. * @param tx 沿 x 轴平移每个点的距离
  7478. * @param ty 沿 y 轴平移每个点的距离
  7479. * @returns 矩阵自身
  7480. * @version Egret 2.4
  7481. * @platform Web,Native
  7482. */
  7483. prepend(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
  7484. /**
  7485. * @language en_US
  7486. * append matrix
  7487. * @param a The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  7488. * @param b The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  7489. * @param c The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  7490. * @param d The value that affects the positioning of pixels along the y axis when scaling or rotating an image..
  7491. * @param tx The distance by which to translate each point along the x axis.
  7492. * @param ty The distance by which to translate each point along the y axis.
  7493. * @returns matrix
  7494. * @version Egret 2.4
  7495. * @platform Web,Native
  7496. */
  7497. /**
  7498. * @language zh_CN
  7499. * 后置矩阵
  7500. * @param a 缩放或旋转图像时影响像素沿 x 轴定位的值
  7501. * @param b 缩放或旋转图像时影响像素沿 y 轴定位的值
  7502. * @param c 缩放或旋转图像时影响像素沿 x 轴定位的值
  7503. * @param d 缩放或旋转图像时影响像素沿 y 轴定位的值
  7504. * @param tx 沿 x 轴平移每个点的距离
  7505. * @param ty 沿 y 轴平移每个点的距离
  7506. * @returns 矩阵自身
  7507. * @version Egret 2.4
  7508. * @platform Web,Native
  7509. */
  7510. append(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
  7511. /**
  7512. * @language en_US
  7513. * Given a point in the pretransform coordinate space, returns the coordinates of that point after the transformation occurs.
  7514. * Unlike the standard transformation applied using the transformPoint() method, the deltaTransformPoint() method's transformation does not consider the translation parameters tx and ty.
  7515. * @param point The point for which you want to get the result of the matrix transformation.
  7516. * @returns The point resulting from applying the matrix transformation.
  7517. * @version Egret 2.4
  7518. * @platform Web,Native
  7519. */
  7520. /**
  7521. * @language zh_CN
  7522. * 如果给定预转换坐标空间中的点,则此方法返回发生转换后该点的坐标。
  7523. * 与使用 transformPoint() 方法应用的标准转换不同,deltaTransformPoint() 方法的转换不考虑转换参数 tx 和 ty。
  7524. * @param point 想要获得其矩阵转换结果的点
  7525. * @returns 由应用矩阵转换所产生的点
  7526. * @version Egret 2.4
  7527. * @platform Web,Native
  7528. */
  7529. deltaTransformPoint(point: Point): Point;
  7530. /**
  7531. * @language en_US
  7532. * Returns a text value listing the properties of the Matrix object.
  7533. * @returns A string containing the values of the properties of the Matrix object: a, b, c, d, tx, and ty.
  7534. * @version Egret 2.4
  7535. * @platform Web,Native
  7536. */
  7537. /**
  7538. * @language zh_CN
  7539. * 返回将 Matrix 对象表示的几何转换应用于指定点所产生的结果。
  7540. * @returns 一个字符串,它包含 Matrix 对象的属性值:a、b、c、d、tx 和 ty。
  7541. * @version Egret 2.4
  7542. * @platform Web,Native
  7543. */
  7544. toString(): string;
  7545. /**
  7546. * @language en_US
  7547. * Includes parameters for scaling, rotation, and translation. When applied to a matrix it sets the matrix's values based on those parameters.
  7548. * @param scaleX The factor by which to scale horizontally.
  7549. * @param scaleY The factor by which scale vertically.
  7550. * @param rotation The amount to rotate, in radians.
  7551. * @param tx The number of pixels to translate (move) to the right along the x axis.
  7552. * @param ty The number of pixels to translate (move) down along the y axis.
  7553. * @version Egret 2.4
  7554. * @platform Web,Native
  7555. */
  7556. /**
  7557. * @language zh_CN
  7558. * 包括用于缩放、旋转和转换的参数。当应用于矩阵时,该方法会基于这些参数设置矩阵的值。
  7559. * @param scaleX 水平缩放所用的系数
  7560. * @param scaleY 垂直缩放所用的系数
  7561. * @param rotation 旋转量(以弧度为单位)
  7562. * @param tx 沿 x 轴向右平移(移动)的像素数
  7563. * @param ty 沿 y 轴向下平移(移动)的像素数
  7564. * @version Egret 2.4
  7565. * @platform Web,Native
  7566. */
  7567. createBox(scaleX: number, scaleY: number, rotation?: number, tx?: number, ty?: number): void;
  7568. /**
  7569. * @language en_US
  7570. * Creates the specific style of matrix expected by the beginGradientFill() and lineGradientStyle() methods of the Graphics class.
  7571. * Width and height are scaled to a scaleX/scaleY pair and the tx/ty values are offset by half the width and height.
  7572. * @param width The width of the gradient box.
  7573. * @param height The height of the gradient box.
  7574. * @param rotation The amount to rotate, in radians.
  7575. * @param tx The distance, in pixels, to translate to the right along the x axis. This value is offset by half of the width parameter.
  7576. * @param ty The distance, in pixels, to translate down along the y axis. This value is offset by half of the height parameter.
  7577. * @version Egret 2.4
  7578. * @platform Web,Native
  7579. */
  7580. /**
  7581. * @language zh_CN
  7582. * 创建 Graphics 类的 beginGradientFill() 和 lineGradientStyle() 方法所需的矩阵的特定样式。
  7583. * 宽度和高度被缩放为 scaleX/scaleY 对,而 tx/ty 值偏移了宽度和高度的一半。
  7584. * @param width 渐变框的宽度
  7585. * @param height 渐变框的高度
  7586. * @param rotation 旋转量(以弧度为单位)
  7587. * @param tx 沿 x 轴向右平移的距离(以像素为单位)。此值将偏移 width 参数的一半
  7588. * @param ty 沿 y 轴向下平移的距离(以像素为单位)。此值将偏移 height 参数的一半
  7589. * @version Egret 2.4
  7590. * @platform Web,Native
  7591. */
  7592. createGradientBox(width: number, height: number, rotation?: number, tx?: number, ty?: number): void;
  7593. /**
  7594. * @private
  7595. */
  7596. $transformBounds(bounds: Rectangle): void;
  7597. /**
  7598. * @private
  7599. */
  7600. private getDeterminant();
  7601. /**
  7602. * @private
  7603. */
  7604. $getScaleX(): number;
  7605. /**
  7606. * @private
  7607. */
  7608. $getScaleY(): number;
  7609. /**
  7610. * @private
  7611. */
  7612. $getSkewX(): number;
  7613. /**
  7614. * @private
  7615. */
  7616. $getSkewY(): number;
  7617. /**
  7618. * @private
  7619. */
  7620. $updateScaleAndRotation(scaleX: number, scaleY: number, skewX: number, skewY: number): void;
  7621. /**
  7622. * @private
  7623. * target = other * this
  7624. */
  7625. $preMultiplyInto(other: Matrix, target: Matrix): void;
  7626. }
  7627. /**
  7628. * @private
  7629. * 仅供框架内复用,要防止暴露引用到外部。
  7630. */
  7631. let $TempMatrix: Matrix;
  7632. }
  7633. declare namespace egret {
  7634. /**
  7635. * @language en_US
  7636. * The JointStyle class is an enumeration of constant values that specify the joint style to use in drawing lines.
  7637. * These constants are provided for use as values in the joints parameter of the egret.Graphics.lineStyle() method.
  7638. * @see egret.Graphics#lineStyle()
  7639. * @version Egret 2.5
  7640. * @platform Web,Native
  7641. */
  7642. /**
  7643. * @language zh_CN
  7644. * JointStyle 类是指定要在绘制线条中使用的联接点样式的常量值枚举。提供的这些常量用作 egret.Graphics.lineStyle() 方法的 joints 参数中的值。
  7645. * @see egret.Graphics#lineStyle()
  7646. * @version Egret 2.5
  7647. * @platform Web,Native
  7648. */
  7649. const JointStyle: {
  7650. BEVEL: string;
  7651. MITER: string;
  7652. ROUND: string;
  7653. };
  7654. }
  7655. declare namespace egret {
  7656. }
  7657. declare namespace egret {
  7658. /**
  7659. * @private
  7660. */
  7661. class Mesh extends Bitmap {
  7662. constructor(value?: BitmapData | Texture);
  7663. /**
  7664. * @private
  7665. */
  7666. $render(): void;
  7667. /**
  7668. * @private
  7669. */
  7670. private _verticesDirty;
  7671. private _bounds;
  7672. /**
  7673. * @private
  7674. */
  7675. $updateVertices(): void;
  7676. /**
  7677. * @private
  7678. */
  7679. $measureContentBounds(bounds: Rectangle): void;
  7680. }
  7681. }
  7682. declare namespace egret {
  7683. }
  7684. /**
  7685. * @version Egret 2.4
  7686. * @platform Web,Native
  7687. * @includeExample egret/localStorage/localStorage.ts
  7688. */
  7689. declare namespace egret.localStorage {
  7690. /**
  7691. * @language en_US
  7692. * Read data
  7693. * @param key {string} Name of the key to be read
  7694. * @version Egret 2.4
  7695. * @platform Web,Native
  7696. */
  7697. /**
  7698. * @language zh_CN
  7699. * 读取数据
  7700. * @param key {string} 要读取的键名称
  7701. * @version Egret 2.4
  7702. * @platform Web,Native
  7703. */
  7704. let getItem: (key: string) => string;
  7705. /**
  7706. * @language en_US
  7707. * Save data
  7708. * @param key {string} Name of the key to be saved
  7709. * @param value {string} Value to be saved
  7710. * @returns {boolean} Whether data is saved successfully
  7711. * @version Egret 2.4
  7712. * @platform Web,Native
  7713. */
  7714. /**
  7715. * @language zh_CN
  7716. * 保存数据
  7717. * @param key {string} 要保存的键名称
  7718. * @param value {string} 要保存的值
  7719. * @returns {boolean} 数据保存是否成功
  7720. * @version Egret 2.4
  7721. * @platform Web,Native
  7722. */
  7723. let setItem: (key: string, value: string) => boolean;
  7724. /**
  7725. * @language en_US
  7726. * Delete data
  7727. * @param key {string} Name of the key to be deleted
  7728. * @version Egret 2.4
  7729. * @platform Web,Native
  7730. */
  7731. /**
  7732. * @language zh_CN
  7733. * 删除数据
  7734. * @param key {string} 要删除的键名称
  7735. * @version Egret 2.4
  7736. * @platform Web,Native
  7737. */
  7738. let removeItem: (key: string) => void;
  7739. /**
  7740. * @language en_US
  7741. * Clear all data
  7742. * @version Egret 2.4
  7743. * @platform Web,Native
  7744. */
  7745. /**
  7746. * @language zh_CN
  7747. * 将所有数据清空
  7748. * @version Egret 2.4
  7749. * @platform Web,Native
  7750. */
  7751. let clear: () => void;
  7752. }
  7753. declare namespace egret.sys {
  7754. /**
  7755. * @private
  7756. * @param channel
  7757. */
  7758. function $pushSoundChannel(channel: SoundChannel): void;
  7759. /**
  7760. * @private
  7761. * @param channel
  7762. */
  7763. function $popSoundChannel(channel: SoundChannel): boolean;
  7764. }
  7765. declare namespace egret {
  7766. /**
  7767. * @language en_US
  7768. * The Sound class lets you work with sound in an application.
  7769. * The Sound class lets you create a Sound object, load and play an external audio file into that object.
  7770. * More detailed control of the sound is performed through the SoundChannel
  7771. *
  7772. * @event egret.Event.COMPLETE Dispatch when the audio resource is loaded and ready to play
  7773. * @event egret.IOErrorEvent.IO_ERROR Dispatch when the audio resource is failed to load
  7774. * @version Egret 2.4
  7775. * @platform Web,Native
  7776. * @includeExample egret/media/Sound.ts
  7777. */
  7778. /**
  7779. * @language zh_CN
  7780. * Sound 允许您在应用程序中使用声音。使用 Sound 类可以创建 Sound 对象、将外部音频文件加载到该对象并播放该文件。
  7781. * 可通过 SoundChannel 对声音执行更精细的控制,如控制音量和监控播放进度。
  7782. * @see http://edn.egret.com/cn/docs/page/156 音频系统
  7783. *
  7784. * @event egret.Event.COMPLETE 音频加载完成时抛出
  7785. * @event egret.IOErrorEvent.IO_ERROR 音频加载失败时抛出
  7786. * @version Egret 2.4
  7787. * @platform Web,Native
  7788. * @includeExample egret/media/Sound.ts
  7789. */
  7790. interface Sound extends EventDispatcher {
  7791. /**
  7792. * @language en_US
  7793. * Initiates loading of an external audio file from the specified URL.
  7794. * @param url Audio file URL
  7795. * @version Egret 2.4
  7796. * @platform Web,Native
  7797. */
  7798. /**
  7799. * @language zh_CN
  7800. * 启动从指定 URL 加载外部音频文件的过程。
  7801. * @param url 需要加载的音频文件URL
  7802. * @version Egret 2.4
  7803. * @platform Web,Native
  7804. */
  7805. load(url: string): void;
  7806. /**
  7807. * @language en_US
  7808. * Generates a new SoundChannel object to play back the sound.
  7809. * @param startTime The initial position in seconds at which playback should start, (default = 0)
  7810. * @param loops Plays, the default value is 0. Greater than 0 to the number of plays, such as 1 to play 1, less than or equal to 0, to loop.
  7811. * @version Egret 2.4
  7812. * @platform Web,Native
  7813. */
  7814. /**
  7815. * @language zh_CN
  7816. * 生成一个新的 SoundChannel 对象来播放该声音。此方法返回 SoundChannel 对象,访问该对象可停止声音调整音量。
  7817. * @param startTime 应开始播放的初始位置(以秒为单位),默认值是 0
  7818. * @param loops 播放次数,默认值是 0,循环播放。 大于 0 为播放次数,如 1 为播放 1 次;小于等于 0,为循环播放。
  7819. * @version Egret 2.4
  7820. * @platform Web,Native
  7821. */
  7822. play(startTime?: number, loops?: number): SoundChannel;
  7823. /**
  7824. * @language en_US
  7825. * Closes the stream, causing any download of data to cease
  7826. * @version Egret 2.4
  7827. * @platform Web,Native
  7828. */
  7829. /**
  7830. * @language zh_CN
  7831. * 关闭该流,从而停止所有数据的下载。
  7832. * @version Egret 2.4
  7833. * @platform Web,Native
  7834. */
  7835. close(): void;
  7836. /**
  7837. * @language en_US
  7838. * Type, default is egret.Sound.EFFECT.
  7839. * In the native and runtime environment, while only play a background music, sound length so as not to be too long.
  7840. * @version Egret 2.4
  7841. * @platform Web,Native
  7842. */
  7843. /**
  7844. * @language zh_CN
  7845. * 类型,默认为 egret.Sound.EFFECT。
  7846. * 在 native 和 runtime 环境下,背景音乐同时只能播放一个,音效长度尽量不要太长。
  7847. * @version Egret 2.4
  7848. * @platform Web,Native
  7849. */
  7850. type: string;
  7851. /**
  7852. * @language en_US
  7853. * Length of the current sound (in seconds).
  7854. * @version Egret 2.4
  7855. * @platform Web,Native
  7856. * @readOnly
  7857. */
  7858. /**
  7859. * @language zh_CN
  7860. * 当前声音的长度(以秒为单位)。
  7861. * @version Egret 2.4
  7862. * @platform Web,Native
  7863. * @readOnly
  7864. */
  7865. length: number;
  7866. }
  7867. /**
  7868. * @copy egret.Sound
  7869. */
  7870. let Sound: {
  7871. /**
  7872. * @language en_US
  7873. * Create Sound object, load an external audio file and play
  7874. * @param url Audio file URL, Sound will start to load the media if url is not empty
  7875. * @version Egret 2.4
  7876. * @platform Web,Native
  7877. */
  7878. /**
  7879. * @language zh_CN
  7880. * 创建 Sound 对象、将外部音频文件加载到该对象并播放该文件
  7881. * @param url 需要加载的音频文件URL,如果指定了 url, Sound会立即开始加载指定的媒体文件
  7882. * @version Egret 2.4
  7883. * @platform Web,Native
  7884. */
  7885. new (): Sound;
  7886. /**
  7887. * @language en_US
  7888. * Background music
  7889. * @default "music"
  7890. * @version Egret 2.4
  7891. * @platform Web,Native
  7892. */
  7893. /**
  7894. * @language zh_CN
  7895. * 背景音乐
  7896. * @default "music"
  7897. * @version Egret 2.4
  7898. * @platform Web,Native
  7899. */
  7900. MUSIC: string;
  7901. /**
  7902. * @language en_US
  7903. * EFFECT
  7904. * @default "effect"
  7905. * @version Egret 2.4
  7906. * @platform Web,Native
  7907. */
  7908. /**
  7909. * @language zh_CN
  7910. * 音效
  7911. * @default "effect"
  7912. * @version Egret 2.4
  7913. * @platform Web,Native
  7914. */
  7915. EFFECT: string;
  7916. };
  7917. }
  7918. declare namespace egret {
  7919. /**
  7920. * @language en_US
  7921. * The SoundChannel class controls a sound in an application.
  7922. * Every sound is assigned to a sound channel, and the application
  7923. * can have multiple sound channels that are mixed together.
  7924. * The SoundChannel class contains a stop() method, properties for
  7925. * set the volume of the channel
  7926. *
  7927. * @event egret.Event.SOUND_COMPLETE Dispatch when a sound has finished playing at last time
  7928. * @version Egret 2.4
  7929. * @platform Web,Native
  7930. * @includeExample egret/media/Sound.ts
  7931. */
  7932. /**
  7933. * @language zh_CN
  7934. * SoundChannel 类控制应用程序中的声音。每个声音均分配给一个声道,而且应用程序可以具有混合在一起的多个声道。
  7935. * SoundChannel 类包含 stop() 方法、用于设置音量和监视播放进度的属性。
  7936. *
  7937. * @event egret.Event.SOUND_COMPLETE 音频最后一次播放完成时抛出
  7938. * @version Egret 2.4
  7939. * @platform Web,Native
  7940. * @includeExample egret/media/Sound.ts
  7941. */
  7942. interface SoundChannel extends IEventDispatcher {
  7943. /**
  7944. * @language en_US
  7945. * The volume, ranging from 0 (silent) to 1 (full volume).
  7946. * @version Egret 2.4
  7947. * @platform Web,Native
  7948. */
  7949. /**
  7950. * @language zh_CN
  7951. * 音量范围从 0(静音)至 1(最大音量)。
  7952. * @version Egret 2.4
  7953. * @platform Web,Native
  7954. */
  7955. volume: number;
  7956. /**
  7957. * @language en_US
  7958. * When the sound is playing, the position property indicates
  7959. * in seconds the current point that is being played in the sound file.
  7960. * @version Egret 2.4
  7961. * @platform Web,Native
  7962. * @readOnly
  7963. */
  7964. /**
  7965. * @language zh_CN
  7966. * 当播放声音时,position 属性表示声音文件中当前播放的位置(以秒为单位)
  7967. * @version Egret 2.4
  7968. * @platform Web,Native
  7969. * @readOnly
  7970. */
  7971. position: number;
  7972. /**
  7973. * @language en_US
  7974. * Stops the sound playing in the channel.
  7975. * @version Egret 2.4
  7976. * @platform Web,Native
  7977. */
  7978. /**
  7979. * @language zh_CN
  7980. * 停止在该声道中播放声音。
  7981. * @version Egret 2.4
  7982. * @platform Web,Native
  7983. */
  7984. stop(): void;
  7985. }
  7986. }
  7987. declare namespace egret {
  7988. /**
  7989. * @language en_US
  7990. * The Video class lets you work with video in an application.
  7991. * The Video class lets you create a Video object, load and play an external video file into that object.
  7992. * Note: On most mobile device, the video is playback in the full screen mode.<br/>
  7993. *
  7994. * @param url URL of the media to play, Video will start to load if the url is not empty
  7995. *
  7996. * @event egret.Event.COMPLETE Dispatch when the video resource is loaded and ready to play
  7997. * @event egret.Event.ENDED Dispatch when the video playback ended
  7998. * @event egret.IOErrorEvent.IO_ERROR when the video is failed to load
  7999. * @version Egret 2.4
  8000. * @platform Web
  8001. * @includeExample egret/media/Video.ts
  8002. */
  8003. /**
  8004. * @language zh_CN
  8005. * Video 允许您在应用程序中使用视频。使用 Video 类可以创建 Video 对象、将外部视频文件加载到该对象并播放该文件。<br/>
  8006. * 注意: 在大多数移动设备中,视频是强制全屏播放的,所以你可以直接调用 play() 方法全屏播放视频,不用将它绘制在Stage中。
  8007. * @see http://edn.egret.com/cn/docs/page/657 视频系统
  8008. *
  8009. * @param url 要播放的视频的URL,如果url不为空,Video会立即加载这个视频
  8010. *
  8011. * @event egret.Event.COMPLETE 视频加载完成时抛出
  8012. * @event egret.Event.ENDED 视频播放完成时抛出
  8013. * @event egret.IOErrorEvent.IO_ERROR 视频加载失败时触发
  8014. * @version Egret 2.4
  8015. * @platform Web
  8016. * @includeExample egret/media/Video.ts
  8017. */
  8018. interface Video extends DisplayObject {
  8019. /**
  8020. * @language en_US
  8021. * Initiates loading of an external video file from the specified URL.
  8022. * @param url Audio file URL
  8023. * * @param cache Should cache the video,only used in Native
  8024. * @version Egret 2.4
  8025. * @platform Web,Native
  8026. */
  8027. /**
  8028. * @language zh_CN
  8029. * 启动从指定 URL 加载外部视频文件的过程。
  8030. * @param url 需要加载的视频文件URL
  8031. * @param cache 是否需要缓存到本地,只在 Native 上使用
  8032. * @version Egret 2.4
  8033. * @platform Web,Native
  8034. */
  8035. load(url: string, cache?: boolean): void;
  8036. /**
  8037. * @language en_US
  8038. * Play back the video.
  8039. * @param startTime The initial position in seconds at which playback should start, (default = 0)
  8040. * @param loop Defines should play the video again when the video is ended. (default = false)
  8041. * @version Egret 2.4
  8042. * @platform Web,Native
  8043. */
  8044. /**
  8045. * @language zh_CN
  8046. * 播放该视频
  8047. * @param startTime 应开始播放的初始位置(以秒为单位),默认值是视频上次结束的位置
  8048. * @param loop 是否需要循环播放,默认值是 false
  8049. * @version Egret 2.4
  8050. * @platform Web,Native
  8051. */
  8052. play(startTime?: number, loop?: boolean): any;
  8053. /**
  8054. * @language en_US
  8055. * Closes the stream, causing any download of data to cease
  8056. * @version Egret 2.4
  8057. * @platform Web,Native
  8058. */
  8059. /**
  8060. * @language zh_CN
  8061. * 关闭该流,从而停止所有数据的下载。
  8062. * @version Egret 2.4
  8063. * @platform Web,Native
  8064. */
  8065. close(): void;
  8066. /**
  8067. * @language en_US
  8068. * The URL of the video you want to play.
  8069. * @version Egret 2.4
  8070. * @platform Web,Native
  8071. */
  8072. /**
  8073. * @language zh_CN
  8074. * 想要播放的视频的URL
  8075. * @version Egret 2.4
  8076. * @platform Web,Native
  8077. */
  8078. src: string;
  8079. /**
  8080. * @language en_US
  8081. * The URL of an image you want to display before the video is loaded or video cannot been draw on the canvas on some mobile device.
  8082. * @version Egret 2.4
  8083. * @platform Web,Native
  8084. */
  8085. /**
  8086. * @language zh_CN
  8087. * 视频加载前,或者在不支持将 video 画在 canvas 的设备上,想要显示的视频截图地址。
  8088. * @version Egret 2.4
  8089. * @platform Web,Native
  8090. */
  8091. poster: string;
  8092. /**
  8093. * @language en_US
  8094. * Should play the video in fullscreen mode (default = true).
  8095. * Currently only supports full-screen mobile terminal web.
  8096. * @version Egret 2.4
  8097. * @platform Web,Native
  8098. */
  8099. /**
  8100. * @language zh_CN
  8101. * 是否全屏播放这个视频(默认值是 true)。
  8102. * 目前移动端 web 只支持全屏。
  8103. * @version Egret 2.4
  8104. * @platform Web,Native
  8105. */
  8106. fullscreen: boolean;
  8107. /**
  8108. * @language en_US
  8109. * The volume, ranging from 0 (silent) to 1 (full volume).
  8110. * @version Egret 2.4
  8111. * @platform Web,Native
  8112. */
  8113. /**
  8114. * @language zh_CN
  8115. * 音量范围从 0(静音)至 1(最大音量)。
  8116. * @version Egret 2.4
  8117. * @platform Web,Native
  8118. */
  8119. volume: number;
  8120. /**
  8121. * @language en_US
  8122. * When the video is playing, the position property indicates
  8123. * in seconds the current point that is being played in the video file.
  8124. * @version Egret 2.4
  8125. * @platform Web,Native
  8126. */
  8127. /**
  8128. * @language zh_CN
  8129. * 当播放视频时,position 属性表示视频文件中当前播放的位置(以秒为单位)
  8130. * @version Egret 2.4
  8131. * @platform Web,Native
  8132. */
  8133. position: number;
  8134. /**
  8135. * @language en_US
  8136. * Pause the video playing.
  8137. * @version Egret 2.4
  8138. * @platform Web,Native
  8139. */
  8140. /**
  8141. * @language zh_CN
  8142. * 暂停播放。
  8143. * @version Egret 2.4
  8144. * @platform Web,Native
  8145. */
  8146. pause(): void;
  8147. /**
  8148. * @language en_US
  8149. * Get bitmapData of the video file, you can use the video as bitmapData on the stage.
  8150. * Note: On most mobile device, the video is playback in the full screen mode.
  8151. * So you can just use the play() method instead of draw it on the Stage
  8152. * @version Egret 2.4
  8153. * @platform Web
  8154. */
  8155. /**
  8156. * @language zh_CN
  8157. * 获取视频的 bitmapData, 你可以将视频绘制到舞台上。
  8158. * 注意: 在大多数移动设备中,视频是全屏播放的,所以你可以直接调用 play() 方法全屏播放视频,不用将它绘制在Stage中。
  8159. * @version Egret 2.4
  8160. * @platform Web
  8161. */
  8162. bitmapData?: BitmapData;
  8163. /**
  8164. * @language en_US
  8165. * Whether current video is paused.
  8166. * @version Egret 2.4
  8167. * @platform Web,Native
  8168. * @readOnly
  8169. */
  8170. /**
  8171. * @language zh_CN
  8172. * 当前视频是否在暂停状态。
  8173. * @version Egret 2.4
  8174. * @platform Web,Native
  8175. * @readOnly
  8176. */
  8177. paused: boolean;
  8178. /**
  8179. * @language en_US
  8180. * Length of the current video (in seconds).
  8181. * @version Egret 3.0.8
  8182. * @platform Web,Native
  8183. * @readOnly
  8184. */
  8185. /**
  8186. * @language zh_CN
  8187. * 当前视频的长度(以秒为单位)。
  8188. * @version Egret 3.0.8
  8189. * @platform Web,Native
  8190. * @readOnly
  8191. */
  8192. length: number;
  8193. }
  8194. /**
  8195. * @copy egret.Video
  8196. */
  8197. let Video: {
  8198. new (url?: string, cache?: boolean): Video;
  8199. };
  8200. }
  8201. /**
  8202. * @private
  8203. */
  8204. declare namespace egret_native {
  8205. let nativeType: string;
  8206. /**
  8207. * 游戏启动
  8208. * @private
  8209. */
  8210. function startGame(): void;
  8211. function loglevel(logType: any): void;
  8212. function callRender(): void;
  8213. function getVersion(): any;
  8214. function setScreenCanvas(canvas: Canvas): void;
  8215. function setFrameRate(frameRate: number): void;
  8216. function onTouchesBegin(num: number, ids: any[], xs_array: any[], ys_array: any[]): any;
  8217. function onTouchesMove(num: number, ids: any[], xs_array: any[], ys_array: any[]): any;
  8218. function onTouchesEnd(num: number, ids: any[], xs_array: any[], ys_array: any[]): any;
  8219. function onTouchesCancel(num: number, ids: any[], xs_array: any[], ys_array: any[]): any;
  8220. function sendToC(float32Array: Float32Array, arrayBufferLen: number, array: string[]): void;
  8221. /**
  8222. * 启动主循环
  8223. * @param callback 主循环回调函数
  8224. * @param thisObject
  8225. */
  8226. function executeMainLoop(callback: Function, thisObject: any): void;
  8227. function pauseApp(): void;
  8228. function resumeApp(): void;
  8229. function readXML(filepath: string): any;
  8230. function xmlStr2JsonStr(text: string): any;
  8231. function isFileExists(filepath: string): boolean;
  8232. function isRecordExists(filepath: string): boolean;
  8233. function readFileSync(filepath: string, type?: string): any;
  8234. function readResourceFileSync(filepath: string): any;
  8235. function readUpdateFileSync(filepath: string): any;
  8236. function deleteUpdateFile(filepath: string): void;
  8237. function readFileAsync(filepath: string, promise: egret.PromiseObject, type?: string): any;
  8238. function writeFileSync(filepath: string, fileContent: string): any;
  8239. function requireHttpSync(url: string, callback: Function): void;
  8240. function requireHttp(url: string, param: any, callback: Function): void;
  8241. function sendInfoToPlugin(info: string): void;
  8242. function receivedPluginInfo(info: string): void;
  8243. function loadRecord(filepath: string): string;
  8244. function saveRecord(filepath: string, fileContent: string): void;
  8245. function getOption(type: string): string;
  8246. namespace Audio {
  8247. function preloadBackgroundMusic(path: string): void;
  8248. function playBackgroundMusic(path: string, loop: boolean): void;
  8249. function setBackgroundMusicVolume(value: number): void;
  8250. function setEffectsVolume(value: number): void;
  8251. function getBackgroundMusicVolume(): number;
  8252. function getEffectsVolume(): number;
  8253. function stopBackgroundMusic(isRelease: boolean): void;
  8254. function preloadEffect(path: string): void;
  8255. function preloadEffectAsync(path: string, promise: egret.PromiseObject): void;
  8256. function playEffect(path: string, loop: boolean): void;
  8257. function unloadEffect(path: string): void;
  8258. function stopEffect(effectId: number): void;
  8259. function pauseBackgroundMusic(): void;
  8260. function pauseAllEffects(): void;
  8261. function resumeBackgroundMusic(): void;
  8262. function resumeAllEffects(): void;
  8263. }
  8264. function download(url: string, savePath: string, promise: any): void;
  8265. namespace Graphics {
  8266. function clearScreen(r: number, g: number, b: number): void;
  8267. function drawImage(texture: any, sourceX: any, sourceY: any, sourceWidth: any, sourceHeight: any, destX: any, destY: any, destWidth: any, destHeight: any): void;
  8268. function drawImageScale9(texture: any, sourceX: any, sourceY: any, sourceWidth: any, sourceHeight: any, destX: any, destY: any, destWidth: any, destHeight: any, x: any, y: any, width: any, height: any): boolean;
  8269. function setTransform(a: number, b: number, c: number, d: number, tx: number, ty: number): void;
  8270. function setGlobalAlpha(alpha: number): void;
  8271. function pushClip(x: number, y: number, w: number, h: number): void;
  8272. function popClip(): void;
  8273. function setGlobalColorTransform(colorTransformMatrix: number[]): void;
  8274. function setGlobalColorTransformEnabled(bool: boolean): void;
  8275. function setGlobalShader(filterData: any): void;
  8276. function lineStyle(thickness: number, color: number): void;
  8277. function lineTo(x: number, y: number): void;
  8278. function moveTo(x: number, y: number): void;
  8279. function beginFill(color: number, alpha: number): void;
  8280. function endFill(): void;
  8281. function setBlendArg(src: number, des: number): void;
  8282. function setTextureScaleFactor(value: number): void;
  8283. }
  8284. namespace Label {
  8285. function createLabel(font: string, size: number, defaultString: string, defaultStroke: number): void;
  8286. function setTextColor(color: number): void;
  8287. function setStrokeColor(color: number): void;
  8288. function drawText(text: string, x: number, y: number): void;
  8289. function setTextAlignment(type: string): void;
  8290. function getTextSize(text: string): number[];
  8291. }
  8292. namespace EGTXML {
  8293. function readXML(filepath: string): void;
  8294. }
  8295. namespace Texture {
  8296. function create(filePath: string): any;
  8297. function addTexture(filePath: string): any;
  8298. function addTextureAsyn(filePath: string, promise: any): any;
  8299. function addTextureUnsyn(filePath: string, promise: any): any;
  8300. function removeTexture(filePath: string): void;
  8301. }
  8302. namespace TextInputOp {
  8303. function setKeybordOpen(isOpen: boolean, jsonConfig?: Object): void;
  8304. function isFullScreenKeyBoard(): boolean;
  8305. function setInputTextMaxLenght(value: number): void;
  8306. function updateConfig(jsonConfig?: Object): void;
  8307. }
  8308. function EGT_TextInput(text: string): void;
  8309. function EGT_keyboardFinish(): void;
  8310. function EGT_deleteBackward(): void;
  8311. function EGT_keyboardDidHide(): void;
  8312. function EGT_keyboardDidShow(): void;
  8313. function EGT_getTextEditerContentText(): string;
  8314. namespace EGTView {
  8315. function getFrameWidth(): number;
  8316. function getFrameHeight(): number;
  8317. function setVisibleRect(x: number, y: number, w: number, h: number): number;
  8318. function setDesignSize(w: number, h: number): number;
  8319. }
  8320. /**
  8321. * @private
  8322. */
  8323. class RenderTexture {
  8324. constructor(width: number, height: number);
  8325. begin(): any;
  8326. end(): any;
  8327. dispose(): any;
  8328. toDataURL(type: any): any;
  8329. saveToFile(type: string, filePath: string): any;
  8330. }
  8331. namespace rastergl {
  8332. function arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
  8333. function quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
  8334. function lineTo(x: number, y: number): void;
  8335. function fill(fillRule?: string): void;
  8336. function closePath(): void;
  8337. function rect(x: number, y: number, w: number, h: number): void;
  8338. function moveTo(x: number, y: number): void;
  8339. function fillRect(x: number, y: number, w: number, h: number): void;
  8340. function bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
  8341. function stroke(): void;
  8342. function strokeRect(x: number, y: number, w: number, h: number): void;
  8343. function beginPath(): void;
  8344. function arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
  8345. function transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;
  8346. function translate(x: number, y: number): void;
  8347. function scale(x: number, y: number): void;
  8348. function rotate(angle: number): void;
  8349. function save(): void;
  8350. function restore(): void;
  8351. function createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
  8352. function createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
  8353. /**
  8354. * @private
  8355. */
  8356. let lineWidth: number;
  8357. /**
  8358. * @private
  8359. */
  8360. let strokeStyle: any;
  8361. /**
  8362. * @private
  8363. */
  8364. let fillStyle: any;
  8365. }
  8366. namespace Game {
  8367. function listResource(root: any, promise: any): any;
  8368. function listUpdate(root: any, promise: any): any;
  8369. }
  8370. /**
  8371. * @private
  8372. */
  8373. class RenderContext {
  8374. clearScreen(r: number, g: number, b: number): void;
  8375. drawImage(texture: any, sourceX: any, sourceY: any, sourceWidth: any, sourceHeight: any, destX: any, destY: any, destWidth: any, destHeight: any): void;
  8376. setTransform(a: number, b: number, c: number, d: number, tx: number, ty: number): void;
  8377. setGlobalAlpha(alpha: number): void;
  8378. pushClip(x: number, y: number, w: number, h: number): void;
  8379. popClip(): void;
  8380. }
  8381. /**
  8382. * @private
  8383. */
  8384. class Canvas {
  8385. constructor(width: number, height: number);
  8386. width: number;
  8387. height: number;
  8388. getContext(type: string): RenderContext;
  8389. }
  8390. }
  8391. declare namespace egret {
  8392. /**
  8393. * @private
  8394. * @version Egret 2.4
  8395. * @platform Web,Native
  8396. */
  8397. class PromiseObject {
  8398. /**
  8399. * @private
  8400. */
  8401. private static promiseObjectList;
  8402. /**
  8403. * @version Egret 2.4
  8404. * @platform Web,Native
  8405. */
  8406. onSuccessFunc: Function;
  8407. /**
  8408. * @version Egret 2.4
  8409. * @platform Web,Native
  8410. */
  8411. onSuccessThisObject: any;
  8412. /**
  8413. * @version Egret 2.4
  8414. * @platform Web,Native
  8415. */
  8416. onErrorFunc: Function;
  8417. /**
  8418. * @version Egret 2.4
  8419. * @platform Web,Native
  8420. */
  8421. onErrorThisObject: any;
  8422. /**
  8423. * @version Egret 2.4
  8424. * @platform Web,Native
  8425. */
  8426. downloadingSizeFunc: Function;
  8427. /**
  8428. * @version Egret 2.4
  8429. * @platform Web,Native
  8430. */
  8431. downloadingSizeThisObject: any;
  8432. /**
  8433. * @version Egret 2.4
  8434. * @platform Web,Native
  8435. */
  8436. onResponseHeaderFunc: Function;
  8437. /**
  8438. * @version Egret 2.4
  8439. * @platform Web,Native
  8440. */
  8441. onResponseHeaderThisObject: any;
  8442. /**
  8443. * @version Egret 2.4
  8444. * @platform Web,Native
  8445. */
  8446. constructor();
  8447. /**
  8448. *
  8449. * @version Egret 2.4
  8450. * @platform Web,Native
  8451. */
  8452. static create(): any;
  8453. /**
  8454. * @private
  8455. *
  8456. * @param args
  8457. */
  8458. private onSuccess(...args);
  8459. /**
  8460. * @private
  8461. *
  8462. * @param args
  8463. */
  8464. private onError(...args);
  8465. /**
  8466. * @private
  8467. *
  8468. * @param args
  8469. */
  8470. private downloadingSize(...args);
  8471. /**
  8472. * @private
  8473. *
  8474. * @param args
  8475. */
  8476. private onResponseHeader(...args);
  8477. /**
  8478. * @private
  8479. *
  8480. */
  8481. private destroy();
  8482. }
  8483. }
  8484. declare namespace egret {
  8485. /**
  8486. * @language en_US
  8487. * The HttpMethod class provides values that specify whether the HttpRequest object should use the POST method
  8488. * or the GET method when sending data to a server.
  8489. * @see egret.HttpRequest
  8490. * @version Egret 2.4
  8491. * @platform Web,Native
  8492. */
  8493. /**
  8494. * @language zh_CN
  8495. * HttpRequestMethod 类提供了一些值,这些值可指定在将数据发送到服务器时,
  8496. * HttpRequest 对象应使用 POST 方法还是 GET 方法。
  8497. * @see egret.HttpRequest
  8498. * @version Egret 2.4
  8499. * @platform Web,Native
  8500. */
  8501. class HttpMethod {
  8502. /**
  8503. * @language en_US
  8504. * Specifies that the HttpRequest object is a GET.
  8505. * @version Egret 2.4
  8506. * @platform Web,Native
  8507. */
  8508. /**
  8509. * @language zh_CN
  8510. * 表示 HttpRequest 对象是一个 GET。
  8511. * @version Egret 2.4
  8512. * @platform Web,Native
  8513. */
  8514. static GET: string;
  8515. /**
  8516. * @language en_US
  8517. * Specifies that the HttpRequest object is a POST.
  8518. * @version Egret 2.4
  8519. * @platform Web,Native
  8520. */
  8521. /**
  8522. * @language zh_CN
  8523. * 表示 HttpRequest 对象是一个 POST。
  8524. * @version Egret 2.4
  8525. * @platform Web,Native
  8526. */
  8527. static POST: string;
  8528. }
  8529. }
  8530. declare namespace egret {
  8531. /**
  8532. * @language en_US
  8533. * The HttpRequest class downloads data from a URL as text or binary data. It is useful for downloading text files,
  8534. * XML, or other information to be used in a dynamic, data-driven application. A HttpRequest object downloads all
  8535. * of the data from a URL before making it available to code in the applications. It sends out notifications about
  8536. * the progress of the download, which you can monitor through the bytesLoaded and bytesTotal properties,
  8537. * as well as through dispatched events.
  8538. * @event egret.Event.COMPLETE Dispatched when the net request is complete.
  8539. * @event egret.Event.IO_ERROR Dispatched when the net request is failed.
  8540. * @event egret.ProgressEvent.PROGRESS Dispatched when data is received as the download operation progresses.
  8541. * @see egret.HttpMethod
  8542. * @see egret.HttpResponseType
  8543. * @includeExample egret/net/HttpRequestExample.ts
  8544. * @version Egret 2.4
  8545. * @platform Web,Native
  8546. */
  8547. /**
  8548. * @language zh_CN
  8549. * HttpRequest 类以文本或二进制数据的形式从 URL 下载数据。
  8550. * HttpRequest 对象会先从 URL 中下载所有数据,然后才将数据用于应用程序中的代码。它会发出有关下载进度的通知,
  8551. * 通过 bytesLoaded 和 bytesTotal 属性以及已调度的事件,可以监视下载进度。
  8552. * @event egret.Event.COMPLETE 加载完成
  8553. * @event egret.Event.IO_ERROR 加载失败
  8554. * @event egret.ProgressEvent.PROGRESS 加载进度,可通过event.bytesLoaded和event.bytesTotal统计进度信息。
  8555. * @see egret.HttpMethod
  8556. * @see egret.HttpResponseType
  8557. * @includeExample egret/net/HttpRequestExample.ts
  8558. * @version Egret 2.4
  8559. * @platform Web,Native
  8560. */
  8561. interface HttpRequest extends EventDispatcher {
  8562. /**
  8563. * @language en_US
  8564. * The data received from the load operation. The format of the data depends on the setting of the responseType property.
  8565. * @readOnly
  8566. * @version Egret 2.4
  8567. * @platform Web,Native
  8568. */
  8569. /**
  8570. * @language zh_CN
  8571. * 本次请求返回的数据,数据类型根据 responseType 设置的值确定。
  8572. * @readOnly
  8573. * @version Egret 2.4
  8574. * @platform Web,Native
  8575. */
  8576. response: any;
  8577. /**
  8578. * @language en_US
  8579. * Controls whether the downloaded data is received as text (HttpResponseType.TEXT) or raw binary data (HttpResponseType.ArrayBuffer)<br/>
  8580. * Note:If you attempt to set this property to an invalid value, Egret runtime set the value to HttpResponseType.TEXT.
  8581. * @default egret.HttpResponseType.TEXT
  8582. * @version Egret 2.4
  8583. * @platform Web,Native
  8584. */
  8585. /**
  8586. * @language zh_CN
  8587. * 设置返回的数据格式为文本(HttpResponseType.TEXT)还是二进制数据(HttpResponseType.ArrayBuffer)<br/>
  8588. * 注意:若尝试设置此属性为一个非法的值,运行时将使用HttpResponseType.TEXT。
  8589. * @default egret.HttpResponseType.TEXT
  8590. * @version Egret 2.4
  8591. * @platform Web,Native
  8592. */
  8593. responseType: string;
  8594. /**
  8595. * @language en_US
  8596. * indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies
  8597. * or authorization headers. (This never affects same-site requests.)
  8598. * @default false
  8599. * @version Egret 2.4
  8600. * @platform Web,Native
  8601. */
  8602. /**
  8603. * @language zh_CN
  8604. * 表明在进行跨站(cross-site)的访问控制(Access-Control)请求时,是否使用认证信息(例如cookie或授权的header)。(这个标志不会影响同站的请求)
  8605. * @default false
  8606. * @version Egret 2.4
  8607. * @platform Web,Native
  8608. */
  8609. withCredentials: boolean;
  8610. /**
  8611. * @language en_US
  8612. * Initializes a request.<br/>
  8613. * Note: Calling this method for an already active request (one for which open() or openRequest() has already been
  8614. * called) is the equivalent of calling abort().
  8615. * @param url The URL to send the request to.
  8616. * @param method The HTTP method to use, please use the const value in the HttpMethod class.
  8617. * @see egret.HttpMethod
  8618. * @version Egret 2.4
  8619. * @platform Web,Native
  8620. */
  8621. /**
  8622. * @language zh_CN
  8623. * 初始化一个请求.<br/>
  8624. * 注意: 若在已经发出请求的对象上调用此方法,相当于立即调用abort().
  8625. * @param url 该请求所要访问的URL该请求所要访问的URL
  8626. * @param method 请求所使用的HTTP方法, 请使用 HttpMethod 定义的枚举值.
  8627. * @see egret.HttpMethod
  8628. * @version Egret 2.4
  8629. * @platform Web,Native
  8630. */
  8631. open(url: string, method?: string): void;
  8632. /**
  8633. * @language en_US
  8634. * Sends the request.
  8635. * @param data the data to send.
  8636. * @version Egret 2.4
  8637. * @platform Web,Native
  8638. */
  8639. /**
  8640. * @language zh_CN
  8641. * 发送请求.
  8642. * @param data 需要发送的数据
  8643. * @version Egret 2.4
  8644. * @platform Web,Native
  8645. */
  8646. send(data?: any): void;
  8647. /**
  8648. * @language en_US
  8649. * Aborts the request if it has already been sent.
  8650. * @version Egret 2.4
  8651. * @platform Web,Native
  8652. */
  8653. /**
  8654. * @language zh_CN
  8655. * 如果请求已经被发送,则立刻中止请求.
  8656. * @version Egret 2.4
  8657. * @platform Web,Native
  8658. */
  8659. abort(): void;
  8660. /**
  8661. * @language en_US
  8662. * Returns all the response headers as a string, or null if no response has been received.
  8663. * @version Egret 2.4
  8664. * @platform Web,Native
  8665. */
  8666. /**
  8667. * @language zh_CN
  8668. * 返回所有响应头信息(响应头名和值), 如果响应头还没接受,则返回"".
  8669. * @version Egret 2.4
  8670. * @platform Web,Native
  8671. */
  8672. getAllResponseHeaders(): string;
  8673. /**
  8674. * @language en_US
  8675. * Sets the value of an HTTP request header. You must call setRequestHeader() after open().
  8676. * @param header The name of the header whose value is to be set.
  8677. * @param value The value to set as the body of the header.
  8678. * @version Egret 2.4
  8679. * @platform Web,Native
  8680. */
  8681. /**
  8682. * @language zh_CN
  8683. * 给指定的HTTP请求头赋值.在这之前,您必须确认已经调用 open() 方法打开了一个url.
  8684. * @param header 将要被赋值的请求头名称.
  8685. * @param value 给指定的请求头赋的值.
  8686. * @version Egret 2.4
  8687. * @platform Web,Native
  8688. */
  8689. setRequestHeader(header: string, value: string): void;
  8690. /**
  8691. * @language en_US
  8692. * Returns the string containing the text of the specified header, or null if either the response has not yet been
  8693. * received or the header doesn't exist in the response.
  8694. * @param header The name of the header whose value is to be get.
  8695. * @version Egret 2.4
  8696. * @platform Web,Native
  8697. */
  8698. /**
  8699. * @language zh_CN
  8700. * 返回指定的响应头的值, 如果响应头还没被接受,或该响应头不存在,则返回"".
  8701. * @param header 要返回的响应头名称
  8702. * @version Egret 2.4
  8703. * @platform Web,Native
  8704. */
  8705. getResponseHeader(header: string): string;
  8706. }
  8707. /**
  8708. * @language en_US
  8709. * Creates a HttpRequest object.
  8710. * @version Egret 2.4
  8711. * @platform Web,Native
  8712. */
  8713. /**
  8714. * @language zh_CN
  8715. * 创建一个 HttpRequest 实例。
  8716. * @version Egret 2.4
  8717. * @platform Web,Native
  8718. */
  8719. let HttpRequest: {
  8720. new (): HttpRequest;
  8721. };
  8722. }
  8723. declare namespace egret {
  8724. /**
  8725. * @language en_US
  8726. * The HttpResponseType class provides values that specify how downloaded data is received.
  8727. * @see egret.HttpRequest
  8728. * @version Egret 2.4
  8729. * @platform Web,Native
  8730. */
  8731. /**
  8732. * @language zh_CN
  8733. * URLLoaderDataFormat 类提供了一些用于指定如何接收已下载数据的值。
  8734. * @see egret.HttpRequest
  8735. * @version Egret 2.4
  8736. * @platform Web,Native
  8737. */
  8738. class HttpResponseType {
  8739. /**
  8740. * @language en_US
  8741. * Specifies that downloaded data is received as text. This is the default value of HttpRequest.responseType
  8742. * @version Egret 2.4
  8743. * @platform Web,Native
  8744. */
  8745. /**
  8746. * @language zh_CN
  8747. * 返回字符串。HttpRequest.responseType属性的默认值。
  8748. * @version Egret 2.4
  8749. * @platform Web,Native
  8750. */
  8751. static TEXT: string;
  8752. /**
  8753. * @language en_US
  8754. * Specifies that downloaded data is received as raw binary data.
  8755. * @version Egret 2.4
  8756. * @platform Web,Native
  8757. */
  8758. /**
  8759. * @language zh_CN
  8760. * 返回二进制的ArrayBuffer对象。
  8761. * @version Egret 2.4
  8762. * @platform Web,Native
  8763. */
  8764. static ARRAY_BUFFER: string;
  8765. }
  8766. }
  8767. declare namespace egret {
  8768. /**
  8769. * @language en_US
  8770. * The Loader class is used to load image (JPG, PNG, or GIF) files. Use the load() method to initiate loading.
  8771. * The loaded image data is in the data property of ImageLoader.
  8772. * @event egret.Event.COMPLETE Dispatched when the net request is complete.
  8773. * @event egret.IOErrorEvent.IO_ERROR Dispatched when the net request is failed.
  8774. * @see egret.HttpRequest
  8775. * @version Egret 2.4
  8776. * @platform Web,Native
  8777. * @includeExample egret/net/ImageLoaderExample.ts
  8778. * @see http://edn.egret.com/cn/docs/page/590 加载位图文件
  8779. */
  8780. /**
  8781. * @language zh_CN
  8782. * ImageLoader 类可用于加载图像(JPG、PNG 或 GIF)文件。使用 load() 方法来启动加载。被加载的图像对象数据将存储在 ImageLoader.data 属性上 。
  8783. * @event egret.Event.COMPLETE 加载完成
  8784. * @event egret.IOErrorEvent.IO_ERROR 加载失败
  8785. * @see egret.HttpRequest
  8786. * @version Egret 2.4
  8787. * @platform Web,Native
  8788. * @includeExample egret/net/ImageLoaderExample.ts
  8789. * @see http://edn.egret.com/cn/docs/page/590 加载位图文件
  8790. */
  8791. interface ImageLoader extends EventDispatcher {
  8792. /**
  8793. * @language en_US
  8794. * The data received from the load operation.
  8795. * @default null
  8796. * @version Egret 2.4
  8797. * @platform Web,Native
  8798. */
  8799. /**
  8800. * @language zh_CN
  8801. * 使用 load() 方法加载成功的 BitmapData 图像数据。
  8802. * @default null
  8803. * @version Egret 2.4
  8804. * @platform Web,Native
  8805. */
  8806. data: BitmapData;
  8807. /**
  8808. * @language en_US
  8809. * Specifies whether or not cross-site Access-Control requests should be made when loading a image from foreign origins.<br/>
  8810. * possible values are:"anonymous","use-credentials" or null.
  8811. * @default null
  8812. * @version Egret 2.4
  8813. * @platform Web,Native
  8814. */
  8815. /**
  8816. * @language zh_CN
  8817. * 当从其他站点加载一个图片时,指定是否启用跨域资源共享(CORS),默认值为null。<br/>
  8818. * 可以设置为"anonymous","use-credentials"或null,设置为其他值将等同于"anonymous"。
  8819. * @version Egret 2.4
  8820. * @platform Web,Native
  8821. */
  8822. crossOrigin: string;
  8823. /**
  8824. * @language en_US
  8825. * start a load operation。<br/>
  8826. * Note: Calling this method for an already active request (one for which load() has already been
  8827. * called) will abort the last load operation immediately.
  8828. * @param url 要加载的图像文件的地址。
  8829. * @version Egret 2.4
  8830. * @platform Web,Native
  8831. */
  8832. /**
  8833. * @language zh_CN
  8834. * 启动一次图像加载。<br/>
  8835. * 注意:若之前已经调用过加载请求,重新调用 load() 将终止先前的请求,并开始新的加载。
  8836. * @param url 要加载的图像文件的地址。
  8837. * @version Egret 2.4
  8838. * @platform Web,Native
  8839. */
  8840. load(url: string): void;
  8841. }
  8842. /**
  8843. * @language en_US
  8844. * Creates a ImageLoader object
  8845. * @version Egret 2.4
  8846. * @platform Web,Native
  8847. */
  8848. /**
  8849. * @language zh_CN
  8850. * 创建一个 ImageLoader 实例
  8851. * @version Egret 2.4
  8852. * @platform Web,Native
  8853. */
  8854. let ImageLoader: {
  8855. /**
  8856. * @language en_US
  8857. * constructor
  8858. * @version Egret 2.4
  8859. * @platform Web,Native
  8860. */
  8861. /**
  8862. * @language zh_CN
  8863. * 构造函数
  8864. * @version Egret 2.4
  8865. * @platform Web,Native
  8866. */
  8867. new (): ImageLoader;
  8868. /**
  8869. * @language en_US
  8870. * Specifies whether to enable cross-origin resource sharing, If ImageLoader instance has been set crossOrigin property will be used to set the property.
  8871. * @version Egret 2.5.7
  8872. * @platform Web,Native
  8873. */
  8874. /**
  8875. * @language zh_CN
  8876. * 指定是否启用跨域资源共享,如果ImageLoader实例有设置过crossOrigin属性将使用设置的属性
  8877. * @version Egret 2.5.7
  8878. * @platform Web,Native
  8879. */
  8880. crossOrigin: string;
  8881. };
  8882. }
  8883. declare namespace egret.sys {
  8884. /**
  8885. * @private
  8886. * 脏矩形计算工具类
  8887. */
  8888. class DirtyRegion {
  8889. constructor(root: DisplayObject);
  8890. /**
  8891. * @private
  8892. */
  8893. private root;
  8894. /**
  8895. * @private
  8896. */
  8897. private dirtyList;
  8898. /**
  8899. * @private
  8900. */
  8901. private hasClipRect;
  8902. /**
  8903. * @private
  8904. */
  8905. private clipWidth;
  8906. /**
  8907. * @private
  8908. */
  8909. private clipHeight;
  8910. /**
  8911. * @private
  8912. */
  8913. private clipArea;
  8914. /**
  8915. * @private
  8916. */
  8917. private clipRectChanged;
  8918. /**
  8919. * @private
  8920. * 设置剪裁边界,超过边界的节点将跳过绘制。
  8921. */
  8922. setClipRect(width: number, height: number): void;
  8923. /**
  8924. * @private
  8925. * 添加一个脏矩形区域,返回是否添加成功,当矩形为空或者在屏幕之外时返回false。
  8926. */
  8927. addRegion(target: Region): boolean;
  8928. /**
  8929. * @private
  8930. */
  8931. clear(): void;
  8932. /**
  8933. * @private
  8934. * 获取最终的脏矩形列表
  8935. */
  8936. getDirtyRegions(): Region[];
  8937. /**
  8938. * @private
  8939. * 合并脏矩形列表
  8940. */
  8941. private mergeDirtyList(dirtyList);
  8942. private $dirtyRegionPolicy;
  8943. setDirtyRegionPolicy(policy: string): void;
  8944. }
  8945. }
  8946. declare namespace egret.sys {
  8947. /**
  8948. * @private
  8949. * 显示列表
  8950. */
  8951. class DisplayList extends HashObject implements sys.Renderable {
  8952. /**
  8953. * 创建一个DisplayList对象,若内存不足或无法创建RenderBuffer,将会返回null。
  8954. */
  8955. static create(target: DisplayObject): DisplayList;
  8956. /**
  8957. * @private
  8958. * 创建一个DisplayList对象
  8959. */
  8960. constructor(root: DisplayObject);
  8961. private isStage;
  8962. /**
  8963. * 位图渲染节点
  8964. */
  8965. $renderNode: RenderNode;
  8966. /**
  8967. * @private
  8968. * 获取渲染节点
  8969. */
  8970. $getRenderNode(): sys.RenderNode;
  8971. /**
  8972. * @private
  8973. * 更新对象在舞台上的显示区域和透明度,返回显示区域是否发生改变。
  8974. */
  8975. $update(dirtyRegionPolicy: string): boolean;
  8976. /**
  8977. * @private
  8978. */
  8979. renderBuffer: RenderBuffer;
  8980. /**
  8981. * @private
  8982. */
  8983. offsetX: number;
  8984. /**
  8985. * @private
  8986. */
  8987. offsetY: number;
  8988. /**
  8989. * @private
  8990. */
  8991. private offsetMatrix;
  8992. /**
  8993. * @private
  8994. * 显示列表根节点
  8995. */
  8996. root: DisplayObject;
  8997. /**
  8998. * @private
  8999. */
  9000. isDirty: boolean;
  9001. needUpdateRegions: boolean;
  9002. /**
  9003. * @private
  9004. * 设置剪裁边界,不再绘制完整目标对象,画布尺寸由外部决定,超过边界的节点将跳过绘制。
  9005. */
  9006. setClipRect(width: number, height: number): void;
  9007. /**
  9008. * @private
  9009. * 显示对象的渲染节点发生改变时,把自身的IRenderable对象注册到此列表上。
  9010. */
  9011. private dirtyNodes;
  9012. /**
  9013. * @private
  9014. */
  9015. private dirtyNodeList;
  9016. /**
  9017. * @private
  9018. * 标记一个节点需要重新渲染
  9019. */
  9020. markDirty(node: Renderable): void;
  9021. /**
  9022. * @private
  9023. */
  9024. private dirtyList;
  9025. /**
  9026. * @private
  9027. */
  9028. private dirtyRegion;
  9029. /**
  9030. * @private
  9031. * 更新节点属性并返回脏矩形列表。
  9032. */
  9033. updateDirtyRegions(): Region[];
  9034. /**
  9035. * @private
  9036. * 绘制根节点显示对象到目标画布,返回draw的次数。
  9037. */
  9038. drawToSurface(): number;
  9039. private bitmapData;
  9040. /**
  9041. * @private
  9042. */
  9043. private sizeChanged;
  9044. /**
  9045. * @private
  9046. * 改变画布的尺寸,由于画布尺寸修改会清空原始画布。所以这里将原始画布绘制到一个新画布上,再与原始画布交换。
  9047. */
  9048. changeSurfaceSize(): void;
  9049. private $dirtyRegionPolicy;
  9050. setDirtyRegionPolicy(policy: string): void;
  9051. }
  9052. }
  9053. declare namespace egret {
  9054. /**
  9055. * @language en_US
  9056. * egret project entry function
  9057. * @param options An object containing the initialization properties for egret engine.
  9058. */
  9059. /**
  9060. * @language zh_CN
  9061. * egret工程入口函数
  9062. * @param options 一个可选对象,包含初始化Egret引擎需要的参数。
  9063. */
  9064. function runEgret(options?: {
  9065. renderMode?: string;
  9066. audioType?: number;
  9067. screenAdapter?: sys.IScreenAdapter;
  9068. }): void;
  9069. /**
  9070. * @language en_US
  9071. * Refresh the screen display
  9072. */
  9073. /**
  9074. * @language zh_CN
  9075. * 刷新屏幕显示
  9076. */
  9077. function updateAllScreens(): void;
  9078. }
  9079. declare namespace egret {
  9080. /**
  9081. * @private
  9082. */
  9083. interface FPSDisplay extends DisplayObject {
  9084. /**
  9085. * 更新FPS信息
  9086. */
  9087. update(datas: FPSData): void;
  9088. /**
  9089. * 插入一条日志信息
  9090. */
  9091. updateInfo(info: string): void;
  9092. }
  9093. /**
  9094. * @private
  9095. */
  9096. let FPSDisplay: {
  9097. new (stage: Stage, showFPS: boolean, showLog: boolean, logFilter: string, styles: Object): FPSDisplay;
  9098. };
  9099. }
  9100. /**
  9101. * @private
  9102. */
  9103. interface FPSData extends Object {
  9104. fps: number;
  9105. draw: number;
  9106. dirty: number;
  9107. costTicker: number;
  9108. costDirty: number;
  9109. costRender: number;
  9110. }
  9111. declare namespace egret.sys {
  9112. let $TempStage: egret.Stage;
  9113. /**
  9114. * @private
  9115. * Egret播放器
  9116. */
  9117. class Player extends HashObject {
  9118. /**
  9119. * @private
  9120. * 实例化一个播放器对象。
  9121. */
  9122. constructor(buffer: RenderBuffer, stage: Stage, entryClassName: string);
  9123. /**
  9124. * @private
  9125. */
  9126. private createDisplayList(stage, buffer);
  9127. /**
  9128. * @private
  9129. */
  9130. private screenDisplayList;
  9131. /**
  9132. * @private
  9133. * 入口类的完整类名
  9134. */
  9135. private entryClassName;
  9136. /**
  9137. * @private
  9138. * 舞台引用
  9139. */
  9140. stage: Stage;
  9141. /**
  9142. * @private
  9143. * 入口类实例
  9144. */
  9145. private root;
  9146. /**
  9147. * @private
  9148. */
  9149. private isPlaying;
  9150. /**
  9151. * @private
  9152. * 启动播放器
  9153. */
  9154. start(): void;
  9155. /**
  9156. * @private
  9157. *
  9158. */
  9159. private initialize();
  9160. /**
  9161. * @private
  9162. * 停止播放器,停止后将不能重新启动。
  9163. */
  9164. stop(): void;
  9165. /**
  9166. * @private
  9167. * 暂停播放器,后续可以通过调用start()重新启动播放器。
  9168. */
  9169. pause(): void;
  9170. /**
  9171. * @private
  9172. * 渲染屏幕
  9173. */
  9174. $render(triggerByFrame: boolean, costTicker: number): void;
  9175. /**
  9176. * @private
  9177. * 更新舞台尺寸
  9178. * @param stageWidth 舞台宽度(以像素为单位)
  9179. * @param stageHeight 舞台高度(以像素为单位)
  9180. */
  9181. updateStageSize(stageWidth: number, stageHeight: number): void;
  9182. /**
  9183. * @private
  9184. * 显示FPS。
  9185. */
  9186. displayFPS: (showFPS: boolean, showLog: boolean, logFilter: string, fpsStyles: Object) => void;
  9187. /**
  9188. * @private
  9189. */
  9190. private showFPS;
  9191. /**
  9192. * @private
  9193. */
  9194. private showLog;
  9195. /**
  9196. * @private
  9197. */
  9198. private fps;
  9199. /**
  9200. * @private
  9201. * 是否显示脏矩形重绘区。
  9202. */
  9203. showPaintRect: (value: boolean) => void;
  9204. /**
  9205. * @private
  9206. */
  9207. private drawDirtyRect;
  9208. /**
  9209. * @private
  9210. */
  9211. private _showPaintRect;
  9212. /**
  9213. * @private
  9214. */
  9215. private stageDisplayList;
  9216. /**
  9217. * @private
  9218. */
  9219. private paintList;
  9220. /**
  9221. * @private
  9222. */
  9223. private drawPaintRect;
  9224. }
  9225. /**
  9226. * @private
  9227. */
  9228. let $logToFPS: (info: string) => void;
  9229. }
  9230. declare namespace egret {
  9231. /**
  9232. * OrientationMode 类为舞台初始旋转模式提供值。
  9233. */
  9234. const OrientationMode: {
  9235. AUTO: string;
  9236. PORTRAIT: string;
  9237. LANDSCAPE: string;
  9238. LANDSCAPE_FLIPPED: string;
  9239. };
  9240. }
  9241. declare namespace egret.sys {
  9242. /**
  9243. * @private
  9244. */
  9245. class Region {
  9246. /**
  9247. * @private
  9248. * 释放一个Region实例到对象池
  9249. */
  9250. static release(region: Region): void;
  9251. /**
  9252. * @private
  9253. * 从对象池中取出或创建一个新的Region对象。
  9254. * 建议对于一次性使用的对象,均使用此方法创建,而不是直接new一个。
  9255. * 使用完后调用对应的release()静态方法回收对象,能有效减少对象创建数量造成的性能开销。
  9256. */
  9257. static create(): Region;
  9258. /**
  9259. * @private
  9260. */
  9261. minX: number;
  9262. /**
  9263. * @private
  9264. */
  9265. minY: number;
  9266. /**
  9267. * @private
  9268. */
  9269. maxX: number;
  9270. /**
  9271. * @private
  9272. */
  9273. maxY: number;
  9274. /**
  9275. * @private
  9276. */
  9277. width: number;
  9278. /**
  9279. * @private
  9280. */
  9281. height: number;
  9282. /**
  9283. * @private
  9284. */
  9285. area: number;
  9286. /**
  9287. * @private
  9288. * 是否发生移动
  9289. */
  9290. moved: boolean;
  9291. /**
  9292. * @private
  9293. */
  9294. setTo(minX: number, minY: number, maxX: number, maxY: number): Region;
  9295. /**
  9296. * @private
  9297. * 把所有值都取整
  9298. */
  9299. intValues(): void;
  9300. /**
  9301. * @private
  9302. */
  9303. updateArea(): void;
  9304. /**
  9305. * @private
  9306. * 注意!由于性能优化,此方法不判断自身是否为空,必须在外部确认自身和目标区域都不为空再调用合并。否则结果始终从0,0点开始。
  9307. */
  9308. union(target: Region): void;
  9309. /**
  9310. * @private
  9311. * 注意!由于性能优化,此方法不判断自身是否为空,必须在外部确认自身和目标区域都不为空再调用合并。否则结果始终从0,0点开始。
  9312. */
  9313. intersect(target: Region): void;
  9314. /**
  9315. * @private
  9316. */
  9317. private setEmpty();
  9318. /**
  9319. * @private
  9320. * 确定此 Region 对象是否为空。
  9321. */
  9322. isEmpty(): boolean;
  9323. /**
  9324. * @private
  9325. */
  9326. intersects(target: Region): boolean;
  9327. /**
  9328. * @private
  9329. */
  9330. updateRegion(bounds: Rectangle, matrix: Matrix): void;
  9331. }
  9332. }
  9333. declare namespace egret.sys {
  9334. /**
  9335. * @private
  9336. * 共享的用于碰撞检测的渲染缓冲
  9337. */
  9338. let customHitTestBuffer: sys.RenderBuffer;
  9339. /**
  9340. * @private
  9341. * 共享的用于canvas碰撞检测的渲染缓冲
  9342. */
  9343. let canvasHitTestBuffer: sys.RenderBuffer;
  9344. /**
  9345. * @private
  9346. * 渲染缓冲
  9347. */
  9348. interface RenderBuffer {
  9349. /**
  9350. * 呈现最终绘图结果的画布。
  9351. * @readOnly
  9352. */
  9353. surface: any;
  9354. /**
  9355. * 渲染上下文。
  9356. * @readOnly
  9357. */
  9358. context: any;
  9359. /**
  9360. * 渲染缓冲的宽度,以像素为单位。
  9361. * @readOnly
  9362. */
  9363. width: number;
  9364. /**
  9365. * 渲染缓冲的高度,以像素为单位。
  9366. * @readOnly
  9367. */
  9368. height: number;
  9369. /**
  9370. * 改变渲染缓冲的大小并清空缓冲区
  9371. * @param width 改变后的宽
  9372. * @param height 改变后的高
  9373. * @param useMaxSize 若传入true,则将改变后的尺寸与已有尺寸对比,保留较大的尺寸。
  9374. */
  9375. resize(width: number, height: number, useMaxSize?: boolean): void;
  9376. /**
  9377. * 改变渲染缓冲为指定大小,但保留原始图像数据
  9378. * @param width 改变后的宽
  9379. * @param height 改变后的高
  9380. * @param offsetX 原始图像数据在改变后缓冲区的绘制起始位置x
  9381. * @param offsetY 原始图像数据在改变后缓冲区的绘制起始位置y
  9382. */
  9383. resizeTo(width: number, height: number, offsetX: number, offsetY: number): void;
  9384. /**
  9385. * 清空并设置裁切区域
  9386. * @param regions 矩形列表
  9387. * @param offsetX 矩形偏移量x
  9388. * @param offsetY 矩形偏移量y
  9389. */
  9390. beginClip(regions: sys.Region[], offsetX?: number, offsetY?: number): void;
  9391. /**
  9392. * 取消上一次设置的clip。
  9393. */
  9394. endClip(): void;
  9395. /**
  9396. * 获取指定区域的像素
  9397. */
  9398. getPixels(x: number, y: number, width?: number, height?: number): number[];
  9399. /**
  9400. * 转换成base64字符串,如果图片(或者包含的图片)跨域,则返回null
  9401. * @param type 转换的类型,如: "image/png","image/jpeg"
  9402. */
  9403. toDataURL(type?: string, ...args: any[]): string;
  9404. /**
  9405. * 清空缓冲区数据
  9406. */
  9407. clear(): void;
  9408. /**
  9409. * 销毁渲染缓冲
  9410. */
  9411. destroy(): void;
  9412. /**
  9413. * 设置脏矩形策略
  9414. */
  9415. setDirtyRegionPolicy(state: string): void;
  9416. }
  9417. /**
  9418. * @private
  9419. */
  9420. let RenderBuffer: {
  9421. /**
  9422. * 创建一个RenderTarget。
  9423. * 注意:若内存不足或创建缓冲区失败,将会抛出错误异常。
  9424. * @param width 渲染缓冲的初始宽
  9425. * @param height 渲染缓冲的初始高
  9426. * @param root 是否为舞台buffer
  9427. */
  9428. new (width?: number, height?: number, root?: boolean): RenderBuffer;
  9429. };
  9430. /**
  9431. * @private
  9432. */
  9433. let CanvasRenderBuffer: {
  9434. /**
  9435. * 创建一个CanvasRenderBuffer。
  9436. * 注意:若内存不足或创建缓冲区失败,将会抛出错误异常。
  9437. * @param width 渲染缓冲的初始宽
  9438. * @param height 渲染缓冲的初始高
  9439. */
  9440. new (width?: number, height?: number): RenderBuffer;
  9441. };
  9442. }
  9443. declare namespace egret.sys {
  9444. /**
  9445. * @private
  9446. */
  9447. interface Renderable extends HashObject {
  9448. /**
  9449. * 获取渲染节点
  9450. */
  9451. $getRenderNode(): RenderNode;
  9452. /**
  9453. * @private
  9454. * 更新对象在舞台上的显示区域和透明度,返回显示区域是否发生改变。
  9455. * 注意:此方法必须在$getRenderNode()被调用之后执行。
  9456. */
  9457. $update(dirtyRegionPolicy: string, bounds?: Rectangle): boolean;
  9458. }
  9459. }
  9460. declare namespace egret.sys {
  9461. /**
  9462. * @private
  9463. * 设备屏幕
  9464. */
  9465. interface Screen {
  9466. /**
  9467. * @private
  9468. * 更新屏幕视口尺寸
  9469. */
  9470. updateScreenSize(): any;
  9471. /**
  9472. * @private
  9473. * 更新触摸数量
  9474. */
  9475. updateMaxTouches(): any;
  9476. /**
  9477. * @private
  9478. * 设置分辨率尺寸
  9479. */
  9480. setContentSize(width: number, height: number): any;
  9481. }
  9482. }
  9483. declare namespace egret.sys {
  9484. /**
  9485. * @private
  9486. * 屏幕适配器接口,当播放器视口尺寸改变时,屏幕适配器将被用于计算当前对应的舞台显示尺寸。
  9487. */
  9488. interface IScreenAdapter {
  9489. /**
  9490. * @private
  9491. * 计算舞台显示尺寸
  9492. * @param scaleMode 当前的缩放模式
  9493. * @param screenWidth 播放器视口宽度
  9494. * @param screenHeight 播放器视口高度
  9495. * @param contentWidth 初始化内容宽度
  9496. * @param contentHeight 初始化内容高度
  9497. */
  9498. calculateStageSize(scaleMode: string, screenWidth: number, screenHeight: number, contentWidth: number, contentHeight: number): StageDisplaySize;
  9499. }
  9500. /**
  9501. * @private
  9502. * 舞台显示尺寸数据
  9503. */
  9504. interface StageDisplaySize {
  9505. /**
  9506. * @private
  9507. * 舞台宽度
  9508. */
  9509. stageWidth: number;
  9510. /**
  9511. * @private
  9512. * 舞台高度
  9513. */
  9514. stageHeight: number;
  9515. /**
  9516. * @private
  9517. * 显示宽度,若跟舞台宽度不同,将会产生缩放。
  9518. */
  9519. displayWidth: number;
  9520. /**
  9521. * @private
  9522. * 显示高度,若跟舞台高度不同,将会产生缩放。
  9523. */
  9524. displayHeight: number;
  9525. }
  9526. /**
  9527. * @private
  9528. * 屏幕适配器实例,开发者可以通过给这个变量赋值实现了IScreenAdapter接口的实例,从而注入自定义的屏幕适配器。
  9529. */
  9530. let screenAdapter: IScreenAdapter;
  9531. /**
  9532. * @private
  9533. * 屏幕适配器默认实现,开发者可以实现自定义规则的屏幕适配器。并在初始化加载时将适配器的实例赋值给egret.sys.screenAdapter上,从而替换掉默认适配器。
  9534. */
  9535. class DefaultScreenAdapter extends HashObject implements IScreenAdapter {
  9536. /**
  9537. * @private
  9538. */
  9539. constructor();
  9540. /**
  9541. * @private
  9542. * 计算舞台显示尺寸
  9543. * @param scaleMode 当前的缩放模式
  9544. * @param screenWidth 播放器视口宽度
  9545. * @param screenHeight 播放器视口高度
  9546. * @param contentWidth 初始化内容宽度
  9547. * @param contentHeight 初始化内容高度
  9548. */
  9549. calculateStageSize(scaleMode: string, screenWidth: number, screenHeight: number, contentWidth: number, contentHeight: number): StageDisplaySize;
  9550. }
  9551. }
  9552. declare namespace egret {
  9553. /**
  9554. * @language en_US
  9555. * StageScaleMode class provides values for the stage zoom mode.
  9556. * @version Egret 2.4
  9557. * @platform Web,Native
  9558. * @includeExample egret/player/StageScaleMode.ts
  9559. */
  9560. /**
  9561. * @language zh_CN
  9562. * StageScaleMode 类为舞台缩放模式提供值。
  9563. * @version Egret 2.4
  9564. * @platform Web,Native
  9565. * @includeExample egret/player/StageScaleMode.ts
  9566. */
  9567. class StageScaleMode {
  9568. /**
  9569. * @language en_US
  9570. * Do not scale application content. Even when you change the player viewport size, it remains unchanged. If the player is smaller than the viewport content, possibly with some cropping.<br/>
  9571. * In this mode, the stage size (Stage.stageWidth, Stage.stageHeight) always with the player viewport size consistent.
  9572. */
  9573. /**
  9574. * @language zh_CN
  9575. * 不缩放应用程序内容。即使在更改播放器视口大小时,它仍然保持不变。如果播放器视口比内容小,则可能进行一些裁切。<br/>
  9576. * 在此模式下,舞台尺寸(Stage.stageWidth,Stage.stageHeight)始终跟播放器视口大小保持一致。
  9577. */
  9578. static NO_SCALE: string;
  9579. /**
  9580. * @language en_US
  9581. * Keep the original aspect ratio scaling application content, after scaling a wide directions application content to fill the viewport players on both sides in the other direction may not be wide enough and left black bars.<br/>
  9582. * In this mode, the stage size (Stage.stageWidth, Stage.stageHeight) is always equal to the initialization incoming external application content size.
  9583. */
  9584. /**
  9585. * @language zh_CN
  9586. * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容的较宽方向填满播放器视口,另一个方向的两侧可能会不够宽而留有黑边。<br/>
  9587. * 在此模式下,舞台尺寸(Stage.stageWidth,Stage.stageHeight)始终等于初始化时外部传入的应用程序内容尺寸。
  9588. */
  9589. static SHOW_ALL: string;
  9590. /**
  9591. * @language en_US
  9592. * Keep the original aspect ratio scaling application content, after scaling a narrow direction of application content to fill the viewport players on both sides in the other direction may exceed the viewport and the player is cut.<br/>
  9593. * In this mode, the stage size (Stage.stageWidth, Stage.stageHeight) is always equal to the initialization incoming external application content size.
  9594. */
  9595. /**
  9596. * @language zh_CN
  9597. * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容的较窄方向填满播放器视口,另一个方向的两侧可能会超出播放器视口而被裁切。<br/>
  9598. * 在此模式下,舞台尺寸(Stage.stageWidth,Stage.stageHeight)始终等于初始化时外部传入的应用程序内容尺寸。
  9599. */
  9600. static NO_BORDER: string;
  9601. /**
  9602. * @language en_US
  9603. * Do not keep the original aspect ratio scaling application content, after scaling application content just fill the player viewport.<br/>
  9604. * In this mode, the stage size (Stage.stageWidth, Stage.stageHeight) is always equal to the initialization incoming external application content size.
  9605. */
  9606. /**
  9607. * @language zh_CN
  9608. * 不保持原始宽高比缩放应用程序内容,缩放后应用程序内容正好填满播放器视口。<br/>
  9609. * 在此模式下,舞台尺寸(Stage.stageWidth,Stage.stageHeight)始终等于初始化时外部传入的应用程序内容尺寸。
  9610. */
  9611. static EXACT_FIT: string;
  9612. /**
  9613. * @language en_US
  9614. * Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, but only to keep the contents of the original application constant width, height may change.<br/>
  9615. * In this mode, the stage width (Stage.stageWidth) is always equal to initialize external incoming application content width. Stage height (Stage.stageHeight) by the current scale with the player viewport height decision.
  9616. */
  9617. /**
  9618. * @language zh_CN
  9619. * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,但只保持应用程序内容的原始宽度不变,高度可能会改变。<br/>
  9620. * 在此模式下,舞台宽度(Stage.stageWidth)始终等于初始化时外部传入的应用程序内容宽度。舞台高度(Stage.stageHeight)由当前的缩放比例与播放器视口高度决定。
  9621. */
  9622. static FIXED_WIDTH: string;
  9623. /**
  9624. * @language en_US
  9625. * Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, but only to keep the contents of the original application constant height, width may change.<br/>
  9626. * In this mode, the stage height (Stage.stageHeight) is always equal to initialize external incoming application content height. Stage width (Stage.stageWidth) by the current scale with the player viewport width decision.
  9627. */
  9628. /**
  9629. * @language zh_CN
  9630. * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,但只保持应用程序内容的原始高度不变,宽度可能会改变。<br/>
  9631. * 在此模式下,舞台高度(Stage.stageHeight)始终等于初始化时外部传入的应用程序内容高度。舞台宽度(Stage.stageWidth)由当前的缩放比例与播放器视口宽度决定。
  9632. */
  9633. static FIXED_HEIGHT: string;
  9634. /**
  9635. * @language en_US
  9636. * Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player,a narrow direction may not be wide enough and fill.<br/>
  9637. * In this mode, the stage height (Stage.stageHeight) and the stage width (Stage.stageWidth) by the current scale with the player viewport size.
  9638. */
  9639. /**
  9640. * @language zh_CN
  9641. * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,应用程序内容的较窄方向可能会不够宽而填充。<br/>
  9642. * 在此模式下,舞台高度(Stage.stageHeight)和舞台宽度(Stage.stageWidth)由当前的缩放比例与播放器视口宽高决定。
  9643. */
  9644. static FIXED_NARROW: string;
  9645. /**
  9646. * @language en_US
  9647. * Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, a wide direction may exceed the viewport and the player is cut.<br/>
  9648. * In this mode, the stage height (Stage.stageHeight) and the stage width (Stage.stageWidth) by the current scale with the player viewport size.
  9649. */
  9650. /**
  9651. * @language zh_CN
  9652. * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,应用程序内容的较宽方向的两侧可能会超出播放器视口而被裁切。<br/>
  9653. * 在此模式下,舞台高度(Stage.stageHeight)和舞台宽度(Stage.stageWidth)由当前的缩放比例与播放器视口宽高决定。
  9654. */
  9655. static FIXED_WIDE: string;
  9656. }
  9657. }
  9658. declare namespace egret.sys {
  9659. /**
  9660. * @private
  9661. */
  9662. let systemRenderer: SystemRenderer;
  9663. /**
  9664. * @private
  9665. * 用于碰撞检测绘制
  9666. */
  9667. let canvasRenderer: SystemRenderer;
  9668. /**
  9669. * @private
  9670. * 显示渲染器接口
  9671. */
  9672. interface SystemRenderer {
  9673. /**
  9674. * 渲染一个显示对象
  9675. * @param displayObject 要渲染的显示对象
  9676. * @param buffer 渲染缓冲
  9677. * @param matrix 要对显示对象整体叠加的变换矩阵
  9678. * @param dirtyList 脏矩形列表
  9679. * @param forRenderTexture 绘制目标是RenderTexture的标志
  9680. * @returns drawCall触发绘制的次数
  9681. */
  9682. render(displayObject: DisplayObject, buffer: RenderBuffer, matrix: Matrix, dirtyList?: Region[], forRenderTexture?: boolean): number;
  9683. /**
  9684. * 将一个RenderNode对象绘制到渲染缓冲
  9685. * @param node 要绘制的节点
  9686. * @param buffer 渲染缓冲
  9687. * @param matrix 要叠加的矩阵
  9688. * @param forHitTest 绘制结果是用于碰撞检测。若为true,当渲染GraphicsNode时,会忽略透明度样式设置,全都绘制为不透明的。
  9689. */
  9690. drawNodeToBuffer(node: sys.RenderNode, buffer: RenderBuffer, matrix: Matrix, forHitTest?: boolean): void;
  9691. }
  9692. }
  9693. declare namespace egret.sys {
  9694. /**
  9695. * @private
  9696. */
  9697. let $START_TIME: number;
  9698. /**
  9699. * @private
  9700. * 是否要广播Event.RENDER事件的标志。
  9701. */
  9702. let $invalidateRenderFlag: boolean;
  9703. /**
  9704. * @private
  9705. * 需要立即刷新屏幕的标志
  9706. */
  9707. let $requestRenderingFlag: boolean;
  9708. /**
  9709. * @private
  9710. * Egret心跳计时器
  9711. */
  9712. class SystemTicker {
  9713. /**
  9714. * @private
  9715. */
  9716. constructor();
  9717. /**
  9718. * @private
  9719. */
  9720. private playerList;
  9721. /**
  9722. * @private
  9723. * 注册一个播放器实例并运行
  9724. */
  9725. $addPlayer(player: Player): void;
  9726. /**
  9727. * @private
  9728. * 停止一个播放器实例的运行。
  9729. */
  9730. $removePlayer(player: Player): void;
  9731. /**
  9732. * @private
  9733. */
  9734. private callBackList;
  9735. /**
  9736. * @private
  9737. */
  9738. private thisObjectList;
  9739. /**
  9740. * @private
  9741. */
  9742. $startTick(callBack: (timeStamp: number) => boolean, thisObject: any): void;
  9743. /**
  9744. * @private
  9745. */
  9746. $stopTick(callBack: (timeStamp: number) => boolean, thisObject: any): void;
  9747. /**
  9748. * @private
  9749. */
  9750. private getTickIndex(callBack, thisObject);
  9751. /**
  9752. * @private
  9753. *
  9754. */
  9755. private concatTick();
  9756. /**
  9757. * @private
  9758. * 全局帧率
  9759. */
  9760. $frameRate: number;
  9761. /**
  9762. * @private
  9763. */
  9764. private frameInterval;
  9765. private frameDeltaTime;
  9766. private lastTimeStamp;
  9767. /**
  9768. * @private
  9769. * 设置全局帧率
  9770. */
  9771. $setFrameRate(value: number): boolean;
  9772. /**
  9773. * @private
  9774. */
  9775. private lastCount;
  9776. /**
  9777. * @private
  9778. * ticker 花销的时间
  9779. */
  9780. private costEnterFrame;
  9781. /**
  9782. * @private
  9783. * 执行一次刷新
  9784. */
  9785. update(): void;
  9786. /**
  9787. * @private
  9788. * 执行一次屏幕渲染
  9789. */
  9790. private render(triggerByFrame, costTicker);
  9791. /**
  9792. * @private
  9793. * 广播EnterFrame事件。
  9794. */
  9795. private broadcastEnterFrame();
  9796. /**
  9797. * @private
  9798. * 广播Render事件。
  9799. */
  9800. private broadcastRender();
  9801. /**
  9802. * @private
  9803. */
  9804. private callLaters();
  9805. /**
  9806. * @private
  9807. */
  9808. private callLaterAsyncs();
  9809. }
  9810. /**
  9811. * @private
  9812. * 心跳计时器单例
  9813. */
  9814. let $ticker: SystemTicker;
  9815. }
  9816. /**
  9817. * @private
  9818. */
  9819. declare let egret_stages: egret.Stage[];
  9820. declare namespace egret.sys {
  9821. /**
  9822. * @private
  9823. * 用户交互操作管理器
  9824. */
  9825. class TouchHandler extends HashObject {
  9826. private maxTouches;
  9827. private useTouchesCount;
  9828. /**
  9829. * @private
  9830. */
  9831. constructor(stage: Stage);
  9832. /**
  9833. * @private
  9834. * 设置同时触摸数量
  9835. */
  9836. $initMaxTouches(): void;
  9837. /**
  9838. * @private
  9839. */
  9840. private stage;
  9841. /**
  9842. * @private
  9843. */
  9844. private touchDownTarget;
  9845. /**
  9846. * @private
  9847. * 触摸开始(按下)
  9848. * @param x 事件发生处相对于舞台的坐标x
  9849. * @param y 事件发生处相对于舞台的坐标y
  9850. * @param touchPointID 分配给触摸点的唯一标识号
  9851. */
  9852. onTouchBegin(x: number, y: number, touchPointID: number): void;
  9853. /**
  9854. * @private
  9855. */
  9856. private lastTouchX;
  9857. /**
  9858. * @private
  9859. */
  9860. private lastTouchY;
  9861. /**
  9862. * @private
  9863. * 触摸移动
  9864. * @param x 事件发生处相对于舞台的坐标x
  9865. * @param y 事件发生处相对于舞台的坐标y
  9866. * @param touchPointID 分配给触摸点的唯一标识号
  9867. */
  9868. onTouchMove(x: number, y: number, touchPointID: number): void;
  9869. /**
  9870. * @private
  9871. * 触摸结束(弹起)
  9872. * @param x 事件发生处相对于舞台的坐标x
  9873. * @param y 事件发生处相对于舞台的坐标y
  9874. * @param touchPointID 分配给触摸点的唯一标识号
  9875. */
  9876. onTouchEnd(x: number, y: number, touchPointID: number): void;
  9877. /**
  9878. * @private
  9879. * 获取舞台坐标下的触摸对象
  9880. */
  9881. private findTarget(stageX, stageY);
  9882. }
  9883. }
  9884. declare namespace egret.sys {
  9885. /**
  9886. * @private
  9887. * 位图渲染节点
  9888. */
  9889. class BitmapNode extends RenderNode {
  9890. constructor();
  9891. /**
  9892. * 要绘制的位图
  9893. */
  9894. image: BitmapData;
  9895. /**
  9896. * 控制在缩放时是否对位图进行平滑处理。
  9897. */
  9898. smoothing: boolean;
  9899. /**
  9900. * 相对偏移矩阵。
  9901. */
  9902. matrix: egret.Matrix;
  9903. /**
  9904. * 图片宽度。WebGL渲染使用
  9905. */
  9906. imageWidth: number;
  9907. /**
  9908. * 图片高度。WebGL渲染使用
  9909. */
  9910. imageHeight: number;
  9911. /**
  9912. * 使用的混合模式
  9913. */
  9914. blendMode: number;
  9915. /**
  9916. * 相对透明度
  9917. */
  9918. alpha: number;
  9919. /**
  9920. * 相对透明度
  9921. */
  9922. filter: ColorMatrixFilter;
  9923. /**
  9924. * 绘制一次位图
  9925. */
  9926. drawImage(sourceX: number, sourceY: number, sourceW: number, sourceH: number, drawX: number, drawY: number, drawW: number, drawH: number): void;
  9927. /**
  9928. * 在显示对象的$render()方法被调用前,自动清空自身的drawData数据。
  9929. */
  9930. cleanBeforeRender(): void;
  9931. static $updateTextureData(node: sys.BitmapNode, image: any, bitmapX: number, bitmapY: number, bitmapWidth: number, bitmapHeight: number, offsetX: number, offsetY: number, textureWidth: number, textureHeight: number, destW: number, destH: number, sourceWidth: number, sourceHeight: number, scale9Grid: egret.Rectangle, fillMode: string, smoothing: boolean): void;
  9932. /**
  9933. * @private
  9934. * 绘制九宫格位图
  9935. */
  9936. private static $updateTextureDataWithScale9Grid(node, scale9Grid, bitmapX, bitmapY, bitmapWidth, bitmapHeight, offsetX, offsetY, textureWidth, textureHeight, destW, destH);
  9937. /**
  9938. * @private
  9939. */
  9940. private static drawClipImage(node, scale, bitmapX, bitmapY, scaledBitmapW, scaledBitmapH, offsetX, offsetY, destW, destH, startX?, startY?);
  9941. }
  9942. }
  9943. declare namespace egret.sys {
  9944. /**
  9945. * @private
  9946. * 矢量渲染节点
  9947. */
  9948. class GraphicsNode extends RenderNode {
  9949. constructor();
  9950. /**
  9951. * 指定一种简单的单一颜色填充,在绘制时该填充将在随后对其他 Graphics 方法(如 lineTo() 或 drawCircle())的调用中使用。
  9952. * @param color 填充的颜色
  9953. * @param alpha 填充的 Alpha 值
  9954. * @param beforePath 插入在指定的路径命令之前绘制,通常是插入到当前正在绘制的线条路径之前,以确保线条总在填充的上方。
  9955. */
  9956. beginFill(color: number, alpha?: number, beforePath?: Path2D): Path2D;
  9957. /**
  9958. * 指定一种简单的单一颜色填充,在绘制时该填充将在随后对其他 Graphics 方法(如 lineTo() 或 drawCircle())的调用中使用。
  9959. * 调用 clear() 方法会清除填充。
  9960. * @param type 用于指定要使用哪种渐变类型的 GradientType 类的值:GradientType.LINEAR 或 GradientType.RADIAL。
  9961. * @param colors 渐变中使用的 RGB 十六进制颜色值的数组(例如,红色为 0xFF0000,蓝色为 0x0000FF,等等)。对于每种颜色,请在 alphas 和 ratios 参数中指定对应值。
  9962. * @param alphas colors 数组中对应颜色的 alpha 值数组。
  9963. * @param ratios 颜色分布比率的数组。有效值为 0 到 255。
  9964. * @param matrix 一个由 egret.Matrix 类定义的转换矩阵。egret.Matrix 类包括 createGradientBox() 方法,通过该方法可以方便地设置矩阵,以便与 beginGradientFill() 方法一起使用
  9965. * @param beforePath 插入在指定的路径命令之前绘制,通常是插入到当前正在绘制的线条路径之前,以确保线条总在填充的上方。
  9966. */
  9967. beginGradientFill(type: string, colors: number[], alphas: number[], ratios: number[], matrix?: egret.Matrix, beforePath?: Path2D): Path2D;
  9968. /**
  9969. * 指定一种线条样式以用于随后对 lineTo() 或 drawCircle() 等 Graphics 方法的调用。
  9970. * @param thickness 一个整数,以点为单位表示线条的粗细,有效值为 0 到 255。如果未指定数字,或者未定义该参数,则不绘制线条。如果传递的值小于 0,则默认值为 0。值 0 表示极细的粗细;最大粗细为 255。如果传递的值大于 255,则默认值为 255。
  9971. * @param color 线条的十六进制颜色值(例如,红色为 0xFF0000,蓝色为 0x0000FF 等)。如果未指明值,则默认值为 0x000000(黑色)。可选。
  9972. * @param alpha 表示线条颜色的 Alpha 值的数字;有效值为 0 到 1。如果未指明值,则默认值为 1(纯色)。如果值小于 0,则默认值为 0。如果值大于 1,则默认值为 1。
  9973. * @param caps 用于指定线条末端处端点类型的 CapsStyle 类的值。默认值:CapsStyle.ROUND
  9974. * @param joints 指定用于拐角的连接外观的类型。默认值:JointStyle.ROUND
  9975. * @param miterLimit 用于表示剪切斜接的极限值的数字。
  9976. */
  9977. lineStyle(thickness?: number, color?: number, alpha?: number, caps?: string, joints?: string, miterLimit?: number): Path2D;
  9978. /**
  9979. * 清空所有缓存的绘制数据
  9980. */
  9981. clear(): void;
  9982. /**
  9983. * 覆盖父类方法,不自动清空缓存的绘图数据,改为手动调用clear()方法清空。
  9984. */
  9985. cleanBeforeRender(): void;
  9986. /**
  9987. * 绘制x偏移
  9988. */
  9989. x: number;
  9990. /**
  9991. * 绘制y偏移
  9992. */
  9993. y: number;
  9994. /**
  9995. * 绘制宽度
  9996. */
  9997. width: number;
  9998. /**
  9999. * 绘制高度
  10000. */
  10001. height: number;
  10002. /**
  10003. * 脏渲染标记
  10004. * 暂时调用lineStyle,beginFill,beginGradientFill标记,实际应该draw时候标记在Path2D
  10005. */
  10006. dirtyRender: boolean;
  10007. $texture: any;
  10008. $textureWidth: any;
  10009. $textureHeight: any;
  10010. /**
  10011. * 清除非绘制的缓存数据
  10012. */
  10013. clean(): void;
  10014. }
  10015. }
  10016. declare namespace egret.sys {
  10017. /**
  10018. * @private
  10019. * 组渲染节点,用于组合多个渲染节点
  10020. */
  10021. class GroupNode extends RenderNode {
  10022. constructor();
  10023. addNode(node: RenderNode): void;
  10024. /**
  10025. * 覆盖父类方法,不自动清空缓存的绘图数据,改为手动调用clear()方法清空。
  10026. * 这里只是想清空绘制命令,因此不调用super
  10027. */
  10028. cleanBeforeRender(): void;
  10029. $getRenderCount(): number;
  10030. }
  10031. }
  10032. declare namespace egret.sys {
  10033. /**
  10034. * @private
  10035. * Mesh 渲染节点
  10036. */
  10037. class MeshNode extends RenderNode {
  10038. constructor();
  10039. /**
  10040. * 要绘制的位图
  10041. */
  10042. image: BitmapData;
  10043. /**
  10044. * 控制在缩放时是否对位图进行平滑处理。
  10045. */
  10046. smoothing: boolean;
  10047. /**
  10048. * 图片宽度。WebGL渲染使用
  10049. */
  10050. imageWidth: number;
  10051. /**
  10052. * 图片高度。WebGL渲染使用
  10053. */
  10054. imageHeight: number;
  10055. /**
  10056. * 相对偏移矩阵。
  10057. */
  10058. matrix: egret.Matrix;
  10059. /**
  10060. * UV 坐标。
  10061. */
  10062. uvs: number[];
  10063. /**
  10064. * 顶点坐标。
  10065. */
  10066. vertices: number[];
  10067. /**
  10068. * 顶点索引。
  10069. */
  10070. indices: number[];
  10071. /**
  10072. * 顶点索引。
  10073. */
  10074. bounds: Rectangle;
  10075. /**
  10076. * 绘制一次位图
  10077. */
  10078. drawMesh(sourceX: number, sourceY: number, sourceW: number, sourceH: number, drawX: number, drawY: number, drawW: number, drawH: number): void;
  10079. /**
  10080. * 在显示对象的$render()方法被调用前,自动清空自身的drawData数据。
  10081. */
  10082. cleanBeforeRender(): void;
  10083. }
  10084. }
  10085. declare namespace egret {
  10086. /**
  10087. * @language en_US
  10088. * RenderTexture is a dynamic texture
  10089. * @extends egret.Texture
  10090. * @version Egret 2.4
  10091. * @platform Web,Native
  10092. * @includeExample egret/display/RenderTexture.ts
  10093. */
  10094. /**
  10095. * @language zh_CN
  10096. * RenderTexture 是动态纹理类,他实现了将显示对象及其子对象绘制成为一个纹理的功能
  10097. * @extends egret.Texture
  10098. * @version Egret 2.4
  10099. * @platform Web,Native
  10100. * @includeExample egret/display/RenderTexture.ts
  10101. */
  10102. class RenderTexture extends egret.Texture {
  10103. constructor();
  10104. $renderBuffer: sys.RenderBuffer;
  10105. /**
  10106. * @language en_US
  10107. * The specified display object is drawn as a texture
  10108. * @param displayObject {egret.DisplayObject} the display to draw
  10109. * @param clipBounds {egret.Rectangle} clip rect
  10110. * @param scale {number} scale factor
  10111. * @version Egret 2.4
  10112. * @platform Web,Native
  10113. */
  10114. /**
  10115. * @language zh_CN
  10116. * 将指定显示对象绘制为一个纹理
  10117. * @param displayObject {egret.DisplayObject} 需要绘制的显示对象
  10118. * @param clipBounds {egret.Rectangle} 绘制矩形区域
  10119. * @param scale {number} 缩放比例
  10120. * @version Egret 2.4
  10121. * @platform Web,Native
  10122. */
  10123. drawToTexture(displayObject: egret.DisplayObject, clipBounds?: Rectangle, scale?: number): boolean;
  10124. /**
  10125. * @inheritDoc
  10126. */
  10127. getPixel32(x: number, y: number): number[];
  10128. /**
  10129. * @inheritDoc
  10130. */
  10131. dispose(): void;
  10132. }
  10133. }
  10134. declare namespace egret.sys {
  10135. /**
  10136. * @private
  10137. * 位图渲染节点
  10138. */
  10139. class SetAlphaNode extends RenderNode {
  10140. constructor();
  10141. /**
  10142. * 绘制一次位图
  10143. */
  10144. setAlpha(alpha: number): void;
  10145. }
  10146. }
  10147. declare namespace egret.sys {
  10148. /**
  10149. * @private
  10150. * 文本格式
  10151. */
  10152. interface TextFormat {
  10153. /**
  10154. * 颜色值
  10155. */
  10156. textColor?: number;
  10157. /**
  10158. * 描边颜色值
  10159. */
  10160. strokeColor?: number;
  10161. /**
  10162. * 字号
  10163. */
  10164. size?: number;
  10165. /**
  10166. * 描边大小
  10167. */
  10168. stroke?: number;
  10169. /**
  10170. * 是否加粗
  10171. */
  10172. bold?: boolean;
  10173. /**
  10174. * 是否倾斜
  10175. */
  10176. italic?: boolean;
  10177. /**
  10178. * 字体名称
  10179. */
  10180. fontFamily?: string;
  10181. }
  10182. }
  10183. declare namespace egret.sys {
  10184. /**
  10185. * @private
  10186. * 文本渲染节点
  10187. */
  10188. class TextNode extends RenderNode {
  10189. constructor();
  10190. /**
  10191. * 颜色值
  10192. */
  10193. textColor: number;
  10194. /**
  10195. * 描边颜色值
  10196. */
  10197. strokeColor: number;
  10198. /**
  10199. * 字号
  10200. */
  10201. size: number;
  10202. /**
  10203. * 描边大小
  10204. */
  10205. stroke: number;
  10206. /**
  10207. * 是否加粗
  10208. */
  10209. bold: boolean;
  10210. /**
  10211. * 是否倾斜
  10212. */
  10213. italic: boolean;
  10214. /**
  10215. * 字体名称
  10216. */
  10217. fontFamily: string;
  10218. /**
  10219. * 绘制一行文本
  10220. */
  10221. drawText(x: number, y: number, text: string, format: TextFormat): void;
  10222. /**
  10223. * 在显示对象的$render()方法被调用前,自动清空自身的drawData数据。
  10224. */
  10225. cleanBeforeRender(): void;
  10226. /**
  10227. * 绘制x偏移
  10228. */
  10229. x: number;
  10230. /**
  10231. * 绘制y偏移
  10232. */
  10233. y: number;
  10234. /**
  10235. * 绘制宽度
  10236. */
  10237. width: number;
  10238. /**
  10239. * 绘制高度
  10240. */
  10241. height: number;
  10242. /**
  10243. * 脏渲染标记
  10244. */
  10245. dirtyRender: boolean;
  10246. $texture: any;
  10247. $textureWidth: any;
  10248. $textureHeight: any;
  10249. /**
  10250. * 清除非绘制的缓存数据
  10251. */
  10252. clean(): void;
  10253. }
  10254. }
  10255. declare namespace egret.sys {
  10256. /**
  10257. * @private
  10258. * 填充路径
  10259. */
  10260. class FillPath extends Path2D {
  10261. constructor();
  10262. /**
  10263. * 填充颜色
  10264. */
  10265. fillColor: number;
  10266. /**
  10267. * 填充透明度
  10268. */
  10269. fillAlpha: number;
  10270. }
  10271. }
  10272. declare namespace egret.sys {
  10273. /**
  10274. * @private
  10275. * 渐变填充路径
  10276. */
  10277. class GradientFillPath extends Path2D {
  10278. constructor();
  10279. gradientType: string;
  10280. colors: number[];
  10281. alphas: number[];
  10282. ratios: number[];
  10283. matrix: Matrix;
  10284. }
  10285. }
  10286. declare namespace egret {
  10287. /**
  10288. * @language en_US
  10289. * This class is used to create lightweight shapes using the drawing application program interface (API). The Shape
  10290. * class includes a graphics property, which lets you access methods from the Graphics class.
  10291. * @see egret.Graphics
  10292. * @version Egret 2.4
  10293. * @platform Web,Native
  10294. * @includeExample egret/display/Shape.ts
  10295. */
  10296. /**
  10297. * @language zh_CN
  10298. * 此类用于使用绘图应用程序编程接口 (API) 创建简单形状。Shape 类含有 graphics 属性,通过该属性您可以访问各种矢量绘图方法。
  10299. * @see egret.Graphics
  10300. * @version Egret 2.4
  10301. * @platform Web,Native
  10302. * @includeExample egret/display/Shape.ts
  10303. */
  10304. class Shape extends DisplayObject {
  10305. /**
  10306. * @language en_US
  10307. * Creates a new Shape object.
  10308. * @version Egret 2.4
  10309. * @platform Web,Native
  10310. */
  10311. /**
  10312. * @language zh_CN
  10313. * 创建一个 Shape 对象
  10314. * @version Egret 2.4
  10315. * @platform Web,Native
  10316. */
  10317. constructor();
  10318. /**
  10319. * @private
  10320. */
  10321. $graphics: Graphics;
  10322. /**
  10323. * @language en_US
  10324. * Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur.
  10325. * @version Egret 2.4
  10326. * @platform Web,Native
  10327. */
  10328. /**
  10329. * @language zh_CN
  10330. * 获取 Shape 中的 Graphics 对象。可通过此对象执行矢量绘图命令。
  10331. * @version Egret 2.4
  10332. * @platform Web,Native
  10333. */
  10334. graphics: Graphics;
  10335. /**
  10336. * @private
  10337. */
  10338. $measureContentBounds(bounds: Rectangle): void;
  10339. $hitTest(stageX: number, stageY: number): DisplayObject;
  10340. /**
  10341. * @private
  10342. */
  10343. $onRemoveFromStage(): void;
  10344. }
  10345. }
  10346. declare namespace egret.sys {
  10347. /**
  10348. * @private
  10349. * 线条路径。
  10350. * 注意:当线条宽度(lineWidth)为1或3像素时,需要特殊处理,往右下角偏移0.5像素,以显示清晰锐利的线条。
  10351. */
  10352. class StrokePath extends Path2D {
  10353. constructor();
  10354. /**
  10355. * 线条宽度。
  10356. * 注意:绘制时对1像素和3像素要特殊处理,整体向右下角偏移0.5像素,以显示清晰锐利的线条。
  10357. */
  10358. lineWidth: number;
  10359. /**
  10360. * 线条颜色
  10361. */
  10362. lineColor: number;
  10363. /**
  10364. * 线条透明度
  10365. */
  10366. lineAlpha: number;
  10367. /**
  10368. * 端点样式,"none":无端点,"round":圆头端点,"square":方头端点
  10369. */
  10370. caps: string;
  10371. /**
  10372. * 联接点样式,"bevel":斜角连接,"miter":尖角连接,"round":圆角连接
  10373. */
  10374. joints: string;
  10375. /**
  10376. * 用于表示剪切斜接的极限值的数字。
  10377. */
  10378. miterLimit: number;
  10379. }
  10380. }
  10381. interface CanvasRenderingContext2D {
  10382. imageSmoothingEnabled: boolean;
  10383. $imageSmoothingEnabled: boolean;
  10384. }
  10385. declare namespace egret {
  10386. /**
  10387. * @private
  10388. * Canvas渲染器
  10389. */
  10390. class CanvasRenderer implements sys.SystemRenderer {
  10391. constructor();
  10392. private nestLevel;
  10393. /**
  10394. * 渲染一个显示对象
  10395. * @param displayObject 要渲染的显示对象
  10396. * @param buffer 渲染缓冲
  10397. * @param matrix 要对显示对象整体叠加的变换矩阵
  10398. * @param dirtyList 脏矩形列表
  10399. * @param forRenderTexture 绘制目标是RenderTexture的标志
  10400. * @returns drawCall触发绘制的次数
  10401. */
  10402. render(displayObject: DisplayObject, buffer: sys.RenderBuffer, matrix: Matrix, dirtyList?: egret.sys.Region[], forRenderTexture?: boolean): number;
  10403. /**
  10404. * @private
  10405. * 绘制一个显示对象
  10406. */
  10407. private drawDisplayObject(displayObject, context, dirtyList, matrix, displayList, clipRegion, root);
  10408. /**
  10409. * @private
  10410. */
  10411. private drawWithFilter(displayObject, context, dirtyList, matrix, clipRegion, root);
  10412. private renderingMask;
  10413. /**
  10414. * @private
  10415. */
  10416. private drawWithClip(displayObject, context, dirtyList, matrix, clipRegion, root);
  10417. /**
  10418. * @private
  10419. */
  10420. private drawWithScrollRect(displayObject, context, dirtyList, matrix, clipRegion, root);
  10421. /**
  10422. * 将一个RenderNode对象绘制到渲染缓冲
  10423. * @param node 要绘制的节点
  10424. * @param buffer 渲染缓冲
  10425. * @param matrix 要叠加的矩阵
  10426. * @param forHitTest 绘制结果是用于碰撞检测。若为true,当渲染GraphicsNode时,会忽略透明度样式设置,全都绘制为不透明的。
  10427. */
  10428. drawNodeToBuffer(node: sys.RenderNode, buffer: sys.RenderBuffer, matrix: Matrix, forHitTest?: boolean): void;
  10429. /**
  10430. * @private
  10431. */
  10432. private renderNode(node, context, forHitTest?);
  10433. /**
  10434. * render mesh
  10435. */
  10436. private renderMesh(node, context);
  10437. /**
  10438. * @private
  10439. */
  10440. private renderBitmap(node, context);
  10441. /**
  10442. * @private
  10443. */
  10444. renderText(node: sys.TextNode, context: CanvasRenderingContext2D): void;
  10445. /**
  10446. * @private
  10447. */
  10448. renderGraphics(node: sys.GraphicsNode, context: CanvasRenderingContext2D, forHitTest?: boolean): number;
  10449. private renderPath(path, context);
  10450. private renderGroup(groupNode, context);
  10451. /**
  10452. * @private
  10453. */
  10454. private createRenderBuffer(width, height);
  10455. }
  10456. }
  10457. declare namespace egret {
  10458. /**
  10459. * @language en_US
  10460. * Orientation monitor the orientation of the device, send CHANGE event when the orientation is changed
  10461. *
  10462. * @event egret.Event.CHANGE device's orientation is changed
  10463. * @version Egret 2.4
  10464. * @platform Web
  10465. * @includeExample egret/sensor/DeviceOrientation.ts
  10466. * @see http://edn.egret.com/cn/docs/page/661 获取设备旋转角度
  10467. */
  10468. /**
  10469. * @language zh_CN
  10470. * Orientation 监听设备方向的变化,当方向变化时派发 CHANGE 事件
  10471. * @event egret.Event.CHANGE 设备方向改变时派发
  10472. * @version Egret 2.4
  10473. * @platform Web
  10474. * @includeExample egret/sensor/DeviceOrientation.ts
  10475. * @see http://edn.egret.com/cn/docs/page/661 获取设备旋转角度
  10476. */
  10477. interface DeviceOrientation extends EventDispatcher {
  10478. /**
  10479. * @language en_US
  10480. * Start to monitor the device's orientation
  10481. * @version Egret 2.4
  10482. * @platform Web
  10483. */
  10484. /**
  10485. * @language zh_CN
  10486. * 开始监听设备方向变化
  10487. * @version Egret 2.4
  10488. * @platform Web
  10489. */
  10490. start(): void;
  10491. /**
  10492. * @language en_US
  10493. * Stop monitor the device's orientation
  10494. * @version Egret 2.4
  10495. * @platform Web
  10496. */
  10497. /**
  10498. * @language zh_CN
  10499. * 停止监听设备方向变化
  10500. * @version Egret 2.4
  10501. * @platform Web
  10502. */
  10503. stop(): void;
  10504. }
  10505. /**
  10506. * @copy egret.Orientation
  10507. */
  10508. let DeviceOrientation: {
  10509. new (): DeviceOrientation;
  10510. };
  10511. }
  10512. declare namespace egret {
  10513. /**
  10514. * @language en_US
  10515. * The Geolocation able to obtain the position of the device.
  10516. * Geolocation will emit CHANGE event when the device's location is changed.
  10517. * It will emit IO_ERROR event if the location request is denied
  10518. * or there is no location service on the device.
  10519. *
  10520. * @event egret.Event.CHANGE The device's location is changed
  10521. * @event egret.Event.IO_ERROR Error occurred while getting the location
  10522. * @version Egret 2.4
  10523. * @platform Web
  10524. * @includeExample egret/sensor/Geolocation.ts
  10525. */
  10526. /**
  10527. * @language zh_CN
  10528. * Geolocation 能够从设备的定位服务获取设备的当前位置。
  10529. * 当设备的位置发生改变时 Geolocation 会派发 CHANGE 事件。
  10530. * 当定位请求被拒绝或该设备没有定位服务时 Geolocation 会派发 IO_ERROR 事件。
  10531. *
  10532. * @event egret.Event.CHANGE 设备位置发生改变
  10533. * @event egret.Event.IO_ERROR 获取设备位置时发生错误
  10534. * @version Egret 2.4
  10535. * @platform Web
  10536. * @includeExample egret/sensor/Geolocation.ts
  10537. */
  10538. interface Geolocation extends EventDispatcher {
  10539. /**
  10540. * @language en_US
  10541. * Start to monitor the device's location
  10542. * @returns
  10543. * @version Egret 2.4
  10544. * @platform Web
  10545. */
  10546. /**
  10547. * @language zh_CN
  10548. * 开始监听设备位置信息
  10549. * @returns
  10550. * @version Egret 2.4
  10551. * @platform Web
  10552. */
  10553. start(): void;
  10554. /**
  10555. * @language en_US
  10556. * Stop monitor the device's location
  10557. * @returns
  10558. * @version Egret 2.4
  10559. * @platform Web
  10560. */
  10561. /**
  10562. * @language zh_CN
  10563. * 停止监听设备位置信息
  10564. * @returns
  10565. * @version Egret 2.4
  10566. * @platform Web
  10567. */
  10568. stop(): void;
  10569. }
  10570. /**
  10571. * @copy egret.Geolocation
  10572. */
  10573. let Geolocation: {
  10574. /**
  10575. * @language en_US
  10576. * constructor
  10577. * @version Egret 2.4
  10578. * @platform Web
  10579. */
  10580. /**
  10581. * @language zh_CN
  10582. * 构造函数
  10583. * @version Egret 2.4
  10584. * @platform Web
  10585. */
  10586. new (): Geolocation;
  10587. };
  10588. }
  10589. declare namespace egret {
  10590. /**
  10591. * @copy egret.Motion
  10592. */
  10593. let Motion: {
  10594. new (): Motion;
  10595. };
  10596. /**
  10597. * @language en_US
  10598. * The Motion class emits events based on activity detected by the device's motion sensor.
  10599. * This data represents the device's movement along a 3-dimensional axis. When the device moves,
  10600. * the sensor detects this movement and emit the CHANGE event. @see egret.MotionEvent
  10601. *
  10602. * @event egret.Event.CHANGE device is moved
  10603. * @version Egret 2.4
  10604. * @platform Web
  10605. * @includeExample egret/sensor/Motion.ts
  10606. */
  10607. /**
  10608. * @language zh_CN
  10609. * Motion 类从用户设备读取运动状态信息并派发 CHANGE 事件。
  10610. * 当设备移动时,传感器会检测到此移动并返回设备加速度,重力和旋转数据。@see egret.MotionEvent
  10611. * Motion 类提供了 start 和 stop 方法,来启动和停止运动信息检查
  10612. *
  10613. * @event egret.Event.CHANGE 运动状态发生改变
  10614. * @version Egret 2.4
  10615. * @platform Web
  10616. * @includeExample egret/sensor/Motion.ts
  10617. */
  10618. interface Motion extends EventDispatcher {
  10619. /**
  10620. * @language en_US
  10621. * Start to monitor device movement
  10622. * @version Egret 2.4
  10623. * @platform Web
  10624. */
  10625. /**
  10626. * @language zh_CN
  10627. * 开始监听设备运动状态
  10628. * @version Egret 2.4
  10629. * @platform Web
  10630. */
  10631. start(): void;
  10632. /**
  10633. * @language en_US
  10634. * Stop monitor device movement
  10635. * @version Egret 2.4
  10636. * @platform Web
  10637. */
  10638. /**
  10639. * @language zh_CN
  10640. * 停止监听设备运动状态
  10641. * @version Egret 2.4
  10642. * @platform Web
  10643. */
  10644. stop(): void;
  10645. }
  10646. /**
  10647. * @language en_US
  10648. * A DeviceRotationRate object provides information about the rate at which
  10649. * the device is rotating around all three axes.
  10650. * @version Egret 2.4
  10651. * @platform Web
  10652. */
  10653. /**
  10654. * @language zh_CN
  10655. * DeviceRotationRate 提供设备围绕三个轴旋转的角速度信息,单位是 角度/秒
  10656. * @version Egret 2.4
  10657. * @platform Web
  10658. */
  10659. interface DeviceRotationRate {
  10660. /**
  10661. * @language en_US
  10662. * The amount of rotation around the Z axis, in degrees per second.
  10663. * @version Egret 2.4
  10664. * @platform Web
  10665. */
  10666. /**
  10667. * @language zh_CN
  10668. * 设备绕 Z 轴旋转的角速度信息,单位是 度/秒
  10669. * @version Egret 2.4
  10670. * @platform Web
  10671. */
  10672. alpha: number;
  10673. /**
  10674. * @language en_US
  10675. * The amount of rotation around the X axis, in degrees per second.
  10676. * @version Egret 2.4
  10677. * @platform Web
  10678. */
  10679. /**
  10680. * @language zh_CN
  10681. * 设备绕 X 轴旋转的角速度信息,单位是 度/秒
  10682. * @version Egret 2.4
  10683. * @platform Web
  10684. */
  10685. beta: number;
  10686. /**
  10687. * @language en_US
  10688. * The amount of rotation around the Y axis, in degrees per second.
  10689. * @version Egret 2.4
  10690. * @platform Web
  10691. */
  10692. /**
  10693. * @language zh_CN
  10694. * 设备绕 Y 轴旋转的角速度信息,单位是 度/秒
  10695. * @version Egret 2.4
  10696. * @platform Web
  10697. */
  10698. gamma: number;
  10699. }
  10700. /**
  10701. * @language en_US
  10702. * A DeviceAcceleration object provides information about the amount
  10703. * of acceleration the device is experiencing along all three axes.
  10704. * Acceleration is expressed in m/s2.
  10705. * @version Egret 2.4
  10706. * @platform Web
  10707. */
  10708. /**
  10709. * @language zh_CN
  10710. * DeviceAcceleration 提供设备在三个维度的加速度信息,加速度值的单位是 m/s2
  10711. * @version Egret 2.4
  10712. * @platform Web
  10713. */
  10714. interface DeviceAcceleration {
  10715. /**
  10716. * @language en_US
  10717. * The amount of acceleration along the X axis
  10718. * @version Egret 2.4
  10719. * @platform Web
  10720. */
  10721. /**
  10722. * @language zh_CN
  10723. * X 轴方向的加速度值
  10724. * @version Egret 2.4
  10725. * @platform Web
  10726. */
  10727. x: number;
  10728. /**
  10729. * @language en_US
  10730. * The amount of acceleration along the Y axis
  10731. * @version Egret 2.4
  10732. * @platform Web
  10733. */
  10734. /**
  10735. * @language zh_CN
  10736. * Y 轴方向的加速度值
  10737. * @version Egret 2.4
  10738. * @platform Web
  10739. */
  10740. y: number;
  10741. /**
  10742. * @language en_US
  10743. * The amount of acceleration along the Z axis
  10744. * @version Egret 2.4
  10745. * @platform Web
  10746. */
  10747. /**
  10748. * @language zh_CN
  10749. * Z 轴方向的加速度值
  10750. * @version Egret 2.4
  10751. * @platform Web
  10752. */
  10753. z: number;
  10754. }
  10755. }
  10756. declare namespace egret {
  10757. /**
  10758. * @language en_US
  10759. * Type of operation.
  10760. * @version Egret 2.4
  10761. * @platform Web,Native
  10762. */
  10763. /**
  10764. * @language zh_CN
  10765. * 运行类型的类型。
  10766. * @version Egret 2.4
  10767. * @platform Web,Native
  10768. */
  10769. class RuntimeType {
  10770. /**
  10771. * @language en_US
  10772. * Running on Web
  10773. * @version Egret 2.4
  10774. * @platform Web,Native
  10775. */
  10776. /**
  10777. * @language zh_CN
  10778. * 运行在Web上
  10779. * @version Egret 2.4
  10780. * @platform Web,Native
  10781. */
  10782. static WEB: string;
  10783. /**
  10784. * @language en_US
  10785. * Running on NATIVE
  10786. * @version Egret 2.4
  10787. * @platform Web,Native
  10788. */
  10789. /**
  10790. * @language zh_CN
  10791. * 运行在NATIVE上
  10792. * @version Egret 2.4
  10793. * @platform Web,Native
  10794. */
  10795. static NATIVE: string;
  10796. }
  10797. /**
  10798. * @language en_US
  10799. * The Capabilities class provides properties that describe the system and runtime that are hosting the application.
  10800. * @version Egret 2.4
  10801. * @platform Web,Native
  10802. * @includeExample egret/system/Capabilities.ts
  10803. */
  10804. /**
  10805. * @language zh_CN
  10806. * Capabilities 类提供一些属性,这些属性描述了承载应用程序的系统和运行时。
  10807. * @version Egret 2.4
  10808. * @platform Web,Native
  10809. * @includeExample egret/system/Capabilities.ts
  10810. */
  10811. class Capabilities {
  10812. /**
  10813. * @private
  10814. */
  10815. static $language: string;
  10816. /**
  10817. * @language en_US
  10818. * Specifies the language code of the system on which the content is running. The language is specified as a lowercase
  10819. * two-letter language code from ISO 639-1. For Chinese, an additional uppercase two-letter country code from ISO 3166
  10820. * distinguishes between Simplified and Traditional Chinese.<br/>
  10821. * The following table lists the possible values,but not limited to them:
  10822. * <ul>
  10823. * <li>Simplified Chinese zh-CN</li>
  10824. * <li>Traditional Chinese zh-TW</li>
  10825. * <li>English en</li>
  10826. * <li>Japanese ja</li>
  10827. * <li>Korean ko</li>
  10828. * </ul>
  10829. * @version Egret 2.4
  10830. * @platform Web,Native
  10831. */
  10832. /**
  10833. * @language zh_CN
  10834. * 表示运行内容的系统的语言代码。语言指定为 ISO 639-1 中的小写双字母语言代码。
  10835. * 对于中文,另外使用 ISO 3166 中的大写双字母国家/地区代码,以区分简体中文和繁体中文。<br/>
  10836. * 以下是可能但不限于的语言和值:
  10837. * <ul>
  10838. * <li>简体中文 zh-CN</li>
  10839. * <li>繁体中文 zh-TW</li>
  10840. * <li>英语 en</li>
  10841. * <li>日语 ja</li>
  10842. * <li>韩语 ko</li>
  10843. * </ul>
  10844. * @version Egret 2.4
  10845. * @platform Web,Native
  10846. */
  10847. static language: string;
  10848. /**
  10849. * @private
  10850. */
  10851. static $isMobile: boolean;
  10852. /**
  10853. * @language en_US
  10854. * Specifies whether the system is running in a mobile device.(such as a mobile phone or tablet)
  10855. * @version Egret 2.4
  10856. * @platform Web,Native
  10857. */
  10858. /**
  10859. * @language zh_CN
  10860. * 表示程序内容是否运行在移动设备中(例如移动电话或平板电脑)。
  10861. * @version Egret 2.4
  10862. * @platform Web,Native
  10863. */
  10864. static isMobile: boolean;
  10865. /**
  10866. * @private
  10867. */
  10868. static $os: string;
  10869. /**
  10870. * @language en_US
  10871. * Specifies the current operating system. The os property can return the following strings:
  10872. * <ul>
  10873. * <li>iPhone "iOS"</li>
  10874. * <li>Android Phone "Android"</li>
  10875. * <li>Windows Phone "Windows Phone"</li>
  10876. * <li>Windows Desktop "Windows PC"</li>
  10877. * <li>Mac Desktop "Mac OS"</li>
  10878. * <li>Unknown OS "Unknown"</li>
  10879. * </ul>
  10880. * @version Egret 2.4
  10881. * @platform Web,Native
  10882. */
  10883. /**
  10884. * @language zh_CN
  10885. * 指示当前的操作系统。os 属性返回下列字符串:
  10886. * <ul>
  10887. * <li>苹果手机操作系统 "iOS"</li>
  10888. * <li>安卓手机操作系统 "Android"</li>
  10889. * <li>微软手机操作系统 "Windows Phone"</li>
  10890. * <li>微软桌面操作系统 "Windows PC"</li>
  10891. * <li>苹果桌面操作系统 "Mac OS"</li>
  10892. * <li>未知操作系统 "Unknown"</li>
  10893. * </ul>
  10894. * @version Egret 2.4
  10895. * @platform Web,Native
  10896. */
  10897. static os: string;
  10898. /**
  10899. * @private
  10900. */
  10901. static $runtimeType: string;
  10902. /**
  10903. * @language en_US
  10904. * It indicates the current type of operation. runtimeType property returns the following string:
  10905. * <ul>
  10906. * <li>Run on Web egret.RuntimeType.WEB</li>
  10907. * <li>Run on Native egret.RuntimeType.NATIVE</li>
  10908. * </ul>
  10909. * @version Egret 2.4
  10910. * @platform Web,Native
  10911. */
  10912. /**
  10913. * @language zh_CN
  10914. * 指示当前的运行类型。runtimeType 属性返回下列字符串:
  10915. * <ul>
  10916. * <li>运行在Web上 egret.RuntimeType.WEB</li>
  10917. * <li>运行在Native上 egret.RuntimeType.NATIVE</li>
  10918. * </ul>
  10919. * @version Egret 2.4
  10920. * @platform Web,Native
  10921. */
  10922. static runtimeType: string;
  10923. /***
  10924. * @language en_US
  10925. * version of the native support.
  10926. * @type {string}
  10927. * @version Egret 2.5
  10928. * @platform Web,Native
  10929. */
  10930. /***
  10931. * @language zh_CN
  10932. * native support 的版本号。
  10933. * @type {string}
  10934. * @version Egret 2.5
  10935. * @platform Web,Native
  10936. */
  10937. static supportVersion: string;
  10938. static $supportVersion: string;
  10939. /***
  10940. * @language en_US
  10941. * version of Egret.
  10942. * @type {string}
  10943. * @version Egret 3.2.0
  10944. * @platform Web,Native
  10945. */
  10946. /***
  10947. * @language zh_CN
  10948. * Egret 的版本号。
  10949. * @type {string}
  10950. * @version Egret 3.2.0
  10951. * @platform Web,Native
  10952. */
  10953. static engineVersion: string;
  10954. /**
  10955. * 设置系统信息
  10956. */
  10957. static $setNativeCapabilities(value: string): void;
  10958. /***
  10959. * @language en_US
  10960. * current render mode.
  10961. * @type {string}
  10962. * @version Egret 3.0.7
  10963. * @platform Web,Native
  10964. */
  10965. /***
  10966. * @language zh_CN
  10967. * 当前渲染模式。
  10968. * @type {string}
  10969. * @version Egret 3.0.7
  10970. * @platform Web,Native
  10971. */
  10972. static renderMode: string;
  10973. static $renderMode: string;
  10974. /***
  10975. * @language en_US
  10976. * Clients border width.
  10977. * The value before the document class initialization is always 0.
  10978. * This value will change after the distribution Event.RESIZE and StageOrientationEvent.ORIENTATION_CHANGE.
  10979. * @version Egret 3.1.3
  10980. * @platform Web,Native
  10981. */
  10982. /***
  10983. * @language zh_CN
  10984. * 客户端边界宽度。
  10985. * 该值在文档类初始化之前始终是0。
  10986. * 该值在派发 Event.RESIZE 以及 StageOrientationEvent.ORIENTATION_CHANGE 之后会发生改变。
  10987. * @version Egret 3.1.3
  10988. * @platform Web,Native
  10989. */
  10990. static boundingClientWidth: number;
  10991. static $boundingClientWidth: number;
  10992. /***
  10993. * @language en_US
  10994. * Clients border height.
  10995. * The value before the document class initialization is always 0.
  10996. * This value will change after the distribution Event.RESIZE and StageOrientationEvent.ORIENTATION_CHANGE.
  10997. * @version Egret 3.1.3
  10998. * @platform Web,Native
  10999. */
  11000. /***
  11001. * @language zh_CN
  11002. * 客户端边界高度。
  11003. * 该值在文档类初始化之前始终是0。
  11004. * 该值在派发 Event.RESIZE 以及 StageOrientationEvent.ORIENTATION_CHANGE 之后会发生改变。
  11005. * @version Egret 3.1.3
  11006. * @platform Web,Native
  11007. */
  11008. static boundingClientHeight: number;
  11009. static $boundingClientHeight: number;
  11010. }
  11011. }
  11012. /**
  11013. * @private
  11014. */
  11015. declare let testDeviceType: () => boolean;
  11016. /**
  11017. * @private
  11018. */
  11019. declare let testRuntimeType: () => boolean;
  11020. declare namespace egret {
  11021. /**
  11022. * @language en_US
  11023. * The BitmapFillMode class defines the image fill mode of Bitmap.
  11024. * The BitmapFillMode class defines a pattern enumeration for adjusting size. These patterns determine how Bitmap fill the size designated by the layout system.
  11025. * @see http://edn.egret.com/cn/docs/page/134 Texture filling way
  11026. * @version Egret 2.4
  11027. * @platform Web,Native
  11028. * @includeExample egret/display/BitmapFillMode.ts
  11029. */
  11030. /**
  11031. * @language zh_CN
  11032. * BitmapFillMode 类定义Bitmap的图像填充方式。
  11033. * BitmapFillMode 类定义了调整大小模式的一个枚举,这些模式确定 Bitmap 如何填充由布局系统指定的尺寸。
  11034. * @see http://edn.egret.com/cn/docs/page/134 纹理的填充方式
  11035. * @version Egret 2.4
  11036. * @platform Web,Native
  11037. * @includeExample egret/display/BitmapFillMode.ts
  11038. */
  11039. const BitmapFillMode: {
  11040. REPEAT: string;
  11041. SCALE: string;
  11042. CLIP: string;
  11043. };
  11044. }
  11045. declare namespace egret {
  11046. /**
  11047. * @language en_US
  11048. * Adds an interface-name-to-implementation-class mapping to the registry.
  11049. * @param interfaceName the interface name to register. For example:"eui.IAssetAdapter","eui.Theme"
  11050. * @param instance the instance to register.
  11051. * @version Egret 3.2.1
  11052. * @platform Web,Native
  11053. */
  11054. /**
  11055. * @language zh_CN
  11056. * 注册一个接口实现。
  11057. * @param interfaceName 注入的接口名称。例如:"eui.IAssetAdapter","eui.Theme"
  11058. * @param instance 实现此接口的实例。
  11059. * @version Egret 3.2.1
  11060. * @platform Web,Native
  11061. */
  11062. function registerImplementation(interfaceName: string, instance: any): void;
  11063. /**
  11064. * @language en_US
  11065. * Returns the singleton instance of the implementation class that was registered for the specified interface.
  11066. * This method is usually called by egret framework.
  11067. * @param interfaceName The interface name to identify. For example:"eui.IAssetAdapter","eui.Theme"
  11068. * @returns the singleton instance of the implementation class
  11069. * @version Egret 3.2.1
  11070. * @platform Web,Native
  11071. */
  11072. /**
  11073. * @language zh_CN
  11074. * 获取一个接口实现。此方法通常由框架内部调用。获取项目注入的自定义实现实例。
  11075. * @param interfaceName 要获取的接口名称。例如:"eui.IAssetAdapter","eui.Theme"
  11076. * @returns 返回实现此接口的实例。
  11077. * @version Egret 3.2.1
  11078. * @platform Web,Native
  11079. */
  11080. function getImplementation(interfaceName: string): any;
  11081. }
  11082. declare namespace egret {
  11083. /**
  11084. * @language en_US
  11085. * Bitmap font, texture set of a font. It is generally used as the value of the BitmapText.font attribute.
  11086. * @see http://bbs.egret-labs.org/thread-918-1-1.html TextureMerger
  11087. * @see http://bbs.egret-labs.org/forum.php?mod=viewthread&tid=251 Text(Containing the specific usage of the bitmap font )
  11088. * @version Egret 2.4
  11089. * @platform Web,Native
  11090. * @includeExample egret/text/BitmapFont.ts
  11091. */
  11092. /**
  11093. * @language zh_CN
  11094. * 位图字体,是一个字体的纹理集,通常作为BitmapText.font属性的值。
  11095. * @see http://bbs.egret-labs.org/thread-918-1-1.html TextureMerger
  11096. * @see http://bbs.egret-labs.org/forum.php?mod=viewthread&tid=251 文本(含位图字体具体用法)
  11097. * @version Egret 2.4
  11098. * @platform Web,Native
  11099. * @includeExample egret/text/BitmapFont.ts
  11100. */
  11101. class BitmapFont extends SpriteSheet {
  11102. /**
  11103. * @language en_US
  11104. * Create an egret.BitmapFont object
  11105. * @param texture {egret.Texture} Texture set that use TextureMerger create
  11106. * @param config {any} Configure data that use TextureMerger create
  11107. * @version Egret 2.4
  11108. * @platform Web,Native
  11109. */
  11110. /**
  11111. * @language zh_CN
  11112. * 创建一个 egret.BitmapFont 对象
  11113. * @param texture {egret.Texture} 使用TextureMerger生成的纹理集
  11114. * @param config {any} 使用TextureMerger生成的配置数据
  11115. * @version Egret 2.4
  11116. * @platform Web,Native
  11117. */
  11118. constructor(texture: Texture, config: any);
  11119. /**
  11120. * @private
  11121. */
  11122. private charList;
  11123. /**
  11124. * @language en_US
  11125. * Obtain corresponding texture through the name attribute
  11126. * @param name {string} name Attribute
  11127. * @returns {egret.Texture}
  11128. * @version Egret 2.4
  11129. * @platform Web,Native
  11130. */
  11131. /**
  11132. * @language zh_CN
  11133. * 通过 name 属性获取对应纹理
  11134. * @param name {string} name属性
  11135. * @returns {egret.Texture}
  11136. * @version Egret 2.4
  11137. * @platform Web,Native
  11138. */
  11139. getTexture(name: string): Texture;
  11140. /**
  11141. * @private
  11142. */
  11143. getConfig(name: string, key: string): number;
  11144. /**
  11145. * @private
  11146. */
  11147. private firstCharHeight;
  11148. /**
  11149. * @private
  11150. *
  11151. * @returns
  11152. */
  11153. _getFirstCharHeight(): number;
  11154. /**
  11155. * @private
  11156. *
  11157. * @param fntText
  11158. * @returns
  11159. */
  11160. private parseConfig(fntText);
  11161. /**
  11162. * @private
  11163. *
  11164. * @param configText
  11165. * @param key
  11166. * @returns
  11167. */
  11168. private getConfigByKey(configText, key);
  11169. }
  11170. }
  11171. declare namespace egret.sys {
  11172. /**
  11173. * @private
  11174. */
  11175. const enum BitmapTextKeys {
  11176. /**
  11177. * @private 外部设定的值
  11178. */
  11179. textFieldWidth = 0,
  11180. /**
  11181. * @private 外部设定的值
  11182. */
  11183. textFieldHeight = 1,
  11184. /**
  11185. * @private
  11186. */
  11187. text = 2,
  11188. /**
  11189. * @private
  11190. */
  11191. lineSpacing = 3,
  11192. /**
  11193. * @private
  11194. */
  11195. letterSpacing = 4,
  11196. /**
  11197. * @private
  11198. */
  11199. font = 5,
  11200. /**
  11201. * @private
  11202. */
  11203. fontStringChanged = 6,
  11204. /**
  11205. * @private
  11206. */
  11207. textLinesChanged = 7,
  11208. /**
  11209. * @private 测量的值
  11210. */
  11211. textWidth = 8,
  11212. /**
  11213. * @private 测量的值
  11214. */
  11215. textHeight = 9,
  11216. /**
  11217. * @private
  11218. */
  11219. textAlign = 10,
  11220. /**
  11221. * @private
  11222. */
  11223. verticalAlign = 11,
  11224. /**
  11225. * @private
  11226. */
  11227. smoothing = 12,
  11228. }
  11229. }
  11230. declare namespace egret {
  11231. /**
  11232. * @language en_US
  11233. * Bitmap font adopts the Bitmap+SpriteSheet mode to render text.
  11234. * @version Egret 2.4
  11235. * @platform Web,Native
  11236. * @includeExample egret/text/BitmapText.ts
  11237. */
  11238. /**
  11239. * @language zh_CN
  11240. * 位图字体采用了Bitmap+SpriteSheet的方式来渲染文字。
  11241. * @version Egret 2.4
  11242. * @platform Web,Native
  11243. * @includeExample egret/text/BitmapText.ts
  11244. */
  11245. class BitmapText extends DisplayObject {
  11246. /**
  11247. * @language en_US
  11248. * Create an egret.BitmapText object
  11249. * @version Egret 2.4
  11250. * @platform Web,Native
  11251. */
  11252. /**
  11253. * @language zh_CN
  11254. * 创建一个 egret.BitmapText 对象
  11255. * @version Egret 2.4
  11256. * @platform Web,Native
  11257. */
  11258. constructor();
  11259. /**
  11260. * @language en_US
  11261. * Whether or not is smoothed when scaled.
  11262. * @default true。
  11263. * @version Egret 3.0
  11264. * @platform Web
  11265. */
  11266. /**
  11267. * @language zh_CN
  11268. * 控制在缩放时是否进行平滑处理。
  11269. * @default true。
  11270. * @version Egret 3.0
  11271. * @platform Web
  11272. */
  11273. smoothing: boolean;
  11274. /**
  11275. * @private
  11276. */
  11277. $BitmapText: Object;
  11278. /**
  11279. * @language en_US
  11280. * A string to display in the text field.
  11281. * @version Egret 2.4
  11282. * @platform Web,Native
  11283. */
  11284. /**
  11285. * @language zh_CN
  11286. * 要显示的文本内容
  11287. * @version Egret 2.4
  11288. * @platform Web,Native
  11289. */
  11290. text: string;
  11291. /**
  11292. * @private
  11293. */
  11294. $setText(value: string): boolean;
  11295. /**
  11296. * @private
  11297. */
  11298. $getWidth(): number;
  11299. /**
  11300. * @private
  11301. */
  11302. $setWidth(value: number): boolean;
  11303. /**
  11304. * @private
  11305. */
  11306. $invalidateContentBounds(): void;
  11307. /**
  11308. * @private
  11309. */
  11310. $getHeight(): number;
  11311. /**
  11312. * @private
  11313. */
  11314. $setHeight(value: number): boolean;
  11315. /**
  11316. * @language en_US
  11317. * The name of the font to use, or a comma-separated list of font names, the type of value must be BitmapFont.
  11318. * @default null
  11319. * @version Egret 2.4
  11320. * @platform Web,Native
  11321. */
  11322. /**
  11323. * @language zh_CN
  11324. * 要使用的字体的名称或用逗号分隔的字体名称列表,类型必须是 BitmapFont。
  11325. * @default null
  11326. * @version Egret 2.4
  11327. * @platform Web,Native
  11328. */
  11329. font: Object;
  11330. $setFont(value: any): boolean;
  11331. /**
  11332. /**
  11333. * @language en_US
  11334. * An integer representing the amount of vertical space between lines.
  11335. * @default 0
  11336. * @version Egret 2.4
  11337. * @platform Web,Native
  11338. */
  11339. /**
  11340. * @language zh_CN
  11341. * 一个整数,表示行与行之间的垂直间距量
  11342. * @default 0
  11343. * @version Egret 2.4
  11344. * @platform Web,Native
  11345. */
  11346. lineSpacing: number;
  11347. $setLineSpacing(value: number): boolean;
  11348. /**
  11349. * @language en_US
  11350. * An integer representing the amount of distance between characters.
  11351. * @default 0
  11352. * @version Egret 2.4
  11353. * @platform Web,Native
  11354. */
  11355. /**
  11356. * @language zh_CN
  11357. * 一个整数,表示字符之间的距离。
  11358. * @default 0
  11359. * @version Egret 2.4
  11360. * @platform Web,Native
  11361. */
  11362. letterSpacing: number;
  11363. $setLetterSpacing(value: number): boolean;
  11364. /**
  11365. * @language en_US
  11366. * Horizontal alignment of text.
  11367. * @default:egret.HorizontalAlign.LEFT
  11368. * @version Egret 2.5.6
  11369. * @platform Web,Native
  11370. */
  11371. /**
  11372. * @language zh_CN
  11373. * 文本的水平对齐方式。
  11374. * @default:egret.HorizontalAlign.LEFT
  11375. * @version Egret 2.5.6
  11376. * @platform Web,Native
  11377. */
  11378. textAlign: string;
  11379. $setTextAlign(value: string): boolean;
  11380. /**
  11381. * @language en_US
  11382. * Vertical alignment of text.
  11383. * @default:egret.VerticalAlign.TOP
  11384. * @version Egret 2.5.6
  11385. * @platform Web,Native
  11386. */
  11387. /**
  11388. * @language zh_CN
  11389. * 文字的垂直对齐方式。
  11390. * @default:egret.VerticalAlign.TOP
  11391. * @version Egret 2.5.6
  11392. * @platform Web,Native
  11393. */
  11394. verticalAlign: string;
  11395. $setVerticalAlign(value: string): boolean;
  11396. /**
  11397. * @language en_US
  11398. * A ratio of the width of the space character. This value is multiplied by the height of the first character is the space character width.
  11399. * @default 0.33
  11400. * @version Egret 2.4
  11401. * @platform Web,Native
  11402. */
  11403. /**
  11404. * @language zh_CN
  11405. * 一个空格字符的宽度比例。这个数值乘以第一个字符的高度即为空格字符的宽。
  11406. * @default 0.33
  11407. * @version Egret 2.4
  11408. * @platform Web,Native
  11409. */
  11410. static EMPTY_FACTOR: number;
  11411. /**
  11412. * @private
  11413. */
  11414. $render(): void;
  11415. /**
  11416. * @private
  11417. */
  11418. $measureContentBounds(bounds: Rectangle): void;
  11419. /**
  11420. * @language en_US
  11421. * Get the BitmapText measured width
  11422. * @version Egret 2.4
  11423. * @platform Web,Native
  11424. */
  11425. /**
  11426. * @language zh_CN
  11427. * 获取位图文本测量宽度
  11428. * @version Egret 2.4
  11429. * @platform Web,Native
  11430. */
  11431. textWidth: number;
  11432. /**
  11433. * @language en_US
  11434. * Get Text BitmapText height
  11435. * @version Egret 2.4
  11436. * @platform Web,Native
  11437. */
  11438. /**
  11439. * @language zh_CN
  11440. * 获取位图文本测量高度
  11441. * @version Egret 2.4
  11442. * @platform Web,Native
  11443. */
  11444. textHeight: number;
  11445. /**
  11446. * @private
  11447. */
  11448. private $textOffsetX;
  11449. /**
  11450. * @private
  11451. */
  11452. private $textOffsetY;
  11453. /**
  11454. * @private
  11455. */
  11456. private $textStartX;
  11457. /**
  11458. * @private
  11459. */
  11460. private $textStartY;
  11461. /**
  11462. * @private
  11463. */
  11464. private textLines;
  11465. /**
  11466. * @private 每一行文字的宽度
  11467. */
  11468. private $textLinesWidth;
  11469. /**
  11470. * @private
  11471. */
  11472. $lineHeights: number[];
  11473. /**
  11474. * @private
  11475. *
  11476. * @returns
  11477. */
  11478. $getTextLines(): string[];
  11479. }
  11480. }
  11481. declare namespace egret {
  11482. /**
  11483. * @language en_US
  11484. * The HorizontalAlign class defines the possible values for the horizontal alignment.
  11485. * @see egret.TextField#textAlign
  11486. * @version Egret 2.4
  11487. * @platform Web,Native
  11488. */
  11489. /**
  11490. * @language zh_CN
  11491. * HorizontalAlign 类为水平对齐方式定义可能的值。
  11492. * @see egret.TextField#textAlign
  11493. * @version Egret 2.4
  11494. * @platform Web,Native
  11495. */
  11496. class HorizontalAlign {
  11497. /**
  11498. * @language en_US
  11499. * Horizontally align content to the left of the container.
  11500. * @version Egret 2.4
  11501. * @platform Web,Native
  11502. */
  11503. /**
  11504. * @language zh_CN
  11505. * 将内容与容器的左侧对齐。
  11506. * @version Egret 2.4
  11507. * @platform Web,Native
  11508. */
  11509. static LEFT: string;
  11510. /**
  11511. * @language en_US
  11512. * Horizontally align content to the right of the container.
  11513. * @version Egret 2.4
  11514. * @platform Web,Native
  11515. */
  11516. /**
  11517. * @language zh_CN
  11518. * 将内容与容器的右侧对齐。
  11519. * @version Egret 2.4
  11520. * @platform Web,Native
  11521. */
  11522. static RIGHT: string;
  11523. /**
  11524. * @language en_US
  11525. * Horizontally align content in the center of the container.
  11526. * @version Egret 2.4
  11527. * @platform Web,Native
  11528. */
  11529. /**
  11530. * @language zh_CN
  11531. * 在容器的水平中心对齐内容。
  11532. * @version Egret 2.4
  11533. * @platform Web,Native
  11534. */
  11535. static CENTER: string;
  11536. /**
  11537. * @language en_US
  11538. * Horizontal alignment with both edges.
  11539. * Note: TextFiled does not support this alignment method.
  11540. * @constant egret.HorizontalAlign.JUSTIFY
  11541. * @version Egret 2.4
  11542. * @platform Web,Native
  11543. */
  11544. /**
  11545. * @language zh_CN
  11546. * 水平两端对齐。
  11547. * 注意:TextFiled不支持此对齐方式。
  11548. * @constant egret.HorizontalAlign.JUSTIFY
  11549. * @version Egret 2.4
  11550. * @platform Web,Native
  11551. */
  11552. static JUSTIFY: string;
  11553. /**
  11554. * @language en_US
  11555. * Align the content of the child items, relative to the container. This operation will adjust uniformly the size of all the child items to be the Content Width \" of the container \".
  11556. * The Content Width \" of the container \" is the size of the max. child item. If the size of all child items are less than the width of the container, they will be adjusted to the width of the container.
  11557. * Note: TextFiled does not support this alignment method.
  11558. * @constant egret.HorizontalAlign.CONTENT_JUSTIFY
  11559. * @version Egret 2.4
  11560. * @platform Web,Native
  11561. */
  11562. /**
  11563. * @language zh_CN
  11564. * 相对于容器对子项进行内容对齐。这会将所有子项的大小统一调整为容器的"内容宽度"。
  11565. * 容器的"内容宽度"是最大子项的大小,如果所有子项都小于容器的宽度,则会将所有子项的大小调整为容器的宽度。
  11566. * 注意:TextFiled不支持此对齐方式。
  11567. * @constant egret.HorizontalAlign.CONTENT_JUSTIFY
  11568. * @version Egret 2.4
  11569. * @platform Web,Native
  11570. */
  11571. static CONTENT_JUSTIFY: string;
  11572. }
  11573. }
  11574. declare namespace egret {
  11575. /**
  11576. * @language en_US
  11577. * Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
  11578. * @see http://edn.egret.com/cn/docs/page/146 Text mixed in a variety of style
  11579. * @version Egret 2.4
  11580. * @platform Web,Native
  11581. * @includeExample egret/text/HtmlTextParser.ts
  11582. */
  11583. /**
  11584. * @language zh_CN
  11585. * 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
  11586. * @see http://edn.egret.com/cn/docs/page/146 多种样式文本混合
  11587. * @version Egret 2.4
  11588. * @platform Web,Native
  11589. * @includeExample egret/text/HtmlTextParser.ts
  11590. */
  11591. class HtmlTextParser {
  11592. /**
  11593. * @version Egret 2.4
  11594. * @platform Web,Native
  11595. */
  11596. constructor();
  11597. private replaceArr;
  11598. private initReplaceArr();
  11599. /**
  11600. * @private
  11601. *
  11602. * @param value
  11603. * @returns
  11604. */
  11605. private replaceSpecial(value);
  11606. /**
  11607. * @private
  11608. */
  11609. private resutlArr;
  11610. /**
  11611. * @language en_US
  11612. * Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
  11613. * @param htmltext {string} Text in html
  11614. * @returns {Array<egret.ITextElement>} 可赋值给 egret.TextField#textFlow Object that can be assigned to the egret.TextField#textFlow property
  11615. * @version Egret 2.4
  11616. * @platform Web,Native
  11617. */
  11618. /**
  11619. * @language zh_CN
  11620. * 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
  11621. * @param htmltext {string} html文本
  11622. * @returns {Array<egret.ITextElement>} 可赋值给 egret.TextField#textFlow 属性的对象
  11623. * @version Egret 2.4
  11624. * @platform Web,Native
  11625. */
  11626. parser(htmltext: string): Array<egret.ITextElement>;
  11627. /**
  11628. * @private
  11629. *
  11630. * @param value
  11631. */
  11632. private addToResultArr(value);
  11633. private changeStringToObject(str);
  11634. /**
  11635. * @private
  11636. *
  11637. * @returns
  11638. */
  11639. private getHeadReg();
  11640. /**
  11641. * @private
  11642. *
  11643. * @param info
  11644. * @param head
  11645. * @param value
  11646. */
  11647. private addProperty(info, head, value);
  11648. /**
  11649. * @private
  11650. */
  11651. private stackArray;
  11652. /**
  11653. * @private
  11654. *
  11655. * @param infoStr
  11656. */
  11657. private addToArray(infoStr);
  11658. }
  11659. }
  11660. declare namespace egret {
  11661. /**
  11662. * @private
  11663. * @version Egret 2.4
  11664. * @platform Web,Native
  11665. */
  11666. interface IHitTextElement {
  11667. /**
  11668. * @version Egret 2.4
  11669. * @platform Web,Native
  11670. */
  11671. lineIndex: number;
  11672. /**
  11673. * @version Egret 2.4
  11674. * @platform Web,Native
  11675. */
  11676. textElementIndex: number;
  11677. }
  11678. /**
  11679. * @language en_US
  11680. * Text Style
  11681. * @version Egret 2.4
  11682. * @platform Web,Native
  11683. */
  11684. /**
  11685. * @language zh_CN
  11686. * 文本样式
  11687. * @version Egret 2.4
  11688. * @platform Web,Native
  11689. */
  11690. interface ITextStyle {
  11691. /**
  11692. * @language en_US
  11693. * text color
  11694. * @version Egret 2.4
  11695. * @platform Web,Native
  11696. * @see http://edn.egret.com/cn/docs/page/146 多种样式混合文本的基本结构
  11697. */
  11698. /**
  11699. * @language zh_CN
  11700. * 颜色值
  11701. * @version Egret 2.4
  11702. * @platform Web,Native
  11703. * @see http://edn.egret.com/cn/docs/page/146 多种样式混合文本的基本结构
  11704. */
  11705. textColor?: number;
  11706. /**
  11707. * @language en_US
  11708. * stroke color
  11709. * @version Egret 2.4
  11710. * @platform Web,Native
  11711. */
  11712. /**
  11713. * @language zh_CN
  11714. * 描边颜色值
  11715. * @version Egret 2.4
  11716. * @platform Web,Native
  11717. */
  11718. strokeColor?: number;
  11719. /**
  11720. * @language en_US
  11721. * size
  11722. * @version Egret 2.4
  11723. * @platform Web,Native
  11724. */
  11725. /**
  11726. * @language zh_CN
  11727. * 字号
  11728. * @version Egret 2.4
  11729. * @platform Web,Native
  11730. */
  11731. size?: number;
  11732. /**
  11733. * @language en_US
  11734. * stroke width
  11735. * @version Egret 2.4
  11736. * @platform Web,Native
  11737. */
  11738. /**
  11739. * @language zh_CN
  11740. * 描边大小
  11741. * @version Egret 2.4
  11742. * @platform Web,Native
  11743. */
  11744. stroke?: number;
  11745. /**
  11746. * @language en_US
  11747. * whether bold
  11748. * @version Egret 2.4
  11749. * @platform Web,Native
  11750. */
  11751. /**
  11752. * @language zh_CN
  11753. * 是否加粗
  11754. * @version Egret 2.4
  11755. * @platform Web,Native
  11756. */
  11757. bold?: boolean;
  11758. /**
  11759. * @language en_US
  11760. * whether italic
  11761. * @version Egret 2.4
  11762. * @platform Web,Native
  11763. */
  11764. /**
  11765. * @language zh_CN
  11766. * 是否倾斜
  11767. * @version Egret 2.4
  11768. * @platform Web,Native
  11769. */
  11770. italic?: boolean;
  11771. /**
  11772. * @language en_US
  11773. * fontFamily
  11774. * @version Egret 2.4
  11775. * @platform Web,Native
  11776. */
  11777. /**
  11778. * @language zh_CN
  11779. * 字体名称
  11780. * @version Egret 2.4
  11781. * @platform Web,Native
  11782. */
  11783. fontFamily?: string;
  11784. /**
  11785. * @language en_US
  11786. * Link events or address
  11787. * @version Egret 2.4
  11788. * @platform Web,Native
  11789. */
  11790. /**
  11791. * @language zh_CN
  11792. * 链接事件或者地址
  11793. * @version Egret 2.4
  11794. * @platform Web,Native
  11795. */
  11796. href?: string;
  11797. /**
  11798. * @language en_US
  11799. * @private
  11800. * @version Egret 2.4
  11801. * @platform Web,Native
  11802. */
  11803. /**
  11804. * @language zh_CN
  11805. * @private
  11806. * @version Egret 2.4
  11807. * @platform Web,Native
  11808. */
  11809. target?: string;
  11810. /**
  11811. * @language en_US
  11812. * Is underlined
  11813. * @version Egret 2.4
  11814. * @platform Web,Native
  11815. */
  11816. /**
  11817. * @language zh_CN
  11818. * 是否加下划线
  11819. * @version Egret 2.4
  11820. * @platform Web,Native
  11821. */
  11822. underline?: boolean;
  11823. }
  11824. /**
  11825. * @language en_US
  11826. * Used to build the basic structure of text with a variety of mixed styles, mainly for setting textFlow property
  11827. * @see http://edn.egret.com/cn/docs/page/146 Text mixed in a variety of style
  11828. * @version Egret 2.4
  11829. * @platform Web,Native
  11830. */
  11831. /**
  11832. * @language zh_CN
  11833. * 用于建立多种样式混合文本的基本结构,主要用于设置 textFlow 属性
  11834. * @see http://edn.egret.com/cn/docs/page/146 多种样式文本混合
  11835. * @version Egret 2.4
  11836. * @platform Web,Native
  11837. */
  11838. interface ITextElement {
  11839. /**
  11840. * @language en_US
  11841. * String Content
  11842. * @version Egret 2.4
  11843. * @platform Web,Native
  11844. */
  11845. /**
  11846. * @language zh_CN
  11847. * 字符串内容
  11848. * @version Egret 2.4
  11849. * @platform Web,Native
  11850. */
  11851. text: string;
  11852. /**
  11853. * @language en_US
  11854. * Text Style
  11855. * @version Egret 2.4
  11856. * @platform Web,Native
  11857. */
  11858. /**
  11859. * @language zh_CN
  11860. * 文本样式
  11861. * @version Egret 2.4
  11862. * @platform Web,Native
  11863. */
  11864. style?: ITextStyle;
  11865. }
  11866. /**
  11867. * @private
  11868. * @version Egret 2.4
  11869. * @platform Web,Native
  11870. */
  11871. interface IWTextElement extends ITextElement {
  11872. /**
  11873. * @version Egret 2.4
  11874. * @platform Web,Native
  11875. */
  11876. width: number;
  11877. }
  11878. /**
  11879. * 文本最终解析的一行数据格式
  11880. * @private
  11881. * @version Egret 2.4
  11882. * @platform Web,Native
  11883. */
  11884. interface ILineElement {
  11885. /**
  11886. * 文本占用宽度
  11887. * @version Egret 2.4
  11888. * @platform Web,Native
  11889. */
  11890. width: number;
  11891. /**
  11892. * 文本占用高度
  11893. * @version Egret 2.4
  11894. * @platform Web,Native
  11895. */
  11896. height: number;
  11897. /**
  11898. * 当前文本字符总数量(包括换行符)
  11899. * @version Egret 2.4
  11900. * @platform Web,Native
  11901. */
  11902. charNum: number;
  11903. /**
  11904. * 是否含有换行符
  11905. * @version Egret 2.4
  11906. * @platform Web,Native
  11907. */
  11908. hasNextLine: boolean;
  11909. /**
  11910. * 本行文本内容
  11911. * @version Egret 2.4
  11912. * @platform Web,Native
  11913. */
  11914. elements: Array<IWTextElement>;
  11915. }
  11916. }
  11917. declare namespace egret {
  11918. /**
  11919. * @private
  11920. * @version Egret 2.4
  11921. * @platform Web,Native
  11922. */
  11923. class InputController extends HashObject {
  11924. /**
  11925. * @private
  11926. */
  11927. private stageText;
  11928. /**
  11929. * @private
  11930. */
  11931. private stageTextAdded;
  11932. /**
  11933. * @private
  11934. */
  11935. private _text;
  11936. /**
  11937. * @private
  11938. */
  11939. private _isFocus;
  11940. /**
  11941. * @version Egret 2.4
  11942. * @platform Web,Native
  11943. */
  11944. constructor();
  11945. /**
  11946. *
  11947. * @param text
  11948. * @version Egret 2.4
  11949. * @platform Web,Native
  11950. */
  11951. init(text: TextField): void;
  11952. /**
  11953. * @private
  11954. *
  11955. */
  11956. _addStageText(): void;
  11957. /**
  11958. * @private
  11959. *
  11960. */
  11961. _removeStageText(): void;
  11962. /**
  11963. * @private
  11964. *
  11965. * @returns
  11966. */
  11967. _getText(): string;
  11968. /**
  11969. * @private
  11970. *
  11971. * @param value
  11972. */
  11973. _setText(value: string): void;
  11974. /**
  11975. * @private
  11976. */
  11977. _setColor(value: number): void;
  11978. /**
  11979. * @private
  11980. *
  11981. * @param event
  11982. */
  11983. private focusHandler(event);
  11984. /**
  11985. * @private
  11986. *
  11987. * @param event
  11988. */
  11989. private blurHandler(event);
  11990. private tempStage;
  11991. private onMouseDownHandler(event);
  11992. $onFocus(): void;
  11993. private onStageDownHandler(event);
  11994. /**
  11995. * @private
  11996. *
  11997. * @param event
  11998. */
  11999. private updateTextHandler(event);
  12000. /**
  12001. * @private
  12002. *
  12003. */
  12004. private resetText();
  12005. /**
  12006. * @private
  12007. *
  12008. */
  12009. _hideInput(): void;
  12010. /**
  12011. * @private
  12012. *
  12013. */
  12014. private updateInput();
  12015. /**
  12016. * @private
  12017. *
  12018. */
  12019. _updateProperties(): void;
  12020. }
  12021. }
  12022. declare namespace egret {
  12023. /**
  12024. * @private
  12025. * @version Egret 2.4
  12026. * @platform Web,Native
  12027. */
  12028. interface StageText extends EventDispatcher {
  12029. /**
  12030. * @private
  12031. */
  12032. $textfield: egret.TextField;
  12033. /**
  12034. * @private
  12035. *
  12036. * @param textfield
  12037. */
  12038. $setTextField(textfield: egret.TextField): boolean;
  12039. /**
  12040. * @private
  12041. *
  12042. */
  12043. $resetStageText(): void;
  12044. /**
  12045. * @private
  12046. *
  12047. * @returns
  12048. */
  12049. $getText(): string;
  12050. /**
  12051. * @private
  12052. *
  12053. * @param value
  12054. */
  12055. $setText(value: string): boolean;
  12056. /**
  12057. * @private
  12058. *
  12059. * @param value
  12060. */
  12061. $setColor(value: number): boolean;
  12062. /**
  12063. * @private
  12064. *
  12065. */
  12066. $show(): void;
  12067. /**
  12068. * @private
  12069. *
  12070. */
  12071. $hide(): void;
  12072. /**
  12073. * @private
  12074. *
  12075. */
  12076. $addToStage(): void;
  12077. /**
  12078. * @private
  12079. *
  12080. */
  12081. $removeFromStage(): void;
  12082. /**
  12083. * @private
  12084. *
  12085. */
  12086. $onBlur(): void;
  12087. }
  12088. /**
  12089. * @version Egret 2.4
  12090. * @platform Web,Native
  12091. */
  12092. let StageText: {
  12093. new (): StageText;
  12094. };
  12095. }
  12096. declare namespace egret.sys {
  12097. /**
  12098. * @private
  12099. */
  12100. const enum TextKeys {
  12101. /**
  12102. * @private
  12103. */
  12104. fontSize = 0,
  12105. /**
  12106. * @private
  12107. */
  12108. lineSpacing = 1,
  12109. /**
  12110. * @private
  12111. */
  12112. textColor = 2,
  12113. /**
  12114. * @private
  12115. */
  12116. textFieldWidth = 3,
  12117. /**
  12118. * @private
  12119. */
  12120. textFieldHeight = 4,
  12121. /**
  12122. * @private
  12123. */
  12124. textWidth = 5,
  12125. /**
  12126. * @private
  12127. */
  12128. textHeight = 6,
  12129. /**
  12130. * @private
  12131. */
  12132. textDrawWidth = 7,
  12133. /**
  12134. * @private
  12135. */
  12136. fontFamily = 8,
  12137. /**
  12138. * @private
  12139. */
  12140. textAlign = 9,
  12141. /**
  12142. * @private
  12143. */
  12144. verticalAlign = 10,
  12145. /**
  12146. * @private
  12147. */
  12148. textColorString = 11,
  12149. /**
  12150. * @private
  12151. */
  12152. fontString = 12,
  12153. /**
  12154. * @private
  12155. */
  12156. text = 13,
  12157. /**
  12158. * @private
  12159. */
  12160. measuredWidths = 14,
  12161. /**
  12162. * @private
  12163. */
  12164. bold = 15,
  12165. /**
  12166. * @private
  12167. */
  12168. italic = 16,
  12169. /**
  12170. * @private
  12171. */
  12172. fontStringChanged = 17,
  12173. /**
  12174. * @private
  12175. */
  12176. textLinesChanged = 18,
  12177. /**
  12178. * @private
  12179. */
  12180. wordWrap = 19,
  12181. /**
  12182. * @private
  12183. */
  12184. displayAsPassword = 20,
  12185. /**
  12186. * @private
  12187. */
  12188. maxChars = 21,
  12189. /**
  12190. * @private
  12191. */
  12192. selectionActivePosition = 22,
  12193. /**
  12194. * @private
  12195. */
  12196. selectionAnchorPosition = 23,
  12197. /**
  12198. * @private
  12199. */
  12200. type = 24,
  12201. /**
  12202. * @private
  12203. */
  12204. strokeColor = 25,
  12205. /**
  12206. * @private
  12207. */
  12208. strokeColorString = 26,
  12209. /**
  12210. * @private
  12211. */
  12212. stroke = 27,
  12213. /**
  12214. * @private
  12215. */
  12216. scrollV = 28,
  12217. /**
  12218. * @private
  12219. */
  12220. numLines = 29,
  12221. /**
  12222. * @private
  12223. */
  12224. multiline = 30,
  12225. /**
  12226. * @private
  12227. */
  12228. border = 31,
  12229. /**
  12230. * @private
  12231. */
  12232. borderColor = 32,
  12233. /**
  12234. * @private
  12235. */
  12236. background = 33,
  12237. /**
  12238. * @private
  12239. */
  12240. backgroundColor = 34,
  12241. /**
  12242. * @private
  12243. */
  12244. restrictAnd = 35,
  12245. /**
  12246. * @private
  12247. */
  12248. restrictNot = 36,
  12249. /**
  12250. * @private
  12251. */
  12252. inputType = 37,
  12253. }
  12254. }
  12255. declare namespace egret {
  12256. /**
  12257. * @language en_US
  12258. * TextField is the text rendering class of egret. It conducts rendering by using the browser / device API. Due to different ways of font rendering in different browsers / devices, there may be differences in the rendering
  12259. * If developers expect no differences among all platforms, please use BitmapText
  12260. * @see http://edn.egret.com/cn/docs/page/141 Create Text
  12261. *
  12262. * @event egret.Event.CHANGE Dispatched when entering text user input。
  12263. * @event egret.FocusEvent.FOCUS_IN Dispatched after the focus to enter text.
  12264. * @event egret.FocusEvent.FOCUS_OUT Enter the text loses focus after dispatch.
  12265. * @version Egret 2.4
  12266. * @platform Web,Native
  12267. * @includeExample egret/text/TextField.ts
  12268. */
  12269. /**
  12270. * @language zh_CN
  12271. * TextField是egret的文本渲染类,采用浏览器/设备的API进行渲染,在不同的浏览器/设备中由于字体渲染方式不一,可能会有渲染差异
  12272. * 如果开发者希望所有平台完全无差异,请使用BitmapText
  12273. * @see http://edn.egret.com/cn/docs/page/141 创建文本
  12274. *
  12275. * @event egret.Event.CHANGE 输入文本有用户输入时调度。
  12276. * @event egret.FocusEvent.FOCUS_IN 聚焦输入文本后调度。
  12277. * @event egret.FocusEvent.FOCUS_OUT 输入文本失去焦点后调度。
  12278. * @version Egret 2.4
  12279. * @platform Web,Native
  12280. * @includeExample egret/text/TextField.ts
  12281. */
  12282. class TextField extends DisplayObject {
  12283. /**
  12284. * @language en_US
  12285. * default fontFamily
  12286. * @version Egret 2.4
  12287. * @platform Web,Native
  12288. */
  12289. /**
  12290. * @language zh_CN
  12291. * 默认文本字体
  12292. * @version Egret 2.4
  12293. * @platform Web,Native
  12294. */
  12295. static default_fontFamily: string;
  12296. /**
  12297. * @language en_US
  12298. * default size in pixels of text
  12299. * @version Egret 3.2.1
  12300. * @platform Web,Native
  12301. */
  12302. /**
  12303. * @language zh_CN
  12304. * 默认文本字号大小
  12305. * @version Egret 3.2.1
  12306. * @platform Web,Native
  12307. */
  12308. static default_size: number;
  12309. /**
  12310. * @language en_US
  12311. * default color of the text.
  12312. * @version Egret 3.2.1
  12313. * @platform Web,Native
  12314. */
  12315. /**
  12316. * @language zh_CN
  12317. * 默认文本颜色
  12318. * @version Egret 3.2.1
  12319. * @platform Web,Native
  12320. */
  12321. static default_textColor: number;
  12322. /**
  12323. * @version Egret 2.4
  12324. * @platform Web,Native
  12325. */
  12326. constructor();
  12327. /**
  12328. * @private
  12329. */
  12330. $TextField: Object;
  12331. /**
  12332. * @private
  12333. */
  12334. private isInput();
  12335. $inputEnabled: boolean;
  12336. $setTouchEnabled(value: boolean): boolean;
  12337. /**
  12338. * @language en_US
  12339. * The name of the font to use, or a comma-separated list of font names.
  12340. * @default "Arial"
  12341. * @version Egret 2.4
  12342. * @platform Web,Native
  12343. */
  12344. /**
  12345. * @language zh_CN
  12346. * 要使用的字体的名称或用逗号分隔的字体名称列表。
  12347. * @default "Arial"
  12348. * @version Egret 2.4
  12349. * @platform Web,Native
  12350. */
  12351. fontFamily: string;
  12352. $setFontFamily(value: string): boolean;
  12353. /**
  12354. * @language en_US
  12355. * The size in pixels of text
  12356. * @default 30
  12357. * @version Egret 2.4
  12358. * @platform Web,Native
  12359. */
  12360. /**
  12361. * @language zh_CN
  12362. * 文本的字号大小。
  12363. * @default 30
  12364. * @version Egret 2.4
  12365. * @platform Web,Native
  12366. */
  12367. size: number;
  12368. $setSize(value: number): boolean;
  12369. /**
  12370. * @language en_US
  12371. * Specifies whether the text is boldface.
  12372. * @default false
  12373. * @version Egret 2.4
  12374. * @platform Web,Native
  12375. */
  12376. /**
  12377. * @language zh_CN
  12378. * 是否显示为粗体。
  12379. * @default false
  12380. * @version Egret 2.4
  12381. * @platform Web,Native
  12382. */
  12383. bold: boolean;
  12384. $setBold(value: boolean): boolean;
  12385. /**
  12386. * @language en_US
  12387. * Determines whether the text is italic font.
  12388. * @default false
  12389. * @version Egret 2.4
  12390. * @platform Web,Native
  12391. */
  12392. /**
  12393. * @language zh_CN
  12394. * 是否显示为斜体。
  12395. * @default false
  12396. * @version Egret 2.4
  12397. * @platform Web,Native
  12398. */
  12399. italic: boolean;
  12400. $setItalic(value: boolean): boolean;
  12401. /**
  12402. * @private
  12403. *
  12404. */
  12405. private invalidateFontString();
  12406. /**
  12407. * @language en_US
  12408. * Horizontal alignment of text.
  12409. * @default:egret.HorizontalAlign.LEFT
  12410. * @version Egret 2.4
  12411. * @platform Web,Native
  12412. */
  12413. /**
  12414. * @language zh_CN
  12415. * 文本的水平对齐方式。
  12416. * @default:egret.HorizontalAlign.LEFT
  12417. * @version Egret 2.4
  12418. * @platform Web,Native
  12419. */
  12420. textAlign: string;
  12421. $setTextAlign(value: string): boolean;
  12422. /**
  12423. * @language en_US
  12424. * Vertical alignment of text.
  12425. * @default:egret.VerticalAlign.TOP
  12426. * @version Egret 2.4
  12427. * @platform Web,Native
  12428. */
  12429. /**
  12430. * @language zh_CN
  12431. * 文字的垂直对齐方式。
  12432. * @default:egret.VerticalAlign.TOP
  12433. * @version Egret 2.4
  12434. * @platform Web,Native
  12435. */
  12436. verticalAlign: string;
  12437. $setVerticalAlign(value: string): boolean;
  12438. /**
  12439. * @language en_US
  12440. * An integer representing the amount of vertical space between lines.
  12441. * @default 0
  12442. * @version Egret 2.4
  12443. * @platform Web,Native
  12444. */
  12445. /**
  12446. * @language zh_CN
  12447. * 一个整数,表示行与行之间的垂直间距量
  12448. * @default 0
  12449. * @version Egret 2.4
  12450. * @platform Web,Native
  12451. */
  12452. lineSpacing: number;
  12453. $setLineSpacing(value: number): boolean;
  12454. /**
  12455. * @language en_US
  12456. * Color of the text.
  12457. * @default 0x000000
  12458. * @version Egret 2.4
  12459. * @platform Web,Native
  12460. */
  12461. /**
  12462. * @language zh_CN
  12463. * 文本颜色
  12464. * @default 0x000000
  12465. * @version Egret 2.4
  12466. * @platform Web,Native
  12467. */
  12468. textColor: number;
  12469. $setTextColor(value: number): boolean;
  12470. /**
  12471. * @language en_US
  12472. * A Boolean value that indicates whether the text field word wrap. If the value is true, then the text field by word wrap;
  12473. * if the value is false, the text field by newline characters.
  12474. * @default false
  12475. * @version Egret 2.4
  12476. * @platform Web,Native
  12477. */
  12478. /**
  12479. * @language zh_CN
  12480. * 一个布尔值,表示文本字段是否按单词换行。如果值为 true,则该文本字段按单词换行;
  12481. * 如果值为 false,则该文本字段按字符换行。
  12482. * @default false
  12483. * @version Egret 2.4
  12484. * @platform Web,Native
  12485. */
  12486. wordWrap: boolean;
  12487. $setWordWrap(value: boolean): void;
  12488. /**
  12489. * @private
  12490. */
  12491. private inputUtils;
  12492. /**
  12493. * @version Egret 2.4
  12494. * @platform Web,Native
  12495. */
  12496. /**
  12497. * @language en_US
  12498. * Type of the text field.
  12499. * Any one of the following TextFieldType constants: TextFieldType.DYNAMIC (specifies the dynamic text field that users can not edit), or TextFieldType.INPUT (specifies the dynamic text field that users can edit).
  12500. * @default egret.TextFieldType.DYNAMIC
  12501. */
  12502. /**
  12503. * @language zh_CN
  12504. * 文本字段的类型。
  12505. * 以下 TextFieldType 常量中的任一个:TextFieldType.DYNAMIC(指定用户无法编辑的动态文本字段),或 TextFieldType.INPUT(指定用户可以编辑的输入文本字段)。
  12506. * @default egret.TextFieldType.DYNAMIC
  12507. */
  12508. type: string;
  12509. /**
  12510. * @private
  12511. *
  12512. * @param value
  12513. */
  12514. $setType(value: string): boolean;
  12515. /**
  12516. * @version Egret 3.1.2
  12517. * @platform Web,Native
  12518. */
  12519. /**
  12520. * @language en_US
  12521. * Pop-up keyboard type.
  12522. * Any of a TextFieldInputType constants.
  12523. */
  12524. /**
  12525. * @language zh_CN
  12526. * 弹出键盘的类型。
  12527. * TextFieldInputType 常量中的任一个。
  12528. */
  12529. inputType: string;
  12530. /**
  12531. * @version Egret 2.4
  12532. * @platform Web,Native
  12533. */
  12534. /**
  12535. * @language en_US
  12536. * Serve as a string of the current text field in the text
  12537. */
  12538. /**
  12539. * @language zh_CN
  12540. * 作为文本字段中当前文本的字符串
  12541. */
  12542. text: string;
  12543. /**
  12544. * @private
  12545. *
  12546. * @returns
  12547. */
  12548. $getText(): string;
  12549. /**
  12550. * @private
  12551. *
  12552. * @param value
  12553. */
  12554. $setBaseText(value: string): boolean;
  12555. /**
  12556. * @private
  12557. *
  12558. * @param value
  12559. */
  12560. $setText(value: string): boolean;
  12561. /**
  12562. * @language en_US
  12563. * Specify whether the text field is a password text field.
  12564. * If the value of this property is true, the text field is treated as a password text field and hides the input characters using asterisks instead of the actual characters. If false, the text field is not treated as a password text field.
  12565. * @default false
  12566. */
  12567. /**
  12568. * @language zh_CN
  12569. * 指定文本字段是否是密码文本字段。
  12570. * 如果此属性的值为 true,则文本字段被视为密码文本字段,并使用星号而不是实际字符来隐藏输入的字符。如果为 false,则不会将文本字段视为密码文本字段。
  12571. * @default false
  12572. */
  12573. displayAsPassword: boolean;
  12574. /**
  12575. * @private
  12576. *
  12577. * @param value
  12578. */
  12579. $setDisplayAsPassword(value: boolean): boolean;
  12580. /**
  12581. * @version Egret 2.4
  12582. * @platform Web,Native
  12583. */
  12584. /**
  12585. * @language en_US
  12586. * Represent the stroke color of the text.
  12587. * Contain three 8-bit numbers with RGB color components; for example, 0xFF0000 is red, 0x00FF00 is green.
  12588. * @default 0x000000
  12589. */
  12590. /**
  12591. * @language zh_CN
  12592. * 表示文本的描边颜色。
  12593. * 包含三个 8 位 RGB 颜色成分的数字;例如,0xFF0000 为红色,0x00FF00 为绿色。
  12594. * @default 0x000000
  12595. */
  12596. strokeColor: number;
  12597. /**
  12598. * @private
  12599. *
  12600. * @param value
  12601. */
  12602. $setStrokeColor(value: number): boolean;
  12603. /**
  12604. * @version Egret 2.4
  12605. * @platform Web,Native
  12606. */
  12607. /**
  12608. * @language en_US
  12609. * Indicate the stroke width.
  12610. * 0 means no stroke.
  12611. * @default 0
  12612. */
  12613. /**
  12614. * @language zh_CN
  12615. * 表示描边宽度。
  12616. * 0为没有描边。
  12617. * @default 0
  12618. */
  12619. stroke: number;
  12620. /**
  12621. * @private
  12622. *
  12623. * @param value
  12624. */
  12625. $setStroke(value: number): boolean;
  12626. /**
  12627. * @language en_US
  12628. * The maximum number of characters that the text field can contain, as entered by a user. \n A script can insert more text than maxChars allows; the maxChars property indicates only how much text a user can enter. If the value of this property is 0, a user can enter an unlimited amount of text.
  12629. * The default value is 0.
  12630. * @default 0
  12631. */
  12632. /**
  12633. * @language zh_CN
  12634. * 文本字段中最多可包含的字符数(即用户输入的字符数)。
  12635. * 脚本可以插入比 maxChars 允许的字符数更多的文本;maxChars 属性仅表示用户可以输入多少文本。如果此属性的值为 0,则用户可以输入无限数量的文本。
  12636. * @default 0
  12637. */
  12638. maxChars: number;
  12639. /**
  12640. * @private
  12641. *
  12642. * @param value
  12643. */
  12644. $setMaxChars(value: number): boolean;
  12645. /**
  12646. * @version Egret 2.4
  12647. * @platform Web,Native
  12648. */
  12649. /**
  12650. * @language en_US
  12651. * Vertical position of text in a text field. scrollV property helps users locate specific passages in a long article, and create scrolling text fields.
  12652. * Vertically scrolling units are lines, and horizontal scrolling unit is pixels.
  12653. * If the first displayed line is the first line in the text field, scrollV is set to 1 (instead of 0).
  12654. */
  12655. /**
  12656. * @language zh_CN
  12657. * 文本在文本字段中的垂直位置。scrollV 属性可帮助用户定位到长篇文章的特定段落,还可用于创建滚动文本字段。
  12658. * 垂直滚动的单位是行,而水平滚动的单位是像素。
  12659. * 如果显示的第一行是文本字段中的第一行,则 scrollV 设置为 1(而非 0)。
  12660. */
  12661. scrollV: number;
  12662. /**
  12663. * @language en_US
  12664. * The maximum value of scrollV
  12665. * @version Egret 2.4
  12666. * @platform Web,Native
  12667. */
  12668. /**
  12669. * @language zh_CN
  12670. * scrollV 的最大值
  12671. * @version Egret 2.4
  12672. * @platform Web,Native
  12673. */
  12674. maxScrollV: number;
  12675. /**
  12676. * @private
  12677. * @version Egret 2.4
  12678. * @platform Web,Native
  12679. */
  12680. selectionBeginIndex: number;
  12681. /**
  12682. * @private
  12683. * @version Egret 2.4
  12684. * @platform Web,Native
  12685. */
  12686. selectionEndIndex: number;
  12687. /**
  12688. * @private
  12689. * @version Egret 2.4
  12690. * @platform Web,Native
  12691. */
  12692. caretIndex: number;
  12693. /**
  12694. * @private
  12695. *
  12696. * @param beginIndex
  12697. * @param endIndex
  12698. */
  12699. $setSelection(beginIndex: number, endIndex: number): boolean;
  12700. /**
  12701. * @private
  12702. *
  12703. * @returns
  12704. */
  12705. $getLineHeight(): number;
  12706. /**
  12707. * @language en_US
  12708. * Number of lines of text.
  12709. * @version Egret 2.4
  12710. * @platform Web,Native
  12711. */
  12712. /**
  12713. * @language zh_CN
  12714. * 文本行数。
  12715. * @version Egret 2.4
  12716. * @platform Web,Native
  12717. */
  12718. numLines: number;
  12719. /**
  12720. * @language en_US
  12721. * Indicate whether field is a multiline text field. Note that this property is valid only when the type is TextFieldType.INPUT.
  12722. * If the value is true, the text field is multiline; if the value is false, the text field is a single-line text field. In a field of type TextFieldType.INPUT, the multiline value determines whether the Enter key creates a new line (a value of false, and the Enter key is ignored).
  12723. * @default false
  12724. */
  12725. /**
  12726. * @language zh_CN
  12727. * 表示字段是否为多行文本字段。注意,此属性仅在type为TextFieldType.INPUT时才有效。
  12728. * 如果值为 true,则文本字段为多行文本字段;如果值为 false,则文本字段为单行文本字段。在类型为 TextFieldType.INPUT 的字段中,multiline 值将确定 Enter 键是否创建新行(如果值为 false,则将忽略 Enter 键)。
  12729. * @default false
  12730. */
  12731. multiline: boolean;
  12732. /**
  12733. * @private
  12734. *
  12735. * @param value
  12736. */
  12737. $setMultiline(value: boolean): boolean;
  12738. /**
  12739. * @language en_US
  12740. * Indicates a user can enter into the text field character set. If you restrict property is null, you can enter any character. If you restrict property is an empty string, you can not enter any character. If you restrict property is a string of characters, you can enter only characters in the string in the text field. The string is scanned from left to right. You can use a hyphen (-) to specify a range. Only restricts user interaction; a script may put any text into the text field. <br/>
  12741. * If the string of characters caret (^) at the beginning, all characters are initially accepted, then the string are excluded from receiving ^ character. If the string does not begin with a caret (^) to, any characters are initially accepted and then a string of characters included in the set of accepted characters. <br/>
  12742. * The following example allows only uppercase characters, spaces, and numbers in the text field: <br/>
  12743. * My_txt.restrict = "A-Z 0-9"; <br/>
  12744. * The following example includes all characters except lowercase letters: <br/>
  12745. * My_txt.restrict = "^ a-z"; <br/>
  12746. * If you need to enter characters \ ^, use two backslash "\\ -" "\\ ^": <br/>
  12747. * Can be used anywhere in the string ^ to rule out including characters and switch between characters, but can only be used to exclude a ^. The following code includes only uppercase letters except uppercase Q: <br/>
  12748. * My_txt.restrict = "A-Z ^ Q"; <br/>
  12749. * @version Egret 2.4
  12750. * @platform Web,Native
  12751. * @default null
  12752. */
  12753. /**
  12754. * @language zh_CN
  12755. * 表示用户可输入到文本字段中的字符集。如果 restrict 属性的值为 null,则可以输入任何字符。如果 restrict 属性的值为空字符串,则不能输入任何字符。如果 restrict 属性的值为一串字符,则只能在文本字段中输入该字符串中的字符。从左向右扫描该字符串。可以使用连字符 (-) 指定一个范围。只限制用户交互;脚本可将任何文本放入文本字段中。<br/>
  12756. * 如果字符串以尖号 (^) 开头,则先接受所有字符,然后从接受字符集中排除字符串中 ^ 之后的字符。如果字符串不以尖号 (^) 开头,则最初不接受任何字符,然后将字符串中的字符包括在接受字符集中。<br/>
  12757. * 下例仅允许在文本字段中输入大写字符、空格和数字:<br/>
  12758. * my_txt.restrict = "A-Z 0-9";<br/>
  12759. * 下例包含除小写字母之外的所有字符:<br/>
  12760. * my_txt.restrict = "^a-z";<br/>
  12761. * 如果需要输入字符 \ ^,请使用2个反斜杠 "\\-" "\\^" :<br/>
  12762. * 可在字符串中的任何位置使用 ^,以在包含字符与排除字符之间进行切换,但是最多只能有一个 ^ 用来排除。下面的代码只包含除大写字母 Q 之外的大写字母:<br/>
  12763. * my_txt.restrict = "A-Z^Q";<br/>
  12764. * @version Egret 2.4
  12765. * @platform Web,Native
  12766. * @default null
  12767. */
  12768. restrict: string;
  12769. /**
  12770. * @private
  12771. *
  12772. * @param value
  12773. */
  12774. $setWidth(value: number): boolean;
  12775. /**
  12776. * @private
  12777. *
  12778. * @param value
  12779. */
  12780. $setHeight(value: number): boolean;
  12781. /**
  12782. * @private
  12783. * 获取显示宽度
  12784. */
  12785. $getWidth(): number;
  12786. /**
  12787. * @private
  12788. * 获取显示宽度
  12789. */
  12790. $getHeight(): number;
  12791. /**
  12792. * @private
  12793. */
  12794. private textNode;
  12795. /**
  12796. * @private
  12797. */
  12798. private graphicsNode;
  12799. /**
  12800. * @version Egret 2.4
  12801. * @platform Web,Native
  12802. */
  12803. /**
  12804. * @language en_US
  12805. * Specifies whether the text field has a border.
  12806. * If true, the text field has a border. If false, the text field has no border.
  12807. * Use borderColor property to set the border color.
  12808. * @default false
  12809. */
  12810. /**
  12811. * @language zh_CN
  12812. * 指定文本字段是否具有边框。
  12813. * 如果为 true,则文本字段具有边框。如果为 false,则文本字段没有边框。
  12814. * 使用 borderColor 属性来设置边框颜色。
  12815. * @default false
  12816. */
  12817. border: boolean;
  12818. /**
  12819. * @private
  12820. */
  12821. $setBorder(value: boolean): void;
  12822. /**
  12823. * @version Egret 2.4
  12824. * @platform Web,Native
  12825. */
  12826. /**
  12827. * @language en_US
  12828. * The color of the text field border.
  12829. * Even currently is no border can be retrieved or set this property, but only if the text field has the border property is set to true, the color is visible.
  12830. * @default 0x000000
  12831. */
  12832. /**
  12833. * @language zh_CN
  12834. * 文本字段边框的颜色。
  12835. * 即使当前没有边框,也可检索或设置此属性,但只有当文本字段已将 border 属性设置为 true 时,才可以看到颜色。
  12836. * @default 0x000000
  12837. */
  12838. borderColor: number;
  12839. /**
  12840. * @private
  12841. */
  12842. $setBorderColor(value: number): void;
  12843. /**
  12844. * @version Egret 2.4
  12845. * @platform Web,Native
  12846. */
  12847. /**
  12848. * @language en_US
  12849. * Specifies whether the text field has a background fill.
  12850. * If true, the text field has a background fill. If false, the text field has no background fill.
  12851. * Use the backgroundColor property to set the background color of the text field.
  12852. * @default false
  12853. */
  12854. /**
  12855. * @language zh_CN
  12856. * 指定文本字段是否具有背景填充。
  12857. * 如果为 true,则文本字段具有背景填充。如果为 false,则文本字段没有背景填充。
  12858. * 使用 backgroundColor 属性来设置文本字段的背景颜色。
  12859. * @default false
  12860. */
  12861. background: boolean;
  12862. /**
  12863. * @private
  12864. */
  12865. $setBackground(value: boolean): void;
  12866. /**
  12867. * @version Egret 2.4
  12868. * @platform Web,Native
  12869. */
  12870. /**
  12871. * @language en_US
  12872. * Color of the text field background.
  12873. * Even currently is no background, can be retrieved or set this property, but only if the text field has the background property set to true, the color is visible.
  12874. * @default 0xFFFFFF
  12875. */
  12876. /**
  12877. * @language zh_CN
  12878. * 文本字段背景的颜色。
  12879. * 即使当前没有背景,也可检索或设置此属性,但只有当文本字段已将 background 属性设置为 true 时,才可以看到颜色。
  12880. * @default 0xFFFFFF
  12881. */
  12882. backgroundColor: number;
  12883. /**
  12884. * @private
  12885. */
  12886. $setBackgroundColor(value: number): void;
  12887. /**
  12888. * @private
  12889. *
  12890. */
  12891. private fillBackground(lines?);
  12892. /**
  12893. * @language en_US
  12894. * Enter the text automatically entered into the input state, the input type is text only and may only be invoked in the user interaction.
  12895. * @version Egret 3.0.8
  12896. * @platform Web,Native
  12897. */
  12898. /**
  12899. * @language zh_CN
  12900. * 输入文本自动进入到输入状态,仅在类型是输入文本并且是在用户交互下才可以调用。
  12901. * @version Egret 3.0.8
  12902. * @platform Web,Native
  12903. */
  12904. setFocus(): void;
  12905. /**
  12906. * @private
  12907. *
  12908. */
  12909. $onRemoveFromStage(): void;
  12910. /**
  12911. * @private
  12912. *
  12913. * @param stage
  12914. * @param nestLevel
  12915. */
  12916. $onAddToStage(stage: Stage, nestLevel: number): void;
  12917. /**
  12918. * 不能重写$invalidateContentBounds,因为内部graphics调用clear时会触发$invalidateContentBounds这狗方法,从而导致死循环。
  12919. */
  12920. $invalidateTextField(): void;
  12921. $update(dirtyRegionPolicy: string, bounds?: Rectangle): boolean;
  12922. $getRenderBounds(): Rectangle;
  12923. /**
  12924. * @private
  12925. */
  12926. $measureContentBounds(bounds: Rectangle): void;
  12927. /**
  12928. * @private
  12929. * @see egret.DisplayObject._render
  12930. * @param renderContext
  12931. */
  12932. $render(): void;
  12933. /**
  12934. * @private
  12935. */
  12936. private isFlow;
  12937. /**
  12938. * @version Egret 2.4
  12939. * @platform Web,Native
  12940. */
  12941. /**
  12942. * @language en_US
  12943. * Set rich text
  12944. */
  12945. /**
  12946. * @language zh_CN
  12947. * 设置富文本
  12948. * @see http://edn.egret.com/cn/index.php/article/index/id/146
  12949. */
  12950. textFlow: Array<egret.ITextElement>;
  12951. /**
  12952. * @private
  12953. *
  12954. * @param text
  12955. * @returns
  12956. */
  12957. private changeToPassText(text);
  12958. /**
  12959. * @private
  12960. */
  12961. private textArr;
  12962. /**
  12963. * @private
  12964. *
  12965. * @param textArr
  12966. */
  12967. private setMiddleStyle(textArr);
  12968. /**
  12969. * @language en_US
  12970. * Get the text measured width
  12971. * @version Egret 2.4
  12972. * @platform Web,Native
  12973. */
  12974. /**
  12975. * @language zh_CN
  12976. * 获取文本测量宽度
  12977. * @version Egret 2.4
  12978. * @platform Web,Native
  12979. */
  12980. textWidth: number;
  12981. /**
  12982. * @language en_US
  12983. * Get Text measuring height
  12984. * @version Egret 2.4
  12985. * @platform Web,Native
  12986. */
  12987. /**
  12988. * @language zh_CN
  12989. * 获取文本测量高度
  12990. * @version Egret 2.4
  12991. * @platform Web,Native
  12992. */
  12993. textHeight: number;
  12994. /**
  12995. * @private
  12996. * @param text
  12997. * @version Egret 2.4
  12998. * @platform Web,Native
  12999. */
  13000. appendText(text: string): void;
  13001. /**
  13002. * @private
  13003. * @param element
  13004. * @version Egret 2.4
  13005. * @platform Web,Native
  13006. */
  13007. appendElement(element: egret.ITextElement): void;
  13008. /**
  13009. * @private
  13010. */
  13011. private linesArr;
  13012. /**
  13013. * @private
  13014. *
  13015. * @returns
  13016. */
  13017. $getLinesArr(): Array<egret.ILineElement>;
  13018. /**
  13019. * @private
  13020. */
  13021. $isTyping: boolean;
  13022. /**
  13023. * @private
  13024. * 返回要绘制的下划线列表
  13025. */
  13026. private drawText();
  13027. private addEvent();
  13028. private removeEvent();
  13029. private onTapHandler(e);
  13030. }
  13031. }
  13032. declare namespace egret {
  13033. /**
  13034. * @language en_US
  13035. * TextFieldInputType class is an enumeration of constant value used in setting the inputType property of the TextField class.
  13036. * @version Egret 3.1.2
  13037. * @platform Web,Native
  13038. */
  13039. /**
  13040. * @language zh_CN
  13041. * TextFieldInputType 类是在设置 TextField 类的 inputType 属性时使用的常数值的枚举。
  13042. * @version Egret 3.1.2
  13043. * @platform Web,Native
  13044. */
  13045. class TextFieldInputType {
  13046. /**
  13047. * @language en_US
  13048. * The default
  13049. * @version Egret 3.1.2
  13050. * @platform Web,Native
  13051. */
  13052. /**
  13053. * @language zh_CN
  13054. * 默认 input 类型
  13055. * @version Egret 3.1.2
  13056. * @platform Web,Native
  13057. */
  13058. static TEXT: string;
  13059. /**
  13060. * @language en_US
  13061. * Telephone Number Inputs
  13062. * @version Egret 3.1.2
  13063. * @platform Web,Native
  13064. */
  13065. /**
  13066. * @language zh_CN
  13067. * 电话号码 input 类型
  13068. * @version Egret 3.1.2
  13069. * @platform Web,Native
  13070. */
  13071. static TEL: string;
  13072. /**
  13073. * @language en_US
  13074. * Password Inputs
  13075. * @version Egret 3.1.2
  13076. * @platform Web,Native
  13077. */
  13078. /**
  13079. * @language zh_CN
  13080. * password 类型
  13081. * @version Egret 3.1.2
  13082. * @platform Web,Native
  13083. */
  13084. static PASSWORD: string;
  13085. }
  13086. }
  13087. declare namespace egret {
  13088. /**
  13089. * @language en_US
  13090. * TextFieldType class is an enumeration of constant value used in setting the type property of the TextField class.
  13091. * @version Egret 2.4
  13092. * @platform Web,Native
  13093. */
  13094. /**
  13095. * @language zh_CN
  13096. * TextFieldType 类是在设置 TextField 类的 type 属性时使用的常数值的枚举。
  13097. * @version Egret 2.4
  13098. * @platform Web,Native
  13099. */
  13100. class TextFieldType {
  13101. /**
  13102. * @language en_US
  13103. * Used to specify dynamic text
  13104. * @version Egret 2.4
  13105. * @platform Web,Native
  13106. */
  13107. /**
  13108. * @language zh_CN
  13109. * 用于指定动态文本
  13110. * @version Egret 2.4
  13111. * @platform Web,Native
  13112. */
  13113. static DYNAMIC: string;
  13114. /**
  13115. * @language en_US
  13116. * Used to specify the input text
  13117. * @version Egret 2.4
  13118. * @platform Web,Native
  13119. */
  13120. /**
  13121. * @language zh_CN
  13122. * 用于指定输入文本
  13123. * @version Egret 2.4
  13124. * @platform Web,Native
  13125. */
  13126. static INPUT: string;
  13127. }
  13128. }
  13129. declare namespace egret {
  13130. /**
  13131. * @private
  13132. * @version Egret 2.4
  13133. * @platform Web,Native
  13134. */
  13135. class TextFieldUtils {
  13136. /**
  13137. * 获取第一个绘制的行数
  13138. * @param textfield 文本
  13139. * @returns {number} 行数,从0开始
  13140. * @private
  13141. */
  13142. static $getStartLine(textfield: egret.TextField): number;
  13143. /**
  13144. * 获取水平比例
  13145. * @param textfield 文本
  13146. * @returns {number} 水平比例
  13147. * @private
  13148. */
  13149. static $getHalign(textfield: egret.TextField): number;
  13150. /**
  13151. * @private
  13152. *
  13153. * @param textfield
  13154. * @returns
  13155. */
  13156. static $getTextHeight(textfield: egret.TextField): number;
  13157. /**
  13158. * 获取垂直比例
  13159. * @param textfield 文本
  13160. * @returns {number} 垂直比例
  13161. * @private
  13162. */
  13163. static $getValign(textfield: egret.TextField): number;
  13164. /**
  13165. * 根据x、y获取文本项
  13166. * @param textfield 文本
  13167. * @param x x坐标值
  13168. * @param y y坐标值
  13169. * @returns 文本单项
  13170. * @private
  13171. */
  13172. static $getTextElement(textfield: egret.TextField, x: number, y: number): ITextElement;
  13173. /**
  13174. * 获取文本点击块
  13175. * @param textfield 文本
  13176. * @param x x坐标值
  13177. * @param y y坐标值
  13178. * @returns 文本点击块
  13179. * @private
  13180. */
  13181. static $getHit(textfield: egret.TextField, x: number, y: number): IHitTextElement;
  13182. /**
  13183. * 获取当前显示多少行
  13184. * @param textfield 文本
  13185. * @returns {number} 显示的行数
  13186. * @private
  13187. */
  13188. static $getScrollNum(textfield: egret.TextField): number;
  13189. }
  13190. }
  13191. /**
  13192. * @private
  13193. */
  13194. declare namespace egret.sys {
  13195. /**
  13196. * 测量文本在指定样式下的宽度。
  13197. * @param text 要测量的文本内容。
  13198. * @param fontFamily 字体名称
  13199. * @param fontSize 字体大小
  13200. * @param bold 是否粗体
  13201. * @param italic 是否斜体
  13202. */
  13203. let measureText: (text: string, fontFamily: string, fontSize: number, bold: boolean, italic: boolean) => number;
  13204. }
  13205. declare namespace egret {
  13206. /**
  13207. * @language en_US
  13208. * The VerticalAlign class defines the possible values for the vertical alignment.
  13209. * @see egret.TextField#verticalAlign
  13210. * @version Egret 2.4
  13211. * @platform Web,Native
  13212. */
  13213. /**
  13214. * @language zh_CN
  13215. * VerticalAlign 类为垂直对齐方式定义可能的值。
  13216. * @see egret.TextField#verticalAlign
  13217. * @version Egret 2.4
  13218. * @platform Web,Native
  13219. */
  13220. class VerticalAlign {
  13221. /**
  13222. * @language en_US
  13223. * Vertically align content to the top of the container.
  13224. * @version Egret 2.4
  13225. * @platform Web,Native
  13226. */
  13227. /**
  13228. * @language zh_CN
  13229. * 将内容与容器的顶部对齐。
  13230. * @version Egret 2.4
  13231. * @platform Web,Native
  13232. */
  13233. static TOP: string;
  13234. /**
  13235. * @language en_US
  13236. * Vertically align content to the bottom of the container.
  13237. * @version Egret 2.4
  13238. * @platform Web,Native
  13239. */
  13240. /**
  13241. * @language zh_CN
  13242. * 将内容与容器的底部对齐。
  13243. * @version Egret 2.4
  13244. * @platform Web,Native
  13245. */
  13246. static BOTTOM: string;
  13247. /**
  13248. * @language en_US
  13249. * Vertically align content in the middle of the container.
  13250. * @version Egret 2.4
  13251. * @platform Web,Native
  13252. */
  13253. /**
  13254. * @language zh_CN
  13255. * 在容器的垂直中心对齐内容。
  13256. * @version Egret 2.4
  13257. * @platform Web,Native
  13258. */
  13259. static MIDDLE: string;
  13260. /**
  13261. * @language en_US
  13262. * Vertical alignment with both edges
  13263. * Note: TextFiled does not support this alignment method."
  13264. * @version Egret 2.4
  13265. * @platform Web,Native
  13266. */
  13267. /**
  13268. * @language zh_CN
  13269. * 垂直两端对齐
  13270. * 注意:TextFiled不支持此对齐方式。
  13271. * @version Egret 2.4
  13272. * @platform Web,Native
  13273. */
  13274. static JUSTIFY: string;
  13275. /**
  13276. * @language en_US
  13277. * Align the content of the child items, relative to the container. This operation will adjust uniformly the size of all the child items to be the Content Height \" of the container \".
  13278. * The Content Height \" of the container \" is the size of the max. child item. If the size of all child items are less than the height of the container, they will be adjusted to the height of the container.
  13279. * Note: TextFiled does not support this alignment method.
  13280. * @version Egret 2.4
  13281. * @platform Web,Native
  13282. */
  13283. /**
  13284. * @language zh_CN
  13285. * 相对于容器对子项进行内容对齐。这会将所有子项的大小统一调整为容器的"内容高度"。
  13286. * 容器的"内容高度"是最大子项的大小,如果所有子项都小于容器的高度,则会将所有子项的大小调整为容器的高度。
  13287. * 注意:TextFiled不支持此对齐方式。
  13288. * @version Egret 2.4
  13289. * @platform Web,Native
  13290. */
  13291. static CONTENT_JUSTIFY: string;
  13292. }
  13293. }
  13294. declare namespace egret {
  13295. /**
  13296. * @language en_US
  13297. * The Endian class contains values that denote the byte order used to represent multibyte numbers.
  13298. * The byte order is either bigEndian (most significant byte first) or littleEndian (least significant byte first).
  13299. * @version Egret 2.4
  13300. * @platform Web,Native
  13301. */
  13302. /**
  13303. * @language zh_CN
  13304. * Endian 类中包含一些值,它们表示用于表示多字节数字的字节顺序。
  13305. * 字节顺序为 bigEndian(最高有效字节位于最前)或 littleEndian(最低有效字节位于最前)。
  13306. * @version Egret 2.4
  13307. * @platform Web,Native
  13308. */
  13309. class Endian {
  13310. /**
  13311. * @language en_US
  13312. * Indicates the least significant byte of the multibyte number appears first in the sequence of bytes.
  13313. * The hexadecimal number 0x12345678 has 4 bytes (2 hexadecimal digits per byte). The most significant byte is 0x12. The least significant byte is 0x78. (For the equivalent decimal number, 305419896, the most significant digit is 3, and the least significant digit is 6).
  13314. * @version Egret 2.4
  13315. * @platform Web,Native
  13316. */
  13317. /**
  13318. * @language zh_CN
  13319. * 表示多字节数字的最低有效字节位于字节序列的最前面。
  13320. * 十六进制数字 0x12345678 包含 4 个字节(每个字节包含 2 个十六进制数字)。最高有效字节为 0x12。最低有效字节为 0x78。(对于等效的十进制数字 305419896,最高有效数字是 3,最低有效数字是 6)。
  13321. * @version Egret 2.4
  13322. * @platform Web,Native
  13323. */
  13324. static LITTLE_ENDIAN: string;
  13325. /**
  13326. * @language en_US
  13327. * Indicates the most significant byte of the multibyte number appears first in the sequence of bytes.
  13328. * The hexadecimal number 0x12345678 has 4 bytes (2 hexadecimal digits per byte). The most significant byte is 0x12. The least significant byte is 0x78. (For the equivalent decimal number, 305419896, the most significant digit is 3, and the least significant digit is 6).
  13329. * @version Egret 2.4
  13330. * @platform Web,Native
  13331. */
  13332. /**
  13333. * @language zh_CN
  13334. * 表示多字节数字的最高有效字节位于字节序列的最前面。
  13335. * 十六进制数字 0x12345678 包含 4 个字节(每个字节包含 2 个十六进制数字)。最高有效字节为 0x12。最低有效字节为 0x78。(对于等效的十进制数字 305419896,最高有效数字是 3,最低有效数字是 6)。
  13336. * @version Egret 2.4
  13337. * @platform Web,Native
  13338. */
  13339. static BIG_ENDIAN: string;
  13340. }
  13341. /**
  13342. * @language en_US
  13343. * The ByteArray class provides methods and attributes for optimized reading and writing as well as dealing with binary data.
  13344. * Note: The ByteArray class is applied to the advanced developers who need to access data at the byte layer.
  13345. * @version Egret 2.4
  13346. * @platform Web,Native
  13347. * @includeExample egret/utils/ByteArray.ts
  13348. */
  13349. /**
  13350. * @language zh_CN
  13351. * ByteArray 类提供用于优化读取、写入以及处理二进制数据的方法和属性。
  13352. * 注意:ByteArray 类适用于需要在字节层访问数据的高级开发人员。
  13353. * @version Egret 2.4
  13354. * @platform Web,Native
  13355. * @includeExample egret/utils/ByteArray.ts
  13356. */
  13357. class ByteArray {
  13358. /**
  13359. * @private
  13360. */
  13361. private static SIZE_OF_BOOLEAN;
  13362. /**
  13363. * @private
  13364. */
  13365. private static SIZE_OF_INT8;
  13366. /**
  13367. * @private
  13368. */
  13369. private static SIZE_OF_INT16;
  13370. /**
  13371. * @private
  13372. */
  13373. private static SIZE_OF_INT32;
  13374. /**
  13375. * @private
  13376. */
  13377. private static SIZE_OF_UINT8;
  13378. /**
  13379. * @private
  13380. */
  13381. private static SIZE_OF_UINT16;
  13382. /**
  13383. * @private
  13384. */
  13385. private static SIZE_OF_UINT32;
  13386. /**
  13387. * @private
  13388. */
  13389. private static SIZE_OF_FLOAT32;
  13390. /**
  13391. * @private
  13392. */
  13393. private static SIZE_OF_FLOAT64;
  13394. /**
  13395. * @private
  13396. */
  13397. private BUFFER_EXT_SIZE;
  13398. private data;
  13399. /**
  13400. * @private
  13401. */
  13402. private _position;
  13403. /**
  13404. * @private
  13405. */
  13406. private write_position;
  13407. /**
  13408. * @language en_US
  13409. * Changes or reads the byte order; egret.Endian.BIG_ENDIAN or egret.Endian.LITTLE_ENDIAN.
  13410. * @default egret.Endian.BIG_ENDIAN
  13411. * @version Egret 2.4
  13412. * @platform Web,Native
  13413. */
  13414. /**
  13415. * @language zh_CN
  13416. * 更改或读取数据的字节顺序;egret.Endian.BIG_ENDIAN 或 egret.Endian.LITTLE_ENDIAN。
  13417. * @default egret.Endian.BIG_ENDIAN
  13418. * @version Egret 2.4
  13419. * @platform Web,Native
  13420. */
  13421. endian: string;
  13422. /**
  13423. * @version Egret 2.4
  13424. * @platform Web,Native
  13425. */
  13426. constructor(buffer?: ArrayBuffer);
  13427. /**
  13428. * @private
  13429. * @param buffer
  13430. */
  13431. private _setArrayBuffer(buffer);
  13432. /**
  13433. * @deprecated
  13434. * @version Egret 2.4
  13435. * @platform Web,Native
  13436. */
  13437. setArrayBuffer(buffer: ArrayBuffer): void;
  13438. /**
  13439. * @private
  13440. */
  13441. buffer: ArrayBuffer;
  13442. /**
  13443. * @private
  13444. * @version Egret 2.4
  13445. * @platform Web,Native
  13446. */
  13447. /**
  13448. * @private
  13449. */
  13450. dataView: DataView;
  13451. /**
  13452. * @private
  13453. */
  13454. bufferOffset: number;
  13455. /**
  13456. * @language en_US
  13457. * The current position of the file pointer (in bytes) to move or return to the ByteArray object. The next time you start reading reading method call in this position, or will start writing in this position next time call a write method.
  13458. * @version Egret 2.4
  13459. * @platform Web,Native
  13460. */
  13461. /**
  13462. * @language zh_CN
  13463. * 将文件指针的当前位置(以字节为单位)移动或返回到 ByteArray 对象中。下一次调用读取方法时将在此位置开始读取,或者下一次调用写入方法时将在此位置开始写入。
  13464. * @version Egret 2.4
  13465. * @platform Web,Native
  13466. */
  13467. position: number;
  13468. /**
  13469. * @language en_US
  13470. * The length of the ByteArray object (in bytes).
  13471. * If the length is set to be larger than the current length, the right-side zero padding byte array.
  13472. * If the length is set smaller than the current length, the byte array is truncated.
  13473. * @version Egret 2.4
  13474. * @platform Web,Native
  13475. */
  13476. /**
  13477. * @language zh_CN
  13478. * ByteArray 对象的长度(以字节为单位)。
  13479. * 如果将长度设置为大于当前长度的值,则用零填充字节数组的右侧。
  13480. * 如果将长度设置为小于当前长度的值,将会截断该字节数组。
  13481. * @version Egret 2.4
  13482. * @platform Web,Native
  13483. */
  13484. length: number;
  13485. /**
  13486. * @language en_US
  13487. * The number of bytes that can be read from the current position of the byte array to the end of the array data.
  13488. * When you access a ByteArray object, the bytesAvailable property in conjunction with the read methods each use to make sure you are reading valid data.
  13489. * @version Egret 2.4
  13490. * @platform Web,Native
  13491. */
  13492. /**
  13493. * @language zh_CN
  13494. * 可从字节数组的当前位置到数组末尾读取的数据的字节数。
  13495. * 每次访问 ByteArray 对象时,将 bytesAvailable 属性与读取方法结合使用,以确保读取有效的数据。
  13496. * @version Egret 2.4
  13497. * @platform Web,Native
  13498. */
  13499. bytesAvailable: number;
  13500. /**
  13501. * @language en_US
  13502. * Clears the contents of the byte array and resets the length and position properties to 0.
  13503. * @version Egret 2.4
  13504. * @platform Web,Native
  13505. */
  13506. /**
  13507. * @language zh_CN
  13508. * 清除字节数组的内容,并将 length 和 position 属性重置为 0。
  13509. * @version Egret 2.4
  13510. * @platform Web,Native
  13511. */
  13512. clear(): void;
  13513. /**
  13514. * @language en_US
  13515. * Read a Boolean value from the byte stream. Read a simple byte. If the byte is non-zero, it returns true; otherwise, it returns false.
  13516. * @return If the byte is non-zero, it returns true; otherwise, it returns false.
  13517. * @version Egret 2.4
  13518. * @platform Web,Native
  13519. */
  13520. /**
  13521. * @language zh_CN
  13522. * 从字节流中读取布尔值。读取单个字节,如果字节非零,则返回 true,否则返回 false
  13523. * @return 如果字节不为零,则返回 true,否则返回 false
  13524. * @version Egret 2.4
  13525. * @platform Web,Native
  13526. */
  13527. readBoolean(): boolean;
  13528. /**
  13529. * @language en_US
  13530. * Read signed bytes from the byte stream.
  13531. * @return An integer ranging from -128 to 127
  13532. * @version Egret 2.4
  13533. * @platform Web,Native
  13534. */
  13535. /**
  13536. * @language zh_CN
  13537. * 从字节流中读取带符号的字节
  13538. * @return 介于 -128 和 127 之间的整数
  13539. * @version Egret 2.4
  13540. * @platform Web,Native
  13541. */
  13542. readByte(): number;
  13543. /**
  13544. * @language en_US
  13545. * Read data byte number specified by the length parameter from the byte stream. Starting from the position specified by offset, read bytes into the ByteArray object specified by the bytes parameter, and write bytes into the target ByteArray
  13546. * @param bytes ByteArray object that data is read into
  13547. * @param offset Offset (position) in bytes. Read data should be written from this position
  13548. * @param length Byte number to be read Default value 0 indicates reading all available data
  13549. * @version Egret 2.4
  13550. * @platform Web,Native
  13551. */
  13552. /**
  13553. * @language zh_CN
  13554. * 从字节流中读取 length 参数指定的数据字节数。从 offset 指定的位置开始,将字节读入 bytes 参数指定的 ByteArray 对象中,并将字节写入目标 ByteArray 中
  13555. * @param bytes 要将数据读入的 ByteArray 对象
  13556. * @param offset bytes 中的偏移(位置),应从该位置写入读取的数据
  13557. * @param length 要读取的字节数。默认值 0 导致读取所有可用的数据
  13558. * @version Egret 2.4
  13559. * @platform Web,Native
  13560. */
  13561. readBytes(bytes: ByteArray, offset?: number, length?: number): void;
  13562. /**
  13563. * @language en_US
  13564. * Read an IEEE 754 double-precision (64 bit) floating point number from the byte stream
  13565. * @return Double-precision (64 bit) floating point number
  13566. * @version Egret 2.4
  13567. * @platform Web,Native
  13568. */
  13569. /**
  13570. * @language zh_CN
  13571. * 从字节流中读取一个 IEEE 754 双精度(64 位)浮点数
  13572. * @return 双精度(64 位)浮点数
  13573. * @version Egret 2.4
  13574. * @platform Web,Native
  13575. */
  13576. readDouble(): number;
  13577. /**
  13578. * @language en_US
  13579. * Read an IEEE 754 single-precision (32 bit) floating point number from the byte stream
  13580. * @return Single-precision (32 bit) floating point number
  13581. * @version Egret 2.4
  13582. * @platform Web,Native
  13583. */
  13584. /**
  13585. * @language zh_CN
  13586. * 从字节流中读取一个 IEEE 754 单精度(32 位)浮点数
  13587. * @return 单精度(32 位)浮点数
  13588. * @version Egret 2.4
  13589. * @platform Web,Native
  13590. */
  13591. readFloat(): number;
  13592. /**
  13593. * @language en_US
  13594. * Read a 32-bit signed integer from the byte stream.
  13595. * @return A 32-bit signed integer ranging from -2147483648 to 2147483647
  13596. * @version Egret 2.4
  13597. * @platform Web,Native
  13598. */
  13599. /**
  13600. * @language zh_CN
  13601. * 从字节流中读取一个带符号的 32 位整数
  13602. * @return 介于 -2147483648 和 2147483647 之间的 32 位带符号整数
  13603. * @version Egret 2.4
  13604. * @platform Web,Native
  13605. */
  13606. readInt(): number;
  13607. /**
  13608. * @language en_US
  13609. * Read a 16-bit signed integer from the byte stream.
  13610. * @return A 16-bit signed integer ranging from -32768 to 32767
  13611. * @version Egret 2.4
  13612. * @platform Web,Native
  13613. */
  13614. /**
  13615. * @language zh_CN
  13616. * 从字节流中读取一个带符号的 16 位整数
  13617. * @return 介于 -32768 和 32767 之间的 16 位带符号整数
  13618. * @version Egret 2.4
  13619. * @platform Web,Native
  13620. */
  13621. readShort(): number;
  13622. /**
  13623. * @language en_US
  13624. * Read unsigned bytes from the byte stream.
  13625. * @return A 32-bit unsigned integer ranging from 0 to 255
  13626. * @version Egret 2.4
  13627. * @platform Web,Native
  13628. */
  13629. /**
  13630. * @language zh_CN
  13631. * 从字节流中读取无符号的字节
  13632. * @return 介于 0 和 255 之间的 32 位无符号整数
  13633. * @version Egret 2.4
  13634. * @platform Web,Native
  13635. */
  13636. readUnsignedByte(): number;
  13637. /**
  13638. * @language en_US
  13639. * Read a 32-bit unsigned integer from the byte stream.
  13640. * @return A 32-bit unsigned integer ranging from 0 to 4294967295
  13641. * @version Egret 2.4
  13642. * @platform Web,Native
  13643. */
  13644. /**
  13645. * @language zh_CN
  13646. * 从字节流中读取一个无符号的 32 位整数
  13647. * @return 介于 0 和 4294967295 之间的 32 位无符号整数
  13648. * @version Egret 2.4
  13649. * @platform Web,Native
  13650. */
  13651. readUnsignedInt(): number;
  13652. /**
  13653. * @language en_US
  13654. * Read a 16-bit unsigned integer from the byte stream.
  13655. * @return A 16-bit unsigned integer ranging from 0 to 65535
  13656. * @version Egret 2.4
  13657. * @platform Web,Native
  13658. */
  13659. /**
  13660. * @language zh_CN
  13661. * 从字节流中读取一个无符号的 16 位整数
  13662. * @return 介于 0 和 65535 之间的 16 位无符号整数
  13663. * @version Egret 2.4
  13664. * @platform Web,Native
  13665. */
  13666. readUnsignedShort(): number;
  13667. /**
  13668. * @language en_US
  13669. * Read a UTF-8 character string from the byte stream Assume that the prefix of the character string is a short unsigned integer (use byte to express length)
  13670. * @return UTF-8 character string
  13671. * @version Egret 2.4
  13672. * @platform Web,Native
  13673. */
  13674. /**
  13675. * @language zh_CN
  13676. * 从字节流中读取一个 UTF-8 字符串。假定字符串的前缀是无符号的短整型(以字节表示长度)
  13677. * @return UTF-8 编码的字符串
  13678. * @version Egret 2.4
  13679. * @platform Web,Native
  13680. */
  13681. readUTF(): string;
  13682. /**
  13683. * @language en_US
  13684. * Read a UTF-8 byte sequence specified by the length parameter from the byte stream, and then return a character string
  13685. * @param Specify a short unsigned integer of the UTF-8 byte length
  13686. * @return A character string consists of UTF-8 bytes of the specified length
  13687. * @version Egret 2.4
  13688. * @platform Web,Native
  13689. */
  13690. /**
  13691. * @language zh_CN
  13692. * 从字节流中读取一个由 length 参数指定的 UTF-8 字节序列,并返回一个字符串
  13693. * @param length 指明 UTF-8 字节长度的无符号短整型数
  13694. * @return 由指定长度的 UTF-8 字节组成的字符串
  13695. * @version Egret 2.4
  13696. * @platform Web,Native
  13697. */
  13698. readUTFBytes(length: number): string;
  13699. /**
  13700. * @language en_US
  13701. * Write a Boolean value. A single byte is written according to the value parameter. If the value is true, write 1; if the value is false, write 0.
  13702. * @param value A Boolean value determining which byte is written. If the value is true, write 1; if the value is false, write 0.
  13703. * @version Egret 2.4
  13704. * @platform Web,Native
  13705. */
  13706. /**
  13707. * @language zh_CN
  13708. * 写入布尔值。根据 value 参数写入单个字节。如果为 true,则写入 1,如果为 false,则写入 0
  13709. * @param value 确定写入哪个字节的布尔值。如果该参数为 true,则该方法写入 1;如果该参数为 false,则该方法写入 0
  13710. * @version Egret 2.4
  13711. * @platform Web,Native
  13712. */
  13713. writeBoolean(value: boolean): void;
  13714. /**
  13715. * @language en_US
  13716. * Write a byte into the byte stream
  13717. * The low 8 bits of the parameter are used. The high 24 bits are ignored.
  13718. * @param value A 32-bit integer. The low 8 bits will be written into the byte stream
  13719. * @version Egret 2.4
  13720. * @platform Web,Native
  13721. */
  13722. /**
  13723. * @language zh_CN
  13724. * 在字节流中写入一个字节
  13725. * 使用参数的低 8 位。忽略高 24 位
  13726. * @param value 一个 32 位整数。低 8 位将被写入字节流
  13727. * @version Egret 2.4
  13728. * @platform Web,Native
  13729. */
  13730. writeByte(value: number): void;
  13731. /**
  13732. * @language en_US
  13733. * Write the byte sequence that includes length bytes in the specified byte array, bytes, (starting at the byte specified by offset, using a zero-based index), into the byte stream
  13734. * If the length parameter is omitted, the default length value 0 is used and the entire buffer starting at offset is written. If the offset parameter is also omitted, the entire buffer is written
  13735. * If the offset or length parameter is out of range, they are clamped to the beginning and end of the bytes array.
  13736. * @param bytes ByteArray Object
  13737. * @param offset A zero-based index specifying the position into the array to begin writing
  13738. * @param length An unsigned integer specifying how far into the buffer to write
  13739. * @version Egret 2.4
  13740. * @platform Web,Native
  13741. */
  13742. /**
  13743. * @language zh_CN
  13744. * 将指定字节数组 bytes(起始偏移量为 offset,从零开始的索引)中包含 length 个字节的字节序列写入字节流
  13745. * 如果省略 length 参数,则使用默认长度 0;该方法将从 offset 开始写入整个缓冲区。如果还省略了 offset 参数,则写入整个缓冲区
  13746. * 如果 offset 或 length 超出范围,它们将被锁定到 bytes 数组的开头和结尾
  13747. * @param bytes ByteArray 对象
  13748. * @param offset 从 0 开始的索引,表示在数组中开始写入的位置
  13749. * @param length 一个无符号整数,表示在缓冲区中的写入范围
  13750. * @version Egret 2.4
  13751. * @platform Web,Native
  13752. */
  13753. writeBytes(bytes: ByteArray, offset?: number, length?: number): void;
  13754. /**
  13755. * @language en_US
  13756. * Write an IEEE 754 double-precision (64 bit) floating point number into the byte stream
  13757. * @param value Double-precision (64 bit) floating point number
  13758. * @version Egret 2.4
  13759. * @platform Web,Native
  13760. */
  13761. /**
  13762. * @language zh_CN
  13763. * 在字节流中写入一个 IEEE 754 双精度(64 位)浮点数
  13764. * @param value 双精度(64 位)浮点数
  13765. * @version Egret 2.4
  13766. * @platform Web,Native
  13767. */
  13768. writeDouble(value: number): void;
  13769. /**
  13770. * @language en_US
  13771. * Write an IEEE 754 single-precision (32 bit) floating point number into the byte stream
  13772. * @param value Single-precision (32 bit) floating point number
  13773. * @version Egret 2.4
  13774. * @platform Web,Native
  13775. */
  13776. /**
  13777. * @language zh_CN
  13778. * 在字节流中写入一个 IEEE 754 单精度(32 位)浮点数
  13779. * @param value 单精度(32 位)浮点数
  13780. * @version Egret 2.4
  13781. * @platform Web,Native
  13782. */
  13783. writeFloat(value: number): void;
  13784. /**
  13785. * @language en_US
  13786. * Write a 32-bit signed integer into the byte stream
  13787. * @param value An integer to be written into the byte stream
  13788. * @version Egret 2.4
  13789. * @platform Web,Native
  13790. */
  13791. /**
  13792. * @language zh_CN
  13793. * 在字节流中写入一个带符号的 32 位整数
  13794. * @param value 要写入字节流的整数
  13795. * @version Egret 2.4
  13796. * @platform Web,Native
  13797. */
  13798. writeInt(value: number): void;
  13799. /**
  13800. * @language en_US
  13801. * Write a 16-bit integer into the byte stream. The low 16 bits of the parameter are used. The high 16 bits are ignored.
  13802. * @param value A 32-bit integer. Its low 16 bits will be written into the byte stream
  13803. * @version Egret 2.4
  13804. * @platform Web,Native
  13805. */
  13806. /**
  13807. * @language zh_CN
  13808. * 在字节流中写入一个 16 位整数。使用参数的低 16 位。忽略高 16 位
  13809. * @param value 32 位整数,该整数的低 16 位将被写入字节流
  13810. * @version Egret 2.4
  13811. * @platform Web,Native
  13812. */
  13813. writeShort(value: number): void;
  13814. /**
  13815. * @language en_US
  13816. * Write a 32-bit unsigned integer into the byte stream
  13817. * @param value An unsigned integer to be written into the byte stream
  13818. * @version Egret 2.4
  13819. * @platform Web,Native
  13820. */
  13821. /**
  13822. * @language zh_CN
  13823. * 在字节流中写入一个无符号的 32 位整数
  13824. * @param value 要写入字节流的无符号整数
  13825. * @version Egret 2.4
  13826. * @platform Web,Native
  13827. */
  13828. writeUnsignedInt(value: number): void;
  13829. /**
  13830. * @language en_US
  13831. * Write a 16-bit unsigned integer into the byte stream
  13832. * @param value An unsigned integer to be written into the byte stream
  13833. * @version Egret 2.5
  13834. * @platform Web,Native
  13835. */
  13836. /**
  13837. * @language zh_CN
  13838. * 在字节流中写入一个无符号的 16 位整数
  13839. * @param value 要写入字节流的无符号整数
  13840. * @version Egret 2.5
  13841. * @platform Web,Native
  13842. */
  13843. writeUnsignedShort(value: number): void;
  13844. /**
  13845. * @language en_US
  13846. * Write a UTF-8 string into the byte stream. The length of the UTF-8 string in bytes is written first, as a 16-bit integer, followed by the bytes representing the characters of the string
  13847. * @param value Character string value to be written
  13848. * @version Egret 2.4
  13849. * @platform Web,Native
  13850. */
  13851. /**
  13852. * @language zh_CN
  13853. * 将 UTF-8 字符串写入字节流。先写入以字节表示的 UTF-8 字符串长度(作为 16 位整数),然后写入表示字符串字符的字节
  13854. * @param value 要写入的字符串值
  13855. * @version Egret 2.4
  13856. * @platform Web,Native
  13857. */
  13858. writeUTF(value: string): void;
  13859. /**
  13860. * @language en_US
  13861. * Write a UTF-8 string into the byte stream. Similar to the writeUTF() method, but the writeUTFBytes() method does not prefix the string with a 16-bit length word
  13862. * @param value Character string value to be written
  13863. * @version Egret 2.4
  13864. * @platform Web,Native
  13865. */
  13866. /**
  13867. * @language zh_CN
  13868. * 将 UTF-8 字符串写入字节流。类似于 writeUTF() 方法,但 writeUTFBytes() 不使用 16 位长度的词为字符串添加前缀
  13869. * @param value 要写入的字符串值
  13870. * @version Egret 2.4
  13871. * @platform Web,Native
  13872. */
  13873. writeUTFBytes(value: string): void;
  13874. /**
  13875. *
  13876. * @returns
  13877. * @version Egret 2.4
  13878. * @platform Web,Native
  13879. */
  13880. toString(): string;
  13881. /**
  13882. * @private
  13883. * 将 Uint8Array 写入字节流
  13884. * @param bytes 要写入的Uint8Array
  13885. * @param validateBuffer
  13886. */
  13887. _writeUint8Array(bytes: Uint8Array, validateBuffer?: boolean): void;
  13888. /**
  13889. * @param len
  13890. * @returns
  13891. * @version Egret 2.4
  13892. * @platform Web,Native
  13893. * @private
  13894. */
  13895. validate(len: number): boolean;
  13896. /**********************/
  13897. /**********************/
  13898. /**
  13899. * @private
  13900. * @param len
  13901. * @param needReplace
  13902. */
  13903. private validateBuffer(len, needReplace?);
  13904. /**
  13905. * @private
  13906. * UTF-8 Encoding/Decoding
  13907. */
  13908. private encodeUTF8(str);
  13909. /**
  13910. * @private
  13911. *
  13912. * @param data
  13913. * @returns
  13914. */
  13915. private decodeUTF8(data);
  13916. /**
  13917. * @private
  13918. *
  13919. * @param code_point
  13920. */
  13921. private encoderError(code_point);
  13922. /**
  13923. * @private
  13924. *
  13925. * @param fatal
  13926. * @param opt_code_point
  13927. * @returns
  13928. */
  13929. private decoderError(fatal, opt_code_point?);
  13930. /**
  13931. * @private
  13932. */
  13933. private EOF_byte;
  13934. /**
  13935. * @private
  13936. */
  13937. private EOF_code_point;
  13938. /**
  13939. * @private
  13940. *
  13941. * @param a
  13942. * @param min
  13943. * @param max
  13944. */
  13945. private inRange(a, min, max);
  13946. /**
  13947. * @private
  13948. *
  13949. * @param n
  13950. * @param d
  13951. */
  13952. private div(n, d);
  13953. /**
  13954. * @private
  13955. *
  13956. * @param string
  13957. */
  13958. private stringToCodePoints(string);
  13959. }
  13960. }
  13961. declare namespace egret {
  13962. /**
  13963. * @language en_US
  13964. * A class that provides constant values for visual blend mode effects. These constants are used in the blendMode
  13965. * property of the DisplayObject class.
  13966. * @see egret.DisplayObject#blendMode
  13967. * @version Egret 2.4
  13968. * @platform Web,Native
  13969. * @includeExample egret/display/BlendMode.ts
  13970. * @see http://edn.egret.com/cn/docs/page/108 显示容器的概念与实现
  13971. */
  13972. /**
  13973. * @language zh_CN
  13974. * 提供混合模式可视效果的常量值的类,通常用于 DisplayObject 的 blendMode 属性上。
  13975. * @see egret.DisplayObject#blendMode
  13976. * @version Egret 2.4
  13977. * @platform Web,Native
  13978. * @includeExample egret/display/BlendMode.ts
  13979. * @see http://edn.egret.com/cn/docs/page/108 显示容器的概念与实现
  13980. */
  13981. class BlendMode {
  13982. /**
  13983. * @language en_US
  13984. * The display object appears in front of the background. Pixel values of the display object override the pixel
  13985. * values of the background. Where the display object is transparent, the background is visible.
  13986. * @version Egret 2.4
  13987. * @platform Web,Native
  13988. */
  13989. /**
  13990. * @language zh_CN
  13991. * 该显示对象出现在背景前面。显示对象的像素值会覆盖背景的像素值。在显示对象为透明的区域,背景是可见的。
  13992. * @version Egret 2.4
  13993. * @platform Web,Native
  13994. */
  13995. static NORMAL: string;
  13996. /**
  13997. * @language en_US
  13998. * Adds the values of the constituent colors of the display object to the colors of its background, applying a
  13999. * ceiling of 0xFF. This setting is commonly used for animating a lightening dissolve between two objects.<br/>
  14000. * For example, if the display object has a pixel with an RGB value of 0xAAA633, and the background pixel has an
  14001. * RGB value of 0xDD2200, the resulting RGB value for the displayed pixel is 0xFFC833 (because 0xAA + 0xDD > 0xFF,
  14002. * 0xA6 + 0x22 = 0xC8, and 0x33 + 0x00 = 0x33).
  14003. * @version Egret 2.4
  14004. * @platform Web,Native
  14005. */
  14006. /**
  14007. * @language zh_CN
  14008. * 将显示对象的原色值添加到它的背景颜色中,上限值为 0xFF。此设置通常用于使两个对象间的加亮溶解产生动画效果。<br/>
  14009. * 例如,如果显示对象的某个像素的 RGB 值为 0xAAA633,背景像素的 RGB 值为 0xDD2200,则显示像素的结果 RGB 值为 0xFFC833
  14010. * (因为 0xAA + 0xDD > 0xFF,0xA6 + 0x22 = 0xC8,且 0x33 + 0x00 = 0x33)。
  14011. * @version Egret 2.4
  14012. * @platform Web,Native
  14013. */
  14014. static ADD: string;
  14015. /**
  14016. * @language en_US
  14017. * Erases the background based on the alpha value of the display object.
  14018. * @version Egret 2.4
  14019. * @platform Web,Native
  14020. */
  14021. /**
  14022. * @language zh_CN
  14023. * 根据显示对象的 Alpha 值擦除背景。Alpha 值不为0的区域将被擦除。
  14024. * @version Egret 2.4
  14025. * @platform Web,Native
  14026. */
  14027. static ERASE: string;
  14028. }
  14029. }
  14030. declare namespace egret.sys {
  14031. /**
  14032. * @private
  14033. * 转换 blendMode 字符串为数字。
  14034. */
  14035. function blendModeToNumber(blendMode: string): number;
  14036. /**
  14037. * @private
  14038. * 转换数字为 blendMode 字符串。
  14039. */
  14040. function numberToBlendMode(blendMode: number): string;
  14041. }
  14042. declare namespace egret {
  14043. /**
  14044. * @private
  14045. */
  14046. let fontMapping: {};
  14047. /**
  14048. * 兼容旧版本不使用 fontMapping 的情况
  14049. * @private
  14050. */
  14051. let useFontMapping: boolean;
  14052. /**
  14053. * @language en_US
  14054. * Register font mapping.
  14055. * @param fontFamily The font family name to register.
  14056. * @param value The font value.
  14057. * @version Egret 3.2.3
  14058. * @platform Native
  14059. */
  14060. /**
  14061. * @language zh_CN
  14062. * 注册字体映射
  14063. * @param fontFamily 要注册的字体名称
  14064. * @param value 注册的字体值
  14065. * @version Egret 3.2.3
  14066. * @platform Native
  14067. */
  14068. function registerFontMapping(fontFamily: string, value: string): void;
  14069. }
  14070. declare namespace egret {
  14071. /**
  14072. * @language en_US
  14073. * The Stage class represents the main drawing area.The Stage object is not globally accessible. You need to access
  14074. * it through the stage property of a DisplayObject instance.<br/>
  14075. * The Stage class has several ancestor classes — Sprite, DisplayObject, and EventDispatcher — from which it inherits
  14076. * properties and methods. Many of these properties and methods are inapplicable to Stage objects.
  14077. * @event egret.Event.RESIZE Dispatched when the stageWidth or stageHeight property of the Stage object is changed.
  14078. * @version Egret 2.4
  14079. * @platform Web,Native
  14080. * @includeExample egret/display/Stage.ts
  14081. */
  14082. /**
  14083. * @language zh_CN
  14084. * Stage 类代表主绘图区。
  14085. * 可以利用 DisplayObject 实例的 stage 属性进行访问。<br/>
  14086. * Stage 类具有多个祖代类: Sprite、DisplayObject 和 EventDispatcher,属性和方法便是从这些类继承而来的。
  14087. * 从这些继承的许多属性和方法不适用于 Stage 对象。
  14088. * @event egret.Event.RESIZE 当stageWidth或stageHeight属性发生改变时调度
  14089. * @event egret.Event.DEACTIVATE 当stage失去焦点后调度
  14090. * @event egret.Event.ACTIVATE 当stage获得焦点后调度
  14091. *
  14092. * @version Egret 2.4
  14093. * @platform Web,Native
  14094. * @includeExample egret/display/Stage.ts
  14095. */
  14096. class Stage extends DisplayObjectContainer {
  14097. /**
  14098. * @private
  14099. * Stage不许允许自行实例化
  14100. * @version Egret 2.4
  14101. * @platform Web,Native
  14102. */
  14103. constructor();
  14104. /**
  14105. * @language en_US
  14106. * Gets and sets the frame rate of the stage. The frame rate is defined as frames per second. Valid range for the
  14107. * frame rate is from 0.01 to 1000 frames per second.<br/>
  14108. * Note: setting the frameRate property of one Stage object changes the frame rate for all Stage objects
  14109. * @default 30
  14110. * @version Egret 2.4
  14111. * @platform Web,Native
  14112. */
  14113. /**
  14114. * @language zh_CN
  14115. * 获取并设置舞台的帧速率。帧速率是指每秒显示的帧数。帧速率的有效范围为每秒 0.01 到 60 个帧。<br/>
  14116. * 注意: 修改任何一个Stage的frameRate属性都会同步修改其他Stage的帧率。
  14117. * @default 30
  14118. * @version Egret 2.4
  14119. * @platform Web,Native
  14120. */
  14121. frameRate: number;
  14122. /**
  14123. * @private
  14124. */
  14125. $stageWidth: number;
  14126. /**
  14127. * @language en_US
  14128. * Indicates the width of the stage, in pixels.
  14129. * @version Egret 2.4
  14130. * @platform Web,Native
  14131. */
  14132. /**
  14133. * @language zh_CN
  14134. * 舞台的当前宽度(以像素为单位)。
  14135. * @version Egret 2.4
  14136. * @platform Web,Native
  14137. */
  14138. stageWidth: number;
  14139. /**
  14140. * @private
  14141. */
  14142. $stageHeight: number;
  14143. /**
  14144. * @language en_US
  14145. * Indicates the height of the stage, in pixels.
  14146. * @version Egret 2.4
  14147. * @platform Web,Native
  14148. */
  14149. /**
  14150. * @language zh_CN
  14151. * 舞台的当前高度(以像素为单位)。
  14152. * @version Egret 2.4
  14153. * @platform Web,Native
  14154. */
  14155. stageHeight: number;
  14156. /**
  14157. * @language en_US
  14158. * After you call the invalidate() method, when the display list is next rendered, the Egret runtime sends a render
  14159. * event to each display object that has registered to listen for the render event. You must call the invalidate()
  14160. * method each time you want the Egret runtime to send render events.
  14161. * @version Egret 2.4
  14162. * @platform Web,Native
  14163. */
  14164. /**
  14165. * @language zh_CN
  14166. * 调用 invalidate() 方法后,在显示列表下次呈现时,Egret 会向每个已注册侦听 Event.RENDER 事件的显示对象发送一个 Event.RENDER 事件。
  14167. * 每次您希望 Egret 发送 Event.RENDER 事件时,都必须调用 invalidate() 方法。
  14168. * @version Egret 2.4
  14169. * @platform Web,Native
  14170. */
  14171. invalidate(): void;
  14172. /**
  14173. * @deprecated
  14174. */
  14175. registerImplementation(interfaceName: string, instance: any): void;
  14176. /**
  14177. * @deprecated
  14178. */
  14179. getImplementation(interfaceName: string): any;
  14180. /**
  14181. * @private
  14182. * 设备屏幕引用
  14183. */
  14184. $screen: egret.sys.Screen;
  14185. $scaleMode: string;
  14186. /**
  14187. * @language en_US
  14188. * A StageScaleMode class that specifies which scale mode to use. The following are valid values:<br/>
  14189. * <ul>
  14190. * <li>StageScaleMode.EXACT_FIT -- The entire application be visible in the specified area without trying to preserve the original aspect ratio. Distortion can occur, the application may be stretched or compressed.</li>
  14191. * <li>StageScaleMode.SHOW_ALL -- The entire application is visible in the specified area without distortion while maintaining the application of the original aspect ratio. Applications may display border.</li>
  14192. * <li>StageScaleMode.NO_SCALE -- The size of the entire application is fixed, so that even if the size of the player window changes, it remains unchanged. If the player window is smaller than the content, it may do some trimming.</li>
  14193. * <li>StageScaleMode.NO_BORDER -- Keep the original aspect ratio scaling application content, after scaling a narrow direction of application content to fill the viewport players on both sides in the other direction may exceed the viewport and the player is cut.</li>
  14194. * <li>StageScaleMode.FIXED_WIDTH -- Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, but only to keep the contents of the original application constant width, height may change.</li>
  14195. * <li>StageScaleMode.FIXED_HEIGHT -- Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, but only to keep the contents of the original application constant height, width may change.</li>
  14196. * </ul>
  14197. * @default egret.StageScaleMode.SHOW_ALL
  14198. */
  14199. /**
  14200. * @language zh_CN
  14201. * 一个 StageScaleMode 类中指定要使用哪种缩放模式的值。以下是有效值:<br/>
  14202. * <ul>
  14203. * <li>StageScaleMode.EXACT_FIT -- 整个应用程序在指定区域中可见,但不尝试保持原始高宽比。可能会发生扭曲,应用程序可能会拉伸或压缩显示。</li>
  14204. * <li>StageScaleMode.SHOW_ALL -- 整个应用程序在指定区域中可见,且不发生扭曲,同时保持应用程序的原始高宽比。应用程序的可能会显示边框。</li>
  14205. * <li>StageScaleMode.NO_SCALE -- 整个应用程序的大小固定,因此,即使播放器窗口的大小更改,它也会保持不变。如果播放器窗口比内容小,则可能进行一些裁切。</li>
  14206. * <li>StageScaleMode.NO_BORDER -- 保持原始宽高比缩放应用程序内容,缩放后应用程序内容的较窄方向填满播放器视口,另一个方向的两侧可能会超出播放器视口而被裁切。</li>
  14207. * <li>StageScaleMode.FIXED_WIDTH -- 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,但只保持应用程序内容的原始宽度不变,高度可能会改变。</li>
  14208. * <li>StageScaleMode.FIXED_HEIGHT -- 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,但只保持应用程序内容的原始高度不变,宽度可能会改变。</li>
  14209. * </ul>
  14210. * @default egret.StageScaleMode.SHOW_ALL
  14211. */
  14212. scaleMode: string;
  14213. $orientation: string;
  14214. /**
  14215. * @language en_US
  14216. * Horizontal and vertical screen display screen, can only be set under the current Native in the configuration file. A egret.OrientationMode class that specifies which display mode to use. The following are valid values:<br/>
  14217. * <ul>
  14218. * <li>egret.OrientationMode.AUTO -- Always follow the direction of application display screen, always guaranteed by the look down.</li>
  14219. * <li>egret.OrientationMode.PORTRAIT -- Applications remain portrait mode, namely horizontal screen look, the screen from left to right.</li>
  14220. * <li>egret.OrientationMode.LANDSCAPE -- Applications remain horizontal screen mode, namely vertical screen, the screen from right to left.</li>
  14221. * <li>egret.OrientationMode.LANDSCAPE_FLIPPED -- Applications remain horizontal screen mode, namely vertical screen, the screen from left to right.</li>
  14222. * </ul>
  14223. * @platform Web
  14224. * @version 2.4
  14225. */
  14226. /**
  14227. * @language zh_CN
  14228. * 屏幕横竖屏显示方式,目前 Native 下只能在配置文件里设置。一个 egret.OrientationMode 类中指定要使用哪种显示方式。以下是有效值:<br/>
  14229. * <ul>
  14230. * <li>egret.OrientationMode.AUTO -- 应用始终跟随屏幕的方向显示,始终保证由上往下看。</li>
  14231. * <li>egret.OrientationMode.PORTRAIT -- 应用始终保持竖屏模式,即横屏看时,屏幕由左往右看。</li>
  14232. * <li>egret.OrientationMode.LANDSCAPE -- 应用始终保持横屏模式,即竖屏看时,屏幕显示由右往左。</li>
  14233. * <li>egret.OrientationMode.LANDSCAPE_FLIPPED -- 应用始终保持横屏模式,即竖屏看时,屏幕显示由左往右。</li>
  14234. * </ul>
  14235. * @platform Web
  14236. * @version 2.4
  14237. */
  14238. orientation: string;
  14239. /**
  14240. * @language en_US
  14241. * Draw texture zoom ratio
  14242. * @default 1
  14243. */
  14244. /**
  14245. * @language zh_CN
  14246. * 绘制纹理的缩放比率,默认值为1
  14247. * @default 1
  14248. */
  14249. textureScaleFactor: number;
  14250. $maxTouches: number;
  14251. /**
  14252. * @language en_US
  14253. * Set the number of screens can simultaneously touch. Above this amount will not be triggered in response.
  14254. * @default 99
  14255. */
  14256. /**
  14257. * @language zh_CN
  14258. * 设置屏幕同时可以触摸的数量。高于这个数量将不会被触发响应。
  14259. * @default 99
  14260. */
  14261. maxTouches: number;
  14262. private $dirtyRegionPolicy;
  14263. /**
  14264. * @language en_US
  14265. * Set dirty region policy
  14266. * One of the constants defined by egret.DirtyRegionPolicy
  14267. * @version Egret 2.5.5
  14268. * @platform Web,Native
  14269. */
  14270. /**
  14271. * @language zh_CN
  14272. * 设置脏矩形策略
  14273. * egret.DirtyRegionPolicy 定义的常量之一
  14274. * @version Egret 2.5.5
  14275. * @platform Web,Native
  14276. */
  14277. dirtyRegionPolicy: string;
  14278. /**
  14279. * @language en_US
  14280. * Set resolution size
  14281. * @param width width
  14282. * @param height height
  14283. * @version Egret 2.5.5
  14284. * @platform Web,Native
  14285. */
  14286. /**
  14287. * @language zh_CN
  14288. * 设置分辨率尺寸
  14289. * @param width 宽度
  14290. * @param height 高度
  14291. * @version Egret 2.5.5
  14292. * @platform Web,Native
  14293. */
  14294. setContentSize(width: number, height: number): void;
  14295. }
  14296. }
  14297. declare namespace egret {
  14298. /**
  14299. * @language en_US
  14300. * Logger is an entrance for the log processing namespace of the engine
  14301. * @version Egret 2.4
  14302. * @platform Web,Native
  14303. */
  14304. /**
  14305. * @language zh_CN
  14306. * Logger是引擎的日志处理模块入口
  14307. * @version Egret 2.4
  14308. * @platform Web,Native
  14309. */
  14310. class Logger {
  14311. /**
  14312. * @language en_US
  14313. * open all
  14314. * @version Egret 2.4
  14315. * @platform Web,Native
  14316. */
  14317. /**
  14318. * @language zh_CN
  14319. * 全开
  14320. * @version Egret 2.4
  14321. * @platform Web,Native
  14322. */
  14323. static ALL: string;
  14324. /**
  14325. * @language en_US
  14326. * level: DEBUG
  14327. * @version Egret 2.4
  14328. * @platform Web,Native
  14329. */
  14330. /**
  14331. * @language zh_CN
  14332. * 等级为 DEBUG
  14333. * @version Egret 2.4
  14334. * @platform Web,Native
  14335. */
  14336. static DEBUG: string;
  14337. /**
  14338. * @language en_US
  14339. * level: INFO
  14340. * @version Egret 2.4
  14341. * @platform Web,Native
  14342. */
  14343. /**
  14344. * @language zh_CN
  14345. * 等级为 INFO
  14346. * @version Egret 2.4
  14347. * @platform Web,Native
  14348. */
  14349. static INFO: string;
  14350. /**
  14351. * @language en_US
  14352. * level: WARN
  14353. * @version Egret 2.4
  14354. * @platform Web,Native
  14355. */
  14356. /**
  14357. * @language zh_CN
  14358. * 等级为 WARN
  14359. * @version Egret 2.4
  14360. * @platform Web,Native
  14361. */
  14362. static WARN: string;
  14363. /**
  14364. * @language en_US
  14365. * level: ERROR
  14366. * @version Egret 2.4
  14367. * @platform Web,Native
  14368. */
  14369. /**
  14370. * @language zh_CN
  14371. * 等级为 ERROR
  14372. * @version Egret 2.4
  14373. * @platform Web,Native
  14374. */
  14375. static ERROR: string;
  14376. /**
  14377. * @language en_US
  14378. * close all
  14379. * @version Egret 2.4
  14380. * @platform Web,Native
  14381. */
  14382. /**
  14383. * @language zh_CN
  14384. * 全关
  14385. * @version Egret 2.4
  14386. * @platform Web,Native
  14387. */
  14388. static OFF: string;
  14389. /**
  14390. * @language en_US
  14391. * Set the current need to open the log level. Grade level are: ALL <DEBUG <INFO <WARN <ERROR <OFF<br/>
  14392. * This feature is only in DEBUG mode to take effect. <br/>
  14393. * <Ul>
  14394. * <Li> Logger.ALL - all levels of log can be printed out. </ li>
  14395. * <Li> Logger.DEBUG - print debug, info, log, warn, error. </ li>
  14396. * <Li> Logger.INFO - print info, log, warn, error. </ li>
  14397. * <Li> Logger.WARN - can print warn, error. </ li>
  14398. * <Li> Logger.ERROR - You can print error. </ li>
  14399. * <Li> Logger.OFF - all closed. </ li>
  14400. * </ Ul>
  14401. *param LogType from this level to start printing.
  14402. * @version Egret 2.4
  14403. * @platform Web,Native
  14404. */
  14405. /**
  14406. * @language zh_CN
  14407. * 设置当前需要开启的log级别。级别等级分别为:ALL < DEBUG < INFO < WARN < ERROR < OFF<br/>
  14408. * 此功能只在 DEBUG 模式下才生效。<br/>
  14409. * <ul>
  14410. * <li>Logger.ALL -- 所有等级的log都可以打印出来。</li>
  14411. * <li>Logger.DEBUG -- 可以打印debug、info、log、warn、error。</li>
  14412. * <li>Logger.INFO -- 可以打印info、log、warn、error。</li>
  14413. * <li>Logger.WARN -- 可以打印warn、error。</li>
  14414. * <li>Logger.ERROR -- 可以打印error。</li>
  14415. * <li>Logger.OFF -- 全部关闭。</li>
  14416. * </ul>
  14417. * @param logType 从这个等级开始打印。
  14418. * @version Egret 2.4
  14419. * @platform Web,Native
  14420. */
  14421. static logLevel: string;
  14422. }
  14423. }
  14424. declare namespace egret {
  14425. /**
  14426. * @version Egret 2.4
  14427. * @platform Web,Native
  14428. */
  14429. class NumberUtils {
  14430. /**
  14431. * @language en_US
  14432. * Judge whether it is a numerical value
  14433. * @param value Parameter that needs to be judged
  14434. * @returns
  14435. * @version Egret 2.4
  14436. * @platform Web,Native
  14437. */
  14438. /**
  14439. * @language zh_CN
  14440. * 判断是否是数值
  14441. * @param value 需要判断的参数
  14442. * @returns
  14443. * @version Egret 2.4
  14444. * @platform Web,Native
  14445. */
  14446. static isNumber(value: any): boolean;
  14447. /**
  14448. * @language en_US
  14449. * Obtain the approximate sin value of the corresponding angle value
  14450. * @param value {number} Angle value
  14451. * @returns {number} sin value
  14452. * @version Egret 2.4
  14453. * @platform Web,Native
  14454. */
  14455. /**
  14456. * @language zh_CN
  14457. * 得到对应角度值的sin近似值
  14458. * @param value {number} 角度值
  14459. * @returns {number} sin值
  14460. * @version Egret 2.4
  14461. * @platform Web,Native
  14462. */
  14463. static sin(value: number): number;
  14464. /**
  14465. * @private
  14466. *
  14467. * @param value
  14468. * @returns
  14469. */
  14470. private static sinInt(value);
  14471. /**
  14472. * @language en_US
  14473. * Obtain the approximate cos value of the corresponding angle value
  14474. * @param value {number} Angle value
  14475. * @returns {number} cos value
  14476. * @version Egret 2.4
  14477. * @platform Web,Native
  14478. */
  14479. /**
  14480. * @language zh_CN
  14481. * 得到对应角度值的cos近似值
  14482. * @param value {number} 角度值
  14483. * @returns {number} cos值
  14484. * @version Egret 2.4
  14485. * @platform Web,Native
  14486. */
  14487. static cos(value: number): number;
  14488. /**
  14489. * @private
  14490. *
  14491. * @param value
  14492. * @returns
  14493. */
  14494. private static cosInt(value);
  14495. }
  14496. }
  14497. /**
  14498. * @private
  14499. */
  14500. declare let egret_sin_map: {};
  14501. /**
  14502. * @private
  14503. */
  14504. declare let egret_cos_map: {};
  14505. /**
  14506. * @private
  14507. */
  14508. declare let DEG_TO_RAD: number;
  14509. declare namespace egret {
  14510. /**
  14511. * @language en_US
  14512. * The Timer class is the interface to timers, which let you run code on a specified time sequence. Use the start()
  14513. * method to start a timer. Add an event listener for the timer event to set up code to be run on the timer interval.<br/>
  14514. * You can create Timer objects to run once or repeat at specified intervals to execute code on a schedule. Depending
  14515. * on the framerate or the runtime environment (available memory and other factors), the runtime may dispatchEvent events at
  14516. * slightly offset intervals.
  14517. * @see egret.TimerEvent
  14518. * @version Egret 2.4
  14519. * @platform Web,Native
  14520. * @includeExample egret/utils/Timer.ts
  14521. */
  14522. /**
  14523. * @language zh_CN
  14524. * Timer 类是计时器的接口,它使您能按指定的时间序列运行代码。
  14525. * 使用 start() 方法来启动计时器。为 timer 事件添加事件侦听器,以便将代码设置为按计时器间隔运行。
  14526. * 可以创建 Timer 对象以运行一次或按指定间隔重复运行,从而按计划执行代码。
  14527. * 根据 Egret 的帧速率或运行时环境(可用内存和其他因素),运行时调度事件的间隔可能稍有不同。
  14528. * @see egret.TimerEvent
  14529. * @version Egret 2.4
  14530. * @platform Web,Native
  14531. * @includeExample egret/utils/Timer.ts
  14532. */
  14533. class Timer extends EventDispatcher {
  14534. /**
  14535. * @language en_US
  14536. * Constructs a new Timer object with the specified delay and repeatCount states.
  14537. * @param delay The delay between timer events, in milliseconds. A delay lower than 20 milliseconds is not recommended.
  14538. * Timer frequency is limited to 60 frames per second, meaning a delay lower than 16.6 milliseconds causes runtime problems.
  14539. * @param repeatCount Specifies the number of repetitions. If zero, the timer repeats indefinitely.If nonzero,
  14540. * the timer runs the specified number of times and then stops.
  14541. * @version Egret 2.4
  14542. * @platform Web,Native
  14543. */
  14544. /**
  14545. * @language zh_CN
  14546. * 使用指定的 delay 和 repeatCount 状态构造新的 Timer 对象。
  14547. * @param delay 计时器事件间的延迟(以毫秒为单位)。建议 delay 不要低于 20 毫秒。计时器频率不得超过 60 帧/秒,这意味着低于 16.6 毫秒的延迟可导致出现运行时问题。
  14548. * @param repeatCount 指定重复次数。如果为零,则计时器将持续不断重复运行。如果不为 0,则将运行计时器,运行次数为指定的次数,然后停止。
  14549. * @version Egret 2.4
  14550. * @platform Web,Native
  14551. */
  14552. constructor(delay: number, repeatCount?: number);
  14553. /**
  14554. * @private
  14555. */
  14556. private _delay;
  14557. /**
  14558. * @language en_US
  14559. * The delay between timer events, in milliseconds. A delay lower than 20 milliseconds is not recommended.<br/>
  14560. * Note: Timer frequency is limited to 60 frames per second, meaning a delay lower than 16.6 milliseconds causes runtime problems.
  14561. * @version Egret 2.4
  14562. * @platform Web,Native
  14563. */
  14564. /**
  14565. * @language zh_CN
  14566. * 计时器事件间的延迟(以毫秒为单位)。如果在计时器正在运行时设置延迟间隔,则计时器将按相同的 repeatCount 迭代重新启动。<br/>
  14567. * 注意:建议 delay 不要低于 20 毫秒。计时器频率不得超过 60 帧/秒,这意味着低于 16.6 毫秒的延迟可导致出现运行时问题。
  14568. * @version Egret 2.4
  14569. * @platform Web,Native
  14570. */
  14571. delay: number;
  14572. /**
  14573. * @language en_US
  14574. * The total number of times the timer is set to run. If the repeat count is set to 0, the timer continues indefinitely,
  14575. * until the stop() method is invoked or the program stops. If the repeat count is nonzero, the timer runs the specified
  14576. * number of times. If repeatCount is set to a total that is the same or less then currentCount the timer stops and will not fire again.
  14577. * @version Egret 2.4
  14578. * @platform Web,Native
  14579. */
  14580. /**
  14581. * @language zh_CN
  14582. * 设置的计时器运行总次数。如果重复计数设置为 0,则计时器将持续不断运行,或直至调用了 stop() 方法或节目停止。
  14583. * 如果重复计数不为 0,则将运行计时器,运行次数为指定的次数。如果设置的 repeatCount 总数等于或小于 currentCount,则计时器将停止并且不会再次触发。
  14584. * @version Egret 2.4
  14585. * @platform Web,Native
  14586. */
  14587. repeatCount: number;
  14588. /**
  14589. * @private
  14590. */
  14591. private _currentCount;
  14592. /**
  14593. * @language en_US
  14594. * The total number of times the timer has fired since it started at zero. If the timer has been reset, only the fires since the reset are counted.
  14595. * @version Egret 2.4
  14596. * @platform Web,Native
  14597. */
  14598. /**
  14599. * @language zh_CN
  14600. * 计时器从 0 开始后触发的总次数。如果已重置了计时器,则只会计入重置后的触发次数。
  14601. * @version Egret 2.4
  14602. * @platform Web,Native
  14603. */
  14604. currentCount: number;
  14605. /**
  14606. * @private
  14607. */
  14608. private _running;
  14609. /**
  14610. * @language en_US
  14611. * The timer's current state; true if the timer is running, otherwise false.
  14612. * @version Egret 2.4
  14613. * @platform Web,Native
  14614. */
  14615. /**
  14616. * @language zh_CN
  14617. * 计时器的当前状态;如果计时器正在运行,则为 true,否则为 false。
  14618. * @version Egret 2.4
  14619. * @platform Web,Native
  14620. */
  14621. running: boolean;
  14622. /**
  14623. * @language en_US
  14624. * Stops the timer, if it is running, and sets the currentCount property back to 0, like the reset button of a stopwatch.
  14625. * Then, when start() is called, the timer instance runs for the specified number of repetitions, as set by the repeatCount value.
  14626. * @version Egret 2.4
  14627. * @platform Web,Native
  14628. */
  14629. /**
  14630. * @language zh_CN
  14631. * 如果计时器正在运行,则停止计时器,并将 currentCount 属性设回为 0,这类似于秒表的重置按钮。然后,在调用 start() 后,将运行计时器实例,运行次数为指定的重复次数(由 repeatCount 值设置)。
  14632. * @version Egret 2.4
  14633. * @platform Web,Native
  14634. */
  14635. reset(): void;
  14636. /**
  14637. * @language en_US
  14638. * Starts the timer, if it is not already running.
  14639. * @version Egret 2.4
  14640. * @platform Web,Native
  14641. */
  14642. /**
  14643. * @language zh_CN
  14644. * 如果计时器尚未运行,则启动计时器。
  14645. * @version Egret 2.4
  14646. * @platform Web,Native
  14647. */
  14648. start(): void;
  14649. /**
  14650. * @language en_US
  14651. * Stops the timer. When start() is called after stop(), the timer instance runs for the remaining number of
  14652. * repetitions, as set by the repeatCount property.
  14653. * @version Egret 2.4
  14654. * @platform Web,Native
  14655. */
  14656. /**
  14657. * @language zh_CN
  14658. * 停止计时器。如果在调用 stop() 后调用 start(),则将继续运行计时器实例,运行次数为剩余的 重复次数(由 repeatCount 属性设置)。
  14659. * @version Egret 2.4
  14660. * @platform Web,Native
  14661. */
  14662. stop(): void;
  14663. /**
  14664. * @private
  14665. */
  14666. private updateInterval;
  14667. /**
  14668. * @private
  14669. */
  14670. private lastCount;
  14671. /**
  14672. * @private
  14673. */
  14674. private lastTimeStamp;
  14675. /**
  14676. * @private
  14677. * Ticker以60FPS频率刷新此方法
  14678. */
  14679. $update(timeStamp: number): boolean;
  14680. }
  14681. }
  14682. declare namespace egret {
  14683. /**
  14684. * @language en_US
  14685. * The XMLNode class is the base class for all xml node.
  14686. * @version Egret 2.4
  14687. * @platform Web,Native
  14688. */
  14689. /**
  14690. * @language zh_CN
  14691. * XML节点基类
  14692. * @version Egret 2.4
  14693. * @platform Web,Native
  14694. */
  14695. interface XMLNode {
  14696. /**
  14697. * @language en_US
  14698. * a integer representing the type of the node, 1:XML,2:XMLAttribute,3:XMLText
  14699. * @version Egret 2.4
  14700. * @platform Web,Native
  14701. */
  14702. /**
  14703. * @language zh_CN
  14704. * 节点类型,1:XML,2:XMLAttribute,3:XMLText
  14705. * @version Egret 2.4
  14706. * @platform Web,Native
  14707. */
  14708. nodeType: number;
  14709. /**
  14710. * @language en_US
  14711. * the parent node of this xml node.
  14712. * @version Egret 2.4
  14713. * @platform Web,Native
  14714. */
  14715. /**
  14716. * @language zh_CN
  14717. * 节点所属的父级节点
  14718. * @version Egret 2.4
  14719. * @platform Web,Native
  14720. */
  14721. parent: XML;
  14722. }
  14723. /**
  14724. * @language en_US
  14725. * The XML class contains properties for working with XML objects.
  14726. * @version Egret 2.4
  14727. * @platform Web,Native
  14728. * @includeExample egret/utils/XML.ts
  14729. */
  14730. /**
  14731. * @language zh_CN
  14732. * XML 类包含用于处理 XML 对象的属性。
  14733. * @version Egret 2.4
  14734. * @platform Web,Native
  14735. * @includeExample egret/utils/XML.ts
  14736. */
  14737. interface XML extends XMLNode {
  14738. /**
  14739. * @language en_US
  14740. * the attributes of this xml node.
  14741. * @version Egret 2.4
  14742. * @platform Web,Native
  14743. */
  14744. /**
  14745. * @language zh_CN
  14746. * 当前节点上的属性列表
  14747. * @version Egret 2.4
  14748. * @platform Web,Native
  14749. */
  14750. attributes: any;
  14751. /**
  14752. * @language en_US
  14753. * the children of the xml node.
  14754. * @version Egret 2.4
  14755. * @platform Web,Native
  14756. */
  14757. /**
  14758. * @language zh_CN
  14759. * 当前节点的子节点列表
  14760. * @version Egret 2.4
  14761. * @platform Web,Native
  14762. */
  14763. children: XMLNode[];
  14764. /**
  14765. * @language en_US
  14766. * the full name of this xml node. For example,the name of <s:Button/> is "s:Button".
  14767. * @version Egret 2.4
  14768. * @platform Web,Native
  14769. */
  14770. /**
  14771. * @language zh_CN
  14772. * 节点完整名称。例如节点 <s:Button/> 的 name 为:"s:Button"
  14773. * @version Egret 2.4
  14774. * @platform Web,Native
  14775. */
  14776. name: string;
  14777. /**
  14778. * @language en_US
  14779. * thie namesapce prefix of this xml node.For example,the prefix of <s:Button/> is "s".
  14780. * @version Egret 2.4
  14781. * @platform Web,Native
  14782. */
  14783. /**
  14784. * @language zh_CN
  14785. * 节点的命名空间前缀。例如节点 <s:Button/> 的 prefix 为:s
  14786. * @version Egret 2.4
  14787. * @platform Web,Native
  14788. */
  14789. prefix: string;
  14790. /**
  14791. * @language en_US
  14792. * the local name of this xml node. For example,the local name of <s:Button/> is "Button".
  14793. * @version Egret 2.4
  14794. * @platform Web,Native
  14795. */
  14796. /**
  14797. * @language zh_CN
  14798. * 节点的本地名称。例如节点 <s:Button/> 的 localName 为:Button
  14799. * @version Egret 2.4
  14800. * @platform Web,Native
  14801. */
  14802. localName: string;
  14803. /**
  14804. * @language en_US
  14805. * the namesapce uri of this xml node.For example,the namespace uri of <s:Skin xmlns:s="http://ns.egret.com/eui"/> is "http://ns.egret.com/eui".
  14806. * @version Egret 2.4
  14807. * @platform Web,Native
  14808. */
  14809. /**
  14810. * @language zh_CN
  14811. * 节点的命名空间地址。例如节点 <s:Skin xmlns:s="http://ns.egret.com/eui"/> 的 namespace 为: http://ns.egret.com/eui
  14812. * @version Egret 2.4
  14813. * @platform Web,Native
  14814. */
  14815. namespace: string;
  14816. }
  14817. /**
  14818. * @language en_US
  14819. * The XMLText class represents a string node in the XML.
  14820. * @version Egret 2.4
  14821. * @platform Web,Native
  14822. */
  14823. /**
  14824. * @language zh_CN
  14825. * XMLText 类表示在XML中的文本节点
  14826. * @version Egret 2.4
  14827. * @platform Web,Native
  14828. */
  14829. interface XMLText extends XMLNode {
  14830. /**
  14831. * @language en_US
  14832. * the text content
  14833. * @version Egret 2.4
  14834. * @platform Web,Native
  14835. */
  14836. /**
  14837. * @language zh_CN
  14838. * 文本内容
  14839. * @version Egret 2.4
  14840. * @platform Web,Native
  14841. */
  14842. text: string;
  14843. }
  14844. /**
  14845. * @language en_US
  14846. * The XML class contains properties for working with XML objects.
  14847. * @version Egret 2.4
  14848. * @platform Web,Native
  14849. */
  14850. /**
  14851. * @language zh_CN
  14852. * XML 类包含用于处理 XML 对象的属性。
  14853. * @version Egret 2.4
  14854. * @platform Web,Native
  14855. */
  14856. let XML: {
  14857. /**
  14858. * @language en_US
  14859. * parses a text to XML instance.
  14860. * @param text the text to be parsed.
  14861. */
  14862. /**
  14863. * @language zh_CN
  14864. * 解析字符串为XML对象
  14865. * @param text 要解析的XML对象。
  14866. */
  14867. parse(text: string): XML;
  14868. };
  14869. }
  14870. declare namespace egret {
  14871. /**
  14872. * @private
  14873. */
  14874. let $callLaterFunctionList: any[];
  14875. /**
  14876. * @private
  14877. */
  14878. let $callLaterThisList: any[];
  14879. /**
  14880. * @private
  14881. */
  14882. let $callLaterArgsList: any[];
  14883. /**
  14884. * @language en_US
  14885. * Delay the function to run unless screen is redrawn.
  14886. * @param method {Function} The function to be delayed to run
  14887. * @param thisObject {any} this reference of callback function
  14888. * @param ...args {any} Function parameter list
  14889. * @version Egret 2.4
  14890. * @platform Web,Native
  14891. * @includeExample egret/utils/callLater.ts
  14892. */
  14893. /**
  14894. * @language zh_CN
  14895. * 延迟函数到屏幕重绘前执行。
  14896. * @param method {Function} 要延迟执行的函数
  14897. * @param thisObject {any} 回调函数的this引用
  14898. * @param ...args {any} 函数参数列表
  14899. * @version Egret 2.4
  14900. * @platform Web,Native
  14901. * @includeExample egret/utils/callLater.ts
  14902. */
  14903. function callLater(method: Function, thisObject: any, ...args: any[]): void;
  14904. /**
  14905. * @private
  14906. */
  14907. let $callAsyncFunctionList: any[];
  14908. /**
  14909. * @private
  14910. */
  14911. let $callAsyncThisList: any[];
  14912. /**
  14913. * @private
  14914. */
  14915. let $callAsyncArgsList: any[];
  14916. /**
  14917. * 异步调用函数
  14918. * @param method {Function} 要异步调用的函数
  14919. * @param thisObject {any} 函数的this引用
  14920. * @param ...args {any} 函数参数列表
  14921. * @private
  14922. */
  14923. function $callAsync(method: Function, thisObject: any, ...args: any[]): void;
  14924. }
  14925. declare namespace egret {
  14926. /**
  14927. * @language en_US
  14928. * Call setter properties of the parent class, instead of the other writing languages, such as super.alpha = 1;
  14929. * @param currentClass The current class class name, non-string
  14930. * @param thisObj The current object. Always this
  14931. * @param type Setter property names need to call
  14932. * @param values Value passed to the parent class
  14933. *
  14934. * @exmaple egret.superSetter(egret.Sprite, this, "alpha", 1);
  14935. */
  14936. /**
  14937. * @language zh_CN
  14938. * 调用父类的setter属性,代替其他语言的写法,如 super.alpha = 1;
  14939. * @param thisObj 当前对象。永远都this
  14940. * @param currentClass 当前 class 类名,非字符串
  14941. * @param type 需要调用的setter属性名称
  14942. * @param values 传给父类的值
  14943. *
  14944. * @exmaple egret.superSetter(egret.Sprite, this, "alpha", 1);
  14945. */
  14946. function superSetter(currentClass: any, thisObj: any, type: string, ...values: any[]): any;
  14947. /**
  14948. * @language en_US
  14949. * Get getter property value of the parent class. Instead of writing in other languages, such as super.alpha;
  14950. * @param currentClass The current class class name, non-string
  14951. * @param thisObj The current object. Always this
  14952. * @param type Setter property names need to call
  14953. * @returns {any} The value returned by the parent
  14954. *
  14955. * @exmaple egret.superGetter(egret.Sprite, this, "alpha");
  14956. */
  14957. /**
  14958. * @language zh_CN
  14959. * 获取父类的getter属性值。代替其他语言的写法,如 super.alpha;
  14960. * @param thisObj 当前对象。永远都this
  14961. * @param currentClass 当前 class 类名,非字符串
  14962. * @param type 需要调用的setter属性名称
  14963. * @returns {any} 父类返回的值
  14964. *
  14965. * @exmaple egret.superGetter(egret.Sprite, this, "alpha");
  14966. */
  14967. function superGetter(currentClass: any, thisObj: any, type: string): any;
  14968. }
  14969. declare namespace egret {
  14970. /**
  14971. * @language en_US
  14972. * Returns a reference to the class object of the class specified by the name parameter.
  14973. * @param name The name of a class.
  14974. * @version Egret 2.4
  14975. * @platform Web,Native
  14976. * @includeExample egret/utils/getDefinitionByName.ts
  14977. */
  14978. /**
  14979. * @language zh_CN
  14980. * 返回 name 参数指定的类的类对象引用。
  14981. * @param name 类的名称。
  14982. * @version Egret 2.4
  14983. * @platform Web,Native
  14984. * @includeExample egret/utils/getDefinitionByName.ts
  14985. */
  14986. function getDefinitionByName(name: string): any;
  14987. }
  14988. declare let __global: any;
  14989. declare namespace egret {
  14990. /**
  14991. * @language en_US
  14992. * Get browser or Runtime parameters, returns an empty string if not set
  14993. * Get the url parameter corresponds to the browser, access to the corresponding parameter in the Runtime setOption
  14994. * @method egret.getOption
  14995. * @param key {string} Parameters key
  14996. * @version Egret 2.4
  14997. * @platform Web,Native
  14998. */
  14999. /**
  15000. * @language zh_CN
  15001. * 获取浏览器或者Runtime参数,如果没有设置返回空字符串
  15002. * 在浏览器中相当于获取url中参数,在Runtime获取对应setOption参数
  15003. * @method egret.getOption
  15004. * @param key {string} 参数key
  15005. * @version Egret 2.4
  15006. * @platform Web,Native
  15007. */
  15008. let getOption: (key: string) => string;
  15009. }
  15010. declare namespace egret {
  15011. /**
  15012. * @language en_US
  15013. * Return the fully qualified class name of an object
  15014. * @param value The object for which a fully qualified class name is desired. Any JavaScript value may be passed to
  15015. * this method including all available JavaScript types, object instances, primitive types such as number, and class objects.
  15016. * @returns A string containing the fully qualified class name.
  15017. * @example
  15018. * <pre>
  15019. * egret.getQualifiedClassName(egret.DisplayObject) //return "egret.DisplayObject"
  15020. * </pre>
  15021. * @version Egret 2.4
  15022. * @platform Web,Native
  15023. * @includeExample egret/utils/getQualifiedClassName.ts
  15024. */
  15025. /**
  15026. * @language zh_CN
  15027. * 返回对象的完全限定类名。
  15028. * @param value 需要完全限定类名称的对象,可以将任何 JavaScript 值传递给此方法,包括所有可用的 JavaScript 类型、对象实例、原始类型
  15029. * (如number)和类对象
  15030. * @returns 包含完全限定类名称的字符串。
  15031. * @example
  15032. * <pre>
  15033. * egret.getQualifiedClassName(egret.DisplayObject) //返回 "egret.DisplayObject"
  15034. * </pre>
  15035. * @version Egret 2.4
  15036. * @platform Web,Native
  15037. * @includeExample egret/utils/getQualifiedClassName.ts
  15038. */
  15039. function getQualifiedClassName(value: any): string;
  15040. }
  15041. declare namespace egret {
  15042. /** @language en_US
  15043. * Returns the fully qualified class name of the base class of the object specified by the value parameter.
  15044. * @param value The object for which a parent class is desired. Any JavaScript value may be passed to this method including
  15045. * all available JavaScript types, object instances, primitive types such as number, and class objects.
  15046. * @returns A fully qualified base class name, or null if none exists.
  15047. * @example
  15048. * <pre>
  15049. * egret.getQualifiedSuperclassName(egret.Bitmap) //return "egret.DisplayObject"
  15050. * </pre>
  15051. * @version Egret 2.4
  15052. * @platform Web,Native
  15053. * @includeExample egret/utils/getQualifiedSuperclassName.ts
  15054. */
  15055. /**
  15056. * @language zh_CN
  15057. * 返回 value 参数指定的对象的基类的完全限定类名。
  15058. * @param value 需要取得父类的对象,可以将任何 JavaScript 值传递给此方法,包括所有可用的 JavaScript 类型、对象实例、原始类型(如number)和类对象
  15059. * @returns 完全限定的基类名称,或 null(如果不存在基类名称)。
  15060. * @example
  15061. * <pre>
  15062. * egret.getQualifiedSuperclassName(egret.Sprite) //返回 "egret.DisplayObject"
  15063. * </pre>
  15064. * @version Egret 2.4
  15065. * @platform Web,Native
  15066. * @includeExample egret/utils/getQualifiedSuperclassName.ts
  15067. */
  15068. function getQualifiedSuperclassName(value: any): string;
  15069. }
  15070. declare namespace egret {
  15071. /**
  15072. * @language en_US
  15073. * Used to compute relative time.this method returns the number of milliseconds since the Egret framework was initialized
  15074. * @returns The number of milliseconds since the Egret framework was initialized
  15075. * @version Egret 2.4
  15076. * @platform Web,Native
  15077. * @includeExample egret/utils/getTimer.ts
  15078. */
  15079. /**
  15080. * @language zh_CN
  15081. * 用于计算相对时间。此方法返回自启动 Egret 框架以来经过的毫秒数。
  15082. * @returns 启动 Egret 框架以来经过的毫秒数。
  15083. * @version Egret 2.4
  15084. * @platform Web,Native
  15085. * @includeExample egret/utils/getTimer.ts
  15086. */
  15087. function getTimer(): number;
  15088. }
  15089. declare namespace egret {
  15090. /**
  15091. * @language en_US
  15092. * Check whether a public definition exists in the specified application domain. The definition can be that of a class, a naming space or a function.
  15093. * @param name {string} Name of the definition.
  15094. * @returns {boolean} Whether the public definition exists
  15095. * @example
  15096. * egret.hasDefinition("egret.DisplayObject") //return true
  15097. * @version Egret 2.4
  15098. * @platform Web,Native
  15099. * @includeExample egret/utils/hasDefinition.ts
  15100. */
  15101. /**
  15102. * @language zh_CN
  15103. * 检查指定的应用程序域之内是否存在一个公共定义。该定义可以是一个类、一个命名空间或一个函数的定义。
  15104. * @param name {string} 定义的名称。
  15105. * @returns {boolean} 公共定义是否存在
  15106. * @example
  15107. * egret.hasDefinition("egret.DisplayObject") //返回 true
  15108. * @version Egret 2.4
  15109. * @platform Web,Native
  15110. * @includeExample egret/utils/hasDefinition.ts
  15111. */
  15112. function hasDefinition(name: string): boolean;
  15113. }
  15114. declare namespace egret {
  15115. /**
  15116. * @language en_US
  15117. * Indicates whether an object is a instance of the class or interface specified as the parameter.This method has better performance
  15118. * compared width the instanceOf operator,and it can indicate whether an object is a instance of the specific interface.
  15119. * @param instance the instance to be checked.
  15120. * @param typeName the string value representing a specific class or interface.
  15121. * @returns A value of true if the object is a instance of the class or interface specified as the parameter.
  15122. * @example
  15123. * <pre>
  15124. * let instance = new egret.Sprite();
  15125. * egret.log(egret.is(instance,"egret.Sprite")) //true
  15126. * egret.log(egret.is(instance,"egret.DisplayObjectContainer")) //true
  15127. * egret.log(egret.is(instance,"egret.Bitmap")) //false
  15128. * </pre>
  15129. * @see egret.registerClass()
  15130. * @version Egret 2.4
  15131. * @platform Web,Native
  15132. */
  15133. /**
  15134. * @language zh_CN
  15135. * 检查指定对象是否为 Egret 框架内指定接口或类或其子类的实例。此方法与使用 instanceOf 关键字相比具有更高的性能,并且能判断接口的实现。
  15136. * @param instance 要判断的实例。
  15137. * @param typeName 类或接口的完全名称.
  15138. * @returns 返回true表示当前对象是指定类或接口的实例。
  15139. * @example
  15140. * <pre>
  15141. * let instance = new egret.Sprite();
  15142. * egret.log(egret.is(instance,"egret.Sprite")) //true
  15143. * egret.log(egret.is(instance,"egret.DisplayObjectContainer")) //true
  15144. * egret.log(egret.is(instance,"egret.Bitmap")) //false
  15145. * </pre>
  15146. * @see egret.registerClass()
  15147. * @version Egret 2.4
  15148. * @platform Web,Native
  15149. */
  15150. function is(instance: any, typeName: string): boolean;
  15151. }
  15152. declare namespace egret {
  15153. /**
  15154. * @language en_US
  15155. * Register and start a timer,which will notify the callback method at a rate of 60 FPS ,and pass the current time stamp as parameters.<br/>
  15156. * Note: After the registration,it will notify the callback method continuously,you can call the stopTick () method to stop it.
  15157. * @param callBack the call back method. the timeStamp parameter of this method represents the number of milliseconds
  15158. * since the Egret framework was initialized. If the return value of this method is true, it will force Egret runtime
  15159. * to render after processing of this method completes.
  15160. * @param thisObject the call back method's "this"
  15161. * @version Egret 2.4
  15162. * @platform Web,Native
  15163. */
  15164. /**
  15165. * @language zh_CN
  15166. * 注册并启动一个计时器,通常会以60FPS的速率触发回调方法,并传入当前时间戳。注意:注册后将会持续触发回调方法,若要停止回调,需要手动调用stopTick()方法。
  15167. * @param callBack 要执行的回调方法。参数 timeStamp 表示从启动Egret框架开始经过的时间(毫秒)。
  15168. * 若回调方法返回值为true,其作用与TimerEvent.updateAfterEvent()类似,将会忽略帧频限制,在此方法处理完成后立即重绘屏幕。
  15169. * @param thisObject 回调方法的this对象引用。
  15170. * @version Egret 2.4
  15171. * @platform Web,Native
  15172. */
  15173. function startTick(callBack: (timeStamp: number) => boolean, thisObject: any): void;
  15174. }
  15175. declare namespace egret {
  15176. /**
  15177. * @language en_US
  15178. * Stops the timer started by the egret.startTick() method.
  15179. * @param callBack the call back method. the timeStamp parameter of this method represents the number of milliseconds
  15180. * since the Egret framework was initialized. If the return value of this method is true, it will force Egret runtime
  15181. * to render after processing of this method completes.
  15182. * @param thisObject the call back method's "this"
  15183. * @version Egret 2.4
  15184. * @platform Web,Native
  15185. */
  15186. /**
  15187. * @language zh_CN
  15188. * 停止之前用 startTick() 方法启动的计时器。
  15189. * @param callBack 要执行的回调方法。参数 timeStamp 表示从启动Egret框架开始经过的时间(毫秒)。
  15190. * 若回调方法返回值为true,其作用与TimerEvent.updateAfterEvent()类似,将会忽略帧频限制,在此方法处理完成后立即重绘屏幕。
  15191. * @param thisObject 回调方法的this对象引用。
  15192. * @version Egret 2.4
  15193. * @platform Web,Native
  15194. */
  15195. function stopTick(callBack: (timeStamp: number) => boolean, thisObject: any): void;
  15196. }
  15197. declare namespace egret {
  15198. /**
  15199. * @language en_US
  15200. * Transfer number to color character string
  15201. * @param value {number} color value ,such as 0xffffff
  15202. * @returns {string} Color character string, for example, #ffffff.
  15203. * @version Egret 2.4
  15204. * @platform Web,Native
  15205. * @includeExample egret/utils/toColorString.ts
  15206. */
  15207. /**
  15208. * @language zh_CN
  15209. * 转换数字为颜色字符串
  15210. * @param value {number} 颜色值,例如 0xffffff
  15211. * @returns {string} 颜色字符串,例如"#ffffff"。
  15212. * @version Egret 2.4
  15213. * @platform Web,Native
  15214. * @includeExample egret/utils/toColorString.ts
  15215. */
  15216. function toColorString(value: number): string;
  15217. }
  15218. /**
  15219. * @private
  15220. */
  15221. interface PlayerOption {
  15222. /**
  15223. * 入口类完整类名
  15224. */
  15225. entryClassName?: string;
  15226. /**
  15227. * 默认帧率
  15228. */
  15229. frameRate?: number;
  15230. /**
  15231. * 屏幕适配模式
  15232. */
  15233. scaleMode?: string;
  15234. /**
  15235. * 初始内容宽度
  15236. */
  15237. contentWidth?: number;
  15238. /**
  15239. * 初始内容高度
  15240. */
  15241. contentHeight?: number;
  15242. /**
  15243. * 屏幕方向
  15244. */
  15245. orientation?: string;
  15246. /**
  15247. * 是否显示重绘区域
  15248. */
  15249. showPaintRect?: boolean;
  15250. /**
  15251. * 显示FPS
  15252. */
  15253. showFPS?: boolean;
  15254. /**
  15255. *
  15256. */
  15257. fpsStyles?: Object;
  15258. /**
  15259. * 显示日志
  15260. */
  15261. showLog?: boolean;
  15262. /**
  15263. * 过滤日志的正则表达式
  15264. */
  15265. logFilter?: string;
  15266. /**
  15267. *
  15268. */
  15269. maxTouches?: number;
  15270. /**
  15271. *
  15272. */
  15273. textureScaleFactor?: number;
  15274. }