• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SCENE_SRC_BITMAP_H
17 #define SCENE_SRC_BITMAP_H
18 
19 #include <scene/interface/intf_image.h>
20 #include <scene/interface/intf_render_target.h>
21 #include <scene/interface/resource/types.h>
22 
23 #include <meta/interface/intf_named.h>
24 
25 #include "render_resource.h"
26 
SCENE_BEGIN_NAMESPACE()27 SCENE_BEGIN_NAMESPACE()
28 
29 class Image : public META_NS::IntroduceInterfaces<RenderResource, IImage, IRenderTarget, META_NS::INamed> {
30     META_OBJECT(Image, ClassId::Image, IntroduceInterfaces)
31 public:
32     META_BEGIN_STATIC_DATA()
33     META_STATIC_PROPERTY_DATA(META_NS::INamed, BASE_NS::string, Name)
34     META_STATIC_PROPERTY_DATA(SCENE_NS::IImage, BASE_NS::Math::UVec2, Size, BASE_NS::Math::UVec2(0, 0),
35         META_NS::DEFAULT_PROPERTY_FLAGS_NO_SER)
36     META_END_STATIC_DATA()
37 
38     META_IMPLEMENT_PROPERTY(BASE_NS::string, Name)
39     META_IMPLEMENT_READONLY_PROPERTY(BASE_NS::Math::UVec2, Size)
40 
41     RENDER_NS::RenderHandleReference GetRenderHandle() const override
42     {
43         return RenderResource::GetRenderHandle();
44     }
45     bool SetRenderHandle(RENDER_NS::RenderHandleReference handle) override;
46 
47     BASE_NS::string GetName() const override
48     {
49         return META_NS::GetValue(Name());
50     }
51 
52     CORE_NS::ResourceType GetResourceType() const override
53     {
54         return ClassId::ImageResource.Id().ToUid();
55     }
56 };
57 
58 SCENE_END_NAMESPACE()
59 
60 #endif