@postermywall/fabricjs-2 6.0.0-rc2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/dist/index.js +229 -491
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist/index.min.mjs +1 -1
  7. package/dist/index.min.mjs.map +1 -1
  8. package/dist/index.mjs +229 -491
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/index.node.cjs +229 -491
  11. package/dist/index.node.cjs.map +1 -1
  12. package/dist/index.node.mjs +229 -491
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/package.json.min.mjs +1 -1
  15. package/dist/package.json.mjs +1 -1
  16. package/dist/src/canvas/Canvas.d.ts.map +1 -1
  17. package/dist/src/canvas/Canvas.min.mjs +1 -1
  18. package/dist/src/canvas/Canvas.min.mjs.map +1 -1
  19. package/dist/src/canvas/Canvas.mjs +8 -9
  20. package/dist/src/canvas/Canvas.mjs.map +1 -1
  21. package/dist/src/canvas/SelectableCanvas.d.ts +1 -1
  22. package/dist/src/canvas/SelectableCanvas.d.ts.map +1 -1
  23. package/dist/src/canvas/SelectableCanvas.min.mjs +1 -1
  24. package/dist/src/canvas/SelectableCanvas.min.mjs.map +1 -1
  25. package/dist/src/canvas/SelectableCanvas.mjs +1 -1
  26. package/dist/src/canvas/SelectableCanvas.mjs.map +1 -1
  27. package/dist/src/canvas/StaticCanvas.d.ts +4 -4
  28. package/dist/src/canvas/StaticCanvas.d.ts.map +1 -1
  29. package/dist/src/canvas/StaticCanvas.min.mjs +1 -1
  30. package/dist/src/canvas/StaticCanvas.min.mjs.map +1 -1
  31. package/dist/src/canvas/StaticCanvas.mjs +0 -13
  32. package/dist/src/canvas/StaticCanvas.mjs.map +1 -1
  33. package/dist/src/color/Color.d.ts +1 -0
  34. package/dist/src/color/Color.d.ts.map +1 -1
  35. package/dist/src/color/Color.min.mjs +1 -1
  36. package/dist/src/color/Color.min.mjs.map +1 -1
  37. package/dist/src/color/Color.mjs +3 -1
  38. package/dist/src/color/Color.mjs.map +1 -1
  39. package/dist/src/filters/BaseFilter.d.ts +16 -23
  40. package/dist/src/filters/BaseFilter.d.ts.map +1 -1
  41. package/dist/src/filters/BaseFilter.min.mjs +1 -1
  42. package/dist/src/filters/BaseFilter.min.mjs.map +1 -1
  43. package/dist/src/filters/BaseFilter.mjs +24 -41
  44. package/dist/src/filters/BaseFilter.mjs.map +1 -1
  45. package/dist/src/filters/BlendColor.d.ts +13 -24
  46. package/dist/src/filters/BlendColor.d.ts.map +1 -1
  47. package/dist/src/filters/BlendColor.min.mjs +1 -1
  48. package/dist/src/filters/BlendColor.min.mjs.map +1 -1
  49. package/dist/src/filters/BlendColor.mjs +1 -25
  50. package/dist/src/filters/BlendColor.mjs.map +1 -1
  51. package/dist/src/filters/BlendImage.d.ts +18 -19
  52. package/dist/src/filters/BlendImage.d.ts.map +1 -1
  53. package/dist/src/filters/BlendImage.min.mjs +1 -1
  54. package/dist/src/filters/BlendImage.min.mjs.map +1 -1
  55. package/dist/src/filters/BlendImage.mjs +13 -24
  56. package/dist/src/filters/BlendImage.mjs.map +1 -1
  57. package/dist/src/filters/Blur.d.ts +10 -12
  58. package/dist/src/filters/Blur.d.ts.map +1 -1
  59. package/dist/src/filters/Blur.min.mjs +1 -1
  60. package/dist/src/filters/Blur.min.mjs.map +1 -1
  61. package/dist/src/filters/Blur.mjs +5 -14
  62. package/dist/src/filters/Blur.mjs.map +1 -1
  63. package/dist/src/filters/Boilerplate.d.ts +11 -13
  64. package/dist/src/filters/Boilerplate.d.ts.map +1 -1
  65. package/dist/src/filters/Brightness.d.ts +10 -12
  66. package/dist/src/filters/Brightness.d.ts.map +1 -1
  67. package/dist/src/filters/Brightness.min.mjs +1 -1
  68. package/dist/src/filters/Brightness.min.mjs.map +1 -1
  69. package/dist/src/filters/Brightness.mjs +4 -16
  70. package/dist/src/filters/Brightness.mjs.map +1 -1
  71. package/dist/src/filters/Canvas2dFilterBackend.d.ts +1 -1
  72. package/dist/src/filters/Canvas2dFilterBackend.d.ts.map +1 -1
  73. package/dist/src/filters/Canvas2dFilterBackend.min.mjs.map +1 -1
  74. package/dist/src/filters/Canvas2dFilterBackend.mjs.map +1 -1
  75. package/dist/src/filters/ColorMatrix.d.ts +17 -15
  76. package/dist/src/filters/ColorMatrix.d.ts.map +1 -1
  77. package/dist/src/filters/ColorMatrix.min.mjs +1 -1
  78. package/dist/src/filters/ColorMatrix.min.mjs.map +1 -1
  79. package/dist/src/filters/ColorMatrix.mjs +7 -27
  80. package/dist/src/filters/ColorMatrix.mjs.map +1 -1
  81. package/dist/src/filters/ColorMatrixFilters.d.ts +63 -497
  82. package/dist/src/filters/ColorMatrixFilters.d.ts.map +1 -1
  83. package/dist/src/filters/ColorMatrixFilters.min.mjs +1 -1
  84. package/dist/src/filters/ColorMatrixFilters.min.mjs.map +1 -1
  85. package/dist/src/filters/ColorMatrixFilters.mjs +13 -8
  86. package/dist/src/filters/ColorMatrixFilters.mjs.map +1 -1
  87. package/dist/src/filters/Composed.d.ts +11 -10
  88. package/dist/src/filters/Composed.d.ts.map +1 -1
  89. package/dist/src/filters/Composed.min.mjs +1 -1
  90. package/dist/src/filters/Composed.min.mjs.map +1 -1
  91. package/dist/src/filters/Composed.mjs +7 -12
  92. package/dist/src/filters/Composed.mjs.map +1 -1
  93. package/dist/src/filters/Contrast.d.ts +10 -12
  94. package/dist/src/filters/Contrast.d.ts.map +1 -1
  95. package/dist/src/filters/Contrast.min.mjs +1 -1
  96. package/dist/src/filters/Contrast.min.mjs.map +1 -1
  97. package/dist/src/filters/Contrast.mjs +6 -17
  98. package/dist/src/filters/Contrast.mjs.map +1 -1
  99. package/dist/src/filters/Convolute.d.ts +11 -14
  100. package/dist/src/filters/Convolute.d.ts.map +1 -1
  101. package/dist/src/filters/Convolute.min.mjs +1 -1
  102. package/dist/src/filters/Convolute.min.mjs.map +1 -1
  103. package/dist/src/filters/Convolute.mjs +1 -15
  104. package/dist/src/filters/Convolute.mjs.map +1 -1
  105. package/dist/src/filters/Gamma.d.ts +17 -14
  106. package/dist/src/filters/Gamma.d.ts.map +1 -1
  107. package/dist/src/filters/Gamma.min.mjs +1 -1
  108. package/dist/src/filters/Gamma.min.mjs.map +1 -1
  109. package/dist/src/filters/Gamma.mjs +20 -24
  110. package/dist/src/filters/Gamma.mjs.map +1 -1
  111. package/dist/src/filters/Grayscale.d.ts +8 -11
  112. package/dist/src/filters/Grayscale.d.ts.map +1 -1
  113. package/dist/src/filters/Grayscale.min.mjs +1 -1
  114. package/dist/src/filters/Grayscale.min.mjs.map +1 -1
  115. package/dist/src/filters/Grayscale.mjs +2 -14
  116. package/dist/src/filters/Grayscale.mjs.map +1 -1
  117. package/dist/src/filters/HueRotation.d.ts +11 -5
  118. package/dist/src/filters/HueRotation.d.ts.map +1 -1
  119. package/dist/src/filters/HueRotation.min.mjs +1 -1
  120. package/dist/src/filters/HueRotation.min.mjs.map +1 -1
  121. package/dist/src/filters/HueRotation.mjs +10 -5
  122. package/dist/src/filters/HueRotation.mjs.map +1 -1
  123. package/dist/src/filters/Invert.d.ts +10 -13
  124. package/dist/src/filters/Invert.d.ts.map +1 -1
  125. package/dist/src/filters/Invert.min.mjs +1 -1
  126. package/dist/src/filters/Invert.min.mjs.map +1 -1
  127. package/dist/src/filters/Invert.mjs +2 -15
  128. package/dist/src/filters/Invert.mjs.map +1 -1
  129. package/dist/src/filters/Noise.d.ts +9 -20
  130. package/dist/src/filters/Noise.d.ts.map +1 -1
  131. package/dist/src/filters/Noise.min.mjs +1 -1
  132. package/dist/src/filters/Noise.min.mjs.map +1 -1
  133. package/dist/src/filters/Noise.mjs +4 -27
  134. package/dist/src/filters/Noise.mjs.map +1 -1
  135. package/dist/src/filters/Pixelate.d.ts +8 -12
  136. package/dist/src/filters/Pixelate.d.ts.map +1 -1
  137. package/dist/src/filters/Pixelate.min.mjs +1 -1
  138. package/dist/src/filters/Pixelate.min.mjs.map +1 -1
  139. package/dist/src/filters/Pixelate.mjs +2 -16
  140. package/dist/src/filters/Pixelate.mjs.map +1 -1
  141. package/dist/src/filters/RemoveColor.d.ts +12 -23
  142. package/dist/src/filters/RemoveColor.d.ts.map +1 -1
  143. package/dist/src/filters/RemoveColor.min.mjs +1 -1
  144. package/dist/src/filters/RemoveColor.min.mjs.map +1 -1
  145. package/dist/src/filters/RemoveColor.mjs +2 -25
  146. package/dist/src/filters/RemoveColor.mjs.map +1 -1
  147. package/dist/src/filters/Resize.d.ts +14 -30
  148. package/dist/src/filters/Resize.d.ts.map +1 -1
  149. package/dist/src/filters/Resize.min.mjs +1 -1
  150. package/dist/src/filters/Resize.min.mjs.map +1 -1
  151. package/dist/src/filters/Resize.mjs +3 -30
  152. package/dist/src/filters/Resize.mjs.map +1 -1
  153. package/dist/src/filters/Saturation.d.ts +9 -12
  154. package/dist/src/filters/Saturation.d.ts.map +1 -1
  155. package/dist/src/filters/Saturation.min.mjs +1 -1
  156. package/dist/src/filters/Saturation.min.mjs.map +1 -1
  157. package/dist/src/filters/Saturation.mjs +8 -20
  158. package/dist/src/filters/Saturation.mjs.map +1 -1
  159. package/dist/src/filters/Vibrance.d.ts +10 -13
  160. package/dist/src/filters/Vibrance.d.ts.map +1 -1
  161. package/dist/src/filters/Vibrance.min.mjs +1 -1
  162. package/dist/src/filters/Vibrance.min.mjs.map +1 -1
  163. package/dist/src/filters/Vibrance.mjs +6 -18
  164. package/dist/src/filters/Vibrance.mjs.map +1 -1
  165. package/dist/src/filters/WebGLFilterBackend.d.ts +1 -1
  166. package/dist/src/filters/WebGLFilterBackend.d.ts.map +1 -1
  167. package/dist/src/filters/WebGLFilterBackend.min.mjs.map +1 -1
  168. package/dist/src/filters/WebGLFilterBackend.mjs.map +1 -1
  169. package/dist/src/filters/shaders/blendImage.d.ts +1 -0
  170. package/dist/src/filters/shaders/blendImage.d.ts.map +1 -1
  171. package/dist/src/filters/shaders/blendImage.min.mjs +1 -1
  172. package/dist/src/filters/shaders/blendImage.min.mjs.map +1 -1
  173. package/dist/src/filters/shaders/blendImage.mjs +2 -1
  174. package/dist/src/filters/shaders/blendImage.mjs.map +1 -1
  175. package/dist/src/filters/typedefs.d.ts +22 -0
  176. package/dist/src/filters/typedefs.d.ts.map +1 -1
  177. package/dist/src/parser/elements_parser.d.ts +1 -1
  178. package/dist/src/parser/elements_parser.d.ts.map +1 -1
  179. package/dist/src/parser/elements_parser.min.mjs.map +1 -1
  180. package/dist/src/parser/elements_parser.mjs.map +1 -1
  181. package/dist/src/shapes/ActiveSelection.d.ts +1 -1
  182. package/dist/src/shapes/ActiveSelection.d.ts.map +1 -1
  183. package/dist/src/shapes/ActiveSelection.min.mjs +1 -1
  184. package/dist/src/shapes/ActiveSelection.min.mjs.map +1 -1
  185. package/dist/src/shapes/ActiveSelection.mjs +13 -10
  186. package/dist/src/shapes/ActiveSelection.mjs.map +1 -1
  187. package/dist/src/shapes/Group.d.ts +9 -0
  188. package/dist/src/shapes/Group.d.ts.map +1 -1
  189. package/dist/src/shapes/Group.min.mjs +1 -1
  190. package/dist/src/shapes/Group.min.mjs.map +1 -1
  191. package/dist/src/shapes/Group.mjs +10 -1
  192. package/dist/src/shapes/Group.mjs.map +1 -1
  193. package/dist/src/shapes/Image.d.ts +4 -4
  194. package/dist/src/shapes/Image.d.ts.map +1 -1
  195. package/dist/src/shapes/Image.min.mjs.map +1 -1
  196. package/dist/src/shapes/Image.mjs.map +1 -1
  197. package/dist/src/shapes/Object/InteractiveObject.d.ts +3 -0
  198. package/dist/src/shapes/Object/InteractiveObject.d.ts.map +1 -1
  199. package/dist/src/shapes/Object/InteractiveObject.min.mjs +1 -1
  200. package/dist/src/shapes/Object/InteractiveObject.min.mjs.map +1 -1
  201. package/dist/src/shapes/Object/InteractiveObject.mjs +3 -1
  202. package/dist/src/shapes/Object/InteractiveObject.mjs.map +1 -1
  203. package/dist/src/shapes/Object/Object.d.ts +1 -16
  204. package/dist/src/shapes/Object/Object.d.ts.map +1 -1
  205. package/dist/src/shapes/Object/Object.min.mjs +1 -1
  206. package/dist/src/shapes/Object/Object.min.mjs.map +1 -1
  207. package/dist/src/shapes/Object/Object.mjs +9 -10
  208. package/dist/src/shapes/Object/Object.mjs.map +1 -1
  209. package/dist/src/shapes/Object/StackedObject.d.ts +8 -15
  210. package/dist/src/shapes/Object/StackedObject.d.ts.map +1 -1
  211. package/dist/src/shapes/Object/StackedObject.min.mjs +1 -1
  212. package/dist/src/shapes/Object/StackedObject.min.mjs.map +1 -1
  213. package/dist/src/shapes/Object/StackedObject.mjs +11 -21
  214. package/dist/src/shapes/Object/StackedObject.mjs.map +1 -1
  215. package/dist/src/shapes/Path.d.ts +2 -2
  216. package/dist/src/shapes/Path.d.ts.map +1 -1
  217. package/dist/src/shapes/Path.min.mjs.map +1 -1
  218. package/dist/src/shapes/Path.mjs +2 -2
  219. package/dist/src/shapes/Path.mjs.map +1 -1
  220. package/dist/src/shapes/Text/TextSVGExportMixin.d.ts +1 -1
  221. package/dist/src/shapes/Text/TextSVGExportMixin.d.ts.map +1 -1
  222. package/dist/src/shapes/Text/TextSVGExportMixin.min.mjs.map +1 -1
  223. package/dist/src/shapes/Text/TextSVGExportMixin.mjs.map +1 -1
  224. package/dist/src/util/misc/objectEnlive.d.ts +2 -2
  225. package/dist/src/util/misc/objectEnlive.d.ts.map +1 -1
  226. package/dist/src/util/misc/objectEnlive.min.mjs.map +1 -1
  227. package/dist/src/util/misc/objectEnlive.mjs.map +1 -1
  228. package/package.json +2 -2
  229. package/src/canvas/Canvas.ts +6 -9
  230. package/src/canvas/SelectableCanvas.ts +2 -2
  231. package/src/canvas/StaticCanvas.ts +4 -18
  232. package/src/color/Color.ts +2 -1
  233. package/src/color/color.test.ts +6 -0
  234. package/src/filters/BaseFilter.ts +45 -51
  235. package/src/filters/BlendColor.ts +13 -35
  236. package/src/filters/BlendImage.ts +26 -40
  237. package/src/filters/Blur.ts +13 -20
  238. package/src/filters/Boilerplate.ts +13 -22
  239. package/src/filters/Brightness.ts +12 -21
  240. package/src/filters/Canvas2dFilterBackend.ts +1 -1
  241. package/src/filters/ColorMatrix.ts +29 -34
  242. package/src/filters/ColorMatrixFilters.ts +15 -9
  243. package/src/filters/Composed.ts +26 -16
  244. package/src/filters/Contrast.ts +15 -23
  245. package/src/filters/Convolute.ts +11 -23
  246. package/src/filters/Gamma.ts +32 -24
  247. package/src/filters/Grayscale.ts +8 -19
  248. package/src/filters/HueRotation.ts +21 -11
  249. package/src/filters/Invert.ts +11 -22
  250. package/src/filters/Noise.ts +11 -30
  251. package/src/filters/Pixelate.ts +9 -22
  252. package/src/filters/RemoveColor.ts +21 -35
  253. package/src/filters/Resize.ts +20 -44
  254. package/src/filters/Saturation.ts +16 -27
  255. package/src/filters/Vibrance.ts +14 -24
  256. package/src/filters/WebGLFilterBackend.ts +1 -1
  257. package/src/filters/shaders/blendImage.ts +12 -0
  258. package/src/filters/typedefs.ts +23 -0
  259. package/src/parser/elements_parser.ts +1 -1
  260. package/src/shapes/ActiveSelection.ts +8 -4
  261. package/src/shapes/Group.ts +16 -1
  262. package/src/shapes/Image.ts +8 -6
  263. package/src/shapes/Object/InteractiveObject.ts +3 -1
  264. package/src/shapes/Object/Object.ts +10 -35
  265. package/src/shapes/Object/StackedObject.ts +28 -44
  266. package/src/shapes/Path.ts +4 -4
  267. package/src/shapes/Text/TextSVGExportMixin.ts +1 -1
  268. package/src/util/misc/objectEnlive.ts +12 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ColorMatrixFilters.d.ts","sourceRoot":"","sources":["../../../src/filters/ColorMatrixFilters.ts"],"names":[],"mappings":"AAGA,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAM/D;;WAEG;;;;;;;;EAOR;AAED,eAAO,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3E;AAED,eAAO,MAAM,OAAO;;;;;;;;;;;CAMnB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;CAMnB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;CAMtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;CAMvB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;CAMpB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;CAMjB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;CAMtB,CAAC"}
