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 #ifndef SCENEPLUGIN_INTF_BITMAP_H
16 #define SCENEPLUGIN_INTF_BITMAP_H
17 
18 #include <base/containers/vector.h>
19 #include <render/resource_handle.h>
20 
21 #include <core/plugin/intf_interface.h>
22 #include <meta/base/meta_types.h>
23 #include <meta/interface/interface_macros.h>
24 #include <meta/interface/property/property_events.h>
25 
26 #include <scene_plugin/interface/compatibility.h>
27 
28 SCENE_BEGIN_NAMESPACE()
29 
30 REGISTER_INTERFACE(IBitmap, "1399fcd5-f338-43cb-8a78-0edb88470dfa")
31 class IBitmap : public CORE_NS::IInterface {
32     META_INTERFACE(CORE_NS::IInterface, IBitmap)
33 public:
34     enum BitmapStatus : uint32_t {
35         /** No image has been loaded */
36         NOT_INITIALIZED = 0,
37         /** The image metadata is currently being loaded */
38         LOADING_METADATA = 1,
39         /** The image metadata loaded, size available */
40         LOADED_METADATA = 2,
41         /** The image is currently being loaded */
42         LOADING_IMAGEDATA = 3,
43         /** The image has been fully loaded */
44         COMPLETED = 4,
45         /** Loading has failed */
46         FAILED = 5,
47     };
48 
49     META_PROPERTY(BASE_NS::string, Uri)
50     META_READONLY_PROPERTY(BASE_NS::Math::UVec2, Size)
51     META_READONLY_PROPERTY(BitmapStatus, Status)
52     virtual void SetRenderHandle(RENDER_NS::RenderHandleReference, const BASE_NS::Math::UVec2 size) = 0;
53     virtual RENDER_NS::RenderHandleReference GetRenderHandle() const = 0;
54 
55     META_EVENT(META_NS::IOnChanged, ResourceChanged)
56 };
57 
58 
59 SCENE_END_NAMESPACE()
60 
61 META_TYPE(SCENE_NS::IBitmap::BitmapStatus)
62 META_TYPE(SCENE_NS::IBitmap::Ptr);
63 
64 #endif // SCENEPLUGIN_INTF_MATERIAL_H
65