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