@@ -1,2 +1,2 @@
1
- import{defineProperty as r,objectSpread2 as e}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{colorMatrixDefaultValues as o,ColorMatrix as i}from"./ColorMatrix.min.mjs";import{classRegistry as t}from"../ClassRegistry.min.mjs";function a(a,s){var m;const n=(r(m=class extends i{},"type",a),r(m,"defaults",e(e({},o),{},{mainParameter:void 0,matrix:s})),m);return t.setClass(n,a),n}const s=a("Brownie",[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0]),m=a("Vintage",[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0]),n=a("Kodachrome",[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0]),l=a("Technicolor",[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0]),p=a("Polaroid",[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0]),c=a("Sepia",[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0]),d=a("BlackWhite",[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]);export{d as BlackWhite,s as Brownie,n as Kodachrome,p as Polaroid,c as Sepia,l as Technicolor,m as Vintage,a as createColorMatrixFilter};
1
+ import{defineProperty as o}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{ColorMatrix as r}from"./ColorMatrix.min.mjs";import{classRegistry as t}from"../ClassRegistry.min.mjs";function e(e,s){var i;const l=(o(i=class extends r{toObject(){return{type:this.type,colorsOnly:this.colorsOnly}}},"type",e),o(i,"defaults",{colorsOnly:!1,matrix:s}),i);return t.setClass(l,e),l}const s=e("Brownie",[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0]),i=e("Vintage",[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0]),l=e("Kodachrome",[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0]),n=e("Technicolor",[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0]),a=e("Polaroid",[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0]),m=e("Sepia",[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0]),c=e("BlackWhite",[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]);export{c as BlackWhite,s as Brownie,l as Kodachrome,a as Polaroid,m as Sepia,n as Technicolor,i as Vintage,e as createColorMatrixFilter};
2
2
  //# sourceMappingURL=ColorMatrixFilters.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorMatrixFilters.min.mjs","sources":["../../../src/filters/ColorMatrixFilters.ts"],"sourcesContent":["import { ColorMatrix, colorMatrixDefaultValues } from './ColorMatrix';\nimport { classRegistry } from '../ClassRegistry';\n\nexport function createColorMatrixFilter(key: string, matrix: number[]) {\n const newClass = class extends ColorMatrix {\n static type = key;\n\n static defaults = {\n ...colorMatrixDefaultValues,\n /**\n * Lock the matrix export for this kind of static, parameter less filters.\n */\n mainParameter: undefined,\n matrix,\n };\n };\n classRegistry.setClass(newClass, key);\n return newClass;\n}\n\nexport const Brownie = createColorMatrixFilter(\n 'Brownie',\n [\n 0.5997, 0.34553, -0.27082, 0, 0.186, -0.0377, 0.86095, 0.15059, 0, -0.1449,\n 0.24113, -0.07441, 0.44972, 0, -0.02965, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Vintage = createColorMatrixFilter(\n 'Vintage',\n [\n 0.62793, 0.32021, -0.03965, 0, 0.03784, 0.02578, 0.64411, 0.03259, 0,\n 0.02926, 0.0466, -0.08512, 0.52416, 0, 0.02023, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Kodachrome = createColorMatrixFilter(\n 'Kodachrome',\n [\n 1.12855, -0.39673, -0.03992, 0, 0.24991, -0.16404, 1.08352, -0.05498, 0,\n 0.09698, -0.16786, -0.56034, 1.60148, 0, 0.13972, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Technicolor = createColorMatrixFilter(\n 'Technicolor',\n [\n 1.91252, -0.85453, -0.09155, 0, 0.04624, -0.30878, 1.76589, -0.10601, 0,\n -0.27589, -0.2311, -0.75018, 1.84759, 0, 0.12137, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Polaroid = createColorMatrixFilter(\n 'Polaroid',\n [\n 1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016,\n 1.483, 0, 0, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Sepia = createColorMatrixFilter(\n 'Sepia',\n [\n 0.393, 0.769, 0.189, 0, 0, 0.349, 0.686, 0.168, 0, 0, 0.272, 0.534, 0.131,\n 0, 0, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const BlackWhite = createColorMatrixFilter(\n 'BlackWhite',\n [\n 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 0, 0, 0,\n 1, 0,\n ]\n);\n"],"names":["createColorMatrixFilter","key","matrix","_class","newClass","_defineProperty","ColorMatrix","_objectSpread","colorMatrixDefaultValues","mainParameter","undefined","classRegistry","setClass","Brownie","Vintage","Kodachrome","Technicolor","Polaroid","Sepia","BlackWhite"],"mappings":"gPAGO,SAASA,EAAwBC,EAAaC,GAAkB,IAAAC,EACrE,MAAMC,GAWLC,EAXaF,EAAG,cAAcG,IAW9B,OAVeL,GAAGI,EAAAF,EAAA,WAAAI,EAAAA,EAAA,CAAA,EAGZC,GAAwB,GAAA,CAI3BC,mBAAeC,EACfR,YAAMC,GAIV,OADAQ,EAAcC,SAASR,EAAUH,GAC1BG,CACT,CAEO,MAAMS,EAAUb,EACrB,UACA,CACE,MAAQ,QAAU,OAAS,EAAG,MAAQ,MAAQ,OAAS,OAAS,GAAI,MACpE,QAAU,OAAS,OAAS,GAAI,OAAS,EAAG,EAAG,EAAG,EAAG,IAI5Cc,EAAUd,EACrB,UACA,CACE,OAAS,QAAU,OAAS,EAAG,OAAS,OAAS,OAAS,OAAS,EACnE,OAAS,OAAS,OAAS,OAAS,EAAG,OAAS,EAAG,EAAG,EAAG,EAAG,IAInDe,EAAaf,EACxB,aACA,CACE,SAAU,QAAU,OAAS,EAAG,QAAU,OAAS,SAAU,OAAS,EACtE,QAAU,QAAU,OAAS,QAAS,EAAG,OAAS,EAAG,EAAG,EAAG,EAAG,IAIrDgB,EAAchB,EACzB,cACA,CACE,SAAU,QAAU,OAAS,EAAG,QAAU,OAAS,SAAU,OAAS,GACrE,QAAU,OAAS,OAAS,QAAS,EAAG,OAAS,EAAG,EAAG,EAAG,EAAG,IAIrDiB,EAAWjB,EACtB,WACA,CACE,OAAQ,MAAQ,KAAO,EAAG,GAAI,KAAO,OAAQ,KAAO,EAAG,GAAI,MAAQ,KACnE,MAAO,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,IAIhBkB,EAAQlB,EACnB,QACA,CACE,KAAO,KAAO,KAAO,EAAG,EAAG,KAAO,KAAO,KAAO,EAAG,EAAG,KAAO,KAAO,KACpE,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,IAITmB,EAAanB,EACxB,aACA,CACE,IAAK,IAAK,IAAK,GAAI,EAAG,IAAK,IAAK,IAAK,GAAI,EAAG,IAAK,IAAK,IAAK,GAAI,EAAG,EAAG,EAAG,EACxE,EAAG"}
