diff options
Diffstat (limited to 'docs/SkPixmap_Reference.bmh')
-rw-r--r-- | docs/SkPixmap_Reference.bmh | 83 |
1 files changed, 1 insertions, 82 deletions
diff --git a/docs/SkPixmap_Reference.bmh b/docs/SkPixmap_Reference.bmh index 93d47b50ea..051a6a1f83 100644 --- a/docs/SkPixmap_Reference.bmh +++ b/docs/SkPixmap_Reference.bmh @@ -1494,91 +1494,10 @@ is drawn after overwriting bottom half float color with top half float color. # ------------------------------------------------------------------------------ -#Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, - int srcX, int srcY, SkTransferFunctionBehavior behavior) const +#Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes) const #In Pixels #Line # copies and converts pixels ## -Copies a Rect of pixels to dstPixels. Copy starts at (srcX, srcY), and does not -exceed Pixmap (width(), height()). - -dstInfo specifies width, height, Color_Type, Alpha_Type, and -Color_Space of destination. dstRowBytes specifics the gap from one destination -row to the next. Returns true if pixels are copied. Returns false if -dstInfo.addr() equals nullptr, or dstRowBytes is less than dstInfo.minRowBytes. - -Pixels are copied only if pixel conversion is possible. If Pixmap colorType is -kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType must match. -If Pixmap colorType is kGray_8_SkColorType, dstInfo.colorSpace must match. -If Pixmap alphaType is kOpaque_SkAlphaType, dstInfo.alphaType must -match. If Pixmap colorSpace is nullptr, dstInfo.colorSpace must match. Returns -false if pixel conversion is not possible. - -srcX and srcY may be negative to copy only top or left of source. Returns -false if width() or height() is zero or negative. Returns false if: - -#Formula -abs(srcX) >= Pixmap width() -## -, or if -#Formula -abs(srcY) >= Pixmap height() -## -. - -If behavior is SkTransferFunctionBehavior::kRespect: converts source -pixels to a linear space before converting to dstInfo. -If behavior is SkTransferFunctionBehavior::kIgnore: source -pixels are treated as if they are linear, regardless of how they are encoded. - -#Param dstInfo destination width, height, Color_Type, Alpha_Type, Color_Space ## -#Param dstPixels destination pixel storage ## -#Param dstRowBytes destination row length ## -#Param srcX column index whose absolute value is less than width() ## -#Param srcY row index whose absolute value is less than height() ## -#Param behavior one of: SkTransferFunctionBehavior::kRespect, - SkTransferFunctionBehavior::kIgnore -## - -#Return true if pixels are copied to dstPixels ## - -#Example -#ToDo example doesn't do anything interesting since image doesn't have alpha ## -#Image 3 -void draw(SkCanvas* canvas) { - SkImageInfo srgb = SkImageInfo::MakeS32(image->width(), image->height(), - kPremul_SkAlphaType); - SkImageInfo linear = srgb.makeColorSpace(srgb.colorSpace()->makeLinearGamma()); - std::vector<int32_t> srcPixels; - size_t rowBytes = image->width() * 4; - srcPixels.resize(image->height() * rowBytes); - SkPixmap pixmap(srgb, (const void*) &srcPixels.front(), rowBytes); - image->readPixels(pixmap, 0, 0); - int offset = -64; - std::vector<int32_t> dstPixels; - dstPixels.resize(image->height() * rowBytes); - for (const auto& info : { srgb, linear } ) { - for (auto behavior : { SkTransferFunctionBehavior::kRespect, - SkTransferFunctionBehavior::kIgnore} ) { - pixmap.readPixels(info, &dstPixels.front(), rowBytes, 0, 0, behavior); - SkBitmap bitmap; - SkPixmap dstmap(info, &dstPixels.front(), rowBytes); - bitmap.installPixels(dstmap); - canvas->drawBitmap(bitmap, 0, offset += 64); - } - } -} -## - -#SeeAlso erase SkBitmap::readPixels SkCanvas::drawBitmap SkCanvas::readPixels SkImage::readPixels SkSurface::readPixels - -## - -# ------------------------------------------------------------------------------ - -#Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes) const - -#In Pixels Copies a Rect of pixels to dstPixels. Copy starts at (0, 0), and does not exceed Pixmap (width(), height()). |