1 /* 2 * Copyright (c) 2021 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_LAYERS_PICTURE_LAYER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_LAYERS_PICTURE_LAYER_H 18 19 #include "flutter/lib/ui/painting/picture.h" 20 21 #include "base/geometry/offset.h" 22 #include "core/pipeline/layers/layer.h" 23 #include "core/pipeline/layers/scene_builder.h" 24 25 namespace OHOS::Ace::Flutter { 26 27 class PictureLayer : public Layer { 28 DECLARE_ACE_TYPE(PictureLayer, Layer) 29 public: 30 PictureLayer() = default; 31 ~PictureLayer() override = default; 32 void SetPicture(fml::RefPtr<flutter::Picture> picture); 33 void AddToScene(SceneBuilder& builder, double x, double y) override; 34 35 void Dump() override; 36 GetPicture()37 fml::RefPtr<flutter::Picture> GetPicture() const 38 { 39 return picture_; 40 } 41 GetOffset()42 const Offset& GetOffset() const 43 { 44 return offset_; 45 } 46 SetNeedAddToScene(bool need)47 void SetNeedAddToScene(bool need) 48 { 49 needAddToScene_ = need; 50 } 51 52 private: 53 bool needAddToScene_ = true; 54 Offset offset_ = Offset(-1.0, -1.0); 55 fml::RefPtr<flutter::Picture> picture_; 56 bool hints_ = false; 57 }; 58 59 } // namespace OHOS::Ace::Flutter 60 61 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_LAYERS_PICTURE_LAYER_H 62