<ahref="#SkSurface">SkSurface</a> is responsible for managing the pixels that a canvas draws into. The pixels can be
allocated either in <ahref="undocumented#CPU">CPU</a> memory (a raster surface) or on the <ahref="undocumented#GPU">GPU</a> (a <ahref="undocumented#GrRenderTarget">GrRenderTarget</a> surface).
<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
| description | function |
| --- | --- |
| <ahref="#SkSurface_MakeFromBackendRenderTarget">MakeFromBackendRenderTarget</a> | Creates <ahref="#Surface">Surface</a> from <ahref="undocumented#GPU">GPU</a> memory buffer. |
| <ahref="#SkSurface_MakeFromBackendTexture">MakeFromBackendTexture</a> | Creates <ahref="#Surface">Surface</a> from <ahref="undocumented#GPU">GPU</a>-backed texture. |
| <ahref="#SkSurface_MakeFromBackendTextureAsRenderTarget">MakeFromBackendTextureAsRenderTarget</a> | Creates <ahref="#Surface">Surface</a> from <ahref="undocumented#GPU">GPU</a>-backed texture. |
| <ahref="#SkSurface_MakeNull">MakeNull</a> | Creates <ahref="#Surface">Surface</a> without backing pixels. |
| <ahref="#SkSurface_MakeRaster">MakeRaster</a> | Creates <ahref="#Surface">Surface</a> from <ahref="undocumented#SkImageInfo">SkImageInfo</a>. |
| <ahref="#SkSurface_MakeRasterDirect">MakeRasterDirect</a> | Creates <ahref="#Surface">Surface</a> from <ahref="undocumented#SkImageInfo">SkImageInfo</a> and <ahref="#Storage">Pixel Storage</a>. |
| <ahref="#SkSurface_MakeRasterDirectReleaseProc">MakeRasterDirectReleaseProc</a> | Creates <ahref="#Surface">Surface</a> from <ahref="undocumented#SkImageInfo">SkImageInfo</a> and <ahref="#Storage">Pixel Storage</a>. |
| <ahref="#SkSurface_makeSurface">makeSurface</a> | Returns a compatible <ahref="#Surface">Surface</a>. |
| <ahref="#SkSurface_notifyContentWillChange">notifyContentWillChange</a> | Notifies that contents will be changed outside of <ahref="undocumented#Skia">Skia</a>. |
| <ahref="#SkSurface_peekPixels">peekPixels</a> | Copies <ahref="#Surface">Surface</a> parameters to <ahref="SkPixmap_Reference#Pixmap">Pixmap</a>. |
| <ahref="#SkSurface_prepareForExternalIO">prepareForExternalIO</a> | To be deprecated. |
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
Wraps a <ahref="undocumented#GPU">GPU</a>-backed texture into <ahref="#Surface">Surface</a>. Caller must ensure the texture is
valid for the lifetime of returned <ahref="#Surface">Surface</a>. If <ahref="#SkSurface_MakeFromBackendTexture_sampleCnt">sampleCnt</a> greater than zero,
creates an intermediate <ahref="undocumented#MSAA">MSAA</a><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 <ahref="undocumented#sRGB">sRGB</a> configuration, then <ahref="#SkSurface_MakeFromBackendTexture_context">context</a> must support <ahref="undocumented#sRGB">sRGB</a>,
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
back-end textures.
If <ahref="undocumented#SK_SUPPORT_GPU">SK SUPPORT GPU</a> is defined as zero, has no effect and returns nullptr.
Wraps a <ahref="undocumented#GPU">GPU</a>-backed buffer into <ahref="#Surface">Surface</a>. Caller must ensure render target is
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 <ahref="undocumented#sRGB">sRGB</a> configuration, then <ahref="#SkSurface_MakeFromBackendRenderTarget_context">context</a> must support <ahref="undocumented#sRGB">sRGB</a>,
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
back-end render targets.
If <ahref="undocumented#SK_SUPPORT_GPU">SK SUPPORT GPU</a> is defined as zero, has no effect and returns nullptr.
Used to wrap a <ahref="undocumented#GPU">GPU</a>-backed texture as a <ahref="#SkSurface">SkSurface</a>. <ahref="undocumented#Skia">Skia</a> will treat the texture as
a rendering target only, but unlike NewFromBackendRenderTarget, <ahref="undocumented#Skia">Skia</a> will manage and own
the associated render target objects (but not the provided texture). <ahref="undocumented#Skia">Skia</a> will not assume
ownership of the texture and the client must ensure the texture is valid for the lifetime
of the <ahref="#SkSurface">SkSurface</a>.
If <ahref="undocumented#SK_SUPPORT_GPU">SK SUPPORT GPU</a> is defined as zero, has no effect and returns nullptr.
Returns offscreen <ahref="#Surface">Surface</a> on <ahref="undocumented#GPU">GPU</a> indicated by <ahref="#SkSurface_MakeRenderTarget_context">context</a>. Allocates memory for
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>.
<ahref="#SkSurface_MakeRenderTarget_sampleCount">sampleCount</a> requests the number of samples per pixel.
Pass zero to disable <ahref="undocumented#Multi_Sample_Anti_Aliasing">Multi Sample Anti Aliasing</a>. The request is rounded
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>.
If <ahref="undocumented#SK_SUPPORT_GPU">SK SUPPORT GPU</a> is defined as zero, has no effect and returns nullptr.
Returns offscreen <ahref="#Surface">Surface</a> on <ahref="undocumented#GPU">GPU</a> indicated by <ahref="#SkSurface_MakeRenderTarget_2_context">context</a>. Allocates memory for
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_MakeRenderTarget_2_sampleCount">sampleCount</a> requests the number of samples per pixel.
Pass zero to disable <ahref="undocumented#Multi_Sample_Anti_Aliasing">Multi Sample Anti Aliasing</a>. The request is rounded
up to the next supported count, or rounded down if it is larger than the
maximum supported count.
<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>
<div><fiddle-embedname="640321e8ecfb3f9329f3bc6e1f02485f"gpu="true"cpu="true"><div><ahref="undocumented#LCD">LCD</a> text takes advantage of raster striping to improve resolution. Only one of
Returns offscreen <ahref="#Surface">Surface</a> on <ahref="undocumented#GPU">GPU</a> indicated by <ahref="#SkSurface_MakeRenderTarget_3_context">context</a>. Allocates memory for
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>
Notifies that <ahref="#Surface">Surface</a> contents will be changed by code outside of <ahref="undocumented#Skia">Skia</a>.
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 a compatible <ahref="#Surface">Surface</a>, or nullptr. Returned <ahref="#Surface">Surface</a> contains
the same raster, <ahref="undocumented#GPU">GPU</a>, or null properties as the original. Returned <ahref="#Surface">Surface</a>
does not share the same pixels.
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>.
bool readPixels(const SkPixmap& dst, int srcX, int srcY)
</pre>
Copies <ahref="SkRect_Reference#Rect">Rect</a> of pixels to <ahref="#SkSurface_readPixels_dst">dst</a>.
Source <ahref="SkRect_Reference#Rect">Rect</a> corners are (<ahref="#SkSurface_readPixels_srcX">srcX</a>, <ahref="#SkSurface_readPixels_srcY">srcY</a>) and (this-><ahref="#SkSurface_width">width</a>, this-><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.
Pixels are readable when <ahref="#Surface">Surface</a> is raster, or backed by a <ahref="undocumented#GPU">GPU</a>.
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 (this-><ahref="#SkSurface_width">width</a>, this-><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.
Pixels are readable when <ahref="#Surface">Surface</a> is raster, or backed by a <ahref="undocumented#GPU">GPU</a>.
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>
bool readPixels(const SkBitmap& dst, int srcX, int srcY)
</pre>
Copies <ahref="SkRect_Reference#Rect">Rect</a> of pixels from <ahref="#Surface">Surface</a> into bitmap.
Source <ahref="SkRect_Reference#Rect">Rect</a> corners are (<ahref="#SkSurface_readPixels_3_srcX">srcX</a>, <ahref="#SkSurface_readPixels_3_srcY">srcY</a>) and (this-><ahref="#SkSurface_width">width</a>, this-><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.
Pixels are readable when <ahref="#Surface">Surface</a> is raster, or backed by a <ahref="undocumented#GPU">GPU</a>.
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>
Issues pending <ahref="#Surface">Surface</a> commands to the <ahref="undocumented#GPU">GPU</a>-backed <ahref="undocumented#API">API</a> and resolves any <ahref="#Surface">Surface</a><ahref="undocumented#MSAA">MSAA</a>.
<ahref="undocumented#Skia">Skia</a> flushes as needed, so it is not necessary to call this if <ahref="undocumented#Skia">Skia</a> manages
drawing and object lifetime. Call when interleaving <ahref="undocumented#Skia">Skia</a> calls with native
Issues pending <ahref="#Surface">Surface</a> commands to the <ahref="undocumented#GPU">GPU</a>-backed <ahref="undocumented#API">API</a> and resolves any <ahref="#Surface">Surface</a><ahref="undocumented#MSAA">MSAA</a>.
After issuing all commands, <ahref="#SkSurface_flushAndSignalSemaphores_signalSemaphores">signalSemaphores</a> of count <ahref="#SkSurface_flushAndSignalSemaphores_numSemaphores">numSemaphores</a> semaphores
are signaled by the <ahref="undocumented#GPU">GPU</a>.
For each <ahref="undocumented#GrBackendSemaphore">GrBackendSemaphore</a> in <ahref="#SkSurface_flushAndSignalSemaphores_signalSemaphores">signalSemaphores</a>:
if <ahref="undocumented#GrBackendSemaphore">GrBackendSemaphore</a> is initialized, the <ahref="undocumented#GPU">GPU</a> back-end uses the semaphore as is;
otherwise, a new semaphore is created and initializes <ahref="undocumented#GrBackendSemaphore">GrBackendSemaphore</a>.
The caller must delete the semaphores created and returned in <ahref="#SkSurface_flushAndSignalSemaphores_signalSemaphores">signalSemaphores</a>.
<ahref="undocumented#GrBackendSemaphore">GrBackendSemaphore</a> can be deleted as soon as this function returns.
If the back-end <ahref="undocumented#API">API</a> is <ahref="undocumented#OpenGL">OpenGL</a> only uninitialized <ahref="#GrBackendSemaphore">GrBackendSemaphores</a> are supported.
If the back-end <ahref="undocumented#API">API</a> is <ahref="undocumented#Vulkan">Vulkan</a> semaphores may be initialized or uninitialized.
If uninitialized, created semaphores are valid only with the VkDevice
with which they were created.
If <ahref="#kNo">GrSemaphoresSubmitted::kNo</a> is returned, the <ahref="undocumented#GPU">GPU</a> back-end did not create or
add any semaphores to signal on the <ahref="undocumented#GPU">GPU</a>; the caller should not instruct the <ahref="undocumented#GPU">GPU</a>
to <ahref="#SkSurface_wait">wait</a> on any of the semaphores.
Pending surface commands are flushed regardless of the return result.
Inserts a list of <ahref="undocumented#GPU">GPU</a> semaphores that the current <ahref="undocumented#GPU">GPU</a>-backed <ahref="undocumented#API">API</a> must <ahref="#SkSurface_wait">wait</a> on before
executing any more commands on the <ahref="undocumented#GPU">GPU</a> for this surface. <ahref="undocumented#Skia">Skia</a> will take ownership of the
underlying semaphores and delete them once they have been signaled and waited on.
If this call returns false, then the <ahref="undocumented#GPU">GPU</a> back-end will not <ahref="#SkSurface_wait">wait</a> on any passed in semaphores,
Draws deferred display list created using <ahref="undocumented#SkDeferredDisplayListRecorder">SkDeferredDisplayListRecorder</a>.
The <ahref="#SkSurface_draw">draw</a> has no effect if <ahref="#Characterization">Surface Characterization</a> stored in <ahref="#SkSurface_draw_2_deferredDisplayList">deferredDisplayList</a>
is not compatible with <ahref="#Surface">Surface</a>.