diff options
author | Cary Clark <caryclark@skia.org> | 2017-10-26 07:58:48 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-26 12:17:36 +0000 |
commit | 154beea85961f73ed7f0da047b7ebd16d2a2d829 (patch) | |
tree | 1e128ab8ce82ea6fd9c1a933d5bb36516dd9af4e /site | |
parent | 456b292956bbc8e90a50be74fc9ccb95ebf11ebd (diff) |
Add docs for SkMatrix, SkRect, SkIRect, SkBitmap
Also minor changes to earlier docs.
Many small changes to improve indentation in generated includes.
Added support for matrix math illustrations.
Docs-Preview: https://skia.org/?cl=58500
Bug: skia:6898
Change-Id: I7da58ad55f82d7fd41d19288beb2cd71730fb01f
Reviewed-on: https://skia-review.googlesource.com/58500
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'site')
-rw-r--r-- | site/user/api/SkBitmap_Reference.md | 248 | ||||
-rw-r--r-- | site/user/api/SkCanvas_Reference.md | 84 | ||||
-rw-r--r-- | site/user/api/SkIRect_Reference.md | 20 | ||||
-rw-r--r-- | site/user/api/SkMatrix_Reference.md | 4459 | ||||
-rw-r--r-- | site/user/api/SkPaint_Reference.md | 51 | ||||
-rw-r--r-- | site/user/api/SkPath_Reference.md | 71 | ||||
-rw-r--r-- | site/user/api/SkPixmap_Reference.md | 91 | ||||
-rw-r--r-- | site/user/api/SkRect_Reference.md | 11 | ||||
-rw-r--r-- | site/user/api/undocumented.md | 21 | ||||
-rw-r--r-- | site/user/api/usingBookmaker.md | 22 |
10 files changed, 4685 insertions, 393 deletions
diff --git a/site/user/api/SkBitmap_Reference.md b/site/user/api/SkBitmap_Reference.md index abff9ffbb1..4182c50733 100644 --- a/site/user/api/SkBitmap_Reference.md +++ b/site/user/api/SkBitmap_Reference.md @@ -74,8 +74,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | <a href="#SkBitmap_bytesPerPixel">bytesPerPixel</a> | Returns number of bytes in pixel based on <a href="undocumented#Color_Type">Color Type</a>. | | <a href="#SkBitmap_colorSpace">colorSpace</a> | Returns <a href="#Info">Image Info</a> <a href="undocumented#Color_Space">Color Space</a>. | | <a href="#SkBitmap_colorType">colorType</a> | Returns <a href="#Info">Image Info</a> <a href="undocumented#Color_Type">Color Type</a>. | -| <a href="#SkBitmap_computeSafeSize64">computeSafeSize64</a> | Returns minimum size required for pixels in 64 bits. | -| <a href="#SkBitmap_computeSize64">computeSize64</a> | Returns conservative size required for pixels. | +| <a href="#SkBitmap_computeByteSize">computeByteSize</a> | Returns size required for pixels. | | <a href="#SkBitmap_dimensions">dimensions</a> | Returns <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a>. | | <a href="#SkBitmap_drawsNothing">drawsNothing</a> | Returns true if no <a href="#SkBitmap_width">width</a>, no <a href="#SkBitmap_height">height</a>, or no <a href="undocumented#Pixel_Ref">Pixel Ref</a>. | | <a href="#SkBitmap_empty">empty</a> | Returns true if <a href="#Info">Image Info</a> has zero <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a>. | @@ -83,7 +82,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | <a href="#SkBitmap_eraseARGB">eraseARGB</a> | Writes <a href="undocumented#Color">Color</a> to pixels. | | <a href="#SkBitmap_eraseArea">eraseArea</a> | Deprecated | | <a href="#SkBitmap_eraseColor">eraseColor</a> | Writes <a href="undocumented#Color">Color</a> to pixels. | -| <a href="#SkBitmap_eraseRGB">eraseRGB</a> | Writes opaque <a href="undocumented#Color">Color</a> to pixels. | +| <a href="#SkBitmap_eraseRGB">eraseRGB</a> | Deprecated | | <a href="#SkBitmap_extractAlpha">extractAlpha</a> | Creates <a href="#Bitmap">Bitmap</a> containing <a href="#Alpha">Alpha</a> of pixels. | | <a href="#SkBitmap_extractSubset">extractSubset</a> | Creates <a href="#Bitmap">Bitmap</a>, sharing pixels if possible. | | <a href="#SkBitmap_getAddr">getAddr</a> | Returns readable pixel address as void pointer. | @@ -94,8 +93,6 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | <a href="#SkBitmap_getColor">getColor</a> | Returns one pixel as <a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>. | | <a href="#SkBitmap_getGenerationID">getGenerationID</a> | Returns unique ID. | | <a href="#SkBitmap_getPixels">getPixels</a> | Returns address of pixels. | -| <a href="#SkBitmap_getSafeSize">getSafeSize</a> | Returns minimum size required for pixels in 32 bits. | -| <a href="#SkBitmap_getSize">getSize</a> | Returns conservative size required for pixels in 32 bits. | | <a href="#SkBitmap_getSubset">getSubset</a> | Returns <a href="#SkBitmap_bounds">bounds</a> offset by origin. | | <a href="#SkBitmap_hasHardwareMipMap">hasHardwareMipMap</a> | Returns <a href="undocumented#Mip_Map">Mip Map</a> support present; <a href="undocumented#Android">Android</a> only. | | <a href="#SkBitmap_height">height</a> | Returns pixel row count. | @@ -129,12 +126,13 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | <a href="#SkBitmap_tryAllocN32Pixels">tryAllocN32Pixels</a> | Allocates compatible <a href="#ARGB">Color ARGB</a> pixels if possible. | | <a href="#SkBitmap_tryAllocPixels">tryAllocPixels</a> | Allocates pixels from <a href="#Info">Image Info</a> if possible. | | <a href="#SkBitmap_tryAllocPixelsFlags">tryAllocPixelsFlags</a> | Allocates pixels from <a href="#Info">Image Info</a> with options if possible. | +| <a href="#SkBitmap_validate">validate</a> | Asserts if <a href="#Bitmap">Bitmap</a> is invalid (debug only). | | <a href="#SkBitmap_width">width</a> | Returns pixel column count. | | <a href="#SkBitmap_writePixels">writePixels</a> | Copies and converts pixels. | # <a name="SkBitmap::Allocator"></a> Class SkBitmap::Allocator -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> class <a href="#SkBitmap_Allocator">Allocator</a> : public <a href="undocumented#SkRefCnt">SkRefCnt</a> { public: virtual bool <a href="#SkBitmap_Allocator_allocPixelRef">allocPixelRef(SkBitmap* bitmap)</a> = 0; @@ -172,7 +170,7 @@ true if <a href="undocumented#Pixel_Ref">Pixel Ref</a> was allocated # <a name="SkBitmap::HeapAllocator"></a> Class SkBitmap::HeapAllocator -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> class <a href="#SkBitmap_HeapAllocator">HeapAllocator</a> : public <a href="#SkBitmap_Allocator">Allocator</a> { public: bool <a href="#SkBitmap_HeapAllocator_allocPixelRef">allocPixelRef(SkBitmap* bitmap)</a> override; @@ -516,6 +514,7 @@ int width() const </pre> Returns pixel count in each pixel row. Should be equal or less than: + <a href="#SkBitmap_rowBytes">rowBytes</a> / <a href="#SkBitmap_info">info</a>.<a href="#SkBitmap_bytesPerPixel">bytesPerPixel</a>. Maybe be less than <a href="#SkBitmap_pixelRef">pixelRef</a>.<a href="#SkBitmap_width">width</a>. Will not exceed <a href="#SkBitmap_pixelRef">pixelRef</a>.<a href="#SkBitmap_width">width</a> less @@ -1096,175 +1095,6 @@ width: 1000000 height: 1000000 computeByteSize: 4999999000000 --- -<a name="SkBitmap_getSize"></a> -## getSize - -<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> -size_t getSize() const -</pre> - -Returns conservative memory required for pixel storage. -Includes unused memory on last row when <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkBitmap_width">width</a>. - -Does not check to see if result fits in 32 bits. Use getSize64() if the -result may exceed 32 bits. - -### Return Value - -<a href="#SkBitmap_height">height</a> times <a href="#SkBitmap_rowBytes">rowBytes</a> - -### Example - -<div><fiddle-embed name="798d5f259dbd1ead4f3b1eac955c2cde"><div><a href="#SkBitmap_getSize">getSize</a> results are not useful when <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a> are large.</div> - -#### Example Output - -~~~~ -width: 1 height: 1 getSize: 5 -width: 1 height: 1000 getSize: 5000 -width: 1 height: 1000000 getSize: 5000000 -width: 1000 height: 1 getSize: 5000 -width: 1000 height: 1000 getSize: 5000000 -width: 1000 height: 1000000 getSize: 705032704 -width: 1000000 height: 1 getSize: 5000000 -width: 1000000 height: 1000 getSize: 705032704 -width: 1000000 height: 1000000 getSize: 658067456 -~~~~ - -</fiddle-embed></div> - -### See Also - -<a href="#SkBitmap_getSafeSize">getSafeSize</a> <a href="#SkBitmap_computeSize64">computeSize64</a> <a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_width">width</a> - ---- - -<a name="SkBitmap_getSafeSize"></a> -## getSafeSize - -<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> -size_t getSafeSize() const -</pre> - -Returns minimum memory required for pixel storage. -Does not include unused memory on last row when <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkBitmap_width">width</a>. - -Returns zero if size does not fit in 32 bits. Use <a href="#SkBitmap_computeSafeSize64">computeSafeSize64</a> if the -result may exceed 32 bits. - -The pixel storage visible may be a subset of the <a href="undocumented#Pixel_Ref">Pixel Ref</a>. Accessing memory -beyond the result may generate an exception. - -### Return Value - -exact pixel storage size - -### Example - -<div><fiddle-embed name="47a93c44326c86371dbf42d2544e76be"><div><a href="#SkBitmap_getSafeSize">getSafeSize</a> results are not useful when <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a> are large.</div> - -#### Example Output - -~~~~ -width: 1 height: 1 getSafeSize: 4 -width: 1 height: 1000 getSafeSize: 4999 -width: 1 height: 1000000 getSafeSize: 4999999 -width: 1000 height: 1 getSafeSize: 4000 -width: 1000 height: 1000 getSafeSize: 4999000 -width: 1000 height: 1000000 getSafeSize: 0 -width: 1000000 height: 1 getSafeSize: 4000000 -width: 1000000 height: 1000 getSafeSize: 0 -width: 1000000 height: 1000000 getSafeSize: 0 -~~~~ - -</fiddle-embed></div> - -### See Also - -<a href="#SkBitmap_getSize">getSize</a> <a href="#SkBitmap_computeSafeSize64">computeSafeSize64</a> <a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_width">width</a> - ---- - -<a name="SkBitmap_computeSize64"></a> -## computeSize64 - -<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> -int64_t computeSize64() const -</pre> - -Returns conservative memory required for pixel storage. -Includes unused memory on last row when <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkBitmap_width">width</a>. - -### Return Value - -conservative pixel storage size - -### Example - -<div><fiddle-embed name="e7deb420416751aa68c1bd7956596833"> - -#### Example Output - -~~~~ -width: 1 height: 1 computeSize64: 5 -width: 1 height: 1000 computeSize64: 5000 -width: 1 height: 1000000 computeSize64: 5000000 -width: 1000 height: 1 computeSize64: 5000 -width: 1000 height: 1000 computeSize64: 5000000 -width: 1000 height: 1000000 computeSize64: 5000000000 -width: 1000000 height: 1 computeSize64: 5000000 -width: 1000000 height: 1000 computeSize64: 5000000000 -width: 1000000 height: 1000000 computeSize64: 5000000000000 -~~~~ - -</fiddle-embed></div> - -### See Also - -<a href="#SkBitmap_getSize">getSize</a> <a href="#SkBitmap_computeSafeSize64">computeSafeSize64</a> <a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_width">width</a> - ---- - -<a name="SkBitmap_computeSafeSize64"></a> -## computeSafeSize64 - -<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> -int64_t computeSafeSize64() const -</pre> - -Returns minimum memory required for pixel storage. -Does not include unused memory on last row when <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkBitmap_width">width</a>. - -### Return Value - -exact pixel storage size - -### Example - -<div><fiddle-embed name="ff12ff8354c1add9ea00797412f6342c"> - -#### Example Output - -~~~~ -width: 1 height: 1 computeSafeSize64: 4 -width: 1 height: 1000 computeSafeSize64: 4999 -width: 1 height: 1000000 computeSafeSize64: 4999999 -width: 1000 height: 1 computeSafeSize64: 4000 -width: 1000 height: 1000 computeSafeSize64: 4999000 -width: 1000 height: 1000000 computeSafeSize64: 4999999000 -width: 1000000 height: 1 computeSafeSize64: 4000000 -width: 1000000 height: 1000 computeSafeSize64: 4999000000 -width: 1000000 height: 1000000 computeSafeSize64: 4999999000000 -~~~~ - -</fiddle-embed></div> - -### See Also - -<a href="#SkBitmap_getSafeSize">getSafeSize</a> <a href="#SkBitmap_computeSize64">computeSize64</a> <a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_width">width</a> - ---- - <a name="SkBitmap_isImmutable"></a> ## isImmutable @@ -1306,9 +1136,9 @@ copy is immutable void setImmutable() </pre> -Once set, pixels can not change. Any other bitmap sharing the same <a href="undocumented#Pixel_Ref">Pixel Ref</a> -are also marked as immutable. Once <a href="undocumented#Pixel_Ref">Pixel Ref</a> is marked immutable, the setting -cannot be cleared. +Sets internal flag to mark <a href="#Bitmap">Bitmap</a> as immutable. Once set, pixels can not change. +Any other bitmap sharing the same <a href="undocumented#Pixel_Ref">Pixel Ref</a> are also marked as immutable. +Once <a href="undocumented#Pixel_Ref">Pixel Ref</a> is marked immutable, the setting cannot be cleared. Writing to immutable <a href="#Bitmap">Bitmap</a> pixels triggers an assert on debug builds. @@ -1591,7 +1421,7 @@ integral rectangle from origin to <a href="#SkBitmap_width">width</a> and <a hre SkISize dimensions() const </pre> -Returns <a href="#Size">ISize</a> { <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a> }. +Returns <a href="undocumented#ISize">ISize</a> { <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a> }. ### Return Value @@ -1699,7 +1529,7 @@ true if <a href="#Info">Image Info</a> set successfully ## <a name="SkBitmap_AllocFlags"></a> Enum SkBitmap::AllocFlags -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkBitmap_AllocFlags">AllocFlags</a> { <a href="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a> = 1 << 0, };</pre> @@ -2577,7 +2407,7 @@ then <a href="#RGB">Color RGB</a> is ignored. ### See Also -<a href="#SkBitmap_eraseARGB">eraseARGB</a> <a href="#SkBitmap_eraseRGB">eraseRGB</a> <a href="#SkBitmap_erase">erase</a> +<a href="#SkBitmap_eraseARGB">eraseARGB</a> <a href="#SkBitmap_erase">erase</a> --- @@ -2613,7 +2443,7 @@ amount of <a href="#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue ### See Also -<a href="#SkBitmap_eraseColor">eraseColor</a> <a href="#SkBitmap_eraseRGB">eraseRGB</a> <a href="#SkBitmap_erase">erase</a> +<a href="#SkBitmap_eraseColor">eraseColor</a> <a href="#SkBitmap_erase">erase</a> --- @@ -2624,25 +2454,19 @@ amount of <a href="#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const </pre> -Replaces pixel values with <a href="undocumented#Color">Color</a> built from <a href="#SkBitmap_eraseRGB_r">r</a>, <a href="#SkBitmap_eraseRGB_g">g</a>, and <a href="#SkBitmap_eraseRGB_b">b</a> with <a href="#Alpha">Color Alpha</a> set -to 255. All pixels contained by <a href="#SkBitmap_bounds">bounds</a> are affected. -If <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>, all pixels are set to 255. +Deprecated. Use <a href="#SkBitmap_eraseARGB">eraseARGB</a> or <a href="#SkBitmap_eraseColor">eraseColor</a>. ### Parameters <table> <tr> <td><a name="SkBitmap_eraseRGB_r"> <code><strong>r </strong></code> </a></td> <td> -amount of <a href="#RGB_Red">Color RGB Red</a>, from no red (0) to full red (255)</td> +amount of red</td> </tr> <tr> <td><a name="SkBitmap_eraseRGB_g"> <code><strong>g </strong></code> </a></td> <td> -amount of <a href="#RGB_Green">Color RGB Green</a>, from no green (0) to full green (255)</td> +amount of green</td> </tr> <tr> <td><a name="SkBitmap_eraseRGB_b"> <code><strong>b </strong></code> </a></td> <td> -amount of <a href="#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue (255)</td> +amount of blue</td> </tr> </table> -### Example - -<div><fiddle-embed name="3088f4d6cf8a01644ffd41bfddad5e03"></fiddle-embed></div> - ### See Also <a href="#SkBitmap_eraseColor">eraseColor</a> <a href="#SkBitmap_eraseARGB">eraseARGB</a> <a href="#SkBitmap_erase">erase</a> @@ -3041,7 +2865,8 @@ If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#Sk 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 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>, +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>. If <a href="#SkBitmap_readPixels_behavior">behavior</a> is <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts source @@ -3106,7 +2931,8 @@ If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#Sk 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 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>, +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>. ### Parameters @@ -3163,7 +2989,8 @@ If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#Sk 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 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>, +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>. ### Parameters @@ -3263,7 +3090,8 @@ If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#Sk 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 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>, +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>. ### Parameters @@ -3550,11 +3378,11 @@ true if <a href="#Alpha">Alpha</a> layer was constructed in <a href="#SkBitmap_e bool peekPixels(SkPixmap* pixmap) const </pre> -If the pixels are available from this bitmap return true, and fill out the -specified <a href="#SkBitmap_peekPixels_pixmap">pixmap</a> (if not null). If there are no pixels, return false and -ignore the <a href="#SkBitmap_peekPixels_pixmap">pixmap</a> parameter. -Note: if this returns true, the results (in the <a href="#SkBitmap_peekPixels_pixmap">pixmap</a>) are only valid until the bitmap -is changed in any way, in which case the results are invalid. +Copies <a href="#Bitmap">Bitmap</a> pixel address, row bytes, and <a href="#Info">Image Info</a> to <a href="#SkBitmap_peekPixels_pixmap">pixmap</a>, if address +is available, and returns true. If pixel address is not available, return +false and leave <a href="#SkBitmap_peekPixels_pixmap">pixmap</a> unchanged. + +<a href="#SkBitmap_peekPixels_pixmap">pixmap</a> contents become invalid on any future change to <a href="#Bitmap">Bitmap</a>. ### Parameters @@ -3595,6 +3423,22 @@ true if <a href="#Bitmap">Bitmap</a> has direct access to pixels --- +<a name="SkBitmap_validate"></a> +## validate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void validate() const; +</pre> + +Asserts if internal values are illegal or inconsistent. Only available if +<a href="undocumented#SK_DEBUG">SK DEBUG</a> is defined at compile time. + +### See Also + +<a href="#SkImageInfo_validate">SkImageInfo::validate()</a> + +--- + <a name="SkBitmap_toString"></a> ## toString diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md index 8d39ac47ed..5d59fd4dd4 100644 --- a/site/user/api/SkCanvas_Reference.md +++ b/site/user/api/SkCanvas_Reference.md @@ -430,7 +430,7 @@ storage of <a href="undocumented#Raster_Surface">Raster Surface</a></td> ## <a name="SkCanvas_ColorBehavior"></a> Enum SkCanvas::ColorBehavior -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum class <a href="#SkCanvas_ColorBehavior">ColorBehavior</a> { <a href="#SkCanvas_ColorBehavior_kLegacy">kLegacy</a>, };</pre> @@ -875,10 +875,11 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY) </pre> -Copies rectangle of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_dstPixels">dstPixels</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are -ignored. Source rectangle corners are (<a href="#SkCanvas_readPixels_srcX">srcX</a>, <a href="#SkCanvas_readPixels_srcY">srcY</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()). +Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_dstPixels">dstPixels</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are +ignored. Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_readPixels_srcX">srcX</a>, <a href="#SkCanvas_readPixels_srcY">srcY</a>) and +(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()). -Destination rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()). +Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (bitmap.width(), bitmap.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to <a href="#SkCanvas_readPixels_dstInfo">dstInfo</a>.colorType() and <a href="#SkCanvas_readPixels_dstInfo">dstInfo</a>.alphaType() if required. @@ -891,7 +892,7 @@ The destination pixel storage must be allocated by the caller. <a href="undocumented#Pixel">Pixel</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a> do not match. Only pixels within both source and destination rectangles -are copied. <a href="#SkCanvas_readPixels_dstPixels">dstPixels</a> contents outside the rectangle intersection are unchanged. +are copied. <a href="#SkCanvas_readPixels_dstPixels">dstPixels</a> contents outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged. Pass negative values for <a href="#SkCanvas_readPixels_srcX">srcX</a> or <a href="#SkCanvas_readPixels_srcY">srcY</a> to offset pixels across or down destination. @@ -956,10 +957,11 @@ pixel = 8056a9ff bool readPixels(const SkPixmap& pixmap, int srcX, int srcY) </pre> -Copies rectangle of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are -ignored. Source rectangle corners are (<a href="#SkCanvas_readPixels_2_srcX">srcX</a>, <a href="#SkCanvas_readPixels_2_srcY">srcY</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()). +Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are +ignored. Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_readPixels_2_srcX">srcX</a>, <a href="#SkCanvas_readPixels_2_srcY">srcY</a>) and +(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()). -Destination rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()). +Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (bitmap.width(), bitmap.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>.colorType() and <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>.alphaType() if required. @@ -971,8 +973,8 @@ class like <a href="undocumented#SkDumpCanvas">SkDumpCanvas</a>. Caller must allocate pixel storage in <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a> if needed. <a href="undocumented#Pixel">Pixel</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a> -do not match. Only pixels within both source and destination rectangles -are copied. <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a> pixels contents outside the rectangle intersection are unchanged. +do not match. Only pixels within both source and destination <a href="#Rect">Rects</a> +are copied. <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a> pixels contents outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged. Pass negative values for <a href="#SkCanvas_readPixels_2_srcX">srcX</a> or <a href="#SkCanvas_readPixels_2_srcY">srcY</a> to offset pixels across or down <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>. @@ -1025,10 +1027,11 @@ pixel = 802b5580 bool readPixels(const SkBitmap& bitmap, int srcX, int srcY) </pre> -Copies rectangle of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are -ignored. Source rectangle corners are (<a href="#SkCanvas_readPixels_3_srcX">srcX</a>, <a href="#SkCanvas_readPixels_3_srcY">srcY</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()). +Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are +ignored. Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_readPixels_3_srcX">srcX</a>, <a href="#SkCanvas_readPixels_3_srcY">srcY</a>) and +(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()). -Destination rectangle corners are (0, 0) and (<a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.width(), <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.height()). +Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.width(), <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.colorType() and <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.alphaType() if required. @@ -1041,7 +1044,7 @@ Caller must allocate pixel storage in <a href="#SkCanvas_readPixels_3_bitmap">bi <a href="SkBitmap_Reference#Bitmap">Bitmap</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a> do not match. Only pixels within both source and destination rectangles -are copied. <a href="SkBitmap_Reference#Bitmap">Bitmap</a> pixels outside the rectangle intersection are unchanged. +are copied. <a href="SkBitmap_Reference#Bitmap">Bitmap</a> pixels outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged. Pass negative values for <a href="#SkCanvas_readPixels_3_srcX">srcX</a> or <a href="#SkCanvas_readPixels_3_srcY">srcY</a> to offset pixels across or down <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>. @@ -1098,12 +1101,13 @@ bool writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y) </pre> -Copies rectangle from <a href="#SkCanvas_writePixels_pixels">pixels</a> to <a href="#Canvas">Canvas</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are ignored. -Source rectangle corners are (0, 0) and (<a href="#SkCanvas_writePixels_info">info</a>.width(), <a href="#SkCanvas_writePixels_info">info</a>.height()). -Destination rectangle corners are (<a href="#SkCanvas_writePixels_x">x</a>, <a href="#SkCanvas_writePixels_y">y</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()). +Copies <a href="SkRect_Reference#Rect">Rect</a> from <a href="#SkCanvas_writePixels_pixels">pixels</a> to <a href="#Canvas">Canvas</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are ignored. +Source <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkCanvas_writePixels_info">info</a>.width(), <a href="#SkCanvas_writePixels_info">info</a>.height()). +Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_writePixels_x">x</a>, <a href="#SkCanvas_writePixels_y">y</a>) and +(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()). Copies each readable pixel intersecting both rectangles, without scaling, -converting tothis-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType()andthis-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType()if required. +converting to <a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() and <a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType() if required. Pixels are writable when <a href="undocumented#Device">Device</a> is raster, or backed by a <a href="undocumented#GPU">GPU</a>. Pixels are not writable when <a href="#SkCanvas">SkCanvas</a> is returned by <a href="#SkDocument_beginPage">SkDocument::beginPage</a>, @@ -1112,7 +1116,7 @@ class like <a href="undocumented#SkDumpCanvas">SkDumpCanvas</a>. <a href="undocumented#Pixel">Pixel</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a> do not match. Only <a href="#SkCanvas_writePixels_pixels">pixels</a> within both source and destination rectangles -are copied. <a href="#Canvas">Canvas</a> <a href="#SkCanvas_writePixels_pixels">pixels</a> outside the rectangle intersection are unchanged. +are copied. <a href="#Canvas">Canvas</a> <a href="#SkCanvas_writePixels_pixels">pixels</a> outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged. Pass negative values for <a href="#SkCanvas_writePixels_x">x</a> or <a href="#SkCanvas_writePixels_y">y</a> to offset <a href="#SkCanvas_writePixels_pixels">pixels</a> to the left or above <a href="#Canvas">Canvas</a> <a href="#SkCanvas_writePixels_pixels">pixels</a>. @@ -1160,13 +1164,14 @@ true if <a href="#SkCanvas_writePixels_pixels">pixels</a> were written to <a hre bool writePixels(const SkBitmap& bitmap, int x, int y) </pre> -Copies rectangle from pixels to <a href="#Canvas">Canvas</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are ignored. -Source rectangle corners are (0, 0) and (<a href="#SkCanvas_writePixels_2_bitmap">bitmap</a>.width(), <a href="#SkCanvas_writePixels_2_bitmap">bitmap</a>.height()). +Copies <a href="SkRect_Reference#Rect">Rect</a> from pixels to <a href="#Canvas">Canvas</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are ignored. +Source <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkCanvas_writePixels_2_bitmap">bitmap</a>.width(), <a href="#SkCanvas_writePixels_2_bitmap">bitmap</a>.height()). -Destination rectangle corners are (<a href="#SkCanvas_writePixels_2_x">x</a>, <a href="#SkCanvas_writePixels_2_y">y</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()). +Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_writePixels_2_x">x</a>, <a href="#SkCanvas_writePixels_2_y">y</a>) and +(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()). Copies each readable pixel intersecting both rectangles, without scaling, -converting tothis-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType()andthis-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType()if required. +converting to <a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() and <a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType() if required. Pixels are writable when <a href="undocumented#Device">Device</a> is raster, or backed by a <a href="undocumented#GPU">GPU</a>. Pixels are not writable when <a href="#SkCanvas">SkCanvas</a> is returned by <a href="#SkDocument_beginPage">SkDocument::beginPage</a>, @@ -1175,7 +1180,7 @@ class like <a href="undocumented#SkDumpCanvas">SkDumpCanvas</a>. <a href="undocumented#Pixel">Pixel</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a> do not match. Only pixels within both source and destination rectangles -are copied. <a href="#Canvas">Canvas</a> pixels outside the rectangle intersection are unchanged. +are copied. <a href="#Canvas">Canvas</a> pixels outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged. Pass negative values for <a href="#SkCanvas_writePixels_2_x">x</a> or <a href="#SkCanvas_writePixels_2_y">y</a> to offset pixels to the left or above <a href="#Canvas">Canvas</a> pixels. @@ -1554,7 +1559,7 @@ depth of saved stack ## <a name="SkCanvas__anonymous"></a> Enum SkCanvas::_anonymous -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum { <a href="#SkCanvas_kIsOpaque_SaveLayerFlag">kIsOpaque SaveLayerFlag</a> = 1 << 0, <a href="#SkCanvas_kPreserveLCDText_SaveLayerFlag">kPreserveLCDText SaveLayerFlag</a> = 1 << 1, @@ -1596,7 +1601,7 @@ scalePaint blends <a href="#Layer">Layer</a> back with transparency.</div></fidd # <a name="SkCanvas_SaveLayerRec"></a> Struct SkCanvas::SaveLayerRec -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> struct <a href="#SkCanvas_SaveLayerRec_SaveLayerRec">SaveLayerRec</a> { <a href="#SkCanvas_SaveLayerRec_SaveLayerRec">SaveLayerRec</a>*(... @@ -2732,7 +2737,7 @@ graphics state used to fill <a href="#Canvas">Canvas</a></td> ## <a name="SkCanvas_PointMode"></a> Enum SkCanvas::PointMode -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkCanvas_PointMode">PointMode</a> { <a href="#SkCanvas_kPoints_PointMode">kPoints PointMode</a>, <a href="#SkCanvas_kLines_PointMode">kLines PointMode</a>, @@ -3389,7 +3394,7 @@ and so on; or nullptr</td> ## <a name="SkCanvas_SrcRectConstraint"></a> Enum SkCanvas::SrcRectConstraint -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkCanvas_SrcRectConstraint">SrcRectConstraint</a> { <a href="#SkCanvas_kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a>, <a href="#SkCanvas_kFast_SrcRectConstraint">kFast SrcRectConstraint</a>, @@ -4007,15 +4012,8 @@ and below <a href="#SkCanvas_drawBitmapNine_center">center</a> to fill the remai --- # <a name="SkCanvas_Lattice"></a> Struct SkCanvas::Lattice -<a href="#SkCanvas_Lattice">Lattice</a> divides <a href="SkBitmap_Reference#Bitmap">Bitmap</a> or <a href="undocumented#Image">Image</a> into a rectangular grid. -Grid entries on even columns and even rows are fixed; these entries are -always drawn at their original size if the destination is large enough. -If the destination side is too small to hold the fixed entries, all fixed -entries are proportionately scaled down to fit. -The grid entries not on even columns and rows are scaled to fit the -remaining space, if any. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> struct <a href="#SkCanvas_Lattice">Lattice</a> { enum <a href="#SkCanvas_Lattice_Flags">Flags</a> {... @@ -4027,9 +4025,17 @@ int <a href="#SkCanvas_Lattice_fYCount">fYCount</a>; const <a href="SkIRect_Reference#SkIRect">SkIRect</a>* <a href="#SkCanvas_Lattice_fBounds">fBounds</a>; };</pre> +<a href="#SkCanvas_Lattice">Lattice</a> divides <a href="SkBitmap_Reference#Bitmap">Bitmap</a> or <a href="undocumented#Image">Image</a> into a rectangular grid. +Grid entries on even columns and even rows are fixed; these entries are +always drawn at their original size if the destination is large enough. +If the destination side is too small to hold the fixed entries, all fixed +entries are proportionately scaled down to fit. +The grid entries not on even columns and rows are scaled to fit the +remaining space, if any. + ## <a name="SkCanvas_Lattice_Flags"></a> Enum SkCanvas::Lattice::Flags -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkCanvas_Lattice_Flags">Flags</a> : uint8_t { <a href="#SkCanvas_Lattice_kTransparent_Flags">kTransparent Flags</a> = 1 << 0, };</pre> @@ -5306,8 +5312,8 @@ Restores <a href="#Canvas">Canvas</a> to saved state. void restore() </pre> -Restores <a href="#Canvas">Canvas</a> to saved state immediately. Subsequent calls and class -destructor have no effect. +Restores <a href="#Canvas">Canvas</a> to saved state immediately. Subsequent calls and +<a href="#SkAutoCanvasRestore_destructor">~SkAutoCanvasRestore</a> have no effect. ### Example diff --git a/site/user/api/SkIRect_Reference.md b/site/user/api/SkIRect_Reference.md index 1982c5094d..7022cc6aec 100644 --- a/site/user/api/SkIRect_Reference.md +++ b/site/user/api/SkIRect_Reference.md @@ -34,7 +34,7 @@ its <a href="#SkIRect_top">top</a>, it is considered empty. | <a href="#SkIRect_MakeEmpty">MakeEmpty</a> | Returns bounds of (0, 0, 0, 0). | | <a href="#SkIRect_MakeLTRB">MakeLTRB</a> | Constructs from int <a href="#SkIRect_left">left</a>, <a href="#SkIRect_top">top</a>, <a href="#SkIRect_right">right</a>, <a href="#SkIRect_bottom">bottom</a>. | | <a href="#SkIRect_MakeLargest">MakeLargest</a> | Constructs from (<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>). | -| <a href="#SkIRect_MakeSize">MakeSize</a> | Constructs from <a href="#Size">ISize</a> returning (0, 0, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). | +| <a href="#SkIRect_MakeSize">MakeSize</a> | Constructs from <a href="undocumented#ISize">ISize</a> returning (0, 0, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). | | <a href="#SkIRect_MakeWH">MakeWH</a> | Constructs from int input returning (0, 0, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). | | <a href="#SkIRect_MakeXYWH">MakeXYWH</a> | Constructs from int input returning (<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). | | <a href="#SkIRect_bottom">bottom</a> | Returns larger bounds in <a href="#SkIRect_y">y</a>, if sorted. | @@ -66,7 +66,7 @@ its <a href="#SkIRect_top">top</a>, it is considered empty. | <a href="#SkIRect_setLargest">setLargest</a> | Sets to (<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>). | | <a href="#SkIRect_setLargestInverted">setLargestInverted</a> | Sets to (<a href="undocumented#SK_MaxS32">SK MaxS32</a>, <a href="undocumented#SK_MaxS32">SK MaxS32</a>, <a href="undocumented#SK_MinS32">SK MinS32</a>, <a href="undocumented#SK_MinS32">SK MinS32</a>). | | <a href="#SkIRect_setXYWH">setXYWH</a> | Sets to (<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). | -| <a href="#SkIRect_size">size</a> | Returns <a href="#Size">ISize</a> (<a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). | +| <a href="#SkIRect_size">size</a> | Returns <a href="undocumented#ISize">ISize</a> (<a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). | | <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>. | @@ -301,7 +301,8 @@ static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h) </pre> -Returns constructed <a href="#IRect">IRect</a> <a href="#SkIRect_set">set</a> to(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + <a href="#SkIRect_MakeXYWH_w">w</a>, <a href="#SkIRect_y">y</a> + <a href="#SkIRect_MakeXYWH_h">h</a>). +Returns constructed <a href="#IRect">IRect</a> <a href="#SkIRect_set">set</a> to: +(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + <a href="#SkIRect_MakeXYWH_w">w</a>, <a href="#SkIRect_y">y</a> + <a href="#SkIRect_MakeXYWH_h">h</a>). Does not validate input; <a href="#SkIRect_MakeXYWH_w">w</a> or <a href="#SkIRect_MakeXYWH_h">h</a> may be negative. @@ -617,7 +618,7 @@ or if result fits in 32-bit signed integer; result may be negative. ### Return Value -<a href="#Size">ISize</a> (<a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>) +<a href="undocumented#ISize">ISize</a> (<a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>) ### Example @@ -1019,7 +1020,8 @@ rect2: {3, 4, 1, 2} void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height) </pre> -Sets <a href="#IRect">IRect</a> to(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + <a href="#SkIRect_width">width</a>, <a href="#SkIRect_y">y</a> + <a href="#SkIRect_height">height</a>). +Sets <a href="#IRect">IRect</a> to: +(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + <a href="#SkIRect_width">width</a>, <a href="#SkIRect_y">y</a> + <a href="#SkIRect_height">height</a>). Does not validate input; <a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a> may be negative. @@ -1495,11 +1497,13 @@ rect (7, 11, 13, 17) test(12, 16, 14, 18) quickReject false; intersects true bool contains(int32_t x, int32_t y) const </pre> -Returns true if<a href="#SkIRect_fLeft">fLeft</a> <= <a href="#SkIRect_x">x</a> < <a href="#SkIRect_fRight">fRight</a> && <a href="#SkIRect_fTop">fTop</a> <= <a href="#SkIRect_y">y</a> < <a href="#SkIRect_fBottom">fBottom</a>. +Returns true if: +<a href="#SkIRect_fLeft">fLeft</a> <= <a href="#SkIRect_x">x</a> < <a href="#SkIRect_fRight">fRight</a> && <a href="#SkIRect_fTop">fTop</a> <= <a href="#SkIRect_y">y</a> < <a href="#SkIRect_fBottom">fBottom</a>. Returns false if <a href="SkRect_Reference#Rect">Rect</a> is empty. -Considers input to describe constructed <a href="#IRect">IRect</a> (<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + 1, <a href="#SkIRect_y">y</a> + 1) and +Considers input to describe constructed <a href="#IRect">IRect</a>: +(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + 1, <a href="#SkIRect_y">y</a> + 1)and returns true if constructed area is completely enclosed by <a href="#IRect">IRect</a> area. ### Parameters @@ -1758,7 +1762,7 @@ rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60) # <a name="Intersection"></a> Intersection IRects <a href="#SkIRect_intersect">intersect</a> when they enclose a common area. To <a href="#SkIRect_intersect">intersect</a>, each of the pair must describe area; <a href="#SkIRect_fLeft">fLeft</a> is less than <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fTop">fTop</a> is less than <a href="#SkIRect_fBottom">fBottom</a>; -empty() returns false. The intersection of <a href="#IRect">IRect</a> a and <a href="#IRect">IRect</a> b can be described by: +empty() returns false. The intersection of <a href="#IRect">IRect</a> pair can be described by: (max(a.fLeft, b.fLeft), max(a.fTop, b.fTop), min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))The intersection is only meaningful if the resulting <a href="#IRect">IRect</a> is not empty and describes an area: <a href="#SkIRect_fLeft">fLeft</a> is less than <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fTop">fTop</a> is less than <a href="#SkIRect_fBottom">fBottom</a>. diff --git a/site/user/api/SkMatrix_Reference.md b/site/user/api/SkMatrix_Reference.md new file mode 100644 index 0000000000..46cca59545 --- /dev/null +++ b/site/user/api/SkMatrix_Reference.md @@ -0,0 +1,4459 @@ +SkMatrix Reference +=== + +# <a name="Matrix"></a> Matrix + +# <a name="SkMatrix"></a> Class SkMatrix +<a href="#Matrix">Matrix</a> holds a 3x3 matrix for transforming coordinates. This allows mapping +<a href="#Point">Points</a> and <a href="#Vector">Vectors</a> with translation, scaling, skewing, rotation, and +perspective. + +<a href="#Matrix">Matrix</a> elements are in row major order. <a href="#Matrix">Matrix</a> does not have a constructor, +so it must be explicitly initialized. <a href="#SkMatrix_setIdentity">setIdentity</a> initializes <a href="#Matrix">Matrix</a> +so it has no effect. <a href="#SkMatrix_setTranslate">setTranslate</a>, <a href="#SkMatrix_setScale">setScale</a>, <a href="#SkMatrix_setSkew">setSkew</a>, <a href="#SkMatrix_setRotate">setRotate</a>, <a href="#SkMatrix_set9">set9</a> and <a href="#SkMatrix_setAll">setAll</a> +initializes all <a href="#Matrix">Matrix</a> elements with the corresponding mapping. + +<a href="#Matrix">Matrix</a> includes a hidden variable that classifies the type of matrix to +improve performance. <a href="#Matrix">Matrix</a> is not thread safe unless <a href="#SkMatrix_getType">getType</a> is called first. + +# <a name="Overview"></a> Overview + +## <a name="Subtopics"></a> Subtopics + +| topics | description | +| --- | --- | + +## <a name="Operators"></a> Operators + +| function | description | +| --- | --- | +| <a href="#SkMatrix_not_equal_operator">operator!=(const SkMatrix& a, const SkMatrix& b)</a> | Returns true if members are unequal. | +| <a href="#SkMatrix_equal_operator">operator==(const SkMatrix& a, const SkMatrix& b)</a> | Returns true if members are equal. | +| <a href="#SkMatrix_subscript_operator_const">operator[](int index)</a> const | Returns <a href="#Matrix">Matrix</a> value. | +| <a href="#SkMatrix_subscript_operator_const">operator[](int index)</a> | Returns writable reference to <a href="#Matrix">Matrix</a> value. | + +## <a name="Member_Functions"></a> Member Functions + +| function | description | +| --- | --- | +| <a href="#SkMatrix_Concat">Concat</a> | Returns the concatenation of <a href="#Matrix">Matrix</a> pair. | +| <a href="#SkMatrix_I">I</a> | Returns a reference to a const identity <a href="#Matrix">Matrix</a>. | +| <a href="#SkMatrix_InvalidMatrix">InvalidMatrix</a> | Returns a reference to a const invalid <a href="#Matrix">Matrix</a>. | +| <a href="#SkMatrix_MakeRectToRect">MakeRectToRect</a> | Constructs from source <a href="SkRect_Reference#Rect">Rect</a> to destination <a href="SkRect_Reference#Rect">Rect</a>. | +| <a href="#SkMatrix_MakeScale">MakeScale</a> | Constructs from scale in x and y. | +| <a href="#SkMatrix_MakeTrans">MakeTrans</a> | Constructs from translate in x and y. | +| <a href="#SkMatrix_SetAffineIdentity">SetAffineIdentity</a> | Sets 3x2 array to identity. | +| <a href="#SkMatrix_asAffine">asAffine</a> | Copies to 3x2 array. | +| <a href="#SkMatrix_cheapEqualTo">cheapEqualTo</a> | Compares <a href="#Matrix">Matrix</a> pair using memcmp(). | +| <a href="#SkMatrix_decomposeScale">decomposeScale</a> | Separates scale if possible. | +| <a href="#SkMatrix_dirtyMatrixTypeCache">dirtyMatrixTypeCache</a> | Sets internal cache to unknown state. | +| <a href="#SkMatrix_dump">dump</a> | Sends text representation using floats to standard output. | +| <a href="#SkMatrix_fixedStepInX">fixedStepInX</a> | Returns step in x for a position in y. | +| <a href="#SkMatrix_get">get</a> | Returns one of nine <a href="#Matrix">Matrix</a> values. | +| <a href="#SkMatrix_get9">get9</a> | Returns all nine <a href="#Matrix">Matrix</a> values. | +| <a href="#SkMatrix_getMaxScale">getMaxScale</a> | Returns maximum scaling, if possible. | +| <a href="#SkMatrix_getMinMaxScales">getMinMaxScales</a> | Returns minimum and maximum scaling, if possible. | +| <a href="#SkMatrix_getMinScale">getMinScale</a> | Returns minimum scaling, if possible. | +| <a href="#SkMatrix_getPerspX">getPerspX</a> | Returns input x perspective factor. | +| <a href="#SkMatrix_getPerspY">getPerspY</a> | Returns input y perspective factor. | +| <a href="#SkMatrix_getScaleX">getScaleX</a> | Returns horizontal scale factor. | +| <a href="#SkMatrix_getScaleY">getScaleY</a> | Returns vertical scale factor. | +| <a href="#SkMatrix_getSkewX">getSkewX</a> | Returns horizontal skew factor. | +| <a href="#SkMatrix_getSkewY">getSkewY</a> | Returns vertical skew factor. | +| <a href="#SkMatrix_getTranslateX">getTranslateX</a> | Returns horizontal translation. | +| <a href="#SkMatrix_getTranslateY">getTranslateY</a> | Returns vertical translation. | +| <a href="#SkMatrix_getType">getType</a> | Returns transform complexity. | +| <a href="#SkMatrix_hasPerspective">hasPerspective</a> | Returns if transform includes perspective. | +| <a href="#SkMatrix_invert">invert</a> | Returns inverse, if possible. | +| <a href="#SkMatrix_isFinite">isFinite</a> | Returns if all <a href="#Matrix">Matrix</a> values are not infinity, <a href="undocumented#NaN">NaN</a>. | +| <a href="#SkMatrix_isFixedStepInX">isFixedStepInX</a> | Returns if transformation supports fixed step in x. | +| <a href="#SkMatrix_isIdentity">isIdentity</a> | Returns if matrix equals the identity <a href="#Matrix">Matrix</a> . | +| <a href="#SkMatrix_isScaleTranslate">isScaleTranslate</a> | Returns if transform is limited to scale and translate. | +| <a href="#SkMatrix_isSimilarity">isSimilarity</a> | Returns if transform is limited to square scale and rotation. | +| <a href="#SkMatrix_isTranslate">isTranslate</a> | Returns if transform is limited to translate. | +| <a href="#SkMatrix_mapHomogeneousPoints">mapHomogeneousPoints</a> | Maps <a href="undocumented#Point3">Point3</a> array. | +| <a href="#SkMatrix_mapPoints">mapPoints</a> | Maps <a href="undocumented#Point">Point</a> array. | +| <a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> | Maps <a href="undocumented#Point">Point</a> array with padding. | +| <a href="#SkMatrix_mapRadius">mapRadius</a> | Returns mean radius of mapped <a href="undocumented#Circle">Circle</a>. | +| <a href="#SkMatrix_mapRect">mapRect</a> | Returns bounds of mapped <a href="SkRect_Reference#Rect">Rect</a>. | +| <a href="#SkMatrix_mapRectScaleTranslate">mapRectScaleTranslate</a> | Returns bounds of mapped <a href="SkRect_Reference#Rect">Rect</a>. | +| <a href="#SkMatrix_mapRectToQuad">mapRectToQuad</a> | Maps <a href="SkRect_Reference#Rect">Rect</a> to <a href="undocumented#Point">Point</a> array. | +| <a href="#SkMatrix_mapVector">mapVector</a> | Maps <a href="undocumented#Vector">Vector</a>. | +| <a href="#SkMatrix_mapVectors">mapVectors</a> | Maps <a href="undocumented#Vector">Vector</a> array. | +| <a href="#SkMatrix_mapXY">mapXY</a> | Maps <a href="undocumented#Point">Point</a>. | +| <a href="#SkMatrix_postConcat">postConcat</a> | Post-multiplies <a href="#Matrix">Matrix</a> by <a href="#Matrix">Matrix</a> parameter. | +| <a href="#SkMatrix_postIDiv">postIDiv</a> | Post-multiplies <a href="#Matrix">Matrix</a> by inverse scale. | +| <a href="#SkMatrix_postRotate">postRotate</a> | Post-multiplies <a href="#Matrix">Matrix</a> by rotation. | +| <a href="#SkMatrix_postScale">postScale</a> | Post-multiplies <a href="#Matrix">Matrix</a> by scale. | +| <a href="#SkMatrix_postSkew">postSkew</a> | Post-multiplies <a href="#Matrix">Matrix</a> by skew. | +| <a href="#SkMatrix_postTranslate">postTranslate</a> | Post-multiplies <a href="#Matrix">Matrix</a> by translation. | +| <a href="#SkMatrix_preConcat">preConcat</a> | Pre-multiplies <a href="#Matrix">Matrix</a> by <a href="#Matrix">Matrix</a> parameter. | +| <a href="#SkMatrix_preRotate">preRotate</a> | Pre-multiplies <a href="#Matrix">Matrix</a> by rotation. | +| <a href="#SkMatrix_preScale">preScale</a> | Pre-multiplies <a href="#Matrix">Matrix</a> by scale. | +| <a href="#SkMatrix_preSkew">preSkew</a> | Pre-multiplies <a href="#Matrix">Matrix</a> by skew. | +| <a href="#SkMatrix_preTranslate">preTranslate</a> | Pre-multiplies <a href="#Matrix">Matrix</a> by translation. | +| <a href="#SkMatrix_preservesAxisAlignment">preservesAxisAlignment</a> | Returns if mapping restricts to 90 degree multiples and mirroring. | +| <a href="#SkMatrix_preservesRightAngles">preservesRightAngles</a> | Returns if mapped 90 angle remains 90 degrees. | +| <a href="#SkMatrix_rectStaysRect">rectStaysRect</a> | Returns if mapped <a href="SkRect_Reference#Rect">Rect</a> can be represented by another <a href="SkRect_Reference#Rect">Rect</a>. | +| <a href="#SkMatrix_reset">reset</a> | Sets <a href="#Matrix">Matrix</a> to identity. | +| <a href="#SkMatrix_set">set</a> | Sets one value. | +| <a href="#SkMatrix_set9">set9</a> | Sets all values from <a href="#Scalar">Scalar</a> array. | +| <a href="#SkMatrix_setAffine">setAffine</a> | Sets left two columns. | +| <a href="#SkMatrix_setAll">setAll</a> | Sets all values from parameters. | +| <a href="#SkMatrix_setConcat">setConcat</a> | Sets to <a href="#Matrix">Matrix</a> parameter multiplied by <a href="#Matrix">Matrix</a> parameter. | +| <a href="#SkMatrix_setIdentity">setIdentity</a> | Sets <a href="#Matrix">Matrix</a> to identity. | +| <a href="#SkMatrix_setPerspX">setPerspX</a> | Sets input x perspective factor. | +| <a href="#SkMatrix_setPerspY">setPerspY</a> | Sets input y perspective factor. | +| <a href="#SkMatrix_setPolyToPoly">setPolyToPoly</a> | Sets to map one to four points to an equal array of points. | +| <a href="#SkMatrix_setRSXform">setRSXform</a> | Sets to rotate, scale, and translate. | +| <a href="#SkMatrix_setRectToRect">setRectToRect</a> | Sets to map one <a href="SkRect_Reference#Rect">Rect</a> to another. | +| <a href="#SkMatrix_setRotate">setRotate</a> | Sets to rotate about a point. | +| <a href="#SkMatrix_setScale">setScale</a> | Sets to scale about a point. | +| <a href="#SkMatrix_setScaleTranslate">setScaleTranslate</a> | Sets to scale and translate. | +| <a href="#SkMatrix_setScaleX">setScaleX</a> | Sets horizontal scale factor. | +| <a href="#SkMatrix_setScaleY">setScaleY</a> | Sets vertical scale factor | +| <a href="#SkMatrix_setSinCos">setSinCos</a> | Sets to rotate and scale about a point. | +| <a href="#SkMatrix_setSkew">setSkew</a> | Sets to skew about a point. | +| <a href="#SkMatrix_setSkewX">setSkewX</a> | Sets horizontal skew factor. | +| <a href="#SkMatrix_setSkewY">setSkewY</a> | Sets vertical skew factor. | +| <a href="#SkMatrix_setTranslate">setTranslate</a> | Sets to translate in x and y. | +| <a href="#SkMatrix_setTranslateX">setTranslateX</a> | Sets horizontal translation. | +| <a href="#SkMatrix_setTranslateY">setTranslateY</a> | Sets vertical translation. | +| <a href="#SkMatrix_toString">toString</a> | Converts <a href="#Matrix">Matrix</a> to machine readable form. | + +<a name="SkMatrix_MakeScale"></a> +## MakeScale + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar sx, SkScalar sy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to scale by (<a href="#SkMatrix_MakeScale_sx">sx</a>, <a href="#SkMatrix_MakeScale_sy">sy</a>). Returned matrix is: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| sx 0 0 | +| 0 sy 0 | +| 0 0 1 |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_MakeScale_sx"> <code><strong>sx </strong></code> </a></td> <td> +horizontal scale factor</td> + </tr> <tr> <td><a name="SkMatrix_MakeScale_sy"> <code><strong>sy </strong></code> </a></td> <td> +vertical scale factor</td> + </tr> +</table> + +### Return Value + +<a href="#Matrix">Matrix</a> with scale + +### Example + +<div><fiddle-embed name="7ff17718111df6d6f95381d8a8f1b389"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_postScale">postScale</a> <a href="#SkMatrix_preScale">preScale</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar scale) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#SkMatrix_MakeScale_2_scale">scale</a> by (<a href="#SkMatrix_MakeScale_2_scale">scale</a>, <a href="#SkMatrix_MakeScale_2_scale">scale</a>). Returned matrix is: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| scale 0 0 | +| 0 scale 0 | +| 0 0 1 |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_MakeScale_2_scale"> <code><strong>scale </strong></code> </a></td> <td> +horizontal and vertical <a href="#SkMatrix_MakeScale_2_scale">scale</a> factor</td> + </tr> +</table> + +### Return Value + +<a href="#Matrix">Matrix</a> with <a href="#SkMatrix_MakeScale_2_scale">scale</a> + +### Example + +<div><fiddle-embed name="2956aeb50fa862cdb13995e1e56a4bc8"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_postScale">postScale</a> <a href="#SkMatrix_preScale">preScale</a> + +--- + +<a name="SkMatrix_MakeTrans"></a> +## MakeTrans + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static SkMatrix SK_WARN_UNUSED_RESULT MakeTrans(SkScalar dx, SkScalar dy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to translate by (<a href="#SkMatrix_MakeTrans_dx">dx</a>, <a href="#SkMatrix_MakeTrans_dy">dy</a>). Returned matrix is: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 1 0 0 | +| 0 1 0 | +| dx dy 1 |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_MakeTrans_dx"> <code><strong>dx </strong></code> </a></td> <td> +horizontal translation</td> + </tr> <tr> <td><a name="SkMatrix_MakeTrans_dy"> <code><strong>dy </strong></code> </a></td> <td> +vertical translation</td> + </tr> +</table> + +### Return Value + +<a href="#Matrix">Matrix</a> with translation + +### Example + +<div><fiddle-embed name="b2479df0d9cf296ff64ac31e36684557"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setTranslate">setTranslate</a> <a href="#SkMatrix_postTranslate">postTranslate</a> <a href="#SkMatrix_preTranslate">preTranslate</a> + +--- + +## <a name="SkMatrix_TypeMask"></a> Enum SkMatrix::TypeMask + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +enum <a href="#SkMatrix_TypeMask">TypeMask</a> { +<a href="#SkMatrix_kIdentity_Mask">kIdentity Mask</a> = 0, +<a href="#SkMatrix_kTranslate_Mask">kTranslate Mask</a> = 0x01, +<a href="#SkMatrix_kScale_Mask">kScale Mask</a> = 0x02, +<a href="#SkMatrix_kAffine_Mask">kAffine Mask</a> = 0x04, +<a href="#SkMatrix_kPerspective_Mask">kPerspective Mask</a> = 0x08, +};</pre> + +Enum of bit fields for mask returned by <a href="#SkMatrix_getType">getType</a>. +Used to identify the complexity of <a href="#Matrix">Matrix</a>, to optimize performance. + +### Constants + +<table> + <tr> + <td><a name="SkMatrix_kIdentity_Mask"> <code><strong>SkMatrix::kIdentity_Mask </strong></code> </a></td><td>0</td><td>all bits clear if <a href="#Matrix">Matrix</a> is identity</td> + </tr> + <tr> + <td><a name="SkMatrix_kTranslate_Mask"> <code><strong>SkMatrix::kTranslate_Mask </strong></code> </a></td><td>1</td><td><a href="#SkMatrix_set">set</a> if <a href="#Matrix">Matrix</a> has translation</td> + </tr> + <tr> + <td><a name="SkMatrix_kScale_Mask"> <code><strong>SkMatrix::kScale_Mask </strong></code> </a></td><td>2</td><td><a href="#SkMatrix_set">set</a> if <a href="#Matrix">Matrix</a> has x or y scale</td> + </tr> + <tr> + <td><a name="SkMatrix_kAffine_Mask"> <code><strong>SkMatrix::kAffine_Mask </strong></code> </a></td><td>4</td><td><a href="#SkMatrix_set">set</a> if <a href="#Matrix">Matrix</a> skews or rotates</td> + </tr> + <tr> + <td><a name="SkMatrix_kPerspective_Mask"> <code><strong>SkMatrix::kPerspective_Mask </strong></code> </a></td><td>8</td><td><a href="#SkMatrix_set">set</a> if <a href="#Matrix">Matrix</a> has perspective</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="ba19b36df8cd78586f3dff54e2d4c093"> + +#### Example Output + +~~~~ +after reset: kIdentity_Mask +after postTranslate: kTranslate_Mask +after postScale: kTranslate_Mask kScale_Mask +after postScale: kTranslate_Mask kScale_Mask kAffine_Mask +after setPolyToPoly: kTranslate_Mask kScale_Mask kAffine_Mask kPerspective_Mask +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_getType">getType</a> + + + +<a name="SkMatrix_getType"></a> +## getType + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +TypeMask getType() const +</pre> + +Returns a bit field describing the transformations the matrix may +perform. The bit field is computed conservatively, so it may include +false positives. For example, when <a href="#SkMatrix_kPerspective_Mask">kPerspective Mask</a> is <a href="#SkMatrix_set">set</a>, all +other bits are <a href="#SkMatrix_set">set</a>. + +### Return Value + +<a href="#SkMatrix_kIdentity_Mask">kIdentity Mask</a>, or combinations of: <a href="#SkMatrix_kTranslate_Mask">kTranslate Mask</a>, <a href="#SkMatrix_kScale_Mask">kScale Mask</a>, +<a href="#SkMatrix_kAffine_Mask">kAffine Mask</a>, <a href="#SkMatrix_kPerspective_Mask">kPerspective Mask</a> + +### Example + +<div><fiddle-embed name="8e45fe2dd52731bb2d4318686257e1d7"> + +#### Example Output + +~~~~ +identity flags hex: 0 decimal: 0 +set all flags hex: f decimal: 15 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_TypeMask">TypeMask</a> + +--- + +<a name="SkMatrix_isIdentity"></a> +## isIdentity + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isIdentity() const +</pre> + +Returns true if <a href="#Matrix">Matrix</a> is identity. Identity matrix is: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 1 0 0 | +| 0 1 0 | +| 0 0 1 |</pre> + +### Return Value + +true if <a href="#Matrix">Matrix</a> has no effect + +### Example + +<div><fiddle-embed name="780ab376325b3cfa889ea26c0769ec11"> + +#### Example Output + +~~~~ +is identity: true +is identity: false +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_reset">reset</a> <a href="#SkMatrix_setIdentity">setIdentity</a> <a href="#SkMatrix_getType">getType</a> + +--- + +<a name="SkMatrix_isScaleTranslate"></a> +## isScaleTranslate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isScaleTranslate() const +</pre> + +Returns true if <a href="#Matrix">Matrix</a> at most scales and translates. <a href="#Matrix">Matrix</a> may be identity, +contain only scale elements, only translate elements, or both. <a href="#Matrix">Matrix</a> form is: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| scale-x 0 translate-x | +| 0 scale-y translate-y | +| 0 0 1 |</pre> + +### Return Value + +true if <a href="#Matrix">Matrix</a> is identity; or scales, translates, or both + +### Example + +<div><fiddle-embed name="6287e29674a487eb94174992d45b9a34"> + +#### Example Output + +~~~~ +is scale-translate: true +is scale-translate: true +is scale-translate: true +is scale-translate: true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_isTranslate">isTranslate</a> <a href="#SkMatrix_setTranslate">setTranslate</a> <a href="#SkMatrix_getType">getType</a> + +--- + +<a name="SkMatrix_isTranslate"></a> +## isTranslate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isTranslate() const +</pre> + +Returns true if <a href="#Matrix">Matrix</a> is identity, or translates. <a href="#Matrix">Matrix</a> form is: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 1 0 translate-x | +| 0 1 translate-y | +| 0 0 1 |</pre> + +### Return Value + +true if <a href="#Matrix">Matrix</a> is identity, or translates + +### Example + +<div><fiddle-embed name="73ac71a8a30841873577c11c6c9b38ee"> + +#### Example Output + +~~~~ +is translate: true +is translate: true +is translate: false +is translate: false +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setTranslate">setTranslate</a> <a href="#SkMatrix_getType">getType</a> + +--- + +<a name="SkMatrix_rectStaysRect"></a> +## rectStaysRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool rectStaysRect() const +</pre> + +Returns true <a href="#Matrix">Matrix</a> maps <a href="SkRect_Reference#Rect">Rect</a> to another <a href="SkRect_Reference#Rect">Rect</a>. If true, <a href="#Matrix">Matrix</a> is identity, +or scales, or rotates a multiple of 90 degrees, or mirrors in x or y. In all +cases, <a href="#Matrix">Matrix</a> may also have translation. <a href="#Matrix">Matrix</a> form is either: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| scale-x 0 translate-x | +| 0 scale-y translate-y | +| 0 0 1 |</pre> + +or + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 0 rotate-x translate-x | +| rotate-y 0 translate-y | +| 0 0 1 |</pre> + +for non-zero values of scale-x, scale-y, rotate-x, and rotate-y. + +Also called <a href="#SkMatrix_preservesAxisAlignment">preservesAxisAlignment</a>; use the one that provides better inline +documentation. + +### Return Value + +true if <a href="#Matrix">Matrix</a> maps one <a href="SkRect_Reference#Rect">Rect</a> into another + +### Example + +<div><fiddle-embed name="ce5319c036c9b5086da8a0009fe409f8"> + +#### Example Output + +~~~~ +rectStaysRect: true +rectStaysRect: true +rectStaysRect: true +rectStaysRect: true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preservesAxisAlignment">preservesAxisAlignment</a> <a href="#SkMatrix_preservesRightAngles">preservesRightAngles</a> + +--- + +<a name="SkMatrix_preservesAxisAlignment"></a> +## preservesAxisAlignment + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool preservesAxisAlignment() const +</pre> + +Returns true <a href="#Matrix">Matrix</a> maps <a href="SkRect_Reference#Rect">Rect</a> to another <a href="SkRect_Reference#Rect">Rect</a>. If true, <a href="#Matrix">Matrix</a> is identity, +or scales, or rotates a multiple of 90 degrees, or mirrors in x or y. In all +cases, <a href="#Matrix">Matrix</a> may also have translation. <a href="#Matrix">Matrix</a> form is either: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| scale-x 0 translate-x | +| 0 scale-y translate-y | +| 0 0 1 |</pre> + +or + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 0 rotate-x translate-x | +| rotate-y 0 translate-y | +| 0 0 1 |</pre> + +for non-zero values of scale-x, scale-y, rotate-x, and rotate-y. + +Also called <a href="#SkMatrix_rectStaysRect">rectStaysRect</a>; use the one that provides better inline +documentation. + +### Return Value + +true if <a href="#Matrix">Matrix</a> maps one <a href="SkRect_Reference#Rect">Rect</a> into another + +### Example + +<div><fiddle-embed name="7a234c96608fb7cb8135b9940b0b15f7"> + +#### Example Output + +~~~~ +preservesAxisAlignment: true +preservesAxisAlignment: true +preservesAxisAlignment: true +preservesAxisAlignment: true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_rectStaysRect">rectStaysRect</a> <a href="#SkMatrix_preservesRightAngles">preservesRightAngles</a> + +--- + +<a name="SkMatrix_hasPerspective"></a> +## hasPerspective + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool hasPerspective() const +</pre> + +Returns true if the matrix contains perspective elements. <a href="#Matrix">Matrix</a> form is: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| -- -- -- | +| -- -- -- | +| perspective-x perspective-y perspective-scale |</pre> + +where perspective-x or perspective-y is non-zero, or perspective-scale is +not one. All other elements may have any value. + +### Return Value + +true if <a href="#Matrix">Matrix</a> is in most general form + +### Example + +<div><fiddle-embed name="688123908c733169bbbfaf11f41ecff6"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setAll">setAll</a> <a href="#SkMatrix_set9">set9</a> + +--- + +<a name="SkMatrix_isSimilarity"></a> +## isSimilarity + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isSimilarity(SkScalar tol = SK_ScalarNearlyZero) const +</pre> + +Returns true if <a href="#Matrix">Matrix</a> contains only translation, rotation, reflection, and +uniform scale. +Returns false if <a href="#Matrix">Matrix</a> contains different scales, skewing, perspective, or +degenerate forms that collapse to a line or point. + +Describes that the <a href="#Matrix">Matrix</a> makes rendering with and without the matrix are +visually alike; a transformed circle remains a circle. Mathematically, this is +referred to as similarity of a <a href="undocumented#Euclidean">Euclidean</a> space, or a similarity transformation. + +Preserves right angles, keeping the arms of the angle equal lengths. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_isSimilarity_tol"> <code><strong>tol </strong></code> </a></td> <td> +to be deprecated</td> + </tr> +</table> + +### Return Value + +true if <a href="#Matrix">Matrix</a> only rotates, uniformly scales, translates + +### Example + +<div><fiddle-embed name="98d60230ad633ae74d851de3a65d72d6"><div><a href="undocumented#String">String</a> is drawn four times through but only two are visible. Drawing the pair +with <a href="#SkMatrix_isSimilarity">isSimilarity</a> false reveals the pair not visible through the matrix.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_isScaleTranslate">isScaleTranslate</a> <a href="#SkMatrix_preservesRightAngles">preservesRightAngles</a> <a href="#SkMatrix_rectStaysRect">rectStaysRect</a> <a href="#SkMatrix_isFixedStepInX">isFixedStepInX</a> + +--- + +<a name="SkMatrix_preservesRightAngles"></a> +## preservesRightAngles + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool preservesRightAngles(SkScalar tol = SK_ScalarNearlyZero) const +</pre> + +Returns true if <a href="#Matrix">Matrix</a> contains only translation, rotation, reflection, and +scale. Scale may differ along rotated axes. +Returns false if <a href="#Matrix">Matrix</a> skewing, perspective, or degenerate forms that collapse +to a line or point. + +Preserves right angles, but not requiring that the arms of the angle +retain equal lengths. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preservesRightAngles_tol"> <code><strong>tol </strong></code> </a></td> <td> +to be deprecated</td> + </tr> +</table> + +### Return Value + +true if <a href="#Matrix">Matrix</a> only rotates, scales, translates + +### Example + +<div><fiddle-embed name="a3d5bfebc1c3423fb983d30aaf4ac5f4"><div>Equal scale is both similar and preserves right angles. +Unequal scale is not similar but preserves right angles. +Skews are not similar and do not preserve right angles.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_isScaleTranslate">isScaleTranslate</a> <a href="#SkMatrix_isSimilarity">isSimilarity</a> <a href="#SkMatrix_rectStaysRect">rectStaysRect</a> <a href="#SkMatrix_isFixedStepInX">isFixedStepInX</a> + +--- + +## <a name="SkMatrix__anonymous"></a> Enum SkMatrix::_anonymous + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +enum { +<a href="#SkMatrix_kMScaleX">kMScaleX</a>, +<a href="#SkMatrix_kMSkewX">kMSkewX</a>, +<a href="#SkMatrix_kMTransX">kMTransX</a>, +<a href="#SkMatrix_kMSkewY">kMSkewY</a>, +<a href="#SkMatrix_kMScaleY">kMScaleY</a>, +<a href="#SkMatrix_kMTransY">kMTransY</a>, +<a href="#SkMatrix_kMPersp0">kMPersp0</a>, +<a href="#SkMatrix_kMPersp1">kMPersp1</a>, +<a href="#SkMatrix_kMPersp2">kMPersp2</a>, +};</pre> + +<a href="#Matrix">Matrix</a> organizes its values in row order. These members correspond to +each value in <a href="#Matrix">Matrix</a>. + +### Constants + +<table> + <tr> + <td><a name="SkMatrix_kMScaleX"> <code><strong>SkMatrix::kMScaleX </strong></code> </a></td><td>0</td><td>horizontal scale factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kMSkewX"> <code><strong>SkMatrix::kMSkewX </strong></code> </a></td><td>1</td><td>horizontal skew factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kMTransX"> <code><strong>SkMatrix::kMTransX </strong></code> </a></td><td>2</td><td>horizontal translation</td> + </tr> + <tr> + <td><a name="SkMatrix_kMSkewY"> <code><strong>SkMatrix::kMSkewY </strong></code> </a></td><td>3</td><td>vertical skew factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kMScaleY"> <code><strong>SkMatrix::kMScaleY </strong></code> </a></td><td>4</td><td>vertical scale factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kMTransY"> <code><strong>SkMatrix::kMTransY </strong></code> </a></td><td>5</td><td>vertical translation</td> + </tr> + <tr> + <td><a name="SkMatrix_kMPersp0"> <code><strong>SkMatrix::kMPersp0 </strong></code> </a></td><td>6</td><td>input x perspective factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kMPersp1"> <code><strong>SkMatrix::kMPersp1 </strong></code> </a></td><td>7</td><td>input y perspective factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kMPersp2"> <code><strong>SkMatrix::kMPersp2 </strong></code> </a></td><td>8</td><td>perspective bias</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3bbf75f4748420810aa2586e3c8548d9"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_set">set</a> + + + +## <a name="SkMatrix__anonymous_2"></a> Enum SkMatrix::_anonymous_2 + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +enum { +<a href="#SkMatrix_kAScaleX">kAScaleX</a>, +<a href="#SkMatrix_kASkewY">kASkewY</a>, +<a href="#SkMatrix_kASkewX">kASkewX</a>, +<a href="#SkMatrix_kAScaleY">kAScaleY</a>, +<a href="#SkMatrix_kATransX">kATransX</a>, +<a href="#SkMatrix_kATransY">kATransY</a>, +};</pre> + +Affine arrays are in column major order to match the matrix used by +<a href="undocumented#PDF">PDF</a> and <a href="undocumented#XPS">XPS</a>. + +### Constants + +<table> + <tr> + <td><a name="SkMatrix_kAScaleX"> <code><strong>SkMatrix::kAScaleX </strong></code> </a></td><td>0</td><td>horizontal scale factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kASkewY"> <code><strong>SkMatrix::kASkewY </strong></code> </a></td><td>1</td><td>vertical skew factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kASkewX"> <code><strong>SkMatrix::kASkewX </strong></code> </a></td><td>2</td><td>horizontal skew factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kAScaleY"> <code><strong>SkMatrix::kAScaleY </strong></code> </a></td><td>3</td><td>vertical scale factor</td> + </tr> + <tr> + <td><a name="SkMatrix_kATransX"> <code><strong>SkMatrix::kATransX </strong></code> </a></td><td>4</td><td>horizontal translation</td> + </tr> + <tr> + <td><a name="SkMatrix_kATransY"> <code><strong>SkMatrix::kATransY </strong></code> </a></td><td>5</td><td>vertical translation</td> + </tr> +</table> + +### See Also + +<a href="#SkMatrix_SetAffineIdentity">SetAffineIdentity</a> <a href="#SkMatrix_asAffine">asAffine</a> <a href="#SkMatrix_setAffine">setAffine</a> + + + +<a name="SkMatrix_subscript_operator_const"></a> +## operator[] + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar operator[](int index) const +</pre> + +Returns one matrix value. Asserts if <a href="#SkMatrix_subscript_operator_const_index">index</a> is out of range and <a href="undocumented#SK_DEBUG">SK DEBUG</a> is +defined. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_subscript_operator_const_index"> <code><strong>index </strong></code> </a></td> <td> +one of: <a href="#SkMatrix_kMScaleX">kMScaleX</a>, <a href="#SkMatrix_kMSkewX">kMSkewX</a>, <a href="#SkMatrix_kMTransX">kMTransX</a>, <a href="#SkMatrix_kMSkewY">kMSkewY</a>, <a href="#SkMatrix_kMScaleY">kMScaleY</a>, <a href="#SkMatrix_kMTransY">kMTransY</a>, +<a href="#SkMatrix_kMPersp0">kMPersp0</a>, <a href="#SkMatrix_kMPersp1">kMPersp1</a>, <a href="#SkMatrix_kMPersp2">kMPersp2</a></td> + </tr> +</table> + +### Return Value + +value corresponding to <a href="#SkMatrix_subscript_operator_const_index">index</a> + +### Example + +<div><fiddle-embed name="e8740493abdf0c6341762db9cee56b89"> + +#### Example Output + +~~~~ +matrix[SkMatrix::kMScaleX] == 42 +matrix[SkMatrix::kMScaleY] == 24 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_set">set</a> + +--- + +<a name="SkMatrix_get"></a> +## get + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar get(int index) const +</pre> + +Returns one matrix value. Asserts if <a href="#SkMatrix_get_index">index</a> is out of range and <a href="undocumented#SK_DEBUG">SK DEBUG</a> is +defined. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_get_index"> <code><strong>index </strong></code> </a></td> <td> +one of: <a href="#SkMatrix_kMScaleX">kMScaleX</a>, <a href="#SkMatrix_kMSkewX">kMSkewX</a>, <a href="#SkMatrix_kMTransX">kMTransX</a>, <a href="#SkMatrix_kMSkewY">kMSkewY</a>, <a href="#SkMatrix_kMScaleY">kMScaleY</a>, <a href="#SkMatrix_kMTransY">kMTransY</a>, +<a href="#SkMatrix_kMPersp0">kMPersp0</a>, <a href="#SkMatrix_kMPersp1">kMPersp1</a>, <a href="#SkMatrix_kMPersp2">kMPersp2</a></td> + </tr> +</table> + +### Return Value + +value corresponding to <a href="#SkMatrix_get_index">index</a> + +### Example + +<div><fiddle-embed name="f5ed382bd04fa7d50b2398cce2fca23a"> + +#### Example Output + +~~~~ +matrix.get(SkMatrix::kMSkewX) == 42 +matrix.get(SkMatrix::kMSkewY) == 24 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_subscript_operator_const">operator[](int index)</a> <a href="#SkMatrix_set">set</a> + +--- + +<a name="SkMatrix_getScaleX"></a> +## getScaleX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getScaleX() const +</pre> + +Returns scale factor multiplied by x input, contributing to x output. +With <a href="#SkMatrix_mapPoints">mapPoints</a>, scales <a href="#Point">Points</a> along the x-axis. + +### Return Value + +horizontal scale factor + +### Example + +<div><fiddle-embed name="ab746d9be63975041ae8e50cba84dc3d"> + +#### Example Output + +~~~~ +matrix.getScaleX() == 42 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_getScaleY">getScaleY</a> <a href="#SkMatrix_setScaleX">setScaleX</a> <a href="#SkMatrix_setScale">setScale</a> + +--- + +<a name="SkMatrix_getScaleY"></a> +## getScaleY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getScaleY() const +</pre> + +Returns scale factor multiplied by y input, contributing to y output. +With <a href="#SkMatrix_mapPoints">mapPoints</a>, scales <a href="#Point">Points</a> along the y-axis. + +### Return Value + +vertical scale factor + +### Example + +<div><fiddle-embed name="708b1a548a2f8661b2ab570782fbc751"> + +#### Example Output + +~~~~ +matrix.getScaleY() == 24 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_getScaleX">getScaleX</a> <a href="#SkMatrix_setScaleY">setScaleY</a> <a href="#SkMatrix_setScale">setScale</a> + +--- + +<a name="SkMatrix_getSkewY"></a> +## getSkewY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getSkewY() const +</pre> + +Returns scale factor multiplied by x input, contributing to y output. +With <a href="#SkMatrix_mapPoints">mapPoints</a>, skews <a href="#Point">Points</a> along the y-axis. +Skew x and y together can rotate <a href="#Point">Points</a>. + +### Return Value + +vertical skew factor + +### Example + +<div><fiddle-embed name="6be5704506d029ffc91ba03b1d3e674b"> + +#### Example Output + +~~~~ +matrix.getSkewY() == 24 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_getSkewX">getSkewX</a> <a href="#SkMatrix_setSkewY">setSkewY</a> <a href="#SkMatrix_setSkew">setSkew</a> + +--- + +<a name="SkMatrix_getSkewX"></a> +## getSkewX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getSkewX() const +</pre> + +Returns scale factor multiplied by y input, contributing to x output. +With <a href="#SkMatrix_mapPoints">mapPoints</a>, skews <a href="#Point">Points</a> along the x-axis. +Skew x and y together can rotate <a href="#Point">Points</a>. + +### Return Value + +horizontal scale factor + +### Example + +<div><fiddle-embed name="df3a5d3c688e7597eae1e4e07bf91ae6"> + +#### Example Output + +~~~~ +matrix.getSkewX() == 42 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_getSkewY">getSkewY</a> <a href="#SkMatrix_setSkewX">setSkewX</a> <a href="#SkMatrix_setSkew">setSkew</a> + +--- + +<a name="SkMatrix_getTranslateX"></a> +## getTranslateX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getTranslateX() const +</pre> + +Returns translation contributing to x output. +With <a href="#SkMatrix_mapPoints">mapPoints</a>, moves <a href="#Point">Points</a> along the x-axis. + +### Return Value + +horizontal translation factor + +### Example + +<div><fiddle-embed name="6236f7f2b91aff977a66ba2ee2558ca4"> + +#### Example Output + +~~~~ +matrix.getTranslateX() == 42 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_getTranslateY">getTranslateY</a> <a href="#SkMatrix_setTranslateX">setTranslateX</a> <a href="#SkMatrix_setTranslate">setTranslate</a> + +--- + +<a name="SkMatrix_getTranslateY"></a> +## getTranslateY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getTranslateY() const +</pre> + +Returns translation contributing to y output. +With <a href="#SkMatrix_mapPoints">mapPoints</a>, moves <a href="#Point">Points</a> along the y-axis. + +### Return Value + +vertical translation factor + +### Example + +<div><fiddle-embed name="08464e32d22421d2b254c71a84545ef5"> + +#### Example Output + +~~~~ +matrix.getTranslateY() == 24 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_getTranslateX">getTranslateX</a> <a href="#SkMatrix_setTranslateY">setTranslateY</a> <a href="#SkMatrix_setTranslate">setTranslate</a> + +--- + +<a name="SkMatrix_getPerspX"></a> +## getPerspX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getPerspX() const +</pre> + +Returns factor scaling input x relative to input y. + +### Return Value + +input x perspective factor + +### Example + +<div><fiddle-embed name="a0f5bf4b55e8c33bfda29bf67e34306f"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_kMPersp0">kMPersp0</a> <a href="#SkMatrix_getPerspY">getPerspY</a> + +--- + +<a name="SkMatrix_getPerspY"></a> +## getPerspY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getPerspY() const +</pre> + +Returns factor scaling input y relative to input x. + +### Return Value + +input y perspective factor + +### Example + +<div><fiddle-embed name="424a00a73675dbd99ad20feb0267442b"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_kMPersp1">kMPersp1</a> <a href="#SkMatrix_getPerspX">getPerspX</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar& operator[](int index) +</pre> + +Returns writable <a href="#Matrix">Matrix</a> value. Asserts if <a href="#SkMatrix_subscript_operator_index">index</a> is out of range and <a href="undocumented#SK_DEBUG">SK DEBUG</a> is +defined. Clears internal cache anticipating that caller will change <a href="#Matrix">Matrix</a> value. + +Next call to read <a href="#Matrix">Matrix</a> state may recompute cache; subsequent writes to <a href="#Matrix">Matrix</a> +value must be followed by <a href="#SkMatrix_dirtyMatrixTypeCache">dirtyMatrixTypeCache</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_subscript_operator_index"> <code><strong>index </strong></code> </a></td> <td> +one of: <a href="#SkMatrix_kMScaleX">kMScaleX</a>, <a href="#SkMatrix_kMSkewX">kMSkewX</a>, <a href="#SkMatrix_kMTransX">kMTransX</a>, <a href="#SkMatrix_kMSkewY">kMSkewY</a>, <a href="#SkMatrix_kMScaleY">kMScaleY</a>, <a href="#SkMatrix_kMTransY">kMTransY</a>, +<a href="#SkMatrix_kMPersp0">kMPersp0</a>, <a href="#SkMatrix_kMPersp1">kMPersp1</a>, <a href="#SkMatrix_kMPersp2">kMPersp2</a></td> + </tr> +</table> + +### Return Value + +writable value corresponding to <a href="#SkMatrix_subscript_operator_index">index</a> + +### Example + +<div><fiddle-embed name="f4365ef332f51f7fd25040e0771ba9a2"> + +#### Example Output + +~~~~ +with identity matrix: x = 24 +after skew x mod: x = 24 +after 2nd skew x mod: x = 24 +after dirty cache: x = 66 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_dirtyMatrixTypeCache">dirtyMatrixTypeCache</a> <a href="#SkMatrix_set">set</a> + +--- + +<a name="SkMatrix_set"></a> +## set + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void set(int index, SkScalar value) +</pre> + +Sets <a href="#Matrix">Matrix</a> <a href="#SkMatrix_set_value">value</a>. Asserts if <a href="#SkMatrix_set_index">index</a> is out of range and <a href="undocumented#SK_DEBUG">SK DEBUG</a> is +defined. Safer than operator[]; internal cache is always maintained. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_set_index"> <code><strong>index </strong></code> </a></td> <td> +one of: <a href="#SkMatrix_kMScaleX">kMScaleX</a>, <a href="#SkMatrix_kMSkewX">kMSkewX</a>, <a href="#SkMatrix_kMTransX">kMTransX</a>, <a href="#SkMatrix_kMSkewY">kMSkewY</a>, <a href="#SkMatrix_kMScaleY">kMScaleY</a>, <a href="#SkMatrix_kMTransY">kMTransY</a>, +<a href="#SkMatrix_kMPersp0">kMPersp0</a>, <a href="#SkMatrix_kMPersp1">kMPersp1</a>, <a href="#SkMatrix_kMPersp2">kMPersp2</a></td> + </tr> <tr> <td><a name="SkMatrix_set_value"> <code><strong>value </strong></code> </a></td> <td> +<a href="#Scalar">Scalar</a> to store in <a href="#Matrix">Matrix</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1d400a92ca826cc89bcb88ea051f28c8"> + +#### Example Output + +~~~~ +with identity matrix: x = 24 +after skew x mod: x = 24 +after 2nd skew x mod: x = 66 +~~~~ + +</fiddle-embed></div> + +### See Also + +operator[] <a href="#SkMatrix_get">get</a> + +--- + +<a name="SkMatrix_setScaleX"></a> +## setScaleX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setScaleX(SkScalar v) +</pre> + +Sets horizontal scale factor. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setScaleX_v"> <code><strong>v </strong></code> </a></td> <td> +horizontal scale factor to store</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a39dfed98c3c3c3a56be9ad59fe4e21e"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_set">set</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_setScaleY">setScaleY</a> + +--- + +<a name="SkMatrix_setScaleY"></a> +## setScaleY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setScaleY(SkScalar v) +</pre> + +Sets vertical scale factor. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setScaleY_v"> <code><strong>v </strong></code> </a></td> <td> +vertical scale factor to store</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="f040c6dd85a02e94eaca00d5c2832604"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_set">set</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_setScaleX">setScaleX</a> + +--- + +<a name="SkMatrix_setSkewY"></a> +## setSkewY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setSkewY(SkScalar v) +</pre> + +Sets vertical skew factor. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setSkewY_v"> <code><strong>v </strong></code> </a></td> <td> +vertical skew factor to store</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="b418d15df9829aefcc6aca93a37428bb"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_set">set</a> <a href="#SkMatrix_setSkew">setSkew</a> <a href="#SkMatrix_setSkewX">setSkewX</a> + +--- + +<a name="SkMatrix_setSkewX"></a> +## setSkewX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setSkewX(SkScalar v) +</pre> + +Sets horizontal skew factor. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setSkewX_v"> <code><strong>v </strong></code> </a></td> <td> +horizontal skew factor to store</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c7177a6fbc1545be95a5ebca87e0cd0d"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_set">set</a> <a href="#SkMatrix_setSkew">setSkew</a> <a href="#SkMatrix_setSkewX">setSkewX</a> + +--- + +<a name="SkMatrix_setTranslateX"></a> +## setTranslateX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTranslateX(SkScalar v) +</pre> + +Sets horizontal translation. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setTranslateX_v"> <code><strong>v </strong></code> </a></td> <td> +horizontal translation to store</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a18bc2e3607ac3a8e438bcb61fb13130"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_set">set</a> <a href="#SkMatrix_setTranslate">setTranslate</a> <a href="#SkMatrix_setTranslateY">setTranslateY</a> + +--- + +<a name="SkMatrix_setTranslateY"></a> +## setTranslateY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTranslateY(SkScalar v) +</pre> + +Sets vertical translation. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setTranslateY_v"> <code><strong>v </strong></code> </a></td> <td> +vertical translation to store</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="34e3c70a72b836abf7f4858d35eecc98"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_set">set</a> <a href="#SkMatrix_setTranslate">setTranslate</a> <a href="#SkMatrix_setTranslateX">setTranslateX</a> + +--- + +<a name="SkMatrix_setPerspX"></a> +## setPerspX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setPerspX(SkScalar v) +</pre> + +Sets input x perspective factor, which causes <a href="#SkMatrix_mapXY">mapXY</a> to vary input x inversely +proportional to input y. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setPerspX_v"> <code><strong>v </strong></code> </a></td> <td> +perspective factor</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="830a9e4e4bb93d25afd83b2fea63929e"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_getPerspX">getPerspX</a> <a href="#SkMatrix_set">set</a> <a href="#SkMatrix_setAll">setAll</a> <a href="#SkMatrix_set9">set9</a> + +--- + +<a name="SkMatrix_setPerspY"></a> +## setPerspY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setPerspY(SkScalar v) +</pre> + +Sets input y perspective factor, which causes <a href="#SkMatrix_mapXY">mapXY</a> to vary input y inversely +proportional to input x. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setPerspY_v"> <code><strong>v </strong></code> </a></td> <td> +perspective factor</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="aeb258b7922c1a11b698b00f562182ec"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_getPerspY">getPerspY</a> <a href="#SkMatrix_set">set</a> <a href="#SkMatrix_setAll">setAll</a> <a href="#SkMatrix_set9">set9</a> + +--- + +<a name="SkMatrix_setAll"></a> +## setAll + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, + SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, + SkScalar persp2) +</pre> + +Sets all values from parameters. Sets matrix to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| scaleX skewX transX | +| skewY scaleY transY | +| persp0 persp1 persp2 |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setAll_scaleX"> <code><strong>scaleX </strong></code> </a></td> <td> +horizontal scale factor to store</td> + </tr> <tr> <td><a name="SkMatrix_setAll_skewX"> <code><strong>skewX </strong></code> </a></td> <td> +horizontal skew factor to store</td> + </tr> <tr> <td><a name="SkMatrix_setAll_transX"> <code><strong>transX </strong></code> </a></td> <td> +horizontal translation to store</td> + </tr> <tr> <td><a name="SkMatrix_setAll_skewY"> <code><strong>skewY </strong></code> </a></td> <td> +vertical skew factor to store</td> + </tr> <tr> <td><a name="SkMatrix_setAll_scaleY"> <code><strong>scaleY </strong></code> </a></td> <td> +vertical scale factor to store</td> + </tr> <tr> <td><a name="SkMatrix_setAll_transY"> <code><strong>transY </strong></code> </a></td> <td> +vertical translation to store</td> + </tr> <tr> <td><a name="SkMatrix_setAll_persp0"> <code><strong>persp0 </strong></code> </a></td> <td> +input x perspective factor to store</td> + </tr> <tr> <td><a name="SkMatrix_setAll_persp1"> <code><strong>persp1 </strong></code> </a></td> <td> +input y perspective factor to store</td> + </tr> <tr> <td><a name="SkMatrix_setAll_persp2"> <code><strong>persp2 </strong></code> </a></td> <td> +perspective scale factor to store</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c51d81b637b58da30fb9ae2d68877167"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_set9">set9</a> + +--- + +<a name="SkMatrix_get9"></a> +## get9 + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void get9(SkScalar buffer[9]) const +</pre> + +Copies nine <a href="#Scalar">Scalar</a> values contained by <a href="#Matrix">Matrix</a> into <a href="#SkMatrix_get9_buffer">buffer</a>, in member value +ascending order: <a href="#SkMatrix_kMScaleX">kMScaleX</a>, <a href="#SkMatrix_kMSkewX">kMSkewX</a>, <a href="#SkMatrix_kMTransX">kMTransX</a>, <a href="#SkMatrix_kMSkewY">kMSkewY</a>, <a href="#SkMatrix_kMScaleY">kMScaleY</a>, <a href="#SkMatrix_kMTransY">kMTransY</a>, +<a href="#SkMatrix_kMPersp0">kMPersp0</a>, <a href="#SkMatrix_kMPersp1">kMPersp1</a>, <a href="#SkMatrix_kMPersp2">kMPersp2</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_get9_buffer"> <code><strong>buffer </strong></code> </a></td> <td> +storage for nine <a href="#Scalar">Scalar</a> values</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="df509d73b47cb98b0475e4465db7b246"> + +#### Example Output + +~~~~ +{4, 0, 3}, +{0, 5, 4}, +{0, 0, 1} +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_set9">set9</a> + +--- + +<a name="SkMatrix_set9"></a> +## set9 + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void set9(const SkScalar buffer[9]) +</pre> + +Sets <a href="#Matrix">Matrix</a> to nine <a href="#Scalar">Scalar</a> values in <a href="#SkMatrix_set9_buffer">buffer</a>, in member value ascending order: +<a href="#SkMatrix_kMScaleX">kMScaleX</a>, <a href="#SkMatrix_kMSkewX">kMSkewX</a>, <a href="#SkMatrix_kMTransX">kMTransX</a>, <a href="#SkMatrix_kMSkewY">kMSkewY</a>, <a href="#SkMatrix_kMScaleY">kMScaleY</a>, <a href="#SkMatrix_kMTransY">kMTransY</a>, <a href="#SkMatrix_kMPersp0">kMPersp0</a>, <a href="#SkMatrix_kMPersp1">kMPersp1</a>, +<a href="#SkMatrix_kMPersp2">kMPersp2</a>. + +Sets matrix to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| buffer[0] buffer[1] buffer[2] | +| buffer[3] buffer[4] buffer[5] | +| buffer[6] buffer[7] buffer[8] |</pre> + +In the future, <a href="#SkMatrix_set9">set9</a> followed by <a href="#SkMatrix_get9">get9</a> may not return the same values. Since <a href="#Matrix">Matrix</a> +maps non-homogeneous coordinates, scaling all nine values produces an equivalent +transformation, possibly improving precision. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_set9_buffer"> <code><strong>buffer </strong></code> </a></td> <td> +nine <a href="#Scalar">Scalar</a> values</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="ec5de0d23e5fe28ba7628625d1402e85"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setAll">setAll</a> <a href="#SkMatrix_get9">get9</a> + +--- + +<a name="SkMatrix_reset"></a> +## reset + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void reset() +</pre> + +Sets <a href="#Matrix">Matrix</a> to identity; which has no effect on mapped <a href="#Point">Points</a>. Sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 1 0 0 | +| 0 1 0 | +| 0 0 1 |</pre> + +Also called <a href="#SkMatrix_setIdentity">setIdentity</a>; use the one that provides better inline +documentation. + +### Example + +<div><fiddle-embed name="ca94f7922bc37ef03bbc51ad70536fcf"> + +#### Example Output + +~~~~ +m.isIdentity(): true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_isIdentity">isIdentity</a> <a href="#SkMatrix_setIdentity">setIdentity</a> + +--- + +<a name="SkMatrix_setIdentity"></a> +## setIdentity + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setIdentity() +</pre> + +Sets <a href="#Matrix">Matrix</a> to identity; which has no effect on mapped <a href="#Point">Points</a>. Sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 1 0 0 | +| 0 1 0 | +| 0 0 1 |</pre> + +Also called <a href="#SkMatrix_reset">reset</a>; use the one that provides better inline +documentation. + +### Example + +<div><fiddle-embed name="3979c865bb482e6ef1fafc71e56bbb91"> + +#### Example Output + +~~~~ +m.isIdentity(): true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_isIdentity">isIdentity</a> <a href="#SkMatrix_reset">reset</a> + +--- + +<a name="SkMatrix_setTranslate"></a> +## setTranslate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTranslate(SkScalar dx, SkScalar dy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to translate by (<a href="#SkMatrix_setTranslate_dx">dx</a>, <a href="#SkMatrix_setTranslate_dy">dy</a>). + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setTranslate_dx"> <code><strong>dx </strong></code> </a></td> <td> +horizontal translation</td> + </tr> <tr> <td><a name="SkMatrix_setTranslate_dy"> <code><strong>dy </strong></code> </a></td> <td> +vertical translation</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="63ca62985741b1bccb5e8b9cf734874e"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setTranslateX">setTranslateX</a> <a href="#SkMatrix_setTranslateY">setTranslateY</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTranslate(const SkVector& v) +</pre> + +Sets <a href="#Matrix">Matrix</a> to translate by (<a href="#SkMatrix_setTranslate_2_v">v</a>.fX, <a href="#SkMatrix_setTranslate_2_v">v</a>.fY). + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setTranslate_2_v"> <code><strong>v </strong></code> </a></td> <td> +<a href="undocumented#Vector">Vector</a> containing horizontal and vertical translation</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="ccfc734aff2ddea0b097c83f5621de5e"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setTranslateX">setTranslateX</a> <a href="#SkMatrix_setTranslateY">setTranslateY</a> <a href="#SkMatrix_MakeTrans">MakeTrans</a> + +--- + +<a name="SkMatrix_setScale"></a> +## setScale + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to scale by <a href="#SkMatrix_setScale_sx">sx</a> and <a href="#SkMatrix_setScale_sy">sy</a>, about a pivot point at (<a href="#SkMatrix_setScale_px">px</a>, <a href="#SkMatrix_setScale_py">py</a>). +The pivot point is unchanged when mapped with <a href="#Matrix">Matrix</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setScale_sx"> <code><strong>sx </strong></code> </a></td> <td> +horizontal scale factor</td> + </tr> <tr> <td><a name="SkMatrix_setScale_sy"> <code><strong>sy </strong></code> </a></td> <td> +vertical scale factor</td> + </tr> <tr> <td><a name="SkMatrix_setScale_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_setScale_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="397db8da89bc92e7c576ad013d64ed24"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setScaleX">setScaleX</a> <a href="#SkMatrix_setScaleY">setScaleY</a> <a href="#SkMatrix_MakeScale">MakeScale</a> <a href="#SkMatrix_preScale">preScale</a> <a href="#SkMatrix_postScale">postScale</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setScale(SkScalar sx, SkScalar sy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to scale by <a href="#SkMatrix_setScale_2_sx">sx</a> and <a href="#SkMatrix_setScale_2_sy">sy</a> about at pivot point at (0, 0). + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setScale_2_sx"> <code><strong>sx </strong></code> </a></td> <td> +horizontal scale factor</td> + </tr> <tr> <td><a name="SkMatrix_setScale_2_sy"> <code><strong>sy </strong></code> </a></td> <td> +vertical scale factor</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="94a9ec11b994580dca14aa2159a796a9"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setScaleX">setScaleX</a> <a href="#SkMatrix_setScaleY">setScaleY</a> <a href="#SkMatrix_MakeScale">MakeScale</a> <a href="#SkMatrix_preScale">preScale</a> <a href="#SkMatrix_postScale">postScale</a> + +--- + +<a name="SkMatrix_setRotate"></a> +## setRotate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setRotate(SkScalar degrees, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to rotate by <a href="#SkMatrix_setRotate_degrees">degrees</a> about a pivot point at (<a href="#SkMatrix_setRotate_px">px</a>, <a href="#SkMatrix_setRotate_py">py</a>). +The pivot point is unchanged when mapped with <a href="#Matrix">Matrix</a>. + +Positive <a href="#SkMatrix_setRotate_degrees">degrees</a> rotates clockwise. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setRotate_degrees"> <code><strong>degrees </strong></code> </a></td> <td> +angle of axes relative to upright axes</td> + </tr> <tr> <td><a name="SkMatrix_setRotate_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_setRotate_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="8c28db3add9cd0177225088f6df6bbb5"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setSinCos">setSinCos</a> <a href="#SkMatrix_preRotate">preRotate</a> <a href="#SkMatrix_postRotate">postRotate</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setRotate(SkScalar degrees) +</pre> + +Sets <a href="#Matrix">Matrix</a> to rotate by <a href="#SkMatrix_setRotate_2_degrees">degrees</a> about a pivot point at (0, 0). +Positive <a href="#SkMatrix_setRotate_2_degrees">degrees</a> rotates clockwise. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setRotate_2_degrees"> <code><strong>degrees </strong></code> </a></td> <td> +angle of axes relative to upright axes</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="93efb9d191bf1b9710c173513e014d6c"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setSinCos">setSinCos</a> <a href="#SkMatrix_preRotate">preRotate</a> <a href="#SkMatrix_postRotate">postRotate</a> + +--- + +<a name="SkMatrix_setSinCos"></a> +## setSinCos + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setSinCos(SkScalar sinValue, SkScalar cosValue, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to rotate by <a href="#SkMatrix_setSinCos_sinValue">sinValue</a> and <a href="#SkMatrix_setSinCos_cosValue">cosValue</a>, about a pivot point at (<a href="#SkMatrix_setSinCos_px">px</a>, <a href="#SkMatrix_setSinCos_py">py</a>). +The pivot point is unchanged when mapped with <a href="#Matrix">Matrix</a>. + +<a href="undocumented#Vector">Vector</a> (<a href="#SkMatrix_setSinCos_sinValue">sinValue</a>, <a href="#SkMatrix_setSinCos_cosValue">cosValue</a>) describes the angle of rotation relative to (0, 1). +<a href="undocumented#Vector">Vector</a> length specifies scale. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setSinCos_sinValue"> <code><strong>sinValue </strong></code> </a></td> <td> +rotation vector x component</td> + </tr> <tr> <td><a name="SkMatrix_setSinCos_cosValue"> <code><strong>cosValue </strong></code> </a></td> <td> +rotation vector y component</td> + </tr> <tr> <td><a name="SkMatrix_setSinCos_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_setSinCos_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="187e1d9228e2e4341ef820bd77b6fda9"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setRotate">setRotate</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_setRSXform">setRSXform</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setSinCos(SkScalar sinValue, SkScalar cosValue) +</pre> + +Sets <a href="#Matrix">Matrix</a> to rotate by <a href="#SkMatrix_setSinCos_2_sinValue">sinValue</a> and <a href="#SkMatrix_setSinCos_2_cosValue">cosValue</a>, about a pivot point at (0, 0). + +<a href="undocumented#Vector">Vector</a> (<a href="#SkMatrix_setSinCos_2_sinValue">sinValue</a>, <a href="#SkMatrix_setSinCos_2_cosValue">cosValue</a>) describes the angle of rotation relative to (0, 1). +<a href="undocumented#Vector">Vector</a> length specifies scale. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setSinCos_2_sinValue"> <code><strong>sinValue </strong></code> </a></td> <td> +rotation vector x component</td> + </tr> <tr> <td><a name="SkMatrix_setSinCos_2_cosValue"> <code><strong>cosValue </strong></code> </a></td> <td> +rotation vector y component</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="e37a94a53c959951b059fcd624639ef6"><div><a href="SkCanvas_Reference#Canvas">Canvas</a> needs offset after applying <a href="#Matrix">Matrix</a> to pivot about <a href="SkRect_Reference#Rect">Rect</a> center.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setRotate">setRotate</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_setRSXform">setRSXform</a> + +--- + +<a name="SkMatrix_setRSXform"></a> +## setRSXform + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkMatrix& setRSXform(const SkRSXform& rsxForm) +</pre> + +Sets <a href="#Matrix">Matrix</a> to rotate, scale, and translate using a compressed matrix form. + +<a href="undocumented#Vector">Vector</a> (<a href="#SkMatrix_setRSXform_rsxForm">rsxForm</a>.fSSin, <a href="#SkMatrix_setRSXform_rsxForm">rsxForm</a>.fSCos) describes the angle of rotation relative +to (0, 1). <a href="undocumented#Vector">Vector</a> length specifies scale. Mapped point is rotated and scaled +by <a href="undocumented#Vector">Vector</a>, then translated by (<a href="#SkMatrix_setRSXform_rsxForm">rsxForm</a>.fTx, <a href="#SkMatrix_setRSXform_rsxForm">rsxForm</a>.fTy). + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setRSXform_rsxForm"> <code><strong>rsxForm </strong></code> </a></td> <td> +compressed <a href="undocumented#RSXform">RSXform</a> matrix</td> + </tr> +</table> + +### Return Value + +reference to <a href="#Matrix">Matrix</a> + +### Example + +<div><fiddle-embed name="c3f5faddca466f78278b32b88fd5f5eb"><div><a href="SkCanvas_Reference#Canvas">Canvas</a> needs offset after applying <a href="#Matrix">Matrix</a> to pivot about <a href="SkRect_Reference#Rect">Rect</a> center.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setSinCos">setSinCos</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_setTranslate">setTranslate</a> + +--- + +<a name="SkMatrix_setSkew"></a> +## setSkew + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to skew by <a href="#SkMatrix_setSkew_kx">kx</a> and <a href="#SkMatrix_setSkew_ky">ky</a>, about a pivot point at (<a href="#SkMatrix_setSkew_px">px</a>, <a href="#SkMatrix_setSkew_py">py</a>). +The pivot point is unchanged when mapped with <a href="#Matrix">Matrix</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setSkew_kx"> <code><strong>kx </strong></code> </a></td> <td> +horizontal skew factor</td> + </tr> <tr> <td><a name="SkMatrix_setSkew_ky"> <code><strong>ky </strong></code> </a></td> <td> +vertical skew factor</td> + </tr> <tr> <td><a name="SkMatrix_setSkew_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_setSkew_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="55e0431adc6c5b1987ebb8123cc10342"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setSkewX">setSkewX</a> <a href="#SkMatrix_setSkewY">setSkewY</a> <a href="#SkMatrix_preSkew">preSkew</a> <a href="#SkMatrix_postSkew">postSkew</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setSkew(SkScalar kx, SkScalar ky) +</pre> + +Sets <a href="#Matrix">Matrix</a> to skew by <a href="#SkMatrix_setSkew_2_kx">kx</a> and <a href="#SkMatrix_setSkew_2_ky">ky</a>, about a pivot point at (0, 0). + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setSkew_2_kx"> <code><strong>kx </strong></code> </a></td> <td> +horizontal skew factor</td> + </tr> <tr> <td><a name="SkMatrix_setSkew_2_ky"> <code><strong>ky </strong></code> </a></td> <td> +vertical skew factor</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="05be7844e9afdd7b9bfc31c5423a70a2"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setSkewX">setSkewX</a> <a href="#SkMatrix_setSkewY">setSkewY</a> <a href="#SkMatrix_preSkew">preSkew</a> <a href="#SkMatrix_postSkew">postSkew</a> + +--- + +<a name="SkMatrix_setConcat"></a> +## setConcat + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setConcat(const SkMatrix& a, const SkMatrix& b) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> <a href="#SkMatrix_setConcat_a">a</a> multiplied by <a href="#Matrix">Matrix</a> <a href="#SkMatrix_setConcat_b">b</a>. Either <a href="#SkMatrix_setConcat_a">a</a> or <a href="#SkMatrix_setConcat_b">b</a> may be this. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | J K L | +a = | D E F |, b = | M N O | + | G H I | | P Q R |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | +a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | + | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setConcat_a"> <code><strong>a </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> on left side of multiply expression</td> + </tr> <tr> <td><a name="SkMatrix_setConcat_b"> <code><strong>b </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> on right side of multiply expression</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0381a10ac69bdefdf9d15b47cbb9fefe"><div><a href="#SkMatrix_setPolyToPoly">setPolyToPoly</a> creates perspective matrices, one the inverse of the other. +Multiplying the matrix by its inverse turns into an identity matrix.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_Concat">Concat</a> <a href="#SkMatrix_preConcat">preConcat</a> <a href="#SkMatrix_postConcat">postConcat</a> <a href="#SkCanvas_concat">SkCanvas::concat</a> + +--- + +<a name="SkMatrix_preTranslate"></a> +## preTranslate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void preTranslate(SkScalar dx, SkScalar dy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> multiplied by <a href="#Matrix">Matrix</a> constructed from translation (<a href="#SkMatrix_preTranslate_dx">dx</a>, <a href="#SkMatrix_preTranslate_dy">dy</a>). +This can be thought of as moving the point to be mapped before applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | 1 0 dx | +Matrix = | D E F |, T(dx, dy) = | 0 1 dy | + | G H I | | 0 0 1 |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | 1 0 dx | | A B A*dx+B*dy+C | +Matrix * T(dx, dy) = | D E F | | 0 1 dy | = | D E D*dx+E*dy+F | + | G H I | | 0 0 1 | | G H G*dx+H*dy+I |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preTranslate_dx"> <code><strong>dx </strong></code> </a></td> <td> +x translation before applying <a href="#Matrix">Matrix</a></td> + </tr> <tr> <td><a name="SkMatrix_preTranslate_dy"> <code><strong>dy </strong></code> </a></td> <td> +y translation before applying <a href="#Matrix">Matrix</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="08f6749933f4ce541073077ab506fd9b"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postTranslate">postTranslate</a> <a href="#SkMatrix_setTranslate">setTranslate</a> <a href="#SkMatrix_MakeTrans">MakeTrans</a> + +--- + +<a name="SkMatrix_preScale"></a> +## preScale + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> multiplied by <a href="#Matrix">Matrix</a> constructed from scaling by (<a href="#SkMatrix_preScale_sx">sx</a>, <a href="#SkMatrix_preScale_sy">sy</a>) +about pivot point (<a href="#SkMatrix_preScale_px">px</a>, <a href="#SkMatrix_preScale_py">py</a>). +This can be thought of as scaling about a pivot point before applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | sx 0 dx | +Matrix = | D E F |, S(sx, sy, px, py) = | 0 sy dy | + | G H I | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +dx = px - sx * px +dy = py - sy * py</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | sx 0 dx | | A*sx B*sy A*dx+B*dy+C | +Matrix * S(sx, sy, px, py) = | D E F | | 0 sy dy | = | D*sx E*sy D*dx+E*dy+F | + | G H I | | 0 0 1 | | G*sx H*sy G*dx+H*dy+I |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preScale_sx"> <code><strong>sx </strong></code> </a></td> <td> +horizontal scale factor</td> + </tr> <tr> <td><a name="SkMatrix_preScale_sy"> <code><strong>sy </strong></code> </a></td> <td> +vertical scale factor</td> + </tr> <tr> <td><a name="SkMatrix_preScale_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_preScale_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="2531f8d1e05d7b6dc22f3efcd2fb84e4"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postScale">postScale</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_MakeScale">MakeScale</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void preScale(SkScalar sx, SkScalar sy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> multiplied by <a href="#Matrix">Matrix</a> constructed from scaling by (<a href="#SkMatrix_preScale_2_sx">sx</a>, <a href="#SkMatrix_preScale_2_sy">sy</a>) +about pivot point (0, 0). +This can be thought of as scaling about the origin before applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | sx 0 0 | +Matrix = | D E F |, S(sx, sy) = | 0 sy 0 | + | G H I | | 0 0 1 |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | sx 0 0 | | A*sx B*sy C | +Matrix * S(sx, sy) = | D E F | | 0 sy 0 | = | D*sx E*sy F | + | G H I | | 0 0 1 | | G*sx H*sy I |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preScale_2_sx"> <code><strong>sx </strong></code> </a></td> <td> +horizontal scale factor</td> + </tr> <tr> <td><a name="SkMatrix_preScale_2_sy"> <code><strong>sy </strong></code> </a></td> <td> +vertical scale factor</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3edbdea8e43d06086abf33ec4a9b415b"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postScale">postScale</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_MakeScale">MakeScale</a> + +--- + +<a name="SkMatrix_preRotate"></a> +## preRotate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void preRotate(SkScalar degrees, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> multiplied by <a href="#Matrix">Matrix</a> constructed from rotating by <a href="#SkMatrix_preRotate_degrees">degrees</a> +about pivot point (<a href="#SkMatrix_preRotate_px">px</a>, <a href="#SkMatrix_preRotate_py">py</a>). +This can be thought of as rotating about a pivot point before applying <a href="#Matrix">Matrix</a>. + +Positive <a href="#SkMatrix_preRotate_degrees">degrees</a> rotates clockwise. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | c -s dx | +Matrix = | D E F |, R(degrees, px, py) = | s c dy | + | G H I | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +c = cos(degrees) +s = sin(degrees) +dx = s * py + (1 - c) * px +dy = -s * px + (1 - c) * py</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | c -s dx | | Ac+Bs -As+Bc A*dx+B*dy+C | +Matrix * R(degrees, px, py) = | D E F | | s c dy | = | Dc+Es -Ds+Ec D*dx+E*dy+F | + | G H I | | 0 0 1 | | Gc+Hs -Gs+Hc G*dx+H*dy+I |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preRotate_degrees"> <code><strong>degrees </strong></code> </a></td> <td> +angle of axes relative to upright axes</td> + </tr> <tr> <td><a name="SkMatrix_preRotate_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_preRotate_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a70bb18d67c06a20ab514e7a47924e5a"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postRotate">postRotate</a> <a href="#SkMatrix_setRotate">setRotate</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void preRotate(SkScalar degrees) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> multiplied by <a href="#Matrix">Matrix</a> constructed from rotating by <a href="#SkMatrix_preRotate_2_degrees">degrees</a> +about pivot point (0, 0). +This can be thought of as rotating about the origin before applying <a href="#Matrix">Matrix</a>. + +Positive <a href="#SkMatrix_preRotate_2_degrees">degrees</a> rotates clockwise. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | c -s 0 | +Matrix = | D E F |, R(degrees, px, py) = | s c 0 | + | G H I | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +c = cos(degrees) +s = sin(degrees)</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | c -s 0 | | Ac+Bs -As+Bc C | +Matrix * R(degrees, px, py) = | D E F | | s c 0 | = | Dc+Es -Ds+Ec F | + | G H I | | 0 0 1 | | Gc+Hs -Gs+Hc I |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preRotate_2_degrees"> <code><strong>degrees </strong></code> </a></td> <td> +angle of axes relative to upright axes</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="5acd49bd931c79a808dd6c7cc0e92f72"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postRotate">postRotate</a> <a href="#SkMatrix_setRotate">setRotate</a> + +--- + +<a name="SkMatrix_preSkew"></a> +## preSkew + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void preSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> multiplied by <a href="#Matrix">Matrix</a> constructed from skewing by (<a href="#SkMatrix_preSkew_kx">kx</a>, <a href="#SkMatrix_preSkew_ky">ky</a>) +about pivot point (<a href="#SkMatrix_preSkew_px">px</a>, <a href="#SkMatrix_preSkew_py">py</a>). +This can be thought of as skewing about a pivot point before applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | 1 kx dx | +Matrix = | D E F |, K(kx, ky, px, py) = | ky 1 dy | + | G H I | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +dx = -kx * py +dy = -ky * px</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | 1 kx dx | | A+B*ky A*kx+B A*dx+B*dy+C | +Matrix * K(kx, ky, px, py) = | D E F | | ky 1 dy | = | D+E*ky D*kx+E D*dx+E*dy+F | + | G H I | | 0 0 1 | | G+H*ky G*kx+H G*dx+H*dy+I |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preSkew_kx"> <code><strong>kx </strong></code> </a></td> <td> +horizontal skew factor</td> + </tr> <tr> <td><a name="SkMatrix_preSkew_ky"> <code><strong>ky </strong></code> </a></td> <td> +vertical skew factor</td> + </tr> <tr> <td><a name="SkMatrix_preSkew_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_preSkew_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="199a18ad61d702664ce6df1d7037aa48"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postSkew">postSkew</a> <a href="#SkMatrix_setSkew">setSkew</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void preSkew(SkScalar kx, SkScalar ky) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> multiplied by <a href="#Matrix">Matrix</a> constructed from skewing by (<a href="#SkMatrix_preSkew_2_kx">kx</a>, <a href="#SkMatrix_preSkew_2_ky">ky</a>) +about pivot point (0, 0). +This can be thought of as skewing about the origin before applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | 1 kx 0 | +Matrix = | D E F |, K(kx, ky) = | ky 1 0 | + | G H I | | 0 0 1 |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | 1 kx 0 | | A+B*ky A*kx+B C | +Matrix * K(kx, ky) = | D E F | | ky 1 0 | = | D+E*ky D*kx+E F | + | G H I | | 0 0 1 | | G+H*ky G*kx+H I |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preSkew_2_kx"> <code><strong>kx </strong></code> </a></td> <td> +horizontal skew factor</td> + </tr> <tr> <td><a name="SkMatrix_preSkew_2_ky"> <code><strong>ky </strong></code> </a></td> <td> +vertical skew factor</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="e100c543869fe8fd516ba69de79444ba"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postSkew">postSkew</a> <a href="#SkMatrix_setSkew">setSkew</a> + +--- + +<a name="SkMatrix_preConcat"></a> +## preConcat + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void preConcat(const SkMatrix& other) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> multiplied by <a href="#Matrix">Matrix</a> <a href="#SkMatrix_preConcat_other">other</a>. +This can be thought of mapping by <a href="#SkMatrix_preConcat_other">other</a> before applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | J K L | +Matrix = | D E F |, other = | M N O | + | G H I | | P Q R |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | +Matrix * other = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | + | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_preConcat_other"> <code><strong>other </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> on right side of multiply expression</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="b07e62298e7b0ab5683db199faffceb2"><div><a href="#SkMatrix_setPolyToPoly">setPolyToPoly</a> creates perspective matrices, one the inverse of the <a href="#SkMatrix_preConcat_other">other</a>. +Multiplying the matrix by its inverse turns into an identity matrix.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postConcat">postConcat</a> <a href="#SkMatrix_setConcat">setConcat</a> <a href="#SkMatrix_Concat">Concat</a> + +--- + +<a name="SkMatrix_postTranslate"></a> +## postTranslate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void postTranslate(SkScalar dx, SkScalar dy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> constructed from translation (<a href="#SkMatrix_postTranslate_dx">dx</a>, <a href="#SkMatrix_postTranslate_dy">dy</a>) multiplied by <a href="#Matrix">Matrix</a>. +This can be thought of as moving the point to be mapped after applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | 1 0 dx | +Matrix = | M N O |, T(dx, dy) = | 0 1 dy | + | P Q R | | 0 0 1 |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | 1 0 dx | | J K L | | J+dx*P K+dx*Q L+dx*R | +T(dx, dy) * Matrix = | 0 1 dy | | M N O | = | M+dy*P N+dy*Q O+dy*R | + | 0 0 1 | | P Q R | | P Q R |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postTranslate_dx"> <code><strong>dx </strong></code> </a></td> <td> +x translation after applying <a href="#Matrix">Matrix</a></td> + </tr> <tr> <td><a name="SkMatrix_postTranslate_dy"> <code><strong>dy </strong></code> </a></td> <td> +y translation after applying <a href="#Matrix">Matrix</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="57e4cff302c0d754ac6c66050d741772"><div>Compare with <a href="#SkMatrix_preTranslate">preTranslate</a> example.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preTranslate">preTranslate</a> <a href="#SkMatrix_setTranslate">setTranslate</a> <a href="#SkMatrix_MakeTrans">MakeTrans</a> + +--- + +<a name="SkMatrix_postScale"></a> +## postScale + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> constructed from scaling by (<a href="#SkMatrix_postScale_sx">sx</a>, <a href="#SkMatrix_postScale_sy">sy</a>) about pivot point +(<a href="#SkMatrix_postScale_px">px</a>, <a href="#SkMatrix_postScale_py">py</a>), multiplied by <a href="#Matrix">Matrix</a>. +This can be thought of as scaling about a pivot point after applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | sx 0 dx | +Matrix = | M N O |, S(sx, sy, px, py) = | 0 sy dy | + | P Q R | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +dx = px - sx * px +dy = py - sy * py</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | sx 0 dx | | J K L | | sx*J+dx*P sx*K+dx*Q sx*L+dx+R | +S(sx, sy, px, py) * Matrix = | 0 sy dy | | M N O | = | sy*M+dy*P sy*N+dy*Q sy*O+dy*R | + | 0 0 1 | | P Q R | | P Q R |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postScale_sx"> <code><strong>sx </strong></code> </a></td> <td> +horizontal scale factor</td> + </tr> <tr> <td><a name="SkMatrix_postScale_sy"> <code><strong>sy </strong></code> </a></td> <td> +vertical scale factor</td> + </tr> <tr> <td><a name="SkMatrix_postScale_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_postScale_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="ed3aa18ba0ea95c85cc49aa3829fe384"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preScale">preScale</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_MakeScale">MakeScale</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void postScale(SkScalar sx, SkScalar sy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> constructed from scaling by (<a href="#SkMatrix_postScale_2_sx">sx</a>, <a href="#SkMatrix_postScale_2_sy">sy</a>) about pivot point +(0, 0), multiplied by <a href="#Matrix">Matrix</a>. +This can be thought of as scaling about the origin after applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | sx 0 0 | +Matrix = | M N O |, S(sx, sy) = | 0 sy 0 | + | P Q R | | 0 0 1 |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | sx 0 0 | | J K L | | sx*J sx*K sx*L | +S(sx, sy) * Matrix = | 0 sy 0 | | M N O | = | sy*M sy*N sy*O | + | 0 0 1 | | P Q R | | P Q R |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postScale_2_sx"> <code><strong>sx </strong></code> </a></td> <td> +horizontal scale factor</td> + </tr> <tr> <td><a name="SkMatrix_postScale_2_sy"> <code><strong>sy </strong></code> </a></td> <td> +vertical scale factor</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1931017698766a67d3a26423453b8095"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preScale">preScale</a> <a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_MakeScale">MakeScale</a> + +--- + +<a name="SkMatrix_postIDiv"></a> +## postIDiv + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool postIDiv(int divx, int divy) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> constructed from scaling by(1/<a href="#SkMatrix_postIDiv_divx">divx</a>, 1/<a href="#SkMatrix_postIDiv_divy">divy</a>)about pivot point (px, py), multiplied by <a href="#Matrix">Matrix</a>. + +Returns false if either <a href="#SkMatrix_postIDiv_divx">divx</a> or <a href="#SkMatrix_postIDiv_divy">divy</a> is zero. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | sx 0 0 | +Matrix = | M N O |, I(divx, divy) = | 0 sy 0 | + | P Q R | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sx = 1 / divx +sy = 1 / divy</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | sx 0 0 | | J K L | | sx*J sx*K sx*L | +I(divx, divy) * Matrix = | 0 sy 0 | | M N O | = | sy*M sy*N sy*O | + | 0 0 1 | | P Q R | | P Q R |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postIDiv_divx"> <code><strong>divx </strong></code> </a></td> <td> +integer divisor for inverse scale in x</td> + </tr> <tr> <td><a name="SkMatrix_postIDiv_divy"> <code><strong>divy </strong></code> </a></td> <td> +integer divisor for inverse scale in y</td> + </tr> +</table> + +### Return Value + +true on successful scale + +### Example + +<div><fiddle-embed name="58c844b8f0c36acdbc8211e8c929c253"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_postScale">postScale</a> <a href="#SkMatrix_MakeScale">MakeScale</a> + +--- + +<a name="SkMatrix_postRotate"></a> +## postRotate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void postRotate(SkScalar degrees, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> constructed from rotating by <a href="#SkMatrix_postRotate_degrees">degrees</a> about pivot point +(<a href="#SkMatrix_postRotate_px">px</a>, <a href="#SkMatrix_postRotate_py">py</a>), multiplied by <a href="#Matrix">Matrix</a>. +This can be thought of as rotating about a pivot point after applying <a href="#Matrix">Matrix</a>. + +Positive <a href="#SkMatrix_postRotate_degrees">degrees</a> rotates clockwise. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | c -s dx | +Matrix = | M N O |, R(degrees, px, py) = | s c dy | + | P Q R | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +c = cos(degrees) +s = sin(degrees) +dx = s * py + (1 - c) * px +dy = -s * px + (1 - c) * py</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |c -s dx| |J K L| |cJ-sM+dx*P cK-sN+dx*Q cL-sO+dx+R| +R(degrees, px, py) * Matrix = |s c dy| |M N O| = |sJ+cM+dy*P sK+cN+dy*Q sL+cO+dy*R| + |0 0 1| |P Q R| | P Q R|</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postRotate_degrees"> <code><strong>degrees </strong></code> </a></td> <td> +angle of axes relative to upright axes</td> + </tr> <tr> <td><a name="SkMatrix_postRotate_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_postRotate_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="e09194ee48a81e7b375ade473d340f0d"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preRotate">preRotate</a> <a href="#SkMatrix_setRotate">setRotate</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void postRotate(SkScalar degrees) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> constructed from rotating by <a href="#SkMatrix_postRotate_2_degrees">degrees</a> about pivot point +(0, 0), multiplied by <a href="#Matrix">Matrix</a>. +This can be thought of as rotating about the origin after applying <a href="#Matrix">Matrix</a>. + +Positive <a href="#SkMatrix_postRotate_2_degrees">degrees</a> rotates clockwise. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | c -s 0 | +Matrix = | M N O |, R(degrees, px, py) = | s c 0 | + | P Q R | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +c = cos(degrees) +s = sin(degrees)</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | c -s dx | | J K L | | cJ-sM cK-sN cL-sO | +R(degrees, px, py) * Matrix = | s c dy | | M N O | = | sJ+cM sK+cN sL+cO | + | 0 0 1 | | P Q R | | P Q R |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postRotate_2_degrees"> <code><strong>degrees </strong></code> </a></td> <td> +angle of axes relative to upright axes</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="52e4c53e26971af5576b30de60fa70c2"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preRotate">preRotate</a> <a href="#SkMatrix_setRotate">setRotate</a> + +--- + +<a name="SkMatrix_postSkew"></a> +## postSkew + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void postSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> constructed from skewing by (<a href="#SkMatrix_postSkew_kx">kx</a>, <a href="#SkMatrix_postSkew_ky">ky</a>) about pivot point +(<a href="#SkMatrix_postSkew_px">px</a>, <a href="#SkMatrix_postSkew_py">py</a>), multiplied by <a href="#Matrix">Matrix</a>. +This can be thought of as skewing about a pivot point after applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | 1 kx dx | +Matrix = | M N O |, K(kx, ky, px, py) = | ky 1 dy | + | P Q R | | 0 0 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +dx = -kx * py +dy = -ky * px</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | 1 kx dx| |J K L| |J+kx*M+dx*P K+kx*N+dx*Q L+kx*O+dx+R| +K(kx, ky, px, py) * Matrix = |ky 1 dy| |M N O| = |ky*J+M+dy*P ky*K+N+dy*Q ky*L+O+dy*R| + | 0 0 1| |P Q R| | P Q R|</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postSkew_kx"> <code><strong>kx </strong></code> </a></td> <td> +horizontal skew factor</td> + </tr> <tr> <td><a name="SkMatrix_postSkew_ky"> <code><strong>ky </strong></code> </a></td> <td> +vertical skew factor</td> + </tr> <tr> <td><a name="SkMatrix_postSkew_px"> <code><strong>px </strong></code> </a></td> <td> +pivot x</td> + </tr> <tr> <td><a name="SkMatrix_postSkew_py"> <code><strong>py </strong></code> </a></td> <td> +pivot y</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="8c34ae3a2b7e2742bb969819737365ec"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preSkew">preSkew</a> <a href="#SkMatrix_setSkew">setSkew</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void postSkew(SkScalar kx, SkScalar ky) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> constructed from skewing by (<a href="#SkMatrix_postSkew_2_kx">kx</a>, <a href="#SkMatrix_postSkew_2_ky">ky</a>) about pivot point +(0, 0), multiplied by <a href="#Matrix">Matrix</a>. +This can be thought of as skewing about the origin after applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | 1 kx 0 | +Matrix = | M N O |, K(kx, ky) = | ky 1 0 | + | P Q R | | 0 0 1 |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | 1 kx 0 | | J K L | | J+kx*M K+kx*N L+kx*O | +K(kx, ky) * Matrix = | ky 1 0 | | M N O | = | ky*J+M ky*K+N ky*L+O | + | 0 0 1 | | P Q R | | P Q R |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postSkew_2_kx"> <code><strong>kx </strong></code> </a></td> <td> +horizontal skew factor</td> + </tr> <tr> <td><a name="SkMatrix_postSkew_2_ky"> <code><strong>ky </strong></code> </a></td> <td> +vertical skew factor</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3aa2603225dff72ac53dd359f897f494"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preSkew">preSkew</a> <a href="#SkMatrix_setSkew">setSkew</a> + +--- + +<a name="SkMatrix_postConcat"></a> +## postConcat + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void postConcat(const SkMatrix& other) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#Matrix">Matrix</a> <a href="#SkMatrix_postConcat_other">other</a> multiplied by <a href="#Matrix">Matrix</a>. +This can be thought of mapping by <a href="#SkMatrix_postConcat_other">other</a> after applying <a href="#Matrix">Matrix</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | J K L | | A B C | +Matrix = | M N O |, other = | D E F | + | P Q R | | G H I |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | +other * Matrix = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | + | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_postConcat_other"> <code><strong>other </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> on left side of multiply expression</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0a4214289249c77f48d59227c4ac4d9e"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preConcat">preConcat</a> <a href="#SkMatrix_setConcat">setConcat</a> <a href="#SkMatrix_Concat">Concat</a> + +--- + +## <a name="SkMatrix_ScaleToFit"></a> Enum SkMatrix::ScaleToFit + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +enum <a href="#SkMatrix_ScaleToFit">ScaleToFit</a> { +<a href="#SkMatrix_kFill_ScaleToFit">kFill ScaleToFit</a>, +<a href="#SkMatrix_kStart_ScaleToFit">kStart ScaleToFit</a>, +<a href="#SkMatrix_kCenter_ScaleToFit">kCenter ScaleToFit</a>, +<a href="#SkMatrix_kEnd_ScaleToFit">kEnd ScaleToFit</a>, +};</pre> + +<a href="#SkMatrix_ScaleToFit">ScaleToFit</a> describes how <a href="#Matrix">Matrix</a> is constructed to map one <a href="SkRect_Reference#Rect">Rect</a> to another. +<a href="#SkMatrix_ScaleToFit">ScaleToFit</a> may allow <a href="#Matrix">Matrix</a> to have unequal horizontal and vertical scaling, +or may restrict <a href="#Matrix">Matrix</a> to square scaling. If restricted, <a href="#SkMatrix_ScaleToFit">ScaleToFit</a> specifies +how <a href="#Matrix">Matrix</a> maps to the side or center of the destination <a href="SkRect_Reference#Rect">Rect</a>. + +### Constants + +<table> + <tr> + <td><a name="SkMatrix_kFill_ScaleToFit"> <code><strong>SkMatrix::kFill_ScaleToFit </strong></code> </a></td><td>0</td><td>Computes <a href="#Matrix">Matrix</a> that scales in x and y independently, so that source <a href="SkRect_Reference#Rect">Rect</a> is +mapped to completely fill destination <a href="SkRect_Reference#Rect">Rect</a>. The aspect ratio of source <a href="SkRect_Reference#Rect">Rect</a> +may change.</td> + </tr> + <tr> + <td><a name="SkMatrix_kStart_ScaleToFit"> <code><strong>SkMatrix::kStart_ScaleToFit </strong></code> </a></td><td>1</td><td>Computes <a href="#Matrix">Matrix</a> that maintains source <a href="SkRect_Reference#Rect">Rect</a> aspect ratio, mapping source <a href="SkRect_Reference#Rect">Rect</a> +width or height to destination <a href="SkRect_Reference#Rect">Rect</a>. Aligns mapping to left and top edges +of destination <a href="SkRect_Reference#Rect">Rect</a>.</td> + </tr> + <tr> + <td><a name="SkMatrix_kCenter_ScaleToFit"> <code><strong>SkMatrix::kCenter_ScaleToFit </strong></code> </a></td><td>2</td><td>Computes <a href="#Matrix">Matrix</a> that maintains source <a href="SkRect_Reference#Rect">Rect</a> aspect ratio, mapping source <a href="SkRect_Reference#Rect">Rect</a> +width or height to destination <a href="SkRect_Reference#Rect">Rect</a>. Aligns mapping to center of destination +<a href="SkRect_Reference#Rect">Rect</a>.</td> + </tr> + <tr> + <td><a name="SkMatrix_kEnd_ScaleToFit"> <code><strong>SkMatrix::kEnd_ScaleToFit </strong></code> </a></td><td>3</td><td>Computes <a href="#Matrix">Matrix</a> that maintains source <a href="SkRect_Reference#Rect">Rect</a> aspect ratio, mapping source <a href="SkRect_Reference#Rect">Rect</a> +width or height to destination <a href="SkRect_Reference#Rect">Rect</a>. Aligns mapping to right and bottom +edges of destination <a href="SkRect_Reference#Rect">Rect</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="17c3070b31b700ea8f52e48af9a66b6e"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setRectToRect">setRectToRect</a> <a href="#SkMatrix_MakeRectToRect">MakeRectToRect</a> <a href="#SkMatrix_setPolyToPoly">setPolyToPoly</a> + + + +<a name="SkMatrix_setRectToRect"></a> +## setRectToRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool setRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf) +</pre> + +Sets <a href="#Matrix">Matrix</a> to scale and translate <a href="#SkMatrix_setRectToRect_src">src</a> <a href="SkRect_Reference#Rect">Rect</a> to <a href="#SkMatrix_setRectToRect_dst">dst</a> <a href="SkRect_Reference#Rect">Rect</a>. <a href="#SkMatrix_setRectToRect_stf">stf</a> selects whether +mapping completely fills <a href="#SkMatrix_setRectToRect_dst">dst</a> or preserves the aspect ratio, and how to align +<a href="#SkMatrix_setRectToRect_src">src</a> within <a href="#SkMatrix_setRectToRect_dst">dst</a>. Returns false if <a href="#SkMatrix_setRectToRect_src">src</a> is empty, and sets <a href="#Matrix">Matrix</a> to identity. +Returns true if <a href="#SkMatrix_setRectToRect_dst">dst</a> is empty, and sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 0 0 0 | +| 0 0 0 | +| 0 0 1 |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setRectToRect_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="SkRect_Reference#Rect">Rect</a> to map from</td> + </tr> <tr> <td><a name="SkMatrix_setRectToRect_dst"> <code><strong>dst </strong></code> </a></td> <td> +<a href="SkRect_Reference#Rect">Rect</a> to map to</td> + </tr> <tr> <td><a name="SkMatrix_setRectToRect_stf"> <code><strong>stf </strong></code> </a></td> <td> +one of: <a href="#SkMatrix_kFill_ScaleToFit">kFill ScaleToFit</a>, <a href="#SkMatrix_kStart_ScaleToFit">kStart ScaleToFit</a>, +<a href="#SkMatrix_kCenter_ScaleToFit">kCenter ScaleToFit</a>, <a href="#SkMatrix_kEnd_ScaleToFit">kEnd ScaleToFit</a></td> + </tr> +</table> + +### Return Value + +true if <a href="#Matrix">Matrix</a> can represent <a href="SkRect_Reference#Rect">Rect</a> mapping + +### Example + +<div><fiddle-embed name="69cdea599dcaaec35efcb24403f4287b"> + +#### Example Output + +~~~~ +src: 0, 0, 0, 0 dst: 0, 0, 0, 0 success: false +[ 1.0000 0.0000 0.0000][ 0.0000 1.0000 0.0000][ 0.0000 0.0000 1.0000] +src: 0, 0, 0, 0 dst: 5, 6, 8, 9 success: false +[ 1.0000 0.0000 0.0000][ 0.0000 1.0000 0.0000][ 0.0000 0.0000 1.0000] +src: 1, 2, 3, 4 dst: 0, 0, 0, 0 success: true +[ 0.0000 0.0000 0.0000][ 0.0000 0.0000 0.0000][ 0.0000 0.0000 1.0000] +src: 1, 2, 3, 4 dst: 5, 6, 8, 9 success: true +[ 1.5000 0.0000 3.5000][ 0.0000 1.5000 3.0000][ 0.0000 0.0000 1.0000] +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_MakeRectToRect">MakeRectToRect</a> <a href="#SkMatrix_ScaleToFit">ScaleToFit</a> <a href="#SkMatrix_setPolyToPoly">setPolyToPoly</a> <a href="#SkRect_isEmpty">SkRect::isEmpty</a> + +--- + +<a name="SkMatrix_MakeRectToRect"></a> +## MakeRectToRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static SkMatrix MakeRectToRect(const SkRect& src, const SkRect& dst, + ScaleToFit stf) +</pre> + +Returns <a href="#Matrix">Matrix</a> <a href="#SkMatrix_set">set</a> to scale and translate <a href="#SkMatrix_MakeRectToRect_src">src</a> <a href="SkRect_Reference#Rect">Rect</a> to <a href="#SkMatrix_MakeRectToRect_dst">dst</a> <a href="SkRect_Reference#Rect">Rect</a>. <a href="#SkMatrix_MakeRectToRect_stf">stf</a> selects +whether mapping completely fills <a href="#SkMatrix_MakeRectToRect_dst">dst</a> or preserves the aspect ratio, and how to +align <a href="#SkMatrix_MakeRectToRect_src">src</a> within <a href="#SkMatrix_MakeRectToRect_dst">dst</a>. Returns the identity <a href="#Matrix">Matrix</a> if <a href="#SkMatrix_MakeRectToRect_src">src</a> is empty. If <a href="#SkMatrix_MakeRectToRect_dst">dst</a> is +empty, returns <a href="#Matrix">Matrix</a> <a href="#SkMatrix_set">set</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 0 0 0 | +| 0 0 0 | +| 0 0 1 |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_MakeRectToRect_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="SkRect_Reference#Rect">Rect</a> to map from</td> + </tr> <tr> <td><a name="SkMatrix_MakeRectToRect_dst"> <code><strong>dst </strong></code> </a></td> <td> +<a href="SkRect_Reference#Rect">Rect</a> to map to</td> + </tr> <tr> <td><a name="SkMatrix_MakeRectToRect_stf"> <code><strong>stf </strong></code> </a></td> <td> +one of: <a href="#SkMatrix_kFill_ScaleToFit">kFill ScaleToFit</a>, <a href="#SkMatrix_kStart_ScaleToFit">kStart ScaleToFit</a>, +<a href="#SkMatrix_kCenter_ScaleToFit">kCenter ScaleToFit</a>, <a href="#SkMatrix_kEnd_ScaleToFit">kEnd ScaleToFit</a></td> + </tr> +</table> + +### Return Value + +<a href="#Matrix">Matrix</a> mapping <a href="#SkMatrix_MakeRectToRect_src">src</a> to <a href="#SkMatrix_MakeRectToRect_dst">dst</a> + +### Example + +<div><fiddle-embed name="a1d6a6721b39350f81021f71a1b93208"> + +#### Example Output + +~~~~ +src: 0, 0, 0, 0 dst: 0, 0, 0, 0 +[ 1.0000 0.0000 0.0000][ 0.0000 1.0000 0.0000][ 0.0000 0.0000 1.0000] +src: 0, 0, 0, 0 dst: 5, 6, 8, 9 +[ 1.0000 0.0000 0.0000][ 0.0000 1.0000 0.0000][ 0.0000 0.0000 1.0000] +src: 1, 2, 3, 4 dst: 0, 0, 0, 0 +[ 0.0000 0.0000 0.0000][ 0.0000 0.0000 0.0000][ 0.0000 0.0000 1.0000] +src: 1, 2, 3, 4 dst: 5, 6, 8, 9 +[ 1.5000 0.0000 3.5000][ 0.0000 1.5000 3.0000][ 0.0000 0.0000 1.0000] +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setRectToRect">setRectToRect</a> <a href="#SkMatrix_ScaleToFit">ScaleToFit</a> <a href="#SkMatrix_setPolyToPoly">setPolyToPoly</a> <a href="#SkRect_isEmpty">SkRect::isEmpty</a> + +--- + +<a name="SkMatrix_setPolyToPoly"></a> +## setPolyToPoly + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count) +</pre> + +Sets <a href="#Matrix">Matrix</a> to map <a href="#SkMatrix_setPolyToPoly_src">src</a> to <a href="#SkMatrix_setPolyToPoly_dst">dst</a>. <a href="#SkMatrix_setPolyToPoly_count">count</a> must be zero or greater, and four or less. + +If <a href="#SkMatrix_setPolyToPoly_count">count</a> is zero, sets <a href="#Matrix">Matrix</a> to identity and returns true. +If <a href="#SkMatrix_setPolyToPoly_count">count</a> is one, sets <a href="#Matrix">Matrix</a> to translate and returns true. +If <a href="#SkMatrix_setPolyToPoly_count">count</a> is two or more, sets <a href="#Matrix">Matrix</a> to map <a href="#Point">Points</a> if possible; returns false +if <a href="#Matrix">Matrix</a> cannot be constructed. If <a href="#SkMatrix_setPolyToPoly_count">count</a> is four, <a href="#Matrix">Matrix</a> may include +perspective. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setPolyToPoly_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="#Point">Points</a> to map from</td> + </tr> <tr> <td><a name="SkMatrix_setPolyToPoly_dst"> <code><strong>dst </strong></code> </a></td> <td> +<a href="#Point">Points</a> to map to</td> + </tr> <tr> <td><a name="SkMatrix_setPolyToPoly_count"> <code><strong>count </strong></code> </a></td> <td> +number of <a href="#Point">Points</a> in <a href="#SkMatrix_setPolyToPoly_src">src</a> and <a href="#SkMatrix_setPolyToPoly_dst">dst</a></td> + </tr> +</table> + +### Return Value + +true if <a href="#Matrix">Matrix</a> was constructed successfully + +### Example + +<div><fiddle-embed name="c851d1313e8909aaea4f0591699fdb7b"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setRectToRect">setRectToRect</a> <a href="#SkMatrix_MakeRectToRect">MakeRectToRect</a> + +--- + +<a name="SkMatrix_invert"></a> +## invert + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool SK_WARN_UNUSED_RESULT invert(SkMatrix* inverse) const +</pre> + +Sets <a href="#SkMatrix_invert_inverse">inverse</a> to reciprocal matrix, returning true if <a href="#Matrix">Matrix</a> can be inverted. +Geometrically, if <a href="#Matrix">Matrix</a> maps from source to destination, <a href="#SkMatrix_invert_inverse">inverse</a> <a href="#Matrix">Matrix</a> +maps from destination to source. If <a href="#Matrix">Matrix</a> can not be inverted, <a href="#SkMatrix_invert_inverse">inverse</a> is +unchanged. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_invert_inverse"> <code><strong>inverse </strong></code> </a></td> <td> +storage for inverted <a href="#Matrix">Matrix</a>; may be nullptr</td> + </tr> +</table> + +### Return Value + +true if <a href="#Matrix">Matrix</a> can be inverted + +### Example + +<div><fiddle-embed name="10a10c5bf2ac7ec88e84204441fc83b6"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_Concat">Concat</a> + +--- + +<a name="SkMatrix_SetAffineIdentity"></a> +## SetAffineIdentity + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static void SetAffineIdentity(SkScalar affine[6]) +</pre> + +Fills <a href="#SkMatrix_SetAffineIdentity_affine">affine</a> with identity values in column major order. +Sets <a href="#SkMatrix_SetAffineIdentity_affine">affine</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 1 0 0 | +| 0 1 0 |</pre> + +Affine 3x2 matrices in column major order are used by <a href="undocumented#OpenGL">OpenGL</a> and <a href="undocumented#XPS">XPS</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_SetAffineIdentity_affine"> <code><strong>affine </strong></code> </a></td> <td> +storage for 3x2 <a href="#SkMatrix_SetAffineIdentity_affine">affine</a> matrix</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="e10adbd0bcc940c5d4d872db0e78e892"> + +#### Example Output + +~~~~ +ScaleX: 1 SkewY: 0 SkewX: 0 ScaleY: 1 TransX: 0 TransY: 0 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setAffine">setAffine</a> <a href="#SkMatrix_asAffine">asAffine</a> + +--- + +<a name="SkMatrix_asAffine"></a> +## asAffine + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool SK_WARN_UNUSED_RESULT asAffine(SkScalar affine[6]) const +</pre> + +Fills <a href="#SkMatrix_asAffine_affine">affine</a> in column major order. Sets <a href="#SkMatrix_asAffine_affine">affine</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| scale-x skew-x translate-x | +| skew-y scale-y translate-y |</pre> + +If <a href="#Matrix">Matrix</a> contains perspective, returns false and leaves <a href="#SkMatrix_asAffine_affine">affine</a> unchanged. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_asAffine_affine"> <code><strong>affine </strong></code> </a></td> <td> +storage for 3x2 <a href="#SkMatrix_asAffine_affine">affine</a> matrix; may be nullptr</td> + </tr> +</table> + +### Return Value + +true if <a href="#Matrix">Matrix</a> does not contain perspective + +### Example + +<div><fiddle-embed name="752e4a48ed1dae05765a2499c390f277"> + +#### Example Output + +~~~~ +ScaleX: 2 SkewY: 5 SkewX: 3 ScaleY: 6 TransX: 4 TransY: 7 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setAffine">setAffine</a> <a href="#SkMatrix_SetAffineIdentity">SetAffineIdentity</a> + +--- + +<a name="SkMatrix_setAffine"></a> +## setAffine + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setAffine(const SkScalar affine[6]) +</pre> + +Sets <a href="#Matrix">Matrix</a> to <a href="#SkMatrix_setAffine_affine">affine</a> values, passed in column major order. Given <a href="#SkMatrix_setAffine_affine">affine</a>, +column, then row, as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| scale-x skew-x translate-x | +| skew-y scale-y translate-y |</pre> + +<a href="#Matrix">Matrix</a> is <a href="#SkMatrix_set">set</a>, row, then column, to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| scale-x skew-x translate-x | +| skew-y scale-y translate-y | +| 0 0 1 |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setAffine_affine"> <code><strong>affine </strong></code> </a></td> <td> +3x2 <a href="#SkMatrix_setAffine_affine">affine</a> matrix</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="403370bd53526f59020a7141955d70b0"> + +#### Example Output + +~~~~ +ScaleX: 2 SkewY: 5 SkewX: 3 ScaleY: 6 TransX: 4 TransY: 7 +[ 2.0000 3.0000 4.0000][ 5.0000 6.0000 7.0000][ 0.0000 0.0000 1.0000] +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_asAffine">asAffine</a> <a href="#SkMatrix_SetAffineIdentity">SetAffineIdentity</a> + +--- + +<a name="SkMatrix_mapPoints"></a> +## mapPoints + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapPoints(SkPoint dst[], const SkPoint src[], int count) const +</pre> + +Maps <a href="#SkMatrix_mapPoints_src">src</a> <a href="undocumented#Point">Point</a> array of length <a href="#SkMatrix_mapPoints_count">count</a> to <a href="#SkMatrix_mapPoints_dst">dst</a> <a href="undocumented#Point">Point</a> array of equal or greater +length. <a href="#Point">Points</a> are mapped by multiplying each <a href="undocumented#Point">Point</a> by <a href="#Matrix">Matrix</a>. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | x | +Matrix = | D E F |, pt = | y | + | G H I | | 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +for (i = 0; i < count; ++i) { + x = src[i].fX + y = src[i].fY +}</pre> + +each <a href="#SkMatrix_mapPoints_dst">dst</a> <a href="undocumented#Point">Point</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B C| |x| Ax+By+C Dx+Ey+F +Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +<a href="#SkMatrix_mapPoints_src">src</a> and <a href="#SkMatrix_mapPoints_dst">dst</a> may point to the same storage. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapPoints_dst"> <code><strong>dst </strong></code> </a></td> <td> +storage for mapped <a href="#Point">Points</a></td> + </tr> <tr> <td><a name="SkMatrix_mapPoints_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="#Point">Points</a> to transform</td> + </tr> <tr> <td><a name="SkMatrix_mapPoints_count"> <code><strong>count </strong></code> </a></td> <td> +number of <a href="#Point">Points</a> to transform</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="f99dcb00296d0c56b6c0e178e94b3534"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapXY">mapXY</a> <a href="#SkMatrix_mapHomogeneousPoints">mapHomogeneousPoints</a> <a href="#SkMatrix_mapVectors">mapVectors</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapPoints(SkPoint pts[], int count) const +</pre> + +Maps <a href="#SkMatrix_mapPoints_2_pts">pts</a> <a href="undocumented#Point">Point</a> array of length <a href="#SkMatrix_mapPoints_2_count">count</a> in place. <a href="#Point">Points</a> are mapped by multiplying +each <a href="undocumented#Point">Point</a> by <a href="#Matrix">Matrix</a>. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | x | +Matrix = | D E F |, pt = | y | + | G H I | | 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +for (i = 0; i < count; ++i) { + x = pts[i].fX + y = pts[i].fY +}</pre> + +each resulting <a href="#SkMatrix_mapPoints_2_pts">pts</a> <a href="undocumented#Point">Point</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B C| |x| Ax+By+C Dx+Ey+F +Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapPoints_2_pts"> <code><strong>pts </strong></code> </a></td> <td> +storage for mapped <a href="#Point">Points</a></td> + </tr> <tr> <td><a name="SkMatrix_mapPoints_2_count"> <code><strong>count </strong></code> </a></td> <td> +number of <a href="#Point">Points</a> to transform</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="428ca171ae3bd0d3f992458ac598b97b"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapXY">mapXY</a> <a href="#SkMatrix_mapHomogeneousPoints">mapHomogeneousPoints</a> <a href="#SkMatrix_mapVectors">mapVectors</a> + +--- + +<a name="SkMatrix_mapPointsWithStride"></a> +## mapPointsWithStride + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapPointsWithStride(SkPoint pts[], size_t stride, int count) const +</pre> + +Maps <a href="#SkMatrix_mapPointsWithStride_count">count</a> <a href="#SkMatrix_mapPointsWithStride_pts">pts</a>, skipping <a href="#SkMatrix_mapPointsWithStride_stride">stride</a> bytes to advance from one <a href="undocumented#Point">Point</a> to the next. +<a href="#Point">Points</a> are mapped by multiplying each <a href="undocumented#Point">Point</a> by <a href="#Matrix">Matrix</a>. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | x | +Matrix = | D E F |, pt = | y | + | G H I | | 1 |</pre> + +each resulting <a href="#SkMatrix_mapPointsWithStride_pts">pts</a> <a href="undocumented#Point">Point</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B C| |x| Ax+By+C Dx+Ey+F +Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapPointsWithStride_pts"> <code><strong>pts </strong></code> </a></td> <td> +storage for mapped <a href="#Point">Points</a></td> + </tr> <tr> <td><a name="SkMatrix_mapPointsWithStride_stride"> <code><strong>stride </strong></code> </a></td> <td> +size of record starting with <a href="undocumented#Point">Point</a>, in bytes</td> + </tr> <tr> <td><a name="SkMatrix_mapPointsWithStride_count"> <code><strong>count </strong></code> </a></td> <td> +number of <a href="#Point">Points</a> to transform</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="02c50c7bb5d5dd1fe7e54b0d3bf64c2a"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapXY">mapXY</a> <a href="#SkMatrix_mapHomogeneousPoints">mapHomogeneousPoints</a> <a href="#SkMatrix_mapVectors">mapVectors</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapPointsWithStride(SkPoint dst[], const SkPoint src[], size_t stride, + int count) const +</pre> + +Maps <a href="#SkMatrix_mapPointsWithStride_2_src">src</a> <a href="undocumented#Point">Point</a> array of length <a href="#SkMatrix_mapPointsWithStride_2_count">count</a> to <a href="#SkMatrix_mapPointsWithStride_2_dst">dst</a> <a href="undocumented#Point">Point</a> array, skipping <a href="#SkMatrix_mapPointsWithStride_2_stride">stride</a> bytes +to advance from one <a href="undocumented#Point">Point</a> to the next. +<a href="#Point">Points</a> are mapped by multiplying each <a href="undocumented#Point">Point</a> by <a href="#Matrix">Matrix</a>. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | x | +Matrix = | D E F |, src = | y | + | G H I | | 1 |</pre> + +each resulting <a href="#SkMatrix_mapPointsWithStride_2_dst">dst</a> <a href="undocumented#Point">Point</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B C| |x| Ax+By+C Dx+Ey+F +Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapPointsWithStride_2_dst"> <code><strong>dst </strong></code> </a></td> <td> +storage for mapped <a href="#Point">Points</a></td> + </tr> <tr> <td><a name="SkMatrix_mapPointsWithStride_2_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="#Point">Points</a> to transform</td> + </tr> <tr> <td><a name="SkMatrix_mapPointsWithStride_2_stride"> <code><strong>stride </strong></code> </a></td> <td> +size of record starting with <a href="undocumented#Point">Point</a>, in bytes</td> + </tr> <tr> <td><a name="SkMatrix_mapPointsWithStride_2_count"> <code><strong>count </strong></code> </a></td> <td> +number of <a href="#Point">Points</a> to transform</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="08e32de52131e6859db16729b2e56e4e"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapXY">mapXY</a> <a href="#SkMatrix_mapHomogeneousPoints">mapHomogeneousPoints</a> <a href="#SkMatrix_mapVectors">mapVectors</a> + +--- + +<a name="SkMatrix_mapHomogeneousPoints"></a> +## mapHomogeneousPoints + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const +</pre> + +Maps <a href="#SkMatrix_mapHomogeneousPoints_src">src</a> <a href="undocumented#Point3">Point3</a> array of length <a href="#SkMatrix_mapHomogeneousPoints_count">count</a> to <a href="#SkMatrix_mapHomogeneousPoints_dst">dst</a> <a href="undocumented#Point3">Point3</a> array, which must of length <a href="#SkMatrix_mapHomogeneousPoints_count">count</a> or +greater. <a href="undocumented#Point3">Point3</a> array is mapped by multiplying each <a href="undocumented#Point3">Point3</a> by <a href="#Matrix">Matrix</a>. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | x | +Matrix = | D E F |, src = | y | + | G H I | | z |</pre> + +each resulting <a href="#SkMatrix_mapHomogeneousPoints_dst">dst</a> <a href="undocumented#Point">Point</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B C| |x| +Matrix * src = |D E F| |y| = |Ax+By+Cz Dx+Ey+Fz Gx+Hy+Iz| + |G H I| |z|</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapHomogeneousPoints_dst"> <code><strong>dst </strong></code> </a></td> <td> +storage for mapped <a href="undocumented#Point3">Point3</a> array</td> + </tr> <tr> <td><a name="SkMatrix_mapHomogeneousPoints_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="undocumented#Point3">Point3</a> array to transform</td> + </tr> <tr> <td><a name="SkMatrix_mapHomogeneousPoints_count"> <code><strong>count </strong></code> </a></td> <td> +items in <a href="undocumented#Point3">Point3</a> array to transform</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0d8c7aa7249048f2b83d32cf13f88560"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapXY">mapXY</a> <a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapVectors">mapVectors</a> + +--- + +<a name="SkMatrix_mapXY"></a> +## mapXY + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapXY(SkScalar x, SkScalar y, SkPoint* result) const +</pre> + +Maps <a href="undocumented#Point">Point</a> (<a href="#SkMatrix_mapXY_x">x</a>, <a href="#SkMatrix_mapXY_y">y</a>) to <a href="#SkMatrix_mapXY_result">result</a>. <a href="undocumented#Point">Point</a> is mapped by multiplying by <a href="#Matrix">Matrix</a>. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | x | +Matrix = | D E F |, pt = | y | + | G H I | | 1 |</pre> + +<a href="#SkMatrix_mapXY_result">result</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B C| |x| Ax+By+C Dx+Ey+F +Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapXY_x"> <code><strong>x </strong></code> </a></td> <td> +x-coordinate of <a href="undocumented#Point">Point</a> to map</td> + </tr> <tr> <td><a name="SkMatrix_mapXY_y"> <code><strong>y </strong></code> </a></td> <td> +y-coordinate of <a href="undocumented#Point">Point</a> to map</td> + </tr> <tr> <td><a name="SkMatrix_mapXY_result"> <code><strong>result </strong></code> </a></td> <td> +storage for mapped <a href="undocumented#Point">Point</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="9e50185d502dc6903783679a84106089"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapVectors">mapVectors</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPoint mapXY(SkScalar x, SkScalar y) const +</pre> + +Returns <a href="undocumented#Point">Point</a> (<a href="#SkMatrix_mapXY_2_x">x</a>, <a href="#SkMatrix_mapXY_2_y">y</a>) multiplied by <a href="#Matrix">Matrix</a>. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | x | +Matrix = | D E F |, pt = | y | + | G H I | | 1 |</pre> + +result is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B C| |x| Ax+By+C Dx+Ey+F +Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapXY_2_x"> <code><strong>x </strong></code> </a></td> <td> +x-coordinate of <a href="undocumented#Point">Point</a> to map</td> + </tr> <tr> <td><a name="SkMatrix_mapXY_2_y"> <code><strong>y </strong></code> </a></td> <td> +y-coordinate of <a href="undocumented#Point">Point</a> to map</td> + </tr> +</table> + +### Return Value + +mapped <a href="undocumented#Point">Point</a> + +### Example + +<div><fiddle-embed name="b1ead09c67a177ab8eace12b061610a7"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapVectors">mapVectors</a> + +--- + +<a name="SkMatrix_mapVectors"></a> +## mapVectors + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapVectors(SkVector dst[], const SkVector src[], int count) const +</pre> + +Maps <a href="#SkMatrix_mapVectors_src">src</a> <a href="undocumented#Vector">Vector</a> array of length <a href="#SkMatrix_mapVectors_count">count</a> to <a href="undocumented#Vector">Vector</a> <a href="undocumented#Point">Point</a> array of equal or greater +length. <a href="#Vector">Vectors</a> are mapped by multiplying each <a href="undocumented#Vector">Vector</a> by <a href="#Matrix">Matrix</a>, treating +<a href="#Matrix">Matrix</a> translation as zero. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B 0 | | x | +Matrix = | D E 0 |, src = | y | + | G H I | | 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +for (i = 0; i < count; ++i) { + x = src[i].fX + y = src[i].fY +}</pre> + +each <a href="#SkMatrix_mapVectors_dst">dst</a> <a href="undocumented#Vector">Vector</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B 0| |x| Ax+By Dx+Ey +Matrix * src = |D E 0| |y| = |Ax+By Dx+Ey Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +<a href="#SkMatrix_mapVectors_src">src</a> and <a href="#SkMatrix_mapVectors_dst">dst</a> may point to the same storage. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapVectors_dst"> <code><strong>dst </strong></code> </a></td> <td> +storage for mapped <a href="#Vector">Vectors</a></td> + </tr> <tr> <td><a name="SkMatrix_mapVectors_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="#Vector">Vectors</a> to transform</td> + </tr> <tr> <td><a name="SkMatrix_mapVectors_count"> <code><strong>count </strong></code> </a></td> <td> +number of <a href="#Vector">Vectors</a> to transform</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="918a9778c3d7d5cb306692784399f6dc"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapVector">mapVector</a> <a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapXY">mapXY</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapVectors(SkVector vecs[], int count) const +</pre> + +Maps <a href="#SkMatrix_mapVectors_2_vecs">vecs</a> <a href="undocumented#Vector">Vector</a> array of length <a href="#SkMatrix_mapVectors_2_count">count</a> in place, multiplying each <a href="undocumented#Vector">Vector</a> by +<a href="#Matrix">Matrix</a>, treating <a href="#Matrix">Matrix</a> translation as zero. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B 0 | | x | +Matrix = | D E 0 |, vec = | y | + | G H I | | 1 |</pre> + +where + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +for (i = 0; i < count; ++i) { + x = vecs[i].fX + y = vecs[i].fY +}</pre> + +each result <a href="undocumented#Vector">Vector</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B 0| |x| Ax+By Dx+Ey +Matrix * vec = |D E 0| |y| = |Ax+By Dx+Ey Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapVectors_2_vecs"> <code><strong>vecs </strong></code> </a></td> <td> +<a href="#Vector">Vectors</a> to transform, and storage for mapped <a href="#Vector">Vectors</a></td> + </tr> <tr> <td><a name="SkMatrix_mapVectors_2_count"> <code><strong>count </strong></code> </a></td> <td> +number of <a href="#Vector">Vectors</a> to transform</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="5754501a00a1323e76353fb53153e939"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapVector">mapVector</a> <a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapXY">mapXY</a> + +--- + +<a name="SkMatrix_mapVector"></a> +## mapVector + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapVector(SkScalar dx, SkScalar dy, SkVector* result) const +</pre> + +Maps <a href="undocumented#Vector">Vector</a> (x, y) to <a href="#SkMatrix_mapVector_result">result</a>. <a href="undocumented#Vector">Vector</a> is mapped by multiplying by <a href="#Matrix">Matrix</a>, +treating <a href="#Matrix">Matrix</a> translation as zero. Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B 0 | | dx | +Matrix = | D E 0 |, vec = | dy | + | G H I | | 1 |</pre> + +each <a href="#SkMatrix_mapVector_result">result</a> <a href="undocumented#Vector">Vector</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B 0| |dx| A*dx+B*dy D*dx+E*dy +Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = ----------- , ----------- + |G H I| | 1| G*dx+H*dy+I G*dx+*dHy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapVector_dx"> <code><strong>dx </strong></code> </a></td> <td> +x-coordinate of <a href="undocumented#Vector">Vector</a> to map</td> + </tr> <tr> <td><a name="SkMatrix_mapVector_dy"> <code><strong>dy </strong></code> </a></td> <td> +y-coordinate of <a href="undocumented#Vector">Vector</a> to map</td> + </tr> <tr> <td><a name="SkMatrix_mapVector_result"> <code><strong>result </strong></code> </a></td> <td> +storage for mapped <a href="undocumented#Vector">Vector</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="aed143fc6cd0bce4ed029b98d1e61f2d"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapVectors">mapVectors</a> <a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapXY">mapXY</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkVector mapVector(SkScalar dx, SkScalar dy) const +</pre> + +Returns <a href="undocumented#Vector">Vector</a> (x, y) multiplied by <a href="#Matrix">Matrix</a>, treating <a href="#Matrix">Matrix</a> translation as zero. +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B 0 | | dx | +Matrix = | D E 0 |, vec = | dy | + | G H I | | 1 |</pre> + +each result <a href="undocumented#Vector">Vector</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B 0| |dx| A*dx+B*dy D*dx+E*dy +Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = ----------- , ----------- + |G H I| | 1| G*dx+H*dy+I G*dx+*dHy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapVector_2_dx"> <code><strong>dx </strong></code> </a></td> <td> +x-coordinate of <a href="undocumented#Vector">Vector</a> to map</td> + </tr> <tr> <td><a name="SkMatrix_mapVector_2_dy"> <code><strong>dy </strong></code> </a></td> <td> +y-coordinate of <a href="undocumented#Vector">Vector</a> to map</td> + </tr> +</table> + +### Return Value + +mapped <a href="undocumented#Vector">Vector</a> + +### Example + +<div><fiddle-embed name="8bf1518db3f369696cd3065b541a8bd7"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapVectors">mapVectors</a> <a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_mapPointsWithStride">mapPointsWithStride</a> <a href="#SkMatrix_mapXY">mapXY</a> + +--- + +<a name="SkMatrix_mapRect"></a> +## mapRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool mapRect(SkRect* dst, const SkRect& src) const +</pre> + +Sets <a href="#SkMatrix_mapRect_dst">dst</a> to bounds of <a href="#SkMatrix_mapRect_src">src</a> corners mapped by <a href="#Matrix">Matrix</a>. +Returns true if mapped corners are <a href="#SkMatrix_mapRect_dst">dst</a> corners. + +Returned value is the same as calling <a href="#SkMatrix_rectStaysRect">rectStaysRect</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapRect_dst"> <code><strong>dst </strong></code> </a></td> <td> +storage for bounds of mapped <a href="#Point">Points</a></td> + </tr> <tr> <td><a name="SkMatrix_mapRect_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="SkRect_Reference#Rect">Rect</a> to map</td> + </tr> +</table> + +### Return Value + +true if <a href="#SkMatrix_mapRect_dst">dst</a> is equivalent to mapped <a href="#SkMatrix_mapRect_src">src</a> + +### Example + +<div><fiddle-embed name="dbcf928b035a31ca69c99392e2e2cca9"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_rectStaysRect">rectStaysRect</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool mapRect(SkRect* rect) const +</pre> + +Sets <a href="#SkMatrix_mapRect_2_rect">rect</a> to bounds of <a href="#SkMatrix_mapRect_2_rect">rect</a> corners mapped by <a href="#Matrix">Matrix</a>. +Returns true if mapped corners are computed <a href="#SkMatrix_mapRect_2_rect">rect</a> corners. + +Returned value is the same as calling <a href="#SkMatrix_rectStaysRect">rectStaysRect</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapRect_2_rect"> <code><strong>rect </strong></code> </a></td> <td> +rectangle to map, and storage for bounds of mapped corners</td> + </tr> +</table> + +### Return Value + +true if result is equivalent to mapped src + +### Example + +<div><fiddle-embed name="5fafd0bd23d1ed37425b970b4a3c6cc9"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapRectScaleTranslate">mapRectScaleTranslate</a> <a href="#SkMatrix_mapPoints">mapPoints</a> <a href="#SkMatrix_rectStaysRect">rectStaysRect</a> + +--- + +<a name="SkMatrix_mapRectToQuad"></a> +## mapRectToQuad + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapRectToQuad(SkPoint dst[4], const SkRect& rect) const +</pre> + +Maps four corners of <a href="#SkMatrix_mapRectToQuad_rect">rect</a> to <a href="#SkMatrix_mapRectToQuad_dst">dst</a>. <a href="#Point">Points</a> are mapped by multiplying each +<a href="#SkMatrix_mapRectToQuad_rect">rect</a> corner by <a href="#Matrix">Matrix</a>. <a href="#SkMatrix_mapRectToQuad_rect">rect</a> corner is processed in this order: +(<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fLeft, <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fTop), (<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fRight, <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fTop), (<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fRight, <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fBottom), +(<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fLeft, <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fBottom). + +<a href="#SkMatrix_mapRectToQuad_rect">rect</a> may be empty: <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fLeft may be greater than or equal to <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fRight; +<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fTop may be greater than or equal to <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fBottom. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | x | +Matrix = | D E F |, pt = | y | + | G H I | | 1 |</pre> + +where pt is initialized from each of (<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fLeft, <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fTop), +(<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fRight, <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fTop), (<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fRight, <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fBottom), (<a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fLeft, <a href="#SkMatrix_mapRectToQuad_rect">rect</a>.fBottom), +each <a href="#SkMatrix_mapRectToQuad_dst">dst</a> <a href="undocumented#Point">Point</a> is computed as: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + |A B C| |x| Ax+By+C Dx+Ey+F +Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- + |G H I| |1| Gx+Hy+I Gx+Hy+I</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapRectToQuad_dst"> <code><strong>dst </strong></code> </a></td> <td> +storage for mapped corner <a href="#Point">Points</a></td> + </tr> <tr> <td><a name="SkMatrix_mapRectToQuad_rect"> <code><strong>rect </strong></code> </a></td> <td> +<a href="SkRect_Reference#Rect">Rect</a> to map</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3bf9404624735d7cf34b47b9c7b27bcc"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapRect">mapRect</a> <a href="#SkMatrix_mapRectScaleTranslate">mapRectScaleTranslate</a> + +--- + +<a name="SkMatrix_mapRectScaleTranslate"></a> +## mapRectScaleTranslate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void mapRectScaleTranslate(SkRect* dst, const SkRect& src) const +</pre> + +Sets <a href="#SkMatrix_mapRectScaleTranslate_dst">dst</a> to bounds of <a href="#SkMatrix_mapRectScaleTranslate_src">src</a> corners mapped by <a href="#Matrix">Matrix</a>. If matrix contains +elements other than scale or translate: asserts if <a href="undocumented#SK_DEBUG">SK DEBUG</a> is defined; +otherwise, results are undefined. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapRectScaleTranslate_dst"> <code><strong>dst </strong></code> </a></td> <td> +storage for bounds of mapped <a href="#Point">Points</a></td> + </tr> <tr> <td><a name="SkMatrix_mapRectScaleTranslate_src"> <code><strong>src </strong></code> </a></td> <td> +<a href="SkRect_Reference#Rect">Rect</a> to map</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="62bc26989c2b4c2a54d516596a71dd97"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapRect">mapRect</a> <a href="#SkMatrix_mapRectToQuad">mapRectToQuad</a> <a href="#SkMatrix_isScaleTranslate">isScaleTranslate</a> <a href="#SkMatrix_rectStaysRect">rectStaysRect</a> + +--- + +<a name="SkMatrix_mapRadius"></a> +## mapRadius + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar mapRadius(SkScalar radius) const +</pre> + +Returns geometric mean <a href="#SkMatrix_mapRadius_radius">radius</a> of ellipse formed by constructing <a href="undocumented#Circle">Circle</a> of +size <a href="#SkMatrix_mapRadius_radius">radius</a>, and mapping constructed <a href="undocumented#Circle">Circle</a> with <a href="#Matrix">Matrix</a>. The result squared is +equal to the major axis length times the minor axis length. +Result is not meaningful if <a href="#Matrix">Matrix</a> contains perspective elements. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_mapRadius_radius"> <code><strong>radius </strong></code> </a></td> <td> +<a href="undocumented#Circle">Circle</a> size to map</td> + </tr> +</table> + +### Return Value + +average mapped <a href="#SkMatrix_mapRadius_radius">radius</a> + +### Example + +<div><fiddle-embed name="6d6f2082fcf59d9f02bfb1758b87db69"><div>The area enclosed by a square with sides equal to mappedRadius is the same as +the area enclosed by the ellipse major and minor axes.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_mapVector">mapVector</a> + +--- + +<a name="SkMatrix_isFixedStepInX"></a> +## isFixedStepInX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isFixedStepInX() const +</pre> + +Returns true if a unit step in x at some y mapped through <a href="#Matrix">Matrix</a> can be +represented by a constant <a href="undocumented#Vector">Vector</a>. Returns true if <a href="#SkMatrix_getType">getType</a> returns <a href="#SkMatrix_kIdentity_Mask">kIdentity Mask</a>, +or combinations of: <a href="#SkMatrix_kTranslate_Mask">kTranslate Mask</a>, <a href="#SkMatrix_kScale_Mask">kScale Mask</a>, and <a href="#SkMatrix_kAffine_Mask">kAffine Mask</a>. + +May return true if <a href="#SkMatrix_getType">getType</a> returns <a href="#SkMatrix_kPerspective_Mask">kPerspective Mask</a>, but only when <a href="#Matrix">Matrix</a> +does not include rotation or skewing along the y-axis. + +### Return Value + +true if <a href="#Matrix">Matrix</a> does not have complex perspective + +### Example + +<div><fiddle-embed name="ab57b232acef69f26de9cb23d23c8a1a"> + +#### Example Output + +~~~~ +[ 1.0000 0.0000 0.0000][ 0.0000 1.0000 0.0000][ 0.0000 0.0000 1.0000] +isFixedStepInX: true +[ 1.0000 0.0000 0.0000][ 0.0000 2.0000 0.0000][ 0.0000 0.0000 1.0000] +isFixedStepInX: true +[ 1.0000 0.0000 0.0000][ 0.0000 1.0000 0.0000][ 0.0000 0.1000 1.0000] +isFixedStepInX: true +[ 1.0000 0.0000 0.0000][ 0.0000 2.0000 0.0000][ 0.0000 0.1000 1.0000] +isFixedStepInX: true +[ 1.0000 0.0000 0.0000][ 0.0000 1.0000 0.0000][ 0.1000 0.0000 1.0000] +isFixedStepInX: false +[ 1.0000 0.0000 0.0000][ 0.0000 2.0000 0.0000][ 0.1000 0.0000 1.0000] +isFixedStepInX: false +[ 1.0000 0.0000 0.0000][ 0.0000 1.0000 0.0000][ 0.1000 0.1000 1.0000] +isFixedStepInX: false +[ 1.0000 0.0000 0.0000][ 0.0000 2.0000 0.0000][ 0.1000 0.1000 1.0000] +isFixedStepInX: false +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_fixedStepInX">fixedStepInX</a> <a href="#SkMatrix_getType">getType</a> + +--- + +<a name="SkMatrix_fixedStepInX"></a> +## fixedStepInX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkVector fixedStepInX(SkScalar y) const +</pre> + +Returns <a href="undocumented#Vector">Vector</a> representing a unit step in x at <a href="#SkMatrix_fixedStepInX_y">y</a> mapped through <a href="#Matrix">Matrix</a>. +If <a href="#SkMatrix_isFixedStepInX">isFixedStepInX</a> is false, returned value is undefined. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_fixedStepInX_y"> <code><strong>y </strong></code> </a></td> <td> +position of line parallel to x-axis</td> + </tr> +</table> + +### Return Value + +<a href="undocumented#Vector">Vector</a> advance of mapped unit step in x + +### Example + +<div><fiddle-embed name="fad6b92b21b1e1deeae61978cec2d232"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_isFixedStepInX">isFixedStepInX</a> <a href="#SkMatrix_getType">getType</a> + +--- + +<a name="SkMatrix_cheapEqualTo"></a> +## cheapEqualTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool cheapEqualTo(const SkMatrix& m) const +</pre> + +Returns true if <a href="#Matrix">Matrix</a> equals <a href="#SkMatrix_cheapEqualTo_m">m</a>, using an efficient comparison. + +Returns false when the sign of zero values is the different; when one +matrix has positive zero value and the other has negative zero value. + +Returns true even when both <a href="#Matrix">Matrices</a> contain <a href="undocumented#NaN">NaN</a>. + +<a href="undocumented#NaN">NaN</a> never equals any value, including itself. To improve performance, <a href="undocumented#NaN">NaN</a> values +are treated as bit patterns that are equal if their bit patterns are equal. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_cheapEqualTo_m"> <code><strong>m </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> to compare</td> + </tr> +</table> + +### Return Value + +true if <a href="#SkMatrix_cheapEqualTo_m">m</a> and <a href="#Matrix">Matrix</a> are represented by identical bit patterns + +### Example + +<div><fiddle-embed name="39016b3cfc6bbabb09348a53822ce508"> + +#### Example Output + +~~~~ +identity: a == b a.cheapEqualTo(b): true +neg zero: a == b a.cheapEqualTo(b): false +one NaN: a != b a.cheapEqualTo(b): false +both NaN: a != b a.cheapEqualTo(b): true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_equal_operator">operator==(const SkMatrix& a, const SkMatrix& b)</a> + +--- + +<a name="SkMatrix_equal_operator"></a> +## operator== + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool operator==(const SkMatrix& a, const SkMatrix& b) +</pre> + +Compares <a href="#SkMatrix_equal_operator_a">a</a> and <a href="#SkMatrix_equal_operator_b">b</a>; returns true if <a href="#SkMatrix_equal_operator_a">a</a> and <a href="#SkMatrix_equal_operator_b">b</a> are numerically equal. Returns true +even if sign of zero values are different. Returns false if either <a href="#Matrix">Matrix</a> +contains <a href="undocumented#NaN">NaN</a>, even if the other <a href="#Matrix">Matrix</a> also contains <a href="undocumented#NaN">NaN</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_equal_operator_a"> <code><strong>a </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> to compare</td> + </tr> <tr> <td><a name="SkMatrix_equal_operator_b"> <code><strong>b </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> to compare</td> + </tr> +</table> + +### Return Value + +true if m and <a href="#Matrix">Matrix</a> are numerically equal + +### Example + +<div><fiddle-embed name="3902859150b0f0c4aeb1f25d00434baa"> + +#### Example Output + +~~~~ +identity: a == b a.cheapEqualTo(b): true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_cheapEqualTo">cheapEqualTo</a> <a href="#SkMatrix_not_equal_operator">operator!=(const SkMatrix& a, const SkMatrix& b)</a> + +--- + +<a name="SkMatrix_not_equal_operator"></a> +## operator!= + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool operator!=(const SkMatrix& a, const SkMatrix& b) +</pre> + +Compares <a href="#SkMatrix_not_equal_operator_a">a</a> and <a href="#SkMatrix_not_equal_operator_b">b</a>; returns true if <a href="#SkMatrix_not_equal_operator_a">a</a> and <a href="#SkMatrix_not_equal_operator_b">b</a> are not numerically equal. Returns false +even if sign of zero values are different. Returns true if either <a href="#Matrix">Matrix</a> +contains <a href="undocumented#NaN">NaN</a>, even if the other <a href="#Matrix">Matrix</a> also contains <a href="undocumented#NaN">NaN</a>. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_not_equal_operator_a"> <code><strong>a </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> to compare</td> + </tr> <tr> <td><a name="SkMatrix_not_equal_operator_b"> <code><strong>b </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> to compare</td> + </tr> +</table> + +### Return Value + +true if m and <a href="#Matrix">Matrix</a> are numerically not equal + +### Example + +<div><fiddle-embed name="8a8fadf5fd294daa4ee152833cc0dc0e"></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_cheapEqualTo">cheapEqualTo</a> <a href="#SkMatrix_equal_operator">operator==(const SkMatrix& a, const SkMatrix& b)</a> + +--- + +<a name="SkMatrix_dump"></a> +## dump + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dump() const +</pre> + +Writes text representation of <a href="#Matrix">Matrix</a> to standard output. Floating point values +are written with limited precision; it may not be possible to reconstruct +original <a href="#Matrix">Matrix</a> from output. + +### Example + +<div><fiddle-embed name="8d72a4818e5a9188348f6c08ab5d8a40"> + +#### Example Output + +~~~~ +[ 0.7071 -0.7071 0.0000][ 0.7071 0.7071 0.0000][ 0.0000 0.0000 1.0000] +[ 0.7071 -0.7071 0.0000][ 0.7071 0.7071 0.0000][ 0.0000 0.0000 1.0000] +matrix != nearlyEqual +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_toString">toString</a> + +--- + +<a name="SkMatrix_toString"></a> +## toString + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void toString(SkString* str) const +</pre> + +Creates string representation of <a href="#Matrix">Matrix</a>. Floating point values +are written with limited precision; it may not be possible to reconstruct +original <a href="#Matrix">Matrix</a> from output. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_toString_str"> <code><strong>str </strong></code> </a></td> <td> +storage for string representation of <a href="#Matrix">Matrix</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1d86e43958e42b8eaaa9b16df1baa4c8"> + +#### Example Output + +~~~~ +mStr [ 0.7071 -0.7071 0.0000][ 0.7071 0.7071 0.0000][ 0.0000 0.0000 1.0000] +neStr [ 0.7071 -0.7071 0.0000][ 0.7071 0.7071 0.0000][ 0.0000 0.0000 1.0000] +matrix != nearlyEqual +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_dump">dump</a> + +--- + +<a name="SkMatrix_getMinScale"></a> +## getMinScale + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getMinScale() const +</pre> + +Returns the minimum scaling factor of <a href="#Matrix">Matrix</a> by decomposing the scaling and +skewing elements. +Returns -1 if scale factor overflows or <a href="#Matrix">Matrix</a> contains perspective. + +### Return Value + +minimum scale factor + +### Example + +<div><fiddle-embed name="1d6f67904c88a806c3731879e9af4ae5"> + +#### Example Output + +~~~~ +matrix.getMinScale() 24 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_getMaxScale">getMaxScale</a> <a href="#SkMatrix_getMinMaxScales">getMinMaxScales</a> + +--- + +<a name="SkMatrix_getMaxScale"></a> +## getMaxScale + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getMaxScale() const +</pre> + +Returns the maximum scaling factor of <a href="#Matrix">Matrix</a> by decomposing the scaling and +skewing elements. +Returns -1 if scale factor overflows or <a href="#Matrix">Matrix</a> contains perspective. + +### Return Value + +maximum scale factor + +### Example + +<div><fiddle-embed name="3fee4364929899649cf9efc37897e964"> + +#### Example Output + +~~~~ +matrix.getMaxScale() 42 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_getMinScale">getMinScale</a> <a href="#SkMatrix_getMinMaxScales">getMinMaxScales</a> + +--- + +<a name="SkMatrix_getMinMaxScales"></a> +## getMinMaxScales + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool SK_WARN_UNUSED_RESULT getMinMaxScales(SkScalar scaleFactors[2]) const +</pre> + +Sets <a href="#SkMatrix_getMinMaxScales_scaleFactors">scaleFactors</a>[0] to the minimum scaling factor, and <a href="#SkMatrix_getMinMaxScales_scaleFactors">scaleFactors</a>[1] to the +maximum scaling factor. Scaling factors are computed by decomposing +the <a href="#Matrix">Matrix</a> scaling and skewing elements. + +Returns true if <a href="#SkMatrix_getMinMaxScales_scaleFactors">scaleFactors</a> are found; otherwise, returns false and sets +<a href="#SkMatrix_getMinMaxScales_scaleFactors">scaleFactors</a> to undefined values. + +### Parameters + +<table> <tr> <td><a name="SkMatrix_getMinMaxScales_scaleFactors"> <code><strong>scaleFactors </strong></code> </a></td> <td> +storage for minimum and maximum scale factors</td> + </tr> +</table> + +### Return Value + +true if scale factors were computed correctly + +### Example + +<div><fiddle-embed name="cd4dc63d3e04226f0b5861ba8925e223"> + +#### Example Output + +~~~~ +matrix.getMinMaxScales() false 2 2 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_getMinScale">getMinScale</a> <a href="#SkMatrix_getMaxScale">getMaxScale</a> + +--- + +<a name="SkMatrix_decomposeScale"></a> +## decomposeScale + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool decomposeScale(SkSize* scale, SkMatrix* remaining = nullptr) const +</pre> + +Decomposes <a href="#Matrix">Matrix</a> into <a href="#SkMatrix_decomposeScale_scale">scale</a> components and whatever remains. Returns false if +<a href="#Matrix">Matrix</a> could not be decomposed. + +Sets <a href="#SkMatrix_decomposeScale_scale">scale</a> to portion of <a href="#Matrix">Matrix</a> that scales in x and y. Sets <a href="#SkMatrix_decomposeScale_remaining">remaining</a> to <a href="#Matrix">Matrix</a> +with x and y scaling factored out. <a href="#SkMatrix_decomposeScale_remaining">remaining</a> may be passed as nullptr +to determine if <a href="#Matrix">Matrix</a> can be decomposed without computing remainder. + +Returns true if <a href="#SkMatrix_decomposeScale_scale">scale</a> components are found. <a href="#SkMatrix_decomposeScale_scale">scale</a> and <a href="#SkMatrix_decomposeScale_remaining">remaining</a> are +unchanged if <a href="#Matrix">Matrix</a> contains perspective; <a href="#SkMatrix_decomposeScale_scale">scale</a> factors are not finite, or +are nearly zero. + +On success<a href="#Matrix">Matrix</a> = <a href="#SkMatrix_decomposeScale_scale">scale</a> * Remaining + +### Parameters + +<table> <tr> <td><a name="SkMatrix_decomposeScale_scale"> <code><strong>scale </strong></code> </a></td> <td> +x and y scaling factors; may be nullptr</td> + </tr> <tr> <td><a name="SkMatrix_decomposeScale_remaining"> <code><strong>remaining </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> without scaling; may be nullptr</td> + </tr> +</table> + +### Return Value + +true if <a href="#SkMatrix_decomposeScale_scale">scale</a> can be computed + +### Example + +<div><fiddle-embed name="139b874da0a3ede1f3df88119085c0aa"> + +#### Example Output + +~~~~ +[ 0.0000 -0.2500 0.0000][ 0.5000 0.0000 0.0000][ 0.0000 0.0000 1.0000] +success: true scale: 0.5, 0.25 +[ 0.0000 -0.5000 0.0000][ 2.0000 0.0000 0.0000][ 0.0000 0.0000 1.0000] +[ 0.0000 -0.2500 0.0000][ 0.5000 0.0000 0.0000][ 0.0000 0.0000 1.0000] +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_MakeScale">MakeScale</a> + +--- + +<a name="SkMatrix_I"></a> +## I + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static const SkMatrix& I() +</pre> + +Returns reference to const identity <a href="#Matrix">Matrix</a>. Returned <a href="#Matrix">Matrix</a> is <a href="#SkMatrix_set">set</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| 1 0 0 | +| 0 1 0 | +| 0 0 1 |</pre> + +### Return Value + +const identity <a href="#Matrix">Matrix</a> + +### Example + +<div><fiddle-embed name="d961d91020f19037204a8c3fd8cb1060"> + +#### Example Output + +~~~~ +m1 == m2 +m2 == m3 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_reset">reset</a> <a href="#SkMatrix_setIdentity">setIdentity</a> + +--- + +<a name="SkMatrix_InvalidMatrix"></a> +## InvalidMatrix + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static const SkMatrix& InvalidMatrix() +</pre> + +Returns reference to a const <a href="#Matrix">Matrix</a> with invalid values. Returned <a href="#Matrix">Matrix</a> is <a href="#SkMatrix_set">set</a> +to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| SK_ScalarMax SK_ScalarMax SK_ScalarMax | +| SK_ScalarMax SK_ScalarMax SK_ScalarMax | +| SK_ScalarMax SK_ScalarMax SK_ScalarMax |</pre> + +### Return Value + +const invalid <a href="#Matrix">Matrix</a> + +### Example + +<div><fiddle-embed name="af0b72360c1c7a25b4754bfa47011dd5"> + +#### Example Output + +~~~~ +scaleX 3.40282e+38 +~~~~ + +</fiddle-embed></div> + +### See Also + +SeeAlso <a href="#SkMatrix_getType">getType</a> + +--- + +<a name="SkMatrix_Concat"></a> +## Concat + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static SkMatrix Concat(const SkMatrix& a, const SkMatrix& b) +</pre> + +Returns <a href="#Matrix">Matrix</a> <a href="#SkMatrix_Concat_a">a</a> multiplied by <a href="#Matrix">Matrix</a> <a href="#SkMatrix_Concat_b">b</a>. + +Given: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | J K L | +a = | D E F |, b = | M N O | + | G H I | | P Q R |</pre> + +sets <a href="#Matrix">Matrix</a> to: + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> + | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | +a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | + | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_Concat_a"> <code><strong>a </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> on left side of multiply expression</td> + </tr> <tr> <td><a name="SkMatrix_Concat_b"> <code><strong>b </strong></code> </a></td> <td> +<a href="#Matrix">Matrix</a> on right side of multiply expression</td> + </tr> +</table> + +### Return Value + +<a href="#Matrix">Matrix</a> computed from <a href="#SkMatrix_Concat_a">a</a> times <a href="#SkMatrix_Concat_b">b</a> + +### Example + +<div><fiddle-embed name="6b4562c7052da94f3d5b2412dca41946"><div><a href="#SkMatrix_setPolyToPoly">setPolyToPoly</a> creates perspective matrices, one the inverse of the other. +Multiplying the matrix by its inverse turns into an identity matrix.</div></fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_preConcat">preConcat</a> <a href="#SkMatrix_postConcat">postConcat</a> + +--- + +<a name="SkMatrix_dirtyMatrixTypeCache"></a> +## dirtyMatrixTypeCache + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dirtyMatrixTypeCache() +</pre> + +Sets internal cache to unknown state. Use to force update after repeated +modifications to <a href="#Matrix">Matrix</a> element reference returned by <a href="#SkMatrix_subscript_operator_const">operator[](int index)</a>. + +### Example + +<div><fiddle-embed name="f4365ef332f51f7fd25040e0771ba9a2"> + +#### Example Output + +~~~~ +with identity matrix: x = 24 +after skew x mod: x = 24 +after 2nd skew x mod: x = 24 +after dirty cache: x = 66 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_subscript_operator_const">operator[](int index)</a> <a href="#SkMatrix_getType">getType</a> + +--- + +<a name="SkMatrix_setScaleTranslate"></a> +## setScaleTranslate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty) +</pre> + +Initializes <a href="#Matrix">Matrix</a> with scale and translate elements. + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +| sx 0 tx | +| 0 sy ty | +| 0 0 1 |</pre> + +### Parameters + +<table> <tr> <td><a name="SkMatrix_setScaleTranslate_sx"> <code><strong>sx </strong></code> </a></td> <td> +horizontal scale factor to store</td> + </tr> <tr> <td><a name="SkMatrix_setScaleTranslate_sy"> <code><strong>sy </strong></code> </a></td> <td> +vertical scale factor to store</td> + </tr> <tr> <td><a name="SkMatrix_setScaleTranslate_tx"> <code><strong>tx </strong></code> </a></td> <td> +horizontal translation to store</td> + </tr> <tr> <td><a name="SkMatrix_setScaleTranslate_ty"> <code><strong>ty </strong></code> </a></td> <td> +vertical translation to store</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="fed43797f13796529cb6731385d6f8f3"> + +#### Example Output + +~~~~ +[ 1.0000 0.0000 3.0000][ 0.0000 2.0000 4.0000][ 0.0000 0.0000 1.0000] +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="#SkMatrix_setScale">setScale</a> <a href="#SkMatrix_preTranslate">preTranslate</a> <a href="#SkMatrix_postTranslate">postTranslate</a> + +--- + +<a name="SkMatrix_isFinite"></a> +## isFinite + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isFinite() const +</pre> + +Returns true if all elements of the matrix are finite. Returns false if any +element is infinity, or <a href="undocumented#NaN">NaN</a>. + +### Return Value + +true if matrix has only finite elements + +### Example + +<div><fiddle-embed name="bc6c6f6a5df770287120d87f81b922eb"> + +#### Example Output + +~~~~ +[ 1.0000 0.0000 nan][ 0.0000 1.0000 0.0000][ 0.0000 0.0000 1.0000] +matrix is finite: false +matrix != matrix +~~~~ + +</fiddle-embed></div> + +### See Also + +operator== + +--- + diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md index e539b3a628..ffab03e288 100644 --- a/site/user/api/SkPaint_Reference.md +++ b/site/user/api/SkPaint_Reference.md @@ -653,7 +653,7 @@ serialized data describing <a href="#Paint">Paint</a> content</td> ## <a name="SkPaint_Hinting"></a> Enum SkPaint::Hinting -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#Hinting">Hinting</a> { <a href="#SkPaint_kNo_Hinting">kNo Hinting</a> = 0, <a href="#SkPaint_kSlight_Hinting">kSlight Hinting</a> = 1, @@ -776,7 +776,7 @@ paint1 == paint2 ## <a name="SkPaint_Flags"></a> Enum SkPaint::Flags -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#Flags">Flags</a> { <a href="#SkPaint_kAntiAlias_Flag">kAntiAlias Flag</a> = 0x01, <a href="#SkPaint_kDither_Flag">kDither Flag</a> = 0x04, @@ -845,7 +845,7 @@ multiple settings at once. ## <a name="SkPaint_ReserveFlags"></a> Enum SkPaint::ReserveFlags -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPaint_ReserveFlags">ReserveFlags</a> { <a href="#SkPaint_kUnderlineText_ReserveFlag">kUnderlineText ReserveFlag</a> = 0x08, <a href="#SkPaint_kStrikeThruText_ReserveFlag">kStrikeThruText ReserveFlag</a> = 0x10, @@ -1356,7 +1356,7 @@ the outline glyph if <a href="#SkPaint_kEmbeddedBitmapText_Flag">kEmbeddedBitmap ### Example -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> <div>The "" <a href="undocumented#TrueType">TrueType</a> font in the <a href="undocumented#Skia">Skia</a> resources/fonts directory includes an embedded bitmap <a href="undocumented#Glyph">Glyph</a> at odd font sizes. This example works on platforms that use <a href="undocumented#FreeType">FreeType</a> as their <a href="#Engine">Font Engine</a>. @@ -2066,7 +2066,7 @@ while stroking. ## <a name="SkPaint_Style"></a> Enum SkPaint::Style -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPaint_Style">Style</a> { <a href="#SkPaint_kFill_Style">kFill Style</a>, <a href="#SkPaint_kStroke_Style">kStroke Style</a>, @@ -2110,7 +2110,7 @@ and the set <a href="#Fill_Type">Path Fill Type</a> is ignored.</td> ## <a name="SkPaint__anonymous"></a> Enum SkPaint::_anonymous -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum { <a href="#SkPaint_kStyleCount">kStyleCount</a> = <a href="#SkPaint_kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1, };</pre> @@ -2375,7 +2375,7 @@ default miter limit == 8 ## <a name="SkPaint_Cap"></a> Enum SkPaint::Cap -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPaint_Cap">Cap</a> { <a href="#SkPaint_kButt_Cap">kButt Cap</a>, <a href="#SkPaint_kRound_Cap">kRound Cap</a>, @@ -2520,7 +2520,7 @@ the following curve, the pair of curves meet at <a href="#Stroke_Join">Stroke Jo ## <a name="SkPaint_Join"></a> Enum SkPaint::Join -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPaint_Join">Join</a> { <a href="#SkPaint_kMiter_Join">kMiter Join</a>, <a href="#SkPaint_kRound_Join">kRound Join</a>, @@ -3663,7 +3663,7 @@ sets <a href="undocumented#Draw_Looper">Draw Looper</a> to <a href="#SkPaint_set ## <a name="SkPaint_Align"></a> Enum SkPaint::Align -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPaint_Align">Align</a> { <a href="#SkPaint_kLeft_Align">kLeft Align</a>, <a href="#SkPaint_kCenter_Align">kCenter Align</a>, @@ -3706,7 +3706,7 @@ and by its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kV ## <a name="SkPaint__anonymous_2"></a> Enum SkPaint::_anonymous_2 -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum { <a href="#SkPaint_kAlignCount">kAlignCount</a> = 3, };</pre> @@ -3944,7 +3944,7 @@ additional shear in x-axis relative to y-axis</td> ## <a name="SkPaint_TextEncoding"></a> Enum SkPaint::TextEncoding -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPaint_TextEncoding">TextEncoding</a> { <a href="#SkPaint_kUTF8_TextEncoding">kUTF8 TextEncoding</a>, <a href="#SkPaint_kUTF16_TextEncoding">kUTF16 TextEncoding</a>, @@ -4075,16 +4075,8 @@ Y-axis values above the baseline are negative, and below the baseline are positi <div><fiddle-embed name="b5b76e0a15da0c3530071186a9006498"></fiddle-embed></div> # <a name="SkPaint_FontMetrics"></a> Struct SkPaint::FontMetrics -<a href="#SkPaint_FontMetrics">FontMetrics</a> is filled out by <a href="#SkPaint_getFontMetrics">getFontMetrics</a>. <a href="#SkPaint_FontMetrics">FontMetrics</a> contents reflect the values -computed by <a href="undocumented#Font_Manager">Font Manager</a> using <a href="undocumented#Typeface">Typeface</a>. Values are set to zero if they are -not available. - -<a href="#SkPaint_FontMetrics_fUnderlineThickness">fUnderlineThickness</a> and <a href="#SkPaint_FontMetrics_fUnderlinePosition">fUnderlinePosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values -are valid, since their value may be zero. -<a href="#SkPaint_FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> and <a href="#SkPaint_FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values -are valid, since their value may be zero. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> struct <a href="#SkPaint_FontMetrics">FontMetrics</a> { enum <a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> { <a href="#SkPaint_FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> = 1 << 0, @@ -4116,13 +4108,18 @@ bool <a href="#SkPaint_FontMetrics_hasStrikeoutThickness">hasStrikeoutThickness( bool <a href="#SkPaint_FontMetrics_hasStrikeoutPosition">hasStrikeoutPosition(SkScalar* position)</a> const; };</pre> -## <a name="SkPaint_FontMetrics_FontMetricsFlags"></a> Enum SkPaint::FontMetrics::FontMetricsFlags +<a href="#SkPaint_FontMetrics">FontMetrics</a> is filled out by <a href="#SkPaint_getFontMetrics">getFontMetrics</a>. <a href="#SkPaint_FontMetrics">FontMetrics</a> contents reflect the values +computed by <a href="undocumented#Font_Manager">Font Manager</a> using <a href="undocumented#Typeface">Typeface</a>. Values are set to zero if they are +not available. -<a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> are set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> when underline and strikeout metrics are valid; -the underline or strikeout metric may be valid and zero. -Fonts with embedded bitmaps may not have valid underline or strikeout metrics. +<a href="#SkPaint_FontMetrics_fUnderlineThickness">fUnderlineThickness</a> and <a href="#SkPaint_FontMetrics_fUnderlinePosition">fUnderlinePosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values +are valid, since their value may be zero. +<a href="#SkPaint_FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> and <a href="#SkPaint_FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values +are valid, since their value may be zero. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +## <a name="SkPaint_FontMetrics_FontMetricsFlags"></a> Enum SkPaint::FontMetrics::FontMetricsFlags + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> { <a href="#SkPaint_FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> = 1 << 0, <a href="#SkPaint_FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> = 1 << 1, @@ -4130,6 +4127,10 @@ enum <a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> { <a href="#SkPaint_FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> = 1 << 3, };</pre> +<a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> are set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> when underline and strikeout metrics are valid; +the underline or strikeout metric may be valid and zero. +Fonts with embedded bitmaps may not have valid underline or strikeout metrics. + ### Constants <table> diff --git a/site/user/api/SkPath_Reference.md b/site/user/api/SkPath_Reference.md index bb3634e373..154b66b27d 100644 --- a/site/user/api/SkPath_Reference.md +++ b/site/user/api/SkPath_Reference.md @@ -216,7 +216,7 @@ Internally, <a href="#Path">Path</a> lazily computes metrics likes bounds and co ## <a name="SkPath_Verb"></a> Enum SkPath::Verb -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#Verb">Verb</a> { <a href="#SkPath_kMove_Verb">kMove Verb</a>, <a href="#SkPath_kLine_Verb">kLine Verb</a>, @@ -298,7 +298,7 @@ verbs: kMove_Verb kLine_Verb kQuad_Verb kClose_Verb kMove_Verb kCubic_Verb kConi ## <a name="SkPath_Direction"></a> Enum SkPath::Direction -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#Direction">Direction</a> { <a href="#SkPath_kCW_Direction">kCW Direction</a>, <a href="#SkPath_kCCW_Direction">kCCW Direction</a>, @@ -320,10 +320,10 @@ travel counterclockwise. <table> <tr> - <td><a name="SkPath_kCW_Direction"> <code><strong>SkPath::kCW_Direction </strong></code> </a></td><td>0</td><td><a href="#Contour">Contour</a> travels in a clockwise direction.</td> + <td><a name="SkPath_kCW_Direction"> <code><strong>SkPath::kCW_Direction </strong></code> </a></td><td>0</td><td><a href="#Contour">Contour</a> travels in a clockwise direction</td> </tr> <tr> - <td><a name="SkPath_kCCW_Direction"> <code><strong>SkPath::kCCW_Direction </strong></code> </a></td><td>1</td><td><a href="#Contour">Contour</a> travels in a counterclockwise direction.</td> + <td><a name="SkPath_kCCW_Direction"> <code><strong>SkPath::kCCW_Direction </strong></code> </a></td><td>1</td><td><a href="#Contour">Contour</a> travels in a counterclockwise direction</td> </tr> </table> @@ -617,7 +617,9 @@ Interpolate between <a href="#Path">Paths</a> with equal sized <a href="SkPath_R 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>) + ending->points * (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 +(this->points * <a href="#SkPath_interpolate_weight">weight</a>) + ending->points * (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 range. @@ -668,7 +670,7 @@ true if <a href="#Path">Path</a> has one owner ## <a name="SkPath_FillType"></a> Enum SkPath::FillType -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPath_FillType">FillType</a> { <a href="#SkPath_kWinding_FillType">kWinding FillType</a>, <a href="#SkPath_kEvenOdd_FillType">kEvenOdd FillType</a>, @@ -842,7 +844,7 @@ unmodified by the original <a href="#SkPath_FillType">FillType</a>. ## <a name="SkPath_Convexity"></a> Enum SkPath::Convexity -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#Convexity">Convexity</a> : uint8_t { <a href="#SkPath_kUnknown_Convexity">kUnknown Convexity</a>, <a href="#SkPath_kConvex_Convexity">kConvex Convexity</a>, @@ -2805,7 +2807,7 @@ line (156,20),(200,20) ## <a name="SkPath_ArcSize"></a> Enum SkPath::ArcSize -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPath_ArcSize">ArcSize</a> { <a href="#SkPath_kSmall_ArcSize">kSmall ArcSize</a>, <a href="#SkPath_kLarge_ArcSize">kLarge ArcSize</a>, @@ -2818,10 +2820,10 @@ Four <a href="undocumented#Oval">Oval</a> parts with radii (rx, ry) start at las <table> <tr> - <td><a name="SkPath_kSmall_ArcSize"> <code><strong>SkPath::kSmall_ArcSize </strong></code> </a></td><td>0</td><td>Smaller of <a href="#Arc">Arc</a> pair.</td> + <td><a name="SkPath_kSmall_ArcSize"> <code><strong>SkPath::kSmall_ArcSize </strong></code> </a></td><td>0</td><td>smaller of <a href="#Arc">Arc</a> pair</td> </tr> <tr> - <td><a name="SkPath_kLarge_ArcSize"> <code><strong>SkPath::kLarge_ArcSize </strong></code> </a></td><td>1</td><td>Larger of <a href="#Arc">Arc</a> pair.</td> + <td><a name="SkPath_kLarge_ArcSize"> <code><strong>SkPath::kLarge_ArcSize </strong></code> </a></td><td>1</td><td>larger of <a href="#Arc">Arc</a> pair</td> </tr> </table> @@ -2840,18 +2842,20 @@ void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep, SkScalar x, SkScalar y) </pre> -Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>. <a href="#Arc">Arc</a> is implemented by one or more <a href="#Conic">Conics</a> weighted to describe part of <a href="undocumented#Oval">Oval</a> -with radii (<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) rotated by <a href="#SkPath_arcTo_4_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>), -choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger. +Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>. <a href="#Arc">Arc</a> is implemented by one or more <a href="#Conic">Conics</a> weighted to +describe part of <a href="undocumented#Oval">Oval</a> with radii (<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) rotated by <a href="#SkPath_arcTo_4_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> +curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>), choosing one of four possible routes: +clockwise or counterclockwise, and smaller or larger. -<a href="#Arc">Arc</a> <a href="#SkPath_arcTo_4_sweep">sweep</a> is always less than 360 degrees. <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if either radii are zero, -or if last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> equals (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>). <a href="#SkPath_arcTo">arcTo</a> scales radii (<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) to fit last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> and -(<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if both are greater than zero but too small. +<a href="#Arc">Arc</a> <a href="#SkPath_arcTo_4_sweep">sweep</a> is always less than 360 degrees. <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if +either radii are zero, or if last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> equals (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>). <a href="#SkPath_arcTo">arcTo</a> scales radii +(<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) to fit last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> and (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if both are greater than zero but +too small. <a href="#SkPath_arcTo">arcTo</a> appends up to four <a href="#Conic">Conic</a> curves. -<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> "" value is -opposite the integer value of <a href="#SkPath_arcTo_4_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> "" uses 1 for clockwise, while <a href="#SkPath_kCW_Direction">kCW Direction</a> -cast to int is zero. +<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> "" value +is opposite the integer value of <a href="#SkPath_arcTo_4_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> "" uses 1 for clockwise, +while <a href="#SkPath_kCW_Direction">kCW Direction</a> cast to int is zero. ### Parameters @@ -2936,7 +2940,9 @@ void rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>, relative to last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a>. <a href="#Arc">Arc</a> is implemented by one or more <a href="#Conic">Conic</a>, weighted to describe part of <a href="undocumented#Oval">Oval</a> with radii (<a href="#SkPath_rArcTo_rx">rx</a>, <a href="#SkPath_rArcTo_ry">ry</a>) rotated by -<a href="#SkPath_rArcTo_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> (x0, y0) to end <a href="undocumented#Point">Point</a>(x0 + <a href="#SkPath_rArcTo_dx">dx</a>, y0 + <a href="#SkPath_rArcTo_dy">dy</a>), +<a href="#SkPath_rArcTo_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> (x0, y0) to end <a href="undocumented#Point">Point</a>: + +(x0 + <a href="#SkPath_rArcTo_dx">dx</a>, y0 + <a href="#SkPath_rArcTo_dy">dy</a>), choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger. If <a href="#Path">Path</a> is empty, the start <a href="#Arc">Arc</a> <a href="undocumented#Point">Point</a> is (0, 0). @@ -3118,7 +3124,9 @@ control <a href="undocumented#Point">Point</a> <a href="#SkPath_ConvertConicToQu Maximum <a href="#Quad">Quad</a> count is 2 to the <a href="#SkPath_ConvertConicToQuads_pow2">pow2</a>. Every third point in array shares last <a href="undocumented#Point">Point</a> of previous <a href="#Quad">Quad</a> and first <a href="undocumented#Point">Point</a> of next <a href="#Quad">Quad</a>. Maximum <a href="#SkPath_ConvertConicToQuads_pts">pts</a> storage size is given by: -(1 + 2 * (1 << <a href="#SkPath_ConvertConicToQuads_pow2">pow2</a>)) * sizeof(SkPoint)<a href="#SkPath_ConvertConicToQuads">ConvertConicToQuads</a> returns <a href="#Quad">Quad</a> count used the approximation, which may be smaller +(1 + 2 * (1 << <a href="#SkPath_ConvertConicToQuads_pow2">pow2</a>)) * sizeof(SkPoint). + +Returns <a href="#Quad">Quad</a> count used the approximation, which may be smaller than the number requested. <a href="#Conic_Weight">Conic Weight</a> determines the amount of influence <a href="#Conic">Conic</a> control point has on the curve. <a href="#SkPath_ConvertConicToQuads_w">w</a> less than one represents an elliptical section. <a href="#SkPath_ConvertConicToQuads_w">w</a> greater than one represents @@ -3446,9 +3454,10 @@ void addCircle(SkScalar x, SkScalar y, SkScalar radius, </pre> Add <a href="undocumented#Circle">Circle</a> centered at (<a href="#SkPath_addCircle_x">x</a>, <a href="#SkPath_addCircle_y">y</a>) of size <a href="#SkPath_addCircle_radius">radius</a> to <a href="#Path">Path</a>, appending <a href="#SkPath_kMove_Verb">kMove Verb</a>, -four <a href="#SkPath_kConic_Verb">kConic Verb</a>, and <a href="#SkPath_kClose_Verb">kClose Verb</a>. <a href="undocumented#Circle">Circle</a> begins at(<a href="#SkPath_addCircle_x">x</a> + <a href="#SkPath_addCircle_radius">radius</a>, <a href="#SkPath_addCircle_y">y</a>), -continuing clockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCW_Direction">kCW Direction</a>, and counterclockwise if <a href="#SkPath_addCircle_dir">dir</a> is -<a href="#SkPath_kCCW_Direction">kCCW Direction</a>. +four <a href="#SkPath_kConic_Verb">kConic Verb</a>, and <a href="#SkPath_kClose_Verb">kClose Verb</a>. <a href="undocumented#Circle">Circle</a> begins at: +(<a href="#SkPath_addCircle_x">x</a> + <a href="#SkPath_addCircle_radius">radius</a>, <a href="#SkPath_addCircle_y">y</a>), +continuing +clockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCW_Direction">kCW Direction</a>, and counterclockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCCW_Direction">kCCW Direction</a>. Has no effect if <a href="#SkPath_addCircle_radius">radius</a> is zero or negative. @@ -3725,7 +3734,7 @@ true to add <a href="undocumented#Line">Line</a> connecting <a href="#Contour">C ## <a name="SkPath_AddPathMode"></a> Enum SkPath::AddPathMode -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPath_AddPathMode">AddPathMode</a> { <a href="#SkPath_kAppend_AddPathMode">kAppend AddPathMode</a>, <a href="#SkPath_kExtend_AddPathMode">kExtend AddPathMode</a>, @@ -4096,7 +4105,7 @@ set value of <a href="#Last_Point">Last Point</a></td> ## <a name="SkPath_SegmentMask"></a> Enum SkPath::SegmentMask -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> enum <a href="#SkPath_SegmentMask">SegmentMask</a> { <a href="#SkPath_kLine_SegmentMask">kLine SegmentMask</a> = 1 << 0, <a href="#SkPath_kQuad_SegmentMask">kQuad SegmentMask</a> = 1 << 1, @@ -4225,9 +4234,9 @@ true if <a href="undocumented#Point">Point</a> is in <a href="#Path">Path</a> void dump(SkWStream* stream, bool forceClose, bool dumpAsHex) const </pre> -Writes text representation of <a href="#Path">Path</a> to <a href="#SkPath_dump_stream">stream</a>. If <a href="#SkPath_dump_stream">stream</a> is nullptr, <a href="#SkPath_dump_2">dump</a> writes to -standard output. Set <a href="#SkPath_dump_forceClose">forceClose</a> to true to get -edges used to fill <a href="#Path">Path</a>. Set <a href="#SkPath_dump_dumpAsHex">dumpAsHex</a> true to generate exact binary representations +Writes text representation of <a href="#Path">Path</a> to <a href="#SkPath_dump_stream">stream</a>. If <a href="#SkPath_dump_stream">stream</a> is nullptr, writes to +standard output. Set <a href="#SkPath_dump_forceClose">forceClose</a> to true to get edges used to fill <a href="#Path">Path</a>. +Set <a href="#SkPath_dump_dumpAsHex">dumpAsHex</a> true to generate exact binary representations of floating point numbers used in <a href="#Point_Array">Point Array</a> and <a href="#Weight">Conic Weights</a>. ### Parameters @@ -4554,7 +4563,7 @@ Iterates through <a href="#Verb_Array">Verb Array</a>, and associated <a href="# Provides options to treat open <a href="#Contour">Contours</a> as closed, and to ignore degenerate data. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> class <a href="#SkPath_Iter_Iter">Iter</a> { public: <a href="#SkPath_Iter_Iter">Iter()</a>; @@ -4899,7 +4908,7 @@ with close(), forceClose is true : isClosedContour returns true Iterates through <a href="#Verb_Array">Verb Array</a>, and associated <a href="#Point_Array">Point Array</a> and <a href="#Conic_Weight">Conic Weight</a>. <a href="#Verb_Array">Verb Array</a>, <a href="#Point_Array">Point Array</a>, and <a href="#Conic_Weight">Conic Weight</a> are returned unaltered. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> class <a href="#SkPath_RawIter_RawIter">RawIter</a> { public: <a href="#SkPath_RawIter_RawIter">RawIter()</a>; diff --git a/site/user/api/SkPixmap_Reference.md b/site/user/api/SkPixmap_Reference.md index 9c7deb64cb..6e44b60aff 100644 --- a/site/user/api/SkPixmap_Reference.md +++ b/site/user/api/SkPixmap_Reference.md @@ -49,13 +49,11 @@ to manage pixel memory; <a href="undocumented#Pixel_Ref">Pixel Ref</a> is safe a | <a href="#SkPixmap_bounds">bounds</a> | Returns <a href="#SkPixmap_width">width</a> and <a href="#SkPixmap_height">height</a> as Rectangle. | | <a href="#SkPixmap_colorSpace">colorSpace</a> | Returns <a href="#Info">Image Info</a> <a href="undocumented#Color_Space">Color Space</a>. | | <a href="#SkPixmap_colorType">colorType</a> | Returns <a href="#Info">Image Info</a> <a href="undocumented#Color_Type">Color Type</a>. | +| <a href="#SkPixmap_computeByteSize">computeByteSize</a> | Returns size required for pixels. | | <a href="#SkPixmap_computeIsOpaque">computeIsOpaque</a> | Returns true if all pixels are opaque. | | <a href="#SkPixmap_erase">erase</a> | Writes <a href="undocumented#Color">Color</a> to pixels. | | <a href="#SkPixmap_extractSubset">extractSubset</a> | Sets pointer to portion of original. | | <a href="#SkPixmap_getColor">getColor</a> | Returns one pixel as <a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>. | -| <a href="#SkPixmap_getSafeSize">getSafeSize</a> | Returns minimum size required for pixels in 32 bits. | -| <a href="#SkPixmap_getSafeSize64">getSafeSize64</a> | Returns minimum size required for pixels in 64 bits. | -| <a href="#SkPixmap_getSize64">getSize64</a> | Returns conservative size required for pixels. | | <a href="#SkPixmap_height">height</a> | Returns pixel row count. | | <a href="#SkPixmap_info">info</a> | Returns <a href="#Info">Image Info</a>. | | <a href="#SkPixmap_isOpaque">isOpaque</a> | Returns true if <a href="#Info">Image Info</a> describes opaque pixels. | @@ -389,7 +387,8 @@ size_t rowBytes() const </pre> Returns row bytes, the interval from one pixel row to the next. Row bytes -is at least as large as<a href="#SkPixmap_width">width</a> * <a href="#SkPixmap_info">info</a>.bytesPerPixel(). +is at least as large as: +<a href="#SkPixmap_width">width</a> * <a href="#SkPixmap_info">info</a>.bytesPerPixel(). Returns zero if <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kUnknown SkColorType</a>. It is up to the <a href="SkBitmap_Reference#Bitmap">Bitmap</a> creator to ensure that row bytes is a useful value. @@ -460,6 +459,7 @@ int width() const </pre> Returns pixel count in each pixel row. Should be equal or less than: + <a href="#SkPixmap_rowBytes">rowBytes</a> / <a href="#SkPixmap_info">info</a>.bytesPerPixel(). ### Return Value @@ -657,7 +657,7 @@ isOpaque: true SkIRect bounds() const </pre> -Returns <a href="SkIRect_Reference#IRect">IRect</a>{ 0, 0, <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a> }. +Returns <a href="SkIRect_Reference#IRect">IRect</a> { 0, 0, <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a> }. ### Return Value @@ -759,68 +759,6 @@ color: kRGBA_F16_SkColorType bytesPerPixel: 8 shiftPerPixel: 3 --- -<a name="SkPixmap_getSize64"></a> -## getSize64 - -<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> -uint64_t getSize64() const -</pre> - -Returns conservative memory required for pixel storage. -Includes unused memory on last row when <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkPixmap_width">width</a>. - -### Return Value - -conservative pixel storage size - -### See Also - -<a href="#SkPixmap_getSafeSize64">getSafeSize64</a> <a href="#SkPixmap_getSafeSize">getSafeSize</a> <a href="#SkPixmap_height">height</a> <a href="#SkPixmap_rowBytes">rowBytes</a> <a href="#SkPixmap_width">width</a> <a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a> - ---- - -<a name="SkPixmap_getSafeSize64"></a> -## getSafeSize64 - -<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> -uint64_t getSafeSize64() const -</pre> - -Returns minimum memory required for pixel storage. -Does not include unused memory on last row when <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkPixmap_width">width</a>. - -### Return Value - -exact pixel storage size - -### See Also - -<a href="#SkPixmap_getSize64">getSize64</a> <a href="#SkPixmap_getSafeSize">getSafeSize</a> <a href="#SkPixmap_height">height</a> <a href="#SkPixmap_rowBytes">rowBytes</a> <a href="#SkPixmap_width">width</a> <a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a> - ---- - -<a name="SkPixmap_getSafeSize"></a> -## getSafeSize - -<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> -size_t getSafeSize() const -</pre> - -Returns minimum memory required for pixel storage. -Does not include unused memory on last row when <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkPixmap_width">width</a>. -Returns zero if value is does not fit in a signed 32-bit integer. -The largest value than can be returned is 2,147,483,647. - -### Return Value - -exact pixel storage size if size fits in signed 32 bits - -### See Also - -<a href="#SkPixmap_getSize64">getSize64</a> <a href="#SkPixmap_getSafeSize64">getSafeSize64</a> <a href="#SkPixmap_height">height</a> <a href="#SkPixmap_rowBytes">rowBytes</a> <a href="#SkPixmap_width">width</a> <a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a> <a href="undocumented#sk_64_isS32">sk 64 isS32</a> - ---- - <a name="SkPixmap_computeByteSize"></a> ## computeByteSize @@ -1679,7 +1617,8 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY, SkTransferFunctionBehavior behavior) const </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>). +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>). <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Color_Type">Color Type</a>, <a href="undocumented#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 @@ -1693,7 +1632,9 @@ If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#Sk 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 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 ifabs(srcX) >= this-><a href="#SkPixmap_width">width</a>, +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>. If <a href="#SkPixmap_readPixels_behavior">behavior</a> is <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts source @@ -1738,7 +1679,7 @@ 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 (this-><a href="#SkPixmap_width">width</a>, this-><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#Color_Type">Color Type</a>, <a href="undocumented#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 @@ -1786,7 +1727,7 @@ 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 (this-><a href="#SkPixmap_width">width</a>, this-><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#Color_Type">Color Type</a>, <a href="undocumented#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 @@ -1800,7 +1741,9 @@ If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#Sk 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 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 ifabs(srcX) >= this-><a href="#SkPixmap_width">width</a>, +false if this-><a href="#SkPixmap_width">width</a> or this-><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>. ### Parameters @@ -1849,7 +1792,9 @@ If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#Sk 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 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 ifabs(srcX) >= this-><a href="#SkPixmap_width">width</a>, +false this-><a href="#SkPixmap_width">width</a> or this-><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>. ### Parameters diff --git a/site/user/api/SkRect_Reference.md b/site/user/api/SkRect_Reference.md index 4dd16b897e..fe1f090331 100644 --- a/site/user/api/SkRect_Reference.md +++ b/site/user/api/SkRect_Reference.md @@ -32,7 +32,7 @@ integer input cannot convert to <a href="undocumented#SkScalar">SkScalar</a> wit | description | function | | --- | --- | | <a href="#SkRect_Intersects">Intersects</a> | Returns true if areas overlap. | -| <a href="#SkRect_Make">Make</a> | Constructs from <a href="#Size">ISize</a> returning (0, 0, <a href="#SkRect_width">width</a>, <a href="#SkRect_height">height</a>). | +| <a href="#SkRect_Make">Make</a> | Constructs from <a href="undocumented#ISize">ISize</a> returning (0, 0, <a href="#SkRect_width">width</a>, <a href="#SkRect_height">height</a>). | | <a href="#SkRect_MakeEmpty">MakeEmpty</a> | Constructs from bounds of (0, 0, 0, 0). | | <a href="#SkRect_MakeFromIRect">MakeFromIRect</a> | Deprecated. | | <a href="#SkRect_MakeIWH">MakeIWH</a> | Constructs from int input returning (0, 0, <a href="#SkRect_width">width</a>, <a href="#SkRect_height">height</a>). | @@ -2016,9 +2016,12 @@ rect: 5, 1, 55, 86 # <a name="Intersection"></a> Intersection <a href="#Rect">Rects</a> <a href="#SkRect_intersect">intersect</a> when they enclose a common area. To <a href="#SkRect_intersect">intersect</a>, each of the pair must describe area; <a href="#SkRect_fLeft">fLeft</a> is less than <a href="#SkRect_fRight">fRight</a>, and <a href="#SkRect_fTop">fTop</a> is less than <a href="#SkRect_fBottom">fBottom</a>; -empty() returns false. The intersection of <a href="#Rect">Rect</a> a and <a href="#Rect">Rect</a> b can be described by: +empty() returns false. The intersection of <a href="#Rect">Rect</a> pair can be described by: + (max(a.fLeft, b.fLeft), max(a.fTop, b.fTop), -min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))The intersection is only meaningful if the resulting <a href="#Rect">Rect</a> is not empty and +min(a.fRight, b.fRight), min(a.fBottom, b.fBottom)). + +The intersection is only meaningful if the resulting <a href="#Rect">Rect</a> is not empty and describes an area: <a href="#SkRect_fLeft">fLeft</a> is less than <a href="#SkRect_fRight">fRight</a>, and <a href="#SkRect_fTop">fTop</a> is less than <a href="#SkRect_fBottom">fBottom</a>. <a name="SkRect_intersect"></a> @@ -2443,6 +2446,7 @@ void growToInclude(SkPoint pt) </pre> Grows <a href="#Rect">Rect</a> to include (<a href="#SkRect_growToInclude_pt">pt</a>.fX, <a href="#SkRect_growToInclude_pt">pt</a>.fY), modifying it so that: + <a href="#SkRect_fLeft">fLeft</a> <= <a href="#SkRect_growToInclude_pt">pt</a>.fX <= <a href="#SkRect_fRight">fRight</a> && <a href="#SkRect_fTop">fTop</a> <= <a href="#SkRect_growToInclude_pt">pt</a>.fY <= <a href="#SkRect_fBottom">fBottom</a>. If <a href="#Rect">Rect</a> is initialized with <a href="#SkRect_setLargestInverted">setLargestInverted</a>, then <a href="#Rect">Rect</a> will contain bounds of @@ -2518,6 +2522,7 @@ void growToInclude(const SkPoint pts[], size_t stride, int count) For each of <a href="#SkRect_growToInclude_3_count">count</a> <a href="undocumented#Point">Point</a> in <a href="#SkRect_growToInclude_3_pts">pts</a>, grows <a href="#Rect">Rect</a> to include (pt.fX, pt.fY), modifying it so that: <a href="#SkRect_fLeft">fLeft</a> <= pt.fX <= <a href="#SkRect_fRight">fRight</a> && <a href="#SkRect_fTop">fTop</a> <= pt.fY <= <a href="#SkRect_fBottom">fBottom</a>. + <a href="undocumented#Point">Point</a> may be followed with other data in each array element. <a href="#SkRect_growToInclude_3_stride">stride</a> is number of bytes in element; the interval to skip to advance from one <a href="undocumented#Point">Point</a> to the next. diff --git a/site/user/api/undocumented.md b/site/user/api/undocumented.md index cd6cb5fbd1..dc102f84ab 100644 --- a/site/user/api/undocumented.md +++ b/site/user/api/undocumented.md @@ -25,6 +25,8 @@ SkCanvas* beginPage(SkScalar width, SkScalar height, # <a name="Size"></a> Size +# <a name="SkSize"></a> Struct SkSize + # <a name="Arc"></a> Arc # <a name="Line"></a> Line @@ -85,6 +87,10 @@ bool equalsWithinTolerance(const SkPoint& p) const ## <a name="ArcTo"></a> ArcTo +# <a name="ISize"></a> ISize + +# <a name="SkISize"></a> Struct SkISize + # <a name="Alias"></a> Alias # <a name="Anti-alias"></a> Anti-alias @@ -521,6 +527,15 @@ size_t computeByteSize(size_t rowBytes) const --- +<a name="SkImageInfo_validate"></a> +## validate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void validate() const +</pre> + +--- + # <a name="SkImage"></a> Class SkImage <a name="SkImage_makeShader"></a> @@ -874,6 +889,10 @@ void setImmutable() --- +# <a name="Point3"></a> Point3 + +# <a name="SkPoint3"></a> Struct SkPoint3 + # <a name="Premultiply"></a> Premultiply # <a name="Raster_Engine"></a> Raster Engine @@ -952,7 +971,7 @@ static sk_sp<SkShader> MakeBitmapShader(const SkBitmap& src, TileMode tmx, # <a name="Stream"></a> Stream -# <a name="SkFlattenable"></a> Class SkFlattenable +# <a name="SkStream"></a> Class SkStream # <a name="String"></a> String diff --git a/site/user/api/usingBookmaker.md b/site/user/api/usingBookmaker.md index 7a93f7a304..96653510ba 100644 --- a/site/user/api/usingBookmaker.md +++ b/site/user/api/usingBookmaker.md @@ -8,22 +8,22 @@ Install<a href="usingBookmaker#Go">Go</a>if needed. Get the fiddle command line interface tool. By default this will appear in your home directory. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> $ go get go.skia.org/infra/fiddle/go/fiddlecli</pre> Build <a href="#Bookmaker">Bookmaker</a>. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> $ ninja -<a href="undocumented#C">C</a> out/dir bookmaker</pre> Generate an starter <a href="#Bookmaker">Bookmaker</a> file from an existing include. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> $ ./out/dir/bookmaker -i include/core/<a href="undocumented#SkXXX.h">SkXXX.h</a> -t docs</pre> If a method or function has an unnamed parameter, bookmaker generates an error: -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> <a href="undocumented#C">C</a>:/puregit/include/core/<a href="SkPixmap_Reference#SkPixmap">SkPixmap</a>.h(208): error: # missing param name bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const ^ @@ -34,14 +34,14 @@ them. After naming all parameters, check in the include before continuing. A successful run generates -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> docs/<a href="undocumented#SkXXX_Reference">SkXXX Reference</a>.bmh</pre> . Next, use your favorite editor to fill out -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> docs/<a href="undocumented#SkXXX_Reference">SkXXX Reference</a>.bmh</pre> . @@ -82,13 +82,13 @@ correct parents. If you run <a href="#Bookmaker">Bookmaker</a> inside <a href="usingBookmaker#Visual_Studio">Visual Studio</a>, you can click on errors and it will take you to the source line in question. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> $ ./out/dir/bookmaker -e fiddle.json -b docs</pre> Once complete, run fiddlecli to generate the example hashes. Errors are contained by the output but aren't reported yet. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> $ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json</pre> Generate <a href="usingBookmaker#bmh_SkXXX">bmh SkXXX</a>.md from <a href="usingBookmaker#SkXXX">SkXXX</a>.bmh and fiddleout.json. @@ -96,19 +96,19 @@ Error checking includes: undefined references, fiddle compiler errors, missing or mismatched printf output. Again, you can click on any errors inside <a href="usingBookmaker#Visual_Studio">Visual Studio</a>. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> $ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json</pre> The original include may have changed since you started creating the markdown. Check to see if it is up to date. This reports if a method no longer exists or its parameters have changed. -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> $ ./out/dir/bookmaker -x -b docs/<a href="usingBookmaker#SkXXX">SkXXX</a>.bmh -i include/core/<a href="usingBookmaker#SkXXX">SkXXX</a>.h</pre> Generate an updated include header. Run: -<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> $ ./out/dir/bookmaker -p -b docs -i include/core/<a href="usingBookmaker#SkXXX">SkXXX</a>.h</pre> to write the updated <a href="undocumented#SkXXX.h">SkXXX.h</a> to the current directory. |