@shopify/react-native-skia 0.1.191 → 0.1.193

Sign up to get free protection for your applications and to get access to all the features.
Files changed (615) hide show
  1. package/android/CMakeLists.txt +1 -1
  2. package/android/build.gradle +1 -0
  3. package/android/cpp/jni/JniPlatformContext.cpp +1 -1
  4. package/cpp/api/JsiSkColorFilter.h +2 -17
  5. package/cpp/api/JsiSkContourMeasure.h +3 -17
  6. package/cpp/api/JsiSkContourMeasureIter.h +3 -18
  7. package/cpp/api/JsiSkData.h +1 -18
  8. package/cpp/api/JsiSkFont.h +4 -14
  9. package/cpp/api/JsiSkHostObjects.h +85 -10
  10. package/cpp/api/JsiSkImage.h +26 -16
  11. package/cpp/api/JsiSkImageFactory.h +2 -2
  12. package/cpp/api/JsiSkImageFilter.h +1 -17
  13. package/cpp/api/JsiSkMaskFilter.h +1 -17
  14. package/cpp/api/JsiSkMatrix.h +3 -6
  15. package/cpp/api/JsiSkPaint.h +3 -15
  16. package/cpp/api/JsiSkPath.h +10 -21
  17. package/cpp/api/JsiSkPathEffect.h +2 -17
  18. package/cpp/api/JsiSkPicture.h +4 -18
  19. package/cpp/api/JsiSkPictureRecorder.h +4 -1
  20. package/cpp/api/JsiSkPoint.h +6 -1
  21. package/cpp/api/JsiSkRRect.h +6 -1
  22. package/cpp/api/JsiSkRSXform.h +4 -6
  23. package/cpp/api/JsiSkRect.h +6 -2
  24. package/cpp/api/JsiSkRuntimeEffect.h +4 -7
  25. package/cpp/api/JsiSkRuntimeShaderBuilder.h +2 -10
  26. package/cpp/api/JsiSkSVG.h +1 -10
  27. package/cpp/api/JsiSkShader.h +2 -16
  28. package/cpp/api/JsiSkSurface.h +3 -16
  29. package/cpp/api/JsiSkTextBlob.h +2 -18
  30. package/cpp/api/JsiSkTypeface.h +1 -22
  31. package/cpp/api/JsiSkVertices.h +3 -17
  32. package/cpp/rnskia/dom/base/Declaration.h +5 -7
  33. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +1 -0
  34. package/cpp/rnskia/dom/nodes/JsiPathNode.h +2 -2
  35. package/cpp/rnskia/dom/props/BoxShadowProps.h +2 -0
  36. package/cpp/rnskia/values/RNSkReadonlyValue.h +2 -2
  37. package/cpp/rnskia/values/RNSkValue.h +1 -1
  38. package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +2 -8
  39. package/cpp/skia/include/android/SkImageAndroid.h +101 -0
  40. package/cpp/skia/include/codec/SkAndroidCodec.h +26 -8
  41. package/cpp/skia/include/codec/SkCodec.h +31 -17
  42. package/cpp/skia/include/codec/SkEncodedImageFormat.h +36 -0
  43. package/cpp/skia/include/codec/SkPixmapUtils.h +31 -0
  44. package/cpp/skia/include/config/SkUserConfig.h +61 -29
  45. package/cpp/skia/include/core/SkBitmap.h +25 -25
  46. package/cpp/skia/include/core/SkBlurTypes.h +0 -2
  47. package/cpp/skia/include/core/SkCanvas.h +32 -15
  48. package/cpp/skia/include/core/SkCapabilities.h +2 -2
  49. package/cpp/skia/include/core/SkColor.h +2 -0
  50. package/cpp/skia/include/core/SkColorPriv.h +19 -4
  51. package/cpp/skia/include/core/SkColorSpace.h +14 -17
  52. package/cpp/skia/include/core/SkColorType.h +1 -0
  53. package/cpp/skia/include/core/SkContourMeasure.h +1 -1
  54. package/cpp/skia/include/core/SkCoverageMode.h +0 -2
  55. package/cpp/skia/include/core/SkCubicMap.h +2 -0
  56. package/cpp/skia/include/core/SkData.h +5 -2
  57. package/cpp/skia/include/core/SkDataTable.h +6 -2
  58. package/cpp/skia/include/core/SkDeferredDisplayList.h +11 -10
  59. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +9 -8
  60. package/cpp/skia/include/core/SkDrawable.h +10 -2
  61. package/cpp/skia/include/core/SkEncodedImageFormat.h +3 -30
  62. package/cpp/skia/include/core/SkFlattenable.h +4 -2
  63. package/cpp/skia/include/core/SkFont.h +1 -0
  64. package/cpp/skia/include/core/SkFontMetrics.h +1 -0
  65. package/cpp/skia/include/core/SkFontMgr.h +20 -29
  66. package/cpp/skia/include/core/SkFontStyle.h +4 -1
  67. package/cpp/skia/include/core/SkGraphics.h +21 -18
  68. package/cpp/skia/include/core/SkICC.h +3 -13
  69. package/cpp/skia/include/core/SkImage.h +395 -717
  70. package/cpp/skia/include/core/SkImageGenerator.h +19 -74
  71. package/cpp/skia/include/core/SkImageInfo.h +7 -5
  72. package/cpp/skia/include/core/SkM44.h +11 -0
  73. package/cpp/skia/include/core/SkMaskFilter.h +6 -3
  74. package/cpp/skia/include/core/SkMatrix.h +14 -4
  75. package/cpp/skia/include/core/SkMesh.h +52 -18
  76. package/cpp/skia/include/core/SkMilestone.h +1 -1
  77. package/cpp/skia/include/core/SkPaint.h +11 -34
  78. package/cpp/skia/include/core/SkPath.h +23 -4
  79. package/cpp/skia/include/core/SkPathBuilder.h +13 -5
  80. package/cpp/skia/include/core/SkPathMeasure.h +1 -1
  81. package/cpp/skia/include/core/SkPathTypes.h +0 -2
  82. package/cpp/skia/include/core/SkPathUtils.h +42 -0
  83. package/cpp/skia/include/core/SkPicture.h +3 -2
  84. package/cpp/skia/include/core/SkPictureRecorder.h +2 -0
  85. package/cpp/skia/include/core/SkPixelRef.h +4 -8
  86. package/cpp/skia/include/core/SkPixmap.h +12 -20
  87. package/cpp/skia/include/core/SkPoint.h +4 -2
  88. package/cpp/skia/include/core/SkPromiseImageTexture.h +2 -2
  89. package/cpp/skia/include/core/SkRRect.h +5 -1
  90. package/cpp/skia/include/core/SkRect.h +6 -3
  91. package/cpp/skia/include/core/SkRefCnt.h +9 -14
  92. package/cpp/skia/include/core/SkRegion.h +1 -1
  93. package/cpp/skia/include/core/SkScalar.h +2 -4
  94. package/cpp/skia/include/core/SkSerialProcs.h +18 -10
  95. package/cpp/skia/include/core/SkShader.h +1 -64
  96. package/cpp/skia/include/core/SkSize.h +2 -0
  97. package/cpp/skia/include/core/SkSpan.h +4 -112
  98. package/cpp/skia/include/core/SkStream.h +11 -12
  99. package/cpp/skia/include/core/SkString.h +9 -25
  100. package/cpp/skia/include/core/SkStrokeRec.h +1 -1
  101. package/cpp/skia/include/core/SkSurface.h +83 -61
  102. package/cpp/skia/include/core/SkSurfaceCharacterization.h +3 -3
  103. package/cpp/skia/include/core/SkSurfaceProps.h +9 -1
  104. package/cpp/skia/include/core/SkTextBlob.h +2 -2
  105. package/cpp/skia/include/core/SkTextureCompressionType.h +30 -0
  106. package/cpp/skia/include/core/SkTime.h +1 -1
  107. package/cpp/skia/include/core/SkTypeface.h +9 -2
  108. package/cpp/skia/include/core/SkTypes.h +37 -466
  109. package/cpp/skia/include/core/SkVertices.h +2 -0
  110. package/cpp/skia/include/core/SkYUVAInfo.h +4 -0
  111. package/cpp/skia/include/core/SkYUVAPixmaps.h +7 -1
  112. package/cpp/skia/include/docs/SkPDFDocument.h +12 -1
  113. package/cpp/skia/include/effects/SkColorMatrix.h +2 -1
  114. package/cpp/skia/include/effects/SkGradientShader.h +65 -14
  115. package/cpp/skia/include/effects/SkImageFilters.h +0 -11
  116. package/cpp/skia/include/effects/SkRuntimeEffect.h +41 -11
  117. package/cpp/skia/include/encode/SkEncoder.h +7 -3
  118. package/cpp/skia/include/encode/SkICC.h +36 -0
  119. package/cpp/skia/include/encode/SkJpegEncoder.h +102 -71
  120. package/cpp/skia/include/encode/SkPngEncoder.h +89 -71
  121. package/cpp/skia/include/encode/SkWebpEncoder.h +65 -38
  122. package/cpp/skia/include/gpu/GpuTypes.h +23 -1
  123. package/cpp/skia/include/gpu/GrBackendSurface.h +9 -7
  124. package/cpp/skia/include/gpu/GrContextOptions.h +28 -9
  125. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +6 -4
  126. package/cpp/skia/include/gpu/GrDirectContext.h +84 -63
  127. package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +2 -1
  128. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -5
  129. package/cpp/skia/include/gpu/GrTypes.h +18 -18
  130. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +4 -4
  131. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +3 -3
  132. package/cpp/skia/include/gpu/ganesh/GrTextureGenerator.h +77 -0
  133. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +385 -0
  134. package/cpp/skia/include/gpu/gl/GrGLExtensions.h +3 -3
  135. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
  136. package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -3
  137. package/cpp/skia/include/gpu/gl/GrGLTypes.h +2 -1
  138. package/cpp/skia/include/gpu/graphite/BackendTexture.h +72 -3
  139. package/cpp/skia/include/gpu/graphite/Context.h +85 -32
  140. package/cpp/skia/include/gpu/graphite/ContextOptions.h +15 -11
  141. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +55 -5
  142. package/cpp/skia/include/gpu/graphite/ImageProvider.h +6 -4
  143. package/cpp/skia/include/gpu/graphite/Recorder.h +41 -11
  144. package/cpp/skia/include/gpu/graphite/Recording.h +50 -3
  145. package/cpp/skia/include/gpu/graphite/TextureInfo.h +47 -8
  146. package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +139 -0
  147. package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +40 -0
  148. package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +28 -0
  149. package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +1 -1
  150. package/cpp/skia/include/gpu/graphite/mtl/{MtlTypes.h → MtlGraphiteTypes.h} +7 -6
  151. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +27 -0
  152. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +4 -9
  153. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +28 -0
  154. package/cpp/skia/include/gpu/mock/GrMockTypes.h +17 -13
  155. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  156. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
  157. package/cpp/skia/include/gpu/vk/GrVkTypes.h +3 -3
  158. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +3 -3
  159. package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +5 -7
  160. package/cpp/skia/include/pathops/SkPathOps.h +3 -3
  161. package/cpp/skia/include/ports/SkFontMgr_data.h +22 -0
  162. package/cpp/skia/include/ports/SkFontMgr_indirect.h +14 -14
  163. package/cpp/skia/include/ports/SkRemotableFontMgr.h +2 -2
  164. package/cpp/skia/include/ports/SkTypeface_win.h +2 -1
  165. package/cpp/skia/include/private/SkChecksum.h +32 -7
  166. package/cpp/skia/include/private/SkColorData.h +1 -26
  167. package/cpp/skia/include/private/SkGainmapInfo.h +97 -0
  168. package/cpp/skia/include/private/SkGainmapShader.h +53 -0
  169. package/cpp/skia/include/private/SkIDChangeListener.h +4 -3
  170. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +71 -0
  171. package/cpp/skia/include/private/SkJpegMetadataDecoder.h +61 -0
  172. package/cpp/skia/include/private/SkOpts_spi.h +3 -1
  173. package/cpp/skia/include/private/SkPathRef.h +64 -47
  174. package/cpp/skia/include/private/SkSLDefines.h +5 -5
  175. package/cpp/skia/include/private/SkSLSampleUsage.h +0 -4
  176. package/cpp/skia/include/private/SkSpinlock.h +1 -1
  177. package/cpp/skia/include/private/SkWeakRefCnt.h +3 -0
  178. package/cpp/skia/include/private/{SingleOwner.h → base/SingleOwner.h} +8 -5
  179. package/cpp/skia/include/private/base/SkAPI.h +52 -0
  180. package/cpp/skia/include/private/base/SkAlign.h +39 -0
  181. package/cpp/skia/include/private/base/SkAlignedStorage.h +32 -0
  182. package/cpp/skia/include/private/base/SkAssert.h +92 -0
  183. package/cpp/skia/include/private/base/SkAttributes.h +102 -0
  184. package/cpp/skia/include/private/base/SkCPUTypes.h +25 -0
  185. package/cpp/skia/include/private/base/SkContainers.h +46 -0
  186. package/cpp/skia/include/private/base/SkDebug.h +27 -0
  187. package/cpp/skia/include/private/{SkDeque.h → base/SkDeque.h} +3 -1
  188. package/cpp/skia/include/private/base/SkFeatures.h +151 -0
  189. package/cpp/skia/include/private/{SkFixed.h → base/SkFixed.h} +9 -7
  190. package/cpp/skia/include/private/{SkFloatBits.h → base/SkFloatBits.h} +2 -3
  191. package/cpp/skia/include/private/{SkFloatingPoint.h → base/SkFloatingPoint.h} +18 -9
  192. package/cpp/skia/include/private/base/SkLoadUserConfig.h +63 -0
  193. package/cpp/skia/include/private/{SkMacros.h → base/SkMacros.h} +17 -2
  194. package/cpp/skia/include/private/{SkMalloc.h → base/SkMalloc.h} +4 -7
  195. package/cpp/skia/include/{core → private/base}/SkMath.h +25 -2
  196. package/cpp/skia/include/private/{SkMutex.h → base/SkMutex.h} +5 -5
  197. package/cpp/skia/include/private/{SkNoncopyable.h → base/SkNoncopyable.h} +2 -2
  198. package/cpp/skia/include/private/{SkOnce.h → base/SkOnce.h} +3 -1
  199. package/cpp/skia/include/private/base/SkPathEnums.h +25 -0
  200. package/cpp/skia/include/private/{SkSafe32.h → base/SkSafe32.h} +16 -1
  201. package/cpp/skia/include/private/{SkSemaphore.h → base/SkSemaphore.h} +4 -3
  202. package/cpp/skia/include/private/base/SkSpan_impl.h +129 -0
  203. package/cpp/skia/include/private/base/SkTArray.h +694 -0
  204. package/cpp/skia/include/private/{SkTDArray.h → base/SkTDArray.h} +17 -54
  205. package/cpp/skia/include/private/{SkTFitsIn.h → base/SkTFitsIn.h} +14 -8
  206. package/cpp/skia/include/private/{SkTLogic.h → base/SkTLogic.h} +1 -1
  207. package/cpp/skia/include/private/{SkTemplates.h → base/SkTemplates.h} +63 -88
  208. package/cpp/skia/include/private/{SkThreadID.h → base/SkThreadID.h} +5 -2
  209. package/cpp/skia/include/private/{SkTo.h → base/SkTo.h} +13 -2
  210. package/cpp/skia/include/private/base/SkTypeTraits.h +33 -0
  211. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +130 -0
  212. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +5 -9
  213. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
  214. package/cpp/skia/include/private/chromium/Slug.h +0 -9
  215. package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +2 -1
  216. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  217. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +1 -1
  218. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +1 -1
  219. package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
  220. package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +3 -2
  221. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +1 -1
  222. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +17 -23
  223. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -2
  224. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +38 -0
  225. package/cpp/skia/include/private/gpu/graphite/{MtlTypesPriv.h → MtlGraphiteTypesPriv.h} +5 -5
  226. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +1 -9
  227. package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +4 -0
  228. package/cpp/skia/include/utils/SkCamera.h +1 -1
  229. package/cpp/skia/include/utils/SkCustomTypeface.h +7 -1
  230. package/cpp/skia/include/utils/SkNWayCanvas.h +6 -6
  231. package/cpp/skia/include/utils/SkOrderedFontMgr.h +7 -6
  232. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +2 -2
  233. package/cpp/skia/include/utils/SkParsePath.h +1 -1
  234. package/cpp/skia/modules/skcms/skcms.h +14 -0
  235. package/cpp/skia/modules/skcms/src/Transform_inl.h +19 -0
  236. package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -2
  237. package/cpp/skia/modules/skparagraph/include/Paragraph.h +72 -2
  238. package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -11
  239. package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
  240. package/cpp/skia/modules/skparagraph/include/TextStyle.h +27 -4
  241. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +13 -13
  242. package/cpp/skia/modules/skresources/include/SkResources.h +18 -4
  243. package/cpp/skia/modules/svg/include/SkSVGAttribute.h +1 -1
  244. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +2 -2
  245. package/cpp/skia/modules/svg/include/SkSVGContainer.h +2 -2
  246. package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
  247. package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +2 -2
  248. package/cpp/skia/modules/svg/include/SkSVGGradient.h +2 -2
  249. package/cpp/skia/modules/svg/include/SkSVGIDMapper.h +2 -2
  250. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
  251. package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
  252. package/cpp/skia/modules/svg/include/SkSVGTypes.h +22 -21
  253. package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
  254. package/cpp/skia/{include/private → src/core}/SkTHash.h +41 -37
  255. package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
  256. package/lib/commonjs/renderer/Canvas.js +17 -1
  257. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  258. package/lib/commonjs/skia/core/Data.d.ts +2 -2
  259. package/lib/commonjs/skia/core/Data.js.map +1 -1
  260. package/lib/commonjs/skia/types/Data/Data.d.ts +2 -2
  261. package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
  262. package/lib/commonjs/skia/types/Image/Image.d.ts +2 -2
  263. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  264. package/lib/commonjs/skia/types/JsiInstance.d.ts +4 -4
  265. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  266. package/lib/commonjs/skia/types/SVG/SVG.d.ts +2 -2
  267. package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
  268. package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +2 -2
  269. package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
  270. package/lib/commonjs/skia/web/Host.d.ts +1 -0
  271. package/lib/commonjs/skia/web/Host.js +2 -0
  272. package/lib/commonjs/skia/web/Host.js.map +1 -1
  273. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -0
  274. package/lib/commonjs/skia/web/JsiSkCanvas.js +6 -0
  275. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  276. package/lib/commonjs/skia/web/JsiSkColorFilter.d.ts +1 -0
  277. package/lib/commonjs/skia/web/JsiSkColorFilter.js +6 -0
  278. package/lib/commonjs/skia/web/JsiSkColorFilter.js.map +1 -1
  279. package/lib/commonjs/skia/web/JsiSkContourMeasure.d.ts +1 -0
  280. package/lib/commonjs/skia/web/JsiSkContourMeasure.js +6 -0
  281. package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
  282. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  283. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js +6 -0
  284. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  285. package/lib/commonjs/skia/web/JsiSkData.d.ts +1 -1
  286. package/lib/commonjs/skia/web/JsiSkData.js +4 -2
  287. package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
  288. package/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -0
  289. package/lib/commonjs/skia/web/JsiSkFont.js +6 -0
  290. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  291. package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -1
  292. package/lib/commonjs/skia/web/JsiSkImage.js +6 -4
  293. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  294. package/lib/commonjs/skia/web/JsiSkImageFilter.d.ts +1 -0
  295. package/lib/commonjs/skia/web/JsiSkImageFilter.js +6 -0
  296. package/lib/commonjs/skia/web/JsiSkImageFilter.js.map +1 -1
  297. package/lib/commonjs/skia/web/JsiSkMaskFilter.d.ts +1 -0
  298. package/lib/commonjs/skia/web/JsiSkMaskFilter.js +6 -0
  299. package/lib/commonjs/skia/web/JsiSkMaskFilter.js.map +1 -1
  300. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +1 -0
  301. package/lib/commonjs/skia/web/JsiSkMatrix.js +5 -0
  302. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  303. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  304. package/lib/commonjs/skia/web/JsiSkPaint.js +6 -0
  305. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  306. package/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -0
  307. package/lib/commonjs/skia/web/JsiSkPath.js +6 -0
  308. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  309. package/lib/commonjs/skia/web/JsiSkPathEffect.d.ts +1 -0
  310. package/lib/commonjs/skia/web/JsiSkPathEffect.js +6 -0
  311. package/lib/commonjs/skia/web/JsiSkPathEffect.js.map +1 -1
  312. package/lib/commonjs/skia/web/JsiSkPicture.d.ts +1 -0
  313. package/lib/commonjs/skia/web/JsiSkPicture.js +6 -1
  314. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  315. package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  316. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +6 -0
  317. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  318. package/lib/commonjs/skia/web/JsiSkPoint.d.ts +1 -0
  319. package/lib/commonjs/skia/web/JsiSkPoint.js +5 -0
  320. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
  321. package/lib/commonjs/skia/web/JsiSkRRect.d.ts +1 -0
  322. package/lib/commonjs/skia/web/JsiSkRRect.js +5 -0
  323. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  324. package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +1 -0
  325. package/lib/commonjs/skia/web/JsiSkRSXform.js +5 -0
  326. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
  327. package/lib/commonjs/skia/web/JsiSkRect.d.ts +1 -0
  328. package/lib/commonjs/skia/web/JsiSkRect.js +5 -0
  329. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
  330. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  331. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +6 -0
  332. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  333. package/lib/commonjs/skia/web/JsiSkShader.d.ts +1 -0
  334. package/lib/commonjs/skia/web/JsiSkShader.js +6 -0
  335. package/lib/commonjs/skia/web/JsiSkShader.js.map +1 -1
  336. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
  337. package/lib/commonjs/skia/web/JsiSkSurface.js +6 -0
  338. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  339. package/lib/commonjs/skia/web/JsiSkTextBlob.d.ts +1 -0
  340. package/lib/commonjs/skia/web/JsiSkTextBlob.js +6 -0
  341. package/lib/commonjs/skia/web/JsiSkTextBlob.js.map +1 -1
  342. package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -1
  343. package/lib/commonjs/skia/web/JsiSkTypeface.js +6 -4
  344. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
  345. package/lib/commonjs/skia/web/JsiSkVertices.d.ts +1 -0
  346. package/lib/commonjs/skia/web/JsiSkVertices.js +6 -0
  347. package/lib/commonjs/skia/web/JsiSkVertices.js.map +1 -1
  348. package/lib/commonjs/values/hooks/useComputedValue.js +1 -1
  349. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  350. package/lib/commonjs/values/types.d.ts +1 -1
  351. package/lib/commonjs/values/types.js.map +1 -1
  352. package/lib/commonjs/values/web/RNSkComputedValue.d.ts +1 -1
  353. package/lib/commonjs/values/web/RNSkComputedValue.js +1 -1
  354. package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
  355. package/lib/commonjs/values/web/RNSkReadonlyValue.d.ts +1 -1
  356. package/lib/commonjs/values/web/RNSkReadonlyValue.js +1 -1
  357. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
  358. package/lib/commonjs/views/SkiaDomView.web.js +14 -4
  359. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  360. package/lib/commonjs/views/types.d.ts +2 -1
  361. package/lib/commonjs/views/types.js.map +1 -1
  362. package/lib/module/renderer/Canvas.js +15 -1
  363. package/lib/module/renderer/Canvas.js.map +1 -1
  364. package/lib/module/skia/core/Data.d.ts +2 -2
  365. package/lib/module/skia/core/Data.js.map +1 -1
  366. package/lib/module/skia/types/Data/Data.d.ts +2 -2
  367. package/lib/module/skia/types/Data/Data.js.map +1 -1
  368. package/lib/module/skia/types/Image/Image.d.ts +2 -2
  369. package/lib/module/skia/types/Image/Image.js.map +1 -1
  370. package/lib/module/skia/types/JsiInstance.d.ts +4 -4
  371. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  372. package/lib/module/skia/types/SVG/SVG.d.ts +2 -2
  373. package/lib/module/skia/types/SVG/SVG.js.map +1 -1
  374. package/lib/module/skia/types/Typeface/Typeface.d.ts +2 -2
  375. package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
  376. package/lib/module/skia/web/Host.d.ts +1 -0
  377. package/lib/module/skia/web/Host.js +2 -0
  378. package/lib/module/skia/web/Host.js.map +1 -1
  379. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -0
  380. package/lib/module/skia/web/JsiSkCanvas.js +6 -0
  381. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  382. package/lib/module/skia/web/JsiSkColorFilter.d.ts +1 -0
  383. package/lib/module/skia/web/JsiSkColorFilter.js +6 -0
  384. package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
  385. package/lib/module/skia/web/JsiSkContourMeasure.d.ts +1 -0
  386. package/lib/module/skia/web/JsiSkContourMeasure.js +6 -0
  387. package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
  388. package/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  389. package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -0
  390. package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  391. package/lib/module/skia/web/JsiSkData.d.ts +1 -1
  392. package/lib/module/skia/web/JsiSkData.js +4 -2
  393. package/lib/module/skia/web/JsiSkData.js.map +1 -1
  394. package/lib/module/skia/web/JsiSkFont.d.ts +1 -0
  395. package/lib/module/skia/web/JsiSkFont.js +6 -0
  396. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  397. package/lib/module/skia/web/JsiSkImage.d.ts +1 -1
  398. package/lib/module/skia/web/JsiSkImage.js +6 -4
  399. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  400. package/lib/module/skia/web/JsiSkImageFilter.d.ts +1 -0
  401. package/lib/module/skia/web/JsiSkImageFilter.js +6 -0
  402. package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
  403. package/lib/module/skia/web/JsiSkMaskFilter.d.ts +1 -0
  404. package/lib/module/skia/web/JsiSkMaskFilter.js +6 -0
  405. package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
  406. package/lib/module/skia/web/JsiSkMatrix.d.ts +1 -0
  407. package/lib/module/skia/web/JsiSkMatrix.js +5 -0
  408. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  409. package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  410. package/lib/module/skia/web/JsiSkPaint.js +6 -0
  411. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  412. package/lib/module/skia/web/JsiSkPath.d.ts +1 -0
  413. package/lib/module/skia/web/JsiSkPath.js +6 -0
  414. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  415. package/lib/module/skia/web/JsiSkPathEffect.d.ts +1 -0
  416. package/lib/module/skia/web/JsiSkPathEffect.js +6 -0
  417. package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
  418. package/lib/module/skia/web/JsiSkPicture.d.ts +1 -0
  419. package/lib/module/skia/web/JsiSkPicture.js +6 -0
  420. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  421. package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  422. package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -0
  423. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  424. package/lib/module/skia/web/JsiSkPoint.d.ts +1 -0
  425. package/lib/module/skia/web/JsiSkPoint.js +5 -0
  426. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  427. package/lib/module/skia/web/JsiSkRRect.d.ts +1 -0
  428. package/lib/module/skia/web/JsiSkRRect.js +5 -0
  429. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  430. package/lib/module/skia/web/JsiSkRSXform.d.ts +1 -0
  431. package/lib/module/skia/web/JsiSkRSXform.js +5 -0
  432. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  433. package/lib/module/skia/web/JsiSkRect.d.ts +1 -0
  434. package/lib/module/skia/web/JsiSkRect.js +5 -0
  435. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  436. package/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  437. package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -0
  438. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  439. package/lib/module/skia/web/JsiSkShader.d.ts +1 -0
  440. package/lib/module/skia/web/JsiSkShader.js +6 -0
  441. package/lib/module/skia/web/JsiSkShader.js.map +1 -1
  442. package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
  443. package/lib/module/skia/web/JsiSkSurface.js +6 -0
  444. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  445. package/lib/module/skia/web/JsiSkTextBlob.d.ts +1 -0
  446. package/lib/module/skia/web/JsiSkTextBlob.js +6 -0
  447. package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
  448. package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -1
  449. package/lib/module/skia/web/JsiSkTypeface.js +6 -4
  450. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  451. package/lib/module/skia/web/JsiSkVertices.d.ts +1 -0
  452. package/lib/module/skia/web/JsiSkVertices.js +6 -0
  453. package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
  454. package/lib/module/values/hooks/useComputedValue.js +1 -1
  455. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  456. package/lib/module/values/types.d.ts +1 -1
  457. package/lib/module/values/types.js.map +1 -1
  458. package/lib/module/values/web/RNSkComputedValue.d.ts +1 -1
  459. package/lib/module/values/web/RNSkComputedValue.js +1 -1
  460. package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
  461. package/lib/module/values/web/RNSkReadonlyValue.d.ts +1 -1
  462. package/lib/module/values/web/RNSkReadonlyValue.js +1 -1
  463. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
  464. package/lib/module/views/SkiaDomView.web.js +13 -4
  465. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  466. package/lib/module/views/types.d.ts +2 -1
  467. package/lib/module/views/types.js.map +1 -1
  468. package/lib/typescript/src/skia/core/Data.d.ts +2 -2
  469. package/lib/typescript/src/skia/types/Data/Data.d.ts +2 -2
  470. package/lib/typescript/src/skia/types/Image/Image.d.ts +2 -2
  471. package/lib/typescript/src/skia/types/JsiInstance.d.ts +4 -4
  472. package/lib/typescript/src/skia/types/SVG/SVG.d.ts +2 -2
  473. package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +2 -2
  474. package/lib/typescript/src/skia/web/Host.d.ts +1 -0
  475. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -0
  476. package/lib/typescript/src/skia/web/JsiSkColorFilter.d.ts +1 -0
  477. package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +1 -0
  478. package/lib/typescript/src/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  479. package/lib/typescript/src/skia/web/JsiSkData.d.ts +1 -1
  480. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -0
  481. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -1
  482. package/lib/typescript/src/skia/web/JsiSkImageFilter.d.ts +1 -0
  483. package/lib/typescript/src/skia/web/JsiSkMaskFilter.d.ts +1 -0
  484. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +1 -0
  485. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  486. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +1 -0
  487. package/lib/typescript/src/skia/web/JsiSkPathEffect.d.ts +1 -0
  488. package/lib/typescript/src/skia/web/JsiSkPicture.d.ts +1 -0
  489. package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  490. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +1 -0
  491. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +1 -0
  492. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -0
  493. package/lib/typescript/src/skia/web/JsiSkRect.d.ts +1 -0
  494. package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  495. package/lib/typescript/src/skia/web/JsiSkShader.d.ts +1 -0
  496. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
  497. package/lib/typescript/src/skia/web/JsiSkTextBlob.d.ts +1 -0
  498. package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -1
  499. package/lib/typescript/src/skia/web/JsiSkVertices.d.ts +1 -0
  500. package/lib/typescript/src/values/types.d.ts +1 -1
  501. package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -1
  502. package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -1
  503. package/lib/typescript/src/views/types.d.ts +2 -1
  504. package/libs/android/arm64-v8a/libskia.a +0 -0
  505. package/libs/android/arm64-v8a/libskottie.a +0 -0
  506. package/libs/android/arm64-v8a/libsksg.a +0 -0
  507. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  508. package/libs/android/arm64-v8a/libsvg.a +0 -0
  509. package/libs/android/armeabi-v7a/libskia.a +0 -0
  510. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  511. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  512. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  513. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  514. package/libs/android/x86/libskia.a +0 -0
  515. package/libs/android/x86/libskottie.a +0 -0
  516. package/libs/android/x86/libsksg.a +0 -0
  517. package/libs/android/x86/libskshaper.a +0 -0
  518. package/libs/android/x86/libsvg.a +0 -0
  519. package/libs/android/x86_64/libskia.a +0 -0
  520. package/libs/android/x86_64/libskottie.a +0 -0
  521. package/libs/android/x86_64/libsksg.a +0 -0
  522. package/libs/android/x86_64/libskshaper.a +0 -0
  523. package/libs/android/x86_64/libsvg.a +0 -0
  524. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  525. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  526. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  527. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  528. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  529. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  530. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  531. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  532. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  533. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  534. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  535. package/package.json +1 -1
  536. package/react-native-skia.podspec +1 -1
  537. package/scripts/install-npm.js +11 -1
  538. package/src/renderer/Canvas.tsx +21 -1
  539. package/src/skia/core/Data.ts +3 -3
  540. package/src/skia/types/Data/Data.ts +2 -2
  541. package/src/skia/types/Image/Image.ts +2 -2
  542. package/src/skia/types/JsiInstance.ts +4 -4
  543. package/src/skia/types/SVG/SVG.ts +2 -2
  544. package/src/skia/types/Typeface/Typeface.ts +2 -2
  545. package/src/skia/web/Host.ts +2 -0
  546. package/src/skia/web/JsiSkCanvas.ts +4 -0
  547. package/src/skia/web/JsiSkColorFilter.ts +4 -0
  548. package/src/skia/web/JsiSkContourMeasure.ts +4 -0
  549. package/src/skia/web/JsiSkContourMeasureIter.ts +4 -0
  550. package/src/skia/web/JsiSkData.ts +3 -3
  551. package/src/skia/web/JsiSkFont.ts +4 -0
  552. package/src/skia/web/JsiSkImage.ts +2 -2
  553. package/src/skia/web/JsiSkImageFilter.ts +4 -0
  554. package/src/skia/web/JsiSkMaskFilter.ts +4 -0
  555. package/src/skia/web/JsiSkMatrix.ts +4 -0
  556. package/src/skia/web/JsiSkPaint.ts +4 -0
  557. package/src/skia/web/JsiSkPath.ts +4 -0
  558. package/src/skia/web/JsiSkPathEffect.ts +4 -0
  559. package/src/skia/web/JsiSkPicture.ts +4 -0
  560. package/src/skia/web/JsiSkPictureRecorder.ts +4 -0
  561. package/src/skia/web/JsiSkPoint.ts +4 -0
  562. package/src/skia/web/JsiSkRRect.ts +4 -0
  563. package/src/skia/web/JsiSkRSXform.ts +4 -0
  564. package/src/skia/web/JsiSkRect.ts +4 -0
  565. package/src/skia/web/JsiSkRuntimeEffect.ts +4 -0
  566. package/src/skia/web/JsiSkShader.ts +4 -0
  567. package/src/skia/web/JsiSkSurface.ts +4 -0
  568. package/src/skia/web/JsiSkTextBlob.ts +4 -0
  569. package/src/skia/web/JsiSkTypeface.ts +2 -2
  570. package/src/skia/web/JsiSkVertices.ts +4 -0
  571. package/src/values/hooks/useComputedValue.ts +1 -1
  572. package/src/values/types.ts +1 -1
  573. package/src/values/web/RNSkComputedValue.ts +1 -1
  574. package/src/values/web/RNSkReadonlyValue.ts +1 -1
  575. package/src/views/SkiaDomView.web.tsx +6 -1
  576. package/src/views/types.ts +2 -1
  577. package/cpp/skia/include/core/SkImageEncoder.h +0 -71
  578. package/cpp/skia/include/gpu/GrConfig.h +0 -53
  579. package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +0 -195
  580. package/cpp/skia/include/private/SkHalf.h +0 -38
  581. package/cpp/skia/include/private/SkImageInfoPriv.h +0 -199
  582. package/cpp/skia/include/private/SkSLIRNode.h +0 -64
  583. package/cpp/skia/include/private/SkSLLayout.h +0 -144
  584. package/cpp/skia/include/private/SkSLModifiers.h +0 -178
  585. package/cpp/skia/include/private/SkSLProgramElement.h +0 -77
  586. package/cpp/skia/include/private/SkSLProgramKind.h +0 -35
  587. package/cpp/skia/include/private/SkSLStatement.h +0 -86
  588. package/cpp/skia/include/private/SkSLString.h +0 -41
  589. package/cpp/skia/include/private/SkSLSymbol.h +0 -94
  590. package/cpp/skia/include/private/SkSafe_math.h +0 -52
  591. package/cpp/skia/include/private/SkStringView.h +0 -51
  592. package/cpp/skia/include/private/SkTArray.h +0 -655
  593. package/cpp/skia/include/private/SkUniquePaintParamsID.h +0 -35
  594. package/cpp/skia/include/private/SkVx.h +0 -1026
  595. package/cpp/skia/include/sksl/DSL.h +0 -37
  596. package/cpp/skia/include/sksl/DSLBlock.h +0 -58
  597. package/cpp/skia/include/sksl/DSLCase.h +0 -62
  598. package/cpp/skia/include/sksl/DSLCore.h +0 -492
  599. package/cpp/skia/include/sksl/DSLExpression.h +0 -241
  600. package/cpp/skia/include/sksl/DSLFunction.h +0 -113
  601. package/cpp/skia/include/sksl/DSLLayout.h +0 -92
  602. package/cpp/skia/include/sksl/DSLModifiers.h +0 -69
  603. package/cpp/skia/include/sksl/DSLStatement.h +0 -82
  604. package/cpp/skia/include/sksl/DSLSymbols.h +0 -61
  605. package/cpp/skia/include/sksl/DSLType.h +0 -271
  606. package/cpp/skia/include/sksl/DSLVar.h +0 -231
  607. package/cpp/skia/include/sksl/SkSLErrorReporter.h +0 -65
  608. package/cpp/skia/include/sksl/SkSLOperator.h +0 -154
  609. package/cpp/skia/include/sksl/SkSLPosition.h +0 -104
  610. package/cpp/skia/include/utils/SkRandom.h +0 -169
  611. package/cpp/skia/src/core/SkLRUCache.h +0 -126
  612. package/cpp/skia/src/core/SkTInternalLList.h +0 -302
  613. /package/cpp/skia/include/{core → codec}/SkPngChunkReader.h +0 -0
  614. /package/cpp/skia/include/private/{SkTPin.h → base/SkTPin.h} +0 -0
  615. /package/cpp/skia/include/private/{SkThreadAnnotations.h → base/SkThreadAnnotations.h} +0 -0
