• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 IMPLFACTORY_H
17 #define IMPLFACTORY_H
18 
19 #include "impl_interface/bitmap_impl.h"
20 #include "impl_interface/blender_impl.h"
21 #include "impl_interface/pixmap_impl.h"
22 #include "impl_interface/camera_impl.h"
23 #include "impl_interface/color_filter_impl.h"
24 #include "impl_interface/color_space_impl.h"
25 #include "impl_interface/core_canvas_impl.h"
26 #include "impl_interface/data_impl.h"
27 #ifdef ACE_ENABLE_GPU
28 #include "impl_interface/gpu_context_impl.h"
29 #endif
30 #include "impl_interface/font_impl.h"
31 #include "impl_interface/font_mgr_impl.h"
32 #include "impl_interface/image_filter_impl.h"
33 #include "impl_interface/image_impl.h"
34 #include "impl_interface/vertices_impl.h"
35 #include "impl_interface/mask_filter_impl.h"
36 #include "impl_interface/matrix_impl.h"
37 #include "impl_interface/matrix44_impl.h"
38 #include "impl_interface/path_effect_impl.h"
39 #include "impl_interface/path_impl.h"
40 #include "impl_interface/picture_impl.h"
41 #include "impl_interface/region_impl.h"
42 #include "impl_interface/resource_holder_impl.h"
43 #include "impl_interface/runtime_blender_builder_impl.h"
44 #include "impl_interface/runtime_effect_impl.h"
45 #include "impl_interface/runtime_shader_builder_impl.h"
46 #include "impl_interface/shader_effect_impl.h"
47 #include "impl_interface/surface_impl.h"
48 #include "impl_interface/text_blob_builder_impl.h"
49 #include "impl_interface/memory_stream_impl.h"
50 
51 namespace OHOS {
52 namespace Rosen {
53 namespace Drawing {
54 class Matrix;
55 class RuntimeEffect;
56 class ImplFactory {
57 public:
58     static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl();
59     static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl(void* rawCanvas);
60     static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl(int32_t width, int32_t height);
61     static std::unique_ptr<DataImpl> CreateDataImpl();
62 #ifdef ACE_ENABLE_GPU
63     static std::unique_ptr<GPUContextImpl> CreateGPUContextImpl();
64 #endif
65     static std::unique_ptr<TraceMemoryDumpImpl> CreateTraceMemoryDumpImpl(const char* categoryKey, bool itemizeType);
66     static std::unique_ptr<BitmapImpl> CreateBitmapImpl();
67     static std::unique_ptr<PixmapImpl> CreatePixmapImpl();
68     static std::unique_ptr<PixmapImpl> CreatePixmapImpl(const ImageInfo& imageInfo, const void* addr, size_t rowBytes);
69     static std::unique_ptr<ImageImpl> CreateImageImpl();
70     static std::unique_ptr<ImageImpl> CreateImageImpl(void* rawImage);
71     static std::unique_ptr<PathImpl> CreatePathImpl();
72     static std::unique_ptr<ColorFilterImpl> CreateColorFilterImpl();
73     static std::unique_ptr<MaskFilterImpl> CreateMaskFilterImpl();
74     static std::unique_ptr<ImageFilterImpl> CreateImageFilterImpl();
75     static std::unique_ptr<PictureImpl> CreatePictureImpl();
76     static std::unique_ptr<ShaderEffectImpl> CreateShaderEffectImpl();
77     static std::unique_ptr<BlenderImpl> CreateBlenderImpl();
78     static std::unique_ptr<RuntimeEffectImpl> CreateRuntimeEffectImpl();
79     static std::unique_ptr<RuntimeShaderBuilderImpl> CreateRuntimeShaderBuilderImpl(std::shared_ptr<RuntimeEffect>);
80     static std::unique_ptr<RuntimeBlenderBuilderImpl> CreateRuntimeBlenderBuilderImpl(std::shared_ptr<RuntimeEffect>);
81     static std::unique_ptr<SurfaceImpl> CreateSurfaceImpl();
82     static std::unique_ptr<PathEffectImpl> CreatePathEffectImpl();
83     static std::unique_ptr<ColorSpaceImpl> CreateColorSpaceImpl();
84     static std::unique_ptr<MatrixImpl> CreateMatrixImpl();
85     static std::unique_ptr<MatrixImpl> CreateMatrixImpl(const Matrix& other);
86     static std::unique_ptr<Matrix44Impl> CreateMatrix44Impl();
87     static std::unique_ptr<CameraImpl> CreateCameraImpl();
88     static std::unique_ptr<RegionImpl> CreateRegionImpl();
89     static std::unique_ptr<VerticesImpl> CreateVerticesImpl();
90     static std::unique_ptr<VerticesImpl::BuilderImpl> CreateVerticesBuilderImpl();
91     static std::unique_ptr<FontImpl> CreateFontImpl();
92     static std::unique_ptr<FontImpl> CreateFontImpl(std::shared_ptr<Typeface> typeface,
93         scalar size, scalar scaleX, scalar skewX);
94     static std::unique_ptr<TextBlobBuilderImpl> CreateTextBlobBuilderImpl();
95     static std::shared_ptr<FontMgrImpl> CreateDefaultFontMgrImpl();
96 #ifndef USE_TEXGINE
97     static std::shared_ptr<FontMgrImpl> CreateDynamicFontMgrImpl();
98 #endif
99     static std::shared_ptr<MemoryStreamImpl> CreateMemoryStreamImpl();
100     static std::shared_ptr<MemoryStreamImpl> CreateMemoryStreamImpl(const void* data, size_t length, bool copyData);
101     static std::shared_ptr<ResourceHolderImpl> CreateResourceHolderImpl();
102 };
103 } // namespace Drawing
104 } // namespace Rosen
105 } // namespace OHOS
106 #endif
107