<ahref="#Bitmap">Bitmap</a> describes a two-dimensional raster pixel array. <ahref="#Bitmap">Bitmap</a> is built on
<ahref="#Info">Image Info</a>, containing integer <ahref="#SkBitmap_width">width</a> and <ahref="#SkBitmap_height">height</a>, <ahref="undocumented#Color_Type">Color Type</a> and <ahref="undocumented#Alpha_Type">Alpha Type</a>
describing the pixel format, and <ahref="undocumented#Color_Space">Color Space</a> describing the range of colors.
<ahref="#Bitmap">Bitmap</a> points to <ahref="undocumented#Pixel_Ref">Pixel Ref</a>, which describes the physical array of pixels.
<ahref="#Info">Image Info</a><ahref="#SkBitmap_bounds">bounds</a> may be located anywhere fully inside <ahref="undocumented#Pixel_Ref">Pixel Ref</a><ahref="#SkBitmap_bounds">bounds</a>.
<ahref="#Bitmap">Bitmap</a> can be drawn using <ahref="SkCanvas_Reference#Canvas">Canvas</a>. <ahref="#Bitmap">Bitmap</a> can be a drawing destination for <ahref="SkCanvas_Reference#Canvas">Canvas</a>
draw methods. <ahref="#Bitmap">Bitmap</a> flexibility as a pixel container limits some optimizations
available to the target platform.
If pixel array is primarily read-only, use <ahref="undocumented#Image">Image</a> for better performance.
If pixel array is primarily written to, use <ahref="undocumented#Surface">Surface</a> for better performance.
Declaring <ahref="#SkBitmap">SkBitmap</a> const prevents altering <ahref="#Info">Image Info</a>: the <ahref="#Bitmap">Bitmap</a><ahref="#SkBitmap_height">height</a>, <ahref="#SkBitmap_width">width</a>,
and so on cannot change. It does not affect <ahref="undocumented#Pixel_Ref">Pixel Ref</a>: a caller may write its
pixels. Declaring <ahref="#SkBitmap">SkBitmap</a> const affects <ahref="#Bitmap">Bitmap</a> configuration, not its contents.
| <ahref="#SkBitmap_dimensions">dimensions</a> | Returns <ahref="#SkBitmap_width">width</a> and <ahref="#SkBitmap_height">height</a>. |
| <ahref="#SkBitmap_drawsNothing">drawsNothing</a> | Returns true if no <ahref="#SkBitmap_width">width</a>, no <ahref="#SkBitmap_height">height</a>, or no <ahref="undocumented#Pixel_Ref">Pixel Ref</a>. |
| <ahref="#SkBitmap_empty">empty</a> | Returns true if <ahref="#Info">Image Info</a> has zero <ahref="#SkBitmap_width">width</a> or <ahref="#SkBitmap_height">height</a>. |
| <ahref="#SkBitmap_erase">erase</a> | Writes <ahref="undocumented#Color">Color</a> to rectangle of pixels. |
| <ahref="#SkBitmap_eraseARGB">eraseARGB</a> | Writes <ahref="undocumented#Color">Color</a> to pixels. |
| <ahref="#SkBitmap_setImmutable">setImmutable</a> | Marks that pixels will not change. |
| <ahref="#SkBitmap_setInfo">setInfo</a> | Sets <ahref="#SkBitmap_height">height</a>, <ahref="#SkBitmap_width">width</a>, <ahref="undocumented#Color_Type">Color Type</a>, and so on, releasing pixels. |
| <ahref="#SkBitmap_setIsVolatile">setIsVolatile</a> | Marks if pixels should not be cached. |
| <ahref="#SkBitmap_setPixelRef">setPixelRef</a> | Sets <ahref="undocumented#Pixel_Ref">Pixel Ref</a> and offset. |
| <ahref="#SkBitmap_setPixels">setPixels</a> | Sets <ahref="undocumented#Pixel_Ref">Pixel Ref</a> without an offset. |
| <ahref="#SkBitmap_shiftPerPixel">shiftPerPixel</a> | Returns bit shift from pixels to bytes. |
Allocates the pixel memory for the <ahref="#SkBitmap_Allocator_allocPixelRef_bitmap">bitmap</a>, given its <ahref="#SkBitmap_dimensions">dimensions</a> and
<ahref="undocumented#Color_Type">Color Type</a>. Returns true on success, where success means either <ahref="#SkBitmap_setPixels">setPixels</a>
or <ahref="#SkBitmap_setPixelRef">setPixelRef</a> was called.
Allocates the pixel memory for the <ahref="#SkBitmap_HeapAllocator_allocPixelRef_bitmap">bitmap</a>, given its <ahref="#SkBitmap_dimensions">dimensions</a> and
<ahref="undocumented#Color_Type">Color Type</a>. Returns true on success, where success means either <ahref="#SkBitmap_setPixels">setPixels</a>
or <ahref="#SkBitmap_setPixelRef">setPixelRef</a> was called.
Creates an <ahref="#SkBitmap_empty">empty</a><ahref="#Bitmap">Bitmap</a> without pixels, with <ahref="undocumented#SkColorType">kUnknown SkColorType</a>,
<ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, and with a <ahref="#SkBitmap_width">width</a> and <ahref="#SkBitmap_height">height</a> of zero. <ahref="undocumented#Pixel_Ref">Pixel Ref</a> origin is
set to (0, 0). <ahref="#Bitmap">Bitmap</a> is not volatile.
Use <ahref="#SkBitmap_setInfo">setInfo</a> to associate <ahref="undocumented#SkColorType">SkColorType</a>, <ahref="undocumented#SkAlphaType">SkAlphaType</a>, <ahref="#SkBitmap_width">width</a>, and <ahref="#SkBitmap_height">height</a>
after <ahref="#Bitmap">Bitmap</a> has been created.
Copies settings from <ahref="#SkBitmap_copy_const_SkBitmap_src">src</a> to returned <ahref="#Bitmap">Bitmap</a>. Shares pixels if <ahref="#SkBitmap_copy_const_SkBitmap_src">src</a> has pixels
allocated, so both bitmaps reference the same pixels.
Copies settings from <ahref="#SkBitmap_move_SkBitmap_src">src</a> to returned <ahref="#Bitmap">Bitmap</a>. Moves ownership of <ahref="#SkBitmap_move_SkBitmap_src">src</a> pixels to
Copies settings from <ahref="#SkBitmap_copy_assignment_operator_src">src</a> to returned <ahref="#Bitmap">Bitmap</a>. Shares pixels if <ahref="#SkBitmap_copy_assignment_operator_src">src</a> has pixels
allocated, so both bitmaps reference the same pixels.
Copies settings from <ahref="#SkBitmap_move_assignment_operator_src">src</a> to returned <ahref="#Bitmap">Bitmap</a>. Moves ownership of <ahref="#SkBitmap_move_assignment_operator_src">src</a> pixels to
Maybe be less than <ahref="#SkBitmap_pixelRef">pixelRef</a>.<ahref="#SkBitmap_width">width</a>. Will not exceed <ahref="#SkBitmap_pixelRef">pixelRef</a>.<ahref="#SkBitmap_width">width</a> less
Maybe be less than <ahref="#SkBitmap_pixelRef">pixelRef</a>.<ahref="#SkBitmap_height">height</a>. Will not exceed <ahref="#SkBitmap_pixelRef">pixelRef</a>.<ahref="#SkBitmap_height">height</a> less
Returns <ahref="undocumented#Color_Space">Color Space</a>, the range of colors, associated with <ahref="#Info">Image Info</a>. The
reference count of <ahref="undocumented#Color_Space">Color Space</a> is unchanged. The returned <ahref="undocumented#Color_Space">Color Space</a> is
immutable.
### Return Value
<ahref="undocumented#Color_Space">Color Space</a> in <ahref="#Info">Image Info</a>
### Example
<div><fiddle-embedname="7ade8a1a21ea5197e565c86740b47b73"><div><ahref="#SkColorSpace_MakeSRGBLinear">SkColorSpace::MakeSRGBLinear</a> creates <ahref="undocumented#Color_Space">Color Space</a> with linear gamma
and an sRGB gamut. This <ahref="undocumented#Color_Space">Color Space</a> gamma is not close to sRGB gamma.</div>
Returns true if either <ahref="#SkBitmap_width">width</a> or <ahref="#SkBitmap_height">height</a> are zero.
Does not check if <ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr; call <ahref="#SkBitmap_drawsNothing">drawsNothing</a> to check <ahref="#SkBitmap_width">width</a>,
<ahref="#SkBitmap_height">height</a>, and <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
### Return Value
true if <ahref="#SkBitmap_dimensions">dimensions</a> do not enclose area
Return true if <ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr.
Does not check if <ahref="#SkBitmap_width">width</a> or <ahref="#SkBitmap_height">height</a> are zero; call <ahref="#SkBitmap_drawsNothing">drawsNothing</a> to check
<ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, and <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
### Return Value
true if no <ahref="undocumented#Pixel_Ref">Pixel Ref</a> is associated
Return true if <ahref="#SkBitmap_width">width</a> or <ahref="#SkBitmap_height">height</a> are zero, or if <ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr.
If true, <ahref="#Bitmap">Bitmap</a> has no effect when drawn or drawn into.
Sets <ahref="undocumented#Alpha_Type">Alpha Type</a>, if <ahref="#SkBitmap_alphaType">alphaType</a> is compatible with <ahref="undocumented#Color_Type">Color Type</a>.
Returns true unless <ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a> and current <ahref="undocumented#Alpha_Type">Alpha Type</a>
is not <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a>.
Returns true if <ahref="undocumented#Color_Type">Color Type</a> is <ahref="undocumented#SkColorType">kUnknown SkColorType</a>. <ahref="#SkBitmap_alphaType">alphaType</a> is ignored, and
Returns true if <ahref="undocumented#Color_Type">Color Type</a> is <ahref="undocumented#SkColorType">kRGB 565 SkColorType</a> or <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>.
<ahref="#SkBitmap_alphaType">alphaType</a> is ignored, and <ahref="undocumented#Alpha_Type">Alpha Type</a> remains <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>.
If <ahref="undocumented#Color_Type">Color Type</a> is <ahref="undocumented#SkColorType">kARGB 4444 SkColorType</a>, <ahref="undocumented#SkColorType">kRGBA 8888 SkColorType</a>,
<ahref="undocumented#SkColorType">kBGRA 8888 SkColorType</a>, or <ahref="undocumented#SkColorType">kRGBA F16 SkColorType</a>: returns true unless
<ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a> and <ahref="undocumented#Alpha_Type">Alpha Type</a> is not <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a>.
If <ahref="undocumented#Alpha_Type">Alpha Type</a> is <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <ahref="#SkBitmap_alphaType">alphaType</a> is ignored.
If <ahref="undocumented#Color_Type">Color Type</a> is <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>, returns true unless
<ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a> and <ahref="undocumented#Alpha_Type">Alpha Type</a> is not <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a>.
If <ahref="undocumented#Alpha_Type">Alpha Type</a> is <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a>, <ahref="#SkBitmap_alphaType">alphaType</a> is ignored. If <ahref="#SkBitmap_alphaType">alphaType</a> is
<ahref="undocumented#SkAlphaType">kUnpremul SkAlphaType</a>, it is treated as <ahref="undocumented#SkAlphaType">kPremul SkAlphaType</a>.
This changes <ahref="undocumented#Alpha_Type">Alpha Type</a> in <ahref="undocumented#Pixel_Ref">Pixel Ref</a>; all bitmaps sharing <ahref="undocumented#Pixel_Ref">Pixel Ref</a>
Returns minimum memory required for pixel storage.
Does not include unused memory on last row when <ahref="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <ahref="#SkBitmap_width">width</a>.
Returns zero if result does not fit in size_t.
Returns zero if <ahref="#SkBitmap_height">height</a> or <ahref="#SkBitmap_width">width</a> is 0.
Returns <ahref="#SkBitmap_height">height</a> times <ahref="#SkBitmap_rowBytes">rowBytes</a> if <ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kUnknown SkColorType</a>.
Writing to immutable <ahref="#Bitmap">Bitmap</a> pixels triggers an assert on debug builds.
### Example
<div><fiddle-embedname="9210060d1f4ca46e1375496237902ef3"><div>Triggers assert if <ahref="undocumented#SK_DEBUG">SK DEBUG</a> is true, runs fine otherwise.</div></fiddle-embed></div>
Returns true if <ahref="undocumented#Alpha_Type">Alpha Type</a> is <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>.
Does not check if <ahref="undocumented#Color_Type">Color Type</a> allows <ahref="#Alpha">Alpha</a>, or if any pixel value has
transparency.
### Return Value
true if <ahref="#Info">Image Info</a> describes opaque <ahref="#Alpha">Alpha</a>
### Example
<div><fiddle-embedname="5e76b68bb46d54315eb0c12d83bd6949"><div><ahref="#SkBitmap_isOpaque">isOpaque</a> ignores whether all pixels are opaque or not.</div>
Resets to its initial state; all fields are set to zero, as if <ahref="#Bitmap">Bitmap</a> had
been initialized by <ahref="#SkBitmap_empty_constructor">SkBitmap()</a>.
Sets <ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, row bytes to zero; pixel address to nullptr; <ahref="undocumented#SkColorType">SkColorType</a> to
<ahref="undocumented#SkColorType">kUnknown SkColorType</a>; and <ahref="undocumented#SkAlphaType">SkAlphaType</a> to <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a>.
If <ahref="undocumented#Pixel_Ref">Pixel Ref</a> is allocated, its reference count is decreased by one, releasing
its memory if <ahref="#Bitmap">Bitmap</a> is the sole owner.
Returns true if all pixels are opaque. <ahref="undocumented#Color_Type">Color Type</a> determines how pixels
are encoded, and whether pixel describes <ahref="#Alpha">Alpha</a>. Returns true for <ahref="undocumented#Color_Type">Color Types</a>
without alpha in each pixel; for other <ahref="undocumented#Color_Type">Color Types</a>, returns true if all
pixels have alpha values equivalent to 1.0 or greater.
For <ahref="undocumented#Color_Type">Color Types</a><ahref="undocumented#SkColorType">kRGB 565 SkColorType</a> or <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>: always
returns true. For <ahref="undocumented#Color_Type">Color Types</a><ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>, <ahref="undocumented#SkColorType">kBGRA 8888 SkColorType</a>,
<ahref="undocumented#SkColorType">kRGBA 8888 SkColorType</a>: returns true if all pixel <ahref="#Alpha">Alpha</a> values are 255.
For <ahref="undocumented#Color_Type">Color Type</a><ahref="undocumented#SkColorType">kARGB 4444 SkColorType</a>: returns true if all pixel <ahref="#Alpha">Alpha</a> values are 15.
For <ahref="undocumented#SkColorType">kRGBA F16 SkColorType</a>: returns true if all pixel <ahref="#Alpha">Alpha</a> values are 1.0 or
greater.
Returns false for <ahref="undocumented#SkColorType">kUnknown SkColorType</a>.
<ahref="#SkBitmap_rowBytes">rowBytes</a>. Frees pixels, and returns true if successful.
<ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_alphaType">alphaType</a> may be altered to a value permitted by <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_colorSpace">colorSpace</a>.
If <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kUnknown SkColorType</a>, <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_alphaType">alphaType</a> is
set to <ahref="undocumented#SkAlphaType">kUnknown SkAlphaType</a>.
If <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a> and <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_alphaType">alphaType</a> is
<ahref="undocumented#SkAlphaType">kUnpremul SkAlphaType</a>, <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_alphaType">alphaType</a> is replaced by <ahref="undocumented#SkAlphaType">kPremul SkAlphaType</a>.
If <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kRGB 565 SkColorType</a> or <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>,
<ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_alphaType">alphaType</a> is set to <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>.
If <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kARGB 4444 SkColorType</a>, <ahref="undocumented#SkColorType">kRGBA 8888 SkColorType</a>,
<ahref="undocumented#SkColorType">kBGRA 8888 SkColorType</a>, or <ahref="undocumented#SkColorType">kRGBA F16 SkColorType</a>: <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_alphaType">alphaType</a> remains
unchanged.
<ahref="#SkBitmap_rowBytes">rowBytes</a> must equal or exceed <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="undocumented#SkImageInfo">minRowBytes</a>. If <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_colorSpace">colorSpace</a> is
<ahref="undocumented#SkColorType">kUnknown SkColorType</a>, <ahref="#SkBitmap_rowBytes">rowBytes</a> is ignored and treated as zero; for all other
<ahref="undocumented#Color_Space">Color Space</a> values, <ahref="#SkBitmap_rowBytes">rowBytes</a> of zero is treated as <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="undocumented#SkImageInfo">minRowBytes</a>.
Calls <ahref="#SkBitmap_reset">reset</a> and returns false if:
<td><ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_width">width</a> times <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_bytesPerPixel">bytesPerPixel</a> exceeds 31 bits</td></tr><tr>
<td><ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_width">width</a> is negative</td></tr><tr>
<td><ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_height">height</a> is negative</td></tr><tr>
<td><ahref="#SkBitmap_rowBytes">rowBytes</a> is positive and less than <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_width">width</a> times <ahref="#SkBitmap_setInfo_imageInfo">imageInfo</a>.<ahref="#SkBitmap_bytesPerPixel">bytesPerPixel</a></td></tr>
<ahref="#SkBitmap_AllocFlags">AllocFlags</a> provides the option to zero pixel memory when allocated.
### Constants
<table>
<tr>
<td><aname="SkBitmap_kZeroPixels_AllocFlag"><code><strong>SkBitmap::kZeroPixels_AllocFlag </strong></code></a></td><td>1</td><td>Instructs <ahref="#SkBitmap_tryAllocPixelsFlags">tryAllocPixelsFlags</a> and <ahref="#SkBitmap_allocPixelsFlags">allocPixelsFlags</a> to zero pixel memory.</td>
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a> and allocates pixel
memory. If <ahref="#SkBitmap_tryAllocPixelsFlags_flags">flags</a> is <ahref="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a>, memory is zeroed.
Returns false and calls <ahref="#SkBitmap_reset">reset</a> if <ahref="#Info">Image Info</a> could not be set, or memory could
not be allocated, or memory size exceeds 31 bits, or memory could not optionally
be zeroed.
On most platforms, allocating pixel memory may succeed even though there is
not sufficient memory to hold pixels; allocation does not take place
until the pixels are written to. The actual behavior depends on the platform
implementation of malloc(), if <ahref="#SkBitmap_tryAllocPixelsFlags_flags">flags</a> is zero, and calloc(), if <ahref="#SkBitmap_tryAllocPixelsFlags_flags">flags</a> is
<ahref="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a>, or zero</td>
</tr>
</table>
### Return Value
true if pixels allocation is successful
### Example
<div><fiddle-embedname="01e11c52fe4a3dc7ee800ce8e925b973"><div>For <ahref="#SkBitmap_width">width</a> of 100,000, <ahref="#SkBitmap_height">height</a> of 100,000, and 4 bytes per pixel, <ahref="undocumented#Pixel_Ref">Pixel Ref</a>
requires 40,000,000,000 bytes of storage. <ahref="#SkBitmap_Allocator">Allocator</a> implemented
internally by <ahref="#SkMallocPixelRef_MakeZeroed">SkMallocPixelRef::MakeZeroed</a> limits the maximum memory allowed;
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a> and allocates pixel
memory. If <ahref="#SkBitmap_allocPixelsFlags_flags">flags</a> is <ahref="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a>, memory is zeroed.
Aborts execution if <ahref="#Info">Image Info</a> could not be set, or memory could
not be allocated, or memory size exceeds 31 bits, or memory could not optionally
be zeroed. Abort steps may be provided by the user at compile time by defining
<ahref="undocumented#SK_ABORT">SK ABORT</a>.
On most platforms, allocating pixel memory may succeed even though there is
not sufficient memory to hold pixels; allocation does not take place
until the pixels are written to. The actual behavior depends on the platform
implementation of malloc(), if <ahref="#SkBitmap_allocPixelsFlags_flags">flags</a> is zero, and calloc(), if <ahref="#SkBitmap_allocPixelsFlags_flags">flags</a> is
<ahref="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a>, or zero</td>
</tr>
</table>
### Example
<div><fiddle-embedname="f21b8965a88c94a32393a8890c4672af"><div><ahref="undocumented#Text">Text</a> is drawn on a transparent background; drawing the bitmap a second time
lets the first draw show through.</div></fiddle-embed></div>
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a> and allocates pixel
memory. <ahref="#SkBitmap_rowBytes">rowBytes</a> must equal or exceed <ahref="#SkBitmap_info">info</a>.<ahref="#SkBitmap_width">width</a> times <ahref="#SkBitmap_info">info</a>.<ahref="#SkBitmap_bytesPerPixel">bytesPerPixel</a>,
or equal zero. Pass in zero for <ahref="#SkBitmap_rowBytes">rowBytes</a> to compute the minimum valid value.
Returns false and calls <ahref="#SkBitmap_reset">reset</a> if <ahref="#Info">Image Info</a> could not be set, or memory could
not be allocated.
On most platforms, allocating pixel memory may succeed even though there is
not sufficient memory to hold pixels; allocation does not take place
until the pixels are written to. The actual behavior depends on the platform
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a> and allocates pixel
memory. <ahref="#SkBitmap_rowBytes">rowBytes</a> must equal or exceed <ahref="#SkBitmap_info">info</a>.<ahref="#SkBitmap_width">width</a> times <ahref="#SkBitmap_info">info</a>.<ahref="#SkBitmap_bytesPerPixel">bytesPerPixel</a>,
or equal zero. Pass in zero for <ahref="#SkBitmap_rowBytes">rowBytes</a> to compute the minimum valid value.
Aborts execution if <ahref="#Info">Image Info</a> could not be set, or memory could
not be allocated, or memory size exceeds 31 bits. Abort steps may be provided by
the user at compile time by defining <ahref="undocumented#SK_ABORT">SK ABORT</a>.
On most platforms, allocating pixel memory may succeed even though there is
not sufficient memory to hold pixels; allocation does not take place
until the pixels are written to. The actual behavior depends on the platform
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a> and allocates pixel
memory.
Returns false and calls <ahref="#SkBitmap_reset">reset</a> if <ahref="#Info">Image Info</a> could not be set, or memory could
not be allocated.
On most platforms, allocating pixel memory may succeed even though there is
not sufficient memory to hold pixels; allocation does not take place
until the pixels are written to. The actual behavior depends on the platform
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a> and allocates pixel
memory.
Aborts execution if <ahref="#Info">Image Info</a> could not be set, or memory could
not be allocated, or memory size exceeds 31 bits. Abort steps may be provided by
the user at compile time by defining <ahref="undocumented#SK_ABORT">SK ABORT</a>.
On most platforms, allocating pixel memory may succeed even though there is
not sufficient memory to hold pixels; allocation does not take place
until the pixels are written to. The actual behavior depends on the platform
bool SK_WARN_UNUSED_RESULT tryAllocN32Pixels(int width, int height,
bool isOpaque = false)
</pre>
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, and the native <ahref="undocumented#Color_Type">Color Type</a>; and allocates
pixel memory. If <ahref="#SkBitmap_isOpaque">isOpaque</a> is true, sets <ahref="#Info">Image Info</a> to <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>;
otherwise, sets to <ahref="undocumented#SkAlphaType">kPremul SkAlphaType</a>.
Calls <ahref="#SkBitmap_reset">reset</a> and returns false if <ahref="#SkBitmap_width">width</a> exceeds 29 bits or is negative,
or <ahref="#SkBitmap_height">height</a> is negative.
Returns false if allocation fails.
Use to create <ahref="#Bitmap">Bitmap</a> that matches native pixel arrangement on the platform,
void allocN32Pixels(int width, int height, bool isOpaque = false)
</pre>
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, and the native <ahref="undocumented#Color_Type">Color Type</a>; and allocates
pixel memory. If <ahref="#SkBitmap_isOpaque">isOpaque</a> is true, sets <ahref="#Info">Image Info</a> to <ahref="undocumented#SkAlphaType">kPremul SkAlphaType</a>;
otherwise, sets to <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>.
Aborts if <ahref="#SkBitmap_width">width</a> exceeds 29 bits or is negative, or <ahref="#SkBitmap_height">height</a> is negative, or
allocation fails. Abort steps may be provided by the user at compile time by
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a>, and creates <ahref="undocumented#Pixel_Ref">Pixel Ref</a>
containing <ahref="#SkBitmap_installPixels_pixels">pixels</a> and <ahref="#SkBitmap_rowBytes">rowBytes</a>. <ahref="#SkBitmap_installPixels_releaseProc">releaseProc</a>, if not nullptr, is called
immediately on failure or when <ahref="#SkBitmap_installPixels_pixels">pixels</a> are no longer referenced. <ahref="#SkBitmap_installPixels_context">context</a> may be
nullptr.
If <ahref="#Info">Image Info</a> could not be set, or <ahref="#SkBitmap_rowBytes">rowBytes</a> is less than <ahref="#SkBitmap_info">info</a>.<ahref="undocumented#SkImageInfo">minRowBytes</a>:
calls <ahref="#SkBitmap_installPixels_releaseProc">releaseProc</a> if present, calls <ahref="#SkBitmap_reset">reset</a>, and returns false.
Otherwise, if <ahref="#SkBitmap_installPixels_pixels">pixels</a> equals nullptr: sets <ahref="#Info">Image Info</a>, calls <ahref="#SkBitmap_installPixels_releaseProc">releaseProc</a> if
present, returns true.
If <ahref="#Info">Image Info</a> is set, <ahref="#SkBitmap_installPixels_pixels">pixels</a> is not nullptr, and <ahref="#SkBitmap_installPixels_releaseProc">releaseProc</a> is not nullptr:
when <ahref="#SkBitmap_installPixels_pixels">pixels</a> are no longer referenced, calls <ahref="#SkBitmap_installPixels_releaseProc">releaseProc</a> with <ahref="#SkBitmap_installPixels_pixels">pixels</a> and <ahref="#SkBitmap_installPixels_context">context</a>
caller state passed to <ahref="#SkBitmap_installPixels_releaseProc">releaseProc</a>; may be nullptr</td>
</tr>
</table>
### Return Value
true if <ahref="#Info">Image Info</a> is set to <ahref="#SkBitmap_info">info</a>
### Example
<div><fiddle-embedname="ff5b5c349efb5d929ff5dff07b7727e6"><div><ahref="#SkBitmap_installPixels_releaseProc">releaseProc</a> is called immediately because <ahref="#SkBitmap_rowBytes">rowBytes</a> is too small for <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.</div>
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a>, and creates <ahref="undocumented#Pixel_Ref">Pixel Ref</a>
containing <ahref="#SkBitmap_installPixels_2_pixels">pixels</a> and <ahref="#SkBitmap_rowBytes">rowBytes</a>.
If <ahref="#Info">Image Info</a> could not be set, or <ahref="#SkBitmap_rowBytes">rowBytes</a> is less than <ahref="#SkBitmap_info">info</a>.<ahref="undocumented#SkImageInfo">minRowBytes</a>:
calls <ahref="#SkBitmap_reset">reset</a>, and returns false.
Otherwise, if <ahref="#SkBitmap_installPixels_2_pixels">pixels</a> equals nullptr: sets <ahref="#Info">Image Info</a>, returns true.
Caller must ensure that <ahref="#SkBitmap_installPixels_2_pixels">pixels</a> are valid for the lifetime of <ahref="#Bitmap">Bitmap</a> and <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
true if <ahref="#Info">Image Info</a> is set to <ahref="#SkBitmap_info">info</a>
### Example
<div><fiddle-embedname="a7e04447b2081010c50d7920e80a6bb2"><div><ahref="undocumented#GPU">GPU</a> does not support <ahref="undocumented#SkAlphaType">kUnpremul SkAlphaType</a>, does not assert that it does not.</div></fiddle-embed></div>
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_installPixels_3_pixmap">pixmap</a>.<ahref="#SkBitmap_info">info</a> following the rules in <ahref="#SkBitmap_setInfo">setInfo</a>, and creates
<ahref="undocumented#Pixel_Ref">Pixel Ref</a> containing <ahref="#SkBitmap_installPixels_3_pixmap">pixmap</a>.addr() and <ahref="#SkBitmap_installPixels_3_pixmap">pixmap</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a>.
If <ahref="#Info">Image Info</a> could not be set, or <ahref="#SkBitmap_installPixels_3_pixmap">pixmap</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a> is less than
<ahref="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>: calls <ahref="#SkBitmap_reset">reset</a>, and returns false.
Otherwise, if <ahref="#SkBitmap_installPixels_3_pixmap">pixmap</a>.addr() equals nullptr: sets <ahref="#Info">Image Info</a>, returns true.
Caller must ensure that <ahref="#SkBitmap_installPixels_3_pixmap">pixmap</a> is valid for the lifetime of <ahref="#Bitmap">Bitmap</a> and <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
<ahref="#Info">Image Info</a>, pixel address, and <ahref="#SkBitmap_rowBytes">rowBytes</a></td>
</tr>
</table>
### Return Value
true if <ahref="#Info">Image Info</a> was set to <ahref="#SkBitmap_installPixels_3_pixmap">pixmap</a>.<ahref="#SkBitmap_info">info</a>
### Example
<div><fiddle-embedname="6e2a8c9358b34aebd2ec586815fe9d3a"><div>Draw a five by five bitmap, and draw it again with a center white pixel.</div></fiddle-embed></div>
Sets <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_installMaskPixels_mask">mask</a><ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_installMaskPixels_mask">mask</a><ahref="#SkBitmap_height">height</a>, <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>, and
<ahref="undocumented#SkAlphaType">kPremul SkAlphaType</a>. Sets <ahref="undocumented#Pixel_Ref">Pixel Ref</a> to <ahref="#SkBitmap_installMaskPixels_mask">mask</a> image and <ahref="#SkBitmap_installMaskPixels_mask">mask</a><ahref="#SkBitmap_rowBytes">rowBytes</a>.
Returns false and calls <ahref="#SkBitmap_reset">reset</a> if <ahref="#SkBitmap_installMaskPixels_mask">mask</a> format is not <ahref="#SkMask_kA8_Format">SkMask::kA8 Format</a>,
or if <ahref="#SkBitmap_installMaskPixels_mask">mask</a><ahref="#SkBitmap_width">width</a> or <ahref="#SkBitmap_installMaskPixels_mask">mask</a><ahref="#SkBitmap_height">height</a> is negative, or if <ahref="#SkBitmap_installMaskPixels_mask">mask</a><ahref="#SkBitmap_rowBytes">rowBytes</a> is less
than <ahref="#SkBitmap_installMaskPixels_mask">mask</a><ahref="#SkBitmap_width">width</a>.
Caller must ensure that <ahref="#SkBitmap_installMaskPixels_mask">mask</a> is valid for the lifetime of <ahref="#Bitmap">Bitmap</a> and <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
true if <ahref="#Info">Image Info</a> and <ahref="undocumented#Pixel_Ref">Pixel Ref</a> refer to <ahref="#SkBitmap_installMaskPixels_mask">mask</a>
### Example
<div><fiddle-embedname="b0456fc063ca467ccecf2105160a3d1d"><div>Draw a five by five bitmap, and draw it again with a center white pixel.</div></fiddle-embed></div>
Replaces <ahref="undocumented#Pixel_Ref">Pixel Ref</a> with <ahref="#SkBitmap_setPixels_pixels">pixels</a>, preserving <ahref="#Info">Image Info</a> and <ahref="#SkBitmap_rowBytes">rowBytes</a>.
Sets <ahref="undocumented#Pixel_Ref">Pixel Ref</a> origin to (0, 0).
If <ahref="#SkBitmap_setPixels_pixels">pixels</a> is nullptr, or if <ahref="#SkBitmap_info">info</a>.<ahref="#SkBitmap_colorType">colorType</a> equals <ahref="undocumented#SkColorType">kUnknown SkColorType</a>;
release reference to <ahref="undocumented#Pixel_Ref">Pixel Ref</a>, and set <ahref="undocumented#Pixel_Ref">Pixel Ref</a> to nullptr.
Caller is responsible for handling ownership pixel memory for the lifetime
of <ahref="#Bitmap">Bitmap</a> and <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
Allocates pixel memory with <ahref="#SkBitmap_HeapAllocator">HeapAllocator</a>, and replaces existing <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
The allocation size is determined by <ahref="#Info">Image Info</a><ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, and <ahref="undocumented#Color_Type">Color Type</a>.
Returns false if <ahref="#SkBitmap_info">info</a>.<ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kUnknown SkColorType</a>, or allocation exceeds
31 bits, or allocation fails.
### Return Value
true if the allocation succeeds
### Example
<div><fiddle-embedname="720e4c053fae9e929ab6518b47e49370"><div><ahref="#Bitmap">Bitmap</a> hosts and draws gray values in set1. <ahref="#SkBitmap_tryAllocPixels">tryAllocPixels</a> replaces <ahref="undocumented#Pixel_Ref">Pixel Ref</a>
and erases it to black, but does not alter set1. <ahref="#SkBitmap_setPixels">setPixels</a> replaces black
<ahref="undocumented#Pixel_Ref">Pixel Ref</a> with set1.</div></fiddle-embed></div>
Allocates pixel memory with <ahref="#SkBitmap_HeapAllocator">HeapAllocator</a>, and replaces existing <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
The allocation size is determined by <ahref="#Info">Image Info</a><ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, and <ahref="undocumented#Color_Type">Color Type</a>.
Aborts if <ahref="#SkBitmap_info">info</a>.<ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kUnknown SkColorType</a>, or allocation exceeds
31 bits, or allocation fails. Abort steps may be provided by the user at compile
time by defining <ahref="undocumented#SK_ABORT">SK ABORT</a>.
### Example
<div><fiddle-embedname="1219b38c788bf270fb20f8cd2d78cff8"><div><ahref="#Bitmap">Bitmap</a> hosts and draws gray values in set1. <ahref="#SkBitmap_allocPixels">allocPixels</a> replaces <ahref="undocumented#Pixel_Ref">Pixel Ref</a>
and erases it to black, but does not alter set1. <ahref="#SkBitmap_setPixels">setPixels</a> replaces black
<ahref="undocumented#Pixel_Ref">Pixel Ref</a> with set2.</div></fiddle-embed></div>
Allocates pixel memory with <ahref="#SkBitmap_tryAllocPixels_4_allocator">allocator</a>, and replaces existing <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
The allocation size is determined by <ahref="#Info">Image Info</a><ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, and <ahref="undocumented#Color_Type">Color Type</a>.
If <ahref="#SkBitmap_tryAllocPixels_4_allocator">allocator</a> is nullptr, use <ahref="#SkBitmap_HeapAllocator">HeapAllocator</a> instead.
Returns false if <ahref="#SkBitmap_tryAllocPixels_4_allocator">allocator</a><ahref="#SkBitmap_HeapAllocator_allocPixelRef">allocPixelRef</a> return false.
instance of <ahref="#SkBitmap_Allocator">SkBitmap::Allocator</a> instantiation</td>
</tr>
</table>
### Return Value
true if custom <ahref="#SkBitmap_tryAllocPixels_4_allocator">allocator</a> reports success
### Example
<div><fiddle-embedname="eb6f861ca1839146d26e40d56c2a001c"><div><ahref="#SkBitmap_HeapAllocator">HeapAllocator</a> limits the maximum size of <ahref="#Bitmap">Bitmap</a> to two gigabytes. Using
a custom <ahref="#SkBitmap_tryAllocPixels_4_allocator">allocator</a>, this limitation may be relaxed. This example can be
modified to allocate an eight gigabyte <ahref="#Bitmap">Bitmap</a> on a 64 bit platform with
Allocates pixel memory with <ahref="#SkBitmap_allocPixels_4_allocator">allocator</a>, and replaces existing <ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
The allocation size is determined by <ahref="#Info">Image Info</a><ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, and <ahref="undocumented#Color_Type">Color Type</a>.
If <ahref="#SkBitmap_allocPixels_4_allocator">allocator</a> is nullptr, use <ahref="#SkBitmap_HeapAllocator">HeapAllocator</a> instead.
Aborts if <ahref="#SkBitmap_allocPixels_4_allocator">allocator</a><ahref="#SkBitmap_HeapAllocator_allocPixelRef">allocPixelRef</a> return false. Abort steps may be provided by
the user at compile time by defining <ahref="undocumented#SK_ABORT">SK ABORT</a>.
Returns origin of pixels within <ahref="undocumented#Pixel_Ref">Pixel Ref</a>. <ahref="#Bitmap">Bitmap</a><ahref="#SkBitmap_bounds">bounds</a> is always contained
by <ahref="undocumented#Pixel_Ref">Pixel Ref</a><ahref="#SkBitmap_bounds">bounds</a>, which may be the same size or larger. Multiple <ahref="#Bitmap">Bitmaps</a>
can share the same <ahref="undocumented#Pixel_Ref">Pixel Ref</a>, where each <ahref="#Bitmap">Bitmap</a> has different <ahref="#SkBitmap_bounds">bounds</a>.
The returned origin added to <ahref="#Bitmap">Bitmap</a><ahref="#SkBitmap_dimensions">dimensions</a> equals or is smaller than the
void setPixelRef(sk_sp<SkPixelRef> pixelRef, int dx, int dy)
</pre>
Replaces <ahref="#SkBitmap_pixelRef">pixelRef</a> and origin in <ahref="#Bitmap">Bitmap</a>. <ahref="#SkBitmap_setPixelRef_dx">dx</a> and <ahref="#SkBitmap_setPixelRef_dy">dy</a> specify the offset
within the <ahref="undocumented#Pixel_Ref">Pixel Ref</a> pixels for the top-left corner of the bitmap.
Asserts in debug builds if <ahref="#SkBitmap_setPixelRef_dx">dx</a> or <ahref="#SkBitmap_setPixelRef_dy">dy</a> are out of range. Pins <ahref="#SkBitmap_setPixelRef_dx">dx</a> and <ahref="#SkBitmap_setPixelRef_dy">dy</a>
to legal range in release builds.
The caller is responsible for ensuring that the pixels match the
<ahref="undocumented#Color_Type">Color Type</a> and <ahref="undocumented#Alpha_Type">Alpha Type</a> in <ahref="#Info">Image Info</a>.
row offset in <ahref="undocumented#Pixel_Ref">Pixel Ref</a> for bitmap origin</td>
</tr>
</table>
### Example
<div><fiddle-embedname="13df9e5b1adcec33d11e4b0f8a91ecb8"><div>Treating 32 bit data as 8 bit data is unlikely to produce useful results.</div></fiddle-embed></div>
Replaces pixel values with <ahref="#SkBitmap_eraseColor_c">c</a>. All pixels contained by <ahref="#SkBitmap_bounds">bounds</a> are affected.
If the <ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a> or k565_SkColorType, then <ahref="#Alpha">Color Alpha</a>
is ignored; <ahref="#RGB">Color RGB</a> is treated as opaque. If <ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>,
void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const
</pre>
Replaces pixel values with <ahref="#Unpremultiply">Unpremultiplied</a><ahref="undocumented#Color">Color</a> built from <ahref="#SkBitmap_eraseARGB_a">a</a>, <ahref="#SkBitmap_eraseARGB_r">r</a>, <ahref="#SkBitmap_eraseARGB_g">g</a>, and <ahref="#SkBitmap_eraseARGB_b">b</a>.
All pixels contained by <ahref="#SkBitmap_bounds">bounds</a> are affected.
If the <ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a> or k565_SkColorType, then <ahref="#SkBitmap_eraseARGB_a">a</a>
is ignored; <ahref="#SkBitmap_eraseARGB_r">r</a>, <ahref="#SkBitmap_eraseARGB_g">g</a>, and <ahref="#SkBitmap_eraseARGB_b">b</a> are treated as opaque. If <ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>,
then <ahref="#SkBitmap_eraseARGB_r">r</a>, <ahref="#SkBitmap_eraseARGB_g">g</a>, and <ahref="#SkBitmap_eraseARGB_b">b</a> are ignored.
Replaces pixel values inside <ahref="#SkBitmap_erase_area">area</a> with <ahref="#SkBitmap_erase_c">c</a>. If <ahref="#SkBitmap_erase_area">area</a> does not intersect <ahref="#SkBitmap_bounds">bounds</a>,
call has no effect.
If the <ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a> or k565_SkColorType, then <ahref="#Alpha">Color Alpha</a>
is ignored; <ahref="#RGB">Color RGB</a> is treated as opaque. If <ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>,
Returns pixel at (<ahref="#SkBitmap_getColor_x">x</a>, <ahref="#SkBitmap_getColor_y">y</a>) as <ahref="#Unpremultiply">Unpremultiplied</a><ahref="undocumented#Color">Color</a>.
Returns black with <ahref="#Alpha">Alpha</a> if <ahref="undocumented#Color_Type">Color Type</a> is <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>.
Input is not validated: out of <ahref="#SkBitmap_bounds">bounds</a> values of <ahref="#SkBitmap_getColor_x">x</a> or <ahref="#SkBitmap_getColor_y">y</a> trigger an assert() if
built with <ahref="undocumented#SK_DEBUG">SK DEBUG</a> defined; and returns undefined values or may crash if
<ahref="undocumented#SK_RELEASE">SK RELEASE</a> is defined. Fails if <ahref="undocumented#Color_Type">Color Type</a> is <ahref="undocumented#SkColorType">kUnknown SkColorType</a> or
pixel address is nullptr.
<ahref="undocumented#Color_Space">Color Space</a> in <ahref="#Info">Image Info</a> is ignored. Some <ahref="undocumented#Color">Color</a> precision may be lost in the
conversion to <ahref="#Unpremultiply">Unpremultiplied</a><ahref="undocumented#Color">Color</a>; original pixel data may have additional
Returns pixel address at (<ahref="#SkBitmap_getAddr_x">x</a>, <ahref="#SkBitmap_getAddr_y">y</a>).
Input is not validated: out of <ahref="#SkBitmap_bounds">bounds</a> values of <ahref="#SkBitmap_getAddr_x">x</a> or <ahref="#SkBitmap_getAddr_y">y</a>, or <ahref="undocumented#SkColorType">kUnknown SkColorType</a>,
trigger an assert() if built with <ahref="undocumented#SK_DEBUG">SK DEBUG</a> defined. Returns nullptr if
<ahref="undocumented#Color_Type">Color Type</a> is <ahref="undocumented#SkColorType">kUnknown SkColorType</a>, or <ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr.
Performs a lookup of pixel size; for better performance, call
one of: <ahref="#SkBitmap_getAddr8">getAddr8</a>, <ahref="#SkBitmap_getAddr16">getAddr16</a>, or <ahref="#SkBitmap_getAddr32">getAddr32</a>.
Shares <ahref="undocumented#Pixel_Ref">Pixel Ref</a> with <ahref="#SkBitmap_extractSubset_dst">dst</a>. Pixels are not copied; <ahref="#Bitmap">Bitmap</a> and <ahref="#SkBitmap_extractSubset_dst">dst</a> point
to the same pixels; <ahref="#SkBitmap_extractSubset_dst">dst</a><ahref="#SkBitmap_bounds">bounds</a> are set to the intersection of <ahref="#SkBitmap_extractSubset_subset">subset</a>
and the original <ahref="#SkBitmap_bounds">bounds</a>.
<ahref="#SkBitmap_extractSubset_subset">subset</a> may be larger than <ahref="#SkBitmap_bounds">bounds</a>. Any area outside of <ahref="#SkBitmap_bounds">bounds</a> is ignored.
Any contents of <ahref="#SkBitmap_extractSubset_dst">dst</a> are discarded. <ahref="#SkBitmap_isVolatile">isVolatile</a> setting is copied to <ahref="#SkBitmap_extractSubset_dst">dst</a>.
<ahref="#SkBitmap_extractSubset_dst">dst</a> is set to <ahref="#SkBitmap_colorType">colorType</a>, <ahref="#SkBitmap_alphaType">alphaType</a>, and <ahref="#SkBitmap_colorSpace">colorSpace</a>.
Return false if:
<table><tr>
<td><ahref="#SkBitmap_extractSubset_dst">dst</a> is nullptr</td></tr><tr>
<td><ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td></tr><tr>
<td><ahref="#SkBitmap_extractSubset_subset">subset</a> does not intersect <ahref="#SkBitmap_bounds">bounds</a></td></tr>
int srcX, int srcY, SkTransferFunctionBehavior behavior) const
</pre>
Copies a <ahref="SkRect_Reference#Rect">Rect</a> of pixels to <ahref="#SkBitmap_readPixels_dstPixels">dstPixels</a>. Copy starts at (<ahref="#SkBitmap_readPixels_srcX">srcX</a>, <ahref="#SkBitmap_readPixels_srcY">srcY</a>), and does not exceed
<ahref="#SkBitmap_readPixels_dstInfo">dstInfo</a> specifies <ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, <ahref="undocumented#Color_Type">Color Type</a>, <ahref="undocumented#Alpha_Type">Alpha Type</a>, and
<ahref="undocumented#Color_Space">Color Space</a> of destination. <ahref="#SkBitmap_readPixels_dstRowBytes">dstRowBytes</a> specifics the gap from one destination
row to the next. Returns true if pixels are copied. Returns false if:
<td><ahref="#SkBitmap_readPixels_dstRowBytes">dstRowBytes</a> is less than <ahref="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<ahref="undocumented#SkImageInfo">minRowBytes</a></td></tr><tr>
<td><ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td></tr>
</table>
Pixels are copied only if pixel conversion is possible. If this-><ahref="#SkBitmap_colorType">colorType</a> is
<ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, or <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <ahref="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<ahref="#SkBitmap_colorType">colorType</a> must match.
If this-><ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, <ahref="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<ahref="#SkBitmap_colorSpace">colorSpace</a> must match.
If this-><ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <ahref="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<ahref="#SkBitmap_alphaType">alphaType</a> must
match. If this-><ahref="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <ahref="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<ahref="#SkBitmap_colorSpace">colorSpace</a> must match. Returns
false if pixel conversion is not possible.
<ahref="#SkBitmap_readPixels_srcX">srcX</a> and <ahref="#SkBitmap_readPixels_srcY">srcY</a> may be negative to copy only top or left of source. Returns
or ifabs(srcY) >= this-><ahref="#SkBitmap_height">height</a>.
If <ahref="#SkBitmap_readPixels_behavior">behavior</a> is <ahref="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts source
pixels to a linear space before converting to <ahref="#SkBitmap_readPixels_dstInfo">dstInfo</a>.
If <ahref="#SkBitmap_readPixels_behavior">behavior</a> is <ahref="#SkTransferFunctionBehavior_kIgnore">SkTransferFunctionBehavior::kIgnore</a>: source
pixels are treated as if they are linear, regardless of how they are encoded.
Copies a <ahref="SkRect_Reference#Rect">Rect</a> of pixels to <ahref="#SkBitmap_readPixels_2_dstPixels">dstPixels</a>. Copy starts at (<ahref="#SkBitmap_readPixels_2_srcX">srcX</a>, <ahref="#SkBitmap_readPixels_2_srcY">srcY</a>), and does not exceed
<ahref="#SkBitmap_readPixels_2_dstInfo">dstInfo</a> specifies <ahref="#SkBitmap_width">width</a>, <ahref="#SkBitmap_height">height</a>, <ahref="undocumented#Color_Type">Color Type</a>, <ahref="undocumented#Alpha_Type">Alpha Type</a>, and
<ahref="undocumented#Color_Space">Color Space</a> of destination. <ahref="#SkBitmap_readPixels_2_dstRowBytes">dstRowBytes</a> specifics the gap from one destination
row to the next. Returns true if pixels are copied. Returns false if:
<td><ahref="#SkBitmap_readPixels_2_dstRowBytes">dstRowBytes</a> is less than <ahref="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<ahref="undocumented#SkImageInfo">minRowBytes</a></td></tr><tr>
<td><ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td></tr>
</table>
Pixels are copied only if pixel conversion is possible. If this-><ahref="#SkBitmap_colorType">colorType</a> is
<ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, or <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <ahref="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<ahref="#SkBitmap_colorType">colorType</a> must match.
If this-><ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, <ahref="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<ahref="#SkBitmap_colorSpace">colorSpace</a> must match.
If this-><ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <ahref="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<ahref="#SkBitmap_alphaType">alphaType</a> must
match. If this-><ahref="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <ahref="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<ahref="#SkBitmap_colorSpace">colorSpace</a> must match. Returns
false if pixel conversion is not possible.
<ahref="#SkBitmap_readPixels_2_srcX">srcX</a> and <ahref="#SkBitmap_readPixels_2_srcY">srcY</a> may be negative to copy only top or left of source. Returns
bool readPixels(const SkPixmap& dst, int srcX, int srcY) const
</pre>
Copies a <ahref="SkRect_Reference#Rect">Rect</a> of pixels to <ahref="#SkBitmap_readPixels_3_dst">dst</a>. Copy starts at (<ahref="#SkBitmap_readPixels_3_srcX">srcX</a>, <ahref="#SkBitmap_readPixels_3_srcY">srcY</a>), and does not exceed
and row bytes of destination. <ahref="#SkBitmap_readPixels_3_dst">dst</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a> specifics the gap from one destination
row to the next. Returns true if pixels are copied. Returns false if:
<td><ahref="#SkBitmap_readPixels_3_dst">dst</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a> is less than <ahref="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a></td></tr><tr>
<td><ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td></tr>
</table>
Pixels are copied only if pixel conversion is possible. If this-><ahref="#SkBitmap_colorType">colorType</a> is
<ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, or <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <ahref="#SkBitmap_readPixels_3_dst">dst</a><ahref="undocumented#Color_Type">Color Type</a> must match.
If this-><ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, <ahref="#SkBitmap_readPixels_3_dst">dst</a><ahref="undocumented#Color_Space">Color Space</a> must match.
If this-><ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <ahref="#SkBitmap_readPixels_3_dst">dst</a><ahref="undocumented#Alpha_Type">Alpha Type</a> must
match. If this-><ahref="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <ahref="#SkBitmap_readPixels_3_dst">dst</a><ahref="undocumented#Color_Space">Color Space</a> must match. Returns
false if pixel conversion is not possible.
<ahref="#SkBitmap_readPixels_3_srcX">srcX</a> and <ahref="#SkBitmap_readPixels_3_srcY">srcY</a> may be negative to copy only top or left of source. Returns
and row bytes of destination. <ahref="#SkBitmap_readPixels_4_dst">dst</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a> specifics the gap from one destination
row to the next. Returns true if pixels are copied. Returns false if:
<td><ahref="#SkBitmap_readPixels_4_dst">dst</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a> is less than <ahref="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a></td></tr><tr>
<td><ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td></tr>
</table>
Pixels are copied only if pixel conversion is possible. If this-><ahref="#SkBitmap_colorType">colorType</a> is
<ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, or <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <ahref="#SkBitmap_readPixels_4_dst">dst</a><ahref="undocumented#Color_Type">Color Type</a> must match.
If this-><ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, <ahref="#SkBitmap_readPixels_4_dst">dst</a><ahref="undocumented#Color_Space">Color Space</a> must match.
If this-><ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <ahref="#SkBitmap_readPixels_4_dst">dst</a><ahref="undocumented#Alpha_Type">Alpha Type</a> must
match. If this-><ahref="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <ahref="#SkBitmap_readPixels_4_dst">dst</a><ahref="undocumented#Color_Space">Color Space</a> must match. Returns
bool writePixels(const SkPixmap& src, int dstX, int dstY)
</pre>
Copies a <ahref="SkRect_Reference#Rect">Rect</a> of pixels from <ahref="#SkBitmap_writePixels_src">src</a>. Copy starts at (<ahref="#SkBitmap_writePixels_dstX">dstX</a>, <ahref="#SkBitmap_writePixels_dstY">dstY</a>), and does not exceed
<td><ahref="#SkBitmap_writePixels_src">src</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a> is less than <ahref="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a></td></tr><tr>
<td><ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td></tr>
</table>
Pixels are copied only if pixel conversion is possible. If this-><ahref="#SkBitmap_colorType">colorType</a> is
<ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, or <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <ahref="#SkBitmap_writePixels_src">src</a><ahref="undocumented#Color_Type">Color Type</a> must match.
If this-><ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, <ahref="#SkBitmap_writePixels_src">src</a><ahref="undocumented#Color_Space">Color Space</a> must match.
If this-><ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <ahref="#SkBitmap_writePixels_src">src</a><ahref="undocumented#Alpha_Type">Alpha Type</a> must
match. If this-><ahref="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <ahref="#SkBitmap_writePixels_src">src</a><ahref="undocumented#Color_Space">Color Space</a> must match. Returns
false if pixel conversion is not possible.
<ahref="#SkBitmap_writePixels_dstX">dstX</a> and <ahref="#SkBitmap_writePixels_dstY">dstY</a> may be negative to copy only top or left of source. Returns
Copies a <ahref="SkRect_Reference#Rect">Rect</a> of pixels from <ahref="#SkBitmap_writePixels_2_src">src</a>. Copy starts at (0, 0), and does not exceed
<td><ahref="#SkBitmap_writePixels_2_src">src</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a> is less than <ahref="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a></td></tr><tr>
<td><ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td></tr>
</table>
Pixels are copied only if pixel conversion is possible. If this-><ahref="#SkBitmap_colorType">colorType</a> is
<ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, or <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <ahref="#SkBitmap_writePixels_2_src">src</a><ahref="undocumented#Color_Type">Color Type</a> must match.
If this-><ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, <ahref="#SkBitmap_writePixels_2_src">src</a><ahref="undocumented#Color_Space">Color Space</a> must match.
If this-><ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <ahref="#SkBitmap_writePixels_2_src">src</a><ahref="undocumented#Alpha_Type">Alpha Type</a> must
match. If this-><ahref="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <ahref="#SkBitmap_writePixels_2_src">src</a><ahref="undocumented#Color_Space">Color Space</a> must match. Returns
bool writePixels(const SkPixmap& src, int x, int y,
SkTransferFunctionBehavior behavior)
</pre>
Copies a <ahref="SkRect_Reference#Rect">Rect</a> of pixels from <ahref="#SkBitmap_writePixels_3_src">src</a>. Copy starts at (0, 0), and does not exceed
<td><ahref="#SkBitmap_writePixels_3_src">src</a>.<ahref="#SkBitmap_rowBytes">rowBytes</a> is less than <ahref="#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a></td></tr><tr>
<td><ahref="undocumented#Pixel_Ref">Pixel Ref</a> is nullptr</td></tr>
</table>
Pixels are copied only if pixel conversion is possible. If this-><ahref="#SkBitmap_colorType">colorType</a> is
<ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, or <ahref="undocumented#SkColorType">kAlpha 8 SkColorType</a>; <ahref="#SkBitmap_writePixels_3_src">src</a><ahref="undocumented#Color_Type">Color Type</a> must match.
If this-><ahref="#SkBitmap_colorType">colorType</a> is <ahref="undocumented#SkColorType">kGray 8 SkColorType</a>, <ahref="#SkBitmap_writePixels_3_src">src</a><ahref="undocumented#Color_Space">Color Space</a> must match.
If this-><ahref="#SkBitmap_alphaType">alphaType</a> is <ahref="undocumented#SkAlphaType">kOpaque SkAlphaType</a>, <ahref="#SkBitmap_writePixels_3_src">src</a><ahref="undocumented#Alpha_Type">Alpha Type</a> must
match. If this-><ahref="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <ahref="#SkBitmap_writePixels_3_src">src</a><ahref="undocumented#Color_Space">Color Space</a> must match. Returns
false if pixel conversion is not possible. Returns false if <ahref="#SkBitmap_width">width</a> or <ahref="#SkBitmap_height">height</a>
is zero or negative.
If <ahref="#SkBitmap_writePixels_3_behavior">behavior</a> is <ahref="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts <ahref="#SkBitmap_writePixels_3_src">src</a>
pixels to a linear space before converting to <ahref="#Info">Image Info</a>.
If <ahref="#SkBitmap_writePixels_3_behavior">behavior</a> is <ahref="#SkTransferFunctionBehavior_kIgnore">SkTransferFunctionBehavior::kIgnore</a>: <ahref="#SkBitmap_writePixels_3_src">src</a>
pixels are treated as if they are linear, regardless of how they are encoded.
Sets <ahref="#SkBitmap_extractAlpha_dst">dst</a> to <ahref="#Alpha">Alpha</a> described by pixels. Returns false if <ahref="#SkBitmap_extractAlpha_dst">dst</a> cannot be written to
or <ahref="#SkBitmap_extractAlpha_dst">dst</a> pixels cannot be allocated.
Uses <ahref="#SkBitmap_HeapAllocator">HeapAllocator</a> to reserve memory for <ahref="#SkBitmap_extractAlpha_dst">dst</a><ahref="undocumented#Pixel_Ref">Pixel Ref</a>.
Sets <ahref="#SkBitmap_extractAlpha_2_dst">dst</a> to <ahref="#Alpha">Alpha</a> described by pixels. Returns false if <ahref="#SkBitmap_extractAlpha_2_dst">dst</a> cannot be written to
or <ahref="#SkBitmap_extractAlpha_2_dst">dst</a> pixels cannot be allocated.
If <ahref="#SkBitmap_extractAlpha_2_paint">paint</a> is not nullptr and contains <ahref="undocumented#Mask_Filter">Mask Filter</a>, <ahref="#SkMaskFilter_filterMask">SkMaskFilter::filterMask</a>
generates <ahref="undocumented#Mask_Alpha">Mask Alpha</a> from <ahref="#Bitmap">Bitmap</a>. Uses <ahref="#SkBitmap_HeapAllocator">HeapAllocator</a> to reserve memory for <ahref="#SkBitmap_extractAlpha_2_dst">dst</a>
<ahref="undocumented#Pixel_Ref">Pixel Ref</a>. Sets <ahref="#SkBitmap_extractAlpha_2_offset">offset</a> to top-left position for <ahref="#SkBitmap_extractAlpha_2_dst">dst</a> for alignment with <ahref="#Bitmap">Bitmap</a>;
Sets <ahref="#SkBitmap_extractAlpha_3_dst">dst</a> to <ahref="#Alpha">Alpha</a> described by pixels. Returns false if <ahref="#SkBitmap_extractAlpha_3_dst">dst</a> cannot be written to
or <ahref="#SkBitmap_extractAlpha_3_dst">dst</a> pixels cannot be allocated.
If <ahref="#SkBitmap_extractAlpha_3_paint">paint</a> is not nullptr and contains <ahref="undocumented#Mask_Filter">Mask Filter</a>, <ahref="#SkMaskFilter_filterMask">SkMaskFilter::filterMask</a>
generates <ahref="undocumented#Mask_Alpha">Mask Alpha</a> from <ahref="#Bitmap">Bitmap</a>. <ahref="#SkBitmap_extractAlpha_3_allocator">allocator</a> may reference a custom allocation
class or be set to nullptr to use <ahref="#SkBitmap_HeapAllocator">HeapAllocator</a>. Sets <ahref="#SkBitmap_extractAlpha_3_offset">offset</a> to top-left
position for <ahref="#SkBitmap_extractAlpha_3_dst">dst</a> for alignment with <ahref="#Bitmap">Bitmap</a>; (0, 0) unless <ahref="undocumented#SkMaskFilter">SkMaskFilter</a> generates
Copies <ahref="#Bitmap">Bitmap</a> pixel address, row bytes, and <ahref="#Info">Image Info</a> to <ahref="#SkBitmap_peekPixels_pixmap">pixmap</a>, if address
is available, and returns true. If pixel address is not available, return
false and leave <ahref="#SkBitmap_peekPixels_pixmap">pixmap</a> unchanged.
<ahref="#SkBitmap_peekPixels_pixmap">pixmap</a> contents become invalid on any future change to <ahref="#Bitmap">Bitmap</a>.