1
+ {"version":3,"file":"ColorMatrixFilters.min.mjs","sources":["../../../src/filters/ColorMatrixFilters.ts"],"sourcesContent":["import { ColorMatrix } from './ColorMatrix';\nimport { classRegistry } from '../ClassRegistry';\nimport type { TMatColorMatrix } from './typedefs';\n\ntype FixedFiltersOwnProps = {\n colorsOnly: boolean;\n};\n\nexport function createColorMatrixFilter(key: string, matrix: TMatColorMatrix) {\n const newClass = class extends ColorMatrix<typeof key, FixedFiltersOwnProps> {\n static type = key;\n\n static defaults = {\n colorsOnly: false,\n matrix,\n };\n\n //@ts-expect-error TS wants matrix to be exported.\n toObject(): { type: string } & FixedFiltersOwnProps {\n return { type: this.type, colorsOnly: this.colorsOnly };\n }\n };\n classRegistry.setClass(newClass, key);\n return newClass as typeof ColorMatrix<typeof key, FixedFiltersOwnProps>;\n}\n\nexport const Brownie = createColorMatrixFilter(\n 'Brownie',\n [\n 0.5997, 0.34553, -0.27082, 0, 0.186, -0.0377, 0.86095, 0.15059, 0, -0.1449,\n 0.24113, -0.07441, 0.44972, 0, -0.02965, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Vintage = createColorMatrixFilter(\n 'Vintage',\n [\n 0.62793, 0.32021, -0.03965, 0, 0.03784, 0.02578, 0.64411, 0.03259, 0,\n 0.02926, 0.0466, -0.08512, 0.52416, 0, 0.02023, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Kodachrome = createColorMatrixFilter(\n 'Kodachrome',\n [\n 1.12855, -0.39673, -0.03992, 0, 0.24991, -0.16404, 1.08352, -0.05498, 0,\n 0.09698, -0.16786, -0.56034, 1.60148, 0, 0.13972, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Technicolor = createColorMatrixFilter(\n 'Technicolor',\n [\n 1.91252, -0.85453, -0.09155, 0, 0.04624, -0.30878, 1.76589, -0.10601, 0,\n -0.27589, -0.2311, -0.75018, 1.84759, 0, 0.12137, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Polaroid = createColorMatrixFilter(\n 'Polaroid',\n [\n 1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016,\n 1.483, 0, 0, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Sepia = createColorMatrixFilter(\n 'Sepia',\n [\n 0.393, 0.769, 0.189, 0, 0, 0.349, 0.686, 0.168, 0, 0, 0.272, 0.534, 0.131,\n 0, 0, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const BlackWhite = createColorMatrixFilter(\n 'BlackWhite',\n [\n 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 0, 0, 0,\n 1, 0,\n ]\n);\n"],"names":["createColorMatrixFilter","key","matrix","_class","newClass","_defineProperty","ColorMatrix","toObject","type","this","colorsOnly","classRegistry","setClass","Brownie","Vintage","Kodachrome","Technicolor","Polaroid","Sepia","BlackWhite"],"mappings":"+LAQO,SAASA,EAAwBC,EAAaC,GAAyB,IAAAC,EAC5E,MAAMC,GAYLC,EAZaF,EAAG,cAAcG,EAS7BC,QAAAA,GACE,MAAO,CAAEC,KAAMC,KAAKD,KAAME,WAAYD,KAAKC,WAC7C,GACD,OAXeT,GAAGI,EAAAF,EAEC,WAAA,CAChBO,YAAY,EACZR,WACDC,GAQH,OADAQ,EAAcC,SAASR,EAAUH,GAC1BG,CACT,CAEO,MAAMS,EAAUb,EACrB,UACA,CACE,MAAQ,QAAU,OAAS,EAAG,MAAQ,MAAQ,OAAS,OAAS,GAAI,MACpE,QAAU,OAAS,OAAS,GAAI,OAAS,EAAG,EAAG,EAAG,EAAG,IAI5Cc,EAAUd,EACrB,UACA,CACE,OAAS,QAAU,OAAS,EAAG,OAAS,OAAS,OAAS,OAAS,EACnE,OAAS,OAAS,OAAS,OAAS,EAAG,OAAS,EAAG,EAAG,EAAG,EAAG,IAInDe,EAAaf,EACxB,aACA,CACE,SAAU,QAAU,OAAS,EAAG,QAAU,OAAS,SAAU,OAAS,EACtE,QAAU,QAAU,OAAS,QAAS,EAAG,OAAS,EAAG,EAAG,EAAG,EAAG,IAIrDgB,EAAchB,EACzB,cACA,CACE,SAAU,QAAU,OAAS,EAAG,QAAU,OAAS,SAAU,OAAS,GACrE,QAAU,OAAS,OAAS,QAAS,EAAG,OAAS,EAAG,EAAG,EAAG,EAAG,IAIrDiB,EAAWjB,EACtB,WACA,CACE,OAAQ,MAAQ,KAAO,EAAG,GAAI,KAAO,OAAQ,KAAO,EAAG,GAAI,MAAQ,KACnE,MAAO,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,IAIhBkB,EAAQlB,EACnB,QACA,CACE,KAAO,KAAO,KAAO,EAAG,EAAG,KAAO,KAAO,KAAO,EAAG,EAAG,KAAO,KAAO,KACpE,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,IAITmB,EAAanB,EACxB,aACA,CACE,IAAK,IAAK,IAAK,GAAI,EAAG,IAAK,IAAK,IAAK,GAAI,EAAG,IAAK,IAAK,IAAK,GAAI,EAAG,EAAG,EAAG,EACxE,EAAG"}
@@ -1,16 +1,21 @@
1
- import { defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.mjs';
2
- import { colorMatrixDefaultValues, ColorMatrix } from './ColorMatrix.mjs';
1
+ import { defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.mjs';
2
+ import { ColorMatrix } from './ColorMatrix.mjs';
3
3
  import { classRegistry } from '../ClassRegistry.mjs';
4
4
 
5
5
  function createColorMatrixFilter(key, matrix) {
6
6
  var _class;
7
- const newClass = (_class = class newClass extends ColorMatrix {}, _defineProperty(_class, "type", key), _defineProperty(_class, "defaults", _objectSpread2(_objectSpread2({}, colorMatrixDefaultValues), {}, {
8
- /**
9
- * Lock the matrix export for this kind of static, parameter less filters.
10
- */
11
- mainParameter: undefined,
7
+ const newClass = (_class = class newClass extends ColorMatrix {
8
+ //@ts-expect-error TS wants matrix to be exported.
9
+ toObject() {
10
+ return {
11
+ type: this.type,
12
+ colorsOnly: this.colorsOnly
13
+ };
14
+ }
15
+ }, _defineProperty(_class, "type", key), _defineProperty(_class, "defaults", {
16
+ colorsOnly: false,
12
17
  matrix
13
- })), _class);
18
+ }), _class);
14
19
  classRegistry.setClass(newClass, key);
15
20
  return newClass;
16
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ColorMatrixFilters.mjs","sources":["../../../src/filters/ColorMatrixFilters.ts"],"sourcesContent":["import { ColorMatrix, colorMatrixDefaultValues } from './ColorMatrix';\nimport { classRegistry } from '../ClassRegistry';\n\nexport function createColorMatrixFilter(key: string, matrix: number[]) {\n const newClass = class extends ColorMatrix {\n static type = key;\n\n static defaults = {\n ...colorMatrixDefaultValues,\n /**\n * Lock the matrix export for this kind of static, parameter less filters.\n */\n mainParameter: undefined,\n matrix,\n };\n };\n classRegistry.setClass(newClass, key);\n return newClass;\n}\n\nexport const Brownie = createColorMatrixFilter(\n 'Brownie',\n [\n 0.5997, 0.34553, -0.27082, 0, 0.186, -0.0377, 0.86095, 0.15059, 0, -0.1449,\n 0.24113, -0.07441, 0.44972, 0, -0.02965, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Vintage = createColorMatrixFilter(\n 'Vintage',\n [\n 0.62793, 0.32021, -0.03965, 0, 0.03784, 0.02578, 0.64411, 0.03259, 0,\n 0.02926, 0.0466, -0.08512, 0.52416, 0, 0.02023, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Kodachrome = createColorMatrixFilter(\n 'Kodachrome',\n [\n 1.12855, -0.39673, -0.03992, 0, 0.24991, -0.16404, 1.08352, -0.05498, 0,\n 0.09698, -0.16786, -0.56034, 1.60148, 0, 0.13972, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Technicolor = createColorMatrixFilter(\n 'Technicolor',\n [\n 1.91252, -0.85453, -0.09155, 0, 0.04624, -0.30878, 1.76589, -0.10601, 0,\n -0.27589, -0.2311, -0.75018, 1.84759, 0, 0.12137, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Polaroid = createColorMatrixFilter(\n 'Polaroid',\n [\n 1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016,\n 1.483, 0, 0, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Sepia = createColorMatrixFilter(\n 'Sepia',\n [\n 0.393, 0.769, 0.189, 0, 0, 0.349, 0.686, 0.168, 0, 0, 0.272, 0.534, 0.131,\n 0, 0, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const BlackWhite = createColorMatrixFilter(\n 'BlackWhite',\n [\n 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 0, 0, 0,\n 1, 0,\n ]\n);\n"],"names":["createColorMatrixFilter","key","matrix","_class","newClass","ColorMatrix","_defineProperty","_objectSpread","colorMatrixDefaultValues","mainParameter","undefined","classRegistry","setClass","Brownie","Vintage","Kodachrome","Technicolor","Polaroid","Sepia","BlackWhite"],"mappings":";;;;AAGO,SAASA,uBAAuBA,CAACC,GAAW,EAAEC,MAAgB,EAAE;AAAA,EAAA,IAAAC,MAAA,CAAA;EACrE,MAAMC,QAAQ,IAAAD,MAAA,GAAG,MAAXC,QAAQ,SAAiBC,WAAW,CAAC,EAW1C,EAAAC,eAAA,CAAAH,MAAA,EAAA,MAAA,EAVeF,GAAG,CAAA,EAAAK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AC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACzE,CAAC,EAAE,CAAC,CAER;;;;"}
1
+ {"version":3,"file":"ColorMatrixFilters.mjs","sources":["../../../src/filters/ColorMatrixFilters.ts"],"sourcesContent":["import { ColorMatrix } from './ColorMatrix';\nimport { classRegistry } from '../ClassRegistry';\nimport type { TMatColorMatrix } from './typedefs';\n\ntype FixedFiltersOwnProps = {\n colorsOnly: boolean;\n};\n\nexport function createColorMatrixFilter(key: string, matrix: TMatColorMatrix) {\n const newClass = class extends ColorMatrix<typeof key, FixedFiltersOwnProps> {\n static type = key;\n\n static defaults = {\n colorsOnly: false,\n matrix,\n };\n\n //@ts-expect-error TS wants matrix to be exported.\n toObject(): { type: string } & FixedFiltersOwnProps {\n return { type: this.type, colorsOnly: this.colorsOnly };\n }\n };\n classRegistry.setClass(newClass, key);\n return newClass as typeof ColorMatrix<typeof key, FixedFiltersOwnProps>;\n}\n\nexport const Brownie = createColorMatrixFilter(\n 'Brownie',\n [\n 0.5997, 0.34553, -0.27082, 0, 0.186, -0.0377, 0.86095, 0.15059, 0, -0.1449,\n 0.24113, -0.07441, 0.44972, 0, -0.02965, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Vintage = createColorMatrixFilter(\n 'Vintage',\n [\n 0.62793, 0.32021, -0.03965, 0, 0.03784, 0.02578, 0.64411, 0.03259, 0,\n 0.02926, 0.0466, -0.08512, 0.52416, 0, 0.02023, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Kodachrome = createColorMatrixFilter(\n 'Kodachrome',\n [\n 1.12855, -0.39673, -0.03992, 0, 0.24991, -0.16404, 1.08352, -0.05498, 0,\n 0.09698, -0.16786, -0.56034, 1.60148, 0, 0.13972, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Technicolor = createColorMatrixFilter(\n 'Technicolor',\n [\n 1.91252, -0.85453, -0.09155, 0, 0.04624, -0.30878, 1.76589, -0.10601, 0,\n -0.27589, -0.2311, -0.75018, 1.84759, 0, 0.12137, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Polaroid = createColorMatrixFilter(\n 'Polaroid',\n [\n 1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016,\n 1.483, 0, 0, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const Sepia = createColorMatrixFilter(\n 'Sepia',\n [\n 0.393, 0.769, 0.189, 0, 0, 0.349, 0.686, 0.168, 0, 0, 0.272, 0.534, 0.131,\n 0, 0, 0, 0, 0, 1, 0,\n ]\n);\n\nexport const BlackWhite = createColorMatrixFilter(\n 'BlackWhite',\n [\n 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 0, 0, 0,\n 1, 0,\n ]\n);\n"],"names":["createColorMatrixFilter","key","matrix","_class","newClass","ColorMatrix","toObject","type","colorsOnly","_defineProperty","classRegistry","setClass","Brownie","Vintage","Kodachrome","Technicolor","Polaroid","Sepia","BlackWhite"],"mappings":";;;;AAQO,SAASA,uBAAuBA,CAACC,GAAW,EAAEC,MAAuB,EAAE;AAAA,EAAA,IAAAC,MAAA,CAAA;EAC5E,MAAMC,QAAQ,IAAAD,MAAA,GAAG,MAAXC,QAAQ,SAAiBC,WAAW,CAAmC;AAQ3E;AACAC,IAAAA,QAAQA,GAA4C;MAClD,OAAO;QAAEC,IAAI,EAAE,IAAI,CAACA,IAAI;QAAEC,UAAU,EAAE,IAAI,CAACA,UAAAA;OAAY,CAAA;AACzD,KAAA;GACD,EAAAC,eAAA,CAAAN,MAAA,EAAA,MAAA,EAXeF,GAAG,CAAAQ,EAAAA,eAAA,CAAAN,MAAA,EAEC,UAAA,EAAA;AAChBK,IAAAA,UAAU,EAAE,KAAK;AACjBN,IAA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EAAE,CAAC,CAER;;;;"}
@@ -1,16 +1,19 @@
1
1
  import { BaseFilter } from './BaseFilter';
2
2
  import type { T2DPipelineState, TWebGLPipelineState } from './typedefs';
3
+ type ComposedOwnProps = {
4
+ subFilters: BaseFilter<string, object>[];
5
+ };
3
6
  /**
4
7
  * A container class that knows how to apply a sequence of filters to an input image.
5
8
  */
6
- export declare class Composed extends BaseFilter {
9
+ export declare class Composed extends BaseFilter<'Composed', ComposedOwnProps> {
7
10
  /**
8
11
  * A non sparse array of filters to apply
9
12
  */
10
- subFilters: BaseFilter[];
13
+ subFilters: ComposedOwnProps['subFilters'];
11
14
  static type: string;
12
- constructor({ subFilters, ...options }?: {
13
- subFilters?: BaseFilter[];
15
+ constructor(options?: {
16
+ subFilters?: BaseFilter<string, object>[];
14
17
  } & Record<string, any>);
15
18
  /**
16
19
  * Apply this container's filters to the input image provided.
@@ -21,14 +24,11 @@ export declare class Composed extends BaseFilter {
21
24
  applyTo(options: TWebGLPipelineState | T2DPipelineState): void;
22
25
  /**
23
26
  * Serialize this filter into JSON.
24
- *
25
27
  * @returns {Object} A JSON representation of this filter.
26
28
  */
27
29
  toObject(): {
28
- subFilters: {
29
- type: string;
30
- }[];
31
- type: string;
30
+ type: 'Composed';
31
+ subFilters: ReturnType<BaseFilter<string, object>['toObject']>[];
32
32
  };
33
33
  isNeutralState(): boolean;
34
34
  /**
@@ -41,6 +41,7 @@ export declare class Composed extends BaseFilter {
41
41
  */
42
42
  static fromObject(object: Record<string, any>, options: {
43
43
  signal: AbortSignal;
44
- }): Promise<BaseFilter>;
44
+ }): Promise<Composed>;
45
45
  }
46
+ export {};
46
47
  //# sourceMappingURL=Composed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Composed.d.ts","sourceRoot":"","sources":["../../../src/filters/Composed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EA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BAAgB;IASvD;;;OAGG;IAEH,QAAQ,IAAI;QACV,IAAI,EAAE,UAAU,CAAC;QACjB,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;KAClE;IAOD,cAAc;IAId;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,EAAE;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,GAC/B,OAAO,CAAC,QAAQ,CAAC;CAYrB"}
@@ -1,2 +1,2 @@
1
- import{defineProperty as t,objectWithoutProperties as s,objectSpread2 as e}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{BaseFilter as r}from"./BaseFilter.min.mjs";import{isWebGLPipelineState as i}from"./utils.min.mjs";import{classRegistry as l}from"../ClassRegistry.min.mjs";const o=["subFilters"];class a extends r{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{subFilters:e=[]}=t;super(s(t,o)),this.subFilters=e}applyTo(t){i(t)&&(t.passes+=this.subFilters.length-1),this.subFilters.forEach((s=>{s.applyTo(t)}))}toObject(){return e(e({},super.toObject()),{},{subFilters:this.subFilters.map((t=>t.toObject()))})}isNeutralState(){return!this.subFilters.some((t=>!t.isNeutralState()))}static fromObject(t,s){return Promise.all((t.subFilters||[]).map((t=>l.getClass(t.type).fromObject(t,s)))).then((t=>new this({subFilters:t})))}}t(a,"type","Composed"),l.setClass(a);export{a as Composed};
1
+ import{defineProperty as t}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{BaseFilter as s}from"./BaseFilter.min.mjs";import{isWebGLPipelineState as e}from"./utils.min.mjs";import{classRegistry as r}from"../ClassRegistry.min.mjs";class i extends s{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.subFilters=t.subFilters||[]}applyTo(t){e(t)&&(t.passes+=this.subFilters.length-1),this.subFilters.forEach((s=>{s.applyTo(t)}))}toObject(){return{type:this.type,subFilters:this.subFilters.map((t=>t.toObject()))}}isNeutralState(){return!this.subFilters.some((t=>!t.isNeutralState()))}static fromObject(t,s){return Promise.all((t.subFilters||[]).map((t=>r.getClass(t.type).fromObject(t,s)))).then((t=>new this({subFilters:t})))}}t(i,"type","Composed"),r.setClass(i);export{i as Composed};
2
2
  //# sourceMappingURL=Composed.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Composed.min.mjs","sources":["../../../src/filters/Composed.ts"],"sourcesContent":["import { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLPipelineState } from './typedefs';\nimport { isWebGLPipelineState } from './utils';\nimport { classRegistry } from '../ClassRegistry';\n\n/**\n * A container class that knows how to apply a sequence of filters to an input image.\n */\nexport class Composed extends BaseFilter {\n /**\n * A non sparse array of filters to apply\n */\n declare subFilters: BaseFilter[];\n\n static type = 'Composed';\n\n constructor({\n subFilters = [],\n ...options\n }: { subFilters?: BaseFilter[] } & Record<string, any> = {}) {\n super(options);\n this.subFilters = subFilters;\n }\n\n /**\n * Apply this container's filters to the input image provided.\n *\n * @param {Object} options\n * @param {Number} options.passes The number of filters remaining to be applied.\n */\n applyTo(options: TWebGLPipelineState | T2DPipelineState) {\n if (isWebGLPipelineState(options)) {\n options.passes += this.subFilters.length - 1;\n }\n this.subFilters.forEach((filter) => {\n filter.applyTo(options);\n });\n }\n\n /**\n * Serialize this filter into JSON.\n *\n * @returns {Object} A JSON representation of this filter.\n */\n toObject() {\n return {\n ...super.toObject(),\n subFilters: this.subFilters.map((filter) => filter.toObject()),\n };\n }\n\n isNeutralState() {\n return !this.subFilters.some((filter) => !filter.isNeutralState());\n }\n\n /**\n * Deserialize a JSON definition of a ComposedFilter into a concrete instance.\n * @static\n * @param {oject} object Object to create an instance from\n * @param {object} [options]\n * @param {AbortSignal} [options.signal] handle aborting `BlendImage` filter loading, see https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal\n * @returns {Promise<Composed>}\n */\n static fromObject(\n object: Record<string, any>,\n options: { signal: AbortSignal }\n ) {\n return Promise.all(\n ((object.subFilters || []) as BaseFilter[]).map((filter) =>\n classRegistry\n .getClass<typeof BaseFilter>(filter.type)\n .fromObject(filter, options)\n )\n ).then(\n (enlivedFilters) => new this({ subFilters: enlivedFilters }) as BaseFilter\n );\n }\n}\n\nclassRegistry.setClass(Composed);\n"],"names":["Composed","BaseFilter","constructor","_ref","arguments","length","undefined","subFilters","super","_objectWithoutProperties","_excluded","this","applyTo","options","isWebGLPipelineState","passes","forEach","filter","toObject","_objectSpread","map","isNeutralState","some","fromObject","object","Promise","all","classRegistry","getClass","type","then","enlivedFilters","_defineProperty","setClass"],"mappings":"2TAQO,MAAMA,UAAiBC,EAQ5BC,WAAAA,GAG6D,IAAAC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAJ,CAAE,GAH/CG,WACVA,EAAa,IAEuCJ,EACpDK,MAFUC,EAAAN,EAAAO,IAGVC,KAAKJ,WAAaA,CACpB,CAQAK,OAAAA,CAAQC,GACFC,EAAqBD,KACvBA,EAAQE,QAAUJ,KAAKJ,WAAWF,OAAS,GAE7CM,KAAKJ,WAAWS,SAASC,IACvBA,EAAOL,QAAQC,EAAQ,GAE3B,CAOAK,QAAAA,GACE,OAAAC,EAAAA,EAAA,CAAA,EACKX,MAAMU,YAAU,GAAA,CACnBX,WAAYI,KAAKJ,WAAWa,KAAKH,GAAWA,EAAOC,cAEvD,CAEAG,cAAAA,GACE,OAAQV,KAAKJ,WAAWe,MAAML,IAAYA,EAAOI,kBACnD,CAUA,iBAAOE,CACLC,EACAX,GAEA,OAAOY,QAAQC,KACXF,EAAOjB,YAAc,IAAqBa,KAAKH,GAC/CU,EACGC,SAA4BX,EAAOY,MACnCN,WAAWN,EAAQJ,MAExBiB,MACCC,GAAmB,IAAIpB,KAAK,CAAEJ,WAAYwB,KAE/C,EAnEAC,EADWhC,EAAQ,OAML,YAiEhB2B,EAAcM,SAASjC"}
1
+ {"version":3,"file":"Composed.min.mjs","sources":["../../../src/filters/Composed.ts"],"sourcesContent":["import { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLPipelineState } from './typedefs';\nimport { isWebGLPipelineState } from './utils';\nimport { classRegistry } from '../ClassRegistry';\n\ntype ComposedOwnProps = {\n subFilters: BaseFilter<string, object>[];\n};\n\n/**\n * A container class that knows how to apply a sequence of filters to an input image.\n */\nexport class Composed extends BaseFilter<'Composed', ComposedOwnProps> {\n /**\n * A non sparse array of filters to apply\n */\n declare subFilters: ComposedOwnProps['subFilters'];\n\n static type = 'Composed';\n\n constructor(\n options: { subFilters?: BaseFilter<string, object>[] } & Record<\n string,\n any\n > = {}\n ) {\n super(options);\n this.subFilters = options.subFilters || [];\n }\n\n /**\n * Apply this container's filters to the input image provided.\n *\n * @param {Object} options\n * @param {Number} options.passes The number of filters remaining to be applied.\n */\n applyTo(options: TWebGLPipelineState | T2DPipelineState) {\n if (isWebGLPipelineState(options)) {\n options.passes += this.subFilters.length - 1;\n }\n this.subFilters.forEach((filter) => {\n filter.applyTo(options);\n });\n }\n\n /**\n * Serialize this filter into JSON.\n * @returns {Object} A JSON representation of this filter.\n */\n //@ts-expect-error TS doesn't like this toObject\n toObject(): {\n type: 'Composed';\n subFilters: ReturnType<BaseFilter<string, object>['toObject']>[];\n } {\n return {\n type: this.type,\n subFilters: this.subFilters.map((filter) => filter.toObject()),\n };\n }\n\n isNeutralState() {\n return !this.subFilters.some((filter) => !filter.isNeutralState());\n }\n\n /**\n * Deserialize a JSON definition of a ComposedFilter into a concrete instance.\n * @static\n * @param {oject} object Object to create an instance from\n * @param {object} [options]\n * @param {AbortSignal} [options.signal] handle aborting `BlendImage` filter loading, see https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal\n * @returns {Promise<Composed>}\n */\n static fromObject(\n object: Record<string, any>,\n options: { signal: AbortSignal }\n ): Promise<Composed> {\n return Promise.all(\n ((object.subFilters || []) as BaseFilter<string, object>[]).map(\n (filter) =>\n classRegistry\n .getClass<typeof BaseFilter>(filter.type)\n .fromObject(filter, options)\n )\n ).then(\n (enlivedFilters) => new this({ subFilters: enlivedFilters }) as Composed\n );\n }\n}\n\nclassRegistry.setClass(Composed);\n"],"names":["Composed","BaseFilter","constructor","options","arguments","length","undefined","super","this","subFilters","applyTo","isWebGLPipelineState","passes","forEach","filter","toObject","type","map","isNeutralState","some","fromObject","object","Promise","all","classRegistry","getClass","then","enlivedFilters","_defineProperty","setClass"],"mappings":"oPAYO,MAAMA,UAAiBC,EAQ5BC,WAAAA,GAKE,IAJAC,EAGCC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EAEJG,MAAMJ,GACNK,KAAKC,WAAaN,EAAQM,YAAc,EAC1C,CAQAC,OAAAA,CAAQP,GACFQ,EAAqBR,KACvBA,EAAQS,QAAUJ,KAAKC,WAAWJ,OAAS,GAE7CG,KAAKC,WAAWI,SAASC,IACvBA,EAAOJ,QAAQP,EAAQ,GAE3B,CAOAY,QAAAA,GAIE,MAAO,CACLC,KAAMR,KAAKQ,KACXP,WAAYD,KAAKC,WAAWQ,KAAKH,GAAWA,EAAOC,aAEvD,CAEAG,cAAAA,GACE,OAAQV,KAAKC,WAAWU,MAAML,IAAYA,EAAOI,kBACnD,CAUA,iBAAOE,CACLC,EACAlB,GAEA,OAAOmB,QAAQC,KACXF,EAAOZ,YAAc,IAAqCQ,KACzDH,GACCU,EACGC,SAA4BX,EAAOE,MACnCI,WAAWN,EAAQX,MAE1BuB,MACCC,GAAmB,IAAInB,KAAK,CAAEC,WAAYkB,KAE/C,EAzEAC,EADW5B,EAAQ,OAML,YAuEhBwB,EAAcK,SAAS7B"}
@@ -1,22 +1,16 @@
1
- import { defineProperty as _defineProperty, objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.mjs';
1
+ import { defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.mjs';
2
2
  import { BaseFilter } from './BaseFilter.mjs';
3
3
  import { isWebGLPipelineState } from './utils.mjs';
4
4
  import { classRegistry } from '../ClassRegistry.mjs';
5
5
 
6
- const _excluded = ["subFilters"];
7
-
8
6
  /**
9
7
  * A container class that knows how to apply a sequence of filters to an input image.
10
8
  */
11
9
  class Composed extends BaseFilter {
12
10
  constructor() {
13
- let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
14
- {
15
- subFilters = []
16
- } = _ref,
17
- options = _objectWithoutProperties(_ref, _excluded);
11
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
12
  super(options);
19
- this.subFilters = subFilters;
13
+ this.subFilters = options.subFilters || [];
20
14
  }
21
15
 
22
16
  /**
@@ -36,13 +30,14 @@ class Composed extends BaseFilter {
36
30
 
37
31
  /**
38
32
  * Serialize this filter into JSON.
39
- *
40
33
  * @returns {Object} A JSON representation of this filter.
41
34
  */
35
+ //@ts-expect-error TS doesn't like this toObject
42
36
  toObject() {
43
- return _objectSpread2(_objectSpread2({}, super.toObject()), {}, {
37
+ return {
38
+ type: this.type,
44
39
  subFilters: this.subFilters.map(filter => filter.toObject())
45
- });
40
+ };
46
41
  }
47
42
  isNeutralState() {
48
43
  return !this.subFilters.some(filter => !filter.isNeutralState());
@@ -1 +1 @@
1
- {"version":3,"file":"Composed.mjs","sources":["../../../src/filters/Composed.ts"],"sourcesContent":["import { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLPipelineState } from './typedefs';\nimport { isWebGLPipelineState } from './utils';\nimport { classRegistry } from '../ClassRegistry';\n\n/**\n * A container class that knows how to apply a sequence of filters to an input image.\n */\nexport class Composed extends BaseFilter {\n /**\n * A non sparse array of filters to apply\n */\n declare subFilters: BaseFilter[];\n\n static type = 'Composed';\n\n constructor({\n subFilters = [],\n ...options\n }: { subFilters?: BaseFilter[] } & Record<string, any> = {}) {\n super(options);\n this.subFilters = subFilters;\n }\n\n /**\n * Apply this container's filters to the input image provided.\n *\n * @param {Object} options\n * @param {Number} options.passes The number of filters remaining to be applied.\n */\n applyTo(options: TWebGLPipelineState | T2DPipelineState) {\n if (isWebGLPipelineState(options)) {\n options.passes += this.subFilters.length - 1;\n }\n this.subFilters.forEach((filter) => {\n filter.applyTo(options);\n });\n }\n\n /**\n * Serialize this filter into JSON.\n *\n * @returns {Object} A JSON representation of this filter.\n */\n toObject() {\n return {\n ...super.toObject(),\n subFilters: this.subFilters.map((filter) => filter.toObject()),\n };\n }\n\n isNeutralState() {\n return !this.subFilters.some((filter) => !filter.isNeutralState());\n }\n\n /**\n * Deserialize a JSON definition of a ComposedFilter into a concrete instance.\n * @static\n * @param {oject} object Object to create an instance from\n * @param {object} [options]\n * @param {AbortSignal} [options.signal] handle aborting `BlendImage` filter loading, see https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal\n * @returns {Promise<Composed>}\n */\n static fromObject(\n object: Record<string, any>,\n options: { signal: AbortSignal }\n ) {\n return Promise.all(\n ((object.subFilters || []) as BaseFilter[]).map((filter) =>\n classRegistry\n .getClass<typeof BaseFilter>(filter.type)\n .fromObject(filter, options)\n )\n ).then(\n (enlivedFilters) => new this({ subFilters: enlivedFilters }) as BaseFilter\n );\n }\n}\n\nclassRegistry.setClass(Composed);\n"],"names":["Composed","BaseFilter","constructor","_ref","arguments","length","undefined","subFilters","options","_objectWithoutProperties","_excluded","applyTo","isWebGLPipelineState","passes","forEach","filter","toObject","_objectSpread","map","isNeutralState","some","fromObject","object","Promise","all","classRegistry","getClass","type","then","enlivedFilters","_defineProperty","setClass"],"mappings":";;;;;;;AAKA;AACA;AACA;AACO,MAAMA,QAAQ,SAASC,UAAU,CAAC;AAQvCC,EAAAA,WAAWA,GAGkD;AAAA,IAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF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,CAAEF,MAAM,CAACf,UAAU,IAAI,EAAE,EAAmBW,GAAG,CAAEH,MAAM,IACrDU,aAAa,CACVC,QAAQ,CAAoBX,MAAM,CAACY,IAAI,CAAC,CACxCN,UAAU,CAACN,MAAM,EAAEP,OAAO,CAC/B,CACF,CAAC,CAACoB,IAAI,CACHC,cAAc,IAAK,IAAI,IAAI,CAAC;AAAEtB,MAAAA,UAAU,EAAEsB,cAAAA;AAAe,KAAC,CAC7D,CAAC,CAAA;AACH,GAAA;AACF,CAAA;AApEE;AACF;AACA;AAFEC,eAAA,CADW9B,QAAQ,EAAA,MAAA,EAML,UAAU,CAAA,CAAA;AAiE1ByB,aAAa,CAACM,QAAQ,CAAC/B,QAAQ,CAAC;;;;"}
1
+ {"version":3,"file":"Composed.mjs","sources":["../../../src/filters/Composed.ts"],"sourcesContent":["import { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLPipelineState } from './typedefs';\nimport { isWebGLPipelineState } from './utils';\nimport { classRegistry } from '../ClassRegistry';\n\ntype ComposedOwnProps = {\n subFilters: BaseFilter<string, object>[];\n};\n\n/**\n * A container class that knows how to apply a sequence of filters to an input image.\n */\nexport class Composed extends BaseFilter<'Composed', ComposedOwnProps> {\n /**\n * A non sparse array of filters to apply\n */\n declare subFilters: ComposedOwnProps['subFilters'];\n\n static type = 'Composed';\n\n constructor(\n options: { subFilters?: BaseFilter<string, object>[] } & Record<\n string,\n any\n > = {}\n ) {\n super(options);\n this.subFilters = options.subFilters || [];\n }\n\n /**\n * Apply this container's filters to the input image provided.\n *\n * @param {Object} options\n * @param {Number} options.passes The number of filters remaining to be applied.\n */\n applyTo(options: TWebGLPipelineState | T2DPipelineState) {\n if (isWebGLPipelineState(options)) {\n options.passes += this.subFilters.length - 1;\n }\n this.subFilters.forEach((filter) => {\n filter.applyTo(options);\n });\n }\n\n /**\n * Serialize this filter into JSON.\n * @returns {Object} A JSON representation of this filter.\n */\n //@ts-expect-error TS doesn't like this toObject\n toObject(): {\n type: 'Composed';\n subFilters: ReturnType<BaseFilter<string, object>['toObject']>[];\n } {\n return {\n type: this.type,\n subFilters: this.subFilters.map((filter) => filter.toObject()),\n };\n }\n\n isNeutralState() {\n return !this.subFilters.some((filter) => !filter.isNeutralState());\n }\n\n /**\n * Deserialize a JSON definition of a ComposedFilter into a concrete instance.\n * @static\n * @param {oject} object Object to create an instance from\n * @param {object} [options]\n * @param {AbortSignal} [options.signal] handle aborting `BlendImage` filter loading, see https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal\n * @returns {Promise<Composed>}\n */\n static fromObject(\n object: Record<string, any>,\n options: { signal: AbortSignal }\n ): Promise<Composed> {\n return Promise.all(\n ((object.subFilters || []) as BaseFilter<string, object>[]).map(\n (filter) =>\n classRegistry\n .getClass<typeof BaseFilter>(filter.type)\n .fromObject(filter, options)\n )\n ).then(\n (enlivedFilters) => new this({ subFilters: enlivedFilters }) as Composed\n );\n }\n}\n\nclassRegistry.setClass(Composed);\n"],"names":["Composed","BaseFilter","constructor","options","arguments","length","undefined","subFilters","applyTo","isWebGLPipelineState","passes","forEach","filter","toObject","type","map","isNeutralState","some","fromObject","object","Promise","all","classRegistry","getClass","then","enlivedFilters","_defineProperty","setClass"],"mappings":";;;;;AASA;AACA;AACA;AACO,MAAMA,QAAQ,SAASC,UAAU,CAA+B;AAQrEC,EAAAA,WAAWA,GAKT;AAAA,IAAA,IAJAC,OAGC,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;IAEN,KAAK,CAACD,OAAO,CAAC,CAAA;AACd,IAAA,IAAI,CAACI,UAAU,GAAGJ,OAAO,CAACI,UAAU,IAAI,EAAE,CAAA;AAC5C,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACL,OAA+C,EAAE;AACvD,IAAA,IAAIM,oBAAoB,CAACN,OAA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AQ,CAAC;;;;"}
@@ -1,7 +1,9 @@
1
- import type { TClassProperties } from '../typedefs';
2
1
  import { BaseFilter } from './BaseFilter';
3
2
  import type { T2DPipelineState, TWebGLUniformLocationMap } from './typedefs';
4
- export declare const contrastDefaultValues: Partial<TClassProperties<Contrast>>;
3
+ type ContrastOwnProps = {
4
+ contrast: number;
5
+ };
6
+ export declare const contrastDefaultValues: ContrastOwnProps;
5
7
  /**
6
8
  * Contrast filter class
7
9
  * @example
@@ -11,16 +13,18 @@ export declare const contrastDefaultValues: Partial<TClassProperties<Contrast>>;
11
13
  * object.filters.push(filter);
12
14
  * object.applyFilters();
13
15
  */
14
- export declare class Contrast extends BaseFilter {
16
+ export declare class Contrast extends BaseFilter<'Contrast', ContrastOwnProps> {
15
17
  /**
16
18
  * contrast value, range from -1 to 1.
17
19
  * @param {Number} contrast
18
20
  * @default 0
19
21
  */
20
- contrast: number;
22
+ contrast: ContrastOwnProps['contrast'];
21
23
  static type: string;
22
- static defaults: Partial<TClassProperties<Contrast>>;
24
+ static defaults: ContrastOwnProps;
25
+ static uniformLocations: string[];
23
26
  getFragmentSource(): string;
27
+ isNeutralState(): boolean;
24
28
  /**
25
29
  * Apply the Contrast operation to a Uint8Array representing the pixels of an image.
26
30
  *
@@ -28,13 +32,6 @@ export declare class Contrast extends BaseFilter {
28
32
  * @param {ImageData} options.imageData The Uint8Array to be filtered.
29
33
  */
30
34
  applyTo2d({ imageData: { data } }: T2DPipelineState): void;
31
- /**
32
- * Return WebGL uniform locations for this filter's shader.
33
- *
34
- * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.
35
- * @param {WebGLShaderProgram} program This filter's compiled shader program.
36
- */
37
- getUniformLocations(gl: WebGLRenderingContext, program: WebGLProgram): TWebGLUniformLocationMap;
38
35
  /**
39
36
  * Send data from this filter to its shader program's uniforms.
40
37
  *
@@ -43,4 +40,5 @@ export declare class Contrast extends BaseFilter {
43
40
  */
44
41
  sendUniformData(gl: WebGLRenderingContext, uniformLocations: TWebGLUniformLocationMap): void;
45
42
  }
43
+ export {};
46
44
  //# sourceMappingURL=Contrast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Contrast.d.ts","sourceRoot":"","sources":["../../../src/filters/Contrast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG7E,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAGrE,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,QAAS,SAAQ,UAAU;IACtC;;;;OAIG;IACK,QAAQ,EAAE,MAAM,CAAC;IAEzB,MAAM,CAAC,IAAI,SAAc;IAEzB,MAAM,CAAC,QAAQ,sCAAyB;IAExC,iBAAiB;IAGjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,gBAAgB;IAcnD;;;;;OAKG;IACH,mBAAmB,CACjB,EAAE,EAAE,qBAAqB,EACzB,OAAO,EAAE,YAAY,GACpB,wBAAwB;IAM3B;;;;;OAKG;IACH,eAAe,CACb,EAAE,EAAE,qBAAqB,EACzB,gBAAgB,EAAE,wBAAwB;CAI7C"}
1
+ {"version":3,"file":"Contrast.d.ts","sourceRoot":"","sources":["../../../src/filters/Contrast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAI7E,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,gBAEnC,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,QAAS,SAAQ,UAAU,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACpE;;;;OAIG;IACK,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAE/C,MAAM,CAAC,IAAI,SAAc;IAEzB,MAAM,CAAC,QAAQ,mBAAyB;IAExC,MAAM,CAAC,gBAAgB,WAAiB;IAExC,iBAAiB;IAIjB,cAAc;IAId;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,gBAAgB;IAWnD;;;;;OAKG;IACH,eAAe,CACb,EAAE,EAAE,qBAAqB,EACzB,gBAAgB,EAAE,wBAAwB;CAI7C"}
@@ -1,2 +1,2 @@
1
- import{defineProperty as t}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{BaseFilter as r}from"./BaseFilter.min.mjs";import{classRegistry as s}from"../ClassRegistry.min.mjs";import{fragmentSource as o}from"./shaders/constrast.min.mjs";const a={contrast:0,mainParameter:"contrast"};class n extends r{getFragmentSource(){return o}applyTo2d(t){let{imageData:{data:r}}=t;if(0===this.contrast)return;const s=Math.floor(255*this.contrast),o=259*(s+255)/(255*(259-s));for(let t=0;t<r.length;t+=4)r[t]=o*(r[t]-128)+128,r[t+1]=o*(r[t+1]-128)+128,r[t+2]=o*(r[t+2]-128)+128}getUniformLocations(t,r){return{uContrast:t.getUniformLocation(r,"uContrast")}}sendUniformData(t,r){t.uniform1f(r.uContrast,this.contrast)}}t(n,"type","Contrast"),t(n,"defaults",a),s.setClass(n);export{n as Contrast,a as contrastDefaultValues};
1
+ import{defineProperty as t}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{BaseFilter as r}from"./BaseFilter.min.mjs";import{classRegistry as s}from"../ClassRegistry.min.mjs";import{fragmentSource as o}from"./shaders/constrast.min.mjs";const a={contrast:0};class e extends r{getFragmentSource(){return o}isNeutralState(){return 0===this.contrast}applyTo2d(t){let{imageData:{data:r}}=t;const s=Math.floor(255*this.contrast),o=259*(s+255)/(255*(259-s));for(let t=0;t<r.length;t+=4)r[t]=o*(r[t]-128)+128,r[t+1]=o*(r[t+1]-128)+128,r[t+2]=o*(r[t+2]-128)+128}sendUniformData(t,r){t.uniform1f(r.uContrast,this.contrast)}}t(e,"type","Contrast"),t(e,"defaults",a),t(e,"uniformLocations",["uContrast"]),s.setClass(e);export{e as Contrast,a as contrastDefaultValues};
2
2
  //# sourceMappingURL=Contrast.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Contrast.min.mjs","sources":["../../../src/filters/Contrast.ts"],"sourcesContent":["import type { TClassProperties } from '../typedefs';\nimport { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLUniformLocationMap } from './typedefs';\nimport { classRegistry } from '../ClassRegistry';\nimport { fragmentSource } from './shaders/constrast';\nexport const contrastDefaultValues: Partial<TClassProperties<Contrast>> = {\n contrast: 0,\n mainParameter: 'contrast',\n};\n\n/**\n * Contrast filter class\n * @example\n * const filter = new Contrast({\n * contrast: 0.25\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n */\nexport class Contrast extends BaseFilter {\n /**\n * contrast value, range from -1 to 1.\n * @param {Number} contrast\n * @default 0\n */\n declare contrast: number;\n\n static type = 'Contrast';\n\n static defaults = contrastDefaultValues;\n\n getFragmentSource() {\n return fragmentSource;\n }\n /**\n * Apply the Contrast operation to a Uint8Array representing the pixels of an image.\n *\n * @param {Object} options\n * @param {ImageData} options.imageData The Uint8Array to be filtered.\n */\n applyTo2d({ imageData: { data } }: T2DPipelineState) {\n if (this.contrast === 0) {\n return;\n }\n const contrast = Math.floor(this.contrast * 255),\n contrastF = (259 * (contrast + 255)) / (255 * (259 - contrast));\n\n for (let i = 0; i < data.length; i += 4) {\n data[i] = contrastF * (data[i] - 128) + 128;\n data[i + 1] = contrastF * (data[i + 1] - 128) + 128;\n data[i + 2] = contrastF * (data[i + 2] - 128) + 128;\n }\n }\n\n /**\n * Return WebGL uniform locations for this filter's shader.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {WebGLShaderProgram} program This filter's compiled shader program.\n */\n getUniformLocations(\n gl: WebGLRenderingContext,\n program: WebGLProgram\n ): TWebGLUniformLocationMap {\n return {\n uContrast: gl.getUniformLocation(program, 'uContrast'),\n };\n }\n\n /**\n * Send data from this filter to its shader program's uniforms.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects\n */\n sendUniformData(\n gl: WebGLRenderingContext,\n uniformLocations: TWebGLUniformLocationMap\n ) {\n gl.uniform1f(uniformLocations.uContrast, this.contrast);\n }\n}\n\nclassRegistry.setClass(Contrast);\n"],"names":["contrastDefaultValues","contrast","mainParameter","Contrast","BaseFilter","getFragmentSource","fragmentSource","applyTo2d","_ref","imageData","data","this","Math","floor","contrastF","i","length","getUniformLocations","gl","program","uContrast","getUniformLocation","sendUniformData","uniformLocations","uniform1f","_defineProperty","classRegistry","setClass"],"mappings":"0PAKO,MAAMA,EAA6D,CACxEC,SAAU,EACVC,cAAe,YAYV,MAAMC,UAAiBC,EAY5BC,iBAAAA,GACE,OAAOC,CACT,CAOAC,SAAAA,CAASC,GAA4C,IAAzCC,WAAWC,KAAEA,IAA0BF,EACjD,GAAsB,IAAlBG,KAAKV,SACP,OAEF,MAAMA,EAAWW,KAAKC,MAAsB,IAAhBF,KAAKV,UAC/Ba,EAAa,KAAOb,EAAW,MAAS,KAAO,IAAMA,IAEvD,IAAK,IAAIc,EAAI,EAAGA,EAAIL,EAAKM,OAAQD,GAAK,EACpCL,EAAKK,GAAKD,GAAaJ,EAAKK,GAAK,KAAO,IACxCL,EAAKK,EAAI,GAAKD,GAAaJ,EAAKK,EAAI,GAAK,KAAO,IAChDL,EAAKK,EAAI,GAAKD,GAAaJ,EAAKK,EAAI,GAAK,KAAO,GAEpD,CAQAE,mBAAAA,CACEC,EACAC,GAEA,MAAO,CACLC,UAAWF,EAAGG,mBAAmBF,EAAS,aAE9C,CAQAG,eAAAA,CACEJ,EACAK,GAEAL,EAAGM,UAAUD,EAAiBH,UAAWT,KAAKV,SAChD,EA5DAwB,EADWtB,EAAQ,OAQL,YAAUsB,EARbtB,EAAQ,WAUDH,GAsDpB0B,EAAcC,SAASxB"}
1
+ {"version":3,"file":"Contrast.min.mjs","sources":["../../../src/filters/Contrast.ts"],"sourcesContent":["import { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLUniformLocationMap } from './typedefs';\nimport { classRegistry } from '../ClassRegistry';\nimport { fragmentSource } from './shaders/constrast';\n\ntype ContrastOwnProps = {\n contrast: number;\n};\n\nexport const contrastDefaultValues: ContrastOwnProps = {\n contrast: 0,\n};\n\n/**\n * Contrast filter class\n * @example\n * const filter = new Contrast({\n * contrast: 0.25\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n */\nexport class Contrast extends BaseFilter<'Contrast', ContrastOwnProps> {\n /**\n * contrast value, range from -1 to 1.\n * @param {Number} contrast\n * @default 0\n */\n declare contrast: ContrastOwnProps['contrast'];\n\n static type = 'Contrast';\n\n static defaults = contrastDefaultValues;\n\n static uniformLocations = ['uContrast'];\n\n getFragmentSource() {\n return fragmentSource;\n }\n\n isNeutralState() {\n return this.contrast === 0;\n }\n\n /**\n * Apply the Contrast operation to a Uint8Array representing the pixels of an image.\n *\n * @param {Object} options\n * @param {ImageData} options.imageData The Uint8Array to be filtered.\n */\n applyTo2d({ imageData: { data } }: T2DPipelineState) {\n const contrast = Math.floor(this.contrast * 255),\n contrastF = (259 * (contrast + 255)) / (255 * (259 - contrast));\n\n for (let i = 0; i < data.length; i += 4) {\n data[i] = contrastF * (data[i] - 128) + 128;\n data[i + 1] = contrastF * (data[i + 1] - 128) + 128;\n data[i + 2] = contrastF * (data[i + 2] - 128) + 128;\n }\n }\n\n /**\n * Send data from this filter to its shader program's uniforms.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects\n */\n sendUniformData(\n gl: WebGLRenderingContext,\n uniformLocations: TWebGLUniformLocationMap\n ) {\n gl.uniform1f(uniformLocations.uContrast, this.contrast);\n }\n}\n\nclassRegistry.setClass(Contrast);\n"],"names":["contrastDefaultValues","contrast","Contrast","BaseFilter","getFragmentSource","fragmentSource","isNeutralState","this","applyTo2d","_ref","imageData","data","Math","floor","contrastF","i","length","sendUniformData","gl","uniformLocations","uniform1f","uContrast","_defineProperty","classRegistry","setClass"],"mappings":"0PASO,MAAMA,EAA0C,CACrDC,SAAU,GAYL,MAAMC,UAAiBC,EAc5BC,iBAAAA,GACE,OAAOC,CACT,CAEAC,cAAAA,GACE,OAAyB,IAAlBC,KAAKN,QACd,CAQAO,SAAAA,CAASC,GAA4C,IAAzCC,WAAWC,KAAEA,IAA0BF,EACjD,MAAMR,EAAWW,KAAKC,MAAsB,IAAhBN,KAAKN,UAC/Ba,EAAa,KAAOb,EAAW,MAAS,KAAO,IAAMA,IAEvD,IAAK,IAAIc,EAAI,EAAGA,EAAIJ,EAAKK,OAAQD,GAAK,EACpCJ,EAAKI,GAAKD,GAAaH,EAAKI,GAAK,KAAO,IACxCJ,EAAKI,EAAI,GAAKD,GAAaH,EAAKI,EAAI,GAAK,KAAO,IAChDJ,EAAKI,EAAI,GAAKD,GAAaH,EAAKI,EAAI,GAAK,KAAO,GAEpD,CAQAE,eAAAA,CACEC,EACAC,GAEAD,EAAGE,UAAUD,EAAiBE,UAAWd,KAAKN,SAChD,EAjDAqB,EADWpB,EAAQ,OAQL,YAAUoB,EARbpB,EAAQ,WAUDF,GAAqBsB,EAV5BpB,EAYe,mBAAA,CAAC,cAyC7BqB,EAAcC,SAAStB"}
@@ -4,8 +4,7 @@ import { classRegistry } from '../ClassRegistry.mjs';
4
4
  import { fragmentSource } from './shaders/constrast.mjs';
5
5
 
6
6
  const contrastDefaultValues = {
7
- contrast: 0,
8
- mainParameter: 'contrast'
7
+ contrast: 0
9
8
  };
10
9
 
11
10
  /**
@@ -21,6 +20,10 @@ class Contrast extends BaseFilter {
21
20
  getFragmentSource() {
22
21
  return fragmentSource;
23
22
  }
23
+ isNeutralState() {
24
+ return this.contrast === 0;
25
+ }
26
+
24
27
  /**
25
28
  * Apply the Contrast operation to a Uint8Array representing the pixels of an image.
26
29
  *
@@ -33,9 +36,6 @@ class Contrast extends BaseFilter {
33
36
  data
34
37
  }
35
38
  } = _ref;
36
- if (this.contrast === 0) {
37
- return;
38
- }
39
39
  const contrast = Math.floor(this.contrast * 255),
40
40
  contrastF = 259 * (contrast + 255) / (255 * (259 - contrast));
41
41
  for (let i = 0; i < data.length; i += 4) {
@@ -45,18 +45,6 @@ class Contrast extends BaseFilter {
45
45
  }
46
46
  }
47
47
 
48
- /**
49
- * Return WebGL uniform locations for this filter's shader.
50
- *
51
- * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.
52
- * @param {WebGLShaderProgram} program This filter's compiled shader program.
53
- */
54
- getUniformLocations(gl, program) {
55
- return {
56
- uContrast: gl.getUniformLocation(program, 'uContrast')
57
- };
58
- }
59
-
60
48
  /**
61
49
  * Send data from this filter to its shader program's uniforms.
62
50
  *
@@ -74,6 +62,7 @@ class Contrast extends BaseFilter {
74
62
  */
75
63
  _defineProperty(Contrast, "type", 'Contrast');
76
64
  _defineProperty(Contrast, "defaults", contrastDefaultValues);
65
+ _defineProperty(Contrast, "uniformLocations", ['uContrast']);
77
66
  classRegistry.setClass(Contrast);
78
67
 
79
68
  export { Contrast, contrastDefaultValues };
@@ -1 +1 @@
1
- {"version":3,"file":"Contrast.mjs","sources":["../../../src/filters/Contrast.ts"],"sourcesContent":["import type { TClassProperties } from '../typedefs';\nimport { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLUniformLocationMap } from './typedefs';\nimport { classRegistry } from '../ClassRegistry';\nimport { fragmentSource } from './shaders/constrast';\nexport const contrastDefaultValues: Partial<TClassProperties<Contrast>> = {\n contrast: 0,\n mainParameter: 'contrast',\n};\n\n/**\n * Contrast filter class\n * @example\n * const filter = new Contrast({\n * contrast: 0.25\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n */\nexport class Contrast extends BaseFilter {\n /**\n * contrast value, range from -1 to 1.\n * @param {Number} contrast\n * @default 0\n */\n declare contrast: number;\n\n static type = 'Contrast';\n\n static defaults = contrastDefaultValues;\n\n getFragmentSource() {\n return fragmentSource;\n }\n /**\n * Apply the Contrast operation to a Uint8Array representing the pixels of an image.\n *\n * @param {Object} options\n * @param {ImageData} options.imageData The Uint8Array to be filtered.\n */\n applyTo2d({ imageData: { data } }: T2DPipelineState) {\n if (this.contrast === 0) {\n return;\n }\n const contrast = Math.floor(this.contrast * 255),\n contrastF = (259 * (contrast + 255)) / (255 * (259 - contrast));\n\n for (let i = 0; i < data.length; i += 4) {\n data[i] = contrastF * (data[i] - 128) + 128;\n data[i + 1] = contrastF * (data[i + 1] - 128) + 128;\n data[i + 2] = contrastF * (data[i + 2] - 128) + 128;\n }\n }\n\n /**\n * Return WebGL uniform locations for this filter's shader.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {WebGLShaderProgram} program This filter's compiled shader program.\n */\n getUniformLocations(\n gl: WebGLRenderingContext,\n program: WebGLProgram\n ): TWebGLUniformLocationMap {\n return {\n uContrast: gl.getUniformLocation(program, 'uContrast'),\n };\n }\n\n /**\n * Send data from this filter to its shader program's uniforms.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects\n */\n sendUniformData(\n gl: WebGLRenderingContext,\n uniformLocations: TWebGLUniformLocationMap\n ) {\n gl.uniform1f(uniformLocations.uContrast, this.contrast);\n }\n}\n\nclassRegistry.setClass(Contrast);\n"],"names":["contrastDefaultValues","contrast","mainParameter","Contrast","BaseFilter","getFragmentSource","fragmentSource","applyTo2d","_ref","imageData","data","Math","floor","contrastF","i","length","getUniformLocations","gl","program","uContrast","getUniformLocation","sendUniformData","uniformLocations","uniform1f","_defineProperty","classRegistry","setClass"],"mappings":";;;;;AAKO,MAAMA,qBAA0D,GAAG;AACxEC,EAAAA,QAAQ,EAAE,CAAC;AACXC,EAAAA,aAAa,EAAE,UAAA;AACjB,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,QAAQ,SAASC,UAAU,CAAC;AAYvCC,EAAAA,iBAAiBA,GAAG;AAClB,IAAA,OAAOC,cAAc,CAAA;AACvB,GAAA;AACA;AACF;AACA;AACA;AACA;AACA;EACEC,SAASA,CAAAC,IAAA,EAA4C;IAAA,IAA3C;AAAEC,MAAAA,SAAS,EAAE;AAAEC,QAAAA,IAAAA;AAAK,OAAA;AAAoB,KAAC,GAAAF,IAAA,CAAA;AACjD,IAAA,IAAI,IAAI,CAACP,QAAQ,KAAK,CAAC,EAAE;AACvB,MAAA,OAAA;AACF,KAAA;IACA,MAAMA,QAAQ,GAAGU,IAAI,CAACC,KAAK,CAAC,IAAI,CAACX,QAAQ,GAAG,GAAG,CAAC;AAC9CY,MAAAA,SAAS,GAAI,GAAG,IAAIZ,QAAQ,GAAG,GAAG,CAAC,IAAK,GAAG,IAAI,GAAG,GAAGA,QAAQ,CAAC,CAAC,CAAA;AAEjE,IAAA,KAAK,IAAIa,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,IAAI,CAACK,MAAM,EAAED,CAAC,IAAI,CAAC,EAAE;AACvCJ,MAAAA,IAAI,CAACI,CAAC,CAAC,GAAGD,SAAS,IAAIH,IAAI,CAACI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AAC3CJ,MAAAA,IAAI,CAACI,CAAC,GAAG,CAAC,CAAC,GAAGD,SAAS,IAAIH,IAAI,CAACI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AACnDJ,MAAAA,IAAI,CAACI,CAAC,GAAG,CAAC,CAAC,GAAGD,SAAS,IAAIH,IAAI,CAACI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AACrD,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACEE,EAAAA,mBAAmBA,CACjBC,EAAyB,EACzBC,OAAqB,EACK;IAC1B,OAAO;AACLC,MAAAA,SAAS,EAAEF,EAAE,CAACG,kBAAkB,CAACF,OAAO,EAAE,WAAW,CAAA;KACtD,CAAA;AACH,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACEG,EAAAA,eAAeA,CACbJ,EAAyB,EACzBK,gBAA0C,EAC1C;IACAL,EAAE,CAACM,SAAS,CAACD,gBAAgB,CAACH,SAAS,EAAE,IAAI,CAAClB,QAAQ,CAAC,CAAA;AACzD,GAAA;AACF,CAAA;AA7DE;AACF;AACA;AACA;AACA;AAJEuB,eAAA,CADWrB,QAAQ,EAAA,MAAA,EAQL,UAAU,CAAA,CAAA;AAAAqB,eAAA,CARbrB,QAAQ,EAAA,UAAA,EAUDH,qBAAqB,CAAA,CAAA;AAsDzCyB,aAAa,CAACC,QAAQ,CAACvB,QAAQ,CAAC;;;;"}
1
+ {"version":3,"file":"Contrast.mjs","sources":["../../../src/filters/Contrast.ts"],"sourcesContent":["import { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLUniformLocationMap } from './typedefs';\nimport { classRegistry } from '../ClassRegistry';\nimport { fragmentSource } from './shaders/constrast';\n\ntype ContrastOwnProps = {\n contrast: number;\n};\n\nexport const contrastDefaultValues: ContrastOwnProps = {\n contrast: 0,\n};\n\n/**\n * Contrast filter class\n * @example\n * const filter = new Contrast({\n * contrast: 0.25\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n */\nexport class Contrast extends BaseFilter<'Contrast', ContrastOwnProps> {\n /**\n * contrast value, range from -1 to 1.\n * @param {Number} contrast\n * @default 0\n */\n declare contrast: ContrastOwnProps['contrast'];\n\n static type = 'Contrast';\n\n static defaults = contrastDefaultValues;\n\n static uniformLocations = ['uContrast'];\n\n getFragmentSource() {\n return fragmentSource;\n }\n\n isNeutralState() {\n return this.contrast === 0;\n }\n\n /**\n * Apply the Contrast operation to a Uint8Array representing the pixels of an image.\n *\n * @param {Object} options\n * @param {ImageData} options.imageData The Uint8Array to be filtered.\n */\n applyTo2d({ imageData: { data } }: T2DPipelineState) {\n const contrast = Math.floor(this.contrast * 255),\n contrastF = (259 * (contrast + 255)) / (255 * (259 - contrast));\n\n for (let i = 0; i < data.length; i += 4) {\n data[i] = contrastF * (data[i] - 128) + 128;\n data[i + 1] = contrastF * (data[i + 1] - 128) + 128;\n data[i + 2] = contrastF * (data[i + 2] - 128) + 128;\n }\n }\n\n /**\n * Send data from this filter to its shader program's uniforms.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects\n */\n sendUniformData(\n gl: WebGLRenderingContext,\n uniformLocations: TWebGLUniformLocationMap\n ) {\n gl.uniform1f(uniformLocations.uContrast, this.contrast);\n }\n}\n\nclassRegistry.setClass(Contrast);\n"],"names":["contrastDefaultValues","contrast","Contrast","BaseFilter","getFragmentSource","fragmentSource","isNeutralState","applyTo2d","_ref","imageData","data","Math","floor","contrastF","i","length","sendUniformData","gl","uniformLocations","uniform1f","uContrast","_defineProperty","classRegistry","setClass"],"mappings":";;;;;AASO,MAAMA,qBAAuC,GAAG;AACrDC,EAAAA,QAAQ,EAAE,CAAA;AACZ,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,QAAQ,SAASC,UAAU,CAA+B;AAcrEC,EAAAA,iBAAiBA,GAAG;AAClB,IAAA,OAAOC,cAAc,CAAA;AACvB,GAAA;AAEAC,EAAAA,cAAcA,GAAG;AACf,IAAA,OAAO,IAAI,CAACL,QAAQ,KAAK,CAAC,CAAA;AAC5B,GAAA;;AAEA;AACF;AACA;A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EAAA,UAAA,EAUDF,qBAAqB,CAAA,CAAA;AAAAqB,eAAA,CAV5BnB,QAAQ,EAYO,kBAAA,EAAA,CAAC,WAAW,CAAC,CAAA,CAAA;AAyCzCoB,aAAa,CAACC,QAAQ,CAACrB,QAAQ,CAAC;;;;"}
@@ -1,7 +1,10 @@
1
- import type { TClassProperties } from '../typedefs';
2
1
  import { BaseFilter } from './BaseFilter';
3
2
  import type { T2DPipelineState, TWebGLUniformLocationMap } from './typedefs';
4
- export declare const convoluteDefaultValues: Partial<TClassProperties<Convolute>>;
3
+ export type ConvoluteOwnProps = {
4
+ opaque: boolean;
5
+ matrix: number[];
6
+ };
7
+ export declare const convoluteDefaultValues: ConvoluteOwnProps;
5
8
  /**
6
9
  * Adapted from <a href="http://www.html5rocks.com/en/tutorials/canvas/imagefilters/">html5rocks article</a>
7
10
  * @example <caption>Sharpen filter</caption>
@@ -42,11 +45,12 @@ export declare const convoluteDefaultValues: Partial<TClassProperties<Convolute>
42
45
  * object.applyFilters();
43
46
  * canvas.renderAll();
44
47
  */
45
- export declare class Convolute extends BaseFilter {
46
- opaque: boolean;
47
- matrix: number[];
48
+ export declare class Convolute extends BaseFilter<'Convolute', ConvoluteOwnProps> {
49
+ opaque: ConvoluteOwnProps['opaque'];
50
+ matrix: ConvoluteOwnProps['matrix'];
48
51
  static type: string;
49
- static defaults: Partial<TClassProperties<Convolute>>;
52
+ static defaults: ConvoluteOwnProps;
53
+ static uniformLocations: string[];
50
54
  getCacheKey(): "Convolute_3_1" | "Convolute_3_0" | "Convolute_5_1" | "Convolute_5_0" | "Convolute_7_1" | "Convolute_7_0" | "Convolute_9_1" | "Convolute_9_0";
51
55
  getFragmentSource(): string;
52
56
  /**
@@ -56,13 +60,6 @@ export declare class Convolute extends BaseFilter {
56
60
  * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered.
57
61
  */
58
62
  applyTo2d(options: T2DPipelineState): void;
59
- /**
60
- * Return WebGL uniform locations for this filter's shader.
61
- *
62
- * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.
63
- * @param {WebGLShaderProgram} program This filter's compiled shader program.
64
- */
65
- getUniformLocations(gl: WebGLRenderingContext, program: WebGLProgram): TWebGLUniformLocationMap;
66
63
  /**
67
64
  * Send data from this filter to its shader program's uniforms.
68
65
  *
@@ -77,7 +74,7 @@ export declare class Convolute extends BaseFilter {
77
74
  toObject(): {
78
75
  opaque: boolean;
79
76
  matrix: number[];
80
- type: string;
77
+ type: "Convolute";
81
78
  };
82
79
  }
83
80
  //# sourceMappingURL=Convolute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Convolute.d.ts","sourceRoot":"","sources":["../../../src/filters/Convolute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAI7E,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAGvE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,SAAU,SAAQ,UAAU;IAI/B,MAAM,EAAE,OAAO,CAAC;IAKhB,MAAM,EAAE,MAAM,EAAE,CAAC;IAEzB,MAAM,CAAC,IAAI,SAAe;IAE1B,MAAM,CAAC,QAAQ,uCAA0B;IAEzC,WAAW;IAMX,iBAAiB;IAIjB;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,gBAAgB;IA2DnC;;;;;OAKG;IACH,mBAAmB,CACjB,EAAE,EAAE,qBAAqB,EACzB,OAAO,EAAE,YAAY,GACpB,wBAAwB;IAS3B;;;;;OAKG;IACH,eAAe,CACb,EAAE,EAAE,qBAAqB,EACzB,gBAAgB,EAAE,wBAAwB;IAK5C;;;OAGG;IACH,QAAQ;;;;;CAOT"}
1
+ {"version":3,"file":"Convolute.d.ts","sourceRoot":"","sources":["../../../src/filters/Convolute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAI7E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAGpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,SAAU,SAAQ,UAAU,CAAC,WAAW,EAAE,iBAAiB,CAAC;IAI/D,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAKpC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAE5C,MAAM,CAAC,IAAI,SAAe;IAE1B,MAAM,CAAC,QAAQ,oBAA0B;IAEzC,MAAM,CAAC,gBAAgB,WAAgD;IAEvE,WAAW;IAMX,iBAAiB;IAIjB;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,gBAAgB;IA2DnC;;;;;OAKG;IACH,eAAe,CACb,EAAE,EAAE,qBAAqB,EACzB,gBAAgB,EAAE,wBAAwB;IAK5C;;;OAGG;IACH,QAAQ;;;;;CAOT"}
@@ -1,2 +1,2 @@
1
- import{defineProperty as t,objectSpread2 as e}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{BaseFilter as a}from"./BaseFilter.min.mjs";import{classRegistry as o}from"../ClassRegistry.min.mjs";import{fragmentSource as r}from"./shaders/convolute.min.mjs";const i={opaque:!1,matrix:[0,0,0,0,1,0,0,0,0]};class s extends a{getCacheKey(){return"".concat(this.type,"_").concat(Math.sqrt(this.matrix.length),"_").concat(this.opaque?1:0)}getFragmentSource(){return r[this.getCacheKey()]}applyTo2d(t){const e=t.imageData,a=e.data,o=this.matrix,r=Math.round(Math.sqrt(o.length)),i=Math.floor(r/2),s=e.width,n=e.height,m=t.ctx.createImageData(s,n),u=m.data,c=this.opaque?1:0;let f,h,p,l,g,x,d,q,j,y,M,S,U;for(M=0;M<n;M++)for(y=0;y<s;y++){for(g=4*(M*s+y),f=0,h=0,p=0,l=0,U=0;U<r;U++)for(S=0;S<r;S++)d=M+U-i,x=y+S-i,d<0||d>=n||x<0||x>=s||(q=4*(d*s+x),j=o[U*r+S],f+=a[q]*j,h+=a[q+1]*j,p+=a[q+2]*j,c||(l+=a[q+3]*j));u[g]=f,u[g+1]=h,u[g+2]=p,u[g+3]=c?a[g+3]:l}t.imageData=m}getUniformLocations(t,e){return{uMatrix:t.getUniformLocation(e,"uMatrix"),uOpaque:t.getUniformLocation(e,"uOpaque"),uHalfSize:t.getUniformLocation(e,"uHalfSize"),uSize:t.getUniformLocation(e,"uSize")}}sendUniformData(t,e){t.uniform1fv(e.uMatrix,this.matrix)}toObject(){return e(e({},super.toObject()),{},{opaque:this.opaque,matrix:[...this.matrix]})}}t(s,"type","Convolute"),t(s,"defaults",i),o.setClass(s);export{s as Convolute,i as convoluteDefaultValues};
1
+ import{defineProperty as t,objectSpread2 as a}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{BaseFilter as e}from"./BaseFilter.min.mjs";import{classRegistry as r}from"../ClassRegistry.min.mjs";import{fragmentSource as o}from"./shaders/convolute.min.mjs";const i={opaque:!1,matrix:[0,0,0,0,1,0,0,0,0]};class s extends e{getCacheKey(){return"".concat(this.type,"_").concat(Math.sqrt(this.matrix.length),"_").concat(this.opaque?1:0)}getFragmentSource(){return o[this.getCacheKey()]}applyTo2d(t){const a=t.imageData,e=a.data,r=this.matrix,o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=a.width,m=a.height,n=t.ctx.createImageData(s,m),u=n.data,h=this.opaque?1:0;let p,c,l,f,g,d,x,q,j,y,M,C,b;for(M=0;M<m;M++)for(y=0;y<s;y++){for(g=4*(M*s+y),p=0,c=0,l=0,f=0,b=0;b<o;b++)for(C=0;C<o;C++)x=M+b-i,d=y+C-i,x<0||x>=m||d<0||d>=s||(q=4*(x*s+d),j=r[b*o+C],p+=e[q]*j,c+=e[q+1]*j,l+=e[q+2]*j,h||(f+=e[q+3]*j));u[g]=p,u[g+1]=c,u[g+2]=l,u[g+3]=h?e[g+3]:f}t.imageData=n}sendUniformData(t,a){t.uniform1fv(a.uMatrix,this.matrix)}toObject(){return a(a({},super.toObject()),{},{opaque:this.opaque,matrix:[...this.matrix]})}}t(s,"type","Convolute"),t(s,"defaults",i),t(s,"uniformLocations",["uMatrix","uOpaque","uHalfSize","uSize"]),r.setClass(s);export{s as Convolute,i as convoluteDefaultValues};
2
2
  //# sourceMappingURL=Convolute.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Convolute.min.mjs","sources":["../../../src/filters/Convolute.ts"],"sourcesContent":["import type { TClassProperties } from '../typedefs';\nimport { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLUniformLocationMap } from './typedefs';\nimport { classRegistry } from '../ClassRegistry';\nimport { fragmentSource } from './shaders/convolute';\n\nexport const convoluteDefaultValues: Partial<TClassProperties<Convolute>> = {\n opaque: false,\n matrix: [0, 0, 0, 0, 1, 0, 0, 0, 0],\n};\n\n/**\n * Adapted from <a href=\"http://www.html5rocks.com/en/tutorials/canvas/imagefilters/\">html5rocks article</a>\n * @example <caption>Sharpen filter</caption>\n * const filter = new Convolute({\n * matrix: [ 0, -1, 0,\n * -1, 5, -1,\n * 0, -1, 0 ]\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n * canvas.renderAll();\n * @example <caption>Blur filter</caption>\n * const filter = new Convolute({\n * matrix: [ 1/9, 1/9, 1/9,\n * 1/9, 1/9, 1/9,\n * 1/9, 1/9, 1/9 ]\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n * canvas.renderAll();\n * @example <caption>Emboss filter</caption>\n * const filter = new Convolute({\n * matrix: [ 1, 1, 1,\n * 1, 0.7, -1,\n * -1, -1, -1 ]\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n * canvas.renderAll();\n * @example <caption>Emboss filter with opaqueness</caption>\n * const filter = new Convolute({\n * opaque: true,\n * matrix: [ 1, 1, 1,\n * 1, 0.7, -1,\n * -1, -1, -1 ]\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n * canvas.renderAll();\n */\nexport class Convolute extends BaseFilter {\n /*\n * Opaque value (true/false)\n */\n declare opaque: boolean;\n\n /*\n * matrix for the filter, max 9x9\n */\n declare matrix: number[];\n\n static type = 'Convolute';\n\n static defaults = convoluteDefaultValues;\n\n getCacheKey() {\n return `${this.type}_${Math.sqrt(this.matrix.length)}_${\n this.opaque ? 1 : 0\n }` as keyof typeof fragmentSource;\n }\n\n getFragmentSource() {\n return fragmentSource[this.getCacheKey()];\n }\n\n /**\n * Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image.\n *\n * @param {Object} options\n * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered.\n */\n applyTo2d(options: T2DPipelineState) {\n const imageData = options.imageData,\n data = imageData.data,\n weights = this.matrix,\n side = Math.round(Math.sqrt(weights.length)),\n halfSide = Math.floor(side / 2),\n sw = imageData.width,\n sh = imageData.height,\n output = options.ctx.createImageData(sw, sh),\n dst = output.data,\n // go through the destination image pixels\n alphaFac = this.opaque ? 1 : 0;\n let r, g, b, a, dstOff, scx, scy, srcOff, wt, x, y, cx, cy;\n\n for (y = 0; y < sh; y++) {\n for (x = 0; x < sw; x++) {\n dstOff = (y * sw + x) * 4;\n // calculate the weighed sum of the source image pixels that\n // fall under the convolution matrix\n r = 0;\n g = 0;\n b = 0;\n a = 0;\n\n for (cy = 0; cy < side; cy++) {\n for (cx = 0; cx < side; cx++) {\n scy = y + cy - halfSide;\n scx = x + cx - halfSide;\n\n // eslint-disable-next-line max-depth\n if (scy < 0 || scy >= sh || scx < 0 || scx >= sw) {\n continue;\n }\n\n srcOff = (scy * sw + scx) * 4;\n wt = weights[cy * side + cx];\n\n r += data[srcOff] * wt;\n g += data[srcOff + 1] * wt;\n b += data[srcOff + 2] * wt;\n // eslint-disable-next-line max-depth\n if (!alphaFac) {\n a += data[srcOff + 3] * wt;\n }\n }\n }\n dst[dstOff] = r;\n dst[dstOff + 1] = g;\n dst[dstOff + 2] = b;\n if (!alphaFac) {\n dst[dstOff + 3] = a;\n } else {\n dst[dstOff + 3] = data[dstOff + 3];\n }\n }\n }\n options.imageData = output;\n }\n\n /**\n * Return WebGL uniform locations for this filter's shader.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {WebGLShaderProgram} program This filter's compiled shader program.\n */\n getUniformLocations(\n gl: WebGLRenderingContext,\n program: WebGLProgram\n ): TWebGLUniformLocationMap {\n return {\n uMatrix: gl.getUniformLocation(program, 'uMatrix'),\n uOpaque: gl.getUniformLocation(program, 'uOpaque'),\n uHalfSize: gl.getUniformLocation(program, 'uHalfSize'),\n uSize: gl.getUniformLocation(program, 'uSize'),\n };\n }\n\n /**\n * Send data from this filter to its shader program's uniforms.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects\n */\n sendUniformData(\n gl: WebGLRenderingContext,\n uniformLocations: TWebGLUniformLocationMap\n ) {\n gl.uniform1fv(uniformLocations.uMatrix, this.matrix);\n }\n\n /**\n * Returns object representation of an instance\n * @return {Object} Object representation of an instance\n */\n toObject() {\n return {\n ...super.toObject(),\n opaque: this.opaque,\n matrix: [...this.matrix],\n };\n }\n}\n\nclassRegistry.setClass(Convolute);\n"],"names":["convoluteDefaultValues","opaque","matrix","Convolute","BaseFilter","getCacheKey","concat","this","type","Math","sqrt","length","getFragmentSource","fragmentSource","applyTo2d","options","imageData","data","weights","side","round","halfSide","floor","sw","width","sh","height","output","ctx","createImageData","dst","alphaFac","r","g","b","a","dstOff","scx","scy","srcOff","wt","x","y","cx","cy","getUniformLocations","gl","program","uMatrix","getUniformLocation","uOpaque","uHalfSize","uSize","sendUniformData","uniformLocations","uniform1fv","toObject","_objectSpread","super","_defineProperty","classRegistry","setClass"],"mappings":"6QAMO,MAAMA,EAA+D,CAC1EC,QAAQ,EACRC,OAAQ,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,IA2C5B,MAAMC,UAAkBC,EAe7BC,WAAAA,GACE,MAAAC,GAAAA,OAAUC,KAAKC,KAAIF,KAAAA,OAAIG,KAAKC,KAAKH,KAAKL,OAAOS,QAAO,KAAAL,OAClDC,KAAKN,OAAS,EAAI,EAEtB,CAEAW,iBAAAA,GACE,OAAOC,EAAeN,KAAKF,cAC7B,CAQAS,SAAAA,CAAUC,GACR,MAAMC,EAAYD,EAAQC,UACxBC,EAAOD,EAAUC,KACjBC,EAAUX,KAAKL,OACfiB,EAAOV,KAAKW,MAAMX,KAAKC,KAAKQ,EAAQP,SACpCU,EAAWZ,KAAKa,MAAMH,EAAO,GAC7BI,EAAKP,EAAUQ,MACfC,EAAKT,EAAUU,OACfC,EAASZ,EAAQa,IAAIC,gBAAgBN,EAAIE,GACzCK,EAAMH,EAAOV,KAEbc,EAAWxB,KAAKN,OAAS,EAAI,EAC/B,IAAI+B,EAAGC,EAAGC,EAAGC,EAAGC,EAAQC,EAAKC,EAAKC,EAAQC,EAAIC,EAAGC,EAAGC,EAAIC,EAExD,IAAKF,EAAI,EAAGA,EAAIjB,EAAIiB,IAClB,IAAKD,EAAI,EAAGA,EAAIlB,EAAIkB,IAAK,CASvB,IARAL,EAAwB,GAAdM,EAAInB,EAAKkB,GAGnBT,EAAI,EACJC,EAAI,EACJC,EAAI,EACJC,EAAI,EAECS,EAAK,EAAGA,EAAKzB,EAAMyB,IACtB,IAAKD,EAAK,EAAGA,EAAKxB,EAAMwB,IACtBL,EAAMI,EAAIE,EAAKvB,EACfgB,EAAMI,EAAIE,EAAKtB,EAGXiB,EAAM,GAAKA,GAAOb,GAAMY,EAAM,GAAKA,GAAOd,IAI9CgB,EAA4B,GAAlBD,EAAMf,EAAKc,GACrBG,EAAKtB,EAAQ0B,EAAKzB,EAAOwB,GAEzBX,GAAKf,EAAKsB,GAAUC,EACpBP,GAAKhB,EAAKsB,EAAS,GAAKC,EACxBN,GAAKjB,EAAKsB,EAAS,GAAKC,EAEnBT,IACHI,GAAKlB,EAAKsB,EAAS,GAAKC,IAI9BV,EAAIM,GAAUJ,EACdF,EAAIM,EAAS,GAAKH,EAClBH,EAAIM,EAAS,GAAKF,EAIhBJ,EAAIM,EAAS,GAHVL,EAGed,EAAKmB,EAAS,GAFdD,CAItB,CAEFpB,EAAQC,UAAYW,CACtB,CAQAkB,mBAAAA,CACEC,EACAC,GAEA,MAAO,CACLC,QAASF,EAAGG,mBAAmBF,EAAS,WACxCG,QAASJ,EAAGG,mBAAmBF,EAAS,WACxCI,UAAWL,EAAGG,mBAAmBF,EAAS,aAC1CK,MAAON,EAAGG,mBAAmBF,EAAS,SAE1C,CAQAM,eAAAA,CACEP,EACAQ,GAEAR,EAAGS,WAAWD,EAAiBN,QAASzC,KAAKL,OAC/C,CAMAsD,QAAAA,GACE,OAAAC,EAAAA,EAAA,CAAA,EACKC,MAAMF,YAAU,GAAA,CACnBvD,OAAQM,KAAKN,OACbC,OAAQ,IAAIK,KAAKL,SAErB,EA7HAyD,EANWxD,EAAS,OAWN,aAAWwD,EAXdxD,EAAS,WAaFH,GAyHpB4D,EAAcC,SAAS1D"}
1
+ {"version":3,"file":"Convolute.min.mjs","sources":["../../../src/filters/Convolute.ts"],"sourcesContent":["import { BaseFilter } from './BaseFilter';\nimport type { T2DPipelineState, TWebGLUniformLocationMap } from './typedefs';\nimport { classRegistry } from '../ClassRegistry';\nimport { fragmentSource } from './shaders/convolute';\n\nexport type ConvoluteOwnProps = {\n opaque: boolean;\n matrix: number[];\n};\n\nexport const convoluteDefaultValues: ConvoluteOwnProps = {\n opaque: false,\n matrix: [0, 0, 0, 0, 1, 0, 0, 0, 0],\n};\n\n/**\n * Adapted from <a href=\"http://www.html5rocks.com/en/tutorials/canvas/imagefilters/\">html5rocks article</a>\n * @example <caption>Sharpen filter</caption>\n * const filter = new Convolute({\n * matrix: [ 0, -1, 0,\n * -1, 5, -1,\n * 0, -1, 0 ]\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n * canvas.renderAll();\n * @example <caption>Blur filter</caption>\n * const filter = new Convolute({\n * matrix: [ 1/9, 1/9, 1/9,\n * 1/9, 1/9, 1/9,\n * 1/9, 1/9, 1/9 ]\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n * canvas.renderAll();\n * @example <caption>Emboss filter</caption>\n * const filter = new Convolute({\n * matrix: [ 1, 1, 1,\n * 1, 0.7, -1,\n * -1, -1, -1 ]\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n * canvas.renderAll();\n * @example <caption>Emboss filter with opaqueness</caption>\n * const filter = new Convolute({\n * opaque: true,\n * matrix: [ 1, 1, 1,\n * 1, 0.7, -1,\n * -1, -1, -1 ]\n * });\n * object.filters.push(filter);\n * object.applyFilters();\n * canvas.renderAll();\n */\nexport class Convolute extends BaseFilter<'Convolute', ConvoluteOwnProps> {\n /*\n * Opaque value (true/false)\n */\n declare opaque: ConvoluteOwnProps['opaque'];\n\n /*\n * matrix for the filter, max 9x9\n */\n declare matrix: ConvoluteOwnProps['matrix'];\n\n static type = 'Convolute';\n\n static defaults = convoluteDefaultValues;\n\n static uniformLocations = ['uMatrix', 'uOpaque', 'uHalfSize', 'uSize'];\n\n getCacheKey() {\n return `${this.type}_${Math.sqrt(this.matrix.length)}_${\n this.opaque ? 1 : 0\n }` as keyof typeof fragmentSource;\n }\n\n getFragmentSource() {\n return fragmentSource[this.getCacheKey()];\n }\n\n /**\n * Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image.\n *\n * @param {Object} options\n * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered.\n */\n applyTo2d(options: T2DPipelineState) {\n const imageData = options.imageData,\n data = imageData.data,\n weights = this.matrix,\n side = Math.round(Math.sqrt(weights.length)),\n halfSide = Math.floor(side / 2),\n sw = imageData.width,\n sh = imageData.height,\n output = options.ctx.createImageData(sw, sh),\n dst = output.data,\n // go through the destination image pixels\n alphaFac = this.opaque ? 1 : 0;\n let r, g, b, a, dstOff, scx, scy, srcOff, wt, x, y, cx, cy;\n\n for (y = 0; y < sh; y++) {\n for (x = 0; x < sw; x++) {\n dstOff = (y * sw + x) * 4;\n // calculate the weighed sum of the source image pixels that\n // fall under the convolution matrix\n r = 0;\n g = 0;\n b = 0;\n a = 0;\n\n for (cy = 0; cy < side; cy++) {\n for (cx = 0; cx < side; cx++) {\n scy = y + cy - halfSide;\n scx = x + cx - halfSide;\n\n // eslint-disable-next-line max-depth\n if (scy < 0 || scy >= sh || scx < 0 || scx >= sw) {\n continue;\n }\n\n srcOff = (scy * sw + scx) * 4;\n wt = weights[cy * side + cx];\n\n r += data[srcOff] * wt;\n g += data[srcOff + 1] * wt;\n b += data[srcOff + 2] * wt;\n // eslint-disable-next-line max-depth\n if (!alphaFac) {\n a += data[srcOff + 3] * wt;\n }\n }\n }\n dst[dstOff] = r;\n dst[dstOff + 1] = g;\n dst[dstOff + 2] = b;\n if (!alphaFac) {\n dst[dstOff + 3] = a;\n } else {\n dst[dstOff + 3] = data[dstOff + 3];\n }\n }\n }\n options.imageData = output;\n }\n\n /**\n * Send data from this filter to its shader program's uniforms.\n *\n * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.\n * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects\n */\n sendUniformData(\n gl: WebGLRenderingContext,\n uniformLocations: TWebGLUniformLocationMap\n ) {\n gl.uniform1fv(uniformLocations.uMatrix, this.matrix);\n }\n\n /**\n * Returns object representation of an instance\n * @return {Object} Object representation of an instance\n */\n toObject() {\n return {\n ...super.toObject(),\n opaque: this.opaque,\n matrix: [...this.matrix],\n };\n }\n}\n\nclassRegistry.setClass(Convolute);\n"],"names":["convoluteDefaultValues","opaque","matrix","Convolute","BaseFilter","getCacheKey","concat","this","type","Math","sqrt","length","getFragmentSource","fragmentSource","applyTo2d","options","imageData","data","weights","side","round","halfSide","floor","sw","width","sh","height","output","ctx","createImageData","dst","alphaFac","r","g","b","a","dstOff","scx","scy","srcOff","wt","x","y","cx","cy","sendUniformData","gl","uniformLocations","uniform1fv","uMatrix","toObject","_objectSpread","super","_defineProperty","classRegistry","setClass"],"mappings":"6QAUO,MAAMA,EAA4C,CACvDC,QAAQ,EACRC,OAAQ,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,IA2C5B,MAAMC,UAAkBC,EAiB7BC,WAAAA,GACE,MAAAC,GAAAA,OAAUC,KAAKC,KAAIF,KAAAA,OAAIG,KAAKC,KAAKH,KAAKL,OAAOS,QAAO,KAAAL,OAClDC,KAAKN,OAAS,EAAI,EAEtB,CAEAW,iBAAAA,GACE,OAAOC,EAAeN,KAAKF,cAC7B,CAQAS,SAAAA,CAAUC,GACR,MAAMC,EAAYD,EAAQC,UACxBC,EAAOD,EAAUC,KACjBC,EAAUX,KAAKL,OACfiB,EAAOV,KAAKW,MAAMX,KAAKC,KAAKQ,EAAQP,SACpCU,EAAWZ,KAAKa,MAAMH,EAAO,GAC7BI,EAAKP,EAAUQ,MACfC,EAAKT,EAAUU,OACfC,EAASZ,EAAQa,IAAIC,gBAAgBN,EAAIE,GACzCK,EAAMH,EAAOV,KAEbc,EAAWxB,KAAKN,OAAS,EAAI,EAC/B,IAAI+B,EAAGC,EAAGC,EAAGC,EAAGC,EAAQC,EAAKC,EAAKC,EAAQC,EAAIC,EAAGC,EAAGC,EAAIC,EAExD,IAAKF,EAAI,EAAGA,EAAIjB,EAAIiB,IAClB,IAAKD,EAAI,EAAGA,EAAIlB,EAAIkB,IAAK,CASvB,IARAL,EAAwB,GAAdM,EAAInB,EAAKkB,GAGnBT,EAAI,EACJC,EAAI,EACJC,EAAI,EACJC,EAAI,EAECS,EAAK,EAAGA,EAAKzB,EAAMyB,IACtB,IAAKD,EAAK,EAAGA,EAAKxB,EAAMwB,IACtBL,EAAMI,EAAIE,EAAKvB,EACfgB,EAAMI,EAAIE,EAAKtB,EAGXiB,EAAM,GAAKA,GAAOb,GAAMY,EAAM,GAAKA,GAAOd,IAI9CgB,EAA4B,GAAlBD,EAAMf,EAAKc,GACrBG,EAAKtB,EAAQ0B,EAAKzB,EAAOwB,GAEzBX,GAAKf,EAAKsB,GAAUC,EACpBP,GAAKhB,EAAKsB,EAAS,GAAKC,EACxBN,GAAKjB,EAAKsB,EAAS,GAAKC,EAEnBT,IACHI,GAAKlB,EAAKsB,EAAS,GAAKC,IAI9BV,EAAIM,GAAUJ,EACdF,EAAIM,EAAS,GAAKH,EAClBH,EAAIM,EAAS,GAAKF,EAIhBJ,EAAIM,EAAS,GAHVL,EAGed,EAAKmB,EAAS,GAFdD,CAItB,CAEFpB,EAAQC,UAAYW,CACtB,CAQAkB,eAAAA,CACEC,EACAC,GAEAD,EAAGE,WAAWD,EAAiBE,QAAS1C,KAAKL,OAC/C,CAMAgD,QAAAA,GACE,OAAAC,EAAAA,EAAA,CAAA,EACKC,MAAMF,YAAU,GAAA,CACnBjD,OAAQM,KAAKN,OACbC,OAAQ,IAAIK,KAAKL,SAErB,EA7GAmD,EANWlD,EAAS,OAWN,aAAWkD,EAXdlD,EAAS,WAaFH,GAAsBqD,EAb7BlD,EAAS,mBAeM,CAAC,UAAW,UAAW,YAAa,UAuGhEmD,EAAcC,SAASpD"}
@@ -117,21 +117,6 @@ class Convolute extends BaseFilter {
117
117
  options.imageData = output;
118
118
  }
119
119
 
120
- /**
121
- * Return WebGL uniform locations for this filter's shader.
122
- *
123
- * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.
124
- * @param {WebGLShaderProgram} program This filter's compiled shader program.
125
- */
126
- getUniformLocations(gl, program) {
127
- return {
128
- uMatrix: gl.getUniformLocation(program, 'uMatrix'),
129
- uOpaque: gl.getUniformLocation(program, 'uOpaque'),
130
- uHalfSize: gl.getUniformLocation(program, 'uHalfSize'),
131
- uSize: gl.getUniformLocation(program, 'uSize')
132
- };
133
- }
134
-
135
120
  /**
136
121
  * Send data from this filter to its shader program's uniforms.
137
122
  *
@@ -161,6 +146,7 @@ class Convolute extends BaseFilter {
161
146
  */
162
147
  _defineProperty(Convolute, "type", 'Convolute');
163
148
  _defineProperty(Convolute, "defaults", convoluteDefaultValues);
149
+ _defineProperty(Convolute, "uniformLocations", ['uMatrix', 'uOpaque', 'uHalfSize', 'uSize']);
164
150
  classRegistry.setClass(Convolute);
165
151
 
166
152
  export { Convolute, convoluteDefaultValues };