@deslop/workbench 0.0.360 → 0.0.381

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 (157) hide show
  1. package/dist/anthropic-C02QVQ9u.mjs +6313 -0
  2. package/dist/azure-openai-responses-CUFLNwdy.mjs +207 -0
  3. package/dist/client/assets/{(home)-DVKAaI4b.js → (home)-BL3S5BVq.js} +1 -1
  4. package/dist/client/assets/-workbench-terminal-YB9hQXjr.js +145 -0
  5. package/dist/client/assets/agent-BmwIVlVZ.js +1 -0
  6. package/dist/client/assets/agent-CE67X_hb.js +2 -0
  7. package/dist/client/assets/{arc-CuHXSNPr.js → arc-BjSQqbzd.js} +1 -1
  8. package/dist/client/assets/architectureDiagram-3BPJPVTR-CTWT1AFv.js +36 -0
  9. package/dist/client/assets/{blockDiagram-GPEHLZMM-D3jiL-uN.js → blockDiagram-GPEHLZMM-CISQUfO9.js} +1 -1
  10. package/dist/client/assets/{c4Diagram-AAUBKEIU-bA47L7u8.js → c4Diagram-AAUBKEIU-Ct3OGD9a.js} +1 -1
  11. package/dist/client/assets/channel-S3CdaK6m.js +1 -0
  12. package/dist/client/assets/{chunk-2J33WTMH-optplvap.js → chunk-2J33WTMH-BUMgKaV6.js} +1 -1
  13. package/dist/client/assets/{chunk-3OPIFGDE-k7mTnOn5.js → chunk-3OPIFGDE-BlIdNnu8.js} +1 -1
  14. package/dist/client/assets/{chunk-4BX2VUAB-Co5qfYem.js → chunk-4BX2VUAB-CiBu5cRv.js} +1 -1
  15. package/dist/client/assets/{chunk-55IACEB6-7AWIUH7L.js → chunk-55IACEB6-nU8KvKB3.js} +1 -1
  16. package/dist/client/assets/{chunk-5ZQYHXKU-Bub4jU0C.js → chunk-5ZQYHXKU-DbN9DSns.js} +1 -1
  17. package/dist/client/assets/{chunk-727SXJPM-DcofuxtV.js → chunk-727SXJPM-DkPu5ecB.js} +2 -2
  18. package/dist/client/assets/{chunk-AQP2D5EJ-CBwGmuY5.js → chunk-AQP2D5EJ-B8lrSg7a.js} +1 -1
  19. package/dist/client/assets/{chunk-BSJP7CBP-BInTsaMb.js → chunk-BSJP7CBP-C450xCVa.js} +1 -1
  20. package/dist/client/assets/{chunk-CSCIHK7Q-BTHSw3Fl.js → chunk-CSCIHK7Q-DoGVP1BZ.js} +2 -2
  21. package/dist/client/assets/{chunk-FMBD7UC4-BQD4ioRx.js → chunk-FMBD7UC4-cqorOok8.js} +1 -1
  22. package/dist/client/assets/{chunk-KSCS5N6A-CUDSaUx0.js → chunk-KSCS5N6A-dbmnxO_p.js} +1 -1
  23. package/dist/client/assets/{chunk-L5ZTLDWV-D0-tvK0S.js → chunk-L5ZTLDWV-D9P-YjsA.js} +1 -1
  24. package/dist/client/assets/{chunk-LZXEDZCA-BkJ5xlLM.js → chunk-LZXEDZCA-BdVT_AWc.js} +2 -2
  25. package/dist/client/assets/{chunk-ND2GUHAM-COdW9HuZ.js → chunk-ND2GUHAM-CmHIi1wD.js} +1 -1
  26. package/dist/client/assets/{chunk-NZK2D7GU-Byrnkfto.js → chunk-NZK2D7GU-hkTOm2qR.js} +1 -1
  27. package/dist/client/assets/{chunk-O5CBEL6O-C_CProRX.js → chunk-O5CBEL6O-D1fDxsSH.js} +1 -1
  28. package/dist/client/assets/chunk-QZHKN3VN-BS_CF_l3.js +1 -0
  29. package/dist/client/assets/chunk-WU5MYG2G-CtG2KJlt.js +1 -0
  30. package/dist/client/assets/{chunk-XPW4576I-DWr3727k.js → chunk-XPW4576I-BjBK3ctW.js} +2 -2
  31. package/dist/client/assets/classDiagram-4FO5ZUOK-BdTSUdNF.js +1 -0
  32. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BdTSUdNF.js +1 -0
  33. package/dist/client/assets/compiler-runtime-CLAvuQ-D.js +1 -0
  34. package/dist/client/assets/cose-bilkent-S5V4N54A-BGt2II16.js +1 -0
  35. package/dist/client/assets/{cytoscape.esm-FqbQrHcz.js → cytoscape.esm-Kic9WIU3.js} +2 -2
  36. package/dist/client/assets/{dagre-BM42HDAG-Bwiv8kFL.js → dagre-BM42HDAG-CN7Tha00.js} +1 -1
  37. package/dist/client/assets/{diagram-2AECGRRQ-BY9KXQPi.js → diagram-2AECGRRQ-DnobmroZ.js} +1 -1
  38. package/dist/client/assets/{diagram-5GNKFQAL-C-jmG8LL.js → diagram-5GNKFQAL-D6NqAeoi.js} +1 -1
  39. package/dist/client/assets/{diagram-KO2AKTUF-qDHWGr5P.js → diagram-KO2AKTUF-y8QX4vEL.js} +1 -1
  40. package/dist/client/assets/{diagram-LMA3HP47-Dg8zuIuL.js → diagram-LMA3HP47-DAEPoAHp.js} +1 -1
  41. package/dist/client/assets/{diagram-OG6HWLK6-DupmLmKo.js → diagram-OG6HWLK6-B3KiYvxM.js} +1 -1
  42. package/dist/client/assets/dialog-B0kBnYwI.js +153 -0
  43. package/dist/client/assets/diff-BP9B4x7R.js +2 -0
  44. package/dist/client/assets/diff-OmMK6IL0.js +221 -0
  45. package/dist/client/assets/dist-D9sYb5Oa.js +1 -0
  46. package/dist/client/assets/{erDiagram-TEJ5UH35-DcYoMsDA.js → erDiagram-TEJ5UH35-CbzdEpkS.js} +1 -1
  47. package/dist/client/assets/external-link-D7Q28KpR.js +1 -0
  48. package/dist/client/assets/fallbacks-DwGmG_0c.js +16 -0
  49. package/dist/client/assets/{flowDiagram-I6XJVG4X-xLfWiyaL.js → flowDiagram-I6XJVG4X-C2H7PQev.js} +1 -1
  50. package/dist/client/assets/ganttDiagram-6RSMTGT7-BZql2QFP.js +292 -0
  51. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-DE7nmb1q.js → gitGraphDiagram-PVQCEYII-d2_5HIIo.js} +1 -1
  52. package/dist/client/assets/{index-D1icept3.js → index-Cc-cDoXa.js} +4 -4
  53. package/dist/client/assets/index-DT_QSnKQ.css +2 -0
  54. package/dist/client/assets/{infoDiagram-5YYISTIA-CUzdfhph.js → infoDiagram-5YYISTIA-DaDFMb3D.js} +1 -1
  55. package/dist/client/assets/input-CEh4Uy0l.js +1 -0
  56. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-D3h5fT3O.js → ishikawaDiagram-YF4QCWOH-7tWPtPSR.js} +1 -1
  57. package/dist/client/assets/{journeyDiagram-JHISSGLW-DXqP7IZk.js → journeyDiagram-JHISSGLW-CYDeiigr.js} +1 -1
  58. package/dist/client/assets/{kanban-definition-UN3LZRKU-BBdz3OGi.js → kanban-definition-UN3LZRKU-BFoF4JfY.js} +3 -3
  59. package/dist/client/assets/{katex-Vhh-h91d.js → katex-CddkPoXu.js} +1 -1
  60. package/dist/client/assets/{line-D2nnU070.js → line-CcJ0IOWh.js} +1 -1
  61. package/dist/client/assets/{linear-BifnMVyn.js → linear-Ct8JHF0c.js} +1 -1
  62. package/dist/client/assets/mermaid-parser.core-CKHoAf1J.js +2 -2
  63. package/dist/client/assets/{mindmap-definition-RKZ34NQL-BAbACAeS.js → mindmap-definition-RKZ34NQL-DTgZ_Z5F.js} +1 -1
  64. package/dist/client/assets/{pieDiagram-4H26LBE5-YjWBEaV3.js → pieDiagram-4H26LBE5-BmpbjVUG.js} +1 -1
  65. package/dist/client/assets/pierre-dark-vibrant-D4RhcSIK.js +1 -0
  66. package/dist/client/assets/pierre-light-vibrant-B76X7i5Y.js +1 -0
  67. package/dist/client/assets/portless-4_iTgOr5.js +1 -0
  68. package/dist/client/assets/portless-qyhmpSUj.js +2 -0
  69. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-0qpR8bhI.js → quadrantDiagram-W4KKPZXB-BncnX7WL.js} +1 -1
  70. package/dist/client/assets/{requirementDiagram-4Y6WPE33-UxrH60_h.js → requirementDiagram-4Y6WPE33-C4viwYDb.js} +1 -1
  71. package/dist/client/assets/resizable-A9BpOcmt.js +1 -0
  72. package/dist/client/assets/route-Da0uHKH9.js +45 -0
  73. package/dist/client/assets/route-ULg8h9n0.js +2 -0
  74. package/dist/client/assets/run-CCCofwDU.js +2 -0
  75. package/dist/client/assets/run-D7w-8aQA.js +1 -0
  76. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-CtfCq9EV.js → sankeyDiagram-5OEKKPKP-cs1kWOqp.js} +1 -1
  77. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-BgLwmDnV.js → sequenceDiagram-3UESZ5HK-D7Bj1Dg6.js} +1 -1
  78. package/dist/client/assets/sonner-DgKrvTU1.js +1 -0
  79. package/dist/client/assets/src-DzxfdEt6.js +1 -0
  80. package/dist/client/assets/state-_2CmL5IM.js +2 -0
  81. package/dist/client/assets/{stateDiagram-AJRCARHV--lvnWH2s.js → stateDiagram-AJRCARHV-xBL-crbl.js} +1 -1
  82. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-ZbAyaVmU.js +1 -0
  83. package/dist/client/assets/terminal-DJ8tjXNh.js +1 -0
  84. package/dist/client/assets/terminal-Dx10AUUW.js +2 -0
  85. package/dist/client/assets/{timeline-definition-PNZ67QCA-BbIMEZmJ.js → timeline-definition-PNZ67QCA-Bs3JkoMQ.js} +2 -2
  86. package/dist/client/assets/triangle-alert-cDPYgb7f.js +1 -0
  87. package/dist/client/assets/{vennDiagram-CIIHVFJN-ClrNZ6mc.js → vennDiagram-CIIHVFJN-D25dPloy.js} +1 -1
  88. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-B104yVOC.js → wardleyDiagram-YWT4CUSO-B7X6xZZ7.js} +1 -1
  89. package/dist/client/assets/{xychartDiagram-2RQKCTM6-BBRSu-ZO.js → xychartDiagram-2RQKCTM6-Cgc-2R8L.js} +1 -1
  90. package/dist/client/index.html +13 -14
  91. package/dist/completionchunk-DDfxP5hO.mjs +5196 -0
  92. package/dist/dist-CsBDFjO2.mjs +1163 -0
  93. package/dist/{execAsync-BeHTdVKh.mjs → execAsync-B-b5b4hb.mjs} +2 -2
  94. package/dist/from-DGwFTZmN.mjs +3845 -0
  95. package/dist/{getMachineId-bsd-8V0SSHI2.mjs → getMachineId-bsd-C-aUDBo5.mjs} +4 -3
  96. package/dist/{getMachineId-darwin-fwMRmXNE.mjs → getMachineId-darwin-CQg0u9gI.mjs} +4 -3
  97. package/dist/{getMachineId-linux-BglPdw6k.mjs → getMachineId-linux-DQmpbzHz.mjs} +3 -2
  98. package/dist/{getMachineId-unsupported-B6r8oWEG.mjs → getMachineId-unsupported-BT4Te_jg.mjs} +3 -2
  99. package/dist/{getMachineId-win-Bvbq3C3K.mjs → getMachineId-win-zoUdci1a.mjs} +4 -3
  100. package/dist/github-copilot-headers-B--aVYl2.mjs +39 -0
  101. package/dist/google-DHtiCcEt.mjs +348 -0
  102. package/dist/google-shared-BT0mQb3v.mjs +25358 -0
  103. package/dist/google-vertex-CRkz0MgQ.mjs +391 -0
  104. package/dist/hash-CDrrQIkY.mjs +17 -0
  105. package/dist/headers-m19bM8_9.mjs +9 -0
  106. package/dist/mistral-DXtHhhUc.mjs +36806 -0
  107. package/dist/multipart-parser-6y-zJbR0.mjs +295 -0
  108. package/dist/openai-CUH8rb7p.mjs +6671 -0
  109. package/dist/openai-codex-responses-BSLixEC8.mjs +1081 -0
  110. package/dist/openai-completions-CE-LDmL4.mjs +735 -0
  111. package/dist/openai-prompt-cache-6hf3xB_x.mjs +9 -0
  112. package/dist/openai-responses-41QiypX_.mjs +217 -0
  113. package/dist/openai-responses-shared-BAoGGIxP.mjs +415 -0
  114. package/dist/openrouter-CDq1vETJ.mjs +125 -0
  115. package/dist/otel-ugdFQeJO.mjs +23177 -0
  116. package/dist/photon_rs-D6BNoOSO.mjs +4253 -0
  117. package/dist/rolldown-runtime-EQORzF3F.mjs +38 -0
  118. package/dist/sanitize-unicode-CPcy0g31.mjs +27 -0
  119. package/dist/server.js +247457 -56643
  120. package/dist/src-BHoXDvRK.mjs +1178 -0
  121. package/dist/transform-messages-CUKh2_5w.mjs +188 -0
  122. package/package.json +4 -3
  123. package/dist/client/assets/-workbench-terminal-CoufoT41.js +0 -145
  124. package/dist/client/assets/agent-B0AsYIb3.js +0 -2
  125. package/dist/client/assets/agent-DCVbbaGs.js +0 -1
  126. package/dist/client/assets/architectureDiagram-3BPJPVTR-hs4IN-ZW.js +0 -36
  127. package/dist/client/assets/button-Dz6Az3h_.js +0 -16
  128. package/dist/client/assets/channel-CHiC1IgU.js +0 -1
  129. package/dist/client/assets/chunk-QZHKN3VN-SFi3gsXX.js +0 -1
  130. package/dist/client/assets/chunk-WU5MYG2G-OzrGGim9.js +0 -1
  131. package/dist/client/assets/classDiagram-4FO5ZUOK-DvZGz7Ek.js +0 -1
  132. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DvZGz7Ek.js +0 -1
  133. package/dist/client/assets/compiler-runtime-rGeCHUuX.js +0 -1
  134. package/dist/client/assets/cose-bilkent-S5V4N54A-BzitJXTQ.js +0 -1
  135. package/dist/client/assets/diff-BqnMP7Ys.js +0 -217
  136. package/dist/client/assets/diff-CLnQZZVT.js +0 -2
  137. package/dist/client/assets/dist-lRkD-JPF.js +0 -1
  138. package/dist/client/assets/external-link-DPI4TAq4.js +0 -1
  139. package/dist/client/assets/fallbacks-uU4M5NOw.js +0 -1
  140. package/dist/client/assets/ganttDiagram-6RSMTGT7-hA3inn7u.js +0 -292
  141. package/dist/client/assets/index-DNWcrdqu.css +0 -2
  142. package/dist/client/assets/input-group-1-P7Y_75.js +0 -153
  143. package/dist/client/assets/loader-circle-BxillczB.js +0 -1
  144. package/dist/client/assets/portless-ClPWjTC4.js +0 -1
  145. package/dist/client/assets/portless-QJD7ZmA9.js +0 -2
  146. package/dist/client/assets/resizable-BaJ5ba6-.js +0 -1
  147. package/dist/client/assets/route-C-L2dkin.js +0 -45
  148. package/dist/client/assets/route-b5JXfzPO.js +0 -2
  149. package/dist/client/assets/run-C7DiKMnt.js +0 -1
  150. package/dist/client/assets/run-Dt91HvlA.js +0 -2
  151. package/dist/client/assets/src-oaGqIoNi.js +0 -1
  152. package/dist/client/assets/state-CVjPP5QG.js +0 -2
  153. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BggoNPhO.js +0 -1
  154. package/dist/client/assets/terminal-C4sv4xT5.js +0 -2
  155. package/dist/client/assets/terminal-kxE_eoTZ.js +0 -1
  156. package/dist/client/assets/triangle-alert-CTEZG9zF.js +0 -1
  157. /package/dist/client/assets/{chunk-QTnfLwEv.js → rolldown-runtime-QTnfLwEv.js} +0 -0
