aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/SkBitmap_Reference.bmh
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-12-15 11:21:51 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-15 16:47:08 +0000
commit0c5f54663b3080819825bd035979a82d4c5ac902 (patch)
tree9204af52a6f81b3fcbfa5751de2216292145c517 /docs/SkBitmap_Reference.bmh
parent0b1df4b87a6d97d2a590b011e6d748eef3709cb4 (diff)
working on image docs
some new image work turn dos into unix linefeeds add SkBitmap::pixmap() Docs-Preview: https://skia.org/?cl=83863 TBR=caryclark@google.com Bug: skia:6898 Change-Id: I06242b4b66464814b753fe37f930baf32f79323a Reviewed-on: https://skia-review.googlesource.com/83863 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'docs/SkBitmap_Reference.bmh')
-rw-r--r--docs/SkBitmap_Reference.bmh53
1 files changed, 52 insertions, 1 deletions
diff --git a/docs/SkBitmap_Reference.bmh b/docs/SkBitmap_Reference.bmh
index 4e0525e85f..6608876937 100644
--- a/docs/SkBitmap_Reference.bmh
+++ b/docs/SkBitmap_Reference.bmh
@@ -122,6 +122,7 @@ is useful to position one or more Bitmaps within a shared pixel array.
# peekPixels # Returns Pixmap if possible. ##
# pixelRef # Returns Pixel_Ref, or nullptr. ##
# pixelRefOrigin # Returns offset within Pixel_Ref. ##
+# pixmap() # Returns Pixmap if possible. ##
# readPixels # Copies and converts pixels. ##
# readyToDraw # Returns true if address of pixels is not nullptr. ##
# refColorSpace # Returns Image_Info Color_Space. ##
@@ -447,6 +448,56 @@ two width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaT
# ------------------------------------------------------------------------------
+#Method SkPixmap pixmap() const
+
+Returns Pixmap with Bitmap pixel address, row bytes, and Image_Info, if address is available.
+If pixel address is not available, returns default constructed Pixmap: nullptr pixels,
+kUnknown_SkColorType, kUnknown_SkAlphaType, width and height of zero.
+
+Returned Pixmap becomes invalid on any future change to Bitmap
+
+#Return Pixmap describing Bitmap, if pixels are readable; otherwise containing zeroes ##
+
+#Example
+ SkBitmap bitmap;
+ bitmap.allocPixels(SkImageInfo::MakeN32Premul(10, 11));
+ SkCanvas offscreen(bitmap);
+ offscreen.clear(SK_ColorWHITE);
+ SkPaint paint;
+ offscreen.drawString("&", 0, 10, paint);
+ SkPixmap pixmap = bitmap.pixmap();
+ if (pixmap.addr()) {
+ const SkPMColor* pixels = pixmap.addr32();
+ SkPMColor pmWhite = pixels[0];
+ for (int y = 0; y < bitmap.height(); ++y) {
+ for (int x = 0; x < bitmap.width(); ++x) {
+ SkDebugf("%c", *pixels++ == pmWhite ? '-' : 'x');
+ }
+ SkDebugf("\n");
+ }
+ }
+ #StdOut
+----------
+---xx-----
+--x--x----
+--x-------
+--xx------
+--x-x---x-
+-x---x--x-
+-x----xx--
+-xx---x---
+--xxxx-xx-
+----------
+ #StdOut ##
+
+##
+
+#SeeAlso peekPixels installPixels readPixels writePixels
+
+##
+
+# ------------------------------------------------------------------------------
+
#Method const SkImageInfo& info() const
Returns width, height, Alpha_Type, Color_Type, and Color_Space.
@@ -3401,7 +3452,7 @@ x---x-
#StdOut ##
##
-#SeeAlso installPixels readPixels writePixels
+#SeeAlso pixmap() installPixels readPixels writePixels
##