| Index: include/core/SkImageInfo.h
|
| diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
|
| index 1165479f7484267e47dc5dfa2bba90e5a79dce56..e0bce2a7c0596b1d2dd19e4f853269a56702ed3d 100644
|
| --- a/include/core/SkImageInfo.h
|
| +++ b/include/core/SkImageInfo.h
|
| @@ -109,6 +109,60 @@ struct SkImageInfo {
|
| SkColorType fColorType;
|
| SkAlphaType fAlphaType;
|
|
|
| + static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at) {
|
| + SkASSERT(width >= 0);
|
| + SkASSERT(height >= 0);
|
| + SkImageInfo info = {
|
| + width, height, ct, at
|
| + };
|
| + return info;
|
| + }
|
| +
|
| + /**
|
| + * Sets colortype to the native ARGB32 type.
|
| + */
|
| + static SkImageInfo MakeN32(int width, int height, SkAlphaType at) {
|
| + SkASSERT(width >= 0);
|
| + SkASSERT(height >= 0);
|
| + SkImageInfo info = {
|
| + width, height, kPMColor_SkColorType, at
|
| + };
|
| + return info;
|
| + }
|
| +
|
| + /**
|
| + * Sets colortype to the native ARGB32 type, and the alphatype to premul.
|
| + */
|
| + static SkImageInfo MakeN32Premul(int width, int height) {
|
| + SkASSERT(width >= 0);
|
| + SkASSERT(height >= 0);
|
| + SkImageInfo info = {
|
| + width, height, kPMColor_SkColorType, kPremul_SkAlphaType
|
| + };
|
| + return info;
|
| + }
|
| +
|
| + /**
|
| + * Sets colortype to the native ARGB32 type, and the alphatype to opaque.
|
| + */
|
| + static SkImageInfo MakeN32Opaque(int width, int height) {
|
| + SkASSERT(width >= 0);
|
| + SkASSERT(height >= 0);
|
| + SkImageInfo info = {
|
| + width, height, kPMColor_SkColorType, kOpaque_SkAlphaType
|
| + };
|
| + return info;
|
| + }
|
| +
|
| + static SkImageInfo MakeA8(int width, int height) {
|
| + SkASSERT(width >= 0);
|
| + SkASSERT(height >= 0);
|
| + SkImageInfo info = {
|
| + width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType
|
| + };
|
| + return info;
|
| + }
|
| +
|
| bool isOpaque() const {
|
| return SkAlphaTypeIsOpaque(fAlphaType);
|
| }
|
|
|