Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.renderscript; |
| 18 | |
| 19 | |
| 20 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 21 | * Intrinsic kernels for blending two {@link android.renderscript.Allocation} objects. |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 22 | **/ |
| 23 | public class ScriptIntrinsicBlend extends ScriptIntrinsic { |
Tim Murray | 460a049 | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 24 | ScriptIntrinsicBlend(long id, RenderScript rs) { |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 25 | super(id, rs); |
| 26 | } |
| 27 | |
| 28 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 29 | * Supported elements types are {@link Element#U8_4} |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 30 | * |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 31 | * @param rs The RenderScript context |
| 32 | * @param e Element type for inputs and outputs |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 33 | * |
| 34 | * @return ScriptIntrinsicBlend |
| 35 | */ |
| 36 | public static ScriptIntrinsicBlend create(RenderScript rs, Element e) { |
Tim Murray | 74478f7 | 2012-09-26 13:46:46 -0700 | [diff] [blame] | 37 | // 7 comes from RS_SCRIPT_INTRINSIC_ID_BLEND in rsDefines.h |
Tim Murray | 460a049 | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 38 | long id = rs.nScriptIntrinsicCreate(7, e.getID(rs)); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 39 | return new ScriptIntrinsicBlend(id, rs); |
| 40 | |
| 41 | } |
| 42 | |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 43 | private void blend(int id, Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
Tim Murray | 74478f7 | 2012-09-26 13:46:46 -0700 | [diff] [blame] | 44 | if (!ain.getElement().isCompatible(Element.U8_4(mRS))) { |
| 45 | throw new RSIllegalArgumentException("Input is not of expected format."); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 46 | } |
Tim Murray | 74478f7 | 2012-09-26 13:46:46 -0700 | [diff] [blame] | 47 | if (!aout.getElement().isCompatible(Element.U8_4(mRS))) { |
| 48 | throw new RSIllegalArgumentException("Output is not of expected format."); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 49 | } |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 50 | forEach(id, ain, aout, null, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 54 | * Sets dst = {0, 0, 0, 0} |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 55 | * |
| 56 | * @param ain The source buffer |
| 57 | * @param aout The destination buffer |
| 58 | */ |
| 59 | public void forEachClear(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 60 | forEachClear(ain, aout, null); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Sets dst = {0, 0, 0, 0} |
| 65 | * |
| 66 | * @param ain The source buffer |
| 67 | * @param aout The destination buffer |
| 68 | * @param opt LaunchOptions for clipping |
| 69 | */ |
| 70 | public void forEachClear(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 71 | blend(0, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Get a KernelID for the Clear kernel. |
| 76 | * |
| 77 | * @return Script.KernelID The KernelID object. |
| 78 | */ |
| 79 | public Script.KernelID getKernelIDClear() { |
| 80 | return createKernelID(0, 3, null, null); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 85 | * Sets dst = src |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 86 | * |
| 87 | * @param ain The source buffer |
| 88 | * @param aout The destination buffer |
| 89 | */ |
| 90 | public void forEachSrc(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 91 | forEachSrc(ain, aout, null); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Sets dst = src |
| 96 | * |
| 97 | * @param ain The source buffer |
| 98 | * @param aout The destination buffer |
| 99 | * @param opt LaunchOptions for clipping |
| 100 | */ |
| 101 | public void forEachSrc(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 102 | forEachDst(ain, aout, null); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Get a KernelID for the Src kernel. |
| 107 | * |
| 108 | * @return Script.KernelID The KernelID object. |
| 109 | */ |
| 110 | public Script.KernelID getKernelIDSrc() { |
| 111 | return createKernelID(1, 3, null, null); |
| 112 | } |
| 113 | |
| 114 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 115 | * Sets dst = dst |
| 116 | * |
| 117 | * This is a NOP. |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 118 | * |
| 119 | * @param ain The source buffer |
| 120 | * @param aout The destination buffer |
| 121 | */ |
| 122 | public void forEachDst(Allocation ain, Allocation aout) { |
| 123 | // NOP |
| 124 | } |
| 125 | |
| 126 | /** |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 127 | * Sets dst = dst |
| 128 | * |
| 129 | * This is a NOP. |
| 130 | * |
| 131 | * @param ain The source buffer |
| 132 | * @param aout The destination buffer |
| 133 | * @param opt LaunchOptions for clipping |
| 134 | */ |
| 135 | public void forEachDst(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 136 | // N, optOP |
| 137 | } |
| 138 | |
| 139 | /** |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 140 | * Get a KernelID for the Dst kernel. |
| 141 | * |
| 142 | * @return Script.KernelID The KernelID object. |
| 143 | */ |
| 144 | public Script.KernelID getKernelIDDst() { |
| 145 | return createKernelID(2, 3, null, null); |
| 146 | } |
| 147 | |
| 148 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 149 | * Sets dst = src + dst * (1.0 - src.a) |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 150 | * |
| 151 | * @param ain The source buffer |
| 152 | * @param aout The destination buffer |
| 153 | */ |
| 154 | public void forEachSrcOver(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 155 | forEachSrcOver(ain, aout, null); |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Sets dst = src + dst * (1.0 - src.a) |
| 160 | * |
| 161 | * @param ain The source buffer |
| 162 | * @param aout The destination buffer |
| 163 | * @param opt LaunchOptions for clipping |
| 164 | */ |
| 165 | public void forEachSrcOver(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 166 | blend(3, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Get a KernelID for the SrcOver kernel. |
| 171 | * |
| 172 | * @return Script.KernelID The KernelID object. |
| 173 | */ |
| 174 | public Script.KernelID getKernelIDSrcOver() { |
| 175 | return createKernelID(3, 3, null, null); |
| 176 | } |
| 177 | |
| 178 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 179 | * Sets dst = dst + src * (1.0 - dst.a) |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 180 | * |
| 181 | * @param ain The source buffer |
| 182 | * @param aout The destination buffer |
| 183 | */ |
| 184 | public void forEachDstOver(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 185 | forEachDstOver(ain, aout, null); |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Sets dst = dst + src * (1.0 - dst.a) |
| 190 | * |
| 191 | * @param ain The source buffer |
| 192 | * @param aout The destination buffer |
| 193 | * @param opt LaunchOptions for clipping |
| 194 | */ |
| 195 | public void forEachDstOver(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 196 | blend(4, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Get a KernelID for the DstOver kernel. |
| 201 | * |
| 202 | * @return Script.KernelID The KernelID object. |
| 203 | */ |
| 204 | public Script.KernelID getKernelIDDstOver() { |
| 205 | return createKernelID(4, 3, null, null); |
| 206 | } |
| 207 | |
| 208 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 209 | * Sets dst = src * dst.a |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 210 | * |
| 211 | * @param ain The source buffer |
| 212 | * @param aout The destination buffer |
| 213 | */ |
| 214 | public void forEachSrcIn(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 215 | forEachSrcIn(ain, aout, null); |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Sets dst = src * dst.a |
| 220 | * |
| 221 | * @param ain The source buffer |
| 222 | * @param aout The destination buffer |
| 223 | * @param opt LaunchOptions for clipping |
| 224 | */ |
| 225 | public void forEachSrcIn(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 226 | blend(5, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Get a KernelID for the SrcIn kernel. |
| 231 | * |
| 232 | * @return Script.KernelID The KernelID object. |
| 233 | */ |
| 234 | public Script.KernelID getKernelIDSrcIn() { |
| 235 | return createKernelID(5, 3, null, null); |
| 236 | } |
| 237 | |
| 238 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 239 | * Sets dst = dst * src.a |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 240 | * |
| 241 | * @param ain The source buffer |
| 242 | * @param aout The destination buffer |
| 243 | */ |
| 244 | public void forEachDstIn(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 245 | forEachDstIn(ain, aout, null); |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Sets dst = dst * src.a |
| 250 | * |
| 251 | * @param ain The source buffer |
| 252 | * @param aout The destination buffer |
| 253 | * @param opt LaunchOptions for clipping |
| 254 | */ |
| 255 | public void forEachDstIn(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 256 | blend(6, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Get a KernelID for the DstIn kernel. |
| 261 | * |
| 262 | * @return Script.KernelID The KernelID object. |
| 263 | */ |
| 264 | public Script.KernelID getKernelIDDstIn() { |
| 265 | return createKernelID(6, 3, null, null); |
| 266 | } |
| 267 | |
| 268 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 269 | * Sets dst = src * (1.0 - dst.a) |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 270 | * |
| 271 | * @param ain The source buffer |
| 272 | * @param aout The destination buffer |
| 273 | */ |
| 274 | public void forEachSrcOut(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 275 | forEachSrcOut(ain, aout, null); |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * Sets dst = src * (1.0 - dst.a) |
| 280 | * |
| 281 | * @param ain The source buffer |
| 282 | * @param aout The destination buffer |
| 283 | * @param opt LaunchOptions for clipping |
| 284 | */ |
| 285 | public void forEachSrcOut(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 286 | blend(7, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Get a KernelID for the SrcOut kernel. |
| 291 | * |
| 292 | * @return Script.KernelID The KernelID object. |
| 293 | */ |
| 294 | public Script.KernelID getKernelIDSrcOut() { |
| 295 | return createKernelID(7, 3, null, null); |
| 296 | } |
| 297 | |
| 298 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 299 | * Sets dst = dst * (1.0 - src.a) |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 300 | * |
| 301 | * @param ain The source buffer |
| 302 | * @param aout The destination buffer |
| 303 | */ |
| 304 | public void forEachDstOut(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 305 | forEachDstOut(ain, aout, null); |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * Sets dst = dst * (1.0 - src.a) |
| 310 | * |
| 311 | * @param ain The source buffer |
| 312 | * @param aout The destination buffer |
| 313 | * @param opt LaunchOptions for clipping |
| 314 | */ |
| 315 | public void forEachDstOut(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 316 | blend(8, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | /** |
| 320 | * Get a KernelID for the DstOut kernel. |
| 321 | * |
| 322 | * @return Script.KernelID The KernelID object. |
| 323 | */ |
| 324 | public Script.KernelID getKernelIDDstOut() { |
| 325 | return createKernelID(8, 3, null, null); |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * dst.rgb = src.rgb * dst.a + (1.0 - src.a) * dst.rgb |
| 330 | * dst.a = dst.a |
| 331 | * |
| 332 | * @param ain The source buffer |
| 333 | * @param aout The destination buffer |
| 334 | */ |
| 335 | public void forEachSrcAtop(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 336 | forEachSrcAtop(ain, aout, null); |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * dst.rgb = src.rgb * dst.a + (1.0 - src.a) * dst.rgb |
| 341 | * dst.a = dst.a |
| 342 | * |
| 343 | * @param ain The source buffer |
| 344 | * @param aout The destination buffer |
| 345 | * @param opt LaunchOptions for clipping |
| 346 | */ |
| 347 | public void forEachSrcAtop(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 348 | blend(9, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 349 | } |
| 350 | |
| 351 | /** |
| 352 | * Get a KernelID for the SrcAtop kernel. |
| 353 | * |
| 354 | * @return Script.KernelID The KernelID object. |
| 355 | */ |
| 356 | public Script.KernelID getKernelIDSrcAtop() { |
| 357 | return createKernelID(9, 3, null, null); |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * dst = dst.rgb * src.a + (1.0 - dst.a) * src.rgb |
| 362 | * dst.a = src.a |
| 363 | * |
| 364 | * @param ain The source buffer |
| 365 | * @param aout The destination buffer |
| 366 | */ |
| 367 | public void forEachDstAtop(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 368 | forEachDstAtop(ain, aout, null); |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * dst = dst.rgb * src.a + (1.0 - dst.a) * src.rgb |
| 373 | * dst.a = src.a |
| 374 | * |
| 375 | * @param ain The source buffer |
| 376 | * @param aout The destination buffer |
| 377 | * @param opt LaunchOptions for clipping |
| 378 | */ |
| 379 | public void forEachDstAtop(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 380 | blend(10, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | /** |
| 384 | * Get a KernelID for the DstAtop kernel. |
| 385 | * |
| 386 | * @return Script.KernelID The KernelID object. |
| 387 | */ |
| 388 | public Script.KernelID getKernelIDDstAtop() { |
| 389 | return createKernelID(10, 3, null, null); |
| 390 | } |
| 391 | |
| 392 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 393 | * Sets dst = {src.r ^ dst.r, src.g ^ dst.g, src.b ^ dst.b, src.a ^ dst.a} |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 394 | * |
| 395 | * @param ain The source buffer |
| 396 | * @param aout The destination buffer |
| 397 | */ |
| 398 | public void forEachXor(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 399 | forEachXor(ain, aout, null); |
| 400 | } |
| 401 | |
| 402 | /** |
| 403 | * Sets dst = {src.r ^ dst.r, src.g ^ dst.g, src.b ^ dst.b, src.a ^ dst.a} |
| 404 | * |
| 405 | * @param ain The source buffer |
| 406 | * @param aout The destination buffer |
| 407 | * @param opt LaunchOptions for clipping |
| 408 | */ |
| 409 | public void forEachXor(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 410 | blend(11, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | /** |
| 414 | * Get a KernelID for the Xor kernel. |
| 415 | * |
| 416 | * @return Script.KernelID The KernelID object. |
| 417 | */ |
| 418 | public Script.KernelID getKernelIDXor() { |
| 419 | return createKernelID(11, 3, null, null); |
| 420 | } |
| 421 | |
| 422 | //////// |
| 423 | /* |
| 424 | public void forEachNormal(Allocation ain, Allocation aout) { |
| 425 | blend(12, ain, aout); |
| 426 | } |
| 427 | |
| 428 | public void forEachAverage(Allocation ain, Allocation aout) { |
| 429 | blend(13, ain, aout); |
| 430 | } |
| 431 | */ |
| 432 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 433 | * Sets dst = src * dst |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 434 | * |
| 435 | * @param ain The source buffer |
| 436 | * @param aout The destination buffer |
| 437 | */ |
| 438 | public void forEachMultiply(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 439 | forEachMultiply(ain, aout, null); |
| 440 | } |
| 441 | |
| 442 | /** |
| 443 | * Sets dst = src * dst |
| 444 | * |
| 445 | * @param ain The source buffer |
| 446 | * @param aout The destination buffer |
| 447 | * @param opt LaunchOptions for clipping |
| 448 | */ |
| 449 | public void forEachMultiply(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 450 | blend(14, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 451 | } |
| 452 | |
| 453 | /** |
| 454 | * Get a KernelID for the Multiply kernel. |
| 455 | * |
| 456 | * @return Script.KernelID The KernelID object. |
| 457 | */ |
| 458 | public Script.KernelID getKernelIDMultiply() { |
| 459 | return createKernelID(14, 3, null, null); |
| 460 | } |
| 461 | |
| 462 | /* |
| 463 | public void forEachScreen(Allocation ain, Allocation aout) { |
| 464 | blend(15, ain, aout); |
| 465 | } |
| 466 | |
| 467 | public void forEachDarken(Allocation ain, Allocation aout) { |
| 468 | blend(16, ain, aout); |
| 469 | } |
| 470 | |
| 471 | public void forEachLighten(Allocation ain, Allocation aout) { |
| 472 | blend(17, ain, aout); |
| 473 | } |
| 474 | |
| 475 | public void forEachOverlay(Allocation ain, Allocation aout) { |
| 476 | blend(18, ain, aout); |
| 477 | } |
| 478 | |
| 479 | public void forEachHardlight(Allocation ain, Allocation aout) { |
| 480 | blend(19, ain, aout); |
| 481 | } |
| 482 | |
| 483 | public void forEachSoftlight(Allocation ain, Allocation aout) { |
| 484 | blend(20, ain, aout); |
| 485 | } |
| 486 | |
| 487 | public void forEachDifference(Allocation ain, Allocation aout) { |
| 488 | blend(21, ain, aout); |
| 489 | } |
| 490 | |
| 491 | public void forEachNegation(Allocation ain, Allocation aout) { |
| 492 | blend(22, ain, aout); |
| 493 | } |
| 494 | |
| 495 | public void forEachExclusion(Allocation ain, Allocation aout) { |
| 496 | blend(23, ain, aout); |
| 497 | } |
| 498 | |
| 499 | public void forEachColorDodge(Allocation ain, Allocation aout) { |
| 500 | blend(24, ain, aout); |
| 501 | } |
| 502 | |
| 503 | public void forEachInverseColorDodge(Allocation ain, Allocation aout) { |
| 504 | blend(25, ain, aout); |
| 505 | } |
| 506 | |
| 507 | public void forEachSoftDodge(Allocation ain, Allocation aout) { |
| 508 | blend(26, ain, aout); |
| 509 | } |
| 510 | |
| 511 | public void forEachColorBurn(Allocation ain, Allocation aout) { |
| 512 | blend(27, ain, aout); |
| 513 | } |
| 514 | |
| 515 | public void forEachInverseColorBurn(Allocation ain, Allocation aout) { |
| 516 | blend(28, ain, aout); |
| 517 | } |
| 518 | |
| 519 | public void forEachSoftBurn(Allocation ain, Allocation aout) { |
| 520 | blend(29, ain, aout); |
| 521 | } |
| 522 | |
| 523 | public void forEachReflect(Allocation ain, Allocation aout) { |
| 524 | blend(30, ain, aout); |
| 525 | } |
| 526 | |
| 527 | public void forEachGlow(Allocation ain, Allocation aout) { |
| 528 | blend(31, ain, aout); |
| 529 | } |
| 530 | |
| 531 | public void forEachFreeze(Allocation ain, Allocation aout) { |
| 532 | blend(32, ain, aout); |
| 533 | } |
| 534 | |
| 535 | public void forEachHeat(Allocation ain, Allocation aout) { |
| 536 | blend(33, ain, aout); |
| 537 | } |
| 538 | */ |
| 539 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 540 | * Sets dst = min(src + dst, 1.0) |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 541 | * |
| 542 | * @param ain The source buffer |
| 543 | * @param aout The destination buffer |
| 544 | */ |
| 545 | public void forEachAdd(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 546 | forEachAdd(ain, aout, null); |
| 547 | } |
| 548 | |
| 549 | /** |
| 550 | * Sets dst = min(src + dst, 1.0) |
| 551 | * |
| 552 | * @param ain The source buffer |
| 553 | * @param aout The destination buffer |
| 554 | * @param opt LaunchOptions for clipping |
| 555 | */ |
| 556 | public void forEachAdd(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 557 | blend(34, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | /** |
| 561 | * Get a KernelID for the Add kernel. |
| 562 | * |
| 563 | * @return Script.KernelID The KernelID object. |
| 564 | */ |
| 565 | public Script.KernelID getKernelIDAdd() { |
| 566 | return createKernelID(34, 3, null, null); |
| 567 | } |
| 568 | |
| 569 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 570 | * Sets dst = max(dst - src, 0.0) |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 571 | * |
| 572 | * @param ain The source buffer |
| 573 | * @param aout The destination buffer |
| 574 | */ |
| 575 | public void forEachSubtract(Allocation ain, Allocation aout) { |
Tim Murray | 6f842ac | 2014-01-13 11:47:53 -0800 | [diff] [blame] | 576 | forEachSubtract(ain, aout, null); |
| 577 | } |
| 578 | |
| 579 | /** |
| 580 | * Sets dst = max(dst - src, 0.0) |
| 581 | * |
| 582 | * @param ain The source buffer |
| 583 | * @param aout The destination buffer |
| 584 | * @param opt LaunchOptions for clipping |
| 585 | */ |
| 586 | public void forEachSubtract(Allocation ain, Allocation aout, Script.LaunchOptions opt) { |
| 587 | blend(35, ain, aout, opt); |
Jason Sams | f70bb04 | 2012-09-21 16:10:49 -0700 | [diff] [blame] | 588 | } |
| 589 | |
| 590 | /** |
| 591 | * Get a KernelID for the Subtract kernel. |
| 592 | * |
| 593 | * @return Script.KernelID The KernelID object. |
| 594 | */ |
| 595 | public Script.KernelID getKernelIDSubtract() { |
| 596 | return createKernelID(35, 3, null, null); |
| 597 | } |
| 598 | |
| 599 | /* |
| 600 | public void forEachStamp(Allocation ain, Allocation aout) { |
| 601 | blend(36, ain, aout); |
| 602 | } |
| 603 | |
| 604 | public void forEachRed(Allocation ain, Allocation aout) { |
| 605 | blend(37, ain, aout); |
| 606 | } |
| 607 | |
| 608 | public void forEachGreen(Allocation ain, Allocation aout) { |
| 609 | blend(38, ain, aout); |
| 610 | } |
| 611 | |
| 612 | public void forEachBlue(Allocation ain, Allocation aout) { |
| 613 | blend(39, ain, aout); |
| 614 | } |
| 615 | |
| 616 | public void forEachHue(Allocation ain, Allocation aout) { |
| 617 | blend(40, ain, aout); |
| 618 | } |
| 619 | |
| 620 | public void forEachSaturation(Allocation ain, Allocation aout) { |
| 621 | blend(41, ain, aout); |
| 622 | } |
| 623 | |
| 624 | public void forEachColor(Allocation ain, Allocation aout) { |
| 625 | blend(42, ain, aout); |
| 626 | } |
| 627 | |
| 628 | public void forEachLuminosity(Allocation ain, Allocation aout) { |
| 629 | blend(43, ain, aout); |
| 630 | } |
| 631 | */ |
| 632 | } |
| 633 | |