1SkImageInfo Reference 2=== 3 4 5<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 6enum <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> { 7 <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, 8 <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, 9 <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, 10 <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>, 11 <a href='SkImageInfo_Reference#kLastEnum_SkAlphaType'>kLastEnum_SkAlphaType</a> = <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>, 12}; 13 14static bool <a href='SkImageInfo_Reference#SkAlphaTypeIsOpaque'>SkAlphaTypeIsOpaque</a>(<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> at); 15; 16 17enum <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> { 18 <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, 19 <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, 20 <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, 21 <a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, 22 <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, 23 <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 24 <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, 25 <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, 26 <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 27 <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, 28 <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>, 29 <a href='SkImageInfo_Reference#kRGBA_F32_SkColorType'>kRGBA_F32_SkColorType</a>, 30 <a href='SkImageInfo_Reference#kLastEnum_SkColorType'>kLastEnum_SkColorType</a> = <a href='SkImageInfo_Reference#kRGBA_F32_SkColorType'>kRGBA_F32_SkColorType</a>, 31 <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a> = <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, 32 <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a> = <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, 33}; 34 35int <a href='SkImageInfo_Reference#SkColorTypeBytesPerPixel'>SkColorTypeBytesPerPixel</a>(<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> ct); 36; 37 38bool <a href='SkImageInfo_Reference#SkColorTypeIsAlwaysOpaque'>SkColorTypeIsAlwaysOpaque</a>(<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> ct); 39; 40 41bool <a href='SkImageInfo_Reference#SkColorTypeValidateAlphaType'>SkColorTypeValidateAlphaType</a>(<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImage_colorType'>colorType</a>, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImage_alphaType'>alphaType</a>, 42 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>* canonical = nullptr); 43; 44 45enum <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> { 46 <a href='SkImageInfo_Reference#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a>, 47 <a href='SkImageInfo_Reference#kRec601_SkYUVColorSpace'>kRec601_SkYUVColorSpace</a>, 48 <a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a>, 49 <a href='SkImageInfo_Reference#kLastEnum_SkYUVColorSpace'>kLastEnum_SkYUVColorSpace</a> = <a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a>, 50}; 51 52struct <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> { 53 // <i><a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> interface</i> 54}; 55</pre> 56 57<a href='#Image_Info'>Image_Info</a> specifies the dimensions and encoding of the pixels in a <a href='SkBitmap_Reference#Bitmap'>Bitmap</a>. 58The dimensions are integral width and height. The encoding is how <a href='undocumented#Pixel'>pixel</a> 59bits describe <a href='#Color_Alpha'>Color_Alpha</a>, transparency; <a href='SkColor_Reference#Color'>Color</a> components red, blue, 60and green; and <a href='#Color_Space'>Color_Space</a>, the range and linearity of colors. 61 62<a href='#Image_Info'>Image_Info</a> describes an uncompressed raster pixels. In contrast, <a href='SkImage_Reference#Image'>Image</a> 63additionally describes compressed pixels like PNG, and <a href='SkSurface_Reference#Surface'>Surface</a> describes 64destinations on the GPU. <a href='SkImage_Reference#Image'>Image</a> and <a href='SkSurface_Reference#Surface'>Surface</a> may be specified by <a href='#Image_Info'>Image_Info</a>, 65but <a href='SkImage_Reference#Image'>Image</a> and <a href='SkSurface_Reference#Surface'>Surface</a> may not contain <a href='#Image_Info'>Image_Info</a>. 66 67<a name='Alpha_Type'></a> 68 69<a name='SkAlphaType'></a> 70 71--- 72 73<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 74enum <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> { 75 <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, 76 <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, 77 <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, 78 <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>, 79 <a href='SkImageInfo_Reference#kLastEnum_SkAlphaType'>kLastEnum_SkAlphaType</a> = <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>, 80}; 81 82</pre> 83 84Describes how to interpret the <a href='SkColor_Reference#Alpha'>alpha</a> component of a <a href='undocumented#Pixel'>pixel</a>. A <a href='undocumented#Pixel'>pixel</a> may 85be opaque, or <a href='#Color_Alpha'>Color_Alpha</a>, describing multiple levels of transparency. 86 87In simple blending, <a href='#Color_Alpha'>Color_Alpha</a> <a href='SkPath_Reference#Conic_Weight'>weights</a> the draw <a href='SkColor_Reference#Color'>color</a> and the destination 88<a href='SkColor_Reference#Color'>color</a> to create a new <a href='SkColor_Reference#Color'>color</a>. If <a href='SkColor_Reference#Alpha'>alpha</a> describes a weight from zero to one, 89new <a href='SkColor_Reference#Color'>color</a> is set to: <code>draw <a href='SkColor_Reference#Color'>color</a> * <a href='SkColor_Reference#Alpha'>alpha</a> + destination <a href='SkColor_Reference#Color'>color</a> * (1 - <a href='SkColor_Reference#Alpha'>alpha</a>)</code>. 90 91In practice <a href='SkColor_Reference#Alpha'>alpha</a> is encoded in two or more bits, where 1.0 equals all bits set. 92 93RGB may have <a href='#Color_Alpha'>Color_Alpha</a> included in each component value; the stored 94value is the original RGB multiplied by <a href='#Color_Alpha'>Color_Alpha</a>. <a href='undocumented#Premultiply'>Premultiplied</a> <a href='SkColor_Reference#Color'>color</a> 95components improve performance. 96 97### Constants 98 99<table style='border-collapse: collapse; width: 62.5em'> 100 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 101<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 102<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Details</th> 103<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 104 <tr style='background-color: #f0f0f0; '> 105 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kUnknown_SkAlphaType'><code>kUnknown_SkAlphaType</code></a></td> 106 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 107 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> 108 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 109<a href='#Image_Info_Alpha_Type'>Alpha_Type</a> is uninitialized. 110</td> 111 </tr> 112 <tr> 113 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kOpaque_SkAlphaType'><code>kOpaque_SkAlphaType</code></a></td> 114 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 115 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Opaque'>Opaque</a> </td> 116 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 117Pixels are opaque. The <a href='#Image_Info_Color_Type'>Color_Type</a> must have no explicit <a href='SkColor_Reference#Alpha'>alpha</a> 118component, or all <a href='SkColor_Reference#Alpha'>alpha</a> components must be set to their maximum value. 119</td> 120 </tr> 121 <tr style='background-color: #f0f0f0; '> 122 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kPremul_SkAlphaType'><code>kPremul_SkAlphaType</code></a></td> 123 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 124 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Premul'>Premul</a> </td> 125 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 126Pixels have <a href='SkColor_Reference#Alpha'>Alpha</a> <a href='undocumented#Premultiply'>Premultiplied</a> into <a href='SkColor_Reference#Color'>color</a> components. 127<a href='SkSurface_Reference#Surface'>Surface</a> pixels must be <a href='undocumented#Premultiply'>Premultiplied</a>. 128</td> 129 </tr> 130 <tr> 131 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kUnpremul_SkAlphaType'><code>kUnpremul_SkAlphaType</code></a></td> 132 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 133 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Unpremul'>Unpremul</a> </td> 134 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 135<a href='undocumented#Pixel'>Pixel</a> <a href='SkColor_Reference#Color'>color</a> component values are independent of <a href='SkColor_Reference#Alpha'>alpha</a> value. 136Images generated from encoded <a href='undocumented#Data'>data</a> like PNG do not <a href='undocumented#Premultiply'>Premultiply</a> <a href='undocumented#Pixel'>pixel</a> <a href='SkColor_Reference#Color'>color</a> 137components. <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> is supported for <a href='SkImage_Reference#Image'>Image</a> pixels, but not for 138<a href='SkSurface_Reference#Surface'>Surface</a> pixels. 139</td> 140 </tr> 141 <tr style='background-color: #f0f0f0; '> 142 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kLastEnum_SkAlphaType'><code>kLastEnum_SkAlphaType</code></a></td> 143 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 144 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> 145 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 146Used by tests to iterate through all valid values. 147</td> 148 </tr> 149</table> 150 151### See Also 152 153<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a> 154 155<a name='Alpha_Type_Opaque'></a> 156 157--- 158 159Use <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> as a hint to optimize drawing when <a href='SkColor_Reference#Alpha'>Alpha</a> component 160of all <a href='undocumented#Pixel'>pixel</a> is set to its maximum value of 1.0; all <a href='SkColor_Reference#Alpha'>alpha</a> component bits are set. 161If <a href='#Image_Info'>Image_Info</a> is set to <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> but all <a href='SkColor_Reference#Alpha'>alpha</a> values are not 1.0, 162results are undefined. 163 164### Example 165 166<div><fiddle-embed name="79146a1a41d58d22582fdc567c6ffe4e"><div><a href='SkColor_Reference#SkPreMultiplyARGB'>SkPreMultiplyARGB</a> parameter a is set to 255, its maximum value, and is interpreted 167as <a href='#Color_Alpha'>Color_Alpha</a> of 1.0. <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> may be set to improve performance. 168If <a href='SkColor_Reference#SkPreMultiplyARGB'>SkPreMultiplyARGB</a> parameter a is set to a value smaller than 255, 169<a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a> must be used instead to avoid undefined results. 170The four displayed values are the original component values, though not necessarily 171in the same order. 172</div></fiddle-embed></div> 173 174<a name='Alpha_Type_Premul'></a> 175 176--- 177 178Use <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a> when stored <a href='SkColor_Reference#Color'>color</a> components are the original <a href='SkColor_Reference#Color'>color</a> 179multiplied by the <a href='SkColor_Reference#Alpha'>alpha</a> component. The <a href='SkColor_Reference#Alpha'>alpha</a> component range of 0.0 to 1.0 is 180achieved by dividing the integer bit value by the maximum bit value. 181 182<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 183stored <a href='SkColor_Reference#Color'>color</a> = original <a href='SkColor_Reference#Color'>color</a> * <a href='SkColor_Reference#Alpha'>alpha</a> / max <a href='SkColor_Reference#Alpha'>alpha </a> 184</pre> 185 186The <a href='SkColor_Reference#Color'>color</a> component must be equal to or smaller than the <a href='SkColor_Reference#Alpha'>alpha</a> component, 187or the results are undefined. 188 189### Example 190 191<div><fiddle-embed name="ad696b39c915803d566e96896ec3a36c"><div><a href='SkColor_Reference#SkPreMultiplyARGB'>SkPreMultiplyARGB</a> parameter a is set to 150, less than its maximum value, and is 192interpreted as <a href='#Color_Alpha'>Color_Alpha</a> of about 0.6. <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a> must be set, since 193<a href='SkColor_Reference#SkPreMultiplyARGB'>SkPreMultiplyARGB</a> parameter a is set to a value smaller than 255, 194to avoid undefined results. 195The four displayed values reflect that the <a href='SkColor_Reference#Alpha'>alpha</a> component has been multiplied 196by the original <a href='SkColor_Reference#Color'>color</a>. 197</div></fiddle-embed></div> 198 199<a name='Alpha_Type_Unpremul'></a> 200 201--- 202 203Use <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> if stored <a href='SkColor_Reference#Color'>color</a> components are not divided by the 204<a href='SkColor_Reference#Alpha'>alpha</a> component. Some drawing destinations may not support 205<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>. 206 207### Example 208 209<div><fiddle-embed name="b8216a9e5ff5bc61a0e46eba7d36307b"><div><a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a> parameter a is set to 150, less than its maximum value, and is 210interpreted as <a href='#Color_Alpha'>Color_Alpha</a> of about 0.6. <a href='SkColor_Reference#Color'>color</a> is not <a href='undocumented#Premultiply'>Premultiplied</a>; 211<a href='SkColor_Reference#Color'>color</a> components may have values greater than <a href='SkColor_Reference#Color'>color alpha</a>. 212The four displayed values are the original component values, though not necessarily 213in the same order. 214</div></fiddle-embed></div> 215 216<a name='SkAlphaTypeIsOpaque'></a> 217 218--- 219 220<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 221static bool <a href='SkImageInfo_Reference#SkAlphaTypeIsOpaque'>SkAlphaTypeIsOpaque</a>(<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> at) 222</pre> 223 224Returns true if <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> equals <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>. <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> is a 225hint that the <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is opaque, or that all <a href='SkColor_Reference#Alpha'>alpha</a> values are set to 226their 1.0 equivalent. If <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is not 227opaque, then the result of drawing any <a href='undocumented#Pixel'>pixel</a> with a <a href='SkColor_Reference#Alpha'>alpha</a> value less than 2281.0 is undefined. 229 230### Parameters 231 232<table> <tr> <td><a name='SkAlphaTypeIsOpaque_at'><code><strong>at</strong></code></a></td> 233 <td>one of:</td> 234 </tr> 235</table> 236 237<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>, 238<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 239 240### Return Value 241 242true if <a href='#SkAlphaTypeIsOpaque_at'>at</a> equals <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> 243 244<a name='Color_Type'></a> 245 246<a name='SkColorType'></a> 247 248--- 249 250<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 251enum <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> { 252 <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, 253 <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, 254 <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, 255 <a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, 256 <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, 257 <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 258 <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, 259 <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, 260 <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 261 <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, 262 <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>, 263 <a href='SkImageInfo_Reference#kRGBA_F32_SkColorType'>kRGBA_F32_SkColorType</a>, 264 <a href='SkImageInfo_Reference#kLastEnum_SkColorType'>kLastEnum_SkColorType</a> = <a href='SkImageInfo_Reference#kRGBA_F32_SkColorType'>kRGBA_F32_SkColorType</a>, 265 <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a> = <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, 266 <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a> = <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, 267}; 268 269</pre> 270 271Describes how <a href='undocumented#Pixel'>pixel</a> bits encode <a href='SkColor_Reference#Color'>color</a>. A <a href='undocumented#Pixel'>pixel</a> may be an <a href='SkColor_Reference#Alpha'>alpha</a> mask, a 272grayscale, RGB, or ARGB. 273 274<a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a> selects the native 32-bit ARGB format. On <a href='#Little_Endian'>Little_Endian</a> 275processors, pixels containing 8-bit ARGB components pack into 32-bit 276<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>. On <a href='#Big_Endian'>Big_Endian</a> processors, pixels pack into 32-bit 277<a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>. 278 279### Constants 280 281<table style='border-collapse: collapse; width: 62.5em'> 282 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 283<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 284<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Details</th> 285<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 286 <tr style='background-color: #f0f0f0; '> 287 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kUnknown_SkColorType'><code>kUnknown_SkColorType</code></a></td> 288 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 289 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> 290 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 291<a href='#Image_Info_Color_Type'>Color_Type</a> is set to <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a> by default. If set, 292encoding format and <a href='undocumented#Size'>size</a> is unknown. 293</td> 294 </tr> 295 <tr> 296 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kAlpha_8_SkColorType'><code>kAlpha_8_SkColorType</code></a></td> 297 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 298 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Alpha_8'>Alpha 8</a> </td> 299 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 300Stores 8-bit byte <a href='undocumented#Pixel'>pixel</a> encoding that represents transparency. Value of zero 301is completely transparent; a value of 255 is completely opaque. 302</td> 303 </tr> 304 <tr style='background-color: #f0f0f0; '> 305 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRGB_565_SkColorType'><code>kRGB_565_SkColorType</code></a></td> 306 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 307 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#RGB_565'>RGB 565</a> </td> 308 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 309Stores 16-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains five bits of blue, 310six bits of green, and five bits of red. 311</td> 312 </tr> 313 <tr> 314 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kARGB_4444_SkColorType'><code>kARGB_4444_SkColorType</code></a></td> 315 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 316 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#ARGB_4444'>ARGB 4444</a> </td> 317 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 318Stores 16-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains four bits of <a href='SkColor_Reference#Alpha'>alpha</a>, 319four bits of blue, four bits of green, and four bits of red. 320</td> 321 </tr> 322 <tr style='background-color: #f0f0f0; '> 323 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRGBA_8888_SkColorType'><code>kRGBA_8888_SkColorType</code></a></td> 324 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>4</td> 325 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#RGBA_8888'>RGBA 8888</a> </td> 326 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 327Stores 32-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains eight bits of red, 328eight bits of green, eight bits of blue, and eight bits of <a href='SkColor_Reference#Alpha'>alpha</a>. 329</td> 330 </tr> 331 <tr> 332 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRGB_888x_SkColorType'><code>kRGB_888x_SkColorType</code></a></td> 333 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>5</td> 334 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#RGB_888'>RGB 888</a> </td> 335 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 336Stores 32-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains eight bits of red, 337eight bits of green, eight bits of blue, and eight unused bits. 338</td> 339 </tr> 340 <tr style='background-color: #f0f0f0; '> 341 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kBGRA_8888_SkColorType'><code>kBGRA_8888_SkColorType</code></a></td> 342 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>6</td> 343 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#BGRA_8888'>BGRA 8888</a> </td> 344 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 345Stores 32-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains eight bits of blue, 346eight bits of green, eight bits of red, and eight bits of <a href='SkColor_Reference#Alpha'>alpha</a>. 347</td> 348 </tr> 349 <tr> 350 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRGBA_1010102_SkColorType'><code>kRGBA_1010102_SkColorType</code></a></td> 351 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>7</td> 352 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#RGBA_1010102'>RGBA 1010102</a> </td> 353 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 354Stores 32-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains ten bits of red, 355ten bits of green, ten bits of blue, and two bits of <a href='SkColor_Reference#Alpha'>alpha</a>. 356</td> 357 </tr> 358 <tr style='background-color: #f0f0f0; '> 359 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRGB_101010x_SkColorType'><code>kRGB_101010x_SkColorType</code></a></td> 360 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>8</td> 361 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#RGB_101010'>RGB 101010</a> </td> 362 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 363Stores 32-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains ten bits of red, 364ten bits of green, ten bits of blue, and two unused bits. 365</td> 366 </tr> 367 <tr> 368 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kGray_8_SkColorType'><code>kGray_8_SkColorType</code></a></td> 369 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>9</td> 370 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Gray_8'>Gray 8</a> </td> 371 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 372Stores 8-bit byte <a href='undocumented#Pixel'>pixel</a> encoding that equivalent to equal values for red, 373blue, and green, representing colors from black to white. 374</td> 375 </tr> 376 <tr style='background-color: #f0f0f0; '> 377 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRGBA_F16_SkColorType'><code>kRGBA_F16_SkColorType</code></a></td> 378 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>10</td> 379 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#RGBA_F16'>RGBA F16</a> </td> 380 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 381Stores 64-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains 16 bits of blue, 38216 bits of green, 16 bits of red, and 16 bits of <a href='SkColor_Reference#Alpha'>alpha</a>. Each component 383is encoded as a half float. 384</td> 385 </tr> 386 <tr> 387 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRGBA_F32_SkColorType'><code>kRGBA_F32_SkColorType</code></a></td> 388 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>11</td> 389 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#RGBA_F32'>RGBA F32</a> </td> 390 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 391Stores 128-bit word <a href='undocumented#Pixel'>pixel</a> encoding that contains 32 bits of blue, 39232 bits of green, 32 bits of red, and 32 bits of <a href='SkColor_Reference#Alpha'>alpha</a>. Each component 393is encoded as a single precision float. 394</td> 395 </tr> 396 <tr style='background-color: #f0f0f0; '> 397 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kLastEnum_SkColorType'><code>kLastEnum_SkColorType</code></a></td> 398 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>11</td> 399 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> 400 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 401Used by tests to iterate through all valid values. 402</td> 403 </tr> 404 <tr> 405 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kN32_SkColorType'><code>kN32_SkColorType</code></a></td> 406 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>4 or 6</td> 407 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> 408 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 409Encodes ARGB as either <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a> or 410<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, whichever is native to the platform. 411</td> 412 </tr> 413</table> 414 415### See Also 416 417<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a> 418 419<a name='Color_Type_Alpha_8'></a> 420 421--- 422 423<a href='SkColor_Reference#Alpha'>Alpha</a> pixels encode transparency without <a href='SkColor_Reference#Color'>color</a> information. Value of zero is 424completely transparent; a value of 255 is completely opaque. <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> 425pixels do not visibly draw, because its pixels have no <a href='SkColor_Reference#Color'>color</a> information. 426When <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is set to <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, the paired <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is 427ignored. 428 429### Example 430 431<div><fiddle-embed name="21ae21e4ce53d2018e042dd457997300"><div><a href='SkColor_Reference#Alpha'>Alpha</a> pixels can modify another draw. orangePaint fills the bounds of <a href='SkBitmap_Reference#Bitmap'>bitmap</a>, 432with its transparency set to alpha8 <a href='undocumented#Pixel'>pixel</a> value. 433</div></fiddle-embed></div> 434 435### See Also 436 437<a href='SkColor_Reference#Alpha'>Alpha</a> <a href='#Image_Info_Color_Type_Gray_8'>Gray_8</a> 438 439<a name='Color_Type_RGB_565'></a> 440 441--- 442 443<a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> encodes RGB to fit in a 16-bit word. Red and blue 444components use five bits describing 32 levels. Green components, more sensitive 445to the eye, use six bits describing 64 levels. <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> has no 446bits for <a href='SkColor_Reference#Alpha'>Alpha</a>. 447Pixels are fully opaque as if its <a href='#Color_Alpha'>Color_Alpha</a> was set to one, and should 448always be paired with <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>. 449 450![Color_Type_RGB_565](https://fiddle.skia.org/i/6dec0226490a4ac1977dc87a31564147_raster.png "") 451 452### Example 453 454<div><fiddle-embed name="7e7c46bb4572e21e13529ff364eb0a9c"></fiddle-embed></div> 455 456### See Also 457 458<a href='#Image_Info_Color_Type_ARGB_4444'>ARGB_4444</a> <a href='#Image_Info_Color_Type_RGBA_8888'>RGBA_8888</a> 459 460<a name='Color_Type_ARGB_4444'></a> 461 462--- 463 464<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a> encodes ARGB to fit in 16-bit word. Each 465component: <a href='SkColor_Reference#Alpha'>alpha</a>, blue, green, and red; use four bits, describing 16 levels. 466Note that <a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a> is misnamed; the acronym does not 467describe the actual component order. 468 469![Color_Type_ARGB_4444](https://fiddle.skia.org/i/e8008512f0d197051e3f26faa67bafc2_raster.png "") 470 471If paired with <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: blue, green, and red components are 472<a href='undocumented#Premultiply'>Premultiplied</a> by the <a href='SkColor_Reference#Alpha'>alpha</a> value. If blue, green, or red is greater than <a href='SkColor_Reference#Alpha'>alpha</a>, 473the drawn result is undefined. 474 475If paired with <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>: <a href='SkColor_Reference#Alpha'>alpha</a>, blue, green, and red components 476may have any value. There may be a performance penalty with <a href='undocumented#Unpremultiply'>Unpremultiplied</a> 477pixels. 478 479If paired with <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>: all <a href='SkColor_Reference#Alpha'>alpha</a> component values are at the maximum; 480blue, green, and red components are fully opaque. If any <a href='SkColor_Reference#Alpha'>alpha</a> component is 481less than 15, the drawn result is undefined. 482 483### Example 484 485<div><fiddle-embed name="33a360c3404ac21db801943336843d8e"></fiddle-embed></div> 486 487### See Also 488 489<a href='#Image_Info_Color_Type_RGBA_8888'>RGBA_8888</a> 490 491<a name='Color_Type_RGBA_8888'></a> 492 493--- 494 495<a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a> encodes ARGB into a 32-bit word. Each component: 496red, green, blue, <a href='SkColor_Reference#Alpha'>alpha</a>; use eight bits, describing 256 levels. 497 498![Color_Type_RGBA_8888](https://fiddle.skia.org/i/9abc324f670e6468f09385551aae5a1c_raster.png "") 499 500If paired with <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: red, green, and blue components are 501<a href='undocumented#Premultiply'>Premultiplied</a> by the <a href='SkColor_Reference#Alpha'>alpha</a> value. If red, green, or blue is greater than <a href='SkColor_Reference#Alpha'>alpha</a>, 502the drawn result is undefined. 503 504If paired with <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>: <a href='SkColor_Reference#Alpha'>alpha</a>, red, green, and blue components 505may have any value. There may be a performance penalty with <a href='undocumented#Unpremultiply'>Unpremultiplied</a> 506pixels. 507 508If paired with <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>: all <a href='SkColor_Reference#Alpha'>alpha</a> component values are at the maximum; 509red, green, and blue components are fully opaque. If any <a href='SkColor_Reference#Alpha'>alpha</a> component is 510less than 255, the drawn result is undefined. 511 512On <a href='#Big_Endian'>Big_Endian</a> platforms, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a> is the native <a href='#Image_Info_Color_Type'>Color_Type</a>, and 513will have the best performance. Use <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a> to choose the best 514<a href='#Image_Info_Color_Type'>Color_Type</a> for the platform at compile time. 515 516### Example 517 518<div><fiddle-embed name="947922a19d59893fe7f9d9ee1954379b"></fiddle-embed></div> 519 520### See Also 521 522<a href='#Image_Info_Color_Type_RGB_888'>RGB_888</a> <a href='#Image_Info_Color_Type_BGRA_8888'>BGRA_8888</a> 523 524<a name='Color_Type_RGB_888'></a> 525 526--- 527 528<a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a> encodes RGB into a 32-bit word. Each component: 529red, green, blue; use eight bits, describing 256 levels. Eight bits are 530unused. Pixels described by <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a> are fully opaque as if 531their <a href='#Color_Alpha'>Color_Alpha</a> was set to one, and should always be paired with 532<a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>. 533 534![Color_Type_RGB_888](https://fiddle.skia.org/i/7527d7ade4764302818e250cd4e03962_raster.png "") 535 536### Example 537 538<div><fiddle-embed name="4260d6cc15db2c60c07f6fdc8d9ae425"></fiddle-embed></div> 539 540### See Also 541 542<a href='#Image_Info_Color_Type_RGBA_8888'>RGBA_8888</a> <a href='#Image_Info_Color_Type_BGRA_8888'>BGRA_8888</a> 543 544<a name='Color_Type_BGRA_8888'></a> 545 546--- 547 548<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a> encodes ARGB into a 32-bit word. Each component: 549blue, green, red, and <a href='SkColor_Reference#Alpha'>alpha</a>; use eight bits, describing 256 levels. 550 551![Color_Type_BGRA_8888](https://fiddle.skia.org/i/6c35ca14d88b0de200ba7f897f889ad7_raster.png "") 552 553If paired with <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: blue, green, and red components are 554<a href='undocumented#Premultiply'>Premultiplied</a> by the <a href='SkColor_Reference#Alpha'>alpha</a> value. If blue, green, or red is greater than <a href='SkColor_Reference#Alpha'>alpha</a>, 555the drawn result is undefined. 556 557If paired with <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>: blue, green, red, and <a href='SkColor_Reference#Alpha'>alpha</a> components 558may have any value. There may be a performance penalty with <a href='undocumented#Unpremultiply'>Unpremultiplied</a> 559pixels. 560 561If paired with <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>: all <a href='SkColor_Reference#Alpha'>alpha</a> component values are at the maximum; 562blue, green, and red components are fully opaque. If any <a href='SkColor_Reference#Alpha'>alpha</a> component is 563less than 255, the drawn result is undefined. 564 565On <a href='#Little_Endian'>Little_Endian</a> platforms, <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a> is the native <a href='#Image_Info_Color_Type'>Color_Type</a>, 566and will have the best performance. Use <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a> to choose the best 567<a href='#Image_Info_Color_Type'>Color_Type</a> for the platform at compile time. 568 569### Example 570 571<div><fiddle-embed name="945ce5344fce5470f8604b2e06e9f9ae"></fiddle-embed></div> 572 573### See Also 574 575<a href='#Image_Info_Color_Type_RGBA_8888'>RGBA_8888</a> 576 577<a name='Color_Type_RGBA_1010102'></a> 578 579--- 580 581<a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a> encodes ARGB into a 32-bit word. Each 582<a href='SkColor_Reference#Color'>Color</a> component: red, green, and blue; use ten bits, describing 1024 levels. 583Two bits contain <a href='SkColor_Reference#Alpha'>alpha</a>, describing four levels. Possible <a href='SkColor_Reference#Alpha'>alpha</a> 584values are zero: fully transparent; one: 33% opaque; two: 67% opaque; 585three: fully opaque. 586 587At present, <a href='SkColor_Reference#Color'>Color</a> in <a href='SkPaint_Reference#Paint'>Paint</a> does not provide enough precision to 588draw all colors possible to a <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>. 589 590![Color_Type_RGBA_1010102](https://fiddle.skia.org/i/8d78daf69145f611054f289a7443a670_raster.png "") 591 592If paired with <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: red, green, and blue components are 593<a href='undocumented#Premultiply'>Premultiplied</a> by the <a href='SkColor_Reference#Alpha'>alpha</a> value. If red, green, or blue is greater than the 594<a href='SkColor_Reference#Alpha'>alpha</a> replicated to ten bits, the drawn result is undefined. 595 596If paired with <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>: <a href='SkColor_Reference#Alpha'>alpha</a>, red, green, and blue components 597may have any value. There may be a performance penalty with <a href='undocumented#Unpremultiply'>Unpremultiplied</a> 598pixels. 599 600If paired with <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>: all <a href='SkColor_Reference#Alpha'>alpha</a> component values are at the maximum; 601red, green, and blue components are fully opaque. If any <a href='SkColor_Reference#Alpha'>alpha</a> component is 602less than three, the drawn result is undefined. 603 604### Example 605 606<div><fiddle-embed name="1282dc1127ce1b0061544619ae4de0f0"></fiddle-embed></div> 607 608### See Also 609 610<a href='#Image_Info_Color_Type_RGB_101010'>RGB_101010</a> <a href='#Image_Info_Color_Type_RGBA_8888'>RGBA_8888</a> 611 612<a name='Color_Type_RGB_101010'></a> 613 614--- 615 616<a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a> encodes RGB into a 32-bit word. Each 617<a href='SkColor_Reference#Color'>Color</a> component: red, green, and blue; use ten bits, describing 1024 levels. 618Two bits are unused. Pixels described by <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a> are fully 619opaque as if its <a href='#Color_Alpha'>Color_Alpha</a> was set to one, and should always be paired 620with <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>. 621 622At present, <a href='SkColor_Reference#Color'>Color</a> in <a href='SkPaint_Reference#Paint'>Paint</a> does not provide enough precision to 623draw all colors possible to a <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>. 624 625![Color_Type_RGB_101010](https://fiddle.skia.org/i/4c9f4d939e2047269d73fa3507caf01f_raster.png "") 626 627### Example 628 629<div><fiddle-embed name="92f81aa0459230459600a01e79ccff29"></fiddle-embed></div> 630 631### See Also 632 633<a href='#Image_Info_Color_Type_RGBA_1010102'>RGBA_1010102</a> 634 635<a name='Color_Type_Gray_8'></a> 636 637--- 638 639<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a> encodes grayscale level in eight bits that is equivalent 640to equal values for red, blue, and green, representing colors from black to 641white. Pixels described by <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a> are fully 642opaque as if its <a href='#Color_Alpha'>Color_Alpha</a> was set to one, and should always be paired with 643<a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>. 644 645### Example 646 647<div><fiddle-embed name="93da0eb0b6722a4f33dc7dae094abf0b"></fiddle-embed></div> 648 649### See Also 650 651<a href='#Image_Info_Color_Type_Alpha_8'>Alpha_8</a> 652 653<a name='Color_Type_RGBA_F16'></a> 654 655--- 656 657<a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> encodes ARGB into a 64-bit word. Each component: 658blue, green, red, and <a href='SkColor_Reference#Alpha'>alpha</a>; use 16 bits, describing a floating <a href='SkPoint_Reference#Point'>point</a> value, 659from -65500 to 65000 with 3.31 decimal digits of precision. 660 661At present, <a href='SkColor_Reference#Color'>Color</a> in <a href='SkPaint_Reference#Paint'>Paint</a> does not provide enough precision or range to 662draw all colors possible to a <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>. 663 664Each component encodes a floating <a href='SkPoint_Reference#Point'>point</a> value using 665<a href='https://www.khronos.org/opengl/wiki/Small_Float_Formats'>Half floats</a></a>. Meaningful colors are represented by the range 0.0 to 1.0, although smaller 666and larger values may be useful when used in combination with <a href='#Transfer_Mode'>Transfer_Mode</a>. 667 668![Color_Type_RGBA_F16](https://fiddle.skia.org/i/1bb35ae52173e0fef874022ca8138adc_raster.png "") 669 670If paired with <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: blue, green, and red components are 671<a href='undocumented#Premultiply'>Premultiplied</a> by the <a href='SkColor_Reference#Alpha'>alpha</a> value. If blue, green, or red is greater than <a href='SkColor_Reference#Alpha'>alpha</a>, 672the drawn result is undefined. 673 674If paired with <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>: blue, green, red, and <a href='SkColor_Reference#Alpha'>alpha</a> components 675may have any value. There may be a performance penalty with <a href='undocumented#Unpremultiply'>Unpremultiplied</a> 676pixels. 677 678If paired with <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>: all <a href='SkColor_Reference#Alpha'>alpha</a> component values are at the maximum; 679blue, green, and red components are fully opaque. If any <a href='SkColor_Reference#Alpha'>alpha</a> component is 680less than one, the drawn result is undefined. 681 682### Example 683 684<div><fiddle-embed name="dd81527bbdf5eaae7dd21ac04ab84f9e"></fiddle-embed></div> 685 686### See Also 687 688<a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a> 689 690<a name='Color_Type_RGBA_F32'></a> 691 692--- 693 694<a href='SkImageInfo_Reference#kRGBA_F32_SkColorType'>kRGBA_F32_SkColorType</a> encodes ARGB into a 128-bit word. Each component: 695blue, green, red, and <a href='SkColor_Reference#Alpha'>alpha</a>; use 32 bits, describing a floating <a href='SkPoint_Reference#Point'>point</a> value, 696from -3.402823e+38 to 3.402823e+38 with 7.225 decimal digits of precision. 697 698At present, <a href='SkColor_Reference#Color'>Color</a> in <a href='SkPaint_Reference#Paint'>Paint</a> does not provide enough precision or range to 699draw all colors possible to a <a href='SkImageInfo_Reference#kRGBA_F32_SkColorType'>kRGBA_F32_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>. 700 701Each component encodes a floating <a href='SkPoint_Reference#Point'>point</a> value using 702<a href='https://en.wikipedia.org/wiki/Single-precision_floating-point_format'>single-precision floats</a></a>. Meaningful colors are represented by the range 0.0 to 1.0, although smaller 703and larger values may be useful when used in combination with <a href='#Transfer_Mode'>Transfer_Mode</a>. 704 705![Color_Type_RGBA_F32](https://fiddle.skia.org/i/4ba31a8f9bc94a996f34da81ef541a9c_raster.png "") 706 707If paired with <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: blue, green, and red components are 708<a href='undocumented#Premultiply'>Premultiplied</a> by the <a href='SkColor_Reference#Alpha'>alpha</a> value. If blue, green, or red is greater than <a href='SkColor_Reference#Alpha'>alpha</a>, 709the drawn result is undefined. 710 711If paired with <a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a>: blue, green, red, and <a href='SkColor_Reference#Alpha'>alpha</a> components 712may have any value. There may be a performance penalty with <a href='undocumented#Unpremultiply'>Unpremultiplied</a> 713pixels. 714 715If paired with <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>: all <a href='SkColor_Reference#Alpha'>alpha</a> component values are at the maximum; 716blue, green, and red components are fully opaque. If any <a href='SkColor_Reference#Alpha'>alpha</a> component is 717less than one, the drawn result is undefined. 718 719### See Also 720 721<a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a> 722 723<a name='SkColorTypeBytesPerPixel'></a> 724 725--- 726 727<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 728int <a href='SkImageInfo_Reference#SkColorTypeBytesPerPixel'>SkColorTypeBytesPerPixel</a>(<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> ct) 729</pre> 730 731Returns the number of bytes required to store a <a href='undocumented#Pixel'>pixel</a>, including unused padding. 732Returns zero if <a href='#SkColorTypeBytesPerPixel_ct'>ct</a> is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a> or invalid. 733 734### Parameters 735 736<table> <tr> <td><a name='SkColorTypeBytesPerPixel_ct'><code><strong>ct</strong></code></a></td> 737 <td>one of:</td> 738 </tr> 739</table> 740 741<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>, 742<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 743<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 744<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 745 746### Return Value 747 748bytes per <a href='undocumented#Pixel'>pixel</a> 749 750### Example 751 752<div><fiddle-embed name="09ef49d07cb7005ba3e34d5ea53896f5"><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>, 753<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 754<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 755<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 756</fiddle-embed></div> 757 758### See Also 759 760<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>::<a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a> 761 762<a name='SkColorTypeIsAlwaysOpaque'></a> 763 764--- 765 766<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 767bool <a href='SkImageInfo_Reference#SkColorTypeIsAlwaysOpaque'>SkColorTypeIsAlwaysOpaque</a>(<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> ct) 768</pre> 769 770Returns true if <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> always decodes <a href='SkColor_Reference#Alpha'>alpha</a> to 1.0, making the <a href='undocumented#Pixel'>pixel</a> 771fully opaque. If true, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> does not reserve bits to encode <a href='SkColor_Reference#Alpha'>alpha</a>. 772 773### Parameters 774 775<table> <tr> <td><a name='SkColorTypeIsAlwaysOpaque_ct'><code><strong>ct</strong></code></a></td> 776 <td>one of:</td> 777 </tr> 778</table> 779 780<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>, 781<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 782<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 783<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 784 785### Return Value 786 787true if <a href='SkColor_Reference#Alpha'>alpha</a> is always set to 1.0 788 789### Example 790 791<div><fiddle-embed name="9b3eb5aaa0dfea9feee54e7650fa5446"><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>, 792<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 793<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 794<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 795</fiddle-embed></div> 796 797### See Also 798 799<a href='SkImageInfo_Reference#SkColorTypeValidateAlphaType'>SkColorTypeValidateAlphaType</a> 800 801<a name='SkColorTypeValidateAlphaType'></a> 802 803--- 804 805<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 806bool <a href='SkImageInfo_Reference#SkColorTypeValidateAlphaType'>SkColorTypeValidateAlphaType</a>(<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> colorType, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> alphaType, 807 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>* canonical = nullptr) 808</pre> 809 810Returns true if <a href='#SkColorTypeValidateAlphaType_canonical'>canonical</a> can be set to a valid <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> for <a href='#SkColorTypeValidateAlphaType_colorType'>colorType</a>. If 811there is more than one valid <a href='#SkColorTypeValidateAlphaType_canonical'>canonical</a> <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, set to <a href='#SkColorTypeValidateAlphaType_alphaType'>alphaType</a>, if valid. 812If true is returned and <a href='#SkColorTypeValidateAlphaType_canonical'>canonical</a> is not nullptr, store valid <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>. 813 814Returns false only if <a href='#SkColorTypeValidateAlphaType_alphaType'>alphaType</a> is <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, <a href='SkImageInfo_Reference#Color_Type'>color type</a> is not 815<a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> is not always opaque. If false is returned, 816<a href='#SkColorTypeValidateAlphaType_canonical'>canonical</a> is ignored. 817 818For <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>: set <a href='#SkColorTypeValidateAlphaType_canonical'>canonical</a> to <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a> and return true. 819For <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>: set <a href='#SkColorTypeValidateAlphaType_canonical'>canonical</a> to <a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a> or 820<a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> and return true if <a href='#SkColorTypeValidateAlphaType_alphaType'>alphaType</a> is not <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>. 821For <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, and 822<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>: set <a href='#SkColorTypeValidateAlphaType_canonical'>canonical</a> to <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> and return true. 823For <a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, 824<a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, and <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a>: set <a href='#SkColorTypeValidateAlphaType_canonical'>canonical</a> to <a href='#SkColorTypeValidateAlphaType_alphaType'>alphaType</a> 825and return true if <a href='#SkColorTypeValidateAlphaType_alphaType'>alphaType</a> is not <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>. 826 827### Parameters 828 829<table> <tr> <td><a name='SkColorTypeValidateAlphaType_colorType'><code><strong>colorType</strong></code></a></td> 830 <td>one of:</td> 831 </tr> 832</table> 833 834<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>, 835<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 836<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 837<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 838 839### Parameters 840 841<table> <tr> <td><a name='SkColorTypeValidateAlphaType_alphaType'><code><strong>alphaType</strong></code></a></td> 842 <td>one of:</td> 843 </tr> 844</table> 845 846<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>, 847<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 848 849### Parameters 850 851<table> <tr> <td><a name='SkColorTypeValidateAlphaType_canonical'><code><strong>canonical</strong></code></a></td> 852 <td>storage for <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a></td> 853 </tr> 854</table> 855 856### Return Value 857 858true if valid <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> can be associated with <a href='#SkColorTypeValidateAlphaType_colorType'>colorType</a> 859 860### Example 861 862<div><fiddle-embed name="befac1c29ed21507d367e4d824383a04"><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>, 863<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 864<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>, 865<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 866<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 867<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 868</fiddle-embed></div> 869 870### See Also 871 872<a href='SkImageInfo_Reference#SkColorTypeIsAlwaysOpaque'>SkColorTypeIsAlwaysOpaque</a> 873 874<a name='YUV_ColorSpace'></a> 875 876<a name='SkYUVColorSpace'></a> 877 878--- 879 880<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 881enum <a href='SkImageInfo_Reference#SkYUVColorSpace'>SkYUVColorSpace</a> { 882 <a href='SkImageInfo_Reference#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a>, 883 <a href='SkImageInfo_Reference#kRec601_SkYUVColorSpace'>kRec601_SkYUVColorSpace</a>, 884 <a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a>, 885 <a href='SkImageInfo_Reference#kLastEnum_SkYUVColorSpace'>kLastEnum_SkYUVColorSpace</a> = <a href='SkImageInfo_Reference#kRec709_SkYUVColorSpace'>kRec709_SkYUVColorSpace</a>, 886}; 887 888</pre> 889 890Describes <a href='SkColor_Reference#Color'>color</a> range of YUV pixels. The <a href='SkColor_Reference#Color'>color</a> mapping from YUV to RGB varies 891depending on the source. YUV pixels may be generated by JPEG images, standard 892video streams, or high definition video streams. Each has its own mapping from 893YUV and RGB. 894 895JPEG YUV values encode the full range of 0 to 255 for all three components. 896Video YUV values range from 16 to 235 for all three components. Details of 897encoding and conversion to RGB are described in 898<a href='https://en.wikipedia.org/wiki/YCbCr'>YCbCr color space</a></a> . 899 900### Constants 901 902<table style='border-collapse: collapse; width: 62.5em'> 903 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 904<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 905<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 906 <tr style='background-color: #f0f0f0; '> 907 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kJPEG_SkYUVColorSpace'><code>kJPEG_SkYUVColorSpace</code></a></td> 908 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 909 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 910Describes standard JPEG <a href='undocumented#Color_Space'>color space</a>; 911<a href='https://en.wikipedia.org/wiki/Rec._601'>CCIR 601</a></a> with full range of 0 to 255 for components. 912</td> 913 </tr> 914 <tr> 915 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRec601_SkYUVColorSpace'><code>kRec601_SkYUVColorSpace</code></a></td> 916 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 917 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 918Describes standard used by standard definition television; 919<a href='https://en.wikipedia.org/wiki/Rec._601'>CCIR 601</a></a> with studio range of 16 to 235 range for components. 920</td> 921 </tr> 922 <tr style='background-color: #f0f0f0; '> 923 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kRec709_SkYUVColorSpace'><code>kRec709_SkYUVColorSpace</code></a></td> 924 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 925 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 926Describes standard used by high definition television; 927<a href='https://en.wikipedia.org/wiki/Rec._709'>Rec. 709</a></a> with studio range of 16 to 235 range for components. 928</td> 929 </tr> 930 <tr> 931 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='kLastEnum_SkYUVColorSpace'><code>kLastEnum_SkYUVColorSpace</code></a></td> 932 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 933 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 934Used by tests to iterate through all valid values. 935</td> 936 </tr> 937</table> 938 939### See Also 940 941<a href='SkImage_Reference#SkImage'>SkImage</a>::<a href='#SkImage_MakeFromYUVTexturesCopy'>MakeFromYUVTexturesCopy</a> <a href='SkImage_Reference#SkImage'>SkImage</a>::<a href='#SkImage_MakeFromNV12TexturesCopy'>MakeFromNV12TexturesCopy</a> 942 943<a name='SkImageInfo'></a> 944 945--- 946 947<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 948struct <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> { 949 950 <a href='#SkImageInfo_empty_constructor'>SkImageInfo()</a>; 951 static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_Make'>Make</a>(int width, int height, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> ct, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> at, 952 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> cs = nullptr); 953 static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeN32'>MakeN32</a>(int width, int height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> at, 954 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> cs = nullptr); 955 static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a>(int width, int height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> at); 956 static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeN32Premul'>MakeN32Premul</a>(int width, int height, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> cs = nullptr); 957 static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeN32Premul'>MakeN32Premul</a>(const <a href='undocumented#SkISize'>SkISize</a>& <a href='undocumented#Size'>size</a>); 958 static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a>(int width, int height); 959 static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeUnknown'>MakeUnknown</a>(int width, int height); 960 static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeUnknown'>MakeUnknown</a>(); 961 int <a href='#SkImageInfo_width'>width()</a> const; 962 int <a href='#SkImageInfo_height'>height()</a> const; 963 <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImageInfo_colorType'>colorType</a>() const; 964 <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImageInfo_alphaType'>alphaType</a>() const; 965 <a href='undocumented#SkColorSpace'>SkColorSpace</a>* <a href='#SkImageInfo_colorSpace'>colorSpace</a>() const; 966 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImageInfo_refColorSpace'>refColorSpace</a>() const; 967 bool <a href='#SkImageInfo_isEmpty'>isEmpty</a>() const; 968 bool <a href='#SkImageInfo_isOpaque'>isOpaque</a>() const; 969 <a href='undocumented#SkISize'>SkISize</a> <a href='#SkImageInfo_dimensions'>dimensions()</a> const; 970 <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkImageInfo_bounds'>bounds()</a> const; 971 bool <a href='#SkImageInfo_gammaCloseToSRGB'>gammaCloseToSRGB</a>() const; 972 <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_makeWH'>makeWH</a>(int newWidth, int newHeight) const; 973 <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_makeAlphaType'>makeAlphaType</a>(<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> newAlphaType) const; 974 <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_makeColorType'>makeColorType</a>(<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> newColorType) const; 975 <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_makeColorSpace'>makeColorSpace</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> cs) const; 976 int <a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>() const; 977 int <a href='#SkImageInfo_shiftPerPixel'>shiftPerPixel</a>() const; 978 uint64_t <a href='#SkImageInfo_minRowBytes64'>minRowBytes64</a>() const; 979 size_t <a href='#SkImageInfo_minRowBytes'>minRowBytes</a>() const; 980 size_t <a href='#SkImageInfo_computeOffset'>computeOffset</a>(int x, int y, size_t rowBytes) const; 981 bool <a href='#SkImageInfo_equal1_operator'>operator==</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& other) const; 982 bool <a href='#SkImageInfo_notequal1_operator'>operator!=</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& other) const; 983 size_t <a href='#SkImageInfo_computeByteSize'>computeByteSize</a>(size_t rowBytes) const; 984 size_t <a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a>() const; 985 static bool <a href='#SkImageInfo_ByteSizeOverflowed'>ByteSizeOverflowed</a>(size_t byteSize); 986 bool <a href='#SkImageInfo_validRowBytes'>validRowBytes</a>(size_t rowBytes) const; 987 void <a href='#SkImageInfo_reset'>reset()</a>; 988 void <a href='#SkImageInfo_validate'>validate()</a> const; 989}; 990 991</pre> 992 993Describes <a href='undocumented#Pixel'>pixel</a> dimensions and encoding. <a href='SkBitmap_Reference#Bitmap'>Bitmap</a>, <a href='SkImage_Reference#Image'>Image</a>, <a href='SkPixmap_Reference#Pixmap'>Pixmap</a>, and <a href='SkSurface_Reference#Surface'>Surface</a> 994can be created from <a href='#Image_Info'>Image_Info</a>. <a href='#Image_Info'>Image_Info</a> can be retrieved from <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> and 995<a href='SkPixmap_Reference#Pixmap'>Pixmap</a>, but not from <a href='SkImage_Reference#Image'>Image</a> and <a href='SkSurface_Reference#Surface'>Surface</a>. For example, <a href='SkImage_Reference#Image'>Image</a> and <a href='SkSurface_Reference#Surface'>Surface</a> 996implementations may defer <a href='undocumented#Pixel'>pixel</a> depth, so may not completely specify <a href='#Image_Info'>Image_Info</a>. 997 998<a href='#Image_Info'>Image_Info</a> contains dimensions, the <a href='undocumented#Pixel'>pixel</a> integral width and height. It encodes 999how <a href='undocumented#Pixel'>pixel</a> bits describe <a href='#Color_Alpha'>Color_Alpha</a>, transparency; <a href='SkColor_Reference#Color'>Color</a> components red, blue, 1000and green; and <a href='#Color_Space'>Color_Space</a>, the range and linearity of colors. 1001 1002<a name='SkImageInfo_empty_constructor'></a> 1003 1004--- 1005 1006<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1007<a href='#SkImageInfo_empty_constructor'>SkImageInfo()</a> 1008</pre> 1009 1010Creates an empty <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> with <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, 1011a width and height of zero, and no <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 1012 1013### Return Value 1014 1015empty <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1016 1017### Example 1018 1019<div><fiddle-embed name="f206f698e7a8db3d84334c26b1a702dc"><div>An empty <a href='#Image_Info'>Image_Info</a> may be passed to <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_accessTopLayerPixels'>accessTopLayerPixels</a> as storage 1020for the <a href='SkCanvas_Reference#Canvas'>Canvas</a> actual <a href='#Image_Info'>Image_Info</a>. 1021</div></fiddle-embed></div> 1022 1023### See Also 1024 1025<a href='#SkImageInfo_Make'>Make</a> <a href='#SkImageInfo_MakeN32'>MakeN32</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a> 1026 1027<a name='SkImageInfo_Make'></a> 1028 1029--- 1030 1031<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1032static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_Make'>Make</a>(int width, int height, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> ct, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> at, 1033 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> cs = nullptr) 1034</pre> 1035 1036Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> from integral dimensions <a href='#SkImageInfo_Make_width'>width</a> and <a href='#SkImageInfo_Make_height'>height</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImageInfo_Make_ct'>ct</a>, 1037<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImageInfo_Make_at'>at</a>, and optionally <a href='undocumented#SkColorSpace'>SkColorSpace</a> <a href='#SkImageInfo_Make_cs'>cs</a>. 1038 1039If <a href='undocumented#SkColorSpace'>SkColorSpace</a> <a href='#SkImageInfo_Make_cs'>cs</a> is nullptr and <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is part of drawing source: <a href='undocumented#SkColorSpace'>SkColorSpace</a> 1040defaults to sRGB, mapping into <a href='SkSurface_Reference#SkSurface'>SkSurface</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 1041 1042Parameters are not validated to see if their values are legal, or that the 1043combination is supported. 1044 1045### Parameters 1046 1047<table> <tr> <td><a name='SkImageInfo_Make_width'><code><strong>width</strong></code></a></td> 1048 <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td> 1049 </tr> 1050 <tr> <td><a name='SkImageInfo_Make_height'><code><strong>height</strong></code></a></td> 1051 <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td> 1052 </tr> 1053 <tr> <td><a name='SkImageInfo_Make_ct'><code><strong>ct</strong></code></a></td> 1054 <td>one of:</td> 1055 </tr> 1056</table> 1057 1058<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>, 1059<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 1060<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 1061<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 1062 1063### Parameters 1064 1065<table> <tr> <td><a name='SkImageInfo_Make_at'><code><strong>at</strong></code></a></td> 1066 <td>one of:</td> 1067 </tr> 1068</table> 1069 1070<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>, 1071<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 1072 1073### Parameters 1074 1075<table> <tr> <td><a name='SkImageInfo_Make_cs'><code><strong>cs</strong></code></a></td> 1076 <td>range of colors; may be nullptr</td> 1077 </tr> 1078</table> 1079 1080### Return Value 1081 1082created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1083 1084### Example 1085 1086<div><fiddle-embed name="9f47f9c2a99473f5b1113db48096d586"></fiddle-embed></div> 1087 1088### See Also 1089 1090<a href='#SkImageInfo_MakeN32'>MakeN32</a> <a href='#SkImageInfo_MakeN32Premul'>MakeN32Premul</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a> 1091 1092<a name='SkImageInfo_MakeN32'></a> 1093 1094--- 1095 1096<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1097static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeN32'>MakeN32</a>(int width, int height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> at, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> cs = nullptr) 1098</pre> 1099 1100Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> from integral dimensions <a href='#SkImageInfo_MakeN32_width'>width</a> and <a href='#SkImageInfo_MakeN32_height'>height</a>, <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a>, 1101<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImageInfo_MakeN32_at'>at</a>, and optionally <a href='undocumented#SkColorSpace'>SkColorSpace</a> <a href='#SkImageInfo_MakeN32_cs'>cs</a>. <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a> will equal either 1102<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a> or <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, whichever is optimal. 1103 1104If <a href='undocumented#SkColorSpace'>SkColorSpace</a> <a href='#SkImageInfo_MakeN32_cs'>cs</a> is nullptr and <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is part of drawing source: <a href='undocumented#SkColorSpace'>SkColorSpace</a> 1105defaults to sRGB, mapping into <a href='SkSurface_Reference#SkSurface'>SkSurface</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 1106 1107Parameters are not validated to see if their values are legal, or that the 1108combination is supported. 1109 1110### Parameters 1111 1112<table> <tr> <td><a name='SkImageInfo_MakeN32_width'><code><strong>width</strong></code></a></td> 1113 <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td> 1114 </tr> 1115 <tr> <td><a name='SkImageInfo_MakeN32_height'><code><strong>height</strong></code></a></td> 1116 <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td> 1117 </tr> 1118 <tr> <td><a name='SkImageInfo_MakeN32_at'><code><strong>at</strong></code></a></td> 1119 <td>one of:</td> 1120 </tr> 1121</table> 1122 1123<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>, 1124<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 1125 1126### Parameters 1127 1128<table> <tr> <td><a name='SkImageInfo_MakeN32_cs'><code><strong>cs</strong></code></a></td> 1129 <td>range of colors; may be nullptr</td> 1130 </tr> 1131</table> 1132 1133### Return Value 1134 1135created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1136 1137### Example 1138 1139<div><fiddle-embed name="78cea0c4cac205b61ad6f6c982cbd888"></fiddle-embed></div> 1140 1141### See Also 1142 1143<a href='#SkImageInfo_Make'>Make</a> <a href='#SkImageInfo_MakeN32Premul'>MakeN32Premul</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a> 1144 1145<a name='SkImageInfo_MakeS32'></a> 1146 1147--- 1148 1149<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1150static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a>(int width, int height, <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> at) 1151</pre> 1152 1153Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> from integral dimensions <a href='#SkImageInfo_MakeS32_width'>width</a> and <a href='#SkImageInfo_MakeS32_height'>height</a>, <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a>, 1154<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImageInfo_MakeS32_at'>at</a>, with sRGB <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 1155 1156Parameters are not validated to see if their values are legal, or that the 1157combination is supported. 1158 1159### Parameters 1160 1161<table> <tr> <td><a name='SkImageInfo_MakeS32_width'><code><strong>width</strong></code></a></td> 1162 <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td> 1163 </tr> 1164 <tr> <td><a name='SkImageInfo_MakeS32_height'><code><strong>height</strong></code></a></td> 1165 <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td> 1166 </tr> 1167 <tr> <td><a name='SkImageInfo_MakeS32_at'><code><strong>at</strong></code></a></td> 1168 <td>one of:</td> 1169 </tr> 1170</table> 1171 1172<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>, 1173<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 1174 1175### Return Value 1176 1177created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1178 1179### Example 1180 1181<div><fiddle-embed name="de418ccb42471d1589508ef3955f8c53"><div>Top gradient is drawn to offScreen without <a href='#Color_Space'>Color_Space</a>. It is darker than middle 1182gradient, drawn to offScreen with sRGB <a href='#Color_Space'>Color_Space</a>. Bottom gradient shares bits 1183with middle, but does not specify the <a href='#Color_Space'>Color_Space</a> in noColorSpaceBitmap. A source 1184without <a href='#Color_Space'>Color_Space</a> is treated as sRGB; the bottom gradient is identical to the 1185middle gradient. 1186</div></fiddle-embed></div> 1187 1188### See Also 1189 1190<a href='#SkImageInfo_Make'>Make</a> <a href='#SkImageInfo_MakeN32'>MakeN32</a> <a href='#SkImageInfo_MakeN32Premul'>MakeN32Premul</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a> 1191 1192<a name='SkImageInfo_MakeN32Premul'></a> 1193 1194--- 1195 1196<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1197static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeN32Premul'>MakeN32Premul</a>(int width, int height, <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> cs = nullptr) 1198</pre> 1199 1200Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> from integral dimensions <a href='#SkImageInfo_MakeN32Premul_width'>width</a> and <a href='#SkImageInfo_MakeN32Premul_height'>height</a>, <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a>, 1201<a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, with optional <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 1202 1203If <a href='undocumented#SkColorSpace'>SkColorSpace</a> <a href='#SkImageInfo_MakeN32Premul_cs'>cs</a> is nullptr and <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is part of drawing source: <a href='undocumented#SkColorSpace'>SkColorSpace</a> 1204defaults to sRGB, mapping into <a href='SkSurface_Reference#SkSurface'>SkSurface</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 1205 1206Parameters are not validated to see if their values are legal, or that the 1207combination is supported. 1208 1209### Parameters 1210 1211<table> <tr> <td><a name='SkImageInfo_MakeN32Premul_width'><code><strong>width</strong></code></a></td> 1212 <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td> 1213 </tr> 1214 <tr> <td><a name='SkImageInfo_MakeN32Premul_height'><code><strong>height</strong></code></a></td> 1215 <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td> 1216 </tr> 1217 <tr> <td><a name='SkImageInfo_MakeN32Premul_cs'><code><strong>cs</strong></code></a></td> 1218 <td>range of colors; may be nullptr</td> 1219 </tr> 1220</table> 1221 1222### Return Value 1223 1224created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1225 1226### Example 1227 1228<div><fiddle-embed name="525650a67e19fdd8ca9f72b7eda65174"></fiddle-embed></div> 1229 1230### See Also 1231 1232<a href='#SkImageInfo_MakeN32'>MakeN32</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a> <a href='#SkImageInfo_Make'>Make</a> 1233 1234<a name='SkImageInfo_MakeN32Premul_2'></a> 1235 1236--- 1237 1238<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1239static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeN32Premul'>MakeN32Premul</a>(const <a href='undocumented#SkISize'>SkISize</a>& <a href='undocumented#Size'>size</a>) 1240</pre> 1241 1242Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> from integral dimensions width and height, <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a>, 1243<a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, with <a href='undocumented#SkColorSpace'>SkColorSpace</a> set to nullptr. 1244 1245If <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is part of drawing source: <a href='undocumented#SkColorSpace'>SkColorSpace</a> defaults to sRGB, mapping 1246into <a href='SkSurface_Reference#SkSurface'>SkSurface</a> <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 1247 1248Parameters are not validated to see if their values are legal, or that the 1249combination is supported. 1250 1251### Parameters 1252 1253<table> <tr> <td><a name='SkImageInfo_MakeN32Premul_2_size'><code><strong>size</strong></code></a></td> 1254 <td>width and height, each must be zero or greater</td> 1255 </tr> 1256</table> 1257 1258### Return Value 1259 1260created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1261 1262### Example 1263 1264<div><fiddle-embed name="b9026d7f39029756bd7cab9542c64f4e"></fiddle-embed></div> 1265 1266### See Also 1267 1268<a href='#SkImageInfo_MakeN32'>MakeN32</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a> <a href='#SkImageInfo_Make'>Make</a> 1269 1270<a name='SkImageInfo_MakeA8'></a> 1271 1272--- 1273 1274<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1275static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a>(int width, int height) 1276</pre> 1277 1278Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> from integral dimensions <a href='#SkImageInfo_MakeA8_width'>width</a> and <a href='#SkImageInfo_MakeA8_height'>height</a>, <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, 1279<a href='SkImageInfo_Reference#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>, with <a href='undocumented#SkColorSpace'>SkColorSpace</a> set to nullptr. 1280 1281### Parameters 1282 1283<table> <tr> <td><a name='SkImageInfo_MakeA8_width'><code><strong>width</strong></code></a></td> 1284 <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td> 1285 </tr> 1286 <tr> <td><a name='SkImageInfo_MakeA8_height'><code><strong>height</strong></code></a></td> 1287 <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td> 1288 </tr> 1289</table> 1290 1291### Return Value 1292 1293created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1294 1295### Example 1296 1297<div><fiddle-embed name="547388991687b8e10d482d8b1c82777d"></fiddle-embed></div> 1298 1299### See Also 1300 1301<a href='#SkImageInfo_MakeN32'>MakeN32</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_Make'>Make</a> 1302 1303<a name='SkImageInfo_MakeUnknown'></a> 1304 1305--- 1306 1307<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1308static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeUnknown'>MakeUnknown</a>(int width, int height) 1309</pre> 1310 1311Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> from integral dimensions <a href='#SkImageInfo_MakeUnknown_width'>width</a> and <a href='#SkImageInfo_MakeUnknown_height'>height</a>, <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, 1312<a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, with <a href='undocumented#SkColorSpace'>SkColorSpace</a> set to nullptr. 1313 1314Returned <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> as part of source does not draw, and as part of destination 1315can not be drawn to. 1316 1317### Parameters 1318 1319<table> <tr> <td><a name='SkImageInfo_MakeUnknown_width'><code><strong>width</strong></code></a></td> 1320 <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td> 1321 </tr> 1322 <tr> <td><a name='SkImageInfo_MakeUnknown_height'><code><strong>height</strong></code></a></td> 1323 <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td> 1324 </tr> 1325</table> 1326 1327### Return Value 1328 1329created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1330 1331### Example 1332 1333<div><fiddle-embed name="75f13a78b28b08c72baf32b7d868de1c"></fiddle-embed></div> 1334 1335### See Also 1336 1337<a href='#SkImageInfo_empty_constructor'>SkImageInfo()</a> <a href='#SkImageInfo_MakeN32'>MakeN32</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_Make'>Make</a> 1338 1339<a name='SkImageInfo_MakeUnknown_2'></a> 1340 1341--- 1342 1343<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1344static <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_MakeUnknown'>MakeUnknown</a>() 1345</pre> 1346 1347Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> from integral dimensions width and height set to zero, 1348<a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, with <a href='undocumented#SkColorSpace'>SkColorSpace</a> set to nullptr. 1349 1350Returned <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> as part of source does not draw, and as part of destination 1351can not be drawn to. 1352 1353### Return Value 1354 1355created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1356 1357### Example 1358 1359<div><fiddle-embed name="a1af7696ae0cdd6f379546dd1f211b7a"></fiddle-embed></div> 1360 1361### See Also 1362 1363<a href='#SkImageInfo_empty_constructor'>SkImageInfo()</a> <a href='#SkImageInfo_MakeN32'>MakeN32</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_Make'>Make</a> 1364 1365<a name='Property'></a> 1366 1367<a name='SkImageInfo_width'></a> 1368 1369--- 1370 1371<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1372int <a href='#SkImageInfo_width'>width()</a>const 1373</pre> 1374 1375Returns <a href='undocumented#Pixel'>pixel</a> count in each row. 1376 1377### Return Value 1378 1379<a href='undocumented#Pixel'>pixel</a> width 1380 1381### Example 1382 1383<div><fiddle-embed name="e2491817695290d0218be77f091b8460"></fiddle-embed></div> 1384 1385### See Also 1386 1387<a href='#SkImageInfo_height'>height</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_width'>width</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>::<a href='#SkPixelRef_width'>width</a> <a href='SkImage_Reference#SkImage'>SkImage</a>::<a href='#SkImage_width'>width</a> <a href='SkSurface_Reference#SkSurface'>SkSurface</a>::<a href='#SkSurface_width'>width</a> 1388 1389<a name='SkImageInfo_height'></a> 1390 1391--- 1392 1393<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1394int <a href='#SkImageInfo_height'>height()</a>const 1395</pre> 1396 1397Returns <a href='undocumented#Pixel'>pixel</a> row count. 1398 1399### Return Value 1400 1401<a href='undocumented#Pixel'>pixel</a> height 1402 1403### Example 1404 1405<div><fiddle-embed name="72c35baaeddca1d912edf93d19429c8e"></fiddle-embed></div> 1406 1407### See Also 1408 1409<a href='#SkImageInfo_width'>width</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_height'>height</a> <a href='undocumented#SkPixelRef'>SkPixelRef</a>::<a href='#SkPixelRef_height'>height</a> <a href='SkImage_Reference#SkImage'>SkImage</a>::<a href='#SkImage_height'>height</a> <a href='SkSurface_Reference#SkSurface'>SkSurface</a>::<a href='#SkSurface_height'>height</a> 1410 1411<a name='SkImageInfo_colorType'></a> 1412 1413--- 1414 1415<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1416<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> <a href='#SkImageInfo_colorType'>colorType</a>()const 1417</pre> 1418 1419Returns <a href='#Image_Info_Color_Type'>Color_Type</a>, one of: <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a>, 1420<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 1421<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 1422<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 1423. 1424 1425### Return Value 1426 1427<a href='#Image_Info_Color_Type'>Color_Type</a> 1428 1429### Example 1430 1431<div><fiddle-embed name="06ecc3ce7f35cc7f930cbc2a662e3105"> 1432 1433#### Example Output 1434 1435~~~~ 1436color type: kAlpha_8_SkColorType 1437~~~~ 1438 1439</fiddle-embed></div> 1440 1441### See Also 1442 1443<a href='#SkImageInfo_alphaType'>alphaType</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_colorType'>colorType</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_colorType'>colorType</a> 1444 1445<a name='SkImageInfo_alphaType'></a> 1446 1447--- 1448 1449<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1450<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> <a href='#SkImageInfo_alphaType'>alphaType</a>()const 1451</pre> 1452 1453Returns <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>, 1454<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 1455. 1456 1457### Return Value 1458 1459<a href='#Image_Info_Alpha_Type'>Alpha_Type</a> 1460 1461### Example 1462 1463<div><fiddle-embed name="5c1d2499a4056b6cff38c1cf924158a1"> 1464 1465#### Example Output 1466 1467~~~~ 1468alpha type: kPremul_SkAlphaType 1469~~~~ 1470 1471</fiddle-embed></div> 1472 1473### See Also 1474 1475<a href='#SkImageInfo_colorType'>colorType</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_alphaType'>alphaType</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_alphaType'>alphaType</a> 1476 1477<a name='SkImageInfo_colorSpace'></a> 1478 1479--- 1480 1481<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1482<a href='undocumented#SkColorSpace'>SkColorSpace</a>* <a href='#SkImageInfo_colorSpace'>colorSpace</a>()const 1483</pre> 1484 1485Returns <a href='undocumented#SkColorSpace'>SkColorSpace</a>, the range of colors. The reference count of 1486<a href='undocumented#SkColorSpace'>SkColorSpace</a> is unchanged. The returned <a href='undocumented#SkColorSpace'>SkColorSpace</a> is immutable. 1487 1488### Return Value 1489 1490<a href='undocumented#SkColorSpace'>SkColorSpace</a>, or nullptr 1491 1492### Example 1493 1494<div><fiddle-embed name="5602b816d7cf75e3851274ef36a4c10f"><div><a href='undocumented#SkColorSpace'>SkColorSpace</a>::<a href='#SkColorSpace_MakeSRGBLinear'>MakeSRGBLinear</a> creates <a href='#Color_Space'>Color_Space</a> with linear gamma 1495and an sRGB gamut. This <a href='#Color_Space'>Color_Space</a> gamma is not close to sRGB gamma. 1496</div> 1497 1498#### Example Output 1499 1500~~~~ 1501gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false 1502~~~~ 1503 1504</fiddle-embed></div> 1505 1506### See Also 1507 1508<a href='#Color_Space'>Color_Space</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_colorSpace'>colorSpace</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_colorSpace'>colorSpace</a> 1509 1510<a name='SkImageInfo_refColorSpace'></a> 1511 1512--- 1513 1514<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1515<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> <a href='#SkImageInfo_refColorSpace'>refColorSpace</a>()const 1516</pre> 1517 1518Returns smart pointer to <a href='undocumented#SkColorSpace'>SkColorSpace</a>, the range of colors. The smart pointer 1519tracks the number of objects sharing this <a href='undocumented#SkColorSpace'>SkColorSpace</a> reference so the memory 1520is released when the owners destruct. 1521 1522The returned <a href='undocumented#SkColorSpace'>SkColorSpace</a> is immutable. 1523 1524### Return Value 1525 1526<a href='undocumented#SkColorSpace'>SkColorSpace</a> wrapped in a smart pointer 1527 1528### Example 1529 1530<div><fiddle-embed name="33f65524736736fd91802b4198ba6fa8"></fiddle-embed></div> 1531 1532### See Also 1533 1534<a href='#Color_Space'>Color_Space</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_refColorSpace'>refColorSpace</a> 1535 1536<a name='SkImageInfo_isEmpty'></a> 1537 1538--- 1539 1540<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1541bool <a href='#SkImageInfo_isEmpty'>isEmpty</a>()const 1542</pre> 1543 1544Returns if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> describes an empty area of pixels by checking if either 1545width or height is zero or smaller. 1546 1547### Return Value 1548 1549true if either dimension is zero or smaller 1550 1551### Example 1552 1553<div><fiddle-embed name="b8757200da5be0b43763cf79feb681a7"> 1554 1555#### Example Output 1556 1557~~~~ 1558width: 0 height: 0 empty: true 1559width: 0 height: 2 empty: true 1560width: 2 height: 0 empty: true 1561width: 2 height: 2 empty: false 1562~~~~ 1563 1564</fiddle-embed></div> 1565 1566### See Also 1567 1568<a href='#SkImageInfo_dimensions'>dimensions</a> <a href='#SkImageInfo_bounds'>bounds</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_empty'>empty</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_bounds'>bounds</a> 1569 1570<a name='SkImageInfo_isOpaque'></a> 1571 1572--- 1573 1574<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1575bool <a href='#SkImageInfo_isOpaque'>isOpaque</a>()const 1576</pre> 1577 1578Returns true if <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is set to hint that all pixels are opaque; their 1579<a href='SkColor_Reference#Alpha'>alpha</a> value is implicitly or explicitly 1.0. If true, and all pixels are 1580not opaque, Skia may draw incorrectly. 1581 1582Does not check if <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> allows <a href='SkColor_Reference#Alpha'>alpha</a>, or if any <a href='undocumented#Pixel'>pixel</a> value has 1583transparency. 1584 1585### Return Value 1586 1587true if <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> is <a href='SkImageInfo_Reference#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a> 1588 1589### Example 1590 1591<div><fiddle-embed name="e9bd4f02b6cfb3ac864cb7fee7d7299c"> 1592 1593#### Example Output 1594 1595~~~~ 1596isOpaque: false 1597isOpaque: false 1598isOpaque: true 1599isOpaque: true 1600~~~~ 1601 1602</fiddle-embed></div> 1603 1604### See Also 1605 1606<a href='#Color_Alpha'>Color_Alpha</a> <a href='SkImageInfo_Reference#SkColorTypeValidateAlphaType'>SkColorTypeValidateAlphaType</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_isOpaque'>isOpaque</a> <a href='SkImage_Reference#SkImage'>SkImage</a>::<a href='#SkImage_isOpaque'>isOpaque</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_isOpaque'>isOpaque</a> 1607 1608<a name='SkImageInfo_dimensions'></a> 1609 1610--- 1611 1612<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1613<a href='undocumented#SkISize'>SkISize</a> <a href='#SkImageInfo_dimensions'>dimensions()</a>const 1614</pre> 1615 1616Returns <a href='undocumented#SkISize'>SkISize</a> { <a href='#SkImageInfo_width'>width()</a>, <a href='#SkImageInfo_height'>height()</a> }. 1617 1618### Return Value 1619 1620integral <a href='undocumented#Size'>size</a> of <a href='#SkImageInfo_width'>width()</a> and <a href='#SkImageInfo_height'>height()</a> 1621 1622### Example 1623 1624<div><fiddle-embed name="d5547cd2b302822aa85b7b0ae3f48458"> 1625 1626#### Example Output 1627 1628~~~~ 1629dimensionsAsBounds == bounds 1630~~~~ 1631 1632</fiddle-embed></div> 1633 1634### See Also 1635 1636<a href='#SkImageInfo_width'>width</a> <a href='#SkImageInfo_height'>height</a> <a href='#SkImageInfo_bounds'>bounds</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_dimensions'>dimensions</a> 1637 1638<a name='SkImageInfo_bounds'></a> 1639 1640--- 1641 1642<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1643<a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkImageInfo_bounds'>bounds()</a>const 1644</pre> 1645 1646Returns <a href='SkIRect_Reference#SkIRect'>SkIRect</a> { 0, 0, <a href='#SkImageInfo_width'>width()</a>, <a href='#SkImageInfo_height'>height()</a> }. 1647 1648### Return Value 1649 1650integral rectangle from origin to <a href='#SkImageInfo_width'>width()</a> and <a href='#SkImageInfo_height'>height()</a> 1651 1652### Example 1653 1654<div><fiddle-embed name="a818be8945cd0c18f99ffe53e90afa48"></fiddle-embed></div> 1655 1656### See Also 1657 1658<a href='#SkImageInfo_width'>width</a> <a href='#SkImageInfo_height'>height</a> <a href='#SkImageInfo_dimensions'>dimensions</a> 1659 1660<a name='SkImageInfo_gammaCloseToSRGB'></a> 1661 1662--- 1663 1664<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1665bool <a href='#SkImageInfo_gammaCloseToSRGB'>gammaCloseToSRGB</a>()const 1666</pre> 1667 1668Returns true if associated <a href='#Color_Space'>Color_Space</a> is not nullptr, and <a href='#Color_Space'>Color_Space</a> gamma 1669is approximately the same as sRGB. 1670This includes the 1671<a href='https://en.wikipedia.org/wiki/SRGB#The_sRGB_transfer_function_(%22gamma%22)'>sRGB transfer function</a></a> as well as a gamma <a href='undocumented#Curve'>curve</a> described by a 2.2 exponent. 1672 1673### Return Value 1674 1675true if <a href='#Color_Space'>Color_Space</a> gamma is approximately the same as sRGB 1676 1677### Example 1678 1679<div><fiddle-embed name="22df72732e898a11773fbfe07388a546"></fiddle-embed></div> 1680 1681### See Also 1682 1683<a href='undocumented#SkColorSpace'>SkColorSpace</a>::<a href='#SkColorSpace_gammaCloseToSRGB'>gammaCloseToSRGB</a> 1684 1685<a name='SkImageInfo_makeWH'></a> 1686 1687--- 1688 1689<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1690<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_makeWH'>makeWH</a>(int newWidth, int newHeight)const 1691</pre> 1692 1693Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> with the same <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a>, and <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, 1694with dimensions set to width and height. 1695 1696### Parameters 1697 1698<table> <tr> <td><a name='SkImageInfo_makeWH_newWidth'><code><strong>newWidth</strong></code></a></td> 1699 <td><a href='undocumented#Pixel'>pixel</a> column count; must be zero or greater</td> 1700 </tr> 1701 <tr> <td><a name='SkImageInfo_makeWH_newHeight'><code><strong>newHeight</strong></code></a></td> 1702 <td><a href='undocumented#Pixel'>pixel</a> row count; must be zero or greater</td> 1703 </tr> 1704</table> 1705 1706### Return Value 1707 1708created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1709 1710### Example 1711 1712<div><fiddle-embed name="cd203a3f9c5fb68272f21f302dd54fbc"></fiddle-embed></div> 1713 1714### See Also 1715 1716<a href='#SkImageInfo_Make'>Make</a> <a href='#SkImageInfo_makeAlphaType'>makeAlphaType</a> <a href='#SkImageInfo_makeColorSpace'>makeColorSpace</a> <a href='#SkImageInfo_makeColorType'>makeColorType</a> 1717 1718<a name='SkImageInfo_makeAlphaType'></a> 1719 1720--- 1721 1722<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1723<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_makeAlphaType'>makeAlphaType</a>(<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> newAlphaType)const 1724</pre> 1725 1726Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> with same <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a>, width, and height, 1727with <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> set to <a href='#SkImageInfo_makeAlphaType_newAlphaType'>newAlphaType</a>. 1728 1729Created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> contains <a href='#SkImageInfo_makeAlphaType_newAlphaType'>newAlphaType</a> even if it is incompatible with 1730<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, in which case <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> in <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is ignored. 1731 1732### Parameters 1733 1734<table> <tr> <td><a name='SkImageInfo_makeAlphaType_newAlphaType'><code><strong>newAlphaType</strong></code></a></td> 1735 <td>one of:</td> 1736 </tr> 1737</table> 1738 1739<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>, 1740<a href='SkImageInfo_Reference#kUnpremul_SkAlphaType'>kUnpremul_SkAlphaType</a> 1741 1742### Return Value 1743 1744created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1745 1746### Example 1747 1748<div><fiddle-embed name="e72db006f1bea26feceaef8727ff9818"></fiddle-embed></div> 1749 1750### See Also 1751 1752<a href='#SkImageInfo_Make'>Make</a> <a href='#SkImageInfo_MakeA8'>MakeA8</a> <a href='#SkImageInfo_makeColorType'>makeColorType</a> <a href='#SkImageInfo_makeColorSpace'>makeColorSpace</a> 1753 1754<a name='SkImageInfo_makeColorType'></a> 1755 1756--- 1757 1758<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1759<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_makeColorType'>makeColorType</a>(<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> newColorType)const 1760</pre> 1761 1762Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> with same <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a>, width, and height, 1763with <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a> set to <a href='#SkImageInfo_makeColorType_newColorType'>newColorType</a>. 1764 1765### Parameters 1766 1767<table> <tr> <td><a name='SkImageInfo_makeColorType_newColorType'><code><strong>newColorType</strong></code></a></td> 1768 <td>one of:</td> 1769 </tr> 1770</table> 1771 1772<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>, 1773<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 1774<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, 1775<a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, <a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 1776 1777### Return Value 1778 1779created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1780 1781### Example 1782 1783<div><fiddle-embed name="3ac267b08b12dc83c95f91d8dd5d70ee"></fiddle-embed></div> 1784 1785### See Also 1786 1787<a href='#SkImageInfo_Make'>Make</a> <a href='#SkImageInfo_makeAlphaType'>makeAlphaType</a> <a href='#SkImageInfo_makeColorSpace'>makeColorSpace</a> 1788 1789<a name='SkImageInfo_makeColorSpace'></a> 1790 1791--- 1792 1793<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1794<a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> <a href='#SkImageInfo_makeColorSpace'>makeColorSpace</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorSpace'>SkColorSpace</a>> cs)const 1795</pre> 1796 1797Creates <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> with same <a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, width, and height, 1798with <a href='undocumented#SkColorSpace'>SkColorSpace</a> set to <a href='#SkImageInfo_makeColorSpace_cs'>cs</a>. 1799 1800### Parameters 1801 1802<table> <tr> <td><a name='SkImageInfo_makeColorSpace_cs'><code><strong>cs</strong></code></a></td> 1803 <td>range of colors; may be nullptr</td> 1804 </tr> 1805</table> 1806 1807### Return Value 1808 1809created <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> 1810 1811### Example 1812 1813<div><fiddle-embed name="fe3c5a755d3dde29bba058a583f18901"></fiddle-embed></div> 1814 1815### See Also 1816 1817<a href='#SkImageInfo_Make'>Make</a> <a href='#SkImageInfo_MakeS32'>MakeS32</a> <a href='#SkImageInfo_makeAlphaType'>makeAlphaType</a> <a href='#SkImageInfo_makeColorType'>makeColorType</a> 1818 1819<a name='SkImageInfo_bytesPerPixel'></a> 1820 1821--- 1822 1823<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1824int <a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>()const 1825</pre> 1826 1827Returns number of bytes per <a href='undocumented#Pixel'>pixel</a> required by <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>. 1828Returns zero if <a href='#SkImageInfo_colorType'>colorType</a>( is <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>. 1829 1830### Return Value 1831 1832bytes in <a href='undocumented#Pixel'>pixel</a> 1833 1834### Example 1835 1836<div><fiddle-embed name="9b6de4a07b2316228e9340e5a3b82134"><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>, 1837<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 1838<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 1839<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 1840 1841#### Example Output 1842 1843~~~~ 1844color: kUnknown_SkColorType bytesPerPixel: 0 1845color: kAlpha_8_SkColorType bytesPerPixel: 1 1846color: kRGB_565_SkColorType bytesPerPixel: 2 1847color: kARGB_4444_SkColorType bytesPerPixel: 2 1848color: kRGBA_8888_SkColorType bytesPerPixel: 4 1849color: kRGB_888x_SkColorType bytesPerPixel: 4 1850color: kBGRA_8888_SkColorType bytesPerPixel: 4 1851color: kRGBA_1010102_SkColorType bytesPerPixel: 4 1852color: kRGB_101010x_SkColorType bytesPerPixel: 4 1853color: kGray_8_SkColorType bytesPerPixel: 1 1854color: kRGBA_F16_SkColorType bytesPerPixel: 8 1855~~~~ 1856 1857</fiddle-embed></div> 1858 1859### See Also 1860 1861<a href='#SkImageInfo_width'>width</a> <a href='#SkImageInfo_shiftPerPixel'>shiftPerPixel</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_bytesPerPixel'>bytesPerPixel</a> 1862 1863<a name='SkImageInfo_shiftPerPixel'></a> 1864 1865--- 1866 1867<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1868int <a href='#SkImageInfo_shiftPerPixel'>shiftPerPixel</a>()const 1869</pre> 1870 1871Returns bit shift converting row bytes to row pixels. 1872Returns zero for <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>. 1873 1874### Return Value 1875 1876one of: 0, 1, 2, 3; left shift to convert pixels to bytes 1877 1878### Example 1879 1880<div><fiddle-embed name="e47b911f94fc629f756a829e523a2a89"><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>, 1881<a href='SkImageInfo_Reference#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_888x_SkColorType'>kRGB_888x_SkColorType</a>, 1882<a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a>, <a href='SkImageInfo_Reference#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a>, 1883<a href='SkImageInfo_Reference#kGray_8_SkColorType'>kGray_8_SkColorType</a>, <a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> 1884 1885#### Example Output 1886 1887~~~~ 1888color: kUnknown_SkColorType shiftPerPixel: 0 1889color: kAlpha_8_SkColorType shiftPerPixel: 0 1890color: kRGB_565_SkColorType shiftPerPixel: 1 1891color: kARGB_4444_SkColorType shiftPerPixel: 1 1892color: kRGBA_8888_SkColorType shiftPerPixel: 2 1893color: kRGB_888x_SkColorType shiftPerPixel: 2 1894color: kBGRA_8888_SkColorType shiftPerPixel: 2 1895color: kRGBA_1010102_SkColorType shiftPerPixel: 2 1896color: kRGB_101010x_SkColorType shiftPerPixel: 2 1897color: kGray_8_SkColorType shiftPerPixel: 0 1898color: kRGBA_F16_SkColorType shiftPerPixel: 3 1899~~~~ 1900 1901</fiddle-embed></div> 1902 1903### See Also 1904 1905<a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a> <a href='#SkImageInfo_minRowBytes'>minRowBytes</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_shiftPerPixel'>shiftPerPixel</a> <a href='SkPixmap_Reference#SkPixmap'>SkPixmap</a>::<a href='#SkPixmap_shiftPerPixel'>shiftPerPixel</a> 1906 1907<a name='SkImageInfo_minRowBytes64'></a> 1908 1909--- 1910 1911<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1912uint64_t <a href='#SkImageInfo_minRowBytes64'>minRowBytes64</a>()const 1913</pre> 1914 1915Returns minimum bytes per row, computed from <a href='undocumented#Pixel'>pixel</a> <a href='#SkImageInfo_width'>width()</a> and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, which 1916specifies <a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>(). <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> maximum value for row bytes must fit 1917in 31 bits. 1918 1919### Return Value 1920 1921<a href='#SkImageInfo_width'>width()</a> times <a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>() as unsigned 64-bit integer 1922 1923### Example 1924 1925<div><fiddle-embed name="4b5d3904476726a39f1c3e276d6b6ba7"> 1926 1927#### Example Output 1928 1929~~~~ 1930RGBA_F16 width 16777216 (0x01000000) OK 1931RGBA_F16 width 33554432 (0x02000000) OK 1932RGBA_F16 width 67108864 (0x04000000) OK 1933RGBA_F16 width 134217728 (0x08000000) OK 1934RGBA_F16 width 268435456 (0x10000000) too large 1935RGBA_F16 width 536870912 (0x20000000) too large 1936RGBA_F16 width 1073741824 (0x40000000) too large 1937RGBA_F16 width -2147483648 (0x80000000) too large 1938~~~~ 1939 1940</fiddle-embed></div> 1941 1942### See Also 1943 1944<a href='#SkImageInfo_minRowBytes'>minRowBytes</a> <a href='#SkImageInfo_computeByteSize'>computeByteSize</a> <a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a> <a href='#SkImageInfo_validRowBytes'>validRowBytes</a> 1945 1946<a name='SkImageInfo_minRowBytes'></a> 1947 1948--- 1949 1950<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1951size_t <a href='#SkImageInfo_minRowBytes'>minRowBytes</a>()const 1952</pre> 1953 1954Returns minimum bytes per row, computed from <a href='undocumented#Pixel'>pixel</a> <a href='#SkImageInfo_width'>width()</a> and <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, which 1955specifies <a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>(). <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a> maximum value for row bytes must fit 1956in 31 bits. 1957 1958### Return Value 1959 1960<a href='#SkImageInfo_width'>width()</a> times <a href='#SkImageInfo_bytesPerPixel'>bytesPerPixel</a>() as signed 32-bit integer 1961 1962### Example 1963 1964<div><fiddle-embed name="897230ecfb36095486beca324fd369f9"> 1965 1966#### Example Output 1967 1968~~~~ 1969RGBA_F16 width 16777216 (0x01000000) OK 1970RGBA_F16 width 33554432 (0x02000000) OK 1971RGBA_F16 width 67108864 (0x04000000) OK 1972RGBA_F16 width 134217728 (0x08000000) OK 1973RGBA_F16 width 268435456 (0x10000000) too large 1974RGBA_F16 width 536870912 (0x20000000) too large 1975RGBA_F16 width 1073741824 (0x40000000) too large 1976RGBA_F16 width -2147483648 (0x80000000) too large 1977~~~~ 1978 1979</fiddle-embed></div> 1980 1981### See Also 1982 1983<a href='#SkImageInfo_minRowBytes64'>minRowBytes64</a> <a href='#SkImageInfo_computeByteSize'>computeByteSize</a> <a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a> <a href='#SkImageInfo_validRowBytes'>validRowBytes</a> 1984 1985<a name='SkImageInfo_computeOffset'></a> 1986 1987--- 1988 1989<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1990size_t <a href='#SkImageInfo_computeOffset'>computeOffset</a>(int x, int y, size_t rowBytes)const 1991</pre> 1992 1993Returns byte offset of <a href='undocumented#Pixel'>pixel</a> from <a href='undocumented#Pixel'>pixel</a> base address. 1994 1995Asserts in debug build if <a href='#SkImageInfo_computeOffset_x'>x</a> or <a href='#SkImageInfo_computeOffset_y'>y</a> is outside of bounds. Does not assert if 1996<a href='#SkImageInfo_computeOffset_rowBytes'>rowBytes</a> is smaller than <a href='#SkImageInfo_minRowBytes'>minRowBytes</a>(), even though result may be incorrect. 1997 1998### Parameters 1999 2000<table> <tr> <td><a name='SkImageInfo_computeOffset_x'><code><strong>x</strong></code></a></td> 2001 <td>column index, zero or greater, and less than <a href='#SkImageInfo_width'>width()</a></td> 2002 </tr> 2003 <tr> <td><a name='SkImageInfo_computeOffset_y'><code><strong>y</strong></code></a></td> 2004 <td>row index, zero or greater, and less than <a href='#SkImageInfo_height'>height()</a></td> 2005 </tr> 2006 <tr> <td><a name='SkImageInfo_computeOffset_rowBytes'><code><strong>rowBytes</strong></code></a></td> 2007 <td><a href='undocumented#Size'>size</a> of <a href='undocumented#Pixel'>pixel</a> row or larger</td> 2008 </tr> 2009</table> 2010 2011### Return Value 2012 2013offset within <a href='undocumented#Pixel'>pixel</a> array 2014 2015### Example 2016 2017<div><fiddle-embed name="818e4e1191e39d2a642902cbf253b399"></fiddle-embed></div> 2018 2019### See Also 2020 2021<a href='#SkImageInfo_height'>height</a> <a href='#SkImageInfo_width'>width</a> <a href='#SkImageInfo_minRowBytes'>minRowBytes</a> <a href='#SkImageInfo_computeByteSize'>computeByteSize</a> 2022 2023<a name='SkImageInfo_equal1_operator'></a> 2024 2025--- 2026 2027<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2028bool operator==(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& other)const 2029</pre> 2030 2031Compares <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> with <a href='#SkImageInfo_equal1_operator_other'>other</a>, and returns true if width, height, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, 2032<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, and <a href='undocumented#SkColorSpace'>SkColorSpace</a> are equivalent. 2033 2034### Parameters 2035 2036<table> <tr> <td><a name='SkImageInfo_equal1_operator_other'><code><strong>other</strong></code></a></td> 2037 <td><a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to compare</td> 2038 </tr> 2039</table> 2040 2041### Return Value 2042 2043true if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> equals <a href='#SkImageInfo_equal1_operator_other'>other</a> 2044 2045### Example 2046 2047<div><fiddle-embed name="53c212c4f2449df0b0eedbc6227b6ab7"> 2048 2049#### Example Output 2050 2051~~~~ 2052info1 != info2 2053info1 != info2 2054info1 != info2 2055info1 == info2 2056~~~~ 2057 2058</fiddle-embed></div> 2059 2060### See Also 2061 2062<a href='#SkImageInfo_notequal1_operator'>operator!=</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& <a href='#SkImageInfo_equal1_operator_other'>other</a>) const <a href='undocumented#SkColorSpace'>SkColorSpace</a>::<a href='#SkColorSpace_Equals'>Equals</a> 2063 2064<a name='SkImageInfo_notequal1_operator'></a> 2065 2066--- 2067 2068<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2069bool operator!=(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& other)const 2070</pre> 2071 2072Compares <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> with <a href='#SkImageInfo_notequal1_operator_other'>other</a>, and returns true if width, height, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, 2073<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a>, and <a href='undocumented#SkColorSpace'>SkColorSpace</a> are not equivalent. 2074 2075### Parameters 2076 2077<table> <tr> <td><a name='SkImageInfo_notequal1_operator_other'><code><strong>other</strong></code></a></td> 2078 <td><a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> to compare</td> 2079 </tr> 2080</table> 2081 2082### Return Value 2083 2084true if <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> is not equal to <a href='#SkImageInfo_notequal1_operator_other'>other</a> 2085 2086### Example 2087 2088<div><fiddle-embed name="8c039fde0a476ac1aa62bf9de5d61c77"> 2089 2090#### Example Output 2091 2092~~~~ 2093info1 != info2 2094info1 != info2 2095info1 != info2 2096info1 == info2 2097~~~~ 2098 2099</fiddle-embed></div> 2100 2101### See Also 2102 2103<a href='#SkImageInfo_equal1_operator'>operator==</a>(const <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a>& <a href='#SkImageInfo_notequal1_operator_other'>other</a>) const <a href='undocumented#SkColorSpace'>SkColorSpace</a>::<a href='#SkColorSpace_Equals'>Equals</a> 2104 2105<a name='SkImageInfo_computeByteSize'></a> 2106 2107--- 2108 2109<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2110size_t <a href='#SkImageInfo_computeByteSize'>computeByteSize</a>(size_t rowBytes)const 2111</pre> 2112 2113Returns storage required by <a href='undocumented#Pixel'>pixel</a> array, given <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> dimensions, <a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>, 2114and <a href='#SkImageInfo_computeByteSize_rowBytes'>rowBytes</a>. <a href='#SkImageInfo_computeByteSize_rowBytes'>rowBytes</a> is assumed to be at least as large as <a href='#SkImageInfo_minRowBytes'>minRowBytes</a>(). 2115 2116Returns zero if height is zero. 2117Returns SIZE_MAX if answer exceeds the range of size_t. 2118 2119### Parameters 2120 2121<table> <tr> <td><a name='SkImageInfo_computeByteSize_rowBytes'><code><strong>rowBytes</strong></code></a></td> 2122 <td><a href='undocumented#Size'>size</a> of <a href='undocumented#Pixel'>pixel</a> row or larger</td> 2123 </tr> 2124</table> 2125 2126### Return Value 2127 2128memory required by <a href='undocumented#Pixel'>pixel</a> buffer 2129 2130### Example 2131 2132<div><fiddle-embed name="9def507d2295f7051effd0c83bb04436"></fiddle-embed></div> 2133 2134### See Also 2135 2136<a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a> <a href='#SkImageInfo_validRowBytes'>validRowBytes</a> 2137 2138<a name='SkImageInfo_computeMinByteSize'></a> 2139 2140--- 2141 2142<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2143size_t <a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a>()const 2144</pre> 2145 2146Returns storage required by <a href='undocumented#Pixel'>pixel</a> array, given <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> dimensions, and 2147<a href='SkImageInfo_Reference#SkColorType'>SkColorType</a>. Uses <a href='#SkImageInfo_minRowBytes'>minRowBytes</a>() to compute bytes for <a href='undocumented#Pixel'>pixel</a> row. 2148 2149Returns zero if height is zero. 2150Returns SIZE_MAX if answer exceeds the range of size_t. 2151 2152### Return Value 2153 2154least memory required by <a href='undocumented#Pixel'>pixel</a> buffer 2155 2156### Example 2157 2158<div><fiddle-embed name="fc18640fdde437cb35338aed7c68d399"></fiddle-embed></div> 2159 2160### See Also 2161 2162<a href='#SkImageInfo_computeByteSize'>computeByteSize</a> <a href='#SkImageInfo_validRowBytes'>validRowBytes</a> 2163 2164<a name='SkImageInfo_ByteSizeOverflowed'></a> 2165 2166--- 2167 2168<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2169static bool <a href='#SkImageInfo_ByteSizeOverflowed'>ByteSizeOverflowed</a>(size_t byteSize) 2170</pre> 2171 2172Returns true if <a href='#SkImageInfo_ByteSizeOverflowed_byteSize'>byteSize</a> equals SIZE_MAX. <a href='#SkImageInfo_computeByteSize'>computeByteSize</a>() and 2173<a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a>() return SIZE_MAX if size_t can not hold buffer <a href='undocumented#Size'>size</a>. 2174 2175### Parameters 2176 2177<table> <tr> <td><a name='SkImageInfo_ByteSizeOverflowed_byteSize'><code><strong>byteSize</strong></code></a></td> 2178 <td>result of <a href='#SkImageInfo_computeByteSize'>computeByteSize</a>() or <a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a>()</td> 2179 </tr> 2180</table> 2181 2182### Return Value 2183 2184true if <a href='#SkImageInfo_computeByteSize'>computeByteSize</a>() or <a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a>() result exceeds size_t 2185 2186### Example 2187 2188<div><fiddle-embed name="6a63dfdd62ab77ff57783af8c33d7b78"> 2189 2190#### Example Output 2191 2192~~~~ 2193rowBytes:100000000 size:99999999900000008 overflowed:false 2194rowBytes:1000000000 size:999999999000000008 overflowed:false 2195rowBytes:10000000000 size:9999999990000000008 overflowed:false 2196rowBytes:100000000000 size:18446744073709551615 overflowed:true 2197rowBytes:1000000000000 size:18446744073709551615 overflowed:true 2198~~~~ 2199 2200</fiddle-embed></div> 2201 2202### See Also 2203 2204<a href='#SkImageInfo_computeByteSize'>computeByteSize</a> <a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a> <a href='#SkImageInfo_validRowBytes'>validRowBytes</a> 2205 2206<a name='SkImageInfo_validRowBytes'></a> 2207 2208--- 2209 2210<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2211bool <a href='#SkImageInfo_validRowBytes'>validRowBytes</a>(size_t rowBytes)const 2212</pre> 2213 2214Returns true if <a href='#SkImageInfo_validRowBytes_rowBytes'>rowBytes</a> is smaller than width times <a href='undocumented#Pixel'>pixel</a> <a href='undocumented#Size'>size</a>. 2215 2216### Parameters 2217 2218<table> <tr> <td><a name='SkImageInfo_validRowBytes_rowBytes'><code><strong>rowBytes</strong></code></a></td> 2219 <td><a href='undocumented#Size'>size</a> of <a href='undocumented#Pixel'>pixel</a> row or larger</td> 2220 </tr> 2221</table> 2222 2223### Return Value 2224 2225true if <a href='#SkImageInfo_validRowBytes_rowBytes'>rowBytes</a> is large enough to contain <a href='undocumented#Pixel'>pixel</a> row 2226 2227### Example 2228 2229<div><fiddle-embed name="c6b0f6a3f493cb08d9abcdefe12de245"> 2230 2231#### Example Output 2232 2233~~~~ 2234validRowBytes(60): false 2235validRowBytes(64): true 2236validRowBytes(68): true 2237~~~~ 2238 2239</fiddle-embed></div> 2240 2241### See Also 2242 2243<a href='#SkImageInfo_ByteSizeOverflowed'>ByteSizeOverflowed</a> <a href='#SkImageInfo_computeByteSize'>computeByteSize</a> <a href='#SkImageInfo_computeMinByteSize'>computeMinByteSize</a> 2244 2245<a name='SkImageInfo_reset'></a> 2246 2247--- 2248 2249<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2250void <a href='#SkImageInfo_reset'>reset()</a> 2251</pre> 2252 2253Creates an empty <a href='SkImageInfo_Reference#SkImageInfo'>SkImageInfo</a> with <a href='SkImageInfo_Reference#kUnknown_SkColorType'>kUnknown_SkColorType</a>, <a href='SkImageInfo_Reference#kUnknown_SkAlphaType'>kUnknown_SkAlphaType</a>, 2254a width and height of zero, and no <a href='undocumented#SkColorSpace'>SkColorSpace</a>. 2255 2256### Example 2257 2258<div><fiddle-embed name="ab7e73786805c936de386b6c1ebe1f13"> 2259 2260#### Example Output 2261 2262~~~~ 2263info == copy 2264info != reset copy 2265SkImageInfo() == reset copy 2266~~~~ 2267 2268</fiddle-embed></div> 2269 2270### See Also 2271 2272<a href='#SkImageInfo_empty_constructor'>SkImageInfo()</a> 2273 2274<a name='Utility'></a> 2275 2276<a name='SkImageInfo_validate'></a> 2277 2278--- 2279 2280<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2281void <a href='#SkImageInfo_validate'>validate()</a>const 2282</pre> 2283 2284### See Also 2285 2286<a href='#SkImageInfo_validRowBytes'>validRowBytes</a> <a href='SkBitmap_Reference#SkBitmap'>SkBitmap</a>::<a href='#SkBitmap_validate'>validate</a> 2287 2288