OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 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 SkColorSpaceXform_DEFINED |
| 9 #define SkColorSpaceXform_DEFINED |
| 10 |
| 11 #include "SkColorSpace.h" |
| 12 |
| 13 class SkColorSpaceXform { |
| 14 public: |
| 15 |
| 16 /** |
| 17 * Create an object to handle color space conversions. |
| 18 * |
| 19 * @param srcSpace The encoded color space. |
| 20 * @param dstSpace The destination color space. |
| 21 * |
| 22 */ |
| 23 static std::unique_ptr<SkColorSpaceXform> New(const sk_sp<SkColorSpace>& src
Space, |
| 24 const sk_sp<SkColorSpace>& dst
Space); |
| 25 |
| 26 /** |
| 27 * Apply the color conversion to a src buffer, storing the output in the ds
t buffer. |
| 28 * The src is stored in RGBA_8888 and the dst is stored in 8888 platform fo
rmat. |
| 29 * The output is not premultiplied. |
| 30 */ |
| 31 virtual void xform_RGBA_8888(uint32_t* dst, const uint32_t* src, uint32_t le
n) const = 0; |
| 32 |
| 33 virtual ~SkColorSpaceXform() {} |
| 34 }; |
| 35 |
| 36 class SkGammaByValueXform : public SkColorSpaceXform { |
| 37 public: |
| 38 |
| 39 void xform_RGBA_8888(uint32_t* dst, const uint32_t* src, uint32_t len) const
override; |
| 40 |
| 41 private: |
| 42 SkGammaByValueXform(float srcGammas[3], const SkMatrix44& srcToDst, float ds
tGammas[3]); |
| 43 |
| 44 float fSrcGammas[3]; |
| 45 const SkMatrix44 fSrcToDst; |
| 46 float fDstGammas[3]; |
| 47 |
| 48 friend class SkColorSpaceXform; |
| 49 }; |
| 50 |
| 51 #endif |
OLD | NEW |