1 /* 2 * Copyright (c) 2021-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 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 #include "impl_interface/document_impl.h" 28 #ifdef RS_ENABLE_GPU 29 #include "impl_interface/gpu_context_impl.h" 30 #endif 31 #include "impl_interface/file_w_stream_impl.h" 32 #include "impl_interface/font_impl.h" 33 #include "impl_interface/font_mgr_impl.h" 34 #include "impl_interface/image_filter_impl.h" 35 #include "impl_interface/image_impl.h" 36 #include "impl_interface/vertices_impl.h" 37 #include "impl_interface/OpListHandleImpl.h" 38 #include "impl_interface/mask_filter_impl.h" 39 #include "impl_interface/matrix_impl.h" 40 #include "impl_interface/matrix44_impl.h" 41 #include "impl_interface/path_effect_impl.h" 42 #include "impl_interface/path_impl.h" 43 #include "impl_interface/path_iterator_impl.h" 44 #include "impl_interface/picture_impl.h" 45 #include "impl_interface/picture_recorder_impl.h" 46 #include "impl_interface/region_impl.h" 47 #include "impl_interface/resource_holder_impl.h" 48 #include "impl_interface/runtime_blender_builder_impl.h" 49 #include "impl_interface/runtime_effect_impl.h" 50 #include "impl_interface/runtime_shader_builder_impl.h" 51 #include "impl_interface/serial_procs_impl.h" 52 #include "impl_interface/shader_effect_impl.h" 53 #include "impl_interface/sharing_serial_context_impl.h" 54 #include "impl_interface/surface_impl.h" 55 #include "impl_interface/text_blob_builder_impl.h" 56 #include "impl_interface/trace_memory_dump_impl.h" 57 #include "impl_interface/memory_stream_impl.h" 58 59 namespace OHOS { 60 namespace Rosen { 61 namespace Drawing { 62 class ImplFactory { 63 public: 64 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl(); 65 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl(DrawingType type); 66 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvasImpl(int32_t width, int32_t height); 67 static std::unique_ptr<DataImpl> CreateDataImpl(); 68 #ifdef RS_ENABLE_GPU 69 static std::unique_ptr<GPUContextImpl> CreateGPUContextImpl(); 70 #endif 71 static std::unique_ptr<TraceMemoryDumpImpl> CreateTraceMemoryDumpImpl(const char* categoryKey, bool itemizeType); 72 static std::unique_ptr<BitmapImpl> CreateBitmapImpl(); 73 static std::unique_ptr<PixmapImpl> CreatePixmapImpl(); 74 static std::unique_ptr<PixmapImpl> CreatePixmapImpl(const ImageInfo& imageInfo, const void* addr, size_t rowBytes); 75 static std::unique_ptr<ImageImpl> CreateImageImpl(); 76 static std::unique_ptr<ImageImpl> CreateImageImpl(void* rawImage); 77 static std::unique_ptr<PathIteratorImpl> CreatePathIteratorImpl(const Path& path); 78 static std::unique_ptr<PathIterImpl> CreatePathIterImpl(const Path& path, bool forceClose); 79 static std::unique_ptr<PathImpl> CreatePathImpl(); 80 static std::unique_ptr<ColorFilterImpl> CreateColorFilterImpl(); 81 static std::unique_ptr<MaskFilterImpl> CreateMaskFilterImpl(); 82 static std::unique_ptr<ImageFilterImpl> CreateImageFilterImpl(); 83 static std::unique_ptr<PictureImpl> CreatePictureImpl(); 84 static std::unique_ptr<PictureRecorderImpl> CreatePictureRecorderImpl(); 85 static std::unique_ptr<SerialProcsImpl> CreateSerialProcsImpl(); 86 static std::unique_ptr<ShaderEffectImpl> CreateShaderEffectImpl(); 87 static std::unique_ptr<SharingSerialContextImpl> CreateSharingSerialContextImpl(); 88 static std::unique_ptr<BlenderImpl> CreateBlenderImpl(); 89 static std::unique_ptr<RuntimeEffectImpl> CreateRuntimeEffectImpl(); 90 static std::unique_ptr<RuntimeShaderBuilderImpl> CreateRuntimeShaderBuilderImpl(std::shared_ptr<RuntimeEffect>); 91 static std::unique_ptr<RuntimeBlenderBuilderImpl> CreateRuntimeBlenderBuilderImpl(std::shared_ptr<RuntimeEffect>); 92 static std::unique_ptr<SurfaceImpl> CreateSurfaceImpl(); 93 static std::unique_ptr<OpListHandleImpl> CreateOplistHandleImpl(); 94 static std::unique_ptr<PathEffectImpl> CreatePathEffectImpl(); 95 static std::unique_ptr<ColorSpaceImpl> CreateColorSpaceImpl(); 96 static std::unique_ptr<MatrixImpl> CreateMatrixImpl(); 97 static std::unique_ptr<MatrixImpl> CreateMatrixImpl(const Matrix& other); 98 static std::unique_ptr<Matrix44Impl> CreateMatrix44Impl(); 99 static std::unique_ptr<CameraImpl> CreateCameraImpl(); 100 static std::unique_ptr<RegionImpl> CreateRegionImpl(); 101 static std::unique_ptr<FileWStreamImpl> CreateFileWStreamImpl(const char path[]); 102 static std::unique_ptr<FontImpl> CreateFontImpl(); 103 static std::unique_ptr<FontImpl> CreateFontImpl(std::shared_ptr<Typeface> typeface, 104 scalar size, scalar scaleX, scalar skewX); 105 static std::unique_ptr<FontImpl> CreateFontImpl(const Font& font); 106 static std::unique_ptr<TextBlobBuilderImpl> CreateTextBlobBuilderImpl(); 107 static std::shared_ptr<FontMgrImpl> CreateDefaultFontMgrImpl(); 108 static std::shared_ptr<FontMgrImpl> CreateDynamicFontMgrImpl(); 109 static std::unique_ptr<VerticesImpl> CreateVerticesImpl(); 110 static std::unique_ptr<VerticesImpl::BuilderImpl> CreateVerticesBuilderImpl(); 111 static std::shared_ptr<MemoryStreamImpl> CreateMemoryStreamImpl(); 112 static std::shared_ptr<MemoryStreamImpl> CreateMemoryStreamImpl(const void* data, size_t length, bool copyData); 113 static std::shared_ptr<ResourceHolderImpl> CreateResourceHolderImpl(); 114 }; 115 } // namespace Drawing 116 } // namespace Rosen 117 } // namespace OHOS 118 #endif 119