1 /* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_PROPERTIES_BLEND_MODE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_PROPERTIES_BLEND_MODE_H 18 19 #include <cstdint> 20 21 namespace OHOS::Ace { 22 // A style class indicates the way to render blendMode effect 23 enum class BlendMode : int16_t { 24 NONE = 0, // Note: The NONE blend mode is different from SRC_OVER. When using it with 25 // RSColorBlendApplyType::SAVE_LAYER, it does not create an offscreen buffer. However, when using it 26 // with RSColorBlendApplyType::FAST, it does not modify the blend mode of subsequent content. 27 28 CLEAR, // r = 0 29 SRC, // r = s 30 DST, // r = d 31 SRC_OVER, // r = s + (1-sa)*d 32 DST_OVER, // r = d + (1-da)*s 33 SRC_IN, // r = s * da 34 DST_IN, // r = d * sa 35 SRC_OUT, // r = s * (1-da) 36 DST_OUT, // r = d * (1-sa) 37 SRC_ATOP, // r = s*da + d*(1-sa) 38 DST_ATOP, // r = d*sa + s*(1-da) 39 XOR, // r = s*(1-da) + d*(1-sa) 40 PLUS, // r = min(s + d, 1) 41 MODULATE, // r = s*d 42 SCREEN, // r = s + d - s*d 43 44 OVERLAY, // multiply or screen, depending on destination 45 DARKEN, // rc = s + d - max(s*da, d*sa), ra = SRC_OVER 46 LIGHTEN, // rc = s + d - min(s*da, d*sa), ra = SRC_OVER 47 COLOR_DODGE, // brighten destination to reflect source 48 COLOR_BURN, // darken destination to reflect source 49 HARD_LIGHT, // multiply or screen, depending on source 50 SOFT_LIGHT, // lighten or darken, depending on source 51 DIFF, // rc = s + d - 2*(min(s*da, d*sa)), ra = SRC_OVER 52 // Due to naming conflicts with macro in winuser.h, DIFFERENCE was changed to DIFF 53 EXCLUSION, // rc = s + d - two(s*d), ra = SRC_OVER 54 MULTIPLY, // r = s*(1-da) + d*(1-sa) + s*d 55 56 HUE, // hue of source with saturation and luminosity of destination 57 SATURATION, // saturation of source with hue and luminosity of destination 58 COLOR, // hue and saturation of source with luminosity of destination 59 LUMINOSITY, // luminosity of source with hue and saturation of destination 60 61 BACK_COMPAT_SOURCE_IN, 62 MAX 63 }; 64 65 enum class BlendApplyType : int16_t { 66 FAST = 0, // Apply blending by drawing the content with the blend mode, without using an offscreen buffer 67 68 OFFSCREEN, // Apply blending by drawing the content onto an offscreen buffer and blend it when drawing it 69 // back to the screen 70 MAX 71 }; 72 } // namespace OHOS::Ace 73 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_PROPERTIES_BLEND_MODE_H 74