rngine 0.7.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -26
- package/android/CMakeLists.txt +45 -2
- package/android/build.gradle +1 -3
- package/android/kls_database.db +0 -0
- package/android/src/main/cpp/game-view.cpp +29 -0
- package/android/src/main/java/com/margelo/nitro/rngine/GameEngine.kt +1 -28
- package/android/src/main/java/com/margelo/nitro/rngine/GameView.kt +22 -166
- package/android/src/main/java/com/margelo/nitro/rngine/SvgLoaderHelper.kt +24 -0
- package/lib/module/GameMethods.js +46 -2
- package/lib/module/GameMethods.js.map +1 -1
- package/lib/module/GameMethods.nitro.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/GameMethods.d.ts +2 -1
- package/lib/typescript/src/GameMethods.d.ts.map +1 -1
- package/lib/typescript/src/GameMethods.nitro.d.ts +5 -2
- package/lib/typescript/src/GameMethods.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeTypes.d.ts +12 -0
- package/lib/typescript/src/nativeTypes.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +7 -10
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitro.json +0 -10
- package/nitrogen/generated/android/rngine+autolinking.cmake +0 -2
- package/nitrogen/generated/android/rngineOnLoad.cpp +0 -16
- package/nitrogen/generated/ios/Rngine-Swift-Cxx-Bridge.cpp +0 -33
- package/nitrogen/generated/ios/Rngine-Swift-Cxx-Bridge.hpp +0 -96
- package/nitrogen/generated/ios/Rngine-Swift-Cxx-Umbrella.hpp +0 -9
- package/nitrogen/generated/ios/RngineAutolinking.mm +0 -8
- package/nitrogen/generated/ios/RngineAutolinking.swift +0 -12
- package/nitrogen/generated/shared/c++/Entity.hpp +10 -2
- package/nitrogen/generated/shared/c++/EntityUpdate.hpp +10 -2
- package/nitrogen/generated/shared/c++/HybridGameMethodsSpec.cpp +4 -1
- package/nitrogen/generated/shared/c++/HybridGameMethodsSpec.hpp +8 -1
- package/nitrogen/generated/shared/c++/World.hpp +91 -0
- package/package.json +4 -1
- package/shared/CollisionUtils.hpp +1 -6
- package/{android/src/main/cpp/ColorUtils.hpp → shared/ColorUtils.cpp} +8 -12
- package/shared/ColorUtils.hpp +7 -0
- package/shared/GameLoop.cpp +142 -51
- package/shared/GameLoop.hpp +10 -14
- package/shared/GameMethods.cpp +101 -10
- package/shared/GameMethods.hpp +19 -1
- package/shared/GameRenderer.cpp +420 -0
- package/shared/GameRenderer.hpp +65 -0
- package/shared/GameStats.hpp +3 -3
- package/shared/Overlap.hpp +9 -0
- package/shared/skia/include/android/AHardwareBufferUtils.h +26 -0
- package/shared/skia/include/android/GrAHardwareBufferUtils.h +97 -0
- package/shared/skia/include/android/SkAndroidFrameworkUtils.h +83 -0
- package/shared/skia/include/android/SkAnimatedImage.h +193 -0
- package/shared/skia/include/android/SkCanvasAndroid.h +20 -0
- package/shared/skia/include/android/SkImageAndroid.h +100 -0
- package/shared/skia/include/android/SkSurfaceAndroid.h +50 -0
- package/shared/skia/include/android/graphite/SurfaceAndroid.h +59 -0
- package/shared/skia/include/android/vk/AndroidVulkanMemoryAllocator.h +31 -0
- package/shared/skia/include/codec/SkAndroidCodec.h +302 -0
- package/shared/skia/include/codec/SkAvifDecoder.h +80 -0
- package/shared/skia/include/codec/SkBmpDecoder.h +44 -0
- package/shared/skia/include/codec/SkBmpRustDecoder.h +42 -0
- package/shared/skia/include/codec/SkCodec.h +1178 -0
- package/shared/skia/include/codec/SkCodecAnimation.h +61 -0
- package/shared/skia/include/codec/SkEncodedImageFormat.h +33 -0
- package/shared/skia/include/codec/SkEncodedOrigin.h +71 -0
- package/shared/skia/include/codec/SkGifDecoder.h +44 -0
- package/shared/skia/include/codec/SkIcoDecoder.h +44 -0
- package/shared/skia/include/codec/SkJpegDecoder.h +51 -0
- package/shared/skia/include/codec/SkJpegxlDecoder.h +44 -0
- package/shared/skia/include/codec/SkPixmapUtils.h +31 -0
- package/shared/skia/include/codec/SkPngChunkReader.h +45 -0
- package/shared/skia/include/codec/SkPngDecoder.h +51 -0
- package/shared/skia/include/codec/SkPngRustDecoder.h +30 -0
- package/shared/skia/include/codec/SkRawDecoder.h +50 -0
- package/shared/skia/include/codec/SkWbmpDecoder.h +44 -0
- package/shared/skia/include/codec/SkWebpDecoder.h +51 -0
- package/shared/skia/include/config/SkUserConfig.h +141 -0
- package/shared/skia/include/core/SkAlphaType.h +45 -0
- package/shared/skia/include/core/SkAnnotation.h +52 -0
- package/shared/skia/include/core/SkArc.h +69 -0
- package/shared/skia/include/core/SkBBHFactory.h +67 -0
- package/shared/skia/include/core/SkBitmap.h +1264 -0
- package/shared/skia/include/core/SkBlendMode.h +112 -0
- package/shared/skia/include/core/SkBlender.h +30 -0
- package/shared/skia/include/core/SkBlurTypes.h +20 -0
- package/shared/skia/include/core/SkCPUContext.h +31 -0
- package/shared/skia/include/core/SkCPURecorder.h +76 -0
- package/shared/skia/include/core/SkCanvas.h +2770 -0
- package/shared/skia/include/core/SkCanvasVirtualEnforcer.h +61 -0
- package/shared/skia/include/core/SkCapabilities.h +35 -0
- package/shared/skia/include/core/SkClipOp.h +19 -0
- package/shared/skia/include/core/SkColor.h +469 -0
- package/shared/skia/include/core/SkColorFilter.h +150 -0
- package/shared/skia/include/core/SkColorSpace.h +432 -0
- package/shared/skia/include/core/SkColorTable.h +62 -0
- package/shared/skia/include/core/SkColorType.h +159 -0
- package/shared/skia/include/core/SkContourMeasure.h +215 -0
- package/shared/skia/include/core/SkCoverageMode.h +28 -0
- package/shared/skia/include/core/SkCubicMap.h +47 -0
- package/shared/skia/include/core/SkData.h +225 -0
- package/shared/skia/include/core/SkDataTable.h +122 -0
- package/shared/skia/include/core/SkDocument.h +93 -0
- package/shared/skia/include/core/SkDrawable.h +178 -0
- package/shared/skia/include/core/SkExecutor.h +59 -0
- package/shared/skia/include/core/SkFlattenable.h +115 -0
- package/shared/skia/include/core/SkFont.h +536 -0
- package/shared/skia/include/core/SkFontArguments.h +116 -0
- package/shared/skia/include/core/SkFontMetrics.h +139 -0
- package/shared/skia/include/core/SkFontMgr.h +178 -0
- package/shared/skia/include/core/SkFontParameters.h +43 -0
- package/shared/skia/include/core/SkFontScanner.h +45 -0
- package/shared/skia/include/core/SkFontStyle.h +84 -0
- package/shared/skia/include/core/SkFontTypes.h +25 -0
- package/shared/skia/include/core/SkFourByteTag.h +19 -0
- package/shared/skia/include/core/SkGraphics.h +169 -0
- package/shared/skia/include/core/SkImage.h +918 -0
- package/shared/skia/include/core/SkImageFilter.h +119 -0
- package/shared/skia/include/core/SkImageGenerator.h +140 -0
- package/shared/skia/include/core/SkImageInfo.h +634 -0
- package/shared/skia/include/core/SkM44.h +442 -0
- package/shared/skia/include/core/SkMallocPixelRef.h +45 -0
- package/shared/skia/include/core/SkMaskFilter.h +45 -0
- package/shared/skia/include/core/SkMatrix.h +1887 -0
- package/shared/skia/include/core/SkMesh.h +429 -0
- package/shared/skia/include/core/SkMilestone.h +9 -0
- package/shared/skia/include/core/SkOpenTypeSVGDecoder.h +30 -0
- package/shared/skia/include/core/SkOverdrawCanvas.h +94 -0
- package/shared/skia/include/core/SkPaint.h +698 -0
- package/shared/skia/include/core/SkPath.h +1145 -0
- package/shared/skia/include/core/SkPathBuilder.h +1052 -0
- package/shared/skia/include/core/SkPathEffect.h +88 -0
- package/shared/skia/include/core/SkPathIter.h +90 -0
- package/shared/skia/include/core/SkPathMeasure.h +96 -0
- package/shared/skia/include/core/SkPathTypes.h +71 -0
- package/shared/skia/include/core/SkPathUtils.h +39 -0
- package/shared/skia/include/core/SkPicture.h +291 -0
- package/shared/skia/include/core/SkPictureRecorder.h +115 -0
- package/shared/skia/include/core/SkPixelRef.h +120 -0
- package/shared/skia/include/core/SkPixmap.h +736 -0
- package/shared/skia/include/core/SkPoint.h +560 -0
- package/shared/skia/include/core/SkPoint3.h +149 -0
- package/shared/skia/include/core/SkRRect.h +548 -0
- package/shared/skia/include/core/SkRSXform.h +71 -0
- package/shared/skia/include/core/SkRasterHandleAllocator.h +94 -0
- package/shared/skia/include/core/SkRecorder.h +49 -0
- package/shared/skia/include/core/SkRect.h +1419 -0
- package/shared/skia/include/core/SkRefCnt.h +391 -0
- package/shared/skia/include/core/SkRegion.h +701 -0
- package/shared/skia/include/core/SkSamplingOptions.h +107 -0
- package/shared/skia/include/core/SkScalar.h +148 -0
- package/shared/skia/include/core/SkSerialProcs.h +127 -0
- package/shared/skia/include/core/SkShader.h +123 -0
- package/shared/skia/include/core/SkSize.h +93 -0
- package/shared/skia/include/core/SkSpan.h +174 -0
- package/shared/skia/include/core/SkStream.h +524 -0
- package/shared/skia/include/core/SkStrikeRef.h +96 -0
- package/shared/skia/include/core/SkString.h +297 -0
- package/shared/skia/include/core/SkStrokeRec.h +160 -0
- package/shared/skia/include/core/SkSurface.h +689 -0
- package/shared/skia/include/core/SkSurfaceProps.h +122 -0
- package/shared/skia/include/core/SkSwizzle.h +21 -0
- package/shared/skia/include/core/SkTextBlob.h +541 -0
- package/shared/skia/include/core/SkTextureCompressionType.h +30 -0
- package/shared/skia/include/core/SkTileMode.h +41 -0
- package/shared/skia/include/core/SkTiledImageUtils.h +125 -0
- package/shared/skia/include/core/SkTraceMemoryDump.h +121 -0
- package/shared/skia/include/core/SkTypeface.h +468 -0
- package/shared/skia/include/core/SkTypes.h +193 -0
- package/shared/skia/include/core/SkUnPreMultiply.h +55 -0
- package/shared/skia/include/core/SkVertices.h +136 -0
- package/shared/skia/include/core/SkYUVAInfo.h +311 -0
- package/shared/skia/include/core/SkYUVAPixmaps.h +335 -0
- package/shared/skia/include/docs/SkMultiPictureDocument.h +53 -0
- package/shared/skia/include/docs/SkPDFDocument.h +277 -0
- package/shared/skia/include/docs/SkPDFJpegHelpers.h +41 -0
- package/shared/skia/include/docs/SkXPSDocument.h +43 -0
- package/shared/skia/include/effects/Sk1DPathEffect.h +40 -0
- package/shared/skia/include/effects/Sk2DPathEffect.h +33 -0
- package/shared/skia/include/effects/SkBlenders.h +27 -0
- package/shared/skia/include/effects/SkBlurMaskFilter.h +35 -0
- package/shared/skia/include/effects/SkColorMatrix.h +57 -0
- package/shared/skia/include/effects/SkColorMatrixFilter.h +22 -0
- package/shared/skia/include/effects/SkCornerPathEffect.h +32 -0
- package/shared/skia/include/effects/SkDashPathEffect.h +43 -0
- package/shared/skia/include/effects/SkDiscretePathEffect.h +37 -0
- package/shared/skia/include/effects/SkGradient.h +206 -0
- package/shared/skia/include/effects/SkHighContrastFilter.h +84 -0
- package/shared/skia/include/effects/SkImageFilters.h +641 -0
- package/shared/skia/include/effects/SkLumaColorFilter.h +37 -0
- package/shared/skia/include/effects/SkOverdrawColorFilter.h +33 -0
- package/shared/skia/include/effects/SkPerlinNoiseShader.h +53 -0
- package/shared/skia/include/effects/SkRuntimeEffect.h +503 -0
- package/shared/skia/include/effects/SkShaderMaskFilter.h +28 -0
- package/shared/skia/include/effects/SkTableMaskFilter.h +47 -0
- package/shared/skia/include/effects/SkTrimPathEffect.h +45 -0
- package/shared/skia/include/encode/SkEncoder.h +63 -0
- package/shared/skia/include/encode/SkICC.h +36 -0
- package/shared/skia/include/encode/SkJpegEncoder.h +127 -0
- package/shared/skia/include/encode/SkPngEncoder.h +132 -0
- package/shared/skia/include/encode/SkPngRustEncoder.h +121 -0
- package/shared/skia/include/encode/SkWebpEncoder.h +87 -0
- package/shared/skia/include/gpu/GpuTypes.h +98 -0
- package/shared/skia/include/gpu/MutableTextureState.h +68 -0
- package/shared/skia/include/gpu/ShaderErrorHandler.h +46 -0
- package/shared/skia/include/gpu/ganesh/GrBackendSemaphore.h +50 -0
- package/shared/skia/include/gpu/ganesh/GrBackendSurface.h +257 -0
- package/shared/skia/include/gpu/ganesh/GrContextOptions.h +384 -0
- package/shared/skia/include/gpu/ganesh/GrContextThreadSafeProxy.h +175 -0
- package/shared/skia/include/gpu/ganesh/GrDirectContext.h +1027 -0
- package/shared/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +53 -0
- package/shared/skia/include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h +49 -0
- package/shared/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +54 -0
- package/shared/skia/include/gpu/ganesh/GrRecordingContext.h +300 -0
- package/shared/skia/include/gpu/ganesh/GrTypes.h +193 -0
- package/shared/skia/include/gpu/ganesh/GrYUVABackendTextures.h +130 -0
- package/shared/skia/include/gpu/ganesh/SkImageGanesh.h +361 -0
- package/shared/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
- package/shared/skia/include/gpu/ganesh/SkSurfaceGanesh.h +218 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DBackendContext.h +35 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DBackendSemaphore.h +20 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DBackendSurface.h +59 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +28 -0
- package/shared/skia/include/gpu/ganesh/d3d/GrD3DTypes.h +248 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLAssembleHelpers.h +17 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLAssembleInterface.h +45 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +64 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLConfig.h +69 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +30 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLExtensions.h +79 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLFunctions.h +313 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLInterface.h +337 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLMakeWebGLInterface.h +19 -0
- package/shared/skia/include/gpu/ganesh/gl/GrGLTypes.h +219 -0
- package/shared/skia/include/gpu/ganesh/gl/egl/GrGLMakeEGLInterface.h +23 -0
- package/shared/skia/include/gpu/ganesh/gl/epoxy/GrGLMakeEpoxyEGLInterface.h +20 -0
- package/shared/skia/include/gpu/ganesh/gl/glx/GrGLMakeGLXInterface.h +23 -0
- package/shared/skia/include/gpu/ganesh/gl/ios/GrGLMakeIOSInterface.h +20 -0
- package/shared/skia/include/gpu/ganesh/gl/mac/GrGLMakeMacInterface.h +20 -0
- package/shared/skia/include/gpu/ganesh/gl/win/GrGLMakeWinInterface.h +20 -0
- package/shared/skia/include/gpu/ganesh/mock/GrMockBackendSurface.h +59 -0
- package/shared/skia/include/gpu/ganesh/mock/GrMockTypes.h +166 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlBackendContext.h +21 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlBackendSemaphore.h +23 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlBackendSurface.h +44 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h +30 -0
- package/shared/skia/include/gpu/ganesh/mtl/GrMtlTypes.h +61 -0
- package/shared/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +73 -0
- package/shared/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +44 -0
- package/shared/skia/include/gpu/ganesh/vk/GrVkBackendSemaphore.h +20 -0
- package/shared/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +71 -0
- package/shared/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +33 -0
- package/shared/skia/include/gpu/ganesh/vk/GrVkTypes.h +101 -0
- package/shared/skia/include/gpu/graphite/BackendSemaphore.h +60 -0
- package/shared/skia/include/gpu/graphite/BackendTexture.h +65 -0
- package/shared/skia/include/gpu/graphite/Context.h +440 -0
- package/shared/skia/include/gpu/graphite/ContextOptions.h +239 -0
- package/shared/skia/include/gpu/graphite/GraphiteTypes.h +315 -0
- package/shared/skia/include/gpu/graphite/Image.h +428 -0
- package/shared/skia/include/gpu/graphite/ImageProvider.h +68 -0
- package/shared/skia/include/gpu/graphite/PersistentPipelineStorage.h +45 -0
- package/shared/skia/include/gpu/graphite/PrecompileContext.h +109 -0
- package/shared/skia/include/gpu/graphite/Recorder.h +355 -0
- package/shared/skia/include/gpu/graphite/Recording.h +100 -0
- package/shared/skia/include/gpu/graphite/Surface.h +121 -0
- package/shared/skia/include/gpu/graphite/TextureInfo.h +133 -0
- package/shared/skia/include/gpu/graphite/YUVABackendTextures.h +148 -0
- package/shared/skia/include/gpu/graphite/dawn/DawnBackendContext.h +77 -0
- package/shared/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +163 -0
- package/shared/skia/include/gpu/graphite/dawn/DawnTypes.h +9 -0
- package/shared/skia/include/gpu/graphite/dawn/DawnUtils.h +9 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlBackendContext.h +34 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +73 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +10 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlGraphiteTypes_cpp.h +50 -0
- package/shared/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +9 -0
- package/shared/skia/include/gpu/graphite/precompile/PaintOptions.h +211 -0
- package/shared/skia/include/gpu/graphite/precompile/Precompile.h +59 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileBase.h +76 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileBlender.h +56 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileColorFilter.h +95 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileImageFilter.h +116 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileMaskFilter.h +49 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileRuntimeEffect.h +47 -0
- package/shared/skia/include/gpu/graphite/precompile/PrecompileShader.h +268 -0
- package/shared/skia/include/gpu/graphite/vk/VulkanGraphiteContext.h +31 -0
- package/shared/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +104 -0
- package/shared/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +39 -0
- package/shared/skia/include/gpu/mtl/MtlMemoryAllocator.h +41 -0
- package/shared/skia/include/gpu/vk/VulkanBackendContext.h +57 -0
- package/shared/skia/include/gpu/vk/VulkanExtensions.h +73 -0
- package/shared/skia/include/gpu/vk/VulkanMemoryAllocator.h +117 -0
- package/shared/skia/include/gpu/vk/VulkanMutableTextureState.h +26 -0
- package/shared/skia/include/gpu/vk/VulkanPreferredFeatures.h +225 -0
- package/shared/skia/include/gpu/vk/VulkanTypes.h +245 -0
- package/shared/skia/include/pathops/SkPathOps.h +150 -0
- package/shared/skia/include/ports/SkCFObject.h +180 -0
- package/shared/skia/include/ports/SkFontConfigInterface.h +112 -0
- package/shared/skia/include/ports/SkFontMgr_FontConfigInterface.h +24 -0
- package/shared/skia/include/ports/SkFontMgr_Fontations.h +20 -0
- package/shared/skia/include/ports/SkFontMgr_android.h +48 -0
- package/shared/skia/include/ports/SkFontMgr_android_ndk.h +27 -0
- package/shared/skia/include/ports/SkFontMgr_data.h +22 -0
- package/shared/skia/include/ports/SkFontMgr_directory.h +21 -0
- package/shared/skia/include/ports/SkFontMgr_empty.h +21 -0
- package/shared/skia/include/ports/SkFontMgr_fontconfig.h +24 -0
- package/shared/skia/include/ports/SkFontMgr_fuchsia.h +21 -0
- package/shared/skia/include/ports/SkFontMgr_mac_ct.h +27 -0
- package/shared/skia/include/ports/SkFontScanner_Fontations.h +15 -0
- package/shared/skia/include/ports/SkFontScanner_FreeType.h +15 -0
- package/shared/skia/include/ports/SkImageGeneratorCG.h +28 -0
- package/shared/skia/include/ports/SkImageGeneratorNDK.h +40 -0
- package/shared/skia/include/ports/SkImageGeneratorWIC.h +41 -0
- package/shared/skia/include/ports/SkTypeface_fontations.h +24 -0
- package/shared/skia/include/ports/SkTypeface_mac.h +44 -0
- package/shared/skia/include/ports/SkTypeface_win.h +63 -0
- package/shared/skia/include/private/SingleOwner.h +75 -0
- package/shared/skia/include/private/SkAPI.h +52 -0
- package/shared/skia/include/private/SkASAN.h +56 -0
- package/shared/skia/include/private/SkAlign.h +51 -0
- package/shared/skia/include/private/SkAlignedStorage.h +32 -0
- package/shared/skia/include/private/SkAnySubclass.h +79 -0
- package/shared/skia/include/private/SkAssert.h +203 -0
- package/shared/skia/include/private/SkAttributes.h +96 -0
- package/shared/skia/include/private/SkCPUTypes.h +25 -0
- package/shared/skia/include/private/SkContainers.h +54 -0
- package/shared/skia/include/private/SkDebug.h +27 -0
- package/shared/skia/include/private/SkDeque.h +138 -0
- package/shared/skia/include/private/SkEncodedInfo.h +249 -0
- package/shared/skia/include/private/SkEnumBitMask.h +92 -0
- package/shared/skia/include/private/SkExif.h +69 -0
- package/shared/skia/include/private/SkFeatures.h +173 -0
- package/shared/skia/include/private/SkFixed.h +143 -0
- package/shared/skia/include/private/SkFloatingPoint.h +183 -0
- package/shared/skia/include/private/SkGainmapInfo.h +140 -0
- package/shared/skia/include/private/SkGainmapShader.h +60 -0
- package/shared/skia/include/private/SkHdrMetadata.h +357 -0
- package/shared/skia/include/private/SkIDChangeListener.h +76 -0
- package/shared/skia/include/private/SkJpegGainmapEncoder.h +48 -0
- package/shared/skia/include/private/SkJpegMetadataDecoder.h +103 -0
- package/shared/skia/include/private/SkLoadUserConfig.h +64 -0
- package/shared/skia/include/private/SkLog.h +62 -0
- package/shared/skia/include/private/SkLogPriority.h +34 -0
- package/shared/skia/include/private/SkMacros.h +170 -0
- package/shared/skia/include/private/SkMalloc.h +152 -0
- package/shared/skia/include/private/SkMath.h +77 -0
- package/shared/skia/include/private/SkMutex.h +72 -0
- package/shared/skia/include/private/SkNoncopyable.h +30 -0
- package/shared/skia/include/private/SkOnce.h +55 -0
- package/shared/skia/include/private/SkPathRef.h +90 -0
- package/shared/skia/include/private/SkPixelStorage.h +52 -0
- package/shared/skia/include/private/SkSLSampleUsage.h +85 -0
- package/shared/skia/include/private/SkSafe32.h +49 -0
- package/shared/skia/include/private/SkSemaphore.h +84 -0
- package/shared/skia/include/private/SkTArray.h +823 -0
- package/shared/skia/include/private/SkTDArray.h +247 -0
- package/shared/skia/include/private/SkTFitsIn.h +92 -0
- package/shared/skia/include/private/SkTLogic.h +56 -0
- package/shared/skia/include/private/SkTPin.h +23 -0
- package/shared/skia/include/private/SkTemplates.h +500 -0
- package/shared/skia/include/private/SkThreadAnnotations.h +104 -0
- package/shared/skia/include/private/SkThreadID.h +23 -0
- package/shared/skia/include/private/SkTo.h +39 -0
- package/shared/skia/include/private/SkTypeTraits.h +53 -0
- package/shared/skia/include/private/SkWeakRefCnt.h +173 -0
- package/shared/skia/include/private/SkXmp.h +62 -0
- package/shared/skia/include/private/chromium/GrDeferredDisplayList.h +120 -0
- package/shared/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +62 -0
- package/shared/skia/include/private/chromium/GrPromiseImageTexture.h +43 -0
- package/shared/skia/include/private/chromium/GrSurfaceCharacterization.h +211 -0
- package/shared/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +131 -0
- package/shared/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +150 -0
- package/shared/skia/include/private/chromium/SkCodecsICCProfileChromium.h +52 -0
- package/shared/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
- package/shared/skia/include/private/chromium/SkExifChromium.h +26 -0
- package/shared/skia/include/private/chromium/SkImageChromium.h +117 -0
- package/shared/skia/include/private/chromium/SkPMColor.h +38 -0
- package/shared/skia/include/private/chromium/Slug.h +72 -0
- package/shared/skia/include/private/gpu/ganesh/GrContext_Base.h +104 -0
- package/shared/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +60 -0
- package/shared/skia/include/private/gpu/ganesh/GrImageContext.h +56 -0
- package/shared/skia/include/private/gpu/ganesh/GrTextureGenerator.h +66 -0
- package/shared/skia/include/private/gpu/ganesh/GrTypesPriv.h +959 -0
- package/shared/skia/include/private/gpu/vk/SkiaVulkan.h +36 -0
- package/shared/skia/include/sksl/SkSLDebugTrace.h +25 -0
- package/shared/skia/include/sksl/SkSLVersion.h +27 -0
- package/shared/skia/include/svg/SkSVGCanvas.h +62 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_icd.h +245 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_layer.h +192 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_platform.h +84 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std.h +394 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_decode.h +109 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_encode.h +143 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +312 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +77 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_encode.h +147 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +446 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +67 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_encode.h +157 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_vp9std.h +151 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_vp9std_decode.h +68 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +36 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan.h +103 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_android.h +159 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_beta.h +375 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_core.h +25896 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_directfb.h +59 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_fuchsia.h +282 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_ggp.h +62 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +50 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +50 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_metal.h +244 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_ohos.h +120 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_screen.h +114 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_vi.h +50 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_wayland.h +59 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +372 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +60 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_xlib.h +60 -0
- package/shared/skia/include/third_party/vulkan/vulkan/vulkan_xlib_xrandr.h +50 -0
- package/shared/skia/include/utils/SkCamera.h +109 -0
- package/shared/skia/include/utils/SkCanvasStateUtils.h +81 -0
- package/shared/skia/include/utils/SkCustomTypeface.h +70 -0
- package/shared/skia/include/utils/SkEventTracer.h +93 -0
- package/shared/skia/include/utils/SkNWayCanvas.h +123 -0
- package/shared/skia/include/utils/SkNoDrawCanvas.h +78 -0
- package/shared/skia/include/utils/SkNullCanvas.h +22 -0
- package/shared/skia/include/utils/SkOrderedFontMgr.h +66 -0
- package/shared/skia/include/utils/SkPaintFilterCanvas.h +140 -0
- package/shared/skia/include/utils/SkParse.h +36 -0
- package/shared/skia/include/utils/SkParsePath.h +33 -0
- package/shared/skia/include/utils/SkShadowUtils.h +102 -0
- package/shared/skia/include/utils/SkTextUtils.h +43 -0
- package/shared/skia/include/utils/SkTraceEventPhase.h +19 -0
- package/shared/skia/include/utils/mac/SkCGUtils.h +90 -0
- package/shared/skia/modules/jsonreader/SkJSONReader.cpp +996 -0
- package/shared/skia/modules/jsonreader/SkJSONReader.h +389 -0
- package/shared/skia/modules/skcms/skcms.h +10 -0
- package/shared/skia/modules/skcms/src/Transform_inl.h +1600 -0
- package/shared/skia/modules/skcms/src/skcms_Transform.h +167 -0
- package/shared/skia/modules/skcms/src/skcms_internals.h +157 -0
- package/shared/skia/modules/skcms/src/skcms_public.h +496 -0
- package/shared/skia/modules/skottie/include/ExternalLayer.h +56 -0
- package/shared/skia/modules/skottie/include/Skottie.h +324 -0
- package/shared/skia/modules/skottie/include/SkottieProperty.h +190 -0
- package/shared/skia/modules/skottie/include/SlotManager.h +113 -0
- package/shared/skia/modules/skottie/include/TextShaper.h +197 -0
- package/shared/skia/modules/skottie/src/SkottieValue.h +56 -0
- package/shared/skia/modules/skottie/src/animator/Animator.h +89 -0
- package/shared/skia/modules/skottie/src/text/Font.h +82 -0
- package/shared/skia/modules/skottie/src/text/TextAdapter.h +155 -0
- package/shared/skia/modules/skottie/src/text/TextAnimator.h +122 -0
- package/shared/skia/modules/skottie/src/text/TextValue.h +28 -0
- package/shared/skia/modules/skparagraph/include/DartTypes.h +153 -0
- package/shared/skia/modules/skparagraph/include/FontArguments.h +46 -0
- package/shared/skia/modules/skparagraph/include/FontCollection.h +76 -0
- package/shared/skia/modules/skparagraph/include/Metrics.h +98 -0
- package/shared/skia/modules/skparagraph/include/Paragraph.h +289 -0
- package/shared/skia/modules/skparagraph/include/ParagraphBuilder.h +94 -0
- package/shared/skia/modules/skparagraph/include/ParagraphCache.h +52 -0
- package/shared/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
- package/shared/skia/modules/skparagraph/include/ParagraphStyle.h +160 -0
- package/shared/skia/modules/skparagraph/include/TextShadow.h +30 -0
- package/shared/skia/modules/skparagraph/include/TextStyle.h +392 -0
- package/shared/skia/modules/skparagraph/include/TypefaceFontProvider.h +78 -0
- package/shared/skia/modules/skresources/include/SkResources.h +291 -0
- package/shared/skia/modules/sksg/include/SkSGClipEffect.h +61 -0
- package/shared/skia/modules/sksg/include/SkSGColorFilter.h +135 -0
- package/shared/skia/modules/sksg/include/SkSGDraw.h +57 -0
- package/shared/skia/modules/sksg/include/SkSGEffectNode.h +50 -0
- package/shared/skia/modules/sksg/include/SkSGGeometryEffect.h +207 -0
- package/shared/skia/modules/sksg/include/SkSGGeometryNode.h +54 -0
- package/shared/skia/modules/sksg/include/SkSGGradient.h +108 -0
- package/shared/skia/modules/sksg/include/SkSGGroup.h +65 -0
- package/shared/skia/modules/sksg/include/SkSGImage.h +59 -0
- package/shared/skia/modules/sksg/include/SkSGInvalidationController.h +46 -0
- package/shared/skia/modules/sksg/include/SkSGMaskEffect.h +65 -0
- package/shared/skia/modules/sksg/include/SkSGMerge.h +74 -0
- package/shared/skia/modules/sksg/include/SkSGNode.h +128 -0
- package/shared/skia/modules/sksg/include/SkSGOpacityEffect.h +54 -0
- package/shared/skia/modules/sksg/include/SkSGPaint.h +112 -0
- package/shared/skia/modules/sksg/include/SkSGPath.h +68 -0
- package/shared/skia/modules/sksg/include/SkSGPlane.h +47 -0
- package/shared/skia/modules/sksg/include/SkSGRect.h +122 -0
- package/shared/skia/modules/sksg/include/SkSGRenderEffect.h +283 -0
- package/shared/skia/modules/sksg/include/SkSGRenderNode.h +157 -0
- package/shared/skia/modules/sksg/include/SkSGScene.h +47 -0
- package/shared/skia/modules/sksg/include/SkSGText.h +82 -0
- package/shared/skia/modules/sksg/include/SkSGTransform.h +127 -0
- package/shared/skia/modules/skshaper/include/SkShaper.h +318 -0
- package/shared/skia/modules/skshaper/include/SkShaper_coretext.h +26 -0
- package/shared/skia/modules/skshaper/include/SkShaper_factory.h +41 -0
- package/shared/skia/modules/skshaper/include/SkShaper_harfbuzz.h +39 -0
- package/shared/skia/modules/skshaper/include/SkShaper_skunicode.h +28 -0
- package/shared/skia/modules/skunicode/include/SkUnicode.h +321 -0
- package/shared/skia/modules/skunicode/include/SkUnicode_icu.h +18 -0
- package/shared/skia/modules/skunicode/include/SkUnicode_libgrapheme.h +19 -0
- package/shared/skia/modules/svg/include/SkSVGAttribute.h +110 -0
- package/shared/skia/modules/svg/include/SkSVGAttributeParser.h +170 -0
- package/shared/skia/modules/svg/include/SkSVGCircle.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGClipPath.h +41 -0
- package/shared/skia/modules/svg/include/SkSVGContainer.h +52 -0
- package/shared/skia/modules/svg/include/SkSVGDOM.h +111 -0
- package/shared/skia/modules/svg/include/SkSVGDefs.h +23 -0
- package/shared/skia/modules/svg/include/SkSVGEllipse.h +51 -0
- package/shared/skia/modules/svg/include/SkSVGFe.h +93 -0
- package/shared/skia/modules/svg/include/SkSVGFeBlend.h +54 -0
- package/shared/skia/modules/svg/include/SkSVGFeColorMatrix.h +55 -0
- package/shared/skia/modules/svg/include/SkSVGFeComponentTransfer.h +82 -0
- package/shared/skia/modules/svg/include/SkSVGFeComposite.h +55 -0
- package/shared/skia/modules/svg/include/SkSVGFeDisplacementMap.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGFeFlood.h +42 -0
- package/shared/skia/modules/svg/include/SkSVGFeGaussianBlur.h +50 -0
- package/shared/skia/modules/svg/include/SkSVGFeImage.h +44 -0
- package/shared/skia/modules/svg/include/SkSVGFeLightSource.h +93 -0
- package/shared/skia/modules/svg/include/SkSVGFeLighting.h +131 -0
- package/shared/skia/modules/svg/include/SkSVGFeMerge.h +63 -0
- package/shared/skia/modules/svg/include/SkSVGFeMorphology.h +55 -0
- package/shared/skia/modules/svg/include/SkSVGFeOffset.h +44 -0
- package/shared/skia/modules/svg/include/SkSVGFeTurbulence.h +49 -0
- package/shared/skia/modules/svg/include/SkSVGFilter.h +48 -0
- package/shared/skia/modules/svg/include/SkSVGFilterContext.h +69 -0
- package/shared/skia/modules/svg/include/SkSVGG.h +23 -0
- package/shared/skia/modules/svg/include/SkSVGGradient.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGHiddenContainer.h +23 -0
- package/shared/skia/modules/svg/include/SkSVGIDMapper.h +19 -0
- package/shared/skia/modules/svg/include/SkSVGImage.h +67 -0
- package/shared/skia/modules/svg/include/SkSVGLine.h +53 -0
- package/shared/skia/modules/svg/include/SkSVGLinearGradient.h +47 -0
- package/shared/skia/modules/svg/include/SkSVGMask.h +49 -0
- package/shared/skia/modules/svg/include/SkSVGNode.h +235 -0
- package/shared/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +37 -0
- package/shared/skia/modules/svg/include/SkSVGPath.h +46 -0
- package/shared/skia/modules/svg/include/SkSVGPattern.h +61 -0
- package/shared/skia/modules/svg/include/SkSVGPoly.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGRadialGradient.h +48 -0
- package/shared/skia/modules/svg/include/SkSVGRect.h +56 -0
- package/shared/skia/modules/svg/include/SkSVGRenderContext.h +229 -0
- package/shared/skia/modules/svg/include/SkSVGSVG.h +60 -0
- package/shared/skia/modules/svg/include/SkSVGShape.h +40 -0
- package/shared/skia/modules/svg/include/SkSVGStop.h +36 -0
- package/shared/skia/modules/svg/include/SkSVGText.h +128 -0
- package/shared/skia/modules/svg/include/SkSVGTransformableNode.h +48 -0
- package/shared/skia/modules/svg/include/SkSVGTypes.h +740 -0
- package/shared/skia/modules/svg/include/SkSVGUse.h +49 -0
- package/shared/skia/modules/svg/include/SkSVGValue.h +85 -0
- package/shared/skia/src/core/SkArenaAlloc.h +371 -0
- package/shared/skia/src/core/SkAutoLocaleSetter.h +94 -0
- package/shared/skia/src/core/SkChecksum.h +118 -0
- package/shared/skia/src/core/SkLRUCache.h +143 -0
- package/shared/skia/src/core/SkMathPriv.h +225 -0
- package/shared/skia/src/core/SkTHash.h +714 -0
- package/shared/skia/src/core/SkTInternalLList.h +304 -0
- package/shared/skia/src/core/SkTLazy.h +216 -0
- package/shared/skia/src/core/SkUTF.h +102 -0
- package/shared/skia/src/gpu/ganesh/gl/GrGLDefines.h +1162 -0
- package/src/GameMethods.nitro.ts +12 -2
- package/src/GameMethods.ts +57 -2
- package/src/index.tsx +1 -1
- package/src/nativeTypes.ts +13 -0
- package/src/types.ts +7 -9
- package/android/src/main/cpp/GameLoopJNI.cpp +0 -132
- package/android/src/main/java/com/margelo/nitro/rngine/Asset.kt +0 -9
- package/android/src/main/java/com/margelo/nitro/rngine/GameAssets.kt +0 -61
- package/android/src/main/java/com/margelo/nitro/rngine/Screen.kt +0 -9
- package/android/src/main/java/com/margelo/nitro/rngine/Shape.kt +0 -26
- package/android/src/main/java/com/margelo/nitro/rngine/Snapshot.kt +0 -3
- package/android/src/main/java/com/margelo/nitro/rngine/SnapshotSerializer.kt +0 -53
- package/lib/module/GameAssets.js +0 -41
- package/lib/module/GameAssets.js.map +0 -1
- package/lib/module/GameAssets.nitro.js +0 -5
- package/lib/module/GameAssets.nitro.js.map +0 -1
- package/lib/typescript/src/GameAssets.d.ts +0 -2
- package/lib/typescript/src/GameAssets.d.ts.map +0 -1
- package/lib/typescript/src/GameAssets.nitro.d.ts +0 -12
- package/lib/typescript/src/GameAssets.nitro.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JHybridGameAssetsSpec.cpp +0 -86
- package/nitrogen/generated/android/c++/JHybridGameAssetsSpec.hpp +0 -65
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngine/HybridGameAssetsSpec.kt +0 -63
- package/nitrogen/generated/ios/c++/HybridGameAssetsSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridGameAssetsSpecSwift.hpp +0 -99
- package/nitrogen/generated/ios/swift/Func_void.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +0 -46
- package/nitrogen/generated/ios/swift/HybridGameAssetsSpec.swift +0 -57
- package/nitrogen/generated/ios/swift/HybridGameAssetsSpec_cxx.swift +0 -176
- package/nitrogen/generated/shared/c++/HybridGameAssetsSpec.cpp +0 -23
- package/nitrogen/generated/shared/c++/HybridGameAssetsSpec.hpp +0 -65
- package/src/GameAssets.nitro.ts +0 -14
- package/src/GameAssets.ts +0 -47
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef SkYUVAPixmaps_DEFINED
|
|
9
|
+
#define SkYUVAPixmaps_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkColorType.h"
|
|
12
|
+
#include "include/core/SkData.h"
|
|
13
|
+
#include "include/core/SkImageInfo.h"
|
|
14
|
+
#include "include/core/SkPixmap.h"
|
|
15
|
+
#include "include/core/SkRefCnt.h"
|
|
16
|
+
#include "include/core/SkSize.h"
|
|
17
|
+
#include "include/core/SkTypes.h"
|
|
18
|
+
#include "include/core/SkYUVAInfo.h"
|
|
19
|
+
#include "include/private/SkTo.h"
|
|
20
|
+
|
|
21
|
+
#include <array>
|
|
22
|
+
#include <bitset>
|
|
23
|
+
#include <cstddef>
|
|
24
|
+
#include <tuple>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* SkYUVAInfo combined with per-plane SkColorTypes and row bytes. Fully specifies the SkPixmaps
|
|
28
|
+
* for a YUVA image without the actual pixel memory and data.
|
|
29
|
+
*/
|
|
30
|
+
class SK_API SkYUVAPixmapInfo {
|
|
31
|
+
public:
|
|
32
|
+
static constexpr auto kMaxPlanes = SkYUVAInfo::kMaxPlanes;
|
|
33
|
+
|
|
34
|
+
using PlaneConfig = SkYUVAInfo::PlaneConfig;
|
|
35
|
+
using Subsampling = SkYUVAInfo::Subsampling;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Data type for Y, U, V, and possibly A channels independent of how values are packed into
|
|
39
|
+
* planes.
|
|
40
|
+
**/
|
|
41
|
+
enum class DataType {
|
|
42
|
+
kUnorm8, ///< 8 bit unsigned normalized
|
|
43
|
+
kUnorm16, ///< 16 bit unsigned normalized
|
|
44
|
+
kFloat16, ///< 16 bit (half) floating point
|
|
45
|
+
kUnorm10_Unorm2, ///< 10 bit unorm for Y, U, and V. 2 bit unorm for alpha (if present).
|
|
46
|
+
|
|
47
|
+
kLast = kUnorm10_Unorm2
|
|
48
|
+
};
|
|
49
|
+
static constexpr int kDataTypeCnt = static_cast<int>(DataType::kLast) + 1;
|
|
50
|
+
|
|
51
|
+
class SK_API SupportedDataTypes {
|
|
52
|
+
public:
|
|
53
|
+
/** Defaults to nothing supported. */
|
|
54
|
+
constexpr SupportedDataTypes() = default;
|
|
55
|
+
|
|
56
|
+
/** All legal combinations of PlaneConfig and DataType are supported. */
|
|
57
|
+
static constexpr SupportedDataTypes All();
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Checks whether there is a supported combination of color types for planes structured
|
|
61
|
+
* as indicated by PlaneConfig with channel data types as indicated by DataType.
|
|
62
|
+
*/
|
|
63
|
+
constexpr bool supported(PlaneConfig, DataType) const;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Update to add support for pixmaps with numChannel channels where each channel is
|
|
67
|
+
* represented as DataType.
|
|
68
|
+
*/
|
|
69
|
+
void enableDataType(DataType, int numChannels);
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
// The bit for DataType dt with n channels is at index kDataTypeCnt*(n-1) + dt.
|
|
73
|
+
std::bitset<kDataTypeCnt*4> fDataTypeSupport = {};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Gets the default SkColorType to use with numChannels channels, each represented as DataType.
|
|
78
|
+
* Returns kUnknown_SkColorType if no such color type.
|
|
79
|
+
*/
|
|
80
|
+
static constexpr SkColorType DefaultColorTypeForDataType(DataType dataType, int numChannels);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* If the SkColorType is supported for YUVA pixmaps this will return the number of YUVA channels
|
|
84
|
+
* that can be stored in a plane of this color type and what the DataType is of those channels.
|
|
85
|
+
* If the SkColorType is not supported as a YUVA plane the number of channels is reported as 0
|
|
86
|
+
* and the DataType returned should be ignored.
|
|
87
|
+
*/
|
|
88
|
+
static std::tuple<int, DataType> NumChannelsAndDataType(SkColorType);
|
|
89
|
+
|
|
90
|
+
/** Default SkYUVAPixmapInfo is invalid. */
|
|
91
|
+
SkYUVAPixmapInfo() = default;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Initializes the SkYUVAPixmapInfo from a SkYUVAInfo with per-plane color types and row bytes.
|
|
95
|
+
* This will be invalid if the colorTypes aren't compatible with the SkYUVAInfo or if a
|
|
96
|
+
* rowBytes entry is not valid for the plane dimensions and color type. Color type and
|
|
97
|
+
* row byte values beyond the number of planes in SkYUVAInfo are ignored. All SkColorTypes
|
|
98
|
+
* must have the same DataType or this will be invalid.
|
|
99
|
+
*
|
|
100
|
+
* If rowBytes is nullptr then bpp*width is assumed for each plane.
|
|
101
|
+
*/
|
|
102
|
+
SkYUVAPixmapInfo(const SkYUVAInfo&,
|
|
103
|
+
const SkColorType[kMaxPlanes],
|
|
104
|
+
const size_t rowBytes[kMaxPlanes]);
|
|
105
|
+
/**
|
|
106
|
+
* Like above but uses DefaultColorTypeForDataType to determine each plane's SkColorType. If
|
|
107
|
+
* rowBytes is nullptr then bpp*width is assumed for each plane.
|
|
108
|
+
*/
|
|
109
|
+
SkYUVAPixmapInfo(const SkYUVAInfo&, DataType, const size_t rowBytes[kMaxPlanes]);
|
|
110
|
+
|
|
111
|
+
SkYUVAPixmapInfo(const SkYUVAPixmapInfo&) = default;
|
|
112
|
+
|
|
113
|
+
SkYUVAPixmapInfo& operator=(const SkYUVAPixmapInfo&) = default;
|
|
114
|
+
|
|
115
|
+
bool operator==(const SkYUVAPixmapInfo&) const;
|
|
116
|
+
bool operator!=(const SkYUVAPixmapInfo& that) const { return !(*this == that); }
|
|
117
|
+
|
|
118
|
+
const SkYUVAInfo& yuvaInfo() const { return fYUVAInfo; }
|
|
119
|
+
|
|
120
|
+
SkYUVColorSpace yuvColorSpace() const { return fYUVAInfo.yuvColorSpace(); }
|
|
121
|
+
|
|
122
|
+
/** The number of SkPixmap planes, 0 if this SkYUVAPixmapInfo is invalid. */
|
|
123
|
+
int numPlanes() const { return fYUVAInfo.numPlanes(); }
|
|
124
|
+
|
|
125
|
+
/** The per-YUV[A] channel data type. */
|
|
126
|
+
DataType dataType() const { return fDataType; }
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Row bytes for the ith plane. Returns zero if this SkYUVAPixmapInfo is invalid.
|
|
130
|
+
*/
|
|
131
|
+
size_t rowBytes(int i) const { return fRowBytes[static_cast<size_t>(i)]; }
|
|
132
|
+
|
|
133
|
+
/** Image info for the ith plane */
|
|
134
|
+
const SkImageInfo& planeInfo(int i) const { return fPlaneInfos[static_cast<size_t>(i)]; }
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Determine size to allocate for all planes. Optionally retrieves the per-plane sizes in
|
|
138
|
+
* planeSizes if not null. If total size overflows will return SIZE_MAX and set all planeSizes
|
|
139
|
+
* to SIZE_MAX. Returns 0 and fills planesSizes with 0 if this SkYUVAPixmapInfo is not valid.
|
|
140
|
+
*/
|
|
141
|
+
size_t computeTotalBytes(size_t planeSizes[kMaxPlanes] = nullptr) const;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Takes an allocation that is assumed to be at least computeTotalBytes() in size and configures
|
|
145
|
+
* the first numPlanes() entries in pixmaps array to point into that memory. The remaining
|
|
146
|
+
* entries of pixmaps are default initialized. Fails if this SkYUVAPixmapInfo not valid.
|
|
147
|
+
*/
|
|
148
|
+
bool initPixmapsFromSingleAllocation(void* memory, SkPixmap pixmaps[kMaxPlanes]) const;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Returns true if this has been configured with a non-empty dimensioned SkYUVAInfo with
|
|
152
|
+
* compatible color types and row bytes.
|
|
153
|
+
*/
|
|
154
|
+
bool isValid() const { return fYUVAInfo.isValid(); }
|
|
155
|
+
|
|
156
|
+
/** Is this valid and does it use color types allowed by the passed SupportedDataTypes? */
|
|
157
|
+
bool isSupported(const SupportedDataTypes&) const;
|
|
158
|
+
|
|
159
|
+
private:
|
|
160
|
+
SkYUVAInfo fYUVAInfo;
|
|
161
|
+
std::array<SkImageInfo, kMaxPlanes> fPlaneInfos = {};
|
|
162
|
+
std::array<size_t, kMaxPlanes> fRowBytes = {};
|
|
163
|
+
DataType fDataType = DataType::kUnorm8;
|
|
164
|
+
static_assert(kUnknown_SkColorType == 0, "default init isn't kUnknown");
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Helper to store SkPixmap planes as described by a SkYUVAPixmapInfo. Can be responsible for
|
|
169
|
+
* allocating/freeing memory for pixmaps or use external memory.
|
|
170
|
+
*/
|
|
171
|
+
class SK_API SkYUVAPixmaps {
|
|
172
|
+
public:
|
|
173
|
+
using DataType = SkYUVAPixmapInfo::DataType;
|
|
174
|
+
static constexpr auto kMaxPlanes = SkYUVAPixmapInfo::kMaxPlanes;
|
|
175
|
+
|
|
176
|
+
static SkColorType RecommendedRGBAColorType(DataType);
|
|
177
|
+
|
|
178
|
+
/** Allocate space for pixmaps' pixels in the SkYUVAPixmaps. */
|
|
179
|
+
static SkYUVAPixmaps Allocate(const SkYUVAPixmapInfo& yuvaPixmapInfo);
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Use storage in SkData as backing store for pixmaps' pixels. SkData is retained by the
|
|
183
|
+
* SkYUVAPixmaps.
|
|
184
|
+
*/
|
|
185
|
+
static SkYUVAPixmaps FromData(const SkYUVAPixmapInfo&, sk_sp<SkData>);
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Makes a deep copy of the src SkYUVAPixmaps. The returned SkYUVAPixmaps owns its planes'
|
|
189
|
+
* backing stores.
|
|
190
|
+
*/
|
|
191
|
+
static SkYUVAPixmaps MakeCopy(const SkYUVAPixmaps& src);
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Use passed in memory as backing store for pixmaps' pixels. Caller must ensure memory remains
|
|
195
|
+
* allocated while pixmaps are in use. There must be at least
|
|
196
|
+
* SkYUVAPixmapInfo::computeTotalBytes() allocated starting at memory.
|
|
197
|
+
*/
|
|
198
|
+
static SkYUVAPixmaps FromExternalMemory(const SkYUVAPixmapInfo&, void* memory);
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Wraps existing SkPixmaps. The SkYUVAPixmaps will have no ownership of the SkPixmaps' pixel
|
|
202
|
+
* memory so the caller must ensure it remains valid. Will return an invalid SkYUVAPixmaps if
|
|
203
|
+
* the SkYUVAInfo isn't compatible with the SkPixmap array (number of planes, plane dimensions,
|
|
204
|
+
* sufficient color channels in planes, ...).
|
|
205
|
+
*/
|
|
206
|
+
static SkYUVAPixmaps FromExternalPixmaps(const SkYUVAInfo&, const SkPixmap[kMaxPlanes]);
|
|
207
|
+
|
|
208
|
+
/** Default SkYUVAPixmaps is invalid. */
|
|
209
|
+
SkYUVAPixmaps() = default;
|
|
210
|
+
~SkYUVAPixmaps() = default;
|
|
211
|
+
|
|
212
|
+
SkYUVAPixmaps(SkYUVAPixmaps&& that) = default;
|
|
213
|
+
SkYUVAPixmaps& operator=(SkYUVAPixmaps&& that) = default;
|
|
214
|
+
SkYUVAPixmaps(const SkYUVAPixmaps&) = default;
|
|
215
|
+
SkYUVAPixmaps& operator=(const SkYUVAPixmaps& that) = default;
|
|
216
|
+
|
|
217
|
+
/** Does have initialized pixmaps compatible with its SkYUVAInfo. */
|
|
218
|
+
bool isValid() const { return !fYUVAInfo.dimensions().isEmpty(); }
|
|
219
|
+
|
|
220
|
+
const SkYUVAInfo& yuvaInfo() const { return fYUVAInfo; }
|
|
221
|
+
|
|
222
|
+
DataType dataType() const { return fDataType; }
|
|
223
|
+
|
|
224
|
+
SkYUVAPixmapInfo pixmapsInfo() const;
|
|
225
|
+
|
|
226
|
+
/** Number of pixmap planes or 0 if this SkYUVAPixmaps is invalid. */
|
|
227
|
+
int numPlanes() const { return this->isValid() ? fYUVAInfo.numPlanes() : 0; }
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Access the SkPixmap planes. They are default initialized if this is not a valid
|
|
231
|
+
* SkYUVAPixmaps.
|
|
232
|
+
*/
|
|
233
|
+
const std::array<SkPixmap, kMaxPlanes>& planes() const { return fPlanes; }
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get the ith SkPixmap plane. SkPixmap will be default initialized if SkYUVAPixmaps is invalid.
|
|
237
|
+
*/
|
|
238
|
+
const SkPixmap& plane(int i) const { return fPlanes[SkToSizeT(i)]; }
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Computes a YUVALocations representation of the planar layout. The result is guaranteed to be
|
|
242
|
+
* valid if this->isValid().
|
|
243
|
+
*/
|
|
244
|
+
SkYUVAInfo::YUVALocations toYUVALocations() const;
|
|
245
|
+
|
|
246
|
+
/** Does this SkPixmaps own the backing store of the planes? */
|
|
247
|
+
bool ownsStorage() const { return SkToBool(fData); }
|
|
248
|
+
|
|
249
|
+
private:
|
|
250
|
+
SkYUVAPixmaps(const SkYUVAPixmapInfo&, sk_sp<SkData>);
|
|
251
|
+
SkYUVAPixmaps(const SkYUVAInfo&, DataType, const SkPixmap[kMaxPlanes]);
|
|
252
|
+
|
|
253
|
+
std::array<SkPixmap, kMaxPlanes> fPlanes = {};
|
|
254
|
+
sk_sp<SkData> fData;
|
|
255
|
+
SkYUVAInfo fYUVAInfo;
|
|
256
|
+
DataType fDataType;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
//////////////////////////////////////////////////////////////////////////////
|
|
260
|
+
|
|
261
|
+
constexpr SkYUVAPixmapInfo::SupportedDataTypes SkYUVAPixmapInfo::SupportedDataTypes::All() {
|
|
262
|
+
using ULL = unsigned long long; // bitset cons. takes this.
|
|
263
|
+
ULL bits = 0;
|
|
264
|
+
for (ULL c = 1; c <= 4; ++c) {
|
|
265
|
+
for (ULL dt = 0; dt <= ULL(kDataTypeCnt); ++dt) {
|
|
266
|
+
if (DefaultColorTypeForDataType(static_cast<DataType>(dt),
|
|
267
|
+
static_cast<int>(c)) != kUnknown_SkColorType) {
|
|
268
|
+
bits |= ULL(1) << (dt + static_cast<ULL>(kDataTypeCnt)*(c - 1));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
SupportedDataTypes combinations;
|
|
273
|
+
combinations.fDataTypeSupport = bits;
|
|
274
|
+
return combinations;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
constexpr bool SkYUVAPixmapInfo::SupportedDataTypes::supported(PlaneConfig config,
|
|
278
|
+
DataType type) const {
|
|
279
|
+
int n = SkYUVAInfo::NumPlanes(config);
|
|
280
|
+
for (int i = 0; i < n; ++i) {
|
|
281
|
+
auto c = static_cast<size_t>(SkYUVAInfo::NumChannelsInPlane(config, i));
|
|
282
|
+
SkASSERT(c >= 1 && c <= 4);
|
|
283
|
+
if (!fDataTypeSupport[static_cast<size_t>(type) +
|
|
284
|
+
(c - 1)*static_cast<size_t>(kDataTypeCnt)]) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
constexpr SkColorType SkYUVAPixmapInfo::DefaultColorTypeForDataType(DataType dataType,
|
|
292
|
+
int numChannels) {
|
|
293
|
+
switch (numChannels) {
|
|
294
|
+
case 1:
|
|
295
|
+
switch (dataType) {
|
|
296
|
+
case DataType::kUnorm8: return kGray_8_SkColorType;
|
|
297
|
+
case DataType::kUnorm16: return kA16_unorm_SkColorType;
|
|
298
|
+
case DataType::kFloat16: return kA16_float_SkColorType;
|
|
299
|
+
case DataType::kUnorm10_Unorm2: return kUnknown_SkColorType;
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
case 2:
|
|
303
|
+
switch (dataType) {
|
|
304
|
+
case DataType::kUnorm8: return kR8G8_unorm_SkColorType;
|
|
305
|
+
case DataType::kUnorm16: return kR16G16_unorm_SkColorType;
|
|
306
|
+
case DataType::kFloat16: return kR16G16_float_SkColorType;
|
|
307
|
+
case DataType::kUnorm10_Unorm2: return kUnknown_SkColorType;
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
310
|
+
case 3:
|
|
311
|
+
// None of these are tightly packed. The intended use case is for interleaved YUVA
|
|
312
|
+
// planes where we're forcing opaqueness by ignoring the alpha values.
|
|
313
|
+
// There are "x" rather than "A" variants for Unorm8 and Unorm10_Unorm2 but we don't
|
|
314
|
+
// choose them because 1) there is no inherent advantage and 2) there is better support
|
|
315
|
+
// in the GPU backend for the "A" versions.
|
|
316
|
+
switch (dataType) {
|
|
317
|
+
case DataType::kUnorm8: return kRGBA_8888_SkColorType;
|
|
318
|
+
case DataType::kUnorm16: return kR16G16B16A16_unorm_SkColorType;
|
|
319
|
+
case DataType::kFloat16: return kRGBA_F16_SkColorType;
|
|
320
|
+
case DataType::kUnorm10_Unorm2: return kRGBA_1010102_SkColorType;
|
|
321
|
+
}
|
|
322
|
+
break;
|
|
323
|
+
case 4:
|
|
324
|
+
switch (dataType) {
|
|
325
|
+
case DataType::kUnorm8: return kRGBA_8888_SkColorType;
|
|
326
|
+
case DataType::kUnorm16: return kR16G16B16A16_unorm_SkColorType;
|
|
327
|
+
case DataType::kFloat16: return kRGBA_F16_SkColorType;
|
|
328
|
+
case DataType::kUnorm10_Unorm2: return kRGBA_1010102_SkColorType;
|
|
329
|
+
}
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
return kUnknown_SkColorType;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
#endif
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef SkMultiPictureDocument_DEFINED
|
|
9
|
+
#define SkMultiPictureDocument_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkPicture.h"
|
|
12
|
+
#include "include/core/SkRefCnt.h"
|
|
13
|
+
#include "include/core/SkSize.h"
|
|
14
|
+
#include "include/core/SkTypes.h"
|
|
15
|
+
|
|
16
|
+
#include <functional>
|
|
17
|
+
|
|
18
|
+
class SkDocument;
|
|
19
|
+
class SkStreamSeekable;
|
|
20
|
+
class SkWStream;
|
|
21
|
+
struct SkDeserialProcs;
|
|
22
|
+
struct SkSerialProcs;
|
|
23
|
+
|
|
24
|
+
struct SkDocumentPage {
|
|
25
|
+
sk_sp<SkPicture> fPicture;
|
|
26
|
+
SkSize fSize;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
namespace SkMultiPictureDocument {
|
|
30
|
+
/**
|
|
31
|
+
* Writes into a file format that is similar to SkPicture::serialize()
|
|
32
|
+
* Accepts a callback for endPage behavior
|
|
33
|
+
*/
|
|
34
|
+
SK_API sk_sp<SkDocument> Make(SkWStream* dst, const SkSerialProcs* = nullptr,
|
|
35
|
+
std::function<void(const SkPicture*)> onEndPage = nullptr);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns the number of pages in the SkMultiPictureDocument.
|
|
39
|
+
*/
|
|
40
|
+
SK_API int ReadPageCount(SkStreamSeekable* src);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Read the SkMultiPictureDocument into the provided array of pages.
|
|
44
|
+
* dstArrayCount must equal SkMultiPictureDocumentReadPageCount().
|
|
45
|
+
* Return false on error.
|
|
46
|
+
*/
|
|
47
|
+
SK_API bool Read(SkStreamSeekable* src,
|
|
48
|
+
SkDocumentPage* dstArray,
|
|
49
|
+
int dstArrayCount,
|
|
50
|
+
const SkDeserialProcs* = nullptr);
|
|
51
|
+
} // namespace SkMultiPictureDocument
|
|
52
|
+
|
|
53
|
+
#endif // SkMultiPictureDocument_DEFINED
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// Copyright 2018 Google LLC
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
3
|
+
#ifndef SkPDFDocument_DEFINED
|
|
4
|
+
#define SkPDFDocument_DEFINED
|
|
5
|
+
|
|
6
|
+
#include "include/core/SkDocument.h"
|
|
7
|
+
#include "include/core/SkMilestone.h"
|
|
8
|
+
#include "include/core/SkRefCnt.h"
|
|
9
|
+
#include "include/core/SkScalar.h"
|
|
10
|
+
#include "include/core/SkSpan.h"
|
|
11
|
+
#include "include/core/SkString.h"
|
|
12
|
+
#include "include/private/SkAPI.h"
|
|
13
|
+
#include "include/private/SkMacros.h"
|
|
14
|
+
#include "include/private/SkNoncopyable.h"
|
|
15
|
+
|
|
16
|
+
#include <cstdint>
|
|
17
|
+
#include <memory>
|
|
18
|
+
#include <vector>
|
|
19
|
+
|
|
20
|
+
class SkCanvas;
|
|
21
|
+
class SkCodec;
|
|
22
|
+
class SkData;
|
|
23
|
+
class SkExecutor;
|
|
24
|
+
class SkPDFArray;
|
|
25
|
+
class SkPDFStructTree;
|
|
26
|
+
class SkPixmap;
|
|
27
|
+
class SkWStream;
|
|
28
|
+
|
|
29
|
+
namespace SkPDF {
|
|
30
|
+
|
|
31
|
+
/** Attributes for nodes in the PDF tree.
|
|
32
|
+
*
|
|
33
|
+
* Each attribute must have an owner (e.g. "Layout", "List", "Table", etc)
|
|
34
|
+
* and an attribute name (e.g. "BBox", "RowSpan", etc.) from PDF32000_2008 14.8.5,
|
|
35
|
+
* and then a value of the proper type according to the spec.
|
|
36
|
+
*
|
|
37
|
+
* Parameters of type `const char*` will not be copied and the pointers must remain valid until
|
|
38
|
+
* `SkDocument::close` or `SkDocument::abort` is called.
|
|
39
|
+
* Names are expected to be constants and are taken as `const char*`.
|
|
40
|
+
* Parameters not taken as `const char*` will be copied.
|
|
41
|
+
*/
|
|
42
|
+
class SK_API AttributeList : SkNoncopyable {
|
|
43
|
+
public:
|
|
44
|
+
AttributeList();
|
|
45
|
+
~AttributeList();
|
|
46
|
+
|
|
47
|
+
void appendInt(const char* owner, const char* name, int value);
|
|
48
|
+
void appendFloat(const char* owner, const char* name, float value);
|
|
49
|
+
void appendName(const char* owner, const char* name, const char* value);
|
|
50
|
+
void appendTextString(const char* owner, const char* name, const char* value);
|
|
51
|
+
void appendTextString(const char* owner, const char* name, SkString value);
|
|
52
|
+
void appendFloatArray(const char* owner, const char* name, SkSpan<const float> value);
|
|
53
|
+
void appendNodeIdArray(const char* owner, const char* name, SkSpan<const int> nodeIds);
|
|
54
|
+
|
|
55
|
+
private:
|
|
56
|
+
friend class ::SkPDFStructTree;
|
|
57
|
+
|
|
58
|
+
std::unique_ptr<SkPDFArray> fAttrs;
|
|
59
|
+
std::vector<int> fElemIds; // element identifiers referenced by fAttrs
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** A node in a PDF structure tree, giving a semantic representation
|
|
63
|
+
of the content. Each node ID is associated with content
|
|
64
|
+
by passing the SkCanvas and node ID to SkPDF::SetNodeId() when drawing.
|
|
65
|
+
NodeIDs should be unique within each tree.
|
|
66
|
+
*/
|
|
67
|
+
struct StructureElementNode {
|
|
68
|
+
SkString fTypeString;
|
|
69
|
+
std::vector<std::unique_ptr<StructureElementNode>> fChildVector;
|
|
70
|
+
int fNodeId = 0;
|
|
71
|
+
AttributeList fAttributes;
|
|
72
|
+
SkString fAlt;
|
|
73
|
+
SkString fLang;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
struct DateTime {
|
|
77
|
+
int16_t fTimeZoneMinutes; // The number of minutes that this
|
|
78
|
+
// is ahead of or behind UTC.
|
|
79
|
+
uint16_t fYear; //!< e.g. 2005
|
|
80
|
+
uint8_t fMonth; //!< 1..12
|
|
81
|
+
uint8_t fDayOfWeek; //!< 0..6, 0==Sunday
|
|
82
|
+
uint8_t fDay; //!< 1..31
|
|
83
|
+
uint8_t fHour; //!< 0..23
|
|
84
|
+
uint8_t fMinute; //!< 0..59
|
|
85
|
+
uint8_t fSecond; //!< 0..59
|
|
86
|
+
|
|
87
|
+
void toISO8601(SkString* dst) const;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
using DecodeJpegCallback = std::unique_ptr<SkCodec> (*)(sk_sp<const SkData>);
|
|
91
|
+
using EncodeJpegCallback = bool (*)(SkWStream* dst, const SkPixmap& src, int quality);
|
|
92
|
+
|
|
93
|
+
/** Optional metadata to be passed into the PDF factory function.
|
|
94
|
+
*/
|
|
95
|
+
struct Metadata {
|
|
96
|
+
/** The document's title.
|
|
97
|
+
*/
|
|
98
|
+
SkString fTitle;
|
|
99
|
+
|
|
100
|
+
/** The name of the person who created the document.
|
|
101
|
+
*/
|
|
102
|
+
SkString fAuthor;
|
|
103
|
+
|
|
104
|
+
/** The subject of the document.
|
|
105
|
+
*/
|
|
106
|
+
SkString fSubject;
|
|
107
|
+
|
|
108
|
+
/** Keywords associated with the document. Commas may be used to delineate
|
|
109
|
+
keywords within the string.
|
|
110
|
+
*/
|
|
111
|
+
SkString fKeywords;
|
|
112
|
+
|
|
113
|
+
/** If the document was converted to PDF from another format,
|
|
114
|
+
the name of the conforming product that created the
|
|
115
|
+
original document from which it was converted.
|
|
116
|
+
*/
|
|
117
|
+
SkString fCreator;
|
|
118
|
+
|
|
119
|
+
/** The product that is converting this document to PDF.
|
|
120
|
+
*/
|
|
121
|
+
SkString fProducer = SkString("Skia/PDF m" SK_MACRO_STRINGIFY(SK_MILESTONE));
|
|
122
|
+
|
|
123
|
+
/** The date and time the document was created.
|
|
124
|
+
The zero default value represents an unknown/unset time.
|
|
125
|
+
*/
|
|
126
|
+
DateTime fCreation = {0, 0, 0, 0, 0, 0, 0, 0};
|
|
127
|
+
|
|
128
|
+
/** The date and time the document was most recently modified.
|
|
129
|
+
The zero default value represents an unknown/unset time.
|
|
130
|
+
*/
|
|
131
|
+
DateTime fModified = {0, 0, 0, 0, 0, 0, 0, 0};
|
|
132
|
+
|
|
133
|
+
/** The natural language of the text in the PDF. If fLang is empty, the root
|
|
134
|
+
StructureElementNode::fLang will be used (if not empty). Text not in
|
|
135
|
+
this language should be marked with StructureElementNode::fLang.
|
|
136
|
+
*/
|
|
137
|
+
SkString fLang;
|
|
138
|
+
|
|
139
|
+
/** The DPI (pixels-per-inch) at which features without native PDF support
|
|
140
|
+
will be rasterized (e.g. draw image with perspective, draw text with
|
|
141
|
+
perspective, ...) A larger DPI would create a PDF that reflects the
|
|
142
|
+
original intent with better fidelity, but it can make for larger PDF
|
|
143
|
+
files too, which would use more memory while rendering, and it would be
|
|
144
|
+
slower to be processed or sent online or to printer.
|
|
145
|
+
*/
|
|
146
|
+
SkScalar fRasterDPI = SK_ScalarDefaultRasterDPI;
|
|
147
|
+
|
|
148
|
+
/** If true, include XMP metadata, a document UUID, and sRGB output intent
|
|
149
|
+
information. This adds length to the document and makes it
|
|
150
|
+
non-reproducable, but are necessary features for PDF/A-2b conformance
|
|
151
|
+
*/
|
|
152
|
+
bool fPDFA = false;
|
|
153
|
+
|
|
154
|
+
/** Encoding quality controls the trade-off between size and quality. By
|
|
155
|
+
default this is set to 101 percent, which corresponds to lossless
|
|
156
|
+
encoding. If this value is set to a value <= 100, and the image is
|
|
157
|
+
opaque, it will be encoded (using JPEG) with that quality setting.
|
|
158
|
+
*/
|
|
159
|
+
int fEncodingQuality = 101;
|
|
160
|
+
|
|
161
|
+
/** If true, rasterize gradients with non-opaque stops for print compatibility.
|
|
162
|
+
Intended only for physical printing; it trades vector fidelity and file
|
|
163
|
+
size to avoid PDF-to-PostScript converter bugs.
|
|
164
|
+
*/
|
|
165
|
+
bool fRasterizeAlphaGradientsForPrinting = false;
|
|
166
|
+
|
|
167
|
+
/** An optional tree of structured document tags that provide
|
|
168
|
+
a semantic representation of the content. The caller
|
|
169
|
+
should retain ownership.
|
|
170
|
+
*/
|
|
171
|
+
StructureElementNode* fStructureElementTreeRoot = nullptr;
|
|
172
|
+
|
|
173
|
+
enum class Outline : int {
|
|
174
|
+
None = 0,
|
|
175
|
+
StructureElementHeaders = 1,
|
|
176
|
+
StructureElements = 2,
|
|
177
|
+
} fOutline = Outline::None;
|
|
178
|
+
|
|
179
|
+
/** Executor to handle threaded work within PDF Backend. If this is nullptr,
|
|
180
|
+
then all work will be done serially on the main thread. To have worker
|
|
181
|
+
threads assist with various tasks, set this to a valid SkExecutor
|
|
182
|
+
instance. Currently used for executing Deflate algorithm in parallel.
|
|
183
|
+
|
|
184
|
+
If set, the PDF output will be non-reproducible in the order and
|
|
185
|
+
internal numbering of objects, but should render the same.
|
|
186
|
+
|
|
187
|
+
Experimental.
|
|
188
|
+
*/
|
|
189
|
+
SkExecutor* fExecutor = nullptr;
|
|
190
|
+
|
|
191
|
+
/** PDF streams may be compressed to save space.
|
|
192
|
+
Use this to specify the desired compression vs time tradeoff.
|
|
193
|
+
*/
|
|
194
|
+
enum class CompressionLevel : int {
|
|
195
|
+
Default = -1,
|
|
196
|
+
None = 0,
|
|
197
|
+
LowButFast = 1,
|
|
198
|
+
Average = 6,
|
|
199
|
+
HighButSlow = 9,
|
|
200
|
+
} fCompressionLevel = CompressionLevel::Default;
|
|
201
|
+
|
|
202
|
+
/** Preferred Subsetter. */
|
|
203
|
+
enum Subsetter {
|
|
204
|
+
kHarfbuzz_Subsetter,
|
|
205
|
+
} fSubsetter = kHarfbuzz_Subsetter;
|
|
206
|
+
|
|
207
|
+
/** Clients can provide a way to decode jpeg. To use Skia's JPEG decoder, pass in
|
|
208
|
+
SkJpegDecoder::Decode. If not supplied, all images will need to be re-encoded
|
|
209
|
+
as jpegs or deflated images before embedding. If supplied, Skia may be able to
|
|
210
|
+
skip the re-encoding step.
|
|
211
|
+
Skia's JPEG decoder can be used here.
|
|
212
|
+
*/
|
|
213
|
+
SkPDF::DecodeJpegCallback jpegDecoder = nullptr;
|
|
214
|
+
|
|
215
|
+
/** Clients can provide a way to encode jpeg. If not supplied, images will be embedded
|
|
216
|
+
as a deflated image, potentially making them much larger. If clients provide
|
|
217
|
+
their own implementation, JPEGs should be encoded to RGB (not YUV) otherwise they
|
|
218
|
+
will have the wrong surrounding metadata provided by Skia.
|
|
219
|
+
Skia's JPEG encoder can be used here.
|
|
220
|
+
*/
|
|
221
|
+
SkPDF::EncodeJpegCallback jpegEncoder = nullptr;
|
|
222
|
+
|
|
223
|
+
// Skia's PDF support depends on having both a jpeg encoder and decoder for writing
|
|
224
|
+
// compact PDFs. It will technically work, but produce larger than optimal PDFs
|
|
225
|
+
// if either the decoder or encoder are left as nullptr. If clients will be creating
|
|
226
|
+
// PDFs that don't use images or otherwise want to incur this cost (with the upside
|
|
227
|
+
// of not having a jpeg library), they should set this to true to avoid an internal
|
|
228
|
+
// assert from firing.
|
|
229
|
+
bool allowNoJpegs = false;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
namespace NodeID {
|
|
233
|
+
static const constexpr int Nothing = 0;
|
|
234
|
+
static const constexpr int OtherArtifact = -1;
|
|
235
|
+
static const constexpr int PaginationArtifact = -2;
|
|
236
|
+
static const constexpr int PaginationHeaderArtifact = -3;
|
|
237
|
+
static const constexpr int PaginationFooterArtifact = -4;
|
|
238
|
+
static const constexpr int PaginationWatermarkArtifact = -5;
|
|
239
|
+
static const constexpr int LayoutArtifact = -6;
|
|
240
|
+
static const constexpr int PageArtifact = -7;
|
|
241
|
+
static const constexpr int BackgroundArtifact = -8;
|
|
242
|
+
} // namespace NodeID
|
|
243
|
+
|
|
244
|
+
/** Associate a node ID with subsequent drawing commands in an
|
|
245
|
+
SkCanvas. The same node ID can appear in a StructureElementNode
|
|
246
|
+
in order to associate a document's structure element tree with
|
|
247
|
+
its content.
|
|
248
|
+
|
|
249
|
+
A node ID of zero indicates no node ID. Negative node IDs are reserved.
|
|
250
|
+
|
|
251
|
+
@param canvas The canvas used to draw to the PDF.
|
|
252
|
+
@param nodeId The node ID for subsequent drawing commands.
|
|
253
|
+
*/
|
|
254
|
+
SK_API void SetNodeId(SkCanvas* dst, int nodeID);
|
|
255
|
+
|
|
256
|
+
/** Create a PDF-backed document, writing the results into a SkWStream.
|
|
257
|
+
|
|
258
|
+
PDF pages are sized in point units. 1 pt == 1/72 inch == 127/360 mm.
|
|
259
|
+
|
|
260
|
+
@param stream A PDF document will be written to this stream. The document may write
|
|
261
|
+
to the stream at anytime during its lifetime, until either close() is
|
|
262
|
+
called or the document is deleted.
|
|
263
|
+
@param metadata a PDFmetadata object. Some fields may be left empty.
|
|
264
|
+
|
|
265
|
+
@returns NULL if there is an error, otherwise a newly created PDF-backed SkDocument.
|
|
266
|
+
*/
|
|
267
|
+
SK_API sk_sp<SkDocument> MakeDocument(SkWStream* stream, const Metadata& metadata);
|
|
268
|
+
|
|
269
|
+
#if !defined(SK_DISABLE_LEGACY_PDF_JPEG)
|
|
270
|
+
static inline sk_sp<SkDocument> MakeDocument(SkWStream* stream) {
|
|
271
|
+
return MakeDocument(stream, Metadata());
|
|
272
|
+
}
|
|
273
|
+
#endif
|
|
274
|
+
|
|
275
|
+
} // namespace SkPDF
|
|
276
|
+
|
|
277
|
+
#endif // SkPDFDocument_DEFINED
|