Home | History | Annotate | Download | only in effects
      1 /*
      2  * Copyright 2014 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef GrYUVEffect_DEFINED
      9 #define GrYUVEffect_DEFINED
     10 
     11 #include "SkImageInfo.h"
     12 
     13 class GrFragmentProcessor;
     14 class GrTexture;
     15 
     16 namespace GrYUVEffect {
     17     /**
     18      * Creates an effect that performs color conversion from YUV to RGB. The input textures are
     19      * assumed to be kA8_GrPixelConfig.
     20      */
     21     const GrFragmentProcessor* CreateYUVToRGB(GrTexture* yTexture, GrTexture* uTexture,
     22                                               GrTexture* vTexture, const SkISize sizes[3],
     23                                               SkYUVColorSpace colorSpace);
     24 
     25     /**
     26      * Creates a processor that performs color conversion from the passed in processor's RGB
     27      * channels to Y, U ,and V channels. The output color is (y, u, v, a) where a is the passed in
     28      * processor's alpha output.
     29      */
     30     const GrFragmentProcessor* CreateRGBToYUV(const GrFragmentProcessor*,
     31                                               SkYUVColorSpace colorSpace);
     32 
     33     /**
     34      * Creates a processor that performs color conversion from the passed in processor's RGB
     35      * channels to U and V channels. The output color is (u, v, 0, a) where a is the passed in
     36      * processor's alpha output.
     37      */
     38     const GrFragmentProcessor* CreateRGBToUV(const GrFragmentProcessor*,
     39                                              SkYUVColorSpace colorSpace);
     40     /**
     41      * Creates a processor that performs color conversion from the passed in fragment processors's
     42      * RGB channels to Y, U, or V (replicated across all four output color channels). The alpha
     43      * output of the passed in fragment processor is ignored.
     44      */
     45     const GrFragmentProcessor* CreateRGBToY(const GrFragmentProcessor*, SkYUVColorSpace colorSpace);
     46     const GrFragmentProcessor* CreateRGBToU(const GrFragmentProcessor*, SkYUVColorSpace colorSpace);
     47     const GrFragmentProcessor* CreateRGBToV(const GrFragmentProcessor*, SkYUVColorSpace colorSpace);
     48 };
     49 
     50 #endif
     51