| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2013 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 SkAlpha_DEFINED | |
| 9 #define SkAlpha_DEFINED | |
| 10 | |
| 11 #include "SkTypes.h" | |
| 12 | |
| 13 /** | |
| 14 * Describes how to interpret the alpha compoent of a pixel. | |
| 15 */ | |
| 16 enum SkAlphaType { | |
| 17 /** | |
| 18 * All pixels should be treated as opaque, regardless of the value stored | |
| 19 * in their alpha field. Used for legacy images that wrote 0 or garbarge | |
| 20 * in their alpha field, but intended the RGB to be treated as opaque. | |
| 21 */ | |
| 22 kIgnore_SkAlphaType, | |
| 23 | |
| 24 /** | |
| 25 * All pixels are stored as opaque. This differs slightly from kIgnore in | |
| 26 * that kOpaque has correct "opaque" values stored in the pixels, while | |
| 27 * kIgnore may not, but in both cases the caller should treat the pixels | |
| 28 * as opaque. | |
| 29 */ | |
| 30 kOpaque_SkAlphaType, | |
| 31 | |
| 32 /** | |
| 33 * All pixels have their alpha premultiplied in their color components. | |
| 34 * This is the natural format for the rendering target pixels. | |
| 35 */ | |
| 36 kPremul_SkAlphaType, | |
| 37 | |
| 38 /** | |
| 39 * All pixels have their color components stored without any regard to the | |
| 40 * alpha. e.g. this is the default configuration for PNG images. | |
| 41 * | |
| 42 * This alpha-type is ONLY supported for input images. Rendering cannot | |
| 43 * generate this on output. | |
| 44 */ | |
| 45 kUnpremul_SkAlphaType, | |
| 46 | |
| 47 kLastEnum_SkAlphaType = kUnpremul_SkAlphaType | |
| 48 }; | |
| 49 | |
| 50 static inline bool SkAlphaTypeIsOpaque(SkAlphaType at) { | |
| 51 return (unsigned)at <= kOpaque_SkAlphaType; | |
| 52 } | |
| 53 #endif | |
| OLD | NEW |