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 RS_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/OpListHandleImpl.h" 36 #include "impl_interface/mask_filter_impl.h" 37 #include "impl_interface/matrix_impl.h" 38 #include "impl_interface/matrix44_impl.h" 39 #include "impl_interface/path_effect_impl.h" 40 #include "impl_interface/path_impl.h" 41 #include "impl_interface/picture_impl.h" 42 #include "impl_interface/region_impl.h" 43 #include "impl_interface/resource_holder_impl.h" 44 #include "impl_interface/runtime_blender_builder_impl.h" 45 #include "impl_interface/runtime_effect_impl.h" 46 #include "impl_interface/runtime_shader_builder_impl.h" 47 #include "impl_interface/shader_effect_impl.h" 48 #include "impl_interface/surface_impl.h" 49 #include "impl_interface/text_blob_builder_impl.h" 50 #include "impl_interface/memory_stream_impl.h" 51 52 namespace OHOS { 53 namespace Rosen { 54 namespace Drawing { 55 class ImplFactory { 56 public: 57 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl(); 58 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl(void* rawCanvas); 59 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl(int32_t width, int32_t height); 60 static std::unique_ptr<DataImpl> CreateDataImpl(); 61 #ifdef RS_ENABLE_GPU 62 static std::unique_ptr<GPUContextImpl> CreateGPUContextImpl(); 63 #endif 64 static std::unique_ptr<TraceMemoryDumpImpl> CreateTraceMemoryDumpImpl(const char* categoryKey, bool itemizeType); 65 static std::unique_ptr<BitmapImpl> CreateBitmapImpl(); 66 static std::unique_ptr<PixmapImpl> CreatePixmapImpl(); 67 static std::unique_ptr<PixmapImpl> CreatePixmapImpl(const ImageInfo& imageInfo, const void* addr, size_t rowBytes); 68 static std::unique_ptr<ImageImpl> CreateImageImpl(); 69 static std::unique_ptr<ImageImpl> CreateImageImpl(void* rawImage); 70 static std::unique_ptr<PathImpl> CreatePathImpl(); 71 static std::unique_ptr<ColorFilterImpl> CreateColorFilterImpl(); 72 static std::unique_ptr<MaskFilterImpl> CreateMaskFilterImpl(); 73 static std::unique_ptr<ImageFilterImpl> CreateImageFilterImpl(); 74 static std::unique_ptr<PictureImpl> CreatePictureImpl(); 75 static std::unique_ptr<ShaderEffectImpl> CreateShaderEffectImpl(); 76 static std::unique_ptr<BlenderImpl> CreateBlenderImpl(); 77 static std::unique_ptr<RuntimeEffectImpl> CreateRuntimeEffectImpl(); 78 static std::unique_ptr<RuntimeShaderBuilderImpl> CreateRuntimeShaderBuilderImpl(std::shared_ptr<RuntimeEffect>); 79 static std::unique_ptr<RuntimeBlenderBuilderImpl> CreateRuntimeBlenderBuilderImpl(std::shared_ptr<RuntimeEffect>); 80 static std::unique_ptr<SurfaceImpl> CreateSurfaceImpl(); 81 static std::unique_ptr<OpListHandleImpl> CreateOplistHandleImpl(); 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<FontImpl> CreateFontImpl(); 90 static std::unique_ptr<FontImpl> CreateFontImpl(std::shared_ptr<Typeface> typeface, 91 scalar size, scalar scaleX, scalar skewX); 92 static std::unique_ptr<FontImpl> CreateFontImpl(const Font& font); 93 static std::unique_ptr<TextBlobBuilderImpl> CreateTextBlobBuilderImpl(); 94 static std::shared_ptr<FontMgrImpl> CreateDefaultFontMgrImpl(); 95 #ifndef USE_TEXGINE 96 static std::shared_ptr<FontMgrImpl> CreateDynamicFontMgrImpl(); 97 #endif 98 static std::unique_ptr<VerticesImpl> CreateVerticesImpl(); 99 static std::unique_ptr<VerticesImpl::BuilderImpl> CreateVerticesBuilderImpl(); 100 static std::shared_ptr<MemoryStreamImpl> CreateMemoryStreamImpl(); 101 static std::shared_ptr<MemoryStreamImpl> CreateMemoryStreamImpl(const void* data, size_t length, bool copyData); 102 static std::shared_ptr<ResourceHolderImpl> CreateResourceHolderImpl(); 103 }; 104 } // namespace Drawing 105 } // namespace Rosen 106 } // namespace OHOS 107 #endif 108