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