1SkImage Reference 2=== 3 4 5<a name='SkImage'></a> 6 7--- 8 9<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 10class <a href='SkImage_Reference#SkImage'>SkImage</a> : public <a href='undocumented#SkRefCnt'>SkRefCnt</a> { 11 12 typedef void* <a href='#SkImage_ReleaseContext'>ReleaseContext</a>; 13 14 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeRasterCopy'>MakeRasterCopy</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='SkPixmap_Reference#Pixmap'>pixmap</a>); 15 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeRasterData'>MakeRasterData</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> pixels, 16 size_t rowBytes); 17 18 typedef void (*<a href='#SkImage_RasterReleaseProc'>RasterReleaseProc</a>)(const void* pixels, <a href='#SkImage_ReleaseContext'>ReleaseContext</a>); 19 20 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromRaster'>MakeFromRaster</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='SkPixmap_Reference#Pixmap'>pixmap</a>, 21 <a href='#SkImage_RasterReleaseProc'>RasterReleaseProc</a> rasterReleaseProc, 22 <a href='#SkImage_ReleaseContext'>ReleaseContext</a> releaseContext); 23 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromBitmap'>MakeFromBitmap</a>(const <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& <a href='SkBitmap_Reference#Bitmap'>bitmap</a>); 24 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromGenerator'>MakeFromGenerator</a>(std::unique_ptr<<a href='undocumented#SkImageGenerator'>SkImageGenerator</a>> imageGenerator, 25 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>* subset = nullptr); 26 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromEncoded'>MakeFromEncoded</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> encoded, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>* subset = nullptr); 27 28 typedef void (*<a href='#SkImage_TextureReleaseProc'>TextureReleaseProc</a>)(<a href='#SkImage_ReleaseContext'>ReleaseContext</a> releaseContext); 29 30 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromTexture'>MakeFromTexture</a>(<a href='undocumented#GrContext'>GrContext</a>* context, 31 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 32 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> origin, 33 <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>, 34 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a>, 35 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a>); 36 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromTexture'>MakeFromTexture</a>(<a href='undocumented#GrContext'>GrContext</a>* context, 37 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 38 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> origin, 39 <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>, 40 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a>, 41 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a>, 42 <a href='#SkImage_TextureReleaseProc'>TextureReleaseProc</a> textureReleaseProc, 43 <a href='#SkImage_ReleaseContext'>ReleaseContext</a> releaseContext); 44 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeCrossContextFromEncoded'>MakeCrossContextFromEncoded</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='undocumented#Data'>data</a>, 45 bool buildMips, <a href='undocumented#SkColorSpace'>SkColorSpace</a>* dstColorSpace, 46 bool limitToMaxTextureSize = false); 47 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeCrossContextFromPixmap'>MakeCrossContextFromPixmap</a>(<a href='undocumented#GrContext'>GrContext</a>* context, const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='SkPixmap_Reference#Pixmap'>pixmap</a>, 48 bool buildMips, <a href='undocumented#SkColorSpace'>SkColorSpace</a>* dstColorSpace, 49 bool limitToMaxTextureSize = false); 50 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromAdoptedTexture'>MakeFromAdoptedTexture</a>(<a href='undocumented#GrContext'>GrContext</a>* context, 51 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 52 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> surfaceOrigin, 53 <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>, 54 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a> = <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, 55 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a> = nullptr); 56 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVATexturesCopy'>MakeFromYUVATexturesCopy</a>(<a href='undocumented#GrContext'>GrContext</a>* context, 57 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 58 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvaTextures[], 59 const <a href='undocumented#SkYUVAIndex'>SkYUVAIndex</a> yuvaIndices[4], 60 <a href='undocumented#SkISize'>SkISize</a> imageSize, 61 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 62 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr); 63 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVATexturesCopyWithExternalBackend'>MakeFromYUVATexturesCopyWithExternalBackend</a>( 64 <a href='undocumented#GrContext'>GrContext</a>* context, 65 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 66 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvaTextures[], 67 const <a href='undocumented#SkYUVAIndex'>SkYUVAIndex</a> yuvaIndices[4], 68 <a href='undocumented#SkISize'>SkISize</a> imageSize, 69 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 70 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 71 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr); 72 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVATextures'>MakeFromYUVATextures</a>(<a href='undocumented#GrContext'>GrContext</a>* context, 73 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 74 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvaTextures[], 75 const <a href='undocumented#SkYUVAIndex'>SkYUVAIndex</a> yuvaIndices[4], 76 <a href='undocumented#SkISize'>SkISize</a> imageSize, 77 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 78 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr); 79 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVAPixmaps'>MakeFromYUVAPixmaps</a>( 80 <a href='undocumented#GrContext'>GrContext</a>* context, <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> yuvaPixmaps[], 81 const <a href='undocumented#SkYUVAIndex'>SkYUVAIndex</a> yuvaIndices[4], <a href='undocumented#SkISize'>SkISize</a> imageSize, <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 82 bool buildMips, bool limitToMaxTextureSize = false, 83 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr); 84 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVTexturesCopy'>MakeFromYUVTexturesCopy</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 85 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvTextures[3], 86 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 87 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr); 88 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVTexturesCopyWithExternalBackend'>MakeFromYUVTexturesCopyWithExternalBackend</a>( 89 <a href='undocumented#GrContext'>GrContext</a>* context, <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 90 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvTextures[3], <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 91 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr); 92 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromNV12TexturesCopy'>MakeFromNV12TexturesCopy</a>(<a href='undocumented#GrContext'>GrContext</a>* context, 93 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 94 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> nv12Textures[2], 95 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 96 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr); 97 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend'>MakeFromNV12TexturesCopyWithExternalBackend</a>( 98 <a href='undocumented#GrContext'>GrContext</a>* context, 99 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 100 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> nv12Textures[2], 101 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 102 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 103 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr); 104 105 enum class <a href='#SkImage_BitDepth'>BitDepth</a> { 106 kU8, 107 kF16, 108 }; 109 110 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromPicture'>MakeFromPicture</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='SkPicture_Reference#Picture'>picture</a>, const <a href='undocumented#SkISize'>SkISize</a>& dimensions, 111 const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>* <a href='SkMatrix_Reference#Matrix'>matrix</a>, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>* <a href='SkPaint_Reference#Paint'>paint</a>, 112 <a href='#SkImage_BitDepth'>BitDepth</a> bitDepth, 113 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a>); 114 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromAHardwareBuffer'>MakeFromAHardwareBuffer</a>( 115 AHardwareBuffer* hardwareBuffer, 116 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a> = <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, 117 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a> = nullptr, 118 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> surfaceOrigin = <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a>); 119 int <a href='#SkImage_width'>width()</a> const; 120 int <a href='#SkImage_height'>height()</a> const; 121 <a href='undocumented#SkISize'>SkISize</a> <a href='#SkImage_dimensions'>dimensions()</a> const; 122 <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkImage_bounds'>bounds()</a> const; 123 uint32_t <a href='#SkImage_uniqueID'>uniqueID</a>() const; 124 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a>() const; 125 <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>() const; 126 <a href='undocumented#SkColorSpace'>SkColorSpace</a>* <a href='#SkImage_colorSpace'>colorSpace</a>() const; 127 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_refColorSpace'>refColorSpace</a>() const; 128 bool <a href='#SkImage_isAlphaOnly'>isAlphaOnly</a>() const; 129 bool <a href='#SkImage_isOpaque'>isOpaque</a>() const; 130 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkShader'>SkShader</a>> <a href='#SkImage_makeShader'>makeShader</a>(<a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_TileMode'>TileMode</a> tileMode1, <a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_TileMode'>TileMode</a> tileMode2, 131 const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>* localMatrix = nullptr) const; 132 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkShader'>SkShader</a>> <a href='#SkImage_makeShader'>makeShader</a>(const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>* localMatrix = nullptr) const; 133 bool <a href='#SkImage_peekPixels'>peekPixels</a>(<a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>* <a href='SkPixmap_Reference#Pixmap'>pixmap</a>) const; 134 bool <a href='#SkImage_isTextureBacked'>isTextureBacked</a>() const; 135 bool <a href='#SkImage_isValid'>isValid</a>(<a href='undocumented#GrContext'>GrContext</a>* context) const; 136 <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> <a href='#SkImage_getBackendTexture'>getBackendTexture</a>(bool flushPendingGrContextIO, 137 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a>* origin = nullptr) const; 138 139 enum <a href='#SkImage_CachingHint'>CachingHint</a> { 140 <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>, 141 <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a>, 142 }; 143 144 bool <a href='#SkImage_readPixels'>readPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& dstInfo, void* dstPixels, size_t dstRowBytes, 145 int srcX, int srcY, <a href='#SkImage_CachingHint'>CachingHint</a> cachingHint = <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>) const; 146 bool <a href='#SkImage_readPixels'>readPixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& dst, int srcX, int srcY, 147 <a href='#SkImage_CachingHint'>CachingHint</a> cachingHint = <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>) const; 148 bool <a href='#SkImage_scalePixels'>scalePixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& dst, <a href='undocumented#SkFilterQuality'>SkFilterQuality</a> filterQuality, 149 <a href='#SkImage_CachingHint'>CachingHint</a> cachingHint = <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>) const; 150 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='#SkImage_encodeToData'>encodeToData</a>(<a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a> encodedImageFormat, int quality) const; 151 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='#SkImage_encodeToData'>encodeToData</a>() const; 152 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='#SkImage_refEncodedData'>refEncodedData</a>() const; 153 <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeSubset'>makeSubset</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& subset) const; 154 <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeTextureImage'>makeTextureImage</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='undocumented#SkColorSpace'>SkColorSpace</a>* dstColorSpace, 155 <a href='undocumented#GrMipMapped'>GrMipMapped</a> mipMapped = <a href='undocumented#GrMipMapped'>GrMipMapped</a>::<a href='#GrMipMapped_kNo'>kNo</a>) const; 156 <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeNonTextureImage'>makeNonTextureImage</a>() const; 157 <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeRasterImage'>makeRasterImage</a>() const; 158 <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeWithFilter'>makeWithFilter</a>(const <a href='undocumented#SkImageFilter'>SkImageFilter</a>* filter, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& subset, 159 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& clipBounds, <a href='SkIRect_Reference#SkIRect'>SkIRect</a>* outSubset, 160 <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a>* offset) const; 161 162 typedef std::function<void(<a href='undocumented#GrBackendTexture'>GrBackendTexture</a>)> <a href='#SkImage_BackendTextureReleaseProc'>BackendTextureReleaseProc</a>; 163 164 static bool <a href='#SkImage_MakeBackendTextureFromSkImage'>MakeBackendTextureFromSkImage</a>(<a href='undocumented#GrContext'>GrContext</a>* context, 165 <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='SkImage_Reference#Image'>image</a>, 166 <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>* backendTexture, 167 <a href='#SkImage_BackendTextureReleaseProc'>BackendTextureReleaseProc</a>* backendTextureReleaseProc); 168 bool <a href='#SkImage_isLazyGenerated'>isLazyGenerated</a>() const; 169 <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeColorSpace'>makeColorSpace</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> target) const; 170}; 171 172</pre> 173 174<a href='SkImage_Reference#Image'>Image</a> describes a two dimensional array of pixels to draw. The pixels may be 175decoded in a <a href='#Raster_Bitmap'>Raster_Bitmap</a>, encoded in a <a href='SkPicture_Reference#Picture'>Picture</a> or compressed <a href='undocumented#Data'>data</a> <a href='SkStream_Reference#Stream'>stream</a>, 176or located in GPU memory as a <a href='#GPU_Texture'>GPU_Texture</a>. 177 178<a href='SkImage_Reference#Image'>Image</a> cannot be modified after it is created. <a href='SkImage_Reference#Image'>Image</a> may allocate additional 179storage as needed; for instance, an encoded <a href='SkImage_Reference#Image'>Image</a> may decode when drawn. 180 181<a href='SkImage_Reference#Image'>Image</a> width and height are greater than zero. Creating an <a href='SkImage_Reference#Image'>Image</a> with zero width 182or height returns <a href='SkImage_Reference#Image'>Image</a> equal to nullptr. 183 184<a href='SkImage_Reference#Image'>Image</a> may be created from <a href='SkBitmap_Reference#Bitmap'>Bitmap</a>, <a href='SkPixmap_Reference#Pixmap'>Pixmap</a>, <a href='SkSurface_Reference#Surface'>Surface</a>, <a href='SkPicture_Reference#Picture'>Picture</a>, encoded streams, 185<a href='#GPU_Texture'>GPU_Texture</a>, <a href='#Image_Info_YUV_ColorSpace'>YUV_ColorSpace</a> <a href='undocumented#Data'>data</a>, or hardware buffer. Encoded streams supported 186include BMP, GIF, HEIF, ICO, JPEG, PNG, WBMP, WebP. Supported encoding details 187vary with platform. 188 189<a name='Raster_Image'></a> 190 191<a href='#Image_Raster_Image'>Raster_Image</a> pixels are decoded in a <a href='#Raster_Bitmap'>Raster_Bitmap</a>. These pixels may be read 192directly and in most cases written to, although edited pixels may not be drawn 193if <a href='SkImage_Reference#Image'>Image</a> has been copied internally. 194 195<a name='Texture_Image'></a> 196 197<a href='#Image_Texture_Image'>Texture_Image</a> are located on GPU and pixels are not accessible. <a href='#Image_Texture_Image'>Texture_Image</a> 198are allocated optimally for best performance. <a href='#Image_Raster_Image'>Raster_Image</a> may 199be drawn to <a href='#GPU_Surface'>GPU_Surface</a>, but pixels are uploaded from CPU to GPU downgrading 200performance. 201 202<a name='Lazy_Image'></a> 203 204<a href='#Image_Lazy_Image'>Lazy_Image</a> defer allocating buffer for <a href='SkImage_Reference#Image'>Image</a> pixels and decoding <a href='SkStream_Reference#Stream'>stream</a> until 205<a href='SkImage_Reference#Image'>Image</a> is drawn. <a href='#Image_Lazy_Image'>Lazy_Image</a> caches result if possible to speed up repeated 206drawing. 207 208<a name='SkImage_MakeRasterCopy'></a> 209 210--- 211 212<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 213static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeRasterCopy'>MakeRasterCopy</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='SkPixmap_Reference#Pixmap'>pixmap</a>) 214</pre> 215 216Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> and copy of pixels. Since pixels are copied, <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> 217pixels may be modified or deleted without affecting <a href='SkImage_Reference#SkImage'>SkImage</a>. 218 219<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> is valid. Valid <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> parameters include: 220dimensions are greater than zero; 221each dimension fits in 29 bits; 222<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> are valid, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is not <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>; 223row bytes are large enough to hold one row of pixels; 224<a href='undocumented#Pixel'>pixel</a> address is not nullptr. 225 226### Parameters 227 228<table> <tr> <td><a name='SkImage_MakeRasterCopy_pixmap'><code><strong>pixmap</strong></code></a></td> 229 <td><a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, <a href='undocumented#Pixel'>pixel</a> address, and row bytes</td> 230 </tr> 231</table> 232 233### Return Value 234 235copy of <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> pixels, or nullptr 236 237### Example 238 239<div><fiddle-embed name="513afec5795a9504ebf6af5373d16b6b"><div>Draw a five by five <a href='SkBitmap_Reference#Bitmap'>bitmap</a>, and draw a copy in an <a href='SkImage_Reference#Image'>Image</a>. Editing the <a href='#SkImage_MakeRasterCopy_pixmap'>pixmap</a> 240alters the <a href='SkBitmap_Reference#Bitmap_Draw'>bitmap draw</a>, but does not alter the <a href='SkImage_Reference#Image'>Image</a> draw since the <a href='SkImage_Reference#Image'>Image</a> 241contains a copy of the pixels. 242</div></fiddle-embed></div> 243 244### See Also 245 246<a href='#SkImage_MakeRasterData'>MakeRasterData</a> <a href='#SkImage_MakeFromGenerator'>MakeFromGenerator</a> 247 248<a name='SkImage_MakeRasterData'></a> 249 250--- 251 252<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 253static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeRasterData'>MakeRasterData</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& info, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> pixels, size_t rowBytes) 254</pre> 255 256Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, sharing <a href='#SkImage_MakeRasterData_pixels'>pixels</a>. 257 258<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is valid. Valid <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> parameters include: 259dimensions are greater than zero; 260each dimension fits in 29 bits; 261<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> are valid, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is not <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>; 262<a href='#SkImage_MakeRasterData_rowBytes'>rowBytes</a> are large enough to hold one row of <a href='#SkImage_MakeRasterData_pixels'>pixels</a>; 263<a href='#SkImage_MakeRasterData_pixels'>pixels</a> is not nullptr, and contains enough <a href='undocumented#Data'>data</a> for <a href='SkImage_Reference#SkImage'>SkImage</a>. 264 265### Parameters 266 267<table> <tr> <td><a name='SkImage_MakeRasterData_info'><code><strong>info</strong></code></a></td> 268 <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> 269 </tr> 270 <tr> <td><a name='SkImage_MakeRasterData_pixels'><code><strong>pixels</strong></code></a></td> 271 <td>address or <a href='undocumented#Pixel_Storage'>pixel storage</a></td> 272 </tr> 273 <tr> <td><a name='SkImage_MakeRasterData_rowBytes'><code><strong>rowBytes</strong></code></a></td> 274 <td><a href='undocumented#Size'>size</a> of <a href='undocumented#Pixel'>pixel</a> row or larger</td> 275 </tr> 276</table> 277 278### Return Value 279 280<a href='SkImage_Reference#SkImage'>SkImage</a> sharing <a href='#SkImage_MakeRasterData_pixels'>pixels</a>, or nullptr 281 282### Example 283 284<div><fiddle-embed name="22e7ce79ab2fe94252d23319f2258127"></fiddle-embed></div> 285 286### See Also 287 288<a href='#SkImage_MakeRasterCopy'>MakeRasterCopy</a> <a href='#SkImage_MakeFromGenerator'>MakeFromGenerator</a> 289 290<a name='SkImage_ReleaseContext'></a> 291 292--- 293 294<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 295 typedef void* <a href='#SkImage_ReleaseContext'>ReleaseContext</a>; 296</pre> 297 298Caller <a href='undocumented#Data'>data</a> passed to <a href='#SkImage_RasterReleaseProc'>RasterReleaseProc</a>; may be nullptr. 299 300### See Also 301 302<a href='#SkImage_MakeFromRaster'>MakeFromRaster</a> <a href='#SkImage_RasterReleaseProc'>RasterReleaseProc</a> 303 304<a name='SkImage_RasterReleaseProc'></a> 305 306--- 307 308<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 309 typedef void (*<a href='#SkImage_RasterReleaseProc'>RasterReleaseProc</a>)(const void* pixels, <a href='#SkImage_ReleaseContext'>ReleaseContext</a>); 310</pre> 311 312Function called when <a href='SkImage_Reference#Image'>Image</a> no longer shares pixels. <a href='#SkImage_ReleaseContext'>ReleaseContext</a> is 313provided by caller when <a href='SkImage_Reference#Image'>Image</a> is created, and may be nullptr. 314 315### See Also 316 317<a href='#SkImage_ReleaseContext'>ReleaseContext</a> <a href='#SkImage_MakeFromRaster'>MakeFromRaster</a> 318 319<a name='SkImage_MakeFromRaster'></a> 320 321--- 322 323<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 324static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromRaster'>MakeFromRaster</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='SkPixmap_Reference#Pixmap'>pixmap</a>, <a href='#SkImage_RasterReleaseProc'>RasterReleaseProc</a> rasterReleaseProc, 325 <a href='#SkImage_ReleaseContext'>ReleaseContext</a> releaseContext) 326</pre> 327 328Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='#SkImage_MakeFromRaster_pixmap'>pixmap</a>, sharing <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> pixels. Pixels must remain valid and 329unchanged until <a href='#SkImage_MakeFromRaster_rasterReleaseProc'>rasterReleaseProc</a> is called. <a href='#SkImage_MakeFromRaster_rasterReleaseProc'>rasterReleaseProc</a> is passed 330<a href='#SkImage_MakeFromRaster_releaseContext'>releaseContext</a> when <a href='SkImage_Reference#SkImage'>SkImage</a> is deleted or no longer refers to <a href='SkPixmap_Reference#Pixmap_Pixels'>pixmap pixels</a>. 331 332Pass nullptr for <a href='#SkImage_MakeFromRaster_rasterReleaseProc'>rasterReleaseProc</a> to share <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> without requiring a callback 333when <a href='SkImage_Reference#SkImage'>SkImage</a> is released. Pass nullptr for <a href='#SkImage_MakeFromRaster_releaseContext'>releaseContext</a> if <a href='#SkImage_MakeFromRaster_rasterReleaseProc'>rasterReleaseProc</a> 334does not require state. 335 336<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if <a href='#SkImage_MakeFromRaster_pixmap'>pixmap</a> is valid. Valid <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> parameters include: 337dimensions are greater than zero; 338each dimension fits in 29 bits; 339<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> are valid, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is not <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>; 340row bytes are large enough to hold one row of pixels; 341<a href='undocumented#Pixel'>pixel</a> address is not nullptr. 342 343### Parameters 344 345<table> <tr> <td><a name='SkImage_MakeFromRaster_pixmap'><code><strong>pixmap</strong></code></a></td> 346 <td><a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, <a href='undocumented#Pixel'>pixel</a> address, and row bytes</td> 347 </tr> 348 <tr> <td><a name='SkImage_MakeFromRaster_rasterReleaseProc'><code><strong>rasterReleaseProc</strong></code></a></td> 349 <td>function called when pixels can be released; or nullptr</td> 350 </tr> 351 <tr> <td><a name='SkImage_MakeFromRaster_releaseContext'><code><strong>releaseContext</strong></code></a></td> 352 <td>state passed to <a href='#SkImage_MakeFromRaster_rasterReleaseProc'>rasterReleaseProc</a>; or nullptr</td> 353 </tr> 354</table> 355 356### Return Value 357 358<a href='SkImage_Reference#SkImage'>SkImage</a> sharing <a href='#SkImage_MakeFromRaster_pixmap'>pixmap</a> 359 360### Example 361 362<div><fiddle-embed name="275356b65d18c8868f4434137350cddc"> 363 364#### Example Output 365 366~~~~ 367before reset: 0 368after reset: 1 369~~~~ 370 371</fiddle-embed></div> 372 373### See Also 374 375<a href='#SkImage_MakeRasterCopy'>MakeRasterCopy</a> <a href='#SkImage_MakeRasterData'>MakeRasterData</a> <a href='#SkImage_MakeFromGenerator'>MakeFromGenerator</a> <a href='#SkImage_RasterReleaseProc'>RasterReleaseProc</a> <a href='#SkImage_ReleaseContext'>ReleaseContext</a> 376 377<a name='SkImage_MakeFromBitmap'></a> 378 379--- 380 381<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 382static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromBitmap'>MakeFromBitmap</a>(const <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>& <a href='SkBitmap_Reference#Bitmap'>bitmap</a>) 383</pre> 384 385Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='#SkImage_MakeFromBitmap_bitmap'>bitmap</a>, sharing or copying <a href='SkBitmap_Reference#Bitmap_Pixels'>bitmap pixels</a>. If the <a href='#SkImage_MakeFromBitmap_bitmap'>bitmap</a> 386is marked immutable, and its <a href='undocumented#Pixel'>pixel</a> memory is shareable, it may be shared 387instead of copied. 388 389<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if <a href='#SkImage_MakeFromBitmap_bitmap'>bitmap</a> is valid. Valid <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> parameters include: 390dimensions are greater than zero; 391each dimension fits in 29 bits; 392<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> are valid, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is not <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>; 393row bytes are large enough to hold one row of pixels; 394<a href='undocumented#Pixel'>pixel</a> address is not nullptr. 395 396### Parameters 397 398<table> <tr> <td><a name='SkImage_MakeFromBitmap_bitmap'><code><strong>bitmap</strong></code></a></td> 399 <td><a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, row bytes, and pixels</td> 400 </tr> 401</table> 402 403### Return Value 404 405created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 406 407### Example 408 409<div><fiddle-embed name="cf2cf53321e4e6a77c2841bfbc0ef707"><div>The first <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> is shared; writing to the <a href='undocumented#Pixel'>pixel</a> memory changes the first 410<a href='SkImage_Reference#Image'>Image</a>. 411The second <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> is marked immutable, and is copied; writing to the <a href='undocumented#Pixel'>pixel</a> 412memory does not alter the second <a href='SkImage_Reference#Image'>Image</a>. 413</div></fiddle-embed></div> 414 415### See Also 416 417<a href='#SkImage_MakeFromRaster'>MakeFromRaster</a> <a href='#SkImage_MakeRasterCopy'>MakeRasterCopy</a> <a href='#SkImage_MakeFromGenerator'>MakeFromGenerator</a> <a href='#SkImage_MakeRasterData'>MakeRasterData</a> 418 419<a name='SkImage_MakeFromGenerator'></a> 420 421--- 422 423<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 424static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromGenerator'>MakeFromGenerator</a>(std::unique_ptr<<a href='undocumented#SkImageGenerator'>SkImageGenerator</a>> imageGenerator, 425 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>* subset = nullptr) 426</pre> 427 428Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='undocumented#Data'>data</a> returned by <a href='#SkImage_MakeFromGenerator_imageGenerator'>imageGenerator</a>. Generated <a href='undocumented#Data'>data</a> is owned by <a href='SkImage_Reference#SkImage'>SkImage</a> and 429may not be shared or accessed. 430 431<a href='#SkImage_MakeFromGenerator_subset'>subset</a> allows selecting a portion of the full <a href='SkImage_Reference#Image'>image</a>. Pass nullptr to select the entire 432<a href='SkImage_Reference#Image'>image</a>; otherwise, <a href='#SkImage_MakeFromGenerator_subset'>subset</a> must be contained by <a href='SkImage_Reference#Image'>image</a> bounds. 433 434<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if generator <a href='undocumented#Data'>data</a> is valid. Valid <a href='undocumented#Data'>data</a> parameters vary by type of <a href='undocumented#Data'>data</a> 435and platform. 436 437<a href='#SkImage_MakeFromGenerator_imageGenerator'>imageGenerator</a> may wrap <a href='SkPicture_Reference#SkPicture'>SkPicture</a> <a href='undocumented#Data'>data</a>, codec <a href='undocumented#Data'>data</a>, or custom <a href='undocumented#Data'>data</a>. 438 439### Parameters 440 441<table> <tr> <td><a name='SkImage_MakeFromGenerator_imageGenerator'><code><strong>imageGenerator</strong></code></a></td> 442 <td>stock or custom routines to retrieve <a href='SkImage_Reference#SkImage'>SkImage</a></td> 443 </tr> 444 <tr> <td><a name='SkImage_MakeFromGenerator_subset'><code><strong>subset</strong></code></a></td> 445 <td>bounds of returned <a href='SkImage_Reference#SkImage'>SkImage</a>; may be nullptr</td> 446 </tr> 447</table> 448 449### Return Value 450 451created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 452 453### Example 454 455<div><fiddle-embed name="c2fec0746f88ca34d7dce59dd9bdef9e"><div>The generator returning <a href='SkPicture_Reference#Picture'>Picture</a> cannot be shared; std::move transfers ownership to generated <a href='SkImage_Reference#Image'>Image</a>. 456</div></fiddle-embed></div> 457 458### See Also 459 460<a href='#SkImage_MakeFromEncoded'>MakeFromEncoded</a> 461 462<a name='SkImage_MakeFromEncoded'></a> 463 464--- 465 466<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 467static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromEncoded'>MakeFromEncoded</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> encoded, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>* subset = nullptr) 468</pre> 469 470Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='#SkImage_MakeFromEncoded_encoded'>encoded</a> <a href='undocumented#Data'>data</a>. 471<a href='#SkImage_MakeFromEncoded_subset'>subset</a> allows selecting a portion of the full <a href='SkImage_Reference#Image'>image</a>. Pass nullptr to select the entire 472<a href='SkImage_Reference#Image'>image</a>; otherwise, <a href='#SkImage_MakeFromEncoded_subset'>subset</a> must be contained by <a href='SkImage_Reference#Image'>image</a> bounds. 473 474<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if format of the <a href='#SkImage_MakeFromEncoded_encoded'>encoded</a> <a href='undocumented#Data'>data</a> is recognized and supported. 475Recognized formats vary by platform. 476 477### Parameters 478 479<table> <tr> <td><a name='SkImage_MakeFromEncoded_encoded'><code><strong>encoded</strong></code></a></td> 480 <td><a href='undocumented#Data'>data</a> of <a href='SkImage_Reference#SkImage'>SkImage</a> to decode</td> 481 </tr> 482 <tr> <td><a name='SkImage_MakeFromEncoded_subset'><code><strong>subset</strong></code></a></td> 483 <td>bounds of returned <a href='SkImage_Reference#SkImage'>SkImage</a>; may be nullptr</td> 484 </tr> 485</table> 486 487### Return Value 488 489created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 490 491### Example 492 493<div><fiddle-embed name="894f732ed6409b1f392bc5481421d0e9"></fiddle-embed></div> 494 495### See Also 496 497<a href='#SkImage_MakeFromGenerator'>MakeFromGenerator</a> 498 499<a name='SkImage_TextureReleaseProc'></a> 500 501--- 502 503<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 504 typedef void (*<a href='#SkImage_TextureReleaseProc'>TextureReleaseProc</a>)(<a href='#SkImage_ReleaseContext'>ReleaseContext</a> releaseContext); 505</pre> 506 507User function called when supplied <a href='undocumented#Texture'>texture</a> may be deleted. 508 509### See Also 510 511<a href='#SkImage_MakeFromTexture'>MakeFromTexture</a> 512 513<a name='SkImage_MakeFromTexture'></a> 514 515--- 516 517<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 518static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromTexture'>MakeFromTexture</a>(<a href='undocumented#GrContext'>GrContext</a>* context, const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 519 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> origin, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>, 520 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a>, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a>) 521</pre> 522 523Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='undocumented#GPU_Texture'>GPU texture</a> associated with <a href='#SkImage_MakeFromTexture_context'>context</a>. Caller is responsible for 524managing the lifetime of <a href='undocumented#GPU_Texture'>GPU texture</a>. 525 526<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if format of <a href='#SkImage_MakeFromTexture_backendTexture'>backendTexture</a> is recognized and supported. 527Recognized formats vary by GPU back-end. 528 529### Parameters 530 531<table> <tr> <td><a name='SkImage_MakeFromTexture_context'><code><strong>context</strong></code></a></td> 532 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 533 </tr> 534 <tr> <td><a name='SkImage_MakeFromTexture_backendTexture'><code><strong>backendTexture</strong></code></a></td> 535 <td><a href='undocumented#Texture'>texture</a> residing on GPU</td> 536 </tr> 537 <tr> <td><a name='SkImage_MakeFromTexture_origin'><code><strong>origin</strong></code></a></td> 538 <td>one of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>, <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a></td> 539 </tr> 540 <tr> <td><a name='SkImage_MakeFromTexture_colorType'><code><strong>colorType</strong></code></a></td> 541 <td>one of:</td> 542 </tr> 543</table> 544 545<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>, 546<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, 547<a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, 548<a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 549<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 550 551### Parameters 552 553<table> <tr> <td><a name='SkImage_MakeFromTexture_alphaType'><code><strong>alphaType</strong></code></a></td> 554 <td>one of:</td> 555 </tr> 556</table> 557 558<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>, 559<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 560 561### Parameters 562 563<table> <tr> <td><a name='SkImage_MakeFromTexture_colorSpace'><code><strong>colorSpace</strong></code></a></td> 564 <td>range of colors; may be nullptr</td> 565 </tr> 566</table> 567 568### Return Value 569 570created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 571 572### Example 573 574<div><fiddle-embed name="94e9296c53bad074bf2a48ff885dac13" gpu="true"><div>A back-end <a href='undocumented#Texture'>texture</a> has been created and uploaded to the GPU outside of this example. 575</div></fiddle-embed></div> 576 577### See Also 578 579<a href='#SkImage_MakeFromAdoptedTexture'>MakeFromAdoptedTexture</a> <a href='SkSurface_Reference#SkSurface'>SkSurface</a>::<a href='#SkSurface_MakeFromBackendTexture'>MakeFromBackendTexture</a> 580 581<a name='SkImage_MakeFromTexture_2'></a> 582 583--- 584 585<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 586static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromTexture'>MakeFromTexture</a>(<a href='undocumented#GrContext'>GrContext</a>* context, const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 587 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> origin, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>, 588 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a>, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a>, 589 <a href='#SkImage_TextureReleaseProc'>TextureReleaseProc</a> textureReleaseProc, 590 <a href='#SkImage_ReleaseContext'>ReleaseContext</a> releaseContext) 591</pre> 592 593Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='undocumented#GPU_Texture'>GPU texture</a> associated with <a href='#SkImage_MakeFromTexture_2_context'>context</a>. <a href='undocumented#GPU_Texture'>GPU texture</a> must stay 594valid and unchanged until <a href='#SkImage_MakeFromTexture_2_textureReleaseProc'>textureReleaseProc</a> is called. <a href='#SkImage_MakeFromTexture_2_textureReleaseProc'>textureReleaseProc</a> is 595passed <a href='#SkImage_MakeFromTexture_2_releaseContext'>releaseContext</a> when <a href='SkImage_Reference#SkImage'>SkImage</a> is deleted or no longer refers to <a href='undocumented#Texture'>texture</a>. 596 597<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if format of <a href='#SkImage_MakeFromTexture_2_backendTexture'>backendTexture</a> is recognized and supported. 598Recognized formats vary by GPU back-end. 599 600### Parameters 601 602<table> <tr> <td><a name='SkImage_MakeFromTexture_2_context'><code><strong>context</strong></code></a></td> 603 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 604 </tr> 605 <tr> <td><a name='SkImage_MakeFromTexture_2_backendTexture'><code><strong>backendTexture</strong></code></a></td> 606 <td><a href='undocumented#Texture'>texture</a> residing on GPU</td> 607 </tr> 608 <tr> <td><a name='SkImage_MakeFromTexture_2_origin'><code><strong>origin</strong></code></a></td> 609 <td>one of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>, <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a></td> 610 </tr> 611 <tr> <td><a name='SkImage_MakeFromTexture_2_colorType'><code><strong>colorType</strong></code></a></td> 612 <td>one of:</td> 613 </tr> 614</table> 615 616<a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, 617<a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, <a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, 618<a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 619<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, 620<a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, 621<a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 622 623### Parameters 624 625<table> <tr> <td><a name='SkImage_MakeFromTexture_2_alphaType'><code><strong>alphaType</strong></code></a></td> 626 <td>one of:</td> 627 </tr> 628</table> 629 630<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>, 631<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 632 633### Parameters 634 635<table> <tr> <td><a name='SkImage_MakeFromTexture_2_colorSpace'><code><strong>colorSpace</strong></code></a></td> 636 <td>range of colors; may be nullptr</td> 637 </tr> 638 <tr> <td><a name='SkImage_MakeFromTexture_2_textureReleaseProc'><code><strong>textureReleaseProc</strong></code></a></td> 639 <td>function called when <a href='undocumented#Texture'>texture</a> can be released</td> 640 </tr> 641 <tr> <td><a name='SkImage_MakeFromTexture_2_releaseContext'><code><strong>releaseContext</strong></code></a></td> 642 <td>state passed to <a href='#SkImage_MakeFromTexture_2_textureReleaseProc'>textureReleaseProc</a></td> 643 </tr> 644</table> 645 646### Return Value 647 648created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 649 650### Example 651 652<div><fiddle-embed name="2b1e46354d823dbb53fa6af570135329" gpu="true"><div><a href='#SkImage_MakeFromTexture_2_textureReleaseProc'>textureReleaseProc</a> may be called at some later <a href='SkPoint_Reference#Point'>point</a> in time. In this example, 653<a href='#SkImage_MakeFromTexture_2_textureReleaseProc'>textureReleaseProc</a> has no effect on the drawing. 654</div></fiddle-embed></div> 655 656### See Also 657 658<a href='#SkImage_MakeFromAdoptedTexture'>MakeFromAdoptedTexture</a> <a href='SkSurface_Reference#SkSurface'>SkSurface</a>::<a href='#SkSurface_MakeFromBackendTexture'>MakeFromBackendTexture</a> 659 660<a name='SkImage_MakeCrossContextFromEncoded'></a> 661 662--- 663 664<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 665static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeCrossContextFromEncoded'>MakeCrossContextFromEncoded</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='undocumented#Data'>data</a>, 666 bool buildMips, <a href='undocumented#SkColorSpace'>SkColorSpace</a>* dstColorSpace, 667 bool limitToMaxTextureSize = false) 668</pre> 669 670Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from encoded <a href='#SkImage_MakeCrossContextFromEncoded_data'>data</a>. <a href='SkImage_Reference#SkImage'>SkImage</a> is uploaded to GPU back-end using <a href='#SkImage_MakeCrossContextFromEncoded_context'>context</a>. 671 672Created <a href='SkImage_Reference#SkImage'>SkImage</a> is available to other GPU contexts, and is available across thread 673boundaries. All contexts must be in the same <a href='undocumented#GPU_Share_Group'>GPU share group</a>, or otherwise 674share resources. 675 676When <a href='SkImage_Reference#SkImage'>SkImage</a> is no longer referenced, <a href='#SkImage_MakeCrossContextFromEncoded_context'>context</a> releases <a href='undocumented#Texture'>texture</a> memory 677asynchronously. 678 679<a href='undocumented#GrBackendTexture'>GrBackendTexture</a> decoded from <a href='#SkImage_MakeCrossContextFromEncoded_data'>data</a> is uploaded to match <a href='SkSurface_Reference#SkSurface'>SkSurface</a> created with 680<a href='#SkImage_MakeCrossContextFromEncoded_dstColorSpace'>dstColorSpace</a>. <a href='undocumented#SkColorSpace'>SkColorSpace</a> of <a href='SkImage_Reference#SkImage'>SkImage</a> is determined by encoded <a href='#SkImage_MakeCrossContextFromEncoded_data'>data</a>. 681 682<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if format of <a href='#SkImage_MakeCrossContextFromEncoded_data'>data</a> is recognized and supported, and if <a href='#SkImage_MakeCrossContextFromEncoded_context'>context</a> 683supports moving resources. Recognized formats vary by platform and GPU back-end. 684 685<a href='SkImage_Reference#SkImage'>SkImage</a> is returned using <a href='#SkImage_MakeFromEncoded'>MakeFromEncoded</a>() if <a href='#SkImage_MakeCrossContextFromEncoded_context'>context</a> is nullptr or does not support 686moving resources between contexts. 687 688### Parameters 689 690<table> <tr> <td><a name='SkImage_MakeCrossContextFromEncoded_context'><code><strong>context</strong></code></a></td> 691 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 692 </tr> 693 <tr> <td><a name='SkImage_MakeCrossContextFromEncoded_data'><code><strong>data</strong></code></a></td> 694 <td><a href='SkImage_Reference#SkImage'>SkImage</a> to decode</td> 695 </tr> 696 <tr> <td><a name='SkImage_MakeCrossContextFromEncoded_buildMips'><code><strong>buildMips</strong></code></a></td> 697 <td>create <a href='SkImage_Reference#SkImage'>SkImage</a> as <a href='undocumented#Mip_Map'>mip map</a> if true</td> 698 </tr> 699 <tr> <td><a name='SkImage_MakeCrossContextFromEncoded_dstColorSpace'><code><strong>dstColorSpace</strong></code></a></td> 700 <td>range of colors of matching <a href='SkSurface_Reference#SkSurface'>SkSurface</a> on GPU</td> 701 </tr> 702 <tr> <td><a name='SkImage_MakeCrossContextFromEncoded_limitToMaxTextureSize'><code><strong>limitToMaxTextureSize</strong></code></a></td> 703 <td>downscale <a href='SkImage_Reference#Image'>image</a> to GPU maximum <a href='undocumented#Texture'>texture</a> <a href='undocumented#Size'>size</a>, if necessary</td> 704 </tr> 705</table> 706 707### Return Value 708 709created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 710 711### Example 712 713<div><fiddle-embed name="069c7b116479e3ca46f953f07dcbdd36"></fiddle-embed></div> 714 715### See Also 716 717<a href='#SkImage_MakeCrossContextFromPixmap'>MakeCrossContextFromPixmap</a> 718 719<a name='SkImage_MakeCrossContextFromPixmap'></a> 720 721--- 722 723<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 724static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeCrossContextFromPixmap'>MakeCrossContextFromPixmap</a>(<a href='undocumented#GrContext'>GrContext</a>* context, const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& <a href='SkPixmap_Reference#Pixmap'>pixmap</a>, 725 bool buildMips, <a href='undocumented#SkColorSpace'>SkColorSpace</a>* dstColorSpace, 726 bool limitToMaxTextureSize = false) 727</pre> 728 729Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='#SkImage_MakeCrossContextFromPixmap_pixmap'>pixmap</a>. <a href='SkImage_Reference#SkImage'>SkImage</a> is uploaded to GPU back-end using <a href='#SkImage_MakeCrossContextFromPixmap_context'>context</a>. 730 731Created <a href='SkImage_Reference#SkImage'>SkImage</a> is available to other GPU contexts, and is available across thread 732boundaries. All contexts must be in the same <a href='undocumented#GPU_Share_Group'>GPU share group</a>, or otherwise 733share resources. 734 735When <a href='SkImage_Reference#SkImage'>SkImage</a> is no longer referenced, <a href='#SkImage_MakeCrossContextFromPixmap_context'>context</a> releases <a href='undocumented#Texture'>texture</a> memory 736asynchronously. 737 738<a href='undocumented#GrBackendTexture'>GrBackendTexture</a> created from <a href='#SkImage_MakeCrossContextFromPixmap_pixmap'>pixmap</a> is uploaded to match <a href='SkSurface_Reference#SkSurface'>SkSurface</a> created with 739<a href='#SkImage_MakeCrossContextFromPixmap_dstColorSpace'>dstColorSpace</a>. <a href='undocumented#SkColorSpace'>SkColorSpace</a> of <a href='SkImage_Reference#SkImage'>SkImage</a> is determined by <a href='#SkImage_MakeCrossContextFromPixmap_pixmap'>pixmap</a>.<a href='#SkPixmap_colorSpace'>colorSpace</a>(). 740 741<a href='SkImage_Reference#SkImage'>SkImage</a> is returned referring to GPU back-end if <a href='#SkImage_MakeCrossContextFromPixmap_context'>context</a> is not nullptr, 742format of <a href='undocumented#Data'>data</a> is recognized and supported, and if <a href='#SkImage_MakeCrossContextFromPixmap_context'>context</a> supports moving 743resources between contexts. Otherwise, <a href='#SkImage_MakeCrossContextFromPixmap_pixmap'>pixmap</a> <a href='undocumented#Pixel'>pixel</a> <a href='undocumented#Data'>data</a> is copied and <a href='SkImage_Reference#SkImage'>SkImage</a> 744as returned in raster format if possible; nullptr may be returned. 745Recognized GPU formats vary by platform and GPU back-end. 746 747### Parameters 748 749<table> <tr> <td><a name='SkImage_MakeCrossContextFromPixmap_context'><code><strong>context</strong></code></a></td> 750 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 751 </tr> 752 <tr> <td><a name='SkImage_MakeCrossContextFromPixmap_pixmap'><code><strong>pixmap</strong></code></a></td> 753 <td><a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, <a href='undocumented#Pixel'>pixel</a> address, and row bytes</td> 754 </tr> 755 <tr> <td><a name='SkImage_MakeCrossContextFromPixmap_buildMips'><code><strong>buildMips</strong></code></a></td> 756 <td>create <a href='SkImage_Reference#SkImage'>SkImage</a> as <a href='undocumented#Mip_Map'>mip map</a> if true</td> 757 </tr> 758 <tr> <td><a name='SkImage_MakeCrossContextFromPixmap_dstColorSpace'><code><strong>dstColorSpace</strong></code></a></td> 759 <td>range of colors of matching <a href='SkSurface_Reference#SkSurface'>SkSurface</a> on GPU</td> 760 </tr> 761 <tr> <td><a name='SkImage_MakeCrossContextFromPixmap_limitToMaxTextureSize'><code><strong>limitToMaxTextureSize</strong></code></a></td> 762 <td>downscale <a href='SkImage_Reference#Image'>image</a> to GPU maximum <a href='undocumented#Texture'>texture</a> <a href='undocumented#Size'>size</a>, if necessary</td> 763 </tr> 764</table> 765 766### Return Value 767 768created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 769 770### Example 771 772<div><fiddle-embed name="45bca8747b8f49b5be34b520897ef048"></fiddle-embed></div> 773 774### See Also 775 776<a href='#SkImage_MakeCrossContextFromEncoded'>MakeCrossContextFromEncoded</a> 777 778<a name='SkImage_MakeFromAdoptedTexture'></a> 779 780--- 781 782<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 783static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromAdoptedTexture'>MakeFromAdoptedTexture</a>(<a href='undocumented#GrContext'>GrContext</a>* context, 784 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 785 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> surfaceOrigin, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>, 786 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a> = <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, 787 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a> = nullptr) 788</pre> 789 790Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='#SkImage_MakeFromAdoptedTexture_backendTexture'>backendTexture</a> associated with <a href='#SkImage_MakeFromAdoptedTexture_context'>context</a>. <a href='#SkImage_MakeFromAdoptedTexture_backendTexture'>backendTexture</a> and 791returned <a href='SkImage_Reference#SkImage'>SkImage</a> are managed internally, and are released when no longer needed. 792 793<a href='SkImage_Reference#SkImage'>SkImage</a> is returned if format of <a href='#SkImage_MakeFromAdoptedTexture_backendTexture'>backendTexture</a> is recognized and supported. 794Recognized formats vary by GPU back-end. 795 796### Parameters 797 798<table> <tr> <td><a name='SkImage_MakeFromAdoptedTexture_context'><code><strong>context</strong></code></a></td> 799 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 800 </tr> 801 <tr> <td><a name='SkImage_MakeFromAdoptedTexture_backendTexture'><code><strong>backendTexture</strong></code></a></td> 802 <td><a href='undocumented#Texture'>texture</a> residing on GPU</td> 803 </tr> 804 <tr> <td><a name='SkImage_MakeFromAdoptedTexture_surfaceOrigin'><code><strong>surfaceOrigin</strong></code></a></td> 805 <td>one of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>, <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a></td> 806 </tr> 807 <tr> <td><a name='SkImage_MakeFromAdoptedTexture_colorType'><code><strong>colorType</strong></code></a></td> 808 <td>one of:</td> 809 </tr> 810</table> 811 812<a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, 813<a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, <a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, 814<a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 815<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, 816<a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, 817<a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 818 819### Parameters 820 821<table> <tr> <td><a name='SkImage_MakeFromAdoptedTexture_alphaType'><code><strong>alphaType</strong></code></a></td> 822 <td>one of:</td> 823 </tr> 824</table> 825 826<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>, 827<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 828 829### Parameters 830 831<table> <tr> <td><a name='SkImage_MakeFromAdoptedTexture_colorSpace'><code><strong>colorSpace</strong></code></a></td> 832 <td>range of colors; may be nullptr</td> 833 </tr> 834</table> 835 836### Return Value 837 838created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 839 840### Example 841 842<div><fiddle-embed name="b034517e39394b7543f06ec885e36d7d" gpu="true"></fiddle-embed></div> 843 844### See Also 845 846<a href='#SkImage_MakeFromTexture'>MakeFromTexture</a> <a href='#SkImage_MakeFromYUVTexturesCopy'>MakeFromYUVTexturesCopy</a> 847 848<a name='SkImage_MakeFromYUVATexturesCopy'></a> 849 850--- 851 852<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 853static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVATexturesCopy'>MakeFromYUVATexturesCopy</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 854 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvaTextures[], 855 const <a href='undocumented#SkYUVAIndex'>SkYUVAIndex</a> yuvaIndices[4], <a href='undocumented#SkISize'>SkISize</a> imageSize, 856 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 857 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr) 858</pre> 859 860Creates an <a href='SkImage_Reference#SkImage'>SkImage</a> by flattening the specified YUVA planes into a single, interleaved RGBA 861<a href='SkImage_Reference#Image'>image</a>. 862 863### Parameters 864 865<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopy_context'><code><strong>context</strong></code></a></td> 866 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 867 </tr> 868 <tr> <td><a name='SkImage_MakeFromYUVATexturesCopy_yuvColorSpace'><code><strong>yuvColorSpace</strong></code></a></td> 869 <td>How the YUV values are converted to RGB. One of:</td> 870 </tr> 871</table> 872 873<a href='SkImageInfo_Reference#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a>, <a href='SkImageInfo_Reference#kRec601_SkYUVColorSpace'>kRec601_SkYUVColorSpace</a>, 874<a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a> 875 876### Parameters 877 878<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopy_yuvaTextures'><code><strong>yuvaTextures</strong></code></a></td> 879 <td>array of (up to four) YUVA textures on GPU which contain the,</td> 880 </tr> 881</table> 882 883possibly interleaved, YUVA planes 884 885### Parameters 886 887<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopy_yuvaIndices'><code><strong>yuvaIndices</strong></code></a></td> 888 <td>array indicating which <a href='undocumented#Texture'>texture</a> in <a href='#SkImage_MakeFromYUVATexturesCopy_yuvaTextures'>yuvaTextures</a>, and channel</td> 889 </tr> 890</table> 891 892in that <a href='undocumented#Texture'>texture</a>, maps to each component of YUVA. 893 894### Parameters 895 896<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopy_imageSize'><code><strong>imageSize</strong></code></a></td> 897 <td><a href='undocumented#Size'>size</a> of the resulting <a href='SkImage_Reference#Image'>image</a></td> 898 </tr> 899 <tr> <td><a name='SkImage_MakeFromYUVATexturesCopy_imageOrigin'><code><strong>imageOrigin</strong></code></a></td> 900 <td>origin of the resulting <a href='SkImage_Reference#Image'>image</a>. One of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>,</td> 901 </tr> 902</table> 903 904<a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a> 905 906### Parameters 907 908<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopy_imageColorSpace'><code><strong>imageColorSpace</strong></code></a></td> 909 <td>range of colors of the resulting <a href='SkImage_Reference#Image'>image</a>; may be nullptr</td> 910 </tr> 911</table> 912 913### Return Value 914 915created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 916 917### See Also 918 919<a href='#SkImage_MakeFromYUVATexturesCopyWithExternalBackend'>MakeFromYUVATexturesCopyWithExternalBackend</a> <a href='#SkImage_MakeFromYUVATextures'>MakeFromYUVATextures</a> 920 921<a name='SkImage_MakeFromYUVATextures'></a> 922 923--- 924 925<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 926static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVATextures'>MakeFromYUVATextures</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 927 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvaTextures[], 928 const <a href='undocumented#SkYUVAIndex'>SkYUVAIndex</a> yuvaIndices[4], <a href='undocumented#SkISize'>SkISize</a> imageSize, 929 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 930 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr) ; 931</pre> 932 933Creates an <a href='SkImage_Reference#SkImage'>SkImage</a> by storing the specified YUVA planes into an <a href='SkImage_Reference#Image'>image</a>, to be rendered 934via multitexturing. 935 936### Parameters 937 938<table> <tr> <td><a name='SkImage_MakeFromYUVATextures_context'><code><strong>context</strong></code></a></td> 939 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 940 </tr> 941 <tr> <td><a name='SkImage_MakeFromYUVATextures_yuvColorSpace'><code><strong>yuvColorSpace</strong></code></a></td> 942 <td>How the YUV values are converted to RGB. One of:</td> 943 </tr> 944</table> 945 946<a href='SkImageInfo_Reference#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a>, <a href='SkImageInfo_Reference#kRec601_SkYUVColorSpace'>kRec601_SkYUVColorSpace</a>, 947<a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a> 948 949### Parameters 950 951<table> <tr> <td><a name='SkImage_MakeFromYUVATextures_yuvaTextures'><code><strong>yuvaTextures</strong></code></a></td> 952 <td>array of (up to four) YUVA textures on GPU which contain the,</td> 953 </tr> 954</table> 955 956possibly interleaved, YUVA planes 957 958### Parameters 959 960<table> <tr> <td><a name='SkImage_MakeFromYUVATextures_yuvaIndices'><code><strong>yuvaIndices</strong></code></a></td> 961 <td>array indicating which <a href='undocumented#Texture'>texture</a> in <a href='#SkImage_MakeFromYUVATextures_yuvaTextures'>yuvaTextures</a>, and channel</td> 962 </tr> 963</table> 964 965in that <a href='undocumented#Texture'>texture</a>, maps to each component of YUVA. 966 967### Parameters 968 969<table> <tr> <td><a name='SkImage_MakeFromYUVATextures_imageSize'><code><strong>imageSize</strong></code></a></td> 970 <td><a href='undocumented#Size'>size</a> of the resulting <a href='SkImage_Reference#Image'>image</a></td> 971 </tr> 972 <tr> <td><a name='SkImage_MakeFromYUVATextures_imageOrigin'><code><strong>imageOrigin</strong></code></a></td> 973 <td>origin of the resulting <a href='SkImage_Reference#Image'>image</a>. One of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>,</td> 974 </tr> 975</table> 976 977<a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a> 978 979### Parameters 980 981<table> <tr> <td><a name='SkImage_MakeFromYUVATextures_imageColorSpace'><code><strong>imageColorSpace</strong></code></a></td> 982 <td>range of colors of the resulting <a href='SkImage_Reference#Image'>image</a>; may be nullptr</td> 983 </tr> 984</table> 985 986### Return Value 987 988created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 989 990### See Also 991 992<a href='#SkImage_MakeFromYUVATexturesCopy'>MakeFromYUVATexturesCopy</a> <a href='#SkImage_MakeFromYUVATexturesCopyWithExternalBackend'>MakeFromYUVATexturesCopyWithExternalBackend</a> 993 994<a name='SkImage_MakeFromYUVAPixmaps'></a> 995 996--- 997 998<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 999static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> 1000 <a href='#SkImage_MakeFromYUVAPixmaps'>MakeFromYUVAPixmaps</a>( 1001 <a href='undocumented#GrContext'>GrContext</a>* context, 1002 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> yuvaPixmaps[], 1003 const <a href='undocumented#SkYUVAIndex'>SkYUVAIndex</a> yuvaIndices[4], <a href='undocumented#SkISize'>SkISize</a> imageSize, <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 1004 bool buildMips, bool limitToMaxTextureSize = false, 1005 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr) ; 1006</pre> 1007 1008Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='SkPixmap_Reference#Pixmap'>pixmap</a> array representing YUVA <a href='undocumented#Data'>data</a>. 1009<a href='SkImage_Reference#SkImage'>SkImage</a> is uploaded to GPU back-end using <a href='#SkImage_MakeFromYUVAPixmaps_context'>context</a>. 1010 1011Each <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> created from <a href='#SkImage_MakeFromYUVAPixmaps_yuvaPixmaps'>yuvaPixmaps</a> array is uploaded to match <a href='SkSurface_Reference#SkSurface'>SkSurface</a> 1012using <a href='undocumented#SkColorSpace'>SkColorSpace</a> of <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>. <a href='undocumented#SkColorSpace'>SkColorSpace</a> of <a href='SkImage_Reference#SkImage'>SkImage</a> is determined by <a href='#SkImage_MakeFromYUVAPixmaps_imageColorSpace'>imageColorSpace</a>. 1013 1014<a href='SkImage_Reference#SkImage'>SkImage</a> is returned referring to GPU back-end if <a href='#SkImage_MakeFromYUVAPixmaps_context'>context</a> is not nullptr and 1015format of <a href='undocumented#Data'>data</a> is recognized and supported. Otherwise, nullptr is returned. 1016Recognized GPU formats vary by platform and GPU back-end. 1017 1018### Parameters 1019 1020<table> <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_context'><code><strong>context</strong></code></a></td> 1021 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 1022 </tr> 1023 <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_yuvColorSpace'><code><strong>yuvColorSpace</strong></code></a></td> 1024 <td>How the YUV values are converted to RGB. One of:</td> 1025 </tr> 1026</table> 1027 1028<a href='SkImageInfo_Reference#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a>, <a href='SkImageInfo_Reference#kRec601_SkYUVColorSpace'>kRec601_SkYUVColorSpace</a>, 1029<a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a> 1030 1031### Parameters 1032 1033<table> <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_yuvaPixmaps'><code><strong>yuvaPixmaps</strong></code></a></td> 1034 <td>array of (up to four) <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a> which contain the,</td> 1035 </tr> 1036</table> 1037 1038possibly interleaved, YUVA planes 1039 1040### Parameters 1041 1042<table> <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_yuvaIndices'><code><strong>yuvaIndices</strong></code></a></td> 1043 <td>array indicating which <a href='SkPixmap_Reference#Pixmap'>pixmap</a> in <a href='#SkImage_MakeFromYUVAPixmaps_yuvaPixmaps'>yuvaPixmaps</a>, and channel</td> 1044 </tr> 1045</table> 1046 1047in that <a href='SkPixmap_Reference#Pixmap'>pixmap</a>, maps to each component of YUVA. 1048 1049### Parameters 1050 1051<table> <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_imageSize'><code><strong>imageSize</strong></code></a></td> 1052 <td><a href='undocumented#Size'>size</a> of the resulting <a href='SkImage_Reference#Image'>image</a></td> 1053 </tr> 1054 <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_imageOrigin'><code><strong>imageOrigin</strong></code></a></td> 1055 <td>origin of the resulting <a href='SkImage_Reference#Image'>image</a>. One of:</td> 1056 </tr> 1057</table> 1058 1059<a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>, <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a> 1060 1061### Parameters 1062 1063<table> <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_buildMips'><code><strong>buildMips</strong></code></a></td> 1064 <td>create internal YUVA textures as <a href='undocumented#Mip_Map'>mip map</a> if true</td> 1065 </tr> 1066 <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_limitToMaxTextureSize'><code><strong>limitToMaxTextureSize</strong></code></a></td> 1067 <td>downscale <a href='SkImage_Reference#Image'>image</a> to GPU maximum <a href='undocumented#Texture'>texture</a> <a href='undocumented#Size'>size</a>, if necessary</td> 1068 </tr> 1069 <tr> <td><a name='SkImage_MakeFromYUVAPixmaps_imageColorSpace'><code><strong>imageColorSpace</strong></code></a></td> 1070 <td>range of colors of the resulting <a href='SkImage_Reference#Image'>image</a>; may be nullptr</td> 1071 </tr> 1072</table> 1073 1074### Return Value 1075 1076created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 1077 1078### See Also 1079 1080<a href='#SkImage_MakeFromYUVATextures'>MakeFromYUVATextures</a> 1081 1082<a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend'></a> 1083 1084--- 1085 1086<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1087static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVATexturesCopyWithExternalBackend'>MakeFromYUVATexturesCopyWithExternalBackend</a>( 1088 <a href='undocumented#GrContext'>GrContext</a>* context, 1089 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvaTextures[], 1090 const <a href='undocumented#SkYUVAIndex'>SkYUVAIndex</a> yuvaIndices[4], <a href='undocumented#SkISize'>SkISize</a> imageSize, 1091 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 1092 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr) 1093</pre> 1094 1095Creates an <a href='SkImage_Reference#SkImage'>SkImage</a> by flattening the specified YUVA planes into a single, interleaved RGBA 1096<a href='SkImage_Reference#Image'>image</a>. '<a href='#SkImage_MakeFromYUVATexturesCopyWithExternalBackend_backendTexture'>backendTexture</a>' is used to store the result of the flattening. 1097 1098### Parameters 1099 1100<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend_context'><code><strong>context</strong></code></a></td> 1101 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 1102 </tr> 1103 <tr> <td><a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend_yuvColorSpace'><code><strong>yuvColorSpace</strong></code></a></td> 1104 <td>How the YUV values are converted to RGB. One of:</td> 1105 </tr> 1106</table> 1107 1108<a href='SkImageInfo_Reference#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a>, <a href='SkImageInfo_Reference#kRec601_SkYUVColorSpace'>kRec601_SkYUVColorSpace</a>, 1109<a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a> 1110 1111### Parameters 1112 1113<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend_yuvaTextures'><code><strong>yuvaTextures</strong></code></a></td> 1114 <td>array of (up to four) YUVA textures on GPU which contain the,</td> 1115 </tr> 1116</table> 1117 1118possibly interleaved, YUVA planes 1119 1120### Parameters 1121 1122<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend_yuvaIndices'><code><strong>yuvaIndices</strong></code></a></td> 1123 <td>array indicating which <a href='undocumented#Texture'>texture</a> in <a href='#SkImage_MakeFromYUVATexturesCopyWithExternalBackend_yuvaTextures'>yuvaTextures</a>, and channel</td> 1124 </tr> 1125</table> 1126 1127in that <a href='undocumented#Texture'>texture</a>, maps to each component of YUVA. 1128 1129### Parameters 1130 1131<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend_imageSize'><code><strong>imageSize</strong></code></a></td> 1132 <td><a href='undocumented#Size'>size</a> of the resulting <a href='SkImage_Reference#Image'>image</a></td> 1133 </tr> 1134 <tr> <td><a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend_imageOrigin'><code><strong>imageOrigin</strong></code></a></td> 1135 <td>origin of the resulting <a href='SkImage_Reference#Image'>image</a>. One of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>,</td> 1136 </tr> 1137</table> 1138 1139<a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a> 1140 1141### Parameters 1142 1143<table> <tr> <td><a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend_backendTexture'><code><strong>backendTexture</strong></code></a></td> 1144 <td>the resource that stores the final pixels</td> 1145 </tr> 1146 <tr> <td><a name='SkImage_MakeFromYUVATexturesCopyWithExternalBackend_imageColorSpace'><code><strong>imageColorSpace</strong></code></a></td> 1147 <td>range of colors of the resulting <a href='SkImage_Reference#Image'>image</a>; may be nullptr</td> 1148 </tr> 1149</table> 1150 1151### Return Value 1152 1153created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 1154 1155### See Also 1156 1157<a href='#SkImage_MakeFromYUVATexturesCopy'>MakeFromYUVATexturesCopy</a> <a href='#SkImage_MakeFromYUVATextures'>MakeFromYUVATextures</a> 1158 1159<a name='SkImage_MakeFromYUVTexturesCopy'></a> 1160 1161--- 1162 1163<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1164static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVTexturesCopy'>MakeFromYUVTexturesCopy</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 1165 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvTextures[3], 1166 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 1167 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr) 1168</pre> 1169 1170To be deprecated. 1171 1172### See Also 1173 1174<a href='#SkImage_MakeFromYUVTexturesCopyWithExternalBackend'>MakeFromYUVTexturesCopyWithExternalBackend</a> <a href='#SkImage_MakeFromNV12TexturesCopy'>MakeFromNV12TexturesCopy</a> <a href='#SkImage_MakeFromYUVATexturesCopy'>MakeFromYUVATexturesCopy</a> 1175 1176<a name='SkImage_MakeFromYUVTexturesCopyWithExternalBackend'></a> 1177 1178--- 1179 1180<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1181static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromYUVTexturesCopyWithExternalBackend'>MakeFromYUVTexturesCopyWithExternalBackend</a>( 1182 <a href='undocumented#GrContext'>GrContext</a>* context, 1183 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> yuvTextures[3], 1184 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 1185 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr) ; 1186</pre> 1187 1188To be deprecated. 1189 1190### See Also 1191 1192<a href='#SkImage_MakeFromYUVTexturesCopy'>MakeFromYUVTexturesCopy</a> <a href='#SkImage_MakeFromNV12TexturesCopy'>MakeFromNV12TexturesCopy</a> <a href='#SkImage_MakeFromYUVATexturesCopyWithExternalBackend'>MakeFromYUVATexturesCopyWithExternalBackend</a> 1193 1194<a name='SkImage_MakeFromNV12TexturesCopy'></a> 1195 1196--- 1197 1198<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1199static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromNV12TexturesCopy'>MakeFromNV12TexturesCopy</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, 1200 const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> nv12Textures[2], 1201 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, 1202 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr) 1203</pre> 1204 1205Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from copy of <a href='#SkImage_MakeFromNV12TexturesCopy_nv12Textures'>nv12Textures</a>, an array of textures on GPU. 1206<a href='#SkImage_MakeFromNV12TexturesCopy_nv12Textures'>nv12Textures</a>[0] contains pixels for <a href='undocumented#YUV_Component_Y'>YUV component y</a> plane. 1207<a href='#SkImage_MakeFromNV12TexturesCopy_nv12Textures'>nv12Textures</a>[1] contains pixels for <a href='undocumented#YUV_Component_U'>YUV component u</a> plane, 1208followed by pixels for <a href='undocumented#YUV_Component_V'>YUV component v</a> plane. 1209Returned <a href='SkImage_Reference#SkImage'>SkImage</a> has the dimensions <a href='#SkImage_MakeFromNV12TexturesCopy_nv12Textures'>nv12Textures</a>[2]. 1210<a href='#SkImage_MakeFromNV12TexturesCopy_yuvColorSpace'>yuvColorSpace</a> describes how YUV colors convert to RGB colors. 1211 1212### Parameters 1213 1214<table> <tr> <td><a name='SkImage_MakeFromNV12TexturesCopy_context'><code><strong>context</strong></code></a></td> 1215 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 1216 </tr> 1217 <tr> <td><a name='SkImage_MakeFromNV12TexturesCopy_yuvColorSpace'><code><strong>yuvColorSpace</strong></code></a></td> 1218 <td>one of: <a href='SkImageInfo_Reference#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a>, <a href='SkImageInfo_Reference#kRec601_SkYUVColorSpace'>kRec601_SkYUVColorSpace</a>,</td> 1219 </tr> 1220</table> 1221 1222<a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a> 1223 1224### Parameters 1225 1226<table> <tr> <td><a name='SkImage_MakeFromNV12TexturesCopy_nv12Textures'><code><strong>nv12Textures</strong></code></a></td> 1227 <td>array of YUV textures on GPU</td> 1228 </tr> 1229 <tr> <td><a name='SkImage_MakeFromNV12TexturesCopy_imageOrigin'><code><strong>imageOrigin</strong></code></a></td> 1230 <td>one of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>, <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a></td> 1231 </tr> 1232 <tr> <td><a name='SkImage_MakeFromNV12TexturesCopy_imageColorSpace'><code><strong>imageColorSpace</strong></code></a></td> 1233 <td>range of colors; may be nullptr</td> 1234 </tr> 1235</table> 1236 1237### Return Value 1238 1239created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 1240 1241### See Also 1242 1243<a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend'>MakeFromNV12TexturesCopyWithExternalBackend</a> <a href='#SkImage_MakeFromYUVTexturesCopy'>MakeFromYUVTexturesCopy</a> <a href='#SkImage_MakeFromYUVATexturesCopy'>MakeFromYUVATexturesCopy</a> 1244 1245<a name='SkImage_MakeFromNV12TexturesCopyWithExternalBackend'></a> 1246 1247--- 1248 1249<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1250static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend'>MakeFromNV12TexturesCopyWithExternalBackend</a>( 1251 <a href='undocumented#GrContext'>GrContext</a>* context, 1252 <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> yuvColorSpace, const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> nv12Textures[2], 1253 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> imageOrigin, const <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>& backendTexture, 1254 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> imageColorSpace = nullptr) ; 1255</pre> 1256 1257Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from copy of <a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend_nv12Textures'>nv12Textures</a>, an array of textures on GPU. 1258<a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend_nv12Textures'>nv12Textures</a>[0] contains pixels for <a href='undocumented#YUV_Component_Y'>YUV component y</a> plane. 1259<a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend_nv12Textures'>nv12Textures</a>[1] contains pixels for <a href='undocumented#YUV_Component_U'>YUV component u</a> plane, 1260followed by pixels for <a href='undocumented#YUV_Component_V'>YUV component v</a> plane. 1261Returned <a href='SkImage_Reference#SkImage'>SkImage</a> has the dimensions <a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend_nv12Textures'>nv12Textures</a>[2] and stores pixels in <a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend_backendTexture'>backendTexture</a>. 1262<a href='#SkImage_MakeFromNV12TexturesCopyWithExternalBackend_yuvColorSpace'>yuvColorSpace</a> describes how YUV colors convert to RGB colors. 1263 1264### Parameters 1265 1266<table> <tr> <td><a name='SkImage_MakeFromNV12TexturesCopyWithExternalBackend_context'><code><strong>context</strong></code></a></td> 1267 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 1268 </tr> 1269 <tr> <td><a name='SkImage_MakeFromNV12TexturesCopyWithExternalBackend_yuvColorSpace'><code><strong>yuvColorSpace</strong></code></a></td> 1270 <td>one of: <a href='SkImageInfo_Reference#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a>, <a href='SkImageInfo_Reference#kRec601_SkYUVColorSpace'>kRec601_SkYUVColorSpace</a>,</td> 1271 </tr> 1272</table> 1273 1274<a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a> 1275 1276### Parameters 1277 1278<table> <tr> <td><a name='SkImage_MakeFromNV12TexturesCopyWithExternalBackend_nv12Textures'><code><strong>nv12Textures</strong></code></a></td> 1279 <td>array of YUV textures on GPU</td> 1280 </tr> 1281 <tr> <td><a name='SkImage_MakeFromNV12TexturesCopyWithExternalBackend_imageOrigin'><code><strong>imageOrigin</strong></code></a></td> 1282 <td>one of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>, <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a></td> 1283 </tr> 1284 <tr> <td><a name='SkImage_MakeFromNV12TexturesCopyWithExternalBackend_backendTexture'><code><strong>backendTexture</strong></code></a></td> 1285 <td>the resource that stores the final pixels</td> 1286 </tr> 1287 <tr> <td><a name='SkImage_MakeFromNV12TexturesCopyWithExternalBackend_imageColorSpace'><code><strong>imageColorSpace</strong></code></a></td> 1288 <td>range of colors; may be nullptr</td> 1289 </tr> 1290</table> 1291 1292### Return Value 1293 1294created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 1295 1296### See Also 1297 1298<a href='#SkImage_MakeFromNV12TexturesCopy'>MakeFromNV12TexturesCopy</a> <a href='#SkImage_MakeFromYUVTexturesCopy'>MakeFromYUVTexturesCopy</a> <a href='#SkImage_MakeFromYUVATexturesCopyWithExternalBackend'>MakeFromYUVATexturesCopyWithExternalBackend</a> 1299 1300<a name='SkImage_BitDepth'></a> 1301 1302--- 1303 1304<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1305 enum class <a href='#SkImage_BitDepth'>BitDepth</a> { 1306 <a href='#SkImage_BitDepth_kU8'>kU8</a>, 1307 <a href='#SkImage_BitDepth_kF16'>kF16</a>, 1308 }; 1309 1310</pre> 1311 1312### Constants 1313 1314<table style='border-collapse: collapse; width: 62.5em'> 1315 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 1316<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 1317<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 1318 <tr style='background-color: #f0f0f0; '> 1319 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkImage_BitDepth_kU8'><code>SkImage::BitDepth::kU8</code></a></td> 1320 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 1321 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1322Use 8 bits per ARGB component using unsigned integer format. 1323</td> 1324 </tr> 1325 <tr> 1326 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkImage_BitDepth_kF16'><code>SkImage::BitDepth::kF16</code></a></td> 1327 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 1328 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1329Use 16 bits per ARGB component using half-precision floating <a href='SkPoint_Reference#Point'>point</a> format. 1330</td> 1331 </tr> 1332</table> 1333 1334### See Also 1335 1336<a href='#SkImage_MakeFromPicture'>MakeFromPicture</a> 1337 1338<a name='SkImage_MakeFromPicture'></a> 1339 1340--- 1341 1342<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1343static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromPicture'>MakeFromPicture</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='SkPicture_Reference#Picture'>picture</a>, const <a href='undocumented#SkISize'>SkISize</a>& dimensions, 1344 const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>* <a href='SkMatrix_Reference#Matrix'>matrix</a>, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>* <a href='SkPaint_Reference#Paint'>paint</a>, 1345 <a href='#SkImage_BitDepth'>BitDepth</a> bitDepth, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a>) 1346</pre> 1347 1348Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from <a href='#SkImage_MakeFromPicture_picture'>picture</a>. Returned <a href='SkImage_Reference#SkImage'>SkImage</a> width and height are set by <a href='#SkImage_MakeFromPicture_dimensions'>dimensions</a>. 1349<a href='SkImage_Reference#SkImage'>SkImage</a> draws <a href='#SkImage_MakeFromPicture_picture'>picture</a> with <a href='#SkImage_MakeFromPicture_matrix'>matrix</a> and <a href='#SkImage_MakeFromPicture_paint'>paint</a>, set to <a href='#SkImage_MakeFromPicture_bitDepth'>bitDepth</a> and <a href='#SkImage_MakeFromPicture_colorSpace'>colorSpace</a>. 1350 1351If <a href='#SkImage_MakeFromPicture_matrix'>matrix</a> is nullptr, draws with identity <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>. If <a href='#SkImage_MakeFromPicture_paint'>paint</a> is nullptr, draws 1352with default <a href='SkPaint_Reference#SkPaint'>SkPaint</a>. <a href='#SkImage_MakeFromPicture_colorSpace'>colorSpace</a> may be nullptr. 1353 1354### Parameters 1355 1356<table> <tr> <td><a name='SkImage_MakeFromPicture_picture'><code><strong>picture</strong></code></a></td> 1357 <td><a href='SkStream_Reference#Stream'>stream</a> of drawing commands</td> 1358 </tr> 1359 <tr> <td><a name='SkImage_MakeFromPicture_dimensions'><code><strong>dimensions</strong></code></a></td> 1360 <td>width and height</td> 1361 </tr> 1362 <tr> <td><a name='SkImage_MakeFromPicture_matrix'><code><strong>matrix</strong></code></a></td> 1363 <td><a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a> to rotate, scale, translate, and so on; may be nullptr</td> 1364 </tr> 1365 <tr> <td><a name='SkImage_MakeFromPicture_paint'><code><strong>paint</strong></code></a></td> 1366 <td><a href='SkPaint_Reference#SkPaint'>SkPaint</a> to apply transparency, filtering, and so on; may be nullptr</td> 1367 </tr> 1368 <tr> <td><a name='SkImage_MakeFromPicture_bitDepth'><code><strong>bitDepth</strong></code></a></td> 1369 <td>8-bit integer or 16-bit float: per component</td> 1370 </tr> 1371 <tr> <td><a name='SkImage_MakeFromPicture_colorSpace'><code><strong>colorSpace</strong></code></a></td> 1372 <td>range of colors; may be nullptr</td> 1373 </tr> 1374</table> 1375 1376### Return Value 1377 1378created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 1379 1380### Example 1381 1382<div><fiddle-embed name="4aa2879b9e44dfd6648995326d2c4dcf"></fiddle-embed></div> 1383 1384### See Also 1385 1386<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawPicture'>drawPicture</a> 1387 1388<a name='SkImage_MakeFromAHardwareBuffer'></a> 1389 1390--- 1391 1392<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1393static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_MakeFromAHardwareBuffer'>MakeFromAHardwareBuffer</a>( 1394 AHardwareBuffer* hardwareBuffer, 1395 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a> = <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, 1396 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_colorSpace'>colorSpace</a> = nullptr, 1397 <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a> surfaceOrigin = <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a>) 1398</pre> 1399 1400(See Skia bug 7447) 1401Creates <a href='SkImage_Reference#SkImage'>SkImage</a> from Android hardware buffer. 1402Returned <a href='SkImage_Reference#SkImage'>SkImage</a> takes a reference on the buffer. 1403 1404Only available on Android, when __ANDROID_API__ is defined to be 26 or greater. 1405 1406### Parameters 1407 1408<table> <tr> <td><a name='SkImage_MakeFromAHardwareBuffer_hardwareBuffer'><code><strong>hardwareBuffer</strong></code></a></td> 1409 <td>AHardwareBuffer Android hardware buffer</td> 1410 </tr> 1411 <tr> <td><a name='SkImage_MakeFromAHardwareBuffer_alphaType'><code><strong>alphaType</strong></code></a></td> 1412 <td>one of:</td> 1413 </tr> 1414</table> 1415 1416<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>, 1417<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 1418 1419### Parameters 1420 1421<table> <tr> <td><a name='SkImage_MakeFromAHardwareBuffer_colorSpace'><code><strong>colorSpace</strong></code></a></td> 1422 <td>range of colors; may be nullptr</td> 1423 </tr> 1424 <tr> <td><a name='SkImage_MakeFromAHardwareBuffer_surfaceOrigin'><code><strong>surfaceOrigin</strong></code></a></td> 1425 <td>one of: <a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>, <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a></td> 1426 </tr> 1427</table> 1428 1429### Return Value 1430 1431created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 1432 1433### See Also 1434 1435<a href='#SkImage_MakeFromRaster'>MakeFromRaster</a> 1436 1437<a name='Property'></a> 1438 1439<a name='SkImage_width'></a> 1440 1441--- 1442 1443<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1444int <a href='#SkImage_width'>width()</a>const 1445</pre> 1446 1447Returns <a href='undocumented#Pixel'>pixel</a> count in each row. 1448 1449### Return Value 1450 1451<a href='undocumented#Pixel'>pixel</a> width in <a href='SkImage_Reference#SkImage'>SkImage</a> 1452 1453### Example 1454 1455<div><fiddle-embed name="9aec65fc252ffc9982fa8867433eca18"></fiddle-embed></div> 1456 1457### See Also 1458 1459<a href='#SkImage_dimensions'>dimensions()</a> <a href='#SkImage_height'>height()</a> 1460 1461<a name='SkImage_height'></a> 1462 1463--- 1464 1465<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1466int <a href='#SkImage_height'>height()</a>const 1467</pre> 1468 1469Returns <a href='undocumented#Pixel'>pixel</a> row count. 1470 1471### Return Value 1472 1473<a href='undocumented#Pixel'>pixel</a> height in <a href='SkImage_Reference#SkImage'>SkImage</a> 1474 1475### Example 1476 1477<div><fiddle-embed name="a4f53a0b6ac85e7bc3887245b728530d"></fiddle-embed></div> 1478 1479### See Also 1480 1481<a href='#SkImage_dimensions'>dimensions()</a> <a href='#SkImage_width'>width()</a> 1482 1483<a name='SkImage_dimensions'></a> 1484 1485--- 1486 1487<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1488<a href='undocumented#SkISize'>SkISize</a> <a href='#SkImage_dimensions'>dimensions()</a>const 1489</pre> 1490 1491Returns <a href='undocumented#SkISize'>SkISize</a> { <a href='#SkImage_width'>width()</a>, <a href='#SkImage_height'>height()</a> }. 1492 1493### Return Value 1494 1495integral <a href='undocumented#Size'>size</a> of <a href='#SkImage_width'>width()</a> and <a href='#SkImage_height'>height()</a> 1496 1497### Example 1498 1499<div><fiddle-embed name="96b4bc43b3667df9ba9e2dafb770d33c"> 1500 1501#### Example Output 1502 1503~~~~ 1504dimensionsAsBounds == bounds 1505~~~~ 1506 1507</fiddle-embed></div> 1508 1509### See Also 1510 1511<a href='#SkImage_height'>height()</a> <a href='#SkImage_width'>width()</a> <a href='#SkImage_bounds'>bounds()</a> 1512 1513<a name='SkImage_bounds'></a> 1514 1515--- 1516 1517<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1518<a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkImage_bounds'>bounds()</a>const 1519</pre> 1520 1521Returns <a href='SkIRect_Reference#SkIRect'>SkIRect</a> { 0, 0, <a href='#SkImage_width'>width()</a>, <a href='#SkImage_height'>height()</a> }. 1522 1523### Return Value 1524 1525integral rectangle from origin to <a href='#SkImage_width'>width()</a> and <a href='#SkImage_height'>height()</a> 1526 1527### Example 1528 1529<div><fiddle-embed name="c204b38b3fc08914b0a634aa4eaec894"></fiddle-embed></div> 1530 1531### See Also 1532 1533<a href='#SkImage_dimensions'>dimensions()</a> 1534 1535<a name='SkImage_uniqueID'></a> 1536 1537--- 1538 1539<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1540uint32_t <a href='#SkImage_uniqueID'>uniqueID</a>()const 1541</pre> 1542 1543Returns value unique to <a href='SkImage_Reference#Image'>image</a>. <a href='SkImage_Reference#SkImage'>SkImage</a> contents cannot change after <a href='SkImage_Reference#SkImage'>SkImage</a> is 1544created. Any operation to create a new <a href='SkImage_Reference#SkImage'>SkImage</a> will receive generate a new 1545unique number. 1546 1547### Return Value 1548 1549unique identifier 1550 1551### Example 1552 1553<div><fiddle-embed name="d70194c9c51e700335f95de91846d023"></fiddle-embed></div> 1554 1555### See Also 1556 1557<a href='#SkImage_isLazyGenerated'>isLazyGenerated</a> 1558 1559<a name='SkImage_alphaType'></a> 1560 1561--- 1562 1563<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1564<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a>()const 1565</pre> 1566 1567Returns <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>, 1568<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 1569. 1570 1571<a href='#Image_Info_Alpha_Type'>Alpha_Type</a> returned was a parameter to an <a href='SkImage_Reference#Image'>Image</a> constructor, 1572or was parsed from encoded <a href='undocumented#Data'>data</a>. 1573 1574### Return Value 1575 1576<a href='#Image_Info_Alpha_Type'>Alpha_Type</a> in <a href='SkImage_Reference#Image'>Image</a> 1577 1578### Example 1579 1580<div><fiddle-embed name="1b9f1f05026ceb14ccb6926a13cdaa83"></fiddle-embed></div> 1581 1582### See Also 1583 1584<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_alphaType'>alphaType</a> 1585 1586<a name='SkImage_colorType'></a> 1587 1588--- 1589 1590<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1591<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>()const 1592</pre> 1593 1594Returns <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> if known; otherwise, returns <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>. 1595 1596### Return Value 1597 1598<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> of <a href='SkImage_Reference#SkImage'>SkImage</a> 1599 1600### Example 1601 1602<div><fiddle-embed name="50396fad4a128f58e400ca00fe09711f"></fiddle-embed></div> 1603 1604### See Also 1605 1606<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_colorType'>colorType</a> 1607 1608<a name='SkImage_colorSpace'></a> 1609 1610--- 1611 1612<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1613<a href='undocumented#SkColorSpace'>SkColorSpace</a>* <a href='#SkImage_colorSpace'>colorSpace</a>()const 1614</pre> 1615 1616Returns <a href='undocumented#SkColorSpace'>SkColorSpace</a>, the range of colors, associated with <a href='SkImage_Reference#SkImage'>SkImage</a>. The 1617reference count of <a href='undocumented#SkColorSpace'>SkColorSpace</a> is unchanged. The returned <a href='undocumented#SkColorSpace'>SkColorSpace</a> is 1618immutable. 1619 1620<a href='undocumented#SkColorSpace'>SkColorSpace</a> returned was passed to an <a href='SkImage_Reference#SkImage'>SkImage</a> constructor, 1621or was parsed from encoded <a href='undocumented#Data'>data</a>. <a href='undocumented#SkColorSpace'>SkColorSpace</a> returned may be ignored when <a href='SkImage_Reference#SkImage'>SkImage</a> 1622is drawn, depending on the capabilities of the <a href='SkSurface_Reference#SkSurface'>SkSurface</a> receiving the drawing. 1623 1624### Return Value 1625 1626<a href='undocumented#SkColorSpace'>SkColorSpace</a> in <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 1627 1628### Example 1629 1630<div><fiddle-embed name="4468d573f42af6f5e234be10a5453bb2"></fiddle-embed></div> 1631 1632### See Also 1633 1634<a href='#SkImage_refColorSpace'>refColorSpace</a> <a href='#SkImage_makeColorSpace'>makeColorSpace</a> 1635 1636<a name='SkImage_refColorSpace'></a> 1637 1638--- 1639 1640<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1641<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImage_refColorSpace'>refColorSpace</a>()const 1642</pre> 1643 1644Returns a smart pointer to <a href='undocumented#SkColorSpace'>SkColorSpace</a>, the range of colors, associated with 1645<a href='SkImage_Reference#SkImage'>SkImage</a>. The smart pointer tracks the number of objects sharing this 1646<a href='undocumented#SkColorSpace'>SkColorSpace</a> reference so the memory is released when the owners destruct. 1647 1648The returned <a href='undocumented#SkColorSpace'>SkColorSpace</a> is immutable. 1649 1650<a href='undocumented#SkColorSpace'>SkColorSpace</a> returned was passed to an <a href='SkImage_Reference#SkImage'>SkImage</a> constructor, 1651or was parsed from encoded <a href='undocumented#Data'>data</a>. <a href='undocumented#SkColorSpace'>SkColorSpace</a> returned may be ignored when <a href='SkImage_Reference#SkImage'>SkImage</a> 1652is drawn, depending on the capabilities of the <a href='SkSurface_Reference#SkSurface'>SkSurface</a> receiving the drawing. 1653 1654### Return Value 1655 1656<a href='undocumented#SkColorSpace'>SkColorSpace</a> in <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr, wrapped in a smart pointer 1657 1658### Example 1659 1660<div><fiddle-embed name="59b2078ebfbda8736a57c0486ae33332"></fiddle-embed></div> 1661 1662### See Also 1663 1664<a href='#SkImage_colorSpace'>colorSpace</a> <a href='#SkImage_makeColorSpace'>makeColorSpace</a> 1665 1666<a name='SkImage_isAlphaOnly'></a> 1667 1668--- 1669 1670<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1671bool <a href='#SkImage_isAlphaOnly'>isAlphaOnly</a>()const 1672</pre> 1673 1674Returns true if <a href='SkImage_Reference#SkImage'>SkImage</a> pixels represent transparency only. If true, each <a href='undocumented#Pixel'>pixel</a> 1675is packed in 8 bits as defined by <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>. 1676 1677### Return Value 1678 1679true if pixels represent a transparency mask 1680 1681### Example 1682 1683<div><fiddle-embed name="50762c73b8ea91959c5a7b68fbf1062d"> 1684 1685#### Example Output 1686 1687~~~~ 1688alphaOnly = true 1689~~~~ 1690 1691</fiddle-embed></div> 1692 1693### See Also 1694 1695<a href='#SkImage_alphaType'>alphaType</a> <a href='#SkImage_isOpaque'>isOpaque</a> 1696 1697<a name='SkImage_isOpaque'></a> 1698 1699--- 1700 1701<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1702bool <a href='#SkImage_isOpaque'>isOpaque</a>()const 1703</pre> 1704 1705Returns true if pixels ignore their <a href='SkColor_Reference#Alpha'>alpha</a> value and are treated as fully opaque. 1706 1707### Return Value 1708 1709true if <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> 1710 1711### Example 1712 1713<div><fiddle-embed name="e3340460003b74ee286d625e68589d65"> 1714 1715#### Example Output 1716 1717~~~~ 1718isOpaque = false 1719isOpaque = true 1720~~~~ 1721 1722</fiddle-embed></div> 1723 1724### See Also 1725 1726<a href='#SkImage_alphaType'>alphaType</a> <a href='#SkImage_isAlphaOnly'>isAlphaOnly</a> 1727 1728<a name='SkImage_makeShader'></a> 1729 1730--- 1731 1732<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1733<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkShader'>SkShader</a>> <a href='#SkImage_makeShader'>makeShader</a>(<a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_TileMode'>TileMode</a> tileMode1, <a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_TileMode'>TileMode</a> tileMode2, 1734 const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>* localMatrix = nullptr)const 1735</pre> 1736 1737Creates <a href='undocumented#SkShader'>SkShader</a> from <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='undocumented#SkShader'>SkShader</a> dimensions are taken from <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='undocumented#SkShader'>SkShader</a> uses 1738<a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_TileMode'>TileMode</a> rules to fill drawn area outside <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='#SkImage_makeShader_localMatrix'>localMatrix</a> permits 1739transforming <a href='SkImage_Reference#SkImage'>SkImage</a> before <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> <a href='SkMatrix_Reference#Matrix'>matrix</a> is applied. 1740 1741### Parameters 1742 1743<table> <tr> <td><a name='SkImage_makeShader_tileMode1'><code><strong>tileMode1</strong></code></a></td> 1744 <td>tiling on x-axis, one of: <a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_kClamp_TileMode'>kClamp_TileMode</a>,</td> 1745 </tr> 1746</table> 1747 1748<a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_kRepeat_TileMode'>kRepeat_TileMode</a>, <a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_kMirror_TileMode'>kMirror_TileMode</a> 1749 1750### Parameters 1751 1752<table> <tr> <td><a name='SkImage_makeShader_tileMode2'><code><strong>tileMode2</strong></code></a></td> 1753 <td>tiling on y-axis, one of: <a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_kClamp_TileMode'>kClamp_TileMode</a>,</td> 1754 </tr> 1755</table> 1756 1757<a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_kRepeat_TileMode'>kRepeat_TileMode</a>, <a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_kMirror_TileMode'>kMirror_TileMode</a> 1758 1759### Parameters 1760 1761<table> <tr> <td><a name='SkImage_makeShader_localMatrix'><code><strong>localMatrix</strong></code></a></td> 1762 <td><a href='SkImage_Reference#SkImage'>SkImage</a> transformation, or nullptr</td> 1763 </tr> 1764</table> 1765 1766### Return Value 1767 1768<a href='undocumented#SkShader'>SkShader</a> containing <a href='SkImage_Reference#SkImage'>SkImage</a> 1769 1770### Example 1771 1772<div><fiddle-embed name="1c6de6fe72b00b5be970f5f718363449"></fiddle-embed></div> 1773 1774### See Also 1775 1776<a href='#SkImage_scalePixels'>scalePixels</a> 1777 1778<a name='SkImage_makeShader_2'></a> 1779 1780--- 1781 1782<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1783<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkShader'>SkShader</a>> <a href='#SkImage_makeShader'>makeShader</a>(const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>* localMatrix = nullptr)const 1784</pre> 1785 1786Creates <a href='undocumented#SkShader'>SkShader</a> from <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='undocumented#SkShader'>SkShader</a> dimensions are taken from <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='undocumented#SkShader'>SkShader</a> uses 1787<a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_kClamp_TileMode'>kClamp_TileMode</a> to fill drawn area outside <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='#SkImage_makeShader_2_localMatrix'>localMatrix</a> permits 1788transforming <a href='SkImage_Reference#SkImage'>SkImage</a> before <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> <a href='SkMatrix_Reference#Matrix'>matrix</a> is applied. 1789 1790### Parameters 1791 1792<table> <tr> <td><a name='SkImage_makeShader_2_localMatrix'><code><strong>localMatrix</strong></code></a></td> 1793 <td><a href='SkImage_Reference#SkImage'>SkImage</a> transformation, or nullptr</td> 1794 </tr> 1795</table> 1796 1797### Return Value 1798 1799<a href='undocumented#SkShader'>SkShader</a> containing <a href='SkImage_Reference#SkImage'>SkImage</a> 1800 1801### Example 1802 1803<div><fiddle-embed name="10172fca71b9dbdcade772513ffeb27e"></fiddle-embed></div> 1804 1805### See Also 1806 1807<a href='#SkImage_scalePixels'>scalePixels</a> 1808 1809<a name='Pixels'></a> 1810 1811<a name='SkImage_peekPixels'></a> 1812 1813--- 1814 1815<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1816bool <a href='#SkImage_peekPixels'>peekPixels</a>(<a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>* <a href='SkPixmap_Reference#Pixmap'>pixmap</a>)const 1817</pre> 1818 1819Copies <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='undocumented#Pixel'>pixel</a> address, row bytes, and <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to <a href='#SkImage_peekPixels_pixmap'>pixmap</a>, if address 1820is available, and returns true. If <a href='undocumented#Pixel'>pixel</a> address is not available, return 1821false and leave <a href='#SkImage_peekPixels_pixmap'>pixmap</a> unchanged. 1822 1823### Parameters 1824 1825<table> <tr> <td><a name='SkImage_peekPixels_pixmap'><code><strong>pixmap</strong></code></a></td> 1826 <td>storage for <a href='undocumented#Pixel'>pixel</a> state if pixels are readable; otherwise, ignored</td> 1827 </tr> 1828</table> 1829 1830### Return Value 1831 1832true if <a href='SkImage_Reference#SkImage'>SkImage</a> has direct access to pixels 1833 1834### Example 1835 1836<div><fiddle-embed name="900c0eab8dfdecd8301ed5be95887f8e"> 1837 1838#### Example Output 1839 1840~~~~ 1841------------ 1842--xx----x--- 1843-x--x--x---- 1844-x--x--x---- 1845-x--x-x----- 1846--xx-xx-xx-- 1847-----x-x--x- 1848----x--x--x- 1849----x--x--x- 1850---x----xx-- 1851------------ 1852~~~~ 1853 1854</fiddle-embed></div> 1855 1856### See Also 1857 1858<a href='#SkImage_readPixels'>readPixels</a> 1859 1860<a name='SkImage_isTextureBacked'></a> 1861 1862--- 1863 1864<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1865bool <a href='#SkImage_isTextureBacked'>isTextureBacked</a>()const 1866</pre> 1867 1868Returns true the contents of <a href='SkImage_Reference#SkImage'>SkImage</a> was created on or uploaded to GPU memory, 1869and is available as a GPU <a href='undocumented#Texture'>texture</a>. 1870 1871### Return Value 1872 1873true if <a href='SkImage_Reference#SkImage'>SkImage</a> is a GPU <a href='undocumented#Texture'>texture</a> 1874 1875### Example 1876 1877<div><fiddle-embed name="9cf5c62a3d2243e6577ae563f360ea9d" gpu="true"></fiddle-embed></div> 1878 1879### See Also 1880 1881<a href='#SkImage_MakeFromTexture'>MakeFromTexture</a> <a href='#SkImage_isValid'>isValid</a> 1882 1883<a name='SkImage_isValid'></a> 1884 1885--- 1886 1887<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1888bool <a href='#SkImage_isValid'>isValid</a>(<a href='undocumented#GrContext'>GrContext</a>* context)const 1889</pre> 1890 1891Returns true if <a href='SkImage_Reference#SkImage'>SkImage</a> can be drawn on either <a href='undocumented#Raster_Surface'>raster surface</a> or <a href='undocumented#GPU_Surface'>GPU surface</a>. 1892If <a href='#SkImage_isValid_context'>context</a> is nullptr, tests if <a href='SkImage_Reference#SkImage'>SkImage</a> draws on <a href='undocumented#Raster_Surface'>raster surface</a>; 1893otherwise, tests if <a href='SkImage_Reference#SkImage'>SkImage</a> draws on <a href='undocumented#GPU_Surface'>GPU surface</a> associated with <a href='#SkImage_isValid_context'>context</a>. 1894 1895<a href='SkImage_Reference#SkImage'>SkImage</a> backed by <a href='undocumented#GPU_Texture'>GPU texture</a> may become invalid if associated <a href='undocumented#GrContext'>GrContext</a> is 1896invalid. <a href='#Lazy_Image'>lazy image</a> may be invalid and may not draw to <a href='undocumented#Raster_Surface'>raster surface</a> or 1897<a href='undocumented#GPU_Surface'>GPU surface</a> or both. 1898 1899### Parameters 1900 1901<table> <tr> <td><a name='SkImage_isValid_context'><code><strong>context</strong></code></a></td> 1902 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 1903 </tr> 1904</table> 1905 1906### Return Value 1907 1908true if <a href='SkImage_Reference#SkImage'>SkImage</a> can be drawn 1909 1910### Example 1911 1912<div><fiddle-embed name="afc62f38aebc56af8e425297ec67dd37" gpu="true"></fiddle-embed></div> 1913 1914### See Also 1915 1916<a href='#SkImage_isTextureBacked'>isTextureBacked</a> <a href='#SkImage_isLazyGenerated'>isLazyGenerated</a> 1917 1918<a name='SkImage_getBackendTexture'></a> 1919 1920--- 1921 1922<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1923<a href='undocumented#GrBackendTexture'>GrBackendTexture</a> <a href='#SkImage_getBackendTexture'>getBackendTexture</a>(bool flushPendingGrContextIO, <a href='undocumented#GrSurfaceOrigin'>GrSurfaceOrigin</a>* origin = nullptr)const 1924</pre> 1925 1926Retrieves the back-end <a href='undocumented#Texture'>texture</a>. If <a href='SkImage_Reference#SkImage'>SkImage</a> has no back-end <a href='undocumented#Texture'>texture</a>, an invalid 1927object is returned. Call <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>::<a href='#GrBackendTexture_isValid'>isValid</a> to determine if the result 1928is valid. 1929 1930If <a href='#SkImage_getBackendTexture_flushPendingGrContextIO'>flushPendingGrContextIO</a> is true, completes deferred I/O operations. 1931 1932If <a href='#SkImage_getBackendTexture_origin'>origin</a> in not nullptr, copies location of content drawn into <a href='SkImage_Reference#SkImage'>SkImage</a>. 1933 1934### Parameters 1935 1936<table> <tr> <td><a name='SkImage_getBackendTexture_flushPendingGrContextIO'><code><strong>flushPendingGrContextIO</strong></code></a></td> 1937 <td>flag to flush outstanding requests</td> 1938 </tr> 1939 <tr> <td><a name='SkImage_getBackendTexture_origin'><code><strong>origin</strong></code></a></td> 1940 <td>storage for one of: <a href='undocumented#kTopLeft_GrSurfaceOrigin'>kTopLeft_GrSurfaceOrigin</a>,</td> 1941 </tr> 1942</table> 1943 1944<a href='undocumented#kBottomLeft_GrSurfaceOrigin'>kBottomLeft_GrSurfaceOrigin</a>; or nullptr 1945 1946### Return Value 1947 1948back-end API <a href='undocumented#Texture'>texture</a> handle; invalid on failure 1949 1950### Example 1951 1952<div><fiddle-embed name="d093aad721261f421c4bef4a296aab48" gpu="true"></fiddle-embed></div> 1953 1954### See Also 1955 1956<a href='#SkImage_MakeFromTexture'>MakeFromTexture</a> <a href='#SkImage_isTextureBacked'>isTextureBacked</a> 1957 1958<a name='SkImage_CachingHint'></a> 1959 1960--- 1961 1962<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1963 enum <a href='#SkImage_CachingHint'>CachingHint</a> { 1964 <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>, 1965 <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a>, 1966 }; 1967 1968</pre> 1969 1970<a href='#SkImage_CachingHint'>CachingHint</a> selects whether Skia may internally cache <a href='SkBitmap_Reference#Bitmap'>Bitmaps</a> generated by 1971decoding <a href='SkImage_Reference#Image'>Image</a>, or by copying <a href='SkImage_Reference#Image'>Image</a> from GPU to CPU. The default behavior 1972allows caching <a href='SkBitmap_Reference#Bitmap'>Bitmaps</a>. 1973 1974Choose <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a> if <a href='SkImage_Reference#Image'>Image</a> pixels are to be used only once, or 1975if <a href='SkImage_Reference#Image'>Image</a> pixels reside in a cache outside of Skia, or to reduce memory pressure. 1976 1977Choosing <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a> does not ensure that pixels will be cached. 1978<a href='SkImage_Reference#Image'>Image</a> pixels may not be cached if memory requirements are too large or 1979pixels are not accessible. 1980 1981### Constants 1982 1983<table style='border-collapse: collapse; width: 62.5em'> 1984 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 1985<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 1986<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 1987 <tr style='background-color: #f0f0f0; '> 1988 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkImage_kAllow_CachingHint'><code>SkImage::kAllow_CachingHint</code></a></td> 1989 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 1990 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1991allows internally caching decoded and copied pixels</td> 1992 </tr> 1993 <tr> 1994 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkImage_kDisallow_CachingHint'><code>SkImage::kDisallow_CachingHint</code></a></td> 1995 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 1996 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1997disallows internally caching decoded and copied pixels</td> 1998 </tr> 1999</table> 2000 2001### See Also 2002 2003<a href='#SkImage_readPixels'>readPixels</a> <a href='#SkImage_scalePixels'>scalePixels</a> 2004 2005<a name='SkImage_readPixels'></a> 2006 2007--- 2008 2009<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2010bool <a href='#SkImage_readPixels'>readPixels</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY, 2011 <a href='#SkImage_CachingHint'>CachingHint</a> cachingHint = <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>)const 2012</pre> 2013 2014Copies <a href='SkRect_Reference#Rect'>Rect</a> of pixels from <a href='SkImage_Reference#Image'>Image</a> to <a href='#SkImage_readPixels_dstPixels'>dstPixels</a>. Copy starts at offset (<a href='#SkImage_readPixels_srcX'>srcX</a>, <a href='#SkImage_readPixels_srcY'>srcY</a>), 2015and does not exceed <a href='SkImage_Reference#Image'>Image</a> (<a href='#SkImage_width'>width()</a>, <a href='#SkImage_height'>height()</a>). 2016 2017<a href='#SkImage_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 2018destination. <a href='#SkImage_readPixels_dstRowBytes'>dstRowBytes</a> specifics the gap from one destination row to the next. 2019Returns true if pixels are copied. Returns false if: 2020 2021<table> <tr> 2022 <td><a href='#SkImage_readPixels_dstInfo'>dstInfo</a> has no address</td> 2023 </tr> <tr> 2024 <td><a href='#SkImage_readPixels_dstRowBytes'>dstRowBytes</a> is less than <a href='#SkImage_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>()</td> 2025 </tr> <tr> 2026 <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td> 2027 </tr> 2028</table> 2029 2030Pixels are copied only if <a href='undocumented#Pixel'>pixel</a> conversion is possible. If <a href='SkImage_Reference#Image'>Image</a> <a href='#Image_Info_Color_Type'>Color_Type</a> is 2031<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='#SkImage_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_colorType'>colorType</a>() must match. 2032If <a href='SkImage_Reference#Image'>Image</a> <a href='#Image_Info_Color_Type'>Color_Type</a> is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='#SkImage_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_colorSpace'>colorSpace</a>() must match. 2033If <a href='SkImage_Reference#Image'>Image</a> <a href='#Image_Info_Alpha_Type'>Alpha_Type</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, <a href='#SkImage_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_alphaType'>alphaType</a>() must 2034match. If <a href='SkImage_Reference#Image'>Image</a> <a href='#Color_Space'>Color_Space</a> is nullptr, <a href='#SkImage_readPixels_dstInfo'>dstInfo</a>.<a href='#SkImageInfo_colorSpace'>colorSpace</a>() must match. Returns 2035false if <a href='undocumented#Pixel'>pixel</a> conversion is not possible. 2036 2037<a href='#SkImage_readPixels_srcX'>srcX</a> and <a href='#SkImage_readPixels_srcY'>srcY</a> may be negative to copy only top or left of source. Returns 2038false if <a href='#SkImage_width'>width()</a> or <a href='#SkImage_height'>height()</a> is zero or negative. 2039Returns false if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkImage_readPixels_srcX'>srcX</a>) >= <a href='SkImage_Reference#Image'>Image</a> <a href='#SkImage_width'>width()</a></code>, or if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkImage_readPixels_srcY'>srcY</a>) >= <a href='SkImage_Reference#Image'>Image</a> <a href='#SkImage_height'>height()</a></code>. 2040 2041If <a href='#SkImage_readPixels_cachingHint'>cachingHint</a> is <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>, pixels may be retained locally. 2042If <a href='#SkImage_readPixels_cachingHint'>cachingHint</a> is <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a>, pixels are not added to the local cache. 2043 2044### Parameters 2045 2046<table> <tr> <td><a name='SkImage_readPixels_dstInfo'><code><strong>dstInfo</strong></code></a></td> 2047 <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> 2048 </tr> 2049 <tr> <td><a name='SkImage_readPixels_dstPixels'><code><strong>dstPixels</strong></code></a></td> 2050 <td>destination <a href='undocumented#Pixel_Storage'>pixel storage</a></td> 2051 </tr> 2052 <tr> <td><a name='SkImage_readPixels_dstRowBytes'><code><strong>dstRowBytes</strong></code></a></td> 2053 <td>destination row length</td> 2054 </tr> 2055 <tr> <td><a name='SkImage_readPixels_srcX'><code><strong>srcX</strong></code></a></td> 2056 <td>column index whose absolute value is less than <a href='#SkImage_width'>width()</a></td> 2057 </tr> 2058 <tr> <td><a name='SkImage_readPixels_srcY'><code><strong>srcY</strong></code></a></td> 2059 <td>row index whose absolute value is less than <a href='#SkImage_height'>height()</a></td> 2060 </tr> 2061 <tr> <td><a name='SkImage_readPixels_cachingHint'><code><strong>cachingHint</strong></code></a></td> 2062 <td>one of: <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>, <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a></td> 2063 </tr> 2064</table> 2065 2066### Return Value 2067 2068true if pixels are copied to <a href='#SkImage_readPixels_dstPixels'>dstPixels</a> 2069 2070### Example 2071 2072<div><fiddle-embed name="8aa8ca63dff4641dfc6ea8a3c555d59c"></fiddle-embed></div> 2073 2074### See Also 2075 2076<a href='#SkImage_scalePixels'>scalePixels</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_readPixels'>readPixels</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='SkSurface_Reference#SkSurface'>SkSurface</a>::<a href='#SkSurface_readPixels'>readPixels</a> 2077 2078<a name='SkImage_readPixels_2'></a> 2079 2080--- 2081 2082<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2083bool <a href='#SkImage_readPixels'>readPixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& dst, int srcX, int srcY, <a href='#SkImage_CachingHint'>CachingHint</a> cachingHint = <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>)const 2084</pre> 2085 2086Copies a <a href='SkRect_Reference#Rect'>Rect</a> of pixels from <a href='SkImage_Reference#Image'>Image</a> to <a href='#SkImage_readPixels_2_dst'>dst</a>. Copy starts at (<a href='#SkImage_readPixels_2_srcX'>srcX</a>, <a href='#SkImage_readPixels_2_srcY'>srcY</a>), and 2087does not exceed <a href='SkImage_Reference#Image'>Image</a> (<a href='#SkImage_width'>width()</a>, <a href='#SkImage_height'>height()</a>). 2088 2089<a href='#SkImage_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>, 2090and row bytes of destination. <a href='#SkImage_readPixels_2_dst'>dst</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() specifics the gap from one destination 2091row to the next. Returns true if pixels are copied. Returns false if: 2092 2093<table> <tr> 2094 <td><a href='#SkImage_readPixels_2_dst'>dst</a> <a href='undocumented#Pixel_Storage'>pixel storage</a> equals nullptr</td> 2095 </tr> <tr> 2096 <td><a href='#SkImage_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> 2097 </tr> <tr> 2098 <td><a href='#Pixel_Ref'>Pixel_Ref</a> is nullptr</td> 2099 </tr> 2100</table> 2101 2102Pixels are copied only if <a href='undocumented#Pixel'>pixel</a> conversion is possible. If <a href='SkImage_Reference#Image'>Image</a> <a href='#Image_Info_Color_Type'>Color_Type</a> is 2103<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='#SkImage_readPixels_2_dst'>dst</a>.<a href='#SkPixmap_colorType'>colorType</a>() must match. 2104If <a href='SkImage_Reference#Image'>Image</a> <a href='#Image_Info_Color_Type'>Color_Type</a> is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='#SkImage_readPixels_2_dst'>dst</a>.<a href='#SkPixmap_colorSpace'>colorSpace</a>() must match. 2105If <a href='SkImage_Reference#Image'>Image</a> <a href='#Image_Info_Alpha_Type'>Alpha_Type</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, <a href='#SkImage_readPixels_2_dst'>dst</a>.<a href='#SkPixmap_alphaType'>alphaType</a>() must 2106match. If <a href='SkImage_Reference#Image'>Image</a> <a href='#Color_Space'>Color_Space</a> is nullptr, <a href='#SkImage_readPixels_2_dst'>dst</a>.<a href='#SkPixmap_colorSpace'>colorSpace</a>() must match. Returns 2107false if <a href='undocumented#Pixel'>pixel</a> conversion is not possible. 2108 2109<a href='#SkImage_readPixels_2_srcX'>srcX</a> and <a href='#SkImage_readPixels_2_srcY'>srcY</a> may be negative to copy only top or left of source. Returns 2110false if <a href='#SkImage_width'>width()</a> or <a href='#SkImage_height'>height()</a> is zero or negative. 2111Returns false if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkImage_readPixels_2_srcX'>srcX</a>) >= <a href='SkImage_Reference#Image'>Image</a> <a href='#SkImage_width'>width()</a></code>, or if <code><a href='undocumented#abs()'>abs</a>(<a href='#SkImage_readPixels_2_srcY'>srcY</a>) >= <a href='SkImage_Reference#Image'>Image</a> <a href='#SkImage_height'>height()</a></code>. 2112 2113If <a href='#SkImage_readPixels_2_cachingHint'>cachingHint</a> is <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>, pixels may be retained locally. 2114If <a href='#SkImage_readPixels_2_cachingHint'>cachingHint</a> is <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a>, pixels are not added to the local cache. 2115 2116### Parameters 2117 2118<table> <tr> <td><a name='SkImage_readPixels_2_dst'><code><strong>dst</strong></code></a></td> 2119 <td>destination <a href='SkPixmap_Reference#Pixmap'>Pixmap</a>: <a href='#Image_Info'>Image_Info</a>, pixels, row bytes</td> 2120 </tr> 2121 <tr> <td><a name='SkImage_readPixels_2_srcX'><code><strong>srcX</strong></code></a></td> 2122 <td>column index whose absolute value is less than <a href='#SkImage_width'>width()</a></td> 2123 </tr> 2124 <tr> <td><a name='SkImage_readPixels_2_srcY'><code><strong>srcY</strong></code></a></td> 2125 <td>row index whose absolute value is less than <a href='#SkImage_height'>height()</a></td> 2126 </tr> 2127 <tr> <td><a name='SkImage_readPixels_2_cachingHint'><code><strong>cachingHint</strong></code></a></td> 2128 <td>one of: <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>, <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a></td> 2129 </tr> 2130</table> 2131 2132### Return Value 2133 2134true if pixels are copied to <a href='#SkImage_readPixels_2_dst'>dst</a> 2135 2136### Example 2137 2138<div><fiddle-embed name="b77a73c4baa63a4a8e2a4fdd96144d0b"></fiddle-embed></div> 2139 2140### See Also 2141 2142<a href='#SkImage_scalePixels'>scalePixels</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_readPixels'>readPixels</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='SkSurface_Reference#SkSurface'>SkSurface</a>::<a href='#SkSurface_readPixels'>readPixels</a> 2143 2144<a name='SkImage_scalePixels'></a> 2145 2146--- 2147 2148<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2149bool <a href='#SkImage_scalePixels'>scalePixels</a>(const <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>& dst, <a href='undocumented#SkFilterQuality'>SkFilterQuality</a> filterQuality, 2150 <a href='#SkImage_CachingHint'>CachingHint</a> cachingHint = <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>)const 2151</pre> 2152 2153Copies <a href='SkImage_Reference#SkImage'>SkImage</a> to <a href='#SkImage_scalePixels_dst'>dst</a>, scaling pixels to fit <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_width'>width()</a> and <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_height'>height()</a>, and 2154converting pixels to match <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_colorType'>colorType</a>() and <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_alphaType'>alphaType</a>(). Returns true if 2155pixels are copied. Returns false if <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_addr'>addr()</a> is nullptr, or <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_rowBytes'>rowBytes</a>() is 2156less than <a href='#SkImage_scalePixels_dst'>dst</a> <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_minRowBytes'>minRowBytes</a>. 2157 2158Pixels are copied only if <a href='undocumented#Pixel'>pixel</a> conversion is possible. If <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is 2159<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='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_colorType'>colorType</a>() must match. 2160If <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_colorSpace'>colorSpace</a>() must match. 2161If <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_alphaType'>alphaType</a>() must 2162match. If <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a> is nullptr, <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_colorSpace'>colorSpace</a>() must match. Returns 2163false if <a href='undocumented#Pixel'>pixel</a> conversion is not possible. 2164 2165Scales the <a href='SkImage_Reference#Image'>image</a>, with <a href='#SkImage_scalePixels_filterQuality'>filterQuality</a>, to match <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_width'>width()</a> and <a href='#SkImage_scalePixels_dst'>dst</a>.<a href='#SkPixmap_height'>height()</a>. 2166<a href='#SkImage_scalePixels_filterQuality'>filterQuality</a> <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a> is fastest, typically implemented with 2167<a href='undocumented#Nearest_Neighbor'>nearest neighbor filter</a>. <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a> is typically implemented with 2168<a href='undocumented#Bilerp'>bilerp filter</a>. <a href='undocumented#kMedium_SkFilterQuality'>kMedium_SkFilterQuality</a> is typically implemented with 2169<a href='undocumented#Bilerp'>bilerp filter</a>, and <a href='undocumented#MipMap'>mip-map filter</a> when <a href='undocumented#Size'>size</a> is reduced. 2170<a href='undocumented#kHigh_SkFilterQuality'>kHigh_SkFilterQuality</a> is slowest, typically implemented with <a href='undocumented#BiCubic'>bicubic filter</a>. 2171 2172If <a href='#SkImage_scalePixels_cachingHint'>cachingHint</a> is <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>, pixels may be retained locally. 2173If <a href='#SkImage_scalePixels_cachingHint'>cachingHint</a> is <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a>, pixels are not added to the local cache. 2174 2175### Parameters 2176 2177<table> <tr> <td><a name='SkImage_scalePixels_dst'><code><strong>dst</strong></code></a></td> 2178 <td>destination <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>: <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>, pixels, row bytes</td> 2179 </tr> 2180 <tr> <td><a name='SkImage_scalePixels_filterQuality'><code><strong>filterQuality</strong></code></a></td> 2181 <td>one of: <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a>, <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a>,</td> 2182 </tr> 2183</table> 2184 2185<a href='undocumented#kMedium_SkFilterQuality'>kMedium_SkFilterQuality</a>, <a href='undocumented#kHigh_SkFilterQuality'>kHigh_SkFilterQuality</a> 2186 2187### Parameters 2188 2189<table> <tr> <td><a name='SkImage_scalePixels_cachingHint'><code><strong>cachingHint</strong></code></a></td> 2190 <td>one of: <a href='#SkImage_kAllow_CachingHint'>kAllow_CachingHint</a>, <a href='#SkImage_kDisallow_CachingHint'>kDisallow_CachingHint</a></td> 2191 </tr> 2192</table> 2193 2194### Return Value 2195 2196true if pixels are scaled to fit <a href='#SkImage_scalePixels_dst'>dst</a> 2197 2198### Example 2199 2200<div><fiddle-embed name="5949c9a63610cae30019e5b1899ee38f"></fiddle-embed></div> 2201 2202### See Also 2203 2204<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawImage'>drawImage</a> <a href='#SkImage_readPixels'>readPixels</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_scalePixels'>scalePixels</a> 2205 2206<a name='SkImage_encodeToData'></a> 2207 2208--- 2209 2210<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2211<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='#SkImage_encodeToData'>encodeToData</a>(<a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a> encodedImageFormat, int quality)const 2212</pre> 2213 2214Encodes <a href='SkImage_Reference#SkImage'>SkImage</a> pixels, returning result as <a href='undocumented#SkData'>SkData</a>. 2215 2216Returns nullptr if encoding fails, or if <a href='#SkImage_encodeToData_encodedImageFormat'>encodedImageFormat</a> is not supported. 2217 2218<a href='SkImage_Reference#SkImage'>SkImage</a> encoding in a format requires both building with one or more of: 2219SK_HAS_JPEG_LIBRARY, SK_HAS_PNG_LIBRARY, SK_HAS_WEBP_LIBRARY; and platform support 2220for the encoded format. 2221 2222If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, <a href='#SkImage_encodeToData_encodedImageFormat'>encodedImageFormat</a> can 2223additionally be one of: <a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a>::<a href='#SkEncodedImageFormat_kICO'>kICO</a>, <a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a>::<a href='#SkEncodedImageFormat_kBMP'>kBMP</a>, 2224<a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a>::<a href='#SkEncodedImageFormat_kGIF'>kGIF</a>. 2225 2226<a href='#SkImage_encodeToData_quality'>quality</a> is a platform and format specific metric trading off <a href='undocumented#Size'>size</a> and encoding 2227error. When used, <a href='#SkImage_encodeToData_quality'>quality</a> equaling 100 encodes with the least error. <a href='#SkImage_encodeToData_quality'>quality</a> may 2228be ignored by the encoder. 2229 2230### Parameters 2231 2232<table> <tr> <td><a name='SkImage_encodeToData_encodedImageFormat'><code><strong>encodedImageFormat</strong></code></a></td> 2233 <td>one of: <a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a>::<a href='#SkEncodedImageFormat_kJPEG'>kJPEG</a>, <a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a>::<a href='#SkEncodedImageFormat_kPNG'>kPNG</a>,</td> 2234 </tr> 2235</table> 2236 2237<a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a>::<a href='#SkEncodedImageFormat_kWEBP'>kWEBP</a> 2238 2239### Parameters 2240 2241<table> <tr> <td><a name='SkImage_encodeToData_quality'><code><strong>quality</strong></code></a></td> 2242 <td>encoder specific metric with 100 equaling best</td> 2243 </tr> 2244</table> 2245 2246### Return Value 2247 2248encoded <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 2249 2250### Example 2251 2252<div><fiddle-embed name="7a3bf8851bb7160e4e49c48f8c09639d"></fiddle-embed></div> 2253 2254### See Also 2255 2256<a href='#SkImage_refEncodedData'>refEncodedData</a> <a href='#SkImage_MakeFromEncoded'>MakeFromEncoded</a> 2257 2258<a name='SkImage_encodeToData_2'></a> 2259 2260--- 2261 2262<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2263<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='#SkImage_encodeToData'>encodeToData</a>()const 2264</pre> 2265 2266Encodes <a href='SkImage_Reference#SkImage'>SkImage</a> pixels, returning result as <a href='undocumented#SkData'>SkData</a>. Returns existing encoded <a href='undocumented#Data'>data</a> 2267if present; otherwise, <a href='SkImage_Reference#SkImage'>SkImage</a> is encoded with <a href='undocumented#SkEncodedImageFormat'>SkEncodedImageFormat</a>::<a href='#SkEncodedImageFormat_kPNG'>kPNG</a>. Skia 2268must be built with SK_HAS_PNG_LIBRARY to encode <a href='SkImage_Reference#SkImage'>SkImage</a>. 2269 2270Returns nullptr if existing encoded <a href='undocumented#Data'>data</a> is missing or invalid, and 2271encoding fails. 2272 2273### Return Value 2274 2275encoded <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 2276 2277### Example 2278 2279<div><fiddle-embed name="30cee813f6aa476b0a9c8a24283e53a3"></fiddle-embed></div> 2280 2281### See Also 2282 2283<a href='#SkImage_refEncodedData'>refEncodedData</a> <a href='#SkImage_MakeFromEncoded'>MakeFromEncoded</a> 2284 2285<a name='SkImage_refEncodedData'></a> 2286 2287--- 2288 2289<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2290<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='#SkImage_refEncodedData'>refEncodedData</a>()const 2291</pre> 2292 2293Returns encoded <a href='SkImage_Reference#SkImage'>SkImage</a> pixels as <a href='undocumented#SkData'>SkData</a>, if <a href='SkImage_Reference#SkImage'>SkImage</a> was created from supported 2294encoded <a href='SkStream_Reference#Stream'>stream</a> format. Platform support for formats vary and may require building 2295with one or more of: SK_HAS_JPEG_LIBRARY, SK_HAS_PNG_LIBRARY, SK_HAS_WEBP_LIBRARY. 2296 2297Returns nullptr if <a href='SkImage_Reference#SkImage'>SkImage</a> contents are not encoded. 2298 2299### Return Value 2300 2301encoded <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 2302 2303### Example 2304 2305<div><fiddle-embed name="80856fe921ce36f8d5a32d8672bccbfc" gpu="true"></fiddle-embed></div> 2306 2307### See Also 2308 2309<a href='#SkImage_encodeToData'>encodeToData</a> <a href='#SkImage_MakeFromEncoded'>MakeFromEncoded</a> 2310 2311<a name='Utility'></a> 2312 2313<a name='SkImage_makeSubset'></a> 2314 2315--- 2316 2317<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2318<a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeSubset'>makeSubset</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& subset)const 2319</pre> 2320 2321Returns <a href='#SkImage_makeSubset_subset'>subset</a> of <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='#SkImage_makeSubset_subset'>subset</a> must be fully contained by <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='#SkImage_dimensions'>dimensions()</a>. 2322The implementation may share pixels, or may copy them. 2323 2324Returns nullptr if <a href='#SkImage_makeSubset_subset'>subset</a> is empty, or <a href='#SkImage_makeSubset_subset'>subset</a> is not contained by bounds, or 2325pixels in <a href='SkImage_Reference#SkImage'>SkImage</a> could not be read or copied. 2326 2327### Parameters 2328 2329<table> <tr> <td><a name='SkImage_makeSubset_subset'><code><strong>subset</strong></code></a></td> 2330 <td>bounds of returned <a href='SkImage_Reference#SkImage'>SkImage</a></td> 2331 </tr> 2332</table> 2333 2334### Return Value 2335 2336partial or full <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 2337 2338### Example 2339 2340<div><fiddle-embed name="889e495ce3e3b3bacc96e8230932331c"></fiddle-embed></div> 2341 2342### See Also 2343 2344<a href='#SkImage_MakeFromEncoded'>MakeFromEncoded</a> 2345 2346<a name='SkImage_makeTextureImage'></a> 2347 2348--- 2349 2350<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2351<a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeTextureImage'>makeTextureImage</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='undocumented#SkColorSpace'>SkColorSpace</a>* dstColorSpace, 2352 <a href='undocumented#GrMipMapped'>GrMipMapped</a> mipMapped = <a href='undocumented#GrMipMapped'>GrMipMapped</a>::<a href='#GrMipMapped_kNo'>kNo</a>)const 2353</pre> 2354 2355Returns <a href='SkImage_Reference#SkImage'>SkImage</a> backed by <a href='undocumented#GPU_Texture'>GPU texture</a> associated with <a href='#SkImage_makeTextureImage_context'>context</a>. Returned <a href='SkImage_Reference#SkImage'>SkImage</a> is 2356compatible with <a href='SkSurface_Reference#SkSurface'>SkSurface</a> created with <a href='#SkImage_makeTextureImage_dstColorSpace'>dstColorSpace</a>. The returned <a href='SkImage_Reference#SkImage'>SkImage</a> respects 2357<a href='#SkImage_makeTextureImage_mipMapped'>mipMapped</a> setting; if <a href='#SkImage_makeTextureImage_mipMapped'>mipMapped</a> equals <a href='undocumented#GrMipMapped'>GrMipMapped</a>::<a href='#GrMipMapped_kYes'>kYes</a>, the backing <a href='undocumented#Texture'>texture</a> 2358allocates <a href='undocumented#Mip_Map'>mip map</a> levels. Returns original <a href='SkImage_Reference#SkImage'>SkImage</a> if <a href='#SkImage_makeTextureImage_context'>context</a> 2359and <a href='#SkImage_makeTextureImage_dstColorSpace'>dstColorSpace</a> match and <a href='#SkImage_makeTextureImage_mipMapped'>mipMapped</a> is compatible with backing <a href='undocumented#GPU_Texture'>GPU texture</a>. 2360 2361Returns nullptr if <a href='#SkImage_makeTextureImage_context'>context</a> is nullptr, or if <a href='SkImage_Reference#SkImage'>SkImage</a> was created with another 2362<a href='undocumented#GrContext'>GrContext</a>. 2363 2364### Parameters 2365 2366<table> <tr> <td><a name='SkImage_makeTextureImage_context'><code><strong>context</strong></code></a></td> 2367 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 2368 </tr> 2369 <tr> <td><a name='SkImage_makeTextureImage_dstColorSpace'><code><strong>dstColorSpace</strong></code></a></td> 2370 <td>range of colors of matching <a href='SkSurface_Reference#SkSurface'>SkSurface</a> on GPU</td> 2371 </tr> 2372 <tr> <td><a name='SkImage_makeTextureImage_mipMapped'><code><strong>mipMapped</strong></code></a></td> 2373 <td>whether created <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='undocumented#Texture'>texture</a> must allocate <a href='undocumented#Mip_Map'>mip map</a> levels</td> 2374 </tr> 2375</table> 2376 2377### Return Value 2378 2379created <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 2380 2381### Example 2382 2383<div><fiddle-embed name="eeec9e07e604b44d0208899a2fe5bef5" gpu="true"></fiddle-embed></div> 2384 2385### See Also 2386 2387<a href='#SkImage_MakeFromTexture'>MakeFromTexture</a> 2388 2389<a name='SkImage_makeNonTextureImage'></a> 2390 2391--- 2392 2393<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2394<a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeNonTextureImage'>makeNonTextureImage</a>()const 2395</pre> 2396 2397Returns raster <a href='SkImage_Reference#Image'>image</a> or lazy <a href='SkImage_Reference#Image'>image</a>. Copies <a href='SkImage_Reference#SkImage'>SkImage</a> backed by GPU <a href='undocumented#Texture'>texture</a> into 2398CPU memory if needed. Returns original <a href='SkImage_Reference#SkImage'>SkImage</a> if decoded in raster <a href='SkBitmap_Reference#Bitmap'>bitmap</a>, 2399or if encoded in a <a href='SkStream_Reference#Stream'>stream</a>. 2400 2401Returns nullptr if backed by GPU <a href='undocumented#Texture'>texture</a> and copy fails. 2402 2403### Return Value 2404 2405raster <a href='SkImage_Reference#Image'>image</a>, lazy <a href='SkImage_Reference#Image'>image</a>, or nullptr 2406 2407### Example 2408 2409<div><fiddle-embed name="ecdbaff44a02c310ef672b7d393c6dea" gpu="true"></fiddle-embed></div> 2410 2411### See Also 2412 2413<a href='#SkImage_makeTextureImage'>makeTextureImage</a> <a href='#SkImage_makeRasterImage'>makeRasterImage</a> <a href='#SkImage_MakeBackendTextureFromSkImage'>MakeBackendTextureFromSkImage</a> 2414 2415<a name='SkImage_makeRasterImage'></a> 2416 2417--- 2418 2419<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2420<a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeRasterImage'>makeRasterImage</a>()const 2421</pre> 2422 2423Returns raster <a href='SkImage_Reference#Image'>image</a>. Copies <a href='SkImage_Reference#SkImage'>SkImage</a> backed by GPU <a href='undocumented#Texture'>texture</a> into CPU memory, 2424or decodes <a href='SkImage_Reference#SkImage'>SkImage</a> from lazy <a href='SkImage_Reference#Image'>image</a>. Returns original <a href='SkImage_Reference#SkImage'>SkImage</a> if decoded in 2425raster <a href='SkBitmap_Reference#Bitmap'>bitmap</a>. 2426 2427Returns nullptr if copy, decode, or <a href='undocumented#Pixel'>pixel</a> read fails. 2428 2429### Return Value 2430 2431raster <a href='SkImage_Reference#Image'>image</a>, or nullptr 2432 2433### Example 2434 2435<div><fiddle-embed name="aed5f399915d40bb5d133ab586e5bac3" gpu="true"></fiddle-embed></div> 2436 2437### See Also 2438 2439<a href='#SkImage_isTextureBacked'>isTextureBacked</a> <a href='#SkImage_isLazyGenerated'>isLazyGenerated</a> <a href='#SkImage_MakeFromRaster'>MakeFromRaster</a> 2440 2441<a name='SkImage_makeWithFilter'></a> 2442 2443--- 2444 2445<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2446<a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeWithFilter'>makeWithFilter</a>(const <a href='undocumented#SkImageFilter'>SkImageFilter</a>* filter, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& subset, 2447 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& clipBounds, <a href='SkIRect_Reference#SkIRect'>SkIRect</a>* outSubset, <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a>* offset)const 2448</pre> 2449 2450Creates filtered <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='#SkImage_makeWithFilter_filter'>filter</a> processes original <a href='SkImage_Reference#SkImage'>SkImage</a>, potentially changing 2451<a href='SkColor_Reference#Color'>color</a>, position, and <a href='undocumented#Size'>size</a>. <a href='#SkImage_makeWithFilter_subset'>subset</a> is the bounds of original <a href='SkImage_Reference#SkImage'>SkImage</a> processed 2452by <a href='#SkImage_makeWithFilter_filter'>filter</a>. <a href='#SkImage_makeWithFilter_clipBounds'>clipBounds</a> is the expected bounds of the filtered <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='#SkImage_makeWithFilter_outSubset'>outSubset</a> 2453is required storage for the actual bounds of the filtered <a href='SkImage_Reference#SkImage'>SkImage</a>. <a href='#SkImage_makeWithFilter_offset'>offset</a> is 2454required storage for translation of returned <a href='SkImage_Reference#SkImage'>SkImage</a>. 2455 2456Returns nullptr if <a href='SkImage_Reference#SkImage'>SkImage</a> could not be created. If nullptr is returned, <a href='#SkImage_makeWithFilter_outSubset'>outSubset</a> 2457and <a href='#SkImage_makeWithFilter_offset'>offset</a> are undefined. 2458 2459Useful for animation of <a href='undocumented#SkImageFilter'>SkImageFilter</a> that varies <a href='undocumented#Size'>size</a> from frame to frame. 2460Returned <a href='SkImage_Reference#SkImage'>SkImage</a> is created larger than required by <a href='#SkImage_makeWithFilter_filter'>filter</a> so that <a href='undocumented#GPU_Texture'>GPU texture</a> 2461can be reused with different sized effects. <a href='#SkImage_makeWithFilter_outSubset'>outSubset</a> describes the valid bounds 2462of <a href='undocumented#GPU_Texture'>GPU texture</a> returned. <a href='#SkImage_makeWithFilter_offset'>offset</a> translates the returned <a href='SkImage_Reference#SkImage'>SkImage</a> to keep subsequent 2463animation frames aligned with respect to each other. 2464 2465### Parameters 2466 2467<table> <tr> <td><a name='SkImage_makeWithFilter_filter'><code><strong>filter</strong></code></a></td> 2468 <td>how <a href='SkImage_Reference#SkImage'>SkImage</a> is sampled when transformed</td> 2469 </tr> 2470 <tr> <td><a name='SkImage_makeWithFilter_subset'><code><strong>subset</strong></code></a></td> 2471 <td>bounds of <a href='SkImage_Reference#SkImage'>SkImage</a> processed by <a href='#SkImage_makeWithFilter_filter'>filter</a></td> 2472 </tr> 2473 <tr> <td><a name='SkImage_makeWithFilter_clipBounds'><code><strong>clipBounds</strong></code></a></td> 2474 <td>expected bounds of filtered <a href='SkImage_Reference#SkImage'>SkImage</a></td> 2475 </tr> 2476 <tr> <td><a name='SkImage_makeWithFilter_outSubset'><code><strong>outSubset</strong></code></a></td> 2477 <td>storage for returned <a href='SkImage_Reference#SkImage'>SkImage</a> bounds</td> 2478 </tr> 2479 <tr> <td><a name='SkImage_makeWithFilter_offset'><code><strong>offset</strong></code></a></td> 2480 <td>storage for returned <a href='SkImage_Reference#SkImage'>SkImage</a> translation</td> 2481 </tr> 2482</table> 2483 2484### Return Value 2485 2486filtered <a href='SkImage_Reference#SkImage'>SkImage</a>, or nullptr 2487 2488### Example 2489 2490<div><fiddle-embed name="85a76163138a2720ac003691d6363938" gpu="true"><div>In each frame of the animation, filtered <a href='SkImage_Reference#Image'>Image</a> is drawn in a different location. 2491By translating <a href='SkCanvas_Reference#Canvas'>canvas</a> by returned <a href='#SkImage_makeWithFilter_offset'>offset</a>, <a href='SkImage_Reference#Image'>Image</a> appears stationary. 2492</div></fiddle-embed></div> 2493 2494### See Also 2495 2496<a href='#SkImage_makeShader'>makeShader</a> <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_setImageFilter'>setImageFilter</a> 2497 2498<a name='SkImage_BackendTextureReleaseProc'></a> 2499 2500--- 2501 2502<a href='#SkImage_BackendTextureReleaseProc'>BackendTextureReleaseProc</a> 2503 2504<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 2505 typedef std::function<void(<a href='undocumented#GrBackendTexture'>GrBackendTexture</a>)> <a href='#SkImage_BackendTextureReleaseProc'>BackendTextureReleaseProc</a>; 2506</pre> 2507 2508Defines a callback function, taking one parameter of type <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> with 2509no return value. Function is called when back-end <a href='undocumented#Texture'>texture</a> is to be released. 2510 2511<a name='SkImage_MakeBackendTextureFromSkImage'></a> 2512 2513--- 2514 2515<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2516static bool <a href='#SkImage_MakeBackendTextureFromSkImage'>MakeBackendTextureFromSkImage</a>(<a href='undocumented#GrContext'>GrContext</a>* context, <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='SkImage_Reference#Image'>image</a>, 2517 <a href='undocumented#GrBackendTexture'>GrBackendTexture</a>* backendTexture, 2518 <a href='#SkImage_BackendTextureReleaseProc'>BackendTextureReleaseProc</a>* backendTextureReleaseProc) 2519</pre> 2520 2521Creates a <a href='undocumented#GrBackendTexture'>GrBackendTexture</a> from the provided <a href='SkImage_Reference#SkImage'>SkImage</a>. Returns true and 2522stores result in <a href='#SkImage_MakeBackendTextureFromSkImage_backendTexture'>backendTexture</a> and <a href='#SkImage_MakeBackendTextureFromSkImage_backendTextureReleaseProc'>backendTextureReleaseProc</a> if 2523<a href='undocumented#Texture'>texture</a> is created; otherwise, returns false and leaves 2524<a href='#SkImage_MakeBackendTextureFromSkImage_backendTexture'>backendTexture</a> and <a href='#SkImage_MakeBackendTextureFromSkImage_backendTextureReleaseProc'>backendTextureReleaseProc</a> unmodified. 2525 2526Call <a href='#SkImage_MakeBackendTextureFromSkImage_backendTextureReleaseProc'>backendTextureReleaseProc</a> after deleting <a href='#SkImage_MakeBackendTextureFromSkImage_backendTexture'>backendTexture</a>. 2527<a href='#SkImage_MakeBackendTextureFromSkImage_backendTextureReleaseProc'>backendTextureReleaseProc</a> cleans up auxiliary <a href='undocumented#Data'>data</a> related to returned 2528<a href='#SkImage_MakeBackendTextureFromSkImage_backendTexture'>backendTexture</a>. The caller must delete returned <a href='#SkImage_MakeBackendTextureFromSkImage_backendTexture'>backendTexture</a> after use. 2529 2530If <a href='SkImage_Reference#SkImage'>SkImage</a> is both <a href='undocumented#Texture'>texture</a> backed and singly referenced, <a href='#SkImage_MakeBackendTextureFromSkImage_image'>image</a> is returned in 2531<a href='#SkImage_MakeBackendTextureFromSkImage_backendTexture'>backendTexture</a> without conversion or making a copy. <a href='SkImage_Reference#SkImage'>SkImage</a> is singly referenced 2532if its was transferred solely using std::move(). 2533 2534If <a href='SkImage_Reference#SkImage'>SkImage</a> is not <a href='undocumented#Texture'>texture</a> backed, returns <a href='undocumented#Texture'>texture</a> with <a href='SkImage_Reference#SkImage'>SkImage</a> contents. 2535 2536### Parameters 2537 2538<table> <tr> <td><a name='SkImage_MakeBackendTextureFromSkImage_context'><code><strong>context</strong></code></a></td> 2539 <td><a href='undocumented#GPU_Context'>GPU context</a></td> 2540 </tr> 2541 <tr> <td><a name='SkImage_MakeBackendTextureFromSkImage_image'><code><strong>image</strong></code></a></td> 2542 <td><a href='SkImage_Reference#SkImage'>SkImage</a> used for <a href='undocumented#Texture'>texture</a></td> 2543 </tr> 2544 <tr> <td><a name='SkImage_MakeBackendTextureFromSkImage_backendTexture'><code><strong>backendTexture</strong></code></a></td> 2545 <td>storage for back-end <a href='undocumented#Texture'>texture</a></td> 2546 </tr> 2547 <tr> <td><a name='SkImage_MakeBackendTextureFromSkImage_backendTextureReleaseProc'><code><strong>backendTextureReleaseProc</strong></code></a></td> 2548 <td>storage for clean up function</td> 2549 </tr> 2550</table> 2551 2552### Return Value 2553 2554true if back-end <a href='undocumented#Texture'>texture</a> was created 2555 2556### Example 2557 2558<div><fiddle-embed name="06aeb3cf63ffccf7b49fe556e5def351" gpu="true"></fiddle-embed></div> 2559 2560### See Also 2561 2562<a href='#SkImage_MakeFromTexture'>MakeFromTexture</a> <a href='#SkImage_makeTextureImage'>makeTextureImage</a> 2563 2564<a name='SkImage_isLazyGenerated'></a> 2565 2566--- 2567 2568<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2569bool <a href='#SkImage_isLazyGenerated'>isLazyGenerated</a>()const 2570</pre> 2571 2572Returns true if <a href='SkImage_Reference#SkImage'>SkImage</a> is backed by an image-generator or other service that creates 2573and caches its pixels or <a href='undocumented#Texture'>texture</a> on-demand. 2574 2575### Return Value 2576 2577true if <a href='SkImage_Reference#SkImage'>SkImage</a> is created as needed 2578 2579### Example 2580 2581<div><fiddle-embed name="a8b8bd4bfe968e2c63085f867665227f"></fiddle-embed></div> 2582 2583### Example 2584 2585<div><fiddle-embed name="f031c2a53f6a57833dc0127e674553da" gpu="true"></fiddle-embed></div> 2586 2587### See Also 2588 2589<a href='#SkImage_isTextureBacked'>isTextureBacked</a> <a href='#SkImage_makeNonTextureImage'>makeNonTextureImage</a> 2590 2591<a name='SkImage_makeColorSpace'></a> 2592 2593--- 2594 2595<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2596<a href='undocumented#sk_sp'>sk_sp</a><<a href='SkImage_Reference#SkImage'>SkImage</a>> <a href='#SkImage_makeColorSpace'>makeColorSpace</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> target)const 2597</pre> 2598 2599Creates <a href='SkImage_Reference#SkImage'>SkImage</a> in <a href='#SkImage_makeColorSpace_target'>target</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 2600Returns nullptr if <a href='SkImage_Reference#SkImage'>SkImage</a> could not be created. 2601 2602Returns original <a href='SkImage_Reference#SkImage'>SkImage</a> if it is in <a href='#SkImage_makeColorSpace_target'>target</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 2603Otherwise, converts pixels from <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a> to <a href='#SkImage_makeColorSpace_target'>target</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 2604If <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='#SkImage_colorSpace'>colorSpace</a>() returns nullptr, <a href='SkImage_Reference#SkImage'>SkImage</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a> is assumed to be sRGB. 2605 2606### Parameters 2607 2608<table> <tr> <td><a name='SkImage_makeColorSpace_target'><code><strong>target</strong></code></a></td> 2609 <td><a href='undocumented#SkColorSpace'>SkColorSpace</a> describing <a href='SkColor_Reference#Color'>color</a> range of returned <a href='SkImage_Reference#SkImage'>SkImage</a></td> 2610 </tr> 2611</table> 2612 2613### Return Value 2614 2615created <a href='SkImage_Reference#SkImage'>SkImage</a> in <a href='#SkImage_makeColorSpace_target'>target</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a> 2616 2617### Example 2618 2619<div><fiddle-embed name="dbf5f75c1275a3013672f896767140fb"></fiddle-embed></div> 2620 2621### See Also 2622 2623<a href='#SkImage_MakeFromPicture'>MakeFromPicture</a> <a href='#SkImage_MakeFromTexture'>MakeFromTexture</a> 2624 2625