@@ -0,0 +1,4253 @@
1
+ #!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
2
+ import { i as __require, t as __commonJSMin } from "./rolldown-runtime-EQORzF3F.mjs";
3
+ //#region ../../node_modules/.pnpm/@silvia-odwyer+photon-node@0.3.4/node_modules/@silvia-odwyer/photon-node/photon_rs.js
4
+ var require_photon_rs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ let imports = {};
6
+ imports["__wbindgen_placeholder__"] = module.exports;
7
+ let wasm;
8
+ const { TextEncoder, TextDecoder } = __require("util");
9
+ function debugString(val) {
10
+ const type = typeof val;
11
+ if (type == "number" || type == "boolean" || val == null) return `${val}`;
12
+ if (type == "string") return `"${val}"`;
13
+ if (type == "symbol") {
14
+ const description = val.description;
15
+ if (description == null) return "Symbol";
16
+ else return `Symbol(${description})`;
17
+ }
18
+ if (type == "function") {
19
+ const name = val.name;
20
+ if (typeof name == "string" && name.length > 0) return `Function(${name})`;
21
+ else return "Function";
22
+ }
23
+ if (Array.isArray(val)) {
24
+ const length = val.length;
25
+ let debug = "[";
26
+ if (length > 0) debug += debugString(val[0]);
27
+ for (let i = 1; i < length; i++) debug += ", " + debugString(val[i]);
28
+ debug += "]";
29
+ return debug;
30
+ }
31
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
32
+ let className;
33
+ if (builtInMatches.length > 1) className = builtInMatches[1];
34
+ else return toString.call(val);
35
+ if (className == "Object") try {
36
+ return "Object(" + JSON.stringify(val) + ")";
37
+ } catch (_) {
38
+ return "Object";
39
+ }
40
+ if (val instanceof Error) return `${val.name}: ${val.message}\n${val.stack}`;
41
+ return className;
42
+ }
43
+ let WASM_VECTOR_LEN = 0;
44
+ let cachedUint8ArrayMemory0 = null;
45
+ function getUint8ArrayMemory0() {
46
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
47
+ return cachedUint8ArrayMemory0;
48
+ }
49
+ let cachedTextEncoder = new TextEncoder("utf-8");
50
+ const encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
51
+ return cachedTextEncoder.encodeInto(arg, view);
52
+ } : function(arg, view) {
53
+ const buf = cachedTextEncoder.encode(arg);
54
+ view.set(buf);
55
+ return {
56
+ read: arg.length,
57
+ written: buf.length
58
+ };
59
+ };
60
+ function passStringToWasm0(arg, malloc, realloc) {
61
+ if (realloc === void 0) {
62
+ const buf = cachedTextEncoder.encode(arg);
63
+ const ptr = malloc(buf.length, 1) >>> 0;
64
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
65
+ WASM_VECTOR_LEN = buf.length;
66
+ return ptr;
67
+ }
68
+ let len = arg.length;
69
+ let ptr = malloc(len, 1) >>> 0;
70
+ const mem = getUint8ArrayMemory0();
71
+ let offset = 0;
72
+ for (; offset < len; offset++) {
73
+ const code = arg.charCodeAt(offset);
74
+ if (code > 127) break;
75
+ mem[ptr + offset] = code;
76
+ }
77
+ if (offset !== len) {
78
+ if (offset !== 0) arg = arg.slice(offset);
79
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
80
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
81
+ const ret = encodeString(arg, view);
82
+ offset += ret.written;
83
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
84
+ }
85
+ WASM_VECTOR_LEN = offset;
86
+ return ptr;
87
+ }
88
+ let cachedDataViewMemory0 = null;
89
+ function getDataViewMemory0() {
90
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
91
+ return cachedDataViewMemory0;
92
+ }
93
+ let cachedTextDecoder = new TextDecoder("utf-8", {
94
+ ignoreBOM: true,
95
+ fatal: true
96
+ });
97
+ cachedTextDecoder.decode();
98
+ function getStringFromWasm0(ptr, len) {
99
+ ptr = ptr >>> 0;
100
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
101
+ }
102
+ function _assertClass(instance, klass) {
103
+ if (!(instance instanceof klass)) throw new Error(`expected instance of ${klass.name}`);
104
+ return instance.ptr;
105
+ }
106
+ /**
107
+ * Alter a select channel by incrementing or decrementing its value by a constant.
108
+ *
109
+ * # Arguments
110
+ * * `img` - A PhotonImage.
111
+ * * `channel` - The channel you wish to alter, it should be either 0, 1 or 2,
112
+ * representing R, G, or B respectively. (O=Red, 1=Green, 2=Blue)
113
+ * * `amount` - The amount to increment/decrement the channel's value by for that pixel.
114
+ * A positive value will increment/decrement the channel's value, a negative value will decrement the channel's value.
115
+ *
116
+ * ## Example
117
+ *
118
+ * ```no_run
119
+ * // For example, to increase the Red channel for all pixels by 10:
120
+ * use photon_rs::channels::alter_channel;
121
+ * use photon_rs::native::{open_image};
122
+ *
123
+ * let mut img = open_image("img.jpg").expect("File should open");
124
+ * alter_channel(&mut img, 0_usize, 10_i16);
125
+ * ```
126
+ *
127
+ * Adds a constant to a select R, G, or B channel's value.
128
+ *
129
+ * ### Decrease a channel's value
130
+ * // For example, to decrease the Green channel for all pixels by 20:
131
+ * ```no_run
132
+ * use photon_rs::channels::alter_channel;
133
+ * use photon_rs::native::open_image;
134
+ *
135
+ * let mut img = open_image("img.jpg").expect("File should open");
136
+ * alter_channel(&mut img, 1_usize, -20_i16);
137
+ * ```
138
+ * **Note**: Note the use of a minus symbol when decreasing the channel.
139
+ * @param {PhotonImage} img
140
+ * @param {number} channel
141
+ * @param {number} amt
142
+ */
143
+ module.exports.alter_channel = function(img, channel, amt) {
144
+ _assertClass(img, PhotonImage);
145
+ wasm.alter_channel(img.__wbg_ptr, channel, amt);
146
+ };
147
+ /**
148
+ * Increment or decrement every pixel's Red channel by a constant.
149
+ *
150
+ * # Arguments
151
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
152
+ * * `amt` - The amount to increment or decrement the channel's value by for that pixel.
153
+ *
154
+ * # Example
155
+ *
156
+ * ```no_run
157
+ * // For example, to increase the Red channel for all pixels by 10:
158
+ * use photon_rs::channels::alter_red_channel;
159
+ * use photon_rs::native::open_image;
160
+ *
161
+ * let mut img = open_image("img.jpg").expect("File should open");
162
+ * alter_red_channel(&mut img, 10_i16);
163
+ * ```
164
+ * @param {PhotonImage} photon_image
165
+ * @param {number} amt
166
+ */
167
+ module.exports.alter_red_channel = function(photon_image, amt) {
168
+ _assertClass(photon_image, PhotonImage);
169
+ wasm.alter_red_channel(photon_image.__wbg_ptr, amt);
170
+ };
171
+ /**
172
+ * Increment or decrement every pixel's Green channel by a constant.
173
+ *
174
+ * # Arguments
175
+ * * `img` - A PhotonImage.
176
+ * * `amt` - The amount to increment/decrement the channel's value by for that pixel.
177
+ *
178
+ * # Example
179
+ *
180
+ * ```no_run
181
+ * // For example, to increase the Green channel for all pixels by 20:
182
+ * use photon_rs::channels::alter_green_channel;
183
+ * use photon_rs::native::open_image;
184
+ *
185
+ * let mut img = open_image("img.jpg").expect("File should open");
186
+ * alter_green_channel(&mut img, 20_i16);
187
+ * ```
188
+ * @param {PhotonImage} img
189
+ * @param {number} amt
190
+ */
191
+ module.exports.alter_green_channel = function(img, amt) {
192
+ _assertClass(img, PhotonImage);
193
+ wasm.alter_green_channel(img.__wbg_ptr, amt);
194
+ };
195
+ /**
196
+ * Increment or decrement every pixel's Blue channel by a constant.
197
+ *
198
+ * # Arguments
199
+ * * `img` - A PhotonImage.
200
+ * * `amt` - The amount to increment or decrement the channel's value by for that pixel.
201
+ *
202
+ * # Example
203
+ *
204
+ * ```no_run
205
+ * // For example, to increase the Blue channel for all pixels by 10:
206
+ * use photon_rs::channels::alter_blue_channel;
207
+ * use photon_rs::native::open_image;
208
+ *
209
+ * let mut img = open_image("img.jpg").expect("File should open");
210
+ * alter_blue_channel(&mut img, 10_i16);
211
+ * ```
212
+ * @param {PhotonImage} img
213
+ * @param {number} amt
214
+ */
215
+ module.exports.alter_blue_channel = function(img, amt) {
216
+ _assertClass(img, PhotonImage);
217
+ wasm.alter_blue_channel(img.__wbg_ptr, amt);
218
+ };
219
+ /**
220
+ * Increment/decrement two channels' values simultaneously by adding an amt to each channel per pixel.
221
+ *
222
+ * # Arguments
223
+ * * `img` - A PhotonImage.
224
+ * * `channel1` - A usize from 0 to 2 that represents either the R, G or B channels.
225
+ * * `amt1` - The amount to increment/decrement the channel's value by for that pixel.
226
+ * * `channel2` -A usize from 0 to 2 that represents either the R, G or B channels.
227
+ * * `amt2` - The amount to increment/decrement the channel's value by for that pixel.
228
+ *
229
+ * # Example
230
+ *
231
+ * ```no_run
232
+ * // For example, to increase the values of the Red and Blue channels per pixel:
233
+ * use photon_rs::channels::alter_two_channels;
234
+ * use photon_rs::native::open_image;
235
+ *
236
+ * let mut img = open_image("img.jpg").expect("File should open");
237
+ * alter_two_channels(&mut img, 0_usize, 10_i16, 2_usize, 20_i16);
238
+ * ```
239
+ * @param {PhotonImage} img
240
+ * @param {number} channel1
241
+ * @param {number} amt1
242
+ * @param {number} channel2
243
+ * @param {number} amt2
244
+ */
245
+ module.exports.alter_two_channels = function(img, channel1, amt1, channel2, amt2) {
246
+ _assertClass(img, PhotonImage);
247
+ wasm.alter_two_channels(img.__wbg_ptr, channel1, amt1, channel2, amt2);
248
+ };
249
+ /**
250
+ * Increment all 3 channels' values by adding an amt to each channel per pixel.
251
+ *
252
+ * # Arguments
253
+ * * `img` - A PhotonImage.
254
+ * * `r_amt` - The amount to increment/decrement the Red channel by.
255
+ * * `g_amt` - The amount to increment/decrement the Green channel by.
256
+ * * `b_amt` - The amount to increment/decrement the Blue channel by.
257
+ *
258
+ * # Example
259
+ *
260
+ * ```no_run
261
+ * // For example, to increase the values of the Red channel by 10, the Green channel by 20,
262
+ * // and the Blue channel by 50:
263
+ * use photon_rs::channels::alter_channels;
264
+ * use photon_rs::native::open_image;
265
+ *
266
+ * let mut img = open_image("img.jpg").expect("File should open");
267
+ * alter_channels(&mut img, 10_i16, 20_i16, 50_i16);
268
+ * ```
269
+ * @param {PhotonImage} img
270
+ * @param {number} r_amt
271
+ * @param {number} g_amt
272
+ * @param {number} b_amt
273
+ */
274
+ module.exports.alter_channels = function(img, r_amt, g_amt, b_amt) {
275
+ _assertClass(img, PhotonImage);
276
+ wasm.alter_channels(img.__wbg_ptr, r_amt, g_amt, b_amt);
277
+ };
278
+ /**
279
+ * Set a certain channel to zero, thus removing the channel's influence in the pixels' final rendered colour.
280
+ *
281
+ * # Arguments
282
+ * * `img` - A PhotonImage.
283
+ * * `channel` - The channel to be removed; must be a usize from 0 to 2, with 0 representing Red, 1 representing Green, and 2 representing Blue.
284
+ * * `min_filter` - Minimum filter. Value between 0 and 255. Only remove the channel if the current pixel's channel value is less than this minimum filter. To completely
285
+ * remove the channel, set this value to 255, to leave the channel as is, set to 0, and to set a channel to zero for a pixel whose red value is greater than 50,
286
+ * then channel would be 0 and min_filter would be 50.
287
+ *
288
+ * # Example
289
+ *
290
+ * ```no_run
291
+ * // For example, to remove the Red channel with a min_filter of 100:
292
+ * use photon_rs::channels::remove_channel;
293
+ * use photon_rs::native::open_image;
294
+ *
295
+ * let mut img = open_image("img.jpg").expect("File should open");
296
+ * remove_channel(&mut img, 0_usize, 100_u8);
297
+ * ```
298
+ * @param {PhotonImage} img
299
+ * @param {number} channel
300
+ * @param {number} min_filter
301
+ */
302
+ module.exports.remove_channel = function(img, channel, min_filter) {
303
+ _assertClass(img, PhotonImage);
304
+ wasm.remove_channel(img.__wbg_ptr, channel, min_filter);
305
+ };
306
+ /**
307
+ * Remove the Red channel's influence in an image.
308
+ *
309
+ * # Arguments
310
+ * * `img` - A PhotonImage.
311
+ * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
312
+ *
313
+ * # Example
314
+ *
315
+ * ```no_run
316
+ * // For example, to remove the red channel for red channel pixel values less than 50:
317
+ * use photon_rs::channels::remove_red_channel;
318
+ * use photon_rs::native::open_image;
319
+ *
320
+ * let mut img = open_image("img.jpg").expect("File should open");
321
+ * remove_red_channel(&mut img, 50_u8);
322
+ * ```
323
+ * @param {PhotonImage} img
324
+ * @param {number} min_filter
325
+ */
326
+ module.exports.remove_red_channel = function(img, min_filter) {
327
+ _assertClass(img, PhotonImage);
328
+ wasm.remove_red_channel(img.__wbg_ptr, min_filter);
329
+ };
330
+ /**
331
+ * Remove the Green channel's influence in an image.
332
+ *
333
+ * # Arguments
334
+ * * `img` - A PhotonImage.
335
+ * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
336
+ *
337
+ * # Example
338
+ *
339
+ * ```no_run
340
+ * // For example, to remove the green channel for green channel pixel values less than 50:
341
+ * use photon_rs::channels::remove_green_channel;
342
+ * use photon_rs::native::open_image;
343
+ *
344
+ * let mut img = open_image("img.jpg").expect("File should open");
345
+ * remove_green_channel(&mut img, 50_u8);
346
+ * ```
347
+ * @param {PhotonImage} img
348
+ * @param {number} min_filter
349
+ */
350
+ module.exports.remove_green_channel = function(img, min_filter) {
351
+ _assertClass(img, PhotonImage);
352
+ wasm.remove_green_channel(img.__wbg_ptr, min_filter);
353
+ };
354
+ /**
355
+ * Remove the Blue channel's influence in an image.
356
+ *
357
+ * # Arguments
358
+ * * `img` - A PhotonImage.
359
+ * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
360
+ *
361
+ * # Example
362
+ *
363
+ * ```no_run
364
+ * // For example, to remove the blue channel for blue channel pixel values less than 50:
365
+ * use photon_rs::channels::remove_blue_channel;
366
+ * use photon_rs::native::open_image;
367
+ *
368
+ * let mut img = open_image("img.jpg").expect("File should open");
369
+ * remove_blue_channel(&mut img, 50_u8);
370
+ * ```
371
+ * @param {PhotonImage} img
372
+ * @param {number} min_filter
373
+ */
374
+ module.exports.remove_blue_channel = function(img, min_filter) {
375
+ _assertClass(img, PhotonImage);
376
+ wasm.remove_blue_channel(img.__wbg_ptr, min_filter);
377
+ };
378
+ /**
379
+ * Swap two channels.
380
+ *
381
+ * # Arguments
382
+ * * `img` - A PhotonImage.
383
+ * * `channel1` - An index from 0 to 2, representing the Red, Green or Blue channels respectively. Red would be represented by 0, Green by 1, and Blue by 2.
384
+ * * `channel2` - An index from 0 to 2, representing the Red, Green or Blue channels respectively. Same as above.
385
+ *
386
+ * # Example
387
+ *
388
+ * ```no_run
389
+ * // For example, to swap the values of the Red channel with the values of the Blue channel:
390
+ * use photon_rs::channels::swap_channels;
391
+ * use photon_rs::native::open_image;
392
+ *
393
+ * let mut img = open_image("img.jpg").expect("File should open");
394
+ * swap_channels(&mut img, 0_usize, 2_usize);
395
+ * ```
396
+ * @param {PhotonImage} img
397
+ * @param {number} channel1
398
+ * @param {number} channel2
399
+ */
400
+ module.exports.swap_channels = function(img, channel1, channel2) {
401
+ _assertClass(img, PhotonImage);
402
+ wasm.swap_channels(img.__wbg_ptr, channel1, channel2);
403
+ };
404
+ /**
405
+ * Invert RGB value of an image.
406
+ *
407
+ * # Arguments
408
+ * * `photon_image` - A DynamicImage that contains a view into the image.
409
+ * # Example
410
+ *
411
+ * ```no_run
412
+ * use photon_rs::channels::invert;
413
+ * use photon_rs::native::open_image;
414
+ *
415
+ * let mut img = open_image("img.jpg").expect("File should open");
416
+ * invert(&mut img);
417
+ * ```
418
+ * @param {PhotonImage} photon_image
419
+ */
420
+ module.exports.invert = function(photon_image) {
421
+ _assertClass(photon_image, PhotonImage);
422
+ wasm.invert(photon_image.__wbg_ptr);
423
+ };
424
+ /**
425
+ * Selective hue rotation.
426
+ *
427
+ * Only rotate the hue of a pixel if its RGB values are within a specified range.
428
+ * This function only rotates a pixel's hue to another if it is visually similar to the colour specified.
429
+ * For example, if a user wishes all pixels that are blue to be changed to red, they can selectively specify only the blue pixels to be changed.
430
+ * # Arguments
431
+ * * `img` - A PhotonImage.
432
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
433
+ * * `degrees` - The amount of degrees to hue rotate by.
434
+ *
435
+ * # Example
436
+ *
437
+ * ```no_run
438
+ * // For example, to only rotate the pixels that are of RGB value RGB{20, 40, 60}:
439
+ * use photon_rs::Rgb;
440
+ * use photon_rs::channels::selective_hue_rotate;
441
+ * use photon_rs::native::open_image;
442
+ *
443
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
444
+ * let mut img = open_image("img.jpg").expect("File should open");
445
+ * selective_hue_rotate(&mut img, ref_color, 180_f32);
446
+ * ```
447
+ * @param {PhotonImage} photon_image
448
+ * @param {Rgb} ref_color
449
+ * @param {number} degrees
450
+ */
451
+ module.exports.selective_hue_rotate = function(photon_image, ref_color, degrees) {
452
+ _assertClass(photon_image, PhotonImage);
453
+ _assertClass(ref_color, Rgb);
454
+ var ptr0 = ref_color.__destroy_into_raw();
455
+ wasm.selective_hue_rotate(photon_image.__wbg_ptr, ptr0, degrees);
456
+ };
457
+ /**
458
+ * Selectively change pixel colours which are similar to the reference colour provided.
459
+ *
460
+ * Similarity between two colours is calculated via the CIE76 formula.
461
+ * Only changes the color of a pixel if its similarity to the reference colour is within the range in the algorithm.
462
+ * For example, with this function, a user can change the color of all blue pixels by mixing them with red by 10%.
463
+ * # Arguments
464
+ * * `photon_image` - A PhotonImage.
465
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
466
+ * * `new_color` - The `RGB` value of the new color (to be mixed with the matched pixels)
467
+ * * `fraction` - The amount of mixing the new colour with the matched pixels
468
+ *
469
+ * # Example
470
+ *
471
+ * ```no_run
472
+ * // For example, to only change the color of pixels that are similar to the RGB value RGB{200, 120, 30} by mixing RGB{30, 120, 200} with 25%:
473
+ * use photon_rs::Rgb;
474
+ * use photon_rs::channels::selective_color_convert;
475
+ * use photon_rs::native::open_image;
476
+ *
477
+ * let ref_color = Rgb::new(200, 120, 30);
478
+ * let new_color = Rgb::new(30, 120, 200);
479
+ * let mut img = open_image("img.jpg").expect("File should open");
480
+ * selective_color_convert(&mut img, ref_color, new_color, 0.25);
481
+ * ```
482
+ * @param {PhotonImage} photon_image
483
+ * @param {Rgb} ref_color
484
+ * @param {Rgb} new_color
485
+ * @param {number} fraction
486
+ */
487
+ module.exports.selective_color_convert = function(photon_image, ref_color, new_color, fraction) {
488
+ _assertClass(photon_image, PhotonImage);
489
+ _assertClass(ref_color, Rgb);
490
+ var ptr0 = ref_color.__destroy_into_raw();
491
+ _assertClass(new_color, Rgb);
492
+ var ptr1 = new_color.__destroy_into_raw();
493
+ wasm.selective_color_convert(photon_image.__wbg_ptr, ptr0, ptr1, fraction);
494
+ };
495
+ /**
496
+ * Selectively lighten an image.
497
+ *
498
+ * Only lighten the hue of a pixel if its colour matches or is similar to the RGB colour specified.
499
+ * For example, if a user wishes all pixels that are blue to be lightened, they can selectively specify only the blue pixels to be changed.
500
+ * # Arguments
501
+ * * `img` - A PhotonImage.
502
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
503
+ * * `amt` - The level from 0 to 1 to lighten the hue by. Increasing by 10% would have an `amt` of 0.1
504
+ *
505
+ * # Example
506
+ *
507
+ * ```no_run
508
+ * // For example, to only lighten the pixels that are of or similar to RGB value RGB{20, 40, 60}:
509
+ * use photon_rs::Rgb;
510
+ * use photon_rs::channels::selective_lighten;
511
+ * use photon_rs::native::open_image;
512
+ *
513
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
514
+ * let mut img = open_image("img.jpg").expect("File should open");
515
+ * selective_lighten(&mut img, ref_color, 0.2_f32);
516
+ * ```
517
+ * @param {PhotonImage} img
518
+ * @param {Rgb} ref_color
519
+ * @param {number} amt
520
+ */
521
+ module.exports.selective_lighten = function(img, ref_color, amt) {
522
+ _assertClass(img, PhotonImage);
523
+ _assertClass(ref_color, Rgb);
524
+ var ptr0 = ref_color.__destroy_into_raw();
525
+ wasm.selective_lighten(img.__wbg_ptr, ptr0, amt);
526
+ };
527
+ /**
528
+ * Selectively desaturate pixel colours which are similar to the reference colour provided.
529
+ *
530
+ * Similarity between two colours is calculated via the CIE76 formula.
531
+ * Only desaturates the hue of a pixel if its similarity to the reference colour is within the range in the algorithm.
532
+ * For example, if a user wishes all pixels that are blue to be desaturated by 0.1, they can selectively specify only the blue pixels to be changed.
533
+ * # Arguments
534
+ * * `img` - A PhotonImage.
535
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
536
+ * * `amt` - The amount of desaturate the colour by.
537
+ *
538
+ * # Example
539
+ *
540
+ * ```no_run
541
+ * // For example, to only desaturate the pixels that are similar to the RGB value RGB{20, 40, 60}:
542
+ * use photon_rs::Rgb;
543
+ * use photon_rs::channels::selective_desaturate;
544
+ * use photon_rs::native::open_image;
545
+ *
546
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
547
+ * let mut img = open_image("img.jpg").expect("File should open");
548
+ * selective_desaturate(&mut img, ref_color, 0.1_f32);
549
+ * ```
550
+ * @param {PhotonImage} img
551
+ * @param {Rgb} ref_color
552
+ * @param {number} amt
553
+ */
554
+ module.exports.selective_desaturate = function(img, ref_color, amt) {
555
+ _assertClass(img, PhotonImage);
556
+ _assertClass(ref_color, Rgb);
557
+ var ptr0 = ref_color.__destroy_into_raw();
558
+ wasm.selective_desaturate(img.__wbg_ptr, ptr0, amt);
559
+ };
560
+ /**
561
+ * Selectively saturate pixel colours which are similar to the reference colour provided.
562
+ *
563
+ * Similarity between two colours is calculated via the CIE76 formula.
564
+ * Only saturates the hue of a pixel if its similarity to the reference colour is within the range in the algorithm.
565
+ * For example, if a user wishes all pixels that are blue to have an increase in saturation by 10%, they can selectively specify only the blue pixels to be changed.
566
+ * # Arguments
567
+ * * `img` - A PhotonImage.
568
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
569
+ * * `amt` - The amount of saturate the colour by.
570
+ *
571
+ * # Example
572
+ *
573
+ * ```no_run
574
+ * // For example, to only increase the saturation of pixels that are similar to the RGB value RGB{20, 40, 60}:
575
+ * use photon_rs::Rgb;
576
+ * use photon_rs::channels::selective_saturate;
577
+ * use photon_rs::native::open_image;
578
+ *
579
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
580
+ * let mut img = open_image("img.jpg").expect("File should open");
581
+ * selective_saturate(&mut img, ref_color, 0.1_f32);
582
+ * ```
583
+ * @param {PhotonImage} img
584
+ * @param {Rgb} ref_color
585
+ * @param {number} amt
586
+ */
587
+ module.exports.selective_saturate = function(img, ref_color, amt) {
588
+ _assertClass(img, PhotonImage);
589
+ _assertClass(ref_color, Rgb);
590
+ var ptr0 = ref_color.__destroy_into_raw();
591
+ wasm.selective_saturate(img.__wbg_ptr, ptr0, amt);
592
+ };
593
+ /**
594
+ * Selectively changes a pixel to greyscale if it is *not* visually similar or close to the colour specified.
595
+ * Only changes the colour of a pixel if its RGB values are within a specified range.
596
+ *
597
+ * (Similarity between two colours is calculated via the CIE76 formula.)
598
+ * For example, if a user wishes all pixels that are *NOT* blue to be displayed in greyscale, they can selectively specify only the blue pixels to be
599
+ * kept in the photo.
600
+ * # Arguments
601
+ * * `img` - A PhotonImage.
602
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
603
+ *
604
+ * # Example
605
+ *
606
+ * ```no_run
607
+ * // For example, to greyscale all pixels that are *not* visually similar to the RGB colour RGB{20, 40, 60}:
608
+ * use photon_rs::Rgb;
609
+ * use photon_rs::channels::selective_greyscale;
610
+ * use photon_rs::native::open_image;
611
+ *
612
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
613
+ * let mut img = open_image("img.jpg").expect("File should open");
614
+ * selective_greyscale(img, ref_color);
615
+ * ```
616
+ * @param {PhotonImage} photon_image
617
+ * @param {Rgb} ref_color
618
+ */
619
+ module.exports.selective_greyscale = function(photon_image, ref_color) {
620
+ _assertClass(photon_image, PhotonImage);
621
+ var ptr0 = photon_image.__destroy_into_raw();
622
+ _assertClass(ref_color, Rgb);
623
+ var ptr1 = ref_color.__destroy_into_raw();
624
+ wasm.selective_greyscale(ptr0, ptr1);
625
+ };
626
+ /**
627
+ * Apply a monochrome effect of a certain colour.
628
+ *
629
+ * It does so by averaging the R, G, and B values of a pixel, and then adding a
630
+ * separate value to that averaged value for each channel to produce a tint.
631
+ * # Arguments
632
+ * * `photon_image` - A PhotonImage.
633
+ * * `r_offset` - The value to add to the Red channel per pixel.
634
+ * * `g_offset` - The value to add to the Green channel per pixel.
635
+ * * `b_offset` - The value to add to the Blue channel per pixel.
636
+ *
637
+ * # Example
638
+ *
639
+ * ```no_run
640
+ * // For example, to apply a monochrome effect to an image:
641
+ * use photon_rs::monochrome::monochrome;
642
+ * use photon_rs::native::open_image;
643
+ *
644
+ * let mut img = open_image("img.jpg").expect("File should open");
645
+ * monochrome(&mut img, 40_u32, 50_u32, 100_u32);
646
+ * ```
647
+ * @param {PhotonImage} img
648
+ * @param {number} r_offset
649
+ * @param {number} g_offset
650
+ * @param {number} b_offset
651
+ */
652
+ module.exports.monochrome = function(img, r_offset, g_offset, b_offset) {
653
+ _assertClass(img, PhotonImage);
654
+ wasm.monochrome(img.__wbg_ptr, r_offset, g_offset, b_offset);
655
+ };
656
+ /**
657
+ * Convert an image to sepia.
658
+ *
659
+ * # Arguments
660
+ * * `photon_image` - A PhotonImage.
661
+ * # Example
662
+ *
663
+ * ```no_run
664
+ * // For example, to sepia an image of type `PhotonImage`:
665
+ * use photon_rs::monochrome::sepia;
666
+ * use photon_rs::native::open_image;
667
+ *
668
+ * let mut img = open_image("img.jpg").expect("File should open");
669
+ * sepia(&mut img);
670
+ * ```
671
+ * @param {PhotonImage} img
672
+ */
673
+ module.exports.sepia = function(img) {
674
+ _assertClass(img, PhotonImage);
675
+ wasm.sepia(img.__wbg_ptr);
676
+ };
677
+ /**
678
+ * Convert an image to grayscale using the conventional averaging algorithm.
679
+ *
680
+ * # Arguments
681
+ * * `photon_image` - A PhotonImage.
682
+ * # Example
683
+ *
684
+ * ```no_run
685
+ * // For example, to convert an image of type `PhotonImage` to grayscale:
686
+ * use photon_rs::monochrome::grayscale;
687
+ * use photon_rs::native::open_image;
688
+ *
689
+ * let mut img = open_image("img.jpg").expect("File should open");
690
+ * grayscale(&mut img);
691
+ * ```
692
+ * @param {PhotonImage} img
693
+ */
694
+ module.exports.grayscale = function(img) {
695
+ _assertClass(img, PhotonImage);
696
+ wasm.grayscale(img.__wbg_ptr);
697
+ };
698
+ /**
699
+ * Convert an image to grayscale with a human corrected factor, to account for human vision.
700
+ *
701
+ * # Arguments
702
+ * * `photon_image` - A PhotonImage.
703
+ * # Example
704
+ *
705
+ * ```no_run
706
+ * // For example, to convert an image of type `PhotonImage` to grayscale with a human corrected factor:
707
+ * use photon_rs::monochrome::grayscale_human_corrected;
708
+ * use photon_rs::native::open_image;
709
+ *
710
+ * let mut img = open_image("img.jpg").expect("File should open");
711
+ * grayscale_human_corrected(&mut img);
712
+ * ```
713
+ * @param {PhotonImage} img
714
+ */
715
+ module.exports.grayscale_human_corrected = function(img) {
716
+ _assertClass(img, PhotonImage);
717
+ wasm.grayscale_human_corrected(img.__wbg_ptr);
718
+ };
719
+ /**
720
+ * Desaturate an image by getting the min/max of each pixel's RGB values.
721
+ *
722
+ * # Arguments
723
+ * * `photon_image` - A PhotonImage.
724
+ * # Example
725
+ *
726
+ * ```no_run
727
+ * // For example, to desaturate an image:
728
+ * use photon_rs::monochrome::desaturate;
729
+ * use photon_rs::native::open_image;
730
+ *
731
+ * let mut img = open_image("img.jpg").expect("File should open");
732
+ * desaturate(&mut img);
733
+ * ```
734
+ * @param {PhotonImage} img
735
+ */
736
+ module.exports.desaturate = function(img) {
737
+ _assertClass(img, PhotonImage);
738
+ wasm.desaturate(img.__wbg_ptr);
739
+ };
740
+ /**
741
+ * Uses a min. decomposition algorithm to convert an image to greyscale.
742
+ *
743
+ * # Arguments
744
+ * * `photon_image` - A PhotonImage.
745
+ *
746
+ * # Example
747
+ *
748
+ * ```no_run
749
+ * // For example, to decompose an image with min decomposition:
750
+ * use photon_rs::monochrome::decompose_min;
751
+ * use photon_rs::native::open_image;
752
+ *
753
+ * let mut img = open_image("img.jpg").expect("File should open");
754
+ * decompose_min(&mut img);
755
+ * ```
756
+ * @param {PhotonImage} img
757
+ */
758
+ module.exports.decompose_min = function(img) {
759
+ _assertClass(img, PhotonImage);
760
+ wasm.decompose_min(img.__wbg_ptr);
761
+ };
762
+ /**
763
+ * Uses a max. decomposition algorithm to convert an image to greyscale.
764
+ *
765
+ * # Arguments
766
+ * * `photon_image` - A PhotonImage.
767
+ *
768
+ * # Example
769
+ *
770
+ * ```no_run
771
+ * // For example, to decompose an image with max decomposition:
772
+ * use photon_rs::monochrome::decompose_max;
773
+ * use photon_rs::native::open_image;
774
+ *
775
+ * let mut img = open_image("img.jpg").expect("File should open");
776
+ * decompose_max(&mut img);
777
+ * ```
778
+ * @param {PhotonImage} img
779
+ */
780
+ module.exports.decompose_max = function(img) {
781
+ _assertClass(img, PhotonImage);
782
+ wasm.decompose_max(img.__wbg_ptr);
783
+ };
784
+ /**
785
+ * Employ only a limited number of gray shades in an image.
786
+ *
787
+ * # Arguments
788
+ * * `photon_image` - A PhotonImage.
789
+ * * `num_shades` - The number of grayscale shades to be displayed in the image.
790
+ *
791
+ * # Example
792
+ *
793
+ * ```no_run
794
+ * // For example, to limit an image to four shades of gray only:
795
+ * use photon_rs::monochrome::grayscale_shades;
796
+ * use photon_rs::native::open_image;
797
+ *
798
+ * let mut img = open_image("img.jpg").expect("File should open");
799
+ * grayscale_shades(&mut img, 4_u8);
800
+ * ```
801
+ * @param {PhotonImage} photon_image
802
+ * @param {number} num_shades
803
+ */
804
+ module.exports.grayscale_shades = function(photon_image, num_shades) {
805
+ _assertClass(photon_image, PhotonImage);
806
+ wasm.grayscale_shades(photon_image.__wbg_ptr, num_shades);
807
+ };
808
+ /**
809
+ * Convert an image to grayscale by setting a pixel's 3 RGB values to the Red channel's value.
810
+ *
811
+ * # Arguments
812
+ * * `photon_image` - A PhotonImage.
813
+ *
814
+ * # Example
815
+ *
816
+ * ```no_run
817
+ * use photon_rs::monochrome::r_grayscale;
818
+ * use photon_rs::native::open_image;
819
+ *
820
+ * let mut img = open_image("img.jpg").expect("File should open");
821
+ * r_grayscale(&mut img);
822
+ * ```
823
+ * @param {PhotonImage} photon_image
824
+ */
825
+ module.exports.r_grayscale = function(photon_image) {
826
+ _assertClass(photon_image, PhotonImage);
827
+ wasm.r_grayscale(photon_image.__wbg_ptr);
828
+ };
829
+ /**
830
+ * Convert an image to grayscale by setting a pixel's 3 RGB values to the Green channel's value.
831
+ *
832
+ * # Arguments
833
+ * * `photon_image` - A PhotonImage.
834
+ *
835
+ * # Example
836
+ *
837
+ * ```no_run
838
+ * use photon_rs::monochrome::g_grayscale;
839
+ * use photon_rs::native::open_image;
840
+ *
841
+ * let mut img = open_image("img.jpg").expect("File should open");
842
+ * g_grayscale(&mut img);
843
+ * ```
844
+ * @param {PhotonImage} photon_image
845
+ */
846
+ module.exports.g_grayscale = function(photon_image) {
847
+ _assertClass(photon_image, PhotonImage);
848
+ wasm.g_grayscale(photon_image.__wbg_ptr);
849
+ };
850
+ /**
851
+ * Convert an image to grayscale by setting a pixel's 3 RGB values to the Blue channel's value.
852
+ *
853
+ * # Arguments
854
+ * * `photon_image` - A PhotonImage.
855
+ *
856
+ * # Example
857
+ *
858
+ * ```no_run
859
+ * use photon_rs::monochrome::b_grayscale;
860
+ * use photon_rs::native::open_image;
861
+ *
862
+ * let mut img = open_image("img.jpg").expect("File should open");
863
+ * b_grayscale(&mut img);
864
+ * ```
865
+ * @param {PhotonImage} photon_image
866
+ */
867
+ module.exports.b_grayscale = function(photon_image) {
868
+ _assertClass(photon_image, PhotonImage);
869
+ wasm.b_grayscale(photon_image.__wbg_ptr);
870
+ };
871
+ /**
872
+ * Convert an image to grayscale by setting a pixel's 3 RGB values to a chosen channel's value.
873
+ *
874
+ * # Arguments
875
+ * * `photon_image` - A PhotonImage.
876
+ * * `channel` - A usize representing the channel from 0 to 2. O represents the Red channel, 1 the Green channel, and 2 the Blue channel.
877
+ *
878
+ * # Example
879
+ * To grayscale using only values from the Red channel:
880
+ * ```no_run
881
+ * use photon_rs::monochrome::single_channel_grayscale;
882
+ * use photon_rs::native::open_image;
883
+ *
884
+ * let mut img = open_image("img.jpg").expect("File should open");
885
+ * single_channel_grayscale(&mut img, 0_usize);
886
+ * ```
887
+ * @param {PhotonImage} photon_image
888
+ * @param {number} channel
889
+ */
890
+ module.exports.single_channel_grayscale = function(photon_image, channel) {
891
+ _assertClass(photon_image, PhotonImage);
892
+ wasm.single_channel_grayscale(photon_image.__wbg_ptr, channel);
893
+ };
894
+ /**
895
+ * Threshold an image using a standard thresholding algorithm.
896
+ *
897
+ * # Arguments
898
+ * * `photon_image` - A PhotonImage.
899
+ * * `threshold` - The amount the image should be thresholded by from 0 to 255.
900
+ * # Example
901
+ *
902
+ * ```no_run
903
+ * // For example, to threshold an image of type `PhotonImage`:
904
+ * use photon_rs::monochrome::threshold;
905
+ * use photon_rs::native::open_image;
906
+ *
907
+ * let mut img = open_image("img.jpg").expect("File should open");
908
+ * threshold(&mut img, 30_u32);
909
+ * ```
910
+ * @param {PhotonImage} img
911
+ * @param {number} threshold
912
+ */
913
+ module.exports.threshold = function(img, threshold) {
914
+ _assertClass(img, PhotonImage);
915
+ wasm.threshold(img.__wbg_ptr, threshold);
916
+ };
917
+ /**
918
+ * Applies gamma correction to an image.
919
+ * # Arguments
920
+ * * `photon_image` - A PhotonImage that contains a view into the image.
921
+ * * `red` - Gamma value for red channel.
922
+ * * `green` - Gamma value for green channel.
923
+ * * `blue` - Gamma value for blue channel.
924
+ * # Example
925
+ *
926
+ * ```no_run
927
+ * // For example, to turn an image of type `PhotonImage` into a gamma corrected image:
928
+ * use photon_rs::colour_spaces::gamma_correction;
929
+ * use photon_rs::native::open_image;
930
+ *
931
+ * let mut img = open_image("img.jpg").expect("File should open");
932
+ * gamma_correction(&mut img, 2.2, 2.2, 2.2);
933
+ * ```
934
+ * @param {PhotonImage} photon_image
935
+ * @param {number} red
936
+ * @param {number} green
937
+ * @param {number} blue
938
+ */
939
+ module.exports.gamma_correction = function(photon_image, red, green, blue) {
940
+ _assertClass(photon_image, PhotonImage);
941
+ wasm.gamma_correction(photon_image.__wbg_ptr, red, green, blue);
942
+ };
943
+ /**
944
+ * Image manipulation effects in the HSLuv colour space
945
+ *
946
+ * Effects include:
947
+ * * **saturate** - Saturation increase.
948
+ * * **desaturate** - Desaturate the image.
949
+ * * **shift_hue** - Hue rotation by a specified number of degrees.
950
+ * * **darken** - Decrease the brightness.
951
+ * * **lighten** - Increase the brightness.
952
+ *
953
+ * # Arguments
954
+ * * `photon_image` - A PhotonImage.
955
+ * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
956
+ * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
957
+ * # Example
958
+ * ```no_run
959
+ * // For example to increase the saturation by 10%:
960
+ * use photon_rs::colour_spaces::hsluv;
961
+ * use photon_rs::native::open_image;
962
+ *
963
+ * // Open the image. A PhotonImage is returned.
964
+ * let mut img = open_image("img.jpg").expect("File should open");
965
+ * hsluv(&mut img, "saturate", 0.1_f32);
966
+ * ```
967
+ * @param {PhotonImage} photon_image
968
+ * @param {string} mode
969
+ * @param {number} amt
970
+ */
971
+ module.exports.hsluv = function(photon_image, mode, amt) {
972
+ _assertClass(photon_image, PhotonImage);
973
+ const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
974
+ const len0 = WASM_VECTOR_LEN;
975
+ wasm.hsluv(photon_image.__wbg_ptr, ptr0, len0, amt);
976
+ };
977
+ /**
978
+ * Image manipulation effects in the LCh colour space
979
+ *
980
+ * Effects include:
981
+ * * **saturate** - Saturation increase.
982
+ * * **desaturate** - Desaturate the image.
983
+ * * **shift_hue** - Hue rotation by a specified number of degrees.
984
+ * * **darken** - Decrease the brightness.
985
+ * * **lighten** - Increase the brightness.
986
+ *
987
+ * # Arguments
988
+ * * `photon_image` - A PhotonImage.
989
+ * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
990
+ * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
991
+ * # Example
992
+ * ```no_run
993
+ * // For example to increase the saturation by 10%:
994
+ * use photon_rs::colour_spaces::lch;
995
+ * use photon_rs::native::open_image;
996
+ *
997
+ * // Open the image. A PhotonImage is returned.
998
+ * let mut img = open_image("img.jpg").expect("File should open");
999
+ * lch(&mut img, "saturate", 0.1_f32);
1000
+ * ```
1001
+ * @param {PhotonImage} photon_image
1002
+ * @param {string} mode
1003
+ * @param {number} amt
1004
+ */
1005
+ module.exports.lch = function(photon_image, mode, amt) {
1006
+ _assertClass(photon_image, PhotonImage);
1007
+ const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1008
+ const len0 = WASM_VECTOR_LEN;
1009
+ wasm.lch(photon_image.__wbg_ptr, ptr0, len0, amt);
1010
+ };
1011
+ /**
1012
+ * Image manipulation effects in the HSL colour space.
1013
+ *
1014
+ * Effects include:
1015
+ * * **saturate** - Saturation increase.
1016
+ * * **desaturate** - Desaturate the image.
1017
+ * * **shift_hue** - Hue rotation by a specified number of degrees.
1018
+ * * **darken** - Decrease the brightness.
1019
+ * * **lighten** - Increase the brightness.
1020
+ *
1021
+ * # Arguments
1022
+ * * `photon_image` - A PhotonImage.
1023
+ * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
1024
+ * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
1025
+ * # Example
1026
+ * ```no_run
1027
+ * // For example to increase the saturation by 10%:
1028
+ * use photon_rs::colour_spaces::hsl;
1029
+ * use photon_rs::native::open_image;
1030
+ *
1031
+ * // Open the image. A PhotonImage is returned.
1032
+ * let mut img = open_image("img.jpg").expect("File should open");
1033
+ * hsl(&mut img, "saturate", 0.1_f32);
1034
+ * ```
1035
+ * @param {PhotonImage} photon_image
1036
+ * @param {string} mode
1037
+ * @param {number} amt
1038
+ */
1039
+ module.exports.hsl = function(photon_image, mode, amt) {
1040
+ _assertClass(photon_image, PhotonImage);
1041
+ const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1042
+ const len0 = WASM_VECTOR_LEN;
1043
+ wasm.hsl(photon_image.__wbg_ptr, ptr0, len0, amt);
1044
+ };
1045
+ /**
1046
+ * Image manipulation in the HSV colour space.
1047
+ *
1048
+ * Effects include:
1049
+ * * **saturate** - Saturation increase.
1050
+ * * **desaturate** - Desaturate the image.
1051
+ * * **shift_hue** - Hue rotation by a specified number of degrees.
1052
+ * * **darken** - Decrease the brightness.
1053
+ * * **lighten** - Increase the brightness.
1054
+ *
1055
+ * # Arguments
1056
+ * * `photon_image` - A PhotonImage.
1057
+ * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
1058
+ * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
1059
+ *
1060
+ * # Example
1061
+ * ```no_run
1062
+ * // For example to increase the saturation by 10%:
1063
+ * use photon_rs::colour_spaces::hsv;
1064
+ * use photon_rs::native::open_image;
1065
+ *
1066
+ * // Open the image. A PhotonImage is returned.
1067
+ * let mut img = open_image("img.jpg").expect("File should open");
1068
+ * hsv(&mut img, "saturate", 0.1_f32);
1069
+ * ```
1070
+ * @param {PhotonImage} photon_image
1071
+ * @param {string} mode
1072
+ * @param {number} amt
1073
+ */
1074
+ module.exports.hsv = function(photon_image, mode, amt) {
1075
+ _assertClass(photon_image, PhotonImage);
1076
+ const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1077
+ const len0 = WASM_VECTOR_LEN;
1078
+ wasm.hsv(photon_image.__wbg_ptr, ptr0, len0, amt);
1079
+ };
1080
+ /**
1081
+ * Shift hue by a specified number of degrees in the HSL colour space.
1082
+ * # Arguments
1083
+ * * `img` - A PhotonImage.
1084
+ * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
1085
+ *
1086
+ * # Example
1087
+ * ```no_run
1088
+ * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
1089
+ * use photon_rs::colour_spaces::hue_rotate_hsl;
1090
+ * use photon_rs::native::open_image;
1091
+ *
1092
+ * // Open the image. A PhotonImage is returned.
1093
+ * let mut img = open_image("img.jpg").expect("File should open");
1094
+ * hue_rotate_hsl(&mut img, 120_f32);
1095
+ * ```
1096
+ * @param {PhotonImage} img
1097
+ * @param {number} degrees
1098
+ */
1099
+ module.exports.hue_rotate_hsl = function(img, degrees) {
1100
+ _assertClass(img, PhotonImage);
1101
+ wasm.hue_rotate_hsl(img.__wbg_ptr, degrees);
1102
+ };
1103
+ /**
1104
+ * Shift hue by a specified number of degrees in the HSV colour space.
1105
+ * # Arguments
1106
+ * * `img` - A PhotonImage.
1107
+ * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
1108
+ *
1109
+ * # Example
1110
+ * ```no_run
1111
+ * // For example to hue rotate/shift the hue by 120 degrees in the HSV colour space:
1112
+ * use photon_rs::colour_spaces::hue_rotate_hsv;
1113
+ * use photon_rs::native::open_image;
1114
+ *
1115
+ * // Open the image. A PhotonImage is returned.
1116
+ * let mut img = open_image("img.jpg").expect("File should open");
1117
+ * hue_rotate_hsv(&mut img, 120_f32);
1118
+ * ```
1119
+ * @param {PhotonImage} img
1120
+ * @param {number} degrees
1121
+ */
1122
+ module.exports.hue_rotate_hsv = function(img, degrees) {
1123
+ _assertClass(img, PhotonImage);
1124
+ wasm.hue_rotate_hsv(img.__wbg_ptr, degrees);
1125
+ };
1126
+ /**
1127
+ * Shift hue by a specified number of degrees in the LCh colour space.
1128
+ * # Arguments
1129
+ * * `img` - A PhotonImage.
1130
+ * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
1131
+ *
1132
+ * # Example
1133
+ * ```no_run
1134
+ * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
1135
+ * use photon_rs::colour_spaces::hue_rotate_lch;
1136
+ * use photon_rs::native::open_image;
1137
+ *
1138
+ * // Open the image. A PhotonImage is returned.
1139
+ * let mut img = open_image("img.jpg").expect("File should open");
1140
+ * hue_rotate_lch(&mut img, 120_f32);
1141
+ * ```
1142
+ * @param {PhotonImage} img
1143
+ * @param {number} degrees
1144
+ */
1145
+ module.exports.hue_rotate_lch = function(img, degrees) {
1146
+ _assertClass(img, PhotonImage);
1147
+ wasm.hue_rotate_lch(img.__wbg_ptr, degrees);
1148
+ };
1149
+ /**
1150
+ * Shift hue by a specified number of degrees in the HSLuv colour space.
1151
+ * # Arguments
1152
+ * * `img` - A PhotonImage.
1153
+ * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
1154
+ *
1155
+ * # Example
1156
+ * ```no_run
1157
+ * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
1158
+ * use photon_rs::colour_spaces::hue_rotate_hsluv;
1159
+ * use photon_rs::native::open_image;
1160
+ *
1161
+ * // Open the image. A PhotonImage is returned.
1162
+ * let mut img = open_image("img.jpg").expect("File should open");
1163
+ * hue_rotate_hsluv(&mut img, 120_f32);
1164
+ * ```
1165
+ * @param {PhotonImage} img
1166
+ * @param {number} degrees
1167
+ */
1168
+ module.exports.hue_rotate_hsluv = function(img, degrees) {
1169
+ _assertClass(img, PhotonImage);
1170
+ wasm.hue_rotate_hsluv(img.__wbg_ptr, degrees);
1171
+ };
1172
+ /**
1173
+ * Increase the image's saturation by converting each pixel's colour to the HSL colour space
1174
+ * and increasing the colour's saturation.
1175
+ * # Arguments
1176
+ * * `img` - A PhotonImage.
1177
+ * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
1178
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1179
+ * Increasing saturation by 80% would be represented by a `level` of 0.8
1180
+ *
1181
+ * # Example
1182
+ * ```no_run
1183
+ * // For example to increase saturation by 10% in the HSL colour space:
1184
+ * use photon_rs::colour_spaces::saturate_hsl;
1185
+ * use photon_rs::native::open_image;
1186
+ *
1187
+ * // Open the image. A PhotonImage is returned.
1188
+ * let mut img = open_image("img.jpg").expect("File should open");
1189
+ * saturate_hsl(&mut img, 0.1_f32);
1190
+ * ```
1191
+ * @param {PhotonImage} img
1192
+ * @param {number} level
1193
+ */
1194
+ module.exports.saturate_hsl = function(img, level) {
1195
+ _assertClass(img, PhotonImage);
1196
+ wasm.saturate_hsl(img.__wbg_ptr, level);
1197
+ };
1198
+ /**
1199
+ * Increase the image's saturation in the LCh colour space.
1200
+ * # Arguments
1201
+ * * `img` - A PhotonImage.
1202
+ * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
1203
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1204
+ * Increasing saturation by 80% would be represented by a `level` of 0.8
1205
+ *
1206
+ * # Example
1207
+ * ```no_run
1208
+ * // For example to increase saturation by 40% in the Lch colour space:
1209
+ * use photon_rs::colour_spaces::saturate_lch;
1210
+ * use photon_rs::native::open_image;
1211
+ *
1212
+ * // Open the image. A PhotonImage is returned.
1213
+ * let mut img = open_image("img.jpg").expect("File should open");
1214
+ * saturate_lch(&mut img, 0.4_f32);
1215
+ * ```
1216
+ * @param {PhotonImage} img
1217
+ * @param {number} level
1218
+ */
1219
+ module.exports.saturate_lch = function(img, level) {
1220
+ _assertClass(img, PhotonImage);
1221
+ wasm.saturate_lch(img.__wbg_ptr, level);
1222
+ };
1223
+ /**
1224
+ * Increase the image's saturation in the HSLuv colour space.
1225
+ * # Arguments
1226
+ * * `img` - A PhotonImage.
1227
+ * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
1228
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1229
+ * Increasing saturation by 80% would be represented by a `level` of 0.8
1230
+ *
1231
+ * # Example
1232
+ * ```no_run
1233
+ * // For example to increase saturation by 40% in the HSLuv colour space:
1234
+ * use photon_rs::colour_spaces::saturate_hsluv;
1235
+ * use photon_rs::native::open_image;
1236
+ *
1237
+ * // Open the image. A PhotonImage is returned.
1238
+ * let mut img = open_image("img.jpg").expect("File should open");
1239
+ * saturate_hsluv(&mut img, 0.4_f32);
1240
+ * ```
1241
+ * @param {PhotonImage} img
1242
+ * @param {number} level
1243
+ */
1244
+ module.exports.saturate_hsluv = function(img, level) {
1245
+ _assertClass(img, PhotonImage);
1246
+ wasm.saturate_hsluv(img.__wbg_ptr, level);
1247
+ };
1248
+ /**
1249
+ * Increase the image's saturation in the HSV colour space.
1250
+ * # Arguments
1251
+ * * `img` - A PhotonImage.
1252
+ * * `level` - Float value from 0 to 1 representing the level by which to increase the saturation by.
1253
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1254
+ * Increasing saturation by 80% would be represented by a `level` of 0.8
1255
+ *
1256
+ * # Example
1257
+ * ```no_run
1258
+ * // For example to increase saturation by 30% in the HSV colour space:
1259
+ * use photon_rs::colour_spaces::saturate_hsv;
1260
+ * use photon_rs::native::open_image;
1261
+ *
1262
+ * // Open the image. A PhotonImage is returned.
1263
+ * let mut img = open_image("img.jpg").expect("File should open");
1264
+ * saturate_hsv(&mut img, 0.3_f32);
1265
+ * ```
1266
+ * @param {PhotonImage} img
1267
+ * @param {number} level
1268
+ */
1269
+ module.exports.saturate_hsv = function(img, level) {
1270
+ _assertClass(img, PhotonImage);
1271
+ wasm.saturate_hsv(img.__wbg_ptr, level);
1272
+ };
1273
+ /**
1274
+ * Lighten an image by a specified amount in the LCh colour space.
1275
+ *
1276
+ * # Arguments
1277
+ * * `img` - A PhotonImage.
1278
+ * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
1279
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1280
+ * Lightening by 80% would be represented by a `level` of 0.8
1281
+ *
1282
+ * # Example
1283
+ * ```no_run
1284
+ * // For example to lighten an image by 10% in the LCh colour space:
1285
+ * use photon_rs::colour_spaces::lighten_lch;
1286
+ * use photon_rs::native::open_image;
1287
+ *
1288
+ * // Open the image. A PhotonImage is returned.
1289
+ * let mut img = open_image("img.jpg").expect("File should open");
1290
+ * lighten_lch(&mut img, 0.1_f32);
1291
+ * ```
1292
+ * @param {PhotonImage} img
1293
+ * @param {number} level
1294
+ */
1295
+ module.exports.lighten_lch = function(img, level) {
1296
+ _assertClass(img, PhotonImage);
1297
+ wasm.lighten_lch(img.__wbg_ptr, level);
1298
+ };
1299
+ /**
1300
+ * Lighten an image by a specified amount in the HSLuv colour space.
1301
+ *
1302
+ * # Arguments
1303
+ * * `img` - A PhotonImage.
1304
+ * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
1305
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1306
+ * Lightening by 80% would be represented by a `level` of 0.8
1307
+ *
1308
+ * # Example
1309
+ * ```no_run
1310
+ * // For example to lighten an image by 10% in the HSLuv colour space:
1311
+ * use photon_rs::colour_spaces::lighten_hsluv;
1312
+ * use photon_rs::native::open_image;
1313
+ *
1314
+ * // Open the image. A PhotonImage is returned.
1315
+ * let mut img = open_image("img.jpg").expect("File should open");
1316
+ * lighten_hsluv(&mut img, 0.1_f32);
1317
+ * ```
1318
+ * @param {PhotonImage} img
1319
+ * @param {number} level
1320
+ */
1321
+ module.exports.lighten_hsluv = function(img, level) {
1322
+ _assertClass(img, PhotonImage);
1323
+ wasm.lighten_hsluv(img.__wbg_ptr, level);
1324
+ };
1325
+ /**
1326
+ * Lighten an image by a specified amount in the HSL colour space.
1327
+ * # Arguments
1328
+ * * `img` - A PhotonImage.
1329
+ * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
1330
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1331
+ * Lightening by 80% would be represented by a `level` of 0.8
1332
+ *
1333
+ * # Example
1334
+ * ```no_run
1335
+ * // For example to lighten an image by 10% in the HSL colour space:
1336
+ * use photon_rs::colour_spaces::lighten_hsl;
1337
+ * use photon_rs::native::open_image;
1338
+ *
1339
+ * // Open the image. A PhotonImage is returned.
1340
+ * let mut img = open_image("img.jpg").expect("File should open");
1341
+ * lighten_hsl(&mut img, 0.1_f32);
1342
+ * ```
1343
+ * @param {PhotonImage} img
1344
+ * @param {number} level
1345
+ */
1346
+ module.exports.lighten_hsl = function(img, level) {
1347
+ _assertClass(img, PhotonImage);
1348
+ wasm.lighten_hsl(img.__wbg_ptr, level);
1349
+ };
1350
+ /**
1351
+ * Lighten an image by a specified amount in the HSV colour space.
1352
+ *
1353
+ * # Arguments
1354
+ * * `img` - A PhotonImage.
1355
+ * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
1356
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1357
+ * Lightening by 80% would be represented by a `level` of 0.8
1358
+ *
1359
+ * # Example
1360
+ * ```no_run
1361
+ * // For example to lighten an image by 10% in the HSV colour space:
1362
+ * use photon_rs::colour_spaces::lighten_hsv;
1363
+ * use photon_rs::native::open_image;
1364
+ *
1365
+ * // Open the image. A PhotonImage is returned.
1366
+ * let mut img = open_image("img.jpg").expect("File should open");
1367
+ * lighten_hsv(&mut img, 0.1_f32);
1368
+ * ```
1369
+ * @param {PhotonImage} img
1370
+ * @param {number} level
1371
+ */
1372
+ module.exports.lighten_hsv = function(img, level) {
1373
+ _assertClass(img, PhotonImage);
1374
+ wasm.lighten_hsv(img.__wbg_ptr, level);
1375
+ };
1376
+ /**
1377
+ * Darken the image by a specified amount in the LCh colour space.
1378
+ *
1379
+ * # Arguments
1380
+ * * `img` - A PhotonImage.
1381
+ * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
1382
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1383
+ * Darkening by 80% would be represented by a `level` of 0.8
1384
+ *
1385
+ * # Example
1386
+ * ```no_run
1387
+ * // For example to darken an image by 10% in the LCh colour space:
1388
+ * use photon_rs::colour_spaces::darken_lch;
1389
+ * use photon_rs::native::open_image;
1390
+ *
1391
+ * // Open the image. A PhotonImage is returned.
1392
+ * let mut img = open_image("img.jpg").expect("File should open");
1393
+ * darken_lch(&mut img, 0.1_f32);
1394
+ * ```
1395
+ * @param {PhotonImage} img
1396
+ * @param {number} level
1397
+ */
1398
+ module.exports.darken_lch = function(img, level) {
1399
+ _assertClass(img, PhotonImage);
1400
+ wasm.darken_lch(img.__wbg_ptr, level);
1401
+ };
1402
+ /**
1403
+ * Darken the image by a specified amount in the HSLuv colour space.
1404
+ *
1405
+ * # Arguments
1406
+ * * `img` - A PhotonImage.
1407
+ * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
1408
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1409
+ * Darkening by 80% would be represented by a `level` of 0.8
1410
+ *
1411
+ * # Example
1412
+ * ```no_run
1413
+ * // For example to darken an image by 10% in the HSLuv colour space:
1414
+ * use photon_rs::colour_spaces::darken_hsluv;
1415
+ * use photon_rs::native::open_image;
1416
+ *
1417
+ * // Open the image. A PhotonImage is returned.
1418
+ * let mut img = open_image("img.jpg").expect("File should open");
1419
+ * darken_hsluv(&mut img, 0.1_f32);
1420
+ * ```
1421
+ * @param {PhotonImage} img
1422
+ * @param {number} level
1423
+ */
1424
+ module.exports.darken_hsluv = function(img, level) {
1425
+ _assertClass(img, PhotonImage);
1426
+ wasm.darken_hsluv(img.__wbg_ptr, level);
1427
+ };
1428
+ /**
1429
+ * Darken the image by a specified amount in the HSL colour space.
1430
+ *
1431
+ * # Arguments
1432
+ * * `img` - A PhotonImage.
1433
+ * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
1434
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1435
+ * Darkening by 80% would be represented by a `level` of 0.8
1436
+ *
1437
+ * # Example
1438
+ * ```no_run
1439
+ * // For example to darken an image by 10% in the HSL colour space:
1440
+ * use photon_rs::colour_spaces::darken_hsl;
1441
+ * use photon_rs::native::open_image;
1442
+ *
1443
+ * // Open the image. A PhotonImage is returned.
1444
+ * let mut img = open_image("img.jpg").expect("File should open");
1445
+ * darken_hsl(&mut img, 0.1_f32);
1446
+ * ```
1447
+ * @param {PhotonImage} img
1448
+ * @param {number} level
1449
+ */
1450
+ module.exports.darken_hsl = function(img, level) {
1451
+ _assertClass(img, PhotonImage);
1452
+ wasm.darken_hsl(img.__wbg_ptr, level);
1453
+ };
1454
+ /**
1455
+ * Darken the image's colours by a specified amount in the HSV colour space.
1456
+ *
1457
+ * # Arguments
1458
+ * * `img` - A PhotonImage.
1459
+ * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
1460
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1461
+ * Darkening by 80% would be represented by a `level` of 0.8
1462
+ *
1463
+ * # Example
1464
+ * ```no_run
1465
+ * // For example to darken an image by 10% in the HSV colour space:
1466
+ * use photon_rs::colour_spaces::darken_hsv;
1467
+ * use photon_rs::native::open_image;
1468
+ *
1469
+ * // Open the image. A PhotonImage is returned.
1470
+ * let mut img = open_image("img.jpg").expect("File should open");
1471
+ * darken_hsv(&mut img, 0.1_f32);
1472
+ * ```
1473
+ * @param {PhotonImage} img
1474
+ * @param {number} level
1475
+ */
1476
+ module.exports.darken_hsv = function(img, level) {
1477
+ _assertClass(img, PhotonImage);
1478
+ wasm.darken_hsv(img.__wbg_ptr, level);
1479
+ };
1480
+ /**
1481
+ * Desaturate the image by a specified amount in the HSV colour space.
1482
+ *
1483
+ * # Arguments
1484
+ * * `img` - A PhotonImage.
1485
+ * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
1486
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1487
+ * Desaturating by 80% would be represented by a `level` of 0.8
1488
+ *
1489
+ * # Example
1490
+ * ```no_run
1491
+ * // For example to desaturate an image by 10% in the HSV colour space:
1492
+ * use photon_rs::colour_spaces::desaturate_hsv;
1493
+ * use photon_rs::native::open_image;
1494
+ *
1495
+ * // Open the image. A PhotonImage is returned.
1496
+ * let mut img = open_image("img.jpg").expect("File should open");
1497
+ * desaturate_hsv(&mut img, 0.1_f32);
1498
+ * ```
1499
+ * @param {PhotonImage} img
1500
+ * @param {number} level
1501
+ */
1502
+ module.exports.desaturate_hsv = function(img, level) {
1503
+ _assertClass(img, PhotonImage);
1504
+ wasm.desaturate_hsv(img.__wbg_ptr, level);
1505
+ };
1506
+ /**
1507
+ * Desaturate the image by a specified amount in the HSL colour space.
1508
+ *
1509
+ * # Arguments
1510
+ * * `img` - A PhotonImage.
1511
+ * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
1512
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1513
+ * Desaturating by 80% would be represented by a `level` of 0.8
1514
+ *
1515
+ * # Example
1516
+ * ```no_run
1517
+ * // For example to desaturate an image by 10% in the LCh colour space:
1518
+ * use photon_rs::colour_spaces::desaturate_hsl;
1519
+ * use photon_rs::native::open_image;
1520
+ *
1521
+ * // Open the image. A PhotonImage is returned.
1522
+ * let mut img = open_image("img.jpg").expect("File should open");
1523
+ * desaturate_hsl(&mut img, 0.1_f32);
1524
+ * ```
1525
+ * @param {PhotonImage} img
1526
+ * @param {number} level
1527
+ */
1528
+ module.exports.desaturate_hsl = function(img, level) {
1529
+ _assertClass(img, PhotonImage);
1530
+ wasm.desaturate_hsl(img.__wbg_ptr, level);
1531
+ };
1532
+ /**
1533
+ * Desaturate the image by a specified amount in the LCh colour space.
1534
+ *
1535
+ * # Arguments
1536
+ * * `img` - A PhotonImage.
1537
+ * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
1538
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1539
+ * Desaturating by 80% would be represented by a `level` of 0.8
1540
+ *
1541
+ * # Example
1542
+ * ```no_run
1543
+ * // For example to desaturate an image by 10% in the LCh colour space:
1544
+ * use photon_rs::colour_spaces::desaturate_lch;
1545
+ * use photon_rs::native::open_image;
1546
+ *
1547
+ * // Open the image. A PhotonImage is returned.
1548
+ * let mut img = open_image("img.jpg").expect("File should open");
1549
+ * desaturate_lch(&mut img, 0.1_f32);
1550
+ * ```
1551
+ * @param {PhotonImage} img
1552
+ * @param {number} level
1553
+ */
1554
+ module.exports.desaturate_lch = function(img, level) {
1555
+ _assertClass(img, PhotonImage);
1556
+ wasm.desaturate_lch(img.__wbg_ptr, level);
1557
+ };
1558
+ /**
1559
+ * Desaturate the image by a specified amount in the HSLuv colour space.
1560
+ *
1561
+ * # Arguments
1562
+ * * `img` - A PhotonImage.
1563
+ * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
1564
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1565
+ * Desaturating by 80% would be represented by a `level` of 0.8
1566
+ *
1567
+ * # Example
1568
+ * ```no_run
1569
+ * // For example to desaturate an image by 10% in the HSLuv colour space:
1570
+ * use photon_rs::colour_spaces::desaturate_hsluv;
1571
+ * use photon_rs::native::open_image;
1572
+ *
1573
+ * // Open the image. A PhotonImage is returned.
1574
+ * let mut img = open_image("img.jpg").expect("File should open");
1575
+ * desaturate_hsluv(&mut img, 0.1_f32);
1576
+ * ```
1577
+ * @param {PhotonImage} img
1578
+ * @param {number} level
1579
+ */
1580
+ module.exports.desaturate_hsluv = function(img, level) {
1581
+ _assertClass(img, PhotonImage);
1582
+ wasm.desaturate_hsluv(img.__wbg_ptr, level);
1583
+ };
1584
+ /**
1585
+ * Mix image with a single color, supporting passing `opacity`.
1586
+ * The algorithm comes from Jimp. See `function mix` and `function colorFn` at following link:
1587
+ * https://github.com/oliver-moran/jimp/blob/29679faa597228ff2f20d34c5758e4d2257065a3/packages/plugin-color/src/index.js
1588
+ * Specifically, result_value = (mix_color_value - origin_value) * opacity + origin_value =
1589
+ * mix_color_value * opacity + (1 - opacity) * origin_value for each
1590
+ * of RGB channel.
1591
+ *
1592
+ * # Arguments
1593
+ * * `photon_image` - A PhotonImage that contains a view into the image.
1594
+ * * `mix_color` - the color to be mixed in, as an RGB value.
1595
+ * * `opacity` - the opacity of color when mixed to image. Float value from 0 to 1.
1596
+ * # Example
1597
+ *
1598
+ * ```no_run
1599
+ * // For example, to mix an image with rgb (50, 255, 254) and opacity 0.4:
1600
+ * use photon_rs::Rgb;
1601
+ * use photon_rs::colour_spaces::mix_with_colour;
1602
+ * use photon_rs::native::open_image;
1603
+ *
1604
+ * let mix_colour = Rgb::new(50_u8, 255_u8, 254_u8);
1605
+ * let mut img = open_image("img.jpg").expect("File should open");
1606
+ * mix_with_colour(&mut img, mix_colour, 0.4_f32);
1607
+ * ```
1608
+ * @param {PhotonImage} photon_image
1609
+ * @param {Rgb} mix_colour
1610
+ * @param {number} opacity
1611
+ */
1612
+ module.exports.mix_with_colour = function(photon_image, mix_colour, opacity) {
1613
+ _assertClass(photon_image, PhotonImage);
1614
+ _assertClass(mix_colour, Rgb);
1615
+ var ptr0 = mix_colour.__destroy_into_raw();
1616
+ wasm.mix_with_colour(photon_image.__wbg_ptr, ptr0, opacity);
1617
+ };
1618
+ /**
1619
+ * Noise reduction.
1620
+ *
1621
+ * # Arguments
1622
+ * * `img` - A PhotonImage.
1623
+ *
1624
+ * # Example
1625
+ *
1626
+ * ```no_run
1627
+ * // For example, to noise reduct an image:
1628
+ * use photon_rs::conv::noise_reduction;
1629
+ * use photon_rs::native::open_image;
1630
+ *
1631
+ * let mut img = open_image("img.jpg").expect("File should open");
1632
+ * noise_reduction(&mut img);
1633
+ * ```
1634
+ * Adds a constant to a select R, G, or B channel's value.
1635
+ * @param {PhotonImage} photon_image
1636
+ */
1637
+ module.exports.noise_reduction = function(photon_image) {
1638
+ _assertClass(photon_image, PhotonImage);
1639
+ wasm.noise_reduction(photon_image.__wbg_ptr);
1640
+ };
1641
+ /**
1642
+ * Sharpen an image.
1643
+ *
1644
+ * # Arguments
1645
+ * * `img` - A PhotonImage.
1646
+ *
1647
+ * # Example
1648
+ *
1649
+ * ```no_run
1650
+ * // For example, to sharpen an image:
1651
+ * use photon_rs::conv::sharpen;
1652
+ * use photon_rs::native::open_image;
1653
+ *
1654
+ * let mut img = open_image("img.jpg").expect("File should open");
1655
+ * sharpen(&mut img);
1656
+ * ```
1657
+ * Adds a constant to a select R, G, or B channel's value.
1658
+ * @param {PhotonImage} photon_image
1659
+ */
1660
+ module.exports.sharpen = function(photon_image) {
1661
+ _assertClass(photon_image, PhotonImage);
1662
+ wasm.sharpen(photon_image.__wbg_ptr);
1663
+ };
1664
+ /**
1665
+ * Apply edge detection to an image, to create a dark version with its edges highlighted.
1666
+ *
1667
+ * # Arguments
1668
+ * * `img` - A PhotonImage.
1669
+ *
1670
+ * # Example
1671
+ *
1672
+ * ```no_run
1673
+ * // For example, to increase the Red channel for all pixels by 10:
1674
+ * use photon_rs::conv::edge_detection;
1675
+ * use photon_rs::native::open_image;
1676
+ *
1677
+ * let mut img = open_image("img.jpg").expect("File should open");
1678
+ * edge_detection(&mut img);
1679
+ * ```
1680
+ * @param {PhotonImage} photon_image
1681
+ */
1682
+ module.exports.edge_detection = function(photon_image) {
1683
+ _assertClass(photon_image, PhotonImage);
1684
+ wasm.edge_detection(photon_image.__wbg_ptr);
1685
+ };
1686
+ /**
1687
+ * Apply an identity kernel convolution to an image.
1688
+ *
1689
+ * # Arguments
1690
+ * * `img` -A PhotonImage.
1691
+ *
1692
+ * # Example
1693
+ *
1694
+ * ```no_run
1695
+ * // For example, to apply an identity kernel convolution:
1696
+ * use photon_rs::conv::identity;
1697
+ * use photon_rs::native::open_image;
1698
+ *
1699
+ * let mut img = open_image("img.jpg").expect("File should open");
1700
+ * identity(&mut img);
1701
+ * ```
1702
+ * @param {PhotonImage} photon_image
1703
+ */
1704
+ module.exports.identity = function(photon_image) {
1705
+ _assertClass(photon_image, PhotonImage);
1706
+ wasm.identity(photon_image.__wbg_ptr);
1707
+ };
1708
+ /**
1709
+ * Apply a box blur effect.
1710
+ *
1711
+ * # Arguments
1712
+ * * `img` - A PhotonImage.
1713
+ *
1714
+ * # Example
1715
+ *
1716
+ * ```no_run
1717
+ * // For example, to apply a box blur effect:
1718
+ * use photon_rs::conv::box_blur;
1719
+ * use photon_rs::native::open_image;
1720
+ *
1721
+ * let mut img = open_image("img.jpg").expect("File should open");
1722
+ * box_blur(&mut img);
1723
+ * ```
1724
+ * @param {PhotonImage} photon_image
1725
+ */
1726
+ module.exports.box_blur = function(photon_image) {
1727
+ _assertClass(photon_image, PhotonImage);
1728
+ wasm.box_blur(photon_image.__wbg_ptr);
1729
+ };
1730
+ /**
1731
+ * Gaussian blur in linear time.
1732
+ *
1733
+ * Reference: http://blog.ivank.net/fastest-gaussian-blur.html
1734
+ *
1735
+ * # Arguments
1736
+ * * `photon_image` - A PhotonImage
1737
+ * * `radius` - blur radius
1738
+ * # Example
1739
+ *
1740
+ * ```no_run
1741
+ * use photon_rs::conv::gaussian_blur;
1742
+ * use photon_rs::native::open_image;
1743
+ *
1744
+ * let mut img = open_image("img.jpg").expect("File should open");
1745
+ * gaussian_blur(&mut img, 3_i32);
1746
+ * ```
1747
+ * @param {PhotonImage} photon_image
1748
+ * @param {number} radius
1749
+ */
1750
+ module.exports.gaussian_blur = function(photon_image, radius) {
1751
+ _assertClass(photon_image, PhotonImage);
1752
+ wasm.gaussian_blur(photon_image.__wbg_ptr, radius);
1753
+ };
1754
+ /**
1755
+ * Detect horizontal lines in an image, and highlight these only.
1756
+ *
1757
+ * # Arguments
1758
+ * * `img` - A PhotonImage.
1759
+ *
1760
+ * # Example
1761
+ *
1762
+ * ```no_run
1763
+ * // For example, to display the horizontal lines in an image:
1764
+ * use photon_rs::conv::detect_horizontal_lines;
1765
+ * use photon_rs::native::open_image;
1766
+ *
1767
+ * let mut img = open_image("img.jpg").expect("File should open");
1768
+ * detect_horizontal_lines(&mut img);
1769
+ * ```
1770
+ * @param {PhotonImage} photon_image
1771
+ */
1772
+ module.exports.detect_horizontal_lines = function(photon_image) {
1773
+ _assertClass(photon_image, PhotonImage);
1774
+ wasm.detect_horizontal_lines(photon_image.__wbg_ptr);
1775
+ };
1776
+ /**
1777
+ * Detect vertical lines in an image, and highlight these only.
1778
+ *
1779
+ * # Arguments
1780
+ * * `img` - A PhotonImage.
1781
+ *
1782
+ * # Example
1783
+ *
1784
+ * ```no_run
1785
+ * // For example, to display the vertical lines in an image:
1786
+ * use photon_rs::conv::detect_vertical_lines;
1787
+ * use photon_rs::native::open_image;
1788
+ *
1789
+ * let mut img = open_image("img.jpg").expect("File should open");
1790
+ * detect_vertical_lines(&mut img);
1791
+ * ```
1792
+ * @param {PhotonImage} photon_image
1793
+ */
1794
+ module.exports.detect_vertical_lines = function(photon_image) {
1795
+ _assertClass(photon_image, PhotonImage);
1796
+ wasm.detect_vertical_lines(photon_image.__wbg_ptr);
1797
+ };
1798
+ /**
1799
+ * Detect lines at a forty five degree angle in an image, and highlight these only.
1800
+ *
1801
+ * # Arguments
1802
+ * * `img` - A PhotonImage.
1803
+ *
1804
+ * # Example
1805
+ *
1806
+ * ```no_run
1807
+ * // For example, to display the lines at a forty five degree angle in an image:
1808
+ * use photon_rs::conv::detect_45_deg_lines;
1809
+ * use photon_rs::native::open_image;
1810
+ *
1811
+ * let mut img = open_image("img.jpg").expect("File should open");
1812
+ * detect_45_deg_lines(&mut img);
1813
+ * ```
1814
+ * @param {PhotonImage} photon_image
1815
+ */
1816
+ module.exports.detect_45_deg_lines = function(photon_image) {
1817
+ _assertClass(photon_image, PhotonImage);
1818
+ wasm.detect_45_deg_lines(photon_image.__wbg_ptr);
1819
+ };
1820
+ /**
1821
+ * Detect lines at a 135 degree angle in an image, and highlight these only.
1822
+ *
1823
+ * # Arguments
1824
+ * * `img` - A PhotonImage.
1825
+ *
1826
+ * # Example
1827
+ *
1828
+ * ```no_run
1829
+ * // For example, to display the lines at a 135 degree angle in an image:
1830
+ * use photon_rs::conv::detect_135_deg_lines;
1831
+ * use photon_rs::native::open_image;
1832
+ *
1833
+ * let mut img = open_image("img.jpg").expect("File should open");
1834
+ * detect_135_deg_lines(&mut img);
1835
+ * ```
1836
+ * @param {PhotonImage} photon_image
1837
+ */
1838
+ module.exports.detect_135_deg_lines = function(photon_image) {
1839
+ _assertClass(photon_image, PhotonImage);
1840
+ wasm.detect_135_deg_lines(photon_image.__wbg_ptr);
1841
+ };
1842
+ /**
1843
+ * Apply a standard laplace convolution.
1844
+ *
1845
+ * # Arguments
1846
+ * * `img` - A PhotonImage.
1847
+ *
1848
+ * # Example
1849
+ *
1850
+ * ```no_run
1851
+ * // For example, to apply a laplace effect:
1852
+ * use photon_rs::conv::laplace;
1853
+ * use photon_rs::native::open_image;
1854
+ *
1855
+ * let mut img = open_image("img.jpg").expect("File should open");
1856
+ * laplace(&mut img);
1857
+ * ```
1858
+ * @param {PhotonImage} photon_image
1859
+ */
1860
+ module.exports.laplace = function(photon_image) {
1861
+ _assertClass(photon_image, PhotonImage);
1862
+ wasm.laplace(photon_image.__wbg_ptr);
1863
+ };
1864
+ /**
1865
+ * Preset edge effect.
1866
+ *
1867
+ * # Arguments
1868
+ * * `img` - A PhotonImage.
1869
+ *
1870
+ * # Example
1871
+ *
1872
+ * ```no_run
1873
+ * // For example, to apply this effect:
1874
+ * use photon_rs::conv::edge_one;
1875
+ * use photon_rs::native::open_image;
1876
+ *
1877
+ * let mut img = open_image("img.jpg").expect("File should open");
1878
+ * edge_one(&mut img);
1879
+ * ```
1880
+ * @param {PhotonImage} photon_image
1881
+ */
1882
+ module.exports.edge_one = function(photon_image) {
1883
+ _assertClass(photon_image, PhotonImage);
1884
+ wasm.edge_one(photon_image.__wbg_ptr);
1885
+ };
1886
+ /**
1887
+ * Apply an emboss effect to an image.
1888
+ *
1889
+ * # Arguments
1890
+ * * `img` - A PhotonImage.
1891
+ *
1892
+ * # Example
1893
+ *
1894
+ * ```no_run
1895
+ * // For example, to apply an emboss effect:
1896
+ * use photon_rs::conv::emboss;
1897
+ * use photon_rs::native::open_image;
1898
+ *
1899
+ * let mut img = open_image("img.jpg").expect("File should open");
1900
+ * emboss(&mut img);
1901
+ * ```
1902
+ * @param {PhotonImage} photon_image
1903
+ */
1904
+ module.exports.emboss = function(photon_image) {
1905
+ _assertClass(photon_image, PhotonImage);
1906
+ wasm.emboss(photon_image.__wbg_ptr);
1907
+ };
1908
+ /**
1909
+ * Apply a horizontal Sobel filter to an image.
1910
+ *
1911
+ * # Arguments
1912
+ * * `img` - A PhotonImage.
1913
+ *
1914
+ * # Example
1915
+ *
1916
+ * ```no_run
1917
+ * // For example, to apply a horizontal Sobel filter:
1918
+ * use photon_rs::conv::sobel_horizontal;
1919
+ * use photon_rs::native::open_image;
1920
+ *
1921
+ * let mut img = open_image("img.jpg").expect("File should open");
1922
+ * sobel_horizontal(&mut img);
1923
+ * ```
1924
+ * @param {PhotonImage} photon_image
1925
+ */
1926
+ module.exports.sobel_horizontal = function(photon_image) {
1927
+ _assertClass(photon_image, PhotonImage);
1928
+ wasm.sobel_horizontal(photon_image.__wbg_ptr);
1929
+ };
1930
+ /**
1931
+ * Apply a horizontal Prewitt convolution to an image.
1932
+ *
1933
+ * # Arguments
1934
+ * * `img` - A PhotonImage.
1935
+ *
1936
+ * # Example
1937
+ *
1938
+ * ```no_run
1939
+ * // For example, to apply a horizontal Prewitt convolution effect:
1940
+ * use photon_rs::conv::prewitt_horizontal;
1941
+ * use photon_rs::native::open_image;
1942
+ *
1943
+ * let mut img = open_image("img.jpg").expect("File should open");
1944
+ * prewitt_horizontal(&mut img);
1945
+ * ```
1946
+ * @param {PhotonImage} photon_image
1947
+ */
1948
+ module.exports.prewitt_horizontal = function(photon_image) {
1949
+ _assertClass(photon_image, PhotonImage);
1950
+ wasm.prewitt_horizontal(photon_image.__wbg_ptr);
1951
+ };
1952
+ /**
1953
+ * Apply a vertical Sobel filter to an image.
1954
+ *
1955
+ * # Arguments
1956
+ * * `img` - A PhotonImage.
1957
+ *
1958
+ * # Example
1959
+ *
1960
+ * ```no_run
1961
+ * // For example, to apply a vertical Sobel filter:
1962
+ * use photon_rs::conv::sobel_vertical;
1963
+ * use photon_rs::native::open_image;
1964
+ *
1965
+ * let mut img = open_image("img.jpg").expect("File should open");
1966
+ * sobel_vertical(&mut img);
1967
+ * ```
1968
+ * @param {PhotonImage} photon_image
1969
+ */
1970
+ module.exports.sobel_vertical = function(photon_image) {
1971
+ _assertClass(photon_image, PhotonImage);
1972
+ wasm.sobel_vertical(photon_image.__wbg_ptr);
1973
+ };
1974
+ /**
1975
+ * Apply a global Sobel filter to an image
1976
+ *
1977
+ * Each pixel is calculated as the magnitude of the horizontal and vertical components of the Sobel filter,
1978
+ * ie if X is the horizontal sobel and Y is the vertical, for each pixel, we calculate sqrt(X^2 + Y^2)
1979
+ *
1980
+ * # Arguments
1981
+ * * `img` - A PhotonImage.
1982
+ *
1983
+ * # Example
1984
+ *
1985
+ * ```no_run
1986
+ * // For example, to apply a global Sobel filter:
1987
+ * use photon_rs::conv::sobel_global;
1988
+ * use photon_rs::native::open_image;
1989
+ *
1990
+ * let mut img = open_image("img.jpg").expect("File should open");
1991
+ * sobel_global(&mut img);
1992
+ * ```
1993
+ * @param {PhotonImage} photon_image
1994
+ */
1995
+ module.exports.sobel_global = function(photon_image) {
1996
+ _assertClass(photon_image, PhotonImage);
1997
+ wasm.sobel_global(photon_image.__wbg_ptr);
1998
+ };
1999
+ /**
2000
+ * Add randomized noise to an image.
2001
+ * This function adds a Gaussian Noise Sample to each pixel through incrementing each channel by a randomized offset.
2002
+ * This randomized offset is generated by creating a randomized thread pool.
2003
+ * **[WASM SUPPORT IS AVAILABLE]**: Randomized thread pools cannot be created with WASM, but
2004
+ * a workaround using js_sys::Math::random works now.
2005
+ * # Arguments
2006
+ * * `img` - A PhotonImage.
2007
+ *
2008
+ * # Example
2009
+ *
2010
+ * ```no_run
2011
+ * // For example:
2012
+ * use photon_rs::native::open_image;
2013
+ * use photon_rs::noise::add_noise_rand;
2014
+ * use photon_rs::PhotonImage;
2015
+ *
2016
+ * let mut img = open_image("img.jpg").expect("File should open");
2017
+ * add_noise_rand(&mut img);
2018
+ * ```
2019
+ * @param {PhotonImage} photon_image
2020
+ */
2021
+ module.exports.add_noise_rand = function(photon_image) {
2022
+ _assertClass(photon_image, PhotonImage);
2023
+ wasm.add_noise_rand(photon_image.__wbg_ptr);
2024
+ };
2025
+ /**
2026
+ * Add pink-tinted noise to an image.
2027
+ *
2028
+ * **[WASM SUPPORT IS AVAILABLE]**: Randomized thread pools cannot be created with WASM, but
2029
+ * a workaround using js_sys::Math::random works now.
2030
+ * # Arguments
2031
+ * * `name` - A PhotonImage that contains a view into the image.
2032
+ *
2033
+ * # Example
2034
+ *
2035
+ * ```no_run
2036
+ * // For example, to add pink-tinted noise to an image:
2037
+ * use photon_rs::native::open_image;
2038
+ * use photon_rs::noise::pink_noise;
2039
+ *
2040
+ * let mut img = open_image("img.jpg").expect("File should open");
2041
+ * pink_noise(&mut img);
2042
+ * ```
2043
+ * @param {PhotonImage} photon_image
2044
+ */
2045
+ module.exports.pink_noise = function(photon_image) {
2046
+ _assertClass(photon_image, PhotonImage);
2047
+ wasm.pink_noise(photon_image.__wbg_ptr);
2048
+ };
2049
+ /**
2050
+ * Add a watermark to an image.
2051
+ *
2052
+ * # Arguments
2053
+ * * `img` - A DynamicImage that contains a view into the image.
2054
+ * * `watermark` - The watermark to be placed onto the `img` image.
2055
+ * * `x` - The x coordinate where the watermark's top corner should be positioned.
2056
+ * * `y` - The y coordinate where the watermark's top corner should be positioned.
2057
+ * # Example
2058
+ *
2059
+ * ```no_run
2060
+ * // For example, to add a watermark to an image at x: 30, y: 40:
2061
+ * use photon_rs::multiple::watermark;
2062
+ * use photon_rs::native::open_image;
2063
+ *
2064
+ * let mut img = open_image("img.jpg").expect("File should open");
2065
+ * let water_mark = open_image("watermark.jpg").expect("File should open");
2066
+ * watermark(&mut img, &water_mark, 30_i64, 40_i64);
2067
+ * ```
2068
+ * @param {PhotonImage} img
2069
+ * @param {PhotonImage} watermark
2070
+ * @param {bigint} x
2071
+ * @param {bigint} y
2072
+ */
2073
+ module.exports.watermark = function(img, watermark, x, y) {
2074
+ _assertClass(img, PhotonImage);
2075
+ _assertClass(watermark, PhotonImage);
2076
+ wasm.watermark(img.__wbg_ptr, watermark.__wbg_ptr, x, y);
2077
+ };
2078
+ /**
2079
+ * Blend two images together.
2080
+ *
2081
+ * The `blend_mode` (3rd param) determines which blending mode to use; change this for varying effects.
2082
+ * The blend modes available include: `overlay`, `over`, `atop`, `xor`, `plus`, `multiply`, `burn`,
2083
+ * `difference`, `soft_light`, `screen`, `hard_light`, `dodge`, `exclusion`, `lighten`, `darken` (more to come)
2084
+ * NOTE: The first image must be smaller than the second image passed as params.
2085
+ * If the first image were larger than the second, then there would be overflowing pixels which would have no corresponding pixels
2086
+ * in the second image.
2087
+ * # Arguments
2088
+ * * `img` - A DynamicImage that contains a view into the image.
2089
+ * * `img2` - The 2nd DynamicImage to be blended with the first.
2090
+ * * `blend_mode` - The blending mode to use. See above for complete list of blend modes available.
2091
+ * # Example
2092
+ *
2093
+ * ```no_run
2094
+ * // For example, to blend two images with the `multiply` blend mode:
2095
+ * use photon_rs::multiple::blend;
2096
+ * use photon_rs::native::open_image;
2097
+ *
2098
+ * let mut img = open_image("img.jpg").expect("File should open");
2099
+ * let img2 = open_image("img2.jpg").expect("File should open");
2100
+ * blend(&mut img, &img2, "multiply");
2101
+ * ```
2102
+ * @param {PhotonImage} photon_image
2103
+ * @param {PhotonImage} photon_image2
2104
+ * @param {string} blend_mode
2105
+ */
2106
+ module.exports.blend = function(photon_image, photon_image2, blend_mode) {
2107
+ _assertClass(photon_image, PhotonImage);
2108
+ _assertClass(photon_image2, PhotonImage);
2109
+ const ptr0 = passStringToWasm0(blend_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2110
+ const len0 = WASM_VECTOR_LEN;
2111
+ wasm.blend(photon_image.__wbg_ptr, photon_image2.__wbg_ptr, ptr0, len0);
2112
+ };
2113
+ /**
2114
+ * @param {number} width
2115
+ * @param {number} height
2116
+ * @returns {PhotonImage}
2117
+ */
2118
+ module.exports.create_gradient = function(width, height) {
2119
+ const ret = wasm.create_gradient(width, height);
2120
+ return PhotonImage.__wrap(ret);
2121
+ };
2122
+ /**
2123
+ * Apply a gradient to an image.
2124
+ * @param {PhotonImage} image
2125
+ */
2126
+ module.exports.apply_gradient = function(image) {
2127
+ _assertClass(image, PhotonImage);
2128
+ wasm.apply_gradient(image.__wbg_ptr);
2129
+ };
2130
+ /**
2131
+ * Solarization on the Blue channel.
2132
+ *
2133
+ * # Arguments
2134
+ * * `img` - A PhotonImage.
2135
+ * # Example
2136
+ *
2137
+ * ```no_run
2138
+ * use photon_rs::filters::neue;
2139
+ * use photon_rs::native::open_image;
2140
+ *
2141
+ * let mut img = open_image("img.jpg").expect("File should open");
2142
+ * neue(&mut img);
2143
+ * ```
2144
+ * @param {PhotonImage} photon_image
2145
+ */
2146
+ module.exports.neue = function(photon_image) {
2147
+ _assertClass(photon_image, PhotonImage);
2148
+ wasm.neue(photon_image.__wbg_ptr);
2149
+ };
2150
+ /**
2151
+ * Solarization on the Red and Green channels.
2152
+ *
2153
+ * # Arguments
2154
+ * * `img` - A PhotonImage.
2155
+ * # Example
2156
+ *
2157
+ * ```no_run
2158
+ * use photon_rs::filters::lix;
2159
+ * use photon_rs::native::open_image;
2160
+ *
2161
+ * let mut img = open_image("img.jpg").expect("File should open");
2162
+ * lix(&mut img);
2163
+ * ```
2164
+ * @param {PhotonImage} photon_image
2165
+ */
2166
+ module.exports.lix = function(photon_image) {
2167
+ _assertClass(photon_image, PhotonImage);
2168
+ wasm.lix(photon_image.__wbg_ptr);
2169
+ };
2170
+ /**
2171
+ * Solarization on the Red and Blue channels.
2172
+ *
2173
+ * # Arguments
2174
+ * * `img` - A PhotonImage.
2175
+ * # Example
2176
+ *
2177
+ * ```no_run
2178
+ * use photon_rs::filters::ryo;
2179
+ * use photon_rs::native::open_image;
2180
+ *
2181
+ * let mut img = open_image("img.jpg").expect("File should open");
2182
+ * ryo(&mut img);
2183
+ * ```
2184
+ * @param {PhotonImage} photon_image
2185
+ */
2186
+ module.exports.ryo = function(photon_image) {
2187
+ _assertClass(photon_image, PhotonImage);
2188
+ wasm.ryo(photon_image.__wbg_ptr);
2189
+ };
2190
+ /**
2191
+ * Apply a filter to an image. Over 20 filters are available.
2192
+ * The filters are as follows:
2193
+ * * **oceanic**: Add an aquamarine-tinted hue to an image.
2194
+ * * **islands**: Aquamarine tint.
2195
+ * * **marine**: Add a green/blue mixed hue to an image.
2196
+ * * **seagreen**: Dark green hue, with tones of blue.
2197
+ * * **flagblue**: Royal blue tint
2198
+ * * **liquid**: Blue-inspired tint.
2199
+ * * **diamante**: Custom filter with a blue/turquoise tint.
2200
+ * * **radio**: Fallout-style radio effect.
2201
+ * * **twenties**: Slight-blue tinted historical effect.
2202
+ * * **rosetint**: Rose-tinted filter.
2203
+ * * **mauve**: Purple-infused filter.
2204
+ * * **bluechrome**: Blue monochrome effect.
2205
+ * * **vintage**: Vintage filter with a red tint.
2206
+ * * **perfume**: Increase the blue channel, with moderate increases in the Red and Green channels.
2207
+ * * **serenity**: Custom filter with an increase in the Blue channel's values.
2208
+ * # Arguments
2209
+ * * `img` - A PhotonImage.
2210
+ * * `filter_name` - The filter's name. Choose from the selection above, eg: "oceanic"
2211
+ * # Example
2212
+ *
2213
+ * ```no_run
2214
+ * // For example, to add a filter called "vintage" to an image:
2215
+ * use photon_rs::filters::filter;
2216
+ * use photon_rs::native::open_image;
2217
+ *
2218
+ * let mut img = open_image("img.jpg").expect("File should open");
2219
+ * filter(&mut img, "vintage");
2220
+ * ```
2221
+ * @param {PhotonImage} img
2222
+ * @param {string} filter_name
2223
+ */
2224
+ module.exports.filter = function(img, filter_name) {
2225
+ _assertClass(img, PhotonImage);
2226
+ const ptr0 = passStringToWasm0(filter_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2227
+ const len0 = WASM_VECTOR_LEN;
2228
+ wasm.filter(img.__wbg_ptr, ptr0, len0);
2229
+ };
2230
+ /**
2231
+ * Apply a lofi effect to an image.
2232
+ *
2233
+ * # Arguments
2234
+ * * `img` - A PhotonImage.
2235
+ * # Example
2236
+ *
2237
+ * ```no_run
2238
+ * use photon_rs::filters::lofi;
2239
+ * use photon_rs::native::open_image;
2240
+ *
2241
+ * let mut img = open_image("img.jpg").expect("File should open");
2242
+ * lofi(&mut img);
2243
+ * ```
2244
+ * @param {PhotonImage} img
2245
+ */
2246
+ module.exports.lofi = function(img) {
2247
+ _assertClass(img, PhotonImage);
2248
+ wasm.lofi(img.__wbg_ptr);
2249
+ };
2250
+ /**
2251
+ * Apply a rose tint to an image.
2252
+ *
2253
+ * # Arguments
2254
+ * * `img` - A PhotonImage.
2255
+ * # Example
2256
+ *
2257
+ * ```no_run
2258
+ * use photon_rs::filters::pastel_pink;
2259
+ * use photon_rs::native::open_image;
2260
+ *
2261
+ * let mut img = open_image("img.jpg").expect("File should open");
2262
+ * pastel_pink(&mut img);
2263
+ * ```
2264
+ * @param {PhotonImage} img
2265
+ */
2266
+ module.exports.pastel_pink = function(img) {
2267
+ _assertClass(img, PhotonImage);
2268
+ wasm.pastel_pink(img.__wbg_ptr);
2269
+ };
2270
+ /**
2271
+ * Apply a vintage, golden hue to an image.
2272
+ *
2273
+ * # Arguments
2274
+ * * `img` - A PhotonImage.
2275
+ * # Example
2276
+ *
2277
+ * ```no_run
2278
+ * use photon_rs::filters::golden;
2279
+ * use photon_rs::native::open_image;
2280
+ *
2281
+ * let mut img = open_image("img.jpg").expect("File should open");
2282
+ * golden(&mut img);
2283
+ * ```
2284
+ * @param {PhotonImage} img
2285
+ */
2286
+ module.exports.golden = function(img) {
2287
+ _assertClass(img, PhotonImage);
2288
+ wasm.golden(img.__wbg_ptr);
2289
+ };
2290
+ /**
2291
+ * Increased contrast filter effect.
2292
+ *
2293
+ * # Arguments
2294
+ * * `img` - A PhotonImage.
2295
+ * # Example
2296
+ *
2297
+ * ```no_run
2298
+ * use photon_rs::filters::cali;
2299
+ * use photon_rs::native::open_image;
2300
+ *
2301
+ * let mut img = open_image("img.jpg").expect("File should open");
2302
+ * cali(&mut img);
2303
+ * ```
2304
+ * @param {PhotonImage} img
2305
+ */
2306
+ module.exports.cali = function(img) {
2307
+ _assertClass(img, PhotonImage);
2308
+ wasm.cali(img.__wbg_ptr);
2309
+ };
2310
+ /**
2311
+ * Greyscale effect with increased contrast.
2312
+ *
2313
+ * # Arguments
2314
+ * * `img` - A PhotonImage.
2315
+ * # Example
2316
+ *
2317
+ * ```no_run
2318
+ * use photon_rs::filters::dramatic;
2319
+ * use photon_rs::native::open_image;
2320
+ *
2321
+ * let mut img = open_image("img.jpg").expect("File should open");
2322
+ * dramatic(&mut img);
2323
+ * ```
2324
+ * @param {PhotonImage} img
2325
+ */
2326
+ module.exports.dramatic = function(img) {
2327
+ _assertClass(img, PhotonImage);
2328
+ wasm.dramatic(img.__wbg_ptr);
2329
+ };
2330
+ /**
2331
+ * Monochrome tint effect with increased contrast
2332
+ *
2333
+ * # Arguments
2334
+ * * `img` - A PhotonImage.
2335
+ * * `rgb_color` - RGB color
2336
+ * # Example
2337
+ *
2338
+ * ```no_run
2339
+ * use photon_rs::filters::monochrome_tint;
2340
+ * use photon_rs::native::open_image;
2341
+ * use photon_rs::Rgb;
2342
+ *
2343
+ * let mut img = open_image("img.jpg").expect("File should open");
2344
+ * let rgb_color = Rgb::new(12, 12, 10);
2345
+ * monochrome_tint(&mut img, rgb_color);
2346
+ * ```
2347
+ * @param {PhotonImage} img
2348
+ * @param {Rgb} rgb_color
2349
+ */
2350
+ module.exports.monochrome_tint = function(img, rgb_color) {
2351
+ _assertClass(img, PhotonImage);
2352
+ _assertClass(rgb_color, Rgb);
2353
+ var ptr0 = rgb_color.__destroy_into_raw();
2354
+ wasm.monochrome_tint(img.__wbg_ptr, ptr0);
2355
+ };
2356
+ /**
2357
+ * Duotone effect with blue and purple tones.
2358
+ *
2359
+ * # Arguments
2360
+ * * `img` - A PhotonImage.
2361
+ * # Example
2362
+ *
2363
+ * ```no_run
2364
+ * use photon_rs::filters::duotone_violette;
2365
+ * use photon_rs::native::open_image;
2366
+ *
2367
+ * let mut img = open_image("img.jpg").expect("File should open");
2368
+ * duotone_violette(&mut img);
2369
+ * ```
2370
+ * @param {PhotonImage} img
2371
+ */
2372
+ module.exports.duotone_violette = function(img) {
2373
+ _assertClass(img, PhotonImage);
2374
+ wasm.duotone_violette(img.__wbg_ptr);
2375
+ };
2376
+ /**
2377
+ * Duotone effect with purple tones.
2378
+ *
2379
+ * # Arguments
2380
+ * * `img` - A PhotonImage.
2381
+ * # Example
2382
+ *
2383
+ * ```no_run
2384
+ * use photon_rs::filters::duotone_horizon;
2385
+ * use photon_rs::native::open_image;
2386
+ *
2387
+ * let mut img = open_image("img.jpg").expect("File should open");
2388
+ * duotone_horizon(&mut img);
2389
+ * ```
2390
+ * @param {PhotonImage} img
2391
+ */
2392
+ module.exports.duotone_horizon = function(img) {
2393
+ _assertClass(img, PhotonImage);
2394
+ wasm.duotone_horizon(img.__wbg_ptr);
2395
+ };
2396
+ /**
2397
+ * A duotone filter with a user-specified color and a gray color
2398
+ *
2399
+ * # Arguments
2400
+ * * `img` - A PhotonImage.
2401
+ * * `rgb_color` - RGB color
2402
+ * # Example
2403
+ *
2404
+ * ```no_run
2405
+ * use photon_rs::filters::duotone_tint;
2406
+ * use photon_rs::native::open_image;
2407
+ * use photon_rs::Rgb;
2408
+ *
2409
+ * let mut img = open_image("img.jpg").expect("File should open");
2410
+ * let rgb_color = Rgb::new(12, 12, 10);
2411
+ * duotone_tint(&mut img, rgb_color);
2412
+ * ```
2413
+ * @param {PhotonImage} img
2414
+ * @param {Rgb} rgb_color
2415
+ */
2416
+ module.exports.duotone_tint = function(img, rgb_color) {
2417
+ _assertClass(img, PhotonImage);
2418
+ _assertClass(rgb_color, Rgb);
2419
+ var ptr0 = rgb_color.__destroy_into_raw();
2420
+ wasm.duotone_tint(img.__wbg_ptr, ptr0);
2421
+ };
2422
+ /**
2423
+ * Duotone effect with a lilac hue
2424
+ *
2425
+ * # Arguments
2426
+ * * `img` - A PhotonImage.
2427
+ * # Example
2428
+ *
2429
+ * ```no_run
2430
+ * use photon_rs::filters::duotone_lilac;
2431
+ * use photon_rs::native::open_image;
2432
+ *
2433
+ * let mut img = open_image("img.jpg").expect("File should open");
2434
+ * duotone_lilac(&mut img);
2435
+ * ```
2436
+ * @param {PhotonImage} img
2437
+ */
2438
+ module.exports.duotone_lilac = function(img) {
2439
+ _assertClass(img, PhotonImage);
2440
+ wasm.duotone_lilac(img.__wbg_ptr);
2441
+ };
2442
+ /**
2443
+ * A duotone ochre tint effect
2444
+ *
2445
+ * # Arguments
2446
+ * * `img` - A PhotonImage.
2447
+ * # Example
2448
+ *
2449
+ * ```no_run
2450
+ * use photon_rs::filters::duotone_ochre;
2451
+ * use photon_rs::native::open_image;
2452
+ *
2453
+ * let mut img = open_image("img.jpg").expect("File should open");
2454
+ * duotone_ochre(&mut img);
2455
+ * ```
2456
+ * @param {PhotonImage} img
2457
+ */
2458
+ module.exports.duotone_ochre = function(img) {
2459
+ _assertClass(img, PhotonImage);
2460
+ wasm.duotone_ochre(img.__wbg_ptr);
2461
+ };
2462
+ /**
2463
+ * Apply a red hue, with increased contrast and brightness.
2464
+ *
2465
+ * # Arguments
2466
+ * * `img` - A PhotonImage.
2467
+ * # Example
2468
+ *
2469
+ * ```no_run
2470
+ * use photon_rs::filters::firenze;
2471
+ * use photon_rs::native::open_image;
2472
+ *
2473
+ * let mut img = open_image("img.jpg").expect("File should open");
2474
+ * firenze(&mut img);
2475
+ * ```
2476
+ * @param {PhotonImage} img
2477
+ */
2478
+ module.exports.firenze = function(img) {
2479
+ _assertClass(img, PhotonImage);
2480
+ wasm.firenze(img.__wbg_ptr);
2481
+ };
2482
+ /**
2483
+ * Apply a greyscale effect with increased contrast.
2484
+ *
2485
+ * # Arguments
2486
+ * * `img` - A PhotonImage.
2487
+ * # Example
2488
+ *
2489
+ * ```no_run
2490
+ * use photon_rs::filters::obsidian;
2491
+ * use photon_rs::native::open_image;
2492
+ *
2493
+ * let mut img = open_image("img.jpg").expect("File should open");
2494
+ * obsidian(&mut img);
2495
+ * ```
2496
+ * @param {PhotonImage} img
2497
+ */
2498
+ module.exports.obsidian = function(img) {
2499
+ _assertClass(img, PhotonImage);
2500
+ wasm.obsidian(img.__wbg_ptr);
2501
+ };
2502
+ /**
2503
+ * Crop an image.
2504
+ *
2505
+ * # Arguments
2506
+ * * `img` - A PhotonImage.
2507
+ *
2508
+ * # Example
2509
+ *
2510
+ * ```no_run
2511
+ * // For example, to crop an image at (0, 0) to (500, 800)
2512
+ * use photon_rs::native::{open_image};
2513
+ * use photon_rs::transform::crop;
2514
+ * use photon_rs::PhotonImage;
2515
+ *
2516
+ * let mut img = open_image("img.jpg").expect("File should open");
2517
+ * let cropped_img: PhotonImage = crop(&img, 0_u32, 0_u32, 500_u32, 800_u32);
2518
+ * // Write the contents of this image in JPG format.
2519
+ * ```
2520
+ * @param {PhotonImage} photon_image
2521
+ * @param {number} x1
2522
+ * @param {number} y1
2523
+ * @param {number} x2
2524
+ * @param {number} y2
2525
+ * @returns {PhotonImage}
2526
+ */
2527
+ module.exports.crop = function(photon_image, x1, y1, x2, y2) {
2528
+ _assertClass(photon_image, PhotonImage);
2529
+ const ret = wasm.crop(photon_image.__wbg_ptr, x1, y1, x2, y2);
2530
+ return PhotonImage.__wrap(ret);
2531
+ };
2532
+ /**
2533
+ * @param {HTMLCanvasElement} source_canvas
2534
+ * @param {number} width
2535
+ * @param {number} height
2536
+ * @param {number} left
2537
+ * @param {number} top
2538
+ * @returns {HTMLCanvasElement}
2539
+ */
2540
+ module.exports.crop_img_browser = function(source_canvas, width, height, left, top) {
2541
+ return wasm.crop_img_browser(source_canvas, width, height, left, top);
2542
+ };
2543
+ /**
2544
+ * Flip an image horizontally.
2545
+ *
2546
+ * # Arguments
2547
+ * * `img` - A PhotonImage.
2548
+ *
2549
+ * # Example
2550
+ *
2551
+ * ```no_run
2552
+ * // For example, to flip an image horizontally:
2553
+ * use photon_rs::native::open_image;
2554
+ * use photon_rs::transform::fliph;
2555
+ *
2556
+ * let mut img = open_image("img.jpg").expect("File should open");
2557
+ * fliph(&mut img);
2558
+ * ```
2559
+ * @param {PhotonImage} photon_image
2560
+ */
2561
+ module.exports.fliph = function(photon_image) {
2562
+ _assertClass(photon_image, PhotonImage);
2563
+ wasm.fliph(photon_image.__wbg_ptr);
2564
+ };
2565
+ /**
2566
+ * Flip an image vertically.
2567
+ *
2568
+ * # Arguments
2569
+ * * `img` - A PhotonImage.
2570
+ *
2571
+ * # Example
2572
+ *
2573
+ * ```no_run
2574
+ * // For example, to flip an image vertically:
2575
+ * use photon_rs::native::open_image;
2576
+ * use photon_rs::transform::flipv;
2577
+ *
2578
+ * let mut img = open_image("img.jpg").expect("File should open");
2579
+ * flipv(&mut img);
2580
+ * ```
2581
+ * @param {PhotonImage} photon_image
2582
+ */
2583
+ module.exports.flipv = function(photon_image) {
2584
+ _assertClass(photon_image, PhotonImage);
2585
+ wasm.flipv(photon_image.__wbg_ptr);
2586
+ };
2587
+ /**
2588
+ * Resize an image on the web.
2589
+ *
2590
+ * # Arguments
2591
+ * * `img` - A PhotonImage.
2592
+ * * `width` - New width.
2593
+ * * `height` - New height.
2594
+ * * `sampling_filter` - Nearest = 1, Triangle = 2, CatmullRom = 3, Gaussian = 4, Lanczos3 = 5
2595
+ * @param {PhotonImage} photon_img
2596
+ * @param {number} width
2597
+ * @param {number} height
2598
+ * @param {SamplingFilter} sampling_filter
2599
+ * @returns {HTMLCanvasElement}
2600
+ */
2601
+ module.exports.resize_img_browser = function(photon_img, width, height, sampling_filter) {
2602
+ _assertClass(photon_img, PhotonImage);
2603
+ return wasm.resize_img_browser(photon_img.__wbg_ptr, width, height, sampling_filter);
2604
+ };
2605
+ /**
2606
+ * Resize an image.
2607
+ *
2608
+ * # Arguments
2609
+ * * `img` - A PhotonImage.
2610
+ * * `width` - New width.
2611
+ * * `height` - New height.
2612
+ * * `sampling_filter` - Nearest = 1, Triangle = 2, CatmullRom = 3, Gaussian = 4, Lanczos3 = 5
2613
+ * @param {PhotonImage} photon_img
2614
+ * @param {number} width
2615
+ * @param {number} height
2616
+ * @param {SamplingFilter} sampling_filter
2617
+ * @returns {PhotonImage}
2618
+ */
2619
+ module.exports.resize = function(photon_img, width, height, sampling_filter) {
2620
+ _assertClass(photon_img, PhotonImage);
2621
+ const ret = wasm.resize(photon_img.__wbg_ptr, width, height, sampling_filter);
2622
+ return PhotonImage.__wrap(ret);
2623
+ };
2624
+ /**
2625
+ * Resize image using seam carver.
2626
+ * Resize only if new dimensions are smaller, than original image.
2627
+ * # NOTE: This is still experimental feature, and pretty slow.
2628
+ *
2629
+ * # Arguments
2630
+ * * `img` - A PhotonImage.
2631
+ * * `width` - New width.
2632
+ * * `height` - New height.
2633
+ *
2634
+ * # Example
2635
+ *
2636
+ * ```no_run
2637
+ * // For example, resize image using seam carver:
2638
+ * use photon_rs::native::open_image;
2639
+ * use photon_rs::transform::seam_carve;
2640
+ * use photon_rs::PhotonImage;
2641
+ *
2642
+ * let img = open_image("img.jpg").expect("File should open");
2643
+ * let result: PhotonImage = seam_carve(&img, 100_u32, 100_u32);
2644
+ * ```
2645
+ * @param {PhotonImage} img
2646
+ * @param {number} width
2647
+ * @param {number} height
2648
+ * @returns {PhotonImage}
2649
+ */
2650
+ module.exports.seam_carve = function(img, width, height) {
2651
+ _assertClass(img, PhotonImage);
2652
+ const ret = wasm.seam_carve(img.__wbg_ptr, width, height);
2653
+ return PhotonImage.__wrap(ret);
2654
+ };
2655
+ /**
2656
+ * Shear the image along the X axis.
2657
+ * A sheared PhotonImage is returned.
2658
+ *
2659
+ * # Arguments
2660
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2661
+ * * `shear` - Amount to shear.
2662
+ *
2663
+ * # Example
2664
+ *
2665
+ * ```no_run
2666
+ * // For example, to shear an image by 0.5:
2667
+ * use photon_rs::native::open_image;
2668
+ * use photon_rs::transform::shearx;
2669
+ *
2670
+ * let img = open_image("img.jpg").expect("File should open");
2671
+ * let sheared_img = shearx(&img, 0.5);
2672
+ * ```
2673
+ * @param {PhotonImage} photon_img
2674
+ * @param {number} shear
2675
+ * @returns {PhotonImage}
2676
+ */
2677
+ module.exports.shearx = function(photon_img, shear) {
2678
+ _assertClass(photon_img, PhotonImage);
2679
+ const ret = wasm.shearx(photon_img.__wbg_ptr, shear);
2680
+ return PhotonImage.__wrap(ret);
2681
+ };
2682
+ /**
2683
+ * Shear the image along the Y axis.
2684
+ * A sheared PhotonImage is returned.
2685
+ *
2686
+ * # Arguments
2687
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2688
+ * * `shear` - Amount to shear.
2689
+ *
2690
+ * # Example
2691
+ *
2692
+ * ```no_run
2693
+ * // For example, to shear an image by 0.5:
2694
+ * use photon_rs::native::open_image;
2695
+ * use photon_rs::transform::sheary;
2696
+ *
2697
+ * let img = open_image("img.jpg").expect("File should open");
2698
+ * let sheared_img = sheary(&img, 0.5);
2699
+ * ```
2700
+ * @param {PhotonImage} photon_img
2701
+ * @param {number} shear
2702
+ * @returns {PhotonImage}
2703
+ */
2704
+ module.exports.sheary = function(photon_img, shear) {
2705
+ _assertClass(photon_img, PhotonImage);
2706
+ const ret = wasm.sheary(photon_img.__wbg_ptr, shear);
2707
+ return PhotonImage.__wrap(ret);
2708
+ };
2709
+ /**
2710
+ * Apply uniform padding around the PhotonImage
2711
+ * A padded PhotonImage is returned.
2712
+ * # Arguments
2713
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2714
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2715
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2716
+ *
2717
+ * # Example
2718
+ *
2719
+ * ```no_run
2720
+ * // For example, to apply a padding of 10 pixels around a PhotonImage:
2721
+ * use photon_rs::transform::padding_uniform;
2722
+ * use photon_rs::native::open_image;
2723
+ * use photon_rs::Rgba;
2724
+ *
2725
+ * let mut img = open_image("img.jpg").expect("File should open");
2726
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2727
+ * padding_uniform(&img, 10_u32, rgba);
2728
+ * ```
2729
+ * @param {PhotonImage} img
2730
+ * @param {number} padding
2731
+ * @param {Rgba} padding_rgba
2732
+ * @returns {PhotonImage}
2733
+ */
2734
+ module.exports.padding_uniform = function(img, padding, padding_rgba) {
2735
+ _assertClass(img, PhotonImage);
2736
+ _assertClass(padding_rgba, Rgba);
2737
+ var ptr0 = padding_rgba.__destroy_into_raw();
2738
+ const ret = wasm.padding_uniform(img.__wbg_ptr, padding, ptr0);
2739
+ return PhotonImage.__wrap(ret);
2740
+ };
2741
+ /**
2742
+ * Apply padding on the left side of the PhotonImage
2743
+ * A padded PhotonImage is returned.
2744
+ * # Arguments
2745
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2746
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2747
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2748
+ *
2749
+ * # Example
2750
+ *
2751
+ * ```no_run
2752
+ * // For example, to apply a padding of 10 pixels on the left side of a PhotonImage:
2753
+ * use photon_rs::transform::padding_left;
2754
+ * use photon_rs::native::open_image;
2755
+ * use photon_rs::Rgba;
2756
+ *
2757
+ * let mut img = open_image("img.jpg").expect("File should open");
2758
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2759
+ * padding_left(&img, 10_u32, rgba);
2760
+ * ```
2761
+ * @param {PhotonImage} img
2762
+ * @param {number} padding
2763
+ * @param {Rgba} padding_rgba
2764
+ * @returns {PhotonImage}
2765
+ */
2766
+ module.exports.padding_left = function(img, padding, padding_rgba) {
2767
+ _assertClass(img, PhotonImage);
2768
+ _assertClass(padding_rgba, Rgba);
2769
+ var ptr0 = padding_rgba.__destroy_into_raw();
2770
+ const ret = wasm.padding_left(img.__wbg_ptr, padding, ptr0);
2771
+ return PhotonImage.__wrap(ret);
2772
+ };
2773
+ /**
2774
+ * Apply padding on the left side of the PhotonImage
2775
+ * A padded PhotonImage is returned.
2776
+ * # Arguments
2777
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2778
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2779
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2780
+ *
2781
+ * # Example
2782
+ *
2783
+ * ```no_run
2784
+ * // For example, to apply a padding of 10 pixels on the right side of a PhotonImage:
2785
+ * use photon_rs::transform::padding_right;
2786
+ * use photon_rs::native::open_image;
2787
+ * use photon_rs::Rgba;
2788
+ *
2789
+ * let mut img = open_image("img.jpg").expect("File should open");
2790
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2791
+ * padding_right(&img, 10_u32, rgba);
2792
+ * ```
2793
+ * @param {PhotonImage} img
2794
+ * @param {number} padding
2795
+ * @param {Rgba} padding_rgba
2796
+ * @returns {PhotonImage}
2797
+ */
2798
+ module.exports.padding_right = function(img, padding, padding_rgba) {
2799
+ _assertClass(img, PhotonImage);
2800
+ _assertClass(padding_rgba, Rgba);
2801
+ var ptr0 = padding_rgba.__destroy_into_raw();
2802
+ const ret = wasm.padding_right(img.__wbg_ptr, padding, ptr0);
2803
+ return PhotonImage.__wrap(ret);
2804
+ };
2805
+ /**
2806
+ * Apply padding on the left side of the PhotonImage
2807
+ * A padded PhotonImage is returned.
2808
+ * # Arguments
2809
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2810
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2811
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2812
+ *
2813
+ * # Example
2814
+ *
2815
+ * ```no_run
2816
+ * // For example, to apply a padding of 10 pixels on the top of a PhotonImage:
2817
+ * use photon_rs::transform::padding_top;
2818
+ * use photon_rs::native::open_image;
2819
+ * use photon_rs::Rgba;
2820
+ *
2821
+ * let mut img = open_image("img.jpg").expect("File should open");
2822
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2823
+ * padding_top(&img, 10_u32, rgba);
2824
+ * ```
2825
+ * @param {PhotonImage} img
2826
+ * @param {number} padding
2827
+ * @param {Rgba} padding_rgba
2828
+ * @returns {PhotonImage}
2829
+ */
2830
+ module.exports.padding_top = function(img, padding, padding_rgba) {
2831
+ _assertClass(img, PhotonImage);
2832
+ _assertClass(padding_rgba, Rgba);
2833
+ var ptr0 = padding_rgba.__destroy_into_raw();
2834
+ const ret = wasm.padding_top(img.__wbg_ptr, padding, ptr0);
2835
+ return PhotonImage.__wrap(ret);
2836
+ };
2837
+ /**
2838
+ * Apply padding on the left side of the PhotonImage
2839
+ * A padded PhotonImage is returned.
2840
+ * # Arguments
2841
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2842
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2843
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2844
+ *
2845
+ * # Example
2846
+ *
2847
+ * ```no_run
2848
+ * // For example, to apply a padding of 10 pixels on the bottom of a PhotonImage:
2849
+ * use photon_rs::transform::padding_bottom;
2850
+ * use photon_rs::native::open_image;
2851
+ * use photon_rs::Rgba;
2852
+ *
2853
+ * let mut img = open_image("img.jpg").expect("File should open");
2854
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2855
+ * padding_bottom(&img, 10_u32, rgba);
2856
+ * ```
2857
+ * @param {PhotonImage} img
2858
+ * @param {number} padding
2859
+ * @param {Rgba} padding_rgba
2860
+ * @returns {PhotonImage}
2861
+ */
2862
+ module.exports.padding_bottom = function(img, padding, padding_rgba) {
2863
+ _assertClass(img, PhotonImage);
2864
+ _assertClass(padding_rgba, Rgba);
2865
+ var ptr0 = padding_rgba.__destroy_into_raw();
2866
+ const ret = wasm.padding_bottom(img.__wbg_ptr, padding, ptr0);
2867
+ return PhotonImage.__wrap(ret);
2868
+ };
2869
+ /**
2870
+ * Rotate the PhotonImage on an arbitrary angle
2871
+ * A rotated PhotonImage is returned.
2872
+ *
2873
+ * # Arguments
2874
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2875
+ * * `angle` - Rotation angle in degrees.
2876
+ *
2877
+ * # Example
2878
+ *
2879
+ * ```no_run
2880
+ * // For example, to rotate a PhotonImage by 30 degrees:
2881
+ * use photon_rs::native::open_image;
2882
+ * use photon_rs::transform::rotate;
2883
+ *
2884
+ * let img = open_image("img.jpg").expect("File should open");
2885
+ * let rotated_img = rotate(&img, 30.0);
2886
+ * ```
2887
+ * @param {PhotonImage} photon_img
2888
+ * @param {number} angle
2889
+ * @returns {PhotonImage}
2890
+ */
2891
+ module.exports.rotate = function(photon_img, angle) {
2892
+ _assertClass(photon_img, PhotonImage);
2893
+ const ret = wasm.rotate(photon_img.__wbg_ptr, angle);
2894
+ return PhotonImage.__wrap(ret);
2895
+ };
2896
+ /**
2897
+ * Resample the PhotonImage.
2898
+ *
2899
+ * # Arguments
2900
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2901
+ * * `dst_width` - Target width.
2902
+ * * `dst_height` - Target height.
2903
+ *
2904
+ * # Example
2905
+ *
2906
+ * ```no_run
2907
+ * // For example, to resample a PhotonImage to 1920x1080 size:
2908
+ * use photon_rs::native::open_image;
2909
+ * use photon_rs::transform::resample;
2910
+ *
2911
+ * let img = open_image("img.jpg").expect("File should open");
2912
+ * let rotated_img = resample(&img, 1920, 1080);
2913
+ * ```
2914
+ * @param {PhotonImage} img
2915
+ * @param {number} dst_width
2916
+ * @param {number} dst_height
2917
+ * @returns {PhotonImage}
2918
+ */
2919
+ module.exports.resample = function(img, dst_width, dst_height) {
2920
+ _assertClass(img, PhotonImage);
2921
+ const ret = wasm.resample(img.__wbg_ptr, dst_width, dst_height);
2922
+ return PhotonImage.__wrap(ret);
2923
+ };
2924
+ /**
2925
+ * Adds an offset to the image by a certain number of pixels.
2926
+ *
2927
+ * This creates an RGB shift effect.
2928
+ *
2929
+ * # Arguments
2930
+ * * `img` - A PhotonImage that contains a view into the image.
2931
+ * * `channel_index`: The index of the channel to increment. 0 for red, 1 for green and 2 for blue.
2932
+ * * `offset` - The offset is added to the pixels in the image.
2933
+ * # Example
2934
+ *
2935
+ * ```no_run
2936
+ * // For example, to offset pixels by 30 pixels on the red channel:
2937
+ * use photon_rs::effects::offset;
2938
+ * use photon_rs::native::open_image;
2939
+ *
2940
+ * let mut img = open_image("img.jpg").expect("File should open");
2941
+ * offset(&mut img, 0_usize, 30_u32);
2942
+ * ```
2943
+ * @param {PhotonImage} photon_image
2944
+ * @param {number} channel_index
2945
+ * @param {number} offset
2946
+ */
2947
+ module.exports.offset = function(photon_image, channel_index, offset) {
2948
+ _assertClass(photon_image, PhotonImage);
2949
+ wasm.offset(photon_image.__wbg_ptr, channel_index, offset);
2950
+ };
2951
+ /**
2952
+ * Adds an offset to the red channel by a certain number of pixels.
2953
+ *
2954
+ * # Arguments
2955
+ * * `img` - A PhotonImage that contains a view into the image.
2956
+ * * `offset` - The offset you want to move the red channel by.
2957
+ * # Example
2958
+ *
2959
+ * ```no_run
2960
+ * // For example, to add an offset to the red channel by 30 pixels.
2961
+ * use photon_rs::effects::offset_red;
2962
+ * use photon_rs::native::open_image;
2963
+ *
2964
+ * let mut img = open_image("img.jpg").expect("File should open");
2965
+ * offset_red(&mut img, 30_u32);
2966
+ * ```
2967
+ * @param {PhotonImage} img
2968
+ * @param {number} offset_amt
2969
+ */
2970
+ module.exports.offset_red = function(img, offset_amt) {
2971
+ _assertClass(img, PhotonImage);
2972
+ wasm.offset_red(img.__wbg_ptr, offset_amt);
2973
+ };
2974
+ /**
2975
+ * Adds an offset to the green channel by a certain number of pixels.
2976
+ *
2977
+ * # Arguments
2978
+ * * `img` - A PhotonImage that contains a view into the image.
2979
+ * * `offset` - The offset you want to move the green channel by.
2980
+ * # Example
2981
+ *
2982
+ * ```no_run
2983
+ * // For example, to add an offset to the green channel by 30 pixels.
2984
+ * use photon_rs::effects::offset_green;
2985
+ * use photon_rs::native::open_image;
2986
+ *
2987
+ * let mut img = open_image("img.jpg").expect("File should open");
2988
+ * offset_green(&mut img, 30_u32);
2989
+ * ```
2990
+ * @param {PhotonImage} img
2991
+ * @param {number} offset_amt
2992
+ */
2993
+ module.exports.offset_green = function(img, offset_amt) {
2994
+ _assertClass(img, PhotonImage);
2995
+ wasm.offset_green(img.__wbg_ptr, offset_amt);
2996
+ };
2997
+ /**
2998
+ * Adds an offset to the blue channel by a certain number of pixels.
2999
+ *
3000
+ * # Arguments
3001
+ * * `img` - A PhotonImage that contains a view into the image.
3002
+ * * `offset_amt` - The offset you want to move the blue channel by.
3003
+ * # Example
3004
+ * // For example, to add an offset to the green channel by 40 pixels.
3005
+ *
3006
+ * ```no_run
3007
+ * use photon_rs::effects::offset_blue;
3008
+ * use photon_rs::native::open_image;
3009
+ *
3010
+ * let mut img = open_image("img.jpg").expect("File should open");
3011
+ * offset_blue(&mut img, 40_u32);
3012
+ * ```
3013
+ * @param {PhotonImage} img
3014
+ * @param {number} offset_amt
3015
+ */
3016
+ module.exports.offset_blue = function(img, offset_amt) {
3017
+ _assertClass(img, PhotonImage);
3018
+ wasm.offset_blue(img.__wbg_ptr, offset_amt);
3019
+ };
3020
+ /**
3021
+ * Adds multiple offsets to the image by a certain number of pixels (on two channels).
3022
+ *
3023
+ * # Arguments
3024
+ * * `img` - A PhotonImage that contains a view into the image.
3025
+ * * `offset` - The offset is added to the pixels in the image.
3026
+ * # Example
3027
+ *
3028
+ * ```no_run
3029
+ * // For example, to add a 30-pixel offset to both the red and blue channels:
3030
+ * use photon_rs::effects::multiple_offsets;
3031
+ * use photon_rs::native::open_image;
3032
+ *
3033
+ * let mut img = open_image("img.jpg").expect("File should open");
3034
+ * multiple_offsets(&mut img, 30_u32, 0_usize, 2_usize);
3035
+ * ```
3036
+ * @param {PhotonImage} photon_image
3037
+ * @param {number} offset
3038
+ * @param {number} channel_index
3039
+ * @param {number} channel_index2
3040
+ */
3041
+ module.exports.multiple_offsets = function(photon_image, offset, channel_index, channel_index2) {
3042
+ _assertClass(photon_image, PhotonImage);
3043
+ wasm.multiple_offsets(photon_image.__wbg_ptr, offset, channel_index, channel_index2);
3044
+ };
3045
+ /**
3046
+ * Halftoning effect.
3047
+ *
3048
+ * # Arguments
3049
+ * * `img` - A PhotonImage that contains a view into the image.
3050
+ * # Example
3051
+ *
3052
+ * ```no_run
3053
+ * // For example:
3054
+ * use photon_rs::effects::halftone;
3055
+ * use photon_rs::native::open_image;
3056
+ *
3057
+ * let mut img = open_image("img.jpg").expect("File should open");
3058
+ * halftone(&mut img);
3059
+ * ```
3060
+ * @param {PhotonImage} photon_image
3061
+ */
3062
+ module.exports.halftone = function(photon_image) {
3063
+ _assertClass(photon_image, PhotonImage);
3064
+ wasm.halftone(photon_image.__wbg_ptr);
3065
+ };
3066
+ /**
3067
+ * Reduces an image to the primary colours.
3068
+ *
3069
+ * # Arguments
3070
+ * * `img` - A PhotonImage that contains a view into the image.
3071
+ * # Example
3072
+ *
3073
+ * ```no_run
3074
+ * // For example, to add a primary colour effect to an image of type `DynamicImage`:
3075
+ * use photon_rs::effects::primary;
3076
+ * use photon_rs::native::open_image;
3077
+ *
3078
+ * let mut img = open_image("img.jpg").expect("File should open");
3079
+ * primary(&mut img);
3080
+ * ```
3081
+ * @param {PhotonImage} img
3082
+ */
3083
+ module.exports.primary = function(img) {
3084
+ _assertClass(img, PhotonImage);
3085
+ wasm.primary(img.__wbg_ptr);
3086
+ };
3087
+ /**
3088
+ * Colorizes the green channels of the image.
3089
+ *
3090
+ * # Arguments
3091
+ * * `img` - A PhotonImage that contains a view into the image.
3092
+ * # Example
3093
+ *
3094
+ * ```no_run
3095
+ * // For example, to colorize an image of type `PhotonImage`:
3096
+ * use photon_rs::effects::colorize;
3097
+ * use photon_rs::native::open_image;
3098
+ *
3099
+ * let mut img = open_image("img.jpg").expect("File should open");
3100
+ * colorize(&mut img);
3101
+ * ```
3102
+ * @param {PhotonImage} photon_image
3103
+ */
3104
+ module.exports.colorize = function(photon_image) {
3105
+ _assertClass(photon_image, PhotonImage);
3106
+ wasm.colorize(photon_image.__wbg_ptr);
3107
+ };
3108
+ /**
3109
+ * Applies a solarizing effect to an image.
3110
+ *
3111
+ * # Arguments
3112
+ * * `img` - A PhotonImage that contains a view into the image.
3113
+ * # Example
3114
+ *
3115
+ * ```no_run
3116
+ * // For example, to colorize an image of type `PhotonImage`:
3117
+ * use photon_rs::effects::solarize;
3118
+ * use photon_rs::native::open_image;
3119
+ *
3120
+ * let mut img = open_image("img.jpg").expect("File should open");
3121
+ * solarize(&mut img);
3122
+ * ```
3123
+ * @param {PhotonImage} photon_image
3124
+ */
3125
+ module.exports.solarize = function(photon_image) {
3126
+ _assertClass(photon_image, PhotonImage);
3127
+ wasm.solarize(photon_image.__wbg_ptr);
3128
+ };
3129
+ /**
3130
+ * Applies a solarizing effect to an image and returns the resulting PhotonImage.
3131
+ *
3132
+ * # Arguments
3133
+ * * `img` - A PhotonImage that contains a view into the image.
3134
+ * # Example
3135
+ *
3136
+ * ```no_run
3137
+ * // For example, to solarize "retimg" an image of type `PhotonImage`:
3138
+ * use photon_rs::effects::solarize_retimg;
3139
+ * use photon_rs::native::open_image;
3140
+ * use photon_rs::PhotonImage;
3141
+ *
3142
+ * let img = open_image("img.jpg").expect("File should open");
3143
+ * let result: PhotonImage = solarize_retimg(&img);
3144
+ * ```
3145
+ * @param {PhotonImage} photon_image
3146
+ * @returns {PhotonImage}
3147
+ */
3148
+ module.exports.solarize_retimg = function(photon_image) {
3149
+ _assertClass(photon_image, PhotonImage);
3150
+ const ret = wasm.solarize_retimg(photon_image.__wbg_ptr);
3151
+ return PhotonImage.__wrap(ret);
3152
+ };
3153
+ /**
3154
+ * Adjust the brightness of an image by a factor.
3155
+ *
3156
+ * # Arguments
3157
+ * * `img` - A PhotonImage that contains a view into the image.
3158
+ * * `brightness` - A u8 to add or subtract to the brightness. To increase
3159
+ * the brightness, pass a positive number (up to 255). To decrease the brightness,
3160
+ * pass a negative number instead.
3161
+ * # Example
3162
+ *
3163
+ * ```no_run
3164
+ * use photon_rs::effects::adjust_brightness;
3165
+ * use photon_rs::native::open_image;
3166
+ *
3167
+ * let mut img = open_image("img.jpg").expect("File should open");
3168
+ * adjust_brightness(&mut img, 10_i16);
3169
+ * ```
3170
+ * @param {PhotonImage} photon_image
3171
+ * @param {number} brightness
3172
+ */
3173
+ module.exports.adjust_brightness = function(photon_image, brightness) {
3174
+ _assertClass(photon_image, PhotonImage);
3175
+ wasm.adjust_brightness(photon_image.__wbg_ptr, brightness);
3176
+ };
3177
+ /**
3178
+ * Increase the brightness of an image by a constant.
3179
+ *
3180
+ * # Arguments
3181
+ * * `img` - A PhotonImage that contains a view into the image.
3182
+ * * `brightness` - A u8 to add to the brightness.
3183
+ * # Example
3184
+ *
3185
+ * ```no_run
3186
+ * use photon_rs::effects::inc_brightness;
3187
+ * use photon_rs::native::open_image;
3188
+ *
3189
+ * let mut img = open_image("img.jpg").expect("File should open");
3190
+ * inc_brightness(&mut img, 10_u8);
3191
+ * ```
3192
+ * @param {PhotonImage} photon_image
3193
+ * @param {number} brightness
3194
+ */
3195
+ module.exports.inc_brightness = function(photon_image, brightness) {
3196
+ _assertClass(photon_image, PhotonImage);
3197
+ wasm.inc_brightness(photon_image.__wbg_ptr, brightness);
3198
+ };
3199
+ /**
3200
+ * Decrease the brightness of an image by a constant.
3201
+ *
3202
+ * # Arguments
3203
+ * * `img` - A PhotonImage that contains a view into the image.
3204
+ * * `brightness` - A u8 to subtract from the brightness. It should be a positive number,
3205
+ * and this value will then be subtracted from the brightness.
3206
+ * # Example
3207
+ *
3208
+ * ```no_run
3209
+ * use photon_rs::effects::dec_brightness;
3210
+ * use photon_rs::native::open_image;
3211
+ *
3212
+ * let mut img = open_image("img.jpg").expect("File should open");
3213
+ * dec_brightness(&mut img, 10_u8);
3214
+ * ```
3215
+ * @param {PhotonImage} photon_image
3216
+ * @param {number} brightness
3217
+ */
3218
+ module.exports.dec_brightness = function(photon_image, brightness) {
3219
+ _assertClass(photon_image, PhotonImage);
3220
+ wasm.dec_brightness(photon_image.__wbg_ptr, brightness);
3221
+ };
3222
+ /**
3223
+ * Adjust the contrast of an image by a factor.
3224
+ *
3225
+ * # Arguments
3226
+ * * `photon_image` - A PhotonImage that contains a view into the image.
3227
+ * * `contrast` - An f32 factor used to adjust contrast. Between [-255.0, 255.0]. The algorithm will
3228
+ * clamp results if passed factor is out of range.
3229
+ * # Example
3230
+ *
3231
+ * ```no_run
3232
+ * use photon_rs::effects::adjust_contrast;
3233
+ * use photon_rs::native::open_image;
3234
+ *
3235
+ * let mut img = open_image("img.jpg").expect("File should open");
3236
+ * adjust_contrast(&mut img, 30_f32);
3237
+ * ```
3238
+ * @param {PhotonImage} photon_image
3239
+ * @param {number} contrast
3240
+ */
3241
+ module.exports.adjust_contrast = function(photon_image, contrast) {
3242
+ _assertClass(photon_image, PhotonImage);
3243
+ wasm.adjust_contrast(photon_image.__wbg_ptr, contrast);
3244
+ };
3245
+ /**
3246
+ * Tint an image by adding an offset to averaged RGB channel values.
3247
+ *
3248
+ * # Arguments
3249
+ * * `img` - A PhotonImage that contains a view into the image.
3250
+ * * `r_offset` - The amount the R channel should be incremented by.
3251
+ * * `g_offset` - The amount the G channel should be incremented by.
3252
+ * * `b_offset` - The amount the B channel should be incremented by.
3253
+ * # Example
3254
+ *
3255
+ * ```no_run
3256
+ * // For example, to tint an image of type `PhotonImage`:
3257
+ * use photon_rs::effects::tint;
3258
+ * use photon_rs::native::open_image;
3259
+ *
3260
+ * let mut img = open_image("img.jpg").expect("File should open");
3261
+ * tint(&mut img, 10_u32, 20_u32, 15_u32);
3262
+ * ```
3263
+ * @param {PhotonImage} photon_image
3264
+ * @param {number} r_offset
3265
+ * @param {number} g_offset
3266
+ * @param {number} b_offset
3267
+ */
3268
+ module.exports.tint = function(photon_image, r_offset, g_offset, b_offset) {
3269
+ _assertClass(photon_image, PhotonImage);
3270
+ wasm.tint(photon_image.__wbg_ptr, r_offset, g_offset, b_offset);
3271
+ };
3272
+ /**
3273
+ * Horizontal strips. Divide an image into a series of equal-height strips, for an artistic effect.
3274
+ *
3275
+ * # Arguments
3276
+ * * `img` - A PhotonImage that contains a view into the image.
3277
+ * * `num_strips` - The number of strips
3278
+ * # Example
3279
+ *
3280
+ * ```no_run
3281
+ * // For example, to draw horizontal strips on a `PhotonImage`:
3282
+ * use photon_rs::effects::horizontal_strips;
3283
+ * use photon_rs::native::open_image;
3284
+ *
3285
+ * let mut img = open_image("img.jpg").expect("File should open");
3286
+ * horizontal_strips(&mut img, 8u8);
3287
+ * ```
3288
+ * @param {PhotonImage} photon_image
3289
+ * @param {number} num_strips
3290
+ */
3291
+ module.exports.horizontal_strips = function(photon_image, num_strips) {
3292
+ _assertClass(photon_image, PhotonImage);
3293
+ wasm.horizontal_strips(photon_image.__wbg_ptr, num_strips);
3294
+ };
3295
+ /**
3296
+ * Horizontal strips. Divide an image into a series of equal-width strips, for an artistic effect. Sepcify a color as well.
3297
+ *
3298
+ * # Arguments
3299
+ * * `img` - A PhotonImage that contains a view into the image.
3300
+ * * `num_strips` - The numbder of strips
3301
+ * * `color` - Color of strips.
3302
+ * # Example
3303
+ *
3304
+ * ```no_run
3305
+ * // For example, to draw blue horizontal strips on a `PhotonImage`:
3306
+ * use photon_rs::effects::color_horizontal_strips;
3307
+ * use photon_rs::native::open_image;
3308
+ * use photon_rs::Rgb;
3309
+ *
3310
+ * let color = Rgb::new(255u8, 0u8, 0u8);
3311
+ * let mut img = open_image("img.jpg").expect("File should open");
3312
+ * color_horizontal_strips(&mut img, 8u8, color);
3313
+ * ```
3314
+ * @param {PhotonImage} photon_image
3315
+ * @param {number} num_strips
3316
+ * @param {Rgb} color
3317
+ */
3318
+ module.exports.color_horizontal_strips = function(photon_image, num_strips, color) {
3319
+ _assertClass(photon_image, PhotonImage);
3320
+ _assertClass(color, Rgb);
3321
+ var ptr0 = color.__destroy_into_raw();
3322
+ wasm.color_horizontal_strips(photon_image.__wbg_ptr, num_strips, ptr0);
3323
+ };
3324
+ /**
3325
+ * Vertical strips. Divide an image into a series of equal-width strips, for an artistic effect.
3326
+ *
3327
+ * # Arguments
3328
+ * * `img` - A PhotonImage that contains a view into the image.
3329
+ * * `num_strips` - The numbder of strips
3330
+ * # Example
3331
+ *
3332
+ * ```no_run
3333
+ * // For example, to draw vertical strips on a `PhotonImage`:
3334
+ * use photon_rs::effects::vertical_strips;
3335
+ * use photon_rs::native::open_image;
3336
+ *
3337
+ * let mut img = open_image("img.jpg").expect("File should open");
3338
+ * vertical_strips(&mut img, 8u8);
3339
+ * ```
3340
+ * @param {PhotonImage} photon_image
3341
+ * @param {number} num_strips
3342
+ */
3343
+ module.exports.vertical_strips = function(photon_image, num_strips) {
3344
+ _assertClass(photon_image, PhotonImage);
3345
+ wasm.vertical_strips(photon_image.__wbg_ptr, num_strips);
3346
+ };
3347
+ /**
3348
+ * Vertical strips. Divide an image into a series of equal-width strips, for an artistic effect. Sepcify a color as well.
3349
+ *
3350
+ * # Arguments
3351
+ * * `img` - A PhotonImage that contains a view into the image.
3352
+ * * `num_strips` - The numbder of strips
3353
+ * * `color` - Color of strips.
3354
+ * # Example
3355
+ *
3356
+ * ```no_run
3357
+ * // For example, to draw red vertical strips on a `PhotonImage`:
3358
+ * use photon_rs::effects::color_vertical_strips;
3359
+ * use photon_rs::native::open_image;
3360
+ * use photon_rs::Rgb;
3361
+ *
3362
+ * let color = Rgb::new(255u8, 0u8, 0u8);
3363
+ * let mut img = open_image("img.jpg").expect("File should open");
3364
+ * color_vertical_strips(&mut img, 8u8, color);
3365
+ * ```
3366
+ * @param {PhotonImage} photon_image
3367
+ * @param {number} num_strips
3368
+ * @param {Rgb} color
3369
+ */
3370
+ module.exports.color_vertical_strips = function(photon_image, num_strips, color) {
3371
+ _assertClass(photon_image, PhotonImage);
3372
+ _assertClass(color, Rgb);
3373
+ var ptr0 = color.__destroy_into_raw();
3374
+ wasm.color_vertical_strips(photon_image.__wbg_ptr, num_strips, ptr0);
3375
+ };
3376
+ /**
3377
+ * Turn an image into an oil painting
3378
+ *
3379
+ * # Arguments
3380
+ * * `img` - A PhotonImage that contains a view into the image.
3381
+ * * `radius` - Radius of each paint particle
3382
+ * * `intesnity` - How artsy an Image should be
3383
+ * # Example
3384
+ *
3385
+ * ```no_run
3386
+ * // For example, to oil an image of type `PhotonImage`:
3387
+ * use photon_rs::effects::oil;
3388
+ * use photon_rs::native::open_image;
3389
+ *
3390
+ * let mut img = open_image("img.jpg").expect("File should open");
3391
+ * oil(&mut img, 4i32, 55.0);
3392
+ * ```
3393
+ * @param {PhotonImage} photon_image
3394
+ * @param {number} radius
3395
+ * @param {number} intensity
3396
+ */
3397
+ module.exports.oil = function(photon_image, radius, intensity) {
3398
+ _assertClass(photon_image, PhotonImage);
3399
+ wasm.oil(photon_image.__wbg_ptr, radius, intensity);
3400
+ };
3401
+ /**
3402
+ * Turn an image into an frosted glass see through
3403
+ *
3404
+ * # Arguments
3405
+ * * `img` - A PhotonImage that contains a view into the image.
3406
+ * # Example
3407
+ *
3408
+ * ```no_run
3409
+ * // For example, to turn an image of type `PhotonImage` into frosted glass see through:
3410
+ * use photon_rs::effects::frosted_glass;
3411
+ * use photon_rs::native::open_image;
3412
+ *
3413
+ * let mut img = open_image("img.jpg").expect("File should open");
3414
+ * frosted_glass(&mut img);
3415
+ * ```
3416
+ * @param {PhotonImage} photon_image
3417
+ */
3418
+ module.exports.frosted_glass = function(photon_image) {
3419
+ _assertClass(photon_image, PhotonImage);
3420
+ wasm.frosted_glass(photon_image.__wbg_ptr);
3421
+ };
3422
+ /**
3423
+ * Pixelize an image.
3424
+ *
3425
+ * # Arguments
3426
+ * * `photon_image` - A PhotonImage that contains a view into the image.
3427
+ * * `pixel_size` - Targeted pixel size of generated image.
3428
+ * # Example
3429
+ *
3430
+ * ```no_run
3431
+ * // For example, to turn an image of type `PhotonImage` into a pixelized image with 50 pixels blocks:
3432
+ * use photon_rs::effects::pixelize;
3433
+ * use photon_rs::native::open_image;
3434
+ *
3435
+ * let mut img = open_image("img.jpg").expect("File should open");
3436
+ * pixelize(&mut img, 50);
3437
+ * ```
3438
+ * @param {PhotonImage} photon_image
3439
+ * @param {number} pixel_size
3440
+ */
3441
+ module.exports.pixelize = function(photon_image, pixel_size) {
3442
+ _assertClass(photon_image, PhotonImage);
3443
+ wasm.pixelize(photon_image.__wbg_ptr, pixel_size);
3444
+ };
3445
+ /**
3446
+ * Normalizes an image by remapping its range of pixels values. Only RGB
3447
+ * channels are processed and each channel is stretched to \[0, 255\] range
3448
+ * independently. This process is also known as contrast stretching.
3449
+ * # Arguments
3450
+ * * `photon_image` - A PhotonImage that contains a view into the image.
3451
+ * # Example
3452
+ *
3453
+ * ```no_run
3454
+ * // For example, to turn an image of type `PhotonImage` into a normalized image:
3455
+ * use photon_rs::effects::normalize;
3456
+ * use photon_rs::native::open_image;
3457
+ *
3458
+ * let mut img = open_image("img.jpg").expect("File should open");
3459
+ * normalize(&mut img);
3460
+ * ```
3461
+ * @param {PhotonImage} photon_image
3462
+ */
3463
+ module.exports.normalize = function(photon_image) {
3464
+ _assertClass(photon_image, PhotonImage);
3465
+ wasm.normalize(photon_image.__wbg_ptr);
3466
+ };
3467
+ /**
3468
+ * Applies Floyd-Steinberg dithering to an image.
3469
+ * Only RGB channels are processed, alpha remains unchanged.
3470
+ * # Arguments
3471
+ * * `photon_image` - A PhotonImage that contains a view into the image.
3472
+ * * `depth` - bits per channel. Clamped between 1 and 8.
3473
+ * # Example
3474
+ *
3475
+ * ```no_run
3476
+ * // For example, to turn an image of type `PhotonImage` into a dithered image:
3477
+ * use photon_rs::effects::dither;
3478
+ * use photon_rs::native::open_image;
3479
+ *
3480
+ * let mut img = open_image("img.jpg").expect("File should open");
3481
+ * let depth = 1;
3482
+ * dither(&mut img, depth);
3483
+ * ```
3484
+ * @param {PhotonImage} photon_image
3485
+ * @param {number} depth
3486
+ */
3487
+ module.exports.dither = function(photon_image, depth) {
3488
+ _assertClass(photon_image, PhotonImage);
3489
+ wasm.dither(photon_image.__wbg_ptr, depth);
3490
+ };
3491
+ /**
3492
+ * @param {PhotonImage} photon_image
3493
+ * @param {Rgb} color_a
3494
+ * @param {Rgb} color_b
3495
+ */
3496
+ module.exports.duotone = function(photon_image, color_a, color_b) {
3497
+ _assertClass(photon_image, PhotonImage);
3498
+ _assertClass(color_a, Rgb);
3499
+ var ptr0 = color_a.__destroy_into_raw();
3500
+ _assertClass(color_b, Rgb);
3501
+ var ptr1 = color_b.__destroy_into_raw();
3502
+ wasm.duotone(photon_image.__wbg_ptr, ptr0, ptr1);
3503
+ };
3504
+ /**
3505
+ * Add bordered-text to an image.
3506
+ * The only font available as of now is Roboto.
3507
+ * Note: A graphic design/text-drawing library is currently being developed, so stay tuned.
3508
+ *
3509
+ * # Arguments
3510
+ * * `photon_image` - A PhotonImage.
3511
+ * * `text` - Text string to be drawn to the image.
3512
+ * * `x` - x-coordinate of where first letter's 1st pixel should be drawn.
3513
+ * * `y` - y-coordinate of where first letter's 1st pixel should be drawn.
3514
+ * * `font_size` - Font size in pixels of the text to be drawn.
3515
+ *
3516
+ * # Example
3517
+ *
3518
+ * ```no_run
3519
+ * // For example to draw the string "Welcome to Photon!" at 10, 10:
3520
+ * use photon_rs::native::open_image;
3521
+ * use photon_rs::text::draw_text_with_border;
3522
+ *
3523
+ * // Open the image. A PhotonImage is returned.
3524
+ * let mut img = open_image("img.jpg").expect("File should open");
3525
+ * draw_text_with_border(&mut img, "Welcome to Photon!", 10_i32, 10_i32, 90_f32);
3526
+ * ```
3527
+ * @param {PhotonImage} photon_img
3528
+ * @param {string} text
3529
+ * @param {number} x
3530
+ * @param {number} y
3531
+ * @param {number} font_size
3532
+ */
3533
+ module.exports.draw_text_with_border = function(photon_img, text, x, y, font_size) {
3534
+ _assertClass(photon_img, PhotonImage);
3535
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3536
+ const len0 = WASM_VECTOR_LEN;
3537
+ wasm.draw_text_with_border(photon_img.__wbg_ptr, ptr0, len0, x, y, font_size);
3538
+ };
3539
+ /**
3540
+ * Add text to an image.
3541
+ * The only font available as of now is Roboto.
3542
+ * Note: A graphic design/text-drawing library is currently being developed, so stay tuned.
3543
+ *
3544
+ * # Arguments
3545
+ * * `photon_image` - A PhotonImage.
3546
+ * * `text` - Text string to be drawn to the image.
3547
+ * * `x` - x-coordinate of where first letter's 1st pixel should be drawn.
3548
+ * * `y` - y-coordinate of where first letter's 1st pixel should be drawn.
3549
+ * * `font_size` - Font size in pixels of the text to be drawn.
3550
+ *
3551
+ * # Example
3552
+ *
3553
+ * ```no_run
3554
+ * // For example to draw the string "Welcome to Photon!" at 10, 10:
3555
+ * use photon_rs::native::open_image;
3556
+ * use photon_rs::text::draw_text;
3557
+ *
3558
+ * // Open the image. A PhotonImage is returned.
3559
+ * let mut img = open_image("img.jpg").expect("File should open");
3560
+ * draw_text(&mut img, "Welcome to Photon!", 10_i32, 10_i32, 90_f32);
3561
+ * ```
3562
+ * @param {PhotonImage} photon_img
3563
+ * @param {string} text
3564
+ * @param {number} x
3565
+ * @param {number} y
3566
+ * @param {number} font_size
3567
+ */
3568
+ module.exports.draw_text = function(photon_img, text, x, y, font_size) {
3569
+ _assertClass(photon_img, PhotonImage);
3570
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3571
+ const len0 = WASM_VECTOR_LEN;
3572
+ wasm.draw_text(photon_img.__wbg_ptr, ptr0, len0, x, y, font_size);
3573
+ };
3574
+ function passArray8ToWasm0(arg, malloc) {
3575
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
3576
+ getUint8ArrayMemory0().set(arg, ptr / 1);
3577
+ WASM_VECTOR_LEN = arg.length;
3578
+ return ptr;
3579
+ }
3580
+ function getArrayU8FromWasm0(ptr, len) {
3581
+ ptr = ptr >>> 0;
3582
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
3583
+ }
3584
+ function takeFromExternrefTable0(idx) {
3585
+ const value = wasm.__wbindgen_export_2.get(idx);
3586
+ wasm.__externref_table_dealloc(idx);
3587
+ return value;
3588
+ }
3589
+ /**
3590
+ *! [temp] Check if WASM is supported.
3591
+ */
3592
+ module.exports.run = function() {
3593
+ const ret = wasm.run();
3594
+ if (ret[1]) throw takeFromExternrefTable0(ret[0]);
3595
+ };
3596
+ /**
3597
+ * Get the ImageData from a 2D canvas context
3598
+ * @param {HTMLCanvasElement} canvas
3599
+ * @param {CanvasRenderingContext2D} ctx
3600
+ * @returns {ImageData}
3601
+ */
3602
+ module.exports.get_image_data = function(canvas, ctx) {
3603
+ return wasm.get_image_data(canvas, ctx);
3604
+ };
3605
+ /**
3606
+ * Place a PhotonImage onto a 2D canvas.
3607
+ * @param {HTMLCanvasElement} canvas
3608
+ * @param {CanvasRenderingContext2D} ctx
3609
+ * @param {PhotonImage} new_image
3610
+ */
3611
+ module.exports.putImageData = function(canvas, ctx, new_image) {
3612
+ _assertClass(new_image, PhotonImage);
3613
+ var ptr0 = new_image.__destroy_into_raw();
3614
+ wasm.putImageData(canvas, ctx, ptr0);
3615
+ };
3616
+ /**
3617
+ * Convert a HTML5 Canvas Element to a PhotonImage.
3618
+ *
3619
+ * This converts the ImageData found in the canvas context to a PhotonImage,
3620
+ * which can then have effects or filters applied to it.
3621
+ * @param {HTMLCanvasElement} canvas
3622
+ * @param {CanvasRenderingContext2D} ctx
3623
+ * @returns {PhotonImage}
3624
+ */
3625
+ module.exports.open_image = function(canvas, ctx) {
3626
+ const ret = wasm.open_image(canvas, ctx);
3627
+ return PhotonImage.__wrap(ret);
3628
+ };
3629
+ /**
3630
+ * Convert ImageData to a raw pixel vec of u8s.
3631
+ * @param {ImageData} imgdata
3632
+ * @returns {Uint8Array}
3633
+ */
3634
+ module.exports.to_raw_pixels = function(imgdata) {
3635
+ const ret = wasm.to_raw_pixels(imgdata);
3636
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3637
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3638
+ return v1;
3639
+ };
3640
+ /**
3641
+ * Convert a base64 string to a PhotonImage.
3642
+ * @param {string} base64
3643
+ * @returns {PhotonImage}
3644
+ */
3645
+ module.exports.base64_to_image = function(base64) {
3646
+ const ptr0 = passStringToWasm0(base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3647
+ const len0 = WASM_VECTOR_LEN;
3648
+ const ret = wasm.base64_to_image(ptr0, len0);
3649
+ return PhotonImage.__wrap(ret);
3650
+ };
3651
+ /**
3652
+ * Convert a base64 string to a Vec of u8s.
3653
+ * @param {string} base64
3654
+ * @returns {Uint8Array}
3655
+ */
3656
+ module.exports.base64_to_vec = function(base64) {
3657
+ const ptr0 = passStringToWasm0(base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3658
+ const len0 = WASM_VECTOR_LEN;
3659
+ const ret = wasm.base64_to_vec(ptr0, len0);
3660
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3661
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3662
+ return v2;
3663
+ };
3664
+ /**
3665
+ * Convert a PhotonImage to JS-compatible ImageData.
3666
+ * @param {PhotonImage} photon_image
3667
+ * @returns {ImageData}
3668
+ */
3669
+ module.exports.to_image_data = function(photon_image) {
3670
+ _assertClass(photon_image, PhotonImage);
3671
+ var ptr0 = photon_image.__destroy_into_raw();
3672
+ return wasm.to_image_data(ptr0);
3673
+ };
3674
+ function isLikeNone(x) {
3675
+ return x === void 0 || x === null;
3676
+ }
3677
+ function addToExternrefTable0(obj) {
3678
+ const idx = wasm.__externref_table_alloc();
3679
+ wasm.__wbindgen_export_2.set(idx, obj);
3680
+ return idx;
3681
+ }
3682
+ function handleError(f, args) {
3683
+ try {
3684
+ return f.apply(this, args);
3685
+ } catch (e) {
3686
+ const idx = addToExternrefTable0(e);
3687
+ wasm.__wbindgen_exn_store(idx);
3688
+ }
3689
+ }
3690
+ let cachedUint8ClampedArrayMemory0 = null;
3691
+ function getUint8ClampedArrayMemory0() {
3692
+ if (cachedUint8ClampedArrayMemory0 === null || cachedUint8ClampedArrayMemory0.byteLength === 0) cachedUint8ClampedArrayMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
3693
+ return cachedUint8ClampedArrayMemory0;
3694
+ }
3695
+ function getClampedArrayU8FromWasm0(ptr, len) {
3696
+ ptr = ptr >>> 0;
3697
+ return getUint8ClampedArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
3698
+ }
3699
+ module.exports.SamplingFilter = Object.freeze({
3700
+ Nearest: 1,
3701
+ "1": "Nearest",
3702
+ Triangle: 2,
3703
+ "2": "Triangle",
3704
+ CatmullRom: 3,
3705
+ "3": "CatmullRom",
3706
+ Gaussian: 4,
3707
+ "4": "Gaussian",
3708
+ Lanczos3: 5,
3709
+ "5": "Lanczos3"
3710
+ });
3711
+ const PhotonImageFinalization = typeof FinalizationRegistry === "undefined" ? {
3712
+ register: () => {},
3713
+ unregister: () => {}
3714
+ } : new FinalizationRegistry((ptr) => wasm.__wbg_photonimage_free(ptr >>> 0, 1));
3715
+ /**
3716
+ * Provides the image's height, width, and contains the image's raw pixels.
3717
+ * For use when communicating between JS and WASM, and also natively.
3718
+ */
3719
+ var PhotonImage = class PhotonImage {
3720
+ static __wrap(ptr) {
3721
+ ptr = ptr >>> 0;
3722
+ const obj = Object.create(PhotonImage.prototype);
3723
+ obj.__wbg_ptr = ptr;
3724
+ PhotonImageFinalization.register(obj, obj.__wbg_ptr, obj);
3725
+ return obj;
3726
+ }
3727
+ __destroy_into_raw() {
3728
+ const ptr = this.__wbg_ptr;
3729
+ this.__wbg_ptr = 0;
3730
+ PhotonImageFinalization.unregister(this);
3731
+ return ptr;
3732
+ }
3733
+ free() {
3734
+ const ptr = this.__destroy_into_raw();
3735
+ wasm.__wbg_photonimage_free(ptr, 0);
3736
+ }
3737
+ /**
3738
+ * Create a new PhotonImage from a Vec of u8s, which represent raw pixels.
3739
+ * @param {Uint8Array} raw_pixels
3740
+ * @param {number} width
3741
+ * @param {number} height
3742
+ */
3743
+ constructor(raw_pixels, width, height) {
3744
+ const ptr0 = passArray8ToWasm0(raw_pixels, wasm.__wbindgen_malloc);
3745
+ const len0 = WASM_VECTOR_LEN;
3746
+ const ret = wasm.photonimage_new(ptr0, len0, width, height);
3747
+ this.__wbg_ptr = ret >>> 0;
3748
+ PhotonImageFinalization.register(this, this.__wbg_ptr, this);
3749
+ return this;
3750
+ }
3751
+ /**
3752
+ * Create a new PhotonImage from a base64 string.
3753
+ * @param {string} base64
3754
+ * @returns {PhotonImage}
3755
+ */
3756
+ static new_from_base64(base64) {
3757
+ const ptr0 = passStringToWasm0(base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3758
+ const len0 = WASM_VECTOR_LEN;
3759
+ const ret = wasm.base64_to_image(ptr0, len0);
3760
+ return PhotonImage.__wrap(ret);
3761
+ }
3762
+ /**
3763
+ * Create a new PhotonImage from a byteslice.
3764
+ * @param {Uint8Array} vec
3765
+ * @returns {PhotonImage}
3766
+ */
3767
+ static new_from_byteslice(vec) {
3768
+ const ptr0 = passArray8ToWasm0(vec, wasm.__wbindgen_malloc);
3769
+ const len0 = WASM_VECTOR_LEN;
3770
+ const ret = wasm.photonimage_new_from_byteslice(ptr0, len0);
3771
+ return PhotonImage.__wrap(ret);
3772
+ }
3773
+ /**
3774
+ * Create a new PhotonImage from a Blob/File.
3775
+ * @param {Blob} blob
3776
+ * @returns {PhotonImage}
3777
+ */
3778
+ static new_from_blob(blob) {
3779
+ const ret = wasm.photonimage_new_from_blob(blob);
3780
+ return PhotonImage.__wrap(ret);
3781
+ }
3782
+ /**
3783
+ * Create a new PhotonImage from a HTMLImageElement
3784
+ * @param {HTMLImageElement} image
3785
+ * @returns {PhotonImage}
3786
+ */
3787
+ static new_from_image(image) {
3788
+ const ret = wasm.photonimage_new_from_image(image);
3789
+ return PhotonImage.__wrap(ret);
3790
+ }
3791
+ /**
3792
+ * Get the width of the PhotonImage.
3793
+ * @returns {number}
3794
+ */
3795
+ get_width() {
3796
+ return wasm.photonimage_get_width(this.__wbg_ptr) >>> 0;
3797
+ }
3798
+ /**
3799
+ * Get the PhotonImage's pixels as a Vec of u8s.
3800
+ * @returns {Uint8Array}
3801
+ */
3802
+ get_raw_pixels() {
3803
+ const ret = wasm.photonimage_get_raw_pixels(this.__wbg_ptr);
3804
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3805
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3806
+ return v1;
3807
+ }
3808
+ /**
3809
+ * Get the height of the PhotonImage.
3810
+ * @returns {number}
3811
+ */
3812
+ get_height() {
3813
+ return wasm.photonimage_get_height(this.__wbg_ptr) >>> 0;
3814
+ }
3815
+ /**
3816
+ * Convert the PhotonImage to base64.
3817
+ * @returns {string}
3818
+ */
3819
+ get_base64() {
3820
+ let deferred1_0;
3821
+ let deferred1_1;
3822
+ try {
3823
+ const ret = wasm.photonimage_get_base64(this.__wbg_ptr);
3824
+ deferred1_0 = ret[0];
3825
+ deferred1_1 = ret[1];
3826
+ return getStringFromWasm0(ret[0], ret[1]);
3827
+ } finally {
3828
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3829
+ }
3830
+ }
3831
+ /**
3832
+ * Convert the PhotonImage to raw bytes. Returns PNG.
3833
+ * @returns {Uint8Array}
3834
+ */
3835
+ get_bytes() {
3836
+ const ret = wasm.photonimage_get_bytes(this.__wbg_ptr);
3837
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3838
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3839
+ return v1;
3840
+ }
3841
+ /**
3842
+ * Convert the PhotonImage to raw bytes. Returns a JPEG.
3843
+ * @param {number} quality
3844
+ * @returns {Uint8Array}
3845
+ */
3846
+ get_bytes_jpeg(quality) {
3847
+ const ret = wasm.photonimage_get_bytes_jpeg(this.__wbg_ptr, quality);
3848
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3849
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3850
+ return v1;
3851
+ }
3852
+ /**
3853
+ * Convert the PhotonImage to raw bytes. Returns a WEBP.
3854
+ * @returns {Uint8Array}
3855
+ */
3856
+ get_bytes_webp() {
3857
+ const ret = wasm.photonimage_get_bytes_webp(this.__wbg_ptr);
3858
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3859
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3860
+ return v1;
3861
+ }
3862
+ /**
3863
+ * Convert the PhotonImage's raw pixels to JS-compatible ImageData.
3864
+ * @returns {ImageData}
3865
+ */
3866
+ get_image_data() {
3867
+ return wasm.photonimage_get_image_data(this.__wbg_ptr);
3868
+ }
3869
+ /**
3870
+ * Convert ImageData to raw pixels, and update the PhotonImage's raw pixels to this.
3871
+ * @param {ImageData} img_data
3872
+ */
3873
+ set_imgdata(img_data) {
3874
+ wasm.photonimage_set_imgdata(this.__wbg_ptr, img_data);
3875
+ }
3876
+ /**
3877
+ * Calculates estimated filesize and returns number of bytes
3878
+ * @returns {bigint}
3879
+ */
3880
+ get_estimated_filesize() {
3881
+ const ret = wasm.photonimage_get_estimated_filesize(this.__wbg_ptr);
3882
+ return BigInt.asUintN(64, ret);
3883
+ }
3884
+ };
3885
+ module.exports.PhotonImage = PhotonImage;
3886
+ const RgbFinalization = typeof FinalizationRegistry === "undefined" ? {
3887
+ register: () => {},
3888
+ unregister: () => {}
3889
+ } : new FinalizationRegistry((ptr) => wasm.__wbg_rgb_free(ptr >>> 0, 1));
3890
+ /**
3891
+ * RGB color type.
3892
+ */
3893
+ var Rgb = class {
3894
+ __destroy_into_raw() {
3895
+ const ptr = this.__wbg_ptr;
3896
+ this.__wbg_ptr = 0;
3897
+ RgbFinalization.unregister(this);
3898
+ return ptr;
3899
+ }
3900
+ free() {
3901
+ const ptr = this.__destroy_into_raw();
3902
+ wasm.__wbg_rgb_free(ptr, 0);
3903
+ }
3904
+ /**
3905
+ * Create a new RGB struct.
3906
+ * @param {number} r
3907
+ * @param {number} g
3908
+ * @param {number} b
3909
+ */
3910
+ constructor(r, g, b) {
3911
+ const ret = wasm.rgb_new(r, g, b);
3912
+ this.__wbg_ptr = ret >>> 0;
3913
+ RgbFinalization.register(this, this.__wbg_ptr, this);
3914
+ return this;
3915
+ }
3916
+ /**
3917
+ * Set the Red value.
3918
+ * @param {number} r
3919
+ */
3920
+ set_red(r) {
3921
+ wasm.rgb_set_red(this.__wbg_ptr, r);
3922
+ }
3923
+ /**
3924
+ * Get the Green value.
3925
+ * @param {number} g
3926
+ */
3927
+ set_green(g) {
3928
+ wasm.rgb_set_green(this.__wbg_ptr, g);
3929
+ }
3930
+ /**
3931
+ * Set the Blue value.
3932
+ * @param {number} b
3933
+ */
3934
+ set_blue(b) {
3935
+ wasm.rgb_set_blue(this.__wbg_ptr, b);
3936
+ }
3937
+ /**
3938
+ * Get the Red value.
3939
+ * @returns {number}
3940
+ */
3941
+ get_red() {
3942
+ return wasm.rgb_get_red(this.__wbg_ptr);
3943
+ }
3944
+ /**
3945
+ * Get the Green value.
3946
+ * @returns {number}
3947
+ */
3948
+ get_green() {
3949
+ return wasm.rgb_get_green(this.__wbg_ptr);
3950
+ }
3951
+ /**
3952
+ * Get the Blue value.
3953
+ * @returns {number}
3954
+ */
3955
+ get_blue() {
3956
+ return wasm.rgb_get_blue(this.__wbg_ptr);
3957
+ }
3958
+ };
3959
+ module.exports.Rgb = Rgb;
3960
+ const RgbaFinalization = typeof FinalizationRegistry === "undefined" ? {
3961
+ register: () => {},
3962
+ unregister: () => {}
3963
+ } : new FinalizationRegistry((ptr) => wasm.__wbg_rgba_free(ptr >>> 0, 1));
3964
+ /**
3965
+ * RGBA color type.
3966
+ */
3967
+ var Rgba = class {
3968
+ __destroy_into_raw() {
3969
+ const ptr = this.__wbg_ptr;
3970
+ this.__wbg_ptr = 0;
3971
+ RgbaFinalization.unregister(this);
3972
+ return ptr;
3973
+ }
3974
+ free() {
3975
+ const ptr = this.__destroy_into_raw();
3976
+ wasm.__wbg_rgba_free(ptr, 0);
3977
+ }
3978
+ /**
3979
+ * Create a new RGBA struct.
3980
+ * @param {number} r
3981
+ * @param {number} g
3982
+ * @param {number} b
3983
+ * @param {number} a
3984
+ */
3985
+ constructor(r, g, b, a) {
3986
+ const ret = wasm.rgba_new(r, g, b, a);
3987
+ this.__wbg_ptr = ret >>> 0;
3988
+ RgbaFinalization.register(this, this.__wbg_ptr, this);
3989
+ return this;
3990
+ }
3991
+ /**
3992
+ * Set the Red value.
3993
+ * @param {number} r
3994
+ */
3995
+ set_red(r) {
3996
+ wasm.rgb_set_red(this.__wbg_ptr, r);
3997
+ }
3998
+ /**
3999
+ * Get the Green value.
4000
+ * @param {number} g
4001
+ */
4002
+ set_green(g) {
4003
+ wasm.rgb_set_green(this.__wbg_ptr, g);
4004
+ }
4005
+ /**
4006
+ * Set the Blue value.
4007
+ * @param {number} b
4008
+ */
4009
+ set_blue(b) {
4010
+ wasm.rgb_set_blue(this.__wbg_ptr, b);
4011
+ }
4012
+ /**
4013
+ * Set the alpha value.
4014
+ * @param {number} a
4015
+ */
4016
+ set_alpha(a) {
4017
+ wasm.rgba_set_alpha(this.__wbg_ptr, a);
4018
+ }
4019
+ /**
4020
+ * Get the Red value.
4021
+ * @returns {number}
4022
+ */
4023
+ get_red() {
4024
+ return wasm.rgb_get_red(this.__wbg_ptr);
4025
+ }
4026
+ /**
4027
+ * Get the Green value.
4028
+ * @returns {number}
4029
+ */
4030
+ get_green() {
4031
+ return wasm.rgb_get_green(this.__wbg_ptr);
4032
+ }
4033
+ /**
4034
+ * Get the Blue value.
4035
+ * @returns {number}
4036
+ */
4037
+ get_blue() {
4038
+ return wasm.rgb_get_blue(this.__wbg_ptr);
4039
+ }
4040
+ /**
4041
+ * Get the alpha value for this color.
4042
+ * @returns {number}
4043
+ */
4044
+ get_alpha() {
4045
+ return wasm.rgba_get_alpha(this.__wbg_ptr);
4046
+ }
4047
+ };
4048
+ module.exports.Rgba = Rgba;
4049
+ module.exports.__wbg_new_abda76e883ba8a5f = function() {
4050
+ return /* @__PURE__ */ new Error();
4051
+ };
4052
+ module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
4053
+ const ret = arg1.stack;
4054
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4055
+ const len1 = WASM_VECTOR_LEN;
4056
+ getDataViewMemory0().setInt32(arg0 + 4, len1, true);
4057
+ getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
4058
+ };
4059
+ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
4060
+ let deferred0_0;
4061
+ let deferred0_1;
4062
+ try {
4063
+ deferred0_0 = arg0;
4064
+ deferred0_1 = arg1;
4065
+ console.error(getStringFromWasm0(arg0, arg1));
4066
+ } finally {
4067
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4068
+ }
4069
+ };
4070
+ module.exports.__wbg_instanceof_Window_c4b70662a0d2c5ec = function(arg0) {
4071
+ let result;
4072
+ try {
4073
+ result = arg0 instanceof Window;
4074
+ } catch (_) {
4075
+ result = false;
4076
+ }
4077
+ return result;
4078
+ };
4079
+ module.exports.__wbg_document_e5c1786dea6542e4 = function(arg0) {
4080
+ const ret = arg0.document;
4081
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4082
+ };
4083
+ module.exports.__wbg_body_e70ae6abd01ae584 = function(arg0) {
4084
+ const ret = arg0.body;
4085
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4086
+ };
4087
+ module.exports.__wbg_createElement_5d4c76f218b78145 = function() {
4088
+ return handleError(function(arg0, arg1, arg2) {
4089
+ return arg0.createElement(getStringFromWasm0(arg1, arg2));
4090
+ }, arguments);
4091
+ };
4092
+ module.exports.__wbg_width_4c6f0048d64cf86b = function(arg0) {
4093
+ return arg0.width;
4094
+ };
4095
+ module.exports.__wbg_height_21f0d3fd8f753394 = function(arg0) {
4096
+ return arg0.height;
4097
+ };
4098
+ module.exports.__wbg_width_79e0847ed5883b03 = function(arg0) {
4099
+ return arg0.width;
4100
+ };
4101
+ module.exports.__wbg_height_e4e4e4779f8feac0 = function(arg0) {
4102
+ return arg0.height;
4103
+ };
4104
+ module.exports.__wbg_data_fda507064d127f5b = function(arg0, arg1) {
4105
+ const ret = arg1.data;
4106
+ const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
4107
+ const len1 = WASM_VECTOR_LEN;
4108
+ getDataViewMemory0().setInt32(arg0 + 4, len1, true);
4109
+ getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
4110
+ };
4111
+ module.exports.__wbg_newwithu8clampedarrayandsh_1fddccb3a94a5e05 = function() {
4112
+ return handleError(function(arg0, arg1, arg2, arg3) {
4113
+ return new ImageData(getClampedArrayU8FromWasm0(arg0, arg1), arg2 >>> 0, arg3 >>> 0);
4114
+ }, arguments);
4115
+ };
4116
+ module.exports.__wbg_instanceof_CanvasRenderingContext2d_3abbe7ec7af32cae = function(arg0) {
4117
+ let result;
4118
+ try {
4119
+ result = arg0 instanceof CanvasRenderingContext2D;
4120
+ } catch (_) {
4121
+ result = false;
4122
+ }
4123
+ return result;
4124
+ };
4125
+ module.exports.__wbg_drawImage_fede06db74e39a60 = function() {
4126
+ return handleError(function(arg0, arg1, arg2, arg3) {
4127
+ arg0.drawImage(arg1, arg2, arg3);
4128
+ }, arguments);
4129
+ };
4130
+ module.exports.__wbg_drawImage_f395c8e43c79a909 = function() {
4131
+ return handleError(function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
4132
+ arg0.drawImage(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
4133
+ }, arguments);
4134
+ };
4135
+ module.exports.__wbg_getImageData_5e1c242046e6b59e = function() {
4136
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
4137
+ return arg0.getImageData(arg1, arg2, arg3, arg4);
4138
+ }, arguments);
4139
+ };
4140
+ module.exports.__wbg_putImageData_a8b3e177ee06d521 = function() {
4141
+ return handleError(function(arg0, arg1, arg2, arg3) {
4142
+ arg0.putImageData(arg1, arg2, arg3);
4143
+ }, arguments);
4144
+ };
4145
+ module.exports.__wbg_instanceof_HtmlCanvasElement_25d964a0dde6717e = function(arg0) {
4146
+ let result;
4147
+ try {
4148
+ result = arg0 instanceof HTMLCanvasElement;
4149
+ } catch (_) {
4150
+ result = false;
4151
+ }
4152
+ return result;
4153
+ };
4154
+ module.exports.__wbg_width_dc225e55343b745e = function(arg0) {
4155
+ return arg0.width;
4156
+ };
4157
+ module.exports.__wbg_setwidth_488780db69b08846 = function(arg0, arg1) {
4158
+ arg0.width = arg1 >>> 0;
4159
+ };
4160
+ module.exports.__wbg_height_3a8bec2f3fe71b26 = function(arg0) {
4161
+ return arg0.height;
4162
+ };
4163
+ module.exports.__wbg_setheight_1761808c18403921 = function(arg0, arg1) {
4164
+ arg0.height = arg1 >>> 0;
4165
+ };
4166
+ module.exports.__wbg_getContext_fc99dbd3a9a7e318 = function() {
4167
+ return handleError(function(arg0, arg1, arg2) {
4168
+ const ret = arg0.getContext(getStringFromWasm0(arg1, arg2));
4169
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4170
+ }, arguments);
4171
+ };
4172
+ module.exports.__wbg_settextContent_f82a86a8df347e1c = function(arg0, arg1, arg2) {
4173
+ arg0.textContent = arg1 === 0 ? void 0 : getStringFromWasm0(arg1, arg2);
4174
+ };
4175
+ module.exports.__wbg_appendChild_fa3b00dade9fc4cf = function() {
4176
+ return handleError(function(arg0, arg1) {
4177
+ return arg0.appendChild(arg1);
4178
+ }, arguments);
4179
+ };
4180
+ module.exports.__wbg_newnoargs_e643855c6572a4a8 = function(arg0, arg1) {
4181
+ return new Function(getStringFromWasm0(arg0, arg1));
4182
+ };
4183
+ module.exports.__wbg_call_f96b398515635514 = function() {
4184
+ return handleError(function(arg0, arg1) {
4185
+ return arg0.call(arg1);
4186
+ }, arguments);
4187
+ };
4188
+ module.exports.__wbg_self_b9aad7f1c618bfaf = function() {
4189
+ return handleError(function() {
4190
+ return self.self;
4191
+ }, arguments);
4192
+ };
4193
+ module.exports.__wbg_window_55e469842c98b086 = function() {
4194
+ return handleError(function() {
4195
+ return window.window;
4196
+ }, arguments);
4197
+ };
4198
+ module.exports.__wbg_globalThis_d0957e302752547e = function() {
4199
+ return handleError(function() {
4200
+ return globalThis.globalThis;
4201
+ }, arguments);
4202
+ };
4203
+ module.exports.__wbg_global_ae2f87312b8987fb = function() {
4204
+ return handleError(function() {
4205
+ return global.global;
4206
+ }, arguments);
4207
+ };
4208
+ module.exports.__wbindgen_is_undefined = function(arg0) {
4209
+ return arg0 === void 0;
4210
+ };
4211
+ module.exports.__wbg_buffer_fcbfb6d88b2732e9 = function(arg0) {
4212
+ return arg0.buffer;
4213
+ };
4214
+ module.exports.__wbg_new_bc5d9aad3f9ac80e = function(arg0) {
4215
+ return new Uint8Array(arg0);
4216
+ };
4217
+ module.exports.__wbg_set_4b3aa8445ac1e91c = function(arg0, arg1, arg2) {
4218
+ arg0.set(arg1, arg2 >>> 0);
4219
+ };
4220
+ module.exports.__wbg_length_d9c4ded7e708c6a1 = function(arg0) {
4221
+ return arg0.length;
4222
+ };
4223
+ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
4224
+ const ptr1 = passStringToWasm0(debugString(arg1), wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4225
+ const len1 = WASM_VECTOR_LEN;
4226
+ getDataViewMemory0().setInt32(arg0 + 4, len1, true);
4227
+ getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
4228
+ };
4229
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
4230
+ throw new Error(getStringFromWasm0(arg0, arg1));
4231
+ };
4232
+ module.exports.__wbindgen_memory = function() {
4233
+ return wasm.memory;
4234
+ };
4235
+ module.exports.__wbindgen_init_externref_table = function() {
4236
+ const table = wasm.__wbindgen_export_2;
4237
+ const offset = table.grow(4);
4238
+ table.set(0, void 0);
4239
+ table.set(offset + 0, void 0);
4240
+ table.set(offset + 1, null);
4241
+ table.set(offset + 2, true);
4242
+ table.set(offset + 3, false);
4243
+ };
4244
+ const path = __require("path").join(__dirname, "photon_rs_bg.wasm");
4245
+ const bytes = __require("fs").readFileSync(path);
4246
+ const wasmModule = new WebAssembly.Module(bytes);
4247
+ wasm = new WebAssembly.Instance(wasmModule, imports).exports;
4248
+ module.exports.__wasm = wasm;
4249
+ wasm.__wbindgen_start();
4250
+ }));
4251
+ //#endregion
4252
+ export default require_photon_rs();
4253
+ export {};