@next2d/player 1.14.7 → 1.14.8

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 (415) hide show
  1. package/@types/next2d.d.ts +4 -0
  2. package/@types/window.d.ts +74 -0
  3. package/README.ja.md +8 -7
  4. package/README.md +17 -12
  5. package/dist/interface/AjaxEventImpl.d.ts +5 -0
  6. package/dist/interface/AjaxEventImpl.js +1 -0
  7. package/dist/interface/AjaxOptionImpl.d.ts +13 -0
  8. package/dist/interface/AjaxOptionImpl.js +1 -0
  9. package/dist/interface/AttachmentImpl.d.ts +11 -0
  10. package/dist/interface/AttachmentImpl.js +1 -0
  11. package/dist/interface/BitmapDataChannelImpl.d.ts +1 -0
  12. package/dist/interface/BitmapDataChannelImpl.js +1 -0
  13. package/dist/interface/BitmapDrawObjectImpl.d.ts +6 -0
  14. package/dist/interface/BitmapDrawObjectImpl.js +1 -0
  15. package/dist/interface/BitmapFilterTypeImpl.d.ts +1 -0
  16. package/dist/interface/BitmapFilterTypeImpl.js +1 -0
  17. package/dist/interface/BlendModeImpl.d.ts +1 -0
  18. package/dist/interface/BlendModeImpl.js +1 -0
  19. package/dist/interface/BoundsImpl.d.ts +6 -0
  20. package/dist/interface/BoundsImpl.js +1 -0
  21. package/dist/interface/Character.d.ts +2 -0
  22. package/dist/interface/Character.js +1 -0
  23. package/dist/interface/CharacterImpl.d.ts +2 -0
  24. package/dist/interface/CharacterImpl.js +1 -0
  25. package/dist/interface/ClassNameMap.d.ts +4 -0
  26. package/dist/interface/ClassNameMap.js +1 -0
  27. package/dist/interface/ClipObjectImpl.d.ts +14 -0
  28. package/dist/interface/ClipObjectImpl.js +1 -0
  29. package/dist/interface/ColorStopImpl.d.ts +7 -0
  30. package/dist/interface/ColorStopImpl.js +1 -0
  31. package/dist/interface/DictionaryTagImpl.d.ts +7 -0
  32. package/dist/interface/DictionaryTagImpl.js +1 -0
  33. package/dist/interface/DisplacementMapFilterModeImpl.d.ts +1 -0
  34. package/dist/interface/DisplacementMapFilterModeImpl.js +1 -0
  35. package/dist/interface/DisplayImpl.d.ts +28 -0
  36. package/dist/interface/DisplayImpl.js +1 -0
  37. package/dist/interface/DisplayObjectImpl.d.ts +2 -0
  38. package/dist/interface/DisplayObjectImpl.js +1 -0
  39. package/dist/interface/DragRulesImpl.d.ts +7 -0
  40. package/dist/interface/DragRulesImpl.js +1 -0
  41. package/dist/interface/DropTargetImpl.d.ts +2 -0
  42. package/dist/interface/DropTargetImpl.js +1 -0
  43. package/dist/interface/EventDispatcherImpl.d.ts +2 -0
  44. package/dist/interface/EventDispatcherImpl.js +1 -0
  45. package/dist/interface/EventListenerImpl.d.ts +6 -0
  46. package/dist/interface/EventListenerImpl.js +1 -0
  47. package/dist/interface/EventsImpl.d.ts +20 -0
  48. package/dist/interface/EventsImpl.js +1 -0
  49. package/dist/interface/FillMeshImpl.d.ts +5 -0
  50. package/dist/interface/FillMeshImpl.js +1 -0
  51. package/dist/interface/FilterArrayImpl.d.ts +10 -0
  52. package/dist/interface/FilterArrayImpl.js +1 -0
  53. package/dist/interface/FilterQualityImpl.d.ts +1 -0
  54. package/dist/interface/FilterQualityImpl.js +1 -0
  55. package/dist/interface/FiltersImpl.d.ts +20 -0
  56. package/dist/interface/FiltersImpl.js +1 -0
  57. package/dist/interface/GeomImpl.d.ts +12 -0
  58. package/dist/interface/GeomImpl.js +1 -0
  59. package/dist/interface/GradientTypeImpl.d.ts +3 -0
  60. package/dist/interface/GradientTypeImpl.js +1 -0
  61. package/dist/interface/GraphicsParentImpl.d.ts +2 -0
  62. package/dist/interface/GraphicsParentImpl.js +1 -0
  63. package/dist/interface/GridImpl.d.ts +6 -0
  64. package/dist/interface/GridImpl.js +1 -0
  65. package/dist/interface/ImageTypeImpl.d.ts +1 -0
  66. package/dist/interface/ImageTypeImpl.js +1 -0
  67. package/dist/interface/IndexRangeImpl.d.ts +4 -0
  68. package/dist/interface/IndexRangeImpl.js +1 -0
  69. package/dist/interface/LoaderInfoDataImpl.d.ts +7 -0
  70. package/dist/interface/LoaderInfoDataImpl.js +1 -0
  71. package/dist/interface/LoopConfigImpl.d.ts +8 -0
  72. package/dist/interface/LoopConfigImpl.js +1 -0
  73. package/dist/interface/LoopTypeImpl.d.ts +1 -0
  74. package/dist/interface/LoopTypeImpl.js +1 -0
  75. package/dist/interface/MediaImpl.d.ts +10 -0
  76. package/dist/interface/MediaImpl.js +1 -0
  77. package/dist/interface/MovieClipActionObjectImpl.d.ts +5 -0
  78. package/dist/interface/MovieClipActionObjectImpl.js +1 -0
  79. package/dist/interface/MovieClipCharacterImpl.d.ts +18 -0
  80. package/dist/interface/MovieClipCharacterImpl.js +1 -0
  81. package/dist/interface/MovieClipLabelObjectImpl.d.ts +4 -0
  82. package/dist/interface/MovieClipLabelObjectImpl.js +1 -0
  83. package/dist/interface/MovieClipSoundObjectImpl.d.ts +5 -0
  84. package/dist/interface/MovieClipSoundObjectImpl.js +1 -0
  85. package/dist/interface/NetImpl.d.ts +6 -0
  86. package/dist/interface/NetImpl.js +1 -0
  87. package/dist/interface/NoCodeDataImpl.d.ts +7 -0
  88. package/dist/interface/NoCodeDataImpl.js +1 -0
  89. package/dist/interface/NoCodeDataZlibImpl.d.ts +4 -0
  90. package/dist/interface/NoCodeDataZlibImpl.js +1 -0
  91. package/dist/interface/ParentImpl.d.ts +2 -0
  92. package/dist/interface/ParentImpl.js +1 -0
  93. package/dist/interface/PlaceObjectImpl.d.ts +12 -0
  94. package/dist/interface/PlaceObjectImpl.js +1 -0
  95. package/dist/interface/PlayerHitObjectImpl.d.ts +7 -0
  96. package/dist/interface/PlayerHitObjectImpl.js +1 -0
  97. package/dist/interface/PlayerModeImpl.d.ts +1 -0
  98. package/dist/interface/PlayerModeImpl.js +1 -0
  99. package/dist/interface/PlayerOptionsImpl.d.ts +8 -0
  100. package/dist/interface/PlayerOptionsImpl.js +1 -0
  101. package/dist/interface/PointImpl.d.ts +4 -0
  102. package/dist/interface/PointImpl.js +1 -0
  103. package/dist/interface/PreObjectImpl.d.ts +23 -0
  104. package/dist/interface/PreObjectImpl.js +1 -0
  105. package/dist/interface/PropertyContainerMessageImpl.d.ts +6 -0
  106. package/dist/interface/PropertyContainerMessageImpl.js +1 -0
  107. package/dist/interface/PropertyMessageImpl.d.ts +41 -0
  108. package/dist/interface/PropertyMessageImpl.js +1 -0
  109. package/dist/interface/PropertyMessageMapImpl.d.ts +2 -0
  110. package/dist/interface/PropertyMessageMapImpl.js +1 -0
  111. package/dist/interface/PropertyShapeMessageImpl.d.ts +6 -0
  112. package/dist/interface/PropertyShapeMessageImpl.js +1 -0
  113. package/dist/interface/PropertyTextMessageImpl.d.ts +25 -0
  114. package/dist/interface/PropertyTextMessageImpl.js +1 -0
  115. package/dist/interface/PropertyVideoMessageImpl.d.ts +5 -0
  116. package/dist/interface/PropertyVideoMessageImpl.js +1 -0
  117. package/dist/interface/RGBAImpl.d.ts +6 -0
  118. package/dist/interface/RGBAImpl.js +1 -0
  119. package/dist/interface/RenderDisplayObjectImpl.d.ts +2 -0
  120. package/dist/interface/RenderDisplayObjectImpl.js +1 -0
  121. package/dist/interface/ShapeCharacterImpl.d.ts +14 -0
  122. package/dist/interface/ShapeCharacterImpl.js +1 -0
  123. package/dist/interface/SoundCharacterImpl.d.ts +5 -0
  124. package/dist/interface/SoundCharacterImpl.js +1 -0
  125. package/dist/interface/SoundTagImpl.d.ts +6 -0
  126. package/dist/interface/SoundTagImpl.js +1 -0
  127. package/dist/interface/SpriteImpl.d.ts +2 -0
  128. package/dist/interface/SpriteImpl.js +1 -0
  129. package/dist/interface/StageDataImpl.d.ts +6 -0
  130. package/dist/interface/StageDataImpl.js +1 -0
  131. package/dist/interface/StageQualityImpl.d.ts +1 -0
  132. package/dist/interface/StageQualityImpl.js +1 -0
  133. package/dist/interface/StrokeMethImpl.d.ts +4 -0
  134. package/dist/interface/StrokeMethImpl.js +1 -0
  135. package/dist/interface/StrokeTypeImpl.d.ts +2 -0
  136. package/dist/interface/StrokeTypeImpl.js +1 -0
  137. package/dist/interface/SurfaceFilterImpl.d.ts +6 -0
  138. package/dist/interface/SurfaceFilterImpl.js +1 -0
  139. package/dist/interface/TextBreakObjectImpl.d.ts +9 -0
  140. package/dist/interface/TextBreakObjectImpl.js +1 -0
  141. package/dist/interface/TextCharacterImpl.d.ts +27 -0
  142. package/dist/interface/TextCharacterImpl.js +1 -0
  143. package/dist/interface/TextDataImpl.d.ts +2 -0
  144. package/dist/interface/TextDataImpl.js +1 -0
  145. package/dist/interface/TextFieldAutoSizeImpl.d.ts +1 -0
  146. package/dist/interface/TextFieldAutoSizeImpl.js +1 -0
  147. package/dist/interface/TextFieldTypeImpl.d.ts +1 -0
  148. package/dist/interface/TextFieldTypeImpl.js +1 -0
  149. package/dist/interface/TextFormatAlignImpl.d.ts +1 -0
  150. package/dist/interface/TextFormatAlignImpl.js +1 -0
  151. package/dist/interface/TextFormatImpl.d.ts +16 -0
  152. package/dist/interface/TextFormatImpl.js +1 -0
  153. package/dist/interface/TextFormatVerticalAlignImpl.d.ts +1 -0
  154. package/dist/interface/TextFormatVerticalAlignImpl.js +1 -0
  155. package/dist/interface/TextImageObjectImpl.d.ts +11 -0
  156. package/dist/interface/TextImageObjectImpl.js +1 -0
  157. package/dist/interface/TextImpl.d.ts +6 -0
  158. package/dist/interface/TextImpl.js +1 -0
  159. package/dist/interface/TextModeImpl.d.ts +1 -0
  160. package/dist/interface/TextModeImpl.js +1 -0
  161. package/dist/interface/TextObjectImpl.d.ts +7 -0
  162. package/dist/interface/TextObjectImpl.js +1 -0
  163. package/dist/interface/TextObjectModeImpl.d.ts +1 -0
  164. package/dist/interface/TextObjectModeImpl.js +1 -0
  165. package/dist/interface/TextStringObjectImpl.d.ts +7 -0
  166. package/dist/interface/TextStringObjectImpl.js +1 -0
  167. package/dist/interface/UIImpl.d.ts +8 -0
  168. package/dist/interface/UIImpl.js +1 -0
  169. package/dist/interface/URLLoaderDataFormatImpl.d.ts +1 -0
  170. package/dist/interface/URLLoaderDataFormatImpl.js +1 -0
  171. package/dist/interface/URLRequestMethodImpl.d.ts +1 -0
  172. package/dist/interface/URLRequestMethodImpl.js +1 -0
  173. package/dist/interface/UniformDataImpl.d.ts +5 -0
  174. package/dist/interface/UniformDataImpl.js +1 -0
  175. package/dist/interface/UnzipQueueImpl.d.ts +6 -0
  176. package/dist/interface/UnzipQueueImpl.js +1 -0
  177. package/dist/interface/VerticesImpl.d.ts +1 -0
  178. package/dist/interface/VerticesImpl.js +1 -0
  179. package/dist/interface/VideoCharacterImpl.d.ts +12 -0
  180. package/dist/interface/VideoCharacterImpl.js +1 -0
  181. package/dist/player/index.d.ts +1 -0
  182. package/dist/player/index.js +40 -0
  183. package/dist/player/next2d/display/BitmapData.d.ts +143 -0
  184. package/dist/player/next2d/display/BitmapData.js +390 -0
  185. package/dist/player/next2d/display/BlendMode.d.ts +204 -0
  186. package/dist/player/next2d/display/BlendMode.js +240 -0
  187. package/dist/player/next2d/display/DisplayObject.d.ts +571 -0
  188. package/dist/player/next2d/display/DisplayObject.js +1733 -0
  189. package/dist/player/next2d/display/DisplayObjectContainer.d.ts +351 -0
  190. package/dist/player/next2d/display/DisplayObjectContainer.js +1765 -0
  191. package/dist/player/next2d/display/FrameLabel.d.ts +98 -0
  192. package/dist/player/next2d/display/FrameLabel.js +122 -0
  193. package/dist/player/next2d/display/Graphics.d.ts +577 -0
  194. package/dist/player/next2d/display/Graphics.js +2193 -0
  195. package/dist/player/next2d/display/GraphicsBitmapFill.d.ts +49 -0
  196. package/dist/player/next2d/display/GraphicsBitmapFill.js +90 -0
  197. package/dist/player/next2d/display/GraphicsGradientFill.d.ts +66 -0
  198. package/dist/player/next2d/display/GraphicsGradientFill.js +162 -0
  199. package/dist/player/next2d/display/InteractiveObject.d.ts +32 -0
  200. package/dist/player/next2d/display/InteractiveObject.js +44 -0
  201. package/dist/player/next2d/display/Loader.d.ts +131 -0
  202. package/dist/player/next2d/display/Loader.js +324 -0
  203. package/dist/player/next2d/display/LoaderInfo.d.ts +122 -0
  204. package/dist/player/next2d/display/LoaderInfo.js +191 -0
  205. package/dist/player/next2d/display/LoopConfig.d.ts +108 -0
  206. package/dist/player/next2d/display/LoopConfig.js +160 -0
  207. package/dist/player/next2d/display/LoopType.d.ts +104 -0
  208. package/dist/player/next2d/display/LoopType.js +122 -0
  209. package/dist/player/next2d/display/MovieClip.d.ts +312 -0
  210. package/dist/player/next2d/display/MovieClip.js +959 -0
  211. package/dist/player/next2d/display/Shape.d.ts +167 -0
  212. package/dist/player/next2d/display/Shape.js +514 -0
  213. package/dist/player/next2d/display/Sprite.d.ts +174 -0
  214. package/dist/player/next2d/display/Sprite.js +288 -0
  215. package/dist/player/next2d/display/Stage.d.ts +164 -0
  216. package/dist/player/next2d/display/Stage.js +255 -0
  217. package/dist/player/next2d/events/Event.d.ts +424 -0
  218. package/dist/player/next2d/events/Event.js +569 -0
  219. package/dist/player/next2d/events/EventDispatcher.d.ts +138 -0
  220. package/dist/player/next2d/events/EventDispatcher.js +624 -0
  221. package/dist/player/next2d/events/EventPhase.d.ts +80 -0
  222. package/dist/player/next2d/events/EventPhase.js +94 -0
  223. package/dist/player/next2d/events/FocusEvent.d.ts +89 -0
  224. package/dist/player/next2d/events/FocusEvent.js +103 -0
  225. package/dist/player/next2d/events/HTTPStatusEvent.d.ts +107 -0
  226. package/dist/player/next2d/events/HTTPStatusEvent.js +142 -0
  227. package/dist/player/next2d/events/IOErrorEvent.d.ts +82 -0
  228. package/dist/player/next2d/events/IOErrorEvent.js +102 -0
  229. package/dist/player/next2d/events/MouseEvent.d.ts +163 -0
  230. package/dist/player/next2d/events/MouseEvent.js +207 -0
  231. package/dist/player/next2d/events/ProgressEvent.d.ts +97 -0
  232. package/dist/player/next2d/events/ProgressEvent.js +125 -0
  233. package/dist/player/next2d/events/VideoEvent.d.ts +145 -0
  234. package/dist/player/next2d/events/VideoEvent.js +183 -0
  235. package/dist/player/next2d/filters/BevelFilter.d.ts +254 -0
  236. package/dist/player/next2d/filters/BevelFilter.js +501 -0
  237. package/dist/player/next2d/filters/BitmapFilter.d.ts +75 -0
  238. package/dist/player/next2d/filters/BitmapFilter.js +96 -0
  239. package/dist/player/next2d/filters/BlurFilter.d.ts +150 -0
  240. package/dist/player/next2d/filters/BlurFilter.js +373 -0
  241. package/dist/player/next2d/filters/ColorMatrixFilter.d.ts +116 -0
  242. package/dist/player/next2d/filters/ColorMatrixFilter.js +180 -0
  243. package/dist/player/next2d/filters/ConvolutionFilter.d.ts +210 -0
  244. package/dist/player/next2d/filters/ConvolutionFilter.js +375 -0
  245. package/dist/player/next2d/filters/DisplacementMapFilter.d.ts +212 -0
  246. package/dist/player/next2d/filters/DisplacementMapFilter.js +381 -0
  247. package/dist/player/next2d/filters/DropShadowFilter.d.ts +240 -0
  248. package/dist/player/next2d/filters/DropShadowFilter.js +470 -0
  249. package/dist/player/next2d/filters/GlowFilter.d.ts +204 -0
  250. package/dist/player/next2d/filters/GlowFilter.js +362 -0
  251. package/dist/player/next2d/filters/GradientBevelFilter.d.ts +243 -0
  252. package/dist/player/next2d/filters/GradientBevelFilter.js +483 -0
  253. package/dist/player/next2d/filters/GradientGlowFilter.d.ts +243 -0
  254. package/dist/player/next2d/filters/GradientGlowFilter.js +473 -0
  255. package/dist/player/next2d/geom/ColorTransform.d.ts +201 -0
  256. package/dist/player/next2d/geom/ColorTransform.js +279 -0
  257. package/dist/player/next2d/geom/Matrix.d.ts +299 -0
  258. package/dist/player/next2d/geom/Matrix.js +455 -0
  259. package/dist/player/next2d/geom/Point.d.ts +213 -0
  260. package/dist/player/next2d/geom/Point.js +276 -0
  261. package/dist/player/next2d/geom/Rectangle.d.ts +364 -0
  262. package/dist/player/next2d/geom/Rectangle.js +517 -0
  263. package/dist/player/next2d/geom/Transform.d.ts +213 -0
  264. package/dist/player/next2d/geom/Transform.js +497 -0
  265. package/dist/player/next2d/media/Sound.d.ts +208 -0
  266. package/dist/player/next2d/media/Sound.js +515 -0
  267. package/dist/player/next2d/media/SoundMixer.d.ts +68 -0
  268. package/dist/player/next2d/media/SoundMixer.js +115 -0
  269. package/dist/player/next2d/media/SoundTransform.d.ts +80 -0
  270. package/dist/player/next2d/media/SoundTransform.js +113 -0
  271. package/dist/player/next2d/media/Video.d.ts +329 -0
  272. package/dist/player/next2d/media/Video.js +871 -0
  273. package/dist/player/next2d/net/URLRequest.d.ts +143 -0
  274. package/dist/player/next2d/net/URLRequest.js +239 -0
  275. package/dist/player/next2d/net/URLRequestHeader.d.ts +82 -0
  276. package/dist/player/next2d/net/URLRequestHeader.js +107 -0
  277. package/dist/player/next2d/text/TextField.d.ts +642 -0
  278. package/dist/player/next2d/text/TextField.js +2707 -0
  279. package/dist/player/next2d/text/TextFormat.d.ts +250 -0
  280. package/dist/player/next2d/text/TextFormat.js +473 -0
  281. package/dist/player/next2d/ui/Easing.d.ts +359 -0
  282. package/dist/player/next2d/ui/Easing.js +481 -0
  283. package/dist/player/next2d/ui/Job.d.ts +155 -0
  284. package/dist/player/next2d/ui/Job.js +344 -0
  285. package/dist/player/next2d/ui/Tween.d.ts +62 -0
  286. package/dist/player/next2d/ui/Tween.js +72 -0
  287. package/dist/player/packages/Display.d.ts +3 -0
  288. package/dist/player/packages/Display.js +36 -0
  289. package/dist/player/packages/Events.d.ts +3 -0
  290. package/dist/player/packages/Events.js +28 -0
  291. package/dist/player/packages/Filters.d.ts +3 -0
  292. package/dist/player/packages/Filters.js +28 -0
  293. package/dist/player/packages/Geom.d.ts +3 -0
  294. package/dist/player/packages/Geom.js +20 -0
  295. package/dist/player/packages/Media.d.ts +3 -0
  296. package/dist/player/packages/Media.js +18 -0
  297. package/dist/player/packages/Net.d.ts +3 -0
  298. package/dist/player/packages/Net.js +14 -0
  299. package/dist/player/packages/Text.d.ts +3 -0
  300. package/dist/player/packages/Text.js +14 -0
  301. package/dist/player/packages/UI.d.ts +3 -0
  302. package/dist/player/packages/UI.js +16 -0
  303. package/dist/player/player/Next2D.d.ts +71 -0
  304. package/dist/player/player/Next2D.js +206 -0
  305. package/dist/player/player/Player.d.ts +334 -0
  306. package/dist/player/player/Player.js +1912 -0
  307. package/dist/player/util/CacheStore.d.ts +115 -0
  308. package/dist/player/util/CacheStore.js +280 -0
  309. package/dist/player/util/Global.d.ts +23 -0
  310. package/dist/player/util/Global.js +67 -0
  311. package/dist/player/util/RenderUtil.d.ts +472 -0
  312. package/dist/player/util/RenderUtil.js +686 -0
  313. package/dist/player/util/Shortcut.d.ts +28 -0
  314. package/dist/player/util/Shortcut.js +28 -0
  315. package/dist/player/util/Util.d.ts +337 -0
  316. package/dist/player/util/Util.js +841 -0
  317. package/dist/renderer/RenderDisplayObject.d.ts +129 -0
  318. package/dist/renderer/RenderDisplayObject.js +567 -0
  319. package/dist/renderer/RenderDisplayObjectContainer.d.ts +70 -0
  320. package/dist/renderer/RenderDisplayObjectContainer.js +670 -0
  321. package/dist/renderer/RenderGlobal.d.ts +76 -0
  322. package/dist/renderer/RenderGlobal.js +88 -0
  323. package/dist/renderer/RenderGraphics.d.ts +90 -0
  324. package/dist/renderer/RenderGraphics.js +597 -0
  325. package/dist/renderer/RenderPlayer.d.ts +164 -0
  326. package/dist/renderer/RenderPlayer.js +421 -0
  327. package/dist/renderer/RenderShape.d.ts +32 -0
  328. package/dist/renderer/RenderShape.js +104 -0
  329. package/dist/renderer/RenderTextField.d.ts +119 -0
  330. package/dist/renderer/RenderTextField.js +709 -0
  331. package/dist/renderer/RenderVideo.d.ts +59 -0
  332. package/dist/renderer/RenderVideo.js +272 -0
  333. package/dist/webgl/BezierConverter.d.ts +59 -0
  334. package/dist/webgl/BezierConverter.js +107 -0
  335. package/dist/webgl/CanvasGradientToWebGL.d.ts +94 -0
  336. package/dist/webgl/CanvasGradientToWebGL.js +187 -0
  337. package/dist/webgl/CanvasPatternToWebGL.d.ts +39 -0
  338. package/dist/webgl/CanvasPatternToWebGL.js +70 -0
  339. package/dist/webgl/CanvasToWebGLContext.d.ts +596 -0
  340. package/dist/webgl/CanvasToWebGLContext.js +1453 -0
  341. package/dist/webgl/CanvasToWebGLContextBlend.d.ts +97 -0
  342. package/dist/webgl/CanvasToWebGLContextBlend.js +303 -0
  343. package/dist/webgl/CanvasToWebGLContextGrid.d.ts +74 -0
  344. package/dist/webgl/CanvasToWebGLContextGrid.js +314 -0
  345. package/dist/webgl/CanvasToWebGLContextMask.d.ts +113 -0
  346. package/dist/webgl/CanvasToWebGLContextMask.js +443 -0
  347. package/dist/webgl/CanvasToWebGLContextPath.d.ts +111 -0
  348. package/dist/webgl/CanvasToWebGLContextPath.js +213 -0
  349. package/dist/webgl/CanvasToWebGLContextStyle.d.ts +77 -0
  350. package/dist/webgl/CanvasToWebGLContextStyle.js +145 -0
  351. package/dist/webgl/ColorBufferPool.d.ts +58 -0
  352. package/dist/webgl/ColorBufferPool.js +137 -0
  353. package/dist/webgl/FrameBufferManager.d.ts +135 -0
  354. package/dist/webgl/FrameBufferManager.js +367 -0
  355. package/dist/webgl/StencilBufferPool.d.ts +56 -0
  356. package/dist/webgl/StencilBufferPool.js +147 -0
  357. package/dist/webgl/TextureManager.d.ts +130 -0
  358. package/dist/webgl/TextureManager.js +303 -0
  359. package/dist/webgl/VertexArrayObjectManager.d.ts +95 -0
  360. package/dist/webgl/VertexArrayObjectManager.js +289 -0
  361. package/dist/webgl/WebGLFillMeshGenerator.d.ts +31 -0
  362. package/dist/webgl/WebGLFillMeshGenerator.js +104 -0
  363. package/dist/webgl/WebGLStrokeMeshGenerator.d.ts +182 -0
  364. package/dist/webgl/WebGLStrokeMeshGenerator.js +510 -0
  365. package/dist/webgl/shader/CanvasToWebGLShader.d.ts +85 -0
  366. package/dist/webgl/shader/CanvasToWebGLShader.js +196 -0
  367. package/dist/webgl/shader/CanvasToWebGLShaderList.d.ts +70 -0
  368. package/dist/webgl/shader/CanvasToWebGLShaderList.js +115 -0
  369. package/dist/webgl/shader/GradientLUTGenerator.d.ts +36 -0
  370. package/dist/webgl/shader/GradientLUTGenerator.js +129 -0
  371. package/dist/webgl/shader/WebGLShaderUniform.d.ts +52 -0
  372. package/dist/webgl/shader/WebGLShaderUniform.js +168 -0
  373. package/dist/webgl/shader/fragment/FragmentShaderLibrary.d.ts +18 -0
  374. package/dist/webgl/shader/fragment/FragmentShaderLibrary.js +35 -0
  375. package/dist/webgl/shader/fragment/FragmentShaderSource.d.ts +29 -0
  376. package/dist/webgl/shader/fragment/FragmentShaderSource.js +99 -0
  377. package/dist/webgl/shader/fragment/FragmentShaderSourceBlend.d.ts +67 -0
  378. package/dist/webgl/shader/fragment/FragmentShaderSourceBlend.js +319 -0
  379. package/dist/webgl/shader/fragment/FragmentShaderSourceGradient.d.ts +44 -0
  380. package/dist/webgl/shader/fragment/FragmentShaderSourceGradient.js +114 -0
  381. package/dist/webgl/shader/fragment/FragmentShaderSourceGradientLUT.d.ts +14 -0
  382. package/dist/webgl/shader/fragment/FragmentShaderSourceGradientLUT.js +58 -0
  383. package/dist/webgl/shader/fragment/FragmentShaderSourceTexture.d.ts +12 -0
  384. package/dist/webgl/shader/fragment/FragmentShaderSourceTexture.js +36 -0
  385. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceBlurFilter.d.ts +12 -0
  386. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceBlurFilter.js +42 -0
  387. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.d.ts +11 -0
  388. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.js +35 -0
  389. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.d.ts +16 -0
  390. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.js +80 -0
  391. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.d.ts +15 -0
  392. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.js +106 -0
  393. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceFilter.d.ts +112 -0
  394. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceFilter.js +275 -0
  395. package/dist/webgl/shader/variants/BlendShaderVariantCollection.d.ts +99 -0
  396. package/dist/webgl/shader/variants/BlendShaderVariantCollection.js +242 -0
  397. package/dist/webgl/shader/variants/FilterShaderVariantCollection.d.ts +150 -0
  398. package/dist/webgl/shader/variants/FilterShaderVariantCollection.js +398 -0
  399. package/dist/webgl/shader/variants/GradientLUTShaderVariantCollection.d.ts +49 -0
  400. package/dist/webgl/shader/variants/GradientLUTShaderVariantCollection.js +110 -0
  401. package/dist/webgl/shader/variants/GradientShapeShaderVariantCollection.d.ts +61 -0
  402. package/dist/webgl/shader/variants/GradientShapeShaderVariantCollection.js +199 -0
  403. package/dist/webgl/shader/variants/ShapeShaderVariantCollection.d.ts +117 -0
  404. package/dist/webgl/shader/variants/ShapeShaderVariantCollection.js +430 -0
  405. package/dist/webgl/shader/vertex/VertexShaderLibrary.d.ts +18 -0
  406. package/dist/webgl/shader/vertex/VertexShaderLibrary.js +75 -0
  407. package/dist/webgl/shader/vertex/VertexShaderSource.d.ts +23 -0
  408. package/dist/webgl/shader/vertex/VertexShaderSource.js +92 -0
  409. package/dist/webgl/shader/vertex/VertexShaderSourceFill.d.ts +45 -0
  410. package/dist/webgl/shader/vertex/VertexShaderSourceFill.js +112 -0
  411. package/dist/webgl/shader/vertex/VertexShaderSourceStroke.d.ts +27 -0
  412. package/dist/webgl/shader/vertex/VertexShaderSourceStroke.js +149 -0
  413. package/package.json +31 -25
  414. package/SECURITY.md +0 -3
  415. package/next2d.js +0 -7
