1SkPixmap Reference 2=== 3 4# <a name="Pixmap"></a> Pixmap 5 6## <a name="Overview"></a> Overview 7 8## <a name="Subtopics"></a> Subtopics 9 10| name | description | 11| --- | --- | 12| <a href="#Constructors">Constructors</a> | functions that construct <a href="SkPixmap_Reference#SkPixmap">SkPixmap</a> | 13| <a href="#Member_Functions">Member Functions</a> | static functions and member methods | 14| <a href="#Related_Functions">Related Functions</a> | similar methods grouped together | 15 16# <a name="SkPixmap"></a> Class SkPixmap 17<a href="#Pixmap">Pixmap</a> provides a utility to pair <a href="SkImageInfo_Reference#SkImageInfo">SkImageInfo</a> with pixels and row bytes. 18<a href="#Pixmap">Pixmap</a> is a low level class which provides convenience functions to access 19raster destinations. <a href="SkCanvas_Reference#Canvas">Canvas</a> can not draw <a href="#Pixmap">Pixmap</a>, nor does <a href="#Pixmap">Pixmap</a> provide 20a direct drawing destination. 21 22Use <a href="SkBitmap_Reference#Bitmap">Bitmap</a> to draw pixels referenced by <a href="#Pixmap">Pixmap</a>; use <a href="SkSurface_Reference#Surface">Surface</a> to draw into 23pixels referenced by <a href="#Pixmap">Pixmap</a>. 24 25<a href="#Pixmap">Pixmap</a> does not try to manage the lifetime of the pixel memory. Use <a href="undocumented#Pixel_Ref">Pixel Ref</a> 26to manage pixel memory; <a href="undocumented#Pixel_Ref">Pixel Ref</a> is safe across threads. 27 28## <a name="Related_Functions"></a> Related Functions 29 30| name | description | 31| --- | --- | 32| <a href="#Image_Info_Access">Image Info Access</a> | returns all or part of <a href="SkImageInfo_Reference#Image_Info">Image Info</a> | 33| <a href="#Initialization">Initialization</a> | sets fields for use | 34| <a href="#Readable_Address">Readable Address</a> | returns read only pixels | 35| <a href="#Reader">Reader</a> | examine pixel value | 36| <a href="#Writable_Address">Writable Address</a> | returns writable pixels | 37| <a href="#Writer">Writer</a> | copy to pixel values | 38 39## <a name="Constructors"></a> Constructors 40 41| name | description | 42| --- | --- | 43| <a href="#SkPixmap_empty_constructor">SkPixmap()</a> | constructs with default values | 44| <a href="#SkPixmap_const_SkImageInfo_const_star">SkPixmap(const SkImageInfo& info, const void* addr, size t rowBytes)</a> | constructs from <a href="SkImageInfo_Reference#Image_Info">Image Info</a>, pixels | 45 46## <a name="Member_Functions"></a> Member Functions 47 48| name | description | 49| --- | --- | 50| <a href="#SkPixmap_addr">addr</a> | returns readable pixel address as void pointer | 51| <a href="#SkPixmap_addr16">addr16</a> | returns readable pixel address as 16-bit pointer | 52| <a href="#SkPixmap_addr32">addr32</a> | returns readable pixel address as 32-bit pointer | 53| <a href="#SkPixmap_addr64">addr64</a> | returns readable pixel address as 64-bit pointer | 54| <a href="#SkPixmap_addr8">addr8</a> | returns readable pixel address as 8-bit pointer | 55| <a href="#SkPixmap_addrF16">addrF16</a> | returns readable pixel component address as 16-bit pointer | 56| <a href="#SkPixmap_alphaType">alphaType</a> | returns <a href="SkImageInfo_Reference#Image_Info">Image Info</a> <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> | 57| <a href="#SkPixmap_bounds">bounds</a> | returns width and height as Rectangle | 58| <a href="#SkPixmap_colorSpace">colorSpace</a> | returns <a href="SkImageInfo_Reference#Image_Info">Image Info</a> <a href="undocumented#Color_Space">Color Space</a> | 59| <a href="#SkPixmap_colorType">colorType</a> | returns <a href="SkImageInfo_Reference#Image_Info">Image Info</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> | 60| <a href="#SkPixmap_computeByteSize">computeByteSize</a> | returns size required for pixels | 61| <a href="#SkPixmap_computeIsOpaque">computeIsOpaque</a> | returns true if all pixels are opaque | 62| <a href="#SkPixmap_erase">erase</a> | writes <a href="undocumented#Color">Color</a> to pixels | 63| <a href="#SkPixmap_extractSubset">extractSubset</a> | sets pointer to portion of original | 64| <a href="#SkPixmap_getColor">getColor</a> | returns one pixel as <a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> | 65| <a href="#SkPixmap_height">height</a> | returns pixel row count | 66| <a href="#SkPixmap_info">info</a> | returns <a href="SkImageInfo_Reference#Image_Info">Image Info</a> | 67| <a href="#SkPixmap_isOpaque">isOpaque</a> | returns true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> describes opaque pixels | 68| <a href="#SkPixmap_readPixels">readPixels</a> | copies and converts pixels | 69| <a href="#SkPixmap_reset">reset</a> | reuses existing <a href="#Pixmap">Pixmap</a> with replacement values | 70| <a href="#SkPixmap_rowBytes">rowBytes</a> | returns interval between rows in bytes | 71| <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> | returns interval between rows in pixels | 72| <a href="#SkPixmap_scalePixels">scalePixels</a> | scales and converts pixels | 73| <a href="#SkPixmap_setColorSpace">setColorSpace</a> | sets <a href="SkImageInfo_Reference#Image_Info">Image Info</a> <a href="undocumented#Color_Space">Color Space</a> | 74| <a href="#SkPixmap_shiftPerPixel">shiftPerPixel</a> | returns bit shift from pixels to bytes | 75| <a href="#SkPixmap_width">width</a> | returns pixel column count | 76| <a href="#SkPixmap_writable_addr">writable addr</a> | returns writable pixel address as void pointer | 77| <a href="#SkPixmap_writable_addr16">writable addr16</a> | returns writable pixel address as 16-bit pointer | 78| <a href="#SkPixmap_writable_addr32">writable addr32</a> | returns writable pixel address as 32-bit pointer | 79| <a href="#SkPixmap_writable_addr64">writable addr64</a> | returns writable pixel address as 64-bit pointer | 80| <a href="#SkPixmap_writable_addr8">writable addr8</a> | returns writable pixel address as 8-bit pointer | 81| <a href="#SkPixmap_writable_addrF16">writable addrF16</a> | returns writable pixel component address as 16-bit pointer | 82 83## <a name="Initialization"></a> Initialization 84 85<a name="SkPixmap_empty_constructor"></a> 86## SkPixmap 87 88<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 89SkPixmap() 90</pre> 91 92Creates an empty <a href="#Pixmap">Pixmap</a> without pixels, with <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>, with 93<a href="SkImageInfo_Reference#SkAlphaType">kUnknown SkAlphaType</a>, and with a width and height of zero. Use 94<a href="#SkPixmap_reset">reset</a> to associate pixels, <a href="SkImageInfo_Reference#SkColorType">SkColorType</a>, <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a>, width, and height 95after <a href="#Pixmap">Pixmap</a> has been created. 96 97### Return Value 98 99empty <a href="#Pixmap">Pixmap</a> 100 101### Example 102 103<div><fiddle-embed name="9547e74a9d37553a667b913ffd1312dd"> 104 105#### Example Output 106 107~~~~ 108width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType 109width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType 110~~~~ 111 112</fiddle-embed></div> 113 114### See Also 115 116<a href="#SkPixmap_const_SkImageInfo_const_star">SkPixmap(const SkImageInfo& info, const void* addr, size t rowBytes)</a> <a href="#SkPixmap_reset">reset</a><sup><a href="#SkPixmap_reset_2">[2]</a></sup><sup><a href="#SkPixmap_reset_3">[3]</a></sup> <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a> <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> 117 118--- 119 120<a name="SkPixmap_const_SkImageInfo_const_star"></a> 121## SkPixmap 122 123<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 124SkPixmap(const SkImageInfo& info, const void* addr, size_t rowBytes) 125</pre> 126 127Creates <a href="#Pixmap">Pixmap</a> from info width, height, <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a>, and <a href="SkImageInfo_Reference#SkColorType">SkColorType</a>. 128addr points to pixels, or nullptr. <a href="#SkPixmap_rowBytes">rowBytes</a> should be info.<a href="#SkPixmap_width">width</a> times 129info.bytesPerPixel(), or larger. 130 131No parameter checking is performed; it is up to the caller to ensure that 132addr and <a href="#SkPixmap_rowBytes">rowBytes</a> agree with info. 133 134The memory lifetime of pixels is managed by the caller. When <a href="#Pixmap">Pixmap</a> goes 135out of scope, addr is unaffected. 136 137<a href="#Pixmap">Pixmap</a> may be later modified by <a href="#SkPixmap_reset">reset</a> to change its size, pixel type, or 138storage. 139 140### Parameters 141 142<table> <tr> <td><a name="SkPixmap_const_SkImageInfo_const_star_info"> <code><strong>info </strong></code> </a></td> <td> 143width, height, <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a>, <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> of <a href="SkImageInfo_Reference#Image_Info">Image Info</a></td> 144 </tr> <tr> <td><a name="SkPixmap_const_SkImageInfo_const_star_addr"> <code><strong>addr </strong></code> </a></td> <td> 145pointer to pixels allocated by caller; may be nullptr</td> 146 </tr> <tr> <td><a name="SkPixmap_const_SkImageInfo_const_star_rowBytes"> <code><strong>rowBytes </strong></code> </a></td> <td> 147size of one row of addr; width times pixel size, or larger</td> 148 </tr> 149</table> 150 151### Return Value 152 153initialized <a href="#Pixmap">Pixmap</a> 154 155### Example 156 157<div><fiddle-embed name="9a00774be57d7308313b3a9073e6e696"><div><a href="#SkImage_MakeRasterCopy">SkImage::MakeRasterCopy</a> takes const <a href="#SkPixmap">SkPixmap</a>& as an argument. The example 158constructs a <a href="#SkPixmap">SkPixmap</a> from the brace-delimited parameters.</div> 159 160#### Example Output 161 162~~~~ 163image alpha only = false 164copy alpha only = true 165~~~~ 166 167</fiddle-embed></div> 168 169### See Also 170 171<a href="#SkPixmap_empty_constructor">SkPixmap()</a> <a href="#SkPixmap_reset">reset</a><sup><a href="#SkPixmap_reset_2">[2]</a></sup><sup><a href="#SkPixmap_reset_3">[3]</a></sup> <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a> <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> 172 173--- 174 175<a name="SkPixmap_reset"></a> 176## reset 177 178<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 179void reset() 180</pre> 181 182Sets width, height, row bytes to zero; pixel address to nullptr; <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> to 183<a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>; and <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a> to <a href="SkImageInfo_Reference#SkAlphaType">kUnknown SkAlphaType</a>. 184 185The prior pixels are unaffected; it is up to the caller to release pixels 186memory if desired. 187 188### Example 189 190<div><fiddle-embed name="d9eb583c39f4f0baea79896b89245c98"> 191 192#### Example Output 193 194~~~~ 195width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType 196width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType 197~~~~ 198 199</fiddle-embed></div> 200 201### See Also 202 203<a href="#SkPixmap_empty_constructor">SkPixmap()</a> <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a> <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> 204 205--- 206 207<a name="SkPixmap_reset_2"></a> 208 209<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 210void reset(const SkImageInfo& info, const void* addr, size_t rowBytes) 211</pre> 212 213Sets width, height, <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a>, and <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> from info. 214Sets pixel address from addr, which may be nullptr. 215Sets row bytes from <a href="#SkPixmap_rowBytes">rowBytes</a>, which should be info.<a href="#SkPixmap_width">width</a> times 216info.bytesPerPixel(), or larger. 217 218Does not check addr. Asserts if built with SK_DEBUG defined and if <a href="#SkPixmap_rowBytes">rowBytes</a> is 219too small to hold one row of pixels. 220 221The memory lifetime pixels are managed by the caller. When <a href="#Pixmap">Pixmap</a> goes 222out of scope, addr is unaffected. 223 224### Parameters 225 226<table> <tr> <td><a name="SkPixmap_reset_2_info"> <code><strong>info </strong></code> </a></td> <td> 227width, height, <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a>, <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> of <a href="SkImageInfo_Reference#Image_Info">Image Info</a></td> 228 </tr> <tr> <td><a name="SkPixmap_reset_2_addr"> <code><strong>addr </strong></code> </a></td> <td> 229pointer to pixels allocated by caller; may be nullptr</td> 230 </tr> <tr> <td><a name="SkPixmap_reset_2_rowBytes"> <code><strong>rowBytes </strong></code> </a></td> <td> 231size of one row of addr; width times pixel size, or larger</td> 232 </tr> 233</table> 234 235### Example 236 237<div><fiddle-embed name="a7c9bfe44f5d888ab5b9996f2b126788"></fiddle-embed></div> 238 239### See Also 240 241<a href="#SkPixmap_const_SkImageInfo_const_star">SkPixmap(const SkImageInfo& info, const void* addr, size t rowBytes)</a> <a href="#SkPixmap_reset">reset</a><sup><a href="#SkPixmap_reset_2">[2]</a></sup><sup><a href="#SkPixmap_reset_3">[3]</a></sup> <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a> <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> 242 243--- 244 245<a name="SkPixmap_setColorSpace"></a> 246## setColorSpace 247 248<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 249void setColorSpace(sk_sp<SkColorSpace> colorSpace) 250</pre> 251 252Changes <a href="undocumented#Color_Space">Color Space</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a>; preserves width, height, <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a>, and 253<a href="SkImageInfo_Reference#SkColorType">SkColorType</a> in <a href="SkImage_Reference#Image">Image</a>, and leaves pixel address and row bytes unchanged. 254<a href="undocumented#Color_Space">Color Space</a> reference count is incremented. 255 256### Parameters 257 258<table> <tr> <td><a name="SkPixmap_setColorSpace_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td> 259<a href="undocumented#Color_Space">Color Space</a> moved to <a href="SkImageInfo_Reference#Image_Info">Image Info</a></td> 260 </tr> 261</table> 262 263### Example 264 265<div><fiddle-embed name="bc42aea1e30b7234544bc25b4fc09dd0"> 266 267#### Example Output 268 269~~~~ 270is unique 271is not unique 272~~~~ 273 274</fiddle-embed></div> 275 276### See Also 277 278<a href="undocumented#Color_Space">Color Space</a> <a href="#SkImageInfo_makeColorSpace">SkImageInfo::makeColorSpace</a> 279 280--- 281 282<a name="SkPixmap_reset_3"></a> 283 284<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 285bool SK_WARN_UNUSED_RESULT reset(const SkMask& mask) 286</pre> 287 288Sets width, height, pixel address, and row bytes to <a href="undocumented#Mask">Mask</a> properties, if <a href="undocumented#Mask">Mask</a> 289format is <a href="#SkMask_kA8_Format">SkMask::kA8 Format</a>; and returns true. Otherwise sets width, height, 290row bytes to zero; pixel address to nullptr; <a href="SkImageInfo_Reference#SkColorType">SkColorType</a> to <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>; 291and <a href="SkImageInfo_Reference#SkAlphaType">SkAlphaType</a> to <a href="SkImageInfo_Reference#SkAlphaType">kUnknown SkAlphaType</a>; and returns false. 292 293Failing to read the return value generates a compile time warning. 294 295### Parameters 296 297<table> <tr> <td><a name="SkPixmap_reset_3_mask"> <code><strong>mask </strong></code> </a></td> <td> 298<a href="undocumented#Mask">Mask</a> containing pixels and dimensions</td> 299 </tr> 300</table> 301 302### Return Value 303 304true if set to <a href="undocumented#Mask">Mask</a> properties 305 306### Example 307 308<div><fiddle-embed name="379761a97bd7a116638a34eb3e80bf0d"> 309 310#### Example Output 311 312~~~~ 313success: true width: 2 height: 2 314success: false width: 0 height: 0 315~~~~ 316 317</fiddle-embed></div> 318 319### See Also 320 321<a href="undocumented#Mask">Mask</a> <a href="#SkPixmap_reset">reset</a><sup><a href="#SkPixmap_reset_2">[2]</a></sup><sup><a href="#SkPixmap_reset_3">[3]</a></sup> 322 323--- 324 325<a name="SkPixmap_extractSubset"></a> 326## extractSubset 327 328<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 329bool SK_WARN_UNUSED_RESULT extractSubset(SkPixmap* subset, const SkIRect& area) const 330</pre> 331 332Sets <a href="#SkPixmap_extractSubset_subset">subset</a> width, height, pixel address to intersection of <a href="#Pixmap">Pixmap</a> with <a href="#SkPixmap_extractSubset_area">area</a>, 333if intersection is not empty; and return true. Otherwise, leave <a href="#SkPixmap_extractSubset_subset">subset</a> unchanged 334and return false. 335 336Failing to read the return value generates a compile time warning. 337 338### Parameters 339 340<table> <tr> <td><a name="SkPixmap_extractSubset_subset"> <code><strong>subset </strong></code> </a></td> <td> 341storage for width, height, pixel address of intersection</td> 342 </tr> <tr> <td><a name="SkPixmap_extractSubset_area"> <code><strong>area </strong></code> </a></td> <td> 343bounds to intersect with <a href="#Pixmap">Pixmap</a></td> 344 </tr> 345</table> 346 347### Return Value 348 349true if intersection of <a href="#Pixmap">Pixmap</a> and <a href="#SkPixmap_extractSubset_area">area</a> is not empty 350 351### Example 352 353<div><fiddle-embed name="febdbfac6cf4cde69837643be2e1f6dd"></fiddle-embed></div> 354 355### See Also 356 357<a href="#SkPixmap_reset">reset</a><sup><a href="#SkPixmap_reset_2">[2]</a></sup><sup><a href="#SkPixmap_reset_3">[3]</a></sup> <a href="#SkIRect_intersect">SkIRect::intersect</a><sup><a href="#SkIRect_intersect_2">[2]</a></sup><sup><a href="#SkIRect_intersect_3">[3]</a></sup> 358 359--- 360 361## <a name="Image_Info_Access"></a> Image Info Access 362 363<a name="SkPixmap_info"></a> 364## info 365 366<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 367const SkImageInfo& info() const 368</pre> 369 370Returns width, height, <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, and <a href="undocumented#Color_Space">Color Space</a>. 371 372### Return Value 373 374reference to ImageInfo 375 376### Example 377 378<div><fiddle-embed name="6e0f558bf7fabc655041116288559134"> 379 380#### Example Output 381 382~~~~ 383width: 384 height: 384 color: BGRA_8888 alpha: Opaque 384~~~~ 385 386</fiddle-embed></div> 387 388### See Also 389 390<a href="SkImageInfo_Reference#Image_Info">Image Info</a> 391 392--- 393 394<a name="SkPixmap_rowBytes"></a> 395## rowBytes 396 397<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 398size_t rowBytes() const 399</pre> 400 401Returns row bytes, the interval from one pixel row to the next. Row bytes 402is at least as large as: 403<a href="#SkPixmap_width">width</a> * <a href="#SkPixmap_info">info</a>.bytesPerPixel(). 404 405Returns zero if <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>. 406It is up to the <a href="SkBitmap_Reference#Bitmap">Bitmap</a> creator to ensure that row bytes is a useful value. 407 408### Return Value 409 410byte length of pixel row 411 412### Example 413 414<div><fiddle-embed name="da5e1f7f49891d3805a5a6103a000eff"> 415 416#### Example Output 417 418~~~~ 419rowBytes: 2 minRowBytes: 4 420rowBytes: 8 minRowBytes: 4 421~~~~ 422 423</fiddle-embed></div> 424 425### See Also 426 427<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_info">info</a> <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a> 428 429--- 430 431<a name="SkPixmap_addr"></a> 432## addr 433 434<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 435const void* addr() const 436</pre> 437 438Returns pixel address, the base address corresponding to the pixel origin. 439 440It is up to the <a href="#Pixmap">Pixmap</a> creator to ensure that pixel address is a useful value. 441 442### Return Value 443 444pixel address 445 446### Example 447 448<div><fiddle-embed name="17bcabaaee2dbb7beba562e9ca50b55e"> 449 450#### Example Output 451 452~~~~ 453#Volatile 454pixels address: 0x7f2a440bb010 455inset address: 0x7f2a440fb210 456~~~~ 457 458</fiddle-embed></div> 459 460### See Also 461 462<a href="#SkPixmap_addr_2">addr(int x, int y)</a> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_info">info</a> <a href="#SkPixmap_rowBytes">rowBytes</a> 463 464--- 465 466<a name="SkPixmap_width"></a> 467## width 468 469<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 470int width() const 471</pre> 472 473Returns pixel count in each pixel row. Should be equal or less than: 474 475<a href="#SkPixmap_rowBytes">rowBytes</a> / <a href="#SkPixmap_info">info</a>.bytesPerPixel(). 476 477### Return Value 478 479pixel width in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> 480 481### Example 482 483<div><fiddle-embed name="f68617b7153a20b2ed3d7f9ed5c6e5e4"> 484 485#### Example Output 486 487~~~~ 488pixmap width: 16 info width: 16 489~~~~ 490 491</fiddle-embed></div> 492 493### See Also 494 495<a href="#SkPixmap_height">height</a> <a href="#SkImageInfo_width">SkImageInfo::width()</a> 496 497--- 498 499<a name="SkPixmap_height"></a> 500## height 501 502<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 503int height() const 504</pre> 505 506Returns pixel row count. 507 508### Return Value 509 510pixel height in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> 511 512### Example 513 514<div><fiddle-embed name="4a996d32122f469d51ddd0186efb48cc"> 515 516#### Example Output 517 518~~~~ 519pixmap height: 32 info height: 32 520~~~~ 521 522</fiddle-embed></div> 523 524### See Also 525 526<a href="#SkPixmap_width">width</a> ImageInfo::height() 527 528--- 529 530<a name="SkPixmap_colorType"></a> 531## colorType 532 533<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 534SkColorType colorType() const 535</pre> 536 537Returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, one of: <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>, <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>, 538<a href="SkImageInfo_Reference#SkColorType">kRGB 565 SkColorType</a>, <a href="SkImageInfo_Reference#SkColorType">kARGB 4444 SkColorType</a>, <a href="SkImageInfo_Reference#SkColorType">kRGBA 8888 SkColorType</a>, 539<a href="SkImageInfo_Reference#SkColorType">kRGB 888x SkColorType</a>, <a href="SkImageInfo_Reference#SkColorType">kBGRA 8888 SkColorType</a>, <a href="SkImageInfo_Reference#SkColorType">kRGBA 1010102 SkColorType</a>, 540<a href="SkImageInfo_Reference#SkColorType">kRGB 101010x SkColorType</a>, <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, <a href="SkImageInfo_Reference#SkColorType">kRGBA F16 SkColorType</a>. 541 542### Return Value 543 544<a href="SkImageInfo_Reference#Color_Type">Color Type</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> 545 546### Example 547 548<div><fiddle-embed name="0ab5c7af272685f2ce177cc79e6b9457"> 549 550#### Example Output 551 552~~~~ 553color type: kAlpha_8_SkColorType 554~~~~ 555 556</fiddle-embed></div> 557 558### See Also 559 560<a href="#SkPixmap_alphaType">alphaType</a> <a href="#SkImageInfo_colorType">SkImageInfo::colorType</a> 561 562--- 563 564<a name="SkPixmap_alphaType"></a> 565## alphaType 566 567<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 568SkAlphaType alphaType() const 569</pre> 570 571Returns <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, one of: <a href="SkImageInfo_Reference#SkAlphaType">kUnknown SkAlphaType</a>, <a href="SkImageInfo_Reference#SkAlphaType">kOpaque SkAlphaType</a>, 572<a href="SkImageInfo_Reference#SkAlphaType">kPremul SkAlphaType</a>, <a href="SkImageInfo_Reference#SkAlphaType">kUnpremul SkAlphaType</a>. 573 574### Return Value 575 576<a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> 577 578### Example 579 580<div><fiddle-embed name="070b1a60232be499eb10c6ea62371804"> 581 582#### Example Output 583 584~~~~ 585alpha type: kPremul_SkAlphaType 586~~~~ 587 588</fiddle-embed></div> 589 590### See Also 591 592<a href="#SkPixmap_colorType">colorType</a> <a href="#SkImageInfo_alphaType">SkImageInfo::alphaType</a> 593 594--- 595 596<a name="SkPixmap_colorSpace"></a> 597## colorSpace 598 599<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 600SkColorSpace* colorSpace() const 601</pre> 602 603Returns <a href="undocumented#Color_Space">Color Space</a> associated with <a href="SkImageInfo_Reference#Image_Info">Image Info</a>. The 604reference count of <a href="undocumented#Color_Space">Color Space</a> is unchanged. The returned <a href="undocumented#Color_Space">Color Space</a> is 605immutable. 606 607### Return Value 608 609<a href="undocumented#Color_Space">Color Space</a>, the range of colors, in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> 610 611### Example 612 613<div><fiddle-embed name="34c71f803b8edb48eaf1cd0c55bb212e"><div><a href="#SkColorSpace_MakeSRGBLinear">SkColorSpace::MakeSRGBLinear</a> creates <a href="undocumented#Color_Space">Color Space</a> with linear gamma 614and an sRGB gamut. This <a href="undocumented#Color_Space">Color Space</a> gamma is not close to sRGB gamma.</div> 615 616#### Example Output 617 618~~~~ 619gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false 620~~~~ 621 622</fiddle-embed></div> 623 624### See Also 625 626<a href="undocumented#Color_Space">Color Space</a> <a href="#SkImageInfo_colorSpace">SkImageInfo::colorSpace</a> 627 628--- 629 630<a name="SkPixmap_isOpaque"></a> 631## isOpaque 632 633<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 634bool isOpaque() const 635</pre> 636 637Returns true if <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is <a href="SkImageInfo_Reference#SkAlphaType">kOpaque SkAlphaType</a>. 638Does not check if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> allows <a href="#Alpha">Alpha</a>, or if any pixel value has 639transparency. 640 641### Return Value 642 643true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> has opaque <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> 644 645### Example 646 647<div><fiddle-embed name="efd083f121e888a523455ea8a49e50d1"><div><a href="#SkPixmap_isOpaque">isOpaque</a> ignores whether all pixels are opaque or not.</div> 648 649#### Example Output 650 651~~~~ 652isOpaque: false 653isOpaque: false 654isOpaque: true 655isOpaque: true 656~~~~ 657 658</fiddle-embed></div> 659 660### See Also 661 662<a href="#SkPixmap_computeIsOpaque">computeIsOpaque</a> <a href="#SkImageInfo_isOpaque">SkImageInfo::isOpaque</a> 663 664--- 665 666<a name="SkPixmap_bounds"></a> 667## bounds 668 669<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 670SkIRect bounds() const 671</pre> 672 673Returns <a href="SkIRect_Reference#IRect">IRect</a> { 0, 0, <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a> }. 674 675### Return Value 676 677integral rectangle from origin to <a href="#SkPixmap_width">width</a> and <a href="#SkPixmap_height">height</a> 678 679### Example 680 681<div><fiddle-embed name="79750fb1d898a4e5c8c828b7bc9acec5"> 682 683#### Example Output 684 685~~~~ 686width: 0 height: 0 empty: true 687width: 0 height: 2 empty: true 688width: 2 height: 0 empty: true 689width: 2 height: 2 empty: false 690~~~~ 691 692</fiddle-embed></div> 693 694### See Also 695 696<a href="#SkPixmap_height">height</a> <a href="#SkPixmap_width">width</a> <a href="SkIRect_Reference#IRect">IRect</a> 697 698--- 699 700<a name="SkPixmap_rowBytesAsPixels"></a> 701## rowBytesAsPixels 702 703<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 704int rowBytesAsPixels() const 705</pre> 706 707Returns number of pixels that fit on row. Should be greater than or equal to 708<a href="#SkPixmap_width">width</a>. 709 710### Return Value 711 712maximum pixels per row 713 714### Example 715 716<div><fiddle-embed name="6231bb212d0c231b5bc44eac626fbcb5"> 717 718#### Example Output 719 720~~~~ 721rowBytes: 4 rowBytesAsPixels: 1 722rowBytes: 5 rowBytesAsPixels: 1 723rowBytes: 6 rowBytesAsPixels: 1 724rowBytes: 7 rowBytesAsPixels: 1 725rowBytes: 8 rowBytesAsPixels: 2 726~~~~ 727 728</fiddle-embed></div> 729 730### See Also 731 732<a href="#SkPixmap_rowBytes">rowBytes</a> <a href="#SkPixmap_shiftPerPixel">shiftPerPixel</a> <a href="#SkPixmap_width">width</a> <a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a> 733 734--- 735 736<a name="SkPixmap_shiftPerPixel"></a> 737## shiftPerPixel 738 739<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 740int shiftPerPixel() const 741</pre> 742 743Returns bit shift converting row bytes to row pixels. 744Returns zero for <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>. 745 746### Return Value 747 748one of: 0, 1, 2, 3; left shift to convert pixels to bytes 749 750### Example 751 752<div><fiddle-embed name="2e778ffd6edea51af4b07f5d322ceb6a"> 753 754#### Example Output 755 756~~~~ 757color: kUnknown_SkColorType bytesPerPixel: 0 shiftPerPixel: 0 758color: kAlpha_8_SkColorType bytesPerPixel: 1 shiftPerPixel: 0 759color: kRGB_565_SkColorType bytesPerPixel: 2 shiftPerPixel: 1 760color: kARGB_4444_SkColorType bytesPerPixel: 2 shiftPerPixel: 1 761color: kRGBA_8888_SkColorType bytesPerPixel: 4 shiftPerPixel: 2 762color: kBGRA_8888_SkColorType bytesPerPixel: 4 shiftPerPixel: 2 763color: kGray_8_SkColorType bytesPerPixel: 1 shiftPerPixel: 0 764color: kRGBA_F16_SkColorType bytesPerPixel: 8 shiftPerPixel: 3 765~~~~ 766 767</fiddle-embed></div> 768 769### See Also 770 771<a href="#SkPixmap_rowBytes">rowBytes</a> <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> <a href="#SkPixmap_width">width</a> <a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a> 772 773--- 774 775<a name="SkPixmap_computeByteSize"></a> 776## computeByteSize 777 778<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 779size_t computeByteSize() const 780</pre> 781 782Returns minimum memory required for pixel storage. 783Does not include unused memory on last row when <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkPixmap_width">width</a>. 784Returns zero if result does not fit in size_t. 785Returns zero if <a href="#SkPixmap_height">height</a> or <a href="#SkPixmap_width">width</a> is 0. 786Returns <a href="#SkPixmap_height">height</a> times <a href="#SkPixmap_rowBytes">rowBytes</a> if <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>. 787 788### Return Value 789 790size in bytes of image buffer 791 792### Example 793 794<div><fiddle-embed name="410d14ddc45d272598c5a4e52bb047de"> 795 796#### Example Output 797 798~~~~ 799width: 1 height: 1 computeByteSize: 4 800width: 1 height: 1000 computeByteSize: 4999 801width: 1 height: 1000000 computeByteSize: 4999999 802width: 1000 height: 1 computeByteSize: 4000 803width: 1000 height: 1000 computeByteSize: 4999000 804width: 1000 height: 1000000 computeByteSize: 4999999000 805width: 1000000 height: 1 computeByteSize: 4000000 806width: 1000000 height: 1000 computeByteSize: 4999000000 807width: 1000000 height: 1000000 computeByteSize: 4999999000000 808~~~~ 809 810</fiddle-embed></div> 811 812### See Also 813 814<a href="#SkImageInfo_computeByteSize">SkImageInfo::computeByteSize</a> 815 816--- 817 818## <a name="Reader"></a> Reader 819 820<a name="SkPixmap_computeIsOpaque"></a> 821## computeIsOpaque 822 823<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 824bool computeIsOpaque() const 825</pre> 826 827Returns true if all pixels are opaque. <a href="SkImageInfo_Reference#Color_Type">Color Type</a> determines how pixels 828are encoded, and whether pixel describes <a href="#Alpha">Alpha</a>. Returns true for <a href="SkImageInfo_Reference#Color_Type">Color Types</a> 829without alpha in each pixel; for other <a href="SkImageInfo_Reference#Color_Type">Color Types</a>, returns true if all 830pixels have alpha values equivalent to 1.0 or greater. 831 832For <a href="SkImageInfo_Reference#Color_Type">Color Types</a> <a href="SkImageInfo_Reference#SkColorType">kRGB 565 SkColorType</a> or <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>: always 833returns true. For <a href="SkImageInfo_Reference#Color_Type">Color Types</a> <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>, <a href="SkImageInfo_Reference#SkColorType">kBGRA 8888 SkColorType</a>, 834<a href="SkImageInfo_Reference#SkColorType">kRGBA 8888 SkColorType</a>: returns true if all pixel <a href="#Alpha">Alpha</a> values are 255. 835For <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="SkImageInfo_Reference#SkColorType">kARGB 4444 SkColorType</a>: returns true if all pixel <a href="#Alpha">Alpha</a> values are 15. 836For <a href="SkImageInfo_Reference#SkColorType">kRGBA F16 SkColorType</a>: returns true if all pixel <a href="#Alpha">Alpha</a> values are 1.0 or 837greater. 838 839Returns false for <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>. 840 841### Return Value 842 843true if all pixels have opaque values or <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is opaque 844 845### Example 846 847<div><fiddle-embed name="6ef37d5be03d0bfaec992dbb5a94c66f"> 848 849#### Example Output 850 851~~~~ 852computeIsOpaque: false 853computeIsOpaque: true 854computeIsOpaque: false 855computeIsOpaque: true 856~~~~ 857 858</fiddle-embed></div> 859 860### See Also 861 862<a href="#SkPixmap_isOpaque">isOpaque</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="#Alpha">Alpha</a> 863 864--- 865 866<a name="SkPixmap_getColor"></a> 867## getColor 868 869<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 870SkColor getColor(int x, int y) const 871</pre> 872 873Returns pixel at (<a href="#SkPixmap_getColor_x">x</a>, <a href="#SkPixmap_getColor_y">y</a>) as <a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>. 874Returns black with <a href="#Alpha">Alpha</a> if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>. 875 876Input is not validated: out of bounds values of <a href="#SkPixmap_getColor_x">x</a> or <a href="#SkPixmap_getColor_y">y</a> trigger an assert() if 877built with SK_DEBUG defined; and returns undefined values or may crash if 878SK_RELEASE is defined. Fails if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a> or 879pixel address is nullptr. 880 881<a href="undocumented#Color_Space">Color Space</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> is ignored. Some <a href="undocumented#Color">Color</a> precision may be lost in the 882conversion to <a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>; original pixel data may have additional 883precision. 884 885### Parameters 886 887<table> <tr> <td><a name="SkPixmap_getColor_x"> <code><strong>x </strong></code> </a></td> <td> 888column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 889 </tr> <tr> <td><a name="SkPixmap_getColor_y"> <code><strong>y </strong></code> </a></td> <td> 890row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 891 </tr> 892</table> 893 894### Return Value 895 896pixel converted to <a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> 897 898### Example 899 900<div><fiddle-embed name="94ad244056dc80ecd87daae004266334"> 901 902#### Example Output 903 904~~~~ 905Premultiplied: 906(0, 0) 0x00000000 0x2a0e002a 0x55380055 0x7f7f007f 907(0, 1) 0x2a000e2a 0x551c1c55 0x7f542a7f 0xaaaa38aa 908(0, 2) 0x55003855 0x7f2a547f 0xaa7171aa 0xd4d48dd4 909(0, 3) 0x7f007f7f 0xaa38aaaa 0xd48dd4d4 0xffffffff 910Unpremultiplied: 911(0, 0) 0x00000000 0x2a5500ff 0x55a800ff 0x7fff00ff 912(0, 1) 0x2a0055ff 0x555454ff 0x7fa954ff 0xaaff54ff 913(0, 2) 0x5500a8ff 0x7f54a9ff 0xaaaaaaff 0xd4ffaaff 914(0, 3) 0x7f00ffff 0xaa54ffff 0xd4aaffff 0xffffffff 915~~~~ 916 917</fiddle-embed></div> 918 919### See Also 920 921<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_readPixels">readPixels</a><sup><a href="#SkPixmap_readPixels_2">[2]</a></sup><sup><a href="#SkPixmap_readPixels_3">[3]</a></sup><sup><a href="#SkPixmap_readPixels_4">[4]</a></sup><sup><a href="#SkPixmap_readPixels_5">[5]</a></sup> 922 923--- 924 925## <a name="Readable_Address"></a> Readable Address 926 927<a name="SkPixmap_addr_2"></a> 928 929<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 930const void* addr(int x, int y) const 931</pre> 932 933Returns readable pixel address at (<a href="#SkPixmap_addr_2_x">x</a>, <a href="#SkPixmap_addr_2_y">y</a>). Returns nullptr if <a href="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr. 934 935Input is not validated: out of bounds values of <a href="#SkPixmap_addr_2_x">x</a> or <a href="#SkPixmap_addr_2_y">y</a> trigger an assert() if 936built with SK_DEBUG defined. Returns nullptr if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>. 937 938Performs a lookup of pixel size; for better performance, call 939one of: <a href="#SkPixmap_addr8">addr8</a>, <a href="#SkPixmap_addr16">addr16</a>, <a href="#SkPixmap_addr32">addr32</a>, <a href="#SkPixmap_addr64">addr64</a>, or <a href="#SkPixmap_addrF16">addrF16</a>. 940 941### Parameters 942 943<table> <tr> <td><a name="SkPixmap_addr_2_x"> <code><strong>x </strong></code> </a></td> <td> 944column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 945 </tr> <tr> <td><a name="SkPixmap_addr_2_y"> <code><strong>y </strong></code> </a></td> <td> 946row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 947 </tr> 948</table> 949 950### Return Value 951 952readable generic pointer to pixel 953 954### Example 955 956<div><fiddle-embed name="6e6e29e860eafed77308c973400cc84d"> 957 958#### Example Output 959 960~~~~ 961pixmap.addr(1, 2) == &storage[1 + 2 * w] 962~~~~ 963 964</fiddle-embed></div> 965 966### See Also 967 968<a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkBitmap_getAddr">SkBitmap::getAddr</a> 969 970--- 971 972<a name="SkPixmap_addr8"></a> 973## addr8 974 975<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 976const uint8_t* addr8() const 977</pre> 978 979Returns readable base pixel address. Result is addressable as unsigned 8-bit bytes. 980Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a> or 981<a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, and is built with SK_DEBUG defined. 982 983One byte corresponds to one pixel. 984 985### Return Value 986 987readable unsigned 8-bit pointer to pixels 988 989### Example 990 991<div><fiddle-embed name="9adda80b2dd1b08ec5ccf66da7c8bd91"> 992 993#### Example Output 994 995~~~~ 996pixmap.addr8() == storage 997~~~~ 998 999</fiddle-embed></div> 1000 1001### See Also 1002 1003<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr8">writable addr8</a> 1004 1005--- 1006 1007<a name="SkPixmap_addr16"></a> 1008## addr16 1009 1010<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1011const uint16_t* addr16() const 1012</pre> 1013 1014Returns readable base pixel address. Result is addressable as unsigned 16-bit words. 1015Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGB 565 SkColorType</a> or 1016<a href="SkImageInfo_Reference#SkColorType">kARGB 4444 SkColorType</a>, and is built with SK_DEBUG defined. 1017 1018One word corresponds to one pixel. 1019 1020### Return Value 1021 1022readable unsigned 16-bit pointer to pixels 1023 1024### Example 1025 1026<div><fiddle-embed name="9b16012d265c954c6de13f3fc960da52"> 1027 1028#### Example Output 1029 1030~~~~ 1031pixmap.addr16() == storage 1032~~~~ 1033 1034</fiddle-embed></div> 1035 1036### See Also 1037 1038<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr16">writable addr16</a> 1039 1040--- 1041 1042<a name="SkPixmap_addr32"></a> 1043## addr32 1044 1045<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1046const uint32_t* addr32() const 1047</pre> 1048 1049Returns readable base pixel address. Result is addressable as unsigned 32-bit words. 1050Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGBA 8888 SkColorType</a> or 1051<a href="SkImageInfo_Reference#SkColorType">kBGRA 8888 SkColorType</a>, and is built with SK_DEBUG defined. 1052 1053One word corresponds to one pixel. 1054 1055### Return Value 1056 1057readable unsigned 32-bit pointer to pixels 1058 1059### Example 1060 1061<div><fiddle-embed name="6b90c7ae9f254fe4ea9ef638f893a3e6"> 1062 1063#### Example Output 1064 1065~~~~ 1066pixmap.addr32() == storage 1067~~~~ 1068 1069</fiddle-embed></div> 1070 1071### See Also 1072 1073<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr32">writable addr32</a> 1074 1075--- 1076 1077<a name="SkPixmap_addr64"></a> 1078## addr64 1079 1080<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1081const uint64_t* addr64() const 1082</pre> 1083 1084Returns readable base pixel address. Result is addressable as unsigned 64-bit words. 1085Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGBA F16 SkColorType</a> and is built 1086with SK_DEBUG defined. 1087 1088One word corresponds to one pixel. 1089 1090### Return Value 1091 1092readable unsigned 64-bit pointer to pixels 1093 1094### Example 1095 1096<div><fiddle-embed name="0d17085a4698a8a2e2235fad9041b4b4"> 1097 1098#### Example Output 1099 1100~~~~ 1101pixmap.addr64() == storage 1102~~~~ 1103 1104</fiddle-embed></div> 1105 1106### See Also 1107 1108<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr64">writable addr64</a> 1109 1110--- 1111 1112<a name="SkPixmap_addrF16"></a> 1113## addrF16 1114 1115<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1116const uint16_t* addrF16() const 1117</pre> 1118 1119Returns readable base pixel address. Result is addressable as unsigned 16-bit words. 1120Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGBA F16 SkColorType</a> and is built 1121with SK_DEBUG defined. 1122 1123Each word represents one color component encoded as a half float. 1124Four words correspond to one pixel. 1125 1126### Return Value 1127 1128readable unsigned 16-bit pointer to first component of pixels 1129 1130### Example 1131 1132<div><fiddle-embed name="54e8525a592f05623c33b375aebc90c1"> 1133 1134#### Example Output 1135 1136~~~~ 1137pixmap.addrF16() == storage 1138~~~~ 1139 1140</fiddle-embed></div> 1141 1142### See Also 1143 1144<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addrF16">writable addrF16</a> 1145 1146--- 1147 1148<a name="SkPixmap_addr8_2"></a> 1149 1150<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1151const uint8_t* addr8(int x, int y) const 1152</pre> 1153 1154Returns readable pixel address at (<a href="#SkPixmap_addr8_2_x">x</a>, <a href="#SkPixmap_addr8_2_y">y</a>). 1155 1156Input is not validated: out of bounds values of <a href="#SkPixmap_addr8_2_x">x</a> or <a href="#SkPixmap_addr8_2_y">y</a> trigger an assert() if 1157built with SK_DEBUG defined. 1158 1159Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a> or 1160<a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, and is built with SK_DEBUG defined. 1161 1162### Parameters 1163 1164<table> <tr> <td><a name="SkPixmap_addr8_2_x"> <code><strong>x </strong></code> </a></td> <td> 1165column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1166 </tr> <tr> <td><a name="SkPixmap_addr8_2_y"> <code><strong>y </strong></code> </a></td> <td> 1167row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1168 </tr> 1169</table> 1170 1171### Return Value 1172 1173readable unsigned 8-bit pointer to pixel at (<a href="#SkPixmap_addr8_2_x">x</a>, <a href="#SkPixmap_addr8_2_y">y</a>) 1174 1175### Example 1176 1177<div><fiddle-embed name="5b986272268ef2c52045c1856f8b6107"> 1178 1179#### Example Output 1180 1181~~~~ 1182pixmap.addr8(1, 2) == &storage[1 + 2 * w] 1183~~~~ 1184 1185</fiddle-embed></div> 1186 1187### See Also 1188 1189<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr8">writable addr8</a> 1190 1191--- 1192 1193<a name="SkPixmap_addr16_2"></a> 1194 1195<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1196const uint16_t* addr16(int x, int y) const 1197</pre> 1198 1199Returns readable pixel address at (<a href="#SkPixmap_addr16_2_x">x</a>, <a href="#SkPixmap_addr16_2_y">y</a>). 1200 1201Input is not validated: out of bounds values of <a href="#SkPixmap_addr16_2_x">x</a> or <a href="#SkPixmap_addr16_2_y">y</a> trigger an assert() if 1202built with SK_DEBUG defined. 1203 1204Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGB 565 SkColorType</a> or 1205<a href="SkImageInfo_Reference#SkColorType">kARGB 4444 SkColorType</a>, and is built with SK_DEBUG defined. 1206 1207### Parameters 1208 1209<table> <tr> <td><a name="SkPixmap_addr16_2_x"> <code><strong>x </strong></code> </a></td> <td> 1210column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1211 </tr> <tr> <td><a name="SkPixmap_addr16_2_y"> <code><strong>y </strong></code> </a></td> <td> 1212row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1213 </tr> 1214</table> 1215 1216### Return Value 1217 1218readable unsigned 16-bit pointer to pixel at (<a href="#SkPixmap_addr16_2_x">x</a>, <a href="#SkPixmap_addr16_2_y">y</a>) 1219 1220### Example 1221 1222<div><fiddle-embed name="2c0c88a546d4ef093ab63ff72dac00b9"> 1223 1224#### Example Output 1225 1226~~~~ 1227pixmap.addr16(1, 2) == &storage[1 + 2 * w] 1228~~~~ 1229 1230</fiddle-embed></div> 1231 1232### See Also 1233 1234<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr16">writable addr16</a> 1235 1236--- 1237 1238<a name="SkPixmap_addr32_2"></a> 1239 1240<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1241const uint32_t* addr32(int x, int y) const 1242</pre> 1243 1244Returns readable pixel address at (<a href="#SkPixmap_addr32_2_x">x</a>, <a href="#SkPixmap_addr32_2_y">y</a>). 1245 1246Input is not validated: out of bounds values of <a href="#SkPixmap_addr32_2_x">x</a> or <a href="#SkPixmap_addr32_2_y">y</a> trigger an assert() if 1247built with SK_DEBUG defined. 1248 1249Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGBA 8888 SkColorType</a> or 1250<a href="SkImageInfo_Reference#SkColorType">kBGRA 8888 SkColorType</a>, and is built with SK_DEBUG defined. 1251 1252### Parameters 1253 1254<table> <tr> <td><a name="SkPixmap_addr32_2_x"> <code><strong>x </strong></code> </a></td> <td> 1255column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1256 </tr> <tr> <td><a name="SkPixmap_addr32_2_y"> <code><strong>y </strong></code> </a></td> <td> 1257row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1258 </tr> 1259</table> 1260 1261### Return Value 1262 1263readable unsigned 32-bit pointer to pixel at (<a href="#SkPixmap_addr32_2_x">x</a>, <a href="#SkPixmap_addr32_2_y">y</a>) 1264 1265### Example 1266 1267<div><fiddle-embed name="12f8b5ce9fb25604f33df336677f5d62"> 1268 1269#### Example Output 1270 1271~~~~ 1272pixmap.addr32(1, 2) == &storage[1 + 2 * w] 1273~~~~ 1274 1275</fiddle-embed></div> 1276 1277### See Also 1278 1279<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr64">writable addr64</a> 1280 1281--- 1282 1283<a name="SkPixmap_addr64_2"></a> 1284 1285<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1286const uint64_t* addr64(int x, int y) const 1287</pre> 1288 1289Returns readable pixel address at (<a href="#SkPixmap_addr64_2_x">x</a>, <a href="#SkPixmap_addr64_2_y">y</a>). 1290 1291Input is not validated: out of bounds values of <a href="#SkPixmap_addr64_2_x">x</a> or <a href="#SkPixmap_addr64_2_y">y</a> trigger an assert() if 1292built with SK_DEBUG defined. 1293 1294Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGBA F16 SkColorType</a> and is built 1295with SK_DEBUG defined. 1296 1297### Parameters 1298 1299<table> <tr> <td><a name="SkPixmap_addr64_2_x"> <code><strong>x </strong></code> </a></td> <td> 1300column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1301 </tr> <tr> <td><a name="SkPixmap_addr64_2_y"> <code><strong>y </strong></code> </a></td> <td> 1302row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1303 </tr> 1304</table> 1305 1306### Return Value 1307 1308readable unsigned 64-bit pointer to pixel at (<a href="#SkPixmap_addr64_2_x">x</a>, <a href="#SkPixmap_addr64_2_y">y</a>) 1309 1310### Example 1311 1312<div><fiddle-embed name="5449f65fd7673273b0b57807fd3117ff"> 1313 1314#### Example Output 1315 1316~~~~ 1317pixmap.addr64(1, 2) == &storage[1 + 2 * w] 1318~~~~ 1319 1320</fiddle-embed></div> 1321 1322### See Also 1323 1324<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr64">writable addr64</a> 1325 1326--- 1327 1328<a name="SkPixmap_addrF16_2"></a> 1329 1330<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1331const uint16_t* addrF16(int x, int y) const 1332</pre> 1333 1334Returns readable pixel address at (<a href="#SkPixmap_addrF16_2_x">x</a>, <a href="#SkPixmap_addrF16_2_y">y</a>). 1335 1336Input is not validated: out of bounds values of <a href="#SkPixmap_addrF16_2_x">x</a> or <a href="#SkPixmap_addrF16_2_y">y</a> trigger an assert() if 1337built with SK_DEBUG defined. 1338 1339Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGBA F16 SkColorType</a> and is built 1340with SK_DEBUG defined. 1341 1342Each unsigned 16-bit word represents one color component encoded as a half float. 1343Four words correspond to one pixel. 1344 1345### Parameters 1346 1347<table> <tr> <td><a name="SkPixmap_addrF16_2_x"> <code><strong>x </strong></code> </a></td> <td> 1348column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1349 </tr> <tr> <td><a name="SkPixmap_addrF16_2_y"> <code><strong>y </strong></code> </a></td> <td> 1350row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1351 </tr> 1352</table> 1353 1354### Return Value 1355 1356readable unsigned 16-bit pointer to pixel component at (<a href="#SkPixmap_addrF16_2_x">x</a>, <a href="#SkPixmap_addrF16_2_y">y</a>) 1357 1358### Example 1359 1360<div><fiddle-embed name="f6076cad455bc80af5d06eb121d3b6f2"> 1361 1362#### Example Output 1363 1364~~~~ 1365pixmap.addrF16(1, 2) == &storage[1 * wordsPerPixel + 2 * rowWords] 1366~~~~ 1367 1368</fiddle-embed></div> 1369 1370### See Also 1371 1372<a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> <a href="#SkPixmap_getColor">getColor</a> <a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addrF16">writable addrF16</a> 1373 1374--- 1375 1376## <a name="Writable_Address"></a> Writable Address 1377 1378<a name="SkPixmap_writable_addr"></a> 1379## writable_addr 1380 1381<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1382void* writable_addr() const 1383</pre> 1384 1385Returns writable base pixel address. 1386 1387### Return Value 1388 1389writable generic base pointer to pixels 1390 1391### Example 1392 1393<div><fiddle-embed name="74ef460f89ed5904334d0f8883e781c4"> 1394 1395#### Example Output 1396 1397~~~~ 1398pixmap.writable_addr() == (void *)storage 1399pixmap.getColor(0, 1) == 0x00000000 1400pixmap.getColor(0, 0) == 0xFFFFFFFF 1401~~~~ 1402 1403</fiddle-embed></div> 1404 1405### See Also 1406 1407<a href="#SkPixmap_writable_addr8">writable addr8</a> <a href="#SkPixmap_writable_addr16">writable addr16</a> <a href="#SkPixmap_writable_addr32">writable addr32</a> <a href="#SkPixmap_writable_addr64">writable addr64</a> <a href="#SkPixmap_writable_addrF16">writable addrF16</a> <a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> 1408 1409--- 1410 1411<a name="SkPixmap_writable_addr_2"></a> 1412 1413<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1414void* writable_addr(int x, int y) const 1415</pre> 1416 1417Returns writable pixel address at (<a href="#SkPixmap_writable_addr_2_x">x</a>, <a href="#SkPixmap_writable_addr_2_y">y</a>). 1418 1419Input is not validated: out of bounds values of <a href="#SkPixmap_writable_addr_2_x">x</a> or <a href="#SkPixmap_writable_addr_2_y">y</a> trigger an assert() if 1420built with SK_DEBUG defined. Returns zero if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>. 1421 1422### Parameters 1423 1424<table> <tr> <td><a name="SkPixmap_writable_addr_2_x"> <code><strong>x </strong></code> </a></td> <td> 1425column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1426 </tr> <tr> <td><a name="SkPixmap_writable_addr_2_y"> <code><strong>y </strong></code> </a></td> <td> 1427row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1428 </tr> 1429</table> 1430 1431### Return Value 1432 1433writable generic pointer to pixel 1434 1435### Example 1436 1437<div><fiddle-embed name="559eaca89c765bc8466ea1ba3331d4db"> 1438 1439#### Example Output 1440 1441~~~~ 1442pixmap.writable_addr() == (void *)storage 1443pixmap.getColor(0, 0) == 0x00000000 1444pixmap.getColor(1, 2) == 0xFFFFFFFF 1445~~~~ 1446 1447</fiddle-embed></div> 1448 1449### See Also 1450 1451<a href="#SkPixmap_writable_addr8">writable addr8</a> <a href="#SkPixmap_writable_addr16">writable addr16</a> <a href="#SkPixmap_writable_addr32">writable addr32</a> <a href="#SkPixmap_writable_addr64">writable addr64</a> <a href="#SkPixmap_writable_addrF16">writable addrF16</a> <a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> 1452 1453--- 1454 1455<a name="SkPixmap_writable_addr8"></a> 1456## writable_addr8 1457 1458<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1459uint8_t* writable_addr8(int x, int y) const 1460</pre> 1461 1462Returns writable pixel address at (<a href="#SkPixmap_writable_addr8_x">x</a>, <a href="#SkPixmap_writable_addr8_y">y</a>). Result is addressable as unsigned 14638-bit bytes. Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a> 1464or <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, and is built with SK_DEBUG defined. 1465 1466One byte corresponds to one pixel. 1467 1468### Parameters 1469 1470<table> <tr> <td><a name="SkPixmap_writable_addr8_x"> <code><strong>x </strong></code> </a></td> <td> 1471column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1472 </tr> <tr> <td><a name="SkPixmap_writable_addr8_y"> <code><strong>y </strong></code> </a></td> <td> 1473row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1474 </tr> 1475</table> 1476 1477### Return Value 1478 1479writable unsigned 8-bit pointer to pixels 1480 1481### Example 1482 1483<div><fiddle-embed name="809284db136748208b3efc31cd89de29"><div>Altering pixels after drawing <a href="SkBitmap_Reference#Bitmap">Bitmap</a> is not guaranteed to affect subsequent 1484drawing on all platforms. Adding a second <a href="#SkBitmap_installPixels">SkBitmap::installPixels</a> after editing 1485pixel memory is safer.</div></fiddle-embed></div> 1486 1487### See Also 1488 1489<a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr16">writable addr16</a> <a href="#SkPixmap_writable_addr32">writable addr32</a> <a href="#SkPixmap_writable_addr64">writable addr64</a> <a href="#SkPixmap_writable_addrF16">writable addrF16</a> <a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr8">addr8</a><sup><a href="#SkPixmap_addr8_2">[2]</a></sup> 1490 1491--- 1492 1493<a name="SkPixmap_writable_addr16"></a> 1494## writable_addr16 1495 1496<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1497uint16_t* writable_addr16(int x, int y) const 1498</pre> 1499 1500Returns <a href="#SkPixmap_writable_addr">writable addr</a> pixel address at (<a href="#SkPixmap_writable_addr16_x">x</a>, <a href="#SkPixmap_writable_addr16_y">y</a>). Result is addressable as unsigned 150116-bit words. Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not <a href="SkImageInfo_Reference#SkColorType">kRGB 565 SkColorType</a> 1502or <a href="SkImageInfo_Reference#SkColorType">kARGB 4444 SkColorType</a>, and is built with SK_DEBUG defined. 1503 1504One word corresponds to one pixel. 1505 1506### Parameters 1507 1508<table> <tr> <td><a name="SkPixmap_writable_addr16_x"> <code><strong>x </strong></code> </a></td> <td> 1509column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1510 </tr> <tr> <td><a name="SkPixmap_writable_addr16_y"> <code><strong>y </strong></code> </a></td> <td> 1511row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1512 </tr> 1513</table> 1514 1515### Return Value 1516 1517writable unsigned 16-bit pointer to pixel 1518 1519### Example 1520 1521<div><fiddle-embed name="6da54774f6432b46b47ea9013c15f280"><div>Draw a five by five bitmap, and draw it again with a center black pixel. 1522The low nibble of the 16-bit word is <a href="#Alpha">Alpha</a>.</div></fiddle-embed></div> 1523 1524### See Also 1525 1526<a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr8">writable addr8</a> <a href="#SkPixmap_writable_addr32">writable addr32</a> <a href="#SkPixmap_writable_addr64">writable addr64</a> <a href="#SkPixmap_writable_addrF16">writable addrF16</a> <a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr16">addr16</a><sup><a href="#SkPixmap_addr16_2">[2]</a></sup> 1527 1528--- 1529 1530<a name="SkPixmap_writable_addr32"></a> 1531## writable_addr32 1532 1533<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1534uint32_t* writable_addr32(int x, int y) const 1535</pre> 1536 1537Returns writable pixel address at (<a href="#SkPixmap_writable_addr32_x">x</a>, <a href="#SkPixmap_writable_addr32_y">y</a>). Result is addressable as unsigned 153832-bit words. Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not 1539<a href="SkImageInfo_Reference#SkColorType">kRGBA 8888 SkColorType</a> or <a href="SkImageInfo_Reference#SkColorType">kBGRA 8888 SkColorType</a>, and is built with SK_DEBUG 1540defined. 1541 1542One word corresponds to one pixel. 1543 1544### Parameters 1545 1546<table> <tr> <td><a name="SkPixmap_writable_addr32_x"> <code><strong>x </strong></code> </a></td> <td> 1547column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1548 </tr> <tr> <td><a name="SkPixmap_writable_addr32_y"> <code><strong>y </strong></code> </a></td> <td> 1549row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1550 </tr> 1551</table> 1552 1553### Return Value 1554 1555writable unsigned 32-bit pointer to pixel 1556 1557### Example 1558 1559<div><fiddle-embed name="f4fdce206b8c0a4e79f0a9f52b7f47a6"></fiddle-embed></div> 1560 1561### See Also 1562 1563<a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr8">writable addr8</a> <a href="#SkPixmap_writable_addr16">writable addr16</a> <a href="#SkPixmap_writable_addr64">writable addr64</a> <a href="#SkPixmap_writable_addrF16">writable addrF16</a> <a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr32">addr32</a><sup><a href="#SkPixmap_addr32_2">[2]</a></sup> 1564 1565--- 1566 1567<a name="SkPixmap_writable_addr64"></a> 1568## writable_addr64 1569 1570<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1571uint64_t* writable_addr64(int x, int y) const 1572</pre> 1573 1574Returns writable pixel address at (<a href="#SkPixmap_writable_addr64_x">x</a>, <a href="#SkPixmap_writable_addr64_y">y</a>). Result is addressable as unsigned 157564-bit words. Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not 1576<a href="SkImageInfo_Reference#SkColorType">kRGBA F16 SkColorType</a> and is built with SK_DEBUG defined. 1577 1578One word corresponds to one pixel. 1579 1580### Parameters 1581 1582<table> <tr> <td><a name="SkPixmap_writable_addr64_x"> <code><strong>x </strong></code> </a></td> <td> 1583column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1584 </tr> <tr> <td><a name="SkPixmap_writable_addr64_y"> <code><strong>y </strong></code> </a></td> <td> 1585row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1586 </tr> 1587</table> 1588 1589### Return Value 1590 1591writable unsigned 64-bit pointer to pixel 1592 1593### Example 1594 1595<div><fiddle-embed name="de14d8d30e4a7b6462103d0e0dd96b0b"></fiddle-embed></div> 1596 1597### See Also 1598 1599<a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr8">writable addr8</a> <a href="#SkPixmap_writable_addr16">writable addr16</a> <a href="#SkPixmap_writable_addr32">writable addr32</a> <a href="#SkPixmap_writable_addrF16">writable addrF16</a> <a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addr64">addr64</a><sup><a href="#SkPixmap_addr64_2">[2]</a></sup> 1600 1601--- 1602 1603<a name="SkPixmap_writable_addrF16"></a> 1604## writable_addrF16 1605 1606<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1607uint16_t* writable_addrF16(int x, int y) const 1608</pre> 1609 1610Returns writable pixel address at (<a href="#SkPixmap_writable_addrF16_x">x</a>, <a href="#SkPixmap_writable_addrF16_y">y</a>). Result is addressable as unsigned 161116-bit words. Will trigger an assert() if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is not 1612<a href="SkImageInfo_Reference#SkColorType">kRGBA F16 SkColorType</a> and is built with SK_DEBUG defined. 1613 1614Each word represents one color component encoded as a half float. 1615Four words correspond to one pixel. 1616 1617### Parameters 1618 1619<table> <tr> <td><a name="SkPixmap_writable_addrF16_x"> <code><strong>x </strong></code> </a></td> <td> 1620column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td> 1621 </tr> <tr> <td><a name="SkPixmap_writable_addrF16_y"> <code><strong>y </strong></code> </a></td> <td> 1622row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td> 1623 </tr> 1624</table> 1625 1626### Return Value 1627 1628writable unsigned 16-bit pointer to first component of pixel 1629 1630### Example 1631 1632<div><fiddle-embed name="7822d78f5cacf5c04267cbbc6c6d0b80"><div>Left bitmap is drawn with two pixels defined in half float format. Right bitmap 1633is drawn after overwriting bottom half float color with top half float color.</div></fiddle-embed></div> 1634 1635### See Also 1636 1637<a href="#SkPixmap_writable_addr">writable addr</a><sup><a href="#SkPixmap_writable_addr_2">[2]</a></sup> <a href="#SkPixmap_writable_addr8">writable addr8</a> <a href="#SkPixmap_writable_addr16">writable addr16</a> <a href="#SkPixmap_writable_addr32">writable addr32</a> <a href="#SkPixmap_writable_addr64">writable addr64</a> <a href="#SkPixmap_addr">addr</a><sup><a href="#SkPixmap_addr_2">[2]</a></sup> <a href="#SkPixmap_addrF16">addrF16</a><sup><a href="#SkPixmap_addrF16_2">[2]</a></sup> 1638 1639--- 1640 1641## <a name="Writer"></a> Writer 1642 1643<a name="SkPixmap_readPixels"></a> 1644## readPixels 1645 1646<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1647bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY, 1648 SkTransferFunctionBehavior behavior) const 1649</pre> 1650 1651Copies 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 1652exceed <a href="#Pixmap">Pixmap</a> (<a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>). 1653 1654<a href="#SkPixmap_readPixels_dstInfo">dstInfo</a> specifies width, height, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, and 1655<a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_dstRowBytes">dstRowBytes</a> specifics the gap from one destination 1656row to the next. Returns true if pixels are copied. Returns false if 1657<a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_dstRowBytes">dstRowBytes</a> is less than <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="SkImageInfo_Reference#SkImageInfo">minRowBytes</a>. 1658 1659Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is 1660<a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, or <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorType">colorType</a> must match. 1661If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. 1662If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="SkImageInfo_Reference#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must 1663match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns 1664false if pixel conversion is not possible. 1665<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 1666false if <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Returns false if: 1667 1668abs(srcX) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a>, 1669or ifabs(srcY) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_height">height</a>. 1670 1671If <a href="#SkPixmap_readPixels_behavior">behavior</a> is <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts source 1672pixels to a linear space before converting to <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>. 1673If <a href="#SkPixmap_readPixels_behavior">behavior</a> is <a href="#SkTransferFunctionBehavior_kIgnore">SkTransferFunctionBehavior::kIgnore</a>: source 1674pixels are treated as if they are linear, regardless of how they are encoded. 1675 1676### Parameters 1677 1678<table> <tr> <td><a name="SkPixmap_readPixels_dstInfo"> <code><strong>dstInfo </strong></code> </a></td> <td> 1679destination width, height, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Space">Color Space</a></td> 1680 </tr> <tr> <td><a name="SkPixmap_readPixels_dstPixels"> <code><strong>dstPixels </strong></code> </a></td> <td> 1681destination pixel storage</td> 1682 </tr> <tr> <td><a name="SkPixmap_readPixels_dstRowBytes"> <code><strong>dstRowBytes </strong></code> </a></td> <td> 1683destination row length</td> 1684 </tr> <tr> <td><a name="SkPixmap_readPixels_srcX"> <code><strong>srcX </strong></code> </a></td> <td> 1685column index whose absolute value is less than <a href="#SkPixmap_width">width</a></td> 1686 </tr> <tr> <td><a name="SkPixmap_readPixels_srcY"> <code><strong>srcY </strong></code> </a></td> <td> 1687row index whose absolute value is less than <a href="#SkPixmap_height">height</a></td> 1688 </tr> <tr> <td><a name="SkPixmap_readPixels_behavior"> <code><strong>behavior </strong></code> </a></td> <td> 1689one of: <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>, 1690<a href="#SkTransferFunctionBehavior_kIgnore">SkTransferFunctionBehavior::kIgnore</a></td> 1691 </tr> 1692</table> 1693 1694### Return Value 1695 1696true if pixels are copied to <a href="#SkPixmap_readPixels_dstPixels">dstPixels</a> 1697 1698### Example 1699 1700<div><fiddle-embed name="2b7f6cc59ea2d5ebceddccbc2f232bcf"></fiddle-embed></div> 1701 1702### See Also 1703 1704<a href="#SkPixmap_erase">erase</a><sup><a href="#SkPixmap_erase_2">[2]</a></sup><sup><a href="#SkPixmap_erase_3">[3]</a></sup> <a href="#SkBitmap_readPixels">SkBitmap::readPixels</a><sup><a href="#SkBitmap_readPixels_2">[2]</a></sup><sup><a href="#SkBitmap_readPixels_3">[3]</a></sup><sup><a href="#SkBitmap_readPixels_4">[4]</a></sup> <a href="#SkCanvas_drawBitmap">SkCanvas::drawBitmap</a> <a href="#SkCanvas_readPixels">SkCanvas::readPixels</a><sup><a href="#SkCanvas_readPixels_2">[2]</a></sup><sup><a href="#SkCanvas_readPixels_3">[3]</a></sup> <a href="#SkImage_readPixels">SkImage::readPixels</a><sup><a href="#SkImage_readPixels_2">[2]</a></sup> <a href="#SkSurface_readPixels">SkSurface::readPixels</a><sup><a href="#SkSurface_readPixels_2">[2]</a></sup><sup><a href="#SkSurface_readPixels_3">[3]</a></sup> 1705 1706--- 1707 1708<a name="SkPixmap_readPixels_2"></a> 1709 1710<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1711bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes) const 1712</pre> 1713 1714Copies 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 1715exceed <a href="#Pixmap">Pixmap</a> (<a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>). 1716 1717<a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a> specifies width, height, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, and 1718<a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_2_dstRowBytes">dstRowBytes</a> specifics the gap from one destination 1719row to the next. Returns true if pixels are copied. Returns false if 1720<a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_2_dstRowBytes">dstRowBytes</a> is less than <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="SkImageInfo_Reference#SkImageInfo">minRowBytes</a>. 1721 1722Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is 1723<a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, or <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorType">colorType</a> must match. 1724If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. 1725If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="SkImageInfo_Reference#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must 1726match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns 1727false if pixel conversion is not possible. 1728 1729Returns false if <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. 1730 1731### Parameters 1732 1733<table> <tr> <td><a name="SkPixmap_readPixels_2_dstInfo"> <code><strong>dstInfo </strong></code> </a></td> <td> 1734destination width, height, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Space">Color Space</a></td> 1735 </tr> <tr> <td><a name="SkPixmap_readPixels_2_dstPixels"> <code><strong>dstPixels </strong></code> </a></td> <td> 1736destination pixel storage</td> 1737 </tr> <tr> <td><a name="SkPixmap_readPixels_2_dstRowBytes"> <code><strong>dstRowBytes </strong></code> </a></td> <td> 1738destination row length</td> 1739 </tr> 1740</table> 1741 1742### Return Value 1743 1744true if pixels are copied to <a href="#SkPixmap_readPixels_2_dstPixels">dstPixels</a> 1745 1746### Example 1747 1748<div><fiddle-embed name="df4e355c4845350daede833b4fd21ec1"><div>Transferring the gradient from 8 bits per component to 4 bits per component 1749creates visible banding.</div></fiddle-embed></div> 1750 1751### See Also 1752 1753<a href="#SkPixmap_erase">erase</a><sup><a href="#SkPixmap_erase_2">[2]</a></sup><sup><a href="#SkPixmap_erase_3">[3]</a></sup> <a href="#SkBitmap_readPixels">SkBitmap::readPixels</a><sup><a href="#SkBitmap_readPixels_2">[2]</a></sup><sup><a href="#SkBitmap_readPixels_3">[3]</a></sup><sup><a href="#SkBitmap_readPixels_4">[4]</a></sup> <a href="#SkCanvas_drawBitmap">SkCanvas::drawBitmap</a> <a href="#SkCanvas_readPixels">SkCanvas::readPixels</a><sup><a href="#SkCanvas_readPixels_2">[2]</a></sup><sup><a href="#SkCanvas_readPixels_3">[3]</a></sup> <a href="#SkImage_readPixels">SkImage::readPixels</a><sup><a href="#SkImage_readPixels_2">[2]</a></sup> <a href="#SkSurface_readPixels">SkSurface::readPixels</a><sup><a href="#SkSurface_readPixels_2">[2]</a></sup><sup><a href="#SkSurface_readPixels_3">[3]</a></sup> 1754 1755--- 1756 1757<a name="SkPixmap_readPixels_3"></a> 1758 1759<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1760bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY) const 1761</pre> 1762 1763Copies 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 1764exceed <a href="#Pixmap">Pixmap</a> (<a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>). 1765 1766<a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a> specifies width, height, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, and 1767<a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_3_dstRowBytes">dstRowBytes</a> specifics the gap from one destination 1768row to the next. Returns true if pixels are copied. Returns false if 1769<a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_3_dstRowBytes">dstRowBytes</a> is less than <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="SkImageInfo_Reference#SkImageInfo">minRowBytes</a>. 1770 1771Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is 1772<a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, or <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorType">colorType</a> must match. 1773If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. 1774If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="SkImageInfo_Reference#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_alphaType">alphaType</a> must 1775match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns 1776false if pixel conversion is not possible. 1777<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 1778false if <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Returns false if: 1779 1780abs(srcX) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a>, 1781or ifabs(srcY) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_height">height</a>. 1782 1783### Parameters 1784 1785<table> <tr> <td><a name="SkPixmap_readPixels_3_dstInfo"> <code><strong>dstInfo </strong></code> </a></td> <td> 1786destination width, height, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Space">Color Space</a></td> 1787 </tr> <tr> <td><a name="SkPixmap_readPixels_3_dstPixels"> <code><strong>dstPixels </strong></code> </a></td> <td> 1788destination pixel storage</td> 1789 </tr> <tr> <td><a name="SkPixmap_readPixels_3_dstRowBytes"> <code><strong>dstRowBytes </strong></code> </a></td> <td> 1790destination row length</td> 1791 </tr> <tr> <td><a name="SkPixmap_readPixels_3_srcX"> <code><strong>srcX </strong></code> </a></td> <td> 1792column index whose absolute value is less than <a href="#SkPixmap_width">width</a></td> 1793 </tr> <tr> <td><a name="SkPixmap_readPixels_3_srcY"> <code><strong>srcY </strong></code> </a></td> <td> 1794row index whose absolute value is less than <a href="#SkPixmap_height">height</a></td> 1795 </tr> 1796</table> 1797 1798### Return Value 1799 1800true if pixels are copied to <a href="#SkPixmap_readPixels_3_dstPixels">dstPixels</a> 1801 1802### Example 1803 1804<div><fiddle-embed name="094ca0bd37588cc7be241bb387a3e17b"></fiddle-embed></div> 1805 1806### See Also 1807 1808<a href="#SkPixmap_erase">erase</a><sup><a href="#SkPixmap_erase_2">[2]</a></sup><sup><a href="#SkPixmap_erase_3">[3]</a></sup> <a href="#SkBitmap_readPixels">SkBitmap::readPixels</a><sup><a href="#SkBitmap_readPixels_2">[2]</a></sup><sup><a href="#SkBitmap_readPixels_3">[3]</a></sup><sup><a href="#SkBitmap_readPixels_4">[4]</a></sup> <a href="#SkCanvas_drawBitmap">SkCanvas::drawBitmap</a> <a href="#SkCanvas_readPixels">SkCanvas::readPixels</a><sup><a href="#SkCanvas_readPixels_2">[2]</a></sup><sup><a href="#SkCanvas_readPixels_3">[3]</a></sup> <a href="#SkImage_readPixels">SkImage::readPixels</a><sup><a href="#SkImage_readPixels_2">[2]</a></sup> <a href="#SkSurface_readPixels">SkSurface::readPixels</a><sup><a href="#SkSurface_readPixels_2">[2]</a></sup><sup><a href="#SkSurface_readPixels_3">[3]</a></sup> 1809 1810--- 1811 1812<a name="SkPixmap_readPixels_4"></a> 1813 1814<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1815bool readPixels(const SkPixmap& dst, int srcX, int srcY) const 1816</pre> 1817 1818Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_4_dst">dst</a>. Copy starts at (<a href="#SkPixmap_readPixels_4_srcX">srcX</a>, <a href="#SkPixmap_readPixels_4_srcY">srcY</a>), and does not 1819exceed <a href="#Pixmap">Pixmap</a> (<a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>). <a href="#SkPixmap_readPixels_4_dst">dst</a> specifies width, height, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, 1820<a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of destination. Returns true if pixels are copied. 1821Returns false if <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_rowBytes">rowBytes</a> is less than 1822<a href="#SkPixmap_readPixels_4_dst">dst</a> <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>. 1823 1824Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is 1825<a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, or <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorType">colorType</a> must match. 1826If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. 1827If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="SkImageInfo_Reference#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_alphaType">alphaType</a> must 1828match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns 1829false if pixel conversion is not possible. 1830<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 1831false <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Returns false if: 1832 1833abs(srcX) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a>, 1834or ifabs(srcY) >= <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_height">height</a>. 1835 1836### Parameters 1837 1838<table> <tr> <td><a name="SkPixmap_readPixels_4_dst"> <code><strong>dst </strong></code> </a></td> <td> 1839<a href="SkImageInfo_Reference#Image_Info">Image Info</a> and pixel address to write to</td> 1840 </tr> <tr> <td><a name="SkPixmap_readPixels_4_srcX"> <code><strong>srcX </strong></code> </a></td> <td> 1841column index whose absolute value is less than <a href="#SkPixmap_width">width</a></td> 1842 </tr> <tr> <td><a name="SkPixmap_readPixels_4_srcY"> <code><strong>srcY </strong></code> </a></td> <td> 1843row index whose absolute value is less than <a href="#SkPixmap_height">height</a></td> 1844 </tr> 1845</table> 1846 1847### Return Value 1848 1849true if pixels are copied to <a href="#SkPixmap_readPixels_4_dst">dst</a> 1850 1851### Example 1852 1853<div><fiddle-embed name="6ec7f7b2cc163cd29f627eef6d4b061c"></fiddle-embed></div> 1854 1855### See Also 1856 1857<a href="#SkPixmap_erase">erase</a><sup><a href="#SkPixmap_erase_2">[2]</a></sup><sup><a href="#SkPixmap_erase_3">[3]</a></sup> <a href="#SkBitmap_readPixels">SkBitmap::readPixels</a><sup><a href="#SkBitmap_readPixels_2">[2]</a></sup><sup><a href="#SkBitmap_readPixels_3">[3]</a></sup><sup><a href="#SkBitmap_readPixels_4">[4]</a></sup> <a href="#SkCanvas_drawBitmap">SkCanvas::drawBitmap</a> <a href="#SkCanvas_readPixels">SkCanvas::readPixels</a><sup><a href="#SkCanvas_readPixels_2">[2]</a></sup><sup><a href="#SkCanvas_readPixels_3">[3]</a></sup> <a href="#SkImage_readPixels">SkImage::readPixels</a><sup><a href="#SkImage_readPixels_2">[2]</a></sup> <a href="#SkSurface_readPixels">SkSurface::readPixels</a><sup><a href="#SkSurface_readPixels_2">[2]</a></sup><sup><a href="#SkSurface_readPixels_3">[3]</a></sup> 1858 1859--- 1860 1861<a name="SkPixmap_readPixels_5"></a> 1862 1863<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1864bool readPixels(const SkPixmap& dst) const 1865</pre> 1866 1867Copies pixels inside <a href="#SkPixmap_bounds">bounds</a> to <a href="#SkPixmap_readPixels_5_dst">dst</a>. <a href="#SkPixmap_readPixels_5_dst">dst</a> specifies width, height, <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, 1868<a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, and <a href="undocumented#Color_Space">Color Space</a> of destination. Returns true if pixels are copied. 1869Returns false if <a href="#SkPixmap_readPixels_5_dst">dst</a>.<a href="#SkPixmap_addr">addr</a> equals nullptr, or <a href="#SkPixmap_readPixels_5_dst">dst</a>.<a href="#SkPixmap_rowBytes">rowBytes</a> is less than 1870<a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>. 1871 1872Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is 1873<a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, or <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> must match. 1874If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. 1875If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="SkImageInfo_Reference#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> must 1876match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_5_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns 1877false if pixel conversion is not possible. 1878Returns false if <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. 1879 1880### Parameters 1881 1882<table> <tr> <td><a name="SkPixmap_readPixels_5_dst"> <code><strong>dst </strong></code> </a></td> <td> 1883<a href="SkImageInfo_Reference#Image_Info">Image Info</a> and pixel address to write to</td> 1884 </tr> 1885</table> 1886 1887### Return Value 1888 1889true if pixels are copied to <a href="#SkPixmap_readPixels_5_dst">dst</a> 1890 1891### Example 1892 1893<div><fiddle-embed name="e18549b5ee1039cb61b0bb38c2104fc9"></fiddle-embed></div> 1894 1895### See Also 1896 1897<a href="#SkPixmap_erase">erase</a><sup><a href="#SkPixmap_erase_2">[2]</a></sup><sup><a href="#SkPixmap_erase_3">[3]</a></sup> <a href="#SkBitmap_readPixels">SkBitmap::readPixels</a><sup><a href="#SkBitmap_readPixels_2">[2]</a></sup><sup><a href="#SkBitmap_readPixels_3">[3]</a></sup><sup><a href="#SkBitmap_readPixels_4">[4]</a></sup> <a href="#SkCanvas_drawBitmap">SkCanvas::drawBitmap</a> <a href="#SkCanvas_readPixels">SkCanvas::readPixels</a><sup><a href="#SkCanvas_readPixels_2">[2]</a></sup><sup><a href="#SkCanvas_readPixels_3">[3]</a></sup> <a href="#SkImage_readPixels">SkImage::readPixels</a><sup><a href="#SkImage_readPixels_2">[2]</a></sup> <a href="#SkSurface_readPixels">SkSurface::readPixels</a><sup><a href="#SkSurface_readPixels_2">[2]</a></sup><sup><a href="#SkSurface_readPixels_3">[3]</a></sup> 1898 1899--- 1900 1901<a name="SkPixmap_scalePixels"></a> 1902## scalePixels 1903 1904<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1905bool scalePixels(const SkPixmap& dst, SkFilterQuality filterQuality) const 1906</pre> 1907 1908Copies <a href="SkBitmap_Reference#Bitmap">Bitmap</a> to <a href="#SkPixmap_scalePixels_dst">dst</a>, scaling pixels to fit <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_width">width</a> and <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_height">height</a>, and 1909converting pixels to match <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_colorType">colorType</a> and <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_alphaType">alphaType</a>. Returns true if 1910pixels are copied. Returns false if <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_addr">addr</a> is nullptr, or <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_rowBytes">rowBytes</a> is 1911less than <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>. 1912 1913Pixels are copied only if pixel conversion is possible. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is 1914<a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, or <a href="SkImageInfo_Reference#SkColorType">kAlpha 8 SkColorType</a>; <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> must match. 1915If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kGray 8 SkColorType</a>, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. 1916If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_alphaType">alphaType</a> is <a href="SkImageInfo_Reference#SkAlphaType">kOpaque SkAlphaType</a>, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> must 1917match. If <a href="#Pixmap">Pixmap</a> <a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_scalePixels_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns 1918false if pixel conversion is not possible. 1919 1920Returns false if <a href="SkBitmap_Reference#Bitmap">Bitmap</a> <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. 1921 1922Scales the image, with <a href="#SkPixmap_scalePixels_filterQuality">filterQuality</a>, to match <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_width">width</a> and <a href="#SkPixmap_scalePixels_dst">dst</a>.<a href="#SkPixmap_height">height</a>. 1923<a href="#SkPixmap_scalePixels_filterQuality">filterQuality</a> <a href="undocumented#SkFilterQuality">kNone SkFilterQuality</a> is fastest, typically implemented with 1924<a href="undocumented#Filter_Quality_Nearest_Neighbor">Filter Quality Nearest Neighbor</a>. <a href="undocumented#SkFilterQuality">kLow SkFilterQuality</a> is typically implemented with 1925<a href="undocumented#Filter_Quality_Bilerp">Filter Quality Bilerp</a>. <a href="undocumented#SkFilterQuality">kMedium SkFilterQuality</a> is typically implemented with 1926<a href="undocumented#Filter_Quality_Bilerp">Filter Quality Bilerp</a>, and <a href="undocumented#Filter_Quality_MipMap">Filter Quality MipMap</a> when size is reduced. 1927<a href="undocumented#SkFilterQuality">kHigh SkFilterQuality</a> is slowest, typically implemented with <a href="undocumented#Filter_Quality_BiCubic">Filter Quality BiCubic</a>. 1928 1929### Parameters 1930 1931<table> <tr> <td><a name="SkPixmap_scalePixels_dst"> <code><strong>dst </strong></code> </a></td> <td> 1932<a href="SkImageInfo_Reference#Image_Info">Image Info</a> and pixel address to write to</td> 1933 </tr> <tr> <td><a name="SkPixmap_scalePixels_filterQuality"> <code><strong>filterQuality </strong></code> </a></td> <td> 1934one of: <a href="undocumented#SkFilterQuality">kNone SkFilterQuality</a>, <a href="undocumented#SkFilterQuality">kLow SkFilterQuality</a>, 1935<a href="undocumented#SkFilterQuality">kMedium SkFilterQuality</a>, <a href="undocumented#SkFilterQuality">kHigh SkFilterQuality</a></td> 1936 </tr> 1937</table> 1938 1939### Return Value 1940 1941true if pixels are scaled to fit <a href="#SkPixmap_scalePixels_dst">dst</a> 1942 1943### Example 1944 1945<div><fiddle-embed name="8e3c8a9c1d0d2e9b8bf66e24d274f792"></fiddle-embed></div> 1946 1947### See Also 1948 1949<a href="#SkCanvas_drawBitmap">SkCanvas::drawBitmap</a> <a href="#SkImage_scalePixels">SkImage::scalePixels</a> 1950 1951--- 1952 1953<a name="SkPixmap_erase"></a> 1954## erase 1955 1956<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1957bool erase(SkColor color, const SkIRect& subset) const 1958</pre> 1959 1960Writes <a href="#SkPixmap_erase_color">color</a> to pixels bounded by <a href="#SkPixmap_erase_subset">subset</a>; returns true on success. 1961Returns false if <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>, or if <a href="#SkPixmap_erase_subset">subset</a> does 1962not intersect <a href="#SkPixmap_bounds">bounds</a>. 1963 1964### Parameters 1965 1966<table> <tr> <td><a name="SkPixmap_erase_color"> <code><strong>color </strong></code> </a></td> <td> 1967<a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> to write</td> 1968 </tr> <tr> <td><a name="SkPixmap_erase_subset"> <code><strong>subset </strong></code> </a></td> <td> 1969bounding integer <a href="SkRect_Reference#Rect">Rect</a> of written pixels</td> 1970 </tr> 1971</table> 1972 1973### Return Value 1974 1975true if pixels are changed 1976 1977### Example 1978 1979<div><fiddle-embed name="a0cdbafed4786788cc90681e7b294234"></fiddle-embed></div> 1980 1981### See Also 1982 1983<a href="#SkBitmap_erase">SkBitmap::erase</a> <a href="#SkCanvas_clear">SkCanvas::clear</a> <a href="#SkCanvas_drawColor">SkCanvas::drawColor</a> 1984 1985--- 1986 1987<a name="SkPixmap_erase_2"></a> 1988 1989<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1990bool erase(SkColor color) const 1991</pre> 1992 1993Writes <a href="#SkPixmap_erase_2_color">color</a> to pixels inside <a href="#SkPixmap_bounds">bounds</a>; returns true on success. 1994Returns false if <a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>, or if <a href="#SkPixmap_bounds">bounds</a> 1995is empty. 1996 1997### Parameters 1998 1999<table> <tr> <td><a name="SkPixmap_erase_2_color"> <code><strong>color </strong></code> </a></td> <td> 2000<a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> to write</td> 2001 </tr> 2002</table> 2003 2004### Return Value 2005 2006true if pixels are changed 2007 2008### Example 2009 2010<div><fiddle-embed name="838202e0d49cad2eb3eeb495834f6d63"></fiddle-embed></div> 2011 2012### See Also 2013 2014<a href="#SkBitmap_erase">SkBitmap::erase</a> <a href="#SkCanvas_clear">SkCanvas::clear</a> <a href="#SkCanvas_drawColor">SkCanvas::drawColor</a> 2015 2016--- 2017 2018<a name="SkPixmap_erase_3"></a> 2019 2020<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 2021bool erase(const SkColor4f& color, const SkIRect* subset = nullptr) const 2022</pre> 2023 2024Writes <a href="#SkPixmap_erase_3_color">color</a> to pixels bounded by <a href="#SkPixmap_erase_3_subset">subset</a>; returns true on success. 2025if <a href="#SkPixmap_erase_3_subset">subset</a> is nullptr, writes colors pixels inside <a href="#SkPixmap_bounds">bounds</a>. Returns false if 2026<a href="#SkPixmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#SkColorType">kUnknown SkColorType</a>, if <a href="#SkPixmap_erase_3_subset">subset</a> is not nullptr and does 2027not intersect <a href="#SkPixmap_bounds">bounds</a>, or if <a href="#SkPixmap_erase_3_subset">subset</a> is nullptr and <a href="#SkPixmap_bounds">bounds</a> is empty. 2028 2029### Parameters 2030 2031<table> <tr> <td><a name="SkPixmap_erase_3_color"> <code><strong>color </strong></code> </a></td> <td> 2032<a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> to write</td> 2033 </tr> <tr> <td><a name="SkPixmap_erase_3_subset"> <code><strong>subset </strong></code> </a></td> <td> 2034bounding integer <a href="SkRect_Reference#Rect">Rect</a> of pixels to write; may be nullptr</td> 2035 </tr> 2036</table> 2037 2038### Return Value 2039 2040true if pixels are changed 2041 2042### Example 2043 2044<div><fiddle-embed name="f884f3f46a565f052a5e252ae2f36e9b"></fiddle-embed></div> 2045 2046### See Also 2047 2048<a href="#SkBitmap_erase">SkBitmap::erase</a> <a href="#SkCanvas_clear">SkCanvas::clear</a> <a href="#SkCanvas_drawColor">SkCanvas::drawColor</a> 2049 2050--- 2051 2052