8#ifndef SkPixmap_DEFINED
9#define SkPixmap_DEFINED
51 : fPixels(nullptr), fRowBytes(0), fInfo(
SkImageInfo::MakeUnknown(0, 0))
73 : fPixels(
addr), fRowBytes(rowBytes), fInfo(
info)
129 [[nodiscard]]
bool extractSubset(
SkPixmap* subset,
const SkIRect& area)
const;
153 const void*
addr()
const {
return fPixels; }
160 int width()
const {
return fInfo.width(); }
166 int height()
const {
return fInfo.height(); }
251 bool computeIsOpaque()
const;
300 float getAlphaf(
int x,
int y)
const;
315 return (
const char*)fPixels + fInfo.computeOffset(
x,
y, fRowBytes);
327 SkASSERT(1 == fInfo.bytesPerPixel());
328 return reinterpret_cast<const uint8_t*
>(fPixels);
340 SkASSERT(2 == fInfo.bytesPerPixel());
341 return reinterpret_cast<const uint16_t*
>(fPixels);
353 SkASSERT(4 == fInfo.bytesPerPixel());
354 return reinterpret_cast<const uint32_t*
>(fPixels);
366 SkASSERT(8 == fInfo.bytesPerPixel());
367 return reinterpret_cast<const uint64_t*
>(fPixels);
380 SkASSERT(8 == fInfo.bytesPerPixel());
383 return reinterpret_cast<const uint16_t*
>(fPixels);
399 SkASSERT((
unsigned)
x < (
unsigned)fInfo.width());
400 SkASSERT((
unsigned)
y < (
unsigned)fInfo.height());
401 return (
const uint8_t*)((
const char*)this->addr8() + (size_t)
y * fRowBytes + (
x << 0));
417 SkASSERT((
unsigned)
x < (
unsigned)fInfo.width());
418 SkASSERT((
unsigned)
y < (
unsigned)fInfo.height());
419 return (
const uint16_t*)((
const char*)this->addr16() + (size_t)
y * fRowBytes + (
x << 1));
435 SkASSERT((
unsigned)
x < (
unsigned)fInfo.width());
436 SkASSERT((
unsigned)
y < (
unsigned)fInfo.height());
437 return (
const uint32_t*)((
const char*)this->addr32() + (size_t)
y * fRowBytes + (
x << 2));
453 SkASSERT((
unsigned)
x < (
unsigned)fInfo.width());
454 SkASSERT((
unsigned)
y < (
unsigned)fInfo.height());
455 return (
const uint64_t*)((
const char*)this->addr64() + (size_t)
y * fRowBytes + (
x << 3));
476 return reinterpret_cast<const uint16_t*
>(this->addr64(
x,
y));
495 return const_cast<void*
>(this->
addr(x,
y));
509 return const_cast<uint8_t*
>(this->addr8(
x,
y));
523 return const_cast<uint16_t*
>(this->addr16(
x,
y));
538 return const_cast<uint32_t*
>(this->addr32(
x,
y));
552 return const_cast<uint64_t*
>(this->addr64(
x,
y));
567 return reinterpret_cast<uint16_t*
>(writable_addr64(
x,
y));
593 return this->readPixels(dstInfo, dstPixels, dstRowBytes, 0, 0);
622 bool readPixels(
const SkImageInfo& dstInfo,
void* dstPixels,
size_t dstRowBytes,
int srcX,
648 return this->readPixels(
dst.info(),
dst.writable_addr(),
dst.rowBytes(), srcX, srcY);
669 return this->readPixels(
dst.info(),
dst.writable_addr(),
dst.rowBytes(), 0, 0);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static void erase(SkSurface *surface)
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
const uint8_t * addr8() const
uint16_t * writable_addrF16(int x, int y) const
uint16_t * writable_addr16(int x, int y) const
const uint16_t * addrF16(int x, int y) const
const uint64_t * addr64() const
const uint32_t * addr32() const
uint64_t * writable_addr64(int x, int y) const
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes) const
SkColorType colorType() const
const uint8_t * addr8(int x, int y) const
const SkImageInfo & info() const
const uint16_t * addr16() const
void * writable_addr(int x, int y) const
bool readPixels(const SkPixmap &dst, int srcX, int srcY) const
int rowBytesAsPixels() const
size_t computeByteSize() const
void * writable_addr() const
uint32_t * writable_addr32(int x, int y) const
const void * addr() const
int shiftPerPixel() const
const uint16_t * addr16(int x, int y) const
SkAlphaType alphaType() const
const uint64_t * addr64(int x, int y) const
SkISize dimensions() const
const void * addr(int x, int y) const
const uint32_t * addr32(int x, int y) const
uint8_t * writable_addr8(int x, int y) const
bool erase(SkColor color) const
bool readPixels(const SkPixmap &dst) const
const uint16_t * addrF16() const
SkPixmap(const SkImageInfo &info, const void *addr, size_t rowBytes)
Optional< SkRect > bounds
static constexpr SkIRect MakeWH(int32_t w, int32_t h)