@@ -0,0 +1,1453 @@
1
+ import { CanvasToWebGLContextStyle } from "./CanvasToWebGLContextStyle";
2
+ import { FrameBufferManager } from "./FrameBufferManager";
3
+ import { CanvasToWebGLContextPath } from "./CanvasToWebGLContextPath";
4
+ import { CanvasToWebGLContextGrid } from "./CanvasToWebGLContextGrid";
5
+ import { CanvasToWebGLShaderList } from "./shader/CanvasToWebGLShaderList";
6
+ import { GradientLUTGenerator } from "./shader/GradientLUTGenerator";
7
+ import { VertexArrayObjectManager } from "./VertexArrayObjectManager";
8
+ import { CanvasToWebGLContextMask } from "./CanvasToWebGLContextMask";
9
+ import { CanvasToWebGLContextBlend } from "./CanvasToWebGLContextBlend";
10
+ import { CanvasPatternToWebGL } from "./CanvasPatternToWebGL";
11
+ import { CanvasGradientToWebGL } from "./CanvasGradientToWebGL";
12
+ import { WebGLFillMeshGenerator } from "./WebGLFillMeshGenerator";
13
+ import { $Math, $getFloat32Array9, $getArray, $clamp, $poolArray, $inverseMatrix, $getFloat32Array6, $poolFloat32Array9, $poolBoundsObject, $getBoundsObject } from "../player/util/RenderUtil";
14
+ /**
15
+ * @class
16
+ */
17
+ export class CanvasToWebGLContext {
18
+ _$gl;
19
+ _$maxTextureSize;
20
+ _$contextStyle;
21
+ _$cacheBounds;
22
+ _$matrix;
23
+ _$cacheAttachment;
24
+ _$stack;
25
+ _$globalAlpha;
26
+ _$imageSmoothingEnabled;
27
+ _$globalCompositeOperation;
28
+ _$clearColorR;
29
+ _$clearColorG;
30
+ _$clearColorB;
31
+ _$clearColorA;
32
+ _$viewportWidth;
33
+ _$viewportHeight;
34
+ _$frameBufferManager;
35
+ _$path;
36
+ _$grid;
37
+ _$offsetX;
38
+ _$offsetY;
39
+ _$blends;
40
+ _$positions;
41
+ _$isLayer;
42
+ _$shaderList;
43
+ _$gradientLUT;
44
+ _$vao;
45
+ _$mask;
46
+ _$blend;
47
+ _$maskBufferArray;
48
+ _$maskBoundsArray;
49
+ _$attachmentArray;
50
+ /**
51
+ * @param {WebGL2RenderingContext} gl
52
+ * @param {number} sample
53
+ * @constructor
54
+ * @public
55
+ */
56
+ constructor(gl, sample) {
57
+ /**
58
+ * @type {WebGL2RenderingContext}
59
+ * @private
60
+ */
61
+ this._$gl = gl;
62
+ /**
63
+ * @type {number}
64
+ * @private
65
+ */
66
+ const samples = $Math.min(sample, gl.getParameter(gl.MAX_SAMPLES));
67
+ /**
68
+ * @type {number}
69
+ * @private
70
+ */
71
+ this._$maxTextureSize = $Math.min(8192, gl.getParameter(gl.MAX_TEXTURE_SIZE)) - 2;
72
+ /**
73
+ * @type {CanvasToWebGLContextStyle}
74
+ * @private
75
+ */
76
+ this._$contextStyle = new CanvasToWebGLContextStyle();
77
+ /**
78
+ * @type {BoundsImpl}
79
+ * @private
80
+ */
81
+ this._$cacheBounds = $getBoundsObject();
82
+ /**
83
+ * @type {Float32Array}
84
+ * @private
85
+ */
86
+ this._$matrix = $getFloat32Array9(1, 0, 0, 0, 1, 0, 0, 0, 1);
87
+ /**
88
+ * @type {AttachmentImpl}
89
+ * @default null
90
+ * @private
91
+ */
92
+ this._$cacheAttachment = null;
93
+ /**
94
+ * @type {array}
95
+ * @private
96
+ */
97
+ this._$stack = [];
98
+ /**
99
+ * @type {number}
100
+ * @default 1
101
+ * @private
102
+ */
103
+ this._$globalAlpha = 1;
104
+ /**
105
+ * @type {boolean}
106
+ * @default false
107
+ * @private
108
+ */
109
+ this._$imageSmoothingEnabled = false;
110
+ /**
111
+ * @type {string}
112
+ * @default "normal"
113
+ * @private
114
+ */
115
+ this._$globalCompositeOperation = "normal";
116
+ /**
117
+ * @type {number}
118
+ * @default 1
119
+ * @private
120
+ */
121
+ this._$clearColorR = 1;
122
+ /**
123
+ * @type {number}
124
+ * @default 1
125
+ * @private
126
+ */
127
+ this._$clearColorG = 1;
128
+ /**
129
+ * @type {number}
130
+ * @default 1
131
+ * @private
132
+ */
133
+ this._$clearColorB = 1;
134
+ /**
135
+ * @type {number}
136
+ * @default 1
137
+ * @private
138
+ */
139
+ this._$clearColorA = 1;
140
+ /**
141
+ * @type {number}
142
+ * @default 0
143
+ * @private
144
+ */
145
+ this._$viewportWidth = 0;
146
+ /**
147
+ * @type {number}
148
+ * @default 0
149
+ * @private
150
+ */
151
+ this._$viewportHeight = 0;
152
+ /**
153
+ * @type {FrameBufferManager}
154
+ * @private
155
+ */
156
+ this._$frameBufferManager = new FrameBufferManager(gl, samples);
157
+ /**
158
+ * @type {CanvasToWebGLContextPath}
159
+ * @private
160
+ */
161
+ this._$path = new CanvasToWebGLContextPath();
162
+ /**
163
+ * @type {CanvasToWebGLContextGrid}
164
+ * @private
165
+ */
166
+ this._$grid = new CanvasToWebGLContextGrid();
167
+ /**
168
+ * @type {number}
169
+ * @default 0
170
+ * @private
171
+ */
172
+ this._$offsetX = 0;
173
+ /**
174
+ * @type {number}
175
+ * @default 0
176
+ * @private
177
+ */
178
+ this._$offsetY = 0;
179
+ /**
180
+ * @type {array}
181
+ * @private
182
+ */
183
+ this._$blends = $getArray();
184
+ /**
185
+ * @type {array}
186
+ * @private
187
+ */
188
+ this._$positions = $getArray();
189
+ /**
190
+ * @type {boolean}
191
+ * @default false
192
+ * @private
193
+ */
194
+ this._$isLayer = false;
195
+ /**
196
+ * @type {CanvasToWebGLShaderList}
197
+ * @private
198
+ */
199
+ this._$shaderList = new CanvasToWebGLShaderList(this, gl);
200
+ /**
201
+ * @type {GradientLUTGenerator}
202
+ * @private
203
+ */
204
+ this._$gradientLUT = new GradientLUTGenerator(this, gl);
205
+ /**
206
+ * @type {VertexArrayObjectManager}
207
+ * @private
208
+ */
209
+ this._$vao = new VertexArrayObjectManager(gl);
210
+ /**
211
+ * @type {CanvasToWebGLContextMask}
212
+ * @private
213
+ */
214
+ this._$mask = new CanvasToWebGLContextMask(this, gl);
215
+ /**
216
+ * @type {CanvasToWebGLContextBlend}
217
+ * @private
218
+ */
219
+ this._$blend = new CanvasToWebGLContextBlend(this, gl);
220
+ /**
221
+ * @type {array}
222
+ * @private
223
+ */
224
+ this._$maskBufferArray = [];
225
+ /**
226
+ * @type {array}
227
+ * @private
228
+ */
229
+ this._$maskBoundsArray = [];
230
+ /**
231
+ * @type {array}
232
+ * @private
233
+ */
234
+ this._$attachmentArray = [];
235
+ }
236
+ /**
237
+ * @return {void}
238
+ * @method
239
+ * @public
240
+ */
241
+ reset() {
242
+ // reset
243
+ this._$globalAlpha = 1;
244
+ this._$globalCompositeOperation = "normal";
245
+ this._$imageSmoothingEnabled = false;
246
+ // reset color
247
+ this._$contextStyle.clear();
248
+ }
249
+ /**
250
+ * @return {boolean}
251
+ * @public
252
+ */
253
+ get isLayer() {
254
+ return this._$isLayer;
255
+ }
256
+ /**
257
+ * @memberof CanvasToWebGLContext#
258
+ * @return {HTMLCanvasElement}
259
+ * @public
260
+ */
261
+ get canvas() {
262
+ return this._$gl.canvas;
263
+ }
264
+ /**
265
+ * @return {AttachmentImpl|null}
266
+ * @public
267
+ */
268
+ get cacheAttachment() {
269
+ return this._$cacheAttachment;
270
+ }
271
+ set cacheAttachment(attachment) {
272
+ this._$cacheAttachment = attachment;
273
+ }
274
+ /**
275
+ * @return {BoundsImpl}
276
+ * @readonly
277
+ * @public
278
+ */
279
+ get cacheBounds() {
280
+ return this._$cacheBounds;
281
+ }
282
+ /**
283
+ * @member {Float32Array|CanvasGradientToWebGL|CanvasPatternToWebGL}
284
+ * @public
285
+ */
286
+ get fillStyle() {
287
+ return this._$contextStyle.fillStyle;
288
+ }
289
+ set fillStyle(fill_style) {
290
+ this._$contextStyle.fillStyle = fill_style;
291
+ }
292
+ /**
293
+ * @member {Float32Array|CanvasGradientToWebGL|CanvasPatternToWebGL}
294
+ * @public
295
+ */
296
+ get strokeStyle() {
297
+ return this._$contextStyle.strokeStyle;
298
+ }
299
+ set strokeStyle(stroke_style) {
300
+ this._$contextStyle.strokeStyle = stroke_style;
301
+ }
302
+ /**
303
+ * @member {number}
304
+ * @public
305
+ */
306
+ get lineWidth() {
307
+ return this._$contextStyle.lineWidth;
308
+ }
309
+ set lineWidth(line_width) {
310
+ this._$contextStyle.lineWidth = line_width;
311
+ }
312
+ /**
313
+ * @member {string}
314
+ * @public
315
+ */
316
+ get lineCap() {
317
+ return this._$contextStyle.lineCap;
318
+ }
319
+ set lineCap(line_cap) {
320
+ this._$contextStyle.lineCap = line_cap;
321
+ }
322
+ /**
323
+ * @member {string}
324
+ * @public
325
+ */
326
+ get lineJoin() {
327
+ return this._$contextStyle.lineJoin;
328
+ }
329
+ set lineJoin(line_join) {
330
+ this._$contextStyle.lineJoin = line_join;
331
+ }
332
+ /**
333
+ * @member {number}
334
+ * @public
335
+ */
336
+ get miterLimit() {
337
+ return this._$contextStyle.miterLimit;
338
+ }
339
+ set miterLimit(miter_limit) {
340
+ this._$contextStyle.miterLimit = miter_limit;
341
+ }
342
+ /**
343
+ * @member {number}
344
+ * @public
345
+ */
346
+ get globalAlpha() {
347
+ return this._$globalAlpha;
348
+ }
349
+ set globalAlpha(global_alpha) {
350
+ this._$globalAlpha = $clamp(global_alpha, 0, 1, 1);
351
+ }
352
+ /**
353
+ * @member {boolean}
354
+ * @public
355
+ */
356
+ get imageSmoothingEnabled() {
357
+ return this._$imageSmoothingEnabled;
358
+ }
359
+ set imageSmoothingEnabled(image_smoothing_enabled) {
360
+ this._$imageSmoothingEnabled = image_smoothing_enabled;
361
+ }
362
+ /**
363
+ * @member {BlendModeImpl}
364
+ * @public
365
+ */
366
+ get globalCompositeOperation() {
367
+ return this._$globalCompositeOperation;
368
+ }
369
+ set globalCompositeOperation(global_composite_operation) {
370
+ this._$globalCompositeOperation = global_composite_operation;
371
+ }
372
+ /**
373
+ * @member {FrameBufferManager}
374
+ * @readonly
375
+ * @public
376
+ */
377
+ get frameBuffer() {
378
+ return this._$frameBufferManager;
379
+ }
380
+ /**
381
+ * @member {CanvasToWebGLShaderList}
382
+ * @readonly
383
+ * @public
384
+ */
385
+ get shaderList() {
386
+ return this._$shaderList;
387
+ }
388
+ /**
389
+ * @member {CanvasToWebGLContextPath}
390
+ * @readonly
391
+ * @public
392
+ */
393
+ get path() {
394
+ return this._$path;
395
+ }
396
+ /**
397
+ * @member {CanvasToWebGLContextGrid}
398
+ * @readonly
399
+ * @public
400
+ */
401
+ get grid() {
402
+ return this._$grid;
403
+ }
404
+ /**
405
+ * @member {VertexArrayObjectManager}
406
+ * @readonly
407
+ * @public
408
+ */
409
+ get vao() {
410
+ return this._$vao;
411
+ }
412
+ /**
413
+ * @member {CanvasToWebGLContextBlend}
414
+ * @readonly
415
+ * @public
416
+ */
417
+ get blend() {
418
+ return this._$blend;
419
+ }
420
+ /**
421
+ * @return {object}
422
+ * @private
423
+ */
424
+ _$getCurrentPosition() {
425
+ return this._$positions[this._$positions.length - 1];
426
+ }
427
+ /**
428
+ * @description textureの最大描画可能サイズからリサイズの比率を算出して返す
429
+ * Calculate and return the resize ratio from the maximum drawable size of texture
430
+ *
431
+ * @param {number} width
432
+ * @param {number} height
433
+ * @return {number}
434
+ * @method
435
+ * @public
436
+ */
437
+ _$getTextureScale(width, height) {
438
+ const maxSize = $Math.max(width, height);
439
+ if (maxSize > this._$maxTextureSize) {
440
+ return this._$maxTextureSize / maxSize;
441
+ }
442
+ return 1;
443
+ }
444
+ /**
445
+ * @param {object} [attachment = null]
446
+ * @return {void}
447
+ * @method
448
+ * @public
449
+ */
450
+ _$bind(attachment = null) {
451
+ if (!attachment) {
452
+ return;
453
+ }
454
+ this._$frameBufferManager.bind(attachment);
455
+ const colorBuffer = attachment.color;
456
+ const stencilBuffer = attachment.stencil;
457
+ const width = attachment.width;
458
+ const height = attachment.height;
459
+ if (this._$viewportWidth !== width || this._$viewportHeight !== height) {
460
+ this._$viewportWidth = width;
461
+ this._$viewportHeight = height;
462
+ this._$gl.viewport(0, 0, width, height);
463
+ }
464
+ // カラーバッファorステンシルバッファが、未初期化の場合はクリアする
465
+ if (colorBuffer && colorBuffer.dirty
466
+ || stencilBuffer && stencilBuffer.dirty) {
467
+ if (colorBuffer) {
468
+ colorBuffer.dirty = false;
469
+ }
470
+ if (stencilBuffer) {
471
+ stencilBuffer.dirty = false;
472
+ }
473
+ this._$gl.clearColor(0, 0, 0, 0);
474
+ this.clearRect(0, 0, this._$viewportWidth, this._$viewportHeight);
475
+ this._$gl.clearColor(this._$clearColorR, this._$clearColorG, this._$clearColorB, this._$clearColorA);
476
+ this._$mask._$onClear(attachment.mask);
477
+ }
478
+ this._$mask._$onBind(attachment.mask);
479
+ }
480
+ /**
481
+ * @param {number} a
482
+ * @param {number} b
483
+ * @param {number} c
484
+ * @param {number} d
485
+ * @param {number} e
486
+ * @param {number} f
487
+ * @return {void}
488
+ * @method
489
+ * @public
490
+ */
491
+ setTransform(a, b, c, d, e, f) {
492
+ this._$matrix[0] = a;
493
+ this._$matrix[1] = b;
494
+ this._$matrix[3] = c;
495
+ this._$matrix[4] = d;
496
+ this._$matrix[6] = e;
497
+ this._$matrix[7] = f;
498
+ }
499
+ /**
500
+ * @param {number} width
501
+ * @param {number} height
502
+ * @return {void}
503
+ * @method
504
+ * @public
505
+ */
506
+ setMaxSize(width, height) {
507
+ this._$frameBufferManager.setMaxSize(width, height);
508
+ }
509
+ /**
510
+ * @param {number} a
511
+ * @param {number} b
512
+ * @param {number} c
513
+ * @param {number} d
514
+ * @param {number} e
515
+ * @param {number} f
516
+ * @return {void}
517
+ * @method
518
+ * @public
519
+ */
520
+ transform(a, b, c, d, e, f) {
521
+ const a00 = this._$matrix[0];
522
+ const a01 = this._$matrix[1];
523
+ const a10 = this._$matrix[3];
524
+ const a11 = this._$matrix[4];
525
+ const a20 = this._$matrix[6];
526
+ const a21 = this._$matrix[7];
527
+ this._$matrix[0] = a * a00 + b * a10;
528
+ this._$matrix[1] = a * a01 + b * a11;
529
+ this._$matrix[3] = c * a00 + d * a10;
530
+ this._$matrix[4] = c * a01 + d * a11;
531
+ this._$matrix[6] = e * a00 + f * a10 + a20;
532
+ this._$matrix[7] = e * a01 + f * a11 + a21;
533
+ }
534
+ /**
535
+ * @param {WebGLTexture} image
536
+ * @param {number} x
537
+ * @param {number} y
538
+ * @param {number} w
539
+ * @param {number} h
540
+ * @param {Float32Array} [color_transform=null]
541
+ * @return {void}
542
+ * @method
543
+ * @public
544
+ */
545
+ drawImage(image, x, y, w, h, color_transform = null) {
546
+ let ct0 = 1;
547
+ let ct1 = 1;
548
+ let ct2 = 1;
549
+ let ct4 = 0;
550
+ let ct5 = 0;
551
+ let ct6 = 0;
552
+ const ct3 = this._$globalAlpha;
553
+ const ct7 = 0;
554
+ if (color_transform) {
555
+ ct0 = color_transform[0];
556
+ ct1 = color_transform[1];
557
+ ct2 = color_transform[2];
558
+ ct4 = color_transform[4] / 255;
559
+ ct5 = color_transform[5] / 255;
560
+ ct6 = color_transform[6] / 255;
561
+ }
562
+ this.blend.drawImage(image, x, y, w, h, ct0, ct1, ct2, ct3, ct4, ct5, ct6, ct7, this._$globalCompositeOperation, this._$viewportWidth, this._$viewportHeight, this._$matrix, this._$imageSmoothingEnabled);
563
+ }
564
+ /**
565
+ * @param {number} r
566
+ * @param {number} g
567
+ * @param {number} b
568
+ * @param {number} a
569
+ * @return {void}
570
+ * @method
571
+ * @public
572
+ */
573
+ _$setColor(r = 0, g = 0, b = 0, a = 0) {
574
+ this._$clearColorR = r;
575
+ this._$clearColorG = g;
576
+ this._$clearColorB = b;
577
+ this._$clearColorA = a;
578
+ this._$gl.clearColor(r, g, b, a);
579
+ }
580
+ /**
581
+ * @param {number} x
582
+ * @param {number} y
583
+ * @param {number} w
584
+ * @param {number} h
585
+ * @return {void}
586
+ * @method
587
+ * @public
588
+ */
589
+ clearRect(x, y, w, h) {
590
+ this._$mask._$onClearRect();
591
+ this._$gl.enable(this._$gl.SCISSOR_TEST);
592
+ this._$gl.scissor(x, y, w, h);
593
+ this._$gl.clear(this._$gl.COLOR_BUFFER_BIT | this._$gl.STENCIL_BUFFER_BIT);
594
+ this._$gl.disable(this._$gl.SCISSOR_TEST);
595
+ }
596
+ /**
597
+ * @param {number} x
598
+ * @param {number} y
599
+ * @param {number} w
600
+ * @param {number} h
601
+ * @return {void}
602
+ * @method
603
+ * @public
604
+ */
605
+ _$clearRectStencil(x, y, w, h) {
606
+ this._$mask._$onClearRect();
607
+ this._$gl.enable(this._$gl.SCISSOR_TEST);
608
+ this._$gl.scissor(x, y, w, h);
609
+ this._$gl.clear(this._$gl.STENCIL_BUFFER_BIT);
610
+ this._$gl.disable(this._$gl.SCISSOR_TEST);
611
+ }
612
+ /**
613
+ * @param {number} x
614
+ * @param {number} y
615
+ * @return {void}
616
+ * @method
617
+ * @public
618
+ */
619
+ moveTo(x, y) {
620
+ this._$path.moveTo(x, y);
621
+ }
622
+ /**
623
+ * @param {number} x
624
+ * @param {number} y
625
+ * @return {void}
626
+ * @method
627
+ * @public
628
+ */
629
+ lineTo(x, y) {
630
+ this._$path.lineTo(x, y);
631
+ }
632
+ /**
633
+ * @return {void}
634
+ * @method
635
+ * @public
636
+ */
637
+ beginPath() {
638
+ this._$path.begin();
639
+ }
640
+ /**
641
+ * @param {number} cx
642
+ * @param {number} cy
643
+ * @param {number} x
644
+ * @param {number} y
645
+ * @return {void}
646
+ * @method
647
+ * @public
648
+ */
649
+ quadraticCurveTo(cx, cy, x, y) {
650
+ this._$path.quadTo(cx, cy, x, y);
651
+ }
652
+ /**
653
+ * @param {number} cp1x
654
+ * @param {number} cp1y
655
+ * @param {number} cp2x
656
+ * @param {number} cp2y
657
+ * @param {number} dx
658
+ * @param {number} dy
659
+ * @return {void}
660
+ * @method
661
+ * @public
662
+ */
663
+ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, dx, dy) {
664
+ this._$path.cubicTo(cp1x, cp1y, cp2x, cp2y, dx, dy);
665
+ }
666
+ /**
667
+ * @return {void}
668
+ * @method
669
+ * @public
670
+ */
671
+ fill() {
672
+ // to triangle
673
+ const fillVertices = this._$path.vertices;
674
+ if (!fillVertices.length) {
675
+ return;
676
+ }
677
+ const checkVertices = $getArray();
678
+ for (let idx = 0; idx < fillVertices.length; ++idx) {
679
+ const vertices = fillVertices[idx];
680
+ if (10 > vertices.length) {
681
+ continue;
682
+ }
683
+ checkVertices.push(vertices);
684
+ }
685
+ if (!checkVertices.length) {
686
+ $poolArray(checkVertices);
687
+ return;
688
+ }
689
+ const fillVertexArrayObject = this._$vao.createFill(checkVertices);
690
+ const fillStyle = this.fillStyle;
691
+ let matrix = this._$matrix;
692
+ let texture;
693
+ let variants;
694
+ let shader;
695
+ const hasGrid = this._$grid.enabled;
696
+ if (fillStyle instanceof CanvasGradientToWebGL) {
697
+ const stops = fillStyle.stops;
698
+ const isLinearSpace = fillStyle.rgb === "linearRGB";
699
+ texture = this
700
+ ._$gradientLUT
701
+ .generateForShape(stops, isLinearSpace);
702
+ this
703
+ ._$frameBufferManager
704
+ .textureManager
705
+ .bind0(texture, true);
706
+ variants = this
707
+ ._$shaderList
708
+ .gradientShapeShaderVariants;
709
+ if (fillStyle.type === "linear") {
710
+ shader = variants
711
+ .getGradientShapeShader(false, hasGrid, false, false, fillStyle.mode);
712
+ variants.setGradientShapeUniform(shader.uniform, false, 0, 0, 0, hasGrid, matrix, $inverseMatrix(this._$matrix), this._$viewportWidth, this._$viewportHeight, this._$grid, false, fillStyle.points, 0);
713
+ }
714
+ else {
715
+ matrix = this._$stack[this._$stack.length - 1];
716
+ const hasFocalPoint = fillStyle.focalPointRatio !== 0;
717
+ shader = variants
718
+ .getGradientShapeShader(false, hasGrid, true, hasFocalPoint, fillStyle.mode);
719
+ variants.setGradientShapeUniform(shader.uniform, false, 0, 0, 0, hasGrid, matrix, $inverseMatrix(this._$matrix), this._$viewportWidth, this._$viewportHeight, this._$grid, true, fillStyle.points, fillStyle.focalPointRatio);
720
+ }
721
+ }
722
+ else if (fillStyle instanceof CanvasPatternToWebGL) {
723
+ matrix = this._$stack[this._$stack.length - 1];
724
+ const pct = fillStyle.colorTransform;
725
+ texture = fillStyle.texture;
726
+ this
727
+ ._$frameBufferManager
728
+ .textureManager
729
+ .bind0(texture, this._$imageSmoothingEnabled);
730
+ variants = this
731
+ ._$shaderList
732
+ .shapeShaderVariants;
733
+ shader = variants
734
+ .getBitmapShapeShader(false, fillStyle.repeat, hasGrid);
735
+ if (pct) {
736
+ variants.setBitmapShapeUniform(shader.uniform, false, 0, 0, 0, hasGrid, matrix, $inverseMatrix(this._$matrix), this._$viewportWidth, this._$viewportHeight, this._$grid, texture.width, texture.height, pct[0], pct[1], pct[2], this._$globalAlpha, pct[4] / 255, pct[5] / 255, pct[6] / 255, 0);
737
+ }
738
+ else {
739
+ variants.setBitmapShapeUniform(shader.uniform, false, 0, 0, 0, hasGrid, matrix, $inverseMatrix(this._$matrix), this._$viewportWidth, this._$viewportHeight, this._$grid, texture.width, texture.height, 1, 1, 1, this._$globalAlpha, 0, 0, 0, 0);
740
+ }
741
+ }
742
+ else {
743
+ variants = this
744
+ ._$shaderList
745
+ .shapeShaderVariants;
746
+ shader = variants
747
+ .getSolidColorShapeShader(false, this._$grid.enabled);
748
+ variants.setSolidColorShapeUniform(shader.uniform, false, 0, 0, 0, hasGrid, matrix, this._$viewportWidth, this._$viewportHeight, this._$grid, fillStyle, this._$globalAlpha);
749
+ }
750
+ const coverageVariants = this
751
+ ._$shaderList
752
+ .shapeShaderVariants;
753
+ const coverageShader = coverageVariants
754
+ .getMaskShapeShader(false, hasGrid);
755
+ coverageVariants.setMaskShapeUniform(coverageShader.uniform, hasGrid, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], matrix[8], this._$viewportWidth, this._$viewportHeight, this._$grid);
756
+ // mask on
757
+ this._$gl.enable(this._$gl.STENCIL_TEST);
758
+ this._$gl.stencilMask(0xff);
759
+ // draw shape
760
+ this._$gl.enable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE);
761
+ this._$gl.stencilFunc(this._$gl.ALWAYS, 0, 0xff);
762
+ this._$gl.stencilOp(this._$gl.KEEP, this._$gl.INVERT, this._$gl.INVERT);
763
+ this._$gl.colorMask(false, false, false, false);
764
+ coverageShader._$fill(fillVertexArrayObject);
765
+ this._$gl.disable(this._$gl.SAMPLE_ALPHA_TO_COVERAGE);
766
+ // draw shape range
767
+ this._$gl.stencilFunc(this._$gl.NOTEQUAL, 0, 0xff);
768
+ this._$gl.stencilOp(this._$gl.KEEP, this._$gl.ZERO, this._$gl.ZERO);
769
+ this._$gl.colorMask(true, true, true, true);
770
+ shader._$fill(fillVertexArrayObject);
771
+ // mask off
772
+ this._$gl.disable(this._$gl.STENCIL_TEST);
773
+ // release vertex array
774
+ this.releaseFillVertexArray(fillVertexArrayObject);
775
+ }
776
+ /**
777
+ * @param {WebGLVertexArrayObject} vertex_array
778
+ * @return {void}
779
+ * @method
780
+ * @public
781
+ */
782
+ releaseFillVertexArray(vertex_array) {
783
+ // release shape vertex array object
784
+ this._$vao.releaseFill(vertex_array);
785
+ const indexRanges = vertex_array.indexRanges;
786
+ for (let idx = 0; idx < indexRanges.length; ++idx) {
787
+ WebGLFillMeshGenerator
788
+ .indexRangePool
789
+ .push(indexRanges[idx]);
790
+ }
791
+ $poolArray(indexRanges);
792
+ }
793
+ /**
794
+ * @return {void}
795
+ * @method
796
+ * @public
797
+ */
798
+ _$enterClip() {
799
+ this._$mask._$enterClip();
800
+ }
801
+ /**
802
+ * @return {void}
803
+ * @method
804
+ * @public
805
+ */
806
+ _$beginClipDef() {
807
+ this._$mask._$beginClipDef();
808
+ }
809
+ /**
810
+ * @param {boolean} flag
811
+ * @return {void}
812
+ * @method
813
+ * @private
814
+ */
815
+ _$updateContainerClipFlag(flag) {
816
+ this._$mask.containerClip = flag;
817
+ }
818
+ /**
819
+ * @description マスク処理の開始関数
820
+ * Mask processing start function
821
+ *
822
+ * @param {Float32Array} matrix
823
+ * @param {object} bounds
824
+ * @return {Float32Array}
825
+ * @method
826
+ * @public
827
+ */
828
+ _$startClip(matrix, bounds) {
829
+ let x = bounds.xMin;
830
+ let y = bounds.yMin;
831
+ let width = Math.abs(bounds.xMax - bounds.xMin);
832
+ let height = Math.abs(bounds.yMax - bounds.yMin);
833
+ // resize
834
+ const manager = this._$frameBufferManager;
835
+ const currentAttachment = manager.currentAttachment;
836
+ if (!currentAttachment || !currentAttachment.texture) {
837
+ throw new Error("the current Attachment is null.");
838
+ }
839
+ if (x > currentAttachment.width
840
+ || y > currentAttachment.height) {
841
+ return null;
842
+ }
843
+ if (width + x > currentAttachment.width) {
844
+ width = currentAttachment.width - x;
845
+ }
846
+ if (height + y > currentAttachment.height) {
847
+ height = currentAttachment.height - y;
848
+ }
849
+ if (0 > x) {
850
+ width += x;
851
+ x = 0;
852
+ }
853
+ if (0 > y) {
854
+ height += y;
855
+ y = 0;
856
+ }
857
+ if (0 >= width || 0 >= height) {
858
+ return null;
859
+ }
860
+ width = $Math.ceil(width);
861
+ height = $Math.ceil(height);
862
+ this._$cacheBounds.xMin = x;
863
+ this._$cacheBounds.yMin = y;
864
+ this._$cacheBounds.xMax = width;
865
+ this._$cacheBounds.yMax = height;
866
+ this._$cacheAttachment = currentAttachment;
867
+ // create new buffer
868
+ this._$bind(manager.createCacheAttachment(width, height, true));
869
+ // draw background
870
+ const texture = currentAttachment.texture;
871
+ this.reset();
872
+ this.setTransform(1, 0, 0, 1, 0, 0);
873
+ this.drawImage(texture, -x, -y, texture.width, texture.height);
874
+ return $getFloat32Array6(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4] - bounds.xMin, matrix[5] - bounds.yMin);
875
+ }
876
+ /**
877
+ * @return {void}
878
+ * @method
879
+ * @public
880
+ */
881
+ _$endClipDef() {
882
+ this._$mask._$endClipDef();
883
+ }
884
+ /**
885
+ * @return {void}
886
+ * @method
887
+ * @public
888
+ */
889
+ _$leaveClip() {
890
+ this._$mask._$leaveClip();
891
+ }
892
+ /**
893
+ * @return {void}
894
+ * @method
895
+ * @public
896
+ */
897
+ _$drawContainerClip() {
898
+ this._$mask._$drawContainerClip();
899
+ }
900
+ /**
901
+ * @return {void}
902
+ * @method
903
+ * @public
904
+ */
905
+ closePath() {
906
+ this._$path.close();
907
+ }
908
+ /**
909
+ * @return {void}
910
+ * @method
911
+ * @public
912
+ */
913
+ stroke() {
914
+ const strokeVertices = this._$path.vertices;
915
+ if (!strokeVertices.length) {
916
+ return;
917
+ }
918
+ const checkVertices = $getArray();
919
+ for (let idx = 0; idx < strokeVertices.length; ++idx) {
920
+ const vertices = strokeVertices[idx];
921
+ if (6 > vertices.length) {
922
+ continue;
923
+ }
924
+ checkVertices.push(vertices);
925
+ }
926
+ if (!checkVertices.length) {
927
+ $poolArray(checkVertices);
928
+ return;
929
+ }
930
+ const strokeBuffer = this._$vao.createStroke(strokeVertices, this.lineCap, this.lineJoin);
931
+ let matrix = this._$matrix;
932
+ const strokeStyle = this.strokeStyle;
933
+ let face = $Math.sign(matrix[0] * matrix[4]);
934
+ if (face > 0 && matrix[1] !== 0 && matrix[3] !== 0) {
935
+ face = -$Math.sign(matrix[1] * matrix[3]);
936
+ }
937
+ let lineWidth = this.lineWidth * 0.5;
938
+ let scaleX;
939
+ let scaleY;
940
+ if (this._$grid.enabled) {
941
+ // lineWidth *= $getSameScaleBase();
942
+ scaleX = $Math.abs(this._$grid.ancestorMatrixA + this._$grid.ancestorMatrixD);
943
+ scaleY = $Math.abs(this._$grid.ancestorMatrixB + this._$grid.ancestorMatrixE);
944
+ }
945
+ else {
946
+ scaleX = $Math.abs(matrix[0] + matrix[3]);
947
+ scaleY = $Math.abs(matrix[1] + matrix[4]);
948
+ }
949
+ const scaleMin = $Math.min(scaleX, scaleY);
950
+ const scaleMax = $Math.max(scaleX, scaleY);
951
+ lineWidth *= scaleMax * (1 - 0.3 * $Math.cos($Math.PI * 0.5 * (scaleMin / scaleMax)));
952
+ lineWidth = $Math.max(1, lineWidth);
953
+ const hasGrid = this._$grid.enabled;
954
+ let texture;
955
+ let variants;
956
+ let shader;
957
+ if (strokeStyle instanceof CanvasGradientToWebGL) {
958
+ if (strokeStyle.type === "radial") {
959
+ matrix = this._$stack[this._$stack.length - 1];
960
+ }
961
+ const stops = strokeStyle.stops;
962
+ const isLinearSpace = strokeStyle.rgb === "linearRGB";
963
+ texture = this
964
+ ._$gradientLUT
965
+ .generateForShape(stops, isLinearSpace);
966
+ this
967
+ ._$frameBufferManager
968
+ .textureManager
969
+ .bind0(texture, true);
970
+ variants = this
971
+ ._$shaderList
972
+ .gradientShapeShaderVariants;
973
+ if (strokeStyle.type === "linear") {
974
+ shader = variants
975
+ .getGradientShapeShader(true, hasGrid, false, false, strokeStyle.mode);
976
+ variants.setGradientShapeUniform(shader.uniform, true, lineWidth, face, this.miterLimit, hasGrid, matrix, $inverseMatrix(this._$matrix), this._$viewportWidth, this._$viewportHeight, this._$grid, false, strokeStyle.points, 0);
977
+ }
978
+ else {
979
+ matrix = this._$stack[this._$stack.length - 1];
980
+ const hasFocalPoint = strokeStyle.focalPointRatio !== 0;
981
+ shader = variants
982
+ .getGradientShapeShader(true, hasGrid, true, hasFocalPoint, strokeStyle.mode);
983
+ variants.setGradientShapeUniform(shader.uniform, true, lineWidth, face, this.miterLimit, hasGrid, matrix, $inverseMatrix(this._$matrix), this._$viewportWidth, this._$viewportHeight, this._$grid, true, strokeStyle.points, strokeStyle.focalPointRatio);
984
+ }
985
+ }
986
+ else if (strokeStyle instanceof CanvasPatternToWebGL) {
987
+ matrix = this._$stack[this._$stack.length - 1];
988
+ const pct = strokeStyle.colorTransform;
989
+ texture = strokeStyle.texture;
990
+ this
991
+ ._$frameBufferManager
992
+ .textureManager
993
+ .bind0(texture);
994
+ variants = this
995
+ ._$shaderList
996
+ .shapeShaderVariants;
997
+ shader = variants
998
+ .getBitmapShapeShader(true, strokeStyle.repeat, this._$grid.enabled);
999
+ if (pct) {
1000
+ variants.setBitmapShapeUniform(shader.uniform, true, lineWidth, face, this.miterLimit, hasGrid, matrix, $inverseMatrix(this._$matrix), this._$viewportWidth, this._$viewportHeight, this._$grid, texture.width, texture.height, pct[0], pct[1], pct[2], this._$globalAlpha, pct[4] / 255, pct[5] / 255, pct[6] / 255, 0);
1001
+ }
1002
+ else {
1003
+ variants.setBitmapShapeUniform(shader.uniform, true, lineWidth, face, this.miterLimit, hasGrid, matrix, $inverseMatrix(this._$matrix), this._$viewportWidth, this._$viewportHeight, this._$grid, texture.width, texture.height, 1, 1, 1, this._$globalAlpha, 0, 0, 0, 0);
1004
+ }
1005
+ }
1006
+ else {
1007
+ variants = this
1008
+ ._$shaderList
1009
+ .shapeShaderVariants;
1010
+ shader = variants
1011
+ .getSolidColorShapeShader(true, this._$grid.enabled);
1012
+ variants.setSolidColorShapeUniform(shader.uniform, true, lineWidth, face, this.miterLimit, hasGrid, matrix, this._$viewportWidth, this._$viewportHeight, this._$grid, strokeStyle, this._$globalAlpha);
1013
+ }
1014
+ shader._$stroke(strokeBuffer);
1015
+ this._$vao.releaseStroke(strokeBuffer);
1016
+ }
1017
+ /**
1018
+ * @param {number} x
1019
+ * @param {number} y
1020
+ * @param {number} radius
1021
+ * @return {void}
1022
+ * @method
1023
+ * @public
1024
+ */
1025
+ arc(x, y, radius) {
1026
+ this._$path.drawCircle(x, y, radius);
1027
+ }
1028
+ /**
1029
+ * @return {void}
1030
+ * @method
1031
+ * @public
1032
+ */
1033
+ clip() {
1034
+ // to triangle
1035
+ const fillVertices = this._$path.vertices;
1036
+ if (!fillVertices.length) {
1037
+ return;
1038
+ }
1039
+ const checkVertices = $getArray();
1040
+ for (let idx = 0; idx < fillVertices.length; ++idx) {
1041
+ const vertices = fillVertices[idx];
1042
+ if (10 > vertices.length) {
1043
+ continue;
1044
+ }
1045
+ checkVertices.push(vertices);
1046
+ }
1047
+ if (!checkVertices.length) {
1048
+ $poolArray(checkVertices);
1049
+ return;
1050
+ }
1051
+ const fillVertexArrayObject = this._$vao.createFill(checkVertices);
1052
+ // mask render
1053
+ const variants = this
1054
+ ._$shaderList
1055
+ .shapeShaderVariants;
1056
+ const shader = variants.getMaskShapeShader(false, false);
1057
+ const uniform = shader.uniform;
1058
+ variants.setMaskShapeUniform(uniform, false, this._$matrix[0], this._$matrix[1], this._$matrix[2], this._$matrix[3], this._$matrix[4], this._$matrix[5], this._$matrix[6], this._$matrix[7], this._$matrix[8], this._$viewportWidth, this._$viewportHeight, null);
1059
+ if (this._$mask._$onClip(fillVertexArrayObject, this._$matrix, this._$viewportWidth, this._$viewportHeight)) {
1060
+ return;
1061
+ }
1062
+ shader._$fill(fillVertexArrayObject);
1063
+ this.beginPath();
1064
+ }
1065
+ /**
1066
+ * @return {void}
1067
+ * @method
1068
+ * @public
1069
+ */
1070
+ save() {
1071
+ // matrix
1072
+ const matrix = this._$matrix;
1073
+ this._$stack.push($getFloat32Array9(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], matrix[8]));
1074
+ // mask
1075
+ this._$mask._$onSave();
1076
+ }
1077
+ /**
1078
+ * @return {void}
1079
+ * @method
1080
+ * @public
1081
+ */
1082
+ restore() {
1083
+ //matrix
1084
+ if (this._$stack.length) {
1085
+ $poolFloat32Array9(this._$matrix);
1086
+ this._$matrix = this._$stack.pop() || $getFloat32Array9();
1087
+ }
1088
+ // mask
1089
+ this._$mask._$onRestore();
1090
+ }
1091
+ /**
1092
+ * @param {WebGLTexture} texture
1093
+ * @param {boolean} repeat
1094
+ * @param {Float32Array} color_transform
1095
+ * @return {CanvasPatternToWebGL}
1096
+ * @method
1097
+ * @public
1098
+ */
1099
+ createPattern(texture, repeat, color_transform) {
1100
+ return new CanvasPatternToWebGL(this, texture, repeat, color_transform);
1101
+ }
1102
+ /**
1103
+ * @param {number} x0
1104
+ * @param {number} y0
1105
+ * @param {number} x1
1106
+ * @param {number} y1
1107
+ * @param {string} [rgb=InterpolationMethod.RGB]
1108
+ * @param {string} [mode=SpreadMethod.PAD]
1109
+ * @return {CanvasGradientToWebGL}
1110
+ * @method
1111
+ * @public
1112
+ */
1113
+ createLinearGradient(x0, y0, x1, y1, rgb = "rgb", mode = "pad") {
1114
+ return new CanvasGradientToWebGL()
1115
+ .linear(x0, y0, x1, y1, rgb, mode);
1116
+ }
1117
+ /**
1118
+ * @param {number} x0
1119
+ * @param {number} y0
1120
+ * @param {number} r0
1121
+ * @param {number} x1
1122
+ * @param {number} y1
1123
+ * @param {number} r1
1124
+ * @param {string} [rgb=InterpolationMethod.RGB]
1125
+ * @param {string} [mode=SpreadMethod.PAD]
1126
+ * @param {number} [focal_point_ratio=0]
1127
+ * @return {CanvasGradientToWebGL}
1128
+ * @method
1129
+ * @public
1130
+ */
1131
+ createRadialGradient(x0, y0, r0, x1, y1, r1, rgb = "rgb", mode = "pad", focal_point_ratio = 0) {
1132
+ return new CanvasGradientToWebGL()
1133
+ .radial(x0, y0, r0, x1, y1, r1, rgb, mode, focal_point_ratio);
1134
+ }
1135
+ /**
1136
+ * @param {WebGLTexture} texture
1137
+ * @param {boolean} is_horizontal
1138
+ * @param {number} blur
1139
+ * @return {void}
1140
+ * @method
1141
+ * @public
1142
+ */
1143
+ _$applyBlurFilter(texture, is_horizontal, blur) {
1144
+ const manager = this._$frameBufferManager;
1145
+ const currentAttachment = manager.currentAttachment;
1146
+ if (!currentAttachment) {
1147
+ throw new Error("the current attachment is null.");
1148
+ }
1149
+ const width = currentAttachment.width;
1150
+ const height = currentAttachment.height;
1151
+ manager
1152
+ .textureManager
1153
+ .bind0(texture, true);
1154
+ const halfBlur = $Math.ceil(blur * 0.5);
1155
+ const fraction = 1 - (halfBlur - blur * 0.5);
1156
+ const samples = 1 + blur;
1157
+ const variants = this
1158
+ ._$shaderList
1159
+ .filterShaderVariants;
1160
+ const shader = variants
1161
+ .getBlurFilterShader(halfBlur);
1162
+ variants
1163
+ .setBlurFilterUniform(shader.uniform, width, height, is_horizontal, fraction, samples);
1164
+ shader._$drawImage();
1165
+ }
1166
+ /**
1167
+ * @param {WebGLTexture} texture
1168
+ * @param {number} width
1169
+ * @param {number} height
1170
+ * @param {number} base_width
1171
+ * @param {number} base_height
1172
+ * @param {number} base_offset_x
1173
+ * @param {number} base_offset_y
1174
+ * @param {number} blur_width
1175
+ * @param {number} blur_height
1176
+ * @param {number} blur_offset_x
1177
+ * @param {number} blur_offset_y
1178
+ * @param {boolean} is_glow
1179
+ * @param {string} type
1180
+ * @param {boolean} knockout
1181
+ * @param {number} strength
1182
+ * @param {array | null} [ratios = null]
1183
+ * @param {array | null} [colors = null]
1184
+ * @param {array | null} [alphas = null]
1185
+ * @param {number} [color_r1 = 0]
1186
+ * @param {number} [color_g1 = 0]
1187
+ * @param {number} [color_b1 = 0]
1188
+ * @param {number} [color_a1 = 0]
1189
+ * @param {number} [color_r2 = 0]
1190
+ * @param {number} [color_g2 = 0]
1191
+ * @param {number} [color_b2 = 0]
1192
+ * @param {number} [color_a2 = 0]
1193
+ * @return {void}
1194
+ * @method
1195
+ * @public
1196
+ */
1197
+ _$applyBitmapFilter(texture, width, height, base_width, base_height, base_offset_x, base_offset_y, blur_width, blur_height, blur_offset_x, blur_offset_y, is_glow, type, knockout, strength, ratios = null, colors = null, alphas = null, color_r1 = 0, color_g1 = 0, color_b1 = 0, color_a1 = 0, color_r2 = 0, color_g2 = 0, color_b2 = 0, color_a2 = 0) {
1198
+ const manager = this._$frameBufferManager;
1199
+ const isInner = type === "inner";
1200
+ const baseAttachment = manager.currentAttachment;
1201
+ const baseTexture = manager.getTextureFromCurrentAttachment();
1202
+ let lut = null;
1203
+ const isGradient = ratios !== null && colors !== null && alphas !== null;
1204
+ if (ratios !== null && colors !== null && alphas !== null) {
1205
+ lut = this
1206
+ ._$gradientLUT
1207
+ .generateForFilter(ratios, colors, alphas);
1208
+ }
1209
+ let targetTextureAttachment;
1210
+ if (isInner) {
1211
+ if (isGradient && lut) {
1212
+ manager
1213
+ .textureManager
1214
+ .bind02(texture, lut, true);
1215
+ }
1216
+ else {
1217
+ manager
1218
+ .textureManager
1219
+ .bind0(texture);
1220
+ }
1221
+ }
1222
+ else {
1223
+ targetTextureAttachment = this
1224
+ ._$frameBufferManager
1225
+ .createTextureAttachment(width, height);
1226
+ this._$bind(targetTextureAttachment);
1227
+ if (isGradient && lut) {
1228
+ manager
1229
+ .textureManager
1230
+ .bind012(texture, baseTexture, lut, true);
1231
+ }
1232
+ else {
1233
+ manager
1234
+ .textureManager
1235
+ .bind01(texture, baseTexture);
1236
+ }
1237
+ }
1238
+ const transformsBase = !(isInner || type === "full" && knockout);
1239
+ const transformsBlur = !(width === blur_width && height === blur_height && blur_offset_x === 0 && blur_offset_y === 0);
1240
+ const appliesStrength = !(strength === 1);
1241
+ const variants = this
1242
+ ._$shaderList
1243
+ .filterShaderVariants;
1244
+ const shader = variants.getBitmapFilterShader(transformsBase, transformsBlur, is_glow, type, knockout, appliesStrength, isGradient);
1245
+ variants.setBitmapFilterUniform(shader.uniform, width, height, base_width, base_height, base_offset_x, base_offset_y, blur_width, blur_height, blur_offset_x, blur_offset_y, is_glow, strength, color_r1, color_g1, color_b1, color_a1, color_r2, color_g2, color_b2, color_a2, transformsBase, transformsBlur, appliesStrength, isGradient);
1246
+ if (!isInner) {
1247
+ this.blend.toOneZero();
1248
+ }
1249
+ else if (knockout) {
1250
+ this.blend.toSourceIn();
1251
+ }
1252
+ else {
1253
+ this.blend.toSourceAtop();
1254
+ }
1255
+ shader._$drawImage();
1256
+ if (!isInner) {
1257
+ manager
1258
+ .releaseAttachment(baseAttachment, true);
1259
+ }
1260
+ }
1261
+ /**
1262
+ * @param {WebGLTexture} texture
1263
+ * @param {array} matrix
1264
+ * @return {void}
1265
+ * @method
1266
+ * @public
1267
+ */
1268
+ _$applyColorMatrixFilter(texture, matrix) {
1269
+ this
1270
+ ._$frameBufferManager
1271
+ .textureManager
1272
+ .bind0(texture, true);
1273
+ const variants = this
1274
+ ._$shaderList
1275
+ .filterShaderVariants;
1276
+ const shader = variants
1277
+ .getColorMatrixFilterShader();
1278
+ variants
1279
+ .setColorMatrixFilterUniform(shader.uniform, matrix);
1280
+ this.blend.reset();
1281
+ shader._$drawImage();
1282
+ }
1283
+ /**
1284
+ * @param {WebGLTexture} texture
1285
+ * @param {number} matrix_x
1286
+ * @param {number} matrix_y
1287
+ * @param {Float32Array} matrix
1288
+ * @param {number} divisor
1289
+ * @param {number} bias
1290
+ * @param {boolean} preserve_alpha
1291
+ * @param {boolean} clamp
1292
+ * @param {number} color_r
1293
+ * @param {number} color_g
1294
+ * @param {number} color_b
1295
+ * @param {number} color_a
1296
+ * @return {void}
1297
+ * @method
1298
+ * @public
1299
+ */
1300
+ _$applyConvolutionFilter(texture, matrix_x, matrix_y, matrix, divisor, bias, preserve_alpha, clamp, color_r, color_g, color_b, color_a) {
1301
+ const width = texture.width;
1302
+ const height = texture.height;
1303
+ const targetTextureAttachment = this
1304
+ ._$frameBufferManager
1305
+ .createTextureAttachment(width, height);
1306
+ this._$bind(targetTextureAttachment);
1307
+ this
1308
+ ._$frameBufferManager
1309
+ .textureManager
1310
+ .bind0(texture, true);
1311
+ const variants = this
1312
+ ._$shaderList
1313
+ .filterShaderVariants;
1314
+ const shader = variants
1315
+ .getConvolutionFilterShader(matrix_x, matrix_y, preserve_alpha, clamp);
1316
+ variants.setConvolutionFilterUniform(shader.uniform, width, height, matrix, divisor, bias, clamp, color_r, color_g, color_b, color_a);
1317
+ this.blend.reset();
1318
+ shader._$drawImage();
1319
+ }
1320
+ /**
1321
+ * @param {WebGLTexture} texture
1322
+ * @param {WebGLTexture} map
1323
+ * @param {number} base_width
1324
+ * @param {number} base_height
1325
+ * @param {PointImpl} [point=null]
1326
+ * @param {number} component_x
1327
+ * @param {number} component_y
1328
+ * @param {number} scale_x
1329
+ * @param {number} scale_y
1330
+ * @param {string} mode
1331
+ * @param {number} color_r
1332
+ * @param {number} color_g
1333
+ * @param {number} color_b
1334
+ * @param {number} color_a
1335
+ * @return {void}
1336
+ * @method
1337
+ * @private
1338
+ */
1339
+ _$applyDisplacementMapFilter(texture, map, base_width, base_height, point, component_x, component_y, scale_x, scale_y, mode, color_r, color_g, color_b, color_a) {
1340
+ const width = texture.width;
1341
+ const height = texture.height;
1342
+ const targetTextureAttachment = this
1343
+ ._$frameBufferManager
1344
+ .createTextureAttachment(width, height);
1345
+ this._$bind(targetTextureAttachment);
1346
+ if (!point) {
1347
+ point = { "x": 0, "y": 0 };
1348
+ }
1349
+ this
1350
+ ._$frameBufferManager
1351
+ .textureManager
1352
+ .bind01(texture, map);
1353
+ const variants = this
1354
+ ._$shaderList
1355
+ .filterShaderVariants;
1356
+ const shader = variants
1357
+ .getDisplacementMapFilterShader(component_x, component_y, mode);
1358
+ variants.setDisplacementMapFilterUniform(shader.uniform, map.width, map.height, base_width, base_height, point.x, point.y, scale_x, scale_y, mode, color_r, color_g, color_b, color_a);
1359
+ this.blend.reset();
1360
+ shader._$drawImage();
1361
+ }
1362
+ /**
1363
+ * @param {BoundsImpl} position
1364
+ * @return {void}
1365
+ * @method
1366
+ * @private
1367
+ */
1368
+ _$startLayer(position) {
1369
+ this._$positions.push(position);
1370
+ this._$blends.push(this._$isLayer);
1371
+ this._$isLayer = true;
1372
+ }
1373
+ /**
1374
+ * @return {void}
1375
+ * @method
1376
+ * @private
1377
+ */
1378
+ _$endLayer() {
1379
+ const bounds = this._$positions.pop();
1380
+ if (bounds) {
1381
+ $poolBoundsObject(bounds);
1382
+ }
1383
+ this._$isLayer = !!this._$blends.pop();
1384
+ }
1385
+ /**
1386
+ * @return {void}
1387
+ * @method
1388
+ * @private
1389
+ */
1390
+ _$saveCurrentMask() {
1391
+ this._$maskBufferArray.push(this._$cacheAttachment);
1392
+ this._$cacheAttachment = null;
1393
+ const bounds = this._$cacheBounds;
1394
+ this._$maskBoundsArray.push($getBoundsObject(bounds.xMin, bounds.xMax, bounds.yMin, bounds.yMax));
1395
+ }
1396
+ /**
1397
+ * @param {number} width
1398
+ * @param {number} height
1399
+ * @param {boolean} [multisample=false]
1400
+ * @return {void}
1401
+ * @method
1402
+ * @private
1403
+ */
1404
+ _$saveAttachment(width, height, multisample = false) {
1405
+ const manager = this._$frameBufferManager;
1406
+ this
1407
+ ._$attachmentArray
1408
+ .push(manager.currentAttachment);
1409
+ this._$bind(manager.createCacheAttachment(width, height, multisample));
1410
+ }
1411
+ /**
1412
+ * @return {void}
1413
+ * @method
1414
+ * @private
1415
+ */
1416
+ _$restoreAttachment(release_texture = false) {
1417
+ const manager = this._$frameBufferManager;
1418
+ manager.releaseAttachment(manager.currentAttachment, release_texture);
1419
+ this._$bind(this._$attachmentArray.pop());
1420
+ }
1421
+ /**
1422
+ * @return {void}
1423
+ * @method
1424
+ * @private
1425
+ */
1426
+ _$restoreCurrentMask() {
1427
+ this._$cacheAttachment = this._$maskBufferArray.pop() || null;
1428
+ this._$cacheBounds = this._$maskBoundsArray.pop() || $getBoundsObject();
1429
+ }
1430
+ /**
1431
+ * @return {object}
1432
+ * @method
1433
+ * @private
1434
+ */
1435
+ getCurrentPosition() {
1436
+ return this._$positions[this._$positions.length - 1];
1437
+ }
1438
+ /**
1439
+ * @description 最大テクスチャサイズを超えないスケール値を取得する
1440
+ * @param {number} width
1441
+ * @param {number} height
1442
+ * @return {number}
1443
+ * @method
1444
+ * @public
1445
+ */
1446
+ textureScale(width, height) {
1447
+ const maxSize = $Math.max(width, height);
1448
+ if (maxSize > this._$maxTextureSize) {
1449
+ return this._$maxTextureSize / maxSize;
1450
+ }
1451
+ return 1;
1452
+ }
1453
+ }