@nice2dev/ui-graphics 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/LICENSE +21 -0
- package/README.md +339 -0
- package/dist/cjs/animation/AnimatedPerson.js +153 -0
- package/dist/cjs/animation/AnimatedPerson.js.map +1 -0
- package/dist/cjs/animation/AnimationEditor.js +106 -0
- package/dist/cjs/animation/AnimationEditor.js.map +1 -0
- package/dist/cjs/animation/Audience.js +59 -0
- package/dist/cjs/animation/Audience.js.map +1 -0
- package/dist/cjs/animation/BodyRenderer.js +33 -0
- package/dist/cjs/animation/BodyRenderer.js.map +1 -0
- package/dist/cjs/animation/animationHelper.js +272 -0
- package/dist/cjs/animation/animationHelper.js.map +1 -0
- package/dist/cjs/animation/characterTypes.js +75 -0
- package/dist/cjs/animation/characterTypes.js.map +1 -0
- package/dist/cjs/animation/choreoDSL.js +190 -0
- package/dist/cjs/animation/choreoDSL.js.map +1 -0
- package/dist/cjs/animation/choreography.js +41 -0
- package/dist/cjs/animation/choreography.js.map +1 -0
- package/dist/cjs/animation/karaokeIntegration.js +98 -0
- package/dist/cjs/animation/karaokeIntegration.js.map +1 -0
- package/dist/cjs/animation/lottieExport.js +128 -0
- package/dist/cjs/animation/lottieExport.js.map +1 -0
- package/dist/cjs/animation/motionPath.js +196 -0
- package/dist/cjs/animation/motionPath.js.map +1 -0
- package/dist/cjs/animation/physics.js +201 -0
- package/dist/cjs/animation/physics.js.map +1 -0
- package/dist/cjs/animation/rig/RigPlayer.js +63 -0
- package/dist/cjs/animation/rig/RigPlayer.js.map +1 -0
- package/dist/cjs/animation/rig/RiggedBody.js +30 -0
- package/dist/cjs/animation/rig/RiggedBody.js.map +1 -0
- package/dist/cjs/animation/rig/choreoRigBridge.js +63 -0
- package/dist/cjs/animation/rig/choreoRigBridge.js.map +1 -0
- package/dist/cjs/animation/rig/ik.js +22 -0
- package/dist/cjs/animation/rig/ik.js.map +1 -0
- package/dist/cjs/animation/rig/poseOps.js +49 -0
- package/dist/cjs/animation/rig/poseOps.js.map +1 -0
- package/dist/cjs/animation/rig/presets.js +60 -0
- package/dist/cjs/animation/rig/presets.js.map +1 -0
- package/dist/cjs/animation/rig/rigMath.js +41 -0
- package/dist/cjs/animation/rig/rigMath.js.map +1 -0
- package/dist/cjs/animation/rig/rigTypes.js +44 -0
- package/dist/cjs/animation/rig/rigTypes.js.map +1 -0
- package/dist/cjs/animation/shapes/arms.js +15 -0
- package/dist/cjs/animation/shapes/arms.js.map +1 -0
- package/dist/cjs/animation/shapes/eyes.js +52 -0
- package/dist/cjs/animation/shapes/eyes.js.map +1 -0
- package/dist/cjs/animation/shapes/hair.js +55 -0
- package/dist/cjs/animation/shapes/hair.js.map +1 -0
- package/dist/cjs/animation/shapes/heads.js +62 -0
- package/dist/cjs/animation/shapes/heads.js.map +1 -0
- package/dist/cjs/animation/shapes/headwear.js +44 -0
- package/dist/cjs/animation/shapes/headwear.js.map +1 -0
- package/dist/cjs/animation/shapes/legs.js +15 -0
- package/dist/cjs/animation/shapes/legs.js.map +1 -0
- package/dist/cjs/animation/shapes/mouths.js +53 -0
- package/dist/cjs/animation/shapes/mouths.js.map +1 -0
- package/dist/cjs/animation/shapes/noses.js +31 -0
- package/dist/cjs/animation/shapes/noses.js.map +1 -0
- package/dist/cjs/animation/shapes/outfits.js +43 -0
- package/dist/cjs/animation/shapes/outfits.js.map +1 -0
- package/dist/cjs/animation/shapes/torsos.js +13 -0
- package/dist/cjs/animation/shapes/torsos.js.map +1 -0
- package/dist/cjs/animation/spineExport.js +132 -0
- package/dist/cjs/animation/spineExport.js.map +1 -0
- package/dist/cjs/core/LocalUI.js +54 -0
- package/dist/cjs/core/LocalUI.js.map +1 -0
- package/dist/cjs/core/collaboration.js +259 -0
- package/dist/cjs/core/collaboration.js.map +1 -0
- package/dist/cjs/core/colorBlindness.js +97 -0
- package/dist/cjs/core/colorBlindness.js.map +1 -0
- package/dist/cjs/core/dragDrop.js +168 -0
- package/dist/cjs/core/dragDrop.js.map +1 -0
- package/dist/cjs/core/fixes.js +185 -0
- package/dist/cjs/core/fixes.js.map +1 -0
- package/dist/cjs/core/gridGuides.js +245 -0
- package/dist/cjs/core/gridGuides.js.map +1 -0
- package/dist/cjs/core/historyVisual.js +124 -0
- package/dist/cjs/core/historyVisual.js.map +1 -0
- package/dist/cjs/core/i18n.js +16 -0
- package/dist/cjs/core/i18n.js.map +1 -0
- package/dist/cjs/core/integrations.js +261 -0
- package/dist/cjs/core/integrations.js.map +1 -0
- package/dist/cjs/core/minimap.js +142 -0
- package/dist/cjs/core/minimap.js.map +1 -0
- package/dist/cjs/core/plugins.js +129 -0
- package/dist/cjs/core/plugins.js.map +1 -0
- package/dist/cjs/core/rtl.js +102 -0
- package/dist/cjs/core/rtl.js.map +1 -0
- package/dist/cjs/core/shortcuts.js +205 -0
- package/dist/cjs/core/shortcuts.js.map +1 -0
- package/dist/cjs/core/theme.js +171 -0
- package/dist/cjs/core/theme.js.map +1 -0
- package/dist/cjs/font/NiceFontEditor.js +193 -0
- package/dist/cjs/font/NiceFontEditor.js.map +1 -0
- package/dist/cjs/game/GameAsset2dEditor.js +371 -0
- package/dist/cjs/game/GameAsset2dEditor.js.map +1 -0
- package/dist/cjs/game/GameAsset2dEditor.module.css.js +6 -0
- package/dist/cjs/game/GameAsset2dEditor.module.css.js.map +1 -0
- package/dist/cjs/game/gameAssetTypes.js +20 -0
- package/dist/cjs/game/gameAssetTypes.js.map +1 -0
- package/dist/cjs/game/gameAssetUtils.js +475 -0
- package/dist/cjs/game/gameAssetUtils.js.map +1 -0
- package/dist/cjs/game/useGameAssetEditor.js +761 -0
- package/dist/cjs/game/useGameAssetEditor.js.map +1 -0
- package/dist/cjs/icon/NiceIconEditor.js +249 -0
- package/dist/cjs/icon/NiceIconEditor.js.map +1 -0
- package/dist/cjs/index.js +264 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/nice2dev-ui/dist/index.js +32070 -0
- package/dist/cjs/nice2dev-ui/dist/index.js.map +1 -0
- package/dist/cjs/nice2dev-ui-graphics.css +1 -0
- package/dist/cjs/photo/FilterThumb.js +29 -0
- package/dist/cjs/photo/FilterThumb.js.map +1 -0
- package/dist/cjs/photo/PhotoEditor.js +20 -0
- package/dist/cjs/photo/PhotoEditor.js.map +1 -0
- package/dist/cjs/photo/PhotoEditor.module.css.js +6 -0
- package/dist/cjs/photo/PhotoEditor.module.css.js.map +1 -0
- package/dist/cjs/photo/PhotoEditorCanvas.js +59 -0
- package/dist/cjs/photo/PhotoEditorCanvas.js.map +1 -0
- package/dist/cjs/photo/PhotoEditorLeftPanel.js +174 -0
- package/dist/cjs/photo/PhotoEditorLeftPanel.js.map +1 -0
- package/dist/cjs/photo/PhotoEditorToolbar.js +15 -0
- package/dist/cjs/photo/PhotoEditorToolbar.js.map +1 -0
- package/dist/cjs/photo/photoEditorActions.js +80 -0
- package/dist/cjs/photo/photoEditorActions.js.map +1 -0
- package/dist/cjs/photo/photoEditorTypes.js +40 -0
- package/dist/cjs/photo/photoEditorTypes.js.map +1 -0
- package/dist/cjs/photo/photoFilters.js +880 -0
- package/dist/cjs/photo/photoFilters.js.map +1 -0
- package/dist/cjs/photo/photoOverlays.js +651 -0
- package/dist/cjs/photo/photoOverlays.js.map +1 -0
- package/dist/cjs/photo/photoSelection.js +547 -0
- package/dist/cjs/photo/photoSelection.js.map +1 -0
- package/dist/cjs/photo/usePhotoEditor.js +640 -0
- package/dist/cjs/photo/usePhotoEditor.js.map +1 -0
- package/dist/cjs/pixel/HSVPicker.js +173 -0
- package/dist/cjs/pixel/HSVPicker.js.map +1 -0
- package/dist/cjs/pixel/PixelEditor.js +28 -0
- package/dist/cjs/pixel/PixelEditor.js.map +1 -0
- package/dist/cjs/pixel/PixelEditor.module.css.js +6 -0
- package/dist/cjs/pixel/PixelEditor.module.css.js.map +1 -0
- package/dist/cjs/pixel/PixelEditorCanvas.js +15 -0
- package/dist/cjs/pixel/PixelEditorCanvas.js.map +1 -0
- package/dist/cjs/pixel/PixelEditorMenuBar.js +11 -0
- package/dist/cjs/pixel/PixelEditorMenuBar.js.map +1 -0
- package/dist/cjs/pixel/PixelEditorRightPanel.js +15 -0
- package/dist/cjs/pixel/PixelEditorRightPanel.js.map +1 -0
- package/dist/cjs/pixel/PixelEditorStatusBar.js +15 -0
- package/dist/cjs/pixel/PixelEditorStatusBar.js.map +1 -0
- package/dist/cjs/pixel/PixelEditorTimeline.js +11 -0
- package/dist/cjs/pixel/PixelEditorTimeline.js.map +1 -0
- package/dist/cjs/pixel/PixelEditorToolbar.js +16 -0
- package/dist/cjs/pixel/PixelEditorToolbar.js.map +1 -0
- package/dist/cjs/pixel/asepriteFormat.js +512 -0
- package/dist/cjs/pixel/asepriteFormat.js.map +1 -0
- package/dist/cjs/pixel/pixelEditorExports.js +471 -0
- package/dist/cjs/pixel/pixelEditorExports.js.map +1 -0
- package/dist/cjs/pixel/pixelEditorTypes.js +102 -0
- package/dist/cjs/pixel/pixelEditorTypes.js.map +1 -0
- package/dist/cjs/pixel/pixelEditorUtils.js +664 -0
- package/dist/cjs/pixel/pixelEditorUtils.js.map +1 -0
- package/dist/cjs/pixel/usePixelEditor.js +1112 -0
- package/dist/cjs/pixel/usePixelEditor.js.map +1 -0
- package/dist/cjs/texture/Nice3DTexturePainter.js +236 -0
- package/dist/cjs/texture/Nice3DTexturePainter.js.map +1 -0
- package/dist/cjs/ui/NiceUIDesigner.js +191 -0
- package/dist/cjs/ui/NiceUIDesigner.js.map +1 -0
- package/dist/cjs/vector/VectorEditor.js +31 -0
- package/dist/cjs/vector/VectorEditor.js.map +1 -0
- package/dist/cjs/vector/VectorEditor.module.css.js +6 -0
- package/dist/cjs/vector/VectorEditor.module.css.js.map +1 -0
- package/dist/cjs/vector/VectorEditorMenuBar.js +16 -0
- package/dist/cjs/vector/VectorEditorMenuBar.js.map +1 -0
- package/dist/cjs/vector/VectorEditorRightPanel.js +126 -0
- package/dist/cjs/vector/VectorEditorRightPanel.js.map +1 -0
- package/dist/cjs/vector/VectorEditorShapeRenderer.js +55 -0
- package/dist/cjs/vector/VectorEditorShapeRenderer.js.map +1 -0
- package/dist/cjs/vector/VectorEditorStatusBar.js +14 -0
- package/dist/cjs/vector/VectorEditorStatusBar.js.map +1 -0
- package/dist/cjs/vector/useVectorEditor.js +613 -0
- package/dist/cjs/vector/useVectorEditor.js.map +1 -0
- package/dist/cjs/vector/vectorBooleanOps.js +511 -0
- package/dist/cjs/vector/vectorBooleanOps.js.map +1 -0
- package/dist/cjs/vector/vectorEditorExport.js +159 -0
- package/dist/cjs/vector/vectorEditorExport.js.map +1 -0
- package/dist/cjs/vector/vectorEditorImport.js +150 -0
- package/dist/cjs/vector/vectorEditorImport.js.map +1 -0
- package/dist/cjs/vector/vectorEditorTypes.js +72 -0
- package/dist/cjs/vector/vectorEditorTypes.js.map +1 -0
- package/dist/cjs/vector/vectorGradients.js +201 -0
- package/dist/cjs/vector/vectorGradients.js.map +1 -0
- package/dist/esm/animation/AnimatedPerson.js +151 -0
- package/dist/esm/animation/AnimatedPerson.js.map +1 -0
- package/dist/esm/animation/AnimationEditor.js +104 -0
- package/dist/esm/animation/AnimationEditor.js.map +1 -0
- package/dist/esm/animation/Audience.js +57 -0
- package/dist/esm/animation/Audience.js.map +1 -0
- package/dist/esm/animation/BodyRenderer.js +28 -0
- package/dist/esm/animation/BodyRenderer.js.map +1 -0
- package/dist/esm/animation/animationHelper.js +268 -0
- package/dist/esm/animation/animationHelper.js.map +1 -0
- package/dist/esm/animation/characterTypes.js +70 -0
- package/dist/esm/animation/characterTypes.js.map +1 -0
- package/dist/esm/animation/choreoDSL.js +182 -0
- package/dist/esm/animation/choreoDSL.js.map +1 -0
- package/dist/esm/animation/choreography.js +36 -0
- package/dist/esm/animation/choreography.js.map +1 -0
- package/dist/esm/animation/karaokeIntegration.js +91 -0
- package/dist/esm/animation/karaokeIntegration.js.map +1 -0
- package/dist/esm/animation/lottieExport.js +123 -0
- package/dist/esm/animation/lottieExport.js.map +1 -0
- package/dist/esm/animation/motionPath.js +185 -0
- package/dist/esm/animation/motionPath.js.map +1 -0
- package/dist/esm/animation/physics.js +192 -0
- package/dist/esm/animation/physics.js.map +1 -0
- package/dist/esm/animation/rig/RigPlayer.js +61 -0
- package/dist/esm/animation/rig/RigPlayer.js.map +1 -0
- package/dist/esm/animation/rig/RiggedBody.js +28 -0
- package/dist/esm/animation/rig/RiggedBody.js.map +1 -0
- package/dist/esm/animation/rig/choreoRigBridge.js +60 -0
- package/dist/esm/animation/rig/choreoRigBridge.js.map +1 -0
- package/dist/esm/animation/rig/ik.js +20 -0
- package/dist/esm/animation/rig/ik.js.map +1 -0
- package/dist/esm/animation/rig/poseOps.js +45 -0
- package/dist/esm/animation/rig/poseOps.js.map +1 -0
- package/dist/esm/animation/rig/presets.js +53 -0
- package/dist/esm/animation/rig/presets.js.map +1 -0
- package/dist/esm/animation/rig/rigMath.js +37 -0
- package/dist/esm/animation/rig/rigMath.js.map +1 -0
- package/dist/esm/animation/rig/rigTypes.js +40 -0
- package/dist/esm/animation/rig/rigTypes.js.map +1 -0
- package/dist/esm/animation/shapes/arms.js +13 -0
- package/dist/esm/animation/shapes/arms.js.map +1 -0
- package/dist/esm/animation/shapes/eyes.js +45 -0
- package/dist/esm/animation/shapes/eyes.js.map +1 -0
- package/dist/esm/animation/shapes/hair.js +46 -0
- package/dist/esm/animation/shapes/hair.js.map +1 -0
- package/dist/esm/animation/shapes/heads.js +52 -0
- package/dist/esm/animation/shapes/heads.js.map +1 -0
- package/dist/esm/animation/shapes/headwear.js +36 -0
- package/dist/esm/animation/shapes/headwear.js.map +1 -0
- package/dist/esm/animation/shapes/legs.js +13 -0
- package/dist/esm/animation/shapes/legs.js.map +1 -0
- package/dist/esm/animation/shapes/mouths.js +45 -0
- package/dist/esm/animation/shapes/mouths.js.map +1 -0
- package/dist/esm/animation/shapes/noses.js +23 -0
- package/dist/esm/animation/shapes/noses.js.map +1 -0
- package/dist/esm/animation/shapes/outfits.js +37 -0
- package/dist/esm/animation/shapes/outfits.js.map +1 -0
- package/dist/esm/animation/shapes/torsos.js +11 -0
- package/dist/esm/animation/shapes/torsos.js.map +1 -0
- package/dist/esm/animation/spineExport.js +128 -0
- package/dist/esm/animation/spineExport.js.map +1 -0
- package/dist/esm/core/LocalUI.js +50 -0
- package/dist/esm/core/LocalUI.js.map +1 -0
- package/dist/esm/core/collaboration.js +252 -0
- package/dist/esm/core/collaboration.js.map +1 -0
- package/dist/esm/core/colorBlindness.js +90 -0
- package/dist/esm/core/colorBlindness.js.map +1 -0
- package/dist/esm/core/dragDrop.js +165 -0
- package/dist/esm/core/dragDrop.js.map +1 -0
- package/dist/esm/core/fixes.js +179 -0
- package/dist/esm/core/fixes.js.map +1 -0
- package/dist/esm/core/gridGuides.js +232 -0
- package/dist/esm/core/gridGuides.js.map +1 -0
- package/dist/esm/core/historyVisual.js +121 -0
- package/dist/esm/core/historyVisual.js.map +1 -0
- package/dist/esm/core/i18n.js +13 -0
- package/dist/esm/core/i18n.js.map +1 -0
- package/dist/esm/core/integrations.js +254 -0
- package/dist/esm/core/integrations.js.map +1 -0
- package/dist/esm/core/minimap.js +139 -0
- package/dist/esm/core/minimap.js.map +1 -0
- package/dist/esm/core/plugins.js +124 -0
- package/dist/esm/core/plugins.js.map +1 -0
- package/dist/esm/core/rtl.js +95 -0
- package/dist/esm/core/rtl.js.map +1 -0
- package/dist/esm/core/shortcuts.js +200 -0
- package/dist/esm/core/shortcuts.js.map +1 -0
- package/dist/esm/core/theme.js +162 -0
- package/dist/esm/core/theme.js.map +1 -0
- package/dist/esm/font/NiceFontEditor.js +189 -0
- package/dist/esm/font/NiceFontEditor.js.map +1 -0
- package/dist/esm/game/GameAsset2dEditor.js +369 -0
- package/dist/esm/game/GameAsset2dEditor.js.map +1 -0
- package/dist/esm/game/GameAsset2dEditor.module.css.js +4 -0
- package/dist/esm/game/GameAsset2dEditor.module.css.js.map +1 -0
- package/dist/esm/game/gameAssetTypes.js +18 -0
- package/dist/esm/game/gameAssetTypes.js.map +1 -0
- package/dist/esm/game/gameAssetUtils.js +456 -0
- package/dist/esm/game/gameAssetUtils.js.map +1 -0
- package/dist/esm/game/useGameAssetEditor.js +759 -0
- package/dist/esm/game/useGameAssetEditor.js.map +1 -0
- package/dist/esm/icon/NiceIconEditor.js +246 -0
- package/dist/esm/icon/NiceIconEditor.js.map +1 -0
- package/dist/esm/index.js +59 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/nice2dev-ui/dist/index.js +31720 -0
- package/dist/esm/nice2dev-ui/dist/index.js.map +1 -0
- package/dist/esm/nice2dev-ui-graphics.css +1 -0
- package/dist/esm/photo/FilterThumb.js +27 -0
- package/dist/esm/photo/FilterThumb.js.map +1 -0
- package/dist/esm/photo/PhotoEditor.js +18 -0
- package/dist/esm/photo/PhotoEditor.js.map +1 -0
- package/dist/esm/photo/PhotoEditor.module.css.js +4 -0
- package/dist/esm/photo/PhotoEditor.module.css.js.map +1 -0
- package/dist/esm/photo/PhotoEditorCanvas.js +57 -0
- package/dist/esm/photo/PhotoEditorCanvas.js.map +1 -0
- package/dist/esm/photo/PhotoEditorLeftPanel.js +172 -0
- package/dist/esm/photo/PhotoEditorLeftPanel.js.map +1 -0
- package/dist/esm/photo/PhotoEditorToolbar.js +13 -0
- package/dist/esm/photo/PhotoEditorToolbar.js.map +1 -0
- package/dist/esm/photo/photoEditorActions.js +75 -0
- package/dist/esm/photo/photoEditorActions.js.map +1 -0
- package/dist/esm/photo/photoEditorTypes.js +36 -0
- package/dist/esm/photo/photoEditorTypes.js.map +1 -0
- package/dist/esm/photo/photoFilters.js +871 -0
- package/dist/esm/photo/photoFilters.js.map +1 -0
- package/dist/esm/photo/photoOverlays.js +636 -0
- package/dist/esm/photo/photoOverlays.js.map +1 -0
- package/dist/esm/photo/photoSelection.js +535 -0
- package/dist/esm/photo/photoSelection.js.map +1 -0
- package/dist/esm/photo/usePhotoEditor.js +638 -0
- package/dist/esm/photo/usePhotoEditor.js.map +1 -0
- package/dist/esm/pixel/HSVPicker.js +171 -0
- package/dist/esm/pixel/HSVPicker.js.map +1 -0
- package/dist/esm/pixel/PixelEditor.js +26 -0
- package/dist/esm/pixel/PixelEditor.js.map +1 -0
- package/dist/esm/pixel/PixelEditor.module.css.js +4 -0
- package/dist/esm/pixel/PixelEditor.module.css.js.map +1 -0
- package/dist/esm/pixel/PixelEditorCanvas.js +13 -0
- package/dist/esm/pixel/PixelEditorCanvas.js.map +1 -0
- package/dist/esm/pixel/PixelEditorMenuBar.js +9 -0
- package/dist/esm/pixel/PixelEditorMenuBar.js.map +1 -0
- package/dist/esm/pixel/PixelEditorRightPanel.js +13 -0
- package/dist/esm/pixel/PixelEditorRightPanel.js.map +1 -0
- package/dist/esm/pixel/PixelEditorStatusBar.js +13 -0
- package/dist/esm/pixel/PixelEditorStatusBar.js.map +1 -0
- package/dist/esm/pixel/PixelEditorTimeline.js +9 -0
- package/dist/esm/pixel/PixelEditorTimeline.js.map +1 -0
- package/dist/esm/pixel/PixelEditorToolbar.js +14 -0
- package/dist/esm/pixel/PixelEditorToolbar.js.map +1 -0
- package/dist/esm/pixel/asepriteFormat.js +505 -0
- package/dist/esm/pixel/asepriteFormat.js.map +1 -0
- package/dist/esm/pixel/pixelEditorExports.js +461 -0
- package/dist/esm/pixel/pixelEditorExports.js.map +1 -0
- package/dist/esm/pixel/pixelEditorTypes.js +90 -0
- package/dist/esm/pixel/pixelEditorTypes.js.map +1 -0
- package/dist/esm/pixel/pixelEditorUtils.js +631 -0
- package/dist/esm/pixel/pixelEditorUtils.js.map +1 -0
- package/dist/esm/pixel/usePixelEditor.js +1110 -0
- package/dist/esm/pixel/usePixelEditor.js.map +1 -0
- package/dist/esm/texture/Nice3DTexturePainter.js +233 -0
- package/dist/esm/texture/Nice3DTexturePainter.js.map +1 -0
- package/dist/esm/ui/NiceUIDesigner.js +187 -0
- package/dist/esm/ui/NiceUIDesigner.js.map +1 -0
- package/dist/esm/vector/VectorEditor.js +29 -0
- package/dist/esm/vector/VectorEditor.js.map +1 -0
- package/dist/esm/vector/VectorEditor.module.css.js +4 -0
- package/dist/esm/vector/VectorEditor.module.css.js.map +1 -0
- package/dist/esm/vector/VectorEditorMenuBar.js +14 -0
- package/dist/esm/vector/VectorEditorMenuBar.js.map +1 -0
- package/dist/esm/vector/VectorEditorRightPanel.js +124 -0
- package/dist/esm/vector/VectorEditorRightPanel.js.map +1 -0
- package/dist/esm/vector/VectorEditorShapeRenderer.js +53 -0
- package/dist/esm/vector/VectorEditorShapeRenderer.js.map +1 -0
- package/dist/esm/vector/VectorEditorStatusBar.js +12 -0
- package/dist/esm/vector/VectorEditorStatusBar.js.map +1 -0
- package/dist/esm/vector/useVectorEditor.js +611 -0
- package/dist/esm/vector/useVectorEditor.js.map +1 -0
- package/dist/esm/vector/vectorBooleanOps.js +507 -0
- package/dist/esm/vector/vectorBooleanOps.js.map +1 -0
- package/dist/esm/vector/vectorEditorExport.js +152 -0
- package/dist/esm/vector/vectorEditorExport.js.map +1 -0
- package/dist/esm/vector/vectorEditorImport.js +148 -0
- package/dist/esm/vector/vectorEditorImport.js.map +1 -0
- package/dist/esm/vector/vectorEditorTypes.js +63 -0
- package/dist/esm/vector/vectorEditorTypes.js.map +1 -0
- package/dist/esm/vector/vectorGradients.js +193 -0
- package/dist/esm/vector/vectorGradients.js.map +1 -0
- package/dist/types/__benchmarks__/bench.d.ts +13 -0
- package/dist/types/__tests__/setup.d.ts +4 -0
- package/dist/types/animation/AnimatedPerson.d.ts +14 -0
- package/dist/types/animation/AnimationEditor.d.ts +20 -0
- package/dist/types/animation/Audience.d.ts +11 -0
- package/dist/types/animation/BodyRenderer.d.ts +12 -0
- package/dist/types/animation/animationHelper.d.ts +28 -0
- package/dist/types/animation/characterTypes.d.ts +37 -0
- package/dist/types/animation/choreoDSL.d.ts +88 -0
- package/dist/types/animation/choreography.d.ts +8 -0
- package/dist/types/animation/karaokeIntegration.d.ts +31 -0
- package/dist/types/animation/lottieExport.d.ts +77 -0
- package/dist/types/animation/motionPath.d.ts +60 -0
- package/dist/types/animation/physics.d.ts +73 -0
- package/dist/types/animation/rig/RigPlayer.d.ts +32 -0
- package/dist/types/animation/rig/RiggedBody.d.ts +19 -0
- package/dist/types/animation/rig/choreoRigBridge.d.ts +9 -0
- package/dist/types/animation/rig/ik.d.ts +8 -0
- package/dist/types/animation/rig/poseOps.d.ts +14 -0
- package/dist/types/animation/rig/presets.d.ts +13 -0
- package/dist/types/animation/rig/rigMath.d.ts +7 -0
- package/dist/types/animation/rig/rigTypes.d.ts +38 -0
- package/dist/types/animation/shapes/arms.d.ts +10 -0
- package/dist/types/animation/shapes/eyes.d.ts +17 -0
- package/dist/types/animation/shapes/hair.d.ts +17 -0
- package/dist/types/animation/shapes/heads.d.ts +18 -0
- package/dist/types/animation/shapes/headwear.d.ts +16 -0
- package/dist/types/animation/shapes/legs.d.ts +10 -0
- package/dist/types/animation/shapes/mouths.d.ts +17 -0
- package/dist/types/animation/shapes/noses.d.ts +17 -0
- package/dist/types/animation/shapes/outfits.d.ts +14 -0
- package/dist/types/animation/shapes/torsos.d.ts +9 -0
- package/dist/types/animation/spineExport.d.ts +66 -0
- package/dist/types/core/LocalUI.d.ts +21 -0
- package/dist/types/core/collaboration.d.ts +164 -0
- package/dist/types/core/colorBlindness.d.ts +24 -0
- package/dist/types/core/dragDrop.d.ts +46 -0
- package/dist/types/core/fixes.d.ts +80 -0
- package/dist/types/core/gridGuides.d.ts +70 -0
- package/dist/types/core/historyVisual.d.ts +915 -0
- package/dist/types/core/i18n.d.ts +27 -0
- package/dist/types/core/integrations.d.ts +103 -0
- package/dist/types/core/minimap.d.ts +49 -0
- package/dist/types/core/plugins.d.ts +111 -0
- package/dist/types/core/rtl.d.ts +32 -0
- package/dist/types/core/shortcuts.d.ts +150 -0
- package/dist/types/core/theme.d.ts +78 -0
- package/dist/types/core/useGamepad.d.ts +64 -0
- package/dist/types/core/usePointerPressure.d.ts +88 -0
- package/dist/types/font/NiceFontEditor.d.ts +62 -0
- package/dist/types/game/AnimationPreviewPlayer.d.ts +29 -0
- package/dist/types/game/CollisionEditor.d.ts +101 -0
- package/dist/types/game/GameAsset2dEditor.d.ts +17 -0
- package/dist/types/game/GameAssetExportPanel.d.ts +20 -0
- package/dist/types/game/IsometricEditor.d.ts +22 -0
- package/dist/types/game/IsometricTilePanel.d.ts +18 -0
- package/dist/types/game/gameAssetExport.d.ts +160 -0
- package/dist/types/game/gameAssetTypes.d.ts +238 -0
- package/dist/types/game/gameAssetUtils.d.ts +23 -0
- package/dist/types/game/index.d.ts +8 -0
- package/dist/types/game/isometricTiles.d.ts +250 -0
- package/dist/types/game/useAnimationPreview.d.ts +63 -0
- package/dist/types/game/useCollisionEditor.d.ts +96 -0
- package/dist/types/game/useGameAssetEditor.d.ts +79 -0
- package/dist/types/game/useGameAssetExport.d.ts +82 -0
- package/dist/types/icon/NiceIconEditor.d.ts +79 -0
- package/dist/types/index.d.ts +85 -0
- package/dist/types/photo/BatchProcessingPanel.d.ts +13 -0
- package/dist/types/photo/FaceDetectionPanel.d.ts +18 -0
- package/dist/types/photo/FilterThumb.d.ts +14 -0
- package/dist/types/photo/PerspectiveCorrectionPanel.d.ts +17 -0
- package/dist/types/photo/PhotoEditor.d.ts +2 -0
- package/dist/types/photo/PhotoEditorCanvas.d.ts +14 -0
- package/dist/types/photo/PhotoEditorLeftPanel.d.ts +13 -0
- package/dist/types/photo/PhotoEditorToolbar.d.ts +13 -0
- package/dist/types/photo/RawFilePanel.d.ts +14 -0
- package/dist/types/photo/StyleTransferPanel.d.ts +15 -0
- package/dist/types/photo/aiStyleTransfer.d.ts +58 -0
- package/dist/types/photo/batchProcessing.d.ts +95 -0
- package/dist/types/photo/faceDetection.d.ts +103 -0
- package/dist/types/photo/index.d.ts +17 -0
- package/dist/types/photo/perspectiveCorrection.d.ts +134 -0
- package/dist/types/photo/photoEditorActions.d.ts +40 -0
- package/dist/types/photo/photoEditorTypes.d.ts +34 -0
- package/dist/types/photo/photoFilters.d.ts +55 -0
- package/dist/types/photo/photoOverlays.d.ts +126 -0
- package/dist/types/photo/photoSelection.d.ts +56 -0
- package/dist/types/photo/rawFileSupport.d.ts +124 -0
- package/dist/types/photo/usePhotoEditor.d.ts +123 -0
- package/dist/types/pixel/HSVPicker.d.ts +11 -0
- package/dist/types/pixel/PaletteExtractorPanel.d.ts +16 -0
- package/dist/types/pixel/PixelEditor.d.ts +17 -0
- package/dist/types/pixel/PixelEditorCanvas.d.ts +10 -0
- package/dist/types/pixel/PixelEditorMenuBar.d.ts +11 -0
- package/dist/types/pixel/PixelEditorRightPanel.d.ts +11 -0
- package/dist/types/pixel/PixelEditorStatusBar.d.ts +11 -0
- package/dist/types/pixel/PixelEditorTimeline.d.ts +11 -0
- package/dist/types/pixel/PixelEditorToolbar.d.ts +11 -0
- package/dist/types/pixel/TileMapPanel.d.ts +14 -0
- package/dist/types/pixel/asepriteFormat.d.ts +62 -0
- package/dist/types/pixel/paletteExtractor.d.ts +73 -0
- package/dist/types/pixel/pixelEditorExports.d.ts +31 -0
- package/dist/types/pixel/pixelEditorTypes.d.ts +51 -0
- package/dist/types/pixel/pixelEditorUtils.d.ts +136 -0
- package/dist/types/pixel/tileMapMode.d.ts +122 -0
- package/dist/types/pixel/usePixelEditor.d.ts +114 -0
- package/dist/types/texture/Nice3DTexturePainter.d.ts +55 -0
- package/dist/types/ui/NiceUIDesigner.d.ts +43 -0
- package/dist/types/vector/PathSimplificationPanel.d.ts +15 -0
- package/dist/types/vector/PdfExportPanel.d.ts +20 -0
- package/dist/types/vector/TextOnPathPanel.d.ts +26 -0
- package/dist/types/vector/VectorEditor.d.ts +32 -0
- package/dist/types/vector/VectorEditorMenuBar.d.ts +8 -0
- package/dist/types/vector/VectorEditorRightPanel.d.ts +7 -0
- package/dist/types/vector/VectorEditorShapeRenderer.d.ts +9 -0
- package/dist/types/vector/VectorEditorStatusBar.d.ts +9 -0
- package/dist/types/vector/VectorFilterPanel.d.ts +19 -0
- package/dist/types/vector/VectorPatternPanel.d.ts +21 -0
- package/dist/types/vector/pathSimplification.d.ts +135 -0
- package/dist/types/vector/pdfExport.d.ts +65 -0
- package/dist/types/vector/textOnPath.d.ts +145 -0
- package/dist/types/vector/useVectorEditor.d.ts +90 -0
- package/dist/types/vector/vectorBooleanOps.d.ts +22 -0
- package/dist/types/vector/vectorEditorExport.d.ts +8 -0
- package/dist/types/vector/vectorEditorImport.d.ts +7 -0
- package/dist/types/vector/vectorEditorTypes.d.ts +47 -0
- package/dist/types/vector/vectorGradients.d.ts +64 -0
- package/dist/types/vector/vectorPatternFills.d.ts +101 -0
- package/dist/types/vector/vectorSvgFilters.d.ts +134 -0
- package/package.json +93 -0
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* pixelEditorUtils.ts — Drawing algorithms for the pixel editor.
|
|
5
|
+
* Bresenham line, midpoint ellipse, flood fill, selection, brush shapes,
|
|
6
|
+
* pressure-aware blending, dithering, gradient, symmetry etc.
|
|
7
|
+
*/
|
|
8
|
+
const DEFAULT_BRUSH = {
|
|
9
|
+
size: 1,
|
|
10
|
+
shape: 'square',
|
|
11
|
+
opacity: 100,
|
|
12
|
+
flow: 100,
|
|
13
|
+
spacing: 25,
|
|
14
|
+
pressureSize: true,
|
|
15
|
+
pressureOpacity: false,
|
|
16
|
+
hardness: 100,
|
|
17
|
+
};
|
|
18
|
+
/** Read a pixel from ImageData at (x,y). Returns [r,g,b,a]. */
|
|
19
|
+
function getPixel(data, x, y) {
|
|
20
|
+
if (x < 0 || y < 0 || x >= data.width || y >= data.height)
|
|
21
|
+
return [0, 0, 0, 0];
|
|
22
|
+
const i = (y * data.width + x) * 4;
|
|
23
|
+
return [data.data[i], data.data[i + 1], data.data[i + 2], data.data[i + 3]];
|
|
24
|
+
}
|
|
25
|
+
/** Set a pixel in ImageData at (x,y). */
|
|
26
|
+
function setPixel(data, x, y, color) {
|
|
27
|
+
if (x < 0 || y < 0 || x >= data.width || y >= data.height)
|
|
28
|
+
return;
|
|
29
|
+
const i = (y * data.width + x) * 4;
|
|
30
|
+
data.data[i] = color[0];
|
|
31
|
+
data.data[i + 1] = color[1];
|
|
32
|
+
data.data[i + 2] = color[2];
|
|
33
|
+
data.data[i + 3] = color[3];
|
|
34
|
+
}
|
|
35
|
+
/** Blend a pixel onto ImageData at (x,y) with alpha compositing. */
|
|
36
|
+
function blendPixel(data, x, y, color, strength = 1) {
|
|
37
|
+
if (x < 0 || y < 0 || x >= data.width || y >= data.height)
|
|
38
|
+
return;
|
|
39
|
+
const i = (y * data.width + x) * 4;
|
|
40
|
+
const sa = (color[3] / 255) * strength;
|
|
41
|
+
if (sa <= 0)
|
|
42
|
+
return;
|
|
43
|
+
const da = data.data[i + 3] / 255;
|
|
44
|
+
const oa = sa + da * (1 - sa);
|
|
45
|
+
if (oa <= 0)
|
|
46
|
+
return;
|
|
47
|
+
data.data[i] = Math.round((color[0] * sa + data.data[i] * da * (1 - sa)) / oa);
|
|
48
|
+
data.data[i + 1] = Math.round((color[1] * sa + data.data[i + 1] * da * (1 - sa)) / oa);
|
|
49
|
+
data.data[i + 2] = Math.round((color[2] * sa + data.data[i + 2] * da * (1 - sa)) / oa);
|
|
50
|
+
data.data[i + 3] = Math.round(oa * 255);
|
|
51
|
+
}
|
|
52
|
+
/** Generate brush mask: returns array of {dx, dy, strength} offsets. */
|
|
53
|
+
function getBrushMask(cfg, pressure = 0.5) {
|
|
54
|
+
const sz = cfg.pressureSize ? Math.max(1, Math.round(cfg.size * pressure)) : cfg.size;
|
|
55
|
+
const half = Math.floor(sz / 2);
|
|
56
|
+
const flowMul = cfg.flow / 100;
|
|
57
|
+
const opaMul = (cfg.opacity / 100) * (cfg.pressureOpacity ? pressure : 1);
|
|
58
|
+
const mask = [];
|
|
59
|
+
for (let dy = -half; dy < sz - half; dy++) {
|
|
60
|
+
for (let dx = -half; dx < sz - half; dx++) {
|
|
61
|
+
let inBrush = false;
|
|
62
|
+
let dist = 0;
|
|
63
|
+
switch (cfg.shape) {
|
|
64
|
+
case 'square':
|
|
65
|
+
inBrush = true;
|
|
66
|
+
dist = Math.max(Math.abs(dx), Math.abs(dy)) / Math.max(half, 0.5);
|
|
67
|
+
break;
|
|
68
|
+
case 'circle': {
|
|
69
|
+
const r = Math.sqrt(dx * dx + dy * dy);
|
|
70
|
+
inBrush = r <= half + 0.5;
|
|
71
|
+
dist = half > 0 ? r / half : 0;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case 'diamond':
|
|
75
|
+
inBrush = Math.abs(dx) + Math.abs(dy) <= half;
|
|
76
|
+
dist = half > 0 ? (Math.abs(dx) + Math.abs(dy)) / half : 0;
|
|
77
|
+
break;
|
|
78
|
+
case 'spray':
|
|
79
|
+
inBrush = Math.random() < 0.3 && Math.sqrt(dx * dx + dy * dy) <= half + 0.5;
|
|
80
|
+
dist = 0;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
if (!inBrush)
|
|
84
|
+
continue;
|
|
85
|
+
// hardness: 100 = hard edge, 0 = soft falloff
|
|
86
|
+
const hardFactor = cfg.hardness / 100;
|
|
87
|
+
const edge = dist > hardFactor ? Math.max(0, 1 - (dist - hardFactor) / (1 - hardFactor + 0.001)) : 1;
|
|
88
|
+
mask.push({ dx, dy, strength: edge * flowMul * opaMul });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return mask;
|
|
92
|
+
}
|
|
93
|
+
/** Apply brush stamp at (x,y) with all brush settings. */
|
|
94
|
+
function applyBrushStamp(data, x, y, color, cfg, pressure = 0.5, erase = false) {
|
|
95
|
+
const mask = getBrushMask(cfg, pressure);
|
|
96
|
+
for (const { dx, dy, strength } of mask) {
|
|
97
|
+
const gx = x + dx, gy = y + dy;
|
|
98
|
+
if (gx < 0 || gy < 0 || gx >= data.width || gy >= data.height)
|
|
99
|
+
continue;
|
|
100
|
+
if (erase) {
|
|
101
|
+
const cur = getPixel(data, gx, gy);
|
|
102
|
+
const newA = Math.max(0, cur[3] - Math.round(255 * strength));
|
|
103
|
+
setPixel(data, gx, gy, [cur[0], cur[1], cur[2], newA]);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
blendPixel(data, gx, gy, color, strength);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** Get symmetry points for a coordinate. */
|
|
111
|
+
function getSymmetryPoints(x, y, w, h, mode) {
|
|
112
|
+
const pts = [{ x, y }];
|
|
113
|
+
switch (mode) {
|
|
114
|
+
case 'h':
|
|
115
|
+
pts.push({ x: w - 1 - x, y });
|
|
116
|
+
break;
|
|
117
|
+
case 'v':
|
|
118
|
+
pts.push({ x, y: h - 1 - y });
|
|
119
|
+
break;
|
|
120
|
+
case 'both':
|
|
121
|
+
pts.push({ x: w - 1 - x, y }, { x, y: h - 1 - y }, { x: w - 1 - x, y: h - 1 - y });
|
|
122
|
+
break;
|
|
123
|
+
case 'radial4': {
|
|
124
|
+
const cx = w / 2, cy = h / 2;
|
|
125
|
+
const dx = x - cx, dy = y - cy;
|
|
126
|
+
pts.push({ x: Math.round(cx - dy), y: Math.round(cy + dx) }, { x: Math.round(cx - dx), y: Math.round(cy - dy) }, { x: Math.round(cx + dy), y: Math.round(cy - dx) });
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return pts;
|
|
131
|
+
}
|
|
132
|
+
/** Draw a linear gradient between two points on ImageData. */
|
|
133
|
+
function drawGradient(data, x0, y0, x1, y1, color1, color2, sel) {
|
|
134
|
+
var _a, _b, _c, _d;
|
|
135
|
+
const dx = x1 - x0, dy = y1 - y0;
|
|
136
|
+
const len = Math.sqrt(dx * dx + dy * dy);
|
|
137
|
+
if (len === 0)
|
|
138
|
+
return;
|
|
139
|
+
const sx = (_a = sel === null || sel === void 0 ? void 0 : sel.x) !== null && _a !== void 0 ? _a : 0, sy = (_b = sel === null || sel === void 0 ? void 0 : sel.y) !== null && _b !== void 0 ? _b : 0;
|
|
140
|
+
const sw = (_c = sel === null || sel === void 0 ? void 0 : sel.w) !== null && _c !== void 0 ? _c : data.width, sh = (_d = sel === null || sel === void 0 ? void 0 : sel.h) !== null && _d !== void 0 ? _d : data.height;
|
|
141
|
+
for (let py = sy; py < sy + sh; py++) {
|
|
142
|
+
for (let px = sx; px < sx + sw; px++) {
|
|
143
|
+
const t = Math.max(0, Math.min(1, ((px - x0) * dx + (py - y0) * dy) / (len * len)));
|
|
144
|
+
const c = [
|
|
145
|
+
Math.round(color1[0] + (color2[0] - color1[0]) * t),
|
|
146
|
+
Math.round(color1[1] + (color2[1] - color1[1]) * t),
|
|
147
|
+
Math.round(color1[2] + (color2[2] - color1[2]) * t),
|
|
148
|
+
Math.round(color1[3] + (color2[3] - color1[3]) * t),
|
|
149
|
+
];
|
|
150
|
+
setPixel(data, px, py, c);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/** Ordered dithering 4x4 Bayer matrix. */
|
|
155
|
+
const BAYER4 = [
|
|
156
|
+
[0, 8, 2, 10],
|
|
157
|
+
[12, 4, 14, 6],
|
|
158
|
+
[3, 11, 1, 9],
|
|
159
|
+
[15, 7, 13, 5],
|
|
160
|
+
];
|
|
161
|
+
/** Apply dithered brush stamp. */
|
|
162
|
+
function applyDitherStamp(data, x, y, color, size, pressure = 0.5) {
|
|
163
|
+
const half = Math.floor(size / 2);
|
|
164
|
+
const threshold = pressure * 16;
|
|
165
|
+
for (let dy = -half; dy < size - half; dy++) {
|
|
166
|
+
for (let dx = -half; dx < size - half; dx++) {
|
|
167
|
+
const gx = x + dx, gy = y + dy;
|
|
168
|
+
if (gx < 0 || gy < 0 || gx >= data.width || gy >= data.height)
|
|
169
|
+
continue;
|
|
170
|
+
const bayer = BAYER4[((gy % 4) + 4) % 4][((gx % 4) + 4) % 4];
|
|
171
|
+
if (bayer < threshold) {
|
|
172
|
+
setPixel(data, gx, gy, color);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** Copy pixels from a selection region. */
|
|
178
|
+
function copySelection(data, sel) {
|
|
179
|
+
const out = new ImageData(sel.w, sel.h);
|
|
180
|
+
for (let y = 0; y < sel.h; y++) {
|
|
181
|
+
for (let x = 0; x < sel.w; x++) {
|
|
182
|
+
const px = getPixel(data, sel.x + x, sel.y + y);
|
|
183
|
+
setPixel(out, x, y, px);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
/** Paste ImageData at position. */
|
|
189
|
+
function pasteAt(dst, src, ox, oy) {
|
|
190
|
+
for (let y = 0; y < src.height; y++) {
|
|
191
|
+
for (let x = 0; x < src.width; x++) {
|
|
192
|
+
const px = getPixel(src, x, y);
|
|
193
|
+
if (px[3] > 0)
|
|
194
|
+
blendPixel(dst, ox + x, oy + y, px, 1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/** Clear pixels in selection region. */
|
|
199
|
+
function clearSelection(data, sel) {
|
|
200
|
+
for (let y = sel.y; y < sel.y + sel.h; y++) {
|
|
201
|
+
for (let x = sel.x; x < sel.x + sel.w; x++) {
|
|
202
|
+
setPixel(data, x, y, [0, 0, 0, 0]);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/** Bresenham line — calls callback for each pixel along the line. */
|
|
207
|
+
function bresenhamLine(x0, y0, x1, y1, cb) {
|
|
208
|
+
const dx = Math.abs(x1 - x0), dy = -Math.abs(y1 - y0);
|
|
209
|
+
const sx = x0 < x1 ? 1 : -1, sy = y0 < y1 ? 1 : -1;
|
|
210
|
+
let err = dx + dy;
|
|
211
|
+
for (;;) {
|
|
212
|
+
cb(x0, y0);
|
|
213
|
+
if (x0 === x1 && y0 === y1)
|
|
214
|
+
break;
|
|
215
|
+
const e2 = 2 * err;
|
|
216
|
+
if (e2 >= dy) {
|
|
217
|
+
err += dy;
|
|
218
|
+
x0 += sx;
|
|
219
|
+
}
|
|
220
|
+
if (e2 <= dx) {
|
|
221
|
+
err += dx;
|
|
222
|
+
y0 += sy;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** Flood fill — fills connected region of same color with new color. */
|
|
227
|
+
function floodFill(data, startX, startY, fillColor) {
|
|
228
|
+
const w = data.width, h = data.height;
|
|
229
|
+
if (startX < 0 || startY < 0 || startX >= w || startY >= h)
|
|
230
|
+
return;
|
|
231
|
+
const target = getPixel(data, startX, startY);
|
|
232
|
+
if (colorsEqual(target, fillColor))
|
|
233
|
+
return;
|
|
234
|
+
const stack = [startX, startY];
|
|
235
|
+
const visited = new Uint8Array(w * h);
|
|
236
|
+
while (stack.length > 0) {
|
|
237
|
+
const y = stack.pop();
|
|
238
|
+
const x = stack.pop();
|
|
239
|
+
const key = y * w + x;
|
|
240
|
+
if (x < 0 || y < 0 || x >= w || y >= h)
|
|
241
|
+
continue;
|
|
242
|
+
if (visited[key])
|
|
243
|
+
continue;
|
|
244
|
+
visited[key] = 1;
|
|
245
|
+
const current = getPixel(data, x, y);
|
|
246
|
+
if (!colorsEqual(current, target))
|
|
247
|
+
continue;
|
|
248
|
+
setPixel(data, x, y, fillColor);
|
|
249
|
+
stack.push(x - 1, y, x + 1, y, x, y - 1, x, y + 1);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/** Check if two RGBA colors are equal (with small tolerance for alpha). */
|
|
253
|
+
function colorsEqual(a, b, tolerance = 0) {
|
|
254
|
+
return Math.abs(a[0] - b[0]) <= tolerance &&
|
|
255
|
+
Math.abs(a[1] - b[1]) <= tolerance &&
|
|
256
|
+
Math.abs(a[2] - b[2]) <= tolerance &&
|
|
257
|
+
Math.abs(a[3] - b[3]) <= tolerance;
|
|
258
|
+
}
|
|
259
|
+
/** Parse hex color string to RGBA. */
|
|
260
|
+
function hexToRGBA(hex, alpha = 255) {
|
|
261
|
+
const h = hex.startsWith('#') ? hex.slice(1) : hex;
|
|
262
|
+
return [
|
|
263
|
+
parseInt(h.slice(0, 2), 16) || 0,
|
|
264
|
+
parseInt(h.slice(2, 4), 16) || 0,
|
|
265
|
+
parseInt(h.slice(4, 6), 16) || 0,
|
|
266
|
+
alpha,
|
|
267
|
+
];
|
|
268
|
+
}
|
|
269
|
+
/** Convert RGBA to hex string. */
|
|
270
|
+
function rgbaToHex(c) {
|
|
271
|
+
return '#' + [c[0], c[1], c[2]].map(v => v.toString(16).padStart(2, '0')).join('');
|
|
272
|
+
}
|
|
273
|
+
/** Create blank ImageData. */
|
|
274
|
+
function createBlankImageData(width, height) {
|
|
275
|
+
return new ImageData(width, height);
|
|
276
|
+
}
|
|
277
|
+
/** Clone ImageData. */
|
|
278
|
+
function cloneImageData(src) {
|
|
279
|
+
const dst = new ImageData(src.width, src.height);
|
|
280
|
+
dst.data.set(src.data);
|
|
281
|
+
return dst;
|
|
282
|
+
}
|
|
283
|
+
/** Flip ImageData horizontally. */
|
|
284
|
+
function flipH(src) {
|
|
285
|
+
const dst = new ImageData(src.width, src.height);
|
|
286
|
+
for (let y = 0; y < src.height; y++)
|
|
287
|
+
for (let x = 0; x < src.width; x++) {
|
|
288
|
+
const si = (y * src.width + x) * 4;
|
|
289
|
+
const di = (y * src.width + (src.width - 1 - x)) * 4;
|
|
290
|
+
dst.data[di] = src.data[si];
|
|
291
|
+
dst.data[di + 1] = src.data[si + 1];
|
|
292
|
+
dst.data[di + 2] = src.data[si + 2];
|
|
293
|
+
dst.data[di + 3] = src.data[si + 3];
|
|
294
|
+
}
|
|
295
|
+
return dst;
|
|
296
|
+
}
|
|
297
|
+
/** Flip ImageData vertically. */
|
|
298
|
+
function flipV(src) {
|
|
299
|
+
const dst = new ImageData(src.width, src.height);
|
|
300
|
+
for (let y = 0; y < src.height; y++)
|
|
301
|
+
for (let x = 0; x < src.width; x++) {
|
|
302
|
+
const si = (y * src.width + x) * 4;
|
|
303
|
+
const di = ((src.height - 1 - y) * src.width + x) * 4;
|
|
304
|
+
dst.data[di] = src.data[si];
|
|
305
|
+
dst.data[di + 1] = src.data[si + 1];
|
|
306
|
+
dst.data[di + 2] = src.data[si + 2];
|
|
307
|
+
dst.data[di + 3] = src.data[si + 3];
|
|
308
|
+
}
|
|
309
|
+
return dst;
|
|
310
|
+
}
|
|
311
|
+
/** Rotate ImageData 90° clockwise. Returns new ImageData with swapped dimensions. */
|
|
312
|
+
function rotateCW(src) {
|
|
313
|
+
const dst = new ImageData(src.height, src.width);
|
|
314
|
+
for (let y = 0; y < src.height; y++)
|
|
315
|
+
for (let x = 0; x < src.width; x++) {
|
|
316
|
+
const si = (y * src.width + x) * 4;
|
|
317
|
+
const di = (x * dst.width + (dst.width - 1 - y)) * 4;
|
|
318
|
+
dst.data[di] = src.data[si];
|
|
319
|
+
dst.data[di + 1] = src.data[si + 1];
|
|
320
|
+
dst.data[di + 2] = src.data[si + 2];
|
|
321
|
+
dst.data[di + 3] = src.data[si + 3];
|
|
322
|
+
}
|
|
323
|
+
return dst;
|
|
324
|
+
}
|
|
325
|
+
// Bayer matrices for ordered dithering
|
|
326
|
+
const BAYER_2x2 = [
|
|
327
|
+
[0, 2],
|
|
328
|
+
[3, 1],
|
|
329
|
+
];
|
|
330
|
+
const BAYER_8x8 = [
|
|
331
|
+
[0, 32, 8, 40, 2, 34, 10, 42],
|
|
332
|
+
[48, 16, 56, 24, 50, 18, 58, 26],
|
|
333
|
+
[12, 44, 4, 36, 14, 46, 6, 38],
|
|
334
|
+
[60, 28, 52, 20, 62, 30, 54, 22],
|
|
335
|
+
[3, 35, 11, 43, 1, 33, 9, 41],
|
|
336
|
+
[51, 19, 59, 27, 49, 17, 57, 25],
|
|
337
|
+
[15, 47, 7, 39, 13, 45, 5, 37],
|
|
338
|
+
[63, 31, 55, 23, 61, 29, 53, 21],
|
|
339
|
+
];
|
|
340
|
+
/** Find closest color in palette */
|
|
341
|
+
function findClosestPaletteColor(r, g, b, palette) {
|
|
342
|
+
let minDist = Infinity;
|
|
343
|
+
let closest = palette[0];
|
|
344
|
+
for (const color of palette) {
|
|
345
|
+
const dr = r - color[0];
|
|
346
|
+
const dg = g - color[1];
|
|
347
|
+
const db = b - color[2];
|
|
348
|
+
const dist = dr * dr + dg * dg + db * db;
|
|
349
|
+
if (dist < minDist) {
|
|
350
|
+
minDist = dist;
|
|
351
|
+
closest = color;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return closest;
|
|
355
|
+
}
|
|
356
|
+
/** Apply ordered dithering with Bayer matrix */
|
|
357
|
+
function ditherOrdered(data, palette, matrix = BAYER4, strength = 1.0) {
|
|
358
|
+
const result = cloneImageData(data);
|
|
359
|
+
const matrixSize = matrix.length;
|
|
360
|
+
const maxMatrixValue = matrixSize * matrixSize;
|
|
361
|
+
for (let y = 0; y < data.height; y++) {
|
|
362
|
+
for (let x = 0; x < data.width; x++) {
|
|
363
|
+
const i = (y * data.width + x) * 4;
|
|
364
|
+
const a = data.data[i + 3];
|
|
365
|
+
if (a < 128)
|
|
366
|
+
continue; // Skip transparent pixels
|
|
367
|
+
const threshold = (matrix[y % matrixSize][x % matrixSize] / maxMatrixValue - 0.5) * strength * 64;
|
|
368
|
+
const r = Math.max(0, Math.min(255, data.data[i] + threshold));
|
|
369
|
+
const g = Math.max(0, Math.min(255, data.data[i + 1] + threshold));
|
|
370
|
+
const b = Math.max(0, Math.min(255, data.data[i + 2] + threshold));
|
|
371
|
+
const closest = findClosestPaletteColor(r, g, b, palette);
|
|
372
|
+
result.data[i] = closest[0];
|
|
373
|
+
result.data[i + 1] = closest[1];
|
|
374
|
+
result.data[i + 2] = closest[2];
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return result;
|
|
378
|
+
}
|
|
379
|
+
/** Floyd-Steinberg error diffusion dithering */
|
|
380
|
+
function ditherFloydSteinberg(data, palette) {
|
|
381
|
+
const result = cloneImageData(data);
|
|
382
|
+
const errors = new Float32Array(data.width * data.height * 3);
|
|
383
|
+
for (let y = 0; y < data.height; y++) {
|
|
384
|
+
for (let x = 0; x < data.width; x++) {
|
|
385
|
+
const idx = (y * data.width + x);
|
|
386
|
+
const i = idx * 4;
|
|
387
|
+
const ei = idx * 3;
|
|
388
|
+
if (data.data[i + 3] < 128)
|
|
389
|
+
continue;
|
|
390
|
+
const oldR = Math.max(0, Math.min(255, data.data[i] + errors[ei]));
|
|
391
|
+
const oldG = Math.max(0, Math.min(255, data.data[i + 1] + errors[ei + 1]));
|
|
392
|
+
const oldB = Math.max(0, Math.min(255, data.data[i + 2] + errors[ei + 2]));
|
|
393
|
+
const newColor = findClosestPaletteColor(oldR, oldG, oldB, palette);
|
|
394
|
+
result.data[i] = newColor[0];
|
|
395
|
+
result.data[i + 1] = newColor[1];
|
|
396
|
+
result.data[i + 2] = newColor[2];
|
|
397
|
+
const errR = oldR - newColor[0];
|
|
398
|
+
const errG = oldG - newColor[1];
|
|
399
|
+
const errB = oldB - newColor[2];
|
|
400
|
+
// Distribute error: [7/16, 3/16, 5/16, 1/16]
|
|
401
|
+
const distribute = (dx, dy, factor) => {
|
|
402
|
+
const nx = x + dx, ny = y + dy;
|
|
403
|
+
if (nx >= 0 && nx < data.width && ny >= 0 && ny < data.height) {
|
|
404
|
+
const ni = (ny * data.width + nx) * 3;
|
|
405
|
+
errors[ni] += errR * factor;
|
|
406
|
+
errors[ni + 1] += errG * factor;
|
|
407
|
+
errors[ni + 2] += errB * factor;
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
distribute(1, 0, 7 / 16);
|
|
411
|
+
distribute(-1, 1, 3 / 16);
|
|
412
|
+
distribute(0, 1, 5 / 16);
|
|
413
|
+
distribute(1, 1, 1 / 16);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return result;
|
|
417
|
+
}
|
|
418
|
+
/** Jarvis-Judice-Ninke dithering (larger error diffusion kernel) */
|
|
419
|
+
function ditherJarvisJudiceNinke(data, palette) {
|
|
420
|
+
const result = cloneImageData(data);
|
|
421
|
+
const errors = new Float32Array(data.width * data.height * 3);
|
|
422
|
+
for (let y = 0; y < data.height; y++) {
|
|
423
|
+
for (let x = 0; x < data.width; x++) {
|
|
424
|
+
const idx = (y * data.width + x);
|
|
425
|
+
const i = idx * 4;
|
|
426
|
+
const ei = idx * 3;
|
|
427
|
+
if (data.data[i + 3] < 128)
|
|
428
|
+
continue;
|
|
429
|
+
const oldR = Math.max(0, Math.min(255, data.data[i] + errors[ei]));
|
|
430
|
+
const oldG = Math.max(0, Math.min(255, data.data[i + 1] + errors[ei + 1]));
|
|
431
|
+
const oldB = Math.max(0, Math.min(255, data.data[i + 2] + errors[ei + 2]));
|
|
432
|
+
const newColor = findClosestPaletteColor(oldR, oldG, oldB, palette);
|
|
433
|
+
result.data[i] = newColor[0];
|
|
434
|
+
result.data[i + 1] = newColor[1];
|
|
435
|
+
result.data[i + 2] = newColor[2];
|
|
436
|
+
const errR = oldR - newColor[0];
|
|
437
|
+
const errG = oldG - newColor[1];
|
|
438
|
+
const errB = oldB - newColor[2];
|
|
439
|
+
const distribute = (dx, dy, factor) => {
|
|
440
|
+
const nx = x + dx, ny = y + dy;
|
|
441
|
+
if (nx >= 0 && nx < data.width && ny >= 0 && ny < data.height) {
|
|
442
|
+
const ni = (ny * data.width + nx) * 3;
|
|
443
|
+
errors[ni] += errR * factor;
|
|
444
|
+
errors[ni + 1] += errG * factor;
|
|
445
|
+
errors[ni + 2] += errB * factor;
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
// JJN kernel: /48
|
|
449
|
+
distribute(1, 0, 7 / 48);
|
|
450
|
+
distribute(2, 0, 5 / 48);
|
|
451
|
+
distribute(-2, 1, 3 / 48);
|
|
452
|
+
distribute(-1, 1, 5 / 48);
|
|
453
|
+
distribute(0, 1, 7 / 48);
|
|
454
|
+
distribute(1, 1, 5 / 48);
|
|
455
|
+
distribute(2, 1, 3 / 48);
|
|
456
|
+
distribute(-2, 2, 1 / 48);
|
|
457
|
+
distribute(-1, 2, 3 / 48);
|
|
458
|
+
distribute(0, 2, 5 / 48);
|
|
459
|
+
distribute(1, 2, 3 / 48);
|
|
460
|
+
distribute(2, 2, 1 / 48);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return result;
|
|
464
|
+
}
|
|
465
|
+
/** Atkinson dithering (preserves details better) */
|
|
466
|
+
function ditherAtkinson(data, palette) {
|
|
467
|
+
const result = cloneImageData(data);
|
|
468
|
+
const errors = new Float32Array(data.width * data.height * 3);
|
|
469
|
+
for (let y = 0; y < data.height; y++) {
|
|
470
|
+
for (let x = 0; x < data.width; x++) {
|
|
471
|
+
const idx = (y * data.width + x);
|
|
472
|
+
const i = idx * 4;
|
|
473
|
+
const ei = idx * 3;
|
|
474
|
+
if (data.data[i + 3] < 128)
|
|
475
|
+
continue;
|
|
476
|
+
const oldR = Math.max(0, Math.min(255, data.data[i] + errors[ei]));
|
|
477
|
+
const oldG = Math.max(0, Math.min(255, data.data[i + 1] + errors[ei + 1]));
|
|
478
|
+
const oldB = Math.max(0, Math.min(255, data.data[i + 2] + errors[ei + 2]));
|
|
479
|
+
const newColor = findClosestPaletteColor(oldR, oldG, oldB, palette);
|
|
480
|
+
result.data[i] = newColor[0];
|
|
481
|
+
result.data[i + 1] = newColor[1];
|
|
482
|
+
result.data[i + 2] = newColor[2];
|
|
483
|
+
// Atkinson only diffuses 6/8 = 3/4 of error
|
|
484
|
+
const errR = (oldR - newColor[0]) / 8;
|
|
485
|
+
const errG = (oldG - newColor[1]) / 8;
|
|
486
|
+
const errB = (oldB - newColor[2]) / 8;
|
|
487
|
+
const distribute = (dx, dy) => {
|
|
488
|
+
const nx = x + dx, ny = y + dy;
|
|
489
|
+
if (nx >= 0 && nx < data.width && ny >= 0 && ny < data.height) {
|
|
490
|
+
const ni = (ny * data.width + nx) * 3;
|
|
491
|
+
errors[ni] += errR;
|
|
492
|
+
errors[ni + 1] += errG;
|
|
493
|
+
errors[ni + 2] += errB;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
distribute(1, 0);
|
|
497
|
+
distribute(2, 0);
|
|
498
|
+
distribute(-1, 1);
|
|
499
|
+
distribute(0, 1);
|
|
500
|
+
distribute(1, 1);
|
|
501
|
+
distribute(0, 2);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return result;
|
|
505
|
+
}
|
|
506
|
+
/** Random dithering */
|
|
507
|
+
function ditherRandom(data, palette, strength = 32) {
|
|
508
|
+
const result = cloneImageData(data);
|
|
509
|
+
for (let y = 0; y < data.height; y++) {
|
|
510
|
+
for (let x = 0; x < data.width; x++) {
|
|
511
|
+
const i = (y * data.width + x) * 4;
|
|
512
|
+
if (data.data[i + 3] < 128)
|
|
513
|
+
continue;
|
|
514
|
+
const noise = (Math.random() - 0.5) * strength * 2;
|
|
515
|
+
const r = Math.max(0, Math.min(255, data.data[i] + noise));
|
|
516
|
+
const g = Math.max(0, Math.min(255, data.data[i + 1] + noise));
|
|
517
|
+
const b = Math.max(0, Math.min(255, data.data[i + 2] + noise));
|
|
518
|
+
const closest = findClosestPaletteColor(r, g, b, palette);
|
|
519
|
+
result.data[i] = closest[0];
|
|
520
|
+
result.data[i + 1] = closest[1];
|
|
521
|
+
result.data[i + 2] = closest[2];
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return result;
|
|
525
|
+
}
|
|
526
|
+
/** Apply dithering with specified algorithm */
|
|
527
|
+
function applyDithering(data, palette, algorithm) {
|
|
528
|
+
switch (algorithm) {
|
|
529
|
+
case 'none':
|
|
530
|
+
// Just quantize without dithering
|
|
531
|
+
return ditherOrdered(data, palette, [[0]], 0);
|
|
532
|
+
case 'ordered-2x2':
|
|
533
|
+
return ditherOrdered(data, palette, BAYER_2x2);
|
|
534
|
+
case 'ordered-4x4':
|
|
535
|
+
return ditherOrdered(data, palette, BAYER4);
|
|
536
|
+
case 'ordered-8x8':
|
|
537
|
+
return ditherOrdered(data, palette, BAYER_8x8);
|
|
538
|
+
case 'floyd-steinberg':
|
|
539
|
+
return ditherFloydSteinberg(data, palette);
|
|
540
|
+
case 'jarvis-judice-ninke':
|
|
541
|
+
return ditherJarvisJudiceNinke(data, palette);
|
|
542
|
+
case 'atkinson':
|
|
543
|
+
return ditherAtkinson(data, palette);
|
|
544
|
+
case 'random':
|
|
545
|
+
return ditherRandom(data, palette);
|
|
546
|
+
default:
|
|
547
|
+
return ditherFloydSteinberg(data, palette);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
/** Generate palette from image using median cut algorithm */
|
|
551
|
+
function extractPalette(data, maxColors) {
|
|
552
|
+
const colors = [];
|
|
553
|
+
// Collect all non-transparent pixels
|
|
554
|
+
for (let i = 0; i < data.data.length; i += 4) {
|
|
555
|
+
if (data.data[i + 3] >= 128) {
|
|
556
|
+
colors.push([data.data[i], data.data[i + 1], data.data[i + 2]]);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (colors.length === 0)
|
|
560
|
+
return [[0, 0, 0, 255]];
|
|
561
|
+
// Simple median cut
|
|
562
|
+
function medianCut(colors, depth) {
|
|
563
|
+
if (depth === 0 || colors.length <= 1) {
|
|
564
|
+
// Return average color
|
|
565
|
+
const r = Math.round(colors.reduce((s, c) => s + c[0], 0) / colors.length);
|
|
566
|
+
const g = Math.round(colors.reduce((s, c) => s + c[1], 0) / colors.length);
|
|
567
|
+
const b = Math.round(colors.reduce((s, c) => s + c[2], 0) / colors.length);
|
|
568
|
+
return [[r, g, b]];
|
|
569
|
+
}
|
|
570
|
+
// Find channel with largest range
|
|
571
|
+
const ranges = [0, 1, 2].map(ch => {
|
|
572
|
+
const vals = colors.map(c => c[ch]);
|
|
573
|
+
return Math.max(...vals) - Math.min(...vals);
|
|
574
|
+
});
|
|
575
|
+
const channel = ranges.indexOf(Math.max(...ranges));
|
|
576
|
+
// Sort by channel and split
|
|
577
|
+
colors.sort((a, b) => a[channel] - b[channel]);
|
|
578
|
+
const mid = Math.floor(colors.length / 2);
|
|
579
|
+
return [
|
|
580
|
+
...medianCut(colors.slice(0, mid), depth - 1),
|
|
581
|
+
...medianCut(colors.slice(mid), depth - 1),
|
|
582
|
+
];
|
|
583
|
+
}
|
|
584
|
+
const depth = Math.ceil(Math.log2(maxColors));
|
|
585
|
+
const palette = medianCut(colors, depth).slice(0, maxColors);
|
|
586
|
+
return palette.map(c => [c[0], c[1], c[2], 255]);
|
|
587
|
+
}
|
|
588
|
+
/** Convert hex palette to RGBA array */
|
|
589
|
+
function hexPaletteToRGBA(hexColors) {
|
|
590
|
+
return hexColors.map(hex => hexToRGBA(hex));
|
|
591
|
+
}
|
|
592
|
+
/** Create reference overlay from file */
|
|
593
|
+
async function createReferenceOverlay(file, targetWidth, targetHeight) {
|
|
594
|
+
return new Promise((resolve, reject) => {
|
|
595
|
+
const img = new Image();
|
|
596
|
+
img.onload = () => {
|
|
597
|
+
// Scale to fit within target dimensions
|
|
598
|
+
const scale = Math.min(targetWidth / img.width, targetHeight / img.height, 1 // Don't scale up
|
|
599
|
+
);
|
|
600
|
+
const canvas = document.createElement('canvas');
|
|
601
|
+
canvas.width = Math.round(img.width * scale);
|
|
602
|
+
canvas.height = Math.round(img.height * scale);
|
|
603
|
+
const ctx = canvas.getContext('2d');
|
|
604
|
+
ctx.imageSmoothingEnabled = false;
|
|
605
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
606
|
+
resolve({
|
|
607
|
+
image: ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
608
|
+
x: 0,
|
|
609
|
+
y: 0,
|
|
610
|
+
opacity: 0.4,
|
|
611
|
+
scale: 1,
|
|
612
|
+
locked: false,
|
|
613
|
+
});
|
|
614
|
+
};
|
|
615
|
+
img.onerror = reject;
|
|
616
|
+
img.src = URL.createObjectURL(file);
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
/** Render reference overlay onto canvas */
|
|
620
|
+
function renderReferenceOverlay(ctx, ref, zoom, panX, panY) {
|
|
621
|
+
ctx.save();
|
|
622
|
+
ctx.globalAlpha = ref.opacity;
|
|
623
|
+
const tempCanvas = document.createElement('canvas');
|
|
624
|
+
tempCanvas.width = ref.image.width;
|
|
625
|
+
tempCanvas.height = ref.image.height;
|
|
626
|
+
tempCanvas.getContext('2d').putImageData(ref.image, 0, 0);
|
|
627
|
+
ctx.imageSmoothingEnabled = false;
|
|
628
|
+
ctx.drawImage(tempCanvas, (ref.x + panX) * zoom, (ref.y + panY) * zoom, ref.image.width * ref.scale * zoom, ref.image.height * ref.scale * zoom);
|
|
629
|
+
ctx.restore();
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
exports.DEFAULT_BRUSH = DEFAULT_BRUSH;
|
|
633
|
+
exports.applyBrushStamp = applyBrushStamp;
|
|
634
|
+
exports.applyDitherStamp = applyDitherStamp;
|
|
635
|
+
exports.applyDithering = applyDithering;
|
|
636
|
+
exports.blendPixel = blendPixel;
|
|
637
|
+
exports.bresenhamLine = bresenhamLine;
|
|
638
|
+
exports.clearSelection = clearSelection;
|
|
639
|
+
exports.cloneImageData = cloneImageData;
|
|
640
|
+
exports.colorsEqual = colorsEqual;
|
|
641
|
+
exports.copySelection = copySelection;
|
|
642
|
+
exports.createBlankImageData = createBlankImageData;
|
|
643
|
+
exports.createReferenceOverlay = createReferenceOverlay;
|
|
644
|
+
exports.ditherAtkinson = ditherAtkinson;
|
|
645
|
+
exports.ditherFloydSteinberg = ditherFloydSteinberg;
|
|
646
|
+
exports.ditherJarvisJudiceNinke = ditherJarvisJudiceNinke;
|
|
647
|
+
exports.ditherOrdered = ditherOrdered;
|
|
648
|
+
exports.ditherRandom = ditherRandom;
|
|
649
|
+
exports.drawGradient = drawGradient;
|
|
650
|
+
exports.extractPalette = extractPalette;
|
|
651
|
+
exports.flipH = flipH;
|
|
652
|
+
exports.flipV = flipV;
|
|
653
|
+
exports.floodFill = floodFill;
|
|
654
|
+
exports.getBrushMask = getBrushMask;
|
|
655
|
+
exports.getPixel = getPixel;
|
|
656
|
+
exports.getSymmetryPoints = getSymmetryPoints;
|
|
657
|
+
exports.hexPaletteToRGBA = hexPaletteToRGBA;
|
|
658
|
+
exports.hexToRGBA = hexToRGBA;
|
|
659
|
+
exports.pasteAt = pasteAt;
|
|
660
|
+
exports.renderReferenceOverlay = renderReferenceOverlay;
|
|
661
|
+
exports.rgbaToHex = rgbaToHex;
|
|
662
|
+
exports.rotateCW = rotateCW;
|
|
663
|
+
exports.setPixel = setPixel;
|
|
664
|
+
//# sourceMappingURL=pixelEditorUtils.js.map
|