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 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 #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/mask_filter_impl.h" 35 #include "impl_interface/matrix_impl.h" 36 #include "impl_interface/matrix44_impl.h" 37 #include "impl_interface/path_effect_impl.h" 38 #include "impl_interface/path_impl.h" 39 #include "impl_interface/picture_impl.h" 40 #include "impl_interface/region_impl.h" 41 #include "impl_interface/resource_holder_impl.h" 42 #include "impl_interface/shader_effect_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/surface_impl.h" 47 #include "impl_interface/text_blob_builder_impl.h" 48 #include "impl_interface/vertices_impl.h" 49 #include "impl_interface/trace_memory_dump_impl.h" 50 #include "impl_interface/memory_stream_impl.h" 51 52 namespace OHOS { 53 namespace Rosen { 54 namespace Drawing { 55 class SkiaImplFactory { 56 public: 57 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvas(); 58 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvas(void* rawCanvas); 59 static std::unique_ptr<CoreCanvasImpl> CreateCoreCanvas(int32_t width, int32_t height); 60 static std::unique_ptr<DataImpl> CreateData(); 61 #ifdef RS_ENABLE_GPU 62 static std::unique_ptr<GPUContextImpl> CreateGPUContext(); 63 #endif 64 static std::unique_ptr<TraceMemoryDumpImpl> CreateTraceMemoryDump(const char* categoryKey, bool itemizeType); 65 static std::unique_ptr<BitmapImpl> CreateBitmap(); 66 static std::unique_ptr<PixmapImpl> CreatePixmap(); 67 static std::unique_ptr<PixmapImpl> CreatePixmap(const ImageInfo& imageInfo, const void* addr, size_t rowBytes); 68 static std::unique_ptr<ImageImpl> CreateImage(); 69 static std::unique_ptr<ImageImpl> CreateImage(void* rawImg); 70 static std::unique_ptr<PictureImpl> CreatePicture(); 71 static std::unique_ptr<PathImpl> CreatePath(); 72 static std::unique_ptr<ColorFilterImpl> CreateColorFilter(); 73 static std::unique_ptr<MaskFilterImpl> CreateMaskFilter(); 74 static std::unique_ptr<ImageFilterImpl> CreateImageFilter(); 75 static std::unique_ptr<ShaderEffectImpl> CreateShaderEffect(); 76 static std::unique_ptr<BlenderImpl> CreateBlender(); 77 static std::unique_ptr<RuntimeEffectImpl> CreateRuntimeEffect(); 78 static std::unique_ptr<RuntimeShaderBuilderImpl> CreateRuntimeShaderBuilder( 79 std::shared_ptr<RuntimeEffect> runtimeEffect); 80 static std::unique_ptr<RuntimeBlenderBuilderImpl> CreateRuntimeBlenderBuilder( 81 std::shared_ptr<RuntimeEffect> runtimeEffect); 82 static std::unique_ptr<SurfaceImpl> CreateSurface(); 83 static std::unique_ptr<OpListHandleImpl> CreateOplistHandle(); 84 static std::unique_ptr<PathEffectImpl> CreatePathEffect(); 85 static std::unique_ptr<ColorSpaceImpl> CreateColorSpace(); 86 static std::unique_ptr<MatrixImpl> CreateMatrix(); 87 static std::unique_ptr<MatrixImpl> CreateMatrix(const Matrix& other); 88 static std::unique_ptr<Matrix44Impl> CreateMatrix44(); 89 static std::unique_ptr<CameraImpl> CreateCamera(); 90 static std::unique_ptr<RegionImpl> CreateRegion(); 91 static std::unique_ptr<FontImpl> CreateFont(); 92 static std::unique_ptr<FontImpl> CreateFont(std::shared_ptr<Typeface> typeface, 93 scalar size, scalar scaleX, scalar skewX); 94 static std::unique_ptr<FontImpl> CreateFont(const Font& font); 95 static std::unique_ptr<TextBlobBuilderImpl> CreateTextBlobBuilder(); 96 static std::shared_ptr<FontMgrImpl> CreateDefaultFontMgr(); 97 #ifndef USE_TEXGINE 98 static std::shared_ptr<FontMgrImpl> CreateDynamicFontMgr(); 99 #endif 100 static std::unique_ptr<VerticesImpl> CreateVertices(); 101 static std::unique_ptr<VerticesImpl::BuilderImpl> CreateVerticesBuilder(); 102 static std::shared_ptr<MemoryStreamImpl> CreateMemoryStream(); 103 static std::shared_ptr<MemoryStreamImpl> CreateMemoryStream(const void* data, size_t length, bool copyData); 104 static std::shared_ptr<ResourceHolderImpl> CreateResourceHolder(); 105 }; 106 } // namespace Drawing 107 } // namespace Rosen 108 } // namespace OHOS 109 #endif