/* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HM_SYMBOL_H #define HM_SYMBOL_H #include #include #include #include #include "draw/path.h" namespace OHOS { namespace Rosen { namespace Drawing { typedef unsigned U8CPU; enum DrawingAnimationType { INVALID_ANIMATION_TYPE = 0, SCALE_TYPE = 1, VARIABLE_COLOR_TYPE = 2, APPEAR_TYPE = 3, DISAPPEAR_TYPE = 4, BOUNCE_TYPE = 5, PULSE_TYPE = 6, REPLACE_APPEAR_TYPE = 7, REPLACE_DISAPPEAR_TYPE = 8, }; enum DrawingCurveType { INVALID_CURVE_TYPE = 0, SPRING = 1, LINEAR = 2, FRICTION = 3, SHARP = 4, }; enum DrawingCommonSubType { DOWN = 0, UP = 1, }; struct DrawingPiecewiseParameter { DrawingCurveType curveType = DrawingCurveType::INVALID_CURVE_TYPE; std::map curveArgs; uint32_t duration = 0; int delay = 0; std::map> properties; }; struct DrawingAnimationPara { uint16_t animationMode = 0; // 0 is default value, is byLayer effect DrawingCommonSubType commonSubType = DrawingCommonSubType::DOWN; std::vector> groupParameters; }; struct DrawingAnimationInfo { DrawingAnimationType animationType = DrawingAnimationType::INVALID_ANIMATION_TYPE; std::map animationParas; }; struct DrawingSColor { float a = 1.f; U8CPU r = 0; U8CPU g = 0; U8CPU b = 0; }; struct DrawingGroupInfo { std::vector layerIndexes; std::vector maskIndexes; }; struct DrawingGroupSetting { std::vector groupInfos; int animationIndex = -1; // -1 is default value, the level has no effecet }; struct DrawingAnimationSetting { std::vector animationTypes; std::vector groupSettings; }; struct DrawingRenderGroup { std::vector groupInfos; DrawingSColor color; }; enum DrawingEffectStrategy { NONE = 0, SCALE = 1, VARIABLE_COLOR = 2, APPEAR = 3, DISAPPEAR = 4, BOUNCE = 5, PULSE = 6, REPLACE_APPEAR = 7, REPLACE_DISAPPEAR = 8, }; struct DrawingSymbolLayers { uint16_t symbolGlyphId = 0; std::vector> layers; std::vector renderGroups; }; enum DrawingSymbolRenderingStrategy { SINGLE = 0, MULTIPLE_COLOR = 1, MULTIPLE_OPACITY = 2, }; struct DrawingSymbolLayersGroups { uint16_t symbolGlyphId = 0; std::vector> layers; std::map> renderModeGroups; std::vector animationSettings; }; struct DrawingHMSymbolData { public: DrawingSymbolLayers symbolInfo_; Path path_; uint64_t symbolId = 0; // span id in paragraph }; class DRAWING_API DrawingHMSymbol { public: static void PathOutlineDecompose(const Path& path, std::vector& paths); static void MultilayerPath(const std::vector>& multMap, const std::vector& paths, std::vector& multPaths); }; } // namespace Drawing } // namespace Rosen } // namespace OHOS #endif