@@ -8,581 +8,252 @@
8
8
  #ifndef SkImage_DEFINED
9
9
  #define SkImage_DEFINED
10
10
 
11
+ #include "include/core/SkAlphaType.h"
11
12
  #include "include/core/SkImageInfo.h"
13
+ #include "include/core/SkRect.h"
12
14
  #include "include/core/SkRefCnt.h"
13
- #include "include/core/SkSamplingOptions.h"
14
- #include "include/core/SkScalar.h"
15
- #include "include/core/SkShader.h"
16
- #include "include/core/SkSurfaceProps.h"
17
- #include "include/core/SkTileMode.h"
18
- #if SK_SUPPORT_GPU
19
- #include "include/gpu/GrTypes.h"
20
- #endif
21
- #if defined(SK_GRAPHITE_ENABLED)
15
+ #include "include/core/SkSize.h"
16
+ #include "include/private/base/SkAPI.h"
17
+
18
+ #if defined(SK_GRAPHITE)
22
19
  #include "include/gpu/graphite/GraphiteTypes.h"
20
+ class SkYUVAPixmaps;
23
21
  #endif
24
- #include <functional> // std::function
25
- #include <optional>
26
22
 
27
- #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
28
- #include <android/hardware_buffer.h>
29
- #endif
23
+ #include <cstddef>
24
+ #include <cstdint>
25
+ #include <memory>
26
+ #include <optional>
30
27
 
