@swf2es/player-hosts 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/LICENSE.third-party +759 -0
- package/README.md +43 -2
- package/dist/indexeddb.d.ts +27 -0
- package/dist/indexeddb.d.ts.map +1 -0
- package/dist/indexeddb.js +170 -0
- package/dist/indexeddb.js.map +1 -0
- package/dist/node-worker.d.ts +2 -0
- package/dist/node-worker.d.ts.map +1 -0
- package/dist/node-worker.js +12 -0
- package/dist/node-worker.js.map +1 -0
- package/dist/node.d.ts +8 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +43 -0
- package/dist/node.js.map +1 -0
- package/dist/precompiled.d.ts +31 -0
- package/dist/precompiled.d.ts.map +1 -0
- package/dist/precompiled.js +125 -0
- package/dist/precompiled.js.map +1 -0
- package/dist/stage3d.d.ts +13 -0
- package/dist/stage3d.d.ts.map +1 -0
- package/dist/stage3d.js +61 -0
- package/dist/stage3d.js.map +1 -0
- package/dist/thread/codegen/codegen.js +308 -0
- package/dist/thread/codegen/index.js +405 -0
- package/dist/thread/format/abc-names.js +126 -0
- package/dist/thread/format/actions.js +222 -0
- package/dist/thread/format/air-descriptor.js +63 -0
- package/dist/thread/format/api-versions.js +22 -0
- package/dist/thread/format/bitmap.js +199 -0
- package/dist/thread/format/button.js +60 -0
- package/dist/thread/format/compression.js +200 -0
- package/dist/thread/format/display.js +305 -0
- package/dist/thread/format/filters.js +136 -0
- package/dist/thread/format/font.js +168 -0
- package/dist/thread/format/index.js +26 -0
- package/dist/thread/format/pbj.js +484 -0
- package/dist/thread/format/shape.js +411 -0
- package/dist/thread/format/sound.js +91 -0
- package/dist/thread/format/swf.js +163 -0
- package/dist/thread/format/tags.js +58 -0
- package/dist/thread/format/text.js +135 -0
- package/dist/thread/format/zip.js +91 -0
- package/dist/thread/native/audio/binary.js +3 -0
- package/dist/thread/native/audio/index.js +72 -0
- package/dist/thread/native/base64.js +9 -0
- package/dist/thread/native/compress/binary.js +3 -0
- package/dist/thread/native/compress/index.js +145 -0
- package/dist/thread/native/instance.js +49 -0
- package/dist/thread/native/mp3/binary.js +3 -0
- package/dist/thread/native/mp3/index.js +48 -0
- package/dist/thread/native/render/binary.js +3 -0
- package/dist/thread/native/render/bitmap-kernel.js +591 -0
- package/dist/thread/native/render/draw-kernel.js +204 -0
- package/dist/thread/native/render/dxt-encoder.js +94 -0
- package/dist/thread/native/render/index.js +10 -0
- package/dist/thread/native/render/lines.js +122 -0
- package/dist/thread/native/render/module.js +26 -0
- package/dist/thread/native/render/pixel-ops.js +235 -0
- package/dist/thread/native/render/tessellator.js +250 -0
- package/dist/thread/player/avm1/amf.js +507 -0
- package/dist/thread/player/avm1/avm1.js +1304 -0
- package/dist/thread/player/avm1/bindings.js +214 -0
- package/dist/thread/player/avm1/classes.js +75 -0
- package/dist/thread/player/avm1/clips.js +229 -0
- package/dist/thread/player/avm1/compile.js +140 -0
- package/dist/thread/player/avm1/external.js +79 -0
- package/dist/thread/player/avm1/focus.js +278 -0
- package/dist/thread/player/avm1/globals/BitmapData.js +542 -0
- package/dist/thread/player/avm1/globals/Button.js +31 -0
- package/dist/thread/player/avm1/globals/Color.js +115 -0
- package/dist/thread/player/avm1/globals/ExternalInterface.js +310 -0
- package/dist/thread/player/avm1/globals/FileReference.js +217 -0
- package/dist/thread/player/avm1/globals/Key.js +60 -0
- package/dist/thread/player/avm1/globals/LoadVars.js +208 -0
- package/dist/thread/player/avm1/globals/LocalConnection.js +92 -0
- package/dist/thread/player/avm1/globals/MovieClip.js +1070 -0
- package/dist/thread/player/avm1/globals/MovieClipLoader.js +90 -0
- package/dist/thread/player/avm1/globals/NetConnection.js +261 -0
- package/dist/thread/player/avm1/globals/PrintJob.js +37 -0
- package/dist/thread/player/avm1/globals/Selection.js +62 -0
- package/dist/thread/player/avm1/globals/SharedObject.js +245 -0
- package/dist/thread/player/avm1/globals/Sound.js +238 -0
- package/dist/thread/player/avm1/globals/Stage.js +12 -0
- package/dist/thread/player/avm1/globals/StyleSheet.js +205 -0
- package/dist/thread/player/avm1/globals/TextField.js +396 -0
- package/dist/thread/player/avm1/globals/TextFormat.js +194 -0
- package/dist/thread/player/avm1/globals/TextSnapshot.js +88 -0
- package/dist/thread/player/avm1/globals/XML.js +396 -0
- package/dist/thread/player/avm1/globals/XMLNode.js +413 -0
- package/dist/thread/player/avm1/globals/XMLSocket.js +205 -0
- package/dist/thread/player/avm1/globals/drawing.js +202 -0
- package/dist/thread/player/avm1/globals/filters.js +635 -0
- package/dist/thread/player/avm1/globals/geom.js +600 -0
- package/dist/thread/player/avm1/input.js +483 -0
- package/dist/thread/player/avm1/keyboard.js +113 -0
- package/dist/thread/player/avm1/loads.js +352 -0
- package/dist/thread/player/avm1/net.js +219 -0
- package/dist/thread/player/avm1/paths.js +104 -0
- package/dist/thread/player/avm1/pointer.js +512 -0
- package/dist/thread/player/avm1/queue.js +303 -0
- package/dist/thread/player/avm1/sound.js +106 -0
- package/dist/thread/player/avm1/swf.js +141 -0
- package/dist/thread/player/avm1/timers.js +113 -0
- package/dist/thread/player/bitmap/bitmap.js +627 -0
- package/dist/thread/player/bitmap/draw.js +68 -0
- package/dist/thread/player/bitmap/dxt.js +11 -0
- package/dist/thread/player/bitmap/filters.js +656 -0
- package/dist/thread/player/bitmap/images.js +240 -0
- package/dist/thread/player/bitmap/kernel.js +65 -0
- package/dist/thread/player/bitmap/ops.js +1239 -0
- package/dist/thread/player/bitmap/pixel-bender.js +911 -0
- package/dist/thread/player/bitmap/png.js +139 -0
- package/dist/thread/player/bitmap/turbulence.js +89 -0
- package/dist/thread/player/clock.js +182 -0
- package/dist/thread/player/display/bitmapobject.js +25 -0
- package/dist/thread/player/display/bounds.js +520 -0
- package/dist/thread/player/display/buttonobject.js +305 -0
- package/dist/thread/player/display/color.js +40 -0
- package/dist/thread/player/display/container.js +150 -0
- package/dist/thread/player/display/display.js +14 -0
- package/dist/thread/player/display/displayobject.js +664 -0
- package/dist/thread/player/display/drawing.js +613 -0
- package/dist/thread/player/display/filters.js +285 -0
- package/dist/thread/player/display/geometry.js +189 -0
- package/dist/thread/player/display/gradients.js +117 -0
- package/dist/thread/player/display/graphicsdata.js +592 -0
- package/dist/thread/player/display/instantiate.js +71 -0
- package/dist/thread/player/display/matrix3d.js +373 -0
- package/dist/thread/player/display/morph.js +226 -0
- package/dist/thread/player/display/movieclip.js +680 -0
- package/dist/thread/player/display/perspective.js +193 -0
- package/dist/thread/player/display/scale9.js +236 -0
- package/dist/thread/player/display/shapeobject.js +131 -0
- package/dist/thread/player/display/shapes.js +407 -0
- package/dist/thread/player/display/textobjects.js +222 -0
- package/dist/thread/player/display/timeline.js +471 -0
- package/dist/thread/player/display/value-lists.js +40 -0
- package/dist/thread/player/display/videoobject.js +6 -0
- package/dist/thread/player/display/walk.js +127 -0
- package/dist/thread/player/files.js +334 -0
- package/dist/thread/player/hosts.js +207 -0
- package/dist/thread/player/input/avm1.js +82 -0
- package/dist/thread/player/input/context-menu.js +63 -0
- package/dist/thread/player/input/keyboard.js +458 -0
- package/dist/thread/player/input/pointer.js +863 -0
- package/dist/thread/player/input/text-editor.js +319 -0
- package/dist/thread/player/input/touch.js +209 -0
- package/dist/thread/player/localconnection.js +90 -0
- package/dist/thread/player/media/audio.js +376 -0
- package/dist/thread/player/media/dynamic-sound.js +90 -0
- package/dist/thread/player/media/extract.js +135 -0
- package/dist/thread/player/media/mp3.js +152 -0
- package/dist/thread/player/media/sounds.js +507 -0
- package/dist/thread/player/media/streaming-audio.js +133 -0
- package/dist/thread/player/player.js +616 -0
- package/dist/thread/player/playerglobal/air/net/WebSocket.js +250 -0
- package/dist/thread/player/playerglobal/air-library.js +8 -0
- package/dist/thread/player/playerglobal/flash/accessibility/Accessibility.js +21 -0
- package/dist/thread/player/playerglobal/flash/crypto/generateRandomBytes.js +32 -0
- package/dist/thread/player/playerglobal/flash/data/EncryptedLocalStore.js +61 -0
- package/dist/thread/player/playerglobal/flash/desktop/Clipboard.js +173 -0
- package/dist/thread/player/playerglobal/flash/desktop/NativeApplication.js +179 -0
- package/dist/thread/player/playerglobal/flash/display/AVM1Movie.js +19 -0
- package/dist/thread/player/playerglobal/flash/display/Bitmap.js +58 -0
- package/dist/thread/player/playerglobal/flash/display/BitmapData.js +633 -0
- package/dist/thread/player/playerglobal/flash/display/DisplayObject.js +614 -0
- package/dist/thread/player/playerglobal/flash/display/DisplayObjectContainer.js +224 -0
- package/dist/thread/player/playerglobal/flash/display/Graphics.js +345 -0
- package/dist/thread/player/playerglobal/flash/display/InteractiveObject.js +87 -0
- package/dist/thread/player/playerglobal/flash/display/Loader.js +79 -0
- package/dist/thread/player/playerglobal/flash/display/LoaderInfo.js +128 -0
- package/dist/thread/player/playerglobal/flash/display/MovieClip.js +194 -0
- package/dist/thread/player/playerglobal/flash/display/NativeWindow.js +245 -0
- package/dist/thread/player/playerglobal/flash/display/Shader.js +26 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderData.js +85 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderInput.js +64 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderJob.js +181 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderParameter.js +23 -0
- package/dist/thread/player/playerglobal/flash/display/Shape.js +13 -0
- package/dist/thread/player/playerglobal/flash/display/SimpleButton.js +103 -0
- package/dist/thread/player/playerglobal/flash/display/Sprite.js +84 -0
- package/dist/thread/player/playerglobal/flash/display/Stage.js +231 -0
- package/dist/thread/player/playerglobal/flash/display/Stage3D.js +54 -0
- package/dist/thread/player/playerglobal/flash/display/shaders.js +228 -0
- package/dist/thread/player/playerglobal/flash/events/Event.js +58 -0
- package/dist/thread/player/playerglobal/flash/events/EventDispatcher.js +103 -0
- package/dist/thread/player/playerglobal/flash/events/GestureEvent.js +34 -0
- package/dist/thread/player/playerglobal/flash/events/HTTPStatusEvent.js +8 -0
- package/dist/thread/player/playerglobal/flash/events/KeyboardEvent.js +51 -0
- package/dist/thread/player/playerglobal/flash/events/MouseEvent.js +59 -0
- package/dist/thread/player/playerglobal/flash/events/PressAndTapGestureEvent.js +30 -0
- package/dist/thread/player/playerglobal/flash/events/TimerEvent.js +16 -0
- package/dist/thread/player/playerglobal/flash/events/TouchEvent.js +45 -0
- package/dist/thread/player/playerglobal/flash/external/ExternalInterface.js +73 -0
- package/dist/thread/player/playerglobal/flash/filesystem/File.js +340 -0
- package/dist/thread/player/playerglobal/flash/filesystem/FileStream.js +453 -0
- package/dist/thread/player/playerglobal/flash/filesystem/paths.js +156 -0
- package/dist/thread/player/playerglobal/flash/filesystem/writes.js +143 -0
- package/dist/thread/player/playerglobal/flash/filters/BevelFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/BitmapFilter.js +205 -0
- package/dist/thread/player/playerglobal/flash/filters/BlurFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/ColorMatrixFilter.js +11 -0
- package/dist/thread/player/playerglobal/flash/filters/ConvolutionFilter.js +26 -0
- package/dist/thread/player/playerglobal/flash/filters/DisplacementMapFilter.js +51 -0
- package/dist/thread/player/playerglobal/flash/filters/DropShadowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GlowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GradientBevelFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GradientGlowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/ShaderFilter.js +53 -0
- package/dist/thread/player/playerglobal/flash/geom/Matrix3D.js +361 -0
- package/dist/thread/player/playerglobal/flash/geom/PerspectiveProjection.js +122 -0
- package/dist/thread/player/playerglobal/flash/geom/Transform.js +245 -0
- package/dist/thread/player/playerglobal/flash/geom/Utils3D.js +85 -0
- package/dist/thread/player/playerglobal/flash/globalization/Collator.js +149 -0
- package/dist/thread/player/playerglobal/flash/globalization/CurrencyFormatter.js +272 -0
- package/dist/thread/player/playerglobal/flash/globalization/CurrencyParseResult.js +21 -0
- package/dist/thread/player/playerglobal/flash/globalization/DateTimeFormatter.js +463 -0
- package/dist/thread/player/playerglobal/flash/globalization/LocaleID.js +144 -0
- package/dist/thread/player/playerglobal/flash/globalization/NumberFormatter.js +444 -0
- package/dist/thread/player/playerglobal/flash/globalization/NumberParseResult.js +22 -0
- package/dist/thread/player/playerglobal/flash/globalization/StringTools.js +59 -0
- package/dist/thread/player/playerglobal/flash/globalization/locale.js +190 -0
- package/dist/thread/player/playerglobal/flash/media/Camera.js +89 -0
- package/dist/thread/player/playerglobal/flash/media/Microphone.js +126 -0
- package/dist/thread/player/playerglobal/flash/media/Sound.js +543 -0
- package/dist/thread/player/playerglobal/flash/media/SoundMixer.js +74 -0
- package/dist/thread/player/playerglobal/flash/media/SoundTransform.js +40 -0
- package/dist/thread/player/playerglobal/flash/media/Video.js +43 -0
- package/dist/thread/player/playerglobal/flash/net/FileFilter.js +27 -0
- package/dist/thread/player/playerglobal/flash/net/FileReference.js +197 -0
- package/dist/thread/player/playerglobal/flash/net/LocalConnection.js +167 -0
- package/dist/thread/player/playerglobal/flash/net/NetConnection.js +155 -0
- package/dist/thread/player/playerglobal/flash/net/SharedObject.js +299 -0
- package/dist/thread/player/playerglobal/flash/net/Socket.js +282 -0
- package/dist/thread/player/playerglobal/flash/net/URLRequest.js +93 -0
- package/dist/thread/player/playerglobal/flash/net/URLStream.js +146 -0
- package/dist/thread/player/playerglobal/flash/net/XMLSocket.js +14 -0
- package/dist/thread/player/playerglobal/flash/net/local-modern.js +142 -0
- package/dist/thread/player/playerglobal/flash/net/local-values.js +217 -0
- package/dist/thread/player/playerglobal/flash/net/navigateToURL.js +29 -0
- package/dist/thread/player/playerglobal/flash/profiler/Telemetry.js +25 -0
- package/dist/thread/player/playerglobal/flash/sensors/Accelerometer.js +12 -0
- package/dist/thread/player/playerglobal/flash/system/ApplicationDomain.js +69 -0
- package/dist/thread/player/playerglobal/flash/system/Capabilities.js +163 -0
- package/dist/thread/player/playerglobal/flash/system/FSCommandHost.js +17 -0
- package/dist/thread/player/playerglobal/flash/system/Security.js +46 -0
- package/dist/thread/player/playerglobal/flash/system/SecurityDomain.js +21 -0
- package/dist/thread/player/playerglobal/flash/system/System.js +73 -0
- package/dist/thread/player/playerglobal/flash/system/Worker.js +112 -0
- package/dist/thread/player/playerglobal/flash/text/Font.js +95 -0
- package/dist/thread/player/playerglobal/flash/text/StaticText.js +16 -0
- package/dist/thread/player/playerglobal/flash/text/StyleSheet.js +65 -0
- package/dist/thread/player/playerglobal/flash/text/TextField.js +707 -0
- package/dist/thread/player/playerglobal/flash/text/TextRenderer.js +77 -0
- package/dist/thread/player/playerglobal/flash/text/engine/FontDescription.js +141 -0
- package/dist/thread/player/playerglobal/flash/text/engine/TabStop.js +46 -0
- package/dist/thread/player/playerglobal/flash/trace/Trace.js +17 -0
- package/dist/thread/player/playerglobal/flash/ui/ContextMenu.js +17 -0
- package/dist/thread/player/playerglobal/flash/ui/GameInput.js +19 -0
- package/dist/thread/player/playerglobal/flash/ui/Keyboard.js +27 -0
- package/dist/thread/player/playerglobal/flash/ui/Mouse.js +127 -0
- package/dist/thread/player/playerglobal/flash/ui/Multitouch.js +46 -0
- package/dist/thread/player/playerglobal/flash/utils/ByteArray.js +155 -0
- package/dist/thread/player/playerglobal/flash/utils/Timer.js +25 -0
- package/dist/thread/player/playerglobal/flash/xml/XMLDocument.js +74 -0
- package/dist/thread/player/playerglobal/index.js +224 -0
- package/dist/thread/player/playerglobal/libraries.js +10 -0
- package/dist/thread/player/playerglobal/playerglobal-library.js +22 -0
- package/dist/thread/player/playerglobal/toplevel.js +122 -0
- package/dist/thread/player/scripting/clipboard.js +146 -0
- package/dist/thread/player/scripting/code.js +900 -0
- package/dist/thread/player/scripting/evaluate.js +144 -0
- package/dist/thread/player/scripting/events.js +172 -0
- package/dist/thread/player/scripting/handover.js +182 -0
- package/dist/thread/player/scripting/lazy.js +38 -0
- package/dist/thread/player/scripting/lifecycle.js +272 -0
- package/dist/thread/player/scripting/loads.js +860 -0
- package/dist/thread/player/scripting/sha256.js +95 -0
- package/dist/thread/player/scripting/symbols.js +348 -0
- package/dist/thread/player/scripting/timers.js +434 -0
- package/dist/thread/player/scripting/workers.js +923 -0
- package/dist/thread/player/scripting.js +1018 -0
- package/dist/thread/player/stage.js +4 -0
- package/dist/thread/player/text/csm.js +113 -0
- package/dist/thread/player/text/css.js +167 -0
- package/dist/thread/player/text/fonts.js +97 -0
- package/dist/thread/player/text/layout.js +393 -0
- package/dist/thread/player/text/static.js +109 -0
- package/dist/thread/player/text/text.js +431 -0
- package/dist/thread/player/workers/thread.js +159 -0
- package/dist/thread/player/workers/wire.js +198 -0
- package/dist/thread/player-hosts/web-worker.js +19 -0
- package/dist/thread/runtime/avm1/activation.js +89 -0
- package/dist/thread/runtime/avm1/case.js +249 -0
- package/dist/thread/runtime/avm1/clips.js +334 -0
- package/dist/thread/runtime/avm1/control.js +280 -0
- package/dist/thread/runtime/avm1/errors.js +50 -0
- package/dist/thread/runtime/avm1/functions.js +249 -0
- package/dist/thread/runtime/avm1/globals/array.js +549 -0
- package/dist/thread/runtime/avm1/globals/broadcaster.js +131 -0
- package/dist/thread/runtime/avm1/globals/date.js +436 -0
- package/dist/thread/runtime/avm1/globals/global.js +344 -0
- package/dist/thread/runtime/avm1/globals/math.js +139 -0
- package/dist/thread/runtime/avm1/globals/number.js +93 -0
- package/dist/thread/runtime/avm1/globals/string.js +201 -0
- package/dist/thread/runtime/avm1/globals/timers.js +129 -0
- package/dist/thread/runtime/avm1/host.js +5 -0
- package/dist/thread/runtime/avm1/index.js +14 -0
- package/dist/thread/runtime/avm1/inheritance.js +132 -0
- package/dist/thread/runtime/avm1/numbers.js +298 -0
- package/dist/thread/runtime/avm1/objects.js +896 -0
- package/dist/thread/runtime/avm1/operators.js +170 -0
- package/dist/thread/runtime/avm1/realm.js +529 -0
- package/dist/thread/runtime/avm1/runtime.js +882 -0
- package/dist/thread/runtime/avm1/scope.js +385 -0
- package/dist/thread/runtime/avm1/urls.js +180 -0
- package/dist/thread/runtime/avm1/values.js +97 -0
- package/dist/thread/runtime/avm2/amf-classes.js +66 -0
- package/dist/thread/runtime/avm2/amf.js +801 -0
- package/dist/thread/runtime/avm2/array-conversion.js +100 -0
- package/dist/thread/runtime/avm2/builtin-library.js +21 -0
- package/dist/thread/runtime/avm2/cache-fill.js +86 -0
- package/dist/thread/runtime/avm2/classes.js +211 -0
- package/dist/thread/runtime/avm2/definitions.js +69 -0
- package/dist/thread/runtime/avm2/descriptors.js +5 -0
- package/dist/thread/runtime/avm2/dictionary-keys.js +295 -0
- package/dist/thread/runtime/avm2/domain-memory.js +75 -0
- package/dist/thread/runtime/avm2/domain.js +280 -0
- package/dist/thread/runtime/avm2/dynamic-properties.js +182 -0
- package/dist/thread/runtime/avm2/enumeration.js +393 -0
- package/dist/thread/runtime/avm2/errors.js +45 -0
- package/dist/thread/runtime/avm2/float-library.js +66 -0
- package/dist/thread/runtime/avm2/float.js +26 -0
- package/dist/thread/runtime/avm2/hooks.js +19 -0
- package/dist/thread/runtime/avm2/index.js +38 -0
- package/dist/thread/runtime/avm2/messages.js +177 -0
- package/dist/thread/runtime/avm2/method-factories.js +95 -0
- package/dist/thread/runtime/avm2/modules.js +105 -0
- package/dist/thread/runtime/avm2/names.js +248 -0
- package/dist/thread/runtime/avm2/natives/aliases.js +47 -0
- package/dist/thread/runtime/avm2/natives/array.js +390 -0
- package/dist/thread/runtime/avm2/natives/bytearray.js +1227 -0
- package/dist/thread/runtime/avm2/natives/case.js +88 -0
- package/dist/thread/runtime/avm2/natives/concurrent.js +199 -0
- package/dist/thread/runtime/avm2/natives/date.js +581 -0
- package/dist/thread/runtime/avm2/natives/define.js +130 -0
- package/dist/thread/runtime/avm2/natives/describe.js +351 -0
- package/dist/thread/runtime/avm2/natives/dictionary.js +12 -0
- package/dist/thread/runtime/avm2/natives/float-vector.js +81 -0
- package/dist/thread/runtime/avm2/natives/float.js +96 -0
- package/dist/thread/runtime/avm2/natives/index.js +64 -0
- package/dist/thread/runtime/avm2/natives/json.js +514 -0
- package/dist/thread/runtime/avm2/natives/number.js +162 -0
- package/dist/thread/runtime/avm2/natives/object.js +237 -0
- package/dist/thread/runtime/avm2/natives/proxy.js +75 -0
- package/dist/thread/runtime/avm2/natives/regexp.js +485 -0
- package/dist/thread/runtime/avm2/natives/shell-workers.js +404 -0
- package/dist/thread/runtime/avm2/natives/shell.js +557 -0
- package/dist/thread/runtime/avm2/natives/sort.js +377 -0
- package/dist/thread/runtime/avm2/natives/string.js +132 -0
- package/dist/thread/runtime/avm2/natives/sync.js +821 -0
- package/dist/thread/runtime/avm2/natives/toplevel.js +139 -0
- package/dist/thread/runtime/avm2/natives/vector-elements.js +46 -0
- package/dist/thread/runtime/avm2/natives/vector.js +406 -0
- package/dist/thread/runtime/avm2/natives/xml/access.js +633 -0
- package/dist/thread/runtime/avm2/natives/xml/build.js +291 -0
- package/dist/thread/runtime/avm2/natives/xml/chars.js +112 -0
- package/dist/thread/runtime/avm2/natives/xml/escape.js +38 -0
- package/dist/thread/runtime/avm2/natives/xml/names.js +204 -0
- package/dist/thread/runtime/avm2/natives/xml/node.js +272 -0
- package/dist/thread/runtime/avm2/natives/xml/operators.js +69 -0
- package/dist/thread/runtime/avm2/natives/xml/parser.js +356 -0
- package/dist/thread/runtime/avm2/natives/xml/strings.js +191 -0
- package/dist/thread/runtime/avm2/natives/xml/values.js +122 -0
- package/dist/thread/runtime/avm2/natives/xml/xml.js +645 -0
- package/dist/thread/runtime/avm2/number-strings.js +110 -0
- package/dist/thread/runtime/avm2/numbers.js +558 -0
- package/dist/thread/runtime/avm2/options.js +16 -0
- package/dist/thread/runtime/avm2/player-messages.js +550 -0
- package/dist/thread/runtime/avm2/property-cache.js +135 -0
- package/dist/thread/runtime/avm2/runtime.js +2644 -0
- package/dist/thread/runtime/avm2/traits.js +509 -0
- package/dist/thread/runtime/index.js +7 -0
- package/dist/web-worker.d.ts +2 -0
- package/dist/web-worker.d.ts.map +1 -0
- package/dist/web-worker.js +20 -0
- package/dist/web-worker.js.map +1 -0
- package/dist/websocket.d.ts +4 -0
- package/dist/websocket.d.ts.map +1 -0
- package/dist/websocket.js +27 -0
- package/dist/websocket.js.map +1 -0
- package/dist/workers.d.ts +35 -0
- package/dist/workers.d.ts.map +1 -0
- package/dist/workers.js +171 -0
- package/dist/workers.js.map +1 -0
- package/package.json +62 -3
- package/src/indexeddb.ts +227 -0
- package/src/node-worker.ts +13 -0
- package/src/node.ts +49 -0
- package/src/precompiled.ts +166 -0
- package/src/stage3d.ts +76 -0
- package/src/web-worker.ts +24 -0
- package/src/websocket.ts +32 -0
- package/src/workers.ts +255 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// What File and FileStream change on the host's file system, with the
|
|
2
|
+
// errors adl (AIR 51.3, Windows) gives for them: a File of the app: URL
|
|
3
|
+
// is never written (a SecurityError, by its URL alone: the same directory
|
|
4
|
+
// through a file: URL or a native path is written), and the IOErrors say
|
|
5
|
+
// what is in the way. A host without writing (FileSystemHost.write) is a
|
|
6
|
+
// disk that refuses every write, IOError 3001.
|
|
7
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
8
|
+
import { NativePaths } from "./paths.js";
|
|
9
|
+
/** "Error #id: message", as an IOErrorEvent's text begins. */
|
|
10
|
+
export function errorText(id) {
|
|
11
|
+
return `Error #${id}: ${avm2.errorMessages[id]}`;
|
|
12
|
+
}
|
|
13
|
+
/** Throws adl's SecurityError where `at` is in the application's directory by its app: URL. */
|
|
14
|
+
export function refuseApp(s, at) {
|
|
15
|
+
if (at.root === "app") {
|
|
16
|
+
throw s.rt.construct(s.rt.classNamed("SecurityError"), "fileWriteResource");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** The host that writes: null for one that cannot. */
|
|
20
|
+
function writer(s) {
|
|
21
|
+
const host = s.fileSystem;
|
|
22
|
+
return host?.write && host.createDirectory && host.remove
|
|
23
|
+
? host
|
|
24
|
+
: null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Why the file at `path` cannot be opened to write: 3006 for a directory,
|
|
28
|
+
* 3003 where a directory it is in is a file, 3001 for a host that does not
|
|
29
|
+
* write; 0 where it can be.
|
|
30
|
+
*/
|
|
31
|
+
export function openRefusal(s, path) {
|
|
32
|
+
const host = s.fileSystem;
|
|
33
|
+
if (host?.stat(path)?.directory) {
|
|
34
|
+
return 3006;
|
|
35
|
+
}
|
|
36
|
+
const paths = new NativePaths(host?.separator ?? "/");
|
|
37
|
+
for (let up = paths.parent(path); up !== null; up = paths.parent(up)) {
|
|
38
|
+
const stat = host?.stat(up);
|
|
39
|
+
if (stat) {
|
|
40
|
+
if (!stat.directory) {
|
|
41
|
+
return 3003;
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return writer(s) ? 0 : 3001;
|
|
47
|
+
}
|
|
48
|
+
/** Writes `bytes` at `offset` of `path`, which is then `length` long; false where the host cannot. */
|
|
49
|
+
export function writeFile(s, path, bytes, offset, length) {
|
|
50
|
+
return writer(s)?.write(path, bytes, offset, length) ?? false;
|
|
51
|
+
}
|
|
52
|
+
/** File's createDirectory: 3002 for a file there; 0 once the directory is there. */
|
|
53
|
+
export function createDirectory(s, path) {
|
|
54
|
+
const stat = s.fileSystem?.stat(path);
|
|
55
|
+
if (stat) {
|
|
56
|
+
return stat.directory ? 0 : 3002;
|
|
57
|
+
}
|
|
58
|
+
return writer(s)?.createDirectory(path) ? 0 : 3001;
|
|
59
|
+
}
|
|
60
|
+
/** File's deleteFile: 3003 for nothing there, 3001 for a directory; 0 once it is gone. */
|
|
61
|
+
export function deleteFile(s, path) {
|
|
62
|
+
const stat = s.fileSystem?.stat(path);
|
|
63
|
+
if (!stat) {
|
|
64
|
+
return 3003;
|
|
65
|
+
}
|
|
66
|
+
if (stat.directory) {
|
|
67
|
+
return 3001;
|
|
68
|
+
}
|
|
69
|
+
return writer(s)?.remove(path) ? 0 : 3001;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* File's deleteDirectory: 3003 for nothing there, 3007 for a file, 3010
|
|
73
|
+
* for one with something in it unless `contents` go too; 0 once it is gone.
|
|
74
|
+
*/
|
|
75
|
+
export function deleteDirectory(s, path, contents) {
|
|
76
|
+
const host = s.fileSystem;
|
|
77
|
+
const stat = host?.stat(path);
|
|
78
|
+
if (!stat) {
|
|
79
|
+
return 3003;
|
|
80
|
+
}
|
|
81
|
+
if (!stat.directory) {
|
|
82
|
+
return 3007;
|
|
83
|
+
}
|
|
84
|
+
if (!contents && (host?.list(path)?.length ?? 0) > 0) {
|
|
85
|
+
return 3010;
|
|
86
|
+
}
|
|
87
|
+
return writer(s)?.remove(path) ? 0 : 3001;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* File's copyTo, and moveTo where `move`: 3003 for nothing at `from`, 3014
|
|
91
|
+
* where `to` is it or a directory it is in or under it, 3012 for something
|
|
92
|
+
* at `to` that may not be replaced (or cannot be removed); a directory is
|
|
93
|
+
* copied with all in it, and `to`'s directories are made. 0 once done.
|
|
94
|
+
*/
|
|
95
|
+
export function copyOrMove(s, from, to, overwrite, move) {
|
|
96
|
+
const host = s.fileSystem;
|
|
97
|
+
const paths = new NativePaths(host?.separator ?? "/");
|
|
98
|
+
if (!host?.stat(from)) {
|
|
99
|
+
return 3003;
|
|
100
|
+
}
|
|
101
|
+
if (paths.under(to, from) || paths.under(from, to)) {
|
|
102
|
+
return 3014;
|
|
103
|
+
}
|
|
104
|
+
const write = writer(s);
|
|
105
|
+
if (host.stat(to)) {
|
|
106
|
+
if (!overwrite || !write?.remove(to)) {
|
|
107
|
+
return 3012;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (!write) {
|
|
111
|
+
return 3001;
|
|
112
|
+
}
|
|
113
|
+
if (move && host.move) {
|
|
114
|
+
return host.move(from, to) ? 0 : 3001;
|
|
115
|
+
}
|
|
116
|
+
if (!copy(host, write, paths, from, to)) {
|
|
117
|
+
return 3001;
|
|
118
|
+
}
|
|
119
|
+
return !move || write.remove(from) ? 0 : 3001;
|
|
120
|
+
}
|
|
121
|
+
function copy(host, write, paths, from, to) {
|
|
122
|
+
const stat = host.stat(from);
|
|
123
|
+
if (!stat) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
if (!stat.directory) {
|
|
127
|
+
const bytes = host.read?.(from);
|
|
128
|
+
return !!bytes && write.write(to, bytes, 0, bytes.length);
|
|
129
|
+
}
|
|
130
|
+
if (!write.createDirectory(to)) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
for (const name of host.list(from) ?? []) {
|
|
134
|
+
if (!copy(host, write, paths, paths.resolve(from, name, null), paths.resolve(to, name, null))) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
/** An IOErrorEvent of `id`, its text adl's: "Error #id: message", and `suffix`. */
|
|
141
|
+
export function ioErrorEvent(s, id, suffix = "") {
|
|
142
|
+
return s.rt.construct(s.rt.classNamed("flash.events::IOErrorEvent"), "ioError", false, false, `${errorText(id)}${suffix}`, id);
|
|
143
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// flash.filters.BitmapFilter, and what its subclasses share: each keeps its
|
|
2
|
+
// values as adl converts them, in a record (`$filter`) that
|
|
3
|
+
// DisplayObject.filters copies to and from the display object's
|
|
4
|
+
// (display/filters.ts in the player), so a filter read back is a copy.
|
|
5
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
6
|
+
import { filterDefaults } from "../../../display/filters.js";
|
|
7
|
+
const CLASSES = [
|
|
8
|
+
["BlurFilter", "blur"],
|
|
9
|
+
["GlowFilter", "glow"],
|
|
10
|
+
["DropShadowFilter", "dropShadow"],
|
|
11
|
+
["BevelFilter", "bevel"],
|
|
12
|
+
["GradientGlowFilter", "gradientGlow"],
|
|
13
|
+
["GradientBevelFilter", "gradientBevel"],
|
|
14
|
+
["ColorMatrixFilter", "colorMatrix"],
|
|
15
|
+
["ConvolutionFilter", "convolution"],
|
|
16
|
+
["DisplacementMapFilter", "displacementMap"],
|
|
17
|
+
["ShaderFilter", "shader"],
|
|
18
|
+
];
|
|
19
|
+
/** A filter object's class by kind, for the objects a display object's filters are read back as. */
|
|
20
|
+
export function filterClassName(kind) {
|
|
21
|
+
return `flash.filters::${CLASSES.find(([, k]) => k === kind)?.[0]}`;
|
|
22
|
+
}
|
|
23
|
+
/** The kind of a filter object, by its class or a base of it: null for one that is no filter swf2es knows. */
|
|
24
|
+
export function filterKindOf(rt, o) {
|
|
25
|
+
for (let t = rt.traitsOf(o); t; t = t.base) {
|
|
26
|
+
const found = CLASSES.find(([name]) => t.name === `flash.filters::${name}`);
|
|
27
|
+
if (found) {
|
|
28
|
+
return found[1];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
/** The record of a filter object, made with the kind's defaults when first touched. */
|
|
34
|
+
export function recordOf(o, kind) {
|
|
35
|
+
o.$filter ??= filterDefaults(kind);
|
|
36
|
+
return o.$filter;
|
|
37
|
+
}
|
|
38
|
+
/** The conversions of filters' values as adl keeps them: alpha in 255ths, strength in 256ths, clamped. */
|
|
39
|
+
function filterValues(s) {
|
|
40
|
+
const num = (v) => s.rt.toNumber(v);
|
|
41
|
+
const blur = (v) => {
|
|
42
|
+
const n = num(v);
|
|
43
|
+
return Number.isNaN(n) ? n : Math.max(0, Math.min(255, n));
|
|
44
|
+
};
|
|
45
|
+
const quality = (v) => Math.max(0, Math.min(15, s.rt.toInt(v)));
|
|
46
|
+
const alpha = (v) => {
|
|
47
|
+
const n = num(v);
|
|
48
|
+
return Number.isNaN(n) ? 0 : Math.trunc(Math.max(0, Math.min(1, n)) * 255) / 255;
|
|
49
|
+
};
|
|
50
|
+
const color = (v) => s.rt.toUint(v) & 0xffffff;
|
|
51
|
+
// 8.8 fixed point, converted as x87 converts: past an int's range it is the indefinite, 0 once clamped.
|
|
52
|
+
const strength = (v) => {
|
|
53
|
+
const fixed = Math.trunc(num(v) * 256);
|
|
54
|
+
return Number.isFinite(fixed) && Math.abs(fixed) < 2 ** 31
|
|
55
|
+
? Math.max(0, Math.min(255 * 256, fixed)) / 256
|
|
56
|
+
: 0;
|
|
57
|
+
};
|
|
58
|
+
// Within a turn either way, through radians and back, left to right as
|
|
59
|
+
// adl's arithmetic goes: 300 is 300.00000000000006.
|
|
60
|
+
const angle = (v) => ((((num(v) % 360) * Math.PI) / 180) * 180) / Math.PI;
|
|
61
|
+
const type = (v) => {
|
|
62
|
+
if (v === null || v === undefined) {
|
|
63
|
+
throw s.rt.error("TypeError", 2007, "type");
|
|
64
|
+
}
|
|
65
|
+
const t = s.rt.toString(v);
|
|
66
|
+
return t === "inner" || t === "outer" ? t : "full";
|
|
67
|
+
};
|
|
68
|
+
/** An int through x87's conversion: out of int32's range it is the indefinite, 0 once clamped. */
|
|
69
|
+
const matrixSize = (v) => {
|
|
70
|
+
const n = Math.trunc(num(v));
|
|
71
|
+
return Number.isFinite(n) && Math.abs(n) < 2 ** 31 ? Math.max(0, Math.min(15, n)) : 0;
|
|
72
|
+
};
|
|
73
|
+
const elements = (v, name) => {
|
|
74
|
+
if (v === null || v === undefined) {
|
|
75
|
+
throw s.rt.error("TypeError", 2007, name);
|
|
76
|
+
}
|
|
77
|
+
return v.$a ?? [];
|
|
78
|
+
};
|
|
79
|
+
// A hole is 0, as a missing value is; an undefined one is NaN.
|
|
80
|
+
const floats = (values, length) => Array.from({ length }, (_, i) => (i in values ? Math.fround(num(values[i])) : 0));
|
|
81
|
+
/** The conversion of each value every kind that has it keeps alike, by its record's key. */
|
|
82
|
+
const converts = {
|
|
83
|
+
blurX: blur,
|
|
84
|
+
blurY: blur,
|
|
85
|
+
quality,
|
|
86
|
+
alpha,
|
|
87
|
+
color,
|
|
88
|
+
strength,
|
|
89
|
+
angle,
|
|
90
|
+
distance: num,
|
|
91
|
+
inner: Boolean,
|
|
92
|
+
knockout: Boolean,
|
|
93
|
+
hideObject: Boolean,
|
|
94
|
+
highlightColor: color,
|
|
95
|
+
highlightAlpha: alpha,
|
|
96
|
+
shadowColor: color,
|
|
97
|
+
shadowAlpha: alpha,
|
|
98
|
+
type,
|
|
99
|
+
divisor: (v) => Math.fround(num(v)),
|
|
100
|
+
bias: (v) => Math.fround(num(v)),
|
|
101
|
+
clamp: Boolean,
|
|
102
|
+
preserveAlpha: Boolean,
|
|
103
|
+
componentX: (v) => s.rt.toUint(v),
|
|
104
|
+
componentY: (v) => s.rt.toUint(v),
|
|
105
|
+
scaleX: (v) => scale(v),
|
|
106
|
+
scaleY: (v) => scale(v),
|
|
107
|
+
};
|
|
108
|
+
const props = Object.fromEntries(Object.entries(converts).map(([key, convert]) => [
|
|
109
|
+
key,
|
|
110
|
+
[
|
|
111
|
+
(f) => f[key],
|
|
112
|
+
(f, v) => {
|
|
113
|
+
f[key] = convert(v);
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
]));
|
|
117
|
+
function scale(v) {
|
|
118
|
+
const n = num(v);
|
|
119
|
+
return Number.isNaN(n) ? n : Math.fround(Math.max(-65535, Math.min(65535, n)));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A gradient's stops, at most 16, as adl keeps them: colours set their
|
|
123
|
+
* count, padding alphas and ratios with 0; alphas fill to it, padding
|
|
124
|
+
* with 1; ratios, truncated and clamped, can only make it fewer.
|
|
125
|
+
*/
|
|
126
|
+
function gradientProps() {
|
|
127
|
+
return {
|
|
128
|
+
colors: [
|
|
129
|
+
(f) => s.rt.array([...f.colors]),
|
|
130
|
+
(f, v) => {
|
|
131
|
+
// A hole reads as undefined, colour 0, where map would skip it.
|
|
132
|
+
const values = elements(v, "colors");
|
|
133
|
+
f.colors = Array.from({ length: Math.min(16, values.length) }, (_, i) => color(values[i]));
|
|
134
|
+
const n = f.colors.length;
|
|
135
|
+
f.alphas = Array.from({ length: n }, (_, i) => f.alphas[i] ?? 0);
|
|
136
|
+
f.ratios = Array.from({ length: n }, (_, i) => f.ratios[i] ?? 0);
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
alphas: [
|
|
140
|
+
(f) => s.rt.array([...f.alphas]),
|
|
141
|
+
(f, v) => {
|
|
142
|
+
const values = elements(v, "alphas");
|
|
143
|
+
f.alphas = Array.from({ length: f.colors.length }, (_, i) => i < values.length ? alpha(values[i]) : 1);
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
ratios: [
|
|
147
|
+
(f) => s.rt.array([...f.ratios]),
|
|
148
|
+
(f, v) => {
|
|
149
|
+
const values = elements(v, "ratios");
|
|
150
|
+
const n = Math.min(f.colors.length, values.length);
|
|
151
|
+
f.colors.length = n;
|
|
152
|
+
f.alphas.length = n;
|
|
153
|
+
f.ratios = Array.from({ length: n }, (_, i) => {
|
|
154
|
+
const x = Math.trunc(num(values[i]));
|
|
155
|
+
return Number.isNaN(x) ? 0 : Math.max(0, Math.min(255, x));
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return { num, alpha, color, matrixSize, elements, floats, props, gradientProps };
|
|
162
|
+
}
|
|
163
|
+
/** A filter class's natives: its kind's record's properties of `props`, and its `own`. */
|
|
164
|
+
export function filterNatives(s, kind, own = () => ({})) {
|
|
165
|
+
const natives = {};
|
|
166
|
+
const values = filterValues(s);
|
|
167
|
+
const { props } = values;
|
|
168
|
+
const name = filterClassName(kind).slice("flash.filters::".length);
|
|
169
|
+
const defaults = filterDefaults(kind);
|
|
170
|
+
const members = {};
|
|
171
|
+
const all = {
|
|
172
|
+
...Object.fromEntries(Object.keys(props)
|
|
173
|
+
.filter((k) => k in defaults)
|
|
174
|
+
.map((k) => [k, props[k]])),
|
|
175
|
+
...own(values),
|
|
176
|
+
};
|
|
177
|
+
for (const [key, [get, set]] of Object.entries(all)) {
|
|
178
|
+
members[key] = {
|
|
179
|
+
get() {
|
|
180
|
+
return get(recordOf(this, kind));
|
|
181
|
+
},
|
|
182
|
+
set(v) {
|
|
183
|
+
set(recordOf(this, kind), v);
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const cls = class {
|
|
188
|
+
};
|
|
189
|
+
Object.defineProperties(cls.prototype, members);
|
|
190
|
+
avm2.registerNativeClass(natives, `flash.filters::${name}`, cls);
|
|
191
|
+
return natives;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* BitmapFilter, as adl has it: abstract, and restricted, so that only
|
|
195
|
+
* playerglobal's own filters, and what extends them, are made; a script's
|
|
196
|
+
* class extending it is refused as it is.
|
|
197
|
+
*/
|
|
198
|
+
export const bitmapFilterHooks = {
|
|
199
|
+
"flash.filters::BitmapFilter": {
|
|
200
|
+
construct: (rt) => {
|
|
201
|
+
throw rt.error("ArgumentError", 2012, "BitmapFilter$");
|
|
202
|
+
},
|
|
203
|
+
restricted: true,
|
|
204
|
+
},
|
|
205
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { filterNatives } from "./BitmapFilter.js";
|
|
2
|
+
export function colorMatrixFilterNatives(s) {
|
|
3
|
+
return filterNatives(s, "colorMatrix", ({ elements, floats }) => ({
|
|
4
|
+
matrix: [
|
|
5
|
+
(f) => s.rt.array([...f.matrix]),
|
|
6
|
+
(f, v) => {
|
|
7
|
+
f.matrix = floats(elements(v, "matrix"), 20);
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { filterNatives } from "./BitmapFilter.js";
|
|
2
|
+
export function convolutionFilterNatives(s) {
|
|
3
|
+
return filterNatives(s, "convolution", ({ elements, floats, matrixSize }) => ({
|
|
4
|
+
matrix: [
|
|
5
|
+
(f) => s.rt.array([...f.matrix]),
|
|
6
|
+
(f, v) => {
|
|
7
|
+
f.matrix = floats(elements(v, "matrix"), f.matrixX * f.matrixY);
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
// Resized, the flat values stay in order, as many as fit, the rest 0.
|
|
11
|
+
matrixX: [
|
|
12
|
+
(f) => f.matrixX,
|
|
13
|
+
(f, v) => {
|
|
14
|
+
f.matrixX = matrixSize(v);
|
|
15
|
+
f.matrix = floats(f.matrix, f.matrixX * f.matrixY);
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
matrixY: [
|
|
19
|
+
(f) => f.matrixY,
|
|
20
|
+
(f, v) => {
|
|
21
|
+
f.matrixY = matrixSize(v);
|
|
22
|
+
f.matrix = floats(f.matrix, f.matrixX * f.matrixY);
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { filterNatives } from "./BitmapFilter.js";
|
|
2
|
+
/**
|
|
3
|
+
* A copy of a displacement map's BitmapData, made as Flash makes it: a
|
|
4
|
+
* plain BitmapData of the same pixels, not through the object's own
|
|
5
|
+
* clone, which a script may override. Null for none, or one disposed.
|
|
6
|
+
*/
|
|
7
|
+
export function copyMap(s, map) {
|
|
8
|
+
const store = map?.$store;
|
|
9
|
+
if (!store || store.disposed) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const o = s.rt.construct(s.rt.classNamed("flash.display::BitmapData"), store.width, store.height, store.transparent, 0);
|
|
13
|
+
o.$store = store.clone();
|
|
14
|
+
return o;
|
|
15
|
+
}
|
|
16
|
+
export function displacementMapFilterNatives(s) {
|
|
17
|
+
return filterNatives(s, "displacementMap", ({ num }) => ({
|
|
18
|
+
// A copy each way, as adl gives one: the map's pixels, the point in whole pixels.
|
|
19
|
+
mapBitmap: [
|
|
20
|
+
(f) => copyMap(s, f.mapBitmap),
|
|
21
|
+
(f, v) => {
|
|
22
|
+
f.mapBitmap = v ?? null;
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
mapPoint: [
|
|
26
|
+
(f) => s.rt.construct(s.rt.classNamed("flash.geom::Point"), f.mapPoint[0], f.mapPoint[1]),
|
|
27
|
+
(f, v) => {
|
|
28
|
+
const p = v;
|
|
29
|
+
f.mapPoint = p
|
|
30
|
+
? [
|
|
31
|
+
Math.trunc(num(s.rt.getProperty(p, s.rt.publicName("x")))) || 0,
|
|
32
|
+
Math.trunc(num(s.rt.getProperty(p, s.rt.publicName("y")))) || 0,
|
|
33
|
+
]
|
|
34
|
+
: [0, 0];
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
mode: [
|
|
38
|
+
(f) => f.mode,
|
|
39
|
+
(f, v) => {
|
|
40
|
+
if (v === null || v === undefined) {
|
|
41
|
+
throw s.rt.error("TypeError", 2007, "mode");
|
|
42
|
+
}
|
|
43
|
+
const mode = s.rt.toString(v);
|
|
44
|
+
if (!["wrap", "clamp", "ignore", "color"].includes(mode)) {
|
|
45
|
+
throw s.rt.error("ArgumentError", 2008, "mode");
|
|
46
|
+
}
|
|
47
|
+
f.mode = mode;
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { kernelOfShader } from "../display/shaders.js";
|
|
2
|
+
import { filterNatives } from "./BitmapFilter.js";
|
|
3
|
+
export function shaderFilterNatives(s) {
|
|
4
|
+
const extension = (v) => {
|
|
5
|
+
const n = s.rt.toInt(v);
|
|
6
|
+
if (n < 0) {
|
|
7
|
+
throw s.rt.error("RangeError", 2006);
|
|
8
|
+
}
|
|
9
|
+
return n;
|
|
10
|
+
};
|
|
11
|
+
const side = (k) => [
|
|
12
|
+
(f) => f.extensions[k],
|
|
13
|
+
(f, v) => {
|
|
14
|
+
f.extensions[k] = extension(v);
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
return filterNatives(s, "shader", () => ({
|
|
18
|
+
shader: [
|
|
19
|
+
(f) => f.shader ?? null,
|
|
20
|
+
(f, v) => {
|
|
21
|
+
if (v === null || v === undefined) {
|
|
22
|
+
throw s.rt.error("TypeError", 2007, "shader");
|
|
23
|
+
}
|
|
24
|
+
if (!kernelOfShader(v)) {
|
|
25
|
+
throw s.rt.error("ArgumentError", 2171);
|
|
26
|
+
}
|
|
27
|
+
f.shader = v;
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
leftExtension: side(0),
|
|
31
|
+
topExtension: side(1),
|
|
32
|
+
rightExtension: side(2),
|
|
33
|
+
bottomExtension: side(3),
|
|
34
|
+
"flash.filters:ShaderFilter::_extendBy": [
|
|
35
|
+
(f) => {
|
|
36
|
+
const [left, top, right, bottom] = f.extensions;
|
|
37
|
+
return s.rt.construct(s.rt.classNamed("flash.geom::Rectangle"), left, top, right - left, bottom - top);
|
|
38
|
+
},
|
|
39
|
+
(f, v) => {
|
|
40
|
+
if (v === null || v === undefined) {
|
|
41
|
+
throw s.rt.error("TypeError", 2007, "extendBy");
|
|
42
|
+
}
|
|
43
|
+
const read = (k) => s.rt.getProperty(v, s.rt.publicName(k));
|
|
44
|
+
f.extensions = [
|
|
45
|
+
extension(read("left")),
|
|
46
|
+
extension(read("top")),
|
|
47
|
+
extension(read("right")),
|
|
48
|
+
extension(read("bottom")),
|
|
49
|
+
];
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
}));
|
|
53
|
+
}
|