| /* |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You under the Apache License, Version 2.0 |
| * (the "License"); you may not use this file except in compliance with |
| * the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| <languageVersion : 1.0;>
|
| kernel WipeRight
|
| < namespace : "flex";
|
| vendor : "Adobe";
|
| version : 1;
|
| description : "Wipe right between two images for Flex effects";
|
| >
|
| {
|
| // first input is unused in AnimateTransitionShader effect
|
| input image4 src0;
|
| input image4 from;
|
| input image4 to;
|
| output pixel4 dst;
|
|
|
| parameter float progress<
|
| minValue: 0.00;
|
| maxValue: 1.00;
|
| defaultValue: 0.0;
|
| >;
|
|
|
| parameter float width<
|
| minValue: 0.0;
|
| maxValue: 1024.0;
|
| defaultValue: 576.0;
|
| >;
|
|
|
| parameter float height<
|
| minValue: 0.00;
|
| maxValue: 1024.0;
|
| defaultValue: 384.0;
|
| >;
|
|
|
| void
|
| evaluatePixel()
|
| {
|
| float2 coord = outCoord();
|
|
|
| // Use src0 in a branch we won't reach just to defeat the
|
| // optimizer from removing the input parameter
|
| if ((width * progress) < coord.x)
|
| dst = sampleNearest(from, coord);
|
| else if (progress < 100.0)
|
| dst = sampleNearest(to, coord);
|
| else
|
| dst = sampleNearest(src0, coord);
|
| // workaround for Flash filter bug that replicates last column/row
|
| if (coord.x >= width || coord.y >= height)
|
| dst.a = 0.0;
|
| }
|
| }
|