@shopify/react-native-skia 0.1.192 → 0.1.193
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/android/CMakeLists.txt +1 -1
- package/android/build.gradle +1 -0
- package/android/cpp/jni/JniPlatformContext.cpp +1 -1
- package/cpp/api/JsiSkImage.h +25 -4
- package/cpp/api/JsiSkImageFactory.h +2 -2
- package/cpp/api/JsiSkPath.h +8 -6
- package/cpp/rnskia/dom/base/Declaration.h +5 -7
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +1 -0
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +2 -2
- package/cpp/rnskia/dom/props/BoxShadowProps.h +2 -0
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +2 -8
- package/cpp/skia/include/android/SkImageAndroid.h +101 -0
- package/cpp/skia/include/codec/SkAndroidCodec.h +26 -8
- package/cpp/skia/include/codec/SkCodec.h +31 -17
- package/cpp/skia/include/codec/SkEncodedImageFormat.h +36 -0
- package/cpp/skia/include/codec/SkPixmapUtils.h +31 -0
- package/cpp/skia/include/config/SkUserConfig.h +61 -29
- package/cpp/skia/include/core/SkBitmap.h +25 -25
- package/cpp/skia/include/core/SkBlurTypes.h +0 -2
- package/cpp/skia/include/core/SkCanvas.h +32 -15
- package/cpp/skia/include/core/SkCapabilities.h +2 -2
- package/cpp/skia/include/core/SkColor.h +2 -0
- package/cpp/skia/include/core/SkColorPriv.h +19 -4
- package/cpp/skia/include/core/SkColorSpace.h +14 -17
- package/cpp/skia/include/core/SkColorType.h +1 -0
- package/cpp/skia/include/core/SkContourMeasure.h +1 -1
- package/cpp/skia/include/core/SkCoverageMode.h +0 -2
- package/cpp/skia/include/core/SkCubicMap.h +2 -0
- package/cpp/skia/include/core/SkData.h +5 -2
- package/cpp/skia/include/core/SkDataTable.h +6 -2
- package/cpp/skia/include/core/SkDeferredDisplayList.h +11 -10
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +9 -8
- package/cpp/skia/include/core/SkDrawable.h +10 -2
- package/cpp/skia/include/core/SkEncodedImageFormat.h +3 -30
- package/cpp/skia/include/core/SkFlattenable.h +4 -2
- package/cpp/skia/include/core/SkFont.h +1 -0
- package/cpp/skia/include/core/SkFontMetrics.h +1 -0
- package/cpp/skia/include/core/SkFontMgr.h +20 -29
- package/cpp/skia/include/core/SkFontStyle.h +4 -1
- package/cpp/skia/include/core/SkGraphics.h +21 -18
- package/cpp/skia/include/core/SkICC.h +3 -13
- package/cpp/skia/include/core/SkImage.h +395 -717
- package/cpp/skia/include/core/SkImageGenerator.h +19 -74
- package/cpp/skia/include/core/SkImageInfo.h +7 -5
- package/cpp/skia/include/core/SkM44.h +11 -0
- package/cpp/skia/include/core/SkMaskFilter.h +6 -3
- package/cpp/skia/include/core/SkMatrix.h +14 -4
- package/cpp/skia/include/core/SkMesh.h +52 -18
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPaint.h +11 -34
- package/cpp/skia/include/core/SkPath.h +23 -4
- package/cpp/skia/include/core/SkPathBuilder.h +13 -5
- package/cpp/skia/include/core/SkPathMeasure.h +1 -1
- package/cpp/skia/include/core/SkPathTypes.h +0 -2
- package/cpp/skia/include/core/SkPathUtils.h +42 -0
- package/cpp/skia/include/core/SkPicture.h +3 -2
- package/cpp/skia/include/core/SkPictureRecorder.h +2 -0
- package/cpp/skia/include/core/SkPixelRef.h +4 -8
- package/cpp/skia/include/core/SkPixmap.h +12 -20
- package/cpp/skia/include/core/SkPoint.h +4 -2
- package/cpp/skia/include/core/SkPromiseImageTexture.h +2 -2
- package/cpp/skia/include/core/SkRRect.h +5 -1
- package/cpp/skia/include/core/SkRect.h +6 -3
- package/cpp/skia/include/core/SkRefCnt.h +9 -14
- package/cpp/skia/include/core/SkRegion.h +1 -1
- package/cpp/skia/include/core/SkScalar.h +2 -4
- package/cpp/skia/include/core/SkSerialProcs.h +18 -10
- package/cpp/skia/include/core/SkShader.h +1 -64
- package/cpp/skia/include/core/SkSize.h +2 -0
- package/cpp/skia/include/core/SkSpan.h +4 -112
- package/cpp/skia/include/core/SkStream.h +11 -12
- package/cpp/skia/include/core/SkString.h +9 -25
- package/cpp/skia/include/core/SkStrokeRec.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +83 -61
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +3 -3
- package/cpp/skia/include/core/SkSurfaceProps.h +9 -1
- package/cpp/skia/include/core/SkTextBlob.h +2 -2
- package/cpp/skia/include/core/SkTextureCompressionType.h +30 -0
- package/cpp/skia/include/core/SkTime.h +1 -1
- package/cpp/skia/include/core/SkTypeface.h +9 -2
- package/cpp/skia/include/core/SkTypes.h +37 -466
- package/cpp/skia/include/core/SkVertices.h +2 -0
- package/cpp/skia/include/core/SkYUVAInfo.h +4 -0
- package/cpp/skia/include/core/SkYUVAPixmaps.h +7 -1
- package/cpp/skia/include/docs/SkPDFDocument.h +12 -1
- package/cpp/skia/include/effects/SkColorMatrix.h +2 -1
- package/cpp/skia/include/effects/SkGradientShader.h +65 -14
- package/cpp/skia/include/effects/SkImageFilters.h +0 -11
- package/cpp/skia/include/effects/SkRuntimeEffect.h +41 -11
- package/cpp/skia/include/encode/SkEncoder.h +7 -3
- package/cpp/skia/include/encode/SkICC.h +36 -0
- package/cpp/skia/include/encode/SkJpegEncoder.h +102 -71
- package/cpp/skia/include/encode/SkPngEncoder.h +89 -71
- package/cpp/skia/include/encode/SkWebpEncoder.h +65 -38
- package/cpp/skia/include/gpu/GpuTypes.h +23 -1
- package/cpp/skia/include/gpu/GrBackendSurface.h +9 -7
- package/cpp/skia/include/gpu/GrContextOptions.h +28 -9
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +6 -4
- package/cpp/skia/include/gpu/GrDirectContext.h +84 -63
- package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +2 -1
- package/cpp/skia/include/gpu/GrRecordingContext.h +9 -5
- package/cpp/skia/include/gpu/GrTypes.h +18 -18
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +4 -4
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTextureGenerator.h +77 -0
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +385 -0
- package/cpp/skia/include/gpu/gl/GrGLExtensions.h +3 -3
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -3
- package/cpp/skia/include/gpu/gl/GrGLTypes.h +2 -1
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +72 -3
- package/cpp/skia/include/gpu/graphite/Context.h +85 -32
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +15 -11
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +55 -5
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +6 -4
- package/cpp/skia/include/gpu/graphite/Recorder.h +41 -11
- package/cpp/skia/include/gpu/graphite/Recording.h +50 -3
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +47 -8
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +139 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +40 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +28 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +1 -1
- package/cpp/skia/include/gpu/graphite/mtl/{MtlTypes.h → MtlGraphiteTypes.h} +7 -6
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +27 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +4 -9
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +28 -0
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +17 -13
- package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +3 -3
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +3 -3
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +5 -7
- package/cpp/skia/include/pathops/SkPathOps.h +3 -3
- package/cpp/skia/include/ports/SkFontMgr_data.h +22 -0
- package/cpp/skia/include/ports/SkFontMgr_indirect.h +14 -14
- package/cpp/skia/include/ports/SkRemotableFontMgr.h +2 -2
- package/cpp/skia/include/ports/SkTypeface_win.h +2 -1
- package/cpp/skia/include/private/SkChecksum.h +32 -7
- package/cpp/skia/include/private/SkColorData.h +1 -26
- package/cpp/skia/include/private/SkGainmapInfo.h +97 -0
- package/cpp/skia/include/private/SkGainmapShader.h +53 -0
- package/cpp/skia/include/private/SkIDChangeListener.h +4 -3
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +71 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +61 -0
- package/cpp/skia/include/private/SkOpts_spi.h +3 -1
- package/cpp/skia/include/private/SkPathRef.h +64 -47
- package/cpp/skia/include/private/SkSLDefines.h +5 -5
- package/cpp/skia/include/private/SkSLSampleUsage.h +0 -4
- package/cpp/skia/include/private/SkSpinlock.h +1 -1
- package/cpp/skia/include/private/SkWeakRefCnt.h +3 -0
- package/cpp/skia/include/private/{SingleOwner.h → base/SingleOwner.h} +8 -5
- package/cpp/skia/include/private/base/SkAPI.h +52 -0
- package/cpp/skia/include/private/base/SkAlign.h +39 -0
- package/cpp/skia/include/private/base/SkAlignedStorage.h +32 -0
- package/cpp/skia/include/private/base/SkAssert.h +92 -0
- package/cpp/skia/include/private/base/SkAttributes.h +102 -0
- package/cpp/skia/include/private/base/SkCPUTypes.h +25 -0
- package/cpp/skia/include/private/base/SkContainers.h +46 -0
- package/cpp/skia/include/private/base/SkDebug.h +27 -0
- package/cpp/skia/include/private/{SkDeque.h → base/SkDeque.h} +3 -1
- package/cpp/skia/include/private/base/SkFeatures.h +151 -0
- package/cpp/skia/include/private/{SkFixed.h → base/SkFixed.h} +9 -7
- package/cpp/skia/include/private/{SkFloatBits.h → base/SkFloatBits.h} +2 -3
- package/cpp/skia/include/private/{SkFloatingPoint.h → base/SkFloatingPoint.h} +18 -9
- package/cpp/skia/include/private/base/SkLoadUserConfig.h +63 -0
- package/cpp/skia/include/private/{SkMacros.h → base/SkMacros.h} +17 -2
- package/cpp/skia/include/private/{SkMalloc.h → base/SkMalloc.h} +4 -7
- package/cpp/skia/include/{core → private/base}/SkMath.h +25 -2
- package/cpp/skia/include/private/{SkMutex.h → base/SkMutex.h} +5 -5
- package/cpp/skia/include/private/{SkNoncopyable.h → base/SkNoncopyable.h} +2 -2
- package/cpp/skia/include/private/{SkOnce.h → base/SkOnce.h} +3 -1
- package/cpp/skia/include/private/base/SkPathEnums.h +25 -0
- package/cpp/skia/include/private/{SkSafe32.h → base/SkSafe32.h} +16 -1
- package/cpp/skia/include/private/{SkSemaphore.h → base/SkSemaphore.h} +4 -3
- package/cpp/skia/include/private/base/SkSpan_impl.h +129 -0
- package/cpp/skia/include/private/base/SkTArray.h +694 -0
- package/cpp/skia/include/private/{SkTDArray.h → base/SkTDArray.h} +17 -54
- package/cpp/skia/include/private/{SkTFitsIn.h → base/SkTFitsIn.h} +14 -8
- package/cpp/skia/include/private/{SkTLogic.h → base/SkTLogic.h} +1 -1
- package/cpp/skia/include/private/{SkTemplates.h → base/SkTemplates.h} +63 -88
- package/cpp/skia/include/private/{SkThreadID.h → base/SkThreadID.h} +5 -2
- package/cpp/skia/include/private/{SkTo.h → base/SkTo.h} +13 -2
- package/cpp/skia/include/private/base/SkTypeTraits.h +33 -0
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +130 -0
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +5 -9
- package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
- package/cpp/skia/include/private/chromium/Slug.h +0 -9
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +2 -1
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +3 -2
- package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +17 -23
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -2
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +38 -0
- package/cpp/skia/include/private/gpu/graphite/{MtlTypesPriv.h → MtlGraphiteTypesPriv.h} +5 -5
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +1 -9
- package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +4 -0
- package/cpp/skia/include/utils/SkCamera.h +1 -1
- package/cpp/skia/include/utils/SkCustomTypeface.h +7 -1
- package/cpp/skia/include/utils/SkNWayCanvas.h +6 -6
- package/cpp/skia/include/utils/SkOrderedFontMgr.h +7 -6
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +2 -2
- package/cpp/skia/include/utils/SkParsePath.h +1 -1
- package/cpp/skia/modules/skcms/skcms.h +14 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +19 -0
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -2
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +72 -2
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -11
- package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +27 -4
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +13 -13
- package/cpp/skia/modules/skresources/include/SkResources.h +18 -4
- package/cpp/skia/modules/svg/include/SkSVGAttribute.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGIDMapper.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +22 -21
- package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
- package/cpp/skia/{include/private → src/core}/SkTHash.h +41 -37
- package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +1 -1
- package/scripts/install-npm.js +11 -1
- package/cpp/skia/include/core/SkImageEncoder.h +0 -71
- package/cpp/skia/include/gpu/GrConfig.h +0 -53
- package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +0 -195
- package/cpp/skia/include/private/SkHalf.h +0 -38
- package/cpp/skia/include/private/SkImageInfoPriv.h +0 -199
- package/cpp/skia/include/private/SkSLIRNode.h +0 -64
- package/cpp/skia/include/private/SkSLLayout.h +0 -144
- package/cpp/skia/include/private/SkSLModifiers.h +0 -178
- package/cpp/skia/include/private/SkSLProgramElement.h +0 -77
- package/cpp/skia/include/private/SkSLProgramKind.h +0 -35
- package/cpp/skia/include/private/SkSLStatement.h +0 -86
- package/cpp/skia/include/private/SkSLString.h +0 -41
- package/cpp/skia/include/private/SkSLSymbol.h +0 -94
- package/cpp/skia/include/private/SkSafe_math.h +0 -52
- package/cpp/skia/include/private/SkStringView.h +0 -51
- package/cpp/skia/include/private/SkTArray.h +0 -655
- package/cpp/skia/include/private/SkUniquePaintParamsID.h +0 -35
- package/cpp/skia/include/private/SkVx.h +0 -1026
- package/cpp/skia/include/sksl/DSL.h +0 -37
- package/cpp/skia/include/sksl/DSLBlock.h +0 -58
- package/cpp/skia/include/sksl/DSLCase.h +0 -62
- package/cpp/skia/include/sksl/DSLCore.h +0 -492
- package/cpp/skia/include/sksl/DSLExpression.h +0 -241
- package/cpp/skia/include/sksl/DSLFunction.h +0 -113
- package/cpp/skia/include/sksl/DSLLayout.h +0 -92
- package/cpp/skia/include/sksl/DSLModifiers.h +0 -69
- package/cpp/skia/include/sksl/DSLStatement.h +0 -82
- package/cpp/skia/include/sksl/DSLSymbols.h +0 -61
- package/cpp/skia/include/sksl/DSLType.h +0 -271
- package/cpp/skia/include/sksl/DSLVar.h +0 -231
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +0 -65
- package/cpp/skia/include/sksl/SkSLOperator.h +0 -154
- package/cpp/skia/include/sksl/SkSLPosition.h +0 -104
- package/cpp/skia/include/utils/SkRandom.h +0 -169
- package/cpp/skia/src/core/SkLRUCache.h +0 -126
- package/cpp/skia/src/core/SkTInternalLList.h +0 -302
- /package/cpp/skia/include/{core → codec}/SkPngChunkReader.h +0 -0
- /package/cpp/skia/include/private/{SkTPin.h → base/SkTPin.h} +0 -0
- /package/cpp/skia/include/private/{SkThreadAnnotations.h → base/SkThreadAnnotations.h} +0 -0
|
@@ -62,10 +62,43 @@ public:
|
|
|
62
62
|
struct Interpolation {
|
|
63
63
|
enum class InPremul : bool { kNo = false, kYes = true };
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
enum class ColorSpace : uint8_t {
|
|
66
|
+
// Default Skia behavior: interpolate in the color space of the destination surface
|
|
67
|
+
kDestination,
|
|
68
|
+
|
|
69
|
+
// https://www.w3.org/TR/css-color-4/#interpolation-space
|
|
70
|
+
kSRGBLinear,
|
|
71
|
+
kLab,
|
|
72
|
+
kOKLab,
|
|
73
|
+
kLCH,
|
|
74
|
+
kOKLCH,
|
|
75
|
+
kSRGB,
|
|
76
|
+
kHSL,
|
|
77
|
+
kHWB,
|
|
78
|
+
|
|
79
|
+
kLastColorSpace = kHWB,
|
|
80
|
+
};
|
|
81
|
+
static constexpr int kColorSpaceCount = static_cast<int>(ColorSpace::kLastColorSpace) + 1;
|
|
82
|
+
|
|
83
|
+
enum class HueMethod : uint8_t {
|
|
84
|
+
// https://www.w3.org/TR/css-color-4/#hue-interpolation
|
|
85
|
+
kShorter,
|
|
86
|
+
kLonger,
|
|
87
|
+
kIncreasing,
|
|
88
|
+
kDecreasing,
|
|
89
|
+
|
|
90
|
+
kLastHueMethod = kDecreasing,
|
|
91
|
+
};
|
|
92
|
+
static constexpr int kHueMethodCount = static_cast<int>(HueMethod::kLastHueMethod) + 1;
|
|
93
|
+
|
|
94
|
+
InPremul fInPremul = InPremul::kNo;
|
|
95
|
+
ColorSpace fColorSpace = ColorSpace::kDestination;
|
|
96
|
+
HueMethod fHueMethod = HueMethod::kShorter; // Only relevant for LCH, OKLCH, HSL, or HWB
|
|
66
97
|
|
|
67
98
|
static Interpolation FromFlags(uint32_t flags) {
|
|
68
|
-
return {flags & kInterpolateColorsInPremul_Flag ? InPremul::kYes : InPremul::kNo
|
|
99
|
+
return {flags & kInterpolateColorsInPremul_Flag ? InPremul::kYes : InPremul::kNo,
|
|
100
|
+
ColorSpace::kDestination,
|
|
101
|
+
HueMethod::kShorter};
|
|
69
102
|
}
|
|
70
103
|
};
|
|
71
104
|
|
|
@@ -76,8 +109,11 @@ public:
|
|
|
76
109
|
@param pos May be NULL. array[count] of SkScalars, or NULL, of the relative position of
|
|
77
110
|
each corresponding color in the colors array. If this is NULL,
|
|
78
111
|
the the colors are distributed evenly between the start and end point.
|
|
79
|
-
If this is not null, the values must
|
|
80
|
-
|
|
112
|
+
If this is not null, the values must lie between 0.0 and 1.0, and be
|
|
113
|
+
strictly increasing. If the first value is not 0.0, then an additional
|
|
114
|
+
color stop is added at position 0.0, with the same color as colors[0].
|
|
115
|
+
If the the last value is not 1.0, then an additional color stop is added
|
|
116
|
+
at position 1.0, with the same color as colors[count - 1].
|
|
81
117
|
@param count Must be >=2. The number of colors (and pos if not NULL) entries.
|
|
82
118
|
@param mode The tiling mode
|
|
83
119
|
|
|
@@ -95,8 +131,11 @@ public:
|
|
|
95
131
|
@param pos May be NULL. array[count] of SkScalars, or NULL, of the relative position of
|
|
96
132
|
each corresponding color in the colors array. If this is NULL,
|
|
97
133
|
the the colors are distributed evenly between the start and end point.
|
|
98
|
-
If this is not null, the values must
|
|
99
|
-
|
|
134
|
+
If this is not null, the values must lie between 0.0 and 1.0, and be
|
|
135
|
+
strictly increasing. If the first value is not 0.0, then an additional
|
|
136
|
+
color stop is added at position 0.0, with the same color as colors[0].
|
|
137
|
+
If the the last value is not 1.0, then an additional color stop is added
|
|
138
|
+
at position 1.0, with the same color as colors[count - 1].
|
|
100
139
|
@param count Must be >=2. The number of colors (and pos if not NULL) entries.
|
|
101
140
|
@param mode The tiling mode
|
|
102
141
|
|
|
@@ -123,8 +162,11 @@ public:
|
|
|
123
162
|
@param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
|
|
124
163
|
each corresponding color in the colors array. If this is NULL,
|
|
125
164
|
the the colors are distributed evenly between the center and edge of the circle.
|
|
126
|
-
If this is not null, the values must
|
|
127
|
-
|
|
165
|
+
If this is not null, the values must lie between 0.0 and 1.0, and be
|
|
166
|
+
strictly increasing. If the first value is not 0.0, then an additional
|
|
167
|
+
color stop is added at position 0.0, with the same color as colors[0].
|
|
168
|
+
If the the last value is not 1.0, then an additional color stop is added
|
|
169
|
+
at position 1.0, with the same color as colors[count - 1].
|
|
128
170
|
@param count Must be >= 2. The number of colors (and pos if not NULL) entries
|
|
129
171
|
@param mode The tiling mode
|
|
130
172
|
*/
|
|
@@ -141,8 +183,11 @@ public:
|
|
|
141
183
|
@param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
|
|
142
184
|
each corresponding color in the colors array. If this is NULL,
|
|
143
185
|
the the colors are distributed evenly between the center and edge of the circle.
|
|
144
|
-
If this is not null, the values must
|
|
145
|
-
|
|
186
|
+
If this is not null, the values must lie between 0.0 and 1.0, and be
|
|
187
|
+
strictly increasing. If the first value is not 0.0, then an additional
|
|
188
|
+
color stop is added at position 0.0, with the same color as colors[0].
|
|
189
|
+
If the the last value is not 1.0, then an additional color stop is added
|
|
190
|
+
at position 1.0, with the same color as colors[count - 1].
|
|
146
191
|
@param count Must be >= 2. The number of colors (and pos if not NULL) entries
|
|
147
192
|
@param mode The tiling mode
|
|
148
193
|
*/
|
|
@@ -214,8 +259,11 @@ public:
|
|
|
214
259
|
@param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative
|
|
215
260
|
position of each corresponding color in the colors array. If this is
|
|
216
261
|
NULL, then the colors are distributed evenly within the angular range.
|
|
217
|
-
If this is not null, the values must
|
|
218
|
-
|
|
262
|
+
If this is not null, the values must lie between 0.0 and 1.0, and be
|
|
263
|
+
strictly increasing. If the first value is not 0.0, then an additional
|
|
264
|
+
color stop is added at position 0.0, with the same color as colors[0].
|
|
265
|
+
If the the last value is not 1.0, then an additional color stop is added
|
|
266
|
+
at position 1.0, with the same color as colors[count - 1].
|
|
219
267
|
@param count Must be >= 2. The number of colors (and pos if not NULL) entries
|
|
220
268
|
@param mode Tiling mode: controls drawing outside of the gradient angular range.
|
|
221
269
|
@param startAngle Start of the angular range, corresponding to pos == 0.
|
|
@@ -250,8 +298,11 @@ public:
|
|
|
250
298
|
@param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative
|
|
251
299
|
position of each corresponding color in the colors array. If this is
|
|
252
300
|
NULL, then the colors are distributed evenly within the angular range.
|
|
253
|
-
If this is not null, the values must
|
|
254
|
-
|
|
301
|
+
If this is not null, the values must lie between 0.0 and 1.0, and be
|
|
302
|
+
strictly increasing. If the first value is not 0.0, then an additional
|
|
303
|
+
color stop is added at position 0.0, with the same color as colors[0].
|
|
304
|
+
If the the last value is not 1.0, then an additional color stop is added
|
|
305
|
+
at position 1.0, with the same color as colors[count - 1].
|
|
255
306
|
@param count Must be >= 2. The number of colors (and pos if not NULL) entries
|
|
256
307
|
@param mode Tiling mode: controls drawing outside of the gradient angular range.
|
|
257
308
|
@param startAngle Start of the angular range, corresponding to pos == 0.
|
|
@@ -310,17 +310,6 @@ public:
|
|
|
310
310
|
static sk_sp<SkImageFilter> Offset(SkScalar dx, SkScalar dy, sk_sp<SkImageFilter> input,
|
|
311
311
|
const CropRect& cropRect = {});
|
|
312
312
|
|
|
313
|
-
/**
|
|
314
|
-
* Create a filter that fills the output with the given paint.
|
|
315
|
-
* @param paint The paint to fill
|
|
316
|
-
* @param cropRect Optional rectangle that will be filled. If null, the source bitmap's bounds
|
|
317
|
-
* are filled even though the source bitmap itself is not used.
|
|
318
|
-
*
|
|
319
|
-
* DEPRECATED: Use Shader() instead, since many features of SkPaint are ignored when filling
|
|
320
|
-
* the target output, and paint color/alpha can be emulated with SkShaders::Color().
|
|
321
|
-
*/
|
|
322
|
-
static sk_sp<SkImageFilter> Paint(const SkPaint& paint, const CropRect& cropRect = {});
|
|
323
|
-
|
|
324
313
|
/**
|
|
325
314
|
* Create a filter that produces the SkPicture as its output, drawn into targetRect. Note that
|
|
326
315
|
* the targetRect is not the same as the SkIRect cropRect that many filters accept. Returns
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
#include "include/core/SkShader.h"
|
|
17
17
|
#include "include/core/SkSpan.h"
|
|
18
18
|
#include "include/core/SkString.h"
|
|
19
|
-
#include "include/
|
|
19
|
+
#include "include/core/SkTypes.h"
|
|
20
20
|
#include "include/private/SkSLSampleUsage.h"
|
|
21
|
+
#include "include/private/base/SkOnce.h"
|
|
22
|
+
#include "include/private/base/SkTemplates.h"
|
|
21
23
|
|
|
22
24
|
#include <string>
|
|
23
25
|
#include <optional>
|
|
@@ -34,6 +36,7 @@ class SkRuntimeImageFilter;
|
|
|
34
36
|
|
|
35
37
|
namespace SkSL {
|
|
36
38
|
class DebugTrace;
|
|
39
|
+
class DebugTracePriv;
|
|
37
40
|
class ErrorReporter;
|
|
38
41
|
class FunctionDefinition;
|
|
39
42
|
struct Program;
|
|
@@ -43,7 +46,11 @@ struct ProgramSettings;
|
|
|
43
46
|
|
|
44
47
|
namespace skvm {
|
|
45
48
|
class Program;
|
|
46
|
-
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
namespace SkSL::RP {
|
|
52
|
+
class Program;
|
|
53
|
+
}
|
|
47
54
|
|
|
48
55
|
/*
|
|
49
56
|
* SkRuntimeEffect supports creating custom SkShader and SkColorFilter objects using Skia's SkSL
|
|
@@ -126,9 +133,9 @@ public:
|
|
|
126
133
|
friend class SkRuntimeEffect;
|
|
127
134
|
friend class SkRuntimeEffectPriv;
|
|
128
135
|
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
bool
|
|
136
|
+
// This flag allows Runtime Effects to access Skia implementation details like sk_FragCoord
|
|
137
|
+
// and functions with private identifiers (e.g. $rgb_to_hsl).
|
|
138
|
+
bool allowPrivateAccess = false;
|
|
132
139
|
|
|
133
140
|
// TODO(skia:11209) - Replace this with a promised SkCapabilities?
|
|
134
141
|
// This flag lifts the ES2 restrictions on Runtime Effects that are gated by the
|
|
@@ -276,6 +283,7 @@ private:
|
|
|
276
283
|
kSamplesOutsideMain_Flag = 0x10,
|
|
277
284
|
kUsesColorTransform_Flag = 0x20,
|
|
278
285
|
kAlwaysOpaque_Flag = 0x40,
|
|
286
|
+
kAlphaUnchanged_Flag = 0x80,
|
|
279
287
|
};
|
|
280
288
|
|
|
281
289
|
SkRuntimeEffect(std::unique_ptr<SkSL::Program> baseProgram,
|
|
@@ -301,15 +309,17 @@ private:
|
|
|
301
309
|
bool samplesOutsideMain() const { return (fFlags & kSamplesOutsideMain_Flag); }
|
|
302
310
|
bool usesColorTransform() const { return (fFlags & kUsesColorTransform_Flag); }
|
|
303
311
|
bool alwaysOpaque() const { return (fFlags & kAlwaysOpaque_Flag); }
|
|
312
|
+
bool isAlphaUnchanged() const { return (fFlags & kAlphaUnchanged_Flag); }
|
|
304
313
|
|
|
305
314
|
const SkFilterColorProgram* getFilterColorProgram() const;
|
|
315
|
+
const SkSL::RP::Program* getRPProgram(SkSL::DebugTracePriv* debugTrace) const;
|
|
306
316
|
|
|
307
|
-
#if
|
|
317
|
+
#if defined(SK_GANESH)
|
|
308
318
|
friend class GrSkSLFP; // fBaseProgram, fSampleUsages
|
|
309
319
|
friend class GrGLSLSkSLFP; //
|
|
310
320
|
#endif
|
|
311
321
|
|
|
312
|
-
friend class SkRTShader; // fBaseProgram, fMain
|
|
322
|
+
friend class SkRTShader; // fBaseProgram, fMain, fSampleUsages, getRPProgram()
|
|
313
323
|
friend class SkRuntimeBlender; //
|
|
314
324
|
friend class SkRuntimeColorFilter; //
|
|
315
325
|
|
|
@@ -319,6 +329,8 @@ private:
|
|
|
319
329
|
uint32_t fHash;
|
|
320
330
|
|
|
321
331
|
std::unique_ptr<SkSL::Program> fBaseProgram;
|
|
332
|
+
std::unique_ptr<SkSL::RP::Program> fRPProgram;
|
|
333
|
+
mutable SkOnce fCompileRPProgramOnce;
|
|
322
334
|
const SkSL::FunctionDefinition& fMain;
|
|
323
335
|
std::vector<Uniform> fUniforms;
|
|
324
336
|
std::vector<Child> fChildren;
|
|
@@ -415,6 +427,11 @@ public:
|
|
|
415
427
|
BuilderUniform uniform(std::string_view name) { return { this, fEffect->findUniform(name) }; }
|
|
416
428
|
BuilderChild child(std::string_view name) { return { this, fEffect->findChild(name) }; }
|
|
417
429
|
|
|
430
|
+
// Get access to the collated uniforms and children (in the order expected by APIs like
|
|
431
|
+
// makeShader on the effect):
|
|
432
|
+
sk_sp<const SkData> uniforms() { return fUniforms; }
|
|
433
|
+
SkSpan<SkRuntimeEffect::ChildPtr> children() { return fChildren; }
|
|
434
|
+
|
|
418
435
|
protected:
|
|
419
436
|
SkRuntimeEffectBuilder() = delete;
|
|
420
437
|
explicit SkRuntimeEffectBuilder(sk_sp<SkRuntimeEffect> effect)
|
|
@@ -432,10 +449,6 @@ protected:
|
|
|
432
449
|
SkRuntimeEffectBuilder& operator=(SkRuntimeEffectBuilder&&) = delete;
|
|
433
450
|
SkRuntimeEffectBuilder& operator=(const SkRuntimeEffectBuilder&) = delete;
|
|
434
451
|
|
|
435
|
-
sk_sp<const SkData> uniforms() { return fUniforms; }
|
|
436
|
-
SkRuntimeEffect::ChildPtr* children() { return fChildren.data(); }
|
|
437
|
-
size_t numChildren() { return fChildren.size(); }
|
|
438
|
-
|
|
439
452
|
private:
|
|
440
453
|
void* writableUniformData() {
|
|
441
454
|
if (!fUniforms->unique()) {
|
|
@@ -492,6 +505,23 @@ private:
|
|
|
492
505
|
friend class SkRuntimeImageFilter;
|
|
493
506
|
};
|
|
494
507
|
|
|
508
|
+
/**
|
|
509
|
+
* SkRuntimeColorFilterBuilder makes it easy to setup and assign uniforms to runtime color filters.
|
|
510
|
+
*/
|
|
511
|
+
class SK_API SkRuntimeColorFilterBuilder : public SkRuntimeEffectBuilder {
|
|
512
|
+
public:
|
|
513
|
+
explicit SkRuntimeColorFilterBuilder(sk_sp<SkRuntimeEffect>);
|
|
514
|
+
~SkRuntimeColorFilterBuilder();
|
|
515
|
+
|
|
516
|
+
SkRuntimeColorFilterBuilder(const SkRuntimeColorFilterBuilder&) = delete;
|
|
517
|
+
SkRuntimeColorFilterBuilder& operator=(const SkRuntimeColorFilterBuilder&) = delete;
|
|
518
|
+
|
|
519
|
+
sk_sp<SkColorFilter> makeColorFilter();
|
|
520
|
+
|
|
521
|
+
private:
|
|
522
|
+
using INHERITED = SkRuntimeEffectBuilder;
|
|
523
|
+
};
|
|
524
|
+
|
|
495
525
|
/**
|
|
496
526
|
* SkRuntimeBlendBuilder is a utility to simplify creation and uniform setup of runtime blenders.
|
|
497
527
|
*/
|
|
@@ -9,8 +9,12 @@
|
|
|
9
9
|
#define SkEncoder_DEFINED
|
|
10
10
|
|
|
11
11
|
#include "include/core/SkPixmap.h"
|
|
12
|
-
#include "include/private/
|
|
13
|
-
#include "include/private/
|
|
12
|
+
#include "include/private/base/SkAPI.h"
|
|
13
|
+
#include "include/private/base/SkNoncopyable.h"
|
|
14
|
+
#include "include/private/base/SkTemplates.h"
|
|
15
|
+
|
|
16
|
+
#include <cstddef>
|
|
17
|
+
#include <cstdint>
|
|
14
18
|
|
|
15
19
|
class SK_API SkEncoder : SkNoncopyable {
|
|
16
20
|
public:
|
|
@@ -53,7 +57,7 @@ protected:
|
|
|
53
57
|
|
|
54
58
|
const SkPixmap& fSrc;
|
|
55
59
|
int fCurrRow;
|
|
56
|
-
|
|
60
|
+
skia_private::AutoTMalloc<uint8_t> fStorage;
|
|
57
61
|
};
|
|
58
62
|
|
|
59
63
|
#endif
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Google Inc.
|
|
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 SkICC_DEFINED
|
|
9
|
+
#define SkICC_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/private/base/SkAPI.h"
|
|
13
|
+
|
|
14
|
+
#include <cstdint>
|
|
15
|
+
|
|
16
|
+
class SkData;
|
|
17
|
+
struct skcms_ICCProfile;
|
|
18
|
+
struct skcms_Matrix3x3;
|
|
19
|
+
struct skcms_TransferFunction;
|
|
20
|
+
|
|
21
|
+
SK_API sk_sp<SkData> SkWriteICCProfile(const skcms_TransferFunction&,
|
|
22
|
+
const skcms_Matrix3x3& toXYZD50);
|
|
23
|
+
|
|
24
|
+
SK_API sk_sp<SkData> SkWriteICCProfile(const skcms_ICCProfile*, const char* description);
|
|
25
|
+
|
|
26
|
+
// Utility function for populating the grid_16 member of skcms_A2B and skcms_B2A
|
|
27
|
+
// structures. This converts a point in XYZD50 to its representation in grid_16_lab.
|
|
28
|
+
// It will write 6 bytes. The behavior of this function matches how skcms will decode
|
|
29
|
+
// values, but might not match the specification, see https://crbug.com/skia/13807.
|
|
30
|
+
SK_API void SkICCFloatXYZD50ToGrid16Lab(const float* float_xyz, uint8_t* grid16_lab);
|
|
31
|
+
|
|
32
|
+
// Utility function for popluating the table_16 member of skcms_Curve structure.
|
|
33
|
+
// This converts a float to its representation in table_16. It will write 2 bytes.
|
|
34
|
+
SK_API void SkICCFloatToTable16(const float f, uint8_t* table_16);
|
|
35
|
+
|
|
36
|
+
#endif//SkICC_DEFINED
|
|
@@ -8,90 +8,121 @@
|
|
|
8
8
|
#ifndef SkJpegEncoder_DEFINED
|
|
9
9
|
#define SkJpegEncoder_DEFINED
|
|
10
10
|
|
|
11
|
-
#include "include/
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/private/base/SkAPI.h"
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
#include <memory>
|
|
15
|
+
|
|
16
|
+
class SkColorSpace;
|
|
17
|
+
class SkData;
|
|
18
|
+
class SkEncoder;
|
|
19
|
+
class SkPixmap;
|
|
14
20
|
class SkWStream;
|
|
21
|
+
class SkImage;
|
|
22
|
+
class GrDirectContext;
|
|
23
|
+
class SkYUVAPixmaps;
|
|
24
|
+
struct skcms_ICCProfile;
|
|
25
|
+
|
|
26
|
+
namespace SkJpegEncoder {
|
|
15
27
|
|
|
16
|
-
class
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
kIgnore,
|
|
21
|
-
kBlendOnBlack,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
enum class Downsample {
|
|
25
|
-
/**
|
|
26
|
-
* Reduction by a factor of two in both the horizontal and vertical directions.
|
|
27
|
-
*/
|
|
28
|
-
k420,
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Reduction by a factor of two in the horizontal direction.
|
|
32
|
-
*/
|
|
33
|
-
k422,
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* No downsampling.
|
|
37
|
-
*/
|
|
38
|
-
k444,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
struct Options {
|
|
42
|
-
/**
|
|
43
|
-
* |fQuality| must be in [0, 100] where 0 corresponds to the lowest quality.
|
|
44
|
-
*/
|
|
45
|
-
int fQuality = 100;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Choose the downsampling factor for the U and V components. This is only
|
|
49
|
-
* meaningful if the |src| is not kGray, since kGray will not be encoded as YUV.
|
|
50
|
-
*
|
|
51
|
-
* Our default value matches the libjpeg-turbo default.
|
|
52
|
-
*/
|
|
53
|
-
Downsample fDownsample = Downsample::k420;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Jpegs must be opaque. This instructs the encoder on how to handle input
|
|
57
|
-
* images with alpha.
|
|
58
|
-
*
|
|
59
|
-
* The default is to ignore the alpha channel and treat the image as opaque.
|
|
60
|
-
* Another option is to blend the pixels onto a black background before encoding.
|
|
61
|
-
* In the second case, the encoder supports linear or legacy blending.
|
|
62
|
-
*/
|
|
63
|
-
AlphaOption fAlphaOption = AlphaOption::kIgnore;
|
|
64
|
-
};
|
|
28
|
+
enum class AlphaOption {
|
|
29
|
+
kIgnore,
|
|
30
|
+
kBlendOnBlack,
|
|
31
|
+
};
|
|
65
32
|
|
|
33
|
+
enum class Downsample {
|
|
66
34
|
/**
|
|
67
|
-
*
|
|
68
|
-
* |options| may be used to control the encoding behavior.
|
|
69
|
-
*
|
|
70
|
-
* Returns true on success. Returns false on an invalid or unsupported |src|.
|
|
35
|
+
* Reduction by a factor of two in both the horizontal and vertical directions.
|
|
71
36
|
*/
|
|
72
|
-
|
|
37
|
+
k420,
|
|
73
38
|
|
|
74
39
|
/**
|
|
75
|
-
*
|
|
76
|
-
* |options| may be used to control the encoding behavior.
|
|
77
|
-
*
|
|
78
|
-
* |dst| is unowned but must remain valid for the lifetime of the object.
|
|
79
|
-
*
|
|
80
|
-
* This returns nullptr on an invalid or unsupported |src|.
|
|
40
|
+
* Reduction by a factor of two in the horizontal direction.
|
|
81
41
|
*/
|
|
82
|
-
|
|
83
|
-
const Options& options);
|
|
42
|
+
k422,
|
|
84
43
|
|
|
85
|
-
|
|
44
|
+
/**
|
|
45
|
+
* No downsampling.
|
|
46
|
+
*/
|
|
47
|
+
k444,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
struct Options {
|
|
51
|
+
/**
|
|
52
|
+
* |fQuality| must be in [0, 100] where 0 corresponds to the lowest quality.
|
|
53
|
+
*/
|
|
54
|
+
int fQuality = 100;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Choose the downsampling factor for the U and V components. This is only
|
|
58
|
+
* meaningful if the |src| is not kGray, since kGray will not be encoded as YUV.
|
|
59
|
+
* This is ignored in favor of |src|'s subsampling when |src| is an SkYUVAPixmaps.
|
|
60
|
+
*
|
|
61
|
+
* Our default value matches the libjpeg-turbo default.
|
|
62
|
+
*/
|
|
63
|
+
Downsample fDownsample = Downsample::k420;
|
|
86
64
|
|
|
87
|
-
|
|
88
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Jpegs must be opaque. This instructs the encoder on how to handle input
|
|
67
|
+
* images with alpha.
|
|
68
|
+
*
|
|
69
|
+
* The default is to ignore the alpha channel and treat the image as opaque.
|
|
70
|
+
* Another option is to blend the pixels onto a black background before encoding.
|
|
71
|
+
* In the second case, the encoder supports linear or legacy blending.
|
|
72
|
+
*/
|
|
73
|
+
AlphaOption fAlphaOption = AlphaOption::kIgnore;
|
|
89
74
|
|
|
90
|
-
|
|
91
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Optional XMP metadata.
|
|
77
|
+
*/
|
|
78
|
+
const SkData* xmpMetadata = nullptr;
|
|
92
79
|
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
/**
|
|
81
|
+
* An optional ICC profile to override the default behavior.
|
|
82
|
+
*
|
|
83
|
+
* The default behavior is to generate an ICC profile using a primary matrix and
|
|
84
|
+
* analytic transfer function. If the color space of |src| cannot be represented
|
|
85
|
+
* in this way (e.g, it is HLG or PQ), then no profile will be embedded.
|
|
86
|
+
*/
|
|
87
|
+
const skcms_ICCProfile* fICCProfile = nullptr;
|
|
88
|
+
const char* fICCProfileDescription = nullptr;
|
|
95
89
|
};
|
|
96
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Encode the |src| pixels to the |dst| stream.
|
|
93
|
+
* |options| may be used to control the encoding behavior.
|
|
94
|
+
*
|
|
95
|
+
* Returns true on success. Returns false on an invalid or unsupported |src|.
|
|
96
|
+
*/
|
|
97
|
+
SK_API bool Encode(SkWStream* dst, const SkPixmap& src, const Options& options);
|
|
98
|
+
SK_API bool Encode(SkWStream* dst,
|
|
99
|
+
const SkYUVAPixmaps& src,
|
|
100
|
+
const SkColorSpace* srcColorSpace,
|
|
101
|
+
const Options& options);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Encode the provided image and return the resulting bytes. If the image was created as
|
|
105
|
+
* a texture-backed image on a GPU context, that |ctx| must be provided so the pixels
|
|
106
|
+
* can be read before being encoded. For raster-backed images, |ctx| can be nullptr.
|
|
107
|
+
* |options| may be used to control the encoding behavior.
|
|
108
|
+
*
|
|
109
|
+
* Returns nullptr if the pixels could not be read or encoding otherwise fails.
|
|
110
|
+
*/
|
|
111
|
+
SK_API sk_sp<SkData> Encode(GrDirectContext* ctx, const SkImage* img, const Options& options);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Create a jpeg encoder that will encode the |src| pixels to the |dst| stream.
|
|
115
|
+
* |options| may be used to control the encoding behavior.
|
|
116
|
+
*
|
|
117
|
+
* |dst| is unowned but must remain valid for the lifetime of the object.
|
|
118
|
+
*
|
|
119
|
+
* This returns nullptr on an invalid or unsupported |src|.
|
|
120
|
+
*/
|
|
121
|
+
SK_API std::unique_ptr<SkEncoder> Make(SkWStream* dst, const SkPixmap& src, const Options& options);
|
|
122
|
+
SK_API std::unique_ptr<SkEncoder> Make(SkWStream* dst,
|
|
123
|
+
const SkYUVAPixmaps& src,
|
|
124
|
+
const SkColorSpace* srcColorSpace,
|
|
125
|
+
const Options& options);
|
|
126
|
+
} // namespace SkJpegEncoder
|
|
127
|
+
|
|
97
128
|
#endif
|