1SkBitmap Reference
2===
3
4
5<a name='SkBitmap'></a>
6
7---
8
9<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
10class <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> {
11
12    <a href='#SkBitmap_empty_constructor'>SkBitmap()</a>;
13    <a href='#SkBitmap_copy_const_SkBitmap'>SkBitmap</a>(const <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& src);
14    <a href='#SkBitmap_move_SkBitmap'>SkBitmap</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>&& src);
15    <a href='#SkBitmap_destructor'>~SkBitmap()</a>;
16    <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& <a href='#SkBitmap_copy_operator'>operator=</a>(const <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& src);
17    <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& <a href='#SkBitmap_move_operator'>operator=</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>&& src);
18    void <a href='#SkBitmap_swap'>swap</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& other);
19    const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='#SkBitmap_pixmap'>pixmap()</a> const;
20    const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& <a href='#SkBitmap_info'>info()</a> const;
21    int <a href='#SkBitmap_width'>width()</a> const;
22    int <a href='#SkBitmap_height'>height()</a> const;
23    <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkBitmap_colorType'>colorType</a>() const;
24    <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkBitmap_alphaType'>alphaType</a>() const;
25    <a href='undocumented#SkColorSpace'>SkColorSpace</a>* <a href='#SkBitmap_colorSpace'>colorSpace</a>() const;
26    <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkBitmap_refColorSpace'>refColorSpace</a>() const;
27    int <a href='#SkBitmap_bytesPerPixel'>bytesPerPixel</a>() const;
28    int <a href='#SkBitmap_rowBytesAsPixels'>rowBytesAsPixels</a>() const;
29    int <a href='#SkBitmap_shiftPerPixel'>shiftPerPixel</a>() const;
30    bool <a href='#SkBitmap_empty'>empty()</a> const;
31    bool <a href='#SkBitmap_isNull'>isNull</a>() const;
32    bool <a href='#SkBitmap_drawsNothing'>drawsNothing</a>() const;
33    size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>() const;
34    bool <a href='#SkBitmap_setAlphaType'>setAlphaType</a>(<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkBitmap_alphaType'>alphaType</a>);
35    void* <a href='#SkBitmap_getPixels'>getPixels</a>() const;
36    size_t <a href='#SkBitmap_computeByteSize'>computeByteSize</a>() const;
37    bool <a href='#SkBitmap_isImmutable'>isImmutable</a>() const;
38    void <a href='#SkBitmap_setImmutable'>setImmutable</a>();
39    bool <a href='#SkBitmap_isOpaque'>isOpaque</a>() const;
40    bool <a href='#SkBitmap_isVolatile'>isVolatile</a>() const;
41    void <a href='#SkBitmap_setIsVolatile'>setIsVolatile</a>(bool <a href='#SkBitmap_isVolatile'>isVolatile</a>);
42    void <a href='#SkBitmap_reset'>reset()</a>;
43    static bool <a href='#SkBitmap_ComputeIsOpaque'>ComputeIsOpaque</a>(const <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& bm);
44    void <a href='#SkBitmap_getBounds'>getBounds</a>(<a href='SkRect_Reference#SkRect'>SkRect</a>* bounds) const;
45    void <a href='#SkBitmap_getBounds'>getBounds</a>(<a href='SkIRect_Reference#SkIRect'>SkIRect</a>* bounds) const;
46    <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkBitmap_bounds'>bounds()</a> const;
47    <a href='undocumented#SkISize'>SkISize</a> <a href='#SkBitmap_dimensions'>dimensions()</a> const;
48    <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkBitmap_getSubset'>getSubset</a>() const;
49    bool <a href='#SkBitmap_setInfo'>setInfo</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& imageInfo, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a> = 0);
50
51    enum <a href='#SkBitmap_AllocFlags'>AllocFlags</a> {
52        <a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a> = 1 << 0,
53    };
54
55    bool <a href='#SkBitmap_tryAllocPixelsFlags'>tryAllocPixelsFlags</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, uint32_t flags);
56    void <a href='#SkBitmap_allocPixelsFlags'>allocPixelsFlags</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, uint32_t flags);
57    bool <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>);
58    void <a href='#SkBitmap_allocPixels'>allocPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>);
59    bool <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info);
60    void <a href='#SkBitmap_allocPixels'>allocPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info);
61    bool <a href='#SkBitmap_tryAllocN32Pixels'>tryAllocN32Pixels</a>(int width, int height, bool <a href='#SkBitmap_isOpaque'>isOpaque</a> = false);
62    void <a href='#SkBitmap_allocN32Pixels'>allocN32Pixels</a>(int width, int height, bool <a href='#SkBitmap_isOpaque'>isOpaque</a> = false);
63    bool <a href='#SkBitmap_installPixels'>installPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, void* pixels, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>,
64                       void (*releaseProc)(void* addr, void* context), void* context);
65    bool <a href='#SkBitmap_installPixels'>installPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, void* pixels, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>);
66    bool <a href='#SkBitmap_installPixels'>installPixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='SkPixmap_Reference#Pixmap'>pixmap</a>);
67    void <a href='#SkBitmap_setPixels'>setPixels</a>(void* pixels);
68    bool <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>();
69    void <a href='#SkBitmap_allocPixels'>allocPixels</a>();
70    bool <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>(<a href='#SkBitmap_Allocator'>Allocator</a>* allocator);
71    void <a href='#SkBitmap_allocPixels'>allocPixels</a>(<a href='#SkBitmap_Allocator'>Allocator</a>* allocator);
72    <a href='undocumented#SkPixelRef'>SkPixelRef</a>* <a href='#SkBitmap_pixelRef'>pixelRef</a>() const;
73    <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a> <a href='#SkBitmap_pixelRefOrigin'>pixelRefOrigin</a>() const;
74    void <a href='#SkBitmap_setPixelRef'>setPixelRef</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkPixelRef'>SkPixelRef</a>> <a href='#SkBitmap_pixelRef'>pixelRef</a>, int dx, int dy);
75    bool <a href='#SkBitmap_readyToDraw'>readyToDraw</a>() const;
76    uint32_t <a href='#SkBitmap_getGenerationID'>getGenerationID</a>() const;
77    void <a href='#SkBitmap_notifyPixelsChanged'>notifyPixelsChanged</a>() const;
78    void <a href='#SkBitmap_eraseColor'>eraseColor</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> c) const;
79    void <a href='#SkBitmap_eraseARGB'>eraseARGB</a>(<a href='undocumented#U8CPU'>U8CPU</a> a, <a href='undocumented#U8CPU'>U8CPU</a> r, <a href='undocumented#U8CPU'>U8CPU</a> g, <a href='undocumented#U8CPU'>U8CPU</a> b) const;
80    void <a href='#SkBitmap_erase'>erase</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> c, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& area) const;
81    <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='#SkBitmap_getColor'>getColor</a>(int x, int y) const;
82    float <a href='#SkBitmap_getAlphaf'>getAlphaf</a>(int x, int y) const;
83    void* <a href='#SkBitmap_getAddr'>getAddr</a>(int x, int y) const;
84    uint32_t* <a href='#SkBitmap_getAddr32'>getAddr32</a>(int x, int y) const;
85    uint16_t* <a href='#SkBitmap_getAddr16'>getAddr16</a>(int x, int y) const;
86    uint8_t* <a href='#SkBitmap_getAddr8'>getAddr8</a>(int x, int y) const;
87    bool <a href='#SkBitmap_extractSubset'>extractSubset</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* dst, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& subset) const;
88    bool <a href='#SkBitmap_readPixels'>readPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& dstInfo, void* dstPixels, size_t dstRowBytes,
89                    int srcX, int srcY) const;
90    bool <a href='#SkBitmap_readPixels'>readPixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& dst, int srcX, int srcY) const;
91    bool <a href='#SkBitmap_readPixels'>readPixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& dst) const;
92    bool <a href='#SkBitmap_writePixels'>writePixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& src, int dstX, int dstY);
93    bool <a href='#SkBitmap_writePixels'>writePixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& src);
94    bool <a href='#SkBitmap_extractAlpha'>extractAlpha</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* dst) const;
95    bool <a href='#SkBitmap_extractAlpha'>extractAlpha</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* dst, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>* <a href='SkPaint_Reference#Paint'>paint</a>,
96                      <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a>* offset) const;
97    bool <a href='#SkBitmap_extractAlpha'>extractAlpha</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* dst, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>* <a href='SkPaint_Reference#Paint'>paint</a>, <a href='#SkBitmap_Allocator'>Allocator</a>* allocator,
98                      <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a>* offset) const;
99    bool <a href='#SkBitmap_peekPixels'>peekPixels</a>(<a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>* <a href='SkPixmap_Reference#Pixmap'>pixmap</a>) const;
100    void <a href='#SkBitmap_validate'>validate()</a> const;
101};
102
103</pre>
104
105<a href='SkBitmap_Reference#Bitmap'>Bitmap</a> describes a two-dimensional raster <a href='undocumented#Pixel'>pixel</a> array. <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> is built on
106<a href='#Image_Info'>Image_Info</a>, containing integer width and height, <a href='#Image_Info_Color_Type'>Color_Type</a> and <a href='#Image_Info_Alpha_Type'>Alpha_Type</a>
107describing the <a href='undocumented#Pixel'>pixel</a> format, and <a href='#Color_Space'>Color_Space</a> describing the range of colors.
108<a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='SkPoint_Reference#Point'>points</a> to <a href='#Pixel_Ref'>Pixel_Ref</a>, which describes the physical array of pixels.
109<a href='#Image_Info'>Image_Info</a> bounds may be located anywhere fully inside <a href='#Pixel_Ref'>Pixel_Ref</a> bounds.
110
111<a href='SkBitmap_Reference#Bitmap'>Bitmap</a> can be drawn using <a href='SkCanvas_Reference#Canvas'>Canvas</a>. <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> can be a drawing destination for <a href='SkCanvas_Reference#Canvas'>Canvas</a>
112draw member functions. <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> flexibility as a <a href='undocumented#Pixel'>pixel</a> container limits some
113optimizations available to the target platform.
114
115If <a href='undocumented#Pixel'>pixel</a> array is primarily read-only, use <a href='SkImage_Reference#Image'>Image</a> for better performance.
116If <a href='undocumented#Pixel'>pixel</a> array is primarily written to, use <a href='SkSurface_Reference#Surface'>Surface</a> for better performance.
117
118Declaring <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> const prevents altering <a href='#Image_Info'>Image_Info</a>: the <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> height, width,
119and so on cannot change. It does not affect <a href='#Pixel_Ref'>Pixel_Ref</a>: a caller may write its
120pixels. Declaring <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> const affects <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> configuration, not its contents.
121
122<a href='SkBitmap_Reference#Bitmap'>Bitmap</a> is not thread safe. Each thread must have its own copy of <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> fields,
123although threads may share the underlying <a href='undocumented#Pixel'>pixel</a> array.
124
125<a name='Row_Bytes'></a>
126
127<a href='SkBitmap_Reference#Bitmap'>Bitmap</a> pixels may be contiguous, or may have a gap at the end of each row.
128<a href='#Bitmap_Row_Bytes'>Row_Bytes</a> is the interval from one row to the next. <a href='#Bitmap_Row_Bytes'>Row_Bytes</a> may be specified;
129sometimes passing zero will compute the <a href='#Bitmap_Row_Bytes'>Row_Bytes</a> from the row width and the
130number of bytes in a <a href='undocumented#Pixel'>pixel</a>. <a href='#Bitmap_Row_Bytes'>Row_Bytes</a> may be larger than the row requires. This
131is useful to position one or more <a href='SkBitmap_Reference#Bitmap'>Bitmaps</a> within a shared <a href='undocumented#Pixel'>pixel</a> array.
132
133<a name='SkBitmap_Allocator'></a>
134
135---
136
137<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
138    class <a href='#SkBitmap_Allocator'>Allocator</a> : public <a href='undocumented#SkRefCnt'>SkRefCnt</a> {
139
140        virtual bool <a href='#SkBitmap_Allocator_allocPixelRef'>allocPixelRef</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* <a href='SkBitmap_Reference#Bitmap'>bitmap</a>) = 0;
141    };
142
143</pre>
144
145Abstract subclass of <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a>.
146
147<a name='SkBitmap_Allocator_allocPixelRef'></a>
148
149---
150
151<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
152virtual bool <a href='#SkBitmap_Allocator_allocPixelRef'>allocPixelRef</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* <a href='SkBitmap_Reference#Bitmap'>bitmap</a>) = 0
153</pre>
154
155Allocates the <a href='undocumented#Pixel'>pixel</a> memory for the <a href='#SkBitmap_Allocator_allocPixelRef_bitmap'>bitmap</a>, given its dimensions and
156<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>. Returns true on success, where success means either <a href='#SkBitmap_setPixels'>setPixels</a>()
157or <a href='#SkBitmap_setPixelRef'>setPixelRef</a>() was called.
158
159### Parameters
160
161<table>  <tr>    <td><a name='SkBitmap_Allocator_allocPixelRef_bitmap'><code><strong>bitmap</strong></code></a></td>
162    <td><a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> containing <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> as input, and <a href='undocumented#SkPixelRef'>SkPixelRef</a> as output</td>
163  </tr>
164</table>
165
166### Return Value
167
168true if <a href='undocumented#SkPixelRef'>SkPixelRef</a> was allocated
169
170### See Also
171
172<a href='#SkBitmap_HeapAllocator'>HeapAllocator</a>
173
174<a name='SkBitmap_HeapAllocator'></a>
175
176---
177
178<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
179    class <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a> : public <a href='#SkBitmap_Allocator'>Allocator</a> {
180
181        bool <a href='#SkBitmap_HeapAllocator_allocPixelRef'>allocPixelRef</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* <a href='SkBitmap_Reference#Bitmap'>bitmap</a>) override;
182    };
183
184</pre>
185
186Subclass of <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_Allocator'>Allocator</a> that returns a <a href='#Pixel_Ref'>Pixel_Ref</a> that allocates its <a href='undocumented#Pixel'>pixel</a>
187memory from the heap. This is the default <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_Allocator'>Allocator</a> invoked by
188<a href='#SkBitmap_allocPixels'>allocPixels</a>.
189
190<a name='SkBitmap_HeapAllocator_allocPixelRef'></a>
191
192---
193
194<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
195bool <a href='#SkBitmap_HeapAllocator_allocPixelRef'>allocPixelRef</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* <a href='SkBitmap_Reference#Bitmap'>bitmap</a>) override
196</pre>
197
198Allocates the <a href='undocumented#Pixel'>pixel</a> memory for the <a href='#SkBitmap_HeapAllocator_allocPixelRef_bitmap'>bitmap</a>, given its dimensions and
199<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>. Returns true on success, where success means either <a href='#SkBitmap_setPixels'>setPixels</a>()
200or <a href='#SkBitmap_setPixelRef'>setPixelRef</a>() was called.
201
202### Parameters
203
204<table>  <tr>    <td><a name='SkBitmap_HeapAllocator_allocPixelRef_bitmap'><code><strong>bitmap</strong></code></a></td>
205    <td><a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> containing <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> as input, and <a href='undocumented#SkPixelRef'>SkPixelRef</a> as output</td>
206  </tr>
207</table>
208
209### Return Value
210
211true if pixels are allocated
212
213### Example
214
215<div><fiddle-embed name="fe79a9c1ec350264eb9c7b2509dd3638">
216
217#### Example Output
218
219~~~~
220#Volatile
221pixel address = (nil)
222pixel address = 0x560ddd0ac670
223~~~~
224
225</fiddle-embed></div>
226
227### See Also
228
229<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_Allocator'>Allocator</a> <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>
230
231<a name='SkBitmap_empty_constructor'></a>
232
233---
234
235<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
236<a href='#SkBitmap_empty_constructor'>SkBitmap()</a>
237</pre>
238
239Creates an empty <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> without pixels, with <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>,
240<a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, and with a width and height of zero. <a href='undocumented#SkPixelRef'>SkPixelRef</a> origin is
241set to (0, 0). <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> is not volatile.
242
243Use <a href='#SkBitmap_setInfo'>setInfo</a>() to associate <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, width, and height
244after <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> has been created.
245
246### Return Value
247
248empty <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>
249
250### Example
251
252<div><fiddle-embed name="6739d14ec0d6a373f2fcadc6b3077fd4">
253
254#### Example Output
255
256~~~~
257width:  0  height:  0  color: kUnknown_SkColorType  alpha: kUnknown_SkAlphaType
258width: 25  height: 35  color: kRGBA_8888_SkColorType  alpha: kOpaque_SkAlphaType
259~~~~
260
261</fiddle-embed></div>
262
263### See Also
264
265<a href='#SkBitmap_setInfo'>setInfo</a>
266
267<a name='SkBitmap_copy_const_SkBitmap'></a>
268
269---
270
271<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
272<a href='#SkBitmap_copy_const_SkBitmap'>SkBitmap</a>(const <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& src)
273</pre>
274
275Copies settings from <a href='#SkBitmap_copy_const_SkBitmap_src'>src</a> to returned <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>. Shares pixels if <a href='#SkBitmap_copy_const_SkBitmap_src'>src</a> has pixels
276allocated, so both <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> reference the same pixels.
277
278### Parameters
279
280<table>  <tr>    <td><a name='SkBitmap_copy_const_SkBitmap_src'><code><strong>src</strong></code></a></td>
281    <td><a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> to copy <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, and share <a href='undocumented#SkPixelRef'>SkPixelRef</a></td>
282  </tr>
283</table>
284
285### Return Value
286
287copy of <a href='#SkBitmap_copy_const_SkBitmap_src'>src</a>
288
289### Example
290
291<div><fiddle-embed name="bbbae7a181bfd128a4484e8e9f454db1">
292
293#### Example Output
294
295~~~~
296original has pixels before copy: true
297original has pixels after copy: true
298copy has pixels: true
299~~~~
300
301</fiddle-embed></div>
302
303### See Also
304
305<a href='#SkBitmap_setInfo'>setInfo</a> <a href='#SkBitmap_setPixelRef'>setPixelRef</a> <a href='#SkBitmap_setPixels'>setPixels</a> <a href='#SkBitmap_swap'>swap</a>
306
307<a name='SkBitmap_move_SkBitmap'></a>
308
309---
310
311<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
312<a href='#SkBitmap_move_SkBitmap'>SkBitmap</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>&& src)
313</pre>
314
315Copies settings from <a href='#SkBitmap_move_SkBitmap_src'>src</a> to returned <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>. Moves ownership of <a href='#SkBitmap_move_SkBitmap_src'>src</a> pixels to
316<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>.
317
318### Parameters
319
320<table>  <tr>    <td><a name='SkBitmap_move_SkBitmap_src'><code><strong>src</strong></code></a></td>
321    <td><a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> to copy <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, and reassign <a href='undocumented#SkPixelRef'>SkPixelRef</a></td>
322  </tr>
323</table>
324
325### Return Value
326
327copy of <a href='#SkBitmap_move_SkBitmap_src'>src</a>
328
329### Example
330
331<div><fiddle-embed name="40afd4f1fa69e02d69d92b38252088ef">
332
333#### Example Output
334
335~~~~
336original has pixels before move: true
337original has pixels after move: false
338copy has pixels: true
339~~~~
340
341</fiddle-embed></div>
342
343### See Also
344
345<a href='#SkBitmap_setInfo'>setInfo</a> <a href='#SkBitmap_setPixelRef'>setPixelRef</a> <a href='#SkBitmap_setPixels'>setPixels</a> <a href='#SkBitmap_swap'>swap</a>
346
347<a name='SkBitmap_destructor'></a>
348
349---
350
351<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
352<a href='#SkBitmap_destructor'>~SkBitmap()</a>
353</pre>
354
355Decrements <a href='undocumented#SkPixelRef'>SkPixelRef</a> reference count, if <a href='undocumented#SkPixelRef'>SkPixelRef</a> is not nullptr.
356
357### See Also
358
359<a href='#Pixel_Ref'>Pixel_Ref</a>
360
361<a name='SkBitmap_copy_operator'></a>
362
363---
364
365<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
366<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& <a href='#SkBitmap_copy_operator'>operator=</a>(const <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& src)
367</pre>
368
369Copies settings from <a href='#SkBitmap_copy_operator_src'>src</a> to returned <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>. Shares pixels if <a href='#SkBitmap_copy_operator_src'>src</a> has pixels
370allocated, so both <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> reference the same pixels.
371
372### Parameters
373
374<table>  <tr>    <td><a name='SkBitmap_copy_operator_src'><code><strong>src</strong></code></a></td>
375    <td><a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> to copy <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, and share <a href='undocumented#SkPixelRef'>SkPixelRef</a></td>
376  </tr>
377</table>
378
379### Return Value
380
381copy of <a href='#SkBitmap_copy_operator_src'>src</a>
382
383### Example
384
385<div><fiddle-embed name="45279c519ae808f78bd30e9d84bdfdde">
386
387#### Example Output
388
389~~~~
390original has pixels before copy: true
391original has pixels after copy: true
392copy has pixels: true
393~~~~
394
395</fiddle-embed></div>
396
397### See Also
398
399<a href='#SkBitmap_setInfo'>setInfo</a> <a href='#SkBitmap_setPixelRef'>setPixelRef</a> <a href='#SkBitmap_setPixels'>setPixels</a> <a href='#SkBitmap_swap'>swap</a>
400
401<a name='SkBitmap_move_operator'></a>
402
403---
404
405<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
406<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& <a href='#SkBitmap_move_operator'>operator=</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>&& src)
407</pre>
408
409Copies settings from <a href='#SkBitmap_move_operator_src'>src</a> to returned <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>. Moves ownership of <a href='#SkBitmap_move_operator_src'>src</a> pixels to
410<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>.
411
412### Parameters
413
414<table>  <tr>    <td><a name='SkBitmap_move_operator_src'><code><strong>src</strong></code></a></td>
415    <td><a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> to copy <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, and reassign <a href='undocumented#SkPixelRef'>SkPixelRef</a></td>
416  </tr>
417</table>
418
419### Return Value
420
421copy of <a href='#SkBitmap_move_operator_src'>src</a>
422
423### Example
424
425<div><fiddle-embed name="35ea3fed27d8db22dc00f48670de64de">
426
427#### Example Output
428
429~~~~
430original has pixels before move: true
431original has pixels after move: false
432copy has pixels: true
433~~~~
434
435</fiddle-embed></div>
436
437### See Also
438
439<a href='#SkBitmap_setInfo'>setInfo</a> <a href='#SkBitmap_setPixelRef'>setPixelRef</a> <a href='#SkBitmap_setPixels'>setPixels</a> <a href='#SkBitmap_swap'>swap</a>
440
441<a name='SkBitmap_swap'></a>
442
443---
444
445<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
446void <a href='#SkBitmap_swap'>swap</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& other)
447</pre>
448
449Swaps the fields of the two <a href='SkBitmap_Reference#Bitmap'>bitmaps</a>.
450
451### Parameters
452
453<table>  <tr>    <td><a name='SkBitmap_swap_other'><code><strong>other</strong></code></a></td>
454    <td><a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> exchanged with original</td>
455  </tr>
456</table>
457
458### Example
459
460<div><fiddle-embed name="de9be45255e48fae445c916a41063abc">
461
462#### Example Output
463
464~~~~
465one width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType
466two width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType
467one width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType
468two width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType
469~~~~
470
471</fiddle-embed></div>
472
473### See Also
474
475<a href='#SkBitmap_move_SkBitmap'>SkBitmap</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>&& src) <a href='#SkBitmap_move_operator'>operator=</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>&& src)
476
477<a name='Property'></a>
478
479<a name='SkBitmap_pixmap'></a>
480
481---
482
483<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
484const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='#SkBitmap_pixmap'>pixmap()</a>const
485</pre>
486
487Returns a constant reference to the <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> holding the <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> <a href='undocumented#Pixel'>pixel</a>
488address, row bytes, and <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>.
489
490### Return Value
491
492reference to <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> describing this <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>
493
494### Example
495
496<div><fiddle-embed name="7f972d742dd78d2500034d8867e9ef2f">
497
498#### Example Output
499
500~~~~
501----------
502---xx-----
503--x--x----
504--x-------
505--xx------
506--x-x---x-
507-x---x--x-
508-x----xx--
509-xx---x---
510--xxxx-xx-
511----------
512~~~~
513
514</fiddle-embed></div>
515
516### See Also
517
518<a href='#SkBitmap_peekPixels'>peekPixels</a> <a href='#SkBitmap_installPixels'>installPixels</a> <a href='#SkBitmap_readPixels'>readPixels</a> <a href='#SkBitmap_writePixels'>writePixels</a>
519
520<a name='SkBitmap_info'></a>
521
522---
523
524<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
525const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& <a href='#SkBitmap_info'>info()</a>const
526</pre>
527
528Returns width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, and <a href='undocumented#SkColorSpace'>SkColorSpace</a>.
529
530### Return Value
531
532reference to <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>
533
534### Example
535
536<div><fiddle-embed name="ec47c4dc23e2925ad565eaba55a91553">
537
538#### Example Output
539
540~~~~
541width: 56 height: 56 color: BGRA_8888 alpha: Opaque
542~~~~
543
544</fiddle-embed></div>
545
546### See Also
547
548<a href='#Image_Info'>Image_Info</a>
549
550<a name='SkBitmap_width'></a>
551
552---
553
554<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
555int <a href='#SkBitmap_width'>width()</a>const
556</pre>
557
558Returns <a href='undocumented#Pixel'>pixel</a> count in each row. Should be equal or less than
559<code><a href='#SkBitmap_rowBytes'>rowBytes</a>() / <a href='#SkBitmap_info'>info()</a>.<a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>()</code>.
560
561May be less than <a href='#SkBitmap_pixelRef'>pixelRef</a>().<a href='#SkPixelRef_width'>width()</a>. Will not exceed <a href='#SkBitmap_pixelRef'>pixelRef</a>().<a href='#SkPixelRef_width'>width()</a> less
562<a href='#SkBitmap_pixelRefOrigin'>pixelRefOrigin</a>().<a href='#SkIPoint_fX'>fX</a>.
563
564### Return Value
565
566<a href='undocumented#Pixel'>pixel</a> width in <a href='#Image_Info'>Image_Info</a>
567
568### Example
569
570<div><fiddle-embed name="d06880c42f8bb3b4c3b67bd988046049">
571
572#### Example Output
573
574~~~~
575bitmap width: 16  info width: 16
576~~~~
577
578</fiddle-embed></div>
579
580### See Also
581
582<a href='#SkBitmap_height'>height()</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>::<a href='#SkPixelRef_width'>width()</a> <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_width'>width()</a>
583
584<a name='SkBitmap_height'></a>
585
586---
587
588<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
589int <a href='#SkBitmap_height'>height()</a>const
590</pre>
591
592Returns <a href='undocumented#Pixel'>pixel</a> row count.
593
594Maybe be less than <a href='#SkBitmap_pixelRef'>pixelRef</a>().<a href='#SkPixelRef_height'>height()</a>. Will not exceed <a href='#SkBitmap_pixelRef'>pixelRef</a>().<a href='#SkPixelRef_height'>height()</a> less
595<a href='#SkBitmap_pixelRefOrigin'>pixelRefOrigin</a>().<a href='#SkIPoint_fY'>fY</a>.
596
597### Return Value
598
599<a href='undocumented#Pixel'>pixel</a> height in <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>
600
601### Example
602
603<div><fiddle-embed name="c79a196278c58b34cd5f551b0124ecc9">
604
605#### Example Output
606
607~~~~
608bitmap height: 32  info height: 32
609~~~~
610
611</fiddle-embed></div>
612
613### See Also
614
615<a href='#SkBitmap_width'>width()</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>::<a href='#SkPixelRef_height'>height()</a> <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_height'>height()</a>
616
617<a name='SkBitmap_colorType'></a>
618
619---
620
621<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
622<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkBitmap_colorType'>colorType</a>()const
623</pre>
624
625Returns <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>,
626<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>,
627<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>,
628<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>
629.
630
631### Return Value
632
633<a href='#Image_Info_Color_Type'>Color_Type</a> in <a href='#Image_Info'>Image_Info</a>
634
635### Example
636
637<div><fiddle-embed name="ceb77fab7326b57822a147b04aa0960e">
638
639#### Example Output
640
641~~~~
642color type: kAlpha_8_SkColorType
643~~~~
644
645</fiddle-embed></div>
646
647### See Also
648
649<a href='#SkBitmap_alphaType'>alphaType</a>() <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_colorType'>colorType</a>
650
651<a name='SkBitmap_alphaType'></a>
652
653---
654
655<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
656<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkBitmap_alphaType'>alphaType</a>()const
657</pre>
658
659Returns <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>,
660<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>
661.
662
663### Return Value
664
665<a href='#Image_Info_Alpha_Type'>Alpha_Type</a> in <a href='#Image_Info'>Image_Info</a>
666
667### Example
668
669<div><fiddle-embed name="070b1a60232be499eb10c6ea62371804">
670
671#### Example Output
672
673~~~~
674alpha type: kPremul_SkAlphaType
675~~~~
676
677</fiddle-embed></div>
678
679### See Also
680
681<a href='#SkBitmap_colorType'>colorType</a>() <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_alphaType'>alphaType</a>
682
683<a name='SkBitmap_colorSpace'></a>
684
685---
686
687<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
688<a href='undocumented#SkColorSpace'>SkColorSpace</a>* <a href='#SkBitmap_colorSpace'>colorSpace</a>()const
689</pre>
690
691Returns <a href='undocumented#SkColorSpace'>SkColorSpace</a>, the range of colors, associated with <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>. The
692reference count of <a href='undocumented#SkColorSpace'>SkColorSpace</a> is unchanged. The returned <a href='undocumented#SkColorSpace'>SkColorSpace</a> is
693immutable.
694
695### Return Value
696
697<a href='undocumented#SkColorSpace'>SkColorSpace</a> in <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, or nullptr
698
699### Example
700
701<div><fiddle-embed name="817f95879fadba44baf87ea60e9b595a"><div><a href='undocumented#SkColorSpace'>SkColorSpace</a>::<a href='#SkColorSpace_MakeSRGBLinear'>MakeSRGBLinear</a> creates <a href='#Color_Space'>Color_Space</a> with linear gamma
702and an sRGB gamut. This <a href='#Color_Space'>Color_Space</a> gamma is not close to sRGB gamma.
703</div>
704
705#### Example Output
706
707~~~~
708gammaCloseToSRGB: false  gammaIsLinear: true  isSRGB: false
709~~~~
710
711</fiddle-embed></div>
712
713### See Also
714
715<a href='#Color_Space'>Color_Space</a> <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_colorSpace'>colorSpace</a>
716
717<a name='SkBitmap_refColorSpace'></a>
718
719---
720
721<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
722<a href='undocumented#sk_sp'>sk_sp</a>&lt;<a href='undocumented#SkColorSpace'>SkColorSpace</a>&gt; <a href='#SkBitmap_refColorSpace'>refColorSpace</a>()const
723</pre>
724
725Returns smart pointer to <a href='undocumented#SkColorSpace'>SkColorSpace</a>, the range of colors, associated with
726<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>. The smart pointer tracks the number of objects sharing this
727<a href='undocumented#SkColorSpace'>SkColorSpace</a> reference so the memory is released when the owners destruct.
728
729The returned <a href='undocumented#SkColorSpace'>SkColorSpace</a> is immutable.
730
731### Return Value
732
733<a href='undocumented#SkColorSpace'>SkColorSpace</a> in <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> wrapped in a smart pointer
734
735### Example
736
737<div><fiddle-embed name="cb028b7931da85b949ad0953b9711f9f">
738
739#### Example Output
740
741~~~~
742gammaCloseToSRGB: false  gammaIsLinear: true  isSRGB: false
743~~~~
744
745</fiddle-embed></div>
746
747### See Also
748
749<a href='#Color_Space'>Color_Space</a> <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_colorSpace'>colorSpace</a>
750
751<a name='SkBitmap_bytesPerPixel'></a>
752
753---
754
755<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
756int <a href='#SkBitmap_bytesPerPixel'>bytesPerPixel</a>()const
757</pre>
758
759Returns number of bytes per <a href='undocumented#Pixel'>pixel</a> required by <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>.
760Returns zero if <a href='#SkBitmap_colorType'>colorType</a>( is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>.
761
762### Return Value
763
764bytes in <a href='undocumented#Pixel'>pixel</a>
765
766### Example
767
768<div><fiddle-embed name="2a688e6f0a516c0d44a826381e9d637f"><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>,
769<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>,
770<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>,
771<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>
772
773#### Example Output
774
775~~~~
776color: kUnknown_SkColorType      bytesPerPixel: 0
777color: kAlpha_8_SkColorType      bytesPerPixel: 1
778color: kRGB_565_SkColorType      bytesPerPixel: 2
779color: kARGB_4444_SkColorType    bytesPerPixel: 2
780color: kRGBA_8888_SkColorType    bytesPerPixel: 4
781color: kRGB_888x_SkColorType     bytesPerPixel: 4
782color: kBGRA_8888_SkColorType    bytesPerPixel: 4
783color: kRGBA_1010102_SkColorType bytesPerPixel: 4
784color: kRGB_101010x_SkColorType  bytesPerPixel: 4
785color: kGray_8_SkColorType       bytesPerPixel: 1
786color: kRGBA_F16_SkColorType     bytesPerPixel: 8
787~~~~
788
789</fiddle-embed></div>
790
791### See Also
792
793<a href='#SkBitmap_rowBytes'>rowBytes</a> <a href='#SkBitmap_rowBytesAsPixels'>rowBytesAsPixels</a> <a href='#SkBitmap_width'>width</a> <a href='#SkBitmap_shiftPerPixel'>shiftPerPixel</a> <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>
794
795<a name='SkBitmap_rowBytesAsPixels'></a>
796
797---
798
799<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
800int <a href='#SkBitmap_rowBytesAsPixels'>rowBytesAsPixels</a>()const
801</pre>
802
803Returns number of pixels that fit on row. Should be greater than or equal to
804<a href='#SkBitmap_width'>width()</a>.
805
806### Return Value
807
808maximum pixels per row
809
810### Example
811
812<div><fiddle-embed name="03a9e08082a23a98de17c3e24871d61a">
813
814#### Example Output
815
816~~~~
817rowBytes: 4 rowBytesAsPixels: 1
818rowBytes: 5 rowBytesAsPixels: 1
819rowBytes: 6 rowBytesAsPixels: 1
820rowBytes: 7 rowBytesAsPixels: 1
821rowBytes: 8 rowBytesAsPixels: 2
822~~~~
823
824</fiddle-embed></div>
825
826### See Also
827
828<a href='#SkBitmap_rowBytes'>rowBytes</a> <a href='#SkBitmap_shiftPerPixel'>shiftPerPixel</a> <a href='#SkBitmap_width'>width</a> <a href='#SkBitmap_bytesPerPixel'>bytesPerPixel</a>
829
830<a name='SkBitmap_shiftPerPixel'></a>
831
832---
833
834<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
835int <a href='#SkBitmap_shiftPerPixel'>shiftPerPixel</a>()const
836</pre>
837
838Returns bit shift converting row bytes to row pixels.
839Returns zero for <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>.
840
841### Return Value
842
843one of: 0, 1, 2, 3; left shift to convert pixels to bytes
844
845### Example
846
847<div><fiddle-embed name="56ede4b7d45c15d5936f81ac3d74f070"><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>,
848<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>,
849<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>,
850<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>
851
852#### Example Output
853
854~~~~
855color: kUnknown_SkColorType       shiftPerPixel: 0
856color: kAlpha_8_SkColorType       shiftPerPixel: 0
857color: kRGB_565_SkColorType       shiftPerPixel: 1
858color: kARGB_4444_SkColorType     shiftPerPixel: 1
859color: kRGBA_8888_SkColorType     shiftPerPixel: 2
860color: kRGB_888x_SkColorType      shiftPerPixel: 2
861color: kBGRA_8888_SkColorType     shiftPerPixel: 2
862color: kRGBA_1010102_SkColorType  shiftPerPixel: 2
863color: kRGB_101010x_SkColorType   shiftPerPixel: 2
864color: kGray_8_SkColorType        shiftPerPixel: 0
865color: kRGBA_F16_SkColorType      shiftPerPixel: 3
866~~~~
867
868</fiddle-embed></div>
869
870### See Also
871
872<a href='#SkBitmap_rowBytes'>rowBytes</a> <a href='#SkBitmap_rowBytesAsPixels'>rowBytesAsPixels</a> <a href='#SkBitmap_width'>width</a> <a href='#SkBitmap_bytesPerPixel'>bytesPerPixel</a>
873
874<a name='SkBitmap_empty'></a>
875
876---
877
878<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
879bool <a href='#SkBitmap_empty'>empty()</a>const
880</pre>
881
882Returns true if either <a href='#SkBitmap_width'>width()</a> or <a href='#SkBitmap_height'>height()</a> are zero.
883
884Does not check if <a href='undocumented#SkPixelRef'>SkPixelRef</a> is nullptr; call <a href='#SkBitmap_drawsNothing'>drawsNothing</a>() to check <a href='#SkBitmap_width'>width()</a>,
885<a href='#SkBitmap_height'>height()</a>, and <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
886
887### Return Value
888
889true if dimensions do not enclose area
890
891### Example
892
893<div><fiddle-embed name="a3762c2722b56ba55e42689c527f146c">
894
895#### Example Output
896
897~~~~
898width: 0 height: 0 empty: true
899width: 0 height: 2 empty: true
900width: 2 height: 0 empty: true
901width: 2 height: 2 empty: false
902~~~~
903
904</fiddle-embed></div>
905
906### See Also
907
908<a href='#SkBitmap_height'>height()</a> <a href='#SkBitmap_width'>width()</a> <a href='#SkBitmap_drawsNothing'>drawsNothing</a>
909
910<a name='SkBitmap_isNull'></a>
911
912---
913
914<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
915bool <a href='#SkBitmap_isNull'>isNull</a>()const
916</pre>
917
918Returns true if <a href='undocumented#SkPixelRef'>SkPixelRef</a> is nullptr.
919
920Does not check if <a href='#SkBitmap_width'>width()</a> or <a href='#SkBitmap_height'>height()</a> are zero; call <a href='#SkBitmap_drawsNothing'>drawsNothing</a>() to check
921<a href='#SkBitmap_width'>width()</a>, <a href='#SkBitmap_height'>height()</a>, and <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
922
923### Return Value
924
925true if no <a href='undocumented#SkPixelRef'>SkPixelRef</a> is associated
926
927### Example
928
929<div><fiddle-embed name="211ec89418011aa6e54aa2cc9567e003">
930
931#### Example Output
932
933~~~~
934empty bitmap does not have pixels
935bitmap with dimensions does not have pixels
936allocated bitmap does have pixels
937~~~~
938
939</fiddle-embed></div>
940
941### See Also
942
943<a href='#SkBitmap_empty'>empty()</a> <a href='#SkBitmap_drawsNothing'>drawsNothing</a> <a href='#SkBitmap_pixelRef'>pixelRef</a>
944
945<a name='SkBitmap_drawsNothing'></a>
946
947---
948
949<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
950bool <a href='#SkBitmap_drawsNothing'>drawsNothing</a>()const
951</pre>
952
953Returns true if <a href='#SkBitmap_width'>width()</a> or <a href='#SkBitmap_height'>height()</a> are zero, or if <a href='undocumented#SkPixelRef'>SkPixelRef</a> is nullptr.
954If true, <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> has no effect when drawn or drawn into.
955
956### Return Value
957
958true if drawing has no effect
959
960### Example
961
962<div><fiddle-embed name="daacf43394ce4045a362a48b5774deed">
963
964#### Example Output
965
966~~~~
967empty:true  isNull:true  drawsNothing:true
968empty:true  isNull:false drawsNothing:true
969empty:false isNull:true  drawsNothing:true
970empty:false isNull:false drawsNothing:false
971~~~~
972
973</fiddle-embed></div>
974
975### See Also
976
977<a href='#SkBitmap_empty'>empty()</a> <a href='#SkBitmap_isNull'>isNull</a> <a href='#SkBitmap_pixelRef'>pixelRef</a>
978
979<a name='SkBitmap_rowBytes'></a>
980
981---
982
983<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
984size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>()const
985</pre>
986
987Returns row bytes, the interval from one <a href='undocumented#Pixel'>pixel</a> row to the next. Row bytes
988is at least as large as: <code><a href='#SkBitmap_width'>width()</a> * <a href='#SkBitmap_info'>info()</a>.<a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>()</code>.
989
990Returns zero if <a href='#SkBitmap_colorType'>colorType</a> is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, or if row bytes supplied to
991<a href='#SkBitmap_setInfo'>setInfo</a> is not large enough to hold a row of pixels.
992
993### Return Value
994
995byte length of <a href='undocumented#Pixel'>pixel</a> row
996
997### Example
998
999<div><fiddle-embed name="a654fd0b73f424859ae6c95e03f55099">
1000
1001#### Example Output
1002
1003~~~~
1004setInfo returned:false rowBytes:0
1005setInfo returned:true  rowBytes:8
1006~~~~
1007
1008</fiddle-embed></div>
1009
1010### See Also
1011
1012<a href='#SkBitmap_info'>info()</a> <a href='#SkBitmap_setInfo'>setInfo</a> <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>
1013
1014<a name='SkBitmap_setAlphaType'></a>
1015
1016---
1017
1018<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1019bool <a href='#SkBitmap_setAlphaType'>setAlphaType</a>(<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkBitmap_alphaType'>alphaType</a>)
1020</pre>
1021
1022Sets <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, if <a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is compatible with <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>.
1023Returns true unless <a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a> and current <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>
1024is not <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>.
1025
1026Returns true if <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>. <a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is ignored, and
1027<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> remains <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>.
1028
1029Returns true if <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> or <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>.
1030<a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is ignored, and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> remains <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>.
1031
1032If <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is <a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>,
1033<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, or <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>: returns true unless
1034<a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a> and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is not <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>.
1035If <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, <a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is ignored.
1036
1037If <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, returns true unless
1038<a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a> and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is not <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>.
1039If <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, <a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is ignored. If <a href='#SkBitmap_setAlphaType_alphaType'>alphaType</a> is
1040<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>, it is treated as <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>.
1041
1042This changes <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> in <a href='undocumented#SkPixelRef'>SkPixelRef</a>; all <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> sharing <a href='undocumented#SkPixelRef'>SkPixelRef</a>
1043are affected.
1044
1045### Parameters
1046
1047<table>  <tr>    <td><a name='SkBitmap_setAlphaType_alphaType'><code><strong>alphaType</strong></code></a></td>
1048    <td>one of:</td>
1049  </tr>
1050</table>
1051
1052<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>,
1053<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>
1054
1055### Return Value
1056
1057true if <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is set
1058
1059### Example
1060
1061<div><fiddle-embed name="af3adcbea7b58bf90298ca5e0ea93030"><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>,
1062<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>
1063<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>,
1064<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>,
1065<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>,
1066<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>
1067</fiddle-embed></div>
1068
1069### See Also
1070
1071<a href='#Image_Info_Alpha_Type'>Alpha_Type</a> <a href='#Image_Info_Color_Type'>Color_Type</a> <a href='#Image_Info'>Image_Info</a> <a href='#SkBitmap_setInfo'>setInfo</a>
1072
1073<a name='SkBitmap_getPixels'></a>
1074
1075---
1076
1077<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1078void* <a href='#SkBitmap_getPixels'>getPixels</a>()const
1079</pre>
1080
1081Returns <a href='undocumented#Pixel'>pixel</a> address, the base address corresponding to the <a href='undocumented#Pixel'>pixel</a> origin.
1082
1083### Return Value
1084
1085<a href='undocumented#Pixel'>pixel</a> address
1086
1087### Example
1088
1089<div><fiddle-embed name="e006bb05cf74ec8d2b3d6adeb5dba11b">
1090
1091#### Example Output
1092
1093~~~~
1094bitmap.getColor(0, 1) == 0x00000000
1095bitmap.getColor(0, 0) == 0xFFFFFFFF
1096~~~~
1097
1098</fiddle-embed></div>
1099
1100### See Also
1101
1102<a href='#SkBitmap_isNull'>isNull</a> <a href='#SkBitmap_drawsNothing'>drawsNothing</a>
1103
1104<a name='SkBitmap_computeByteSize'></a>
1105
1106---
1107
1108<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1109size_t <a href='#SkBitmap_computeByteSize'>computeByteSize</a>()const
1110</pre>
1111
1112Returns minimum memory required for <a href='undocumented#Pixel'>pixel</a> storage.
1113Does not include unused memory on last row when <a href='#SkBitmap_rowBytesAsPixels'>rowBytesAsPixels</a>() exceeds <a href='#SkBitmap_width'>width()</a>.
1114Returns zero if result does not fit in size_t.
1115Returns zero if <a href='#SkBitmap_height'>height()</a> or <a href='#SkBitmap_width'>width()</a> is 0.
1116Returns <a href='#SkBitmap_height'>height()</a> times <a href='#SkBitmap_rowBytes'>rowBytes</a>() if <a href='#SkBitmap_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>.
1117
1118### Return Value
1119
1120<a href='undocumented#Size'>size</a> in bytes of <a href='SkImage_Reference#Image'>image</a> buffer
1121
1122### Example
1123
1124<div><fiddle-embed name="165c8f208829fc0908e8a50da60c0076">
1125
1126#### Example Output
1127
1128~~~~
1129width:       1 height:       1 computeByteSize:             4
1130width:       1 height:    1000 computeByteSize:          4999
1131width:       1 height: 1000000 computeByteSize:       4999999
1132width:    1000 height:       1 computeByteSize:          4000
1133width:    1000 height:    1000 computeByteSize:       4999000
1134width:    1000 height: 1000000 computeByteSize:    4999999000
1135width: 1000000 height:       1 computeByteSize:       4000000
1136width: 1000000 height:    1000 computeByteSize:    4999000000
1137width: 1000000 height: 1000000 computeByteSize: 4999999000000
1138~~~~
1139
1140</fiddle-embed></div>
1141
1142### See Also
1143
1144<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_computeByteSize'>computeByteSize</a>
1145
1146<a name='SkBitmap_isImmutable'></a>
1147
1148---
1149
1150<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1151bool <a href='#SkBitmap_isImmutable'>isImmutable</a>()const
1152</pre>
1153
1154Returns true if pixels can not change.
1155
1156Most immutable <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> checks trigger an assert only on debug builds.
1157
1158### Return Value
1159
1160true if pixels are immutable
1161
1162### Example
1163
1164<div><fiddle-embed name="db61fdcd382342ee88ea1b4f27c27b95">
1165
1166#### Example Output
1167
1168~~~~
1169original is immutable
1170copy is immutable
1171~~~~
1172
1173</fiddle-embed></div>
1174
1175### See Also
1176
1177<a href='#SkBitmap_setImmutable'>setImmutable</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>::<a href='#SkPixelRef_isImmutable'>isImmutable</a> <a href='SkImage_Reference#SkImage'>SkImage</a>
1178
1179<a name='SkBitmap_setImmutable'></a>
1180
1181---
1182
1183<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1184void <a href='#SkBitmap_setImmutable'>setImmutable</a>()
1185</pre>
1186
1187Sets internal flag to mark <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> as immutable. Once set, pixels can not change.
1188Any other <a href='SkBitmap_Reference#Bitmap'>bitmap</a> sharing the same <a href='undocumented#SkPixelRef'>SkPixelRef</a> are also marked as immutable.
1189Once <a href='undocumented#SkPixelRef'>SkPixelRef</a> is marked immutable, the setting cannot be cleared.
1190
1191Writing to immutable <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> pixels triggers an assert on debug builds.
1192
1193### Example
1194
1195<div><fiddle-embed name="9210060d1f4ca46e1375496237902ef3"><div>Triggers assert if SK_DEBUG is true, runs fine otherwise.
1196</div></fiddle-embed></div>
1197
1198### See Also
1199
1200<a href='#SkBitmap_isImmutable'>isImmutable</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>::<a href='#SkPixelRef_setImmutable'>setImmutable</a> <a href='SkImage_Reference#SkImage'>SkImage</a>
1201
1202<a name='SkBitmap_isOpaque'></a>
1203
1204---
1205
1206<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1207bool <a href='#SkBitmap_isOpaque'>isOpaque</a>()const
1208</pre>
1209
1210Returns true if <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is set to hint that all pixels are opaque; their
1211<a href='SkColor_Reference#Alpha'>alpha</a> value is implicitly or explicitly 1.0. If true, and all pixels are
1212not opaque, Skia may draw incorrectly.
1213
1214Does 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
1215transparency.
1216
1217### Return Value
1218
1219true if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>
1220
1221### Example
1222
1223<div><fiddle-embed name="5e76b68bb46d54315eb0c12d83bd6949"><div><a href='#SkBitmap_isOpaque'>isOpaque</a> ignores whether all pixels are opaque or not.
1224</div>
1225
1226#### Example Output
1227
1228~~~~
1229isOpaque: false
1230isOpaque: false
1231isOpaque: true
1232isOpaque: true
1233~~~~
1234
1235</fiddle-embed></div>
1236
1237### See Also
1238
1239<a href='#SkBitmap_ComputeIsOpaque'>ComputeIsOpaque</a> <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_isOpaque'>isOpaque</a>
1240
1241<a name='SkBitmap_isVolatile'></a>
1242
1243---
1244
1245<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1246bool <a href='#SkBitmap_isVolatile'>isVolatile</a>()const
1247</pre>
1248
1249Provides a hint to caller that pixels should not be cached. Only true if
1250<a href='#SkBitmap_setIsVolatile'>setIsVolatile</a>() has been called to mark as volatile.
1251
1252Volatile state is not shared by other <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> sharing the same <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
1253
1254### Return Value
1255
1256true if marked volatile
1257
1258### Example
1259
1260<div><fiddle-embed name="23c4543ac6cdd0e8fe762816a0dc2e03">
1261
1262#### Example Output
1263
1264~~~~
1265original is volatile
1266copy is not volatile
1267~~~~
1268
1269</fiddle-embed></div>
1270
1271### See Also
1272
1273<a href='#SkBitmap_setIsVolatile'>setIsVolatile</a>
1274
1275<a name='SkBitmap_setIsVolatile'></a>
1276
1277---
1278
1279<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1280void <a href='#SkBitmap_setIsVolatile'>setIsVolatile</a>(bool <a href='#SkBitmap_isVolatile'>isVolatile</a>)
1281</pre>
1282
1283Sets if pixels should be read from <a href='undocumented#SkPixelRef'>SkPixelRef</a> on every access. <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> are not
1284volatile by default; a GPU back end may upload <a href='undocumented#Pixel'>pixel</a> values expecting them to be
1285accessed repeatedly. Marking temporary <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> as volatile provides a hint to
1286<a href='undocumented#SkBaseDevice'>SkBaseDevice</a> that the <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> pixels should not be cached. This can
1287improve performance by avoiding overhead and reducing resource
1288consumption on <a href='undocumented#SkBaseDevice'>SkBaseDevice</a>.
1289
1290### Parameters
1291
1292<table>  <tr>    <td><a name='SkBitmap_setIsVolatile_isVolatile'><code><strong>isVolatile</strong></code></a></td>
1293    <td>true if backing pixels are temporary</td>
1294  </tr>
1295</table>
1296
1297### Example
1298
1299<div><fiddle-embed name="e8627a4df659b896402f89a91326618f"></fiddle-embed></div>
1300
1301### See Also
1302
1303<a href='#SkBitmap_setIsVolatile_isVolatile'>isVolatile</a>
1304
1305<a name='SkBitmap_reset'></a>
1306
1307---
1308
1309<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1310void <a href='#SkBitmap_reset'>reset()</a>
1311</pre>
1312
1313Resets to its initial state; all fields are set to zero, as if <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> had
1314been initialized by <a href='#SkBitmap_empty_constructor'>SkBitmap()</a>.
1315
1316Sets width, height, row bytes to zero; <a href='undocumented#Pixel'>pixel</a> address to nullptr; <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> to
1317<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>.
1318
1319If <a href='undocumented#SkPixelRef'>SkPixelRef</a> is allocated, its reference count is decreased by one, releasing
1320its memory if <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> is the sole owner.
1321
1322### Example
1323
1324<div><fiddle-embed name="52ccaeda67924373c5b55a2b89fe314d">
1325
1326#### Example Output
1327
1328~~~~
1329width:1 height:1 isNull:false
1330width:0 height:0 isNull:true
1331~~~~
1332
1333</fiddle-embed></div>
1334
1335### See Also
1336
1337<a href='#SkBitmap_empty_constructor'>SkBitmap()</a> <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>
1338
1339<a name='SkBitmap_ComputeIsOpaque'></a>
1340
1341---
1342
1343<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1344static bool <a href='#SkBitmap_ComputeIsOpaque'>ComputeIsOpaque</a>(const <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& bm)
1345</pre>
1346
1347Returns true if all pixels are opaque. <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> determines how pixels
1348are 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>
1349without <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
1350pixels have <a href='SkColor_Reference#Alpha'>alpha</a> values equivalent to 1.0 or greater.
1351
1352For <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
1353returns 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>,
1354<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.
1355For <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.
1356For <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
1357greater.
1358
1359Returns false for <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>.
1360
1361### Parameters
1362
1363<table>  <tr>    <td><a name='SkBitmap_ComputeIsOpaque_bm'><code><strong>bm</strong></code></a></td>
1364    <td><a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> to check</td>
1365  </tr>
1366</table>
1367
1368### Return Value
1369
1370true if all pixels have opaque values or <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is opaque
1371
1372### Example
1373
1374<div><fiddle-embed name="9df1baa17658fbd0c419780f26fd854f">
1375
1376#### Example Output
1377
1378~~~~
1379computeIsOpaque: false
1380computeIsOpaque: true
1381computeIsOpaque: false
1382computeIsOpaque: true
1383~~~~
1384
1385</fiddle-embed></div>
1386
1387### See Also
1388
1389<a href='#SkBitmap_isOpaque'>isOpaque</a> <a href='#Image_Info_Color_Type'>Color_Type</a> <a href='SkColor_Reference#Alpha'>Alpha</a>
1390
1391<a name='SkBitmap_getBounds'></a>
1392
1393---
1394
1395<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1396void <a href='#SkBitmap_getBounds'>getBounds</a>(<a href='SkRect_Reference#SkRect'>SkRect</a>* bounds)const
1397</pre>
1398
1399Returns <a href='SkRect_Reference#SkRect'>SkRect</a> { 0, 0, <a href='#SkBitmap_width'>width()</a>, <a href='#SkBitmap_height'>height()</a> }.
1400
1401### Parameters
1402
1403<table>  <tr>    <td><a name='SkBitmap_getBounds_bounds'><code><strong>bounds</strong></code></a></td>
1404    <td>container for floating <a href='SkPoint_Reference#Point'>point</a> rectangle</td>
1405  </tr>
1406</table>
1407
1408### Example
1409
1410<div><fiddle-embed name="2431ebc7e7d1e91e6d9daafd0f7a478f"></fiddle-embed></div>
1411
1412### See Also
1413
1414<a href='#SkBitmap_bounds'>bounds()</a>
1415
1416<a name='SkBitmap_getBounds_2'></a>
1417
1418---
1419
1420<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1421void <a href='#SkBitmap_getBounds'>getBounds</a>(<a href='SkIRect_Reference#SkIRect'>SkIRect</a>* bounds)const
1422</pre>
1423
1424Returns <a href='SkIRect_Reference#SkIRect'>SkIRect</a> { 0, 0, <a href='#SkBitmap_width'>width()</a>, <a href='#SkBitmap_height'>height()</a> }.
1425
1426### Parameters
1427
1428<table>  <tr>    <td><a name='SkBitmap_getBounds_2_bounds'><code><strong>bounds</strong></code></a></td>
1429    <td>container for integral rectangle</td>
1430  </tr>
1431</table>
1432
1433### Example
1434
1435<div><fiddle-embed name="0c45da35172bc0a529b2faecddae62a2"></fiddle-embed></div>
1436
1437### See Also
1438
1439<a href='#SkBitmap_bounds'>bounds()</a>
1440
1441<a name='SkBitmap_bounds'></a>
1442
1443---
1444
1445<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1446<a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkBitmap_bounds'>bounds()</a>const
1447</pre>
1448
1449Returns <a href='SkIRect_Reference#SkIRect'>SkIRect</a> { 0, 0, <a href='#SkBitmap_width'>width()</a>, <a href='#SkBitmap_height'>height()</a> }.
1450
1451### Return Value
1452
1453integral rectangle from origin to <a href='#SkBitmap_width'>width()</a> and <a href='#SkBitmap_height'>height()</a>
1454
1455### Example
1456
1457<div><fiddle-embed name="3e9126152ff1cc592aef6facbcb5fc96"></fiddle-embed></div>
1458
1459### See Also
1460
1461<a href='#SkBitmap_getBounds'>getBounds</a>
1462
1463<a name='SkBitmap_dimensions'></a>
1464
1465---
1466
1467<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1468<a href='undocumented#SkISize'>SkISize</a> <a href='#SkBitmap_dimensions'>dimensions()</a>const
1469</pre>
1470
1471Returns <a href='undocumented#SkISize'>SkISize</a> { <a href='#SkBitmap_width'>width()</a>, <a href='#SkBitmap_height'>height()</a> }.
1472
1473### Return Value
1474
1475integral <a href='undocumented#Size'>size</a> of <a href='#SkBitmap_width'>width()</a> and <a href='#SkBitmap_height'>height()</a>
1476
1477### Example
1478
1479<div><fiddle-embed name="647056bcc12c27fb4413f212f33a2898"></fiddle-embed></div>
1480
1481### See Also
1482
1483<a href='#SkBitmap_height'>height</a> <a href='#SkBitmap_width'>width</a>
1484
1485<a name='SkBitmap_getSubset'></a>
1486
1487---
1488
1489<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1490<a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkBitmap_getSubset'>getSubset</a>()const
1491</pre>
1492
1493Returns the bounds of this <a href='SkBitmap_Reference#Bitmap'>bitmap</a>, offset by its <a href='undocumented#SkPixelRef'>SkPixelRef</a> origin.
1494
1495### Return Value
1496
1497bounds within <a href='undocumented#SkPixelRef'>SkPixelRef</a> bounds
1498
1499### Example
1500
1501<div><fiddle-embed name="d6dd0b425aa550f21b938a18c2e1a981">
1502
1503#### Example Output
1504
1505~~~~
1506source: 0, 0, 512, 512
1507subset: 100, 100, 412, 412
1508~~~~
1509
1510</fiddle-embed></div>
1511
1512### See Also
1513
1514<a href='#SkBitmap_extractSubset'>extractSubset</a> <a href='#SkBitmap_getBounds'>getBounds</a>
1515
1516<a name='SkBitmap_setInfo'></a>
1517
1518---
1519
1520<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1521bool <a href='#SkBitmap_setInfo'>setInfo</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& imageInfo, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a> = 0)
1522</pre>
1523
1524Sets width, height, <a href='#Image_Info_Alpha_Type'>Alpha_Type</a>, <a href='#Image_Info_Color_Type'>Color_Type</a>, <a href='#Color_Space'>Color_Space</a>, and optional
1525<a href='#SkBitmap_setInfo_rowBytes'>rowBytes</a>. Frees pixels, and returns true if successful.
1526
1527<a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_alphaType'>alphaType</a>() may be altered to a value permitted by <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_colorSpace'>colorSpace</a>().
1528If <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_alphaType'>alphaType</a>() is
1529set to <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>.
1530If <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a> and <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_alphaType'>alphaType</a>() is
1531<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>, <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_alphaType'>alphaType</a>() is replaced by <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>.
1532If <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> or <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>,
1533<a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_alphaType'>alphaType</a>() is set to <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>.
1534If <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>,
1535<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, or <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>: <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_alphaType'>alphaType</a>() remains
1536unchanged.
1537
1538<a href='#SkBitmap_setInfo_rowBytes'>rowBytes</a> must equal or exceed <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>(). If <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_colorSpace'>colorSpace</a>() is
1539<a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, <a href='#SkBitmap_setInfo_rowBytes'>rowBytes</a> is ignored and treated as zero; for all other
1540<a href='#Color_Space'>Color_Space</a> values, <a href='#SkBitmap_setInfo_rowBytes'>rowBytes</a> of zero is treated as <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>().
1541
1542Calls <a href='#SkBitmap_reset'>reset()</a> and returns false if:
1543
1544<table>  <tr>
1545    <td><a href='#SkBitmap_setInfo_rowBytes'>rowBytes</a> exceeds 31 bits</td>
1546  </tr>  <tr>
1547    <td><a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_width'>width()</a> is negative</td>
1548  </tr>  <tr>
1549    <td><a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_height'>height()</a> is negative</td>
1550  </tr>  <tr>
1551    <td><a href='#SkBitmap_setInfo_rowBytes'>rowBytes</a> is positive and less than <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_width'>width()</a> times <a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>()</td>
1552  </tr>
1553</table>
1554
1555### Parameters
1556
1557<table>  <tr>    <td><a name='SkBitmap_setInfo_imageInfo'><code><strong>imageInfo</strong></code></a></td>
1558    <td>contains width, height, <a href='#Image_Info_Alpha_Type'>Alpha_Type</a>, <a href='#Image_Info_Color_Type'>Color_Type</a>, <a href='#Color_Space'>Color_Space</a></td>
1559  </tr>
1560  <tr>    <td><a name='SkBitmap_setInfo_rowBytes'><code><strong>rowBytes</strong></code></a></td>
1561    <td><a href='#SkBitmap_setInfo_imageInfo'>imageInfo</a>.<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>() or larger; or zero</td>
1562  </tr>
1563</table>
1564
1565### Return Value
1566
1567true if <a href='#Image_Info'>Image_Info</a> set successfully
1568
1569### Example
1570
1571<div><fiddle-embed name="599ab64d0aea005498176249bbfb64eb"></fiddle-embed></div>
1572
1573### See Also
1574
1575<a href='#Image_Info_Alpha_Type'>Alpha_Type</a> <a href='#Image_Info_Color_Type'>Color_Type</a> <a href='#Color_Space'>Color_Space</a> <a href='#SkBitmap_height'>height</a> <a href='#SkBitmap_setInfo_rowBytes'>rowBytes</a> <a href='#SkBitmap_width'>width</a>
1576
1577<a name='SkBitmap_AllocFlags'></a>
1578
1579---
1580
1581<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1582    enum <a href='#SkBitmap_AllocFlags'>AllocFlags</a> {
1583        <a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a> = 1 << 0,
1584    };
1585
1586</pre>
1587
1588<a href='#SkBitmap_AllocFlags'>AllocFlags</a> provides the option to zero <a href='undocumented#Pixel'>pixel</a> memory when allocated.
1589
1590### Constants
1591
1592<table style='border-collapse: collapse; width: 62.5em'>
1593  <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th>
1594<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th>
1595<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr>
1596  <tr style='background-color: #f0f0f0; '>
1597    <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBitmap_kZeroPixels_AllocFlag'><code>SkBitmap::kZeroPixels_AllocFlag</code></a></td>
1598    <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td>
1599    <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
1600Instructs <a href='#SkBitmap_tryAllocPixelsFlags'>tryAllocPixelsFlags</a> and <a href='#SkBitmap_allocPixelsFlags'>allocPixelsFlags</a> to zero <a href='undocumented#Pixel'>pixel</a> memory.
1601</td>
1602  </tr>
1603</table>
1604
1605### See Also
1606
1607<a href='#SkBitmap_tryAllocPixelsFlags'>tryAllocPixelsFlags</a> <a href='#SkBitmap_allocPixelsFlags'>allocPixelsFlags</a> <a href='#SkBitmap_erase'>erase</a> <a href='#SkBitmap_eraseColor'>eraseColor</a>
1608
1609<a name='Allocate'></a>
1610
1611<a name='SkBitmap_tryAllocPixelsFlags'></a>
1612
1613---
1614
1615<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1616bool <a href='#SkBitmap_tryAllocPixelsFlags'>tryAllocPixelsFlags</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, uint32_t flags)
1617</pre>
1618
1619Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_tryAllocPixelsFlags_info'>info</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>() and allocates <a href='undocumented#Pixel'>pixel</a>
1620memory. If <a href='#SkBitmap_tryAllocPixelsFlags_flags'>flags</a> is <a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a>, memory is zeroed.
1621
1622Returns false and calls <a href='#SkBitmap_reset'>reset()</a> if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or memory could
1623not be allocated, or memory could not optionally be zeroed.
1624
1625On most platforms, allocating <a href='undocumented#Pixel'>pixel</a> memory may succeed even though there is
1626not sufficient memory to hold pixels; allocation does not take place
1627until the pixels are written to. The actual behavior depends on the platform
1628implementation of malloc(), if <a href='#SkBitmap_tryAllocPixelsFlags_flags'>flags</a> is zero, and calloc(), if <a href='#SkBitmap_tryAllocPixelsFlags_flags'>flags</a> is
1629<a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a>.
1630
1631<a href='#SkBitmap_tryAllocPixelsFlags_flags'>flags</a> set to <a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a> offers equal or better performance than
1632subsequently calling <a href='#SkBitmap_eraseColor'>eraseColor</a>() with <a href='SkColor_Reference#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a>.
1633
1634### Parameters
1635
1636<table>  <tr>    <td><a name='SkBitmap_tryAllocPixelsFlags_info'><code><strong>info</strong></code></a></td>
1637    <td>contains width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a></td>
1638  </tr>
1639  <tr>    <td><a name='SkBitmap_tryAllocPixelsFlags_flags'><code><strong>flags</strong></code></a></td>
1640    <td><a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a>, or zero</td>
1641  </tr>
1642</table>
1643
1644### Return Value
1645
1646true if pixels allocation is successful
1647
1648### Example
1649
1650<div><fiddle-embed name="f1d1880d38e0aea4cefd3e11745e8a09">
1651
1652#### Example Output
1653
1654~~~~
1655bitmap allocation succeeded!
1656~~~~
1657
1658</fiddle-embed></div>
1659
1660### See Also
1661
1662<a href='#SkBitmap_allocPixelsFlags'>allocPixelsFlags</a> <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a> <a href='undocumented#SkMallocPixelRef'>SkMallocPixelRef</a>::<a href='#SkMallocPixelRef_MakeZeroed'>MakeZeroed</a>
1663
1664<a name='SkBitmap_allocPixelsFlags'></a>
1665
1666---
1667
1668<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1669void <a href='#SkBitmap_allocPixelsFlags'>allocPixelsFlags</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, uint32_t flags)
1670</pre>
1671
1672Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_allocPixelsFlags_info'>info</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>() and allocates <a href='undocumented#Pixel'>pixel</a>
1673memory. If <a href='#SkBitmap_allocPixelsFlags_flags'>flags</a> is <a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a>, memory is zeroed.
1674
1675Aborts execution if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or memory could
1676not be allocated, or memory could not optionally
1677be zeroed. Abort steps may be provided by the user at compile time by defining
1678SK_ABORT.
1679
1680On most platforms, allocating <a href='undocumented#Pixel'>pixel</a> memory may succeed even though there is
1681not sufficient memory to hold pixels; allocation does not take place
1682until the pixels are written to. The actual behavior depends on the platform
1683implementation of malloc(), if <a href='#SkBitmap_allocPixelsFlags_flags'>flags</a> is zero, and calloc(), if <a href='#SkBitmap_allocPixelsFlags_flags'>flags</a> is
1684<a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a>.
1685
1686<a href='#SkBitmap_allocPixelsFlags_flags'>flags</a> set to <a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a> offers equal or better performance than
1687subsequently calling <a href='#SkBitmap_eraseColor'>eraseColor</a>() with <a href='SkColor_Reference#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a>.
1688
1689### Parameters
1690
1691<table>  <tr>    <td><a name='SkBitmap_allocPixelsFlags_info'><code><strong>info</strong></code></a></td>
1692    <td>contains width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a></td>
1693  </tr>
1694  <tr>    <td><a name='SkBitmap_allocPixelsFlags_flags'><code><strong>flags</strong></code></a></td>
1695    <td><a href='#SkBitmap_kZeroPixels_AllocFlag'>kZeroPixels_AllocFlag</a>, or zero</td>
1696  </tr>
1697</table>
1698
1699### Example
1700
1701<div><fiddle-embed name="737e721c7d9e0f367d25521a1b823b9d"><div><a href='undocumented#Text'>Text</a> is drawn on a transparent background; drawing the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> a second time
1702lets the first draw show through.
1703</div></fiddle-embed></div>
1704
1705### See Also
1706
1707<a href='#SkBitmap_tryAllocPixelsFlags'>tryAllocPixelsFlags</a> <a href='#SkBitmap_allocPixels'>allocPixels</a> <a href='undocumented#SkMallocPixelRef'>SkMallocPixelRef</a>::<a href='#SkMallocPixelRef_MakeZeroed'>MakeZeroed</a>
1708
1709<a name='SkBitmap_tryAllocPixels'></a>
1710
1711---
1712
1713<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1714bool <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>)
1715</pre>
1716
1717Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_tryAllocPixels_info'>info</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>() and allocates <a href='undocumented#Pixel'>pixel</a>
1718memory. <a href='#SkBitmap_tryAllocPixels_rowBytes'>rowBytes</a> must equal or exceed <a href='#SkBitmap_tryAllocPixels_info'>info</a>.<a href='#SkImageInfo_width'>width()</a> times <a href='#SkBitmap_tryAllocPixels_info'>info</a>.<a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>(),
1719or equal zero. Pass in zero for <a href='#SkBitmap_tryAllocPixels_rowBytes'>rowBytes</a> to compute the minimum valid value.
1720
1721Returns false and calls <a href='#SkBitmap_reset'>reset()</a> if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or memory could
1722not be allocated.
1723
1724On most platforms, allocating <a href='undocumented#Pixel'>pixel</a> memory may succeed even though there is
1725not sufficient memory to hold pixels; allocation does not take place
1726until the pixels are written to. The actual behavior depends on the platform
1727implementation of malloc().
1728
1729### Parameters
1730
1731<table>  <tr>    <td><a name='SkBitmap_tryAllocPixels_info'><code><strong>info</strong></code></a></td>
1732    <td>contains width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a></td>
1733  </tr>
1734  <tr>    <td><a name='SkBitmap_tryAllocPixels_rowBytes'><code><strong>rowBytes</strong></code></a></td>
1735    <td><a href='undocumented#Size'>size</a> of <a href='undocumented#Pixel'>pixel</a> row or larger; may be zero</td>
1736  </tr>
1737</table>
1738
1739### Return Value
1740
1741true if  <a href='undocumented#Pixel_Storage'>pixel storage</a> is allocated
1742
1743### Example
1744
1745<div><fiddle-embed name="34479d5aa23ce9f5e334b0786c9edb22"></fiddle-embed></div>
1746
1747### See Also
1748
1749<a href='#SkBitmap_tryAllocPixelsFlags'>tryAllocPixelsFlags</a> <a href='#SkBitmap_allocPixels'>allocPixels</a> <a href='undocumented#SkMallocPixelRef'>SkMallocPixelRef</a>::<a href='#SkMallocPixelRef_MakeAllocate'>MakeAllocate</a>
1750
1751<a name='SkBitmap_allocPixels'></a>
1752
1753---
1754
1755<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1756void <a href='#SkBitmap_allocPixels'>allocPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>)
1757</pre>
1758
1759Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_allocPixels_info'>info</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>() and allocates <a href='undocumented#Pixel'>pixel</a>
1760memory. <a href='#SkBitmap_allocPixels_rowBytes'>rowBytes</a> must equal or exceed <a href='#SkBitmap_allocPixels_info'>info</a>.<a href='#SkImageInfo_width'>width()</a> times <a href='#SkBitmap_allocPixels_info'>info</a>.<a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>(),
1761or equal zero. Pass in zero for <a href='#SkBitmap_allocPixels_rowBytes'>rowBytes</a> to compute the minimum valid value.
1762
1763Aborts execution if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or memory could
1764not be allocated. Abort steps may be provided by
1765the user at compile time by defining SK_ABORT.
1766
1767On most platforms, allocating <a href='undocumented#Pixel'>pixel</a> memory may succeed even though there is
1768not sufficient memory to hold pixels; allocation does not take place
1769until the pixels are written to. The actual behavior depends on the platform
1770implementation of malloc().
1771
1772### Parameters
1773
1774<table>  <tr>    <td><a name='SkBitmap_allocPixels_info'><code><strong>info</strong></code></a></td>
1775    <td>contains width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a></td>
1776  </tr>
1777  <tr>    <td><a name='SkBitmap_allocPixels_rowBytes'><code><strong>rowBytes</strong></code></a></td>
1778    <td><a href='undocumented#Size'>size</a> of <a href='undocumented#Pixel'>pixel</a> row or larger; may be zero</td>
1779  </tr>
1780</table>
1781
1782### Example
1783
1784<div><fiddle-embed name="555c0f62f96602a9dcd459badcd005e0"></fiddle-embed></div>
1785
1786### See Also
1787
1788<a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a> <a href='#SkBitmap_allocPixelsFlags'>allocPixelsFlags</a> <a href='undocumented#SkMallocPixelRef'>SkMallocPixelRef</a>::<a href='#SkMallocPixelRef_MakeAllocate'>MakeAllocate</a>
1789
1790<a name='SkBitmap_tryAllocPixels_2'></a>
1791
1792---
1793
1794<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1795bool <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info)
1796</pre>
1797
1798Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_tryAllocPixels_2_info'>info</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>() and allocates <a href='undocumented#Pixel'>pixel</a>
1799memory.
1800
1801Returns false and calls <a href='#SkBitmap_reset'>reset()</a> if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or memory could
1802not be allocated.
1803
1804On most platforms, allocating <a href='undocumented#Pixel'>pixel</a> memory may succeed even though there is
1805not sufficient memory to hold pixels; allocation does not take place
1806until the pixels are written to. The actual behavior depends on the platform
1807implementation of malloc().
1808
1809### Parameters
1810
1811<table>  <tr>    <td><a name='SkBitmap_tryAllocPixels_2_info'><code><strong>info</strong></code></a></td>
1812    <td>contains width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a></td>
1813  </tr>
1814</table>
1815
1816### Return Value
1817
1818true if  <a href='undocumented#Pixel_Storage'>pixel storage</a> is allocated
1819
1820### Example
1821
1822<div><fiddle-embed name="7ef3d043c4c5885649e591dd7dca92ff"></fiddle-embed></div>
1823
1824### See Also
1825
1826<a href='#SkBitmap_tryAllocPixelsFlags'>tryAllocPixelsFlags</a> <a href='#SkBitmap_allocPixels'>allocPixels</a> <a href='undocumented#SkMallocPixelRef'>SkMallocPixelRef</a>::<a href='#SkMallocPixelRef_MakeAllocate'>MakeAllocate</a>
1827
1828<a name='SkBitmap_allocPixels_2'></a>
1829
1830---
1831
1832<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1833void <a href='#SkBitmap_allocPixels'>allocPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info)
1834</pre>
1835
1836Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_allocPixels_2_info'>info</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>() and allocates <a href='undocumented#Pixel'>pixel</a>
1837memory.
1838
1839Aborts execution if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or memory could
1840not be allocated. Abort steps may be provided by
1841the user at compile time by defining SK_ABORT.
1842
1843On most platforms, allocating <a href='undocumented#Pixel'>pixel</a> memory may succeed even though there is
1844not sufficient memory to hold pixels; allocation does not take place
1845until the pixels are written to. The actual behavior depends on the platform
1846implementation of malloc().
1847
1848### Parameters
1849
1850<table>  <tr>    <td><a name='SkBitmap_allocPixels_2_info'><code><strong>info</strong></code></a></td>
1851    <td>contains width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a></td>
1852  </tr>
1853</table>
1854
1855### Example
1856
1857<div><fiddle-embed name="91f474a11a2112cd5c88c40a9015048d"></fiddle-embed></div>
1858
1859### See Also
1860
1861<a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a> <a href='#SkBitmap_allocPixelsFlags'>allocPixelsFlags</a> <a href='undocumented#SkMallocPixelRef'>SkMallocPixelRef</a>::<a href='#SkMallocPixelRef_MakeAllocate'>MakeAllocate</a>
1862
1863<a name='SkBitmap_tryAllocN32Pixels'></a>
1864
1865---
1866
1867<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1868bool <a href='#SkBitmap_tryAllocN32Pixels'>tryAllocN32Pixels</a>(int width, int height, bool <a href='#SkBitmap_isOpaque'>isOpaque</a> = false)
1869</pre>
1870
1871Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_tryAllocN32Pixels_width'>width</a>, <a href='#SkBitmap_tryAllocN32Pixels_height'>height</a>, and native  <a href='SkImageInfo_Reference#Color_Type'>color type</a>; and allocates
1872<a href='undocumented#Pixel'>pixel</a> memory. If <a href='#SkBitmap_tryAllocN32Pixels_isOpaque'>isOpaque</a> is true, sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>;
1873otherwise, sets to <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>.
1874
1875Calls <a href='#SkBitmap_reset'>reset()</a> and returns false if <a href='#SkBitmap_tryAllocN32Pixels_width'>width</a> exceeds 29 bits or is negative,
1876or <a href='#SkBitmap_tryAllocN32Pixels_height'>height</a> is negative.
1877
1878Returns false if allocation fails.
1879
1880Use to create <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> that matches <a href='SkColor_Reference#SkPMColor'>SkPMColor</a>, the native <a href='undocumented#Pixel'>pixel</a> arrangement on
1881the platform. <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> drawn to output <a href='undocumented#Device'>device</a> skips converting its <a href='undocumented#Pixel'>pixel</a> format.
1882
1883### Parameters
1884
1885<table>  <tr>    <td><a name='SkBitmap_tryAllocN32Pixels_width'><code><strong>width</strong></code></a></td>
1886    <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td>
1887  </tr>
1888  <tr>    <td><a name='SkBitmap_tryAllocN32Pixels_height'><code><strong>height</strong></code></a></td>
1889    <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td>
1890  </tr>
1891  <tr>    <td><a name='SkBitmap_tryAllocN32Pixels_isOpaque'><code><strong>isOpaque</strong></code></a></td>
1892    <td>true if pixels do not have transparency</td>
1893  </tr>
1894</table>
1895
1896### Return Value
1897
1898true if  <a href='undocumented#Pixel_Storage'>pixel storage</a> is allocated
1899
1900### Example
1901
1902<div><fiddle-embed name="a2b1e0910f37066f15ae56368775a6d8"></fiddle-embed></div>
1903
1904### See Also
1905
1906<a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a> <a href='#SkBitmap_allocN32Pixels'>allocN32Pixels</a> <a href='undocumented#SkMallocPixelRef'>SkMallocPixelRef</a>::<a href='#SkMallocPixelRef_MakeAllocate'>MakeAllocate</a>
1907
1908<a name='SkBitmap_allocN32Pixels'></a>
1909
1910---
1911
1912<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1913void <a href='#SkBitmap_allocN32Pixels'>allocN32Pixels</a>(int width, int height, bool <a href='#SkBitmap_isOpaque'>isOpaque</a> = false)
1914</pre>
1915
1916Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_allocN32Pixels_width'>width</a>, <a href='#SkBitmap_allocN32Pixels_height'>height</a>, and the native  <a href='SkImageInfo_Reference#Color_Type'>color type</a>; and allocates
1917<a href='undocumented#Pixel'>pixel</a> memory. If <a href='#SkBitmap_allocN32Pixels_isOpaque'>isOpaque</a> is true, sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>;
1918otherwise, sets to <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>.
1919
1920Aborts if <a href='#SkBitmap_allocN32Pixels_width'>width</a> exceeds 29 bits or is negative, or <a href='#SkBitmap_allocN32Pixels_height'>height</a> is negative, or
1921allocation fails. Abort steps may be provided by the user at compile time by
1922defining SK_ABORT.
1923
1924Use to create <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> that matches <a href='SkColor_Reference#SkPMColor'>SkPMColor</a>, the native <a href='undocumented#Pixel'>pixel</a> arrangement on
1925the platform. <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> drawn to output <a href='undocumented#Device'>device</a> skips converting its <a href='undocumented#Pixel'>pixel</a> format.
1926
1927### Parameters
1928
1929<table>  <tr>    <td><a name='SkBitmap_allocN32Pixels_width'><code><strong>width</strong></code></a></td>
1930    <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td>
1931  </tr>
1932  <tr>    <td><a name='SkBitmap_allocN32Pixels_height'><code><strong>height</strong></code></a></td>
1933    <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td>
1934  </tr>
1935  <tr>    <td><a name='SkBitmap_allocN32Pixels_isOpaque'><code><strong>isOpaque</strong></code></a></td>
1936    <td>true if pixels do not have transparency</td>
1937  </tr>
1938</table>
1939
1940### Example
1941
1942<div><fiddle-embed name="c717491f9251604724c9cbde7088ec20"></fiddle-embed></div>
1943
1944### See Also
1945
1946<a href='#SkBitmap_allocPixels'>allocPixels</a> <a href='#SkBitmap_tryAllocN32Pixels'>tryAllocN32Pixels</a> <a href='undocumented#SkMallocPixelRef'>SkMallocPixelRef</a>::<a href='#SkMallocPixelRef_MakeAllocate'>MakeAllocate</a>
1947
1948<a name='SkBitmap_installPixels'></a>
1949
1950---
1951
1952<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
1953bool <a href='#SkBitmap_installPixels'>installPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, void* pixels, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>, void (*releaseProc)
1954                   (void* addr, void* context) , void* context)
1955</pre>
1956
1957Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_installPixels_info'>info</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>(), and creates <a href='undocumented#SkPixelRef'>SkPixelRef</a>
1958containing <a href='#SkBitmap_installPixels_pixels'>pixels</a> and <a href='#SkBitmap_installPixels_rowBytes'>rowBytes</a>. <a href='#SkBitmap_installPixels_releaseProc'>releaseProc</a>, if not nullptr, is called
1959immediately on failure or when <a href='#SkBitmap_installPixels_pixels'>pixels</a> are no longer referenced. <a href='#SkBitmap_installPixels_context'>context</a> may be
1960nullptr.
1961
1962If <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or <a href='#SkBitmap_installPixels_rowBytes'>rowBytes</a> is less than <a href='#SkBitmap_installPixels_info'>info</a>.<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>():
1963calls <a href='#SkBitmap_installPixels_releaseProc'>releaseProc</a> if present, calls <a href='#SkBitmap_reset'>reset()</a>, and returns false.
1964
1965Otherwise, if <a href='#SkBitmap_installPixels_pixels'>pixels</a> equals nullptr: sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, calls <a href='#SkBitmap_installPixels_releaseProc'>releaseProc</a> if
1966present, returns true.
1967
1968If <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is set, <a href='#SkBitmap_installPixels_pixels'>pixels</a> is not nullptr, and <a href='#SkBitmap_installPixels_releaseProc'>releaseProc</a> is not nullptr:
1969when <a href='#SkBitmap_installPixels_pixels'>pixels</a> are no longer referenced, calls <a href='#SkBitmap_installPixels_releaseProc'>releaseProc</a> with <a href='#SkBitmap_installPixels_pixels'>pixels</a> and <a href='#SkBitmap_installPixels_context'>context</a>
1970as parameters.
1971
1972### Parameters
1973
1974<table>  <tr>    <td><a name='SkBitmap_installPixels_info'><code><strong>info</strong></code></a></td>
1975    <td>contains width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a></td>
1976  </tr>
1977  <tr>    <td><a name='SkBitmap_installPixels_pixels'><code><strong>pixels</strong></code></a></td>
1978    <td>address or  <a href='undocumented#Pixel_Storage'>pixel storage</a>; may be nullptr</td>
1979  </tr>
1980  <tr>    <td><a name='SkBitmap_installPixels_rowBytes'><code><strong>rowBytes</strong></code></a></td>
1981    <td><a href='undocumented#Size'>size</a> of <a href='undocumented#Pixel'>pixel</a> row or larger</td>
1982  </tr>
1983  <tr>    <td><a name='SkBitmap_installPixels_releaseProc'><code><strong>releaseProc</strong></code></a></td>
1984    <td>function called when <a href='#SkBitmap_installPixels_pixels'>pixels</a> can be deleted; may be nullptr</td>
1985  </tr>
1986  <tr>    <td><a name='SkBitmap_installPixels_context'><code><strong>context</strong></code></a></td>
1987    <td>caller state passed to <a href='#SkBitmap_installPixels_releaseProc'>releaseProc</a>; may be nullptr</td>
1988  </tr>
1989</table>
1990
1991### Return Value
1992
1993true if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is set to <a href='#SkBitmap_installPixels_info'>info</a>
1994
1995### Example
1996
1997<div><fiddle-embed name="8c4f7bf73fffa1a812ee8e88e44e639c"><div><a href='#SkBitmap_installPixels_releaseProc'>releaseProc</a> is called immediately because <a href='#SkBitmap_installPixels_rowBytes'>rowBytes</a> is too small for <a href='#Pixel_Ref'>Pixel_Ref</a>.
1998</div>
1999
2000#### Example Output
2001
2002~~~~
2003before installPixels
2004releaseProc called
2005install not successful
2006~~~~
2007
2008</fiddle-embed></div>
2009
2010### See Also
2011
2012<a href='#SkBitmap_allocPixels'>allocPixels</a>
2013
2014<a name='SkBitmap_installPixels_2'></a>
2015
2016---
2017
2018<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2019bool <a href='#SkBitmap_installPixels'>installPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, void* pixels, size_t <a href='#SkBitmap_rowBytes'>rowBytes</a>)
2020</pre>
2021
2022Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_installPixels_2_info'>info</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>(), and creates <a href='undocumented#SkPixelRef'>SkPixelRef</a>
2023containing <a href='#SkBitmap_installPixels_2_pixels'>pixels</a> and <a href='#SkBitmap_installPixels_2_rowBytes'>rowBytes</a>.
2024
2025If <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or <a href='#SkBitmap_installPixels_2_rowBytes'>rowBytes</a> is less than <a href='#SkBitmap_installPixels_2_info'>info</a>.<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>():
2026calls <a href='#SkBitmap_reset'>reset()</a>, and returns false.
2027
2028Otherwise, if <a href='#SkBitmap_installPixels_2_pixels'>pixels</a> equals nullptr: sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, returns true.
2029
2030Caller must ensure that <a href='#SkBitmap_installPixels_2_pixels'>pixels</a> are valid for the lifetime of <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> and <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
2031
2032### Parameters
2033
2034<table>  <tr>    <td><a name='SkBitmap_installPixels_2_info'><code><strong>info</strong></code></a></td>
2035    <td>contains width, height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a></td>
2036  </tr>
2037  <tr>    <td><a name='SkBitmap_installPixels_2_pixels'><code><strong>pixels</strong></code></a></td>
2038    <td>address or  <a href='undocumented#Pixel_Storage'>pixel storage</a>; may be nullptr</td>
2039  </tr>
2040  <tr>    <td><a name='SkBitmap_installPixels_2_rowBytes'><code><strong>rowBytes</strong></code></a></td>
2041    <td><a href='undocumented#Size'>size</a> of <a href='undocumented#Pixel'>pixel</a> row or larger</td>
2042  </tr>
2043</table>
2044
2045### Return Value
2046
2047true if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is set to <a href='#SkBitmap_installPixels_2_info'>info</a>
2048
2049### Example
2050
2051<div><fiddle-embed name="a7e04447b2081010c50d7920e80a6bb2"><div>GPU does not support <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>, does not assert that it does not.
2052</div></fiddle-embed></div>
2053
2054### See Also
2055
2056<a href='#SkBitmap_allocPixels'>allocPixels</a>
2057
2058<a name='SkBitmap_installPixels_3'></a>
2059
2060---
2061
2062<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2063bool <a href='#SkBitmap_installPixels'>installPixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='SkPixmap_Reference#Pixmap'>pixmap</a>)
2064</pre>
2065
2066Sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_installPixels_3_pixmap'>pixmap</a>.<a href='#SkPixmap_info'>info()</a> following the rules in <a href='#SkBitmap_setInfo'>setInfo</a>(), and creates
2067<a href='undocumented#SkPixelRef'>SkPixelRef</a> containing <a href='#SkBitmap_installPixels_3_pixmap'>pixmap</a>.<a href='#SkPixmap_addr'>addr()</a> and <a href='#SkBitmap_installPixels_3_pixmap'>pixmap</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>().
2068
2069If <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> could not be set, or <a href='#SkBitmap_installPixels_3_pixmap'>pixmap</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() is less than
2070<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>(): calls <a href='#SkBitmap_reset'>reset()</a>, and returns false.
2071
2072Otherwise, if <a href='#SkBitmap_installPixels_3_pixmap'>pixmap</a>.<a href='#SkPixmap_addr'>addr()</a> equals nullptr: sets <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, returns true.
2073
2074Caller must ensure that <a href='#SkBitmap_installPixels_3_pixmap'>pixmap</a> is valid for the lifetime of <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> and <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
2075
2076### Parameters
2077
2078<table>  <tr>    <td><a name='SkBitmap_installPixels_3_pixmap'><code><strong>pixmap</strong></code></a></td>
2079    <td><a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, <a href='undocumented#Pixel'>pixel</a> address, and <a href='#SkBitmap_rowBytes'>rowBytes</a>()</td>
2080  </tr>
2081</table>
2082
2083### Return Value
2084
2085true if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> was set to <a href='#SkBitmap_installPixels_3_pixmap'>pixmap</a>.<a href='#SkPixmap_info'>info()</a>
2086
2087### Example
2088
2089<div><fiddle-embed name="6e2a8c9358b34aebd2ec586815fe9d3a"><div>Draw a five by five <a href='SkBitmap_Reference#Bitmap'>bitmap</a>, and draw it again with a center white <a href='undocumented#Pixel'>pixel</a>.
2090</div></fiddle-embed></div>
2091
2092### See Also
2093
2094<a href='#SkBitmap_allocPixels'>allocPixels</a>
2095
2096<a name='Pixels'></a>
2097
2098<a name='SkBitmap_setPixels'></a>
2099
2100---
2101
2102<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2103void <a href='#SkBitmap_setPixels'>setPixels</a>(void* pixels)
2104</pre>
2105
2106Replaces <a href='undocumented#SkPixelRef'>SkPixelRef</a> with <a href='#SkBitmap_setPixels_pixels'>pixels</a>, preserving <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> and <a href='#SkBitmap_rowBytes'>rowBytes</a>().
2107Sets <a href='undocumented#SkPixelRef'>SkPixelRef</a> origin to (0, 0).
2108
2109If <a href='#SkBitmap_setPixels_pixels'>pixels</a> is nullptr, or if <a href='#SkBitmap_info'>info()</a>.<a href='#SkImageInfo_colorType'>colorType</a>() equals <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>;
2110release reference to <a href='undocumented#SkPixelRef'>SkPixelRef</a>, and set <a href='undocumented#SkPixelRef'>SkPixelRef</a> to nullptr.
2111
2112Caller is responsible for handling ownership <a href='undocumented#Pixel'>pixel</a> memory for the lifetime
2113of <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> and <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
2114
2115### Parameters
2116
2117<table>  <tr>    <td><a name='SkBitmap_setPixels_pixels'><code><strong>pixels</strong></code></a></td>
2118    <td>address of  <a href='undocumented#Pixel_Storage'>pixel storage</a>, managed by caller</td>
2119  </tr>
2120</table>
2121
2122### Example
2123
2124<div><fiddle-embed name="f0db16e06c9a1436917c8179f8c1718f"></fiddle-embed></div>
2125
2126### See Also
2127
2128<a href='#SkBitmap_installPixels'>installPixels</a> <a href='#SkBitmap_allocPixels'>allocPixels</a>
2129
2130<a name='SkBitmap_tryAllocPixels_3'></a>
2131
2132---
2133
2134<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2135bool <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>()
2136</pre>
2137
2138Allocates <a href='undocumented#Pixel'>pixel</a> memory with <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a>, and replaces existing <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
2139The allocation <a href='undocumented#Size'>size</a> is determined by <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> width, height, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>.
2140
2141Returns false if <a href='#SkBitmap_info'>info()</a>.<a href='#SkImageInfo_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, or allocation fails.
2142
2143### Return Value
2144
2145true if the allocation succeeds
2146
2147### Example
2148
2149<div><fiddle-embed name="720e4c053fae9e929ab6518b47e49370"><div><a href='SkBitmap_Reference#Bitmap'>Bitmap</a> hosts and draws gray values in set1. <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a> replaces <a href='#Pixel_Ref'>Pixel_Ref</a>
2150and erases it to black, but does not alter set1. <a href='#SkBitmap_setPixels'>setPixels</a> replaces black
2151<a href='#Pixel_Ref'>Pixel_Ref</a> with set1.
2152</div></fiddle-embed></div>
2153
2154### See Also
2155
2156<a href='#SkBitmap_allocPixels'>allocPixels</a> <a href='#SkBitmap_installPixels'>installPixels</a> <a href='#SkBitmap_setPixels'>setPixels</a>
2157
2158<a name='SkBitmap_allocPixels_3'></a>
2159
2160---
2161
2162<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2163void <a href='#SkBitmap_allocPixels'>allocPixels</a>()
2164</pre>
2165
2166Allocates <a href='undocumented#Pixel'>pixel</a> memory with <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a>, and replaces existing <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
2167The allocation <a href='undocumented#Size'>size</a> is determined by <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> width, height, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>.
2168
2169Aborts if <a href='#SkBitmap_info'>info()</a>.<a href='#SkImageInfo_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, or allocation fails.
2170Abort steps may be provided by the user at compile
2171time by defining SK_ABORT.
2172
2173### Example
2174
2175<div><fiddle-embed name="1219b38c788bf270fb20f8cd2d78cff8"><div><a href='SkBitmap_Reference#Bitmap'>Bitmap</a> hosts and draws gray values in set1. <a href='#SkBitmap_allocPixels'>allocPixels</a> replaces <a href='#Pixel_Ref'>Pixel_Ref</a>
2176and erases it to black, but does not alter set1. <a href='#SkBitmap_setPixels'>setPixels</a> replaces black
2177<a href='#Pixel_Ref'>Pixel_Ref</a> with set2.
2178</div></fiddle-embed></div>
2179
2180### See Also
2181
2182<a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a> <a href='#SkBitmap_installPixels'>installPixels</a> <a href='#SkBitmap_setPixels'>setPixels</a>
2183
2184<a name='SkBitmap_tryAllocPixels_4'></a>
2185
2186---
2187
2188<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2189bool <a href='#SkBitmap_tryAllocPixels'>tryAllocPixels</a>(<a href='#SkBitmap_Allocator'>Allocator</a>* allocator)
2190</pre>
2191
2192Allocates <a href='undocumented#Pixel'>pixel</a> memory with <a href='#SkBitmap_tryAllocPixels_4_allocator'>allocator</a>, and replaces existing <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
2193The allocation <a href='undocumented#Size'>size</a> is determined by <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> width, height, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>.
2194If <a href='#SkBitmap_tryAllocPixels_4_allocator'>allocator</a> is nullptr, use <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a> instead.
2195
2196Returns false if <a href='#SkBitmap_Allocator'>Allocator</a>::<a href='#SkBitmap_Allocator_allocPixelRef'>allocPixelRef</a> return false.
2197
2198### Parameters
2199
2200<table>  <tr>    <td><a name='SkBitmap_tryAllocPixels_4_allocator'><code><strong>allocator</strong></code></a></td>
2201    <td>instance of <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_Allocator'>Allocator</a> instantiation</td>
2202  </tr>
2203</table>
2204
2205### Return Value
2206
2207true if custom <a href='#SkBitmap_tryAllocPixels_4_allocator'>allocator</a> reports success
2208
2209### Example
2210
2211<div><fiddle-embed name="eb6f861ca1839146d26e40d56c2a001c"><div><a href='#SkBitmap_HeapAllocator'>HeapAllocator</a> limits the maximum <a href='undocumented#Size'>size</a> of <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> to two gigabytes. Using
2212a custom <a href='#SkBitmap_tryAllocPixels_4_allocator'>allocator</a>, this limitation may be relaxed. This example can be
2213modified to allocate an eight gigabyte <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> on a 64-bit platform with
2214sufficient memory.
2215</div></fiddle-embed></div>
2216
2217### See Also
2218
2219<a href='#SkBitmap_allocPixels'>allocPixels</a> <a href='#SkBitmap_Allocator'>Allocator</a> <a href='#Pixel_Ref'>Pixel_Ref</a>
2220
2221<a name='SkBitmap_allocPixels_4'></a>
2222
2223---
2224
2225<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2226void <a href='#SkBitmap_allocPixels'>allocPixels</a>(<a href='#SkBitmap_Allocator'>Allocator</a>* allocator)
2227</pre>
2228
2229Allocates <a href='undocumented#Pixel'>pixel</a> memory with <a href='#SkBitmap_allocPixels_4_allocator'>allocator</a>, and replaces existing <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
2230The allocation <a href='undocumented#Size'>size</a> is determined by <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> width, height, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>.
2231If <a href='#SkBitmap_allocPixels_4_allocator'>allocator</a> is nullptr, use <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a> instead.
2232
2233Aborts if <a href='#SkBitmap_Allocator'>Allocator</a>::<a href='#SkBitmap_Allocator_allocPixelRef'>allocPixelRef</a> return false. Abort steps may be provided by
2234the user at compile time by defining SK_ABORT.
2235
2236### Parameters
2237
2238<table>  <tr>    <td><a name='SkBitmap_allocPixels_4_allocator'><code><strong>allocator</strong></code></a></td>
2239    <td>instance of <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_Allocator'>Allocator</a> instantiation</td>
2240  </tr>
2241</table>
2242
2243### Example
2244
2245<div><fiddle-embed name="1b2800d23c9ea249b45c2c21a34b6d14"></fiddle-embed></div>
2246
2247### See Also
2248
2249<a href='#SkBitmap_allocPixels'>allocPixels</a> <a href='#SkBitmap_Allocator'>Allocator</a> <a href='#Pixel_Ref'>Pixel_Ref</a>
2250
2251<a name='SkBitmap_pixelRef'></a>
2252
2253---
2254
2255<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2256<a href='undocumented#SkPixelRef'>SkPixelRef</a>* <a href='#SkBitmap_pixelRef'>pixelRef</a>()const
2257</pre>
2258
2259Returns <a href='undocumented#SkPixelRef'>SkPixelRef</a>, which contains: <a href='undocumented#Pixel'>pixel</a> base address; its dimensions; and
2260<a href='#SkBitmap_rowBytes'>rowBytes</a>(), the interval from one row to the next. Does not change <a href='undocumented#SkPixelRef'>SkPixelRef</a>
2261reference count. <a href='undocumented#SkPixelRef'>SkPixelRef</a> may be shared by multiple <a href='SkBitmap_Reference#Bitmap'>bitmaps</a>.
2262If <a href='undocumented#SkPixelRef'>SkPixelRef</a> has not been set, returns nullptr.
2263
2264### Return Value
2265
2266<a href='undocumented#SkPixelRef'>SkPixelRef</a>, or nullptr
2267
2268### Example
2269
2270<div><fiddle-embed name="5db2d30870a7cc45f28e22578d1880c3"></fiddle-embed></div>
2271
2272### See Also
2273
2274<a href='#SkBitmap_getPixels'>getPixels</a> <a href='#SkBitmap_getAddr'>getAddr</a>
2275
2276<a name='SkBitmap_pixelRefOrigin'></a>
2277
2278---
2279
2280<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2281<a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a> <a href='#SkBitmap_pixelRefOrigin'>pixelRefOrigin</a>()const
2282</pre>
2283
2284Returns origin of pixels within <a href='undocumented#SkPixelRef'>SkPixelRef</a>. <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> bounds is always contained
2285by <a href='undocumented#SkPixelRef'>SkPixelRef</a> bounds, which may be the same <a href='undocumented#Size'>size</a> or larger. Multiple <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>
2286can share the same <a href='undocumented#SkPixelRef'>SkPixelRef</a>, where each <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> has different bounds.
2287
2288The returned origin added to <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> dimensions equals or is smaller than the
2289<a href='undocumented#SkPixelRef'>SkPixelRef</a> dimensions.
2290
2291Returns (0, 0) if <a href='undocumented#SkPixelRef'>SkPixelRef</a> is nullptr.
2292
2293### Return Value
2294
2295<a href='undocumented#Pixel'>pixel</a> origin within <a href='undocumented#SkPixelRef'>SkPixelRef</a>
2296
2297### Example
2298
2299<div><fiddle-embed name="6d31686c6c0829c70f284ae716526d6a">
2300
2301#### Example Output
2302
2303~~~~
2304source origin: 0, 0
2305subset origin: 32, 64
2306~~~~
2307
2308</fiddle-embed></div>
2309
2310### See Also
2311
2312<a href='undocumented#SkPixelRef'>SkPixelRef</a> <a href='#SkBitmap_getSubset'>getSubset</a> <a href='#SkBitmap_setPixelRef'>setPixelRef</a>
2313
2314<a name='Set'></a>
2315
2316<a name='SkBitmap_setPixelRef'></a>
2317
2318---
2319
2320<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2321void <a href='#SkBitmap_setPixelRef'>setPixelRef</a>(<a href='undocumented#sk_sp'>sk_sp</a>&lt;<a href='undocumented#SkPixelRef'>SkPixelRef</a>&gt; <a href='#SkBitmap_pixelRef'>pixelRef</a>, int dx, int dy)
2322</pre>
2323
2324Replaces <a href='#SkBitmap_setPixelRef_pixelRef'>pixelRef</a> and origin in <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>.  <a href='#SkBitmap_setPixelRef_dx'>dx</a> and <a href='#SkBitmap_setPixelRef_dy'>dy</a> specify the offset
2325within the <a href='undocumented#SkPixelRef'>SkPixelRef</a> pixels for the top-left corner of the <a href='SkBitmap_Reference#Bitmap'>bitmap</a>.
2326
2327Asserts in debug builds if <a href='#SkBitmap_setPixelRef_dx'>dx</a> or <a href='#SkBitmap_setPixelRef_dy'>dy</a> are out of range. Pins <a href='#SkBitmap_setPixelRef_dx'>dx</a> and <a href='#SkBitmap_setPixelRef_dy'>dy</a>
2328to legal range in release builds.
2329
2330The caller is responsible for ensuring that the pixels match the
2331<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> in <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>.
2332
2333### Parameters
2334
2335<table>  <tr>    <td><a name='SkBitmap_setPixelRef_pixelRef'><code><strong>pixelRef</strong></code></a></td>
2336    <td><a href='undocumented#SkPixelRef'>SkPixelRef</a> describing <a href='undocumented#Pixel'>pixel</a> address and <a href='#SkBitmap_rowBytes'>rowBytes</a>()</td>
2337  </tr>
2338  <tr>    <td><a name='SkBitmap_setPixelRef_dx'><code><strong>dx</strong></code></a></td>
2339    <td>column offset in <a href='undocumented#SkPixelRef'>SkPixelRef</a> for <a href='SkBitmap_Reference#Bitmap'>bitmap</a> origin</td>
2340  </tr>
2341  <tr>    <td><a name='SkBitmap_setPixelRef_dy'><code><strong>dy</strong></code></a></td>
2342    <td>row offset in <a href='undocumented#SkPixelRef'>SkPixelRef</a> for <a href='SkBitmap_Reference#Bitmap'>bitmap</a> origin</td>
2343  </tr>
2344</table>
2345
2346### Example
2347
2348<div><fiddle-embed name="f98cc0451c6e77a8833d261c9a484c5f"><div>Treating 32-bit <a href='undocumented#Data'>data</a> as 8-bit <a href='undocumented#Data'>data</a> is unlikely to produce useful results.
2349</div></fiddle-embed></div>
2350
2351### See Also
2352
2353<a href='#SkBitmap_setInfo'>setInfo</a>
2354
2355<a name='SkBitmap_readyToDraw'></a>
2356
2357---
2358
2359<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2360bool <a href='#SkBitmap_readyToDraw'>readyToDraw</a>()const
2361</pre>
2362
2363Returns true if <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> is can be drawn.
2364
2365### Return Value
2366
2367true if <a href='#SkBitmap_getPixels'>getPixels</a>() is not nullptr
2368
2369### Example
2370
2371<div><fiddle-embed name="e89c78ca992e2e789ed50944fe68f920"></fiddle-embed></div>
2372
2373### See Also
2374
2375<a href='#SkBitmap_getPixels'>getPixels</a> <a href='#SkBitmap_drawsNothing'>drawsNothing</a>
2376
2377<a name='SkBitmap_getGenerationID'></a>
2378
2379---
2380
2381<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2382uint32_t <a href='#SkBitmap_getGenerationID'>getGenerationID</a>()const
2383</pre>
2384
2385Returns a unique value corresponding to the pixels in <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
2386Returns a different value after <a href='#SkBitmap_notifyPixelsChanged'>notifyPixelsChanged</a>() has been called.
2387Returns zero if <a href='undocumented#SkPixelRef'>SkPixelRef</a> is nullptr.
2388
2389Determines if pixels have changed since last examined.
2390
2391### Return Value
2392
2393unique value for pixels in <a href='undocumented#SkPixelRef'>SkPixelRef</a>
2394
2395### Example
2396
2397<div><fiddle-embed name="db9dd91e0207c3941c09538555817b4b">
2398
2399#### Example Output
2400
2401~~~~
2402#Volatile
2403empty id 0
2404alloc id 4
2405erase id 6
2406~~~~
2407
2408</fiddle-embed></div>
2409
2410### See Also
2411
2412<a href='#SkBitmap_notifyPixelsChanged'>notifyPixelsChanged</a> <a href='#Pixel_Ref'>Pixel_Ref</a>
2413
2414<a name='SkBitmap_notifyPixelsChanged'></a>
2415
2416---
2417
2418<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2419void <a href='#SkBitmap_notifyPixelsChanged'>notifyPixelsChanged</a>()const
2420</pre>
2421
2422Marks that pixels in <a href='undocumented#SkPixelRef'>SkPixelRef</a> have changed. Subsequent calls to
2423<a href='#SkBitmap_getGenerationID'>getGenerationID</a>() return a different value.
2424
2425### Example
2426
2427<div><fiddle-embed name="8f463ed17b0ed4fb9c503a0ec71706f9"></fiddle-embed></div>
2428
2429### See Also
2430
2431<a href='#SkBitmap_getGenerationID'>getGenerationID</a> <a href='#SkBitmap_isVolatile'>isVolatile</a> <a href='#Pixel_Ref'>Pixel_Ref</a>
2432
2433<a name='Draw'></a>
2434
2435<a name='SkBitmap_eraseColor'></a>
2436
2437---
2438
2439<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2440void <a href='#SkBitmap_eraseColor'>eraseColor</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> c)const
2441</pre>
2442
2443Replaces <a href='undocumented#Pixel'>pixel</a> values with <a href='#SkBitmap_eraseColor_c'>c</a>. All pixels contained by <a href='#SkBitmap_bounds'>bounds()</a> are affected.
2444If the <a href='#SkBitmap_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a> or <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, then <a href='SkColor_Reference#Alpha'>alpha</a>
2445is ignored; RGB is treated as opaque. If <a href='#SkBitmap_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>,
2446then RGB is ignored.
2447
2448### Parameters
2449
2450<table>  <tr>    <td><a name='SkBitmap_eraseColor_c'><code><strong>c</strong></code></a></td>
2451    <td><a href='undocumented#Unpremultiply'>unpremultiplied</a> <a href='SkColor_Reference#Color'>color</a></td>
2452  </tr>
2453</table>
2454
2455### Example
2456
2457<div><fiddle-embed name="418928dbfffa9eb00c8225530f44baf5"></fiddle-embed></div>
2458
2459### See Also
2460
2461<a href='#SkBitmap_eraseARGB'>eraseARGB</a> <a href='#SkBitmap_erase'>erase</a>
2462
2463<a name='SkBitmap_eraseARGB'></a>
2464
2465---
2466
2467<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2468void <a href='#SkBitmap_eraseARGB'>eraseARGB</a>(<a href='undocumented#U8CPU'>U8CPU</a> a, <a href='undocumented#U8CPU'>U8CPU</a> r, <a href='undocumented#U8CPU'>U8CPU</a> g, <a href='undocumented#U8CPU'>U8CPU</a> b)const
2469</pre>
2470
2471Replaces <a href='undocumented#Pixel'>pixel</a> values with <a href='undocumented#Unpremultiply'>unpremultiplied</a> <a href='SkColor_Reference#Color'>color</a> built from <a href='#SkBitmap_eraseARGB_a'>a</a>, <a href='#SkBitmap_eraseARGB_r'>r</a>, <a href='#SkBitmap_eraseARGB_g'>g</a>, and <a href='#SkBitmap_eraseARGB_b'>b</a>.
2472All pixels contained by <a href='#SkBitmap_bounds'>bounds()</a> are affected.
2473If the <a href='#SkBitmap_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a> or <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, then <a href='#SkBitmap_eraseARGB_a'>a</a>
2474is ignored; <a href='#SkBitmap_eraseARGB_r'>r</a>, <a href='#SkBitmap_eraseARGB_g'>g</a>, and <a href='#SkBitmap_eraseARGB_b'>b</a> are treated as opaque. If <a href='#SkBitmap_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>,
2475then <a href='#SkBitmap_eraseARGB_r'>r</a>, <a href='#SkBitmap_eraseARGB_g'>g</a>, and <a href='#SkBitmap_eraseARGB_b'>b</a> are ignored.
2476
2477### Parameters
2478
2479<table>  <tr>    <td><a name='SkBitmap_eraseARGB_a'><code><strong>a</strong></code></a></td>
2480    <td>amount of <a href='SkColor_Reference#Alpha'>alpha</a>, from fully transparent (0) to fully opaque (255)</td>
2481  </tr>
2482  <tr>    <td><a name='SkBitmap_eraseARGB_r'><code><strong>r</strong></code></a></td>
2483    <td>amount of red, from no red (0) to full red (255)</td>
2484  </tr>
2485  <tr>    <td><a name='SkBitmap_eraseARGB_g'><code><strong>g</strong></code></a></td>
2486    <td>amount of green, from no green (0) to full green (255)</td>
2487  </tr>
2488  <tr>    <td><a name='SkBitmap_eraseARGB_b'><code><strong>b</strong></code></a></td>
2489    <td>amount of blue, from no blue (0) to full blue (255)</td>
2490  </tr>
2491</table>
2492
2493### Example
2494
2495<div><fiddle-embed name="67277b0a1003f340473a35982533561c"></fiddle-embed></div>
2496
2497### See Also
2498
2499<a href='#SkBitmap_eraseColor'>eraseColor</a> <a href='#SkBitmap_erase'>erase</a>
2500
2501<a name='SkBitmap_erase'></a>
2502
2503---
2504
2505<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2506void <a href='#SkBitmap_erase'>erase</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> c, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& area)const
2507</pre>
2508
2509Replaces <a href='undocumented#Pixel'>pixel</a> values inside <a href='#SkBitmap_erase_area'>area</a> with <a href='#SkBitmap_erase_c'>c</a>. If <a href='#SkBitmap_erase_area'>area</a> does not intersect <a href='#SkBitmap_bounds'>bounds()</a>,
2510call has no effect.
2511
2512If the <a href='#SkBitmap_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a> or <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, then <a href='SkColor_Reference#Alpha'>alpha</a>
2513is ignored; RGB is treated as opaque. If <a href='#SkBitmap_colorType'>colorType</a>() is <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>,
2514then RGB is ignored.
2515
2516### Parameters
2517
2518<table>  <tr>    <td><a name='SkBitmap_erase_c'><code><strong>c</strong></code></a></td>
2519    <td><a href='undocumented#Unpremultiply'>unpremultiplied</a> <a href='SkColor_Reference#Color'>color</a></td>
2520  </tr>
2521  <tr>    <td><a name='SkBitmap_erase_area'><code><strong>area</strong></code></a></td>
2522    <td>rectangle to fill</td>
2523  </tr>
2524</table>
2525
2526### Example
2527
2528<div><fiddle-embed name="2c5c4230ccd2861a5d15b7cd2764ab6e"></fiddle-embed></div>
2529
2530### See Also
2531
2532<a href='#SkBitmap_eraseColor'>eraseColor</a> <a href='#SkBitmap_eraseARGB'>eraseARGB</a> <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawRect'>drawRect</a>
2533
2534<a name='SkBitmap_getColor'></a>
2535
2536---
2537
2538<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2539<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='#SkBitmap_getColor'>getColor</a>(int x, int y)const
2540</pre>
2541
2542Returns <a href='undocumented#Pixel'>pixel</a> at (<a href='#SkBitmap_getColor_x'>x</a>, <a href='#SkBitmap_getColor_y'>y</a>) as <a href='undocumented#Unpremultiply'>unpremultiplied</a> <a href='SkColor_Reference#Color'>color</a>.
2543Returns 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>.
2544
2545Input is not validated: out of bounds values of <a href='#SkBitmap_getColor_x'>x</a> or <a href='#SkBitmap_getColor_y'>y</a> trigger an assert() if
2546built with SK_DEBUG defined; and returns undefined values or may crash if
2547SK_RELEASE is defined. Fails if <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a> or
2548<a href='undocumented#Pixel'>pixel</a> address is nullptr.
2549
2550<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
2551conversion 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
2552precision.
2553
2554### Parameters
2555
2556<table>  <tr>    <td><a name='SkBitmap_getColor_x'><code><strong>x</strong></code></a></td>
2557    <td>column index, zero or greater, and less than <a href='#SkBitmap_width'>width()</a></td>
2558  </tr>
2559  <tr>    <td><a name='SkBitmap_getColor_y'><code><strong>y</strong></code></a></td>
2560    <td>row index, zero or greater, and less than <a href='#SkBitmap_height'>height()</a></td>
2561  </tr>
2562</table>
2563
2564### Return Value
2565
2566<a href='undocumented#Pixel'>pixel</a> converted to <a href='undocumented#Unpremultiply'>unpremultiplied</a> <a href='SkColor_Reference#Color'>color</a>
2567
2568### Example
2569
2570<div><fiddle-embed name="193d1f6d8a43b7a8e9f27ba21de38617">
2571
2572#### Example Output
2573
2574~~~~
2575Premultiplied:
2576(0, 0) 0x00000000 0x2a0e002a 0x55380055 0x7f7f007f
2577(0, 1) 0x2a000e2a 0x551c1c55 0x7f542a7f 0xaaaa38aa
2578(0, 2) 0x55003855 0x7f2a547f 0xaa7171aa 0xd4d48dd4
2579(0, 3) 0x7f007f7f 0xaa38aaaa 0xd48dd4d4 0xffffffff
2580Unpremultiplied:
2581(0, 0) 0x00000000 0x2a5500ff 0x55a800ff 0x7fff00ff
2582(0, 1) 0x2a0055ff 0x555454ff 0x7fa954ff 0xaaff54ff
2583(0, 2) 0x5500a8ff 0x7f54a9ff 0xaaaaaaff 0xd4ffaaff
2584(0, 3) 0x7f00ffff 0xaa54ffff 0xd4aaffff 0xffffffff
2585~~~~
2586
2587</fiddle-embed></div>
2588
2589### See Also
2590
2591<a href='#SkBitmap_getAlphaf'>getAlphaf</a> <a href='#SkBitmap_getAddr'>getAddr</a> <a href='#SkBitmap_readPixels'>readPixels</a>
2592
2593<a name='SkBitmap_getAlphaf'></a>
2594
2595---
2596
2597<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2598float <a href='#SkBitmap_getAlphaf'>getAlphaf</a>(int x, int y)const
2599</pre>
2600
2601Looks up the <a href='undocumented#Pixel'>pixel</a> at (<a href='#SkBitmap_getAlphaf_x'>x</a>,<a href='#SkBitmap_getAlphaf_y'>y</a>) and return its <a href='SkColor_Reference#Alpha'>alpha</a> component, normalized to [0..1].
2602This is roughly equivalent to <code>SkGetColorA(<a href='#SkBitmap_getColor'>getColor</a>())</code>, but can be more efficient
2603(and more precise if the pixels store more than 8 bits per component).
2604
2605### Parameters
2606
2607<table>  <tr>    <td><a name='SkBitmap_getAlphaf_x'><code><strong>x</strong></code></a></td>
2608    <td>column index, zero or greater, and less than <a href='#SkBitmap_width'>width()</a></td>
2609  </tr>
2610  <tr>    <td><a name='SkBitmap_getAlphaf_y'><code><strong>y</strong></code></a></td>
2611    <td>row index, zero or greater, and less than <a href='#SkBitmap_height'>height()</a></td>
2612  </tr>
2613</table>
2614
2615### Return Value
2616
2617<a href='SkColor_Reference#Alpha'>alpha</a> converted to normalized float
2618
2619### See Also
2620
2621<a href='#SkBitmap_getColor'>getColor</a>
2622
2623<a name='SkBitmap_getAddr'></a>
2624
2625---
2626
2627<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2628void* <a href='#SkBitmap_getAddr'>getAddr</a>(int x, int y)const
2629</pre>
2630
2631Returns <a href='undocumented#Pixel'>pixel</a> address at (<a href='#SkBitmap_getAddr_x'>x</a>, <a href='#SkBitmap_getAddr_y'>y</a>).
2632
2633Input is not validated: out of bounds values of <a href='#SkBitmap_getAddr_x'>x</a> or <a href='#SkBitmap_getAddr_y'>y</a>, or <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>,
2634trigger an assert() if built with SK_DEBUG defined. Returns nullptr if
2635<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, or <a href='undocumented#SkPixelRef'>SkPixelRef</a> is nullptr.
2636
2637Performs a lookup of <a href='undocumented#Pixel'>pixel</a> <a href='undocumented#Size'>size</a>; for better performance, call
2638one of: <a href='#SkBitmap_getAddr8'>getAddr8</a>(), <a href='#SkBitmap_getAddr16'>getAddr16</a>(), or <a href='#SkBitmap_getAddr32'>getAddr32</a>().
2639
2640### Parameters
2641
2642<table>  <tr>    <td><a name='SkBitmap_getAddr_x'><code><strong>x</strong></code></a></td>
2643    <td>column index, zero or greater, and less than <a href='#SkBitmap_width'>width()</a></td>
2644  </tr>
2645  <tr>    <td><a name='SkBitmap_getAddr_y'><code><strong>y</strong></code></a></td>
2646    <td>row index, zero or greater, and less than <a href='#SkBitmap_height'>height()</a></td>
2647  </tr>
2648</table>
2649
2650### Return Value
2651
2652generic pointer to <a href='undocumented#Pixel'>pixel</a>
2653
2654### Example
2655
2656<div><fiddle-embed name="ffcefb2344cd38c3b99f69cfe6d64a17">
2657
2658#### Example Output
2659
2660~~~~
2661addr interval == rowBytes
2662~~~~
2663
2664</fiddle-embed></div>
2665
2666### See Also
2667
2668<a href='#SkBitmap_getAddr8'>getAddr8</a> <a href='#SkBitmap_getAddr16'>getAddr16</a> <a href='#SkBitmap_getAddr32'>getAddr32</a> <a href='#SkBitmap_readPixels'>readPixels</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_addr'>addr</a>
2669
2670<a name='SkBitmap_getAddr32'></a>
2671
2672---
2673
2674<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2675uint32_t* <a href='#SkBitmap_getAddr32'>getAddr32</a>(int x, int y)const
2676</pre>
2677
2678Returns address at (<a href='#SkBitmap_getAddr32_x'>x</a>, <a href='#SkBitmap_getAddr32_y'>y</a>).
2679
2680Input is not validated. Triggers an assert() if built with SK_DEBUG defined and:
2681
2682<table>  <tr>
2683    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
2684  </tr>  <tr>
2685    <td><a href='#SkBitmap_bytesPerPixel'>bytesPerPixel</a>() is not four</td>
2686  </tr>  <tr>
2687    <td><a href='#SkBitmap_getAddr32_x'>x</a> is negative, or not less than <a href='#SkBitmap_width'>width()</a></td>
2688  </tr>  <tr>
2689    <td><a href='#SkBitmap_getAddr32_y'>y</a> is negative, or not less than <a href='#SkBitmap_height'>height()</a></td>
2690  </tr>
2691</table>
2692
2693### Parameters
2694
2695<table>  <tr>    <td><a name='SkBitmap_getAddr32_x'><code><strong>x</strong></code></a></td>
2696    <td>column index, zero or greater, and less than <a href='#SkBitmap_width'>width()</a></td>
2697  </tr>
2698  <tr>    <td><a name='SkBitmap_getAddr32_y'><code><strong>y</strong></code></a></td>
2699    <td>row index, zero or greater, and less than <a href='#SkBitmap_height'>height()</a></td>
2700  </tr>
2701</table>
2702
2703### Return Value
2704
2705unsigned 32-bit pointer to <a href='undocumented#Pixel'>pixel</a> at (<a href='#SkBitmap_getAddr32_x'>x</a>, <a href='#SkBitmap_getAddr32_y'>y</a>)
2706
2707### Example
2708
2709<div><fiddle-embed name="837a2bcc9fb9ce617a3420956cefc64a">
2710
2711#### Example Output
2712
2713~~~~
2714addr interval == rowBytes
2715~~~~
2716
2717</fiddle-embed></div>
2718
2719### See Also
2720
2721<a href='#SkBitmap_getAddr8'>getAddr8</a> <a href='#SkBitmap_getAddr16'>getAddr16</a> <a href='#SkBitmap_getAddr'>getAddr</a> <a href='#SkBitmap_readPixels'>readPixels</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_addr32'>addr32</a>
2722
2723<a name='SkBitmap_getAddr16'></a>
2724
2725---
2726
2727<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2728uint16_t* <a href='#SkBitmap_getAddr16'>getAddr16</a>(int x, int y)const
2729</pre>
2730
2731Returns address at (<a href='#SkBitmap_getAddr16_x'>x</a>, <a href='#SkBitmap_getAddr16_y'>y</a>).
2732
2733Input is not validated. Triggers an assert() if built with SK_DEBUG defined and:
2734
2735<table>  <tr>
2736    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
2737  </tr>  <tr>
2738    <td><a href='#SkBitmap_bytesPerPixel'>bytesPerPixel</a>() is not two</td>
2739  </tr>  <tr>
2740    <td><a href='#SkBitmap_getAddr16_x'>x</a> is negative, or not less than <a href='#SkBitmap_width'>width()</a></td>
2741  </tr>  <tr>
2742    <td><a href='#SkBitmap_getAddr16_y'>y</a> is negative, or not less than <a href='#SkBitmap_height'>height()</a></td>
2743  </tr>
2744</table>
2745
2746### Parameters
2747
2748<table>  <tr>    <td><a name='SkBitmap_getAddr16_x'><code><strong>x</strong></code></a></td>
2749    <td>column index, zero or greater, and less than <a href='#SkBitmap_width'>width()</a></td>
2750  </tr>
2751  <tr>    <td><a name='SkBitmap_getAddr16_y'><code><strong>y</strong></code></a></td>
2752    <td>row index, zero or greater, and less than <a href='#SkBitmap_height'>height()</a></td>
2753  </tr>
2754</table>
2755
2756### Return Value
2757
2758unsigned 16-bit pointer to <a href='undocumented#Pixel'>pixel</a> at (<a href='#SkBitmap_getAddr16_x'>x</a>, <a href='#SkBitmap_getAddr16_y'>y</a>)
2759
2760### Example
2761
2762<div><fiddle-embed name="53e00899ef2e00e2096daf7a07d9b059">
2763
2764#### Example Output
2765
2766~~~~
2767addr interval == rowBytes
2768~~~~
2769
2770</fiddle-embed></div>
2771
2772### See Also
2773
2774<a href='#SkBitmap_getAddr8'>getAddr8</a> <a href='#SkBitmap_getAddr'>getAddr</a> <a href='#SkBitmap_getAddr32'>getAddr32</a> <a href='#SkBitmap_readPixels'>readPixels</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_addr16'>addr16</a>
2775
2776<a name='SkBitmap_getAddr8'></a>
2777
2778---
2779
2780<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2781uint8_t* <a href='#SkBitmap_getAddr8'>getAddr8</a>(int x, int y)const
2782</pre>
2783
2784Returns address at (<a href='#SkBitmap_getAddr8_x'>x</a>, <a href='#SkBitmap_getAddr8_y'>y</a>).
2785
2786Input is not validated. Triggers an assert() if built with SK_DEBUG defined and:
2787
2788<table>  <tr>
2789    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
2790  </tr>  <tr>
2791    <td><a href='#SkBitmap_bytesPerPixel'>bytesPerPixel</a>() is not one</td>
2792  </tr>  <tr>
2793    <td><a href='#SkBitmap_getAddr8_x'>x</a> is negative, or not less than <a href='#SkBitmap_width'>width()</a></td>
2794  </tr>  <tr>
2795    <td><a href='#SkBitmap_getAddr8_y'>y</a> is negative, or not less than <a href='#SkBitmap_height'>height()</a></td>
2796  </tr>
2797</table>
2798
2799### Parameters
2800
2801<table>  <tr>    <td><a name='SkBitmap_getAddr8_x'><code><strong>x</strong></code></a></td>
2802    <td>column index, zero or greater, and less than <a href='#SkBitmap_width'>width()</a></td>
2803  </tr>
2804  <tr>    <td><a name='SkBitmap_getAddr8_y'><code><strong>y</strong></code></a></td>
2805    <td>row index, zero or greater, and less than <a href='#SkBitmap_height'>height()</a></td>
2806  </tr>
2807</table>
2808
2809### Return Value
2810
2811unsigned 8-bit pointer to <a href='undocumented#Pixel'>pixel</a> at (<a href='#SkBitmap_getAddr8_x'>x</a>, <a href='#SkBitmap_getAddr8_y'>y</a>)
2812
2813### Example
2814
2815<div><fiddle-embed name="cb9a08e8ff779b6a1cf8bb54f3883aaf">
2816
2817#### Example Output
2818
2819~~~~
2820&pixels[4][2] == bitmap.getAddr8(2, 4)
2821~~~~
2822
2823</fiddle-embed></div>
2824
2825### See Also
2826
2827<a href='#SkBitmap_getAddr'>getAddr</a> <a href='#SkBitmap_getAddr16'>getAddr16</a> <a href='#SkBitmap_getAddr32'>getAddr32</a> <a href='#SkBitmap_readPixels'>readPixels</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_addr8'>addr8</a>
2828
2829<a name='SkBitmap_extractSubset'></a>
2830
2831---
2832
2833<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2834bool <a href='#SkBitmap_extractSubset'>extractSubset</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* dst, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& subset)const
2835</pre>
2836
2837Shares <a href='#Pixel_Ref'>Pixel_Ref</a> with <a href='#SkBitmap_extractSubset_dst'>dst</a>. Pixels are not copied; <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> and <a href='#SkBitmap_extractSubset_dst'>dst</a> <a href='SkPoint_Reference#Point'>point</a>
2838to the same pixels; <a href='#SkBitmap_extractSubset_dst'>dst</a> <a href='#SkBitmap_bounds'>bounds()</a> are set to the intersection of <a href='#SkBitmap_extractSubset_subset'>subset</a>
2839and the original <a href='#SkBitmap_bounds'>bounds()</a>.
2840
2841<a href='#SkBitmap_extractSubset_subset'>subset</a> may be larger than <a href='#SkBitmap_bounds'>bounds()</a>. Any area outside of <a href='#SkBitmap_bounds'>bounds()</a> is ignored.
2842
2843Any contents of <a href='#SkBitmap_extractSubset_dst'>dst</a> are discarded. <a href='#SkBitmap_isVolatile'>isVolatile</a> setting is copied to <a href='#SkBitmap_extractSubset_dst'>dst</a>.
2844<a href='#SkBitmap_extractSubset_dst'>dst</a> is set to <a href='#SkBitmap_colorType'>colorType</a>, <a href='#SkBitmap_alphaType'>alphaType</a>, and <a href='#SkBitmap_colorSpace'>colorSpace</a>.
2845
2846Return false if:
2847
2848<table>  <tr>
2849    <td><a href='#SkBitmap_extractSubset_dst'>dst</a> is nullptr</td>
2850  </tr>  <tr>
2851    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
2852  </tr>  <tr>
2853    <td><a href='#SkBitmap_extractSubset_subset'>subset</a> does not intersect <a href='#SkBitmap_bounds'>bounds()</a></td>
2854  </tr>
2855</table>
2856
2857### Parameters
2858
2859<table>  <tr>    <td><a name='SkBitmap_extractSubset_dst'><code><strong>dst</strong></code></a></td>
2860    <td><a href='SkBitmap_Reference#Bitmap'>Bitmap</a> set to <a href='#SkBitmap_extractSubset_subset'>subset</a></td>
2861  </tr>
2862  <tr>    <td><a name='SkBitmap_extractSubset_subset'><code><strong>subset</strong></code></a></td>
2863    <td>rectangle of pixels to reference</td>
2864  </tr>
2865</table>
2866
2867### Return Value
2868
2869true if <a href='#SkBitmap_extractSubset_dst'>dst</a> is replaced by <a href='#SkBitmap_extractSubset_subset'>subset</a>
2870
2871### Example
2872
2873<div><fiddle-embed name="304148c50c91490bfd58e9222342419c">
2874
2875#### Example Output
2876
2877~~~~
2878bounds: 0, 0, 512, 512
2879subset: -100,  100,    0,  200  success; false
2880subset: -100,  100,  100,  200  success; true  subset: 0, 0, 100, 100
2881subset: -100,  100, 1000,  200  success; true  subset: 0, 0, 512, 100
2882subset:    0,  100,    0,  200  success; false
2883subset:    0,  100,  100,  200  success; true  subset: 0, 0, 100, 100
2884subset:    0,  100, 1000,  200  success; true  subset: 0, 0, 512, 100
2885subset:  100,  100,    0,  200  success; false
2886subset:  100,  100,  100,  200  success; false
2887subset:  100,  100, 1000,  200  success; true  subset: 0, 0, 412, 100
2888subset: 1000,  100,    0,  200  success; false
2889subset: 1000,  100,  100,  200  success; false
2890subset: 1000,  100, 1000,  200  success; false
2891~~~~
2892
2893</fiddle-embed></div>
2894
2895### See Also
2896
2897<a href='#SkBitmap_readPixels'>readPixels</a> <a href='#SkBitmap_writePixels'>writePixels</a> <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawBitmap'>drawBitmap</a>
2898
2899<a name='SkBitmap_readPixels'></a>
2900
2901---
2902
2903<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2904bool <a href='#SkBitmap_readPixels'>readPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY)const
2905</pre>
2906
2907Copies a <a href='SkRect_Reference#Rect'>Rect</a> of pixels from <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> to <a href='#SkBitmap_readPixels_dstPixels'>dstPixels</a>. Copy starts at (<a href='#SkBitmap_readPixels_srcX'>srcX</a>, <a href='#SkBitmap_readPixels_srcY'>srcY</a>),
2908and does not exceed <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> (<a href='#SkBitmap_width'>width()</a>, <a href='#SkBitmap_height'>height()</a>).
2909
2910<a href='#SkBitmap_readPixels_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 <a href='#Color_Space'>Color_Space</a> of
2911destination. <a href='#SkBitmap_readPixels_dstRowBytes'>dstRowBytes</a> specifics the gap from one destination row to the next.
2912Returns true if pixels are copied. Returns false if:
2913
2914<table>  <tr>
2915    <td><a href='#SkBitmap_readPixels_dstInfo'>dstInfo</a> has no address</td>
2916  </tr>  <tr>
2917    <td><a href='#SkBitmap_readPixels_dstRowBytes'>dstRowBytes</a> is less than <a href='#SkBitmap_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>()</td>
2918  </tr>  <tr>
2919    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
2920  </tr>
2921</table>
2922
2923Pixels are copied only if <a href='undocumented#Pixel'>pixel</a> conversion is possible. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is
2924<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='#SkBitmap_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_colorType'>colorType</a>() must match.
2925If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='#SkBitmap_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_colorSpace'>colorSpace</a>() must match.
2926If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, <a href='#SkBitmap_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_alphaType'>alphaType</a>() must
2927match. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorSpace'>colorSpace</a> is nullptr, <a href='#SkBitmap_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_colorSpace'>colorSpace</a>() must match. Returns
2928false if <a href='undocumented#Pixel'>pixel</a> conversion is not possible.
2929
2930<a href='#SkBitmap_readPixels_srcX'>srcX</a> and <a href='#SkBitmap_readPixels_srcY'>srcY</a> may be negative to copy only top or left of source. Returns
2931false if <a href='#SkBitmap_width'>width()</a> or <a href='#SkBitmap_height'>height()</a> is zero or negative.
2932Returns false if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkBitmap_readPixels_srcX'>srcX</a>) >= <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_width'>width()</a></code>, or if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkBitmap_readPixels_srcY'>srcY</a>) >= <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_height'>height()</a></code>.
2933
2934### Parameters
2935
2936<table>  <tr>    <td><a name='SkBitmap_readPixels_dstInfo'><code><strong>dstInfo</strong></code></a></td>
2937    <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>
2938  </tr>
2939  <tr>    <td><a name='SkBitmap_readPixels_dstPixels'><code><strong>dstPixels</strong></code></a></td>
2940    <td>destination  <a href='undocumented#Pixel_Storage'>pixel storage</a></td>
2941  </tr>
2942  <tr>    <td><a name='SkBitmap_readPixels_dstRowBytes'><code><strong>dstRowBytes</strong></code></a></td>
2943    <td>destination row length</td>
2944  </tr>
2945  <tr>    <td><a name='SkBitmap_readPixels_srcX'><code><strong>srcX</strong></code></a></td>
2946    <td>column index whose absolute value is less than <a href='#SkBitmap_width'>width()</a></td>
2947  </tr>
2948  <tr>    <td><a name='SkBitmap_readPixels_srcY'><code><strong>srcY</strong></code></a></td>
2949    <td>row index whose absolute value is less than <a href='#SkBitmap_height'>height()</a></td>
2950  </tr>
2951</table>
2952
2953### Return Value
2954
2955true if pixels are copied to <a href='#SkBitmap_readPixels_dstPixels'>dstPixels</a>
2956
2957### Example
2958
2959<div><fiddle-embed name="b2cbbbbcffb618865d8aae3bc04b2a62"><div>Transferring the gradient from 8 bits per component to 4 bits per component
2960creates visible banding.
2961</div></fiddle-embed></div>
2962
2963### See Also
2964
2965<a href='#SkBitmap_writePixels'>writePixels</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_readPixels'>readPixels</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>
2966
2967<a name='SkBitmap_readPixels_2'></a>
2968
2969---
2970
2971<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
2972bool <a href='#SkBitmap_readPixels'>readPixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& dst, int srcX, int srcY)const
2973</pre>
2974
2975Copies a <a href='SkRect_Reference#Rect'>Rect</a> of pixels from <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> to <a href='#SkBitmap_readPixels_2_dst'>dst</a>. Copy starts at (<a href='#SkBitmap_readPixels_2_srcX'>srcX</a>, <a href='#SkBitmap_readPixels_2_srcY'>srcY</a>), and
2976does not exceed <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> (<a href='#SkBitmap_width'>width()</a>, <a href='#SkBitmap_height'>height()</a>).
2977
2978<a href='#SkBitmap_readPixels_2_dst'>dst</a> specifies 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>,  <a href='undocumented#Pixel_Storage'>pixel storage</a>,
2979and  <a href='#Row_Bytes'>row bytes</a> of destination. <a href='#SkBitmap_readPixels_2_dst'>dst</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() specifics the gap from one destination
2980row to the next. Returns true if pixels are copied. Returns false if:
2981
2982<table>  <tr>
2983    <td><a href='#SkBitmap_readPixels_2_dst'>dst</a>  <a href='undocumented#Pixel_Storage'>pixel storage</a> equals nullptr</td>
2984  </tr>  <tr>
2985    <td><a href='#SkBitmap_readPixels_2_dst'>dst</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() is less than <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>()</td>
2986  </tr>  <tr>
2987    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
2988  </tr>
2989</table>
2990
2991Pixels are copied only if <a href='undocumented#Pixel'>pixel</a> conversion is possible. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is
2992<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='#SkBitmap_readPixels_2_dst'>dst</a> <a href='#Image_Info_Color_Type'>Color_Type</a> must match.
2993If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='#SkBitmap_readPixels_2_dst'>dst</a> <a href='#Color_Space'>Color_Space</a> must match.
2994If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, <a href='#SkBitmap_readPixels_2_dst'>dst</a> <a href='#Image_Info_Alpha_Type'>Alpha_Type</a> must
2995match. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorSpace'>colorSpace</a> is nullptr, <a href='#SkBitmap_readPixels_2_dst'>dst</a> <a href='#Color_Space'>Color_Space</a> must match. Returns
2996false if <a href='undocumented#Pixel'>pixel</a> conversion is not possible.
2997
2998<a href='#SkBitmap_readPixels_2_srcX'>srcX</a> and <a href='#SkBitmap_readPixels_2_srcY'>srcY</a> may be negative to copy only top or left of source. Returns
2999false if <a href='#SkBitmap_width'>width()</a> or <a href='#SkBitmap_height'>height()</a> is zero or negative.
3000Returns false if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkBitmap_readPixels_2_srcX'>srcX</a>) >= <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_width'>width()</a></code>, or if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkBitmap_readPixels_2_srcY'>srcY</a>) >= <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_height'>height()</a></code>.
3001
3002### Parameters
3003
3004<table>  <tr>    <td><a name='SkBitmap_readPixels_2_dst'><code><strong>dst</strong></code></a></td>
3005    <td>destination <a href='SkPixmap_Reference#Pixmap'>Pixmap</a>: <a href='#Image_Info'>Image_Info</a>, pixels,  <a href='#Row_Bytes'>row bytes</a></td>
3006  </tr>
3007  <tr>    <td><a name='SkBitmap_readPixels_2_srcX'><code><strong>srcX</strong></code></a></td>
3008    <td>column index whose absolute value is less than <a href='#SkBitmap_width'>width()</a></td>
3009  </tr>
3010  <tr>    <td><a name='SkBitmap_readPixels_2_srcY'><code><strong>srcY</strong></code></a></td>
3011    <td>row index whose absolute value is less than <a href='#SkBitmap_height'>height()</a></td>
3012  </tr>
3013</table>
3014
3015### Return Value
3016
3017true if pixels are copied to <a href='#SkBitmap_readPixels_2_dst'>dst</a>
3018
3019### Example
3020
3021<div><fiddle-embed name="e9f70cbc9827097449a386ec7a8a8188"></fiddle-embed></div>
3022
3023### See Also
3024
3025<a href='#SkBitmap_writePixels'>writePixels</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_readPixels'>readPixels</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>
3026
3027<a name='SkBitmap_readPixels_3'></a>
3028
3029---
3030
3031<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
3032bool <a href='#SkBitmap_readPixels'>readPixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& dst)const
3033</pre>
3034
3035Copies a <a href='SkRect_Reference#Rect'>Rect</a> of pixels from <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> to <a href='#SkBitmap_readPixels_3_dst'>dst</a>. Copy starts at (0, 0), and
3036does not exceed <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> (<a href='#SkBitmap_width'>width()</a>, <a href='#SkBitmap_height'>height()</a>).
3037
3038<a href='#SkBitmap_readPixels_3_dst'>dst</a> specifies 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>,  <a href='undocumented#Pixel_Storage'>pixel storage</a>,
3039and  <a href='#Row_Bytes'>row bytes</a> of destination. <a href='#SkBitmap_readPixels_3_dst'>dst</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() specifics the gap from one destination
3040row to the next. Returns true if pixels are copied. Returns false if:
3041
3042<table>  <tr>
3043    <td><a href='#SkBitmap_readPixels_3_dst'>dst</a>  <a href='undocumented#Pixel_Storage'>pixel storage</a> equals nullptr</td>
3044  </tr>  <tr>
3045    <td><a href='#SkBitmap_readPixels_3_dst'>dst</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() is less than <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>()</td>
3046  </tr>  <tr>
3047    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
3048  </tr>
3049</table>
3050
3051Pixels are copied only if <a href='undocumented#Pixel'>pixel</a> conversion is possible. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is
3052<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='#SkBitmap_readPixels_3_dst'>dst</a> <a href='#Image_Info_Color_Type'>Color_Type</a> must match.
3053If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='#SkBitmap_readPixels_3_dst'>dst</a> <a href='#Color_Space'>Color_Space</a> must match.
3054If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, <a href='#SkBitmap_readPixels_3_dst'>dst</a> <a href='#Image_Info_Alpha_Type'>Alpha_Type</a> must
3055match. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorSpace'>colorSpace</a> is nullptr, <a href='#SkBitmap_readPixels_3_dst'>dst</a> <a href='#Color_Space'>Color_Space</a> must match. Returns
3056false if <a href='undocumented#Pixel'>pixel</a> conversion is not possible.
3057
3058### Parameters
3059
3060<table>  <tr>    <td><a name='SkBitmap_readPixels_3_dst'><code><strong>dst</strong></code></a></td>
3061    <td>destination <a href='SkPixmap_Reference#Pixmap'>Pixmap</a>: <a href='#Image_Info'>Image_Info</a>, pixels,  <a href='#Row_Bytes'>row bytes</a></td>
3062  </tr>
3063</table>
3064
3065### Return Value
3066
3067true if pixels are copied to <a href='#SkBitmap_readPixels_3_dst'>dst</a>
3068
3069### Example
3070
3071<div><fiddle-embed name="4590fbf052659d6e629fbfd827081ae5"></fiddle-embed></div>
3072
3073### See Also
3074
3075<a href='#SkBitmap_writePixels'>writePixels</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_readPixels'>readPixels</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>
3076
3077<a name='SkBitmap_writePixels'></a>
3078
3079---
3080
3081<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
3082bool <a href='#SkBitmap_writePixels'>writePixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& src, int dstX, int dstY)
3083</pre>
3084
3085Copies a <a href='SkRect_Reference#Rect'>Rect</a> of pixels from <a href='#SkBitmap_writePixels_src'>src</a>. Copy starts at (<a href='#SkBitmap_writePixels_dstX'>dstX</a>, <a href='#SkBitmap_writePixels_dstY'>dstY</a>), and does not exceed
3086(<a href='#SkBitmap_writePixels_src'>src</a>.<a href='#SkPixmap_width'>width()</a>, <a href='#SkBitmap_writePixels_src'>src</a>.<a href='#SkPixmap_height'>height()</a>).
3087
3088<a href='#SkBitmap_writePixels_src'>src</a> specifies 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>,  <a href='undocumented#Pixel_Storage'>pixel storage</a>,
3089and  <a href='#Row_Bytes'>row bytes</a> of source. <a href='#SkBitmap_writePixels_src'>src</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() specifics the gap from one source
3090row to the next. Returns true if pixels are copied. Returns false if:
3091
3092<table>  <tr>
3093    <td><a href='#SkBitmap_writePixels_src'>src</a>  <a href='undocumented#Pixel_Storage'>pixel storage</a> equals nullptr</td>
3094  </tr>  <tr>
3095    <td><a href='#SkBitmap_writePixels_src'>src</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() is less than <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>()</td>
3096  </tr>  <tr>
3097    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
3098  </tr>
3099</table>
3100
3101Pixels are copied only if <a href='undocumented#Pixel'>pixel</a> conversion is possible. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is
3102<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='#SkBitmap_writePixels_src'>src</a> <a href='#Image_Info_Color_Type'>Color_Type</a> must match.
3103If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='#SkBitmap_writePixels_src'>src</a> <a href='#Color_Space'>Color_Space</a> must match.
3104If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, <a href='#SkBitmap_writePixels_src'>src</a> <a href='#Image_Info_Alpha_Type'>Alpha_Type</a> must
3105match. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorSpace'>colorSpace</a> is nullptr, <a href='#SkBitmap_writePixels_src'>src</a> <a href='#Color_Space'>Color_Space</a> must match. Returns
3106false if <a href='undocumented#Pixel'>pixel</a> conversion is not possible.
3107
3108<a href='#SkBitmap_writePixels_dstX'>dstX</a> and <a href='#SkBitmap_writePixels_dstY'>dstY</a> may be negative to copy only top or left of source. Returns
3109false if <a href='#SkBitmap_width'>width()</a> or <a href='#SkBitmap_height'>height()</a> is zero or negative.
3110Returns false if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkBitmap_writePixels_dstX'>dstX</a>) >= <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_width'>width()</a></code>, or if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkBitmap_writePixels_dstY'>dstY</a>) >= <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_height'>height()</a></code>.
3111
3112### Parameters
3113
3114<table>  <tr>    <td><a name='SkBitmap_writePixels_src'><code><strong>src</strong></code></a></td>
3115    <td>source <a href='SkPixmap_Reference#Pixmap'>Pixmap</a>: <a href='#Image_Info'>Image_Info</a>, pixels,  <a href='#Row_Bytes'>row bytes</a></td>
3116  </tr>
3117  <tr>    <td><a name='SkBitmap_writePixels_dstX'><code><strong>dstX</strong></code></a></td>
3118    <td>column index whose absolute value is less than <a href='#SkBitmap_width'>width()</a></td>
3119  </tr>
3120  <tr>    <td><a name='SkBitmap_writePixels_dstY'><code><strong>dstY</strong></code></a></td>
3121    <td>row index whose absolute value is less than <a href='#SkBitmap_height'>height()</a></td>
3122  </tr>
3123</table>
3124
3125### Return Value
3126
3127true if <a href='#SkBitmap_writePixels_src'>src</a> pixels are copied to <a href='SkBitmap_Reference#Bitmap'>Bitmap</a>
3128
3129### Example
3130
3131<div><fiddle-embed name="9b3133a6673d2514d166398adbe1f9f4"></fiddle-embed></div>
3132
3133### See Also
3134
3135<a href='#SkBitmap_readPixels'>readPixels</a>
3136
3137<a name='SkBitmap_writePixels_2'></a>
3138
3139---
3140
3141<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
3142bool <a href='#SkBitmap_writePixels'>writePixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& src)
3143</pre>
3144
3145Copies a <a href='SkRect_Reference#Rect'>Rect</a> of pixels from <a href='#SkBitmap_writePixels_2_src'>src</a>. Copy starts at (0, 0), and does not exceed
3146(<a href='#SkBitmap_writePixels_2_src'>src</a>.<a href='#SkPixmap_width'>width()</a>, <a href='#SkBitmap_writePixels_2_src'>src</a>.<a href='#SkPixmap_height'>height()</a>).
3147
3148<a href='#SkBitmap_writePixels_2_src'>src</a> specifies 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>,  <a href='undocumented#Pixel_Storage'>pixel storage</a>,
3149and  <a href='#Row_Bytes'>row bytes</a> of source. <a href='#SkBitmap_writePixels_2_src'>src</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() specifics the gap from one source
3150row to the next. Returns true if pixels are copied. Returns false if:
3151
3152<table>  <tr>
3153    <td><a href='#SkBitmap_writePixels_2_src'>src</a>  <a href='undocumented#Pixel_Storage'>pixel storage</a> equals nullptr</td>
3154  </tr>  <tr>
3155    <td><a href='#SkBitmap_writePixels_2_src'>src</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() is less than <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>()</td>
3156  </tr>  <tr>
3157    <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td>
3158  </tr>
3159</table>
3160
3161Pixels are copied only if <a href='undocumented#Pixel'>pixel</a> conversion is possible. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is
3162<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='#SkBitmap_writePixels_2_src'>src</a> <a href='#Image_Info_Color_Type'>Color_Type</a> must match.
3163If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorType'>colorType</a> is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='#SkBitmap_writePixels_2_src'>src</a> <a href='#Color_Space'>Color_Space</a> must match.
3164If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, <a href='#SkBitmap_writePixels_2_src'>src</a> <a href='#Image_Info_Alpha_Type'>Alpha_Type</a> must
3165match. If <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> <a href='#SkBitmap_colorSpace'>colorSpace</a> is nullptr, <a href='#SkBitmap_writePixels_2_src'>src</a> <a href='#Color_Space'>Color_Space</a> must match. Returns
3166false if <a href='undocumented#Pixel'>pixel</a> conversion is not possible.
3167
3168### Parameters
3169
3170<table>  <tr>    <td><a name='SkBitmap_writePixels_2_src'><code><strong>src</strong></code></a></td>
3171    <td>source <a href='SkPixmap_Reference#Pixmap'>Pixmap</a>: <a href='#Image_Info'>Image_Info</a>, pixels,  <a href='#Row_Bytes'>row bytes</a></td>
3172  </tr>
3173</table>
3174
3175### Return Value
3176
3177true if <a href='#SkBitmap_writePixels_2_src'>src</a> pixels are copied to <a href='SkBitmap_Reference#Bitmap'>Bitmap</a>
3178
3179### Example
3180
3181<div><fiddle-embed name="faa5dfa466f6e16c07c124d971f32679"></fiddle-embed></div>
3182
3183### See Also
3184
3185<a href='#SkBitmap_readPixels'>readPixels</a>
3186
3187<a name='SkBitmap_extractAlpha'></a>
3188
3189---
3190
3191<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
3192bool <a href='#SkBitmap_extractAlpha'>extractAlpha</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* dst)const
3193</pre>
3194
3195Sets <a href='#SkBitmap_extractAlpha_dst'>dst</a> to <a href='SkColor_Reference#Alpha'>alpha</a> described by pixels. Returns false if <a href='#SkBitmap_extractAlpha_dst'>dst</a> cannot be written to
3196or <a href='#SkBitmap_extractAlpha_dst'>dst</a> pixels cannot be allocated.
3197
3198Uses <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a> to reserve memory for <a href='#SkBitmap_extractAlpha_dst'>dst</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>.
3199
3200### Parameters
3201
3202<table>  <tr>    <td><a name='SkBitmap_extractAlpha_dst'><code><strong>dst</strong></code></a></td>
3203    <td>holds <a href='undocumented#SkPixelRef'>SkPixelRef</a> to fill with <a href='SkColor_Reference#Alpha'>alpha</a> <a href='SkCanvas_Reference#Layer'>layer</a></td>
3204  </tr>
3205</table>
3206
3207### Return Value
3208
3209true if <a href='SkColor_Reference#Alpha'>alpha</a> <a href='SkCanvas_Reference#Layer'>layer</a> was constructed in <a href='#SkBitmap_extractAlpha_dst'>dst</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>
3210
3211### Example
3212
3213<div><fiddle-embed name="ab6577df079e6c70511cf2bfc6447b44"></fiddle-embed></div>
3214
3215### See Also
3216
3217<a href='#SkBitmap_extractSubset'>extractSubset</a>
3218
3219<a name='SkBitmap_extractAlpha_2'></a>
3220
3221---
3222
3223<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
3224bool <a href='#SkBitmap_extractAlpha'>extractAlpha</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* dst, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>* <a href='SkPaint_Reference#Paint'>paint</a>, <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a>* offset)const
3225</pre>
3226
3227Sets <a href='#SkBitmap_extractAlpha_2_dst'>dst</a> to <a href='SkColor_Reference#Alpha'>alpha</a> described by pixels. Returns false if <a href='#SkBitmap_extractAlpha_2_dst'>dst</a> cannot be written to
3228or <a href='#SkBitmap_extractAlpha_2_dst'>dst</a> pixels cannot be allocated.
3229
3230If <a href='#SkBitmap_extractAlpha_2_paint'>paint</a> is not nullptr and contains <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>, <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>
3231generates  <a href='undocumented#Mask_Alpha'>mask alpha</a> from <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>. Uses <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a> to reserve memory for <a href='#SkBitmap_extractAlpha_2_dst'>dst</a>
3232<a href='undocumented#SkPixelRef'>SkPixelRef</a>. Sets <a href='#SkBitmap_extractAlpha_2_offset'>offset</a> to top-left position for <a href='#SkBitmap_extractAlpha_2_dst'>dst</a> for alignment with <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>;
3233(0, 0) unless <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> generates mask.
3234
3235### Parameters
3236
3237<table>  <tr>    <td><a name='SkBitmap_extractAlpha_2_dst'><code><strong>dst</strong></code></a></td>
3238    <td>holds <a href='undocumented#SkPixelRef'>SkPixelRef</a> to fill with <a href='SkColor_Reference#Alpha'>alpha</a> <a href='SkCanvas_Reference#Layer'>layer</a></td>
3239  </tr>
3240  <tr>    <td><a name='SkBitmap_extractAlpha_2_paint'><code><strong>paint</strong></code></a></td>
3241    <td>holds optional <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>; may be nullptr</td>
3242  </tr>
3243  <tr>    <td><a name='SkBitmap_extractAlpha_2_offset'><code><strong>offset</strong></code></a></td>
3244    <td>top-left position for <a href='#SkBitmap_extractAlpha_2_dst'>dst</a>; may be nullptr</td>
3245  </tr>
3246</table>
3247
3248### Return Value
3249
3250true if <a href='SkColor_Reference#Alpha'>alpha</a> <a href='SkCanvas_Reference#Layer'>layer</a> was constructed in <a href='#SkBitmap_extractAlpha_2_dst'>dst</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>
3251
3252### Example
3253
3254<div><fiddle-embed name="092739b4cd5d732a27c07ced8ef45f01"></fiddle-embed></div>
3255
3256### See Also
3257
3258<a href='#SkBitmap_extractSubset'>extractSubset</a>
3259
3260<a name='SkBitmap_extractAlpha_3'></a>
3261
3262---
3263
3264<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
3265bool <a href='#SkBitmap_extractAlpha'>extractAlpha</a>(<a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>* dst, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>* <a href='SkPaint_Reference#Paint'>paint</a>, <a href='#SkBitmap_Allocator'>Allocator</a>* allocator, <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a>* offset)const
3266</pre>
3267
3268Sets <a href='#SkBitmap_extractAlpha_3_dst'>dst</a> to <a href='SkColor_Reference#Alpha'>alpha</a> described by pixels. Returns false if <a href='#SkBitmap_extractAlpha_3_dst'>dst</a> cannot be written to
3269or <a href='#SkBitmap_extractAlpha_3_dst'>dst</a> pixels cannot be allocated.
3270
3271If <a href='#SkBitmap_extractAlpha_3_paint'>paint</a> is not nullptr and contains <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>, <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>
3272generates  <a href='undocumented#Mask_Alpha'>mask alpha</a> from <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>. <a href='#SkBitmap_extractAlpha_3_allocator'>allocator</a> may reference a custom allocation
3273class or be set to nullptr to use <a href='#SkBitmap_HeapAllocator'>HeapAllocator</a>. Sets <a href='#SkBitmap_extractAlpha_3_offset'>offset</a> to top-left
3274position for <a href='#SkBitmap_extractAlpha_3_dst'>dst</a> for alignment with <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>; (0, 0) unless <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> generates
3275mask.
3276
3277### Parameters
3278
3279<table>  <tr>    <td><a name='SkBitmap_extractAlpha_3_dst'><code><strong>dst</strong></code></a></td>
3280    <td>holds <a href='undocumented#SkPixelRef'>SkPixelRef</a> to fill with <a href='SkColor_Reference#Alpha'>alpha</a> <a href='SkCanvas_Reference#Layer'>layer</a></td>
3281  </tr>
3282  <tr>    <td><a name='SkBitmap_extractAlpha_3_paint'><code><strong>paint</strong></code></a></td>
3283    <td>holds optional <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>; may be nullptr</td>
3284  </tr>
3285  <tr>    <td><a name='SkBitmap_extractAlpha_3_allocator'><code><strong>allocator</strong></code></a></td>
3286    <td>function to reserve memory for <a href='undocumented#SkPixelRef'>SkPixelRef</a>; may be nullptr</td>
3287  </tr>
3288  <tr>    <td><a name='SkBitmap_extractAlpha_3_offset'><code><strong>offset</strong></code></a></td>
3289    <td>top-left position for <a href='#SkBitmap_extractAlpha_3_dst'>dst</a>; may be nullptr</td>
3290  </tr>
3291</table>
3292
3293### Return Value
3294
3295true if <a href='SkColor_Reference#Alpha'>alpha</a> <a href='SkCanvas_Reference#Layer'>layer</a> was constructed in <a href='#SkBitmap_extractAlpha_3_dst'>dst</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>
3296
3297### Example
3298
3299<div><fiddle-embed name="cd7543fa8c9f3cede46dc2d72eb8c4bd"></fiddle-embed></div>
3300
3301### See Also
3302
3303<a href='#SkBitmap_extractSubset'>extractSubset</a>
3304
3305<a name='SkBitmap_peekPixels'></a>
3306
3307---
3308
3309<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
3310bool <a href='#SkBitmap_peekPixels'>peekPixels</a>(<a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>* <a href='SkPixmap_Reference#Pixmap'>pixmap</a>)const
3311</pre>
3312
3313Copies <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> <a href='undocumented#Pixel'>pixel</a> address,  <a href='#Row_Bytes'>row bytes</a>, and <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkBitmap_peekPixels_pixmap'>pixmap</a>, if address
3314is available, and returns true. If <a href='undocumented#Pixel'>pixel</a> address is not available, return
3315false and leave <a href='#SkBitmap_peekPixels_pixmap'>pixmap</a> unchanged.
3316
3317<a href='#SkBitmap_peekPixels_pixmap'>pixmap</a> contents become invalid on any future change to <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>.
3318
3319### Parameters
3320
3321<table>  <tr>    <td><a name='SkBitmap_peekPixels_pixmap'><code><strong>pixmap</strong></code></a></td>
3322    <td>storage for <a href='undocumented#Pixel'>pixel</a> state if pixels are readable; otherwise, ignored</td>
3323  </tr>
3324</table>
3325
3326### Return Value
3327
3328true if <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> has direct access to pixels
3329
3330### Example
3331
3332<div><fiddle-embed name="0cc2c6a0dffa61a88711534bd3d43b40">
3333
3334#### Example Output
3335
3336~~~~
3337------
3338-xxx--
3339x---x-
3340----x-
3341---x--
3342--x---
3343--x---
3344------
3345--x---
3346--x---
3347------
3348~~~~
3349
3350</fiddle-embed></div>
3351
3352### See Also
3353
3354<a href='#SkBitmap_peekPixels_pixmap'>pixmap</a> <a href='#SkBitmap_installPixels'>installPixels</a> <a href='#SkBitmap_readPixels'>readPixels</a> <a href='#SkBitmap_writePixels'>writePixels</a>
3355
3356<a name='Utility'></a>
3357
3358<a name='SkBitmap_validate'></a>
3359
3360---
3361
3362<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
3363void <a href='#SkBitmap_validate'>validate()</a> const;
3364</pre>
3365
3366### See Also
3367
3368<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_validate'>validate</a>
3369
3370