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 SKIA_IMPLFACTORY_H 17 #define SKIA_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/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/path_iterator_impl.h" 42 #include "impl_interface/picture_impl.h" 43 #include "impl_interface/picture_recorder_impl.h" 44 #include "impl_interface/region_impl.h" 45 #include "impl_interface/resource_holder_impl.h" 46 #include "impl_interface/shader_effect_impl.h" 47 #include "impl_interface/sharing_serial_context_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/surface_impl.h" 53 #include "impl_interface/text_blob_builder_impl.h" 54 #include "impl_interface/vertices_impl.h" 55 #include "impl_interface/trace_memory_dump_impl.h" 56 #include "impl_interface/memory_stream_impl.h" 57 58 59 namespace OHOS { 60 namespace Rosen { 61 namespace Drawing { 62 class SkiaImplFactory { 63 public: 64 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvas(); 65 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvas(DrawingType type); 66 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvas(int32_t width, int32_t height); 67 static std::unique_ptr<DataImpl> CreateData(); 68 #ifdef RS_ENABLE_GPU 69 static std::unique_ptr<GPUContextImpl> CreateGPUContext(); 70 #endif 71 static std::unique_ptr<TraceMemoryDumpImpl> CreateTraceMemoryDump(const char* categoryKey, bool itemizeType); 72 static std::unique_ptr<BitmapImpl> CreateBitmap(); 73 static std::unique_ptr<PixmapImpl> CreatePixmap(); 74 static std::unique_ptr<PixmapImpl> CreatePixmap(const ImageInfo& imageInfo, const void* addr, size_t rowBytes); 75 static std::unique_ptr<ImageImpl> CreateImage(); 76 static std::unique_ptr<ImageImpl> CreateImage(void* rawImg); 77 static std::unique_ptr<PictureImpl> CreatePicture(); 78 static std::unique_ptr<PictureRecorderImpl> CreatePictureRecorder(); 79 static std::unique_ptr<PathImpl> CreatePath(); 80 static std::unique_ptr<PathIterImpl> CreatePathIter(const Path& path, bool forceClose); 81 static std::unique_ptr<PathIteratorImpl> CreatePathIterator(const Path& path); 82 static std::unique_ptr<ColorFilterImpl> CreateColorFilter(); 83 static std::unique_ptr<MaskFilterImpl> CreateMaskFilter(); 84 static std::unique_ptr<ImageFilterImpl> CreateImageFilter(); 85 static std::unique_ptr<SerialProcsImpl> CreateSerialProcs(); 86 static std::unique_ptr<ShaderEffectImpl> CreateShaderEffect(); 87 static std::unique_ptr<SharingSerialContextImpl> CreateSharingSerialContext(); 88 static std::unique_ptr<BlenderImpl> CreateBlender(); 89 static std::unique_ptr<RuntimeEffectImpl> CreateRuntimeEffect(); 90 static std::unique_ptr<RuntimeShaderBuilderImpl> CreateRuntimeShaderBuilder( 91 std::shared_ptr<RuntimeEffect> runtimeEffect); 92 static std::unique_ptr<RuntimeBlenderBuilderImpl> CreateRuntimeBlenderBuilder( 93 std::shared_ptr<RuntimeEffect> runtimeEffect); 94 static std::unique_ptr<SurfaceImpl> CreateSurface(); 95 static std::unique_ptr<OpListHandleImpl> CreateOplistHandle(); 96 static std::unique_ptr<PathEffectImpl> CreatePathEffect(); 97 static std::unique_ptr<ColorSpaceImpl> CreateColorSpace(); 98 static std::unique_ptr<MatrixImpl> CreateMatrix(); 99 static std::unique_ptr<MatrixImpl> CreateMatrix(const Matrix& other); 100 static std::unique_ptr<Matrix44Impl> CreateMatrix44(); 101 static std::unique_ptr<CameraImpl> CreateCamera(); 102 static std::unique_ptr<RegionImpl> CreateRegion(); 103 static std::unique_ptr<FileWStreamImpl> CreateFileWStream(const char path[]); 104 static std::unique_ptr<FontImpl> CreateFont(); 105 static std::unique_ptr<FontImpl> CreateFont(std::shared_ptr<Typeface> typeface, 106 scalar size, scalar scaleX, scalar skewX); 107 static std::unique_ptr<FontImpl> CreateFont(const Font& font); 108 static std::unique_ptr<TextBlobBuilderImpl> CreateTextBlobBuilder(); 109 static std::shared_ptr<FontMgrImpl> CreateDefaultFontMgr(); 110 static std::shared_ptr<FontMgrImpl> CreateDynamicFontMgr(); 111 static std::unique_ptr<VerticesImpl> CreateVertices(); 112 static std::unique_ptr<VerticesImpl::BuilderImpl> CreateVerticesBuilder(); 113 static std::shared_ptr<MemoryStreamImpl> CreateMemoryStream(); 114 static std::shared_ptr<MemoryStreamImpl> CreateMemoryStream(const void* data, size_t length, bool copyData); 115 static std::shared_ptr<ResourceHolderImpl> CreateResourceHolder(); 116 }; 117 } // namespace Drawing 118 } // namespace Rosen 119 } // namespace OHOS 120 #endif