Index: include/core/SkImageInfo.h |
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h |
index 3d82dc805c7998084986878283da43ef9f35b7b8..e709be9fc6c737e5890dd503a8296f25bce16976 100644 |
--- a/include/core/SkImageInfo.h |
+++ b/include/core/SkImageInfo.h |
@@ -136,14 +136,31 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, |
* Describe an image's dimensions and pixel type. |
*/ |
struct SkImageInfo { |
+public: |
int fWidth; |
int fHeight; |
SkColorType fColorType; |
SkAlphaType fAlphaType; |
+//private: |
+ enum Profile { |
+ kUnknown_Profile, |
+ kSRGB_Profile, |
+ kExponential_Profile, |
+ }; |
+ |
+ uint32_t fProfile; |
+ float fGamma; |
+ |
+public: |
+ static SkImageInfo MakeSRGB(int width, int height, SkColorType ct, SkAlphaType at); |
+ |
+ static SkImageInfo MakeWithGamam(int width, int height, SkColorType ct, SkAlphaType at, |
bsalomon
2014/08/27 17:11:30
typo, gamam
reed1
2014/08/27 18:52:49
Done.
|
+ float gamma); |
+ |
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at) { |
SkImageInfo info = { |
- width, height, ct, at |
+ width, height, ct, at, kUnknown_Profile, 0 |
}; |
return info; |
} |
@@ -153,7 +170,7 @@ struct SkImageInfo { |
*/ |
static SkImageInfo MakeN32(int width, int height, SkAlphaType at) { |
SkImageInfo info = { |
- width, height, kN32_SkColorType, at |
+ width, height, kN32_SkColorType, at, kUnknown_Profile, 0 |
}; |
return info; |
} |
@@ -163,7 +180,7 @@ struct SkImageInfo { |
*/ |
static SkImageInfo MakeN32Premul(int width, int height) { |
SkImageInfo info = { |
- width, height, kN32_SkColorType, kPremul_SkAlphaType |
+ width, height, kN32_SkColorType, kPremul_SkAlphaType, kUnknown_Profile, 0 |
}; |
return info; |
} |
@@ -177,21 +194,21 @@ struct SkImageInfo { |
static SkImageInfo MakeA8(int width, int height) { |
SkImageInfo info = { |
- width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType |
+ width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType, kUnknown_Profile, 0 |
}; |
return info; |
} |
static SkImageInfo MakeUnknown(int width, int height) { |
SkImageInfo info = { |
- width, height, kUnknown_SkColorType, kIgnore_SkAlphaType |
+ width, height, kUnknown_SkColorType, kIgnore_SkAlphaType, kUnknown_Profile, 0 |
}; |
return info; |
} |
static SkImageInfo MakeUnknown() { |
SkImageInfo info = { |
- 0, 0, kUnknown_SkColorType, kIgnore_SkAlphaType |
+ 0, 0, kUnknown_SkColorType, kIgnore_SkAlphaType, kUnknown_Profile, 0 |
}; |
return info; |
} |
@@ -256,6 +273,17 @@ struct SkImageInfo { |
} |
SkDEBUGCODE(void validate() const;) |
+ |
+ /** |
+ * If the Info was tagged to be sRGB, return true, else return false. |
+ */ |
+ bool isSRGB() const { return kSRGB_Profile == fProfile; } |
+ |
+ /** |
+ * If this was tagged with an explicit gamma value, return that value, else return 0. |
+ * If this was tagged as sRGB, return 0. |
+ */ |
+ float gamma() const { return fGamma; } |
}; |
#endif |