add Type enum to SkColorSpace
Bug: 727128 Change-Id: I116de4efd6e64504a4e1892f431f528533b1173a Reviewed-on: https://skia-review.googlesource.com/64261 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
This commit is contained in:
parent
2d6b3937e0
commit
6566b97b76
@ -104,6 +104,16 @@ public:
|
||||
*/
|
||||
static sk_sp<SkColorSpace> MakeICC(const void*, size_t);
|
||||
|
||||
/**
|
||||
* Types of colorspaces.
|
||||
*/
|
||||
enum Type {
|
||||
kRGB_Type,
|
||||
kCMYK_Type,
|
||||
kGray_Type,
|
||||
};
|
||||
Type type() const;
|
||||
|
||||
/**
|
||||
* Returns true if the color space gamma is near enough to be approximated as sRGB.
|
||||
* This includes the canonical sRGB transfer function as well as a 2.2f exponential
|
||||
|
@ -234,6 +234,14 @@ sk_sp<SkColorSpace> SkColorSpace::MakeSRGBLinear() {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkColorSpace::Type SkColorSpace::type() const {
|
||||
SkMatrix44 m(SkMatrix44::kUninitialized_Constructor);
|
||||
if (this->toXYZD50(&m)) {
|
||||
return m.isScale() ? kGray_Type : kRGB_Type;
|
||||
}
|
||||
return as_CSB(this)->onIsCMYK() ? kCMYK_Type : kRGB_Type;
|
||||
}
|
||||
|
||||
bool SkColorSpace::gammaCloseToSRGB() const {
|
||||
return as_CSB(this)->onGammaCloseToSRGB();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user