2017-09-14 15:25:39 +00:00
SkPixmap Reference
===
2018-05-16 11:07:07 +00:00
# <a name='Pixmap'>Pixmap</a>
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
# <a name='SkPixmap'>Class SkPixmap</a>
< a href = '#Pixmap' > Pixmap< / a > provides a utility to pair < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > with pixels and row bytes.
< a href = '#Pixmap' > Pixmap< / a > is a low level class which provides convenience functions to access
raster destinations. < a href = 'SkCanvas_Reference#Canvas' > Canvas< / a > can not draw < a href = '#Pixmap' > Pixmap< / a > , nor does < a href = '#Pixmap' > Pixmap< / a > provide
a direct drawing destination.
2018-02-01 14:37:32 +00:00
2018-05-16 11:07:07 +00:00
Use < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > to draw pixels referenced by < a href = '#Pixmap' > Pixmap< / a > ; use < a href = 'SkSurface_Reference#Surface' > Surface< / a > to draw into
pixels referenced by < a href = '#Pixmap' > Pixmap< / a > .
2018-02-01 14:37:32 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixmap' > Pixmap< / a > does not try to manage the lifetime of the pixel memory. Use < a href = 'undocumented#Pixel_Ref' > Pixel Ref< / a >
to manage pixel memory; < a href = 'undocumented#Pixel_Ref' > Pixel Ref< / a > is safe across threads.
## Overview
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Constructor' > Constructors</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > functions that construct < a href = '#SkPixmap' > SkPixmap</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Member_Function' > Functions</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > global and class member functions</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Related_Function' > Related Functions</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > similar member functions grouped together</ td >
< / tr >
< / table >
## <a name='Related_Function'>Related Function</a>
SkPixmap global, < code > struct< / code > , and < code > class< / code > related member functions share a topic.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Image_Info_Access' > Image Info Access</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns all or part of < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Initialization' > Initialization</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sets fields for use</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Pixels' > Pixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > read and write pixel values</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Readable_Address' > Readable Address</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns read only pixels</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Reader' > Reader</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > examine pixel value</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#Writable_Address' > Writable Address</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixels</ td >
< / tr >
< / table >
2018-02-01 14:37:32 +00:00
2018-05-16 11:07:07 +00:00
## <a name='Constructor'>Constructor</a>
SkPixmap can be constructed or initialized by these functions, including C++ class constructors.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_empty_constructor' > SkPixmap()</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > constructs with default values</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_const_SkImageInfo_const_star' > SkPixmap(const SkImageInfo& info, const void* addr, size t rowBytes)</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > constructs from < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a > , pixels</ td >
< / tr >
< / table >
## <a name='Member_Function'>Member Function</a>
SkPixmap member functions read and modify the structure properties.
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_addr' > addr</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns readable pixel address as void pointer</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_addr16' > addr16</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns readable pixel address as 16-bit pointer</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_addr32' > addr32</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns readable pixel address as 32-bit pointer</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_addr64' > addr64</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns readable pixel address as 64-bit pointer</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_addr8' > addr8</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns readable pixel address as 8-bit pointer</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_addrF16' > addrF16</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns readable pixel component address as 16-bit pointer</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_alphaType' > alphaType</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a > < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_bounds' > bounds</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns width and height as Rectangle</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_colorSpace' > colorSpace</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a > < a href = 'undocumented#Color_Space' > Color Space</ a ></ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_colorType' > colorType</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a > < a href = 'SkImageInfo_Reference#Color_Type' > Color Type</ a ></ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_computeByteSize' > computeByteSize</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns size required for pixels</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_computeIsOpaque' > computeIsOpaque</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns true if all pixels are opaque</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_erase' > erase</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > writes < a href = 'SkColor_Reference#Color' > Color</ a > to pixels</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_extractSubset' > extractSubset</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sets pointer to portion of original</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
2018-09-20 21:31:43 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_getAlphaf' > getAlphaf</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'SkColor_Reference#Alpha' > Alpha</ a > normalized from zero to one</ td >
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_getColor' > getColor</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns one pixel as < a href = 'undocumented#Unpremultiply' > Unpremultiplied</ a > < a href = 'SkColor_Reference#Color' > Color</ a ></ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_height' > height</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns pixel row count</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_info' > info</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a ></ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_isOpaque' > isOpaque</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns true if < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a > describes opaque pixels</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_readPixels' > readPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > copies and converts pixels</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_reset' > reset</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > reuses existing < a href = '#Pixmap' > Pixmap</ a > with replacement values</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_rowBytes' > rowBytes</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns interval between rows in bytes</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_rowBytesAsPixels' > rowBytesAsPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns interval between rows in pixels</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_scalePixels' > scalePixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > scales and converts pixels</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_setColorSpace' > setColorSpace</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > sets < a href = 'SkImageInfo_Reference#Image_Info' > Image Info</ a > < a href = 'undocumented#Color_Space' > Color Space</ a ></ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_shiftPerPixel' > shiftPerPixel</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns bit shift from pixels to bytes</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_width' > width</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns pixel column count</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_writable_addr' > writable addr</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixel address as void pointer</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_writable_addr16' > writable addr16</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixel address as 16-bit pointer</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_writable_addr32' > writable addr32</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixel address as 32-bit pointer</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_writable_addr64' > writable addr64</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixel address as 64-bit pointer</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_writable_addr8' > writable addr8</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixel address as 8-bit pointer</ td >
< / tr >
2018-09-20 21:31:43 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_writable_addrF16' > writable addrF16</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > returns writable pixel component address as 16-bit pointer</ td >
< / tr >
< / table >
## <a name='Initialization'>Initialization</a>
< a name = 'SkPixmap_empty_constructor' > < / a >
2017-09-14 15:25:39 +00:00
## SkPixmap
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = '#SkPixmap' > SkPixmap< / a > ()
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Creates an empty < a href = '#Pixmap' > Pixmap< / a > without pixels, with < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > , with
< a href = 'SkImageInfo_Reference#kUnknown_SkAlphaType' > kUnknown_SkAlphaType< / a > , and with a width and height of zero. Use
< a href = '#SkPixmap_reset' > reset< / a > to associate pixels, < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a > , < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > , width, and height
after < a href = '#Pixmap' > Pixmap< / a > has been created.
2017-09-14 15:25:39 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
empty < a href = '#Pixmap' > Pixmap< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-01-30 15:08:57 +00:00
< div > < fiddle-embed name = "9547e74a9d37553a667b913ffd1312dd" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_const_SkImageInfo_const_star' > SkPixmap(const SkImageInfo& info, const void* addr, size t rowBytes)< / a > < a href = '#SkPixmap_reset' > reset< / a > < sup > < a href = '#SkPixmap_reset_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_reset_3' > [3]< / a > < / sup > < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_const_SkImageInfo_const_star' > < / a >
2017-09-14 15:25:39 +00:00
## SkPixmap
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = '#SkPixmap' > SkPixmap< / a > (const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & info, const void* addr, size_t < a href = '#SkPixmap_rowBytes' > rowBytes< / a > )
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Creates < a href = '#Pixmap' > Pixmap< / a > from info width, height, < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > , and < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a > .
addr points to pixels, or nullptr. < a href = '#SkPixmap_rowBytes' > rowBytes< / a > should be info.< a href = '#SkPixmap_width' > width< / a > times
2018-01-26 17:56:22 +00:00
info.bytesPerPixel(), or larger.
2017-09-14 15:25:39 +00:00
No parameter checking is performed; it is up to the caller to ensure that
2018-05-16 11:07:07 +00:00
addr and < a href = '#SkPixmap_rowBytes' > rowBytes< / a > agree with info.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
The memory lifetime of pixels is managed by the caller. When < a href = '#Pixmap' > Pixmap< / a > goes
2018-01-26 17:56:22 +00:00
out of scope, addr is unaffected.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixmap' > Pixmap< / a > may be later modified by < a href = '#SkPixmap_reset' > reset< / a > to change its size, pixel type, or
2017-09-14 15:25:39 +00:00
storage.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_const_SkImageInfo_const_star_info' > < code > < strong > info< / strong > < / code > < / a > < / td >
< td > width, height, < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > , < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a > of < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_const_SkImageInfo_const_star_addr' > < code > < strong > addr< / strong > < / code > < / a > < / td >
< td > pointer to pixels allocated by caller; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_const_SkImageInfo_const_star_rowBytes' > < code > < strong > rowBytes< / strong > < / code > < / a > < / td >
< td > size of one row of addr; width times pixel size, or larger< / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
initialized < a href = '#Pixmap' > Pixmap< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "9a00774be57d7308313b3a9073e6e696" > < div > < a href = 'SkImage_Reference#SkImage_MakeRasterCopy' > SkImage::MakeRasterCopy< / a > takes const < a href = '#SkPixmap' > SkPixmap< / a > & as an argument. The example
constructs a < a href = '#SkPixmap' > SkPixmap< / a > from the brace-delimited parameters.
2018-03-05 18:26:16 +00:00
< / div >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
image alpha only = false
copy alpha only = true
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_empty_constructor' > SkPixmap()< / a > < a href = '#SkPixmap_reset' > reset< / a > < sup > < a href = '#SkPixmap_reset_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_reset_3' > [3]< / a > < / sup > < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_reset' > < / a >
2017-09-14 15:25:39 +00:00
## reset
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkPixmap_reset' > reset< / a > ()
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Sets width, height, row bytes to zero; pixel address to nullptr; < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a > to
< a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > ; and < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > to < a href = 'SkImageInfo_Reference#kUnknown_SkAlphaType' > kUnknown_SkAlphaType< / a > .
2017-09-14 15:25:39 +00:00
The prior pixels are unaffected; it is up to the caller to release pixels
memory if desired.
### Example
2018-07-16 12:12:01 +00:00
< div > < fiddle-embed name = "d9eb583c39f4f0baea79896b89245c98" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType
width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_empty_constructor' > SkPixmap()< / a > < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_reset_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkPixmap_reset' > reset< / a > (const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & info, const void* addr, size_t < a href = '#SkPixmap_rowBytes' > rowBytes< / a > )
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Sets width, height, < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > , and < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a > from info.
2018-01-26 17:56:22 +00:00
Sets pixel address from addr, which may be nullptr.
2018-05-16 11:07:07 +00:00
Sets row bytes from < a href = '#SkPixmap_rowBytes' > rowBytes< / a > , which should be info.< a href = '#SkPixmap_width' > width< / a > times
2018-01-26 17:56:22 +00:00
info.bytesPerPixel(), or larger.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Does not check addr. Asserts if built with SK_DEBUG defined and if < a href = '#SkPixmap_rowBytes' > rowBytes< / a > is
2018-01-04 21:11:51 +00:00
too small to hold one row of pixels.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
The memory lifetime pixels are managed by the caller. When < a href = '#Pixmap' > Pixmap< / a > goes
2018-01-26 17:56:22 +00:00
out of scope, addr is unaffected.
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_reset_2_info' > < code > < strong > info< / strong > < / code > < / a > < / td >
< td > width, height, < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > , < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a > of < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_reset_2_addr' > < code > < strong > addr< / strong > < / code > < / a > < / td >
< td > pointer to pixels allocated by caller; may be nullptr< / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_reset_2_rowBytes' > < code > < strong > rowBytes< / strong > < / code > < / a > < / td >
< td > size of one row of addr; width times pixel size, or larger< / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "9a392b753167cfa849cebeefd5a6e07d" > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_const_SkImageInfo_const_star' > SkPixmap(const SkImageInfo& info, const void* addr, size t rowBytes)< / a > < a href = '#SkPixmap_reset' > reset< / a > < sup > < a href = '#SkPixmap_reset_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_reset_3' > [3]< / a > < / sup > < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > < a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_setColorSpace' > < / a >
2017-09-14 15:25:39 +00:00
## setColorSpace
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void < a href = '#SkPixmap_setColorSpace' > setColorSpace< / a > (< a href = 'undocumented#sk_sp' > sk sp< / a > < < a href = 'undocumented#SkColorSpace' > SkColorSpace< / a > > < a href = '#SkPixmap_colorSpace' > colorSpace< / a > )
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Changes < a href = 'undocumented#Color_Space' > Color Space< / a > in < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > ; preserves width, height, < a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > , and
< a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a > in < a href = 'SkImage_Reference#Image' > Image< / a > , and leaves pixel address and row bytes unchanged.
< a href = 'undocumented#Color_Space' > Color Space< / a > reference count is incremented.
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_setColorSpace_colorSpace' > < code > < strong > colorSpace< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Color_Space' > Color Space< / a > moved to < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "30d70aec4de17c831dba71e03dc9664a" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
is unique
is not unique
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Color_Space' > Color Space< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_makeColorSpace' > SkImageInfo::makeColorSpace< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_reset_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool SK_WARN_UNUSED_RESULT < a href = '#SkPixmap_reset' > reset< / a > (const < a href = 'undocumented#SkMask' > SkMask< / a > & mask)
2017-09-14 15:25:39 +00:00
< / pre >
2018-09-06 16:47:04 +00:00
To be deprecated soon.
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_extractSubset' > < / a >
2017-09-14 15:25:39 +00:00
## extractSubset
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool SK_WARN_UNUSED_RESULT < a href = '#SkPixmap_extractSubset' > extractSubset< / a > (< a href = '#SkPixmap' > SkPixmap< / a > * subset, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & area) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Sets < a href = '#SkPixmap_extractSubset_subset' > subset< / a > width, height, pixel address to intersection of < a href = '#Pixmap' > Pixmap< / a > with < a href = '#SkPixmap_extractSubset_area' > area< / a > ,
if intersection is not empty; and return true. Otherwise, leave < a href = '#SkPixmap_extractSubset_subset' > subset< / a > unchanged
2018-01-04 21:11:51 +00:00
and return false.
2017-09-14 15:25:39 +00:00
Failing to read the return value generates a compile time warning.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_extractSubset_subset' > < code > < strong > subset< / strong > < / code > < / a > < / td >
< td > storage for width, height, pixel address of intersection< / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_extractSubset_area' > < code > < strong > area< / strong > < / code > < / a > < / td >
< td > bounds to intersect with < a href = '#Pixmap' > Pixmap< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if intersection of < a href = '#Pixmap' > Pixmap< / a > and < a href = '#SkPixmap_extractSubset_area' > area< / a > is not empty
2017-09-14 15:25:39 +00:00
### Example
< div > < fiddle-embed name = "febdbfac6cf4cde69837643be2e1f6dd" > < / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_reset' > reset< / a > < sup > < a href = '#SkPixmap_reset_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_reset_3' > [3]< / a > < / sup > < a href = 'SkIRect_Reference#SkIRect_intersect' > SkIRect::intersect< / a > < sup > < a href = 'SkIRect_Reference#SkIRect_intersect_2' > [2]< / a > < / sup > < sup > < a href = 'SkIRect_Reference#SkIRect_intersect_3' > [3]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Image_Info_Access'>Image Info Access</a>
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_info' > < / a >
2017-09-14 15:25:39 +00:00
## info
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & < a href = '#SkPixmap_info' > info< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns width, height, < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , and < a href = 'undocumented#Color_Space' > Color Space< / a > .
2017-09-14 15:25:39 +00:00
### Return Value
reference to ImageInfo
### Example
2018-07-04 05:33:26 +00:00
< div > < fiddle-embed name = "6e0f558bf7fabc655041116288559134" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
width: 384 height: 384 color: BGRA_8888 alpha: Opaque
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_rowBytes' > < / a >
2017-09-14 15:25:39 +00:00
## rowBytes
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
size_t < a href = '#SkPixmap_rowBytes' > rowBytes< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns row bytes, the interval from one pixel row to the next. Row bytes
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
is at least as large as: < code >< a href = '#SkPixmap_width' > width</ a > \* < a href = '#SkPixmap_info' > info</ a > \.bytesPerPixel()</ code > .
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Returns zero if < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > .
It is up to the < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > creator to ensure that row bytes is a useful value.
2017-09-14 15:25:39 +00:00
### Return Value
byte length of pixel row
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "19ac8bb81854680bd408fec8cb797d5c" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
rowBytes: 2 minRowBytes: 4
rowBytes: 8 minRowBytes: 4
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_info' > info< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_minRowBytes' > SkImageInfo::minRowBytes< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr' > < / a >
2017-09-14 15:25:39 +00:00
## addr
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const void* < a href = '#SkPixmap_addr' > addr< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
2017-09-21 16:31:06 +00:00
Returns pixel address, the base address corresponding to the pixel origin.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
It is up to the < a href = '#Pixmap' > Pixmap< / a > creator to ensure that pixel address is a useful value.
2017-09-14 15:25:39 +00:00
### Return Value
pixel address
### Example
< div > < fiddle-embed name = "17bcabaaee2dbb7beba562e9ca50b55e" >
#### Example Output
~~~~
#Volatile
pixels address: 0x7f2a440bb010
inset address: 0x7f2a440fb210
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr_2' > addr(int x, int y)< / a > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_info' > info< / a > < a href = '#SkPixmap_rowBytes' > rowBytes< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_width' > < / a >
2017-09-14 15:25:39 +00:00
## width
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkPixmap_width' > width< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns pixel count in each pixel row. Should be equal or less than:
2017-10-26 11:58:48 +00:00
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
< code >< a href = '#SkPixmap_rowBytes' > rowBytes</ a > / < a href = '#SkPixmap_info' > info</ a > \.bytesPerPixel()</ code > .
2017-09-14 15:25:39 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
pixel width in < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-07-19 03:49:13 +00:00
< div > < fiddle-embed name = "f68617b7153a20b2ed3d7f9ed5c6e5e4" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
pixmap width: 16 info width: 16
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_height' > height< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_width' > SkImageInfo::width()< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_height' > < / a >
2017-09-14 15:25:39 +00:00
## height
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkPixmap_height' > height< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns pixel row count.
### Return Value
2018-05-16 11:07:07 +00:00
pixel height in < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a >
2017-09-14 15:25:39 +00:00
### Example
2017-10-04 18:31:33 +00:00
< div > < fiddle-embed name = "4a996d32122f469d51ddd0186efb48cc" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
pixmap height: 32 info height: 32
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_width' > width< / a > ImageInfo::height()
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_colorType' > < / a >
2017-09-14 15:25:39 +00:00
## colorType
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'SkImageInfo_Reference#SkColorType' > SkColorType< / a > < a href = '#SkPixmap_colorType' > colorType< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns < a href = 'SkImageInfo_Reference#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 > ,
< 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 > ,
< 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 > ,
< a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , < a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > .
2017-09-14 15:25:39 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > in < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-01-30 15:08:57 +00:00
< div > < fiddle-embed name = "0ab5c7af272685f2ce177cc79e6b9457" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
2018-01-30 15:08:57 +00:00
color type: kAlpha_8_SkColorType
2017-09-14 15:25:39 +00:00
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_alphaType' > alphaType< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_colorType' > SkImageInfo::colorType< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_alphaType' > < / a >
2017-09-14 15:25:39 +00:00
## alphaType
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'SkImageInfo_Reference#SkAlphaType' > SkAlphaType< / a > < a href = '#SkPixmap_alphaType' > alphaType< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns < a href = 'SkImageInfo_Reference#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 > ,
< a href = 'SkImageInfo_Reference#kUnpremul_SkAlphaType' > kUnpremul_SkAlphaType< / a > .
2017-09-14 15:25:39 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > in < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "070b1a60232be499eb10c6ea62371804" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
alpha type: kPremul_SkAlphaType
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_colorType' > colorType< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_alphaType' > SkImageInfo::alphaType< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_colorSpace' > < / a >
2017-09-14 15:25:39 +00:00
## colorSpace
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'undocumented#SkColorSpace' > SkColorSpace< / a > * < a href = '#SkPixmap_colorSpace' > colorSpace< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns < a href = 'undocumented#Color_Space' > Color Space< / a > , the range of colors, associated with < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > . The
reference count of < a href = 'undocumented#Color_Space' > Color Space< / a > is unchanged. The returned < a href = 'undocumented#Color_Space' > Color Space< / a > is
2017-10-04 18:31:33 +00:00
immutable.
2017-09-14 15:25:39 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Color_Space' > Color Space< / a > in < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > , or nullptr
2017-09-14 15:25:39 +00:00
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "3421bb20a302d563832ba7bb45e0cc58" > < div > < a href = 'undocumented#SkColorSpace_MakeSRGBLinear' > SkColorSpace::MakeSRGBLinear< / a > creates < a href = 'undocumented#Color_Space' > Color Space< / a > with linear gamma
and an sRGB gamut. This < a href = 'undocumented#Color_Space' > Color Space< / a > gamma is not close to sRGB gamma.
2018-03-05 18:26:16 +00:00
< / div >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Color_Space' > Color Space< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_colorSpace' > SkImageInfo::colorSpace< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_isOpaque' > < / a >
2017-09-14 15:25:39 +00:00
## isOpaque
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkPixmap_isOpaque' > isOpaque< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns true if < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > is < a href = 'SkImageInfo_Reference#kOpaque_SkAlphaType' > kOpaque_SkAlphaType< / a > .
Does not check if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > allows < a href = 'SkColor_Reference#Alpha' > Alpha< / a > , or if any pixel value has
2017-10-04 18:31:33 +00:00
transparency.
2017-09-14 15:25:39 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
true if < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > has opaque < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "efd083f121e888a523455ea8a49e50d1" > < div > < a href = '#SkPixmap_isOpaque' > isOpaque< / a > ignores whether all pixels are opaque or not.
2018-03-05 18:26:16 +00:00
< / div >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
isOpaque: false
isOpaque: false
isOpaque: true
isOpaque: true
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_computeIsOpaque' > computeIsOpaque< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_isOpaque' > SkImageInfo::isOpaque< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_bounds' > < / a >
2017-09-14 15:25:39 +00:00
## bounds
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > < a href = '#SkPixmap_bounds' > bounds< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns < a href = 'SkIRect_Reference#IRect' > IRect< / a > { 0, 0, < a href = '#SkPixmap_width' > width< / a > , < a href = '#SkPixmap_height' > height< / a > }.
2017-09-14 15:25:39 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
integral rectangle from origin to < a href = '#SkPixmap_width' > width< / a > and < a href = '#SkPixmap_height' > height< / a >
2017-09-14 15:25:39 +00:00
### Example
< div > < fiddle-embed name = "79750fb1d898a4e5c8c828b7bc9acec5" >
#### Example Output
~~~~
width: 0 height: 0 empty: true
width: 0 height: 2 empty: true
width: 2 height: 0 empty: true
width: 2 height: 2 empty: false
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_height' > height< / a > < a href = '#SkPixmap_width' > width< / a > < a href = 'SkIRect_Reference#IRect' > IRect< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_rowBytesAsPixels' > < / a >
2017-09-14 15:25:39 +00:00
## rowBytesAsPixels
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkPixmap_rowBytesAsPixels' > rowBytesAsPixels< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns number of pixels that fit on row. Should be greater than or equal to
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_width' > width< / a > .
2017-09-14 15:25:39 +00:00
### Return Value
maximum pixels per row
### Example
< div > < fiddle-embed name = "6231bb212d0c231b5bc44eac626fbcb5" >
#### Example Output
~~~~
rowBytes: 4 rowBytesAsPixels: 1
rowBytes: 5 rowBytesAsPixels: 1
rowBytes: 6 rowBytesAsPixels: 1
rowBytes: 7 rowBytesAsPixels: 1
rowBytes: 8 rowBytesAsPixels: 2
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_rowBytes' > rowBytes< / a > < a href = '#SkPixmap_shiftPerPixel' > shiftPerPixel< / a > < a href = '#SkPixmap_width' > width< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_bytesPerPixel' > SkImageInfo::bytesPerPixel< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_shiftPerPixel' > < / a >
2017-09-14 15:25:39 +00:00
## shiftPerPixel
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
int < a href = '#SkPixmap_shiftPerPixel' > shiftPerPixel< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns bit shift converting row bytes to row pixels.
2018-05-16 11:07:07 +00:00
Returns zero for < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > .
2017-09-14 15:25:39 +00:00
### Return Value
one of: 0, 1, 2, 3; left shift to convert pixels to bytes
### Example
2018-05-16 11:07:07 +00:00
< div > < fiddle-embed name = "bf31ee140e2c163c3957276e6d4c4f0c" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
color: kUnknown_SkColorType bytesPerPixel: 0 shiftPerPixel: 0
2018-01-30 15:08:57 +00:00
color: kAlpha_8_SkColorType bytesPerPixel: 1 shiftPerPixel: 0
2017-09-14 15:25:39 +00:00
color: kRGB_565_SkColorType bytesPerPixel: 2 shiftPerPixel: 1
color: kARGB_4444_SkColorType bytesPerPixel: 2 shiftPerPixel: 1
color: kRGBA_8888_SkColorType bytesPerPixel: 4 shiftPerPixel: 2
color: kBGRA_8888_SkColorType bytesPerPixel: 4 shiftPerPixel: 2
color: kGray_8_SkColorType bytesPerPixel: 1 shiftPerPixel: 0
color: kRGBA_F16_SkColorType bytesPerPixel: 8 shiftPerPixel: 3
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_rowBytes' > rowBytes< / a > < a href = '#SkPixmap_rowBytesAsPixels' > rowBytesAsPixels< / a > < a href = '#SkPixmap_width' > width< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_bytesPerPixel' > SkImageInfo::bytesPerPixel< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_computeByteSize' > < / a >
2017-10-04 18:31:33 +00:00
## computeByteSize
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
size_t < a href = '#SkPixmap_computeByteSize' > computeByteSize< / a > () const
2017-10-04 18:31:33 +00:00
< / pre >
Returns minimum memory required for pixel storage.
2018-05-16 11:07:07 +00:00
Does not include unused memory on last row when < a href = '#SkPixmap_rowBytesAsPixels' > rowBytesAsPixels< / a > exceeds < a href = '#SkPixmap_width' > width< / a > .
2017-10-04 18:31:33 +00:00
Returns zero if result does not fit in size_t.
2018-05-16 11:07:07 +00:00
Returns zero if < a href = '#SkPixmap_height' > height< / a > or < a href = '#SkPixmap_width' > width< / a > is 0.
Returns < a href = '#SkPixmap_height' > height< / a > times < a href = '#SkPixmap_rowBytes' > rowBytes< / a > if < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > .
2017-10-04 18:31:33 +00:00
### Return Value
size in bytes of image buffer
2017-09-14 15:25:39 +00:00
### Example
2018-07-12 12:40:13 +00:00
< div > < fiddle-embed name = "410d14ddc45d272598c5a4e52bb047de" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
2017-10-04 18:31:33 +00:00
width: 1 height: 1 computeByteSize: 4
width: 1 height: 1000 computeByteSize: 4999
width: 1 height: 1000000 computeByteSize: 4999999
width: 1000 height: 1 computeByteSize: 4000
width: 1000 height: 1000 computeByteSize: 4999000
width: 1000 height: 1000000 computeByteSize: 4999999000
width: 1000000 height: 1 computeByteSize: 4000000
width: 1000000 height: 1000 computeByteSize: 4999000000
width: 1000000 height: 1000000 computeByteSize: 4999999000000
2017-09-14 15:25:39 +00:00
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#SkImageInfo_computeByteSize' > SkImageInfo::computeByteSize< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Reader'>Reader</a>
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_computeIsOpaque' > < / a >
2017-09-14 15:25:39 +00:00
## computeIsOpaque
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkPixmap_computeIsOpaque' > computeIsOpaque< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns true if all pixels are opaque. < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > determines how pixels
are encoded, and whether pixel describes < a href = 'SkColor_Reference#Alpha' > Alpha< / a > . Returns true for < a href = 'SkImageInfo_Reference#Color_Type' > Color Types< / a >
without alpha in each pixel; for other < a href = 'SkImageInfo_Reference#Color_Type' > Color Types< / a > , returns true if all
2017-09-14 15:25:39 +00:00
pixels have alpha values equivalent to 1.0 or greater.
2018-05-16 11:07:07 +00:00
For < a href = 'SkImageInfo_Reference#Color_Type' > Color Types< / a > < a href = 'SkImageInfo_Reference#kRGB_565_SkColorType' > kRGB_565_SkColorType< / a > or < a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > : always
returns true. For < a href = 'SkImageInfo_Reference#Color_Type' > Color Types< / a > < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > , < a href = 'SkImageInfo_Reference#kBGRA_8888_SkColorType' > kBGRA_8888_SkColorType< / a > ,
< a href = 'SkImageInfo_Reference#kRGBA_8888_SkColorType' > kRGBA_8888_SkColorType< / a > : returns true if all pixel < a href = 'SkColor_Reference#Alpha' > Alpha< / a > values are 255.
For < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > < a href = 'SkImageInfo_Reference#kARGB_4444_SkColorType' > kARGB_4444_SkColorType< / a > : returns true if all pixel < a href = 'SkColor_Reference#Alpha' > Alpha< / a > values are 15.
For < a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > : returns true if all pixel < a href = 'SkColor_Reference#Alpha' > Alpha< / a > values are 1.0 or
2017-09-14 15:25:39 +00:00
greater.
2018-05-16 11:07:07 +00:00
Returns false for < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > .
2017-09-14 15:25:39 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
true if all pixels have opaque values or < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is opaque
2017-09-14 15:25:39 +00:00
### Example
2018-07-09 05:28:19 +00:00
< div > < fiddle-embed name = "6ef37d5be03d0bfaec992dbb5a94c66f" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
computeIsOpaque: false
computeIsOpaque: true
computeIsOpaque: false
computeIsOpaque: true
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_isOpaque' > isOpaque< / a > < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > < a href = 'SkColor_Reference#Alpha' > Alpha< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_getColor' > < / a >
2017-09-14 15:25:39 +00:00
## getColor
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
< a href = 'SkColor_Reference#SkColor' > SkColor< / a > < a href = '#SkPixmap_getColor' > getColor< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns pixel at (< a href = '#SkPixmap_getColor_x' > x< / a > , < a href = '#SkPixmap_getColor_y' > y< / a > ) as < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > < a href = 'SkColor_Reference#Color' > Color< / a > .
Returns black with < a href = 'SkColor_Reference#Alpha' > Alpha< / a > if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > .
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Input is not validated: out of bounds values of < a href = '#SkPixmap_getColor_x' > x< / a > or < a href = '#SkPixmap_getColor_y' > y< / a > trigger an assert() if
2018-01-04 21:11:51 +00:00
built with SK_DEBUG defined; and returns undefined values or may crash if
2018-05-16 11:07:07 +00:00
SK_RELEASE is defined. Fails if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > or
2017-09-14 15:25:39 +00:00
pixel address is nullptr.
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Color_Space' > Color Space< / a > in < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > is ignored. Some < a href = 'SkColor_Reference#Color' > Color< / a > precision may be lost in the
conversion to < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > < a href = 'SkColor_Reference#Color' > Color< / a > ; original pixel data may have additional
2017-09-14 15:25:39 +00:00
precision.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_getColor_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_getColor_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
pixel converted to < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > < a href = 'SkColor_Reference#Color' > Color< / a >
2017-09-14 15:25:39 +00:00
### Example
< div > < fiddle-embed name = "94ad244056dc80ecd87daae004266334" >
#### Example Output
~~~~
Premultiplied:
(0, 0) 0x00000000 0x2a0e002a 0x55380055 0x7f7f007f
(0, 1) 0x2a000e2a 0x551c1c55 0x7f542a7f 0xaaaa38aa
(0, 2) 0x55003855 0x7f2a547f 0xaa7171aa 0xd4d48dd4
(0, 3) 0x7f007f7f 0xaa38aaaa 0xd48dd4d4 0xffffffff
Unpremultiplied:
(0, 0) 0x00000000 0x2a5500ff 0x55a800ff 0x7fff00ff
(0, 1) 0x2a0055ff 0x555454ff 0x7fa954ff 0xaaff54ff
(0, 2) 0x5500a8ff 0x7f54a9ff 0xaaaaaaff 0xd4ffaaff
(0, 3) 0x7f00ffff 0xaa54ffff 0xd4aaffff 0xffffffff
~~~~
< / fiddle-embed > < / div >
### See Also
2018-09-20 21:31:43 +00:00
< a href = '#SkPixmap_getAlphaf' > getAlphaf< / a > < a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_readPixels' > readPixels< / a > < sup > < a href = '#SkPixmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_readPixels_3' > [3]< / a > < / sup > < sup > < a href = '#SkPixmap_readPixels_4' > [4]< / a > < / sup >
---
< a name = 'SkPixmap_getAlphaf' > < / a >
## getAlphaf
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
float < a href = '#SkPixmap_getAlphaf' > getAlphaf< / a > (int x, int y) const
< / pre >
Looks up the pixel at (< a href = '#SkPixmap_getAlphaf_x' > x< / a > ,< a href = '#SkPixmap_getAlphaf_y' > y< / a > ) and return its alpha component, normalized to [0..1].
This is roughly equivalent to < code > SkGetColorA(getColor()\)</ code > , but can be more efficent
(and more precise if the pixels store more than 8 bits per component).
### Parameters
< table > < tr > < td > < a name = 'SkPixmap_getAlphaf_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_getAlphaf_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
< / tr >
< / table >
### Return Value
alpha converted to normalized float
### See Also
< a href = '#SkPixmap_getColor' > getColor< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Readable_Address'>Readable Address</a>
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const void* < a href = '#SkPixmap_addr' > addr< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns readable pixel address at (< a href = '#SkPixmap_addr_2_x' > x< / a > , < a href = '#SkPixmap_addr_2_y' > y< / a > ). Returns nullptr if < a href = 'undocumented#Pixel_Ref' > Pixel Ref< / a > is nullptr.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Input is not validated: out of bounds values of < a href = '#SkPixmap_addr_2_x' > x< / a > or < a href = '#SkPixmap_addr_2_y' > y< / a > trigger an assert() if
built with SK_DEBUG defined. Returns nullptr if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > .
2017-10-04 18:31:33 +00:00
2018-01-04 21:11:51 +00:00
Performs a lookup of pixel size; for better performance, call
2018-05-16 11:07:07 +00:00
one of: < a href = '#SkPixmap_addr8' > addr8< / a > , < a href = '#SkPixmap_addr16' > addr16< / a > , < a href = '#SkPixmap_addr32' > addr32< / a > , < a href = '#SkPixmap_addr64' > addr64< / a > , or < a href = '#SkPixmap_addrF16' > addrF16< / a > .
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_addr_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_addr_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
readable generic pointer to pixel
### Example
< div > < fiddle-embed name = "6e6e29e860eafed77308c973400cc84d" >
#### Example Output
~~~~
pixmap.addr(1, 2) == & storage[1 + 2 * w]
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_getAddr' > SkBitmap::getAddr< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr8' > < / a >
2017-09-14 15:25:39 +00:00
## addr8
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint8_t* < a href = '#SkPixmap_addr8' > addr8< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns readable base pixel address. Result is addressable as unsigned 8-bit bytes.
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > or
< a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
One byte corresponds to one pixel.
### Return Value
readable unsigned 8-bit pointer to pixels
### Example
2018-07-04 05:33:26 +00:00
< div > < fiddle-embed name = "9adda80b2dd1b08ec5ccf66da7c8bd91" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
pixmap.addr8() == storage
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr8' > writable addr8< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr16' > < / a >
2017-09-14 15:25:39 +00:00
## addr16
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint16_t* < a href = '#SkPixmap_addr16' > addr16< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns readable base pixel address. Result is addressable as unsigned 16-bit words.
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGB_565_SkColorType' > kRGB_565_SkColorType< / a > or
< a href = 'SkImageInfo_Reference#kARGB_4444_SkColorType' > kARGB_4444_SkColorType< / a > , and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
One word corresponds to one pixel.
### Return Value
readable unsigned 16-bit pointer to pixels
### Example
< div > < fiddle-embed name = "9b16012d265c954c6de13f3fc960da52" >
#### Example Output
~~~~
pixmap.addr16() == storage
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr16' > writable addr16< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr32' > < / a >
2017-09-14 15:25:39 +00:00
## addr32
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint32_t* < a href = '#SkPixmap_addr32' > addr32< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns readable base pixel address. Result is addressable as unsigned 32-bit words.
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGBA_8888_SkColorType' > kRGBA_8888_SkColorType< / a > or
< a href = 'SkImageInfo_Reference#kBGRA_8888_SkColorType' > kBGRA_8888_SkColorType< / a > , and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
One word corresponds to one pixel.
### Return Value
readable unsigned 32-bit pointer to pixels
### Example
< div > < fiddle-embed name = "6b90c7ae9f254fe4ea9ef638f893a3e6" >
#### Example Output
~~~~
pixmap.addr32() == storage
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr32' > writable addr32< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr64' > < / a >
2017-09-14 15:25:39 +00:00
## addr64
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint64_t* < a href = '#SkPixmap_addr64' > addr64< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns readable base pixel address. Result is addressable as unsigned 64-bit words.
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > and is built
2018-01-04 21:11:51 +00:00
with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
One word corresponds to one pixel.
### Return Value
readable unsigned 64-bit pointer to pixels
### Example
< div > < fiddle-embed name = "0d17085a4698a8a2e2235fad9041b4b4" >
#### Example Output
~~~~
pixmap.addr64() == storage
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addrF16' > < / a >
2017-09-14 15:25:39 +00:00
## addrF16
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint16_t* < a href = '#SkPixmap_addrF16' > addrF16< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns readable base pixel address. Result is addressable as unsigned 16-bit words.
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > and is built
2018-01-04 21:11:51 +00:00
with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
Each word represents one color component encoded as a half float.
Four words correspond to one pixel.
### Return Value
readable unsigned 16-bit pointer to first component of pixels
### Example
< div > < fiddle-embed name = "54e8525a592f05623c33b375aebc90c1" >
#### Example Output
~~~~
pixmap.addrF16() == storage
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr8_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint8_t* < a href = '#SkPixmap_addr8' > addr8< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns readable pixel address at (< a href = '#SkPixmap_addr8_2_x' > x< / a > , < a href = '#SkPixmap_addr8_2_y' > y< / a > ).
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Input is not validated: out of bounds values of < a href = '#SkPixmap_addr8_2_x' > x< / a > or < a href = '#SkPixmap_addr8_2_y' > y< / a > trigger an assert() if
2018-01-04 21:11:51 +00:00
built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > or
< a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_addr8_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_addr8_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
readable unsigned 8-bit pointer to pixel at (< a href = '#SkPixmap_addr8_2_x' > x< / a > , < a href = '#SkPixmap_addr8_2_y' > y< / a > )
2017-09-14 15:25:39 +00:00
### Example
2018-07-16 05:29:00 +00:00
< div > < fiddle-embed name = "5b986272268ef2c52045c1856f8b6107" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
pixmap.addr8(1, 2) == & storage[1 + 2 * w]
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr8' > writable addr8< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr16_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint16_t* < a href = '#SkPixmap_addr16' > addr16< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns readable pixel address at (< a href = '#SkPixmap_addr16_2_x' > x< / a > , < a href = '#SkPixmap_addr16_2_y' > y< / a > ).
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Input is not validated: out of bounds values of < a href = '#SkPixmap_addr16_2_x' > x< / a > or < a href = '#SkPixmap_addr16_2_y' > y< / a > trigger an assert() if
2018-01-04 21:11:51 +00:00
built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGB_565_SkColorType' > kRGB_565_SkColorType< / a > or
< a href = 'SkImageInfo_Reference#kARGB_4444_SkColorType' > kARGB_4444_SkColorType< / a > , and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_addr16_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_addr16_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
readable unsigned 16-bit pointer to pixel at (< a href = '#SkPixmap_addr16_2_x' > x< / a > , < a href = '#SkPixmap_addr16_2_y' > y< / a > )
2017-09-14 15:25:39 +00:00
### Example
2018-07-19 14:50:44 +00:00
< div > < fiddle-embed name = "2c0c88a546d4ef093ab63ff72dac00b9" >
2017-09-14 15:25:39 +00:00
#### Example Output
~~~~
pixmap.addr16(1, 2) == & storage[1 + 2 * w]
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr16' > writable addr16< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr32_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint32_t* < a href = '#SkPixmap_addr32' > addr32< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns readable pixel address at (< a href = '#SkPixmap_addr32_2_x' > x< / a > , < a href = '#SkPixmap_addr32_2_y' > y< / a > ).
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Input is not validated: out of bounds values of < a href = '#SkPixmap_addr32_2_x' > x< / a > or < a href = '#SkPixmap_addr32_2_y' > y< / a > trigger an assert() if
2018-01-04 21:11:51 +00:00
built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGBA_8888_SkColorType' > kRGBA_8888_SkColorType< / a > or
< a href = 'SkImageInfo_Reference#kBGRA_8888_SkColorType' > kBGRA_8888_SkColorType< / a > , and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_addr32_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_addr32_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
readable unsigned 32-bit pointer to pixel at (< a href = '#SkPixmap_addr32_2_x' > x< / a > , < a href = '#SkPixmap_addr32_2_y' > y< / a > )
2017-09-14 15:25:39 +00:00
### Example
< div > < fiddle-embed name = "12f8b5ce9fb25604f33df336677f5d62" >
#### Example Output
~~~~
pixmap.addr32(1, 2) == & storage[1 + 2 * w]
~~~~
< / fiddle-embed > < / div >
2017-11-02 21:49:34 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a >
2017-11-02 21:49:34 +00:00
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addr64_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint64_t* < a href = '#SkPixmap_addr64' > addr64< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns readable pixel address at (< a href = '#SkPixmap_addr64_2_x' > x< / a > , < a href = '#SkPixmap_addr64_2_y' > y< / a > ).
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Input is not validated: out of bounds values of < a href = '#SkPixmap_addr64_2_x' > x< / a > or < a href = '#SkPixmap_addr64_2_y' > y< / a > trigger an assert() if
2018-01-04 21:11:51 +00:00
built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > and is built
2018-01-04 21:11:51 +00:00
with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_addr64_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_addr64_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
readable unsigned 64-bit pointer to pixel at (< a href = '#SkPixmap_addr64_2_x' > x< / a > , < a href = '#SkPixmap_addr64_2_y' > y< / a > )
2017-09-14 15:25:39 +00:00
### Example
< div > < fiddle-embed name = "5449f65fd7673273b0b57807fd3117ff" >
#### Example Output
~~~~
pixmap.addr64(1, 2) == & storage[1 + 2 * w]
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_addrF16_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
const uint16_t* < a href = '#SkPixmap_addrF16' > addrF16< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns readable pixel address at (< a href = '#SkPixmap_addrF16_2_x' > x< / a > , < a href = '#SkPixmap_addrF16_2_y' > y< / a > ).
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Input is not validated: out of bounds values of < a href = '#SkPixmap_addrF16_2_x' > x< / a > or < a href = '#SkPixmap_addrF16_2_y' > y< / a > trigger an assert() if
2018-01-04 21:11:51 +00:00
built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > and is built
2018-01-04 21:11:51 +00:00
with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
Each unsigned 16-bit word represents one color component encoded as a half float.
Four words correspond to one pixel.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_addrF16_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_addrF16_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
readable unsigned 16-bit pointer to pixel component at (< a href = '#SkPixmap_addrF16_2_x' > x< / a > , < a href = '#SkPixmap_addrF16_2_y' > y< / a > )
2017-09-14 15:25:39 +00:00
### Example
< div > < fiddle-embed name = "f6076cad455bc80af5d06eb121d3b6f2" >
#### Example Output
~~~~
pixmap.addrF16(1, 2) == & storage[1 * wordsPerPixel + 2 * rowWords]
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup > < a href = '#SkPixmap_getColor' > getColor< / a > < a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Writable_Address'>Writable Address</a>
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_writable_addr' > < / a >
2017-09-14 15:25:39 +00:00
## writable_addr
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void* < a href = '#SkPixmap_writable_addr' > writable addr< / a > () const
2017-09-14 15:25:39 +00:00
< / pre >
Returns writable base pixel address.
### Return Value
writable generic base pointer to pixels
### Example
< div > < fiddle-embed name = "74ef460f89ed5904334d0f8883e781c4" >
#### Example Output
~~~~
pixmap.writable_addr() == (void *)storage
pixmap.getColor(0, 1) == 0x00000000
pixmap.getColor(0, 0) == 0xFFFFFFFF
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_writable_addr8' > writable addr8< / a > < a href = '#SkPixmap_writable_addr16' > writable addr16< / a > < a href = '#SkPixmap_writable_addr32' > writable addr32< / a > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a > < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a > < a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_writable_addr_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
void* < a href = '#SkPixmap_writable_addr' > writable addr< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns writable pixel address at (< a href = '#SkPixmap_writable_addr_2_x' > x< / a > , < a href = '#SkPixmap_writable_addr_2_y' > y< / a > ).
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Input is not validated: out of bounds values of < a href = '#SkPixmap_writable_addr_2_x' > x< / a > or < a href = '#SkPixmap_writable_addr_2_y' > y< / a > trigger an assert() if
built with SK_DEBUG defined. Returns zero if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > .
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_writable_addr_2_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_writable_addr_2_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
writable generic pointer to pixel
### Example
< div > < fiddle-embed name = "559eaca89c765bc8466ea1ba3331d4db" >
#### Example Output
~~~~
pixmap.writable_addr() == (void *)storage
pixmap.getColor(0, 0) == 0x00000000
pixmap.getColor(1, 2) == 0xFFFFFFFF
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_writable_addr8' > writable addr8< / a > < a href = '#SkPixmap_writable_addr16' > writable addr16< / a > < a href = '#SkPixmap_writable_addr32' > writable addr32< / a > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a > < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a > < a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_writable_addr8' > < / a >
2017-09-14 15:25:39 +00:00
## writable_addr8
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
uint8_t* < a href = '#SkPixmap_writable_addr8' > writable addr8< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns writable pixel address at (< a href = '#SkPixmap_writable_addr8_x' > x< / a > , < a href = '#SkPixmap_writable_addr8_y' > y< / a > ). Result is addressable as unsigned
8-bit bytes. Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a >
or < a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
One byte corresponds to one pixel.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_writable_addr8_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_writable_addr8_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
writable unsigned 8-bit pointer to pixels
### Example
2018-07-16 05:29:00 +00:00
< div > < fiddle-embed name = "809284db136748208b3efc31cd89de29" > < div > Altering pixels after drawing < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > is not guaranteed to affect subsequent
2018-05-16 11:07:07 +00:00
drawing on all platforms. Adding a second < a href = 'SkBitmap_Reference#SkBitmap_installPixels' > SkBitmap::installPixels< / a > after editing
2018-03-05 18:26:16 +00:00
pixel memory is safer.
< / div > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr16' > writable addr16< / a > < a href = '#SkPixmap_writable_addr32' > writable addr32< / a > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a > < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a > < a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr8' > addr8< / a > < sup > < a href = '#SkPixmap_addr8_2' > [2]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_writable_addr16' > < / a >
2017-09-14 15:25:39 +00:00
## writable_addr16
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
uint16_t* < a href = '#SkPixmap_writable_addr16' > writable addr16< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns < a href = '#SkPixmap_writable_addr' > writable addr< / a > pixel address at (< a href = '#SkPixmap_writable_addr16_x' > x< / a > , < a href = '#SkPixmap_writable_addr16_y' > y< / a > ). Result is addressable as unsigned
16-bit words. Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not < a href = 'SkImageInfo_Reference#kRGB_565_SkColorType' > kRGB_565_SkColorType< / a >
or < a href = 'SkImageInfo_Reference#kARGB_4444_SkColorType' > kARGB_4444_SkColorType< / a > , and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
One word corresponds to one pixel.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_writable_addr16_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_writable_addr16_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
writable unsigned 16-bit pointer to pixel
### Example
< div > < fiddle-embed name = "6da54774f6432b46b47ea9013c15f280" > < div > Draw a five by five bitmap, and draw it again with a center black pixel.
2018-05-16 11:07:07 +00:00
The low nibble of the 16-bit word is < a href = 'SkColor_Reference#Alpha' > Alpha< / a > .
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr8' > writable addr8< / a > < a href = '#SkPixmap_writable_addr32' > writable addr32< / a > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a > < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a > < a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr16' > addr16< / a > < sup > < a href = '#SkPixmap_addr16_2' > [2]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_writable_addr32' > < / a >
2017-09-14 15:25:39 +00:00
## writable_addr32
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
uint32_t* < a href = '#SkPixmap_writable_addr32' > writable addr32< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns writable pixel address at (< a href = '#SkPixmap_writable_addr32_x' > x< / a > , < a href = '#SkPixmap_writable_addr32_y' > y< / a > ). Result is addressable as unsigned
32-bit words. Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not
< a href = 'SkImageInfo_Reference#kRGBA_8888_SkColorType' > kRGBA_8888_SkColorType< / a > or < a href = 'SkImageInfo_Reference#kBGRA_8888_SkColorType' > kBGRA_8888_SkColorType< / a > , and is built with SK_DEBUG
2017-09-21 16:31:06 +00:00
defined.
2017-09-14 15:25:39 +00:00
One word corresponds to one pixel.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_writable_addr32_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_writable_addr32_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
writable unsigned 32-bit pointer to pixel
### Example
2018-06-19 16:57:43 +00:00
< div > < fiddle-embed name = "086866243bf9e4c14c3b215a2aa69ad9" > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr8' > writable addr8< / a > < a href = '#SkPixmap_writable_addr16' > writable addr16< / a > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a > < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a > < a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr32' > addr32< / a > < sup > < a href = '#SkPixmap_addr32_2' > [2]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_writable_addr64' > < / a >
2017-09-14 15:25:39 +00:00
## writable_addr64
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
uint64_t* < a href = '#SkPixmap_writable_addr64' > writable addr64< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns writable pixel address at (< a href = '#SkPixmap_writable_addr64_x' > x< / a > , < a href = '#SkPixmap_writable_addr64_y' > y< / a > ). Result is addressable as unsigned
64-bit words. Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not
< a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
One word corresponds to one pixel.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_writable_addr64_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_writable_addr64_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
writable unsigned 64-bit pointer to pixel
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "de14d8d30e4a7b6462103d0e0dd96b0b" > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr8' > writable addr8< / a > < a href = '#SkPixmap_writable_addr16' > writable addr16< / a > < a href = '#SkPixmap_writable_addr32' > writable addr32< / a > < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a > < a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addr64' > addr64< / a > < sup > < a href = '#SkPixmap_addr64_2' > [2]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_writable_addrF16' > < / a >
2017-09-14 15:25:39 +00:00
## writable_addrF16
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
uint16_t* < a href = '#SkPixmap_writable_addrF16' > writable addrF16< / a > (int x, int y) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Returns writable pixel address at (< a href = '#SkPixmap_writable_addrF16_x' > x< / a > , < a href = '#SkPixmap_writable_addrF16_y' > y< / a > ). Result is addressable as unsigned
16-bit words. Will trigger an assert() if < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > is not
< a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > and is built with SK_DEBUG defined.
2017-09-14 15:25:39 +00:00
Each word represents one color component encoded as a half float.
Four words correspond to one pixel.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_writable_addrF16_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
< td > column index, zero or greater, and less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_writable_addrF16_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
< td > row index, zero or greater, and less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
writable unsigned 16-bit pointer to first component of pixel
### Example
< div > < fiddle-embed name = "7822d78f5cacf5c04267cbbc6c6d0b80" > < div > Left bitmap is drawn with two pixels defined in half float format. Right bitmap
2018-03-05 18:26:16 +00:00
is drawn after overwriting bottom half float color with top half float color.
< / div > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_writable_addr' > writable addr< / a > < sup > < a href = '#SkPixmap_writable_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_writable_addr8' > writable addr8< / a > < a href = '#SkPixmap_writable_addr16' > writable addr16< / a > < a href = '#SkPixmap_writable_addr32' > writable addr32< / a > < a href = '#SkPixmap_writable_addr64' > writable addr64< / a > < a href = '#SkPixmap_addr' > addr< / a > < sup > < a href = '#SkPixmap_addr_2' > [2]< / a > < / sup > < a href = '#SkPixmap_addrF16' > addrF16< / a > < sup > < a href = '#SkPixmap_addrF16_2' > [2]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
## <a name='Pixels'>Pixels</a>
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Topic</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_erase' > erase</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > writes < a href = 'SkColor_Reference#Color' > Color</ a > to pixels</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_erase' > erase(SkColor color, const SkIRect& subset)</ a > const</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_erase_2' > erase(SkColor color)</ a > const</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_erase_3' > erase(const SkColor4f& color, const SkIRect* subset = nullptr)</ a > const</ td >
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_readPixels' > readPixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > copies and converts pixels</ td >
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
2018-07-17 17:19:56 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_readPixels' > readPixels(const SkImageInfo& dstInfo, void* dstPixels, size t dstRowBytes)</ a > const</ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
2018-07-17 17:19:56 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_readPixels_2' > readPixels(const SkImageInfo& dstInfo, void* dstPixels, size t dstRowBytes, int srcX, int srcY)</ a > const</ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
2018-07-17 17:19:56 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_readPixels_3' > readPixels(const SkPixmap& dst, int srcX, int srcY)</ a > const</ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' ></ td >
2018-07-17 17:19:56 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_readPixels_4' > readPixels(const SkPixmap& dst)</ a > const</ td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a href = '#SkPixmap_scalePixels' > scalePixels</ a ></ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > scales and converts pixels</ td >
< / tr >
< / table >
< a name = 'SkPixmap_readPixels' > < / a >
2017-09-14 15:25:39 +00:00
## readPixels
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-07-17 17:19:56 +00:00
bool < a href = '#SkPixmap_readPixels' > readPixels< / a > (const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & dstInfo, void* dstPixels, size_t dstRowBytes) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-07-17 17:19:56 +00:00
Copies a < a href = 'SkRect_Reference#Rect' > Rect< / a > of pixels to < a href = '#SkPixmap_readPixels_dstPixels' > dstPixels< / a > . Copy starts at (0, 0), and does not
2018-05-16 11:07:07 +00:00
exceed < a href = '#Pixmap' > Pixmap< / a > (< a href = '#SkPixmap_width' > width< / a > , < a href = '#SkPixmap_height' > height< / a > ).
2017-09-21 16:31:06 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_readPixels_dstInfo' > dstInfo< / a > specifies width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , and
< a href = 'undocumented#Color_Space' > Color Space< / a > of destination. < a href = '#SkPixmap_readPixels_dstRowBytes' > dstRowBytes< / a > specifics the gap from one destination
2017-09-14 15:25:39 +00:00
row to the next. Returns true if pixels are copied. Returns false if
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_readPixels_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_addr' > addr< / a > equals nullptr, or < a href = '#SkPixmap_readPixels_dstRowBytes' > dstRowBytes< / a > is less than < a href = '#SkPixmap_readPixels_dstInfo' > dstInfo< / a > .< a href = 'SkImageInfo_Reference#SkImageInfo' > minRowBytes< / a > .
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are copied only if pixel conversion is possible. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is
< a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , or < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > ; < a href = '#SkPixmap_readPixels_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_colorType' > colorType< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , < a href = '#SkPixmap_readPixels_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_colorSpace' > colorSpace< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_alphaType' > alphaType< / a > is < a href = 'SkImageInfo_Reference#kOpaque_SkAlphaType' > kOpaque_SkAlphaType< / a > , < a href = '#SkPixmap_readPixels_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_alphaType' > alphaType< / a > must
match. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorSpace' > colorSpace< / a > is nullptr, < a href = '#SkPixmap_readPixels_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_colorSpace' > colorSpace< / a > must match. Returns
2017-09-14 15:25:39 +00:00
false if pixel conversion is not possible.
2017-10-26 11:58:48 +00:00
2018-07-17 17:19:56 +00:00
Returns false if < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_width' > width< / a > or < a href = '#SkPixmap_height' > height< / a > is zero or negative.
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_readPixels_dstInfo' > < code > < strong > dstInfo< / strong > < / code > < / a > < / td >
< td > destination width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , < a href = 'undocumented#Color_Space' > Color Space< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_readPixels_dstPixels' > < code > < strong > dstPixels< / strong > < / code > < / a > < / td >
< td > destination pixel storage< / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_readPixels_dstRowBytes' > < code > < strong > dstRowBytes< / strong > < / code > < / a > < / td >
< td > destination row length< / td >
< / tr >
2017-09-14 15:25:39 +00:00
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if pixels are copied to < a href = '#SkPixmap_readPixels_dstPixels' > dstPixels< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-07-17 17:19:56 +00:00
< div > < fiddle-embed name = "df4e355c4845350daede833b4fd21ec1" > < div > Transferring the gradient from 8 bits per component to 4 bits per component
creates visible banding.
< / div > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkPixmap_erase' > erase< / a > < sup > < a href = '#SkPixmap_erase_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_erase_3' > [3]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels' > SkBitmap::readPixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_3' > [3]< / a > < / sup > < a href = 'SkCanvas_Reference#SkCanvas_drawBitmap' > SkCanvas::drawBitmap< / a > < a href = 'SkCanvas_Reference#SkCanvas_readPixels' > SkCanvas::readPixels< / a > < sup > < a href = 'SkCanvas_Reference#SkCanvas_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkCanvas_Reference#SkCanvas_readPixels_3' > [3]< / a > < / sup > < a href = 'SkImage_Reference#SkImage_readPixels' > SkImage::readPixels< / a > < sup > < a href = 'SkImage_Reference#SkImage_readPixels_2' > [2]< / a > < / sup > < a href = 'SkSurface_Reference#SkSurface_readPixels' > SkSurface::readPixels< / a > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_3' > [3]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_readPixels_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-07-17 17:19:56 +00:00
bool < a href = '#SkPixmap_readPixels' > readPixels< / a > (const < a href = 'SkImageInfo_Reference#SkImageInfo' > SkImageInfo< / a > & dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-07-17 17:19:56 +00:00
Copies a < a href = 'SkRect_Reference#Rect' > Rect< / a > of pixels to < a href = '#SkPixmap_readPixels_2_dstPixels' > dstPixels< / a > . Copy starts at (< a href = '#SkPixmap_readPixels_2_srcX' > srcX< / a > , < a href = '#SkPixmap_readPixels_2_srcY' > srcY< / a > ), and does not
2018-05-16 11:07:07 +00:00
exceed < a href = '#Pixmap' > Pixmap< / a > (< a href = '#SkPixmap_width' > width< / a > , < a href = '#SkPixmap_height' > height< / a > ).
2017-09-21 16:31:06 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_readPixels_2_dstInfo' > dstInfo< / a > specifies width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , and
< a href = 'undocumented#Color_Space' > Color Space< / a > of destination. < a href = '#SkPixmap_readPixels_2_dstRowBytes' > dstRowBytes< / a > specifics the gap from one destination
2017-09-14 15:25:39 +00:00
row to the next. Returns true if pixels are copied. Returns false if
2018-05-16 11:07:07 +00:00
< a href = '#SkPixmap_readPixels_2_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_addr' > addr< / a > equals nullptr, or < a href = '#SkPixmap_readPixels_2_dstRowBytes' > dstRowBytes< / a > is less than < a href = '#SkPixmap_readPixels_2_dstInfo' > dstInfo< / a > .< a href = 'SkImageInfo_Reference#SkImageInfo' > minRowBytes< / a > .
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are copied only if pixel conversion is possible. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is
< a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , or < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > ; < a href = '#SkPixmap_readPixels_2_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_colorType' > colorType< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , < a href = '#SkPixmap_readPixels_2_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_colorSpace' > colorSpace< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_alphaType' > alphaType< / a > is < a href = 'SkImageInfo_Reference#kOpaque_SkAlphaType' > kOpaque_SkAlphaType< / a > , < a href = '#SkPixmap_readPixels_2_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_alphaType' > alphaType< / a > must
match. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorSpace' > colorSpace< / a > is nullptr, < a href = '#SkPixmap_readPixels_2_dstInfo' > dstInfo< / a > .< a href = '#SkPixmap_colorSpace' > colorSpace< / a > must match. Returns
2017-09-14 15:25:39 +00:00
false if pixel conversion is not possible.
2018-07-17 17:19:56 +00:00
< a href = '#SkPixmap_readPixels_2_srcX' > srcX< / a > and < a href = '#SkPixmap_readPixels_2_srcY' > srcY< / a > may be negative to copy only top or left of source. Returns
2018-05-16 11:07:07 +00:00
false if < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_width' > width< / a > or < a href = '#SkPixmap_height' > height< / a > is zero or negative. Returns false if:
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
< code > abs(srcX) >= < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_width' > width< / a > < / code > , or if < code > abs(srcY) >= < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_height' > height< / a > < / code > .
2017-09-14 15:25:39 +00:00
### Parameters
2018-07-17 17:19:56 +00:00
< table > < tr > < td > < a name = 'SkPixmap_readPixels_2_dstInfo' > < code > < strong > dstInfo< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > destination width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > , < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , < a href = 'undocumented#Color_Space' > Color Space< / a > < / td >
< / tr >
2018-07-17 17:19:56 +00:00
< tr > < td > < a name = 'SkPixmap_readPixels_2_dstPixels' > < code > < strong > dstPixels< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > destination pixel storage< / td >
< / tr >
2018-07-17 17:19:56 +00:00
< tr > < td > < a name = 'SkPixmap_readPixels_2_dstRowBytes' > < code > < strong > dstRowBytes< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > destination row length< / td >
< / tr >
2018-07-17 17:19:56 +00:00
< tr > < td > < a name = 'SkPixmap_readPixels_2_srcX' > < code > < strong > srcX< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > column index whose absolute value is less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
2018-07-17 17:19:56 +00:00
< tr > < td > < a name = 'SkPixmap_readPixels_2_srcY' > < code > < strong > srcY< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > row index whose absolute value is less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-07-17 17:19:56 +00:00
true if pixels are copied to < a href = '#SkPixmap_readPixels_2_dstPixels' > dstPixels< / a >
2017-09-14 15:25:39 +00:00
### Example
< div > < fiddle-embed name = "094ca0bd37588cc7be241bb387a3e17b" > < / fiddle-embed > < / div >
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkPixmap_erase' > erase< / a > < sup > < a href = '#SkPixmap_erase_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_erase_3' > [3]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels' > SkBitmap::readPixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_3' > [3]< / a > < / sup > < a href = 'SkCanvas_Reference#SkCanvas_drawBitmap' > SkCanvas::drawBitmap< / a > < a href = 'SkCanvas_Reference#SkCanvas_readPixels' > SkCanvas::readPixels< / a > < sup > < a href = 'SkCanvas_Reference#SkCanvas_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkCanvas_Reference#SkCanvas_readPixels_3' > [3]< / a > < / sup > < a href = 'SkImage_Reference#SkImage_readPixels' > SkImage::readPixels< / a > < sup > < a href = 'SkImage_Reference#SkImage_readPixels_2' > [2]< / a > < / sup > < a href = 'SkSurface_Reference#SkSurface_readPixels' > SkSurface::readPixels< / a > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_3' > [3]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-07-17 17:19:56 +00:00
< a name = 'SkPixmap_readPixels_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkPixmap_readPixels' > readPixels< / a > (const < a href = '#SkPixmap' > SkPixmap< / a > & dst, int srcX, int srcY) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-07-17 17:19:56 +00:00
Copies a < a href = 'SkRect_Reference#Rect' > Rect< / a > of pixels to < a href = '#SkPixmap_readPixels_3_dst' > dst< / a > . Copy starts at (< a href = '#SkPixmap_readPixels_3_srcX' > srcX< / a > , < a href = '#SkPixmap_readPixels_3_srcY' > srcY< / a > ), and does not
exceed < a href = '#Pixmap' > Pixmap< / a > (< a href = '#SkPixmap_width' > width< / a > , < a href = '#SkPixmap_height' > height< / a > ). < a href = '#SkPixmap_readPixels_3_dst' > dst< / a > specifies width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > ,
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , and < a href = 'undocumented#Color_Space' > Color Space< / a > of destination. Returns true if pixels are copied.
2018-07-17 17:19:56 +00:00
Returns false if < a href = '#SkPixmap_readPixels_3_dst' > dst< / a > .< a href = '#SkPixmap_addr' > addr< / a > equals nullptr, or < a href = '#SkPixmap_readPixels_3_dst' > dst< / a > .< a href = '#SkPixmap_rowBytes' > rowBytes< / a > is less than
< a href = '#SkPixmap_readPixels_3_dst' > dst< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_minRowBytes' > SkImageInfo::minRowBytes< / a > .
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are copied only if pixel conversion is possible. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is
2018-07-17 17:19:56 +00:00
< a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , or < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > ; < a href = '#SkPixmap_readPixels_3_dst' > dst< / a > .< a href = '#SkPixmap_info' > info< / a > .< a href = '#SkPixmap_colorType' > colorType< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , < a href = '#SkPixmap_readPixels_3_dst' > dst< / a > .< a href = '#SkPixmap_info' > info< / a > .< a href = '#SkPixmap_colorSpace' > colorSpace< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_alphaType' > alphaType< / a > is < a href = 'SkImageInfo_Reference#kOpaque_SkAlphaType' > kOpaque_SkAlphaType< / a > , < a href = '#SkPixmap_readPixels_3_dst' > dst< / a > .< a href = '#SkPixmap_info' > info< / a > .< a href = '#SkPixmap_alphaType' > alphaType< / a > must
match. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorSpace' > colorSpace< / a > is nullptr, < a href = '#SkPixmap_readPixels_3_dst' > dst< / a > .< a href = '#SkPixmap_info' > info< / a > .< a href = '#SkPixmap_colorSpace' > colorSpace< / a > must match. Returns
2017-09-14 15:25:39 +00:00
false if pixel conversion is not possible.
2017-10-26 11:58:48 +00:00
2018-07-17 17:19:56 +00:00
< a href = '#SkPixmap_readPixels_3_srcX' > srcX< / a > and < a href = '#SkPixmap_readPixels_3_srcY' > srcY< / a > may be negative to copy only top or left of source. Returns
2018-05-16 11:07:07 +00:00
false < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_width' > width< / a > or < a href = '#SkPixmap_height' > height< / a > is zero or negative. Returns false if:
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
< code > abs(srcX) >= < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_width' > width< / a > < / code > , or if < code > abs(srcY) >= < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_height' > height< / a > < / code > .
2017-09-14 15:25:39 +00:00
### Parameters
2018-07-17 17:19:56 +00:00
< table > < tr > < td > < a name = 'SkPixmap_readPixels_3_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > and pixel address to write to< / td >
< / tr >
2018-07-17 17:19:56 +00:00
< tr > < td > < a name = 'SkPixmap_readPixels_3_srcX' > < code > < strong > srcX< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > column index whose absolute value is less than < a href = '#SkPixmap_width' > width< / a > < / td >
< / tr >
2018-07-17 17:19:56 +00:00
< tr > < td > < a name = 'SkPixmap_readPixels_3_srcY' > < code > < strong > srcY< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > row index whose absolute value is less than < a href = '#SkPixmap_height' > height< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-07-17 17:19:56 +00:00
true if pixels are copied to < a href = '#SkPixmap_readPixels_3_dst' > dst< / a >
2017-09-14 15:25:39 +00:00
### Example
< div > < fiddle-embed name = "6ec7f7b2cc163cd29f627eef6d4b061c" > < / fiddle-embed > < / div >
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkPixmap_erase' > erase< / a > < sup > < a href = '#SkPixmap_erase_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_erase_3' > [3]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels' > SkBitmap::readPixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_3' > [3]< / a > < / sup > < a href = 'SkCanvas_Reference#SkCanvas_drawBitmap' > SkCanvas::drawBitmap< / a > < a href = 'SkCanvas_Reference#SkCanvas_readPixels' > SkCanvas::readPixels< / a > < sup > < a href = 'SkCanvas_Reference#SkCanvas_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkCanvas_Reference#SkCanvas_readPixels_3' > [3]< / a > < / sup > < a href = 'SkImage_Reference#SkImage_readPixels' > SkImage::readPixels< / a > < sup > < a href = 'SkImage_Reference#SkImage_readPixels_2' > [2]< / a > < / sup > < a href = 'SkSurface_Reference#SkSurface_readPixels' > SkSurface::readPixels< / a > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_3' > [3]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-07-17 17:19:56 +00:00
< a name = 'SkPixmap_readPixels_4' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkPixmap_readPixels' > readPixels< / a > (const < a href = '#SkPixmap' > SkPixmap< / a > & dst) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-07-17 17:19:56 +00:00
Copies pixels inside < a href = '#SkPixmap_bounds' > bounds< / a > to < a href = '#SkPixmap_readPixels_4_dst' > dst< / a > . < a href = '#SkPixmap_readPixels_4_dst' > dst< / a > specifies width, height, < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > ,
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > , and < a href = 'undocumented#Color_Space' > Color Space< / a > of destination. Returns true if pixels are copied.
2018-07-17 17:19:56 +00:00
Returns false if < a href = '#SkPixmap_readPixels_4_dst' > dst< / a > .< a href = '#SkPixmap_addr' > addr< / a > equals nullptr, or < a href = '#SkPixmap_readPixels_4_dst' > dst< / a > .< a href = '#SkPixmap_rowBytes' > rowBytes< / a > is less than
< a href = '#SkPixmap_readPixels_4_dst' > dst< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_minRowBytes' > SkImageInfo::minRowBytes< / a > .
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are copied only if pixel conversion is possible. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is
2018-07-17 17:19:56 +00:00
< a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , or < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > ; < a href = '#SkPixmap_readPixels_4_dst' > dst< / a > < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , < a href = '#SkPixmap_readPixels_4_dst' > dst< / a > < a href = 'undocumented#Color_Space' > Color Space< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_alphaType' > alphaType< / a > is < a href = 'SkImageInfo_Reference#kOpaque_SkAlphaType' > kOpaque_SkAlphaType< / a > , < a href = '#SkPixmap_readPixels_4_dst' > dst< / a > < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > must
match. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorSpace' > colorSpace< / a > is nullptr, < a href = '#SkPixmap_readPixels_4_dst' > dst< / a > < a href = 'undocumented#Color_Space' > Color Space< / a > must match. Returns
2017-09-14 15:25:39 +00:00
false if pixel conversion is not possible.
2018-05-16 11:07:07 +00:00
Returns false if < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_width' > width< / a > or < a href = '#SkPixmap_height' > height< / a > is zero or negative.
2017-09-14 15:25:39 +00:00
### Parameters
2018-07-17 17:19:56 +00:00
< table > < tr > < td > < a name = 'SkPixmap_readPixels_4_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
2018-05-16 11:07:07 +00:00
< td > < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > and pixel address to write to< / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-07-17 17:19:56 +00:00
true if pixels are copied to < a href = '#SkPixmap_readPixels_4_dst' > dst< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-07-16 05:29:00 +00:00
< div > < fiddle-embed name = "e18549b5ee1039cb61b0bb38c2104fc9" > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-07-17 17:19:56 +00:00
< a href = '#SkPixmap_erase' > erase< / a > < sup > < a href = '#SkPixmap_erase_2' > [2]< / a > < / sup > < sup > < a href = '#SkPixmap_erase_3' > [3]< / a > < / sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels' > SkBitmap::readPixels< / a > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkBitmap_Reference#SkBitmap_readPixels_3' > [3]< / a > < / sup > < a href = 'SkCanvas_Reference#SkCanvas_drawBitmap' > SkCanvas::drawBitmap< / a > < a href = 'SkCanvas_Reference#SkCanvas_readPixels' > SkCanvas::readPixels< / a > < sup > < a href = 'SkCanvas_Reference#SkCanvas_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkCanvas_Reference#SkCanvas_readPixels_3' > [3]< / a > < / sup > < a href = 'SkImage_Reference#SkImage_readPixels' > SkImage::readPixels< / a > < sup > < a href = 'SkImage_Reference#SkImage_readPixels_2' > [2]< / a > < / sup > < a href = 'SkSurface_Reference#SkSurface_readPixels' > SkSurface::readPixels< / a > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_2' > [2]< / a > < / sup > < sup > < a href = 'SkSurface_Reference#SkSurface_readPixels_3' > [3]< / a > < / sup >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_scalePixels' > < / a >
2017-09-14 15:25:39 +00:00
## scalePixels
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkPixmap_scalePixels' > scalePixels< / a > (const < a href = '#SkPixmap' > SkPixmap< / a > & dst, < a href = 'undocumented#SkFilterQuality' > SkFilterQuality< / a > filterQuality) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Copies < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > to < a href = '#SkPixmap_scalePixels_dst' > dst< / a > , scaling pixels to fit < a href = '#SkPixmap_scalePixels_dst' > dst< / a > .< a href = '#SkPixmap_width' > width< / a > and < a href = '#SkPixmap_scalePixels_dst' > dst< / a > .< a href = '#SkPixmap_height' > height< / a > , and
converting pixels to match < a href = '#SkPixmap_scalePixels_dst' > dst< / a > .< a href = '#SkPixmap_colorType' > colorType< / a > and < a href = '#SkPixmap_scalePixels_dst' > dst< / a > .< a href = '#SkPixmap_alphaType' > alphaType< / a > . Returns true if
pixels are copied. Returns false if < a href = '#SkPixmap_scalePixels_dst' > dst< / a > .< a href = '#SkPixmap_addr' > addr< / a > is nullptr, or < a href = '#SkPixmap_scalePixels_dst' > dst< / a > .< a href = '#SkPixmap_rowBytes' > rowBytes< / a > is
less than < a href = '#SkPixmap_scalePixels_dst' > dst< / a > < a href = 'SkImageInfo_Reference#SkImageInfo_minRowBytes' > SkImageInfo::minRowBytes< / a > .
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
< a href = '#Pixels' > Pixels< / a > are copied only if pixel conversion is possible. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is
< a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , or < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > ; < a href = '#SkPixmap_scalePixels_dst' > dst< / a > < a href = 'SkImageInfo_Reference#Color_Type' > Color Type< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kGray_8_SkColorType' > kGray_8_SkColorType< / a > , < a href = '#SkPixmap_scalePixels_dst' > dst< / a > < a href = 'undocumented#Color_Space' > Color Space< / a > must match.
If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_alphaType' > alphaType< / a > is < a href = 'SkImageInfo_Reference#kOpaque_SkAlphaType' > kOpaque_SkAlphaType< / a > , < a href = '#SkPixmap_scalePixels_dst' > dst< / a > < a href = 'SkImageInfo_Reference#Alpha_Type' > Alpha Type< / a > must
match. If < a href = '#Pixmap' > Pixmap< / a > < a href = '#SkPixmap_colorSpace' > colorSpace< / a > is nullptr, < a href = '#SkPixmap_scalePixels_dst' > dst< / a > < a href = 'undocumented#Color_Space' > Color Space< / a > must match. Returns
2017-09-14 15:25:39 +00:00
false if pixel conversion is not possible.
2018-05-16 11:07:07 +00:00
Returns false if < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > < a href = '#SkPixmap_width' > width< / a > or < a href = '#SkPixmap_height' > height< / a > is zero or negative.
2017-09-14 15:25:39 +00:00
2018-05-16 11:07:07 +00:00
Scales the image, with < a href = '#SkPixmap_scalePixels_filterQuality' > filterQuality< / a > , to match < a href = '#SkPixmap_scalePixels_dst' > dst< / a > .< a href = '#SkPixmap_width' > width< / a > and < a href = '#SkPixmap_scalePixels_dst' > dst< / a > .< a href = '#SkPixmap_height' > height< / a > .
< a href = '#SkPixmap_scalePixels_filterQuality' > filterQuality< / a > < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > is fastest, typically implemented with
< a href = 'undocumented#Nearest_Neighbor' > Filter Quality Nearest Neighbor< / a > . < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > is typically implemented with
< a href = 'undocumented#Bilerp' > Filter Quality Bilerp< / a > . < a href = 'undocumented#kMedium_SkFilterQuality' > kMedium_SkFilterQuality< / a > is typically implemented with
< a href = 'undocumented#Bilerp' > Filter Quality Bilerp< / a > , and < a href = 'undocumented#MipMap' > Filter Quality MipMap< / a > when size is reduced.
< a href = 'undocumented#kHigh_SkFilterQuality' > kHigh_SkFilterQuality< / a > is slowest, typically implemented with < a href = 'undocumented#BiCubic' > Filter Quality BiCubic< / a > .
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_scalePixels_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
< td > < a href = 'SkImageInfo_Reference#Image_Info' > Image Info< / a > and pixel address to write to< / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_scalePixels_filterQuality' > < code > < strong > filterQuality< / strong > < / code > < / a > < / td >
< td > one of: < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > ,
< a href = 'undocumented#kMedium_SkFilterQuality' > kMedium_SkFilterQuality< / a > , < a href = 'undocumented#kHigh_SkFilterQuality' > kHigh_SkFilterQuality< / a > < / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
2018-05-16 11:07:07 +00:00
true if pixels are scaled to fit < a href = '#SkPixmap_scalePixels_dst' > dst< / a >
2017-09-14 15:25:39 +00:00
### Example
2018-07-19 14:50:44 +00:00
< div > < fiddle-embed name = "8e3c8a9c1d0d2e9b8bf66e24d274f792" > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkCanvas_Reference#SkCanvas_drawBitmap' > SkCanvas::drawBitmap< / a > < a href = 'SkImage_Reference#SkImage_scalePixels' > SkImage::scalePixels< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_erase' > < / a >
2017-09-14 15:25:39 +00:00
## erase
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkPixmap_erase' > erase< / a > (< a href = 'SkColor_Reference#SkColor' > SkColor< / a > color, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > & subset) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Writes < a href = '#SkPixmap_erase_color' > color< / a > to pixels bounded by < a href = '#SkPixmap_erase_subset' > subset< / a > ; returns true on success.
Returns false if < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > , or if < a href = '#SkPixmap_erase_subset' > subset< / a > does
not intersect < a href = '#SkPixmap_bounds' > bounds< / a > .
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_erase_color' > < code > < strong > color< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > < a href = 'SkColor_Reference#Color' > Color< / a > to write< / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_erase_subset' > < code > < strong > subset< / strong > < / code > < / a > < / td >
< td > bounding integer < a href = 'SkRect_Reference#Rect' > Rect< / a > of written pixels< / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
true if pixels are changed
### Example
2017-11-02 21:49:34 +00:00
< div > < fiddle-embed name = "a0cdbafed4786788cc90681e7b294234" > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkBitmap_Reference#SkBitmap_erase' > SkBitmap::erase< / a > < a href = 'SkCanvas_Reference#SkCanvas_clear' > SkCanvas::clear< / a > < a href = 'SkCanvas_Reference#SkCanvas_drawColor' > SkCanvas::drawColor< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_erase_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkPixmap_erase' > erase< / a > (< a href = 'SkColor_Reference#SkColor' > SkColor< / a > color) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Writes < a href = '#SkPixmap_erase_2_color' > color< / a > to pixels inside < a href = '#SkPixmap_bounds' > bounds< / a > ; returns true on success.
Returns false if < a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > , or if < a href = '#SkPixmap_bounds' > bounds< / a >
2017-09-14 15:25:39 +00:00
is empty.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_erase_2_color' > < code > < strong > color< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > < a href = 'SkColor_Reference#Color' > Color< / a > to write< / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
true if pixels are changed
### Example
2017-11-02 21:49:34 +00:00
< div > < fiddle-embed name = "838202e0d49cad2eb3eeb495834f6d63" > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkBitmap_Reference#SkBitmap_erase' > SkBitmap::erase< / a > < a href = 'SkCanvas_Reference#SkCanvas_clear' > SkCanvas::clear< / a > < a href = 'SkCanvas_Reference#SkCanvas_drawColor' > SkCanvas::drawColor< / a >
2017-09-14 15:25:39 +00:00
---
2018-05-16 11:07:07 +00:00
< a name = 'SkPixmap_erase_3' > < / a >
2018-01-26 17:56:22 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
bool < a href = '#SkPixmap_erase' > erase< / a > (const < a href = 'SkColor4f_Reference#SkColor4f' > SkColor4f< / a > & color, const < a href = 'SkIRect_Reference#SkIRect' > SkIRect< / a > * subset = nullptr) const
2017-09-14 15:25:39 +00:00
< / pre >
2018-05-16 11:07:07 +00:00
Writes < a href = '#SkPixmap_erase_3_color' > color< / a > to pixels bounded by < a href = '#SkPixmap_erase_3_subset' > subset< / a > ; returns true on success.
if < a href = '#SkPixmap_erase_3_subset' > subset< / a > is nullptr, writes colors pixels inside < a href = '#SkPixmap_bounds' > bounds< / a > . Returns false if
< a href = '#SkPixmap_colorType' > colorType< / a > is < a href = 'SkImageInfo_Reference#kUnknown_SkColorType' > kUnknown_SkColorType< / a > , if < a href = '#SkPixmap_erase_3_subset' > subset< / a > is not nullptr and does
not intersect < a href = '#SkPixmap_bounds' > bounds< / a > , or if < a href = '#SkPixmap_erase_3_subset' > subset< / a > is nullptr and < a href = '#SkPixmap_bounds' > bounds< / a > is empty.
2017-09-14 15:25:39 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPixmap_erase_3_color' > < code > < strong > color< / strong > < / code > < / a > < / td >
< td > < a href = 'undocumented#Unpremultiply' > Unpremultiplied< / a > < a href = 'SkColor_Reference#Color' > Color< / a > to write< / td >
< / tr >
< tr > < td > < a name = 'SkPixmap_erase_3_subset' > < code > < strong > subset< / strong > < / code > < / a > < / td >
< td > bounding integer < a href = 'SkRect_Reference#Rect' > Rect< / a > of pixels to write; may be nullptr< / td >
2017-09-14 15:25:39 +00:00
< / tr >
< / table >
### Return Value
true if pixels are changed
### Example
2017-11-02 21:49:34 +00:00
< div > < fiddle-embed name = "f884f3f46a565f052a5e252ae2f36e9b" > < / fiddle-embed > < / div >
2017-09-14 15:25:39 +00:00
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkBitmap_Reference#SkBitmap_erase' > SkBitmap::erase< / a > < a href = 'SkCanvas_Reference#SkCanvas_clear' > SkCanvas::clear< / a > < a href = 'SkCanvas_Reference#SkCanvas_drawColor' > SkCanvas::drawColor< / a >
2017-09-14 15:25:39 +00:00
---