31
- class GrBackendFormat;
32
- class GrBackendTexture;
33
- class GrContextThreadSafeProxy;
34
28
  class GrDirectContext;
35
29
  class GrRecordingContext;
36
- class GrYUVABackendTextureInfo;
37
- class GrYUVABackendTextures;
38
- class SkCanvas;
30
+ class SkBitmap;
31
+ class SkColorSpace;
39
32
  class SkData;
40
33
  class SkImage;
41
34
  class SkImageFilter;
42
35
  class SkImageGenerator;
36
+ class SkMatrix;
43
37
  class SkMipmap;
44
38
  class SkPaint;
45
39
  class SkPicture;
46
40
  class SkPixmap;
47
- class SkPromiseImageTexture;
48
- class SkSurface;
49
- class SkYUVAPixmaps;
41
+ class SkShader;
42
+ class SkSurfaceProps;
43
+ enum SkColorType : int;
44
+ enum class SkTextureCompressionType;
45
+ enum class SkTileMode;
50
46
 
51
- enum class SkEncodedImageFormat;
47
+ struct SkIPoint;
48
+ struct SkSamplingOptions;
52
49
 
53
- #if defined(SK_GRAPHITE_ENABLED)
50
+ #if defined(SK_GRAPHITE)
54
51
  namespace skgpu::graphite {
55
52
  class BackendTexture;
56
53
  class Recorder;
57
- };
54
+ class TextureInfo;
55
+ enum class Volatile : bool;
56
+ class YUVABackendTextures;
57
+ }
58
58
  #endif
