skia2/include/core/SkICC.h
Ravi Mistry 113d05fa7b Revert "Revert "WIP: Skia support library for ICC tasks""
This reverts commit eb733fbf56.

Reason for revert: Revert patch was automatically merged incorrectly?

Original change's description:
> Revert "WIP: Skia support library for ICC tasks"
> 
> This reverts commit fc8dc3194a.
> 
> Reason for revert: Breaks Build-Mac-Clang-Arm7-{Debug,Release}-iOS builds.
> Example tasks:
> * https://chromium-swarm.appspot.com/task?id=3322f668620b9e10&refresh=10
> * https://chromium-swarm.appspot.com/task?id=332296146331e810&refresh=10
> 
> Original change's description:
> > WIP: Skia support library for ICC tasks
> > 
> > As a starting point, this would be mostly trivial to implement using
> > SkColorSpace.
> > 
> > This also would give us the flexibility to begin to move all of
> > the ICC related code from SkColorSpace to SkICC.
> > 
> > What are the advantages of moving this away from SkColorSpace?
> > (1) A long term goal (once Chrome uses SkCodec), might be to
> > move SkColorSpace::MakeICC() out of the public API.  That way,
> > we can guarantee that we can draw to/from *any* SkColorSpace.
> > (2) Keeps SkColorSpace separate from ICC-specific representations
> > like SkColorSpaceTransferFn etc.
> > 
> > BUG=skia:
> > 
> > Change-Id: Iddeb9903221fb57fbfc01218d8641c928b4a5165
> > Reviewed-on: https://skia-review.googlesource.com/5676
> > Commit-Queue: Matt Sarett <msarett@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
> > 
> 
> TBR=mtklein@google.com,msarett@google.com,brianosman@google.com,reed@google.com,reviews@skia.org
> BUG=skia:
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> 
> Change-Id: Ibdf272fce25892402bd3e85595fb8814cdf59856
> Reviewed-on: https://skia-review.googlesource.com/6232
> Commit-Queue: Ravi Mistry <rmistry@google.com>
> Reviewed-by: Ravi Mistry <rmistry@google.com>
> 

TBR=mtklein@google.com,rmistry@google.com,msarett@google.com,reviews@skia.org,brianosman@google.com,reed@google.com
BUG=skia:
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I68b1624cfab8adfe31b17e1193a7766507dec8b0
Reviewed-on: https://skia-review.googlesource.com/6233
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
2016-12-17 01:31:22 +00:00

74 lines
2.3 KiB
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkICC_DEFINED
#define SkICC_DEFINED
#include "SkRefCnt.h"
struct SkColorSpaceTransferFn;
class SkColorSpace;
class SkData;
class SkMatrix44;
class SK_API SkICC : public SkRefCnt {
public:
/**
* Parse an ICC profile.
*
* Returns nullptr if the data is not a valid ICC profile or if the profile
* input space is not RGB.
*/
static sk_sp<SkICC> Make(const void*, size_t);
/**
* If the gamut can be represented as transformation into XYZ D50, returns
* true and sets the proper values in |toXYZD50|.
*
* If not, returns false. This indicates that the ICC data is too complex
* to isolate a simple gamut transformation.
*/
bool toXYZD50(SkMatrix44* toXYZD50) const;
/**
* If the transfer function can be represented as coefficients to the standard
* equation, returns true and sets |fn| to the proper values.
*
* If not, returns false. This indicates one of the following:
* (1) The R, G, and B transfer functions are not the same.
* (2) The transfer function is represented as a table that we have not managed
* to match to a standard curve.
* (3) The ICC data is too complex to isolate a single transfer function.
*/
bool isNumericalTransferFn(SkColorSpaceTransferFn* fn) const;
/**
* If the transfer function can be approximated as coefficients to the standard
* equation, returns true and sets |fn| to the proper values.
*
* If not, returns false. This indicates one of the following:
* (1) The R, G, and B transfer functions are not the same.
* (2) The transfer function is represented as a table that is not increasing with
* end points at zero and one.
* (3) The ICC data is too complex to isolate a single transfer function.
*/
bool approximateNumericalTransferFn(SkColorSpaceTransferFn* fn) const;
/**
* Write an ICC profile with transfer function |fn| and gamut |toXYZD50|.
*/
static sk_sp<SkData> WriteToICC(const SkColorSpaceTransferFn& fn, const SkMatrix44& toXYZD50);
private:
SkICC(sk_sp<SkColorSpace> colorSpace);
sk_sp<SkColorSpace> fColorSpace;
};
#endif