Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Unified Diff: include/core/SkBitmap.h

Issue 377303002: add readPixels() to SkBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | src/core/SkBitmap.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkBitmap.h
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 51e9a9243a13b156ab8591d888b79bbbd11588e6..e6fbeb7019c9ab1c7bf5daf48b6148d0810d4746 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -591,6 +591,28 @@ public:
}
/**
+ * Copy the bitmap's pixels into the specified buffer (pixels + rowBytes),
+ * converting them into the requested format (SkImageInfo). The src pixels are read
+ * starting at the specified (x,y) offset, relative to the top-left corner.
+ *
+ * The specified ImageInfo and (x,y) offset specifies a source rectangle
+ *
+ * srcR.setXYWH(x, y, info.width(), info.height());
+ *
+ * SrcR is intersected with the bounds of the bitmap. If this intersection is not empty,
+ * then we have two sets of pixels (of equal size), the "src" beginning at (x,y)
+ * and the "dst" by info+pixels+rowBytes. Replace the dst pixels with the corresponding src
+ * pixels, performing any colortype/alphatype transformations needed (in the case where the
+ * src and dst have different colortypes or alphatypes).
+ *
+ * This call can fail, returning false, for several reasons:
+ * - If srcR does not intersect the bitmap bounds.
+ * - If the requested colortype/alphatype cannot be converted from the src's types.
+ * - If the src pixels are not available.
+ */
+ bool readPixels(const SkImageInfo&, void* pixels, size_t rowBytes, int x, int y) const;
+
+ /**
* Returns true if this bitmap's pixels can be converted into the requested
* colorType, such that copyTo() could succeed.
*/
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698