59
59
 
60
- /** \class SkImage
61
- SkImage describes a two dimensional array of pixels to draw. The pixels may be
62
- decoded in a raster bitmap, encoded in a SkPicture or compressed data stream,
63
- or located in GPU memory as a GPU texture.
64
-
65
- SkImage cannot be modified after it is created. SkImage may allocate additional
66
- storage as needed; for instance, an encoded SkImage may decode when drawn.
60
+ namespace SkImages {
67
61
 
68
- SkImage width and height are greater than zero. Creating an SkImage with zero width
69
- or height returns SkImage equal to nullptr.
70
-
71
- SkImage may be created from SkBitmap, SkPixmap, SkSurface, SkPicture, encoded streams,
72
- GPU texture, YUV_ColorSpace data, or hardware buffer. Encoded streams supported
73
- include BMP, GIF, HEIF, ICO, JPEG, PNG, WBMP, WebP. Supported encoding details
74
- vary with platform.
62
+ /** Caller data passed to RasterReleaseProc; may be nullptr. */
63
+ using ReleaseContext = void*;
64
+ /** Function called when SkImage no longer shares pixels. ReleaseContext is
65
+ provided by caller when SkImage is created, and may be nullptr.
75
66
  */
76
- class SK_API SkImage : public SkRefCnt {
77
- public:
78
-
79
- /** Caller data passed to RasterReleaseProc; may be nullptr.
80
- */
81
- typedef void* ReleaseContext;
82
-
83
- /** Creates SkImage from SkPixmap and copy of pixels. Since pixels are copied, SkPixmap
84
- pixels may be modified or deleted without affecting SkImage.
85
-
86
- SkImage is returned if SkPixmap is valid. Valid SkPixmap parameters include:
87
- dimensions are greater than zero;
88
- each dimension fits in 29 bits;
89
- SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType;
90
- row bytes are large enough to hold one row of pixels;
91
- pixel address is not nullptr.
92
-
93
- @param pixmap SkImageInfo, pixel address, and row bytes
94
- @return copy of SkPixmap pixels, or nullptr
67
+ using RasterReleaseProc = void(const void* pixels, ReleaseContext);
95
68
 
96
- example: https://fiddle.skia.org/c/@Image_MakeRasterCopy
97
- */
98
- static sk_sp<SkImage> MakeRasterCopy(const SkPixmap& pixmap);
99
-
100
- /** Creates SkImage from SkImageInfo, sharing pixels.
69
+ /** Creates a CPU-backed SkImage from bitmap, sharing or copying bitmap pixels. If the bitmap
70
+ is marked immutable, and its pixel memory is shareable, it may be shared
71
+ instead of copied.
101
72
 
102
- SkImage is returned if SkImageInfo is valid. Valid SkImageInfo parameters include:
103
- dimensions are greater than zero;
104
- each dimension fits in 29 bits;
105
- SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType;
106
- rowBytes are large enough to hold one row of pixels;
107
- pixels is not nullptr, and contains enough data for SkImage.
108
-
109
- @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace
110
- @param pixels address or pixel storage
111
- @param rowBytes size of pixel row or larger
112
- @return SkImage sharing pixels, or nullptr
113
- */
114
- static sk_sp<SkImage> MakeRasterData(const SkImageInfo& info, sk_sp<SkData> pixels,
115
- size_t rowBytes);
73
+ SkImage is returned if bitmap is valid. Valid SkBitmap parameters include:
74
+ dimensions are greater than zero;
75
+ each dimension fits in 29 bits;
76
+ SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType;
77
+ row bytes are large enough to hold one row of pixels;
78
+ pixel address is not nullptr.
116
79
 
117
- /** Function called when SkImage no longer shares pixels. ReleaseContext is
118
- provided by caller when SkImage is created, and may be nullptr.
119
- */
120
- typedef void (*RasterReleaseProc)(const void* pixels, ReleaseContext);
121
-
122
- /** Creates SkImage from pixmap, sharing SkPixmap pixels. Pixels must remain valid and
123
- unchanged until rasterReleaseProc is called. rasterReleaseProc is passed
124
- releaseContext when SkImage is deleted or no longer refers to pixmap pixels.
125
-
126
- Pass nullptr for rasterReleaseProc to share SkPixmap without requiring a callback
127
- when SkImage is released. Pass nullptr for releaseContext if rasterReleaseProc
128
- does not require state.
129
-
130
- SkImage is returned if pixmap is valid. Valid SkPixmap parameters include:
131
- dimensions are greater than zero;
132
- each dimension fits in 29 bits;
133
- SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType;
134
- row bytes are large enough to hold one row of pixels;
135
- pixel address is not nullptr.
136
-
137
- @param pixmap SkImageInfo, pixel address, and row bytes
138
- @param rasterReleaseProc function called when pixels can be released; or nullptr
139
- @param releaseContext state passed to rasterReleaseProc; or nullptr
140
- @return SkImage sharing pixmap
141
- */
142
- static sk_sp<SkImage> MakeFromRaster(const SkPixmap& pixmap,
143
- RasterReleaseProc rasterReleaseProc,
144
- ReleaseContext releaseContext);
145
-
146
- /** Creates SkImage from bitmap, sharing or copying bitmap pixels. If the bitmap
147
- is marked immutable, and its pixel memory is shareable, it may be shared
148
- instead of copied.
149
-
150
- SkImage is returned if bitmap is valid. Valid SkBitmap parameters include:
151
- dimensions are greater than zero;
152
- each dimension fits in 29 bits;
153
- SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType;
154
- row bytes are large enough to hold one row of pixels;
155
- pixel address is not nullptr.
156
-
157
- @param bitmap SkImageInfo, row bytes, and pixels
158
- @return created SkImage, or nullptr
159
-
160
- example: https://fiddle.skia.org/c/@Image_MakeFromBitmap
161
- */
162
- static sk_sp<SkImage> MakeFromBitmap(const SkBitmap& bitmap);
163
-
164
- /** Creates SkImage from data returned by imageGenerator. Generated data is owned by SkImage and
165
- may not be shared or accessed.
166
-
167
- SkImage is returned if generator data is valid. Valid data parameters vary by type of data
168
- and platform.
169
-
170
- imageGenerator may wrap SkPicture data, codec data, or custom data.
171
-
172
- @param imageGenerator stock or custom routines to retrieve SkImage
173
- @return created SkImage, or nullptr
174
- */
175
- static sk_sp<SkImage> MakeFromGenerator(std::unique_ptr<SkImageGenerator> imageGenerator);
176
-
177
- /**
178
- * Return an image backed by the encoded data, but attempt to defer decoding until the image
179
- * is actually used/drawn. This deferral allows the system to cache the result, either on the
180
- * CPU or on the GPU, depending on where the image is drawn. If memory is low, the cache may
181
- * be purged, causing the next draw of the image to have to re-decode.
182
- *
183
- * If alphaType is nullopt, the image's alpha type will be chosen automatically based on the
184
- * image format. Transparent images will default to kPremul_SkAlphaType. If alphaType contains
185
- * kPremul_SkAlphaType or kUnpremul_SkAlphaType, that alpha type will be used. Forcing opaque
186
- * (passing kOpaque_SkAlphaType) is not allowed, and will return nullptr.
187
- *
188
- * This is similar to DecodeTo[Raster,Texture], but this method will attempt to defer the
189
- * actual decode, while the DecodeTo... method explicitly decode and allocate the backend
190
- * when the call is made.
191
- *
192
- * If the encoded format is not supported, nullptr is returned.
193
- *
194
- * @param encoded the encoded data
195
- * @return created SkImage, or nullptr
196
-
197
- example: https://fiddle.skia.org/c/@Image_MakeFromEncoded
198
- */
199
- static sk_sp<SkImage> MakeFromEncoded(sk_sp<SkData> encoded,
200
- std::optional<SkAlphaType> alphaType = std::nullopt);
201
-
202
- /*
203
- * Experimental:
204
- * Skia | GL_COMPRESSED_* | MTLPixelFormat* | VK_FORMAT_*_BLOCK
205
- * --------------------------------------------------------------------------------------
206
- * kETC2_RGB8_UNORM | ETC1_RGB8 | ETC2_RGB8 (iOS-only) | ETC2_R8G8B8_UNORM
207
- * | RGB8_ETC2 | |
208
- * --------------------------------------------------------------------------------------
209
- * kBC1_RGB8_UNORM | RGB_S3TC_DXT1_EXT | N/A | BC1_RGB_UNORM
210
- * --------------------------------------------------------------------------------------
211
- * kBC1_RGBA8_UNORM | RGBA_S3TC_DXT1_EXT | BC1_RGBA (macOS-only)| BC1_RGBA_UNORM
212
- */
213
- enum class CompressionType {
214
- kNone,
215
- kETC2_RGB8_UNORM, // the same as ETC1
216
-
217
- kBC1_RGB8_UNORM,
218
- kBC1_RGBA8_UNORM,
219
- kLast = kBC1_RGBA8_UNORM,
220
- };
80
+ @param bitmap SkImageInfo, row bytes, and pixels
81
+ @return created SkImage, or nullptr
82
+ */
83
+ SK_API sk_sp<SkImage> RasterFromBitmap(const SkBitmap& bitmap);
221
84
 
222
- static constexpr int kCompressionTypeCount = static_cast<int>(CompressionType::kLast) + 1;
85
+ /** Creates a CPU-backed SkImage from compressed data.
223
86
 
224
- static const CompressionType kETC1_CompressionType = CompressionType::kETC2_RGB8_UNORM;
87
+ This method will decompress the compressed data and create an image wrapping
88
+ it. Any mipmap levels present in the compressed data are discarded.
225
89
 
226
- /** Creates a CPU-backed SkImage from compressed data.
90
+ @param data compressed data to store in SkImage
91
+ @param width width of full SkImage
92
+ @param height height of full SkImage
93
+ @param type type of compression used
94
+ @return created SkImage, or nullptr
95
+ */
96
+ SK_API sk_sp<SkImage> RasterFromCompressedTextureData(sk_sp<SkData> data,
97
+ int width,
98
+ int height,
99
+ SkTextureCompressionType type);
100
+
101
+ /**
102
+ * Return a SkImage using the encoded data, but attempts to defer decoding until the
103
+ * image is actually used/drawn. This deferral allows the system to cache the result, either on the
104
+ * CPU or on the GPU, depending on where the image is drawn. If memory is low, the cache may
105
+ * be purged, causing the next draw of the image to have to re-decode.
106
+ *
107
+ * If alphaType is nullopt, the image's alpha type will be chosen automatically based on the
108
+ * image format. Transparent images will default to kPremul_SkAlphaType. If alphaType contains
109
+ * kPremul_SkAlphaType or kUnpremul_SkAlphaType, that alpha type will be used. Forcing opaque
110
+ * (passing kOpaque_SkAlphaType) is not allowed, and will return nullptr.
111
+ *
112
+ * If the encoded format is not supported, nullptr is returned.
113
+ *
114
+ * @param encoded the encoded data
115
+ * @return created SkImage, or nullptr
227
116
 
228
- This method will decompress the compressed data and create an image wrapping
229
- it. Any mipmap levels present in the compressed data are discarded.
117
+ example: https://fiddle.skia.org/c/@Image_DeferredFromEncodedData
118
+ */
119
+ SK_API sk_sp<SkImage> DeferredFromEncodedData(sk_sp<SkData> encoded,
120
+ std::optional<SkAlphaType> alphaType = std::nullopt);
230
121
 
231
- @param data compressed data to store in SkImage
232
- @param width width of full SkImage
233
- @param height height of full SkImage
234
- @param type type of compression used
235
- @return created SkImage, or nullptr
236
- */
237
- static sk_sp<SkImage> MakeRasterFromCompressed(sk_sp<SkData> data,
238
- int width, int height,
239
- CompressionType type);
122
+ /** Creates SkImage from data returned by imageGenerator. The image data will not be created
123
+ (on either the CPU or GPU) until the image is actually drawn.
124
+ Generated data is owned by SkImage and may not be shared or accessed.
240
125
 
241
- enum class BitDepth {
242
- kU8, //!< uses 8-bit unsigned int per color component
243
- kF16, //!< uses 16-bit float per color component
244
- };
126
+ SkImage is returned if generator data is valid. Valid data parameters vary by type of data
127
+ and platform.
245
128
 
246
- /** Creates SkImage from picture. Returned SkImage width and height are set by dimensions.
247
- SkImage draws picture with matrix and paint, set to bitDepth and colorSpace.
129
+ imageGenerator may wrap SkPicture data, codec data, or custom data.
248
130
 
249
- If matrix is nullptr, draws with identity SkMatrix. If paint is nullptr, draws
250
- with default SkPaint. colorSpace may be nullptr.
131
+ @param imageGenerator stock or custom routines to retrieve SkImage
132
+ @return created SkImage, or nullptr
133
+ */
134
+ SK_API sk_sp<SkImage> DeferredFromGenerator(std::unique_ptr<SkImageGenerator> imageGenerator);
251
135
 
252
- @param picture stream of drawing commands
253
- @param dimensions width and height
254
- @param matrix SkMatrix to rotate, scale, translate, and so on; may be nullptr
255
- @param paint SkPaint to apply transparency, filtering, and so on; may be nullptr
256
- @param bitDepth 8-bit integer or 16-bit float: per component
257
- @param colorSpace range of colors; may be nullptr
258
- @param props props to use when rasterizing the picture
259
- @return created SkImage, or nullptr
260
- */
261
- static sk_sp<SkImage> MakeFromPicture(sk_sp<SkPicture> picture, const SkISize& dimensions,
262
- const SkMatrix* matrix, const SkPaint* paint,
263
- BitDepth bitDepth, sk_sp<SkColorSpace> colorSpace,
264
- SkSurfaceProps props = {});
265
-
266
- #if SK_SUPPORT_GPU
267
- /** Creates a GPU-backed SkImage from compressed data.
268
-
269
- This method will return an SkImage representing the compressed data.
270
- If the GPU doesn't support the specified compression method, the data
271
- will be decompressed and then wrapped in a GPU-backed image.
272
-
273
- Note: one can query the supported compression formats via
274
- GrRecordingContext::compressedBackendFormat.
275
-
276
- @param context GPU context
277
- @param data compressed data to store in SkImage
278
- @param width width of full SkImage
279
- @param height height of full SkImage
280
- @param type type of compression used
281
- @param mipmapped does 'data' contain data for all the mipmap levels?
282
- @param isProtected do the contents of 'data' require DRM protection (on Vulkan)?
283
- @return created SkImage, or nullptr
284
- */
285
- static sk_sp<SkImage> MakeTextureFromCompressed(GrDirectContext* direct,
286
- sk_sp<SkData> data,
287
- int width, int height,
288
- CompressionType type,
289
- GrMipmapped mipmapped = GrMipmapped::kNo,
290
- GrProtected isProtected = GrProtected::kNo);
291
-
292
- /** User function called when supplied texture may be deleted.
293
- */
294
- typedef void (*TextureReleaseProc)(ReleaseContext releaseContext);
136
+ enum class BitDepth {
137
+ kU8, //!< uses 8-bit unsigned int per color component
138
+ kF16, //!< uses 16-bit float per color component
139
+ };
295
140
 
296
- /** Creates SkImage from GPU texture associated with context. GPU texture must stay
297
- valid and unchanged until textureReleaseProc is called. textureReleaseProc is
298
- passed releaseContext when SkImage is deleted or no longer refers to texture.
141
+ /** Creates SkImage from picture. Returned SkImage width and height are set by dimensions.
142
+ SkImage draws picture with matrix and paint, set to bitDepth and colorSpace.
299
143
 
300
- SkImage is returned if format of backendTexture is recognized and supported.
301
- Recognized formats vary by GPU back-end.
144
+ The Picture data is not turned into an image (CPU or GPU) until it is drawn.
302
145
 
303
- @note When using a DDL recording context, textureReleaseProc will be called on the
304
- GPU thread after the DDL is played back on the direct context.
146
+ If matrix is nullptr, draws with identity SkMatrix. If paint is nullptr, draws
147
+ with default SkPaint. colorSpace may be nullptr.
305
148
 
306
- @param context GPU context
307
- @param backendTexture texture residing on GPU
308
- @param colorSpace This describes the color space of this image's contents, as
309
- seen after sampling. In general, if the format of the backend
310
- texture is SRGB, some linear colorSpace should be supplied
311
- (e.g., SkColorSpace::MakeSRGBLinear()). If the format of the
312
- backend texture is linear, then the colorSpace should include
313
- a description of the transfer function as
314
- well (e.g., SkColorSpace::MakeSRGB()).
315
- @param textureReleaseProc function called when texture can be released
316
- @param releaseContext state passed to textureReleaseProc
317
- @return created SkImage, or nullptr
318
- */
319
- static sk_sp<SkImage> MakeFromTexture(GrRecordingContext* context,
320
- const GrBackendTexture& backendTexture,
321
- GrSurfaceOrigin origin,
322
- SkColorType colorType,
323
- SkAlphaType alphaType,
149
+ @param picture stream of drawing commands
150
+ @param dimensions width and height
151
+ @param matrix SkMatrix to rotate, scale, translate, and so on; may be nullptr
152
+ @param paint SkPaint to apply transparency, filtering, and so on; may be nullptr
153
+ @param bitDepth 8-bit integer or 16-bit float: per component
154
+ @param colorSpace range of colors; may be nullptr
155
+ @param props props to use when rasterizing the picture
156
+ @return created SkImage, or nullptr
157
+ */
158
+ SK_API sk_sp<SkImage> DeferredFromPicture(sk_sp<SkPicture> picture,
159
+ const SkISize& dimensions,
160
+ const SkMatrix* matrix,
161
+ const SkPaint* paint,
162
+ BitDepth bitDepth,
324
163
  sk_sp<SkColorSpace> colorSpace,
325
- TextureReleaseProc textureReleaseProc = nullptr,
326
- ReleaseContext releaseContext = nullptr);
327
-
328
- /** Creates an SkImage from a GPU backend texture. The backend texture must stay
329
- valid and unchanged until textureReleaseProc is called. The textureReleaseProc is
330
- called when the SkImage is deleted or no longer refers to the texture and will be
331
- passed the releaseContext.
332
-
333
- An SkImage is returned if the format of backendTexture is recognized and supported.
334
- Recognized formats vary by GPU back-end.
335
-
336
- @note When using a DDL recording context, textureReleaseProc will be called on the
337
- GPU thread after the DDL is played back on the direct context.
338
-
339
- @param context the GPU context
340
- @param backendTexture a texture already allocated by the GPU
341
- @param alphaType This characterizes the nature of the alpha values in the
342
- backend texture. For opaque compressed formats (e.g., ETC1)
343
- this should usually be set to kOpaque_SkAlphaType.
344
- @param colorSpace This describes the color space of this image's contents, as
345
- seen after sampling. In general, if the format of the backend
346
- texture is SRGB, some linear colorSpace should be supplied
347
- (e.g., SkColorSpace::MakeSRGBLinear()). If the format of the
348
- backend texture is linear, then the colorSpace should include
349
- a description of the transfer function as
350
- well (e.g., SkColorSpace::MakeSRGB()).
351
- @param textureReleaseProc function called when the backend texture can be released
352
- @param releaseContext state passed to textureReleaseProc
353
- @return created SkImage, or nullptr
354
- */
355
- static sk_sp<SkImage> MakeFromCompressedTexture(GrRecordingContext* context,
356
- const GrBackendTexture& backendTexture,
357
- GrSurfaceOrigin origin,
358
- SkAlphaType alphaType,
359
- sk_sp<SkColorSpace> colorSpace,
360
- TextureReleaseProc textureReleaseProc = nullptr,
361
- ReleaseContext releaseContext = nullptr);
362
-
363
- /** Creates SkImage from pixmap. SkImage is uploaded to GPU back-end using context.
364
-
365
- Created SkImage is available to other GPU contexts, and is available across thread
366
- boundaries. All contexts must be in the same GPU share group, or otherwise
367
- share resources.
368
-
369
- When SkImage is no longer referenced, context releases texture memory
370
- asynchronously.
371
-
372
- GrBackendTexture created from pixmap is uploaded to match SkSurface created with
373
- dstColorSpace. SkColorSpace of SkImage is determined by pixmap.colorSpace().
374
-
375
- SkImage is returned referring to GPU back-end if context is not nullptr,
376
- format of data is recognized and supported, and if context supports moving
377
- resources between contexts. Otherwise, pixmap pixel data is copied and SkImage
378
- as returned in raster format if possible; nullptr may be returned.
379
- Recognized GPU formats vary by platform and GPU back-end.
380
-
381
- @param context GPU context
382
- @param pixmap SkImageInfo, pixel address, and row bytes
383
- @param buildMips create SkImage as mip map if true
384
- @param dstColorSpace range of colors of matching SkSurface on GPU
385
- @param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary
386
- @return created SkImage, or nullptr
387
- */
388
- static sk_sp<SkImage> MakeCrossContextFromPixmap(GrDirectContext* context,
389
- const SkPixmap& pixmap,
390
- bool buildMips,
391
- bool limitToMaxTextureSize = false);
392
-
393
- /** Creates SkImage from backendTexture associated with context. backendTexture and
394
- returned SkImage are managed internally, and are released when no longer needed.
395
-
396
- SkImage is returned if format of backendTexture is recognized and supported.
397
- Recognized formats vary by GPU back-end.
398
-
399
- @param context GPU context
400
- @param backendTexture texture residing on GPU
401
- @param textureOrigin origin of backendTexture
402
- @param colorType color type of the resulting image
403
- @param alphaType alpha type of the resulting image
404
- @param colorSpace range of colors; may be nullptr
405
- @return created SkImage, or nullptr
406
- */
407
- static sk_sp<SkImage> MakeFromAdoptedTexture(GrRecordingContext* context,
408
- const GrBackendTexture& backendTexture,
409
- GrSurfaceOrigin textureOrigin,
410
- SkColorType colorType);
411
- static sk_sp<SkImage> MakeFromAdoptedTexture(GrRecordingContext* context,
412
- const GrBackendTexture& backendTexture,
413
- GrSurfaceOrigin textureOrigin,
414
- SkColorType colorType,
415
- SkAlphaType alphaType);
416
- static sk_sp<SkImage> MakeFromAdoptedTexture(GrRecordingContext* context,
417
- const GrBackendTexture& backendTexture,
418
- GrSurfaceOrigin textureOrigin,
419
- SkColorType colorType,
420
- SkAlphaType alphaType,
421
- sk_sp<SkColorSpace> colorSpace);
422
-
423
- /** Creates an SkImage from YUV[A] planar textures. This requires that the textures stay valid
424
- for the lifetime of the image. The ReleaseContext can be used to know when it is safe to
425
- either delete or overwrite the textures. If ReleaseProc is provided it is also called before
426
- return on failure.
427
-
428
- @param context GPU context
429
- @param yuvaTextures A set of textures containing YUVA data and a description of the
430
- data and transformation to RGBA.
431
- @param imageColorSpace range of colors of the resulting image after conversion to RGB;
432
- may be nullptr
433
- @param textureReleaseProc called when the backend textures can be released
434
- @param releaseContext state passed to textureReleaseProc
435
- @return created SkImage, or nullptr
436
- */
437
- static sk_sp<SkImage> MakeFromYUVATextures(GrRecordingContext* context,
438
- const GrYUVABackendTextures& yuvaTextures,
439
- sk_sp<SkColorSpace> imageColorSpace = nullptr,
440
- TextureReleaseProc textureReleaseProc = nullptr,
441
- ReleaseContext releaseContext = nullptr);
442
-
443
- /** Creates SkImage from SkYUVAPixmaps.
444
-
445
- The image will remain planar with each plane converted to a texture using the passed
446
- GrRecordingContext.
447
-
448
- SkYUVAPixmaps has a SkYUVAInfo which specifies the transformation from YUV to RGB.
449
- The SkColorSpace of the resulting RGB values is specified by imageColorSpace. This will
450
- be the SkColorSpace reported by the image and when drawn the RGB values will be converted
451
- from this space into the destination space (if the destination is tagged).
452
-
453
- Currently, this is only supported using the GPU backend and will fail if context is nullptr.
164
+ SkSurfaceProps props);
165
+ SK_API sk_sp<SkImage> DeferredFromPicture(sk_sp<SkPicture> picture,
166
+ const SkISize& dimensions,
167
+ const SkMatrix* matrix,
168
+ const SkPaint* paint,
169
+ BitDepth bitDepth,
170
+ sk_sp<SkColorSpace> colorSpace);
171
+
172
+ /** Creates a CPU-backed SkImage from pixmap, copying the pixel data.
173
+ As a result, pixmap pixels may be modified or deleted without affecting SkImage.
174
+
175
+ SkImage is returned if SkPixmap is valid. Valid SkPixmap parameters include:
176
+ dimensions are greater than zero;
177
+ each dimension fits in 29 bits;
178
+ SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType;
179
+ row bytes are large enough to hold one row of pixels;
180
+ pixel address is not nullptr.
181
+
182
+ @param pixmap SkImageInfo, pixel address, and row bytes
183
+ @return copy of SkPixmap pixels, or nullptr
184
+
185
+ example: https://fiddle.skia.org/c/@Image_RasterFromPixmapCopy
186
+ */
187
+ SK_API sk_sp<SkImage> RasterFromPixmapCopy(const SkPixmap& pixmap);
188
+
189
+ /** Creates CPU-backed SkImage from pixmap, sharing SkPixmap pixels. Pixels must remain valid and
190
+ unchanged until rasterReleaseProc is called. rasterReleaseProc is passed
191
+ releaseContext when SkImage is deleted or no longer refers to pixmap pixels.
192
+
193
+ Pass nullptr for rasterReleaseProc to share SkPixmap without requiring a callback
194
+ when SkImage is released. Pass nullptr for releaseContext if rasterReleaseProc
195
+ does not require state.
196
+
197
+ SkImage is returned if pixmap is valid. Valid SkPixmap parameters include:
198
+ dimensions are greater than zero;
199
+ each dimension fits in 29 bits;
200
+ SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType;
201
+ row bytes are large enough to hold one row of pixels;
202
+ pixel address is not nullptr.
203
+
204
+ @param pixmap SkImageInfo, pixel address, and row bytes
205
+ @param rasterReleaseProc function called when pixels can be released; or nullptr
206
+ @param releaseContext state passed to rasterReleaseProc; or nullptr
207
+ @return SkImage sharing pixmap
208
+ */
209
+ SK_API sk_sp<SkImage> RasterFromPixmap(const SkPixmap& pixmap,
210
+ RasterReleaseProc rasterReleaseProc,
211
+ ReleaseContext releaseContext);
212
+
213
+ /** Creates CPU-backed SkImage from pixel data described by info.
214
+ The pixels data will *not* be copied.
215
+
216
+ SkImage is returned if SkImageInfo is valid. Valid SkImageInfo parameters include:
217
+ dimensions are greater than zero;
218
+ each dimension fits in 29 bits;
219
+ SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType;
220
+ rowBytes are large enough to hold one row of pixels;
221
+ pixels is not nullptr, and contains enough data for SkImage.
222
+
223
+ @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace
224
+ @param pixels address or pixel storage
225
+ @param rowBytes size of pixel row or larger
226
+ @return SkImage sharing pixels, or nullptr
227
+ */
228
+ SK_API sk_sp<SkImage> RasterFromData(const SkImageInfo& info,
229
+ sk_sp<SkData> pixels,
230
+ size_t rowBytes);
454
231
 
455
- SkYUVAPixmaps does not need to remain valid after this returns.
232
+ } // namespace SkImages
456
233
 
457
- @param context GPU context
458
- @param pixmaps The planes as pixmaps with supported SkYUVAInfo that
459
- specifies conversion to RGB.
460
- @param buildMips create internal YUVA textures as mip map if kYes. This is
461
- silently ignored if the context does not support mip maps.
462
- @param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary
463
- @param imageColorSpace range of colors of the resulting image; may be nullptr
464
- @return created SkImage, or nullptr
465
- */
466
- static sk_sp<SkImage> MakeFromYUVAPixmaps(GrRecordingContext* context,
467
- const SkYUVAPixmaps& pixmaps,
468
- GrMipmapped buildMips = GrMipmapped::kNo,
469
- bool limitToMaxTextureSize = false,
470
- sk_sp<SkColorSpace> imageColorSpace = nullptr);
471
-
472
- using PromiseImageTextureContext = void*;
473
- using PromiseImageTextureFulfillProc =
474
- sk_sp<SkPromiseImageTexture> (*)(PromiseImageTextureContext);
475
- using PromiseImageTextureReleaseProc = void (*)(PromiseImageTextureContext);
476
-
477
- /** Create a new SkImage that is very similar to an SkImage created by MakeFromTexture. The
478
- difference is that the caller need not have created the texture nor populated it with the
479
- image pixel data. Moreover, the SkImage may be created on a thread as the creation of the
480
- image does not require access to the backend API or GrDirectContext. Instead of passing a
481
- GrBackendTexture the client supplies a description of the texture consisting of
482
- GrBackendFormat, width, height, and GrMipmapped state. The resulting SkImage can be drawn
483
- to a SkDeferredDisplayListRecorder or directly to a GPU-backed SkSurface.
484
-
485
- When the actual texture is required to perform a backend API draw, textureFulfillProc will
486
- be called to receive a GrBackendTexture. The properties of the GrBackendTexture must match
487
- those set during the SkImage creation, and it must refer to a valid existing texture in the
488
- backend API context/device, and be populated with the image pixel data. The texture cannot
489
- be deleted until textureReleaseProc is called.
490
-
491
- There is at most one call to each of textureFulfillProc and textureReleaseProc.
492
- textureReleaseProc is always called even if image creation fails or if the
493
- image is never fulfilled (e.g. it is never drawn or all draws are clipped out)
494
-
495
- @param gpuContextProxy the thread-safe proxy of the gpu context. required.
496
- @param backendFormat format of promised gpu texture
497
- @param dimensions width & height of promised gpu texture
498
- @param mipmapped mip mapped state of promised gpu texture
499
- @param origin surface origin of promised gpu texture
500
- @param colorType color type of promised gpu texture
501
- @param alphaType alpha type of promised gpu texture
502
- @param colorSpace range of colors; may be nullptr
503
- @param textureFulfillProc function called to get actual gpu texture
504
- @param textureReleaseProc function called when texture can be deleted
505
- @param textureContext state passed to textureFulfillProc and textureReleaseProc
506
- @return created SkImage, or nullptr
507
- */
508
- static sk_sp<SkImage> MakePromiseTexture(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
509
- const GrBackendFormat& backendFormat,
510
- SkISize dimensions,
511
- GrMipmapped mipmapped,
512
- GrSurfaceOrigin origin,
513
- SkColorType colorType,
514
- SkAlphaType alphaType,
515
- sk_sp<SkColorSpace> colorSpace,
516
- PromiseImageTextureFulfillProc textureFulfillProc,
517
- PromiseImageTextureReleaseProc textureReleaseProc,
518
- PromiseImageTextureContext textureContext);
519
-
520
- /** This entry point operates like 'MakePromiseTexture' but it is used to construct a SkImage
521
- from YUV[A] data. The source data may be planar (i.e. spread across multiple textures). In
522
- the extreme Y, U, V, and A are all in different planes and thus the image is specified by
523
- four textures. 'backendTextureInfo' describes the planar arrangement, texture formats,
524
- conversion to RGB, and origin of the textures. Separate 'textureFulfillProc' and
525
- 'textureReleaseProc' calls are made for each texture. Each texture has its own
526
- PromiseImageTextureContext. If 'backendTextureInfo' is not valid then no release proc
527
- calls are made. Otherwise, the calls will be made even on failure. 'textureContexts' has one
528
- entry for each of the up to four textures, as indicated by 'backendTextureInfo'.
529
-
530
- Currently the mip mapped property of 'backendTextureInfo' is ignored. However, in the
531
- near future it will be required that if it is kYes then textureFulfillProc must return
532
- a mip mapped texture for each plane in order to successfully draw the image.
533
-
534
- @param gpuContextProxy the thread-safe proxy of the gpu context. required.
535
- @param backendTextureInfo info about the promised yuva gpu texture
536
- @param imageColorSpace range of colors; may be nullptr
537
- @param textureFulfillProc function called to get actual gpu texture
538
- @param textureReleaseProc function called when texture can be deleted
539
- @param textureContexts state passed to textureFulfillProc and textureReleaseProc
540
- @return created SkImage, or nullptr
541
- */
542
- static sk_sp<SkImage> MakePromiseYUVATexture(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
543
- const GrYUVABackendTextureInfo& backendTextureInfo,
544
- sk_sp<SkColorSpace> imageColorSpace,
545
- PromiseImageTextureFulfillProc textureFulfillProc,
546
- PromiseImageTextureReleaseProc textureReleaseProc,
547
- PromiseImageTextureContext textureContexts[]);
234
+ /** \class SkImage
235
+ SkImage describes a two dimensional array of pixels to draw. The pixels may be
236
+ decoded in a raster bitmap, encoded in a SkPicture or compressed data stream,
237
+ or located in GPU memory as a GPU texture.
548
238
 
549
- #endif // SK_SUPPORT_GPU
239
+ SkImage cannot be modified after it is created. SkImage may allocate additional
240
+ storage as needed; for instance, an encoded SkImage may decode when drawn.
550
241
 
551
- #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
552
- /** (See Skia bug 7447)
553
- Creates SkImage from Android hardware buffer.
554
- Returned SkImage takes a reference on the buffer.
242
+ SkImage width and height are greater than zero. Creating an SkImage with zero width
243
+ or height returns SkImage equal to nullptr.
555
244
 
556
- Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
245
+ SkImage may be created from SkBitmap, SkPixmap, SkSurface, SkPicture, encoded streams,
246
+ GPU texture, YUV_ColorSpace data, or hardware buffer. Encoded streams supported
247
+ include BMP, GIF, HEIF, ICO, JPEG, PNG, WBMP, WebP. Supported encoding details
248
+ vary with platform.
557
249
 
558
- @param hardwareBuffer AHardwareBuffer Android hardware buffer
559
- @param colorSpace range of colors; may be nullptr
560
- @return created SkImage, or nullptr
561
- */
562
- static sk_sp<SkImage> MakeFromAHardwareBuffer(
563
- AHardwareBuffer* hardwareBuffer,
564
- SkAlphaType alphaType = kPremul_SkAlphaType,
565
- sk_sp<SkColorSpace> colorSpace = nullptr,
566
- GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
567
-
568
- /** Creates SkImage from Android hardware buffer and uploads the data from the SkPixmap to it.
569
- Returned SkImage takes a reference on the buffer.
570
-
571
- Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
572
-
573
- @param context GPU context
574
- @param pixmap SkPixmap that contains data to be uploaded to the AHardwareBuffer
575
- @param hardwareBuffer AHardwareBuffer Android hardware buffer
576
- @param surfaceOrigin surface origin for resulting image
577
- @return created SkImage, or nullptr
578
- */
579
- static sk_sp<SkImage> MakeFromAHardwareBufferWithData(
580
- GrDirectContext* context,
581
- const SkPixmap& pixmap,
582
- AHardwareBuffer* hardwareBuffer,
583
- GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
584
- #endif
250
+ See SkImages namespace for the static factory methods to make SkImages.
585
251
 
252
+ Clients should *not* subclass SkImage as there is a lot of internal machinery that is
253
+ not publicly accessible.
254
+ */
255
+ class SK_API SkImage : public SkRefCnt {
256
+ public:
586
257
  /** Returns a SkImageInfo describing the width, height, color type, alpha type, and color space
587
258
  of the SkImage.
588
259
 
@@ -691,18 +362,12 @@ public:
691
362
  */
692
363
  sk_sp<SkShader> makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions&,
693
364
  const SkMatrix* localMatrix = nullptr) const;
694
-
695
365
  sk_sp<SkShader> makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions& sampling,
696
- const SkMatrix& lm) const {
697
- return this->makeShader(tmx, tmy, sampling, &lm);
698
- }
699
- sk_sp<SkShader> makeShader(const SkSamplingOptions& sampling, const SkMatrix& lm) const {
700
- return this->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, &lm);
701
- }
366
+ const SkMatrix& lm) const;
367
+ /** Defaults to clamp in both X and Y. */
368
+ sk_sp<SkShader> makeShader(const SkSamplingOptions& sampling, const SkMatrix& lm) const;
702
369
  sk_sp<SkShader> makeShader(const SkSamplingOptions& sampling,
703
- const SkMatrix* lm = nullptr) const {
704
- return this->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, lm);
705
- }
370
+ const SkMatrix* lm = nullptr) const;
706
371
 
