<ahref="#SkSurface">SkSurface</a> takes care of allocating a <ahref="SkCanvas_Reference#SkCanvas">SkCanvas</a> that will <ahref="#SkSurface_draw">draw</a> into the surface. Call
surface-><ahref="#SkSurface_getCanvas">getCanvas</a> to use that canvas (but don't delete it, it is owned by the surface).
<ahref="#SkSurface">SkSurface</a> always has non-zero dimensions. If there is a request for a new surface, and either
of the requested dimensions are zero, then nullptr will be returned.
# <a name="Overview"></a> Overview
## <a name="Subtopics"></a> Subtopics
| topics | description |
| --- | --- |
## <a name="Member_Functions"></a> Member Functions
Allocates raster <ahref="#Surface">Surface</a>. <ahref="SkCanvas_Reference#Canvas">Canvas</a> returned by <ahref="#Surface">Surface</a> draws directly into <ahref="#SkSurface_MakeRasterDirect_pixels">pixels</a>.
<ahref="#Surface">Surface</a> is returned if all parameters are valid.
Valid parameters include:
info dimensions are greater than zero;
info contains <ahref="undocumented#Image_Color_Type">Image Color Type</a> and <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a> supported by <ahref="undocumented#Raster_Surface">Raster Surface</a>;
<ahref="#SkSurface_MakeRasterDirect_pixels">pixels</a> is not nullptr;
<ahref="#SkSurface_MakeRasterDirect_rowBytes">rowBytes</a> is large enough to contain info <ahref="#SkSurface_width">width</a><ahref="#SkSurface_MakeRasterDirect_pixels">pixels</a> of <ahref="undocumented#Image_Color_Type">Image Color Type</a>.
<ahref="undocumented#Pixel">Pixel</a> buffer size should be info <ahref="#SkSurface_height">height</a> times computed <ahref="#SkSurface_MakeRasterDirect_rowBytes">rowBytes</a>.
Pixels are not initialized.
To access <ahref="#SkSurface_MakeRasterDirect_pixels">pixels</a> after drawing, call <ahref="#SkSurface_flush">flush</a> or <ahref="#SkSurface_peekPixels">peekPixels</a>.
<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, <ahref="undocumented#Image_Color_Type">Image Color Type</a>, <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, <ahref="undocumented#Color_Space">Color Space</a>,
of <ahref="undocumented#Raster_Surface">Raster Surface</a>; <ahref="#SkSurface_width">width</a> and <ahref="#SkSurface_height">height</a> must be greater than zero</td>
Allocates raster <ahref="#Surface">Surface</a>. <ahref="SkCanvas_Reference#Canvas">Canvas</a> returned by <ahref="#Surface">Surface</a> draws directly into <ahref="#SkSurface_MakeRasterDirectReleaseProc_pixels">pixels</a>.
<ahref="#SkSurface_MakeRasterDirectReleaseProc_releaseProc">releaseProc</a> is called with <ahref="#SkSurface_MakeRasterDirectReleaseProc_pixels">pixels</a> and <ahref="#SkSurface_MakeRasterDirectReleaseProc_context">context</a> when <ahref="#Surface">Surface</a> is deleted.
<ahref="#Surface">Surface</a> is returned if all parameters are valid.
Valid parameters include:
info dimensions are greater than zero;
info contains <ahref="undocumented#Image_Color_Type">Image Color Type</a> and <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a> supported by <ahref="undocumented#Raster_Surface">Raster Surface</a>;
<ahref="#SkSurface_MakeRasterDirectReleaseProc_pixels">pixels</a> is not nullptr;
<ahref="#SkSurface_MakeRasterDirectReleaseProc_rowBytes">rowBytes</a> is large enough to contain info <ahref="#SkSurface_width">width</a><ahref="#SkSurface_MakeRasterDirectReleaseProc_pixels">pixels</a> of <ahref="undocumented#Image_Color_Type">Image Color Type</a>.
<ahref="undocumented#Pixel">Pixel</a> buffer size should be info <ahref="#SkSurface_height">height</a> times computed <ahref="#SkSurface_MakeRasterDirectReleaseProc_rowBytes">rowBytes</a>.
Pixels are not initialized.
To access <ahref="#SkSurface_MakeRasterDirectReleaseProc_pixels">pixels</a> after drawing, call <ahref="#SkSurface_flush">flush</a> or <ahref="#SkSurface_peekPixels">peekPixels</a>.
<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, <ahref="undocumented#Image_Color_Type">Image Color Type</a>, <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, <ahref="undocumented#Color_Space">Color Space</a>,
of <ahref="undocumented#Raster_Surface">Raster Surface</a>; <ahref="#SkSurface_width">width</a> and <ahref="#SkSurface_height">height</a> must be greater than zero</td>
Allocates raster <ahref="#Surface">Surface</a>. <ahref="SkCanvas_Reference#Canvas">Canvas</a> returned by <ahref="#Surface">Surface</a> draws directly into pixels.
Allocates and zeroes pixel memory. <ahref="undocumented#Pixel">Pixel</a> memory size is <ahref="#SkSurface_MakeRaster_imageInfo">imageInfo</a>.<ahref="#SkSurface_height">height</a> times
<ahref="#SkSurface_MakeRaster_rowBytes">rowBytes</a>, or times <ahref="#SkSurface_MakeRaster_imageInfo">imageInfo</a>.minRowBytes() if <ahref="#SkSurface_MakeRaster_rowBytes">rowBytes</a> is zero.
<ahref="undocumented#Pixel">Pixel</a> memory is deleted when <ahref="#Surface">Surface</a> is deleted.
<ahref="#Surface">Surface</a> is returned if all parameters are valid.
Valid parameters include:
info dimensions are greater than zero;
info contains <ahref="undocumented#Image_Color_Type">Image Color Type</a> and <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a> supported by <ahref="undocumented#Raster_Surface">Raster Surface</a>;
<ahref="#SkSurface_MakeRaster_rowBytes">rowBytes</a> is large enough to contain info <ahref="#SkSurface_width">width</a> pixels of <ahref="undocumented#Image_Color_Type">Image Color Type</a>, or is zero.
If <ahref="#SkSurface_MakeRaster_rowBytes">rowBytes</a> is not zero, subsequent images returned by <ahref="#SkSurface_makeImageSnapshot">makeImageSnapshot</a>
have the same <ahref="#SkSurface_MakeRaster_rowBytes">rowBytes</a>.
<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, <ahref="undocumented#Image_Color_Type">Image Color Type</a>, <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, <ahref="undocumented#Color_Space">Color Space</a>,
of <ahref="undocumented#Raster_Surface">Raster Surface</a>; <ahref="#SkSurface_width">width</a> and <ahref="#SkSurface_height">height</a> must be greater than zero</td>
Allocates raster <ahref="#Surface">Surface</a>. <ahref="SkCanvas_Reference#Canvas">Canvas</a> returned by <ahref="#Surface">Surface</a> draws directly into pixels.
Allocates and zeroes pixel memory. <ahref="undocumented#Pixel">Pixel</a> memory size is <ahref="#SkSurface_MakeRaster_2_imageInfo">imageInfo</a>.<ahref="#SkSurface_height">height</a> times
<ahref="undocumented#Pixel">Pixel</a> memory is deleted when <ahref="#Surface">Surface</a> is deleted.
<ahref="#Surface">Surface</a> is returned if all parameters are valid.
Valid parameters include:
info dimensions are greater than zero;
info contains <ahref="undocumented#Image_Color_Type">Image Color Type</a> and <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a> supported by <ahref="undocumented#Raster_Surface">Raster Surface</a>.
<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, <ahref="undocumented#Image_Color_Type">Image Color Type</a>, <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, <ahref="undocumented#Color_Space">Color Space</a>,
of <ahref="undocumented#Raster_Surface">Raster Surface</a>; <ahref="#SkSurface_width">width</a> and <ahref="#SkSurface_height">height</a> must be greater than zero</td>
static sk_sp<SkSurface> MakeRasterN32Premul(int width, int height,
const SkSurfaceProps* surfaceProps = nullptr)
</pre>
Allocates raster <ahref="#Surface">Surface</a>. <ahref="SkCanvas_Reference#Canvas">Canvas</a> returned by <ahref="#Surface">Surface</a> draws directly into pixels.
Allocates and zeroes pixel memory. <ahref="undocumented#Pixel">Pixel</a> memory size is <ahref="#SkSurface_height">height</a> times <ahref="#SkSurface_width">width</a> times
four. <ahref="undocumented#Pixel">Pixel</a> memory is deleted when <ahref="#Surface">Surface</a> is deleted.
Internally, sets <ahref="undocumented#Image_Info">Image Info</a> to <ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, <ahref="undocumented#Native_Color_Type">Native Color Type</a>, and
valid for the lifetime of returned <ahref="#Surface">Surface</a>. If <ahref="#SkSurface_MakeFromBackendTexture_sampleCnt">sampleCnt</a> greater than zero,
creates an intermediate MSAA <ahref="#Surface">Surface</a> which is used for drawing <ahref="#SkSurface_MakeFromBackendTexture_backendTexture">backendTexture</a>.
<ahref="#Surface">Surface</a> is returned if all parameters are valid. <ahref="#SkSurface_MakeFromBackendTexture_backendTexture">backendTexture</a> is valid if
its pixel configuration agrees with <ahref="#SkSurface_MakeFromBackendTexture_colorSpace">colorSpace</a> and <ahref="#SkSurface_MakeFromBackendTexture_context">context</a>; for instance, if
<ahref="#SkSurface_MakeFromBackendTexture_backendTexture">backendTexture</a> has an sRGB configuration, then <ahref="#SkSurface_MakeFromBackendTexture_context">context</a> must support sRGB,
and <ahref="#SkSurface_MakeFromBackendTexture_colorSpace">colorSpace</a> must be present. Further, <ahref="#SkSurface_MakeFromBackendTexture_backendTexture">backendTexture</a><ahref="#SkSurface_width">width</a> and <ahref="#SkSurface_height">height</a> must
not exceed <ahref="#SkSurface_MakeFromBackendTexture_context">context</a> capabilities, and the <ahref="#SkSurface_MakeFromBackendTexture_context">context</a> must be able to support
valid for the lifetime of returned <ahref="#Surface">Surface</a>. If <ahref="#SkSurface_MakeFromBackendTexture_2_sampleCnt">sampleCnt</a> greater than zero,
creates an intermediate MSAA <ahref="#Surface">Surface</a> which is used for drawing <ahref="#SkSurface_MakeFromBackendTexture_2_backendTexture">backendTexture</a>.
<ahref="#Surface">Surface</a> is returned if all parameters are valid. <ahref="#SkSurface_MakeFromBackendTexture_2_backendTexture">backendTexture</a> is valid if
its pixel configuration agrees with <ahref="#SkSurface_MakeFromBackendTexture_2_colorSpace">colorSpace</a> and <ahref="#SkSurface_MakeFromBackendTexture_2_context">context</a>; for instance, if
<ahref="#SkSurface_MakeFromBackendTexture_2_backendTexture">backendTexture</a> has an sRGB configuration, then <ahref="#SkSurface_MakeFromBackendTexture_2_context">context</a> must support sRGB,
and <ahref="#SkSurface_MakeFromBackendTexture_2_colorSpace">colorSpace</a> must be present. Further, <ahref="#SkSurface_MakeFromBackendTexture_2_backendTexture">backendTexture</a><ahref="#SkSurface_width">width</a> and <ahref="#SkSurface_height">height</a> must
not exceed <ahref="#SkSurface_MakeFromBackendTexture_2_context">context</a> capabilities, and the <ahref="#SkSurface_MakeFromBackendTexture_2_context">context</a> must be able to support
valid for the lifetime of returned <ahref="#Surface">Surface</a>.
<ahref="#Surface">Surface</a> is returned if all parameters are valid. <ahref="#SkSurface_MakeFromBackendRenderTarget_backendRenderTarget">backendRenderTarget</a> is valid if
its pixel configuration agrees with <ahref="#SkSurface_MakeFromBackendRenderTarget_colorSpace">colorSpace</a> and <ahref="#SkSurface_MakeFromBackendRenderTarget_context">context</a>; for instance, if
<ahref="#SkSurface_MakeFromBackendRenderTarget_backendRenderTarget">backendRenderTarget</a> has an sRGB configuration, then <ahref="#SkSurface_MakeFromBackendRenderTarget_context">context</a> must support sRGB,
and <ahref="#SkSurface_MakeFromBackendRenderTarget_colorSpace">colorSpace</a> must be present. Further, <ahref="#SkSurface_MakeFromBackendRenderTarget_backendRenderTarget">backendRenderTarget</a><ahref="#SkSurface_width">width</a> and <ahref="#SkSurface_height">height</a> must
not exceed <ahref="#SkSurface_MakeFromBackendRenderTarget_context">context</a> capabilities, and the <ahref="#SkSurface_MakeFromBackendRenderTarget_context">context</a> must be able to support
valid for the lifetime of returned <ahref="#Surface">Surface</a>.
<ahref="#Surface">Surface</a> is returned if all parameters are valid. <ahref="#SkSurface_MakeFromBackendRenderTarget_2_backendRenderTarget">backendRenderTarget</a> is valid if
its pixel configuration agrees with <ahref="#SkSurface_MakeFromBackendRenderTarget_2_colorSpace">colorSpace</a> and <ahref="#SkSurface_MakeFromBackendRenderTarget_2_context">context</a>; for instance, if
<ahref="#SkSurface_MakeFromBackendRenderTarget_2_backendRenderTarget">backendRenderTarget</a> has an sRGB configuration, then <ahref="#SkSurface_MakeFromBackendRenderTarget_2_context">context</a> must support sRGB,
and <ahref="#SkSurface_MakeFromBackendRenderTarget_2_colorSpace">colorSpace</a> must be present. Further, <ahref="#SkSurface_MakeFromBackendRenderTarget_2_backendRenderTarget">backendRenderTarget</a><ahref="#SkSurface_width">width</a> and <ahref="#SkSurface_height">height</a> must
not exceed <ahref="#SkSurface_MakeFromBackendRenderTarget_2_context">context</a> capabilities, and the <ahref="#SkSurface_MakeFromBackendRenderTarget_2_context">context</a> must be able to support
pixels, based on the <ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, and <ahref="undocumented#Image_Color_Type">Image Color Type</a> in ImageInfo. <ahref="#SkSurface_MakeRenderTarget_budgeted">budgeted</a>
selects whether allocation for offscreen pixels is tracked by <ahref="#SkSurface_MakeRenderTarget_context">context</a>. <ahref="#SkSurface_MakeRenderTarget_imageInfo">imageInfo</a>
describes the pixel format in <ahref="undocumented#Image_Color_Type">Image Color Type</a>, and transparency in
<ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, and color matching in <ahref="undocumented#Color_Space">Color Space</a>.
up to the next supported count, or rounded down if it is larger than the
maximum supported count.
<ahref="#SkSurface_MakeRenderTarget_surfaceOrigin">surfaceOrigin</a> pins either the top-left or the bottom-left corner to the origin.
<ahref="#SkSurface_MakeRenderTarget_shouldCreateWithMips">shouldCreateWithMips</a> hints that <ahref="SkImage_Reference#Image">Image</a> returned by <ahref="#SkSurface_makeImageSnapshot">makeImageSnapshot</a> is <ahref="undocumented#Mip_Map">Mip Map</a>.
pixels, based on the <ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, and <ahref="undocumented#Image_Color_Type">Image Color Type</a> in ImageInfo. <ahref="#SkSurface_MakeRenderTarget_2_budgeted">budgeted</a>
selects whether allocation for offscreen pixels is tracked by <ahref="#SkSurface_MakeRenderTarget_2_context">context</a>. <ahref="#SkSurface_MakeRenderTarget_2_imageInfo">imageInfo</a>
describes the pixel format in <ahref="undocumented#Image_Color_Type">Image Color Type</a>, and transparency in
<ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, and color matching in <ahref="undocumented#Color_Space">Color Space</a>.
<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, <ahref="undocumented#Image_Color_Type">Image Color Type</a>, <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, <ahref="undocumented#Color_Space">Color Space</a>,
of <ahref="undocumented#Raster_Surface">Raster Surface</a>; <ahref="#SkSurface_width">width</a>, or <ahref="#SkSurface_height">height</a>, or both, may be zero</td>
<div><fiddle-embedname="640321e8ecfb3f9329f3bc6e1f02485f"gpu="true"cpu="true"><div>LCD text takes advantage of raster striping to improve resolution. Only one of
the four combinations is correct, depending on whether the monitor's LCD is
pixels, based on the <ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, and <ahref="undocumented#Image_Color_Type">Image Color Type</a> in ImageInfo. <ahref="#SkSurface_MakeRenderTarget_3_budgeted">budgeted</a>
selects whether allocation for offscreen pixels is tracked by <ahref="#SkSurface_MakeRenderTarget_3_context">context</a>. <ahref="#SkSurface_MakeRenderTarget_3_imageInfo">imageInfo</a>
describes the pixel format in <ahref="undocumented#Image_Color_Type">Image Color Type</a>, and transparency in
<ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, and color matching in <ahref="undocumented#Color_Space">Color Space</a>.
<ahref="#Surface">Surface</a> bottom-left corner is pinned to the origin.
<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, <ahref="undocumented#Image_Color_Type">Image Color Type</a>, <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>, <ahref="undocumented#Color_Space">Color Space</a>,
of <ahref="undocumented#Raster_Surface">Raster Surface</a>; <ahref="#SkSurface_width">width</a>, or <ahref="#SkSurface_height">height</a>, or both, may be zero</td>
</tr>
</table>
### Return Value
<ahref="#Surface">Surface</a> if all parameters are valid; otherwise, nullptr
static sk_sp<SkSurface> MakeNull(int width, int height)
</pre>
Returns <ahref="#Surface">Surface</a> without backing pixels. Drawing to <ahref="SkCanvas_Reference#Canvas">Canvas</a> returned from <ahref="#Surface">Surface</a>
has no effect. Calling <ahref="#SkSurface_makeImageSnapshot">makeImageSnapshot</a> on returned <ahref="#Surface">Surface</a> returns nullptr.
<ahref="#SkSurface_ContentChangeMode">ContentChangeMode</a> members are parameters to <ahref="#SkSurface_notifyContentWillChange">notifyContentWillChange</a>.
### Constants
<table>
<tr>
<td><aname="SkSurface_kDiscard_ContentChangeMode"><code><strong>SkSurface::kDiscard_ContentChangeMode </strong></code></a></td><td>Pass to notifyContentWillChange to discard surface contents when</td><td>the surface is cleared or overwritten.</td>
</tr>
<tr>
<td><aname="SkSurface_kRetain_ContentChangeMode"><code><strong>SkSurface::kRetain_ContentChangeMode </strong></code></a></td><td>Pass to notifyContentWillChange when to preserve surface contents.</td><td>If a snapshot has been generated, this copies the <ahref="#Surface">Surface</a> contents.</td>
Subsequent calls to <ahref="#SkSurface_generationID">generationID</a> return a different value.
<ahref="#SkSurface_notifyContentWillChange_mode">mode</a> is normally passed as <ahref="#SkSurface_kRetain_ContentChangeMode">kRetain ContentChangeMode</a>.
<td><aname="SkSurface_kFlushRead_BackendHandleAccess"><code><strong>SkSurface::kFlushRead_BackendHandleAccess </strong></code></a></td><td>0</td><td>Caller may read from the back-end object.</td>
<td><aname="SkSurface_kFlushWrite_BackendHandleAccess"><code><strong>SkSurface::kFlushWrite_BackendHandleAccess </strong></code></a></td><td>1</td><td>Caller may write to the back-end object.</td>
<td><aname="SkSurface_kDiscardWrite_BackendHandleAccess"><code><strong>SkSurface::kDiscardWrite_BackendHandleAccess </strong></code></a></td><td>2</td><td>Caller must overwrite the entire back-end object.</td>
Returns <ahref="SkCanvas_Reference#Canvas">Canvas</a> that draws into <ahref="#Surface">Surface</a>. Subsequent calls return the same <ahref="SkCanvas_Reference#Canvas">Canvas</a>.
<ahref="SkCanvas_Reference#Canvas">Canvas</a> returned is managed and owned by <ahref="#Surface">Surface</a>, and is deleted when <ahref="#Surface">Surface</a>
is deleted.
### Return Value
drawing <ahref="SkCanvas_Reference#Canvas">Canvas</a> for <ahref="#Surface">Surface</a>
Returns nullptr if <ahref="#SkSurface_makeSurface_imageInfo">imageInfo</a><ahref="#SkSurface_width">width</a> or <ahref="#SkSurface_height">height</a> are zero, or if <ahref="#SkSurface_makeSurface_imageInfo">imageInfo</a>
is incompatible with <ahref="#Surface">Surface</a>.
void draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
</pre>
Draws <ahref="#Surface">Surface</a> contents to <ahref="#SkSurface_draw_canvas">canvas</a>, with its top-left corner at (<ahref="#SkSurface_draw_x">x</a>, <ahref="#SkSurface_draw_y">y</a>).
If <ahref="SkPaint_Reference#Paint">Paint</a><ahref="#SkSurface_draw_paint">paint</a> is not nullptr, apply <ahref="undocumented#Color_Filter">Color Filter</a>, <ahref="#Alpha">Color Alpha</a>, <ahref="undocumented#Image_Filter">Image Filter</a>,
<ahref="undocumented#Blend_Mode">Blend Mode</a>, and <ahref="undocumented#Draw_Looper">Draw Looper</a>.
Copies <ahref="#Surface">Surface</a> pixel address, row bytes, and <ahref="undocumented#Image_Info">Image Info</a> to <ahref="SkPixmap_Reference#Pixmap">Pixmap</a>, if address
is available, and returns true. If pixel address is not available, return
false and leave <ahref="SkPixmap_Reference#Pixmap">Pixmap</a> unchanged.
<ahref="#SkSurface_peekPixels_pixmap">pixmap</a> contents become invalid on any future change to <ahref="#Surface">Surface</a>.
Source <ahref="SkRect_Reference#Rect">Rect</a> corners are (<ahref="#SkSurface_readPixels_srcX">srcX</a>, <ahref="#SkSurface_readPixels_srcY">srcY</a>) and <ahref="#Surface">Surface</a> (<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>).
Destination <ahref="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<ahref="#SkSurface_readPixels_dst">dst</a>.<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_readPixels_dst">dst</a>.<ahref="#SkSurface_height">height</a>).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to <ahref="#SkSurface_readPixels_dst">dst</a>.colorType() and <ahref="#SkSurface_readPixels_dst">dst</a>.alphaType() if required.
The destination pixel storage must be allocated by the caller.
<ahref="undocumented#Pixel">Pixel</a> values are converted only if <ahref="undocumented#Image_Color_Type">Image Color Type</a> and <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>
do not match. Only pixels within both source and destination rectangles
are copied. <ahref="#SkSurface_readPixels_dst">dst</a> contents outside <ahref="SkRect_Reference#Rect">Rect</a> intersection are unchanged.
Pass negative values for <ahref="#SkSurface_readPixels_srcX">srcX</a> or <ahref="#SkSurface_readPixels_srcY">srcY</a> to offset pixels across or down destination.
Does not copy, and returns false if:
<table><tr>
<td>Source and destination rectangles do not intersect.</td></tr><tr>
<td><ahref="SkPixmap_Reference#Pixmap">Pixmap</a> pixels could not be allocated.</td></tr><tr>
<td><ahref="#SkSurface_readPixels_dst">dst</a>.rowBytes() is too small to contain one row of pixels.</td></tr>
bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY)
</pre>
Copies <ahref="SkRect_Reference#Rect">Rect</a> of pixels from <ahref="SkCanvas_Reference#Canvas">Canvas</a> into <ahref="#SkSurface_readPixels_2_dstPixels">dstPixels</a>.
Source <ahref="SkRect_Reference#Rect">Rect</a> corners are (<ahref="#SkSurface_readPixels_2_srcX">srcX</a>, <ahref="#SkSurface_readPixels_2_srcY">srcY</a>) and <ahref="#Surface">Surface</a> (<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>).
Destination <ahref="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<ahref="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.<ahref="#SkSurface_height">height</a>).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to <ahref="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.colorType() and <ahref="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.alphaType() if required.
The destination pixel storage must be allocated by the caller.
<ahref="undocumented#Pixel">Pixel</a> values are converted only if <ahref="undocumented#Image_Color_Type">Image Color Type</a> and <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>
do not match. Only pixels within both source and destination rectangles
are copied. <ahref="#SkSurface_readPixels_2_dstPixels">dstPixels</a> contents outside <ahref="SkRect_Reference#Rect">Rect</a> intersection are unchanged.
Pass negative values for <ahref="#SkSurface_readPixels_2_srcX">srcX</a> or <ahref="#SkSurface_readPixels_2_srcY">srcY</a> to offset pixels across or down destination.
Does not copy, and returns false if:
<table><tr>
<td>Source and destination rectangles do not intersect.</td></tr><tr>
<td><ahref="#Surface">Surface</a> pixels could not be converted to <ahref="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.colorType() or <ahref="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.alphaType().</td></tr><tr>
<td><ahref="#SkSurface_readPixels_2_dstRowBytes">dstRowBytes</a> is too small to contain one row of pixels.</td></tr>
<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>, <ahref="undocumented#Image_Color_Type">Image Color Type</a>, and <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a> of <ahref="#SkSurface_readPixels_2_dstPixels">dstPixels</a></td>
storage for pixels; <ahref="#SkSurface_readPixels_2_dstInfo">dstInfo</a>.<ahref="#SkSurface_height">height</a> times <ahref="#SkSurface_readPixels_2_dstRowBytes">dstRowBytes</a>, or larger</td>
Source <ahref="SkRect_Reference#Rect">Rect</a> corners are (<ahref="#SkSurface_readPixels_3_srcX">srcX</a>, <ahref="#SkSurface_readPixels_3_srcY">srcY</a>) and <ahref="#Surface">Surface</a> (<ahref="#SkSurface_width">width</a>, <ahref="#SkSurface_height">height</a>).
Destination <ahref="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (bitmap.<ahref="#SkSurface_width">width</a>, bitmap.<ahref="#SkSurface_height">height</a>).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to bitmap.colorType() and bitmap.alphaType() if required.
The destination pixel storage must be allocated by the caller.
<ahref="undocumented#Pixel">Pixel</a> values are converted only if <ahref="undocumented#Image_Color_Type">Image Color Type</a> and <ahref="undocumented#Image_Alpha_Type">Image Alpha Type</a>
do not match. Only pixels within both source and destination rectangles
are copied. <ahref="#SkSurface_readPixels_3_dst">dst</a> contents outside <ahref="SkRect_Reference#Rect">Rect</a> intersection are unchanged.
Pass negative values for <ahref="#SkSurface_readPixels_3_srcX">srcX</a> or <ahref="#SkSurface_readPixels_3_srcY">srcY</a> to offset pixels across or down destination.
Does not copy, and returns false if:
<table><tr>
<td>Source and destination rectangles do not intersect.</td></tr><tr>
<td><ahref="#Surface">Surface</a> pixels could not be converted to <ahref="#SkSurface_readPixels_3_dst">dst</a>.colorType() or <ahref="#SkSurface_readPixels_3_dst">dst</a>.alphaType().</td></tr><tr>
<td><ahref="#SkSurface_readPixels_3_dst">dst</a> pixels could not be allocated.</td></tr><tr>
<td><ahref="#SkSurface_readPixels_3_dst">dst</a>.rowBytes() is too small to contain one row of pixels.</td></tr>
After issuing all commands, <ahref="#SkSurface_flushAndSignalSemaphores_signalSemaphores">signalSemaphores</a> of count <ahref="#SkSurface_flushAndSignalSemaphores_numSemaphores">numSemaphores</a> semaphores
For each <ahref="undocumented#GrBackendSemaphore">GrBackendSemaphore</a> in <ahref="#SkSurface_flushAndSignalSemaphores_signalSemaphores">signalSemaphores</a>: