1 /* 2 * Copyright (c) 2021-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 RENDER_SERVICE_CLIENT_CORE_PROPERTY_RS_PROPERTIES_DEF_H 17 #define RENDER_SERVICE_CLIENT_CORE_PROPERTY_RS_PROPERTIES_DEF_H 18 19 #ifndef USE_ROSEN_DRAWING 20 #include "include/core/SkMatrix.h" 21 #else 22 #include "utils/matrix.h" 23 #endif 24 25 #include "common/rs_color_palette.h" 26 #include "common/rs_rect.h" 27 #include "common/rs_vector4.h" 28 29 namespace OHOS { 30 namespace Rosen { 31 class RSObjGeometry; 32 class RSImage; 33 class RSShader; 34 35 enum class Gravity { 36 CENTER = 0, 37 TOP, 38 BOTTOM, 39 LEFT, 40 RIGHT, 41 TOP_LEFT, 42 TOP_RIGHT, 43 BOTTOM_LEFT, 44 BOTTOM_RIGHT, 45 RESIZE, 46 RESIZE_ASPECT, 47 RESIZE_ASPECT_TOP_LEFT, 48 RESIZE_ASPECT_BOTTOM_RIGHT, 49 RESIZE_ASPECT_FILL, 50 RESIZE_ASPECT_FILL_TOP_LEFT, 51 RESIZE_ASPECT_FILL_BOTTOM_RIGHT, 52 53 DEFAULT = TOP_LEFT 54 }; 55 56 enum class ForegroundColorStrategyType { 57 INVALID = 0, 58 INVERT_BACKGROUNDCOLOR, 59 }; 60 61 class Decoration final { 62 public: Decoration()63 Decoration() {} ~Decoration()64 ~Decoration() {} 65 std::shared_ptr<RSShader> bgShader_ = nullptr; 66 std::shared_ptr<RSImage> bgImage_ = nullptr; 67 RectF bgImageRect_ = RectF(); 68 Color backgroundColor_ = RgbPalette::Transparent(); 69 Color foregroundColor_ = RgbPalette::Transparent(); 70 }; 71 72 class Sandbox final { 73 public: Sandbox()74 Sandbox() {} ~Sandbox()75 ~Sandbox() {} 76 std::optional<Vector2f> position_; 77 #ifndef USE_ROSEN_DRAWING 78 std::optional<SkMatrix> matrix_; 79 #else 80 std::optional<Drawing::Matrix> matrix_; 81 #endif 82 }; 83 } // namespace Rosen 84 } // namespace OHOS 85 86 #endif // RENDER_SERVICE_CLIENT_CORE_PROPERTY_RS_PROPERTIES_DEF_H 87