1 /* 2 * Copyright (c) 2024 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_NG_PATTERNS_SHAPE_SHAPE_CONTAINER_MODIFIER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SHAPE_SHAPE_CONTAINER_MODIFIER_H 18 19 #include "base/geometry/ng/image_mesh.h" 20 #include "base/memory/referenced.h" 21 #include "core/components_ng/base/modifier.h" 22 23 namespace OHOS::Ace::NG { 24 class ShapeContainerModifier : public ContentModifier { 25 DECLARE_ACE_TYPE(ShapeContainerModifier, ContentModifier); 26 27 public: 28 ShapeContainerModifier(); 29 ~ShapeContainerModifier() override = default; 30 31 void onDraw(DrawingContext& context) override; 32 33 void UpdatePixelMap(const RefPtr<PixelMap>& pixelMap); 34 SetRow(int32_t row)35 void SetRow(int32_t row) 36 { 37 CHECK_NULL_VOID(row_); 38 row_->Set(row); 39 } 40 SetColumn(int32_t column)41 void SetColumn(int32_t column) 42 { 43 CHECK_NULL_VOID(column_); 44 column_->Set(column); 45 } 46 SetMesh(const LinearVector<float> & mesh)47 void SetMesh(const LinearVector<float>& mesh) 48 { 49 CHECK_NULL_VOID(mesh_); 50 mesh_->Set(mesh); 51 } 52 53 private: 54 RefPtr<PropertyInt> row_; 55 RefPtr<PropertyInt> column_; 56 RefPtr<PropertyVectorFloat> mesh_; 57 // mark pixelmap is modified 58 RefPtr<PropertyBool> flag_; 59 RefPtr<PixelMap> pixelMap_; 60 61 ACE_DISALLOW_COPY_AND_MOVE(ShapeContainerModifier); 62 }; 63 } // namespace OHOS::Ace::NG 64 65 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SHAPE_SHAPE_CONTAINER_MODIFIER_H 66