aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-01-02 11:34:14 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-02 17:00:40 +0000
commit61ca7c56bd79fe0a6cc32e943874ff5e3e5bf220 (patch)
treec459d20ef42f5dcb82a0b0113152f54413c4119d
parente2d4e8f276ba8aee57f071e87e85f04a6a07addf (diff)
update image doc and minor bookmaker fixes
image doc is still a work in progress. Update online version to latest; updating include header is still a ways off. Remove SkPaint::flatten() example since parameter is not publicly accessible. Minor changes to fix typedef and std::function references. TBR=rmistry@google.com Docs-Preview: https://skia.org/?cl=87120 Bug: skia:6898 Change-Id: I3553bc5fca97c5997aa61ea034b5ca10cb10df75 Reviewed-on: https://skia-review.googlesource.com/87120 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
-rw-r--r--docs/SkBitmap_Reference.bmh1
-rw-r--r--docs/SkImage_Reference.bmh737
-rw-r--r--docs/SkPaint_Reference.bmh43
-rw-r--r--docs/undocumented.bmh22
-rw-r--r--site/user/api/SkBitmap_Reference.md2
-rw-r--r--site/user/api/SkImage_Reference.md739
-rw-r--r--site/user/api/SkPaint_Reference.md12
-rw-r--r--site/user/api/catalog.htm160
-rw-r--r--site/user/api/undocumented.md4
-rw-r--r--tools/bookmaker/bookmaker.cpp4
-rw-r--r--tools/bookmaker/includeParser.cpp2
11 files changed, 1271 insertions, 455 deletions
diff --git a/docs/SkBitmap_Reference.bmh b/docs/SkBitmap_Reference.bmh
index 6608876937..c22524f198 100644
--- a/docs/SkBitmap_Reference.bmh
+++ b/docs/SkBitmap_Reference.bmh
@@ -1348,6 +1348,7 @@ Returns IRect { 0, 0, width(), height() }.
#Example
#Height 128
#Image 4
+ canvas->scale(.5f, .5f);
SkIRect bounds = source.bounds();
for (int x : { 0, bounds.width() } ) {
for (int y : { 0, bounds.height() } ) {
diff --git a/docs/SkImage_Reference.bmh b/docs/SkImage_Reference.bmh
index b0e319291d..9a2b79e711 100644
--- a/docs/SkImage_Reference.bmh
+++ b/docs/SkImage_Reference.bmh
@@ -3,16 +3,40 @@
#Class SkImage
-SkImage is an abstraction for drawing a rectangle of pixels, though the
-particular type of image could be actually storing its data on the GPU, or
-as drawing commands (picture or PDF or otherwise), ready to be played back
-into another canvas.
-The content of SkImage is always immutable, though the actual storage may
-change, if for example that image can be re-created via encoded data or
-other means.
-SkImage always has a non-zero dimensions. If there is a request to create a new
-image, either directly or via SkSurface, and either of the requested dimensions
-are zero, then nullptr will be returned.
+Image describes a two dimensional array of pixels to draw. The pixels may be
+unencoded in a Raster_Bitmap, encoded in a Picture or compressed data stream,
+or located in GPU memory as a GPU_Texture.
+
+Image cannot be modified after it is created. Image may allocate additional
+storage as needed; for instance, an encoded Image may decode when drawn.
+
+Image width and height are greater than zero. Creating an Image with zero width
+or height returns Image equal to nullptr.
+
+Image may be created from Bitmap, Pixmap, Surface, Picture, encoded streams,
+GPU_Texture, YUV_ColorSpace data, or hardware buffer. Encoded streams supported
+include BMP, GIF, HEIF, ICO, JPEG, PNG, WBMP, WebP. Supported encodings details
+vary with platform.
+
+#Topic Raster_Image
+#Alias Raster_Image
+Raster_Image pixels are unencoded in a Raster_Bitmap. These pixels may be read
+directly and in most cases written to, although edited pixels may not be drawn
+if Image has been copied internally.
+##
+
+#Topic Texture_Image
+Texture_Image are located on GPU and pixels are not accessible. Texture_Image
+are allocated optimally for best performance. Raster_Image may
+be drawn to GPU_Surface, but pixels are uploaded from CPU to GPU downgrading
+performance.
+##
+
+#Topic Lazy_Image
+Lazy_Image defer allocating buffer for Image pixels and decoding stream until
+Image is drawn. Lazy_Image caches result if possible to speed up repeated
+drawing.
+##
#Topic Overview
@@ -30,36 +54,39 @@ are zero, then nullptr will be returned.
#Legend
# description # function ##
#Legend ##
-# MakeBackendTextureFromSkImage # Creates GPU texture from Image. ##
+# MakeBackendTextureFromSkImage # Creates GPU_Texture from Image. ##
# MakeCrossContextFromEncoded # Creates Image from encoded data, and uploads to GPU. ##
# MakeFromAHardwareBuffer # Creates Image from Android hardware buffer. ##
-# MakeFromAdoptedTexture # Creates Image from GPU texture, managed internally. ##
+# MakeFromAdoptedTexture # Creates Image from GPU_Texture, managed internally. ##
# MakeFromBitmap # Creates Image from Bitmap, sharing or copying pixels. ##
+# MakeFromDeferredTextureImageData # ##
# MakeFromEncoded # Creates Image from encoded data. ##
# MakeFromGenerator # Creates Image from a stream of data. ##
# MakeFromNV12TexturesCopy # Creates Image from YUV_ColorSpace data in two planes. ##
# MakeFromPicture # Creates Image from Picture. ##
# MakeFromRaster # Creates Image from Pixmap, with release. ##
-# MakeFromTexture # Creates Image from GPU texture, managed externally. ##
+# MakeFromTexture # Creates Image from GPU_Texture, managed externally. ##
# MakeFromYUVTexturesCopy # Creates Image from YUV_ColorSpace data in three planes. ##
# MakeRasterCopy # Creates Image from Pixmap and copied pixels. ##
# MakeRasterData # Creates Image from Image_Info and shared pixels. ##
-# alphaType # Returns Alpha_Type ##
-# asLegacyBitmap # Returns as Raster_Bitmap ##
+# alphaType # Returns Alpha_Type. ##
+# asLegacyBitmap # Returns as Raster_Bitmap. ##
# bounds() # Returns width() and height() as Rectangle. ##
# colorSpace # Returns Color_Space. ##
# dimensions() # Returns width() and height(). ##
# encodeToData # Returns encoded Image as SkData. ##
+# getDeferredTextureImageData # ##
# getTexture # Deprecated. ##
# getTextureHandle # Returns GPU reference to Image as texture. ##
# height() # Returns pixel row count. ##
# isAlphaOnly # Returns if pixels represent a transparency mask. ##
# isLazyGenerated # Returns if Image is created as needed. ##
# isOpaque # Returns if Alpha_Type is kOpaque_SkAlphaType. ##
-# isTextureBacked # Returns if Image was created from GPU texture. ##
+# isTextureBacked # Returns if Image was created from GPU_Texture. ##
# isValid # Returns if Image can draw to Raster_Surface or GPU_Context. ##
# makeColorSpace # Creates Image matching Color_Space if possible. ##
-# makeNonTextureImage # Creates Raster_Image if possible. ##
+# makeNonTextureImage # Creates Image without dependency on GPU_Texture. ##
+# makeRasterImage # Creates Image compatible with Raster_Surface if possible. ##
# makeShader # Creates Shader, Paint element that can tile Image. ##
# makeSubset # Creates Image containing part of original. ##
# makeTextureImage # Creates Image matching Color_Space if possible. ##
@@ -336,31 +363,94 @@ Recognized formats vary by platfrom.
#Return created Image, or nullptr ##
-#Bug 7343
-Waiting on fiddle to support returning image as SkData
+#Example
+#Image 3
+int x = 0;
+for (int quality : { 100, 50, 10, 1} ) {
+ sk_sp<SkData> encodedData = image->encodeToData(SkEncodedImageFormat::kJPEG, quality);
+ sk_sp<SkImage> image = SkImage::MakeFromEncoded(encodedData);
+ canvas->drawImage(image, x, 0);
+ x += 64;
+}
+##
+
+#SeeAlso MakeFromGenerator
+
+#Method ##
+
+# ------------------------------------------------------------------------------
+
+#Typedef void (*TextureReleaseProc)(ReleaseContext releaseContext)
+
##
+#Method static sk_sp<SkImage> MakeFromTexture(GrContext* context,
+ const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin origin,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace)
+
+Deprecated.
+
+#Param context GPU_Context ##
+#Param backendTexture texture residing on GPU ##
+#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+ kPremul_SkAlphaType, kUnpremul_SkAlphaType
+##
+#Param colorSpace range of colors; may be nullptr ##
+
+#Return created Image, or nullptr ##
+
#NoExample
##
-#SeeAlso MakeFromGenerator
+#SeeAlso MakeFromAdoptedTexture SkSurface::MakeFromBackendTexture
#Method ##
# ------------------------------------------------------------------------------
-#Typedef void (*TextureReleaseProc)(ReleaseContext releaseContext)
+#Method static sk_sp<SkImage> MakeFromTexture(GrContext* context,
+ const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin origin,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace,
+ TextureReleaseProc textureReleaseProc,
+ ReleaseContext releaseContext)
+
+Deprecated.
+#Param context GPU_Context ##
+#Param backendTexture texture residing on GPU ##
+#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+ kPremul_SkAlphaType, kUnpremul_SkAlphaType
##
+#Param colorSpace range of colors; may be nullptr ##
+#Param textureReleaseProc function called when texture can be released ##
+#Param releaseContext state passed to textureReleaseProc ##
+
+#Return created Image, or nullptr ##
+
+#NoExample
+##
+
+#SeeAlso MakeFromAdoptedTexture SkSurface::MakeFromBackendTexture
+
+#Method ##
+
+# ------------------------------------------------------------------------------
#Method static sk_sp<SkImage> MakeFromTexture(GrContext* context,
const GrBackendTexture& backendTexture,
GrSurfaceOrigin origin,
+ SkColorType colorType,
SkAlphaType alphaType,
sk_sp<SkColorSpace> colorSpace)
-Creates Image from GPU texture associated with context. Caller is responsible for
-managing the lifetime of GPU texture.
+Creates Image from GPU_Texture associated with context. Caller is responsible for
+managing the lifetime of GPU_Texture.
Image is returned if format of backendTexture is recognized and supported.
Recognized formats vary by GPU back-end.
@@ -368,10 +458,15 @@ Recognized formats vary by GPU back-end.
#Param context GPU_Context ##
#Param backendTexture texture residing on GPU ##
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
+ kRGB_565_SkColorType, kARGB_4444_SkColorType,
+ kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+ kGray_8_SkColorType, kRGBA_F16_SkColorType
+##
#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
kPremul_SkAlphaType, kUnpremul_SkAlphaType
##
-#Param colorSpace range of colors ##
+#Param colorSpace range of colors; may be nullptr ##
#Return created Image, or nullptr ##
@@ -405,12 +500,13 @@ x += 512;
#Method static sk_sp<SkImage> MakeFromTexture(GrContext* context,
const GrBackendTexture& backendTexture,
GrSurfaceOrigin origin,
+ SkColorType colorType,
SkAlphaType alphaType,
sk_sp<SkColorSpace> colorSpace,
TextureReleaseProc textureReleaseProc,
ReleaseContext releaseContext)
-Creates Image from GPU texture associated with context. GPU texture must stay
+Creates Image from GPU_Texture associated with context. GPU_Texture must stay
valid and unchanged until textureReleaseProc is called. textureReleaseProc is
passed releaseContext when Image is deleted or no longer refers to texture.
@@ -420,10 +516,15 @@ Recognized formats vary by GPU back-end.
#Param context GPU_Context ##
#Param backendTexture texture residing on GPU ##
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
+ kRGB_565_SkColorType, kARGB_4444_SkColorType,
+ kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+ kGray_8_SkColorType, kRGBA_F16_SkColorType
+##
#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
kPremul_SkAlphaType, kUnpremul_SkAlphaType
##
-#Param colorSpace range of colors ##
+#Param colorSpace range of colors; may be nullptr ##
#Param textureReleaseProc function called when texture can be released ##
#Param releaseContext state passed to textureReleaseProc ##
@@ -431,7 +532,7 @@ Recognized formats vary by GPU back-end.
#ToDo
This doesn't do anything clever with TextureReleaseProc because it may not get called
-within the lifetime of the example
+fwithin the lifetime of the example
##
#Example
@@ -445,7 +546,7 @@ auto debugster = [](SkImage::ReleaseContext context) -> void {
int x = 0;
for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {
sk_sp<SkImage> image = SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,
- origin, kOpaque_SkAlphaType, nullptr, debugster, &x);
+ origin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType, nullptr, debugster, &x);
canvas->drawImage(image, x, 0);
x += 128;
}
@@ -476,6 +577,9 @@ dstColorSpace. Color_Space of Image is determined by encoded data.
Image is returned if format of data is recognized and supported, and if context
supports moving resources. Recognized formats vary by platform and GPU back-end.
+Image is returned using MakeFromEncoded if context is nullptr or does not support
+moving resources between contexts.
+
#Param context GPU_Context ##
#Param data Image to decode ##
#Param buildMips create Image as Mip_Map if true ##
@@ -484,7 +588,13 @@ supports moving resources. Recognized formats vary by platform and GPU back-end.
#Return created Image, or nullptr ##
#Example
-// incomplete
+#Image 4
+#Height 128
+GrContext* context = canvas->getGrContext();
+sk_sp<SkData> encodedData = image->encodeToData(SkEncodedImageFormat::kJPEG, 100);
+sk_sp<SkImage> image = SkImage::MakeCrossContextFromEncoded(context,
+ encodedData, false, nullptr);
+canvas->drawImage(image, 0, 0);
##
#SeeAlso MakeCrossContextFromPixmap
@@ -509,10 +619,11 @@ asynchronously.
Texture created from pixmap is uploaded to match Surface created with
dstColorSpace. Color_Space of Image is determined by pixmap.colorSpace().
-Image is returned referring to GPU back-end if format of data is recognized and
-supported, and if context supports moving resources. Otherwise, pixmap pixel
-data is copied and Image as returned in raster format if possible; nullptr may
-be returned. Recognized GPU formats vary by platform and GPU back-end.
+Image is returned referring to GPU back-end if context is not nullptr,
+format of data is recognized and supported, and if context supports moving
+resources between contexts. Otherwise, pixmap pixel data is copied and Image
+as returned in raster format if possible; nullptr may be returned.
+Recognized GPU formats vary by platform and GPU back-end.
#Param context GPU_Context ##
#Param pixmap Image_Info, pixel address, and row bytes ##
@@ -522,7 +633,15 @@ be returned. Recognized GPU formats vary by platform and GPU back-end.
#Return created Image, or nullptr ##
#Example
-// incomplete
+#Image 4
+#Height 128
+GrContext* context = canvas->getGrContext();
+SkPixmap pixmap;
+if (source.peekPixels(&pixmap)) {
+ sk_sp<SkImage> image = SkImage::MakeCrossContextFromPixmap(context, pixmap,
+ false, nullptr);
+ canvas->drawImage(image, 0, 0);
+}
##
#SeeAlso MakeCrossContextFromEncoded
@@ -537,6 +656,34 @@ be returned. Recognized GPU formats vary by platform and GPU back-end.
SkAlphaType alphaType = kPremul_SkAlphaType,
sk_sp<SkColorSpace> colorSpace = nullptr)
+Deprecated.
+
+#Param context GPU_Context ##
+#Param backendTexture texture residing on GPU ##
+#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+ kPremul_SkAlphaType, kUnpremul_SkAlphaType
+##
+#Param colorSpace range of colors; may be nullptr ##
+
+#Return created Image, or nullptr ##
+
+#NoExample
+##
+
+#SeeAlso MakeFromTexture MakeFromYUVTexturesCopy
+
+#Method ##
+
+# ------------------------------------------------------------------------------
+
+#Method static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext* context,
+ const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin surfaceOrigin,
+ SkColorType colorType,
+ SkAlphaType alphaType = kPremul_SkAlphaType,
+ sk_sp<SkColorSpace> colorSpace = nullptr)
+
Creates Image from backendTexture associated with context. backendTexture and
returned Image are managed internally, and are released when no longer needed.
@@ -546,47 +693,113 @@ Recognized formats vary by GPU back-end.
#Param context GPU_Context ##
#Param backendTexture texture residing on GPU ##
#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
+ kRGB_565_SkColorType, kARGB_4444_SkColorType,
+ kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+ kGray_8_SkColorType, kRGBA_F16_SkColorType
+##
#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
kPremul_SkAlphaType, kUnpremul_SkAlphaType
##
-#Param colorSpace range of colors ##
+#Param colorSpace range of colors; may be nullptr ##
#Return created Image, or nullptr ##
#Example
-// incomplete
+ if (!canvas->getGrContext()) {
+ return;
+ }
+ canvas->scale(.5f, .5f);
+ canvas->clear(0x7f3f5f7f);
+ int x = 0, y = 0;
+ for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {
+ for (auto alpha : { kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType } ) {
+ sk_sp<SkImage> image = SkImage::MakeFromAdoptedTexture(canvas->getGrContext(),
+ backEndTexture, origin,
+ kRGBA_8888_SkColorType, alpha);
+ canvas->drawImage(image, x, y);
+ x += 160;
+ }
+ x -= 160 * 3;
+ y += 256;
+ }
+##
+
+#SeeAlso MakeFromTexture MakeFromYUVTexturesCopy
+
+#Method ##
+
+# ------------------------------------------------------------------------------
+
+#Method static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
+ const GrBackendObject yuvTextureHandles[3],
+ const SkISize yuvSizes[3],
+ GrSurfaceOrigin surfaceOrigin,
+ sk_sp<SkColorSpace> colorSpace = nullptr)
+
+Creates Image from copy of yuvTextureHandles, an array of textures on GPU.
+yuvTextureHandles contain pixels for YUV planes of Image.
+yuvSizes conain dimensions for each pixel plane. Dimensions must be greater than
+zero but may differ from plane to plane. Returned Image has the dimensions
+yuvSizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
+
+#Param context GPU_Context ##
+#Param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+ kRec709_SkYUVColorSpace
##
+#Param yuvTextureHandles array of YUV textures on GPU ##
+#Param yuvSizes dimensions of YUV textures ##
+#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param colorSpace range of colors; may be nullptr ##
-#SeeAlso incomplete
+#Return created Image, or nullptr ##
+
+# seems too complicated to create an example for this
+#ToDo
+should this be moved to chrome only?
+##
+
+#NoExample
+##
+
+#SeeAlso MakeFromNV12TexturesCopy
#Method ##
# ------------------------------------------------------------------------------
#Method static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
- const GrBackendObject yuvTextureHandles[3],
+ const GrBackendTexture yuvTextureHandles[3],
const SkISize yuvSizes[3],
GrSurfaceOrigin surfaceOrigin,
sk_sp<SkColorSpace> colorSpace = nullptr)
-Create a new image by copying the pixels from the specified y, u, v textures. The data
-from the textures is immediately ingested into the image and the textures can be modified or
-deleted after the function returns. The image will have the dimensions of the y texture.
+Creates Image from copy of yuvTextureHandles, an array of textures on GPU.
+yuvTextureHandles contain pixels for YUV planes of Image.
+yuvSizes conain dimensions for each pixel plane. Dimensions must be greater than
+zero but may differ from plane to plane. Returned Image has the dimensions
+yuvSizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
-#Param context incomplete ##
-#Param yuvColorSpace incomplete ##
-#Param yuvTextureHandles incomplete ##
-#Param yuvSizes incomplete ##
-#Param surfaceOrigin incomplete ##
-#Param colorSpace incomplete ##
+#Param context GPU_Context ##
+#Param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+ kRec709_SkYUVColorSpace
+##
+#Param yuvTextureHandles array of YUV textures on GPU ##
+#Param yuvSizes dimensions of YUV textures ##
+#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param colorSpace range of colors; may be nullptr ##
-#Return incomplete ##
+#Return created Image, or nullptr ##
-#Example
-// incomplete
+# seems too complicated to create an example for this
+#ToDo
+should this be moved to chrome only?
##
-#SeeAlso incomplete
+#NoExample
+##
+
+#SeeAlso MakeFromNV12TexturesCopy
#Method ##
@@ -599,48 +812,103 @@ deleted after the function returns. The image will have the dimensions of the y
GrSurfaceOrigin surfaceOrigin,
sk_sp<SkColorSpace> colorSpace = nullptr)
-Create a new image by copying the pixels from the specified y and UV_Mapping. The data
-from the textures is immediately ingested into the image and the textures can be modified or
-deleted after the function returns. The image will have the dimensions of the y texture.
+Creates Image from copy of nv12TextureHandles, an array of textures on GPU.
+nv12TextureHandles[0] contains pixels for YUV_Component_Y plane.
+nv12TextureHandles[1] contains pixels for YUV_Component_U plane,
+followed by pixels for YUV_Component_V plane.
+nv12Sizes conain dimensions for each pixel plane. Dimensions must be greater than
+zero but may differ from plane to plane. Returned Image has the dimensions
+nv12Sizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
-#Param context incomplete ##
-#Param yuvColorSpace incomplete ##
-#Param nv12TextureHandles incomplete ##
-#Param nv12Sizes incomplete ##
-#Param surfaceOrigin incomplete ##
-#Param colorSpace incomplete ##
+#Param context GPU_Context ##
+#Param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+ kRec709_SkYUVColorSpace
+##
+#Param nv12TextureHandles array of YUV textures on GPU ##
+#Param nv12Sizes dimensions of YUV textures ##
+#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param colorSpace range of colors; may be nullptr ##
-#Return incomplete ##
+#Return created Image, or nullptr ##
-#Example
-// incomplete
+# seems too complicated to create an example for this
+#ToDo
+should this be moved to chrome only?
##
-#SeeAlso incomplete
+#NoExample
+##
+
+#SeeAlso MakeFromYUVTexturesCopy
#Method ##
# ------------------------------------------------------------------------------
+#Method static sk_sp<SkImage> MakeFromNV12TexturesCopy(GrContext* context,
+ SkYUVColorSpace yuvColorSpace,
+ const GrBackendTexture nv12TextureHandles[2],
+ const SkISize nv12Sizes[2],
+ GrSurfaceOrigin surfaceOrigin,
+ sk_sp<SkColorSpace> colorSpace = nullptr)
+
+Creates Image from copy of nv12TextureHandles, an array of textures on GPU.
+nv12TextureHandles[0] contains pixels for YUV_Component_Y plane.
+nv12TextureHandles[1] contains pixels for YUV_Component_U plane,
+followed by pixels for YUV_Component_V plane.
+nv12Sizes conain dimensions for each pixel plane. Dimensions must be greater than
+zero but may differ from plane to plane. Returned Image has the dimensions
+nv12Sizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
+
+#Param context GPU_Context ##
+#Param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+ kRec709_SkYUVColorSpace
+##
+#Param nv12TextureHandles array of YUV textures on GPU ##
+#Param nv12Sizes dimensions of YUV textures ##
+#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
+#Param colorSpace range of colors; may be nullptr ##
+
+#Return created Image, or nullptr ##
+
+# seems too complicated to create an example for this
+#ToDo
+should this be moved to chrome only?
+##
+
+#NoExample
+##
+
+#SeeAlso MakeFromYUVTexturesCopy
+
+#Method ##
+
+# ------------------------------------------------------------------------------
+
+#Bug 7424
+currently uncalled by any test or client
+##
+
#Enum BitDepth
#Code
- enum BitDepth {
+ enum class BitDepth {
kU8,
kF16,
};
##
#Const kU8 0
+Use 8 bits per Color_ARGB component using unsigned integer format.
##
#Const kF16 1
+Use 16 bits per Color_ARGB component using half-precision floating point format.
##
-#Example
-// incomplete
+#NoExample
##
-#SeeAlso incomplete
+#SeeAlso MakeFromPicture
#Enum ##
@@ -651,23 +919,44 @@ deleted after the function returns. The image will have the dimensions of the y
BitDepth bitDepth,
sk_sp<SkColorSpace> colorSpace)
-Create a new image from the specified picture.
-On creation of the SkImage, snap the SkPicture to a particular BitDepth and SkColorSpace.
+Creates Image from picture. Returned Image width and height are set by dimensions.
+Image draws picture with matrix and paint, set to bitDepth and colorSpace.
-#Param picture incomplete ##
-#Param dimensions incomplete ##
-#Param matrix incomplete ##
-#Param paint incomplete ##
-#Param bitDepth incomplete ##
-#Param colorSpace incomplete ##
+If matrix is nullptr, draws with identity Matrix. If paint is nullptr, draws
+with default Paint. colorSpace may be nullptr.
-#Return incomplete ##
+#Param picture stream of drawing commands ##
+#Param dimensions width and height ##
+#Param matrix Matrix to rotate, scale, translate, and so on; may be nullptr ##
+#Param paint Paint to apply transparency, filtering, and so on; may be nullptr ##
+#Param bitDepth 8 bit integer or 16 bit float: per component ##
+#Param colorSpace range of colors; may be nullptr ##
+
+#Return created Image, or nullptr ##
#Example
-// incomplete
+ SkPaint paint;
+ SkPictureRecorder recorder;
+ SkCanvas* recordingCanvas = recorder.beginRecording(50, 50);
+ for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xff007f00 } ) {
+ paint.setColor(color);
+ recordingCanvas->drawRect({10, 10, 30, 40}, paint);
+ recordingCanvas->translate(10, 10);
+ recordingCanvas->scale(1.2f, 1.4f);
+ }
+ sk_sp<SkPicture> playback = recorder.finishRecordingAsPicture();
+ int x = 0, y = 0;
+ for (auto alpha : { 70, 140, 210 } ) {
+ paint.setAlpha(alpha);
+ auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ sk_sp<SkImage> image = SkImage::MakeFromPicture(playback, {50, 50}, nullptr, &paint,
+ SkImage::BitDepth::kU8, srgbColorSpace);
+ canvas->drawImage(image, x, y);
+ x += 70; y += 70;
+ }
##
-#SeeAlso incomplete
+#SeeAlso SkCanvas::drawPicture
#Method ##
@@ -677,45 +966,25 @@ On creation of the SkImage, snap the SkPicture to a particular BitDepth and SkCo
SkAlphaType alphaType = kPremul_SkAlphaType,
sk_sp<SkColorSpace> colorSpace = nullptr)
- Create a new image from the an Android hardware buffer.
- The new image takes a reference on the buffer.
+#Bug 7447 ##
- Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
+Creates Image from Android hardware buffer.
+Returned Image takes a reference on the buffer.
-#Param hardwareBuffer incomplete ##
-#Param alphaType incomplete ##
-#Param colorSpace incomplete ##
+Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
-#Return incomplete ##
-
-#Example
-// incomplete
+#Param hardwareBuffer AHardwareBuffer Android hardware buffer ##
+#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+ kPremul_SkAlphaType, kUnpremul_SkAlphaType
##
+#Param colorSpace range of colors; may be nullptr ##
-#SeeAlso incomplete
-
-#Method ##
-
-# ------------------------------------------------------------------------------
-
-#Method static sk_sp<SkImage> MakeFromAHardwareBuffer(AHardwareBuffer* hardwareBuffer,
- SkAlphaType alphaType = kPremul_SkAlphaType,
- sk_sp<SkColorSpace> colorSpace = nullptr)
-
-Create a new image from the an Android hardware buffer.
-The new image takes a reference on the buffer.
-
-#Param hardwareBuffer incomplete ##
-#Param alphaType incomplete ##
-#Param colorSpace incomplete ##
-
-#Return incomplete ##
+#Return created Image, or nullptr ##
-#Example
-// incomplete
+#NoExample
##
-#SeeAlso incomplete
+#SeeAlso MakeFromRaster
#Method ##
@@ -723,13 +992,23 @@ The new image takes a reference on the buffer.
#Method int width() const
-#Return incomplete ##
+Returns pixel count in each row.
+
+#Return pixel width in Image ##
#Example
-// incomplete
+#Image 4
+#Height 168
+ canvas->translate(10, 10);
+ canvas->drawImage(image, 0, 0);
+ canvas->translate(0, image->height());
+ SkPaint paint;
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawLine(0, 10, image->width(), 10, paint);
+ canvas->drawString("width", image->width() / 2, 25, paint);
##
-#SeeAlso incomplete
+#SeeAlso dimensions() height()
#Method ##
@@ -739,13 +1018,21 @@ The new image takes a reference on the buffer.
Returns pixel row count.
-#Return incomplete ##
+#Return pixel height in Image ##
#Example
-// incomplete
-##
-
-#SeeAlso incomplete
+#Image 4
+#Height 148
+ canvas->translate(10, 10);
+ canvas->drawImage(image, 0, 0);
+ canvas->translate(image->width(), 0);
+ SkPaint paint;
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ paint.setVerticalText(true);
+ canvas->drawLine(10, 0, 10, image->height(), paint);
+ canvas->drawString("height", 25, image->height() / 2, paint);##
+
+#SeeAlso dimensions() width()
#Method ##
@@ -758,10 +1045,14 @@ Returns ISize { width(), height() }.
#Return integral size of width() and height() ##
#Example
-// incomplete
+#Image 4
+ SkISize dimensions = image->dimensions();
+ SkIRect bounds = image->bounds();
+ SkIRect dimensionsAsBounds = SkIRect::MakeSize(dimensions);
+ SkDebugf("dimensionsAsBounds %c= bounds\n", dimensionsAsBounds == bounds ? '=' : '!');
##
-#SeeAlso height() width()
+#SeeAlso height() width() bounds()
#Method ##
@@ -774,10 +1065,18 @@ Returns IRect { 0, 0, width(), height() }.
#Return integral rectangle from origin to width() and height() ##
#Example
-// incomplete
+#Height 128
+#Image 4
+ canvas->scale(.5f, .5f);
+ SkIRect bounds = image->bounds();
+ for (int x : { 0, image->width() } ) {
+ for (int y : { 0, image->height() } ) {
+ canvas->drawImage(image, x, y);
+ }
+ }
##
-#SeeAlso incomplete
+#SeeAlso dimensions()
#Method ##
@@ -785,13 +1084,27 @@ Returns IRect { 0, 0, width(), height() }.
#Method uint32_t uniqueID() const
-#Return incomplete ##
+Returns value unique to image. Image contents cannot change after Image is
+created. Any operation to create a new Image will receive generate a new
+unique number.
+
+#Return unique identifier ##
#Example
-// incomplete
+#Image 5
+#Height 156
+ sk_sp<SkImage> subset = image->makeSubset({10, 20, 90, 100});
+ canvas->drawImage(image, 0, 0);
+ canvas->drawImage(subset, 128, 0);
+ SkPaint paint;
+ SkString s;
+ s.printf("original id: %d", image->uniqueID());
+ canvas->drawString(s, 20, image->height() + 20, paint);
+ s.printf("subset id: %d", subset->uniqueID());
+ canvas->drawString(s, 148, subset->height() + 20, paint);
##
-#SeeAlso incomplete
+#SeeAlso isLazyGenerated
#Method ##
@@ -799,13 +1112,25 @@ Returns IRect { 0, 0, width(), height() }.
#Method SkAlphaType alphaType() const
-#Return incomplete ##
+Returns Alpha_Type, one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+kPremul_SkAlphaType, kUnpremul_SkAlphaType.
+
+Alpha_Type returned was a parameter to an Image constructor,
+or was parsed from encoded data.
+
+#Return Alpha_Type in Image ##
#Example
-// incomplete
+#Image 4
+#Height 156
+ const char* alphaTypeStr[] = { "Unknown", "Opaque", "Premul", "Unpremul" };
+ SkAlphaType alphaType = image->alphaType();
+ canvas->drawImage(image, 0, 0);
+ SkPaint paint;
+ canvas->drawString(alphaTypeStr[(int) alphaType], 20, image->height() + 20, paint);
##
-#SeeAlso incomplete
+#SeeAlso SkImageInfo::alphaType
#Method ##
@@ -978,7 +1303,7 @@ draws on GPU_Surface associated with context.
Texture-backed images may become invalid if their underlying GrContext is abandoned. Some
generator-backed images may be invalid for CPU and/or GPU.
-#Param context incomplete ##
+#Param context GPU_Context ##
#Return incomplete ##
@@ -1168,21 +1493,15 @@ Returns nullptr if encoding fails, or encodedImageFormat is not supported.
# ------------------------------------------------------------------------------
-#Method sk_sp<SkData> encodeToData(SkPixelSerializer* pixelSerializer = nullptr) const
+#Method sk_sp<SkData> encodeToData() const
Encodes Image and returns result as SkData. Will reuse existing encoded data
-if present, as returned by refEncodedData. pixelSerializer validates existing
-encoded data, and encodes Image when existing encoded data is missing or
-invalid.
-
-Passing nullptr for pixelSerializer selects default serialization which
-accepts all data and encodes to PNG.
+if present, as returned by refEncodedData. If encoded data is missing or invalid,
+Image is encoded as PNG.
Returns nullptr if existing encoded data is missing or invalid and
encoding fails.
-#Param pixelSerializer incomplete ##
-
#Return incomplete ##
#Example
@@ -1258,7 +1577,7 @@ with surfaces that have the supplied destination color space. If no transformati
required, the returned image may be the same as this image. If this image is from a
different GrContext, this will fail.
-#Param context incomplete ##
+#Param context GPU_Context ##
#Param dstColorSpace incomplete ##
#Return incomplete ##
@@ -1275,6 +1594,23 @@ different GrContext, this will fail.
#Method sk_sp<SkImage> makeNonTextureImage() const
+Creates raster Image if Image contains GPU_Texture and raster Image , this will make a raster copy of it (or nullptr if reading back
+the pixels fails). Otherwise, it returns the original image.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+#Method ##
+
+# ------------------------------------------------------------------------------
+
+#Method sk_sp<SkImage> makeRasterImage() const
+
If the image is texture-backed this will make a raster copy of it (or nullptr if reading back
the pixels fails). Otherwise, it returns the original image.
@@ -1322,6 +1658,127 @@ caller.
# ------------------------------------------------------------------------------
+#Struct DeferredTextureImageUsageParams
+
+#Code
+ struct DeferredTextureImageUsageParams {
+ DeferredTextureImageUsageParams(const SkMatrix matrix, const SkFilterQuality quality,
+ int preScaleMipLevel);
+ SkMatrix fMatrix;
+ SkFilterQuality fQuality;
+ int fPreScaleMipLevel;
+ };
+##
+
+#Member SkMatrix fMatrix
+##
+
+#Member SkFilterQuality fQuality
+##
+
+#Member int fPreScaleMipLevel
+##
+
+#Method DeferredTextureImageUsageParams(const SkMatrix matrix, const SkFilterQuality quality,
+ int preScaleMipLevel)
+
+#Param matrix incomplete ##
+#Param quality incomplete ##
+#Param preScaleMipLevel incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method size_t getDeferredTextureImageData(const GrContextThreadSafeProxy& contextThreadSafeProxy,
+ const DeferredTextureImageUsageParams deferredTextureImageUsageParams[],
+ int paramCnt,
+ void* buffer,
+ SkColorSpace* dstColorSpace = nullptr,
+ SkColorType dstColorType = kN32_SkColorType) const
+
+This method allows clients to capture the data necessary to turn a SkImage into a texture-
+backed image. If the original image is codec-backed this will decode into a format optimized
+for the context represented by the proxy. This method is thread safe with respect to the
+GrContext whence the proxy came. Clients allocate and manage the storage of the deferred
+texture data and control its lifetime. No cleanup is required, thus it is safe to simply free
+the memory out from under the data.
+
+The same method is used both for getting the size necessary for pre-uploaded texture data
+and for retrieving the data. The params array represents the set of draws over which to
+optimize the pre-upload data.
+
+When called with a null buffer this returns the size that the client must allocate in order
+to create deferred texture data for this image (or zero if this is an inappropriate
+candidate). The buffer allocated by the client should be 8 byte aligned.
+
+When buffer is not null this fills in the deferred texture data for this image in the
+provided buffer (assuming this is an appropriate candidate image and the buffer is
+appropriately aligned). Upon success the size written is returned, otherwise 0.
+
+dstColorSpace is the color space of the surface where this texture will ultimately be used.
+If the method determines that mip-maps are needed, this helps determine the correct strategy
+for building them (gamma-correct or not).
+
+dstColorType is the color type of the surface where this texture will ultimately be used.
+This determines the format with which the image will be uploaded to the GPU. If dstColorType
+does not support color spaces (low bit depth types such as kARGB_4444_SkColorType),
+then dstColorSpace must be null.
+
+#Param contextThreadSafeProxy incomplete ##
+#Param deferredTextureImageUsageParams incomplete ##
+#Param paramCnt incomplete ##
+#Param buffer incomplete ##
+#Param dstColorSpace incomplete ##
+#Param dstColorType incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method static sk_sp<SkImage> MakeFromDeferredTextureImageData(GrContext* context, const void* data,
+ SkBudgeted budgeted)
+
+Returns a texture-backed image from data produced in SkImage::getDeferredTextureImageData.
+The context must be the context that provided the proxy passed to
+getDeferredTextureImageData.
+
+#Param context GPU_Context ##
+#Param data incomplete ##
+#Param budgeted incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+# ------------------------------------------------------------------------------
+
#Typedef std::function<void(GrBackendTexture)> BackendTextureReleaseProc
##
@@ -1347,7 +1804,7 @@ without conversion or making a copy.
If the SkImage is not texture backed, this function will generate a texture with the image's
contents and return that.
-#Param context incomplete ##
+#Param context GPU_Context ##
#Param image incomplete ##
#Param backendTexture incomplete ##
#Param backendTextureReleaseProc incomplete ##
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index aff9a7146d..f0a2d5fb92 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -567,47 +567,10 @@ can reconstitute the paint at a later time.
#Param buffer Write_Buffer receiving the flattened Paint data ##
-#Example
- class PaintDumper : public SkWriteBuffer {
- public:
- bool isCrossProcess() const override { return false; };
- void writePad32(const void* buffer, size_t bytes) override {}
- void writeByteArray(const void* data, size_t size) override {}
- void writeBool(bool value) override {}
- void writeScalar(SkScalar value) override {}
- void writeScalarArray(const SkScalar* value, uint32_t count) override {}
- void writeInt(int32_t value) override {}
- void writeIntArray(const int32_t* value, uint32_t count) override {}
- void writeUInt(uint32_t value) override {}
- void writeString(const char* value) override {}
- void writeFlattenable(const SkFlattenable* flattenable) override {}
- void writeColorArray(const SkColor* color, uint32_t count) override {}
- void writeColor4f(const SkColor4f& color) override {}
- void writeColor4fArray(const SkColor4f* color, uint32_t count) override {}
- void writePoint(const SkPoint& point) override {}
- void writePointArray(const SkPoint* point, uint32_t count) override {}
- void writeMatrix(const SkMatrix& matrix) override {}
- void writeIRect(const SkIRect& rect) override {}
- void writeRect(const SkRect& rect) override {}
- void writeRegion(const SkRegion& region) override {}
- void writePath(const SkPath& path) override {}
- size_t writeStream(SkStream* stream, size_t length) override { return 0; }
- void writeImage(const SkImage*) override {}
- void writeTypeface(SkTypeface* typeface) override {}
- void writePaint(const SkPaint& paint) override {}
-
- void writeColor(SkColor color) override {
- SkDebugf("color = 0x%08x\n", color);
- }
- } dumper;
-
- SkPaint paint;
- paint.setColor(SK_ColorRED);
- paint.flatten(dumper);
+# why is flatten() public?
+#Bug 6172 ##
- #StdOut
- color = 0xffff0000
- ##
+#NoExample
##
##
diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh
index b6987528e2..f99aa2211a 100644
--- a/docs/undocumented.bmh
+++ b/docs/undocumented.bmh
@@ -1,11 +1,13 @@
# external references that will be documented eventually ...
#External
- DirectWrite TrueType Windows Linux Android iOS __ANDROID_API__
+ DirectWrite TrueType Windows Linux Android iOS __ANDROID_API__ AHardwareBuffer
FreeType FreeType-based Harfbuzz
Descenders Kerning Unhinted
- LCD RGB sRGB YUV_ColorSpace
+ LCD RGB sRGB YUV
+ YUV_Component_Y YUV_Component_U YUV_Component_V
Unicode Unicode5 UTF-8 UTF-16 UTF-32 ASCII Unichar
API
+ BMP GIF HEIF ICO JPEG PNG WBMP WebP
CPU
GPU GPU-backed OpenGL Vulkan I/O MSAA UV_Mapping Multi_Sample_Anti_Aliasing GPU_Share_Group
PDF XPS
@@ -295,6 +297,10 @@ FT_Load_Glyph
#Substitute GPU surface
##
+#Topic GPU_Texture
+#Substitute GPU texture
+##
+
#Topic HTML_Canvas
#Substitute HTML Canvas
#Subtopic ArcTo
@@ -638,9 +644,6 @@ FT_Load_Glyph
#Topic Raster_Bitmap
##
-#Topic Raster_Image
-##
-
#Topic Raster_Surface
##
@@ -811,3 +814,12 @@ FT_Load_Glyph
#Struct SkWriteBuffer
#Struct ##
#Topic ##
+
+#Enum YUV_ColorSpace
+#Const kJPEG_SkYUVColorSpace 0
+##
+#Const kRec601_SkYUVColorSpace 1
+##
+#Const kRec709_SkYUVColorSpace 2
+##
+##
diff --git a/site/user/api/SkBitmap_Reference.md b/site/user/api/SkBitmap_Reference.md
index fc30b242c9..443f1bfd2f 100644
--- a/site/user/api/SkBitmap_Reference.md
+++ b/site/user/api/SkBitmap_Reference.md
@@ -1452,7 +1452,7 @@ integral rectangle from origin to <a href="#SkBitmap_width">width</a> and <a hre
### Example
-<div><fiddle-embed name="bd020c1527964761adf7646e82a36487"></fiddle-embed></div>
+<div><fiddle-embed name="41a60435d6eb76cb400fe9be635e3762"></fiddle-embed></div>
### See Also
diff --git a/site/user/api/SkImage_Reference.md b/site/user/api/SkImage_Reference.md
index 1ba1cdd0c3..b42e5917c0 100644
--- a/site/user/api/SkImage_Reference.md
+++ b/site/user/api/SkImage_Reference.md
@@ -4,16 +4,36 @@ SkImage Reference
# <a name="Image"></a> Image
# <a name="SkImage"></a> Class SkImage
-<a href="#SkImage">SkImage</a> is an abstraction for drawing a rectangle of pixels, though the
-particular type of image could be actually storing its data on the <a href="undocumented#GPU">GPU</a>, or
-as drawing commands (picture or <a href="undocumented#PDF">PDF</a> or otherwise), ready to be played back
-into another canvas.
-The content of <a href="#SkImage">SkImage</a> is always immutable, though the actual storage may
-change, if for example that image can be re-created via encoded data or
-other means.
-<a href="#SkImage">SkImage</a> always has a non-zero <a href="#SkImage_dimensions">dimensions</a>. If there is a request to create a new
-image, either directly or via <a href="SkSurface_Reference#SkSurface">SkSurface</a>, and either of the requested <a href="#SkImage_dimensions">dimensions</a>
-are zero, then nullptr will be returned.
+<a href="#Image">Image</a> describes a two dimensional array of pixels to draw. The pixels may be
+unencoded in a <a href="undocumented#Raster_Bitmap">Raster Bitmap</a>, encoded in a <a href="undocumented#Picture">Picture</a> or compressed data stream,
+or located in <a href="undocumented#GPU">GPU</a> memory as a <a href="undocumented#GPU_Texture">GPU Texture</a>.
+
+<a href="#Image">Image</a> cannot be modified after it is created. <a href="#Image">Image</a> may allocate additional
+storage as needed; for instance, an encoded <a href="#Image">Image</a> may decode when drawn.
+
+<a href="#Image">Image</a> <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> are greater than zero. Creating an <a href="#Image">Image</a> with zero <a href="#SkImage_width">width</a>
+or <a href="#SkImage_height">height</a> returns <a href="#Image">Image</a> equal to nullptr.
+
+<a href="#Image">Image</a> may be created from <a href="SkBitmap_Reference#Bitmap">Bitmap</a>, <a href="SkPixmap_Reference#Pixmap">Pixmap</a>, <a href="SkSurface_Reference#Surface">Surface</a>, <a href="undocumented#Picture">Picture</a>, encoded streams,
+<a href="undocumented#GPU_Texture">GPU Texture</a>, <a href="undocumented#YUV_ColorSpace">YUV ColorSpace</a> data, or hardware buffer. Encoded streams supported
+include <a href="undocumented#BMP">BMP</a>, <a href="undocumented#GIF">GIF</a>, <a href="undocumented#HEIF">HEIF</a>, <a href="undocumented#ICO">ICO</a>, <a href="undocumented#JPEG">JPEG</a>, <a href="undocumented#PNG">PNG</a>, <a href="undocumented#WBMP">WBMP</a>, <a href="undocumented#WebP">WebP</a>. Supported encodings details
+vary with platform.
+
+# <a name="Raster_Image"></a> Raster Image
+<a href="SkImage_Reference#Raster_Image">Raster Image</a> pixels are unencoded in a <a href="undocumented#Raster_Bitmap">Raster Bitmap</a>. These pixels may be read
+directly and in most cases written to, although edited pixels may not be drawn
+if <a href="#Image">Image</a> has been copied internally.
+
+# <a name="Texture_Image"></a> Texture Image
+<a href="#Texture_Image">Texture Image</a> are located on <a href="undocumented#GPU">GPU</a> and pixels are not accessible. <a href="#Texture_Image">Texture Image</a>
+are allocated optimally for best performance. <a href="SkImage_Reference#Raster_Image">Raster Image</a> may
+be drawn to <a href="undocumented#GPU_Surface">GPU Surface</a>, but pixels are uploaded from <a href="undocumented#CPU">CPU</a> to <a href="undocumented#GPU">GPU</a> downgrading
+performance.
+
+# <a name="Lazy_Image"></a> Lazy Image
+<a href="#Lazy_Image">Lazy Image</a> defer allocating buffer for <a href="#Image">Image</a> pixels and decoding stream until
+<a href="#Image">Image</a> is drawn. <a href="#Lazy_Image">Lazy Image</a> caches result if possible to speed up repeated
+drawing.
# <a name="Overview"></a> Overview
@@ -26,36 +46,39 @@ are zero, then nullptr will be returned.
| description | function |
| --- | --- |
-| <a href="#SkImage_MakeBackendTextureFromSkImage">MakeBackendTextureFromSkImage</a> | Creates <a href="undocumented#GPU">GPU</a> texture from <a href="#Image">Image</a>. |
+| <a href="#SkImage_MakeBackendTextureFromSkImage">MakeBackendTextureFromSkImage</a> | Creates <a href="undocumented#GPU_Texture">GPU Texture</a> from <a href="#Image">Image</a>. |
| <a href="#SkImage_MakeCrossContextFromEncoded">MakeCrossContextFromEncoded</a> | Creates <a href="#Image">Image</a> from encoded data, and uploads to <a href="undocumented#GPU">GPU</a>. |
| <a href="#SkImage_MakeFromAHardwareBuffer">MakeFromAHardwareBuffer</a> | Creates <a href="#Image">Image</a> from <a href="undocumented#Android">Android</a> hardware buffer. |
-| <a href="#SkImage_MakeFromAdoptedTexture">MakeFromAdoptedTexture</a> | Creates <a href="#Image">Image</a> from <a href="undocumented#GPU">GPU</a> texture, managed internally. |
+| <a href="#SkImage_MakeFromAdoptedTexture">MakeFromAdoptedTexture</a> | Creates <a href="#Image">Image</a> from <a href="undocumented#GPU_Texture">GPU Texture</a>, managed internally. |
| <a href="#SkImage_MakeFromBitmap">MakeFromBitmap</a> | Creates <a href="#Image">Image</a> from <a href="SkBitmap_Reference#Bitmap">Bitmap</a>, sharing or copying pixels. |
+| <a href="#SkImage_MakeFromDeferredTextureImageData">MakeFromDeferredTextureImageData</a> | |
| <a href="#SkImage_MakeFromEncoded">MakeFromEncoded</a> | Creates <a href="#Image">Image</a> from encoded data. |
| <a href="#SkImage_MakeFromGenerator">MakeFromGenerator</a> | Creates <a href="#Image">Image</a> from a stream of data. |
| <a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy</a> | Creates <a href="#Image">Image</a> from <a href="undocumented#YUV_ColorSpace">YUV ColorSpace</a> data in two planes. |
| <a href="#SkImage_MakeFromPicture">MakeFromPicture</a> | Creates <a href="#Image">Image</a> from <a href="undocumented#Picture">Picture</a>. |
| <a href="#SkImage_MakeFromRaster">MakeFromRaster</a> | Creates <a href="#Image">Image</a> from <a href="SkPixmap_Reference#Pixmap">Pixmap</a>, with release. |
-| <a href="#SkImage_MakeFromTexture">MakeFromTexture</a> | Creates <a href="#Image">Image</a> from <a href="undocumented#GPU">GPU</a> texture, managed externally. |
+| <a href="#SkImage_MakeFromTexture">MakeFromTexture</a> | Creates <a href="#Image">Image</a> from <a href="undocumented#GPU_Texture">GPU Texture</a>, managed externally. |
| <a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy</a> | Creates <a href="#Image">Image</a> from <a href="undocumented#YUV_ColorSpace">YUV ColorSpace</a> data in three planes. |
| <a href="#SkImage_MakeRasterCopy">MakeRasterCopy</a> | Creates <a href="#Image">Image</a> from <a href="SkPixmap_Reference#Pixmap">Pixmap</a> and copied pixels. |
| <a href="#SkImage_MakeRasterData">MakeRasterData</a> | Creates <a href="#Image">Image</a> from <a href="#Info">Image Info</a> and shared pixels. |
-| <a href="#SkImage_alphaType">alphaType</a> | Returns <a href="#Alpha_Type">Alpha Type</a> |
-| <a href="#SkImage_asLegacyBitmap">asLegacyBitmap</a> | Returns as <a href="undocumented#Raster_Bitmap">Raster Bitmap</a> |
+| <a href="#SkImage_alphaType">alphaType</a> | Returns <a href="#Alpha_Type">Alpha Type</a>. |
+| <a href="#SkImage_asLegacyBitmap">asLegacyBitmap</a> | Returns as <a href="undocumented#Raster_Bitmap">Raster Bitmap</a>. |
| <a href="#SkImage_bounds">bounds</a> | Returns <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> as Rectangle. |
| <a href="#SkImage_colorSpace">colorSpace</a> | Returns <a href="undocumented#Color_Space">Color Space</a>. |
| <a href="#SkImage_dimensions">dimensions</a> | Returns <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a>. |
| <a href="#SkImage_encodeToData">encodeToData</a> | Returns encoded <a href="#Image">Image</a> as <a href="undocumented#SkData">SkData</a>. |
+| <a href="#SkImage_getDeferredTextureImageData">getDeferredTextureImageData</a> | |
| <a href="#SkImage_getTexture">getTexture</a> | Deprecated. |
| <a href="#SkImage_getTextureHandle">getTextureHandle</a> | Returns <a href="undocumented#GPU">GPU</a> reference to <a href="#Image">Image</a> as texture. |
| <a href="#SkImage_height">height</a> | Returns pixel row count. |
| <a href="#SkImage_isAlphaOnly">isAlphaOnly</a> | Returns if pixels represent a transparency mask. |
| <a href="#SkImage_isLazyGenerated">isLazyGenerated</a> | Returns if <a href="#Image">Image</a> is created as needed. |
| <a href="#SkImage_isOpaque">isOpaque</a> | Returns if <a href="#Alpha_Type">Alpha Type</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>. |
-| <a href="#SkImage_isTextureBacked">isTextureBacked</a> | Returns if <a href="#Image">Image</a> was created from <a href="undocumented#GPU">GPU</a> texture. |
+| <a href="#SkImage_isTextureBacked">isTextureBacked</a> | Returns if <a href="#Image">Image</a> was created from <a href="undocumented#GPU_Texture">GPU Texture</a>. |
| <a href="#SkImage_isValid">isValid</a> | Returns if <a href="#Image">Image</a> can draw to <a href="undocumented#Raster_Surface">Raster Surface</a> or <a href="undocumented#GPU_Context">GPU Context</a>. |
| <a href="#SkImage_makeColorSpace">makeColorSpace</a> | Creates <a href="#Image">Image</a> matching <a href="undocumented#Color_Space">Color Space</a> if possible. |
-| <a href="#SkImage_makeNonTextureImage">makeNonTextureImage</a> | Creates <a href="undocumented#Raster_Image">Raster Image</a> if possible. |
+| <a href="#SkImage_makeNonTextureImage">makeNonTextureImage</a> | Creates <a href="#Image">Image</a> without dependency on <a href="undocumented#GPU_Texture">GPU Texture</a>. |
+| <a href="#SkImage_makeRasterImage">makeRasterImage</a> | Creates <a href="#Image">Image</a> compatible with <a href="undocumented#Raster_Surface">Raster Surface</a> if possible. |
| <a href="#SkImage_makeShader">makeShader</a> | Creates <a href="undocumented#Shader">Shader</a>, <a href="SkPaint_Reference#Paint">Paint</a> element that can tile <a href="#Image">Image</a>. |
| <a href="#SkImage_makeSubset">makeSubset</a> | Creates <a href="#Image">Image</a> containing part of original. |
| <a href="#SkImage_makeTextureImage">makeTextureImage</a> | Creates <a href="#Image">Image</a> matching <a href="undocumented#Color_Space">Color Space</a> if possible. |
@@ -331,6 +354,10 @@ data of <a href="#Image">Image</a> to decode</td>
created <a href="#Image">Image</a>, or nullptr
+### Example
+
+<div><fiddle-embed name="894f732ed6409b1f392bc5481421d0e9"></fiddle-embed></div>
+
### See Also
<a href="#SkImage_MakeFromGenerator">MakeFromGenerator</a>
@@ -346,11 +373,7 @@ static sk_sp&lt;SkImage&gt; MakeFromTexture(GrContext* context, const GrBackendT
sk_sp&lt;SkColorSpace&gt; colorSpace)
</pre>
-Creates <a href="#Image">Image</a> from <a href="undocumented#GPU">GPU</a> texture associated with <a href="#SkImage_MakeFromTexture_context">context</a>. Caller is responsible for
-managing the lifetime of <a href="undocumented#GPU">GPU</a> texture.
-
-<a href="#Image">Image</a> is returned if format of <a href="#SkImage_MakeFromTexture_backendTexture">backendTexture</a> is recognized and supported.
-Recognized formats vary by <a href="undocumented#GPU">GPU</a> back-end.
+Deprecated.
### Parameters
@@ -364,7 +387,7 @@ one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>,
one of: <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>,
<a href="undocumented#SkAlphaType">kPremul SkAlphaType</a>, <a href="undocumented#SkAlphaType">kUnpremul SkAlphaType</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-range of colors</td>
+range of colors; may be nullptr</td>
</tr>
</table>
@@ -372,10 +395,6 @@ range of colors</td>
created <a href="#Image">Image</a>, or nullptr
-### Example
-
-<div><fiddle-embed name="2faa98d6a1d578010326af17ee7e4d2a" gpu="true"><div>A back-end texture has been created and uploaded to the <a href="undocumented#GPU">GPU</a> outside of this example.</div></fiddle-embed></div>
-
### See Also
<a href="#SkImage_MakeFromAdoptedTexture">MakeFromAdoptedTexture</a> <a href="#SkSurface_MakeFromBackendTexture">SkSurface::MakeFromBackendTexture</a>
@@ -390,12 +409,7 @@ static sk_sp&lt;SkImage&gt; MakeFromTexture(GrContext* context, const GrBackendT
ReleaseContext releaseContext)
</pre>
-Creates <a href="#Image">Image</a> from <a href="undocumented#GPU">GPU</a> texture associated with <a href="#SkImage_MakeFromTexture_2_context">context</a>. <a href="undocumented#GPU">GPU</a> texture must stay
-valid and unchanged until <a href="#SkImage_MakeFromTexture_2_textureReleaseProc">textureReleaseProc</a> is called. <a href="#SkImage_MakeFromTexture_2_textureReleaseProc">textureReleaseProc</a> is
-passed <a href="#SkImage_MakeFromTexture_2_releaseContext">releaseContext</a> when <a href="#Image">Image</a> is deleted or no longer refers to texture.
-
-<a href="#Image">Image</a> is returned if format of <a href="#SkImage_MakeFromTexture_2_backendTexture">backendTexture</a> is recognized and supported.
-Recognized formats vary by <a href="undocumented#GPU">GPU</a> back-end.
+Deprecated.
### Parameters
@@ -409,7 +423,7 @@ one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>,
one of: <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>,
<a href="undocumented#SkAlphaType">kPremul SkAlphaType</a>, <a href="undocumented#SkAlphaType">kUnpremul SkAlphaType</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-range of colors</td>
+range of colors; may be nullptr</td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_2_textureReleaseProc"> <code><strong>textureReleaseProc </strong></code> </a></td> <td>
function called when texture can be released</td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_2_releaseContext"> <code><strong>releaseContext </strong></code> </a></td> <td>
@@ -421,9 +435,106 @@ state passed to <a href="#SkImage_MakeFromTexture_2_textureReleaseProc">textureR
created <a href="#Image">Image</a>, or nullptr
+### See Also
+
+<a href="#SkImage_MakeFromAdoptedTexture">MakeFromAdoptedTexture</a> <a href="#SkSurface_MakeFromBackendTexture">SkSurface::MakeFromBackendTexture</a>
+
+---
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+static sk_sp&lt;SkImage&gt; MakeFromTexture(GrContext* context, const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin origin, SkColorType colorType,
+ SkAlphaType alphaType, sk_sp&lt;SkColorSpace&gt; colorSpace)
+</pre>
+
+Creates <a href="#Image">Image</a> from <a href="undocumented#GPU_Texture">GPU Texture</a> associated with <a href="#SkImage_MakeFromTexture_3_context">context</a>. Caller is responsible for
+managing the lifetime of <a href="undocumented#GPU_Texture">GPU Texture</a>.
+
+<a href="#Image">Image</a> is returned if format of <a href="#SkImage_MakeFromTexture_3_backendTexture">backendTexture</a> is recognized and supported.
+Recognized formats vary by <a href="undocumented#GPU">GPU</a> back-end.
+
+### Parameters
+
+<table> <tr> <td><a name="SkImage_MakeFromTexture_3_context"> <code><strong>context </strong></code> </a></td> <td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_3_backendTexture"> <code><strong>backendTexture </strong></code> </a></td> <td>
+texture residing on <a href="undocumented#GPU">GPU</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_3_origin"> <code><strong>origin </strong></code> </a></td> <td>
+one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_3_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
+one of: <a href="undocumented#SkColorType">kUnknown SkColorType</a>, <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>,
+<a href="undocumented#SkColorType">kRGB 565 SkColorType</a>, <a href="undocumented#SkColorType">kARGB 4444 SkColorType</a>,
+<a href="undocumented#SkColorType">kRGBA 8888 SkColorType</a>, <a href="undocumented#SkColorType">kBGRA 8888 SkColorType</a>,
+<a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="undocumented#SkColorType">kRGBA F16 SkColorType</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_3_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
+one of: <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>,
+<a href="undocumented#SkAlphaType">kPremul SkAlphaType</a>, <a href="undocumented#SkAlphaType">kUnpremul SkAlphaType</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_3_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
+range of colors; may be nullptr</td>
+ </tr>
+</table>
+
+### Return Value
+
+created <a href="#Image">Image</a>, or nullptr
+
### Example
-<div><fiddle-embed name="dea2835da4be78d1e9ab4be58010d1ad"></fiddle-embed></div>
+<div><fiddle-embed name="2faa98d6a1d578010326af17ee7e4d2a" gpu="true"><div>A back-end texture has been created and uploaded to the <a href="undocumented#GPU">GPU</a> outside of this example.</div></fiddle-embed></div>
+
+### See Also
+
+<a href="#SkImage_MakeFromAdoptedTexture">MakeFromAdoptedTexture</a> <a href="#SkSurface_MakeFromBackendTexture">SkSurface::MakeFromBackendTexture</a>
+
+---
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+static sk_sp&lt;SkImage&gt; MakeFromTexture(GrContext* context, const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin origin, SkColorType colorType,
+ SkAlphaType alphaType, sk_sp&lt;SkColorSpace&gt; colorSpace,
+ TextureReleaseProc textureReleaseProc,
+ ReleaseContext releaseContext)
+</pre>
+
+Creates <a href="#Image">Image</a> from <a href="undocumented#GPU_Texture">GPU Texture</a> associated with <a href="#SkImage_MakeFromTexture_4_context">context</a>. <a href="undocumented#GPU_Texture">GPU Texture</a> must stay
+valid and unchanged until <a href="#SkImage_MakeFromTexture_4_textureReleaseProc">textureReleaseProc</a> is called. <a href="#SkImage_MakeFromTexture_4_textureReleaseProc">textureReleaseProc</a> is
+passed <a href="#SkImage_MakeFromTexture_4_releaseContext">releaseContext</a> when <a href="#Image">Image</a> is deleted or no longer refers to texture.
+
+<a href="#Image">Image</a> is returned if format of <a href="#SkImage_MakeFromTexture_4_backendTexture">backendTexture</a> is recognized and supported.
+Recognized formats vary by <a href="undocumented#GPU">GPU</a> back-end.
+
+### Parameters
+
+<table> <tr> <td><a name="SkImage_MakeFromTexture_4_context"> <code><strong>context </strong></code> </a></td> <td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_4_backendTexture"> <code><strong>backendTexture </strong></code> </a></td> <td>
+texture residing on <a href="undocumented#GPU">GPU</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_4_origin"> <code><strong>origin </strong></code> </a></td> <td>
+one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_4_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
+one of: <a href="undocumented#SkColorType">kUnknown SkColorType</a>, <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>,
+<a href="undocumented#SkColorType">kRGB 565 SkColorType</a>, <a href="undocumented#SkColorType">kARGB 4444 SkColorType</a>,
+<a href="undocumented#SkColorType">kRGBA 8888 SkColorType</a>, <a href="undocumented#SkColorType">kBGRA 8888 SkColorType</a>,
+<a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="undocumented#SkColorType">kRGBA F16 SkColorType</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_4_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
+one of: <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>,
+<a href="undocumented#SkAlphaType">kPremul SkAlphaType</a>, <a href="undocumented#SkAlphaType">kUnpremul SkAlphaType</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_4_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
+range of colors; may be nullptr</td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_4_textureReleaseProc"> <code><strong>textureReleaseProc </strong></code> </a></td> <td>
+function called when texture can be released</td>
+ </tr> <tr> <td><a name="SkImage_MakeFromTexture_4_releaseContext"> <code><strong>releaseContext </strong></code> </a></td> <td>
+state passed to <a href="#SkImage_MakeFromTexture_4_textureReleaseProc">textureReleaseProc</a></td>
+ </tr>
+</table>
+
+### Return Value
+
+created <a href="#Image">Image</a>, or nullptr
+
+### Example
+
+<div><fiddle-embed name="6a50c3cb961c23ad9ecbd5caedac0d70"></fiddle-embed></div>
### See Also
@@ -454,6 +565,9 @@ asynchronously.
<a href="#Image">Image</a> is returned if format of <a href="#SkImage_MakeCrossContextFromEncoded_data">data</a> is recognized and supported, and if <a href="#SkImage_MakeCrossContextFromEncoded_context">context</a>
supports moving resources. Recognized formats vary by platform and <a href="undocumented#GPU">GPU</a> back-end.
+<a href="#Image">Image</a> is returned using <a href="#SkImage_MakeFromEncoded">MakeFromEncoded</a> if <a href="#SkImage_MakeCrossContextFromEncoded_context">context</a> is nullptr or does not support
+moving resources between contexts.
+
### Parameters
<table> <tr> <td><a name="SkImage_MakeCrossContextFromEncoded_context"> <code><strong>context </strong></code> </a></td> <td>
@@ -473,7 +587,7 @@ created <a href="#Image">Image</a>, or nullptr
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="90202d8b1df605fdb0c84f2c351f9598"></fiddle-embed></div>
### See Also
@@ -501,10 +615,11 @@ asynchronously.
<a href="undocumented#Texture">Texture</a> created from <a href="#SkImage_MakeCrossContextFromPixmap_pixmap">pixmap</a> is uploaded to match <a href="SkSurface_Reference#Surface">Surface</a> created with
<a href="#SkImage_MakeCrossContextFromPixmap_dstColorSpace">dstColorSpace</a>. <a href="undocumented#Color_Space">Color Space</a> of <a href="#Image">Image</a> is determined by <a href="#SkImage_MakeCrossContextFromPixmap_pixmap">pixmap</a>.<a href="#SkImage_colorSpace">colorSpace</a>.
-<a href="#Image">Image</a> is returned referring to <a href="undocumented#GPU">GPU</a> back-end if format of data is recognized and
-supported, and if <a href="#SkImage_MakeCrossContextFromPixmap_context">context</a> supports moving resources. Otherwise, <a href="#SkImage_MakeCrossContextFromPixmap_pixmap">pixmap</a> pixel
-data is copied and <a href="#Image">Image</a> as returned in raster format if possible; nullptr may
-be returned. Recognized <a href="undocumented#GPU">GPU</a> formats vary by platform and <a href="undocumented#GPU">GPU</a> back-end.
+<a href="#Image">Image</a> is returned referring to <a href="undocumented#GPU">GPU</a> back-end if <a href="#SkImage_MakeCrossContextFromPixmap_context">context</a> is not nullptr,
+format of data is recognized and supported, and if <a href="#SkImage_MakeCrossContextFromPixmap_context">context</a> supports moving
+resources between contexts. Otherwise, <a href="#SkImage_MakeCrossContextFromPixmap_pixmap">pixmap</a> pixel data is copied and <a href="#Image">Image</a>
+as returned in raster format if possible; nullptr may be returned.
+Recognized <a href="undocumented#GPU">GPU</a> formats vary by platform and <a href="undocumented#GPU">GPU</a> back-end.
### Parameters
@@ -525,7 +640,7 @@ created <a href="#Image">Image</a>, or nullptr
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="bb37de3dc4a0c53d48cdfafb90b9b18e"></fiddle-embed></div>
### See Also
@@ -544,11 +659,7 @@ static sk_sp&lt;SkImage&gt; MakeFromAdoptedTexture(GrContext* context,
sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
</pre>
-Creates <a href="#Image">Image</a> from <a href="#SkImage_MakeFromAdoptedTexture_backendTexture">backendTexture</a> associated with <a href="#SkImage_MakeFromAdoptedTexture_context">context</a>. <a href="#SkImage_MakeFromAdoptedTexture_backendTexture">backendTexture</a> and
-returned <a href="#Image">Image</a> are managed internally, and are released when no longer needed.
-
-<a href="#Image">Image</a> is returned if format of <a href="#SkImage_MakeFromAdoptedTexture_backendTexture">backendTexture</a> is recognized and supported.
-Recognized formats vary by <a href="undocumented#GPU">GPU</a> back-end.
+Deprecated.
### Parameters
@@ -562,7 +673,52 @@ one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>,
one of: <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>,
<a href="undocumented#SkAlphaType">kPremul SkAlphaType</a>, <a href="undocumented#SkAlphaType">kUnpremul SkAlphaType</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-range of colors</td>
+range of colors; may be nullptr</td>
+ </tr>
+</table>
+
+### Return Value
+
+created <a href="#Image">Image</a>, or nullptr
+
+### See Also
+
+<a href="#SkImage_MakeFromTexture">MakeFromTexture</a> <a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy</a>
+
+---
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+static sk_sp&lt;SkImage&gt; MakeFromAdoptedTexture(GrContext* context,
+ const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin surfaceOrigin, SkColorType colorType,
+ SkAlphaType alphaType = kPremul_SkAlphaType,
+ sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
+</pre>
+
+Creates <a href="#Image">Image</a> from <a href="#SkImage_MakeFromAdoptedTexture_2_backendTexture">backendTexture</a> associated with <a href="#SkImage_MakeFromAdoptedTexture_2_context">context</a>. <a href="#SkImage_MakeFromAdoptedTexture_2_backendTexture">backendTexture</a> and
+returned <a href="#Image">Image</a> are managed internally, and are released when no longer needed.
+
+<a href="#Image">Image</a> is returned if format of <a href="#SkImage_MakeFromAdoptedTexture_2_backendTexture">backendTexture</a> is recognized and supported.
+Recognized formats vary by <a href="undocumented#GPU">GPU</a> back-end.
+
+### Parameters
+
+<table> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_context"> <code><strong>context </strong></code> </a></td> <td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_backendTexture"> <code><strong>backendTexture </strong></code> </a></td> <td>
+texture residing on <a href="undocumented#GPU">GPU</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
+one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
+one of: <a href="undocumented#SkColorType">kUnknown SkColorType</a>, <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>,
+<a href="undocumented#SkColorType">kRGB 565 SkColorType</a>, <a href="undocumented#SkColorType">kARGB 4444 SkColorType</a>,
+<a href="undocumented#SkColorType">kRGBA 8888 SkColorType</a>, <a href="undocumented#SkColorType">kBGRA 8888 SkColorType</a>,
+<a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="undocumented#SkColorType">kRGBA F16 SkColorType</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
+one of: <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>,
+<a href="undocumented#SkAlphaType">kPremul SkAlphaType</a>, <a href="undocumented#SkAlphaType">kUnpremul SkAlphaType</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
+range of colors; may be nullptr</td>
</tr>
</table>
@@ -572,11 +728,11 @@ created <a href="#Image">Image</a>, or nullptr
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="aed9b621fdc2135d512b58648d064224"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImage_MakeFromTexture">MakeFromTexture</a> <a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy</a>
---
@@ -591,38 +747,79 @@ static sk_sp&lt;SkImage&gt; MakeFromYUVTexturesCopy(GrContext* context, SkYUVCol
sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
</pre>
-Create a new image by copying the pixels from the specified y, u, v textures. The data
-from the textures is immediately ingested into the image and the textures can be modified or
-deleted after the function returns. The image will have the <a href="#SkImage_dimensions">dimensions</a> of the y texture.
+Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromYUVTexturesCopy_yuvTextureHandles">yuvTextureHandles</a>, an array of textures on <a href="undocumented#GPU">GPU</a>.
+<a href="#SkImage_MakeFromYUVTexturesCopy_yuvTextureHandles">yuvTextureHandles</a> contain pixels for <a href="undocumented#YUV">YUV</a> planes of <a href="#Image">Image</a>.
+<a href="#SkImage_MakeFromYUVTexturesCopy_yuvSizes">yuvSizes</a> conain <a href="#SkImage_dimensions">dimensions</a> for each pixel plane. Dimensions must be greater than
+zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has the <a href="#SkImage_dimensions">dimensions</a>
+<a href="#SkImage_MakeFromYUVTexturesCopy_yuvSizes">yuvSizes</a>[0]. <a href="#SkImage_MakeFromYUVTexturesCopy_yuvColorSpace">yuvColorSpace</a> describes how <a href="undocumented#YUV">YUV</a> colors convert to <a href="undocumented#RGB">RGB</a> colors.
### Parameters
<table> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_context"> <code><strong>context </strong></code> </a></td> <td>
-incomplete</td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_yuvColorSpace"> <code><strong>yuvColorSpace </strong></code> </a></td> <td>
-incomplete</td>
+one of: <a href="undocumented#YUV_ColorSpace">kJPEG SkYUVColorSpace</a>, <a href="undocumented#YUV_ColorSpace">kRec601 SkYUVColorSpace</a>,
+<a href="undocumented#YUV_ColorSpace">kRec709 SkYUVColorSpace</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_yuvTextureHandles"> <code><strong>yuvTextureHandles </strong></code> </a></td> <td>
-incomplete</td>
+array of <a href="undocumented#YUV">YUV</a> textures on <a href="undocumented#GPU">GPU</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_yuvSizes"> <code><strong>yuvSizes </strong></code> </a></td> <td>
-incomplete</td>
+<a href="#SkImage_dimensions">dimensions</a> of <a href="undocumented#YUV">YUV</a> textures</td>
</tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
-incomplete</td>
+one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-incomplete</td>
+range of colors; may be nullptr</td>
</tr>
</table>
### Return Value
-incomplete
+created <a href="#Image">Image</a>, or nullptr
-### Example
+### See Also
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy</a>
+
+---
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+static sk_sp&lt;SkImage&gt; MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
+ const GrBackendTexture yuvTextureHandles[3],
+ const SkISize yuvSizes[3],
+ GrSurfaceOrigin surfaceOrigin,
+ sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
+</pre>
+
+Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvTextureHandles">yuvTextureHandles</a>, an array of textures on <a href="undocumented#GPU">GPU</a>.
+<a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvTextureHandles">yuvTextureHandles</a> contain pixels for <a href="undocumented#YUV">YUV</a> planes of <a href="#Image">Image</a>.
+<a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvSizes">yuvSizes</a> conain <a href="#SkImage_dimensions">dimensions</a> for each pixel plane. Dimensions must be greater than
+zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has the <a href="#SkImage_dimensions">dimensions</a>
+<a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvSizes">yuvSizes</a>[0]. <a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvColorSpace">yuvColorSpace</a> describes how <a href="undocumented#YUV">YUV</a> colors convert to <a href="undocumented#RGB">RGB</a> colors.
+
+### Parameters
+
+<table> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_context"> <code><strong>context </strong></code> </a></td> <td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_yuvColorSpace"> <code><strong>yuvColorSpace </strong></code> </a></td> <td>
+one of: <a href="undocumented#YUV_ColorSpace">kJPEG SkYUVColorSpace</a>, <a href="undocumented#YUV_ColorSpace">kRec601 SkYUVColorSpace</a>,
+<a href="undocumented#YUV_ColorSpace">kRec709 SkYUVColorSpace</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_yuvTextureHandles"> <code><strong>yuvTextureHandles </strong></code> </a></td> <td>
+array of <a href="undocumented#YUV">YUV</a> textures on <a href="undocumented#GPU">GPU</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_yuvSizes"> <code><strong>yuvSizes </strong></code> </a></td> <td>
+<a href="#SkImage_dimensions">dimensions</a> of <a href="undocumented#YUV">YUV</a> textures</td>
+ </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
+one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
+range of colors; may be nullptr</td>
+ </tr>
+</table>
+
+### Return Value
+
+created <a href="#Image">Image</a>, or nullptr
### See Also
-incomplete
+<a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy</a>
---
@@ -637,45 +834,90 @@ static sk_sp&lt;SkImage&gt; MakeFromNV12TexturesCopy(GrContext* context, SkYUVCo
sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
</pre>
-Create a new image by copying the pixels from the specified y and <a href="undocumented#UV_Mapping">UV Mapping</a>. The data
-from the textures is immediately ingested into the image and the textures can be modified or
-deleted after the function returns. The image will have the <a href="#SkImage_dimensions">dimensions</a> of the y texture.
+Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromNV12TexturesCopy_nv12TextureHandles">nv12TextureHandles</a>, an array of textures on <a href="undocumented#GPU">GPU</a>.
+<a href="#SkImage_MakeFromNV12TexturesCopy_nv12TextureHandles">nv12TextureHandles</a>[0] contains pixels for <a href="undocumented#YUV_Component_Y">YUV Component Y</a> plane.
+<a href="#SkImage_MakeFromNV12TexturesCopy_nv12TextureHandles">nv12TextureHandles</a>[1] contains pixels for <a href="undocumented#YUV_Component_U">YUV Component U</a> plane,
+followed by pixels for <a href="undocumented#YUV_Component_V">YUV Component V</a> plane.
+<a href="#SkImage_MakeFromNV12TexturesCopy_nv12Sizes">nv12Sizes</a> conain <a href="#SkImage_dimensions">dimensions</a> for each pixel plane. Dimensions must be greater than
+zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has the <a href="#SkImage_dimensions">dimensions</a>
+<a href="#SkImage_MakeFromNV12TexturesCopy_nv12Sizes">nv12Sizes</a>[0]. <a href="#SkImage_MakeFromNV12TexturesCopy_yuvColorSpace">yuvColorSpace</a> describes how <a href="undocumented#YUV">YUV</a> colors convert to <a href="undocumented#RGB">RGB</a> colors.
### Parameters
<table> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_context"> <code><strong>context </strong></code> </a></td> <td>
-incomplete</td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_yuvColorSpace"> <code><strong>yuvColorSpace </strong></code> </a></td> <td>
-incomplete</td>
+one of: <a href="undocumented#YUV_ColorSpace">kJPEG SkYUVColorSpace</a>, <a href="undocumented#YUV_ColorSpace">kRec601 SkYUVColorSpace</a>,
+<a href="undocumented#YUV_ColorSpace">kRec709 SkYUVColorSpace</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_nv12TextureHandles"> <code><strong>nv12TextureHandles </strong></code> </a></td> <td>
-incomplete</td>
+array of <a href="undocumented#YUV">YUV</a> textures on <a href="undocumented#GPU">GPU</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_nv12Sizes"> <code><strong>nv12Sizes </strong></code> </a></td> <td>
-incomplete</td>
+<a href="#SkImage_dimensions">dimensions</a> of <a href="undocumented#YUV">YUV</a> textures</td>
</tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
-incomplete</td>
+one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-incomplete</td>
+range of colors; may be nullptr</td>
</tr>
</table>
### Return Value
-incomplete
+created <a href="#Image">Image</a>, or nullptr
-### Example
+### See Also
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy</a>
+
+---
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+static sk_sp&lt;SkImage&gt; MakeFromNV12TexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
+ const GrBackendTexture nv12TextureHandles[2],
+ const SkISize nv12Sizes[2],
+ GrSurfaceOrigin surfaceOrigin,
+ sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
+</pre>
+
+Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12TextureHandles">nv12TextureHandles</a>, an array of textures on <a href="undocumented#GPU">GPU</a>.
+<a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12TextureHandles">nv12TextureHandles</a>[0] contains pixels for <a href="undocumented#YUV_Component_Y">YUV Component Y</a> plane.
+<a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12TextureHandles">nv12TextureHandles</a>[1] contains pixels for <a href="undocumented#YUV_Component_U">YUV Component U</a> plane,
+followed by pixels for <a href="undocumented#YUV_Component_V">YUV Component V</a> plane.
+<a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12Sizes">nv12Sizes</a> conain <a href="#SkImage_dimensions">dimensions</a> for each pixel plane. Dimensions must be greater than
+zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has the <a href="#SkImage_dimensions">dimensions</a>
+<a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12Sizes">nv12Sizes</a>[0]. <a href="#SkImage_MakeFromNV12TexturesCopy_2_yuvColorSpace">yuvColorSpace</a> describes how <a href="undocumented#YUV">YUV</a> colors convert to <a href="undocumented#RGB">RGB</a> colors.
+
+### Parameters
+
+<table> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_context"> <code><strong>context </strong></code> </a></td> <td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_yuvColorSpace"> <code><strong>yuvColorSpace </strong></code> </a></td> <td>
+one of: <a href="undocumented#YUV_ColorSpace">kJPEG SkYUVColorSpace</a>, <a href="undocumented#YUV_ColorSpace">kRec601 SkYUVColorSpace</a>,
+<a href="undocumented#YUV_ColorSpace">kRec709 SkYUVColorSpace</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_nv12TextureHandles"> <code><strong>nv12TextureHandles </strong></code> </a></td> <td>
+array of <a href="undocumented#YUV">YUV</a> textures on <a href="undocumented#GPU">GPU</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_nv12Sizes"> <code><strong>nv12Sizes </strong></code> </a></td> <td>
+<a href="#SkImage_dimensions">dimensions</a> of <a href="undocumented#YUV">YUV</a> textures</td>
+ </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
+one of: <a href="undocumented#GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
+range of colors; may be nullptr</td>
+ </tr>
+</table>
+
+### Return Value
+
+created <a href="#Image">Image</a>, or nullptr
### See Also
-incomplete
+<a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy</a>
---
## <a name="SkImage_BitDepth"></a> Enum SkImage::BitDepth
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
-enum <a href="#SkImage_BitDepth">BitDepth</a> {
+enum class <a href="#SkImage_BitDepth">BitDepth</a> {
<a href="#SkImage_kU8">kU8</a>,
<a href="#SkImage_kF16">kF16</a>,
};</pre>
@@ -684,20 +926,16 @@ enum <a href="#SkImage_BitDepth">BitDepth</a> {
<table>
<tr>
- <td><a name="SkImage_kU8"> <code><strong>SkImage::kU8 </strong></code> </a></td><td>0</td><td></td>
+ <td><a name="SkImage_kU8"> <code><strong>SkImage::kU8 </strong></code> </a></td><td>0</td><td>Use 8 bits per <a href="#ARGB">Color ARGB</a> component using unsigned integer format.</td>
</tr>
<tr>
- <td><a name="SkImage_kF16"> <code><strong>SkImage::kF16 </strong></code> </a></td><td>1</td><td></td>
+ <td><a name="SkImage_kF16"> <code><strong>SkImage::kF16 </strong></code> </a></td><td>1</td><td>Use 16 bits per <a href="#ARGB">Color ARGB</a> component using half-precision floating point format.</td>
</tr>
</table>
-### Example
-
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
-
### See Also
-incomplete
+<a href="#SkImage_MakeFromPicture">MakeFromPicture</a>
@@ -710,37 +948,40 @@ static sk_sp&lt;SkImage&gt; MakeFromPicture(sk_sp&lt;SkPicture&gt; picture, cons
BitDepth bitDepth, sk_sp&lt;SkColorSpace&gt; colorSpace)
</pre>
-Create a new image from the specified <a href="#SkImage_MakeFromPicture_picture">picture</a>.
-On creation of the <a href="#SkImage">SkImage</a>, snap the <a href="undocumented#SkPicture">SkPicture</a> to a particular <a href="#SkImage_BitDepth">BitDepth</a> and <a href="undocumented#SkColorSpace">SkColorSpace</a>.
+Creates <a href="#Image">Image</a> from <a href="#SkImage_MakeFromPicture_picture">picture</a>. Returned <a href="#Image">Image</a> <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> are set by <a href="#SkImage_dimensions">dimensions</a>.
+<a href="#Image">Image</a> draws <a href="#SkImage_MakeFromPicture_picture">picture</a> with <a href="#SkImage_MakeFromPicture_matrix">matrix</a> and <a href="#SkImage_MakeFromPicture_paint">paint</a>, set to <a href="#SkImage_MakeFromPicture_bitDepth">bitDepth</a> and <a href="#SkImage_colorSpace">colorSpace</a>.
+
+If <a href="#SkImage_MakeFromPicture_matrix">matrix</a> is nullptr, draws with identity <a href="SkMatrix_Reference#Matrix">Matrix</a>. If <a href="#SkImage_MakeFromPicture_paint">paint</a> is nullptr, draws
+with default <a href="SkPaint_Reference#Paint">Paint</a>. <a href="#SkImage_colorSpace">colorSpace</a> may be nullptr.
### Parameters
<table> <tr> <td><a name="SkImage_MakeFromPicture_picture"> <code><strong>picture </strong></code> </a></td> <td>
-incomplete</td>
+stream of drawing commands</td>
</tr> <tr> <td><a name="SkImage_MakeFromPicture_dimensions"> <code><strong>dimensions </strong></code> </a></td> <td>
-incomplete</td>
+<a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromPicture_matrix"> <code><strong>matrix </strong></code> </a></td> <td>
-incomplete</td>
+<a href="SkMatrix_Reference#Matrix">Matrix</a> to rotate, scale, translate, and so on; may be nullptr</td>
</tr> <tr> <td><a name="SkImage_MakeFromPicture_paint"> <code><strong>paint </strong></code> </a></td> <td>
-incomplete</td>
+<a href="SkPaint_Reference#Paint">Paint</a> to apply transparency, filtering, and so on; may be nullptr</td>
</tr> <tr> <td><a name="SkImage_MakeFromPicture_bitDepth"> <code><strong>bitDepth </strong></code> </a></td> <td>
-incomplete</td>
+8 bit integer or 16 bit float: per component</td>
</tr> <tr> <td><a name="SkImage_MakeFromPicture_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-incomplete</td>
+range of colors; may be nullptr</td>
</tr>
</table>
### Return Value
-incomplete
+created <a href="#Image">Image</a>, or nullptr
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="4aa2879b9e44dfd6648995326d2c4dcf"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkCanvas_drawPicture">SkCanvas::drawPicture</a>
---
@@ -753,67 +994,30 @@ static sk_sp&lt;SkImage&gt; MakeFromAHardwareBuffer(AHardwareBuffer* hardwareBuf
sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
</pre>
-Create a new image from the an <a href="undocumented#Android">Android</a> hardware buffer.
-The new image takes a reference on the buffer.
+Creates <a href="#Image">Image</a> from <a href="undocumented#Android">Android</a> hardware buffer.
+Returned <a href="#Image">Image</a> takes a reference on the buffer.
Only available on <a href="undocumented#Android">Android</a>, when __<a href="undocumented#ANDROID_API__">ANDROID API </a> is defined to be 26 or greater.
### Parameters
<table> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_hardwareBuffer"> <code><strong>hardwareBuffer </strong></code> </a></td> <td>
-incomplete</td>
+<a href="undocumented#AHardwareBuffer">AHardwareBuffer</a> <a href="undocumented#Android">Android</a> hardware buffer</td>
</tr> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
-incomplete</td>
+one of: <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>,
+<a href="undocumented#SkAlphaType">kPremul SkAlphaType</a>, <a href="undocumented#SkAlphaType">kUnpremul SkAlphaType</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-incomplete</td>
- </tr>
-</table>
-
-### Return Value
-
-incomplete
-
-### Example
-
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
-
-### See Also
-
-incomplete
-
----
-
-<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
-static sk_sp&lt;SkImage&gt; MakeFromAHardwareBuffer(AHardwareBuffer* hardwareBuffer,
- SkAlphaType alphaType = kPremul_SkAlphaType,
- sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
-</pre>
-
-Create a new image from the an <a href="undocumented#Android">Android</a> hardware buffer.
-The new image takes a reference on the buffer.
-
-### Parameters
-
-<table> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_2_hardwareBuffer"> <code><strong>hardwareBuffer </strong></code> </a></td> <td>
-incomplete</td>
- </tr> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_2_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
-incomplete</td>
- </tr> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-incomplete</td>
+range of colors; may be nullptr</td>
</tr>
</table>
### Return Value
-incomplete
-
-### Example
-
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+created <a href="#Image">Image</a>, or nullptr
### See Also
-incomplete
+<a href="#SkImage_MakeFromRaster">MakeFromRaster</a>
---
@@ -824,17 +1028,19 @@ incomplete
int width() const
</pre>
+Returns pixel count in each row.
+
### Return Value
-incomplete
+pixel <a href="#SkImage_width">width</a> in <a href="#Image">Image</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="4fa6c18eb829d8979cfdbbf6f42e4c97"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImage_dimensions">dimensions</a> <a href="#SkImage_height">height</a>
---
@@ -849,15 +1055,15 @@ Returns pixel row count.
### Return Value
-incomplete
+pixel <a href="#SkImage_height">height</a> in <a href="#Image">Image</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="96c8202a13068e36432006f75b124eee"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImage_dimensions">dimensions</a> <a href="#SkImage_width">width</a>
---
@@ -876,11 +1082,11 @@ integral size of <a href="#SkImage_width">width</a> and <a href="#SkImage_height
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="96b4bc43b3667df9ba9e2dafb770d33c"></fiddle-embed></div>
### See Also
-<a href="#SkImage_height">height</a> <a href="#SkImage_width">width</a>
+<a href="#SkImage_height">height</a> <a href="#SkImage_width">width</a> <a href="#SkImage_bounds">bounds</a>
---
@@ -899,11 +1105,11 @@ integral rectangle from origin to <a href="#SkImage_width">width</a> and <a href
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="a6617b5d3066aadce2c37ed2184d6098"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImage_dimensions">dimensions</a>
---
@@ -914,17 +1120,21 @@ incomplete
uint32_t uniqueID() const
</pre>
+Returns value unique to image. <a href="#Image">Image</a> contents cannot change after <a href="#Image">Image</a> is
+created. Any operation to create a new <a href="#Image">Image</a> will receive generate a new
+unique number.
+
### Return Value
-incomplete
+unique identifier
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="d70194c9c51e700335f95de91846d023"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImage_isLazyGenerated">isLazyGenerated</a>
---
@@ -935,17 +1145,23 @@ incomplete
SkAlphaType alphaType() const
</pre>
+Returns <a href="#Alpha_Type">Alpha Type</a>, one of: <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>,
+<a href="undocumented#SkAlphaType">kPremul SkAlphaType</a>, <a href="undocumented#SkAlphaType">kUnpremul SkAlphaType</a>.
+
+<a href="#Alpha_Type">Alpha Type</a> returned was a parameter to an <a href="#Image">Image</a> constructor,
+or was parsed from encoded data.
+
### Return Value
-incomplete
+<a href="#Alpha_Type">Alpha Type</a> in <a href="#Image">Image</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="1c8b8588dbbb1d5df72ee9164ae0aab0"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_alphaType">SkImageInfo::alphaType</a>
---
@@ -1190,7 +1406,7 @@ generator-backed images may be invalid for <a href="undocumented#CPU">CPU</a> an
### Parameters
<table> <tr> <td><a name="SkImage_isValid_context"> <code><strong>context </strong></code> </a></td> <td>
-incomplete</td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
</tr>
</table>
@@ -1437,27 +1653,16 @@ incomplete
---
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
-sk_sp&lt;SkData&gt; encodeToData(SkPixelSerializer* pixelSerializer = nullptr) const
+sk_sp&lt;SkData&gt; encodeToData() const
</pre>
Encodes <a href="#Image">Image</a> and returns result as <a href="undocumented#SkData">SkData</a>. Will reuse existing encoded data
-if present, as returned by <a href="#SkImage_refEncodedData">refEncodedData</a>. <a href="#SkImage_encodeToData_2_pixelSerializer">pixelSerializer</a> validates existing
-encoded data, and encodes <a href="#Image">Image</a> when existing encoded data is missing or
-invalid.
-
-Passing nullptr for <a href="#SkImage_encodeToData_2_pixelSerializer">pixelSerializer</a> selects default serialization which
-accepts all data and encodes to PNG.
+if present, as returned by <a href="#SkImage_refEncodedData">refEncodedData</a>. If encoded data is missing or invalid,
+<a href="#Image">Image</a> is encoded as <a href="undocumented#PNG">PNG</a>.
Returns nullptr if existing encoded data is missing or invalid and
encoding fails.
-### Parameters
-
-<table> <tr> <td><a name="SkImage_encodeToData_2_pixelSerializer"> <code><strong>pixelSerializer </strong></code> </a></td> <td>
-incomplete</td>
- </tr>
-</table>
-
### Return Value
incomplete
@@ -1479,7 +1684,7 @@ incomplete
sk_sp&lt;SkData&gt; refEncodedData() const
</pre>
-If the image already has its contents in encoded form (e.g. PNG or JPEG), return that
+If the image already has its contents in encoded form (e.g. <a href="undocumented#PNG">PNG</a> or <a href="undocumented#JPEG">JPEG</a>), return that
as <a href="undocumented#SkData">SkData</a>. If the image does not already has its contents in encoded form, return nullptr.
To force the image to return its contents as encoded data, call <a href="#SkImage_encodeToData">encodeToData</a>.
@@ -1574,7 +1779,7 @@ different <a href="undocumented#GrContext">GrContext</a>, this will fail.
### Parameters
<table> <tr> <td><a name="SkImage_makeTextureImage_context"> <code><strong>context </strong></code> </a></td> <td>
-incomplete</td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
</tr> <tr> <td><a name="SkImage_makeTextureImage_dstColorSpace"> <code><strong>dstColorSpace </strong></code> </a></td> <td>
incomplete</td>
</tr>
@@ -1601,6 +1806,30 @@ incomplete
sk_sp&lt;SkImage&gt; makeNonTextureImage() const
</pre>
+Creates raster <a href="#Image">Image</a> if <a href="#Image">Image</a> contains <a href="undocumented#GPU_Texture">GPU Texture</a> and raster <a href="#Image">Image</a> , this will make a raster copy of it (or nullptr if reading back
+the pixels fails). Otherwise, it returns the original image.
+
+### Return Value
+
+incomplete
+
+### Example
+
+<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+
+### See Also
+
+incomplete
+
+---
+
+<a name="SkImage_makeRasterImage"></a>
+## makeRasterImage
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+sk_sp&lt;SkImage&gt; makeRasterImage() const
+</pre>
+
If the image is texture-backed this will make a raster copy of it (or nullptr if reading back
the pixels fails). Otherwise, it returns the original image.
@@ -1665,6 +1894,170 @@ incomplete
---
+# <a name="SkImage_DeferredTextureImageUsageParams"></a> Struct SkImage::DeferredTextureImageUsageParams
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+struct <a href="#SkImage_DeferredTextureImageUsageParams_DeferredTextureImageUsageParams">DeferredTextureImageUsageParams</a> {
+<a href="#SkImage_DeferredTextureImageUsageParams_DeferredTextureImageUsageParams">DeferredTextureImageUsageParams(const SkMatrix matrix, const SkFilterQuality quality,
+int preScaleMipLevel)</a>;
+<a href="SkMatrix_Reference#SkMatrix">SkMatrix</a> <a href="#SkImage_DeferredTextureImageUsageParams_fMatrix">fMatrix</a>;
+<a href="undocumented#SkFilterQuality">SkFilterQuality</a> <a href="#SkImage_DeferredTextureImageUsageParams_fQuality">fQuality</a>;
+int <a href="#SkImage_DeferredTextureImageUsageParams_fPreScaleMipLevel">fPreScaleMipLevel</a>;
+};</pre>
+
+<a name="SkImage_DeferredTextureImageUsageParams_fMatrix"> <code><strong>SkMatrix fMatrix</strong></code> </a>
+
+<a name="SkImage_DeferredTextureImageUsageParams_fQuality"> <code><strong>SkFilterQuality fQuality</strong></code> </a>
+
+<a name="SkImage_DeferredTextureImageUsageParams_fPreScaleMipLevel"> <code><strong>int fPreScaleMipLevel</strong></code> </a>
+
+<a name="SkImage_DeferredTextureImageUsageParams_DeferredTextureImageUsageParams"></a>
+## DeferredTextureImageUsageParams
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+DeferredTextureImageUsageParams(const SkMatrix matrix, const SkFilterQuality quality,
+ int preScaleMipLevel)
+</pre>
+
+### Parameters
+
+<table> <tr> <td><a name="SkImage_DeferredTextureImageUsageParams_DeferredTextureImageUsageParams_matrix"> <code><strong>matrix </strong></code> </a></td> <td>
+incomplete</td>
+ </tr> <tr> <td><a name="SkImage_DeferredTextureImageUsageParams_DeferredTextureImageUsageParams_quality"> <code><strong>quality </strong></code> </a></td> <td>
+incomplete</td>
+ </tr> <tr> <td><a name="SkImage_DeferredTextureImageUsageParams_DeferredTextureImageUsageParams_preScaleMipLevel"> <code><strong>preScaleMipLevel </strong></code> </a></td> <td>
+incomplete</td>
+ </tr>
+</table>
+
+### Return Value
+
+incomplete
+
+### Example
+
+<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+
+### See Also
+
+incomplete
+
+---
+
+### Example
+
+<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+
+### See Also
+
+incomplete
+
+<a name="SkImage_getDeferredTextureImageData"></a>
+## getDeferredTextureImageData
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+size_t getDeferredTextureImageData(const GrContextThreadSafeProxy& contextThreadSafeProxy,
+ const DeferredTextureImageUsageParams deferredTextureImageUsageParams[],
+ int paramCnt, void* buffer, SkColorSpace* dstColorSpace = nullptr,
+ SkColorType dstColorType = kN32_SkColorType) const
+</pre>
+
+This method allows clients to capture the data necessary to turn a <a href="#SkImage">SkImage</a> into a texture-
+backed image. If the original image is codec-backed this will decode into a format optimized
+for the context represented by the proxy. This method is thread safe with respect to the
+<a href="undocumented#GrContext">GrContext</a> whence the proxy came. Clients allocate and manage the storage of the deferred
+texture data and control its lifetime. No cleanup is required, thus it is safe to simply free
+the memory out from under the data.
+
+The same method is used both for getting the size necessary for pre-uploaded texture data
+and for retrieving the data. The params array represents the set of draws over which to
+optimize the pre-upload data.
+
+When called with a null <a href="#SkImage_getDeferredTextureImageData_buffer">buffer</a> this returns the size that the client must allocate in order
+to create deferred texture data for this image (or zero if this is an inappropriate
+candidate). The <a href="#SkImage_getDeferredTextureImageData_buffer">buffer</a> allocated by the client should be 8 byte aligned.
+
+When <a href="#SkImage_getDeferredTextureImageData_buffer">buffer</a> is not null this fills in the deferred texture data for this image in the
+provided <a href="#SkImage_getDeferredTextureImageData_buffer">buffer</a> (assuming this is an appropriate candidate image and the <a href="#SkImage_getDeferredTextureImageData_buffer">buffer</a> is
+appropriately aligned). Upon success the size written is returned, otherwise 0.
+
+<a href="#SkImage_getDeferredTextureImageData_dstColorSpace">dstColorSpace</a> is the color space of the surface where this texture will ultimately be used.
+If the method determines that mip-maps are needed, this helps determine the correct strategy
+for building them (gamma-correct or not).
+
+<a href="#SkImage_getDeferredTextureImageData_dstColorType">dstColorType</a> is the color type of the surface where this texture will ultimately be used.
+This determines the format with which the image will be uploaded to the <a href="undocumented#GPU">GPU</a>. If <a href="#SkImage_getDeferredTextureImageData_dstColorType">dstColorType</a>
+does not support color spaces (low bit depth types such as <a href="undocumented#SkColorType">kARGB 4444 SkColorType</a>),
+then <a href="#SkImage_getDeferredTextureImageData_dstColorSpace">dstColorSpace</a> must be null.
+
+### Parameters
+
+<table> <tr> <td><a name="SkImage_getDeferredTextureImageData_contextThreadSafeProxy"> <code><strong>contextThreadSafeProxy </strong></code> </a></td> <td>
+incomplete</td>
+ </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_deferredTextureImageUsageParams"> <code><strong>deferredTextureImageUsageParams </strong></code> </a></td> <td>
+incomplete</td>
+ </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_paramCnt"> <code><strong>paramCnt </strong></code> </a></td> <td>
+incomplete</td>
+ </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_buffer"> <code><strong>buffer </strong></code> </a></td> <td>
+incomplete</td>
+ </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_dstColorSpace"> <code><strong>dstColorSpace </strong></code> </a></td> <td>
+incomplete</td>
+ </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_dstColorType"> <code><strong>dstColorType </strong></code> </a></td> <td>
+incomplete</td>
+ </tr>
+</table>
+
+### Return Value
+
+incomplete
+
+### Example
+
+<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+
+### See Also
+
+incomplete
+
+---
+
+<a name="SkImage_MakeFromDeferredTextureImageData"></a>
+## MakeFromDeferredTextureImageData
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+static sk_sp&lt;SkImage&gt; MakeFromDeferredTextureImageData(GrContext* context, const void* data,
+ SkBudgeted budgeted)
+</pre>
+
+Returns a texture-backed image from <a href="#SkImage_MakeFromDeferredTextureImageData_data">data</a> produced in <a href="#SkImage_getDeferredTextureImageData">SkImage::getDeferredTextureImageData</a>.
+The <a href="#SkImage_MakeFromDeferredTextureImageData_context">context</a> must be the <a href="#SkImage_MakeFromDeferredTextureImageData_context">context</a> that provided the proxy passed to
+<a href="#SkImage_getDeferredTextureImageData">getDeferredTextureImageData</a>.
+
+### Parameters
+
+<table> <tr> <td><a name="SkImage_MakeFromDeferredTextureImageData_context"> <code><strong>context </strong></code> </a></td> <td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
+ </tr> <tr> <td><a name="SkImage_MakeFromDeferredTextureImageData_data"> <code><strong>data </strong></code> </a></td> <td>
+incomplete</td>
+ </tr> <tr> <td><a name="SkImage_MakeFromDeferredTextureImageData_budgeted"> <code><strong>budgeted </strong></code> </a></td> <td>
+incomplete</td>
+ </tr>
+</table>
+
+### Return Value
+
+incomplete
+
+### Example
+
+<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+
+### See Also
+
+incomplete
+
+---
+
<a href="#SkImage_BackendTextureReleaseProc">BackendTextureReleaseProc</a>
<a name="SkImage_MakeBackendTextureFromSkImage"></a>
@@ -1693,7 +2086,7 @@ contents and return that.
### Parameters
<table> <tr> <td><a name="SkImage_MakeBackendTextureFromSkImage_context"> <code><strong>context </strong></code> </a></td> <td>
-incomplete</td>
+<a href="undocumented#GPU_Context">GPU Context</a></td>
</tr> <tr> <td><a name="SkImage_MakeBackendTextureFromSkImage_image"> <code><strong>image </strong></code> </a></td> <td>
incomplete</td>
</tr> <tr> <td><a name="SkImage_MakeBackendTextureFromSkImage_backendTexture"> <code><strong>backendTexture </strong></code> </a></td> <td>
diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md
index ef8d1afd0d..c497f44ba2 100644
--- a/site/user/api/SkPaint_Reference.md
+++ b/site/user/api/SkPaint_Reference.md
@@ -613,18 +613,6 @@ can reconstitute the paint at a later time.
</tr>
</table>
-### Example
-
-<div><fiddle-embed name="ef700e9d42d1826d35e92eeae120e7fa">
-
-#### Example Output
-
-~~~~
-color = 0xffff0000
-~~~~
-
-</fiddle-embed></div>
-
---
<a name="SkPaint_unflatten"></a>
diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm
index ee48589741..67afa4b989 100644
--- a/site/user/api/catalog.htm
+++ b/site/user/api/catalog.htm
@@ -1043,6 +1043,13 @@
"name": "SkImage::MakeFromRaster",
"stdout": "before reset: 0\\nafter reset: 1\\n"
},
+ "SkImage_dimensions": {
+ "code": "void draw(SkCanvas* canvas) {\n SkISize dimensions = image->dimensions();\n SkIRect bounds = image->bounds();\n SkIRect dimensionsAsBounds = SkIRect::MakeSize(dimensions);\n SkDebugf(\"dimensionsAsBounds %c= bounds\\n\", dimensionsAsBounds == bounds ? '=' : '!');\n}",
+ "hash": "96b4bc43b3667df9ba9e2dafb770d33c",
+ "file": "SkImage_Reference",
+ "name": "SkImage::dimensions()",
+ "stdout": "dimensionsAsBounds == bounds\\n"
+ },
"SkMatrix_I": {
"code": "void draw(SkCanvas* canvas) {\n SkMatrix m1, m2, m3;\n m1.reset();\n m2.setIdentity();\n m3 = SkMatrix::I();\n SkDebugf(\"m1 %c= m2\\n\", m1 == m2 ? '=' : '!');\n SkDebugf(\"m2 %c= m3\\n\", m1 == m2 ? '=' : '!');\n}",
"hash": "d961d91020f19037204a8c3fd8cb1060",
@@ -1365,13 +1372,6 @@
"name": "SkPaint::operator==(const SkPaint& a, const SkPaint& b)",
"stdout": "paint1 == paint2\\npaint1 != paint2\\n"
},
- "SkPaint_flatten": {
- "code": "void draw(SkCanvas* canvas) {\n class PaintDumper : public SkWriteBuffer {\n public:\n bool isCrossProcess() const override { return false; };\n void writePad32(const void* buffer, size_t bytes) override {}\n void writeByteArray(const void* data, size_t size) override {}\n void writeBool(bool value) override {}\n void writeScalar(SkScalar value) override {}\n void writeScalarArray(const SkScalar* value, uint32_t count) override {}\n void writeInt(int32_t value) override {}\n void writeIntArray(const int32_t* value, uint32_t count) override {}\n void writeUInt(uint32_t value) override {}\n void writeString(const char* value) override {}\n void writeFlattenable(const SkFlattenable* flattenable) override {}\n void writeColorArray(const SkColor* color, uint32_t count) override {}\n void writeColor4f(const SkColor4f& color) override {}\n void writeColor4fArray(const SkColor4f* color, uint32_t count) override {}\n void writePoint(const SkPoint& point) override {}\n void writePointArray(const SkPoint* point, uint32_t count) override {}\n void writeMatrix(const SkMatrix& matrix) override {}\n void writeIRect(const SkIRect& rect) override {}\n void writeRect(const SkRect& rect) override {}\n void writeRegion(const SkRegion& region) override {}\n void writePath(const SkPath& path) override {}\n size_t writeStream(SkStream* stream, size_t length) override { return 0; }\n void writeImage(const SkImage*) override {}\n void writeTypeface(SkTypeface* typeface) override {}\n void writePaint(const SkPaint& paint) override {}\n void writeColor(SkColor color) override {\n SkDebugf(\"color = 0x%08x\\n\", color);\n }\n } dumper;\n SkPaint paint;\n paint.setColor(SK_ColorRED);\n paint.flatten(dumper);\n}",
- "hash": "ef700e9d42d1826d35e92eeae120e7fa",
- "file": "SkPaint_Reference",
- "name": "SkPaint::flatten()",
- "stdout": "color = 0xffff0000\\n"
- },
"SkPaint_getAlpha": {
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkDebugf(\"255 %c= paint.getAlpha()\\n\", 255 == paint.getAlpha() ? '=' : '!');\n}",
"hash": "9a85bb62fe3d877b18fb7f952c4fa7f7",
@@ -3636,10 +3636,10 @@
"name": "SkBitmap::allocPixels_4"
},
"SkBitmap_bounds": {
- "code": "void draw(SkCanvas* canvas) {\n SkIRect bounds = source.bounds();\n for (int x : { 0, bounds.width() } ) {\n for (int y : { 0, bounds.height() } ) {\n canvas->drawBitmap(source, x, y);\n }\n }\n}",
+ "code": "void draw(SkCanvas* canvas) {\n canvas->scale(.5f, .5f);\n SkIRect bounds = source.bounds();\n for (int x : { 0, bounds.width() } ) {\n for (int y : { 0, bounds.height() } ) {\n canvas->drawBitmap(source, x, y);\n }\n }\n}",
"width": 256,
"height": 128,
- "hash": "bd020c1527964761adf7646e82a36487",
+ "hash": "41a60435d6eb76cb400fe9be635e3762",
"file": "SkBitmap_Reference",
"name": "SkBitmap::bounds()"
},
@@ -4707,21 +4707,29 @@
"file": "SkIPoint_Reference",
"name": "SkIPoint::operator-=(const SkIVector& v)"
},
- "SkImage_BitDepth": {
+ "SkImage_CachingHint": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
"height": 256,
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkImage_Reference",
- "name": "SkImage::BitDepth"
+ "name": "SkImage::CachingHint"
},
- "SkImage_CachingHint": {
+ "SkImage_DeferredTextureImageUsageParams": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
"height": 256,
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkImage_Reference",
- "name": "SkImage::CachingHint"
+ "name": "SkImage::DeferredTextureImageUsageParams"
+},
+ "SkImage_DeferredTextureImageUsageParams_DeferredTextureImageUsageParams": {
+ "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "width": 256,
+ "height": 256,
+ "hash": "882e8e0103048009a25cfc20400492f7",
+ "file": "SkImage_Reference",
+ "name": "SkImage::DeferredTextureImageUsageParams::DeferredTextureImageUsageParams"
},
"SkImage_LegacyBitmapMode": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
@@ -4740,52 +4748,52 @@
"name": "SkImage::MakeBackendTextureFromSkImage"
},
"SkImage_MakeCrossContextFromEncoded": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n sk_sp<SkData> encodedData = image->encodeToData(SkEncodedImageFormat::kJPEG, 100);\n sk_sp<SkImage> image = SkImage::MakeCrossContextFromEncoded(context,\n encodedData, false, nullptr);\n canvas->drawImage(image, 0, 0);\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 128,
+ "hash": "90202d8b1df605fdb0c84f2c351f9598",
"file": "SkImage_Reference",
"name": "SkImage::MakeCrossContextFromEncoded"
},
"SkImage_MakeCrossContextFromPixmap": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n SkPixmap pixmap;\n if (source.peekPixels(&pixmap)) {\n sk_sp<SkImage> image = SkImage::MakeCrossContextFromPixmap(context, pixmap,\n false, nullptr);\n canvas->drawImage(image, 0, 0);\n }\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 128,
+ "hash": "bb37de3dc4a0c53d48cdfafb90b9b18e",
"file": "SkImage_Reference",
"name": "SkImage::MakeCrossContextFromPixmap"
},
- "SkImage_MakeFromAHardwareBuffer": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "SkImage_MakeFromAdoptedTexture_2": {
+ "code": "void draw(SkCanvas* canvas) {\n if (!canvas->getGrContext()) {\n return;\n }\n canvas->scale(.5f, .5f);\n canvas->clear(0x7f3f5f7f);\n int x = 0, y = 0;\n for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {\n for (auto alpha : { kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType } ) {\n sk_sp<SkImage> image = SkImage::MakeFromAdoptedTexture(canvas->getGrContext(),\n backEndTexture, origin, \n kRGBA_8888_SkColorType, alpha);\n canvas->drawImage(image, x, y);\n x += 160;\n }\n x -= 160 * 3;\n y += 256;\n }\n}",
"width": 256,
"height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "hash": "aed9b621fdc2135d512b58648d064224",
"file": "SkImage_Reference",
- "name": "SkImage::MakeFromAHardwareBuffer"
+ "name": "SkImage::MakeFromAdoptedTexture_2"
},
- "SkImage_MakeFromAHardwareBuffer_2": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "SkImage_MakeFromBitmap": {
+ "code": "void draw(SkCanvas* canvas) {\n uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },\n { 0xAC, 0xA8, 0x89, 0xA7, 0x87 },\n { 0x9B, 0xB5, 0xE5, 0x95, 0x46 },\n { 0x90, 0x81, 0xC5, 0x71, 0x33 },\n { 0x75, 0x55, 0x44, 0x40, 0x30 }};\n SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kOpaque_SkAlphaType);\n SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);\n SkBitmap bitmap;\n bitmap.installPixels(pixmap);\n sk_sp<SkImage> image1 = SkImage::MakeFromBitmap(bitmap);\n bitmap.setImmutable();\n sk_sp<SkImage> image2 = SkImage::MakeFromBitmap(bitmap);\n *pixmap.writable_addr8(2, 2) = 0x00;\n canvas->scale(10, 10);\n canvas->drawImage(image1, 0, 0);\n canvas->drawImage(image2, 10, 0);\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 50,
+ "hash": "cf2cf53321e4e6a77c2841bfbc0ef707",
"file": "SkImage_Reference",
- "name": "SkImage::MakeFromAHardwareBuffer_2"
+ "name": "SkImage::MakeFromBitmap"
},
- "SkImage_MakeFromAdoptedTexture": {
+ "SkImage_MakeFromDeferredTextureImageData": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
"height": 256,
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkImage_Reference",
- "name": "SkImage::MakeFromAdoptedTexture"
+ "name": "SkImage::MakeFromDeferredTextureImageData"
},
- "SkImage_MakeFromBitmap": {
- "code": "void draw(SkCanvas* canvas) {\n uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },\n { 0xAC, 0xA8, 0x89, 0xA7, 0x87 },\n { 0x9B, 0xB5, 0xE5, 0x95, 0x46 },\n { 0x90, 0x81, 0xC5, 0x71, 0x33 },\n { 0x75, 0x55, 0x44, 0x40, 0x30 }};\n SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kOpaque_SkAlphaType);\n SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);\n SkBitmap bitmap;\n bitmap.installPixels(pixmap);\n sk_sp<SkImage> image1 = SkImage::MakeFromBitmap(bitmap);\n bitmap.setImmutable();\n sk_sp<SkImage> image2 = SkImage::MakeFromBitmap(bitmap);\n *pixmap.writable_addr8(2, 2) = 0x00;\n canvas->scale(10, 10);\n canvas->drawImage(image1, 0, 0);\n canvas->drawImage(image2, 10, 0);\n}",
+ "SkImage_MakeFromEncoded": {
+ "code": "void draw(SkCanvas* canvas) {\n int x = 0;\n for (int quality : { 100, 50, 10, 1} ) {\n sk_sp<SkData> encodedData = image->encodeToData(SkEncodedImageFormat::kJPEG, quality);\n sk_sp<SkImage> image = SkImage::MakeFromEncoded(encodedData);\n canvas->drawImage(image, x, 0);\n x += 64;\n }\n}",
"width": 256,
- "height": 50,
- "hash": "cf2cf53321e4e6a77c2841bfbc0ef707",
+ "height": 256,
+ "hash": "894f732ed6409b1f392bc5481421d0e9",
"file": "SkImage_Reference",
- "name": "SkImage::MakeFromBitmap"
+ "name": "SkImage::MakeFromEncoded"
},
"SkImage_MakeFromGenerator": {
"code": "void draw(SkCanvas* canvas) {\n SkPictureRecorder recorder;\n recorder.beginRecording(100, 100)->drawColor(SK_ColorRED);\n auto picture = recorder.finishRecordingAsPicture();\n auto gen = SkImageGenerator::MakeFromPicture({100, 100}, picture, nullptr, nullptr,\n SkImage::BitDepth::kU8, SkColorSpace::MakeSRGB());\n sk_sp<SkImage> image = SkImage::MakeFromGenerator(std::move(gen));\n canvas->drawImage(image, 0, 0);\n}",
@@ -4795,45 +4803,29 @@
"file": "SkImage_Reference",
"name": "SkImage::MakeFromGenerator"
},
- "SkImage_MakeFromNV12TexturesCopy": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImage_Reference",
- "name": "SkImage::MakeFromNV12TexturesCopy"
-},
"SkImage_MakeFromPicture": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkPictureRecorder recorder;\n SkCanvas* recordingCanvas = recorder.beginRecording(50, 50);\n for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xff007f00 } ) {\n paint.setColor(color);\n recordingCanvas->drawRect({10, 10, 30, 40}, paint);\n recordingCanvas->translate(10, 10);\n recordingCanvas->scale(1.2f, 1.4f);\n }\n sk_sp<SkPicture> playback = recorder.finishRecordingAsPicture();\n int x = 0, y = 0;\n for (auto alpha : { 70, 140, 210 } ) {\n paint.setAlpha(alpha);\n auto srgbColorSpace = SkColorSpace::MakeSRGB();\n sk_sp<SkImage> image = SkImage::MakeFromPicture(playback, {50, 50}, nullptr, &paint,\n SkImage::BitDepth::kU8, srgbColorSpace);\n canvas->drawImage(image, x, y);\n x += 70; y += 70;\n }\n}",
"width": 256,
"height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "hash": "4aa2879b9e44dfd6648995326d2c4dcf",
"file": "SkImage_Reference",
"name": "SkImage::MakeFromPicture"
},
- "SkImage_MakeFromTexture": {
+ "SkImage_MakeFromTexture_3": {
"code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n canvas->scale(.25f, .25f);\n int x = 0;\n for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> image = SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n origin, kOpaque_SkAlphaType, nullptr);\n canvas->drawImage(image, x, 0);\n x += 512;\n }\n}",
"width": 256,
"height": 128,
"hash": "2faa98d6a1d578010326af17ee7e4d2a",
"file": "SkImage_Reference",
- "name": "SkImage::MakeFromTexture"
+ "name": "SkImage::MakeFromTexture_3"
},
- "SkImage_MakeFromTexture_2": {
- "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n auto debugster = [](SkImage::ReleaseContext context) -> void {\n *((int *) context) += 128;\n };\n int x = 0;\n for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> image = SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n origin, kOpaque_SkAlphaType, nullptr, debugster, &x);\n canvas->drawImage(image, x, 0);\n x += 128;\n }\n}",
+ "SkImage_MakeFromTexture_4": {
+ "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n auto debugster = [](SkImage::ReleaseContext context) -> void {\n *((int *) context) += 128;\n };\n int x = 0;\n for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> image = SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n origin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType, nullptr, debugster, &x);\n canvas->drawImage(image, x, 0);\n x += 128;\n }\n}",
"width": 256,
"height": 256,
- "hash": "dea2835da4be78d1e9ab4be58010d1ad",
- "file": "SkImage_Reference",
- "name": "SkImage::MakeFromTexture_2"
-},
- "SkImage_MakeFromYUVTexturesCopy": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "hash": "6a50c3cb961c23ad9ecbd5caedac0d70",
"file": "SkImage_Reference",
- "name": "SkImage::MakeFromYUVTexturesCopy"
+ "name": "SkImage::MakeFromTexture_4"
},
"SkImage_MakeRasterCopy": {
"code": "void draw(SkCanvas* canvas) {\n uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },\n { 0xAC, 0xA8, 0x89, 0xA7, 0x87 },\n { 0x9B, 0xB5, 0xE5, 0x95, 0x46 },\n { 0x90, 0x81, 0xC5, 0x71, 0x33 },\n { 0x75, 0x55, 0x44, 0x40, 0x30 }};\n SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kOpaque_SkAlphaType);\n SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);\n SkBitmap bitmap;\n bitmap.installPixels(pixmap);\n sk_sp<SkImage> image = SkImage::MakeRasterCopy(pixmap);\n *pixmap.writable_addr8(2, 2) = 0x00;\n canvas->scale(10, 10);\n canvas->drawBitmap(bitmap, 0, 0);\n canvas->drawImage(image, 10, 0);\n}",
@@ -4852,10 +4844,10 @@
"name": "SkImage::MakeRasterData"
},
"SkImage_alphaType": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n const char* alphaTypeStr[] = { \"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\" };\n SkAlphaType alphaType = image->alphaType();\n canvas->drawImage(image, 0, 0);\n SkPaint paint;\n canvas->drawString(alphaTypeStr[(int) alphaType], 20, image->height() + 20, paint);\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 156,
+ "hash": "1c8b8588dbbb1d5df72ee9164ae0aab0",
"file": "SkImage_Reference",
"name": "SkImage::alphaType"
},
@@ -4868,10 +4860,10 @@
"name": "SkImage::asLegacyBitmap"
},
"SkImage_bounds": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n canvas->scale(.5f, .5f);\n SkIRect bounds = image->bounds();\n for (int x : { 0, image->width() } ) {\n for (int y : { 0, image->height() } ) {\n canvas->drawImage(image, x, y);\n }\n }\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 128,
+ "hash": "a6617b5d3066aadce2c37ed2184d6098",
"file": "SkImage_Reference",
"name": "SkImage::bounds()"
},
@@ -4883,29 +4875,29 @@
"file": "SkImage_Reference",
"name": "SkImage::colorSpace"
},
- "SkImage_dimensions": {
+ "SkImage_encodeToData": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
"height": 256,
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkImage_Reference",
- "name": "SkImage::dimensions()"
+ "name": "SkImage::encodeToData"
},
- "SkImage_encodeToData": {
+ "SkImage_encodeToData_2": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
"height": 256,
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkImage_Reference",
- "name": "SkImage::encodeToData"
+ "name": "SkImage::encodeToData_2"
},
- "SkImage_encodeToData_2": {
+ "SkImage_getDeferredTextureImageData": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
"height": 256,
"hash": "882e8e0103048009a25cfc20400492f7",
"file": "SkImage_Reference",
- "name": "SkImage::encodeToData_2"
+ "name": "SkImage::getDeferredTextureImageData"
},
"SkImage_getTextureHandle": {
"code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n SkString str;\n int y = 0;\n for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context,\n backEndTexture, origin, kPremul_SkAlphaType, nullptr));\n GrSurfaceOrigin readBackOrigin;\n GrBackendObject readBackHandle = srcImage->getTextureHandle(false, &readBackOrigin);\n str.printf(\"readBackHandle: %x\", readBackHandle);\n canvas->drawString(str, 5, y += 20, paint);\n str.printf(\"origin: k%s_GrSurfaceOrigin\", readBackOrigin ? \"BottomLeft\" : \"TopLeft\");\n canvas->drawString(str, 5, y += 20, paint);\n }\n}",
@@ -4916,10 +4908,10 @@
"name": "SkImage::getTextureHandle"
},
"SkImage_height": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 10);\n canvas->drawImage(image, 0, 0);\n canvas->translate(image->width(), 0);\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n paint.setVerticalText(true);\n canvas->drawLine(10, 0, 10, image->height(), paint);\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 148,
+ "hash": "96c8202a13068e36432006f75b124eee",
"file": "SkImage_Reference",
"name": "SkImage::height()"
},
@@ -4979,6 +4971,14 @@
"file": "SkImage_Reference",
"name": "SkImage::makeNonTextureImage"
},
+ "SkImage_makeRasterImage": {
+ "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "width": 256,
+ "height": 256,
+ "hash": "882e8e0103048009a25cfc20400492f7",
+ "file": "SkImage_Reference",
+ "name": "SkImage::makeRasterImage"
+},
"SkImage_makeShader": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
@@ -5076,18 +5076,18 @@
"name": "SkImage::toString"
},
"SkImage_uniqueID": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkImage> subset = image->makeSubset({10, 20, 90, 100});\n canvas->drawImage(image, 0, 0);\n canvas->drawImage(subset, 128, 0);\n SkPaint paint;\n SkString s;\n s.printf(\"original id: %d\", image->uniqueID());\n canvas->drawString(s, 20, image->height() + 20, paint);\n s.printf(\"subset id: %d\", subset->uniqueID());\n canvas->drawString(s, 148, subset->height() + 20, paint);\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 156,
+ "hash": "d70194c9c51e700335f95de91846d023",
"file": "SkImage_Reference",
"name": "SkImage::uniqueID"
},
"SkImage_width": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 10);\n canvas->drawImage(image, 0, 0);\n canvas->translate(0, image->height());\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->drawLine(0, 10, image->width(), 10, paint);\n canvas->drawString(\"width\", image->width() / 2, 25, paint);\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 168,
+ "hash": "4fa6c18eb829d8979cfdbbf6f42e4c97",
"file": "SkImage_Reference",
"name": "SkImage::width()"
},
diff --git a/site/user/api/undocumented.md b/site/user/api/undocumented.md
index 4c48b29194..9b4473e453 100644
--- a/site/user/api/undocumented.md
+++ b/site/user/api/undocumented.md
@@ -317,6 +317,8 @@ void flush()
# <a name="GPU_Surface"></a> GPU Surface
+# <a name="GPU_Texture"></a> GPU Texture
+
# <a name="Glyph"></a> Glyph
# <a name="HTML_Canvas"></a> HTML Canvas
@@ -930,8 +932,6 @@ static std::unique_ptr&lt;SkCanvas&gt; MakeCanvas(std::unique_ptr&lt;SkRasterHan
---
-# <a name="Raster_Image"></a> Raster Image
-
# <a name="Raster_Surface"></a> Raster Surface
# <a name="Rasterizer"></a> Rasterizer
diff --git a/tools/bookmaker/bookmaker.cpp b/tools/bookmaker/bookmaker.cpp
index b4db36a2e1..2677621ee1 100644
--- a/tools/bookmaker/bookmaker.cpp
+++ b/tools/bookmaker/bookmaker.cpp
@@ -1074,8 +1074,8 @@ string TextParser::typedefName() {
if (!end) {
return this->reportError<string>("missing typedef std::function end bracket >");
}
-
- if (this->startsWith("std::function")) {
+ bool stdFunction = this->startsWith("std::function");
+ if (stdFunction) {
if (!this->skipToEndBracket('>')) {
return this->reportError<string>("missing typedef std::function end bracket >");
}
diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp
index 2846614d44..da2ee54c2e 100644
--- a/tools/bookmaker/includeParser.cpp
+++ b/tools/bookmaker/includeParser.cpp
@@ -1731,6 +1731,8 @@ bool IncludeParser::parseTemplate() {
bool IncludeParser::parseTypedef(Definition* child, Definition* markupDef) {
TextParser typedefParser(child);
+ typedefParser.skipExact("typedef");
+ typedefParser.skipWhiteSpace();
string nameStr = typedefParser.typedefName();
if (!markupDef) {
Definition& typedefDef = fITypedefMap[nameStr];