diff options
author | Cary Clark <caryclark@skia.org> | 2018-01-11 10:35:44 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-11 19:37:49 +0000 |
commit | ac47b88d3c4b6232ea8664cea99fbd8394f2dc38 (patch) | |
tree | 39c001433e3677d688cc472292295a8062edee80 /site | |
parent | 5f9102f2912ef702e013c48466b5461f2a0b9eb9 (diff) |
update bookmaker to ToT
more image docs, still not done
add ability to comment out non-working examples easily
start work on additional self-checks
clean up use of this-> in docs
TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=91720
Bug: skia:6898
Change-Id: I706ab8145290e53ab67d3f509ccf4e1225adb3c3
Reviewed-on: https://skia-review.googlesource.com/91720
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'site')
-rw-r--r-- | site/user/api/SkBitmap_Reference.md | 112 | ||||
-rw-r--r-- | site/user/api/SkCanvas_Reference.md | 8 | ||||
-rw-r--r-- | site/user/api/SkIRect_Reference.md | 109 | ||||
-rw-r--r-- | site/user/api/SkImage_Reference.md | 423 | ||||
-rw-r--r-- | site/user/api/SkPath_Reference.md | 2 | ||||
-rw-r--r-- | site/user/api/SkPixmap_Reference.md | 82 | ||||
-rw-r--r-- | site/user/api/SkRect_Reference.md | 7 | ||||
-rw-r--r-- | site/user/api/SkSurface_Reference.md | 6 | ||||
-rw-r--r-- | site/user/api/catalog.htm | 145 | ||||
-rw-r--r-- | site/user/api/undocumented.md | 49 | ||||
-rw-r--r-- | site/user/api/usingBookmaker.md | 32 |
11 files changed, 617 insertions, 358 deletions
diff --git a/site/user/api/SkBitmap_Reference.md b/site/user/api/SkBitmap_Reference.md index 45469e3147..4de5c7b6ac 100644 --- a/site/user/api/SkBitmap_Reference.md +++ b/site/user/api/SkBitmap_Reference.md @@ -107,7 +107,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | <a href="#SkBitmap_peekPixels">peekPixels</a> | Returns <a href="SkPixmap_Reference#Pixmap">Pixmap</a> if possible. | | <a href="#SkBitmap_pixelRef">pixelRef</a> | Returns <a href="undocumented#Pixel_Ref">Pixel Ref</a>, or nullptr. | | <a href="#SkBitmap_pixelRefOrigin">pixelRefOrigin</a> | Returns offset within <a href="undocumented#Pixel_Ref">Pixel Ref</a>. | -| <a href="#SkBitmap_pixmap">pixmap</a> | Returns <a href="SkPixmap_Reference#Pixmap">Pixmap</a> if possible. | +| <a href="#SkBitmap_pixmap">pixmap</a> | Returns <a href="SkPixmap_Reference#Pixmap">Pixmap</a>. | | <a href="#SkBitmap_readPixels">readPixels</a> | Copies and converts pixels. | | <a href="#SkBitmap_readyToDraw">readyToDraw</a> | Returns true if address of pixels is not nullptr. | | <a href="#SkBitmap_refColorSpace">refColorSpace</a> | Returns <a href="undocumented#Image_Info">Image Info</a> <a href="undocumented#Color_Space">Color Space</a>. | @@ -480,23 +480,19 @@ two width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaT ## pixmap <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -SkPixmap pixmap() const +const SkPixmap& pixmap() const </pre> -Returns <a href="SkPixmap_Reference#Pixmap">Pixmap</a> with <a href="#Bitmap">Bitmap</a> pixel address, row bytes, and <a href="undocumented#Image_Info">Image Info</a>, if address -is available. If pixel address is not available, returns default constructed -<a href="SkPixmap_Reference#Pixmap">Pixmap</a>: nullptr pixels, <a href="undocumented#SkColorType">kUnknown SkColorType</a>, <a href="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <a href="#SkBitmap_width">width</a> and -<a href="#SkBitmap_height">height</a> of zero. - -Returned <a href="SkPixmap_Reference#Pixmap">Pixmap</a> becomes invalid on any future change to <a href="#Bitmap">Bitmap</a> +Returns a constant reference to the <a href="SkPixmap_Reference#Pixmap">Pixmap</a> holding the <a href="#Bitmap">Bitmap</a> pixel +address, row bytes, and <a href="undocumented#Image_Info">Image Info</a>. ### Return Value -<a href="SkPixmap_Reference#Pixmap">Pixmap</a> describing <a href="#Bitmap">Bitmap</a>, if pixels are readable; otherwise containing zeroes +reference to <a href="SkPixmap_Reference#Pixmap">Pixmap</a> describing this <a href="#Bitmap">Bitmap</a> ### Example -<div><fiddle-embed name="4e2da4cff5fa3752b630a63080b44752"> +<div><fiddle-embed name="7f972d742dd78d2500034d8867e9ef2f"> #### Example Output @@ -2886,8 +2882,8 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, SkTransferFunctionBehavior behavior) const </pre> -Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkBitmap_readPixels_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkBitmap_readPixels_srcX">srcX</a>, <a href="#SkBitmap_readPixels_srcY">srcY</a>), and does not exceed -(this-><a href="#SkBitmap_width">width</a>, this-><a href="#SkBitmap_height">height</a>). +Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Bitmap">Bitmap</a> pixels to <a href="#SkBitmap_readPixels_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkBitmap_readPixels_srcX">srcX</a>, <a href="#SkBitmap_readPixels_srcY">srcY</a>), +and does not exceed <a href="#Bitmap">Bitmap</a> (<a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>). <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a> specifies <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkBitmap_readPixels_dstRowBytes">dstRowBytes</a> specifics the gap from one destination @@ -2899,16 +2895,16 @@ row to the next. Returns true if pixels are copied. Returns false if: <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> </table> -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkBitmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorType">colorType</a> must match. -If this-><a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. -If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkBitmap_alphaType">alphaType</a> must -match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. Returns +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkBitmap_alphaType">alphaType</a> must +match. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. Returns false if pixel conversion is not possible. <a href="#SkBitmap_readPixels_srcX">srcX</a> and <a href="#SkBitmap_readPixels_srcY">srcY</a> may be negative to copy only top or left of source. Returns false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. -Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>, -or ifabs(srcY) >= this-><a href="#SkBitmap_height">height</a>. +Returns false ifabs(srcX) >= <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_width">width</a>, +or ifabs(srcY) >= <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_height">height</a>. If <a href="#SkBitmap_readPixels_behavior">behavior</a> is <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts source pixels to a linear space before converting to <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>. @@ -2951,12 +2947,12 @@ true if pixels are copied to <a href="#SkBitmap_readPixels_dstPixels">dstPixels< bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY) const </pre> -Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkBitmap_readPixels_2_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkBitmap_readPixels_2_srcX">srcX</a>, <a href="#SkBitmap_readPixels_2_srcY">srcY</a>), and does not exceed -(this-><a href="#SkBitmap_width">width</a>, this-><a href="#SkBitmap_height">height</a>). +Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Bitmap">Bitmap</a> to <a href="#SkBitmap_readPixels_2_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkBitmap_readPixels_2_srcX">srcX</a>, <a href="#SkBitmap_readPixels_2_srcY">srcY</a>), +and does not exceed <a href="#Bitmap">Bitmap</a> (<a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>). -<a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a> specifies <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, and -<a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkBitmap_readPixels_2_dstRowBytes">dstRowBytes</a> specifics the gap from one destination -row to the next. Returns true if pixels are copied. Returns false if: +<a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a> specifies <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of +destination. <a href="#SkBitmap_readPixels_2_dstRowBytes">dstRowBytes</a> specifics the gap from one destination row to the next. +Returns true if pixels are copied. Returns false if: <table> <tr> <td><a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.addr() equals nullptr</td> </tr> <tr> @@ -2964,16 +2960,16 @@ row to the next. Returns true if pixels are copied. Returns false if: <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> </table> -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkBitmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorType">colorType</a> must match. -If this-><a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. -If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkBitmap_alphaType">alphaType</a> must -match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. Returns +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkBitmap_alphaType">alphaType</a> must +match. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. Returns false if pixel conversion is not possible. <a href="#SkBitmap_readPixels_2_srcX">srcX</a> and <a href="#SkBitmap_readPixels_2_srcY">srcY</a> may be negative to copy only top or left of source. Returns false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. -Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>, -or ifabs(srcY) >= this-><a href="#SkBitmap_height">height</a>. +Returns false ifabs(srcX) >= <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_width">width</a>, +or ifabs(srcY) >= <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_height">height</a>. ### Parameters @@ -3009,8 +3005,8 @@ creates visible banding.</div></fiddle-embed></div> bool readPixels(const SkPixmap& dst, int srcX, int srcY) const </pre> -Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkBitmap_readPixels_3_dst">dst</a>. Copy starts at (<a href="#SkBitmap_readPixels_3_srcX">srcX</a>, <a href="#SkBitmap_readPixels_3_srcY">srcY</a>), and does not exceed -(this-><a href="#SkBitmap_width">width</a>, this-><a href="#SkBitmap_height">height</a>). +Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Bitmap">Bitmap</a> to <a href="#SkBitmap_readPixels_3_dst">dst</a>. Copy starts at (<a href="#SkBitmap_readPixels_3_srcX">srcX</a>, <a href="#SkBitmap_readPixels_3_srcY">srcY</a>), and +does not exceed <a href="#Bitmap">Bitmap</a> (<a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>). <a href="#SkBitmap_readPixels_3_dst">dst</a> specifies <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Space">Color Space</a>, pixel storage, and row bytes of destination. <a href="#SkBitmap_readPixels_3_dst">dst</a>.<a href="#SkBitmap_rowBytes">rowBytes</a> specifics the gap from one destination @@ -3022,16 +3018,16 @@ row to the next. Returns true if pixels are copied. Returns false if: <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> </table> -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkBitmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkBitmap_readPixels_3_dst">dst</a> <a href="undocumented#Image_Color_Type">Color Type</a> must match. -If this-><a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_readPixels_3_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. -If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_readPixels_3_dst">dst</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must -match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_3_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_readPixels_3_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_readPixels_3_dst">dst</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must +match. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_3_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns false if pixel conversion is not possible. <a href="#SkBitmap_readPixels_3_srcX">srcX</a> and <a href="#SkBitmap_readPixels_3_srcY">srcY</a> may be negative to copy only top or left of source. Returns false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. -Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>, -or ifabs(srcY) >= this-><a href="#SkBitmap_height">height</a>. +Returns false ifabs(srcX) >= <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_width">width</a>, +or ifabs(srcY) >= <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_height">height</a>. ### Parameters @@ -3062,8 +3058,8 @@ true if pixels are copied to <a href="#SkBitmap_readPixels_3_dst">dst</a> bool readPixels(const SkPixmap& dst) const </pre> -Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkBitmap_readPixels_4_dst">dst</a>. Copy starts at (0, 0), and does not exceed -(this-><a href="#SkBitmap_width">width</a>, this-><a href="#SkBitmap_height">height</a>). +Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Bitmap">Bitmap</a> to <a href="#SkBitmap_readPixels_4_dst">dst</a>. Copy starts at (0, 0), and +does not exceed <a href="#Bitmap">Bitmap</a> (<a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>). <a href="#SkBitmap_readPixels_4_dst">dst</a> specifies <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Space">Color Space</a>, pixel storage, and row bytes of destination. <a href="#SkBitmap_readPixels_4_dst">dst</a>.<a href="#SkBitmap_rowBytes">rowBytes</a> specifics the gap from one destination @@ -3075,11 +3071,11 @@ row to the next. Returns true if pixels are copied. Returns false if: <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> </table> -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkBitmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkBitmap_readPixels_4_dst">dst</a> <a href="undocumented#Image_Color_Type">Color Type</a> must match. -If this-><a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_readPixels_4_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. -If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_readPixels_4_dst">dst</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must -match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_4_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_readPixels_4_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_readPixels_4_dst">dst</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must +match. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_4_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns false if pixel conversion is not possible. ### Parameters @@ -3123,16 +3119,16 @@ row to the next. Returns true if pixels are copied. Returns false if: <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> </table> -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkBitmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkBitmap_writePixels_src">src</a> <a href="undocumented#Image_Color_Type">Color Type</a> must match. -If this-><a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_writePixels_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. -If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_writePixels_src">src</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must -match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_writePixels_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_writePixels_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_writePixels_src">src</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must +match. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_writePixels_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns false if pixel conversion is not possible. <a href="#SkBitmap_writePixels_dstX">dstX</a> and <a href="#SkBitmap_writePixels_dstY">dstY</a> may be negative to copy only top or left of source. Returns false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. -Returns false ifabs(dstX) >= this-><a href="#SkBitmap_width">width</a>, -or ifabs(dstY) >= this-><a href="#SkBitmap_height">height</a>. +Returns false ifabs(dstX) >= <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_width">width</a>, +or ifabs(dstY) >= <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_height">height</a>. ### Parameters @@ -3176,11 +3172,11 @@ row to the next. Returns true if pixels are copied. Returns false if: <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> </table> -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkBitmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkBitmap_writePixels_2_src">src</a> <a href="undocumented#Image_Color_Type">Color Type</a> must match. -If this-><a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_writePixels_2_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. -If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_writePixels_2_src">src</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must -match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_writePixels_2_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_writePixels_2_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_writePixels_2_src">src</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must +match. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_writePixels_2_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns false if pixel conversion is not possible. ### Parameters @@ -3221,11 +3217,11 @@ row to the next. Returns true if pixels are copied. Returns false if: <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> </table> -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkBitmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkBitmap_writePixels_3_src">src</a> <a href="undocumented#Image_Color_Type">Color Type</a> must match. -If this-><a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_writePixels_3_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. -If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_writePixels_3_src">src</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must -match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_writePixels_3_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkBitmap_writePixels_3_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. +If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkBitmap_writePixels_3_src">src</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must +match. If <a href="#Bitmap">Bitmap</a> <a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_writePixels_3_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns false if pixel conversion is not possible. Returns false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. @@ -3484,7 +3480,7 @@ SK_DEBUG is defined at compile time. void toString(SkString* str) const; </pre> -Creates string representation. The representation is read by +Creates string representation of <a href="#Bitmap">Bitmap</a>. The representation is read by internal debugging tools. The interface and implementation may be suppressed by defining SK_IGNORE_TO_STRING. diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md index 7d76c1e020..0994f1dd95 100644 --- a/site/user/api/SkCanvas_Reference.md +++ b/site/user/api/SkCanvas_Reference.md @@ -1185,8 +1185,8 @@ Does not copy, and returns false if: <table> <tr> <td>Source and destination rectangles do not intersect.</td> </tr> <tr> - <td><a href="#SkCanvas_writePixels_pixels">pixels</a> could not be converted to this-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() or -this-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType().</td> </tr> <tr> + <td><a href="#SkCanvas_writePixels_pixels">pixels</a> could not be converted to <a href="#Canvas">Canvas</a> <a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() or +<a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType().</td> </tr> <tr> <td><a href="#Canvas">Canvas</a> <a href="#SkCanvas_writePixels_pixels">pixels</a> are not writable; for instance, <a href="#Canvas">Canvas</a> is document-based.</td> </tr> <tr> <td><a href="#SkCanvas_writePixels_rowBytes">rowBytes</a> is too small to contain one row of <a href="#SkCanvas_writePixels_pixels">pixels</a>.</td> </tr> </table> @@ -1250,8 +1250,8 @@ Does not copy, and returns false if: <table> <tr> <td>Source and destination rectangles do not intersect.</td> </tr> <tr> <td><a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> does not have allocated pixels.</td> </tr> <tr> - <td><a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> pixels could not be converted to this-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() or -this-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType().</td> </tr> <tr> + <td><a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> pixels could not be converted to <a href="#Canvas">Canvas</a> <a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() or +<a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType().</td> </tr> <tr> <td><a href="#Canvas">Canvas</a> pixels are not writable; for instance, <a href="#Canvas">Canvas</a> is document based.</td> </tr> <tr> <td><a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> pixels are inaccessible; for instance, <a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> wraps a texture.</td> </tr> </table> diff --git a/site/user/api/SkIRect_Reference.md b/site/user/api/SkIRect_Reference.md index 51e96f002d..7afb05edaa 100644 --- a/site/user/api/SkIRect_Reference.md +++ b/site/user/api/SkIRect_Reference.md @@ -42,11 +42,13 @@ its <a href="#SkIRect_top">top</a>, it is considered empty. | <a href="#SkIRect_contains">contains</a> | Returns true if points are equal or inside. | | <a href="#SkIRect_containsNoEmptyCheck">containsNoEmptyCheck</a> | Returns true if points are equal or inside. Skips empty check. | | <a href="#SkIRect_height">height</a> | Returns span in <a href="#SkIRect_y">y</a>. | +| <a href="#SkIRect_height64">height64</a> | Returns span in <a href="#SkIRect_y">y</a> as int64_t. | | <a href="#SkIRect_inset">inset</a> | Moves the sides symmetrically about the center. | | <a href="#SkIRect_intersect">intersect</a> | Sets to shared area; returns true if not empty. | | <a href="#SkIRect_intersectNoEmptyCheck">intersectNoEmptyCheck</a> | Sets to shared area; returns true if not empty. Skips empty check. | | <a href="#SkIRect_is16Bit">is16Bit</a> | Returns true if members fit in 16-bit word. | -| <a href="#SkIRect_isEmpty">isEmpty</a> | Returns true if <a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a> are zero or negative. | +| <a href="#SkIRect_isEmpty">isEmpty</a> | Returns true if <a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a> are zero or negative or they exceed int32_t. | +| <a href="#SkIRect_isEmpty64">isEmpty64</a> | Returns true if <a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a> are zero or negative. | | <a href="#SkIRect_join">join</a> | Sets to union of bounds. | | <a href="#SkIRect_left">left</a> | Returns smaller bounds in <a href="#SkIRect_x">x</a>, if sorted. | | <a href="#SkIRect_makeInset">makeInset</a> | Constructs from sides moved symmetrically about the center. | @@ -66,6 +68,7 @@ its <a href="#SkIRect_top">top</a>, it is considered empty. | <a href="#SkIRect_sort">sort</a> | Orders sides from smaller to larger. | | <a href="#SkIRect_top">top</a> | Returns smaller bounds in <a href="#SkIRect_y">y</a>, if sorted. | | <a href="#SkIRect_width">width</a> | Returns span in <a href="#SkIRect_x">x</a>. | +| <a href="#SkIRect_width64">width64</a> | Returns span in <a href="#SkIRect_y">y</a> as int64_t. | | <a href="#SkIRect_x">x</a> | Returns bounds <a href="#SkIRect_left">left</a>. | | <a href="#SkIRect_y">y</a> | Returns bounds <a href="#SkIRect_top">top</a>. | @@ -528,7 +531,36 @@ large width: -5 ### See Also -<a href="#SkIRect_height">height</a> <a href="#SkRect_width">SkRect::width()</a> +<a href="#SkIRect_height">height</a> <a href="#SkIRect_width64">width64</a> <a href="#SkIRect_height64">height64</a> <a href="#SkRect_width">SkRect::width()</a> + +--- + +<a name="SkIRect_width64"></a> +## width64 + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +int64_t width64() const +</pre> + +Returns span on the <a href="#SkIRect_x">x</a>-axis. This does not check if <a href="#IRect">IRect</a> is sorted, so the +result may be negative. This is safer than calling <a href="#SkIRect_width">width</a> since <a href="#SkIRect_width">width</a> might +overflow in its calculation. + +### Return Value + +<a href="#SkIRect_fRight">fRight</a> minus <a href="#SkIRect_fLeft">fLeft</a> cast to int64_t + +<a href="#SkIRect">SkIRect</a> large = { -2147483647, 1, 2147483644, 2 }; + +#### Example Output + +~~~~ +width: -5 width64: 4294967291 +~~~~ + +### See Also + +<a href="#SkIRect_width">width</a> <a href="#SkIRect_height">height</a> <a href="#SkIRect_height64">height64</a> <a href="#SkRect_width">SkRect::width()</a> --- @@ -565,6 +597,35 @@ large height: -5 --- +<a name="SkIRect_height64"></a> +## height64 + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +int64_t height64() const +</pre> + +Returns span on the <a href="#SkIRect_y">y</a>-axis. This does not check if <a href="#IRect">IRect</a> is sorted, so the +result may be negative. This is safer than calling <a href="#SkIRect_height">height</a> since <a href="#SkIRect_height">height</a> might +overflow in its calculation. + +### Return Value + +<a href="#SkIRect_fBottom">fBottom</a> minus <a href="#SkIRect_fTop">fTop</a> cast to int64_t + +<a href="#SkIRect">SkIRect</a> large = { 1, -2147483647, 2, 2147483644 }; + +#### Example Output + +~~~~ +height: -5 height64: 4294967291 +~~~~ + +### See Also + +<a href="#SkIRect_width">width</a> <a href="#SkIRect_height">height</a> <a href="#SkIRect_width64">width64</a> <a href="#SkRect_height">SkRect::height()</a> + +--- + <a name="SkIRect_size"></a> ## size @@ -676,9 +737,7 @@ left: 1073741824 right: 1073741826 centerX: -1073741823 safe mid x: 1073741825 bool isEmpty() const </pre> -Returns true if <a href="#SkIRect_fLeft">fLeft</a> is equal to or greater than <a href="#SkIRect_fRight">fRight</a>, or if <a href="#SkIRect_fTop">fTop</a> is equal -to or greater than <a href="#SkIRect_fBottom">fBottom</a>. Call <a href="#SkIRect_sort">sort</a> to reverse rectangles with negative -<a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a>. +Returns true if <a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a> . ### Return Value @@ -705,6 +764,39 @@ sorted: {20, 40, 20, 50} is empty --- +<a name="SkIRect_isEmpty64"></a> +## isEmpty64 + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +bool isEmpty64() const +</pre> + +Returns true if <a href="#SkIRect_fLeft">fLeft</a> is equal to or greater than <a href="#SkIRect_fRight">fRight</a>, or if <a href="#SkIRect_fTop">fTop</a> is equal +to or greater than <a href="#SkIRect_fBottom">fBottom</a>. Call <a href="#SkIRect_sort">sort</a> to reverse rectangles with negative +<a href="#SkIRect_width64">width64</a> or <a href="#SkIRect_height64">height64</a>. + +### Return Value + +true if <a href="#SkIRect_width64">width64</a> or <a href="#SkIRect_height64">height64</a> are zero or negative + +<a href="#SkIRect">SkIRect</a> tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}}; +for (auto rect : tests) { + +#### Example Output + +~~~~ +rect: {20, 40, 10, 50} is empty +sorted: {10, 40, 20, 50} is not empty +rect: {20, 40, 20, 50} is empty +sorted: {20, 40, 20, 50} is empty +~~~~ + +### See Also + +<a href="#SkIRect_EmptyIRect">EmptyIRect</a> <a href="#SkIRect_MakeEmpty">MakeEmpty</a> <a href="#SkIRect_sort">sort</a> <a href="#SkRect_isEmpty">SkRect::isEmpty</a> + +--- + <a name="SkIRect_equal_operator"></a> ## operator== @@ -2081,5 +2173,12 @@ rect: 0, 0, 0, 0 static SkIRect SK_WARN_UNUSED_RESULT MakeLargest() </pre> +Returns constructed <a href="#SkIRect">SkIRect</a> setting <a href="#SkIRect_left">left</a> and <a href="#SkIRect_top">top</a> to most negative value, and +setting <a href="#SkIRect_right">right</a> and <a href="#SkIRect_bottom">bottom</a> to most positive value. + +### Return Value + +bounds (<a href="undocumented#SK_MinS32">SK MinS32</a>, <a href="undocumented#SK_MinS32">SK MinS32</a>, <a href="undocumented#SK_MaxS32">SK MaxS32</a>, <a href="undocumented#SK_MaxS32">SK MaxS32</a>) + --- diff --git a/site/user/api/SkImage_Reference.md b/site/user/api/SkImage_Reference.md index 820aa5747e..f0c9b302f5 100644 --- a/site/user/api/SkImage_Reference.md +++ b/site/user/api/SkImage_Reference.md @@ -319,7 +319,7 @@ created <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="ba59d292a18cb0e8a90e1bb143115f1d"><div>The generator returning <a href="undocumented#Picture">Picture</a> cannot be shared; std::move transfers ownership to generated <a href="#Image">Image</a>.</div></fiddle-embed></div> +<div><fiddle-embed name="c2fec0746f88ca34d7dce59dd9bdef9e"><div>The generator returning <a href="undocumented#Picture">Picture</a> cannot be shared; std::move transfers ownership to generated <a href="#Image">Image</a>.</div></fiddle-embed></div> ### See Also @@ -395,10 +395,6 @@ range of colors; may be nullptr</td> 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"> @@ -435,10 +431,6 @@ 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"> @@ -480,7 +472,7 @@ 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 GPU outside of this example.</div></fiddle-embed></div> +<div><fiddle-embed name="d5e43961a54548f445eece91d517381c" gpu="true"><div>A back-end texture has been created and uploaded to the GPU outside of this example.</div></fiddle-embed></div> ### See Also @@ -534,7 +526,7 @@ created <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="6a50c3cb961c23ad9ecbd5caedac0d70"></fiddle-embed></div> +<div><fiddle-embed name="c7be9423f7c2ef819523ba4d607d17b8" gpu="true"></fiddle-embed></div> ### See Also @@ -587,7 +579,7 @@ created <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="90202d8b1df605fdb0c84f2c351f9598"></fiddle-embed></div> +<div><fiddle-embed name="069c7b116479e3ca46f953f07dcbdd36"></fiddle-embed></div> ### See Also @@ -640,7 +632,7 @@ created <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="bb37de3dc4a0c53d48cdfafb90b9b18e"></fiddle-embed></div> +<div><fiddle-embed name="45bca8747b8f49b5be34b520897ef048"></fiddle-embed></div> ### See Also @@ -728,7 +720,7 @@ created <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="aed9b621fdc2135d512b58648d064224"></fiddle-embed></div> +<div><fiddle-embed name="b07964ec9c5c8a6febba805f1cf4d071" gpu="true"></fiddle-embed></div> ### See Also @@ -1036,7 +1028,7 @@ pixel <a href="#SkImage_width">width</a> in <a href="#Image">Image</a> ### Example -<div><fiddle-embed name="4fa6c18eb829d8979cfdbbf6f42e4c97"></fiddle-embed></div> +<div><fiddle-embed name="39a6d0bbeac6d957c2338e0bff865cf8"></fiddle-embed></div> ### See Also @@ -1059,7 +1051,7 @@ pixel <a href="#SkImage_height">height</a> in <a href="#Image">Image</a> ### Example -<div><fiddle-embed name="96c8202a13068e36432006f75b124eee"></fiddle-embed></div> +<div><fiddle-embed name="6e563cb8351d34bd8af555a51bcd7a96"></fiddle-embed></div> ### See Also @@ -1105,7 +1097,7 @@ integral rectangle from origin to <a href="#SkImage_width">width</a> and <a href ### Example -<div><fiddle-embed name="a6617b5d3066aadce2c37ed2184d6098"></fiddle-embed></div> +<div><fiddle-embed name="c204b38b3fc08914b0a634aa4eaec894"></fiddle-embed></div> ### See Also @@ -1157,7 +1149,7 @@ or was parsed from encoded data. ### Example -<div><fiddle-embed name="1c8b8588dbbb1d5df72ee9164ae0aab0"></fiddle-embed></div> +<div><fiddle-embed name="dac1403132a42459d6881585efbfe74b"></fiddle-embed></div> ### See Also @@ -1502,15 +1494,19 @@ storage for one of: <a href="undocumented#GrSurfaceOrigin">kTopLeft GrSurfaceOri ### Return Value -back-end API texture handle +back-end API texture handle, or nullptr ### Example -<div><fiddle-embed name="704b914d622fbff24d7a45647380459e" gpu="true"></fiddle-embed></div> +<div><fiddle-embed name="f8943191063bfcc69f29f2b149df5c6d" gpu="true"></fiddle-embed></div> + +### Example + +<div><fiddle-embed name="a86c580638fcf83f782047b95c60f43f" gpu="true"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_MakeFromTexture">MakeFromTexture</a> <a href="#SkImage_isTextureBacked">isTextureBacked</a> --- @@ -1522,28 +1518,31 @@ enum <a href="#SkImage_CachingHint">CachingHint</a> { <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a>, };</pre> -Hints to image calls where the system might cache computed intermediates (e.g. the results -of decoding or a read-back from the GPU. Passing <a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a> signals that the system's default -behavior is fine. Passing <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a> signals that caching should be avoided. +<a href="#SkImage_CachingHint">CachingHint</a> selects whether Skia may internally cache <a href="#Bitmap">Bitmaps</a> generated by +decoding <a href="#Image">Image</a>, or by copying <a href="#Image">Image</a> from GPU to CPU. The default behavior +allows caching <a href="#Bitmap">Bitmaps</a>. + +Choose <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a> if <a href="#Image">Image</a> pixels are to be used only once, or +if <a href="#Image">Image</a> pixels reside in a cache outside of Skia, or to reduce memory pressure. + +Choosing <a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a> does not ensure that pixels will be cached. +<a href="#Image">Image</a> pixels may not be cached if memory requirements are too large or +pixels are not accessible. ### Constants <table> <tr> - <td><a name="SkImage_kAllow_CachingHint"> <code><strong>SkImage::kAllow_CachingHint </strong></code> </a></td><td>0</td><td></td> + <td><a name="SkImage_kAllow_CachingHint"> <code><strong>SkImage::kAllow_CachingHint </strong></code> </a></td><td>0</td><td>Allows Skia to internally cache decoded and copied pixels.</td> </tr> <tr> - <td><a name="SkImage_kDisallow_CachingHint"> <code><strong>SkImage::kDisallow_CachingHint </strong></code> </a></td><td>1</td><td></td> + <td><a name="SkImage_kDisallow_CachingHint"> <code><strong>SkImage::kDisallow_CachingHint </strong></code> </a></td><td>1</td><td>Disallows Skia from internally caching decoded and copied pixels.</td> </tr> </table> -### Example - -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> - ### See Also -incomplete +<a href="#SkImage_readPixels">readPixels</a> <a href="#SkImage_scalePixels">scalePixels</a> @@ -1555,51 +1554,62 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, CachingHint cachingHint = kAllow_CachingHint) const </pre> -Copy the pixels from the image into the specified buffer (<a href="#SkImage_readPixels_dstPixels">dstPixels</a> + <a href="#SkImage_readPixels_dstRowBytes">dstRowBytes</a>), -converting them into the requested format (<a href="#SkImage_readPixels_dstInfo">dstInfo</a>). The image pixels are read -starting at the specified (<a href="#SkImage_readPixels_srcX">srcX</a>, <a href="#SkImage_readPixels_srcY">srcY</a>) location. -<a href="#SkImage_readPixels_dstInfo">dstInfo</a> and (<a href="#SkImage_readPixels_srcX">srcX</a>, <a href="#SkImage_readPixels_srcY">srcY</a>) offset specifies a source rectangle: +Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Image">Image</a> to <a href="#SkImage_readPixels_dstPixels">dstPixels</a>. Copy starts at offset (<a href="#SkImage_readPixels_srcX">srcX</a>, <a href="#SkImage_readPixels_srcY">srcY</a>), +and does not exceed <a href="#Image">Image</a> (<a href="#SkImage_width">width</a>, <a href="#SkImage_height">height</a>). -<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -<a href="SkRect_Reference#SkRect">SkRect</a> srcR; -srcR.setXYWH(srcX, srcY, dstInfo.width(), <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="#SkImage_height">height</a>);</pre> +<a href="#SkImage_readPixels_dstInfo">dstInfo</a> specifies <a href="#SkImage_width">width</a>, <a href="#SkImage_height">height</a>, <a href="#Color_Type">Color Type</a>, <a href="#Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of +destination. <a href="#SkImage_readPixels_dstRowBytes">dstRowBytes</a> specifics the gap from one destination row to the next. +Returns true if pixels are copied. Returns false if: + +<table> <tr> + <td><a href="#SkImage_readPixels_dstInfo">dstInfo</a>.addr() equals nullptr</td> </tr> <tr> + <td><a href="#SkImage_readPixels_dstRowBytes">dstRowBytes</a> is less than <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="undocumented#SkImageInfo">minRowBytes</a></td> </tr> <tr> + <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> +</table> + +Pixels are copied only if pixel conversion is possible. If <a href="#Image">Image</a> <a href="#Color_Type">Color Type</a> is +<a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="undocumented#SkImageInfo">colorType</a> must match. +If <a href="#Image">Image</a> <a href="#Color_Type">Color Type</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. +If <a href="#Image">Image</a> <a href="#Alpha_Type">Alpha Type</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="#SkImage_alphaType">alphaType</a> must +match. If <a href="#Image">Image</a> <a href="undocumented#Color_Space">Color Space</a> is nullptr, <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. Returns +false if pixel conversion is not possible. + +<a href="#SkImage_readPixels_srcX">srcX</a> and <a href="#SkImage_readPixels_srcY">srcY</a> may be negative to copy only top or left of source. Returns +false if <a href="#SkImage_width">width</a> or <a href="#SkImage_height">height</a> is zero or negative. +Returns false ifabs(srcX) >= <a href="#Image">Image</a> <a href="#SkImage_width">width</a>, +or ifabs(srcY) >= <a href="#Image">Image</a> <a href="#SkImage_height">height</a>. -The source rectangle is intersected with the <a href="#SkImage_bounds">bounds</a> of the image. If this intersection is not empty, -then we have two sets of pixels (of equal size). Replace <a href="#SkImage_readPixels_dstPixels">dstPixels</a> with the -corresponding <a href="#Image">Image</a> pixels, performing any <a href="#Color_Type">Color Type</a>/<a href="#Alpha_Type">Alpha Type</a> transformations needed -(in the case where <a href="#Image">Image</a> and <a href="#SkImage_readPixels_dstInfo">dstInfo</a> have different <a href="#Color_Type">Color Types</a> or <a href="#Alpha_Type">Alpha Types</a>). -This call can fail, returning false, for several reasons: -if source rectangle does not intersect the image <a href="#SkImage_bounds">bounds</a>; -if the requested <a href="#Color_Type">Color Type</a>/<a href="#Alpha_Type">Alpha Type</a> cannot be converted from the image's types. +If <a href="#SkImage_readPixels_cachingHint">cachingHint</a> is <a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a>, pixels may be retained locally. +If <a href="#SkImage_readPixels_cachingHint">cachingHint</a> is <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a>, pixels are not added to the local cache. ### Parameters <table> <tr> <td><a name="SkImage_readPixels_dstInfo"> <code><strong>dstInfo </strong></code> </a></td> <td> -incomplete</td> +destination <a href="#SkImage_width">width</a>, <a href="#SkImage_height">height</a>, <a href="#Color_Type">Color Type</a>, <a href="#Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Space">Color Space</a></td> </tr> <tr> <td><a name="SkImage_readPixels_dstPixels"> <code><strong>dstPixels </strong></code> </a></td> <td> -incomplete</td> +destination pixel storage</td> </tr> <tr> <td><a name="SkImage_readPixels_dstRowBytes"> <code><strong>dstRowBytes </strong></code> </a></td> <td> -incomplete</td> +destination row length</td> </tr> <tr> <td><a name="SkImage_readPixels_srcX"> <code><strong>srcX </strong></code> </a></td> <td> -incomplete</td> +column index whose absolute value is less than <a href="#SkImage_width">width</a></td> </tr> <tr> <td><a name="SkImage_readPixels_srcY"> <code><strong>srcY </strong></code> </a></td> <td> -incomplete</td> +row index whose absolute value is less than <a href="#SkImage_height">height</a></td> </tr> <tr> <td><a name="SkImage_readPixels_cachingHint"> <code><strong>cachingHint </strong></code> </a></td> <td> -incomplete</td> +one of: <a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a>, <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a></td> </tr> </table> ### Return Value -incomplete +true if pixels are copied to <a href="#SkImage_readPixels_dstPixels">dstPixels</a> ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="8aa8ca63dff4641dfc6ea8a3c555d59c"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_scalePixels">scalePixels</a> <a href="#SkBitmap_readPixels">SkBitmap::readPixels</a> <a href="#SkPixmap_readPixels">SkPixmap::readPixels</a> <a href="#SkCanvas_readPixels">SkCanvas::readPixels</a> <a href="#SkSurface_readPixels">SkSurface::readPixels</a> --- @@ -1607,30 +1617,57 @@ incomplete bool readPixels(const SkPixmap& dst, int srcX, int srcY, CachingHint cachingHint = kAllow_CachingHint) const </pre> +Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Image">Image</a> to <a href="#SkImage_readPixels_2_dst">dst</a>. Copy starts at (<a href="#SkImage_readPixels_2_srcX">srcX</a>, <a href="#SkImage_readPixels_2_srcY">srcY</a>), and +does not exceed <a href="#Image">Image</a> (<a href="#SkImage_width">width</a>, <a href="#SkImage_height">height</a>). + +<a href="#SkImage_readPixels_2_dst">dst</a> specifies <a href="#SkImage_width">width</a>, <a href="#SkImage_height">height</a>, <a href="#Color_Type">Color Type</a>, <a href="#Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Space">Color Space</a>, pixel storage, +and row bytes of destination. <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">rowBytes</a> specifics the gap from one destination +row to the next. Returns true if pixels are copied. Returns false if: + +<table> <tr> + <td><a href="#SkImage_readPixels_2_dst">dst</a> pixel storage equals nullptr</td> </tr> <tr> + <td><a href="#SkImage_readPixels_2_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">rowBytes</a> is less than <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a></td> </tr> <tr> + <td><a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td> </tr> +</table> + +Pixels are copied only if pixel conversion is possible. If <a href="#Image">Image</a> <a href="#Color_Type">Color Type</a> is +<a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">colorType</a> must match. +If <a href="#Image">Image</a> <a href="#Color_Type">Color Type</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. +If <a href="#Image">Image</a> <a href="#Alpha_Type">Alpha Type</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="#SkImage_alphaType">alphaType</a> must +match. If <a href="#Image">Image</a> <a href="undocumented#Color_Space">Color Space</a> is nullptr, <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. Returns +false if pixel conversion is not possible. +<a href="#SkImage_readPixels_2_srcX">srcX</a> and <a href="#SkImage_readPixels_2_srcY">srcY</a> may be negative to copy only top or left of source. Returns +false if <a href="#SkImage_width">width</a> or <a href="#SkImage_height">height</a> is zero or negative. +Returns false ifabs(srcX) >= <a href="#Image">Image</a> <a href="#SkImage_width">width</a>, +or ifabs(srcY) >= <a href="#Image">Image</a> <a href="#SkImage_height">height</a>. + +If <a href="#SkImage_readPixels_2_cachingHint">cachingHint</a> is <a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a>, pixels may be retained locally. +If <a href="#SkImage_readPixels_2_cachingHint">cachingHint</a> is <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a>, pixels are not added to the local cache. + ### Parameters <table> <tr> <td><a name="SkImage_readPixels_2_dst"> <code><strong>dst </strong></code> </a></td> <td> -incomplete</td> +destination <a href="SkPixmap_Reference#Pixmap">Pixmap</a>: <a href="#Info">Image Info</a>, pixels, row bytes</td> </tr> <tr> <td><a name="SkImage_readPixels_2_srcX"> <code><strong>srcX </strong></code> </a></td> <td> -incomplete</td> +column index whose absolute value is less than <a href="#SkImage_width">width</a></td> </tr> <tr> <td><a name="SkImage_readPixels_2_srcY"> <code><strong>srcY </strong></code> </a></td> <td> -incomplete</td> +row index whose absolute value is less than <a href="#SkImage_height">height</a></td> </tr> <tr> <td><a name="SkImage_readPixels_2_cachingHint"> <code><strong>cachingHint </strong></code> </a></td> <td> -incomplete</td> +one of: <a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a>, <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a></td> </tr> </table> ### Return Value -incomplete +true if pixels are copied to <a href="#SkImage_readPixels_2_dst">dst</a> ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="b77a73c4baa63a4a8e2a4fdd96144d0b"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_scalePixels">scalePixels</a> <a href="#SkBitmap_readPixels">SkBitmap::readPixels</a> <a href="#SkPixmap_readPixels">SkPixmap::readPixels</a> <a href="#SkCanvas_readPixels">SkCanvas::readPixels</a> <a href="#SkSurface_readPixels">SkSurface::readPixels</a> --- @@ -1642,33 +1679,51 @@ bool scalePixels(const SkPixmap& dst, SkFilterQuality filterQuality, CachingHint cachingHint = kAllow_CachingHint) const </pre> -Copies <a href="#Image">Image</a> pixels into <a href="#SkImage_scalePixels_dst">dst</a>, converting to <a href="#SkImage_scalePixels_dst">dst</a> <a href="#Color_Type">Color Type</a> and <a href="#Alpha_Type">Alpha Type</a>. -If the conversion cannot be performed, false is returned. -If <a href="#SkImage_scalePixels_dst">dst</a> <a href="#SkImage_dimensions">dimensions</a> differ from <a href="#Image">Image</a> <a href="#SkImage_dimensions">dimensions</a>, <a href="#Image">Image</a> is scaled, applying -<a href="#SkImage_scalePixels_filterQuality">filterQuality</a>. +Copies <a href="#Image">Image</a> to <a href="#SkImage_scalePixels_dst">dst</a>, scaling pixels to fit <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_width">width</a> and <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_height">height</a>, and +converting pixels to match <a href="#SkImage_scalePixels_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">colorType</a> and <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_alphaType">alphaType</a>. Returns true if +pixels are copied. Returns false if <a href="#SkImage_scalePixels_dst">dst</a>.addr() is nullptr, or <a href="#SkImage_scalePixels_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">rowBytes</a> is +less than <a href="#SkImage_scalePixels_dst">dst</a> <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>. + +Pixels are copied only if pixel conversion is possible. If <a href="#Image">Image</a> <a href="#Color_Type">Color Type</a> is +<a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkImage_scalePixels_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">colorType</a> must match. +If <a href="#Image">Image</a> <a href="#Color_Type">Color Type</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. +If <a href="#Image">Image</a> <a href="#Alpha_Type">Alpha Type</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_alphaType">alphaType</a> must +match. If <a href="#Image">Image</a> <a href="undocumented#Color_Space">Color Space</a> is nullptr, <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. Returns +false if pixel conversion is not possible. + +Scales the image, with <a href="#SkImage_scalePixels_filterQuality">filterQuality</a>, to match <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_width">width</a> and <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_height">height</a>. +<a href="#SkImage_scalePixels_filterQuality">filterQuality</a> <a href="undocumented#SkFilterQuality">kNone SkFilterQuality</a> is fastest, typically implemented with +<a href="undocumented#Filter_Quality_Nearest_Neighbor">Filter Quality Nearest Neighbor</a>. <a href="undocumented#SkFilterQuality">kLow SkFilterQuality</a> is typically implemented with +<a href="undocumented#Filter_Quality_Bilerp">Filter Quality Bilerp</a>. <a href="undocumented#SkFilterQuality">kMedium SkFilterQuality</a> is typically implemented with +<a href="undocumented#Filter_Quality_Bilerp">Filter Quality Bilerp</a>, and <a href="undocumented#Filter_Quality_MipMap">Filter Quality MipMap</a> when size is reduced. +<a href="undocumented#SkFilterQuality">kHigh SkFilterQuality</a> is slowest, typically implemented with <a href="undocumented#Filter_Quality_BiCubic">Filter Quality BiCubic</a>. + +If <a href="#SkImage_scalePixels_cachingHint">cachingHint</a> is <a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a>, pixels may be retained locally. +If <a href="#SkImage_scalePixels_cachingHint">cachingHint</a> is <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a>, pixels are not added to the local cache. ### Parameters <table> <tr> <td><a name="SkImage_scalePixels_dst"> <code><strong>dst </strong></code> </a></td> <td> -incomplete</td> +destination <a href="SkPixmap_Reference#Pixmap">Pixmap</a>: <a href="#Info">Image Info</a>, pixels, row bytes</td> </tr> <tr> <td><a name="SkImage_scalePixels_filterQuality"> <code><strong>filterQuality </strong></code> </a></td> <td> -incomplete</td> +one of: <a href="undocumented#SkFilterQuality">kNone SkFilterQuality</a>, <a href="undocumented#SkFilterQuality">kLow SkFilterQuality</a>, +<a href="undocumented#SkFilterQuality">kMedium SkFilterQuality</a>, <a href="undocumented#SkFilterQuality">kHigh SkFilterQuality</a></td> </tr> <tr> <td><a name="SkImage_scalePixels_cachingHint"> <code><strong>cachingHint </strong></code> </a></td> <td> -incomplete</td> +one of: <a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a>, <a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a></td> </tr> </table> ### Return Value -incomplete +true if pixels are scaled to fit <a href="#SkImage_scalePixels_dst">dst</a> ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="5949c9a63610cae30019e5b1899ee38f"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkCanvas_drawImage">SkCanvas::drawImage</a> <a href="#SkImage_readPixels">readPixels</a> <a href="#SkPixmap_scalePixels">SkPixmap::scalePixels</a> --- @@ -1681,14 +1736,27 @@ sk_sp<SkData> encodeToData(SkEncodedImageFormat encodedImageFormat, int qu Encodes <a href="#Image">Image</a> pixels, returning result as <a href="undocumented#SkData">SkData</a>. -Returns nullptr if encoding fails, or <a href="#SkImage_encodeToData_encodedImageFormat">encodedImageFormat</a> is not supported. +Returns nullptr if encoding fails, or if <a href="#SkImage_encodeToData_encodedImageFormat">encodedImageFormat</a> is not supported. + +<a href="#Image">Image</a> encoding in a format requires both building with one or more of: +SK_HAS_JPEG_LIBRARY, SK_HAS_PNG_LIBRARY, SK_HAS_WEBP_LIBRARY; and platform support +for the encoded format. + +If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, <a href="#SkImage_encodeToData_encodedImageFormat">encodedImageFormat</a> can +additionally be one of: <a href="#SkEncodedImageFormat_kICO">SkEncodedImageFormat::kICO</a>, <a href="#SkEncodedImageFormat_kBMP">SkEncodedImageFormat::kBMP</a>, +<a href="#SkEncodedImageFormat_kGIF">SkEncodedImageFormat::kGIF</a>. + +<a href="#SkImage_encodeToData_quality">quality</a> is a platform and format specific metric trading off size and encoding +error. When used, <a href="#SkImage_encodeToData_quality">quality</a> equaling 100 encodes with the least error. <a href="#SkImage_encodeToData_quality">quality</a> may +be ignored by the encoder. ### Parameters <table> <tr> <td><a name="SkImage_encodeToData_encodedImageFormat"> <code><strong>encodedImageFormat </strong></code> </a></td> <td> -incomplete</td> +one of: <a href="#SkEncodedImageFormat_kJPEG">SkEncodedImageFormat::kJPEG</a>, <a href="#SkEncodedImageFormat_kPNG">SkEncodedImageFormat::kPNG</a>, +<a href="#SkEncodedImageFormat_kWEBP">SkEncodedImageFormat::kWEBP</a></td> </tr> <tr> <td><a name="SkImage_encodeToData_quality"> <code><strong>quality </strong></code> </a></td> <td> -incomplete</td> +encoder specific metric with 100 equaling best</td> </tr> </table> @@ -1698,11 +1766,11 @@ encoded <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="7a3bf8851bb7160e4e49c48f8c09639d"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_refEncodedData">refEncodedData</a> <a href="#SkImage_MakeFromEncoded">MakeFromEncoded</a> --- @@ -1710,24 +1778,24 @@ incomplete sk_sp<SkData> 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>. If encoded data is missing or invalid, -<a href="#Image">Image</a> is encoded as PNG. +Encodes <a href="#Image">Image</a> pixels, returning result as <a href="undocumented#SkData">SkData</a>. Returns existing encoded data +if present; otherwise, <a href="#Image">Image</a> is encoded with <a href="#SkEncodedImageFormat_kPNG">SkEncodedImageFormat::kPNG</a>. Skia +must be built with SK_HAS_PNG_LIBRARY to encode <a href="#Image">Image</a>. -Returns nullptr if existing encoded data is missing or invalid and +Returns nullptr if existing encoded data is missing or invalid, and encoding fails. ### Return Value -incomplete +encoded <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="30cee813f6aa476b0a9c8a24283e53a3"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_refEncodedData">refEncodedData</a> <a href="#SkImage_MakeFromEncoded">MakeFromEncoded</a> --- @@ -1738,22 +1806,23 @@ incomplete sk_sp<SkData> refEncodedData() const </pre> -If the image already has its contents in encoded form (e.g. PNG or JPEG), return that -as <a href="undocumented#SkData">SkData</a>. If the image does not already has its contents in encoded form, return nullptr. +Returns encoded <a href="#Image">Image</a> pixels as <a href="undocumented#SkData">SkData</a>, if <a href="#Image">Image</a> was created from supported +encoded stream format. Platform support for formats vary and may require building +with one or more of: SK_HAS_JPEG_LIBRARY, SK_HAS_PNG_LIBRARY, SK_HAS_WEBP_LIBRARY. -To force the image to return its contents as encoded data, call <a href="#SkImage_encodeToData">encodeToData</a>. +Returns nullptr if <a href="#Image">Image</a> contents are not encoded. ### Return Value -incomplete +encoded <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="91866923b37edd673c18232fdf3eabd8" gpu="true"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_encodeToData">encodeToData</a> <a href="#SkImage_MakeFromEncoded">MakeFromEncoded</a> --- @@ -1764,24 +1833,27 @@ incomplete const char* toString(SkString* string) const </pre> +Appends <a href="#Image">Image</a> description to <a href="#SkImage_toString_string">string</a>, including unique ID, <a href="#SkImage_width">width</a>, <a href="#SkImage_height">height</a>, and +whether the image is opaque. + ### Parameters <table> <tr> <td><a name="SkImage_toString_string"> <code><strong>string </strong></code> </a></td> <td> -incomplete</td> +storage for description; existing content is preserved</td> </tr> </table> ### Return Value -incomplete +<a href="#SkImage_toString_string">string</a> appended with <a href="#Image">Image</a> description ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="e5eae6d362434154730e3bacff165ebd"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkPaint_toString">SkPaint::toString</a> --- @@ -1792,29 +1864,30 @@ incomplete sk_sp<SkImage> makeSubset(const SkIRect& subset) const </pre> -Return a new image that is a <a href="#SkImage_makeSubset_subset">subset</a> of this image. The underlying implementation may -share the pixels, or it may make a copy. -If <a href="#SkImage_makeSubset_subset">subset</a> does not intersect the <a href="#SkImage_bounds">bounds</a> of this image, or the copy/share cannot be made, -nullptr will be returned. +Returns <a href="#SkImage_makeSubset_subset">subset</a> of <a href="#Image">Image</a>. <a href="#SkImage_makeSubset_subset">subset</a> must be fully contained by <a href="#Image">Image</a> <a href="#SkImage_dimensions">dimensions</a>. +The implementation may share pixels, or may copy them. + +Returns nullptr if <a href="#SkImage_makeSubset_subset">subset</a> is empty, or <a href="#SkImage_makeSubset_subset">subset</a> is not contained by <a href="#SkImage_bounds">bounds</a>, or +pixels in <a href="#Image">Image</a> could not be read or copied. ### Parameters <table> <tr> <td><a name="SkImage_makeSubset_subset"> <code><strong>subset </strong></code> </a></td> <td> -incomplete</td> +<a href="#SkImage_bounds">bounds</a> of returned <a href="#Image">Image</a></td> </tr> </table> ### Return Value -incomplete +partial or full <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="93669037c9eb9d142e7776b9f936fa96"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_MakeFromEncoded">MakeFromEncoded</a> --- @@ -1825,31 +1898,33 @@ incomplete sk_sp<SkImage> makeTextureImage(GrContext* context, SkColorSpace* dstColorSpace) const </pre> -Ensures that an image is backed by a texture (when <a href="undocumented#GrContext">GrContext</a> is non-null), suitable for use -with surfaces that have the supplied destination color space. If no transformation is -required, the returned image may be the same as this image. If this image is from a -different <a href="undocumented#GrContext">GrContext</a>, this will fail. +Returns <a href="#Image">Image</a> backed by <a href="undocumented#GPU_Texture">GPU Texture</a> associated with <a href="#SkImage_makeTextureImage_context">context</a>. Returned <a href="#Image">Image</a> is +compatible with <a href="SkSurface_Reference#Surface">Surface</a> created with <a href="#SkImage_makeTextureImage_dstColorSpace">dstColorSpace</a>. Returns original +<a href="#Image">Image</a> if <a href="#SkImage_makeTextureImage_context">context</a> and <a href="#SkImage_makeTextureImage_dstColorSpace">dstColorSpace</a> match. + +Returns nullptr if <a href="#SkImage_makeTextureImage_context">context</a> is nullptr, or if <a href="#Image">Image</a> was created with another +<a href="undocumented#GrContext">GrContext</a>. ### Parameters <table> <tr> <td><a name="SkImage_makeTextureImage_context"> <code><strong>context </strong></code> </a></td> <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> +range of colors of matching <a href="SkSurface_Reference#Surface">Surface</a> on GPU</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="7d060e137662b233960200b7b2597ba6" gpu="true"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_MakeFromTexture">MakeFromTexture</a> --- @@ -1860,16 +1935,19 @@ incomplete sk_sp<SkImage> 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. +Returns <a href="SkImage_Reference#Raster_Image">Raster Image</a> or <a href="#Lazy_Image">Lazy Image</a>. Copies <a href="#Image">Image</a> backed by <a href="undocumented#GPU_Texture">GPU Texture</a> into +CPU memory if needed. Returns original <a href="#Image">Image</a> if unencoded in <a href="undocumented#Raster_Bitmap">Raster Bitmap</a>, +or if encoded in a stream. + +Returns nullptr if backed by <a href="undocumented#GPU_Texture">GPU Texture</a> and copy fails. ### Return Value -incomplete +<a href="SkImage_Reference#Raster_Image">Raster Image</a>, <a href="#Lazy_Image">Lazy Image</a>, or nullptr ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="220d369551a553f8ba4cd1c21b97a793" gpu="true"></fiddle-embed></div> ### See Also @@ -1884,20 +1962,23 @@ incomplete sk_sp<SkImage> 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. +Returns <a href="SkImage_Reference#Raster_Image">Raster Image</a>. Copies <a href="#Image">Image</a> backed by <a href="undocumented#GPU_Texture">GPU Texture</a> into CPU memory, +or decodes <a href="#Image">Image</a> from <a href="#Lazy_Image">Lazy Image</a>. Returns original <a href="#Image">Image</a> if unencoded in +<a href="undocumented#Raster_Bitmap">Raster Bitmap</a>. + +Returns nullptr if copy, decode, or pixel read fails. ### Return Value -incomplete +<a href="SkImage_Reference#Raster_Image">Raster Image</a>, or nullptr ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="d821b8e345df9ff0c8cbb6d91c588c02" gpu="true"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_isTextureBacked">isTextureBacked</a> <a href="#SkImage_isLazyGenerated">isLazyGenerated</a> <a href="#SkImage_MakeFromRaster">MakeFromRaster</a> --- @@ -1909,20 +1990,27 @@ sk_sp<SkImage> makeWithFilter(const SkImageFilter* filter, const SkIRect& const SkIRect& clipBounds, SkIRect* outSubset, SkIPoint* offset) const </pre> -Apply a given image <a href="#SkImage_makeWithFilter_filter">filter</a> to this image, and return the filtered result. -The <a href="#SkImage_makeWithFilter_subset">subset</a> represents the active portion of this image. The return value is similarly an -<a href="#SkImage">SkImage</a>, with an active <a href="#SkImage_makeWithFilter_subset">subset</a> (<a href="#SkImage_makeWithFilter_outSubset">outSubset</a>). This is usually used with texture-backed -images, where the texture may be approx-match and thus larger than the required size. -<a href="#SkImage_makeWithFilter_clipBounds">clipBounds</a> constrains the device-space extent of the image, stored in <a href="#SkImage_makeWithFilter_outSubset">outSubset</a>. -<a href="#SkImage_makeWithFilter_offset">offset</a> is storage, set to the amount to translate the result when drawn. -If the result image cannot be created, or the result would be transparent black, null -is returned, in which case the <a href="#SkImage_makeWithFilter_offset">offset</a> and <a href="#SkImage_makeWithFilter_outSubset">outSubset</a> parameters should be ignored by the -caller. +Creates filtered <a href="#Image">Image</a>. <a href="#SkImage_makeWithFilter_filter">filter</a> processes original <a href="#Image">Image</a>, potentially changing +color, position, and size. <a href="#SkImage_makeWithFilter_subset">subset</a> is the <a href="#SkImage_bounds">bounds</a> of original <a href="#Image">Image</a> processed +by <a href="#SkImage_makeWithFilter_filter">filter</a>. <a href="#SkImage_makeWithFilter_clipBounds">clipBounds</a> is the expected <a href="#SkImage_bounds">bounds</a> of the filtered <a href="#Image">Image</a>. <a href="#SkImage_makeWithFilter_outSubset">outSubset</a> +is required storage for the actual <a href="#SkImage_bounds">bounds</a> of the filtered <a href="#Image">Image</a>. <a href="#SkImage_makeWithFilter_offset">offset</a> is +required storage for translation of returned <a href="#Image">Image</a>. + +Returns nullptr if <a href="#Image">Image</a> could not be created. If nullptr is returned, <a href="#SkImage_makeWithFilter_outSubset">outSubset</a> +and <a href="#SkImage_makeWithFilter_offset">offset</a> are undefined. + +<a href="#SkImage_makeWithFilter">makeWithFilter</a> is optimized to support <a href="#Image">Image</a> backed by <a href="undocumented#GPU_Texture">GPU Texture</a> drawn in an +animation with <a href="undocumented#SkImageFilter">SkImageFilter</a> that vary in size from one frame to the next. The +created <a href="#Image">Image</a> is drawn at an increased size so that <a href="undocumented#GPU_Texture">GPU Texture</a> can be reused +with different sized effects. <a href="#SkImage_makeWithFilter_outSubset">outSubset</a> describes the valid <a href="#SkImage_bounds">bounds</a> of <a href="undocumented#GPU_Texture">GPU Texture</a> +returned. The returned <a href="#Image">Image</a> may be much larger than required for the <a href="#SkImage_makeWithFilter_filter">filter</a>. +<a href="#SkImage_makeWithFilter_offset">offset</a> translates the returned <a href="#Image">Image</a> to keep subsequent animation frames +aligned with respect to each other. ### Parameters <table> <tr> <td><a name="SkImage_makeWithFilter_filter"> <code><strong>filter </strong></code> </a></td> <td> -incomplete</td> +how <a href="#Image">Image</a> is sampled when transformed</td> </tr> <tr> <td><a name="SkImage_makeWithFilter_subset"> <code><strong>subset </strong></code> </a></td> <td> incomplete</td> </tr> <tr> <td><a name="SkImage_makeWithFilter_clipBounds"> <code><strong>clipBounds </strong></code> </a></td> <td> @@ -1936,19 +2024,21 @@ incomplete</td> ### Return Value -incomplete +filtered <a href="#Image">Image</a>, or nullptr ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="eabb12543886ace5e1212af220a19c6d" gpu="true"><div>In each frame of the animation, filtered <a href="#Image">Image</a> is drawn in a different location. +By translating canvas by returned <a href="#SkImage_makeWithFilter_offset">offset</a>, <a href="#Image">Image</a> appears stationary.</div></fiddle-embed></div> ### See Also -incomplete +<a href="#SkPaint_setImageFilter">SkPaint::setImageFilter</a> --- # <a name="SkImage_DeferredTextureImageUsageParams"></a> Struct SkImage::DeferredTextureImageUsageParams +Used only by Chrome; to be deprecated. <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> struct <a href="#SkImage_DeferredTextureImageUsageParams_DeferredTextureImageUsageParams">DeferredTextureImageUsageParams</a> { @@ -2016,6 +2106,8 @@ size_t getDeferredTextureImageData(const GrContextThreadSafeProxy& contextThread SkColorType dstColorType = kN32_SkColorType) const </pre> +Used only by Chrome; to be deprecated. + 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 @@ -2035,43 +2127,43 @@ When <a href="#SkImage_getDeferredTextureImageData_buffer">buffer</a> is not nul 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. +<a href="#SkImage_getDeferredTextureImageData_dstColorSpace">dstColorSpace</a> is the <a href="undocumented#Color_Space">Color Space</a> 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 GPU. 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>), +does not support <a href="undocumented#Color_Space">Color Space</a> (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> +thread safe GPU context</td> </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_deferredTextureImageUsageParams"> <code><strong>deferredTextureImageUsageParams </strong></code> </a></td> <td> -incomplete</td> +array of <a href="#Image">Image</a> transformations</td> </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_paramCnt"> <code><strong>paramCnt </strong></code> </a></td> <td> -incomplete</td> +entries in <a href="#SkImage_getDeferredTextureImageData_deferredTextureImageUsageParams">deferredTextureImageUsageParams</a> array</td> </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_buffer"> <code><strong>buffer </strong></code> </a></td> <td> -incomplete</td> +storage for <a href="undocumented#GPU_Texture">GPU Texture</a> data, or nullptr</td> </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_dstColorSpace"> <code><strong>dstColorSpace </strong></code> </a></td> <td> -incomplete</td> +<a href="SkSurface_Reference#Surface">Surface</a> <a href="undocumented#Color_Space">Color Space</a>, or nullptr</td> </tr> <tr> <td><a name="SkImage_getDeferredTextureImageData_dstColorType"> <code><strong>dstColorType </strong></code> </a></td> <td> -incomplete</td> +<a href="SkSurface_Reference#Surface">Surface</a> <a href="#Color_Type">Color Type</a></td> </tr> </table> ### Return Value -incomplete +size of storage for <a href="undocumented#GPU_Texture">GPU Texture</a> data ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="31d224ac4d22ba60221c565f9a12ad50" gpu="true"></fiddle-embed></div> ### See Also -incomplete +<a href="#SkImage_MakeFromDeferredTextureImageData">MakeFromDeferredTextureImageData</a> --- @@ -2083,6 +2175,8 @@ static sk_sp<SkImage> MakeFromDeferredTextureImageData(GrContext* context, SkBudgeted budgeted) </pre> +Used only by Chrome; to be deprecated. + 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>. @@ -2202,10 +2296,10 @@ incomplete bool asLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode legacyBitmapMode) const </pre> -Creates raster <a href="SkBitmap_Reference#Bitmap">Bitmap</a> with same pixels as <a href="#Image">Image</a>. If <a href="#SkImage_asLegacyBitmap_legacyBitmapMode">legacyBitmapMode</a> is <a href="#SkImage_kRO_LegacyBitmapMode">kRO LegacyBitmapMode</a>, -returned <a href="#SkImage_asLegacyBitmap_bitmap">bitmap</a> is read-only and immutable. -Returns true if <a href="SkBitmap_Reference#Bitmap">Bitmap</a> is stored in <a href="#SkImage_asLegacyBitmap_bitmap">bitmap</a>. Returns false and resets <a href="#SkImage_asLegacyBitmap_bitmap">bitmap</a> if <a href="SkBitmap_Reference#Bitmap">Bitmap</a> -write did not succeed. +Creates raster <a href="SkBitmap_Reference#Bitmap">Bitmap</a> with same pixels as <a href="#Image">Image</a>. If <a href="#SkImage_asLegacyBitmap_legacyBitmapMode">legacyBitmapMode</a> is +<a href="#SkImage_kRO_LegacyBitmapMode">kRO LegacyBitmapMode</a>, returned <a href="#SkImage_asLegacyBitmap_bitmap">bitmap</a> is read-only and immutable. +Returns true if <a href="SkBitmap_Reference#Bitmap">Bitmap</a> is stored in <a href="#SkImage_asLegacyBitmap_bitmap">bitmap</a>. Returns false and resets <a href="#SkImage_asLegacyBitmap_bitmap">bitmap</a> if +<a href="SkBitmap_Reference#Bitmap">Bitmap</a> write did not succeed. ### Parameters @@ -2254,7 +2348,7 @@ true if <a href="#Image">Image</a> is created as needed ### See Also -incomplete +<a href="#SkImage_isTextureBacked">isTextureBacked</a> MakeNonTextureImage --- @@ -2265,39 +2359,44 @@ incomplete sk_sp<SkImage> makeColorSpace(sk_sp<SkColorSpace> target, SkTransferFunctionBehavior premulBehavior) const </pre> -If <a href="#SkImage_makeColorSpace_target">target</a> is supported, returns an <a href="#SkImage">SkImage</a> in <a href="#SkImage_makeColorSpace_target">target</a> color space. -Otherwise, returns nullptr. -This will leave the image as is if it already in <a href="#SkImage_makeColorSpace_target">target</a> color space. -Otherwise, it will convert the pixels from <a href="#Image">Image</a> color space to <a href="#SkImage_makeColorSpace_target">target</a> -color space. If this-><a href="#SkImage_colorSpace">colorSpace</a> is nullptr, <a href="#Image">Image</a> color space will be -treated as sRGB. +Creates <a href="#Image">Image</a> in <a href="#SkImage_makeColorSpace_target">target</a> <a href="undocumented#Color_Space">Color Space</a>. +Returns nullptr if <a href="#Image">Image</a> could not be created. + +Returns original <a href="#Image">Image</a> if it is in <a href="#SkImage_makeColorSpace_target">target</a> <a href="undocumented#Color_Space">Color Space</a>. +Otherwise, converts pixels from <a href="#Image">Image</a> <a href="undocumented#Color_Space">Color Space</a> to <a href="#SkImage_makeColorSpace_target">target</a> <a href="undocumented#Color_Space">Color Space</a>. +If <a href="#Image">Image</a> <a href="#SkImage_colorSpace">colorSpace</a> returns nullptr, <a href="#Image">Image</a> <a href="undocumented#Color_Space">Color Space</a> is assumed to be sRGB. -If <a href="#SkImage_makeColorSpace_premulBehavior">premulBehavior</a> is <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts <a href="#Image">Image</a> -pixels to a linear space before converting to match destination <a href="#Color_Type">Color Type</a> +<a href="undocumented#SkTransferFunctionBehavior">SkTransferFunctionBehavior</a> is to be deprecated. + +Set <a href="#SkImage_makeColorSpace_premulBehavior">premulBehavior</a> to <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a> to convert <a href="#Image">Image</a> +pixels to a linear space, before converting to destination <a href="#Color_Type">Color Type</a> and <a href="undocumented#Color_Space">Color Space</a>. -If <a href="#SkImage_makeColorSpace_premulBehavior">premulBehavior</a> is <a href="#SkTransferFunctionBehavior_kIgnore">SkTransferFunctionBehavior::kIgnore</a>: <a href="#Image">Image</a> -pixels are treated as if they are linear, regardless of how they are encoded. + +Set <a href="#SkImage_makeColorSpace_premulBehavior">premulBehavior</a> to <a href="#SkTransferFunctionBehavior_kIgnore">SkTransferFunctionBehavior::kIgnore</a> to treat <a href="#Image">Image</a> +pixels as linear, when converting to destination <a href="#Color_Type">Color Type</a> +and <a href="undocumented#Color_Space">Color Space</a>, ignoring pixel encoding. ### Parameters <table> <tr> <td><a name="SkImage_makeColorSpace_target"> <code><strong>target </strong></code> </a></td> <td> -incomplete</td> +<a href="undocumented#Color_Space">Color Space</a> describing color range of returned <a href="#Image">Image</a></td> </tr> <tr> <td><a name="SkImage_makeColorSpace_premulBehavior"> <code><strong>premulBehavior </strong></code> </a></td> <td> -incomplete</td> +one of: <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>, +<a href="#SkTransferFunctionBehavior_kIgnore">SkTransferFunctionBehavior::kIgnore</a></td> </tr> </table> ### Return Value -incomplete +created <a href="#Image">Image</a> in <a href="#SkImage_makeColorSpace_target">target</a> <a href="undocumented#Color_Space">Color Space</a> ### Example -<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> +<div><fiddle-embed name="ab8bcb9acecbee444019a724d2b0503c"></fiddle-embed></div> ### See Also -incomplete +MakeFromPixture <a href="#SkImage_MakeFromTexture">MakeFromTexture</a> --- diff --git a/site/user/api/SkPath_Reference.md b/site/user/api/SkPath_Reference.md index 0633dfd234..e5900b364a 100644 --- a/site/user/api/SkPath_Reference.md +++ b/site/user/api/SkPath_Reference.md @@ -617,7 +617,7 @@ bool interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const Interpolate between <a href="#Path">Paths</a> with <a href="#Point_Array">Point Array</a> of equal size. Copy <a href="#Verb_Array">Verb Array</a> and <a href="#Weight">Weights</a> to <a href="#SkPath_interpolate_out">out</a>, and set <a href="#SkPath_interpolate_out">out</a> <a href="#Point_Array">Point Array</a> to a weighted average of this <a href="#Point_Array">Point Array</a> and <a href="#SkPath_interpolate_ending">ending</a> <a href="#Point_Array">Point Array</a>, using the formula: -(this->points * <a href="#SkPath_interpolate_weight">weight</a>) + <a href="#SkPath_interpolate_ending">ending</a>->points * (1 - <a href="#SkPath_interpolate_weight">weight</a>). +(<a href="#Path">Path</a> <a href="SkPoint_Reference#Point">Point</a> * <a href="#SkPath_interpolate_weight">weight</a>) + <a href="#SkPath_interpolate_ending">ending</a> <a href="SkPoint_Reference#Point">Point</a> * (1 - <a href="#SkPath_interpolate_weight">weight</a>). <a href="#SkPath_interpolate_weight">weight</a> is most useful when between zero (<a href="#SkPath_interpolate_ending">ending</a> <a href="#Point_Array">Point Array</a>) and one (this <a href="#Point_Array">Point Array</a>); will work with values outside of this diff --git a/site/user/api/SkPixmap_Reference.md b/site/user/api/SkPixmap_Reference.md index 4c21b27879..7fa4bb7aa2 100644 --- a/site/user/api/SkPixmap_Reference.md +++ b/site/user/api/SkPixmap_Reference.md @@ -1622,24 +1622,24 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, </pre> Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkPixmap_readPixels_srcX">srcX</a>, <a href="#SkPixmap_readPixels_srcY">srcY</a>), and does not -exceed (this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>). +exceed <a href="#Pixmap">Pixmap</a> (<a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>). <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_dstRowBytes">dstRowBytes</a> specifics the gap from one destination row to the next. Returns true if pixels are copied. Returns false if <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_dstRowBytes">dstRowBytes</a> is less than <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="undocumented#SkImageInfo">minRowBytes</a>. -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkPixmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorType">colorType</a> must match. -If this-><a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. -If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must -match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must +match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns false if pixel conversion is not possible. <a href="#SkPixmap_readPixels_srcX">srcX</a> and <a href="#SkPixmap_readPixels_srcY">srcY</a> may be negative to copy only top or left of source. Returns false if <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Returns false if: -abs(srcX) >= this-><a href="#SkPixmap_width">width</a>, -or ifabs(srcY) >= this-><a href="#SkPixmap_height">height</a>. +abs(srcX) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a>, +or ifabs(srcY) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_height">height</a>. If <a href="#SkPixmap_readPixels_behavior">behavior</a> is <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts source pixels to a linear space before converting to <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>. @@ -1683,21 +1683,21 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes) </pre> Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_2_dstPixels">dstPixels</a>. Copy starts at (0, 0), and does not -exceed (this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>). +exceed <a href="#Pixmap">Pixmap</a> (<a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>). <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_2_dstRowBytes">dstRowBytes</a> specifics the gap from one destination row to the next. Returns true if pixels are copied. Returns false if <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_2_dstRowBytes">dstRowBytes</a> is less than <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="undocumented#SkImageInfo">minRowBytes</a>. -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkPixmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorType">colorType</a> must match. -If this-><a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. -If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must -match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must +match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns false if pixel conversion is not possible. -Returns false if this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. +Returns false if <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. ### Parameters @@ -1730,24 +1730,24 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, </pre> Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_3_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkPixmap_readPixels_3_srcX">srcX</a>, <a href="#SkPixmap_readPixels_3_srcY">srcY</a>), and does not -exceed (this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>). +exceed <a href="#Pixmap">Pixmap</a> (<a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>). <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_3_dstRowBytes">dstRowBytes</a> specifics the gap from one destination row to the next. Returns true if pixels are copied. Returns false if <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_3_dstRowBytes">dstRowBytes</a> is less than <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="undocumented#SkImageInfo">minRowBytes</a>. -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkPixmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorType">colorType</a> must match. -If this-><a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. -If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must -match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must +match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns false if pixel conversion is not possible. <a href="#SkPixmap_readPixels_3_srcX">srcX</a> and <a href="#SkPixmap_readPixels_3_srcY">srcY</a> may be negative to copy only top or left of source. Returns -false if this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. Returns false if: +false if <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Returns false if: -abs(srcX) >= this-><a href="#SkPixmap_width">width</a>, -or ifabs(srcY) >= this-><a href="#SkPixmap_height">height</a>. +abs(srcX) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a>, +or ifabs(srcY) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_height">height</a>. ### Parameters @@ -1783,22 +1783,22 @@ bool readPixels(const SkPixmap& dst, int srcX, int srcY) const </pre> Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_4_dst">dst</a>. Copy starts at (<a href="#SkPixmap_readPixels_4_srcX">srcX</a>, <a href="#SkPixmap_readPixels_4_srcY">srcY</a>), and does not -exceed (this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>). <a href="#SkPixmap_readPixels_4_dst">dst</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, +exceed <a href="#Pixmap">Pixmap</a> (<a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>). <a href="#SkPixmap_readPixels_4_dst">dst</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Image_Color_Type">Color Type</a>, <a href="undocumented#Image_Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of destination. Returns true if pixels are copied. Returns false if <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_rowBytes">rowBytes</a> is less than <a href="#SkPixmap_readPixels_4_dst">dst</a> <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>. -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkPixmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorType">colorType</a> must match. -If this-><a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. -If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_alphaType">alphaType</a> must -match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_alphaType">alphaType</a> must +match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns false if pixel conversion is not possible. <a href="#SkPixmap_readPixels_4_srcX">srcX</a> and <a href="#SkPixmap_readPixels_4_srcY">srcY</a> may be negative to copy only top or left of source. Returns -false this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. Returns false if: +false <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Returns false if: -abs(srcX) >= this-><a href="#SkPixmap_width">width</a>, -or ifabs(srcY) >= this-><a href="#SkPixmap_height">height</a>. +abs(srcX) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a>, +or ifabs(srcY) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_height">height</a>. ### Parameters @@ -1834,13 +1834,13 @@ Copies pixels inside <a href="#SkPixmap_bounds">bounds</a> to <a href="#SkPixmap Returns false if <a href="#SkPixmap_readPixels_5_dst">dst</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_5_dst">dst</a>.<a href="#SkPixmap_rowBytes">rowBytes</a> is less than <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>. -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkPixmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Image_Color_Type">Color Type</a> must match. -If this-><a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. -If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must -match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must +match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns false if pixel conversion is not possible. -Returns false if this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. +Returns false if <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. ### Parameters @@ -1870,19 +1870,19 @@ true if pixels are copied to <a href="#SkPixmap_readPixels_5_dst">dst</a> bool scalePixels(const SkPixmap& dst, SkFilterQuality filterQuality) const </pre> -Copies this to <a href="#SkPixmap_scalePixels_dst">dst</a>, scaling pixels to fit <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_width">width</a> and <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_height">height</a>, and +Copies <a href="SkBitmap_Reference#Bitmap">Bitmap</a> to <a href="#SkPixmap_scalePixels_dst">dst</a>, scaling pixels to fit <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_width">width</a> and <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_height">height</a>, and converting pixels to match <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_colorType">colorType</a> and <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_alphaType">alphaType</a>. Returns true if pixels are copied. Returns false if <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_addr">addr</a> is nullptr, or <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_rowBytes">rowBytes</a> is less than <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>. -Pixels are copied only if pixel conversion is possible. If this-><a href="#SkPixmap_colorType">colorType</a> is +Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, or <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Image_Color_Type">Color Type</a> must match. -If this-><a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. -If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must -match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. +If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Image_Alpha_Type">Alpha Type</a> must +match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns false if pixel conversion is not possible. -Returns false if this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. +Returns false if <a href="SkBitmap_Reference#Bitmap">Bitmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Scales the image, with <a href="#SkPixmap_scalePixels_filterQuality">filterQuality</a>, to match <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_width">width</a> and <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_height">height</a>. <a href="#SkPixmap_scalePixels_filterQuality">filterQuality</a> <a href="undocumented#SkFilterQuality">kNone SkFilterQuality</a> is fastest, typically implemented with @@ -1903,7 +1903,7 @@ one of: <a href="undocumented#SkFilterQuality">kNone SkFilterQuality</a>, <a hre ### Return Value -true if pixels are copied to <a href="#SkPixmap_scalePixels_dst">dst</a> +true if pixels are scaled to fit <a href="#SkPixmap_scalePixels_dst">dst</a> ### Example diff --git a/site/user/api/SkRect_Reference.md b/site/user/api/SkRect_Reference.md index f679e6284c..4a571751a7 100644 --- a/site/user/api/SkRect_Reference.md +++ b/site/user/api/SkRect_Reference.md @@ -2743,5 +2743,12 @@ rect is equal to copy static SkRect SK_WARN_UNUSED_RESULT MakeLargest() </pre> +Returns constructed <a href="#SkRect">SkRect</a> setting <a href="#SkRect_left">left</a> and <a href="#SkRect_top">top</a> to most negative finite value, and +setting <a href="#SkRect_right">right</a> and <a href="#SkRect_bottom">bottom</a> to most positive finite value. + +### Return Value + +bounds (<a href="undocumented#SK_ScalarMin">SK ScalarMin</a>, <a href="undocumented#SK_ScalarMin">SK ScalarMin</a>, <a href="undocumented#SK_ScalarMax">SK ScalarMax</a>, <a href="undocumented#SK_ScalarMax">SK ScalarMax</a>) + --- diff --git a/site/user/api/SkSurface_Reference.md b/site/user/api/SkSurface_Reference.md index 64c6542b9c..58ec8ce6d9 100644 --- a/site/user/api/SkSurface_Reference.md +++ b/site/user/api/SkSurface_Reference.md @@ -1408,7 +1408,7 @@ bool readPixels(const SkPixmap& dst, int srcX, int srcY) Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkSurface_readPixels_dst">dst</a>. -Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_readPixels_srcX">srcX</a>, <a href="#SkSurface_readPixels_srcY">srcY</a>) and (this-><a href="#SkSurface_width">width</a>, this-><a href="#SkSurface_height">height</a>). +Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_readPixels_srcX">srcX</a>, <a href="#SkSurface_readPixels_srcY">srcY</a>) and <a href="#Surface">Surface</a> (<a href="#SkSurface_width">width</a>, <a href="#SkSurface_height">height</a>). Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkSurface_readPixels_dst">dst</a>.<a href="#SkSurface_width">width</a>, <a href="#SkSurface_readPixels_dst">dst</a>.<a href="#SkSurface_height">height</a>). Copies each readable pixel intersecting both rectangles, without scaling, converting to <a href="#SkSurface_readPixels_dst">dst</a>.colorType() and <a href="#SkSurface_readPixels_dst">dst</a>.alphaType() if required. @@ -1462,7 +1462,7 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="SkCanvas_Reference#Canvas">Canvas</a> into <a href="#SkSurface_readPixels_2_dstPixels">dstPixels</a>. -Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_readPixels_2_srcX">srcX</a>, <a href="#SkSurface_readPixels_2_srcY">srcY</a>) and (this-><a href="#SkSurface_width">width</a>, this-><a href="#SkSurface_height">height</a>). +Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_readPixels_2_srcX">srcX</a>, <a href="#SkSurface_readPixels_2_srcY">srcY</a>) and <a href="#Surface">Surface</a> (<a href="#SkSurface_width">width</a>, <a href="#SkSurface_height">height</a>). Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkSurface_width">width</a>, <a href="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkSurface_height">height</a>). Copies each readable pixel intersecting both rectangles, without scaling, converting to <a href="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.colorType() and <a href="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.alphaType() if required. @@ -1522,7 +1522,7 @@ bool readPixels(const SkBitmap& dst, int srcX, int srcY) Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Surface">Surface</a> into bitmap. -Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_readPixels_3_srcX">srcX</a>, <a href="#SkSurface_readPixels_3_srcY">srcY</a>) and (this-><a href="#SkSurface_width">width</a>, this-><a href="#SkSurface_height">height</a>). +Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_readPixels_3_srcX">srcX</a>, <a href="#SkSurface_readPixels_3_srcY">srcY</a>) and <a href="#Surface">Surface</a> (<a href="#SkSurface_width">width</a>, <a href="#SkSurface_height">height</a>). Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (bitmap.<a href="#SkSurface_width">width</a>, bitmap.<a href="#SkSurface_height">height</a>). Copies each readable pixel intersecting both rectangles, without scaling, converting to bitmap.colorType() and bitmap.alphaType() if required. diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm index d782ee8b1b..21c8e730bc 100644 --- a/site/user/api/catalog.htm +++ b/site/user/api/catalog.htm @@ -274,8 +274,8 @@ "stdout": "source origin: 0, 0\\nsubset origin: 32, 64\\n" }, "SkBitmap_pixmap": { - "code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(10, 11));\n SkCanvas offscreen(bitmap);\n offscreen.clear(SK_ColorWHITE);\n SkPaint paint;\n offscreen.drawString(\"&\", 0, 10, paint);\n SkPixmap pixmap = bitmap.pixmap();\n if (pixmap.addr()) {\n const SkPMColor* pixels = pixmap.addr32();\n SkPMColor pmWhite = pixels[0];\n for (int y = 0; y < bitmap.height(); ++y) {\n for (int x = 0; x < bitmap.width(); ++x) {\n SkDebugf(\"%c\", *pixels++ == pmWhite ? '-' : 'x');\n }\n SkDebugf(\"\\n\");\n }\n }\n}", - "hash": "4e2da4cff5fa3752b630a63080b44752", + "code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(10, 11));\n SkCanvas offscreen(bitmap);\n offscreen.clear(SK_ColorWHITE);\n SkPaint paint;\n offscreen.drawString(\"&\", 0, 10, paint);\n const SkPixmap& pixmap = bitmap.pixmap();\n if (pixmap.addr()) {\n SkPMColor pmWhite = *pixmap.addr32(0, 0);\n for (int y = 0; y < pixmap.height(); ++y) {\n for (int x = 0; x < pixmap.width(); ++x) {\n SkDebugf(\"%c\", *pixmap.addr32(x, y) == pmWhite ? '-' : 'x');\n }\n SkDebugf(\"\\n\");\n }\n }\n}", + "hash": "7f972d742dd78d2500034d8867e9ef2f", "file": "SkBitmap_Reference", "name": "SkBitmap::pixmap()", "stdout": "----------\\n---xx-----\\n--x--x----\\n--x-------\\n--xx------\\n--x-x---x-\\n-x---x--x-\\n-x----xx--\\n-xx---x---\\n--xxxx-xx-\\n----------\\n" @@ -2765,27 +2765,6 @@ "name": "SkRect::operator==(const SkRect& a, const SkRect& b)", "stdout": "tests are equal\\n{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal\\n{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal\\n{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal\\n" }, - "SkRect_growToInclude": { - "code": "void draw(SkCanvas* canvas) {\n SkRect rect = { 1, 1, 0, 0 };\n rect.growToInclude( { 42, 24 } );\n SkDebugf(\"rect: %g, %g, %g, %g \", rect.left(), rect.top(), rect.right(), rect.bottom());\n SkDebugf(\"isEmpty: %s\\n\", rect.isEmpty() ? \"true\" : \"false\");\n}", - "hash": "9a2bb963b7bdde80710cac5d148c6ccd", - "file": "SkRect_Reference", - "name": "SkRect::growToInclude", - "stdout": "rect: 1, 1, 42, 24 isEmpty: false\\n" - }, - "SkRect_growToInclude_2": { - "code": "void draw(SkCanvas* canvas) {\n SkPoint pts[] = { { 30, 50 }, { 40, 50 }, { 30, 60 } };\n SkRect rect = { pts[0].fX, pts[0].fY, pts[0].fX, pts[0].fY };\n rect.growToInclude( pts[1] );\n rect.growToInclude( pts[2] );\n SkDebugf(\"rect: %g, %g, %g, %g \", rect.left(), rect.top(), rect.right(), rect.bottom());\n}", - "hash": "73082d5aea2026cae4c42ec587417df2", - "file": "SkRect_Reference", - "name": "SkRect::growToInclude_2", - "stdout": "rect: 30, 50, 40, 60" - }, - "SkRect_growToInclude_3": { - "code": "void draw(SkCanvas* canvas) {\n SkPoint3 pts[] = { { 30, 50, -1 }, { 40, 50, -1 }, { 30, 60, -1 } };\n SkRect rect = { 1, 1, 0, 0 };\n rect.growToInclude((SkPoint* ) &pts[0].fX, sizeof(SkPoint3), SK_ARRAY_COUNT(pts));\n SkDebugf(\"rect: %g, %g, %g, %g \", rect.left(), rect.top(), rect.right(), rect.bottom());\n}", - "hash": "1275f2f35d5ca9412bd2ae0e81e9f2e0", - "file": "SkRect_Reference", - "name": "SkRect::growToInclude_3", - "stdout": "rect: 30, 50, 40, 60 \\n" - }, "SkRect_height": { "code": "void draw(SkCanvas* canvas) {\n SkRect unsorted = { 15, 25, 10, 20 };\n SkDebugf(\"unsorted height: %g\\n\", unsorted.height());\n SkRect large = { 1, -2147483647.f, 2, 2147483644.f };\n SkDebugf(\"large height: %.0f\\n\", large.height());\n}", "hash": "39429e45f05240218ecd511443ab3e44", @@ -4672,14 +4651,6 @@ "file": "SkIPoint_Reference", "name": "SkIPoint::operator-=(const SkIVector& v)" }, - "SkImage_CachingHint": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", - "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", - "file": "SkImage_Reference", - "name": "SkImage::CachingHint" -}, "SkImage_DeferredTextureImageUsageParams": { "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", "width": 256, @@ -4715,16 +4686,16 @@ "SkImage_MakeCrossContextFromEncoded": { "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": 128, - "hash": "90202d8b1df605fdb0c84f2c351f9598", + "height": 64, + "hash": "069c7b116479e3ca46f953f07dcbdd36", "file": "SkImage_Reference", "name": "SkImage::MakeCrossContextFromEncoded" }, "SkImage_MakeCrossContextFromPixmap": { "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": 128, - "hash": "bb37de3dc4a0c53d48cdfafb90b9b18e", + "height": 64, + "hash": "45bca8747b8f49b5be34b520897ef048", "file": "SkImage_Reference", "name": "SkImage::MakeCrossContextFromPixmap" }, @@ -4732,7 +4703,7 @@ "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": "aed9b621fdc2135d512b58648d064224", + "hash": "b07964ec9c5c8a6febba805f1cf4d071", "file": "SkImage_Reference", "name": "SkImage::MakeFromAdoptedTexture_2" }, @@ -4763,8 +4734,8 @@ "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}", "width": 256, - "height": 256, - "hash": "ba59d292a18cb0e8a90e1bb143115f1d", + "height": 128, + "hash": "c2fec0746f88ca34d7dce59dd9bdef9e", "file": "SkImage_Reference", "name": "SkImage::MakeFromGenerator" }, @@ -4777,18 +4748,18 @@ "name": "SkImage::MakeFromPicture" }, "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}", + "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(context, backEndTexture,\n origin, kOpaque_SkAlphaType, nullptr);\n canvas->drawImage(image, x, 0);\n x += 512;\n }\n}", "width": 256, "height": 128, - "hash": "2faa98d6a1d578010326af17ee7e4d2a", + "hash": "d5e43961a54548f445eece91d517381c", "file": "SkImage_Reference", "name": "SkImage::MakeFromTexture_3" }, "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}", + "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n auto debugster = [](SkImage::ReleaseContext releaseContext) -> void {\n *((int *) releaseContext) += 128;\n };\n int x = 0;\n for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> image = SkImage::MakeFromTexture(context, 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": "6a50c3cb961c23ad9ecbd5caedac0d70", + "hash": "c7be9423f7c2ef819523ba4d607d17b8", "file": "SkImage_Reference", "name": "SkImage::MakeFromTexture_4" }, @@ -4809,10 +4780,10 @@ "name": "SkImage::MakeRasterData" }, "SkImage_alphaType": { - "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}", + "code": "void draw(SkCanvas* canvas) {\n const char* alphaTypeStr[] = { \"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\" };\n SkAlphaType alphaType = image->alphaType();\n canvas->drawImage(image, 16, 0);\n SkPaint paint;\n canvas->drawString(alphaTypeStr[(int) alphaType], 20, image->height() + 20, paint);\n}", "width": 256, - "height": 156, - "hash": "1c8b8588dbbb1d5df72ee9164ae0aab0", + "height": 96, + "hash": "dac1403132a42459d6881585efbfe74b", "file": "SkImage_Reference", "name": "SkImage::alphaType" }, @@ -4825,10 +4796,10 @@ "name": "SkImage::asLegacyBitmap" }, "SkImage_bounds": { - "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}", + "code": "void draw(SkCanvas* canvas) {\n SkIRect bounds = image->bounds();\n for (int x : { 0, bounds.width() } ) {\n for (int y : { 0, bounds.height() } ) {\n canvas->drawImage(image, x, y);\n }\n }\n}", "width": 256, "height": 128, - "hash": "a6617b5d3066aadce2c37ed2184d6098", + "hash": "c204b38b3fc08914b0a634aa4eaec894", "file": "SkImage_Reference", "name": "SkImage::bounds()" }, @@ -4841,42 +4812,50 @@ "name": "SkImage::colorSpace" }, "SkImage_encodeToData": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n canvas->scale(4, 4);\n SkIRect subset = {0, 0, 16, 64};\n int x = 0;\n for (int quality : { 0, 10, 50, 100 } ) {\n sk_sp<SkData> data(image->encodeToData(SkEncodedImageFormat::kJPEG, quality));\n sk_sp<SkImage> filtered = SkImage::MakeFromEncoded(data, &subset);\n canvas->drawImage(filtered, x, 0);\n x += 16;\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "7a3bf8851bb7160e4e49c48f8c09639d", "file": "SkImage_Reference", "name": "SkImage::encodeToData" }, "SkImage_encodeToData_2": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n canvas->scale(4, 4);\n SkIRect subset = {136, 32, 200, 96};\n sk_sp<SkData> data(image->encodeToData());\n sk_sp<SkImage> eye = SkImage::MakeFromEncoded(data, &subset);\n canvas->drawImage(eye, 0, 0);\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "30cee813f6aa476b0a9c8a24283e53a3", "file": "SkImage_Reference", "name": "SkImage::encodeToData_2" }, "SkImage_getDeferredTextureImageData": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n sk_sp<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());\n auto params = SkImage::DeferredTextureImageUsageParams(SkMatrix::MakeScale(2, 2),\n kNone_SkFilterQuality, 0);\n SkColorSpace* colorSpace = canvas->imageInfo().colorSpace();\n size_t requiredMemoryInBytes = image->getDeferredTextureImageData(\n *proxy, ¶ms, 1, nullptr, colorSpace);\n std::vector<uint8_t> memory;\n memory.resize(requiredMemoryInBytes);\n image->getDeferredTextureImageData(*proxy, ¶ms, 1, memory.data(), colorSpace);\n sk_sp<SkImage> uploadedEncodedImage = SkImage::MakeFromDeferredTextureImageData(\n context, memory.data(), SkBudgeted::kNo);\n canvas->scale(2, 2);\n canvas->drawImage(uploadedEncodedImage, 10, 10);\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "31d224ac4d22ba60221c565f9a12ad50", "file": "SkImage_Reference", "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}", + "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 = -10;\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: 0x%x\", readBackHandle);\n canvas->drawString(str, 5, y += 30, paint);\n canvas->drawImage(srcImage, 80, y += 10);\n str.printf(\"origin: k%s_GrSurfaceOrigin\", readBackOrigin ? \"BottomLeft\" : \"TopLeft\");\n canvas->drawString(str, 5, y += srcImage->height() + 10, paint);\n }\n}", "width": 256, "height": 256, - "hash": "704b914d622fbff24d7a45647380459e", + "hash": "f8943191063bfcc69f29f2b149df5c6d", "file": "SkImage_Reference", "name": "SkImage::getTextureHandle" }, + "SkImage_getTextureHandle_a": { + "code": "void draw(SkCanvas* canvas) {\n auto drawImage = [=](sk_sp<SkImage> image, const char* label) -> void {\n if (nullptr == image) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->drawImage(image, 0, image->height() / 4);\n canvas->drawString(label, image->width() / 2, image->height() / 8, paint);\n GrSurfaceOrigin readBackOrigin;\n GrBackendObject readBackHandle = image->getTextureHandle(false, &readBackOrigin);\n canvas->drawString(readBackHandle ? \"has readBackHandle\" : \"no readBackHandle\",\n image->width() / 2, image->height() * 11 / 8, paint);\n };\n drawImage(image, \"image\");\n canvas->translate(image->width(), 0);\n sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, nullptr));\n drawImage(textureImage, \"backEndTexture\");\n}", + "width": 256, + "height": 256, + "hash": "a86c580638fcf83f782047b95c60f43f", + "file": "SkImage_Reference", + "name": "SkImage::getTextureHandle_2" +}, "SkImage_height": { - "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}", + "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 canvas->drawString(\"height\", 25, image->height() / 2, paint);\n}", "width": 256, - "height": 148, - "hash": "96c8202a13068e36432006f75b124eee", + "height": 96, + "hash": "6e563cb8351d34bd8af555a51bcd7a96", "file": "SkImage_Reference", "name": "SkImage::height()" }, @@ -4913,26 +4892,26 @@ "name": "SkImage::isValid" }, "SkImage_makeColorSpace": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkColorSpace> normalColorSpace = SkColorSpace::MakeRGB(\n SkColorSpace::kSRGB_RenderTargetGamma, SkColorSpace::kSRGB_Gamut);\n sk_sp<SkColorSpace> wackyColorSpace = normalColorSpace->makeColorSpin();\n for (auto colorSpace : { normalColorSpace, wackyColorSpace } ) {\n for (auto transfer : { SkTransferFunctionBehavior::kRespect,\n SkTransferFunctionBehavior::kIgnore } ) {\n sk_sp<SkImage> colorSpaced = image->makeColorSpace(colorSpace, transfer);\n canvas->drawImage(colorSpaced, 0, 0);\n canvas->translate(128, 0);\n }\n canvas->translate(-256, 128);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "ab8bcb9acecbee444019a724d2b0503c", "file": "SkImage_Reference", "name": "SkImage::makeColorSpace" }, "SkImage_makeNonTextureImage": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n auto drawImage = [=](sk_sp<SkImage> image, const char* label) -> void {\n if (nullptr == image) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextAlign(SkPaint::kCenter_Align);\n sk_sp<SkImage> nonTexture(image->makeNonTextureImage());\n canvas->drawImage(nonTexture, 0, 0);\n canvas->drawString(label, nonTexture->width() / 2, nonTexture->height() / 4, paint);\n };\n sk_sp<SkImage> bitmapImage(SkImage::MakeFromBitmap(source));\n sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, nullptr));\n drawImage(image, \"image\");\n canvas->translate(image->width(), 0);\n drawImage(bitmapImage, \"source\");\n canvas->translate(-image->width(), image->height());\n drawImage(textureImage, \"backEndTexture\");\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "220d369551a553f8ba4cd1c21b97a793", "file": "SkImage_Reference", "name": "SkImage::makeNonTextureImage" }, "SkImage_makeRasterImage": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n auto drawImage = [=](sk_sp<SkImage> image, const char* label) -> void {\n if (nullptr == image) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextAlign(SkPaint::kCenter_Align);\n sk_sp<SkImage> raster(image->makeRasterImage());\n canvas->drawImage(raster, 0, 0);\n canvas->drawString(label, raster->width() / 2, raster->height() / 4, paint);\n };\n sk_sp<SkImage> bitmapImage(SkImage::MakeFromBitmap(source));\n sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, nullptr));\n drawImage(image, \"image\");\n canvas->translate(image->width(), 0);\n drawImage(bitmapImage, \"source\");\n canvas->translate(-image->width(), image->height());\n drawImage(textureImage, \"backEndTexture\");\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "d821b8e345df9ff0c8cbb6d91c588c02", "file": "SkImage_Reference", "name": "SkImage::makeRasterImage" }, @@ -4953,42 +4932,42 @@ "name": "SkImage::makeShader_2" }, "SkImage_makeSubset": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n canvas->scale(.5f, .5f);\n const int width = 32;\n const int height = 32;\n for (int y = 0; y < 512; y += height ) {\n for (int x = 0; x < 512; x += width ) {\n sk_sp<SkImage> subset(image->makeSubset({x, y, x + width, y + height}));\n canvas->drawImage(subset, x * 3 / 2, y * 3 / 2);\n }\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "93669037c9eb9d142e7776b9f936fa96", "file": "SkImage_Reference", "name": "SkImage::makeSubset" }, "SkImage_makeTextureImage": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n auto drawImage = [=](sk_sp<SkImage> image, GrContext* context, const char* label) -> void {\n if (nullptr == image || nullptr == context) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextAlign(SkPaint::kCenter_Align);\n sk_sp<SkImage> texture(image->makeTextureImage(context, nullptr));\n canvas->drawImage(texture, 0, 0);\n canvas->drawString(label, texture->width() / 2, texture->height() / 4, paint);\n };\n sk_sp<SkImage> bitmapImage(SkImage::MakeFromBitmap(source));\n GrContext* context = canvas->getGrContext();\n sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(context, backEndTexture,\n kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, nullptr));\n drawImage(image, context, \"image\");\n canvas->translate(image->width(), 0);\n drawImage(bitmapImage, context, \"source\");\n canvas->translate(-image->width(), image->height());\n drawImage(textureImage, context, \"backEndTexture\");\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "7d060e137662b233960200b7b2597ba6", "file": "SkImage_Reference", "name": "SkImage::makeTextureImage" }, "SkImage_makeWithFilter": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkImageFilter> shadowFilter = SkDropShadowImageFilter::Make(\n -10.0f * frame, 5.0f * frame, 3.0f, 3.0f, SK_ColorBLUE,\n SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode,\n nullptr);\n sk_sp<SkImageFilter> offsetFilter = SkOffsetImageFilter::Make(40, 40, shadowFilter, nullptr);\n SkIRect subset = image->bounds();\n SkIRect clipBounds = image->bounds();\n clipBounds.outset(60, 60);\n SkIRect outSubset;\n SkIPoint offset;\n sk_sp<SkImage> filtered(image->makeWithFilter(offsetFilter.get(), subset, clipBounds,\n &outSubset, &offset));\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n canvas->drawLine(0, 0, offset.fX, offset.fY, paint);\n canvas->translate(offset.fX, offset.fY);\n canvas->drawImage(filtered, 0, 0);\n canvas->drawRect(SkRect::MakeFromIRect(outSubset), paint);\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "eabb12543886ace5e1212af220a19c6d", "file": "SkImage_Reference", "name": "SkImage::makeWithFilter" }, "SkImage_readPixels": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n canvas->scale(.5f, .5f);\n const int width = 32;\n const int height = 32;\n std::vector<int32_t> dstPixels;\n dstPixels.resize(height * width * 4);\n SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);\n for (int y = 0; y < 512; y += height ) {\n for (int x = 0; x < 512; x += width ) {\n if (image->readPixels(info, &dstPixels.front(), width * 4, x, y)) {\n SkPixmap dstPixmap(info, &dstPixels.front(), width * 4);\n SkBitmap bitmap;\n bitmap.installPixels(dstPixmap);\n canvas->drawBitmap(bitmap, 0, 0);\n }\n canvas->translate(48, 0);\n }\n canvas->translate(-16 * 48, 48);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "8aa8ca63dff4641dfc6ea8a3c555d59c", "file": "SkImage_Reference", "name": "SkImage::readPixels" }, "SkImage_readPixels_2": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n std::vector<int32_t> srcPixels;\n int rowBytes = image->width() * 4;\n int quarterWidth = image->width() / 4;\n int quarterHeight = image->height() / 4;\n srcPixels.resize(image->height() * rowBytes);\n for (int y = 0; y < 4; ++y) {\n for (int x = 0; x < 4; ++x) {\n SkPixmap pixmap(SkImageInfo::MakeN32Premul(quarterWidth, quarterHeight),\n &srcPixels.front() + x * image->height() * quarterWidth +\n y * quarterWidth, rowBytes);\n image->readPixels(pixmap, x * quarterWidth, y * quarterHeight);\n }\n }\n canvas->scale(.5f, .5f);\n SkBitmap bitmap;\n bitmap.installPixels(SkImageInfo::MakeN32Premul(image->width(), image->height()),\n &srcPixels.front(), rowBytes);\n canvas->drawBitmap(bitmap, 0, 0);\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "b77a73c4baa63a4a8e2a4fdd96144d0b", "file": "SkImage_Reference", "name": "SkImage::readPixels_2" }, @@ -5001,26 +4980,26 @@ "name": "SkImage::refColorSpace" }, "SkImage_refEncodedData": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n struct {\n const char* name;\n sk_sp<SkImage> image;\n } tests[] = { { \"image\", image }, { \"bitmap\", SkImage::MakeFromBitmap(source) },\n { \"texture\", SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, nullptr) } };\n SkString string;\n SkPaint paint;\n for (const auto& test : tests ) {\n if (!test.image) {\n string.printf(\"no %s\", test.name);\n } else {\n string.printf(\"%s\" \"encoded %s\", test.image->refEncodedData() ? \"\" : \"no \", test.name);\n }\n canvas->drawString(string, 10, 20, paint);\n canvas->translate(0, 20);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "91866923b37edd673c18232fdf3eabd8", "file": "SkImage_Reference", "name": "SkImage::refEncodedData" }, "SkImage_scalePixels": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n std::vector<int32_t> srcPixels;\n int quarterWidth = image->width() / 16;\n int rowBytes = quarterWidth * 4;\n int quarterHeight = image->height() / 16;\n srcPixels.resize(quarterHeight * rowBytes);\n SkPixmap pixmap(SkImageInfo::MakeN32Premul(quarterWidth, quarterHeight),\n &srcPixels.front(), rowBytes);\n canvas->scale(4, 4);\n SkFilterQuality qualities[] = { kNone_SkFilterQuality, kLow_SkFilterQuality,\n kMedium_SkFilterQuality, kHigh_SkFilterQuality };\n for (unsigned index = 0; index < SK_ARRAY_COUNT(qualities); ++index) {\n image->scalePixels(pixmap, qualities[index]);\n sk_sp<SkImage> filtered = SkImage::MakeFromRaster(pixmap, nullptr, nullptr);\n canvas->drawImage(filtered, 16 * index, 0);\n }\n}", "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "height": 128, + "hash": "5949c9a63610cae30019e5b1899ee38f", "file": "SkImage_Reference", "name": "SkImage::scalePixels" }, "SkImage_toString": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n struct {\n const char* name;\n sk_sp<SkImage> image;\n } tests[] = { { \"image\", image }, { \"bitmap\", SkImage::MakeFromBitmap(source) },\n { \"texture\", SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, nullptr) } };\n SkString string;\n SkPaint paint;\n for (const auto& test : tests ) {\n string.printf(\"%s: \", test.name);\n test.image ? (void) test.image->toString(&string) : string.append(\"no image\");\n canvas->drawString(string, 10, 20, paint);\n canvas->translate(0, 20);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "e5eae6d362434154730e3bacff165ebd", "file": "SkImage_Reference", "name": "SkImage::toString" }, @@ -5035,8 +5014,8 @@ "SkImage_width": { "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": 168, - "hash": "4fa6c18eb829d8979cfdbbf6f42e4c97", + "height": 96, + "hash": "39a6d0bbeac6d957c2338e0bff865cf8", "file": "SkImage_Reference", "name": "SkImage::width()" }, diff --git a/site/user/api/undocumented.md b/site/user/api/undocumented.md index b0bbeba90f..8de6faf503 100644 --- a/site/user/api/undocumented.md +++ b/site/user/api/undocumented.md @@ -262,6 +262,55 @@ void draw(SkCanvas*, const SkMatrix* = NULL) # <a name="SkDumpCanvas"></a> Class SkDumpCanvas +# <a name="Encoded_Image_Format"></a> Encoded Image Format + +## <a name="SkEncodedImageFormat"></a> Enum SkEncodedImageFormat + +### Constants + +<table> + <tr> + <td><a name="SkEncodedImageFormat_kUnknown"> <code><strong>SkEncodedImageFormat::kUnknown </strong></code> </a></td><td>0</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kBMP"> <code><strong>SkEncodedImageFormat::kBMP </strong></code> </a></td><td>1</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kGIF"> <code><strong>SkEncodedImageFormat::kGIF </strong></code> </a></td><td>2</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kICO"> <code><strong>SkEncodedImageFormat::kICO </strong></code> </a></td><td>3</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kJPEG"> <code><strong>SkEncodedImageFormat::kJPEG </strong></code> </a></td><td>4</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kPNG"> <code><strong>SkEncodedImageFormat::kPNG </strong></code> </a></td><td>5</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kWBMP"> <code><strong>SkEncodedImageFormat::kWBMP </strong></code> </a></td><td>6</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kWEBP"> <code><strong>SkEncodedImageFormat::kWEBP </strong></code> </a></td><td>7</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kPKM"> <code><strong>SkEncodedImageFormat::kPKM </strong></code> </a></td><td>8</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kKTX"> <code><strong>SkEncodedImageFormat::kKTX </strong></code> </a></td><td>9</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kASTC"> <code><strong>SkEncodedImageFormat::kASTC </strong></code> </a></td><td>10</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kDNG"> <code><strong>SkEncodedImageFormat::kDNG </strong></code> </a></td><td>11</td><td></td> + </tr> + <tr> + <td><a name="SkEncodedImageFormat_kHEIF"> <code><strong>SkEncodedImageFormat::kHEIF </strong></code> </a></td><td>12</td><td></td> + </tr> + +</table> + # <a name="Filter_Quality"></a> Filter Quality ## <a name="SkFilterQuality"></a> Enum SkFilterQuality diff --git a/site/user/api/usingBookmaker.md b/site/user/api/usingBookmaker.md index d420402b0e..69ec3c53a7 100644 --- a/site/user/api/usingBookmaker.md +++ b/site/user/api/usingBookmaker.md @@ -2,6 +2,7 @@ usingBookmaker === # <a name="Bookmaker"></a> Bookmaker +How to use the <a href="#Bookmaker">Bookmaker</a> utility. ## <a name="Broken_Build"></a> Broken Build @@ -14,6 +15,18 @@ To fix this, edit the docs file corresponding to the changed include file. For instance, if the change was made to <a href="SkIRect_Reference#SkIRect">SkIRect</a>, edit docs/SkIRect_Reference.bmh. Checking in the edited docs/SkIRect_Reference.bmh will fix the bot. +If the interface is deprecated, but still present in the interface, mark-up the +documentation to be deprecated as well. + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +# void someMethodThatIsNowDeprecated() + +#Deprecated +## + +## +</pre> + To regenerate the documentation, follow the <a href="#Installing">Installing</a> and <a href="#Regenerate">Regenerate</a> steps below. If the <a href="https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-Nightly-Bookmaker">Housekeeper-Nightly-Bookmaker</a> bot is red, one of several things may have gone wrong: @@ -52,7 +65,24 @@ wrote updated <a href="SkSurface_Reference#SkSurface">SkSurface</a>.h</pre> The updated SkSurface.h is written to the root to avoid subsequent runs of <a href="#Bookmaker">Bookmaker</a> from recompiling. if SkSurface.h was not changed, it is not written, and <a href="#Bookmaker">Bookmaker</a> will not generate any output. -How to use the <a href="#Bookmaker">Bookmaker</a> utility. + +## <a name="Broken_Example"></a> Broken Example + +An example may cause <a href="#Bookmaker">Bookmaker</a> or a bot running <a href="#Bookmaker">Bookmaker</a> to fail if it can't +be compiled by fiddle. If the example cannot be fixed, it can be commented out +by changing + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +#Example</pre> + +to + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +#NoExample</pre> + +. +The disabled example can contain additional markup, +which will be ignored. ## <a name="Installing"></a> Installing |