bsalomon | f267c1e | 2016-02-01 13:16:14 -0800 | [diff] [blame] | 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; |
Robert Phillips | bc7a4fb | 2017-01-23 15:30:35 -0500 | [diff] [blame] | 14 | class GrTextureProxy; |
bsalomon | f267c1e | 2016-02-01 13:16:14 -0800 | [diff] [blame] | 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 | */ |
Robert Phillips | fbcef6e | 2017-06-15 12:07:18 -0400 | [diff] [blame] | 21 | sk_sp<GrFragmentProcessor> MakeYUVToRGB(sk_sp<GrTextureProxy> yProxy, |
Robert Phillips | bc7a4fb | 2017-01-23 15:30:35 -0500 | [diff] [blame] | 22 | sk_sp<GrTextureProxy> uProxy, |
| 23 | sk_sp<GrTextureProxy> vProxy, const SkISize sizes[3], |
jbauman | b445a57 | 2016-06-09 13:24:48 -0700 | [diff] [blame] | 24 | SkYUVColorSpace colorSpace, bool nv12); |
bsalomon | f267c1e | 2016-02-01 13:16:14 -0800 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Creates a processor that performs color conversion from the passed in processor's RGB |
| 28 | * channels to Y, U ,and V channels. The output color is (y, u, v, a) where a is the passed in |
| 29 | * processor's alpha output. |
| 30 | */ |
Robert Phillips | bc7a4fb | 2017-01-23 15:30:35 -0500 | [diff] [blame] | 31 | sk_sp<GrFragmentProcessor> MakeRGBToYUV(sk_sp<GrFragmentProcessor>, SkYUVColorSpace); |
bsalomon | f267c1e | 2016-02-01 13:16:14 -0800 | [diff] [blame] | 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 | */ |
Robert Phillips | bc7a4fb | 2017-01-23 15:30:35 -0500 | [diff] [blame] | 38 | sk_sp<GrFragmentProcessor> MakeRGBToUV(sk_sp<GrFragmentProcessor>, SkYUVColorSpace); |
bsalomon | f267c1e | 2016-02-01 13:16:14 -0800 | [diff] [blame] | 39 | /** |
| 40 | * Creates a processor that performs color conversion from the passed in fragment processors's |
| 41 | * RGB channels to Y, U, or V (replicated across all four output color channels). The alpha |
| 42 | * output of the passed in fragment processor is ignored. |
| 43 | */ |
Robert Phillips | bc7a4fb | 2017-01-23 15:30:35 -0500 | [diff] [blame] | 44 | sk_sp<GrFragmentProcessor> MakeRGBToY(sk_sp<GrFragmentProcessor>, SkYUVColorSpace); |
| 45 | sk_sp<GrFragmentProcessor> MakeRGBToU(sk_sp<GrFragmentProcessor>, SkYUVColorSpace); |
| 46 | sk_sp<GrFragmentProcessor> MakeRGBToV(sk_sp<GrFragmentProcessor>, SkYUVColorSpace); |
bsalomon | f267c1e | 2016-02-01 13:16:14 -0800 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | #endif |