Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkPixmap Class Reference

Pairs SkImageInfo with actual pixels and rowbytes. More...

#include <SkPixmap.h>

Public Member Functions

 SkPixmap (const SkImageInfo &info, const void *addr, size_t rowBytes, SkColorTable *ctable=NULL)
 
void reset ()
 
void reset (const SkImageInfo &info, const void *addr, size_t rowBytes, SkColorTable *ctable=NULL)
 
void reset (const SkImageInfo &info)
 
void setColorSpace (sk_sp< SkColorSpace >)
 
bool SK_WARN_UNUSED_RESULT reset (const SkMask &)
 If supported, set this pixmap to point to the pixels in the specified mask and return true. More...
 
bool SK_WARN_UNUSED_RESULT extractSubset (SkPixmap *subset, const SkIRect &area) const
 Computes the intersection of area and this pixmap. More...
 
const SkImageInfoinfo () const
 
size_t rowBytes () const
 
const void * addr () const
 
SkColorTablectable () const
 
int width () const
 
int height () const
 
SkColorType colorType () const
 
SkAlphaType alphaType () const
 
SkColorSpacecolorSpace () const
 
bool isOpaque () const
 
SkIRect bounds () const
 
int rowBytesAsPixels () const
 Return the rowbytes expressed as a number of pixels (like width and height).
 
int shiftPerPixel () const
 Return the shift amount per pixel (i.e. More...
 
uint64_t getSize64 () const
 
uint64_t getSafeSize64 () const
 
size_t getSafeSize () const
 
bool computeIsOpaque () const
 This will brute-force return true if all of the pixels in the pixmap are opaque. More...
 
SkColor getColor (int x, int y) const
 Converts the pixel at the specified coordinate to an unpremultiplied SkColor. More...
 
const void * addr (int x, int y) const
 
const uint8_t * addr8 () const
 
const uint16_t * addr16 () const
 
const uint32_t * addr32 () const
 
const uint64_t * addr64 () const
 
const uint16_t * addrF16 () const
 
const uint8_t * addr8 (int x, int y) const
 
const uint16_t * addr16 (int x, int y) const
 
const uint32_t * addr32 (int x, int y) const
 
const uint64_t * addr64 (int x, int y) const
 
const uint16_t * addrF16 (int x, int y) const
 
void * writable_addr () const
 
void * writable_addr (int x, int y) const
 
uint8_t * writable_addr8 (int x, int y) const
 
uint16_t * writable_addr16 (int x, int y) const
 
uint32_t * writable_addr32 (int x, int y) const
 
uint64_t * writable_addr64 (int x, int y) const
 
uint16_t * writable_addrF16 (int x, int y) const
 
bool readPixels (const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, SkTransferFunctionBehavior behavior) const
 
bool readPixels (const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes) const
 
bool readPixels (const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
 
bool readPixels (const SkPixmap &dst, int srcX, int srcY) const
 
bool readPixels (const SkPixmap &dst) const
 
bool scalePixels (const SkPixmap &dst, SkFilterQuality) const
 Copy the pixels from this pixmap into the dst pixmap, converting as needed into dst's colortype/alphatype. More...
 
bool erase (SkColor, const SkIRect &subset) const
 Returns true if pixels were written to (e.g. More...
 
bool erase (SkColor color) const
 
bool erase (const SkColor4f &, const SkIRect *subset=nullptr) const
 

Private Attributes

const void * fPixels
 
SkColorTablefCTable
 
size_t fRowBytes
 
SkImageInfo fInfo
 

Detailed Description

Pairs SkImageInfo with actual pixels and rowbytes.

This class does not try to manage the lifetime of the pixel memory (nor the colortable if provided).

Member Function Documentation

bool SkPixmap::computeIsOpaque ( ) const

This will brute-force return true if all of the pixels in the pixmap are opaque.

If there are no pixels, or encounters an error, returns false.

bool SkPixmap::erase ( SkColor  ,
const SkIRect subset 
) const

Returns true if pixels were written to (e.g.

if colorType is kUnknown_SkColorType, this will return false). If subset does not intersect the bounds of this pixmap, returns false.

bool SK_WARN_UNUSED_RESULT SkPixmap::extractSubset ( SkPixmap subset,
const SkIRect area 
) const

Computes the intersection of area and this pixmap.

If that intersection is non-empty, set subset to that intersection and return true.

On failure, return false and ignore the subset parameter.

SkColor SkPixmap::getColor ( int  x,
int  y 
) const

Converts the pixel at the specified coordinate to an unpremultiplied SkColor.

Note: this ignores any SkColorSpace information, and may return lower precision data than is actually in the pixel. Alpha only colortypes (e.g. kAlpha_8_SkColorType) return black with the appropriate alpha set. The value is undefined for kUnknown_SkColorType or if x or y are out of bounds, or if the pixtap does not have any pixels.

bool SK_WARN_UNUSED_RESULT SkPixmap::reset ( const SkMask )

If supported, set this pixmap to point to the pixels in the specified mask and return true.

On failure, return false and set this pixmap to empty.

bool SkPixmap::scalePixels ( const SkPixmap dst,
SkFilterQuality   
) const

Copy the pixels from this pixmap into the dst pixmap, converting as needed into dst's colortype/alphatype.

If the conversion cannot be performed, false is returned.

If dst's dimensions differ from the src dimension, the image will be scaled, applying the specified filter-quality.

int SkPixmap::shiftPerPixel ( ) const
inline

Return the shift amount per pixel (i.e.

0 for 1-byte per pixel, 1 for 2-bytes per pixel colortypes, 2 for 4-bytes per pixel colortypes). Return 0 for kUnknown_SkColorType.


The documentation for this class was generated from the following file: