@next2d/display 1.18.11 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/package.json +17 -28
  2. package/src/BitmapData/service/BitmapDataCanvasToBufferService.d.ts +10 -0
  3. package/src/BitmapData/service/BitmapDataCanvasToBufferService.js +22 -0
  4. package/src/BitmapData/service/BitmapDataImageToBufferService.d.ts +10 -0
  5. package/src/BitmapData/service/BitmapDataImageToBufferService.js +21 -0
  6. package/src/BitmapData.d.ts +71 -0
  7. package/src/BitmapData.js +133 -0
  8. package/{dist → src}/BlendMode.d.ts +4 -50
  9. package/{dist → src}/BlendMode.js +4 -58
  10. package/src/DisplayObject/service/DisplayObjectApplyChangesService.d.ts +11 -0
  11. package/src/DisplayObject/service/DisplayObjectApplyChangesService.js +16 -0
  12. package/src/DisplayObject/service/DisplayObjectBaseBuildService.d.ts +16 -0
  13. package/src/DisplayObject/service/DisplayObjectBaseBuildService.js +31 -0
  14. package/src/DisplayObject/service/DisplayObjectBlendToNumberService.d.ts +11 -0
  15. package/src/DisplayObject/service/DisplayObjectBlendToNumberService.js +45 -0
  16. package/src/DisplayObject/service/DisplayObjectBuildFilterService.d.ts +12 -0
  17. package/src/DisplayObject/service/DisplayObjectBuildFilterService.js +53 -0
  18. package/src/DisplayObject/service/DisplayObjectCalcBoundsMatrixService.d.ts +14 -0
  19. package/src/DisplayObject/service/DisplayObjectCalcBoundsMatrixService.js +31 -0
  20. package/src/DisplayObject/service/DisplayObjectDispatchAddedEventService.d.ts +11 -0
  21. package/src/DisplayObject/service/DisplayObjectDispatchAddedEventService.js +19 -0
  22. package/src/DisplayObject/service/DisplayObjectDispatchAddedToStageEventService.d.ts +11 -0
  23. package/src/DisplayObject/service/DisplayObjectDispatchAddedToStageEventService.js +21 -0
  24. package/src/DisplayObject/service/DisplayObjectDispatchRemovedEventService.d.ts +11 -0
  25. package/src/DisplayObject/service/DisplayObjectDispatchRemovedEventService.js +19 -0
  26. package/src/DisplayObject/service/DisplayObjectDispatchRemovedToStageEventService.d.ts +11 -0
  27. package/src/DisplayObject/service/DisplayObjectDispatchRemovedToStageEventService.js +27 -0
  28. package/src/DisplayObject/service/DisplayObjectGenerateHashService.d.ts +10 -0
  29. package/src/DisplayObject/service/DisplayObjectGenerateHashService.js +24 -0
  30. package/src/DisplayObject/service/DisplayObjectGetPlaceObjectService.d.ts +12 -0
  31. package/src/DisplayObject/service/DisplayObjectGetPlaceObjectService.js +41 -0
  32. package/src/DisplayObject/service/DisplayObjectGlobalToLocalService.d.ts +13 -0
  33. package/src/DisplayObject/service/DisplayObjectGlobalToLocalService.js +18 -0
  34. package/src/DisplayObject/service/DisplayObjectLocalToGlobalService.d.ts +13 -0
  35. package/src/DisplayObject/service/DisplayObjectLocalToGlobalService.js +17 -0
  36. package/src/DisplayObject/service/DisplayObjectRemoveService.d.ts +11 -0
  37. package/src/DisplayObject/service/DisplayObjectRemoveService.js +16 -0
  38. package/src/DisplayObject/usecase/DisplayObjectConcatenatedMatrixUseCase.d.ts +12 -0
  39. package/src/DisplayObject/usecase/DisplayObjectConcatenatedMatrixUseCase.js +25 -0
  40. package/src/DisplayObject/usecase/DisplayObjectGetAlphaUseCase.d.ts +11 -0
  41. package/src/DisplayObject/usecase/DisplayObjectGetAlphaUseCase.js +24 -0
  42. package/src/DisplayObject/usecase/DisplayObjectGetBlendModeUseCase.d.ts +12 -0
  43. package/src/DisplayObject/usecase/DisplayObjectGetBlendModeUseCase.js +19 -0
  44. package/src/DisplayObject/usecase/DisplayObjectGetBoundsUseCase.d.ts +13 -0
  45. package/src/DisplayObject/usecase/DisplayObjectGetBoundsUseCase.js +37 -0
  46. package/src/DisplayObject/usecase/DisplayObjectGetCalcBoundsUseCase.d.ts +11 -0
  47. package/src/DisplayObject/usecase/DisplayObjectGetCalcBoundsUseCase.js +28 -0
  48. package/src/DisplayObject/usecase/DisplayObjectGetColorTransformUseCase.d.ts +12 -0
  49. package/src/DisplayObject/usecase/DisplayObjectGetColorTransformUseCase.js +17 -0
  50. package/src/DisplayObject/usecase/DisplayObjectGetFiltersUseCase.d.ts +12 -0
  51. package/src/DisplayObject/usecase/DisplayObjectGetFiltersUseCase.js +25 -0
  52. package/src/DisplayObject/usecase/DisplayObjectGetHeightUseCase.d.ts +11 -0
  53. package/src/DisplayObject/usecase/DisplayObjectGetHeightUseCase.js +24 -0
  54. package/src/DisplayObject/usecase/DisplayObjectGetMatrixUseCase.d.ts +12 -0
  55. package/src/DisplayObject/usecase/DisplayObjectGetMatrixUseCase.js +17 -0
  56. package/src/DisplayObject/usecase/DisplayObjectGetRawBoundsUseCase.d.ts +11 -0
  57. package/src/DisplayObject/usecase/DisplayObjectGetRawBoundsUseCase.js +28 -0
  58. package/src/DisplayObject/usecase/DisplayObjectGetRawColorTransformUseCase.d.ts +11 -0
  59. package/src/DisplayObject/usecase/DisplayObjectGetRawColorTransformUseCase.js +25 -0
  60. package/src/DisplayObject/usecase/DisplayObjectGetRawMatrixUseCase.d.ts +12 -0
  61. package/src/DisplayObject/usecase/DisplayObjectGetRawMatrixUseCase.js +26 -0
  62. package/src/DisplayObject/usecase/DisplayObjectGetRotationUseCase.d.ts +11 -0
  63. package/src/DisplayObject/usecase/DisplayObjectGetRotationUseCase.js +23 -0
  64. package/src/DisplayObject/usecase/DisplayObjectGetScaleXUseCase.d.ts +11 -0
  65. package/src/DisplayObject/usecase/DisplayObjectGetScaleXUseCase.js +29 -0
  66. package/src/DisplayObject/usecase/DisplayObjectGetScaleYUseCase.d.ts +11 -0
  67. package/src/DisplayObject/usecase/DisplayObjectGetScaleYUseCase.js +29 -0
  68. package/src/DisplayObject/usecase/DisplayObjectGetWidthUseCase.d.ts +11 -0
  69. package/src/DisplayObject/usecase/DisplayObjectGetWidthUseCase.js +24 -0
  70. package/src/DisplayObject/usecase/DisplayObjectGetXUseCase.d.ts +11 -0
  71. package/src/DisplayObject/usecase/DisplayObjectGetXUseCase.js +16 -0
  72. package/src/DisplayObject/usecase/DisplayObjectGetYUseCase.d.ts +11 -0
  73. package/src/DisplayObject/usecase/DisplayObjectGetYUseCase.js +16 -0
  74. package/src/DisplayObject/usecase/DisplayObjectHitTestObjectUseCase.d.ts +10 -0
  75. package/src/DisplayObject/usecase/DisplayObjectHitTestObjectUseCase.js +35 -0
  76. package/src/DisplayObject/usecase/DisplayObjectHitTestPointUseCase.d.ts +14 -0
  77. package/src/DisplayObject/usecase/DisplayObjectHitTestPointUseCase.js +69 -0
  78. package/src/DisplayObject/usecase/DisplayObjectIsMaskReflectedInDisplayUseCase.d.ts +16 -0
  79. package/src/DisplayObject/usecase/DisplayObjectIsMaskReflectedInDisplayUseCase.js +59 -0
  80. package/src/DisplayObject/usecase/DisplayObjectSetAlphaUseCase.d.ts +12 -0
  81. package/src/DisplayObject/usecase/DisplayObjectSetAlphaUseCase.js +32 -0
  82. package/src/DisplayObject/usecase/DisplayObjectSetBlendModeUseCase.d.ts +13 -0
  83. package/src/DisplayObject/usecase/DisplayObjectSetBlendModeUseCase.js +18 -0
  84. package/src/DisplayObject/usecase/DisplayObjectSetFiltersUseCase.d.ts +13 -0
  85. package/src/DisplayObject/usecase/DisplayObjectSetFiltersUseCase.js +15 -0
  86. package/src/DisplayObject/usecase/DisplayObjectSetHeightUseCase.d.ts +12 -0
  87. package/src/DisplayObject/usecase/DisplayObjectSetHeightUseCase.js +30 -0
  88. package/src/DisplayObject/usecase/DisplayObjectSetRotationUseCase.d.ts +12 -0
  89. package/src/DisplayObject/usecase/DisplayObjectSetRotationUseCase.js +63 -0
  90. package/src/DisplayObject/usecase/DisplayObjectSetScaleXUseCase.d.ts +12 -0
  91. package/src/DisplayObject/usecase/DisplayObjectSetScaleXUseCase.js +48 -0
  92. package/src/DisplayObject/usecase/DisplayObjectSetScaleYUseCase.d.ts +12 -0
  93. package/src/DisplayObject/usecase/DisplayObjectSetScaleYUseCase.js +48 -0
  94. package/src/DisplayObject/usecase/DisplayObjectSetWidthUseCase.d.ts +12 -0
  95. package/src/DisplayObject/usecase/DisplayObjectSetWidthUseCase.js +30 -0
  96. package/src/DisplayObject/usecase/DisplayObjectSetXUseCase.d.ts +12 -0
  97. package/src/DisplayObject/usecase/DisplayObjectSetXUseCase.js +27 -0
  98. package/src/DisplayObject/usecase/DisplayObjectSetYUseCase.d.ts +12 -0
  99. package/src/DisplayObject/usecase/DisplayObjectSetYUseCase.js +27 -0
  100. package/src/DisplayObject.d.ts +706 -0
  101. package/src/DisplayObject.js +1094 -0
  102. package/src/DisplayObjectContainer/service/DisplayObjectContainerAddedToStageService.d.ts +11 -0
  103. package/src/DisplayObjectContainer/service/DisplayObjectContainerAddedToStageService.js +24 -0
  104. package/src/DisplayObjectContainer/service/DisplayObjectContainerAssignStageAndRootService.d.ts +11 -0
  105. package/src/DisplayObjectContainer/service/DisplayObjectContainerAssignStageAndRootService.js +26 -0
  106. package/src/DisplayObjectContainer/service/DisplayObjectContainerContainsService.d.ts +13 -0
  107. package/src/DisplayObjectContainer/service/DisplayObjectContainerContainsService.js +32 -0
  108. package/src/DisplayObjectContainer/service/DisplayObjectContainerGetChildAtService.d.ts +13 -0
  109. package/src/DisplayObjectContainer/service/DisplayObjectContainerGetChildAtService.js +14 -0
  110. package/src/DisplayObjectContainer/service/DisplayObjectContainerGetChildByNameService.d.ts +13 -0
  111. package/src/DisplayObjectContainer/service/DisplayObjectContainerGetChildByNameService.js +24 -0
  112. package/src/DisplayObjectContainer/service/DisplayObjectContainerRemovedToStageService.d.ts +12 -0
  113. package/src/DisplayObjectContainer/service/DisplayObjectContainerRemovedToStageService.js +24 -0
  114. package/src/DisplayObjectContainer/service/DisplayObjectContainerUnAssignStageAndRootService.d.ts +11 -0
  115. package/src/DisplayObjectContainer/service/DisplayObjectContainerUnAssignStageAndRootService.js +29 -0
  116. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerAddChildUseCase.d.ts +13 -0
  117. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerAddChildUseCase.js +53 -0
  118. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerAdvanceFrameUseCase.d.ts +11 -0
  119. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerAdvanceFrameUseCase.js +39 -0
  120. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerCalcBoundsMatrixUseCase.d.ts +11 -0
  121. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerCalcBoundsMatrixUseCase.js +62 -0
  122. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateClipQueueUseCase.d.ts +13 -0
  123. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateClipQueueUseCase.js +49 -0
  124. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateRenderQueueUseCase.d.ts +18 -0
  125. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateRenderQueueUseCase.js +163 -0
  126. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerMouseHitUseCase.d.ts +17 -0
  127. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerMouseHitUseCase.js +206 -0
  128. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerPrepareUseCase.d.ts +11 -0
  129. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerPrepareUseCase.js +32 -0
  130. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRawBoundsMatrixUseCase.d.ts +12 -0
  131. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRawBoundsMatrixUseCase.js +62 -0
  132. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildAtUseCase.d.ts +12 -0
  133. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildAtUseCase.js +19 -0
  134. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildUseCase.d.ts +13 -0
  135. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildUseCase.js +66 -0
  136. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildrenUseCase.d.ts +12 -0
  137. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildrenUseCase.js +25 -0
  138. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSetChildIndexUseCase.d.ts +14 -0
  139. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSetChildIndexUseCase.js +22 -0
  140. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSwapChildrenAtUseCase.d.ts +13 -0
  141. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSwapChildrenAtUseCase.js +23 -0
  142. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSwapChildrenUseCase.d.ts +14 -0
  143. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSwapChildrenUseCase.js +23 -0
  144. package/src/DisplayObjectContainer.d.ts +229 -0
  145. package/src/DisplayObjectContainer.js +317 -0
  146. package/src/DisplayObjectUtil.d.ts +288 -0
  147. package/src/DisplayObjectUtil.js +465 -0
  148. package/src/FrameLabel.d.ts +45 -0
  149. package/src/FrameLabel.js +59 -0
  150. package/src/Graphics/service/GraphicsCalcFillBoundsService.d.ts +13 -0
  151. package/src/Graphics/service/GraphicsCalcFillBoundsService.js +17 -0
  152. package/src/Graphics/service/GraphicsCalcLineBoundsService.d.ts +17 -0
  153. package/src/Graphics/service/GraphicsCalcLineBoundsService.js +58 -0
  154. package/src/Graphics/service/GraphicsDrawEllipseService.d.ts +15 -0
  155. package/src/Graphics/service/GraphicsDrawEllipseService.js +36 -0
  156. package/src/Graphics/service/GraphicsDrawRectService.d.ts +15 -0
  157. package/src/Graphics/service/GraphicsDrawRectService.js +28 -0
  158. package/src/Graphics/service/GraphicsDrawRoundRectService.d.ts +17 -0
  159. package/src/Graphics/service/GraphicsDrawRoundRectService.js +48 -0
  160. package/src/Graphics/service/GraphicsHitTestService.d.ts +13 -0
  161. package/src/Graphics/service/GraphicsHitTestService.js +73 -0
  162. package/src/Graphics/service/GraphicsMargePathService.d.ts +15 -0
  163. package/src/Graphics/service/GraphicsMargePathService.js +23 -0
  164. package/src/Graphics/service/GraphicsToNumberArrayService.d.ts +10 -0
  165. package/src/Graphics/service/GraphicsToNumberArrayService.js +242 -0
  166. package/src/Graphics/usecase/GraphicsCalcBoundsUseCase.d.ts +17 -0
  167. package/src/Graphics/usecase/GraphicsCalcBoundsUseCase.js +28 -0
  168. package/{dist → src}/Graphics.d.ts +240 -217
  169. package/src/Graphics.js +1224 -0
  170. package/{dist → src}/GraphicsBitmapFill.d.ts +4 -5
  171. package/{dist → src}/GraphicsBitmapFill.js +29 -6
  172. package/{dist → src}/GraphicsGradientFill.d.ts +12 -13
  173. package/{dist → src}/GraphicsGradientFill.js +68 -19
  174. package/src/InteractiveObject.d.ts +37 -0
  175. package/src/InteractiveObject.js +51 -0
  176. package/src/Loader/service/LoaderBuildService.d.ts +13 -0
  177. package/src/Loader/service/LoaderBuildService.js +46 -0
  178. package/src/Loader/service/LoaderLoadStartEventService.d.ts +12 -0
  179. package/src/Loader/service/LoaderLoadStartEventService.js +19 -0
  180. package/src/Loader/service/LoaderProgressEventService.d.ts +12 -0
  181. package/src/Loader/service/LoaderProgressEventService.js +16 -0
  182. package/src/Loader/usecase/LoaderLoadEndEventUseCase.d.ts +12 -0
  183. package/src/Loader/usecase/LoaderLoadEndEventUseCase.js +39 -0
  184. package/src/Loader/usecase/LoaderLoadJsonUseCase.d.ts +14 -0
  185. package/src/Loader/usecase/LoaderLoadJsonUseCase.js +33 -0
  186. package/src/Loader/usecase/LoaderLoadUseCase.d.ts +14 -0
  187. package/src/Loader/usecase/LoaderLoadUseCase.js +39 -0
  188. package/src/Loader/worker/ZlibInflateWorker.d.ts +2 -0
  189. package/src/Loader/worker/ZlibInflateWorker.js +20 -0
  190. package/src/Loader.d.ts +82 -0
  191. package/src/Loader.js +104 -0
  192. package/src/LoaderInfo.d.ts +68 -0
  193. package/src/LoaderInfo.js +96 -0
  194. package/src/LoopConfig.d.ts +61 -0
  195. package/src/LoopConfig.js +86 -0
  196. package/src/LoopType.d.ts +59 -0
  197. package/src/LoopType.js +69 -0
  198. package/src/MovieClip/service/MovieClipAddActionsService.d.ts +12 -0
  199. package/src/MovieClip/service/MovieClipAddActionsService.js +27 -0
  200. package/src/MovieClip/service/MovieClipAddFrameLabelService.d.ts +13 -0
  201. package/src/MovieClip/service/MovieClipAddFrameLabelService.js +16 -0
  202. package/src/MovieClip/service/MovieClipAddLabelsService.d.ts +13 -0
  203. package/src/MovieClip/service/MovieClipAddLabelsService.js +20 -0
  204. package/src/MovieClip/service/MovieClipBuildSoundsService.d.ts +15 -0
  205. package/src/MovieClip/service/MovieClipBuildSoundsService.js +47 -0
  206. package/src/MovieClip/service/MovieClipCurrentFrameLabelService.d.ts +12 -0
  207. package/src/MovieClip/service/MovieClipCurrentFrameLabelService.js +19 -0
  208. package/src/MovieClip/service/MovieClipCurrentLabelsService.d.ts +12 -0
  209. package/src/MovieClip/service/MovieClipCurrentLabelsService.js +14 -0
  210. package/src/MovieClip/service/MovieClipDispatchFrameLabelEventService.d.ts +13 -0
  211. package/src/MovieClip/service/MovieClipDispatchFrameLabelEventService.js +24 -0
  212. package/src/MovieClip/service/MovieClipGetChildrenService.d.ts +13 -0
  213. package/src/MovieClip/service/MovieClipGetChildrenService.js +133 -0
  214. package/src/MovieClip/service/MovieClipGetFrameForLabelService.d.ts +12 -0
  215. package/src/MovieClip/service/MovieClipGetFrameForLabelService.js +22 -0
  216. package/src/MovieClip/service/MovieClipSetActionService.d.ts +12 -0
  217. package/src/MovieClip/service/MovieClipSetActionService.js +21 -0
  218. package/src/MovieClip/service/MovieClipSetSoundsService.d.ts +13 -0
  219. package/src/MovieClip/service/MovieClipSetSoundsService.js +21 -0
  220. package/src/MovieClip/usecase/MovieClipAdvanceFrameUseCase.d.ts +11 -0
  221. package/src/MovieClip/usecase/MovieClipAdvanceFrameUseCase.js +36 -0
  222. package/src/MovieClip/usecase/MovieClipBuildDictionaryCharacterUseCase.d.ts +17 -0
  223. package/src/MovieClip/usecase/MovieClipBuildDictionaryCharacterUseCase.js +51 -0
  224. package/src/MovieClip/usecase/MovieClipBuildFromCharacterUseCase.d.ts +12 -0
  225. package/src/MovieClip/usecase/MovieClipBuildFromCharacterUseCase.js +33 -0
  226. package/src/MovieClip/usecase/MovieClipGoToFrameUseCase.d.ts +12 -0
  227. package/src/MovieClip/usecase/MovieClipGoToFrameUseCase.js +58 -0
  228. package/src/MovieClip/usecase/MovieClipGotoAndPlayUseCase.d.ts +12 -0
  229. package/src/MovieClip/usecase/MovieClipGotoAndPlayUseCase.js +15 -0
  230. package/src/MovieClip/usecase/MovieClipGotoAndStopUseCase.d.ts +12 -0
  231. package/src/MovieClip/usecase/MovieClipGotoAndStopUseCase.js +16 -0
  232. package/src/MovieClip/usecase/MovieClipNextFrameUseCase.d.ts +11 -0
  233. package/src/MovieClip/usecase/MovieClipNextFrameUseCase.js +17 -0
  234. package/src/MovieClip/usecase/MovieClipPrepareActionUseCase.d.ts +11 -0
  235. package/src/MovieClip/usecase/MovieClipPrepareActionUseCase.js +21 -0
  236. package/src/MovieClip/usecase/MovieClipPrepareSoundUseCase.d.ts +11 -0
  237. package/src/MovieClip/usecase/MovieClipPrepareSoundUseCase.js +18 -0
  238. package/src/MovieClip/usecase/MovieClipPrevFrameUseCase.d.ts +11 -0
  239. package/src/MovieClip/usecase/MovieClipPrevFrameUseCase.js +17 -0
  240. package/{dist → src}/MovieClip.d.ts +128 -167
  241. package/src/MovieClip.js +409 -0
  242. package/src/Shape/service/ShapeGetRawBoundsService.d.ts +10 -0
  243. package/src/Shape/service/ShapeGetRawBoundsService.js +13 -0
  244. package/src/Shape/usecase/ShapeBuildFromCharacterUseCase.d.ts +13 -0
  245. package/src/Shape/usecase/ShapeBuildFromCharacterUseCase.js +121 -0
  246. package/src/Shape/usecase/ShapeCalcBoundsMatrixUseCase.d.ts +12 -0
  247. package/src/Shape/usecase/ShapeCalcBoundsMatrixUseCase.js +30 -0
  248. package/src/Shape/usecase/ShapeClearBitmapBufferUseCase.d.ts +11 -0
  249. package/src/Shape/usecase/ShapeClearBitmapBufferUseCase.js +24 -0
  250. package/src/Shape/usecase/ShapeGenerateClipQueueUseCase.d.ts +12 -0
  251. package/src/Shape/usecase/ShapeGenerateClipQueueUseCase.js +30 -0
  252. package/src/Shape/usecase/ShapeGenerateRenderQueueUseCase.d.ts +17 -0
  253. package/src/Shape/usecase/ShapeGenerateRenderQueueUseCase.js +241 -0
  254. package/src/Shape/usecase/ShapeHitTestUseCase.d.ts +15 -0
  255. package/src/Shape/usecase/ShapeHitTestUseCase.js +34 -0
  256. package/src/Shape/usecase/ShapeLoadSrcUseCase.d.ts +12 -0
  257. package/src/Shape/usecase/ShapeLoadSrcUseCase.js +32 -0
  258. package/src/Shape/usecase/ShapeSetBitmapBufferUseCase.d.ts +14 -0
  259. package/src/Shape/usecase/ShapeSetBitmapBufferUseCase.js +22 -0
  260. package/src/Shape.d.ts +153 -0
  261. package/src/Shape.js +235 -0
  262. package/src/Sprite/service/SpriteStartDragService.d.ts +14 -0
  263. package/src/Sprite/service/SpriteStartDragService.js +22 -0
  264. package/src/Sprite/service/SpriteStopDragService.d.ts +11 -0
  265. package/src/Sprite/service/SpriteStopDragService.js +17 -0
  266. package/src/Sprite.d.ts +126 -0
  267. package/src/Sprite.js +192 -0
  268. package/src/Stage/service/StageExecuteFrameActionsService.d.ts +9 -0
  269. package/src/Stage/service/StageExecuteFrameActionsService.js +34 -0
  270. package/src/Stage/service/StageExecuteFrameSoundsService.d.ts +9 -0
  271. package/src/Stage/service/StageExecuteFrameSoundsService.js +35 -0
  272. package/src/Stage/usecase/StageGenerateRenderQueueUseCase.d.ts +18 -0
  273. package/src/Stage/usecase/StageGenerateRenderQueueUseCase.js +42 -0
  274. package/src/Stage/usecase/StageReadyUseCase.d.ts +11 -0
  275. package/src/Stage/usecase/StageReadyUseCase.js +20 -0
  276. package/src/Stage/usecase/StageTickerUseCase.d.ts +9 -0
  277. package/src/Stage/usecase/StageTickerUseCase.js +20 -0
  278. package/src/Stage.d.ts +161 -0
  279. package/src/Stage.js +240 -0
  280. package/src/TextField/service/TextFieldGetRawBoundsService.d.ts +10 -0
  281. package/src/TextField/service/TextFieldGetRawBoundsService.js +12 -0
  282. package/src/TextField/usecase/TextFieldCalcBoundsMatrixUseCase.d.ts +12 -0
  283. package/src/TextField/usecase/TextFieldCalcBoundsMatrixUseCase.js +30 -0
  284. package/src/TextField/usecase/TextFieldGenerateRenderQueueUseCase.d.ts +17 -0
  285. package/src/TextField/usecase/TextFieldGenerateRenderQueueUseCase.js +200 -0
  286. package/src/TextField/usecase/TextFieldHitTestUseCase.d.ts +15 -0
  287. package/src/TextField/usecase/TextFieldHitTestUseCase.js +36 -0
  288. package/src/Video/service/VideoGetRawBoundsService.d.ts +11 -0
  289. package/src/Video/service/VideoGetRawBoundsService.js +13 -0
  290. package/src/Video/usecase/VideoCalcBoundsMatrixUseCase.d.ts +12 -0
  291. package/src/Video/usecase/VideoCalcBoundsMatrixUseCase.js +30 -0
  292. package/src/Video/usecase/VideoGenerateRenderQueueUseCase.d.ts +18 -0
  293. package/src/Video/usecase/VideoGenerateRenderQueueUseCase.js +177 -0
  294. package/src/Video/usecase/VideoHitTestUseCase.d.ts +15 -0
  295. package/src/Video/usecase/VideoHitTestUseCase.js +37 -0
  296. package/{dist → src}/index.d.ts +0 -3
  297. package/{dist → src}/index.js +0 -3
  298. package/src/interface/IAjaxEvent.d.ts +5 -0
  299. package/src/interface/IAjaxEvent.js +1 -0
  300. package/src/interface/IAjaxOption.d.ts +13 -0
  301. package/src/interface/IAjaxOption.js +1 -0
  302. package/src/interface/IAnimationToolData.d.ts +8 -0
  303. package/src/interface/IAnimationToolData.js +1 -0
  304. package/src/interface/IAnimationToolDataZlib.d.ts +4 -0
  305. package/src/interface/IAnimationToolDataZlib.js +1 -0
  306. package/src/interface/IBlendMode.d.ts +1 -0
  307. package/src/interface/IBlendMode.js +1 -0
  308. package/src/interface/IBounds.d.ts +6 -0
  309. package/src/interface/IBounds.js +1 -0
  310. package/src/interface/ICapsStyle.d.ts +1 -0
  311. package/src/interface/ICapsStyle.js +1 -0
  312. package/src/interface/ICharacter.d.ts +5 -0
  313. package/src/interface/ICharacter.js +1 -0
  314. package/src/interface/IColorStop.d.ts +7 -0
  315. package/src/interface/IColorStop.js +1 -0
  316. package/src/interface/IDictionaryTag.d.ts +8 -0
  317. package/src/interface/IDictionaryTag.js +1 -0
  318. package/src/interface/IDisplayObject.d.ts +2 -0
  319. package/src/interface/IDisplayObject.js +1 -0
  320. package/src/interface/IFilterArray.d.ts +2 -0
  321. package/src/interface/IFilterArray.js +1 -0
  322. package/src/interface/IGradientType.d.ts +1 -0
  323. package/src/interface/IGradientType.js +1 -0
  324. package/src/interface/IGrid.d.ts +6 -0
  325. package/src/interface/IGrid.js +1 -0
  326. package/src/interface/IInterpolationMethod.d.ts +1 -0
  327. package/src/interface/IInterpolationMethod.js +1 -0
  328. package/src/interface/IJointStyle.d.ts +1 -0
  329. package/src/interface/IJointStyle.js +1 -0
  330. package/src/interface/ILoaderInfoData.d.ts +7 -0
  331. package/src/interface/ILoaderInfoData.js +1 -0
  332. package/src/interface/ILoopConfig.d.ts +8 -0
  333. package/src/interface/ILoopConfig.js +1 -0
  334. package/src/interface/ILoopType.d.ts +1 -0
  335. package/src/interface/ILoopType.js +1 -0
  336. package/src/interface/IMovieClipActionObject.d.ts +5 -0
  337. package/src/interface/IMovieClipActionObject.js +1 -0
  338. package/src/interface/IMovieClipCharacter.d.ts +17 -0
  339. package/src/interface/IMovieClipCharacter.js +1 -0
  340. package/src/interface/IMovieClipLabelObject.d.ts +4 -0
  341. package/src/interface/IMovieClipLabelObject.js +1 -0
  342. package/src/interface/IMovieClipSoundObject.d.ts +5 -0
  343. package/src/interface/IMovieClipSoundObject.js +1 -0
  344. package/src/interface/IParent.d.ts +2 -0
  345. package/src/interface/IParent.js +1 -0
  346. package/src/interface/IPlaceObject.d.ts +14 -0
  347. package/src/interface/IPlaceObject.js +1 -0
  348. package/src/interface/IPlayerHitObject.d.ts +7 -0
  349. package/src/interface/IPlayerHitObject.js +1 -0
  350. package/src/interface/IShapeCharacter.d.ts +14 -0
  351. package/src/interface/IShapeCharacter.js +1 -0
  352. package/src/interface/ISoundCharacter.d.ts +4 -0
  353. package/src/interface/ISoundCharacter.js +1 -0
  354. package/src/interface/ISoundTag.d.ts +6 -0
  355. package/src/interface/ISoundTag.js +1 -0
  356. package/src/interface/ISpreadMethod.d.ts +1 -0
  357. package/src/interface/ISpreadMethod.js +1 -0
  358. package/src/interface/ISprite.d.ts +2 -0
  359. package/src/interface/ISprite.js +1 -0
  360. package/src/interface/IStageData.d.ts +6 -0
  361. package/src/interface/IStageData.js +1 -0
  362. package/src/interface/ISurfaceFilter.d.ts +6 -0
  363. package/src/interface/ISurfaceFilter.js +1 -0
  364. package/src/interface/ITextFieldCharacter.d.ts +26 -0
  365. package/src/interface/ITextFieldCharacter.js +1 -0
  366. package/src/interface/ITextFieldType.d.ts +1 -0
  367. package/src/interface/ITextFieldType.js +1 -0
  368. package/src/interface/ITextFormatAlign.d.ts +1 -0
  369. package/src/interface/ITextFormatAlign.js +1 -0
  370. package/src/interface/IURLLoaderDataFormat.d.ts +1 -0
  371. package/src/interface/IURLLoaderDataFormat.js +1 -0
  372. package/src/interface/IURLRequestHeader.d.ts +4 -0
  373. package/src/interface/IURLRequestHeader.js +1 -0
  374. package/src/interface/IURLRequestMethod.d.ts +1 -0
  375. package/src/interface/IURLRequestMethod.js +1 -0
  376. package/src/interface/IVideoCharacter.d.ts +11 -0
  377. package/src/interface/IVideoCharacter.js +1 -0
  378. package/dist/BitmapData.d.ts +0 -151
  379. package/dist/BitmapData.js +0 -416
  380. package/dist/DisplayObject.d.ts +0 -563
  381. package/dist/DisplayObject.js +0 -1791
  382. package/dist/DisplayObjectContainer.d.ts +0 -346
  383. package/dist/DisplayObjectContainer.js +0 -1608
  384. package/dist/FrameLabel.d.ts +0 -98
  385. package/dist/FrameLabel.js +0 -120
  386. package/dist/Graphics.js +0 -2304
  387. package/dist/InteractiveObject.d.ts +0 -32
  388. package/dist/InteractiveObject.js +0 -43
  389. package/dist/Loader.d.ts +0 -140
  390. package/dist/Loader.js +0 -319
  391. package/dist/LoaderInfo.d.ts +0 -120
  392. package/dist/LoaderInfo.js +0 -184
  393. package/dist/LoopConfig.d.ts +0 -108
  394. package/dist/LoopConfig.js +0 -156
  395. package/dist/LoopType.d.ts +0 -104
  396. package/dist/LoopType.js +0 -122
  397. package/dist/MovieClip.js +0 -934
  398. package/dist/Shape.d.ts +0 -162
  399. package/dist/Shape.js +0 -517
  400. package/dist/Sprite.d.ts +0 -158
  401. package/dist/Sprite.js +0 -258
  402. package/dist/Stage.d.ts +0 -164
  403. package/dist/Stage.js +0 -252
  404. package/dist/TextField.d.ts +0 -656
  405. package/dist/TextField.js +0 -2807
package/dist/Graphics.js DELETED
@@ -1,2304 +0,0 @@
1
- import { GraphicsBitmapFill } from "./GraphicsBitmapFill";
2
- import { GraphicsGradientFill } from "./GraphicsGradientFill";
3
- import { $currentPlayer } from "@next2d/util";
4
- import { $cacheStore, $doUpdated, $Math, $Number, $getArray, $poolArray, $toColorInt, $intToRGBA, $clamp, $boundsMatrix, $poolBoundsObject, $Infinity, $getFloat32Array6, $multiplicationMatrix, $poolFloat32Array6, $getBoundsObject, $Float32Array, $getFloat32Array4, $getInt32Array4, $linearGradientXY } from "@next2d/share";
5
- /**
6
- * Graphics クラスには、ベクターシェイプの作成に使用できる一連のメソッドがあります。
7
- * 描画をサポートする表示オブジェクトには、Sprite および Shape オブジェクトがあります。
8
- * これらの各クラスには、Graphics オブジェクトである graphics プロパティがあります。
9
- * 以下は、簡単に使用できるように用意されているヘルパー関数の一例です。
10
- * drawRect()、drawRoundRect()、drawCircle()、および drawEllipse()。
11
- *
12
- * The Graphics class contains a set of methods that you can use to create a vector shape.
13
- * Display objects that support drawing include Sprite and Shape objects.
14
- * Each of these classes includes a graphics property that is a Graphics object.
15
- * The following are among those helper functions provided for ease of use:
16
- * drawRect(), drawRoundRect(), drawCircle(), and drawEllipse().
17
- *
18
- * @class
19
- * @memberOf next2d.display
20
- */
21
- export class Graphics {
22
- /**
23
- * @param {DisplayObject} src
24
- *
25
- * @constructor
26
- * @public
27
- */
28
- constructor(src = null) {
29
- /**
30
- * @type {DisplayObject}
31
- * @default null
32
- * @private
33
- */
34
- this._$displayObject = src;
35
- /**
36
- * @type {number}
37
- * @default 0
38
- * @private
39
- */
40
- this._$maxAlpha = 0;
41
- /**
42
- * @type {number}
43
- * @default 0
44
- * @private
45
- */
46
- this._$pointerX = 0;
47
- /**
48
- * @type {number}
49
- * @default 0
50
- * @private
51
- */
52
- this._$pointerY = 0;
53
- /**
54
- * @type {boolean}
55
- * @default false
56
- * @private
57
- */
58
- this._$canDraw = false;
59
- /**
60
- * @type {number}
61
- * @default 0
62
- * @private
63
- */
64
- this._$fillType = 0;
65
- /**
66
- * @type {GraphicsGradientFill}
67
- * @default null
68
- * @private
69
- */
70
- this._$fillGradient = null;
71
- /**
72
- * @type {GraphicsGradientFill}
73
- * @default null
74
- * @private
75
- */
76
- this._$fillBitmap = null;
77
- /**
78
- * @type {number}
79
- * @default 0
80
- * @private
81
- */
82
- this._$fillStyleR = 0;
83
- /**
84
- * @type {number}
85
- * @default 0
86
- * @private
87
- */
88
- this._$fillStyleG = 0;
89
- /**
90
- * @type {number}
91
- * @default 0
92
- * @private
93
- */
94
- this._$fillStyleB = 0;
95
- /**
96
- * @type {number}
97
- * @default 0
98
- * @private
99
- */
100
- this._$fillStyleA = 0;
101
- /**
102
- * @type {boolean}
103
- * @default false
104
- * @private
105
- */
106
- this._$doFill = false;
107
- /**
108
- * @type {number}
109
- * @default 0
110
- * @private
111
- */
112
- this._$lineType = 0;
113
- /**
114
- * @type {GraphicsGradientFill}
115
- * @default 0
116
- * @private
117
- */
118
- this._$lineGradient = null;
119
- /**
120
- * @type {string}
121
- * @default none
122
- * @private
123
- */
124
- this._$caps = "none";
125
- /**
126
- * @type {string}
127
- * @default round
128
- * @private
129
- */
130
- this._$joints = "round";
131
- /**
132
- * @type {number}
133
- * @default 0
134
- * @private
135
- */
136
- this._$miterLimit = 0;
137
- /**
138
- * @type {number}
139
- * @default 1
140
- * @private
141
- */
142
- this._$lineWidth = 1;
143
- /**
144
- * @type {number}
145
- * @default 0
146
- * @private
147
- */
148
- this._$lineStyleR = 0;
149
- /**
150
- * @type {number}
151
- * @default 0
152
- * @private
153
- */
154
- this._$lineStyleG = 0;
155
- /**
156
- * @type {number}
157
- * @default 0
158
- * @private
159
- */
160
- this._$lineStyleB = 0;
161
- /**
162
- * @type {number}
163
- * @default 0
164
- * @private
165
- */
166
- this._$lineStyleA = 0;
167
- /**
168
- * @type {boolean}
169
- * @default false
170
- * @private
171
- */
172
- this._$doLine = false;
173
- /**
174
- * @type {number}
175
- * @default Number.MAX_VALUE
176
- * @private
177
- */
178
- this._$xMin = $Number.MAX_VALUE;
179
- /**
180
- * @type {number}
181
- * @default -Number.MAX_VALUE
182
- * @private
183
- */
184
- this._$xMax = -$Number.MAX_VALUE;
185
- /**
186
- * @type {number}
187
- * @default Number.MAX_VALUE
188
- * @private
189
- */
190
- this._$yMin = $Number.MAX_VALUE;
191
- /**
192
- * @type {number}
193
- * @default -Number.MAX_VALUE
194
- * @private
195
- */
196
- this._$yMax = -$Number.MAX_VALUE;
197
- /**
198
- * @type {Float32Array}
199
- * @default null
200
- * @private
201
- */
202
- this._$buffer = null;
203
- /**
204
- * @type {array}
205
- * @default null
206
- * @private
207
- */
208
- this._$recode = null;
209
- /**
210
- * @type {array}
211
- * @default null
212
- * @private
213
- */
214
- this._$fills = null;
215
- /**
216
- * @type {array}
217
- * @default null
218
- * @private
219
- */
220
- this._$lines = null;
221
- /**
222
- * @type {string}
223
- * @default ""
224
- * @private
225
- */
226
- this._$uniqueKey = "";
227
- /**
228
- * @type {array}
229
- * @private
230
- */
231
- this._$cacheKeys = $getArray();
232
- /**
233
- * @type {array}
234
- * @private
235
- */
236
- this._$cacheParams = $getArray(0, 0, 0);
237
- /**
238
- * @type {number}
239
- * @default 0
240
- * @private
241
- */
242
- this._$bitmapId = 0;
243
- /**
244
- * @type {string}
245
- * @default "shape"
246
- * @private
247
- */
248
- this._$mode = "shape";
249
- /**
250
- * @type {boolean}
251
- * @default false
252
- * @private
253
- */
254
- this._$posted = false;
255
- }
256
- /**
257
- * @description 指定されたクラスのストリングを返します。
258
- * Returns the string representation of the specified class.
259
- *
260
- * @return {string}
261
- * @default [class Graphics]
262
- * @method
263
- * @static
264
- */
265
- static toString() {
266
- return "[class Graphics]";
267
- }
268
- /**
269
- * @description 指定されたクラスの空間名を返します。
270
- * Returns the space name of the specified class.
271
- *
272
- * @return {string}
273
- * @default next2d.display.Bitmap
274
- * @const
275
- * @static
276
- */
277
- static get namespace() {
278
- return "next2d.display.Graphics";
279
- }
280
- /**
281
- * @description 指定されたオブジェクトのストリングを返します。
282
- * Returns the string representation of the specified object.
283
- *
284
- * @return {string}
285
- * @default [object Graphics]
286
- * @method
287
- * @public
288
- */
289
- toString() {
290
- return "[object Graphics]";
291
- }
292
- /**
293
- * @description 指定されたオブジェクトの空間名を返します。
294
- * Returns the space name of the specified object.
295
- *
296
- * @return {string}
297
- * @default next2d.display.Graphics
298
- * @const
299
- * @public
300
- */
301
- get namespace() {
302
- return "next2d.display.Graphics";
303
- }
304
- /**
305
- * @return {number}
306
- * @default 0
307
- * @const
308
- * @static
309
- * @private
310
- */
311
- static get MOVE_TO() {
312
- return 0;
313
- }
314
- /**
315
- * @return {number}
316
- * @default 1
317
- * @const
318
- * @static
319
- * @private
320
- */
321
- static get CURVE_TO() {
322
- return 1;
323
- }
324
- /**
325
- * @return {number}
326
- * @default 2
327
- * @const
328
- * @static
329
- * @private
330
- */
331
- static get LINE_TO() {
332
- return 2;
333
- }
334
- /**
335
- * @return {number}
336
- * @default 3
337
- * @const
338
- * @static
339
- * @private
340
- */
341
- static get CUBIC() {
342
- return 3;
343
- }
344
- /**
345
- * @return {number}
346
- * @default 4
347
- * @const
348
- * @static
349
- * @private
350
- */
351
- static get ARC() {
352
- return 4;
353
- }
354
- /**
355
- * @return {number}
356
- * @default 5
357
- * @const
358
- * @static
359
- * @private
360
- */
361
- static get FILL_STYLE() {
362
- return 5;
363
- }
364
- /**
365
- * @return {number}
366
- * @default 6
367
- * @const
368
- * @static
369
- * @private
370
- */
371
- static get STROKE_STYLE() {
372
- return 6;
373
- }
374
- /**
375
- * @return {number}
376
- * @default 7
377
- * @const
378
- * @static
379
- * @private
380
- */
381
- static get END_FILL() {
382
- return 7;
383
- }
384
- /**
385
- * @return {number}
386
- * @default 8
387
- * @const
388
- * @static
389
- * @private
390
- */
391
- static get END_STROKE() {
392
- return 8;
393
- }
394
- /**
395
- * @return {number}
396
- * @default 9
397
- * @const
398
- * @static
399
- * @private
400
- */
401
- static get BEGIN_PATH() {
402
- return 9;
403
- }
404
- /**
405
- * @return {number}
406
- * @default 10
407
- * @const
408
- * @static
409
- * @private
410
- */
411
- static get GRADIENT_FILL() {
412
- return 10;
413
- }
414
- /**
415
- * @return {number}
416
- * @default 11
417
- * @const
418
- * @static
419
- * @private
420
- */
421
- static get GRADIENT_STROKE() {
422
- return 11;
423
- }
424
- /**
425
- * @return {number}
426
- * @default 12
427
- * @const
428
- * @static
429
- * @private
430
- */
431
- static get CLOSE_PATH() {
432
- return 12;
433
- }
434
- /**
435
- * @return {number}
436
- * @default 13
437
- * @const
438
- * @static
439
- * @private
440
- */
441
- static get BITMAP_FILL() {
442
- return 13;
443
- }
444
- /**
445
- * @return {number}
446
- * @default 14
447
- * @const
448
- * @static
449
- * @private
450
- */
451
- static get BITMAP_STROKE() {
452
- return 14;
453
- }
454
- /**
455
- * @description 描画領域をビットマップイメージで塗りつぶします。
456
- * Fills a drawing area with a bitmap image.
457
- *
458
- * @param {BitmapData} bitmap_data
459
- * @param {Matrix} [matrix=null]
460
- * @param {boolean} [repeat=true]
461
- * @param {boolean} [smooth=false]
462
- * @return {Graphics}
463
- * @method
464
- * @public
465
- */
466
- beginBitmapFill(bitmap_data, matrix = null, repeat = true, smooth = false) {
467
- // end fill
468
- if (this._$doFill) {
469
- this.endFill();
470
- }
471
- if (!this._$fills) {
472
- this._$fills = $getArray();
473
- }
474
- // start
475
- this._$maxAlpha = 1;
476
- this._$doFill = true;
477
- this._$canDraw = true;
478
- // beginPath
479
- this._$fills.push(Graphics.BEGIN_PATH);
480
- this._$fillType = Graphics.BITMAP_FILL;
481
- this._$fillBitmap = new GraphicsBitmapFill(bitmap_data, matrix, repeat, smooth);
482
- return this;
483
- }
484
- /**
485
- * @description 描画のときに他の Graphics メソッド(lineTo() や drawCircle() など)
486
- * に対する今後の呼び出しに使用する単純な一色塗りを指定します。
487
- * Specifies a simple one-color fill that subsequent calls
488
- * to other Graphics methods (such as lineTo() or drawCircle()) use when drawing.
489
- *
490
- * @param {string|number} [color=0]
491
- * @param {number} [alpha=1.0]
492
- * @return {Graphics}
493
- * @method
494
- * @public
495
- */
496
- beginFill(color = 0, alpha = 1) {
497
- // end fill
498
- if (this._$doFill) {
499
- this.endFill();
500
- }
501
- if (!this._$fills) {
502
- this._$fills = $getArray();
503
- }
504
- // valid
505
- color = $clamp($toColorInt(color), 0, 0xffffff, 0);
506
- alpha = $clamp(alpha, 0, 1, 1);
507
- // setup
508
- this._$maxAlpha = $Math.max(this._$maxAlpha, alpha);
509
- this._$doFill = true;
510
- this._$canDraw = true;
511
- // beginPath
512
- this._$fills.push(Graphics.BEGIN_PATH);
513
- // add Fill Style
514
- const object = $intToRGBA(color, alpha);
515
- this._$fillType = Graphics.FILL_STYLE;
516
- this._$fillStyleR = object.R;
517
- this._$fillStyleG = object.G;
518
- this._$fillStyleB = object.B;
519
- this._$fillStyleA = object.A;
520
- return this;
521
- }
522
- /**
523
- * @description Graphics の他のメソッド(lineTo()、drawCircle() など)に対する、
524
- * オブジェクトの後続の呼び出しに使用するグラデーション塗りを指定します。
525
- * Specifies a gradient fill used by subsequent calls
526
- * to other Graphics methods (such as lineTo() or drawCircle()) for the object.
527
- *
528
- * @param {string} type
529
- * @param {array} colors
530
- * @param {array} alphas
531
- * @param {array} ratios
532
- * @param {Matrix} [matrix=null]
533
- * @param {string} [spread_method=SpreadMethod.PAD]
534
- * @param {string} [interpolation_method=InterpolationMethod.RGB]
535
- * @param {number} [focal_point_ratio=0]
536
- * @return {Graphics}
537
- * @method
538
- * @public
539
- */
540
- beginGradientFill(type, colors, alphas, ratios, matrix = null, spread_method = "pad", interpolation_method = "rgb", focal_point_ratio = 0) {
541
- if (this._$doFill) {
542
- this.endFill();
543
- }
544
- if (!this._$fills) {
545
- this._$fills = $getArray();
546
- }
547
- // setup
548
- for (let idx = 0; idx < alphas.length; ++idx) {
549
- this._$maxAlpha = $Math.max(this._$maxAlpha, alphas[idx]);
550
- }
551
- this._$doFill = true;
552
- this._$canDraw = true;
553
- // beginPath
554
- this._$fills.push(Graphics.BEGIN_PATH);
555
- this._$fillType = Graphics.GRADIENT_FILL;
556
- this._$fillGradient = new GraphicsGradientFill(type, colors, alphas, ratios, matrix, spread_method, interpolation_method, focal_point_ratio);
557
- return this;
558
- }
559
- /**
560
- * @description この Graphics オブジェクトに描画されているグラフィックをクリアし、
561
- * 塗りと線のスタイルの設定をリセットします。
562
- * Clears the graphics that were drawn to this Graphics object,
563
- * and resets fill and line style settings.
564
- *
565
- * @return {Graphics}
566
- * @method
567
- * @public
568
- */
569
- clear() {
570
- // param clear
571
- this._$maxAlpha = 0;
572
- this._$pointerX = 0;
573
- this._$pointerY = 0;
574
- this._$canDraw = false;
575
- this._$bitmapId = 0;
576
- this._$mode = "shape";
577
- this._$posted = false;
578
- // fill
579
- this._$fillType = 0;
580
- this._$fillGradient = null;
581
- this._$fillBitmap = null;
582
- this._$fillStyleR = 0;
583
- this._$fillStyleG = 0;
584
- this._$fillStyleB = 0;
585
- this._$fillStyleA = 0;
586
- this._$doFill = false;
587
- // stroke
588
- this._$lineType = 0;
589
- this._$lineGradient = null;
590
- this._$caps = "none";
591
- this._$joints = "round";
592
- this._$miterLimit = 0;
593
- this._$lineWidth = 1;
594
- this._$lineStyleR = 0;
595
- this._$lineStyleG = 0;
596
- this._$lineStyleB = 0;
597
- this._$lineStyleA = 0;
598
- this._$doLine = false;
599
- // bounds size
600
- this._$xMin = $Number.MAX_VALUE;
601
- this._$xMax = -$Number.MAX_VALUE;
602
- this._$yMin = $Number.MAX_VALUE;
603
- this._$yMax = -$Number.MAX_VALUE;
604
- // init array
605
- if (this._$recode) {
606
- $poolArray(this._$recode);
607
- }
608
- if (this._$fills) {
609
- $poolArray(this._$fills);
610
- }
611
- if (this._$lines) {
612
- $poolArray(this._$lines);
613
- }
614
- this._$buffer = null;
615
- this._$recode = null;
616
- this._$fills = null;
617
- this._$lines = null;
618
- // cache clear
619
- this._$cacheKeys.length = 0;
620
- this._$uniqueKey = "";
621
- this._$cacheParams.fill(0);
622
- // restart
623
- this._$restart();
624
- return this;
625
- }
626
- /**
627
- * @description すべての描画コマンドをソース Graphics オブジェクトから、呼び出し Graphics オブジェクトにコピーします。
628
- * Copies all of drawing commands from the source Graphics object into the calling Graphics object.
629
- *
630
- * @return {Graphics}
631
- * @method
632
- * @public
633
- */
634
- clone() {
635
- const graphics = new Graphics();
636
- graphics.copyFrom(this);
637
- return graphics;
638
- }
639
- /**
640
- * @description すべての描画コマンドをソース Graphics オブジェクトから、呼び出し Graphics オブジェクトにコピーします。
641
- * Copies all of drawing commands from the source Graphics object into the calling Graphics object.
642
- *
643
- * @param {Graphics} graphics
644
- * @return {void}
645
- * @method
646
- * @public
647
- */
648
- copyFrom(graphics) {
649
- if (graphics._$fillGradient) {
650
- this._$fillGradient = graphics._$fillGradient.clone();
651
- }
652
- if (graphics._$fillBitmap) {
653
- this._$fillBitmap = graphics._$fillBitmap.clone();
654
- }
655
- // fill
656
- this._$doFill = graphics._$doFill;
657
- this._$fillType = graphics._$fillType;
658
- this._$fillStyleR = graphics._$fillStyleR;
659
- this._$fillStyleG = graphics._$fillStyleG;
660
- this._$fillStyleB = graphics._$fillStyleB;
661
- this._$fillStyleA = graphics._$fillStyleA;
662
- if (graphics._$lineGradient) {
663
- this._$lineGradient = graphics._$lineGradient.clone();
664
- }
665
- // stroke
666
- this._$doLine = graphics._$doLine;
667
- this._$lineType = graphics._$lineType;
668
- this._$caps = graphics._$caps;
669
- this._$joints = graphics._$joints;
670
- this._$miterLimit = graphics._$miterLimit;
671
- this._$lineWidth = graphics._$lineWidth;
672
- this._$lineStyleR = graphics._$lineStyleR;
673
- this._$lineStyleG = graphics._$lineStyleG;
674
- this._$lineStyleB = graphics._$lineStyleB;
675
- this._$lineStyleA = graphics._$lineStyleA;
676
- // bounds
677
- this._$xMin = graphics._$xMin;
678
- this._$xMax = graphics._$xMax;
679
- this._$yMin = graphics._$yMin;
680
- this._$yMax = graphics._$yMax;
681
- // params
682
- this._$maxAlpha = graphics._$maxAlpha;
683
- this._$pointerX = graphics._$pointerX;
684
- this._$pointerY = graphics._$pointerY;
685
- this._$canDraw = graphics._$canDraw;
686
- // path params
687
- if (graphics._$fills) {
688
- this._$fills = graphics._$fills.slice(0);
689
- }
690
- if (graphics._$lines) {
691
- this._$lines = graphics._$lines.slice(0);
692
- }
693
- if (graphics._$recode) {
694
- this._$recode = graphics._$recode.slice(0);
695
- }
696
- }
697
- /**
698
- * @description 現在の描画位置から指定されたアンカーポイントに 3 次ベジェ曲線を描画します。
699
- * Draws a cubic Bezier curve from the current drawing position to the specified anchor point.
700
- *
701
- * @param {number} control_x1
702
- * @param {number} control_y1
703
- * @param {number} control_x2
704
- * @param {number} control_y2
705
- * @param {number} anchor_x
706
- * @param {number} anchor_y
707
- * @return {Graphics}
708
- * @method
709
- * @public
710
- */
711
- cubicCurveTo(control_x1, control_y1, control_x2, control_y2, anchor_x, anchor_y) {
712
- anchor_x = +anchor_x || 0;
713
- anchor_y = +anchor_y || 0;
714
- if (this._$pointerX === anchor_x && this._$pointerY === anchor_y) {
715
- return this;
716
- }
717
- control_x1 = +control_x1 || 0;
718
- control_y1 = +control_y1 || 0;
719
- control_x2 = +control_x2 || 0;
720
- control_y2 = +control_y2 || 0;
721
- // set bounds
722
- this._$setBounds(control_x1, control_y1);
723
- this._$setBounds(control_x2, control_y2);
724
- this._$setBounds(anchor_x, anchor_y);
725
- this._$margePath($getArray(Graphics.CUBIC, control_x1, control_y1, control_x2, control_y2, anchor_x, anchor_y));
726
- this._$pointerX = anchor_x;
727
- this._$pointerY = anchor_y;
728
- // restart
729
- this._$restart();
730
- return this;
731
- }
732
- /**
733
- * @description (controlX, controlY) で指定されたコントロールポイントを使用し、
734
- * 現在の描画位置から (anchorX, anchorY) まで、現在の線のスタイルで 2 次ベジェ曲線を描画します。
735
- * Draws a quadratic Bezier curve using the current line style from
736
- * the current drawing position to (anchorX, anchorY)
737
- * and using the control point that (controlX, controlY) specifies.
738
- *
739
- * @param {number} control_x
740
- * @param {number} control_y
741
- * @param {number} anchor_x
742
- * @param {number} anchor_y
743
- * @return {Graphics}
744
- * @method
745
- * @public
746
- */
747
- curveTo(control_x, control_y, anchor_x, anchor_y) {
748
- anchor_x = +anchor_x || 0;
749
- anchor_y = +anchor_y || 0;
750
- if (this._$pointerX === anchor_x && this._$pointerY === anchor_y) {
751
- return this;
752
- }
753
- control_x = +control_x || 0;
754
- control_y = +control_y || 0;
755
- this._$setBounds(control_x, control_y);
756
- this._$setBounds(anchor_x, anchor_y);
757
- this._$margePath($getArray(Graphics.CURVE_TO, control_x, control_y, anchor_x, anchor_y));
758
- this._$pointerX = anchor_x;
759
- this._$pointerY = anchor_y;
760
- // restart
761
- this._$restart();
762
- return this;
763
- }
764
- /**
765
- * @description 円を描画します。
766
- * Draws a circle.
767
- *
768
- * @param {number} x
769
- * @param {number} y
770
- * @param {number} radius
771
- * @return {Graphics}
772
- * @method
773
- * @public
774
- */
775
- drawCircle(x, y, radius) {
776
- x = +x || 0;
777
- y = +y || 0;
778
- radius = +radius || 0;
779
- radius = $Math.round(radius);
780
- this._$setBounds(x - radius, y - radius);
781
- this._$setBounds(x + radius, y + radius);
782
- this._$margePath($getArray(Graphics.MOVE_TO, x + radius, y, Graphics.ARC, x, y, radius));
783
- this._$pointerX = x;
784
- this._$pointerY = y;
785
- // restart
786
- this._$restart();
787
- return this;
788
- }
789
- /**
790
- * @description 楕円を描画します。
791
- * Draws an ellipse.
792
- *
793
- * @param {number} x
794
- * @param {number} y
795
- * @param {number} width
796
- * @param {number} height
797
- * @return {Graphics}
798
- * @method
799
- * @public
800
- */
801
- drawEllipse(x, y, width, height) {
802
- x = +x || 0;
803
- y = +y || 0;
804
- width = +width || 0;
805
- height = +height || 0;
806
- width = $Math.round(width);
807
- height = $Math.round(height);
808
- const hw = width / 2; // half width
809
- const hh = height / 2; // half height
810
- const x0 = x + hw;
811
- const y0 = y + hh;
812
- const x1 = x + width;
813
- const y1 = y + height;
814
- const c = 4 / 3 * ($Math.SQRT2 - 1);
815
- const cw = c * hw;
816
- const ch = c * hh;
817
- return this
818
- .moveTo(x0, y)
819
- .cubicCurveTo(x0 + cw, y, x1, y0 - ch, x1, y0)
820
- .cubicCurveTo(x1, y0 + ch, x0 + cw, y1, x0, y1)
821
- .cubicCurveTo(x0 - cw, y1, x, y0 + ch, x, y0)
822
- .cubicCurveTo(x, y0 - ch, x0 - cw, y, x0, y);
823
- }
824
- /**
825
- * @description 矩形を描画します。
826
- * Draws a rectangle.
827
- *
828
- * @param {number} x
829
- * @param {number} y
830
- * @param {number} width
831
- * @param {number} height
832
- * @return {Graphics}
833
- * @method
834
- * @public
835
- */
836
- drawRect(x, y, width, height) {
837
- // valid
838
- x = +x || 0;
839
- y = +y || 0;
840
- width = +width || 0;
841
- height = +height || 0;
842
- const xMax = $Math.round(x + width);
843
- const yMax = $Math.round(y + height);
844
- return this
845
- .moveTo(x, y)
846
- .lineTo(x, yMax)
847
- .lineTo(xMax, yMax)
848
- .lineTo(xMax, y)
849
- .lineTo(x, y);
850
- }
851
- /**
852
- * @description 角丸矩形を描画します。
853
- * Draws a rounded rectangle.
854
- *
855
- * @param {number} x
856
- * @param {number} y
857
- * @param {number} width
858
- * @param {number} height
859
- * @param {number} ellipse_width
860
- * @param {number} [ellipse_height=NaN]
861
- * @return {Graphics}
862
- * @method
863
- * @public
864
- */
865
- drawRoundRect(x, y, width, height, ellipse_width, ellipse_height = NaN) {
866
- x = +x || 0;
867
- y = +y || 0;
868
- width = +width || 0;
869
- height = +height || 0;
870
- ellipse_width = +ellipse_width || 0;
871
- ellipse_height = +ellipse_height || ellipse_width;
872
- width = $Math.round(width);
873
- height = $Math.round(height);
874
- ellipse_width = $Math.round(ellipse_width);
875
- ellipse_height = $Math.round(ellipse_height);
876
- const hew = ellipse_width / 2;
877
- const heh = ellipse_height / 2;
878
- const c = 4 / 3 * ($Math.SQRT2 - 1);
879
- const cw = c * hew;
880
- const ch = c * heh;
881
- const dx0 = x + hew;
882
- const dx1 = x + width;
883
- const dx2 = dx1 - hew;
884
- const dy0 = y + heh;
885
- const dy1 = y + height;
886
- const dy2 = dy1 - heh;
887
- return this
888
- .moveTo(dx0, y)
889
- .lineTo(dx2, y)
890
- .cubicCurveTo(dx2 + cw, y, dx1, dy0 - ch, dx1, dy0)
891
- .lineTo(dx1, dy2)
892
- .cubicCurveTo(dx1, dy2 + ch, dx2 + cw, dy1, dx2, dy1)
893
- .lineTo(dx0, dy1)
894
- .cubicCurveTo(dx0 - cw, dy1, x, dy2 + ch, x, dy2)
895
- .lineTo(x, dy0)
896
- .cubicCurveTo(x, dy0 - ch, dx0 - cw, y, dx0, y);
897
- }
898
- /**
899
- * @description beginFill()、beginGradientFill()、または beginBitmapFill() メソッドへの
900
- * 最後の呼び出し以降に追加された線と曲線に塗りを適用します。
901
- * Applies a fill to the lines and curves that were added since
902
- * the last call to the beginFill(), beginGradientFill(),
903
- * or beginBitmapFill() method.
904
- *
905
- * @return {Graphics}
906
- * @method
907
- * @public
908
- */
909
- endFill() {
910
- if (this._$doFill && this._$fills && this._$fills.length > 7) {
911
- if (!this._$recode) {
912
- this._$recode = $getArray();
913
- }
914
- if (this._$fills[2] !== this._$fills[this._$fills.length - 2]
915
- || this._$fills[3] !== this._$fills[this._$fills.length - 1]) {
916
- this._$fills.push(Graphics.LINE_TO, this._$fills[2], this._$fills[3]);
917
- }
918
- this._$recode.push(...this._$fills);
919
- // fill
920
- switch (this._$fillType) {
921
- case Graphics.FILL_STYLE:
922
- this._$recode.push(this._$fillType, this._$fillStyleR, this._$fillStyleG, this._$fillStyleB, this._$fillStyleA, Graphics.END_FILL);
923
- break;
924
- case Graphics.GRADIENT_FILL:
925
- if (this._$fillGradient) {
926
- this._$recode.push(this._$fillType, ...this._$fillGradient.toArray());
927
- }
928
- break;
929
- case Graphics.BITMAP_FILL:
930
- if (this._$fillBitmap) {
931
- this._$recode.push(this._$fillType, ...this._$fillBitmap.toArray());
932
- }
933
- break;
934
- }
935
- }
936
- if (this._$fills) {
937
- $poolArray(this._$fills);
938
- this._$fills = null;
939
- }
940
- // reset
941
- this._$fillType = 0;
942
- this._$fillGradient = null;
943
- this._$fillBitmap = null;
944
- this._$fillStyleR = 0;
945
- this._$fillStyleG = 0;
946
- this._$fillStyleB = 0;
947
- this._$fillStyleA = 0;
948
- this._$doFill = false;
949
- // restart
950
- this._$restart();
951
- return this;
952
- }
953
- /**
954
- * @description lineStyle()、または lineGradientStyle() メソッドへの
955
- * 最後の呼び出し以降に追加された線と曲線に塗りを適用します。
956
- * Applies a fill to the lines and curves that were added since
957
- * the last call to the beginFill() or beginGradientFill() method.
958
- *
959
- * @return {Graphics}
960
- * @method
961
- * @public
962
- */
963
- endLine() {
964
- if (this._$doLine && this._$lines) {
965
- if (!this._$recode) {
966
- this._$recode = $getArray();
967
- }
968
- this._$recode.push(...this._$lines);
969
- // clear
970
- $poolArray(this._$lines);
971
- this._$lines = null;
972
- // fill
973
- switch (this._$lineType) {
974
- case Graphics.STROKE_STYLE:
975
- this._$recode.push(this._$lineType, this._$lineWidth, this._$caps, this._$joints, this._$miterLimit, this._$lineStyleR, this._$lineStyleG, this._$lineStyleB, this._$lineStyleA, Graphics.END_STROKE);
976
- break;
977
- case Graphics.GRADIENT_STROKE:
978
- if (this._$lineGradient) {
979
- this._$recode.push(this._$lineType, this._$lineWidth, this._$caps, this._$joints, this._$miterLimit, ...this._$lineGradient.toArray());
980
- }
981
- break;
982
- case Graphics.BITMAP_STROKE:
983
- if (this._$fillBitmap) {
984
- this._$recode.push(this._$lineType, this._$lineWidth, this._$caps, this._$joints, this._$miterLimit, ...this._$fillBitmap.toArray());
985
- }
986
- break;
987
- }
988
- }
989
- // reset
990
- this._$lineType = 0;
991
- this._$lineWidth = 0;
992
- this._$lineGradient = null;
993
- this._$lineStyleR = 0;
994
- this._$lineStyleG = 0;
995
- this._$lineStyleB = 0;
996
- this._$lineStyleA = 0;
997
- this._$caps = "none";
998
- this._$joints = "round";
999
- this._$miterLimit = 0;
1000
- this._$doLine = false;
1001
- // restart
1002
- this._$restart();
1003
- return this;
1004
- }
1005
- /**
1006
- * @description 線の描画で、線として使用するビットマップを指定します。
1007
- * Specifies a bitmap to use for the line stroke when drawing lines.
1008
- *
1009
- * @param {BitmapData} bitmap_data
1010
- * @param {Matrix} [matrix=null]
1011
- * @param {boolean} [repeat=true]
1012
- * @param {boolean} [smooth=false]
1013
- * @return {Graphics}
1014
- * @method
1015
- * @public
1016
- */
1017
- lineBitmapStyle(bitmap_data, matrix = null, repeat = true, smooth = false) {
1018
- // end fill
1019
- if (this._$doLine) {
1020
- this.endLine();
1021
- }
1022
- if (!this._$lines) {
1023
- this._$lines = $getArray();
1024
- }
1025
- // start
1026
- this._$maxAlpha = 1;
1027
- this._$doLine = true;
1028
- this._$canDraw = true;
1029
- // beginPath
1030
- this._$lines.push(Graphics.BEGIN_PATH);
1031
- this._$lineType = Graphics.BITMAP_STROKE;
1032
- this._$fillBitmap = new GraphicsBitmapFill(bitmap_data, matrix, repeat, smooth);
1033
- return this;
1034
- }
1035
- /**
1036
- * @description 線の描画で使用するグラデーションを指定します。
1037
- * Specifies a gradient to use for the stroke when drawing lines.
1038
- *
1039
- * @param {string} type
1040
- * @param {array} colors
1041
- * @param {array} alphas
1042
- * @param {array} ratios
1043
- * @param {Matrix} [matrix=null]
1044
- * @param {string} [spread_method=SpreadMethod.PAD]
1045
- * @param {string} [interpolation_method=InterpolationMethod.RGB]
1046
- * @param {number} [focal_point_ratio=0]
1047
- * @return {Graphics}
1048
- * @method
1049
- * @public
1050
- */
1051
- lineGradientStyle(type, colors, alphas, ratios, matrix = null, spread_method = "pad", interpolation_method = "rgb", focal_point_ratio = 0) {
1052
- if (!this._$doLine) {
1053
- return this;
1054
- }
1055
- if (!this._$lines) {
1056
- this._$lines = $getArray();
1057
- }
1058
- // setup
1059
- for (let idx = 0; idx < alphas.length; ++idx) {
1060
- this._$maxAlpha = $Math.max(this._$maxAlpha, alphas[idx]);
1061
- }
1062
- // beginPath
1063
- this._$lines.push(Graphics.BEGIN_PATH);
1064
- this._$lineType = Graphics.GRADIENT_STROKE;
1065
- this._$lineGradient = new GraphicsGradientFill(type, colors, alphas, ratios, matrix, spread_method, interpolation_method, focal_point_ratio);
1066
- return this;
1067
- }
1068
- /**
1069
- * @description lineTo() メソッドや drawCircle() メソッドなど、
1070
- * Graphics のメソッドの後続の呼び出しに使用する線スタイルを指定します。
1071
- * Specifies a line style used for subsequent calls
1072
- * to Graphics methods such as the lineTo() method
1073
- * or the drawCircle() method.
1074
- *
1075
- * @param {number} [thickness=NaN]
1076
- * @param {number|string} [color=0]
1077
- * @param {number} [alpha=1]
1078
- * @param {string} [caps=CapsStyle.NONE]
1079
- * @param {string} [joints=JointStyle.ROUND]
1080
- * @param {number} [miter_limit=3]
1081
- * @return {Graphics}
1082
- * @method
1083
- * @public
1084
- */
1085
- lineStyle(thickness = 1, color = 0, alpha = 1, caps = "round", joints = "round", miter_limit = 3) {
1086
- if (this._$doLine) {
1087
- this.endLine();
1088
- }
1089
- if (!this._$lines) {
1090
- this._$lines = $getArray();
1091
- }
1092
- color = $clamp($toColorInt(color), 0, 0xffffff, 0);
1093
- alpha = $clamp(+alpha, 0, 1, 1);
1094
- // setup
1095
- this._$maxAlpha = $Math.max(this._$maxAlpha, alpha);
1096
- this._$doLine = true;
1097
- this._$canDraw = true;
1098
- // beginPath
1099
- if (this._$pointerX || this._$pointerY) {
1100
- this._$lines.push(Graphics.BEGIN_PATH, Graphics.MOVE_TO, this._$pointerX, this._$pointerY);
1101
- }
1102
- else {
1103
- this._$lines.push(Graphics.BEGIN_PATH);
1104
- }
1105
- // add Fill Style
1106
- const object = $intToRGBA(color, alpha);
1107
- // color
1108
- this._$lineType = Graphics.STROKE_STYLE;
1109
- this._$lineStyleR = object.R;
1110
- this._$lineStyleG = object.G;
1111
- this._$lineStyleB = object.B;
1112
- this._$lineStyleA = object.A;
1113
- // param
1114
- this._$lineWidth = thickness;
1115
- this._$caps = `${caps}`;
1116
- this._$joints = `${joints}`;
1117
- // set miter limit
1118
- if (this._$joints === "miter") {
1119
- this._$miterLimit = miter_limit;
1120
- }
1121
- return this;
1122
- }
1123
- /**
1124
- * @description 現在の描画位置から (x, y) まで、現在の線のスタイルを使用して線を描画します。
1125
- * その後で、現在の描画位置は (x, y) に設定されます。
1126
- * Draws a line using the current line style from the current drawing position to (x, y);
1127
- * the current drawing position is then set to (x, y).
1128
- *
1129
- * @param {number} x
1130
- * @param {number} y
1131
- * @returns {Graphics}
1132
- * @method
1133
- * @public
1134
- */
1135
- lineTo(x, y) {
1136
- x = +x || 0;
1137
- y = +y || 0;
1138
- if (this._$pointerX === x && this._$pointerY === y) {
1139
- return this;
1140
- }
1141
- this._$setBounds(x, y);
1142
- this._$margePath($getArray(Graphics.LINE_TO, x, y));
1143
- this._$pointerX = x;
1144
- this._$pointerY = y;
1145
- // restart
1146
- this._$restart();
1147
- return this;
1148
- }
1149
- /**
1150
- * @description 現在の描画位置を (x, y) に移動します。
1151
- * Moves the current drawing position to (x, y).
1152
- *
1153
- * @param {number} x
1154
- * @param {number} y
1155
- * @returns {Graphics}
1156
- * @method
1157
- * @public
1158
- */
1159
- moveTo(x, y) {
1160
- x = +x || 0;
1161
- y = +y || 0;
1162
- this._$pointerX = x;
1163
- this._$pointerY = y;
1164
- this._$setBounds(x, y);
1165
- let duplication = false;
1166
- if (this._$doFill && this._$fills) {
1167
- const isMove = this._$fills[this._$fills.length - 3] === Graphics.MOVE_TO;
1168
- if (isMove) {
1169
- duplication = true;
1170
- this._$fills[this._$fills.length - 2] = x;
1171
- this._$fills[this._$fills.length - 1] = y;
1172
- }
1173
- }
1174
- if (this._$doLine && this._$lines) {
1175
- const isMove = this._$lines[this._$lines.length - 3] === Graphics.MOVE_TO;
1176
- if (isMove) {
1177
- duplication = true;
1178
- this._$lines[this._$lines.length - 2] = x;
1179
- this._$lines[this._$lines.length - 1] = y;
1180
- }
1181
- }
1182
- if (!duplication) {
1183
- this._$margePath($getArray(Graphics.MOVE_TO, x, y));
1184
- }
1185
- // restart
1186
- this._$restart();
1187
- return this;
1188
- }
1189
- /**
1190
- * @param {CanvasToWebGLContext} context
1191
- * @param {Float32Array} matrix
1192
- * @return {void}
1193
- * @method
1194
- * @private
1195
- */
1196
- _$clip(context, matrix) {
1197
- // size
1198
- const baseBounds = this._$getBounds();
1199
- const bounds = $boundsMatrix(baseBounds, matrix);
1200
- $poolBoundsObject(baseBounds);
1201
- const width = $Math.ceil($Math.abs(bounds.xMax - bounds.xMin));
1202
- const height = $Math.ceil($Math.abs(bounds.yMax - bounds.yMin));
1203
- $poolBoundsObject(bounds);
1204
- switch (true) {
1205
- case width === 0:
1206
- case height === 0:
1207
- case width === -$Infinity:
1208
- case height === -$Infinity:
1209
- case width === $Infinity:
1210
- case height === $Infinity:
1211
- return;
1212
- default:
1213
- break;
1214
- }
1215
- context.reset();
1216
- context.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
1217
- this._$doDraw(context, null, true);
1218
- context.clip();
1219
- }
1220
- /**
1221
- * @param {CanvasToWebGLContext} context
1222
- * @param {Float32Array} matrix
1223
- * @param {Float32Array} color_transform
1224
- * @param {string} [blend_mode=BlendMode.NORMAL]
1225
- * @param {array} [filters=null]
1226
- * @return {void}
1227
- * @method
1228
- * @private
1229
- */
1230
- _$draw(context, matrix, color_transform, blend_mode = "normal", filters = null) {
1231
- if (!this._$maxAlpha) {
1232
- return;
1233
- }
1234
- const alpha = $clamp(color_transform[3] + color_transform[7] / 255, 0, 1);
1235
- const displayObject = this._$displayObject;
1236
- // set grid data
1237
- let hasGrid = displayObject._$scale9Grid !== null;
1238
- // 9スライスを有効にしたオブジェクトが回転・傾斜成分を含む場合は
1239
- // 9スライスは無効になる
1240
- const rawMatrix = displayObject._$transform._$rawMatrix();
1241
- if (hasGrid) {
1242
- hasGrid = hasGrid
1243
- && $Math.abs(rawMatrix[1]) < 0.001
1244
- && $Math.abs(rawMatrix[2]) < 0.0001;
1245
- }
1246
- // size
1247
- const baseBounds = this._$getBounds();
1248
- const bounds = $boundsMatrix(baseBounds, matrix);
1249
- const xMax = bounds.xMax;
1250
- const xMin = bounds.xMin;
1251
- const yMax = bounds.yMax;
1252
- const yMin = bounds.yMin;
1253
- $poolBoundsObject(bounds);
1254
- const width = $Math.ceil($Math.abs(xMax - xMin));
1255
- const height = $Math.ceil($Math.abs(yMax - yMin));
1256
- switch (true) {
1257
- case width === 0:
1258
- case height === 0:
1259
- case width === -$Infinity:
1260
- case height === -$Infinity:
1261
- case width === $Infinity:
1262
- case height === $Infinity:
1263
- return;
1264
- default:
1265
- break;
1266
- }
1267
- let xScale = +$Math.sqrt(matrix[0] * matrix[0]
1268
- + matrix[1] * matrix[1]);
1269
- if (!$Number.isInteger(xScale)) {
1270
- const value = xScale.toString();
1271
- const index = value.indexOf("e");
1272
- if (index !== -1) {
1273
- xScale = +value.slice(0, index);
1274
- }
1275
- xScale = +xScale.toFixed(4);
1276
- }
1277
- let yScale = +$Math.sqrt(matrix[2] * matrix[2]
1278
- + matrix[3] * matrix[3]);
1279
- if (!$Number.isInteger(yScale)) {
1280
- const value = yScale.toString();
1281
- const index = value.indexOf("e");
1282
- if (index !== -1) {
1283
- yScale = +value.slice(0, index);
1284
- }
1285
- yScale = +yScale.toFixed(4);
1286
- }
1287
- const canApply = filters !== null
1288
- && filters.length > 0
1289
- && displayObject._$canApply(filters);
1290
- let filterBounds = $getBoundsObject(0, width, 0, height);
1291
- if (canApply && filters) {
1292
- for (let idx = 0; idx < filters.length; ++idx) {
1293
- filterBounds = filters[idx]
1294
- ._$generateFilterRect(filterBounds, xScale, yScale);
1295
- }
1296
- }
1297
- // cache current buffer
1298
- const manager = context.frameBuffer;
1299
- const currentAttachment = manager.currentAttachment;
1300
- if (!currentAttachment
1301
- || xMin - filterBounds.xMin > currentAttachment.width
1302
- || yMin - filterBounds.yMin > currentAttachment.height) {
1303
- $poolBoundsObject(filterBounds);
1304
- return;
1305
- }
1306
- if (0 > xMin + filterBounds.xMax || 0 > yMin + filterBounds.yMax) {
1307
- $poolBoundsObject(filterBounds);
1308
- return;
1309
- }
1310
- $poolBoundsObject(filterBounds);
1311
- // get cache
1312
- if (this._$uniqueKey === "") {
1313
- if (!hasGrid
1314
- && displayObject._$loaderInfo
1315
- && displayObject._$characterId) {
1316
- this._$uniqueKey = `${displayObject._$loaderInfo._$id}@${this._$bitmapId || displayObject._$characterId}`;
1317
- }
1318
- else {
1319
- this._$uniqueKey = this._$createCacheKey();
1320
- }
1321
- }
1322
- const player = $currentPlayer();
1323
- if (this._$mode === "bitmap") {
1324
- if (!this._$cacheKeys.length) {
1325
- this._$cacheKeys = $cacheStore.generateKeys(this._$uniqueKey);
1326
- }
1327
- }
1328
- else {
1329
- if (!this._$cacheKeys.length
1330
- || this._$cacheParams[0] !== xScale
1331
- || this._$cacheParams[1] !== yScale
1332
- || this._$cacheParams[2] !== color_transform[7]) {
1333
- const keys = $getArray();
1334
- keys[0] = xScale;
1335
- keys[1] = yScale;
1336
- this._$cacheKeys = $cacheStore.generateKeys(this._$uniqueKey, keys, color_transform);
1337
- $poolArray(keys);
1338
- this._$cacheParams[0] = xScale;
1339
- this._$cacheParams[1] = yScale;
1340
- this._$cacheParams[2] = color_transform[7];
1341
- }
1342
- }
1343
- context.cachePosition = $cacheStore.get(this._$cacheKeys);
1344
- if (!context.cachePosition) {
1345
- const currentAttachment = manager.currentAttachment;
1346
- if (currentAttachment && currentAttachment.mask) {
1347
- context.stopStencil();
1348
- }
1349
- let width = 0;
1350
- let height = 0;
1351
- if (this._$mode === "shape") {
1352
- width = $Math.ceil($Math.abs(baseBounds.xMax - baseBounds.xMin) * xScale);
1353
- height = $Math.ceil($Math.abs(baseBounds.yMax - baseBounds.yMin) * yScale);
1354
- // resize
1355
- const textureScale = context._$getTextureScale(width, height);
1356
- if (textureScale < 1) {
1357
- width *= textureScale;
1358
- height *= textureScale;
1359
- }
1360
- }
1361
- else {
1362
- width = $Math.ceil($Math.abs(baseBounds.xMax - baseBounds.xMin));
1363
- height = $Math.ceil($Math.abs(baseBounds.yMax - baseBounds.yMin));
1364
- }
1365
- // create cache position
1366
- context.cachePosition = manager.createCachePosition(width, height);
1367
- context.bindRenderBuffer(context.cachePosition);
1368
- // reset
1369
- context.reset();
1370
- if (this._$mode === "shape") {
1371
- context.setTransform(xScale, 0, 0, yScale, -baseBounds.xMin * xScale, -baseBounds.yMin * yScale);
1372
- }
1373
- else {
1374
- context.setTransform(1, 0, 0, 1, -baseBounds.xMin, -baseBounds.yMin);
1375
- }
1376
- if (hasGrid) {
1377
- const mScale = player.scaleX;
1378
- const baseMatrix = $getFloat32Array6(mScale, 0, 0, mScale, 0, 0);
1379
- const pMatrix = $multiplicationMatrix(baseMatrix, rawMatrix);
1380
- $poolFloat32Array6(baseMatrix);
1381
- const aMatrixBase = displayObject
1382
- ._$parent
1383
- ._$transform
1384
- .concatenatedMatrix
1385
- ._$matrix;
1386
- const aMatrix = $getFloat32Array6(aMatrixBase[0], aMatrixBase[1], aMatrixBase[2], aMatrixBase[3], aMatrixBase[4] * mScale - xMin, aMatrixBase[5] * mScale - yMin);
1387
- $poolFloat32Array6(aMatrixBase);
1388
- const apMatrix = $multiplicationMatrix(aMatrix, pMatrix);
1389
- const aOffsetX = apMatrix[4] - (matrix[4] - xMin);
1390
- const aOffsetY = apMatrix[5] - (matrix[5] - yMin);
1391
- $poolFloat32Array6(apMatrix);
1392
- const parentBounds = $boundsMatrix(baseBounds, pMatrix);
1393
- const parentXMax = +parentBounds.xMax;
1394
- const parentXMin = +parentBounds.xMin;
1395
- const parentYMax = +parentBounds.yMax;
1396
- const parentYMin = +parentBounds.yMin;
1397
- const parentWidth = $Math.ceil($Math.abs(parentXMax - parentXMin));
1398
- const parentHeight = $Math.ceil($Math.abs(parentYMax - parentYMin));
1399
- $poolBoundsObject(parentBounds);
1400
- const scale9Grid = displayObject._$scale9Grid;
1401
- const grid = {
1402
- "x": scale9Grid.x,
1403
- "y": scale9Grid.y,
1404
- "w": scale9Grid.width,
1405
- "h": scale9Grid.height
1406
- };
1407
- context.grid.enable(parentXMin, parentYMin, parentWidth, parentHeight, baseBounds, grid, mScale, pMatrix[0], pMatrix[1], pMatrix[2], pMatrix[3], pMatrix[4], pMatrix[5], aMatrix[0], aMatrix[1], aMatrix[2], aMatrix[3], aMatrix[4] - aOffsetX, aMatrix[5] - aOffsetY);
1408
- $poolFloat32Array6(pMatrix);
1409
- $poolFloat32Array6(aMatrix);
1410
- }
1411
- // execute
1412
- this._$doDraw(context, color_transform, false);
1413
- if (hasGrid) {
1414
- context.grid.disable();
1415
- }
1416
- manager.transferTexture(context.cachePosition);
1417
- // set cache
1418
- $cacheStore.set(this._$cacheKeys, context.cachePosition);
1419
- // end draw and reset current buffer
1420
- context._$bind(currentAttachment);
1421
- }
1422
- let offsetX = 0;
1423
- let offsetY = 0;
1424
- if (canApply) {
1425
- const bitmapTexture = this._$createBitmapTexture(context, context.cachePosition, xScale, yScale, width, height);
1426
- const position = displayObject._$drawFilter(context, matrix, filters, width, height, bitmapTexture);
1427
- if (position.offsetX) {
1428
- offsetX = position.offsetX;
1429
- }
1430
- if (position.offsetY) {
1431
- offsetY = position.offsetY;
1432
- }
1433
- // update
1434
- context.cachePosition = position;
1435
- }
1436
- if (!canApply && this._$mode === "bitmap") {
1437
- context.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], baseBounds.xMin * matrix[0] + baseBounds.yMin * matrix[2] + matrix[4], baseBounds.xMin * matrix[1] + baseBounds.yMin * matrix[3] + matrix[5]);
1438
- }
1439
- else {
1440
- const radianX = $Math.atan2(matrix[1], matrix[0]);
1441
- const radianY = $Math.atan2(-matrix[2], matrix[3]);
1442
- if (!canApply && (radianX || radianY)) {
1443
- const tx = baseBounds.xMin * xScale;
1444
- const ty = baseBounds.yMin * yScale;
1445
- const cosX = $Math.cos(radianX);
1446
- const sinX = $Math.sin(radianX);
1447
- const cosY = $Math.cos(radianY);
1448
- const sinY = $Math.sin(radianY);
1449
- context.setTransform(cosX, sinX, -sinY, cosY, tx * cosX - ty * sinY + matrix[4], tx * sinX + ty * cosY + matrix[5]);
1450
- }
1451
- else {
1452
- context.setTransform(1, 0, 0, 1, xMin - offsetX, yMin - offsetY);
1453
- }
1454
- }
1455
- // draw
1456
- if (context.cachePosition) {
1457
- context.globalAlpha = alpha;
1458
- context.imageSmoothingEnabled = this._$mode === "shape";
1459
- context.globalCompositeOperation = blend_mode;
1460
- context.drawInstance(xMin - offsetX, yMin - offsetY, xMax, yMax, color_transform);
1461
- // cache position clear
1462
- context.cachePosition = null;
1463
- }
1464
- // pool
1465
- $poolBoundsObject(baseBounds);
1466
- }
1467
- /**
1468
- * @return {WebGLTexture | null}
1469
- * @method
1470
- * @private
1471
- */
1472
- _$createBitmapTexture(context, position, x_scale, y_scale, width, height) {
1473
- if (this._$mode !== "bitmap") {
1474
- return null;
1475
- }
1476
- context.drawInstacedArray();
1477
- const manager = context.frameBuffer;
1478
- const currentAttachment = manager.currentAttachment;
1479
- const attachment = manager
1480
- .createCacheAttachment(width, height);
1481
- context._$bind(attachment);
1482
- context.reset();
1483
- const parentMatrix = $getFloat32Array6(x_scale, 0, 0, y_scale, width / 2, height / 2);
1484
- const texture = context.getTextureFromRect(position);
1485
- const baseMatrix = $getFloat32Array6(1, 0, 0, 1, -texture.width / 2, -texture.height / 2);
1486
- const scaleMatrix = $multiplicationMatrix(parentMatrix, baseMatrix);
1487
- $poolFloat32Array6(parentMatrix);
1488
- $poolFloat32Array6(baseMatrix);
1489
- context.setTransform(scaleMatrix[0], scaleMatrix[1], scaleMatrix[2], scaleMatrix[3], scaleMatrix[4], scaleMatrix[5]);
1490
- context.drawImage(texture, 0, 0, texture.width, texture.height);
1491
- const bitmapTexture = manager.getTextureFromCurrentAttachment();
1492
- context._$bind(currentAttachment);
1493
- manager.releaseAttachment(attachment);
1494
- manager.textureManager.release(texture);
1495
- return bitmapTexture;
1496
- }
1497
- /**
1498
- * @param {CanvasToWebGLContext} context
1499
- * @param {Float32Array} [color_transform=null]
1500
- * @param {boolean} [is_clip=false]
1501
- * @return {void}
1502
- * @method
1503
- * @private
1504
- */
1505
- _$doDraw(context, color_transform = null, is_clip = false) {
1506
- // draw
1507
- context.reset();
1508
- context.beginPath();
1509
- this._$runCommand(context, color_transform, is_clip);
1510
- }
1511
- /**
1512
- * @param {CanvasRenderingContext2D} context
1513
- * @param {Float32Array} matrix
1514
- * @param {object} options
1515
- * @param {boolean} [is_clip=false]
1516
- * @return {boolean}
1517
- * @method
1518
- * @private
1519
- */
1520
- _$hit(context, matrix, options, is_clip = false) {
1521
- context.beginPath();
1522
- context.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
1523
- return this._$runCommand(context, null, is_clip, options);
1524
- }
1525
- /**
1526
- * @return {object}
1527
- * @method
1528
- * @private
1529
- */
1530
- _$getBounds() {
1531
- const displayObject = this._$displayObject;
1532
- if (displayObject && displayObject._$bounds) {
1533
- return $getBoundsObject(displayObject._$bounds.xMin, displayObject._$bounds.xMax, displayObject._$bounds.yMin, displayObject._$bounds.yMax);
1534
- }
1535
- return $getBoundsObject(this._$xMin, this._$xMax, this._$yMin, this._$yMax);
1536
- }
1537
- /**
1538
- * @return {void}
1539
- * @method
1540
- * @private
1541
- */
1542
- _$restart() {
1543
- if (this._$displayObject) {
1544
- // reset
1545
- this._$displayObject._$posted = false;
1546
- if (!this._$displayObject._$isUpdated()) {
1547
- this._$displayObject._$doChanged();
1548
- $doUpdated();
1549
- $cacheStore.removeCache(this._$displayObject._$instanceId);
1550
- if (this._$displayObject._$characterId) {
1551
- $cacheStore.removeCache(this._$displayObject._$characterId);
1552
- }
1553
- }
1554
- }
1555
- }
1556
- /**
1557
- * @param {number} [x=0]
1558
- * @param {number} [y=0]
1559
- * @return {void}
1560
- * @method
1561
- * @private
1562
- */
1563
- _$setBounds(x = 0, y = 0) {
1564
- this._$setFillBounds(x, y);
1565
- if (this._$doLine) {
1566
- this._$setLineBounds(x, y);
1567
- }
1568
- }
1569
- /**
1570
- * @param {number} x
1571
- * @param {number} y
1572
- * @return {void}
1573
- * @method
1574
- * @private
1575
- */
1576
- _$setFillBounds(x = 0, y = 0) {
1577
- this._$xMin = $Math.min(this._$xMin, x);
1578
- this._$xMax = $Math.max(this._$xMax, x);
1579
- this._$yMin = $Math.min(this._$yMin, y);
1580
- this._$yMax = $Math.max(this._$yMax, y);
1581
- }
1582
- /**
1583
- * @param {number} x
1584
- * @param {number} y
1585
- * @return {void}
1586
- * @method
1587
- * @private
1588
- */
1589
- _$setLineBounds(x = 0, y = 0) {
1590
- this._$xMin = $Math.min(this._$xMin, $Math.min(x, this._$pointerX));
1591
- this._$xMax = $Math.max(this._$xMax, $Math.max(x, this._$pointerX));
1592
- this._$yMin = $Math.min(this._$yMin, $Math.min(y, this._$pointerY));
1593
- this._$yMax = $Math.max(this._$yMax, $Math.max(y, this._$pointerY));
1594
- // correction
1595
- const half = this._$lineWidth / 2;
1596
- const radian90 = 0.5 * $Math.PI;
1597
- const radian1 = $Math.atan2(y - this._$pointerY, x - this._$pointerX); // to end point
1598
- const radian2 = $Math.atan2(this._$pointerY - y, this._$pointerX - x); // to start point
1599
- const radian3 = radian1 + radian90;
1600
- const radian4 = radian1 - radian90;
1601
- const radian5 = radian2 + radian90;
1602
- const radian6 = radian2 - radian90;
1603
- // init
1604
- let x1 = x + half;
1605
- let x2 = -half + x;
1606
- let x3 = this._$pointerX + half;
1607
- let x4 = -half + this._$pointerX;
1608
- let y1 = y + half;
1609
- let y2 = -half + y;
1610
- let y3 = this._$pointerY + half;
1611
- let y4 = -half + this._$pointerY;
1612
- this._$xMin = $Math.min(this._$xMin, $Math.min(x1, $Math.min(x2, $Math.min(x3, x4))));
1613
- this._$xMax = $Math.max(this._$xMax, $Math.max(x1, $Math.max(x2, $Math.max(x3, x4))));
1614
- this._$yMin = $Math.min(this._$yMin, $Math.min(y1, $Math.min(y2, $Math.min(y3, y4))));
1615
- this._$yMax = $Math.max(this._$yMax, $Math.max(y1, $Math.max(y2, $Math.max(y3, y4))));
1616
- // pointer x
1617
- if ($Math.abs(radian3) % radian90 !== 0) {
1618
- x1 = x + $Math.cos(radian3) * half;
1619
- }
1620
- if ($Math.abs(radian4) % radian90 !== 0) {
1621
- x2 = x + $Math.cos(radian4) * half;
1622
- }
1623
- if ($Math.abs(radian5) % radian90 !== 0) {
1624
- x3 = this._$pointerX + $Math.cos(radian5) * half;
1625
- }
1626
- if ($Math.abs(radian6) % radian90 !== 0) {
1627
- x4 = this._$pointerX + $Math.cos(radian6) * half;
1628
- }
1629
- // pointer y
1630
- if (radian3 && $Math.abs(radian3) % $Math.PI !== 0) {
1631
- y1 = y + $Math.sin(radian3) * half;
1632
- }
1633
- if (radian4 && $Math.abs(radian4) % $Math.PI !== 0) {
1634
- y2 = y + $Math.sin(radian4) * half;
1635
- }
1636
- if (radian5 && $Math.abs(radian5) % $Math.PI !== 0) {
1637
- y3 = this._$pointerY + $Math.sin(radian5) * half;
1638
- }
1639
- if (radian6 && $Math.abs(radian6) % $Math.PI !== 0) {
1640
- y4 = this._$pointerY + $Math.sin(radian6) * half;
1641
- }
1642
- this._$xMin = $Math.min(this._$xMin, $Math.min(x1, $Math.min(x2, $Math.min(x3, x4))));
1643
- this._$xMax = $Math.max(this._$xMax, $Math.max(x1, $Math.max(x2, $Math.max(x3, x4))));
1644
- this._$yMin = $Math.min(this._$yMin, $Math.min(y1, $Math.min(y2, $Math.min(y3, y4))));
1645
- this._$yMax = $Math.max(this._$yMax, $Math.max(y1, $Math.max(y2, $Math.max(y3, y4))));
1646
- // case
1647
- switch (this._$caps) {
1648
- case "round":
1649
- if ($Math.abs(radian1) % radian90 !== 0) {
1650
- const rx1 = x + $Math.cos(radian1) * half;
1651
- this._$xMin = $Math.min(this._$xMin, rx1);
1652
- this._$xMax = $Math.max(this._$xMax, rx1);
1653
- }
1654
- if (radian1 && $Math.abs(radian1) % $Math.PI !== 0) {
1655
- const ry1 = y + $Math.sin(radian1) * half;
1656
- this._$yMin = $Math.min(this._$yMin, ry1);
1657
- this._$yMax = $Math.max(this._$yMax, ry1);
1658
- }
1659
- if ($Math.abs(radian2) % radian90 !== 0) {
1660
- const rx2 = this._$pointerX + $Math.cos(radian2) * half;
1661
- this._$xMin = $Math.min(this._$xMin, rx2);
1662
- this._$xMax = $Math.max(this._$xMax, rx2);
1663
- }
1664
- if (radian2 && $Math.abs(radian2) % $Math.PI !== 0) {
1665
- const ry2 = this._$pointerY + $Math.sin(radian2) * half;
1666
- this._$yMin = $Math.min(this._$yMin, ry2);
1667
- this._$yMax = $Math.max(this._$yMax, ry2);
1668
- }
1669
- break;
1670
- case "square":
1671
- if ($Math.abs(radian1) % radian90 !== 0) {
1672
- const r1cos = $Math.cos(radian1) * half;
1673
- const rx1 = x1 + r1cos;
1674
- const rx2 = x2 + r1cos;
1675
- this._$xMin = $Math.min(this._$xMin, $Math.min(rx1, rx2));
1676
- this._$xMax = $Math.max(this._$xMax, $Math.max(rx1, rx2));
1677
- }
1678
- if ($Math.abs(radian2) % radian90 !== 0) {
1679
- const r2cos = $Math.cos(radian2) * half;
1680
- const rx3 = x3 + r2cos;
1681
- const rx4 = x4 + r2cos;
1682
- this._$xMin = $Math.min(this._$xMin, $Math.min(rx3, rx4));
1683
- this._$xMax = $Math.max(this._$xMax, $Math.max(rx3, rx4));
1684
- }
1685
- if (radian1 && $Math.abs(radian1) % $Math.PI !== 0) {
1686
- const r1sin = $Math.sin(radian1) * half;
1687
- const ry1 = y1 + r1sin;
1688
- const ry2 = y2 + r1sin;
1689
- this._$yMin = $Math.min(this._$yMin, $Math.min(ry1, ry2));
1690
- this._$yMax = $Math.max(this._$yMax, $Math.max(ry1, ry2));
1691
- }
1692
- if (radian2 && $Math.abs(radian2) % $Math.PI !== 0) {
1693
- const r2sin = $Math.sin(radian2) * half;
1694
- const ry3 = y3 + r2sin;
1695
- const ry4 = y4 + r2sin;
1696
- this._$yMin = $Math.min(this._$yMin, $Math.min(ry3, ry4));
1697
- this._$yMax = $Math.max(this._$yMax, $Math.max(ry3, ry4));
1698
- }
1699
- break;
1700
- default:
1701
- break;
1702
- }
1703
- }
1704
- /**
1705
- * @param {array} data
1706
- * @method
1707
- * @private
1708
- */
1709
- _$margePath(data) {
1710
- if (this._$doFill && this._$fills) {
1711
- this._$fills.push(...data);
1712
- }
1713
- if (this._$doLine && this._$lines) {
1714
- this._$lines.push(...data);
1715
- }
1716
- $poolArray(data);
1717
- }
1718
- /**
1719
- * @return {string}
1720
- * @method
1721
- * @private
1722
- */
1723
- _$createCacheKey() {
1724
- if (this._$doLine) {
1725
- this.endLine();
1726
- }
1727
- // fixed logic
1728
- if (this._$doFill) {
1729
- this.endFill();
1730
- }
1731
- if (!this._$recode) {
1732
- return "";
1733
- }
1734
- const recodes = this._$getRecodes();
1735
- let hash = 0;
1736
- for (let idx = 0; idx < recodes.length; idx++) {
1737
- const chr = recodes[idx];
1738
- hash = (hash << 5) - hash + chr;
1739
- hash |= 0;
1740
- }
1741
- return `${hash}`;
1742
- }
1743
- /**
1744
- * @return {Float32Array}
1745
- * @method
1746
- * @private
1747
- */
1748
- _$getRecodes() {
1749
- // fixed logic
1750
- if (this._$doLine) {
1751
- this.endLine();
1752
- }
1753
- // fixed logic
1754
- if (this._$doFill) {
1755
- this.endFill();
1756
- }
1757
- if (!this._$recode) {
1758
- this._$recode = $getArray();
1759
- }
1760
- if (!this._$buffer) {
1761
- const array = $getArray();
1762
- const recode = this._$recode;
1763
- for (let idx = 0; idx < recode.length;) {
1764
- const type = recode[idx++];
1765
- array.push(type);
1766
- switch (type) {
1767
- case Graphics.BEGIN_PATH:
1768
- case Graphics.END_FILL:
1769
- case Graphics.END_STROKE:
1770
- case Graphics.CLOSE_PATH:
1771
- break;
1772
- case Graphics.MOVE_TO:
1773
- case Graphics.LINE_TO:
1774
- array.push(recode[idx++], recode[idx++]);
1775
- break;
1776
- case Graphics.CURVE_TO:
1777
- case Graphics.FILL_STYLE:
1778
- array.push(recode[idx++], recode[idx++], recode[idx++], recode[idx++]);
1779
- break;
1780
- case Graphics.CUBIC:
1781
- array.push(recode[idx++], recode[idx++], recode[idx++], recode[idx++], recode[idx++], recode[idx++]);
1782
- break;
1783
- case Graphics.STROKE_STYLE:
1784
- {
1785
- array.push(recode[idx++]);
1786
- const lineCap = recode[idx++];
1787
- switch (lineCap) {
1788
- case "none":
1789
- array.push(0);
1790
- break;
1791
- case "round":
1792
- array.push(1);
1793
- break;
1794
- case "square":
1795
- array.push(2);
1796
- break;
1797
- }
1798
- const lineJoin = recode[idx++];
1799
- switch (lineJoin) {
1800
- case "bevel":
1801
- array.push(0);
1802
- break;
1803
- case "miter":
1804
- array.push(1);
1805
- break;
1806
- case "round":
1807
- array.push(2);
1808
- break;
1809
- }
1810
- array.push(recode[idx++], // MITER LIMIT
1811
- recode[idx++], recode[idx++], recode[idx++], recode[idx++]);
1812
- }
1813
- break;
1814
- case Graphics.ARC:
1815
- array.push(recode[idx++], recode[idx++], recode[idx++]);
1816
- break;
1817
- case Graphics.GRADIENT_FILL:
1818
- {
1819
- const type = recode[idx++];
1820
- const stops = recode[idx++];
1821
- const matrix = recode[idx++];
1822
- const spread = recode[idx++];
1823
- const interpolation = recode[idx++];
1824
- const focal = recode[idx++];
1825
- array.push(type === "linear" ? 0 : 1);
1826
- array.push(stops.length);
1827
- for (let idx = 0; idx < stops.length; ++idx) {
1828
- const color = stops[idx];
1829
- array.push(color.ratio, color.R, color.G, color.B, color.A);
1830
- }
1831
- array.push(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
1832
- switch (spread) {
1833
- case "reflect":
1834
- array.push(0);
1835
- break;
1836
- case "repeat":
1837
- array.push(1);
1838
- break;
1839
- default:
1840
- array.push(2);
1841
- break;
1842
- }
1843
- array.push(interpolation === "linearRGB" ? 0 : 1);
1844
- array.push(focal);
1845
- }
1846
- break;
1847
- case Graphics.GRADIENT_STROKE:
1848
- {
1849
- array.push(recode[idx++]);
1850
- const lineCap = recode[idx++];
1851
- switch (lineCap) {
1852
- case "none":
1853
- array.push(0);
1854
- break;
1855
- case "round":
1856
- array.push(1);
1857
- break;
1858
- case "square":
1859
- array.push(2);
1860
- break;
1861
- }
1862
- const lineJoin = recode[idx++];
1863
- switch (lineJoin) {
1864
- case "bevel":
1865
- array.push(0);
1866
- break;
1867
- case "miter":
1868
- array.push(1);
1869
- break;
1870
- case "round":
1871
- array.push(2);
1872
- break;
1873
- }
1874
- // miterLimit
1875
- array.push(recode[idx++]);
1876
- const type = recode[idx++];
1877
- const stops = recode[idx++];
1878
- const matrix = recode[idx++];
1879
- const spread = recode[idx++];
1880
- const interpolation = recode[idx++];
1881
- const focal = recode[idx++];
1882
- array.push(type === "linear" ? 0 : 1);
1883
- array.push(stops.length);
1884
- for (let idx = 0; idx < stops.length; ++idx) {
1885
- const color = stops[idx];
1886
- array.push(color.ratio, color.R, color.G, color.B, color.A);
1887
- }
1888
- array.push(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
1889
- switch (spread) {
1890
- case "reflect":
1891
- array.push(0);
1892
- break;
1893
- case "repeat":
1894
- array.push(1);
1895
- break;
1896
- default:
1897
- array.push(2);
1898
- break;
1899
- }
1900
- array.push(interpolation === "linearRGB" ? 0 : 1);
1901
- array.push(focal);
1902
- }
1903
- break;
1904
- case Graphics.BITMAP_FILL:
1905
- {
1906
- const bitmapData = recode[idx++];
1907
- let buffer;
1908
- if (bitmapData.image !== null || bitmapData.canvas !== null) {
1909
- const canvas = $cacheStore.getCanvas();
1910
- const width = bitmapData.width;
1911
- const height = bitmapData.height;
1912
- canvas.width = width;
1913
- canvas.height = height;
1914
- const context = canvas.getContext("2d");
1915
- if (!context) {
1916
- throw new Error("the context is null.");
1917
- }
1918
- // @ts-ignore
1919
- context.drawImage(bitmapData.image || bitmapData.canvas, 0, 0);
1920
- buffer = new Uint8Array(context.getImageData(0, 0, width, height).data);
1921
- $cacheStore.destroy(context);
1922
- }
1923
- else if (bitmapData._$buffer !== null) {
1924
- buffer = bitmapData._$buffer;
1925
- }
1926
- else {
1927
- break;
1928
- }
1929
- array.push(bitmapData.width, bitmapData.height, this._$xMax - this._$xMin, this._$yMax - this._$yMin, buffer.length);
1930
- for (let idx = 0; idx < buffer.length; ++idx) {
1931
- array.push(buffer[idx]);
1932
- }
1933
- const matrix = recode[idx++];
1934
- if (matrix) {
1935
- array.push(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
1936
- }
1937
- else {
1938
- array.push(1, 0, 0, 1, 0, 0);
1939
- }
1940
- const repeat = recode[idx++];
1941
- array.push(repeat ? 1 : 0);
1942
- const smooth = recode[idx++];
1943
- array.push(smooth ? 1 : 0);
1944
- }
1945
- break;
1946
- case Graphics.BITMAP_STROKE:
1947
- {
1948
- array.push(recode[idx++]);
1949
- const lineCap = recode[idx++];
1950
- switch (lineCap) {
1951
- case "none":
1952
- array.push(0);
1953
- break;
1954
- case "round":
1955
- array.push(1);
1956
- break;
1957
- case "square":
1958
- array.push(2);
1959
- break;
1960
- }
1961
- const lineJoin = recode[idx++];
1962
- switch (lineJoin) {
1963
- case "bevel":
1964
- array.push(0);
1965
- break;
1966
- case "miter":
1967
- array.push(1);
1968
- break;
1969
- case "round":
1970
- array.push(2);
1971
- break;
1972
- }
1973
- // MITER LIMIT
1974
- array.push(recode[idx++]);
1975
- const bitmapData = recode[idx++];
1976
- let buffer;
1977
- if (bitmapData.image !== null || bitmapData.canvas !== null) {
1978
- const canvas = $cacheStore.getCanvas();
1979
- const width = bitmapData.width;
1980
- const height = bitmapData.height;
1981
- canvas.width = width;
1982
- canvas.height = height;
1983
- const context = canvas.getContext("2d");
1984
- if (!context) {
1985
- throw new Error("the context is null.");
1986
- }
1987
- // @ts-ignore
1988
- context.drawImage(bitmapData.image || bitmapData.canvas, 0, 0);
1989
- buffer = new Uint8Array(context.getImageData(0, 0, width, height).data);
1990
- $cacheStore.destroy(context);
1991
- }
1992
- else if (bitmapData._$buffer !== null) {
1993
- buffer = bitmapData._$buffer;
1994
- }
1995
- else {
1996
- break;
1997
- }
1998
- array.push(bitmapData.width, bitmapData.height, this._$xMax - this._$xMin, this._$yMax - this._$yMin, buffer.length);
1999
- for (let idx = 0; idx < buffer.length; ++idx) {
2000
- array.push(buffer[idx]);
2001
- }
2002
- const matrix = recode[idx++];
2003
- if (matrix) {
2004
- array.push(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
2005
- }
2006
- else {
2007
- array.push(1, 0, 0, 1, 0, 0);
2008
- }
2009
- const repeat = recode[idx++];
2010
- array.push(repeat ? 1 : 0);
2011
- const smooth = recode[idx++];
2012
- array.push(smooth ? 1 : 0);
2013
- }
2014
- break;
2015
- default:
2016
- break;
2017
- }
2018
- }
2019
- this._$buffer = new $Float32Array(array);
2020
- }
2021
- return this._$buffer.slice();
2022
- }
2023
- /**
2024
- * @param {CanvasToWebGLContext|CanvasRenderingContext2D} context
2025
- * @param {Float32Array} [color_transform=null]
2026
- * @param {boolean} [is_clip=false]
2027
- * @param {object} [options=null]
2028
- * @return {boolean}
2029
- * @method
2030
- * @private
2031
- */
2032
- _$runCommand(context, color_transform = null, is_clip = false, options = null) {
2033
- // fixed logic
2034
- if (this._$doLine) {
2035
- this.endLine();
2036
- }
2037
- // fixed logic
2038
- if (this._$doFill) {
2039
- this.endFill();
2040
- }
2041
- if (!this._$recode) {
2042
- return false;
2043
- }
2044
- const recode = this._$recode;
2045
- const length = recode.length;
2046
- for (let idx = 0; idx < length;) {
2047
- switch (recode[idx++]) {
2048
- case Graphics.BEGIN_PATH:
2049
- context.beginPath();
2050
- break;
2051
- case Graphics.MOVE_TO:
2052
- context.moveTo(recode[idx++], recode[idx++]);
2053
- break;
2054
- case Graphics.LINE_TO:
2055
- context.lineTo(recode[idx++], recode[idx++]);
2056
- break;
2057
- case Graphics.CURVE_TO:
2058
- context.quadraticCurveTo(recode[idx++], recode[idx++], recode[idx++], recode[idx++]);
2059
- break;
2060
- case Graphics.FILL_STYLE:
2061
- {
2062
- if (is_clip || options) {
2063
- idx += 4;
2064
- continue;
2065
- }
2066
- const color = $getFloat32Array4();
2067
- color[0] = recode[idx++] / 255;
2068
- color[1] = recode[idx++] / 255;
2069
- color[2] = recode[idx++] / 255;
2070
- color[3] = recode[idx++] / 255;
2071
- if (color_transform !== null) {
2072
- if (color_transform[7] !== 0) {
2073
- color[3] = $Math.max(0, $Math.min(color[3] * color_transform[7], 255)) / 255;
2074
- }
2075
- }
2076
- context.fillStyle = color;
2077
- }
2078
- break;
2079
- case Graphics.END_FILL:
2080
- if (options && "isPointInPath" in context
2081
- && context.isPointInPath(options.x, options.y)) {
2082
- return true;
2083
- }
2084
- if (!is_clip && !options) {
2085
- context.fill();
2086
- }
2087
- break;
2088
- case Graphics.STROKE_STYLE:
2089
- {
2090
- if (is_clip || options) {
2091
- idx += 8;
2092
- continue;
2093
- }
2094
- context.lineWidth = recode[idx++];
2095
- context.lineCap = recode[idx++];
2096
- context.lineJoin = recode[idx++];
2097
- context.miterLimit = recode[idx++];
2098
- const color = $getFloat32Array4();
2099
- color[0] = recode[idx++] / 255;
2100
- color[1] = recode[idx++] / 255;
2101
- color[2] = recode[idx++] / 255;
2102
- color[3] = recode[idx++] / 255;
2103
- if (color_transform !== null) {
2104
- if (color_transform[7] !== 0) {
2105
- color[3] = $Math.max(0, $Math.min(color[3] + color_transform[7], 255)) / 255;
2106
- }
2107
- }
2108
- context.strokeStyle = color;
2109
- }
2110
- break;
2111
- case Graphics.END_STROKE:
2112
- if (options && "isPointInStroke" in context
2113
- && context.isPointInStroke(options.x, options.y)) {
2114
- return true;
2115
- }
2116
- if (!is_clip && !options) {
2117
- context.stroke();
2118
- }
2119
- break;
2120
- case Graphics.CLOSE_PATH:
2121
- context.closePath();
2122
- break;
2123
- case Graphics.CUBIC:
2124
- context.bezierCurveTo(recode[idx++], recode[idx++], recode[idx++], recode[idx++], recode[idx++], recode[idx++]);
2125
- break;
2126
- case Graphics.ARC:
2127
- context.arc(recode[idx++], recode[idx++], recode[idx++], 0, 2 * $Math.PI);
2128
- break;
2129
- case Graphics.GRADIENT_FILL:
2130
- {
2131
- if (options && "isPointInPath" in context
2132
- && context.isPointInPath(options.x, options.y)) {
2133
- return true;
2134
- }
2135
- if (is_clip || options
2136
- || context instanceof CanvasRenderingContext2D // fixed logic
2137
- ) {
2138
- idx += 6;
2139
- continue;
2140
- }
2141
- const type = recode[idx++];
2142
- const stops = recode[idx++];
2143
- const matrix = recode[idx++];
2144
- const spread = recode[idx++];
2145
- const interpolation = recode[idx++];
2146
- const focal = recode[idx++];
2147
- let css;
2148
- if (type === "linear") {
2149
- const xy = $linearGradientXY(matrix);
2150
- css = context.createLinearGradient(xy[0], xy[1], xy[2], xy[3], interpolation, spread);
2151
- }
2152
- else {
2153
- context.save();
2154
- context.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
2155
- css = context.createRadialGradient(0, 0, 0, 0, 0, 819.2, interpolation, spread, focal);
2156
- }
2157
- for (let idx = 0; idx < stops.length; ++idx) {
2158
- const color = stops[idx];
2159
- let alpha = color.A;
2160
- if (color_transform) {
2161
- if (color_transform[7] !== 0) {
2162
- alpha = $Math.max(0, $Math.min(color.A + color_transform[7], 255)) | 0;
2163
- }
2164
- }
2165
- css.addColorStop(color.ratio, $getInt32Array4(color.R, color.G, color.B, alpha));
2166
- }
2167
- context.fillStyle = css;
2168
- context.fill();
2169
- if (type === "radial") {
2170
- context.restore();
2171
- }
2172
- }
2173
- break;
2174
- case Graphics.GRADIENT_STROKE:
2175
- {
2176
- if (options && "isPointInStroke" in context
2177
- && context.isPointInStroke(options.x, options.y)) {
2178
- return true;
2179
- }
2180
- if (is_clip || options
2181
- || context instanceof CanvasRenderingContext2D // fixed logic
2182
- ) {
2183
- idx += 12;
2184
- continue;
2185
- }
2186
- context.lineWidth = recode[idx++];
2187
- context.lineCap = recode[idx++];
2188
- context.lineJoin = recode[idx++];
2189
- context.miterLimit = recode[idx++];
2190
- const type = recode[idx++];
2191
- const stops = recode[idx++];
2192
- const matrix = recode[idx++];
2193
- const spread = recode[idx++];
2194
- const interpolation = recode[idx++];
2195
- const focal = recode[idx++];
2196
- let css;
2197
- if (type === "linear") {
2198
- const xy = $linearGradientXY(matrix);
2199
- css = context.createLinearGradient(xy[0], xy[1], xy[2], xy[3], interpolation, spread);
2200
- }
2201
- else {
2202
- context.save();
2203
- context.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
2204
- css = context.createRadialGradient(0, 0, 0, 0, 0, 819.2, interpolation, spread, focal);
2205
- }
2206
- for (let idx = 0; idx < stops.length; ++idx) {
2207
- const color = stops[idx];
2208
- let alpha = color.A;
2209
- if (color_transform) {
2210
- if (color_transform[7] !== 0) {
2211
- alpha = $Math.max(0, $Math.min(color.A + color_transform[7], 255)) | 0;
2212
- }
2213
- }
2214
- css.addColorStop(color.ratio, $getInt32Array4(color.R, color.G, color.B, alpha));
2215
- }
2216
- context.strokeStyle = css;
2217
- context.stroke();
2218
- if (type === "radial") {
2219
- context.restore();
2220
- }
2221
- }
2222
- break;
2223
- case Graphics.BITMAP_FILL:
2224
- {
2225
- if (options && "isPointInPath" in context
2226
- && context.isPointInPath(options.x, options.y)) {
2227
- return true;
2228
- }
2229
- if (is_clip || options
2230
- || context instanceof CanvasRenderingContext2D // fixed logic
2231
- ) {
2232
- idx += 6;
2233
- continue;
2234
- }
2235
- context.save();
2236
- const bitmapData = recode[idx++];
2237
- const matrix = recode[idx++];
2238
- const repeat = recode[idx++];
2239
- const smooth = recode[idx++];
2240
- if (matrix) {
2241
- context.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
2242
- }
2243
- const texture = bitmapData.getTexture();
2244
- if (!texture || !color_transform) {
2245
- break;
2246
- }
2247
- context.imageSmoothingEnabled = smooth;
2248
- if (this._$bitmapId
2249
- || bitmapData.width === this._$xMax - this._$xMin
2250
- && bitmapData.height === this._$yMax - this._$yMin) {
2251
- context.drawBitmap(texture);
2252
- }
2253
- else {
2254
- context.fillStyle = context.createPattern(texture, repeat, color_transform);
2255
- context.fill();
2256
- }
2257
- // restore
2258
- context.restore();
2259
- context.imageSmoothingEnabled = false;
2260
- }
2261
- break;
2262
- case Graphics.BITMAP_STROKE:
2263
- {
2264
- if (options && "isPointInStroke" in context
2265
- && context.isPointInStroke(options.x, options.y)) {
2266
- return true;
2267
- }
2268
- if (is_clip || options
2269
- || context instanceof CanvasRenderingContext2D // fixed logic
2270
- ) {
2271
- idx += 9;
2272
- continue;
2273
- }
2274
- context.save();
2275
- context.lineWidth = recode[idx++];
2276
- context.lineCap = recode[idx++];
2277
- context.lineJoin = recode[idx++];
2278
- context.miterLimit = recode[idx++];
2279
- const bitmapData = recode[idx++];
2280
- const matrix = recode[idx++];
2281
- const repeat = recode[idx++];
2282
- const smooth = recode[idx++];
2283
- if (matrix) {
2284
- context.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
2285
- }
2286
- const texture = bitmapData.getTexture();
2287
- if (!texture || !color_transform) {
2288
- break;
2289
- }
2290
- context.strokeStyle = context.createPattern(texture, repeat, color_transform);
2291
- context.imageSmoothingEnabled = smooth;
2292
- context.stroke();
2293
- // restore
2294
- context.restore();
2295
- context.imageSmoothingEnabled = false;
2296
- }
2297
- break;
2298
- default:
2299
- break;
2300
- }
2301
- }
2302
- return false;
2303
- }
2304
- }