Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / include / core / SkAlphaType.h
1 /*
2  * Copyright 2022 Google LLC
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 SkAlphaType_DEFINED
9 #define SkAlphaType_DEFINED
10
11 /** \enum SkAlphaType
12     Describes how to interpret the alpha component of a pixel. A pixel may
13     be opaque, or alpha, describing multiple levels of transparency.
14
15     In simple blending, alpha weights the draw color and the destination
16     color to create a new color. If alpha describes a weight from zero to one:
17
18     new color = draw color * alpha + destination color * (1 - alpha)
19
20     In practice alpha is encoded in two or more bits, where 1.0 equals all bits set.
21
22     RGB may have alpha included in each component value; the stored
23     value is the original RGB multiplied by alpha. Premultiplied color
24     components improve performance.
25 */
26 enum SkAlphaType : int {
27     kUnknown_SkAlphaType,                          //!< uninitialized
28     kOpaque_SkAlphaType,                           //!< pixel is opaque
29     kPremul_SkAlphaType,                           //!< pixel components are premultiplied by alpha
30     kUnpremul_SkAlphaType,                         //!< pixel components are independent of alpha
31     kLastEnum_SkAlphaType = kUnpremul_SkAlphaType, //!< last valid value
32 };
33
34 /** Returns true if SkAlphaType equals kOpaque_SkAlphaType.
35
36     kOpaque_SkAlphaType is a hint that the SkColorType is opaque, or that all
37     alpha values are set to their 1.0 equivalent. If SkAlphaType is
38     kOpaque_SkAlphaType, and SkColorType is not opaque, then the result of
39     drawing any pixel with a alpha value less than 1.0 is undefined.
40 */
41 static inline bool SkAlphaTypeIsOpaque(SkAlphaType at) {
42     return kOpaque_SkAlphaType == at;
43 }
44
45 #endif