707
372
  /**
708
373
  * makeRawShader functions like makeShader, but for images that contain non-color data.
@@ -719,20 +384,12 @@ public:
719
384
  */
720
385
  sk_sp<SkShader> makeRawShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions&,
721
386
  const SkMatrix* localMatrix = nullptr) const;
722
-
723
387
  sk_sp<SkShader> makeRawShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions& sampling,
724
- const SkMatrix& lm) const {
725
- return this->makeRawShader(tmx, tmy, sampling, &lm);
726
- }
727
- sk_sp<SkShader> makeRawShader(const SkSamplingOptions& sampling, const SkMatrix& lm) const {
728
- return this->makeRawShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, &lm);
729
- }
388
+ const SkMatrix& lm) const;
389
+ /** Defaults to clamp in both X and Y. */
390
+ sk_sp<SkShader> makeRawShader(const SkSamplingOptions& sampling, const SkMatrix& lm) const;
730
391
  sk_sp<SkShader> makeRawShader(const SkSamplingOptions& sampling,
731
- const SkMatrix* lm = nullptr) const {
732
- return this->makeRawShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, lm);
733
- }
734
-
735
- using CubicResampler = SkCubicResampler;
392
+ const SkMatrix* lm = nullptr) const;
736
393
 
