• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_BASE_IMAGE_ACE_DRAWABLE_DESCRIPTOR_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_IMAGE_ACE_DRAWABLE_DESCRIPTOR_H
18 
19 #include <cstdint>
20 #include <functional>
21 
22 #include "base/memory/ace_type.h"
23 #include "core/components_ng/render/canvas_image.h"
24 #include "core/components_ng/render/drawing_forward.h"
25 
26 
27 namespace OHOS {
28 namespace Ace {
29 class DrawableDescriptor : public AceType {
30     DECLARE_ACE_TYPE(DrawableDescriptor, AceType);
31 
32 public:
33     using RedrawCallback = std::function<void()>;
34 
35     static RefPtr<DrawableDescriptor> CreateDrawable(void* sptrAddr);
36 
37     virtual void RegisterRedrawCallback(RedrawCallback&& callback) = 0;
38 
39     virtual void Draw(RSCanvas& canvas, const NG::ImagePaintConfig& config) = 0;
40 
41     // Used to shield existing services temporarily.
42     virtual int32_t GetDrawableSrcType() = 0;
43 };
44 } // namespace Ace
45 } // namespace OHOS
46 
47 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_IMAGE_ACE_DRAWABLE_DESCRIPTOR_H
48