Line data Source code
1 : /*
2 : * Copyright 2017 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 SkColorSpaceXformer_DEFINED
9 : #define SkColorSpaceXformer_DEFINED
10 :
11 : #include "SkColorSpaceXform.h"
12 : #include "SkImage.h"
13 : #include "SkShader.h"
14 :
15 0 : class SkColorSpaceXformer : public SkNoncopyable {
16 : public:
17 : static std::unique_ptr<SkColorSpaceXformer> Make(sk_sp<SkColorSpace> dst);
18 :
19 : sk_sp<SkImage> apply(const SkImage* src);
20 : sk_sp<SkImage> apply(const SkBitmap& bitmap);
21 : sk_sp<SkColorFilter> apply(const SkColorFilter* shader);
22 : const SkPaint* apply(const SkPaint* src);
23 : const SkPaint& apply(const SkPaint& src);
24 : void apply(SkColor dst[], const SkColor src[], int n);
25 : SkColor apply(SkColor srgb);
26 :
27 : private:
28 : sk_sp<SkShader> apply(const SkShader* shader);
29 :
30 0 : SkColorSpaceXformer() {}
31 :
32 : sk_sp<SkColorSpace> fDst;
33 : std::unique_ptr<SkColorSpaceXform> fFromSRGB;
34 : SkPaint fDstPaint;
35 : };
36 :
37 : #endif
|