737
394
  /** Copies SkImage pixel address, row bytes, and SkImageInfo to pixmap, if address
738
395
  is available, and returns true. If pixel address is not available, return
@@ -752,12 +409,12 @@ public:
752
409
 
753
410
  example: https://fiddle.skia.org/c/@Image_isTextureBacked
754
411
  */
755
- bool isTextureBacked() const;
412
+ virtual bool isTextureBacked() const = 0;
756
413
 
757
414
  /** Returns an approximation of the amount of texture memory used by the image. Returns
758
415
  zero if the image is not texture backed or if the texture has an external format.
759
416
  */
760
- size_t textureSize() const;
417
+ virtual size_t textureSize() const = 0;
761
418
 
762
419
  /** Returns true if SkImage can be drawn on either raster surface or GPU surface.
763
420
  If context is nullptr, tests if SkImage draws on raster surface;
@@ -772,43 +429,7 @@ public:
772
429
 
773
430
  example: https://fiddle.skia.org/c/@Image_isValid
774
431
  */
775
- bool isValid(GrRecordingContext* context) const;
776
-
777
- #if SK_SUPPORT_GPU
778
- /** Flushes any pending uses of texture-backed images in the GPU backend. If the image is not
779
- texture-backed (including promise texture images) or if the GrDirectContext does not
780
- have the same context ID as the context backing the image then this is a no-op.
781
-
782
- If the image was not used in any non-culled draws in the current queue of work for the
783
- passed GrDirectContext then this is a no-op unless the GrFlushInfo contains semaphores or
784
- a finish proc. Those are respected even when the image has not been used.
785
-
786
- @param context the context on which to flush pending usages of the image.
787
- @param info flush options
788
- */
789
- GrSemaphoresSubmitted flush(GrDirectContext* context, const GrFlushInfo& flushInfo) const;
790
-
791
- void flush(GrDirectContext* context) const { this->flush(context, {}); }
792
-
793
- /** Version of flush() that uses a default GrFlushInfo. Also submits the flushed work to the
794
- GPU.
795
- */
796
- void flushAndSubmit(GrDirectContext*) const;
797
-
798
- /** Retrieves the back-end texture. If SkImage has no back-end texture, an invalid
799
- object is returned. Call GrBackendTexture::isValid to determine if the result
800
- is valid.
801
-
802
- If flushPendingGrContextIO is true, completes deferred I/O operations.
803
-
804
- If origin in not nullptr, copies location of content drawn into SkImage.
805
-
806
- @param flushPendingGrContextIO flag to flush outstanding requests
807
- @return back-end API texture handle; invalid on failure
808
- */
809
- GrBackendTexture getBackendTexture(bool flushPendingGrContextIO,
810
- GrSurfaceOrigin* origin = nullptr) const;
811
- #endif // SK_SUPPORT_GPU
432
+ virtual bool isValid(GrRecordingContext* context) const = 0;
812
433
 
813
434
  /** \enum SkImage::CachingHint
814
435
  CachingHint selects whether Skia may internally cache SkBitmap generated by
@@ -941,40 +562,11 @@ public:
941
562
 
942
563
  enum class RescaleMode {
943
564
  kNearest,
565
+ kLinear,
944
566
  kRepeatedLinear,
945
567
  kRepeatedCubic,
946
568
  };
947
569
 
948
- /** Makes image pixel data available to caller, possibly asynchronously.
949
-
950
- Currently asynchronous reads are only supported on the GPU backend and only when the
951
- underlying 3D API supports transfer buffers and CPU/GPU synchronization primitives. In all
952
- other cases this operates synchronously.
953
-
954
- Data is read from the source sub-rectangle, then converted to the color space, color type,
955
- and alpha type of 'info'. A 'srcRect' that is not contained by the bounds of the image
956
- causes failure.
957
-
958
- When the pixel data is ready the caller's ReadPixelsCallback is called with a
959
- AsyncReadResult containing pixel data in the requested color type, alpha type, and color
960
- space. The AsyncReadResult will have count() == 1. Upon failure the callback is called with
961
- nullptr for AsyncReadResult. For a GPU image this flushes work but a submit must occur to
962
- guarantee a finite time before the callback is called.
963
-
964
- The data is valid for the lifetime of AsyncReadResult with the exception that if the SkImage
965
- is GPU-backed the data is immediately invalidated if the context is abandoned or
966
- destroyed.
967
-
968
- @param info info of the requested pixels
969
- @param srcRect subrectangle of image to read
970
- @param callback function to call with result of the read
971
- @param context passed to callback
972
- */
973
- void asyncReadPixels(const SkImageInfo& info,
974
- const SkIRect& srcRect,
975
- ReadPixelsCallback callback,
976
- ReadPixelsContext context) const;
977
-
978
570
  /** Makes image pixel data available to caller, possibly asynchronously. It can also rescale
979
571
  the image pixels.
980
572
 
@@ -1071,44 +663,6 @@ public:
1071
663
  bool scalePixels(const SkPixmap& dst, const SkSamplingOptions&,
1072
664
  CachingHint cachingHint = kAllow_CachingHint) const;
1073
665
 
1074
- /** Encodes SkImage pixels, returning result as SkData.
1075
-
1076
- Returns nullptr if encoding fails, or if encodedImageFormat is not supported.
1077
-
1078
- SkImage encoding in a format requires both building with one or more of:
1079
- SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP; and platform support
1080
- for the encoded format.
1081
-
1082
- If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, encodedImageFormat can
1083
- additionally be one of: SkEncodedImageFormat::kICO, SkEncodedImageFormat::kBMP,
1084
- SkEncodedImageFormat::kGIF.
1085
-
1086
- quality is a platform and format specific metric trading off size and encoding
1087
- error. When used, quality equaling 100 encodes with the least error. quality may
1088
- be ignored by the encoder.
1089
-
1090
- @param encodedImageFormat one of: SkEncodedImageFormat::kJPEG, SkEncodedImageFormat::kPNG,
1091
- SkEncodedImageFormat::kWEBP
1092
- @param quality encoder specific metric with 100 equaling best
1093
- @return encoded SkImage, or nullptr
1094
-
1095
- example: https://fiddle.skia.org/c/@Image_encodeToData
1096
- */
1097
- sk_sp<SkData> encodeToData(SkEncodedImageFormat encodedImageFormat, int quality) const;
1098
-
1099
- /** Encodes SkImage pixels, returning result as SkData. Returns existing encoded data
1100
- if present; otherwise, SkImage is encoded with SkEncodedImageFormat::kPNG. Skia
1101
- must be built with SK_ENCODE_PNG to encode SkImage.
1102
-
1103
- Returns nullptr if existing encoded data is missing or invalid, and
1104
- encoding fails.
1105
-
1106
- @return encoded SkImage, or nullptr
1107
-
1108
- example: https://fiddle.skia.org/c/@Image_encodeToData_2
1109
- */
1110
- sk_sp<SkData> encodeToData() const;
1111
-
1112
666
  /** Returns encoded SkImage pixels as SkData, if SkImage was created from supported
1113
667
  encoded stream format. Platform support for formats vary and may require building
1114
668
  with one or more of: SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP.
@@ -1151,33 +705,79 @@ public:
1151
705
  */
1152
706
  sk_sp<SkImage> withDefaultMipmaps() const;
1153
707
 
1154
- #if SK_SUPPORT_GPU
1155
- /** Returns SkImage backed by GPU texture associated with context. Returned SkImage is
1156
- compatible with SkSurface created with dstColorSpace. The returned SkImage respects
1157
- mipmapped setting; if mipmapped equals GrMipmapped::kYes, the backing texture
1158
- allocates mip map levels.
1159
-
1160
- The mipmapped parameter is effectively treated as kNo if MIP maps are not supported by the
1161
- GPU.
1162
-
1163
- Returns original SkImage if the image is already texture-backed, the context matches, and
1164
- mipmapped is compatible with the backing GPU texture. SkBudgeted is ignored in this case.
1165
-
1166
- Returns nullptr if context is nullptr, or if SkImage was created with another
1167
- GrDirectContext.
708
+ #if defined(SK_GANESH) || defined(SK_GRAPHITE)
709
+ using ReleaseContext = SkImages::ReleaseContext;
710
+ using TextureReleaseProc = void (*)(ReleaseContext);
711
+ #endif
1168
712
 
1169
- @param GrDirectContext the GrDirectContext in play, if it exists
1170
- @param GrMipmapped whether created SkImage texture must allocate mip map levels
1171
- @param SkBudgeted whether to count a newly created texture for the returned image
1172
- counts against the context's budget.
1173
- @return created SkImage, or nullptr
713
+ #if defined(SK_GRAPHITE)
714
+ // Passed to both fulfill and imageRelease
715
+ using GraphitePromiseImageContext = void*;
716
+ // Returned from fulfill and passed into textureRelease
717
+ using GraphitePromiseTextureReleaseContext = void*;
718
+
719
+ using GraphitePromiseImageFulfillProc =
720
+ std::tuple<skgpu::graphite::BackendTexture, GraphitePromiseTextureReleaseContext>
721
+ (*)(GraphitePromiseImageContext);
722
+ using GraphitePromiseImageReleaseProc = void (*)(GraphitePromiseImageContext);
723
+ using GraphitePromiseTextureReleaseProc = void (*)(GraphitePromiseTextureReleaseContext);
724
+
725
+ /** Create a new SkImage that is very similar to an SkImage created by
726
+ MakeGraphiteFromBackendTexture. The difference is that the caller need not have created the
727
+ backend texture nor populated it with data when creating the image. Instead of passing a
728
+ BackendTexture to the factory the client supplies a description of the texture consisting
729
+ of dimensions, TextureInfo, SkColorInfo and Volatility.
730
+
731
+ In general, 'fulfill' must return a BackendTexture that matches the properties
732
+ provided at SkImage creation time. The BackendTexture must refer to a valid existing
733
+ texture in the backend API context/device, and already be populated with data.
734
+ The texture cannot be deleted until 'textureRelease' is called. 'textureRelease' will
735
+ be called with the textureReleaseContext returned by 'fulfill'.
736
+
737
+ Wrt when and how often the fulfill, imageRelease, and textureRelease callbacks will
738
+ be called:
739
+
740
+ For non-volatile promise images, 'fulfill' will be called at Context::insertRecording
741
+ time. Regardless of whether 'fulfill' succeeded or failed, 'imageRelease' will always be
742
+ called only once - when Skia will no longer try calling 'fulfill' to get a backend
743
+ texture. If 'fulfill' failed (i.e., it didn't return a valid backend texture) then
744
+ 'textureRelease' will never be called. If 'fulfill' was successful then
745
+ 'textureRelease' will be called only once when the GPU is done with the contents of the
746
+ promise image. This will usually occur during a Context::submit call but it could occur
747
+ earlier due to error conditions. 'fulfill' can be called multiple times if the promise
748
+ image is used in multiple recordings. If 'fulfill' fails, the insertRecording itself will
749
+ fail. Subsequent insertRecording calls (with Recordings that use the promise image) will
750
+ keep calling 'fulfill' until it succeeds.
751
+
752
+ For volatile promise images, 'fulfill' will be called each time the Recording is inserted
753
+ into a Context. Regardless of whether 'fulfill' succeeded or failed, 'imageRelease'
754
+ will always be called only once just like the non-volatile case. If 'fulfill' fails at
755
+ insertRecording-time, 'textureRelease' will never be called. If 'fulfill' was successful
756
+ then a 'textureRelease' matching that 'fulfill' will be called when the GPU is done with
757
+ the contents of the promise image. This will usually occur during a Context::submit call
758
+ but it could occur earlier due to error conditions.
759
+
760
+ @param recorder the recorder that will capture the commands creating the image
761
+ @param dimensions width & height of promised gpu texture
762
+ @param textureInfo structural information for the promised gpu texture
763
+ @param colorInfo color type, alpha type and colorSpace information for the image
764
+ @param isVolatile volatility of the promise image
765
+ @param fulfill function called to get the actual backend texture
766
+ @param imageRelease function called when any image-centric data can be deleted
767
+ @param textureRelease function called when the backend texture can be deleted
768
+ @param imageContext state passed to fulfill and imageRelease
769
+ @return created SkImage, or nullptr
1174
770
  */
1175
- sk_sp<SkImage> makeTextureImage(GrDirectContext*,
1176
- GrMipmapped = GrMipmapped::kNo,
1177
- SkBudgeted = SkBudgeted::kYes) const;
1178
- #endif
771
+ static sk_sp<SkImage> MakeGraphitePromiseTexture(skgpu::graphite::Recorder*,
772
+ SkISize dimensions,
773
+ const skgpu::graphite::TextureInfo&,
774
+ const SkColorInfo&,
775
+ skgpu::graphite::Volatile,
776
+ GraphitePromiseImageFulfillProc,
777
+ GraphitePromiseImageReleaseProc,
778
+ GraphitePromiseTextureReleaseProc,
779
+ GraphitePromiseImageContext);
1179
780
 
1180
- #ifdef SK_GRAPHITE_ENABLED
1181
781
  /** Creates an SkImage from a GPU texture associated with the recorder.
1182
782
 
1183
783
  SkImage is returned if the format of backendTexture is recognized and supported.
@@ -1198,12 +798,60 @@ public:
1198
798
  const skgpu::graphite::BackendTexture&,
1199
799
  SkColorType colorType,
1200
800
  SkAlphaType alphaType,
1201
- sk_sp<SkColorSpace> colorSpace);
801
+ sk_sp<SkColorSpace> colorSpace,
802
+ TextureReleaseProc = nullptr,
803
+ ReleaseContext = nullptr);
804
+
805
+ /** Creates an SkImage from YUV[A] planar textures associated with the recorder.
806
+ @param recorder The recorder.
807
+ @param yuvaBackendTextures A set of textures containing YUVA data and a description of the
808
+ data and transformation to RGBA.
809
+ @param imageColorSpace range of colors of the resulting image after conversion to RGB;
810
+ may be nullptr
811
+ @param TextureReleaseProc called when the backend textures can be released
812
+ @param ReleaseContext state passed to TextureReleaseProc
813
+ @return created SkImage, or nullptr
814
+ */
815
+ static sk_sp<SkImage> MakeGraphiteFromYUVABackendTextures(
816
+ skgpu::graphite::Recorder* recorder,
817
+ const skgpu::graphite::YUVABackendTextures& yuvaBackendTextures,
818
+ sk_sp<SkColorSpace> imageColorSpace,
819
+ TextureReleaseProc = nullptr,
820
+ ReleaseContext = nullptr);
1202
821
 
1203
822
  struct RequiredImageProperties {
1204
- skgpu::graphite::Mipmapped fMipmapped;
823
+ skgpu::Mipmapped fMipmapped;
1205
824
  };
1206
825
 
826
+ /** Creates SkImage from SkYUVAPixmaps.
827
+
828
+ The image will remain planar with each plane converted to a texture using the passed
829
+ Recorder.
830
+
831
+ SkYUVAPixmaps has a SkYUVAInfo which specifies the transformation from YUV to RGB.
832
+ The SkColorSpace of the resulting RGB values is specified by imgColorSpace. This will
833
+ be the SkColorSpace reported by the image and when drawn the RGB values will be converted
834
+ from this space into the destination space (if the destination is tagged).
835
+
836
+ This is only supported using the GPU backend and will fail if recorder is nullptr.
837
+
838
+ SkYUVAPixmaps does not need to remain valid after this returns.
839
+
840
+ @param Recorder The Recorder to use for storing commands
841
+ @param pixmaps The planes as pixmaps with supported SkYUVAInfo that
842
+ specifies conversion to RGB.
843
+ @param RequiredImageProperties Properties the returned SkImage must possess (e.g.,
844
+ mipmaps)
845
+ @param limitToMaxTextureSize Downscale image to GPU maximum texture size, if necessary
846
+ @param imgColorSpace Range of colors of the resulting image; may be nullptr
847
+ @return Created SkImage, or nullptr
848
+ */
849
+ static sk_sp<SkImage> MakeGraphiteFromYUVAPixmaps(skgpu::graphite::Recorder*,
850
+ const SkYUVAPixmaps& pixmaps,
851
+ RequiredImageProperties = {},
852
+ bool limitToMaxTextureSize = false,
853
+ sk_sp<SkColorSpace> imgColorSpace = nullptr);
854
+
1207
855
  /** Graphite version of makeTextureImage.
1208
856
 
1209
857
  Returns an SkImage backed by a Graphite texture, using the provided Recorder for creation
@@ -1225,9 +873,70 @@ public:
1225
873
  mipmaps)
1226
874
  @return created SkImage, or nullptr
1227
875
  */
1228
- sk_sp<SkImage> makeTextureImage(skgpu::graphite::Recorder*,
1229
- RequiredImageProperties = {}) const;
1230
- #endif
876
+ virtual sk_sp<SkImage> makeTextureImage(skgpu::graphite::Recorder*,
877
+ RequiredImageProperties = {}) const = 0;
878
+
879
+ /** Returns subset of this image.
880
+
881
+ Returns nullptr if any of the following are true:
882
+ - Subset is empty
883
+ - Subset is not contained inside the image's bounds
884
+ - Pixels in the image could not be read or copied
885
+
886
+ If this image is texture-backed, the recorder parameter is required.
887
+ If the recorder parameter is provided, and the image is raster-backed, the subset will
888
+ be converted to texture-backed.
889
+
890
+ @param subset bounds of returned SkImage
891
+ @param recorder the recorder in which to create the new image
892
+ @param RequiredImageProperties properties the returned SkImage must possess (e.g.,
893
+ mipmaps)
894
+ @return the subsetted image, or nullptr
895
+ */
896
+ sk_sp<SkImage> makeSubset(const SkIRect& subset,
897
+ skgpu::graphite::Recorder*,
898
+ RequiredImageProperties = {}) const;
899
+
900
+ /** Creates SkImage in target SkColorSpace.
901
+ Returns nullptr if SkImage could not be created.
902
+
903
+ Returns original SkImage if it is in target SkColorSpace.
904
+ Otherwise, converts pixels from SkImage SkColorSpace to target SkColorSpace.
905
+ If SkImage colorSpace() returns nullptr, SkImage SkColorSpace is assumed to be sRGB.
906
+
907
+ If this image is graphite-backed, the recorder parameter is required.
908
+
909
+ @param targetColorSpace SkColorSpace describing color range of returned SkImage
910
+ @param recorder The Recorder in which to create the new image
911
+ @param RequiredImageProperties properties the returned SkImage must possess (e.g.,
912
+ mipmaps)
913
+ @return created SkImage in target SkColorSpace
914
+ */
915
+ sk_sp<SkImage> makeColorSpace(sk_sp<SkColorSpace> targetColorSpace,
916
+ skgpu::graphite::Recorder*,
917
+ RequiredImageProperties = {}) const;
918
+
919
+ /** Experimental.
920
+ Creates SkImage in target SkColorType and SkColorSpace.
921
+ Returns nullptr if SkImage could not be created.
922
+
923
+ Returns original SkImage if it is in target SkColorType and SkColorSpace.
924
+
925
+ If this image is graphite-backed, the recorder parameter is required.
926
+
927
+ @param targetColorType SkColorType of returned SkImage
928
+ @param targetColorSpace SkColorSpace of returned SkImage
929
+ @param recorder The Recorder in which to create the new image
930
+ @param RequiredImageProperties properties the returned SkImage must possess (e.g.,
931
+ mipmaps)
932
+ @return created SkImage in target SkColorType and SkColorSpace
933
+ */
934
+ sk_sp<SkImage> makeColorTypeAndColorSpace(SkColorType targetColorType,
935
+ sk_sp<SkColorSpace> targetColorSpace,
936
+ skgpu::graphite::Recorder*,
937
+ RequiredImageProperties = {}) const;
938
+
939
+ #endif // SK_GRAPHITE
1231
940
 
1232
941
  /** Returns raster image or lazy image. Copies SkImage backed by GPU texture into
1233
942
  CPU memory if needed. Returns original SkImage if decoded in raster bitmap,
@@ -1285,38 +994,6 @@ public:
1285
994
  const SkIRect& clipBounds, SkIRect* outSubset,
1286
995
  SkIPoint* offset) const;
1287
996
 
1288
- /** Defines a callback function, taking one parameter of type GrBackendTexture with
1289
- no return value. Function is called when back-end texture is to be released.
1290
- */
1291
- typedef std::function<void(GrBackendTexture)> BackendTextureReleaseProc;
1292
-
1293
- #if SK_SUPPORT_GPU
1294
- /** Creates a GrBackendTexture from the provided SkImage. Returns true and
1295
- stores result in backendTexture and backendTextureReleaseProc if
1296
- texture is created; otherwise, returns false and leaves
1297
- backendTexture and backendTextureReleaseProc unmodified.
1298
-
1299
- Call backendTextureReleaseProc after deleting backendTexture.
1300
- backendTextureReleaseProc cleans up auxiliary data related to returned
1301
- backendTexture. The caller must delete returned backendTexture after use.
1302
-
1303
- If SkImage is both texture backed and singly referenced, image is returned in
1304
- backendTexture without conversion or making a copy. SkImage is singly referenced
1305
- if its was transferred solely using std::move().
1306
-
1307
- If SkImage is not texture backed, returns texture with SkImage contents.
1308
-
1309
- @param context GPU context
1310
- @param image SkImage used for texture
1311
- @param backendTexture storage for back-end texture
1312
- @param backendTextureReleaseProc storage for clean up function
1313
- @return true if back-end texture was created
1314
- */
1315
- static bool MakeBackendTextureFromSkImage(GrDirectContext* context,
1316
- sk_sp<SkImage> image,
1317
- GrBackendTexture* backendTexture,
1318
- BackendTextureReleaseProc* backendTextureReleaseProc);
1319
- #endif
1320
997
  /** Deprecated.
1321
998
  */
1322
999
  enum LegacyBitmapMode {
@@ -1393,7 +1070,8 @@ private:
1393
1070
  SkImage(const SkImageInfo& info, uint32_t uniqueID);
1394
1071
 
1395
1072
  friend class SkBitmap;
1396
- friend class SkImage_Base;
1073
+ friend class SkImage_Base; // for private ctor
1074
+ friend class SkImage_Raster; // for withMipmaps
1397
1075
  friend class SkMipmapBuilder;
1398
1076
 
1399
1077
  SkImageInfo fInfo;