aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorCary Clark <caryclark@skia.org>2017-10-04 14:31:33 -0400
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2017-10-04 18:50:33 +0000
commitbc5697d3b13b082ade1e8397952265dd604664d1 (patch)
treee70354fb728f051f119c4f042191f446e13fa00b /docs
parent0078e912718c9c3013e4db08951d4f3fd584bc57 (diff)
downloadskqp-bc5697d3b13b082ade1e8397952265dd604664d1.tar.gz
starting next gaggle of docs
starting next gaggle of docs Docs-Preview: https://skia.org/?cl=50264 Bug: skia:6898 Change-Id: I639795b55c0c96b2efccac13cb67592f055a75a2 Reviewed-on: https://skia-review.googlesource.com/50264 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'docs')
-rw-r--r--docs/SkBitmap_Reference.bmh3631
-rw-r--r--docs/SkCanvas_Reference.bmh126
-rw-r--r--docs/SkIRect_Reference.bmh1043
-rw-r--r--docs/SkMatrix_Reference.bmh2388
-rw-r--r--docs/SkPaint_Reference.bmh41
-rw-r--r--docs/SkPixmap_Reference.bmh146
-rw-r--r--docs/SkRect_Reference.bmh1320
-rw-r--r--docs/undocumented.bmh99
8 files changed, 8596 insertions, 198 deletions
diff --git a/docs/SkBitmap_Reference.bmh b/docs/SkBitmap_Reference.bmh
new file mode 100644
index 0000000000..03e8a103bb
--- /dev/null
+++ b/docs/SkBitmap_Reference.bmh
@@ -0,0 +1,3631 @@
+#Topic Bitmap
+#Alias Bitmaps
+#Alias Bitmap_Reference
+
+#Class SkBitmap
+
+Bitmap describes a two-dimensional raster pixel array. Bitmap is built on
+Image_Info, containing integer width and height, Color_Type and Alpha_Type
+describing the pixel format, and Color_Space describing the range of colors.
+Bitmap points to Pixel_Ref, which describes the physical array of pixels.
+Image_Info bounds may be located anywhere fully inside Pixel_Ref bounds.
+
+Bitmap can be drawn using Canvas. Bitmap can be a drawing destination for Canvas
+draw methods. Bitmap flexibility as a pixel container limits some optimizations
+available to the target platform.
+
+If pixel array is primarily read-only, use Image for better performance.
+If pixel array is primarily written to, use Surface for better performance.
+
+Declaring SkBitmap const prevents altering Image_Info: the Bitmap height, width,
+and so on cannot change. It does not affect Pixel_Ref: a caller may write its
+pixels. Declaring SkBitmap const affects Bitmap configuration, not its contents.
+
+Bitmap is not thread safe. Each thread must have its own copy if Bitmap fields,
+although threads may share the underlying pixel array.
+
+#Topic Row_Bytes
+Bitmap pixels may be contiguous, or may have a gap at the end of each row.
+Row_Bytes is the interval from one row to the next. Row_Bytes may be specified;
+sometimes passing zero will compute the Row_Bytes from the row width and the
+number of bytes in a pixel. Row_Bytes may be larger than the row requires. This
+is useful to position one or more Bitmaps within a shared pixel array.
+##
+
+#Topic Overview
+
+#Subtopic Subtopics
+#ToDo manually add subtopics ##
+#Table
+#Legend
+# topics # description ##
+#Legend ##
+#Table ##
+##
+
+#Subtopic Structs
+#Table
+#Legend
+# description # struct ##
+#Legend ##
+# Allocator # ##
+# HeapAllocator # ##
+#Table ##
+#Subtopic ##
+
+#Subtopic Constructors
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# SkBitmap() # Constructs with default values. ##
+# SkBitmap(SkBitmap&& src) # Takes ownership of pixels. ##
+# SkBitmap(const SkBitmap& src) # Shares ownership of pixels. ##
+# ~SkBitmap() # Releases ownership of pixels. ##
+#Table ##
+#Subtopic ##
+
+#Subtopic Operators
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# SkBitmap& operator=(SkBitmap&& src) # Takes ownership of pixels. ##
+# SkBitmap& operator=(const SkBitmap& src) # Shares ownership of pixels. ##
+#Table ##
+#Subtopic ##
+
+#Subtopic Member_Functions
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# ComputeIsOpaque # Returns true if all pixels are opaque. ##
+# allocN32Pixels # Allocates compatible Color_ARGB pixels, or aborts. ##
+# allocPixels # Allocates pixels from Image_Info, or aborts. ##
+# allocPixelsFlags # Allocates pixels from Image_Info with options, or aborts. ##
+# alphaType # Returns Image_Info Alpha_Type. ##
+# bounds() # Returns width and height as Rectangle. ##
+# bytesPerPixel # Returns number of bytes in pixel based on Color_Type. ##
+# colorSpace # Returns Image_Info Color_Space. ##
+# colorType # Returns Image_Info Color_Type. ##
+# computeSafeSize64 # Returns minimum size required for pixels in 64 bits. ##
+# computeSize64 # Returns conservative size required for pixels. ##
+# dimensions # Returns width and height. ##
+# drawsNothing # Returns true if no width, no height, or no Pixel_Ref. ##
+# empty() # Returns true if Image_Info has zero width or height. ##
+# erase() # Writes Color to rectangle of pixels. ##
+# eraseARGB # Writes Color to pixels. ##
+# eraseArea # Deprecated ##
+# eraseColor # Writes Color to pixels. ##
+# eraseRGB # Writes opaque Color to pixels. ##
+# extractAlpha # Creates Bitmap containing Alpha of pixels. ##
+# extractSubset # Creates Bitmap, sharing pixels if possible. ##
+# getAddr # Returns readable pixel address as void pointer. ##
+# getAddr16 # Returns readable pixel address as 16-bit pointer. ##
+# getAddr32 # Returns readable pixel address as 32-bit pointer. ##
+# getAddr8 # Returns readable pixel address as 8-bit pointer. ##
+# getBounds # Returns width and height as Rectangle. ##
+# getColor # Returns one pixel as Unpremultiplied Color. ##
+# getGenerationID # Returns unique ID. ##
+# getPixels # Returns address of pixels. ##
+# getSafeSize # Returns minimum size required for pixels in 32 bits. ##
+# getSize # Returns conservative size required for pixels in 32 bits. ##
+# getSubset # Returns bounds offset by origin. ##
+# hasHardwareMipMap # Returns Mip_Map support present; Android only. ##
+# height # Returns pixel row count. ##
+# info() # Returns Image_Info. ##
+# installMaskPixels # Creates Pixel_Ref from Mask. ##
+# installPixels # Creates Pixel_Ref, with optional release function. ##
+# isImmutable # Returns true if pixels will not change. ##
+# isNull # Returns true if Pixel_Ref is nullptr. ##
+# isOpaque # Returns true if Image_Info describes opaque pixels. ##
+# isVolatile # Returns true if pixels should not be cached. ##
+# notifyPixelsChanged # Marks pixels as changed, altering the unique ID. ##
+# peekPixels # Returns Pixmap if possible. ##
+# pixelRef # Returns Pixel_Ref, or nullptr. ##
+# pixelRefOrigin # Returns offset within Pixel_Ref. ##
+# readPixels # Copies and converts pixels. ##
+# readyToDraw # Returns true if address of pixels is not nullptr. ##
+# refColorSpace # Returns Image_Info Color_Space. ##
+# reset() # Sets to default values, releases pixel ownership. ##
+# rowBytes # Returns interval between rows in bytes. ##
+# rowBytesAsPixels # Returns interval between rows in pixels. ##
+# setAlphaType # Sets Alpha_Type of shared pixels. ##
+# setHasHardwareMipMap # Sets Mip_Map support present; Android only. ##
+# setImmutable # Marks that pixels will not change. ##
+# setInfo # Sets height, width, Color_Type, and so on, releasing pixels. ##
+# setIsVolatile # Marks if pixels should not be cached. ##
+# setPixelRef # Sets Pixel_Ref and offset. ##
+# setPixels # Sets Pixel_Ref without an offset. ##
+# shiftPerPixel # Returns bit shift from pixels to bytes. ##
+# swap() # Exchanges Bitmap pair. ##
+# toString # Converts Bitmap to machine readable form. ##
+# tryAllocN32Pixels # Allocates compatible Color_ARGB pixels if possible. ##
+# tryAllocPixels # Allocates pixels from Image_Info if possible. ##
+# tryAllocPixelsFlags # Allocates pixels from Image_Info with options if possible. ##
+# width() # Returns pixel column count. ##
+# writePixels # Copies and converts pixels. ##
+#Table ##
+#Subtopic ##
+
+#Topic ##
+
+# ------------------------------------------------------------------------------
+
+#Class Allocator
+
+#Code
+ class Allocator : public SkRefCnt {
+ public:
+ virtual bool allocPixelRef(SkBitmap* bitmap) = 0;
+ };
+##
+
+Abstract subclass of HeapAllocator.
+
+# ------------------------------------------------------------------------------
+
+#Method virtual bool allocPixelRef(SkBitmap* bitmap) = 0
+
+Allocates the pixel memory for the bitmap, given its dimensions and
+Color_Type. Returns true on success, where success means either setPixels
+or setPixelRef was called.
+
+#Param bitmap Bitmap containing Image_Info as input, and Pixel_Ref as output ##
+
+#Return true if Pixel_Ref was allocated ##
+
+#NoExample
+##
+
+#SeeAlso HeapAllocator
+
+##
+
+#Class Allocator ##
+
+# ------------------------------------------------------------------------------
+
+#Class HeapAllocator
+
+#Code
+ class HeapAllocator : public Allocator {
+ public:
+ bool allocPixelRef(SkBitmap* bitmap) override;
+ };
+##
+
+Subclass of Allocator that returns a Pixel_Ref that allocates its pixel
+memory from the heap. This is the default Allocator invoked by
+allocPixels.
+
+# ------------------------------------------------------------------------------
+
+#Method bool allocPixelRef(SkBitmap* bitmap) override
+
+Allocates the pixel memory for the bitmap, given its dimensions and
+Color_Type. Returns true on success, where success means either setPixels
+or setPixelRef was called.
+
+#Param bitmap Bitmap containing Image_Info as input, and Pixel_Ref as output ##
+
+#Return true if pixels are allocated ##
+
+#Example
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::MakeN32(16, 16, kPremul_SkAlphaType));
+ SkDebugf("pixel address = %p\n", bitmap.getPixels());
+ SkBitmap::HeapAllocator stdalloc;
+ if (!stdalloc.allocPixelRef(&bitmap)) {
+ SkDebugf("pixel allocation failed\n");
+ } else {
+ SkDebugf("pixel address = %p\n", bitmap.getPixels());
+ }
+#StdOut
+pixel address = (nil)
+pixel address = 0x560ddd0ac670
+##
+##
+
+#SeeAlso Allocator tryAllocPixels
+
+##
+
+#class HeapAllocator ##
+
+# ------------------------------------------------------------------------------
+
+#Method SkBitmap()
+
+Creates an empty Bitmap without pixels, with kUnknown_SkColorType,
+kUnknown_SkAlphaType, and with a width and height of zero. Pixel_Ref origin is
+set to (0, 0). Bitmap is not volatile.
+
+Use setInfo to associate SkColorType, SkAlphaType, width, and height
+after Bitmap has been created.
+
+#Return empty Bitmap ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", "RGBA_8888", "BGRA_8888",
+ "Gray_8", "RGBA_F16"};
+ SkBitmap bitmap;
+ for (int i = 0; i < 2; ++i) {
+ SkDebugf("width: %2d height: %2d", bitmap.width(), bitmap.height());
+ SkDebugf(" color: k%s_SkColorType", colors[bitmap.colorType()]);
+ SkDebugf(" alpha: k%s_SkAlphaType\n", alphas[bitmap.alphaType()]);
+ bitmap.setInfo(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType),
+ 0);
+ }
+}
+#StdOut
+width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
+width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType
+##
+##
+
+#SeeAlso setInfo
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkBitmap(const SkBitmap& src)
+
+Copies settings from src to returned Bitmap. Shares pixels if src has pixels
+allocated, so both bitmaps reference the same pixels.
+
+#Param src Bitmap to copy Image_Info, and share Pixel_Ref ##
+
+#Return copy of src ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ SkBitmap original;
+ original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
+ SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false");
+ SkBitmap copy(original);
+ SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false");
+ SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+}
+#StdOut
+original has pixels before copy: true
+original has pixels after copy: true
+copy has pixels: true
+##
+##
+
+#SeeAlso setInfo setPixelRef setPixels swap
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkBitmap(SkBitmap&& src)
+
+Copies settings from src to returned Bitmap. Moves ownership of src pixels to
+Bitmap.
+
+#Param src Bitmap to copy Image_Info, and reassign Pixel_Ref ##
+
+#Return copy of src ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ SkBitmap original;
+ original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
+ SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false");
+ SkBitmap copy(std::move(original));
+ SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false");
+ SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+}
+#StdOut
+original has pixels before move: true
+original has pixels after move: false
+copy has pixels: true
+##
+##
+
+#SeeAlso setInfo setPixelRef setPixels swap
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method ~SkBitmap()
+
+Decrements Pixel_Ref reference count, if Pixel_Ref is not nullptr.
+
+#NoExample
+##
+
+#SeeAlso Pixel_Ref
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkBitmap& operator=(const SkBitmap& src)
+
+Copies settings from src to returned Bitmap. Shares pixels if src has pixels
+allocated, so both bitmaps reference the same pixels.
+
+#Param src Bitmap to copy Image_Info, and share Pixel_Ref ##
+
+#Return copy of src ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ SkBitmap original;
+ original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
+ SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false");
+ SkBitmap copy = original;
+ SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false");
+ SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+}
+#StdOut
+original has pixels before copy: true
+original has pixels after copy: true
+copy has pixels: true
+##
+##
+
+#SeeAlso setInfo setPixelRef setPixels swap
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkBitmap& operator=(SkBitmap&& src)
+
+Copies settings from src to returned Bitmap. Moves ownership of src pixels to
+Bitmap.
+
+#Param src Bitmap to copy Image_Info, and reassign Pixel_Ref ##
+
+#Return copy of src ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ SkBitmap original;
+ original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
+ SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false");
+ SkBitmap copy = std::move(original);
+ SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false");
+ SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+}
+#StdOut
+original has pixels before move: true
+original has pixels after move: false
+copy has pixels: true
+##
+##
+
+#SeeAlso setInfo setPixelRef setPixels swap
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void swap(SkBitmap& other)
+
+Swaps the fields of the two bitmaps.
+
+#Param other Bitmap exchanged with original ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ auto debugster = [](const char* prefix, const SkBitmap& b) -> void {
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", "RGBA_8888", "BGRA_8888",
+ "Gray_8", "RGBA_F16"};
+ SkDebugf("%s width:%d height:%d colorType:k%s_SkColorType alphaType:k%s_SkAlphaType\n",
+ prefix, b.width(), b.height(), colors[b.colorType()], alphas[b.alphaType()]);
+ };
+ SkBitmap one, two;
+ one.tryAllocPixels(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
+ two.tryAllocPixels(SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType));
+ for (int index = 0; index < 2; ++index) {
+ debugster("one", one);
+ debugster("two", two);
+ one.swap(two);
+ }
+}
+#StdOut
+one width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType
+two width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType
+one width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType
+two width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType
+##
+##
+
+#SeeAlso SkBitmap(SkBitmap&& src) operator=(SkBitmap&& src)
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method const SkImageInfo& info() const
+
+Returns width, height, Alpha_Type, Color_Type, and Color_Space.
+
+#Return reference to Image_Info ##
+
+#Example
+#Image 4
+void draw(SkCanvas* canvas) {
+ // SkBitmap source; // pre-populated with soccer ball by fiddle.skia.org
+ const SkImageInfo& info = source.info();
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
+ "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
+ SkDebugf("width: %d height: %d color: %s alpha: %s\n", info.width(), info.height(),
+ colors[info.colorType()], alphas[info.alphaType()]);
+#StdOut
+width: 56 height: 56 color: BGRA_8888 alpha: Opaque
+##
+}
+##
+
+#SeeAlso Image_Info
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int width() const
+
+Returns pixel count in each pixel row. Should be equal or less than:
+#Formula
+rowBytes() / info().bytesPerPixel()
+##
+.
+
+Maybe be less than pixelRef().width(). Will not exceed pixelRef().width() less
+pixelRefOrigin().fX.
+
+#Return pixel width in Image_Info ##
+
+#Example
+ SkImageInfo info = SkImageInfo::MakeA8(16, 32);
+ SkBitmap bitmap;
+ bitmap.setInfo(info);
+ SkDebugf("bitmap width: %d info width: %d\n", bitmap.width(), info.width());
+#StdOut
+bitmap width: 16 info width: 16
+##
+##
+
+#SeeAlso height() SkPixelRef::width() SkImageInfo::width()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int height() const
+
+Returns pixel row count.
+
+Maybe be less than pixelRef().height(). Will not exceed pixelRef().height() less
+pixelRefOrigin().fY.
+
+#Return pixel height in Image_Info ##
+
+#Example
+ SkImageInfo info = SkImageInfo::MakeA8(16, 32);
+ SkBitmap bitmap;
+ bitmap.setInfo(info);
+ SkDebugf("bitmap height: %d info height: %d\n", bitmap.height(), info.height());
+#StdOut
+bitmap height: 32 info height: 32
+##
+##
+
+#SeeAlso width() SkPixelRef::height() SkImageInfo::height()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkColorType colorType() const
+
+Returns Color_Type, one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
+kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType,
+kBGRA_8888_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType.
+
+#Return Color_Type in Image_Info ##
+
+#Example
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
+ "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::MakeA8(16, 32));
+ SkDebugf("color type: k" "%s" "_SkColorType\n", colors[bitmap.colorType()]);
+#StdOut
+color type: kAlpha_SkColorType
+##
+##
+
+#SeeAlso alphaType() SkImageInfo::colorType
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkAlphaType alphaType() const
+
+Returns Alpha_Type, one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+kPremul_SkAlphaType, kUnpremul_SkAlphaType.
+
+#Return Alpha_Type in Image_Info ##
+
+#Example
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ SkPixmap pixmap(SkImageInfo::MakeA8(16, 32), nullptr, 64);
+ SkDebugf("alpha type: k" "%s" "_SkAlphaType\n", alphas[pixmap.alphaType()]);
+#StdOut
+alpha type: kPremul_SkAlphaType
+##
+##
+
+#SeeAlso colorType() SkImageInfo::alphaType
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkColorSpace* colorSpace() const
+
+Returns Color_Space, the range of colors, associated with Image_Info. The
+reference count of Color_Space is unchanged. The returned Color_Space is
+immutable.
+
+#Return Color_Space in Image_Info ##
+
+#Example
+#Description
+SkColorSpace::MakeSRGBLinear creates Color_Space with linear gamma
+and an sRGB gamut. This Color_Space gamma is not close to sRGB gamma.
+##
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,
+ SkColorSpace::MakeSRGBLinear()));
+ SkColorSpace* colorSpace = bitmap.colorSpace();
+ SkDebugf("gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\n",
+ colorSpace->gammaCloseToSRGB() ? "true" : "false",
+ colorSpace->gammaIsLinear() ? "true" : "false",
+ colorSpace->isSRGB() ? "true" : "false");
+#StdOut
+gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
+##
+##
+
+#SeeAlso Color_Space SkImageInfo::colorSpace
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method sk_sp<SkColorSpace> refColorSpace() const
+
+Returns a smart pointer to Color_Space, the range of colors, associated with
+Image_Info. The smart pointer tracks the number of objects sharing this
+Color_Space reference so the memory is released when the owners destruct.
+
+The returned Color_Space is immutable.
+
+#Return Color_Space in Image_Info wrapped in a smart pointer ##
+
+#Example
+ SkBitmap bitmap1, bitmap2;
+ bitmap1.setInfo(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,
+ SkColorSpace::MakeSRGBLinear()));
+ bitmap2.setInfo(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,
+ bitmap1.refColorSpace()));
+ SkColorSpace* colorSpace = bitmap2.colorSpace();
+ SkDebugf("gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\n",
+ colorSpace->gammaCloseToSRGB() ? "true" : "false",
+ colorSpace->gammaIsLinear() ? "true" : "false",
+ colorSpace->isSRGB() ? "true" : "false");
+#StdOut
+gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
+##
+##
+
+#SeeAlso Color_Space SkImageInfo::colorSpace
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int bytesPerPixel() const
+
+Returns number of bytes per pixel required by Color_Type.
+Returns zero if colorType( is kUnknown_SkColorType.
+
+#Return bytes in pixel ##
+
+#Example
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
+ "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
+ SkImageInfo info = SkImageInfo::MakeA8(1, 1);
+ SkBitmap bitmap;
+ for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType,
+ kRGB_565_SkColorType, kARGB_4444_SkColorType,
+ kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+ kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
+ bitmap.setInfo(info.makeColorType(colorType));
+ SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d\n",
+ colors[colorType], 10 - strlen(colors[colorType]), " ",
+ bitmap.bytesPerPixel());
+ }
+#StdOut
+color: kUnknown_SkColorType bytesPerPixel: 0
+color: kAlpha_SkColorType bytesPerPixel: 1
+color: kRGB_565_SkColorType bytesPerPixel: 2
+color: kARGB_4444_SkColorType bytesPerPixel: 2
+color: kRGBA_8888_SkColorType bytesPerPixel: 4
+color: kBGRA_8888_SkColorType bytesPerPixel: 4
+color: kGray_8_SkColorType bytesPerPixel: 1
+color: kRGBA_F16_SkColorType bytesPerPixel: 8
+##
+##
+
+#SeeAlso rowBytes rowBytesAsPixels width shiftPerPixel
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int rowBytesAsPixels() const
+
+Returns number of pixels that fit on row. Should be greater than or equal to
+width().
+
+#Return maximum pixels per row ##
+
+#Example
+ SkBitmap bitmap;
+ for (int rowBytes : { 4, 5, 6, 7, 8} ) {
+ bitmap.setInfo(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType), rowBytes);
+ SkDebugf("rowBytes: %d rowBytesAsPixels: %d\n", rowBytes, bitmap.rowBytesAsPixels());
+ }
+#StdOut
+rowBytes: 4 rowBytesAsPixels: 1
+rowBytes: 5 rowBytesAsPixels: 1
+rowBytes: 6 rowBytesAsPixels: 1
+rowBytes: 7 rowBytesAsPixels: 1
+rowBytes: 8 rowBytesAsPixels: 2
+##
+##
+
+#SeeAlso rowBytes shiftPerPixel width bytesPerPixel
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int shiftPerPixel() const
+
+Returns bit shift converting row bytes to row pixels.
+Returns zero for kUnknown_SkColorType.
+
+#Return one of: 0, 1, 2, 3; left shift to convert pixels to bytes ##
+
+#Example
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
+ "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
+ SkImageInfo info = SkImageInfo::MakeA8(1, 1);
+ SkBitmap bitmap;
+ for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType,
+ kRGB_565_SkColorType, kARGB_4444_SkColorType,
+ kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+ kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
+ bitmap.setInfo(info.makeColorType(colorType));
+ SkDebugf("color: k" "%s" "_SkColorType" "%*s" "shiftPerPixel: %d\n",
+ colors[colorType], 10 - strlen(colors[colorType]), " ",
+ bitmap.shiftPerPixel());
+ }
+#StdOut
+color: kUnknown_SkColorType shiftPerPixel: 0
+color: kAlpha_SkColorType shiftPerPixel: 0
+color: kRGB_565_SkColorType shiftPerPixel: 1
+color: kARGB_4444_SkColorType shiftPerPixel: 1
+color: kRGBA_8888_SkColorType shiftPerPixel: 2
+color: kBGRA_8888_SkColorType shiftPerPixel: 2
+color: kGray_8_SkColorType shiftPerPixel: 0
+color: kRGBA_F16_SkColorType shiftPerPixel: 3
+##
+##
+
+#SeeAlso rowBytes rowBytesAsPixels width bytesPerPixel
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool empty() const
+
+Returns true if either width() or height() are zero.
+
+Does not check if Pixel_Ref is nullptr; call drawsNothing to check width(),
+height(), and Pixel_Ref.
+
+#Return true if dimensions do not enclose area ##
+
+#Example
+ SkBitmap bitmap;
+ for (int width : { 0, 2 } ) {
+ for (int height : { 0, 2 } ) {
+ bitmap.setInfo(SkImageInfo::MakeA8(width, height));
+ SkDebugf("width: %d height: %d empty: %s\n", width, height,
+ bitmap.empty() ? "true" : "false");
+ }
+ }
+#StdOut
+width: 0 height: 0 empty: true
+width: 0 height: 2 empty: true
+width: 2 height: 0 empty: true
+width: 2 height: 2 empty: false
+##
+##
+
+#SeeAlso height() width() drawsNothing
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isNull() const
+
+Return true if Pixel_Ref is nullptr.
+
+Does not check if width() or height() are zero; call drawsNothing to check
+width(), height(), and Pixel_Ref.
+
+#Return true if no Pixel_Ref is associated ##
+
+#Example
+ SkBitmap bitmap;
+ SkDebugf("empty bitmap does %shave pixels\n", bitmap.isNull() ? "not " : "");
+ bitmap.setInfo(SkImageInfo::MakeA8(8, 8));
+ SkDebugf("bitmap with dimensions does %shave pixels\n", bitmap.isNull() ? "not " : "");
+ bitmap.allocPixels();
+ SkDebugf("allocated bitmap does %shave pixels\n", bitmap.isNull() ? "not " : "");
+#StdOut
+empty bitmap does not have pixels
+bitmap with dimensions does not have pixels
+allocated bitmap does have pixels
+##
+##
+
+#SeeAlso empty() drawsNothing pixelRef
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool drawsNothing() const
+
+Return true if width() or height() are zero, or if Pixel_Ref is nullptr.
+If true, Bitmap has no effect when drawn or drawn into.
+
+#Return true if drawing has no effect ##
+
+#Example
+ SkBitmap bitmap;
+ for (int w : { 0, 8 } ) {
+ for (bool allocate : { false, true} ) {
+ bitmap.setInfo(SkImageInfo::MakeA8(w, 8));
+ allocate ? bitmap.allocPixels() : (void) 0 ;
+ SkDebugf("empty:%s isNull:%s drawsNothing:%s\n", bitmap.empty() ? "true " : "false",
+ bitmap.isNull() ? "true " : "false", bitmap.drawsNothing() ? "true" : "false");
+ }
+ }
+#StdOut
+empty:true isNull:true drawsNothing:true
+empty:true isNull:false drawsNothing:true
+empty:false isNull:true drawsNothing:true
+empty:false isNull:false drawsNothing:false
+##
+##
+
+#SeeAlso empty() isNull pixelRef
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method size_t rowBytes() const
+
+Returns row bytes, the interval from one pixel row to the next. Row bytes
+is at least as large as
+#Formula
+width() * info().bytesPerPixel()
+##
+.
+
+Returns zero if colorType is kUnknown_SkColorType, or if row bytes supplied to
+setInfo is not large enough to hold a row of pixels.
+
+#Return byte length of pixel row ##
+
+#Example
+ SkBitmap bitmap;
+ for (int rowBytes : { 2, 8 } ) {
+ bool result = bitmap.setInfo(SkImageInfo::MakeA8(4, 4), rowBytes);
+ SkDebugf("setInfo returned:%s rowBytes:%d\n", result ? "true " : "false", bitmap.rowBytes());
+ }
+#StdOut
+setInfo returned:false rowBytes:0
+setInfo returned:true rowBytes:8
+##
+##
+
+#SeeAlso info() setInfo SkImageInfo::minRowBytes
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool setAlphaType(SkAlphaType alphaType)
+
+Sets Alpha_Type, if alphaType is compatible with Color_Type.
+Returns true unless alphaType is kUnknown_SkAlphaType and current Alpha_Type
+is not kUnknown_SkAlphaType.
+
+Returns true if Color_Type is kUnknown_SkColorType. alphaType is ignored, and
+Alpha_Type remains kUnknown_SkAlphaType.
+
+Returns true if Color_Type is kRGB_565_SkColorType or kGray_8_SkColorType.
+alphaType is ignored, and Alpha_Type remains kOpaque_SkAlphaType.
+
+If Color_Type is kARGB_4444_SkColorType, kRGBA_8888_SkColorType,
+kBGRA_8888_SkColorType, or kRGBA_F16_SkColorType: returns true unless
+alphaType is kUnknown_SkAlphaType and Alpha_Type is not kUnknown_SkAlphaType.
+If Alpha_Type is kUnknown_SkAlphaType, alphaType is ignored.
+
+If Color_Type is kAlpha_8_SkColorType, returns true unless
+alphaType is kUnknown_SkAlphaType and Alpha_Type is not kUnknown_SkAlphaType.
+If Alpha_Type is kUnknown_SkAlphaType, alphaType is ignored. If alphaType is
+kUnpremul_SkAlphaType, it is treated as kPremul_SkAlphaType.
+
+This changes Alpha_Type in Pixel_Ref; all bitmaps sharing Pixel_Ref
+are affected.
+
+#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+ kPremul_SkAlphaType, kUnpremul_SkAlphaType
+##
+
+#Return true if Alpha_Type is set ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ const char* colors[] = {"Unknown", "Alpha_8", "RGB_565", "ARGB_4444",
+ "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
+ const char* alphas[] = {"Unknown ", "Opaque ", "Premul ", "Unpremul"};
+
+ SkBitmap bitmap;
+ SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+ kPremul_SkAlphaType, kUnpremul_SkAlphaType };
+ SkDebugf("%88s", "Canonical Unknown Opaque Premul Unpremul\n");
+ for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
+ kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+ kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
+ for (SkAlphaType canonicalAlphaType : alphaTypes) {
+ SkColorTypeValidateAlphaType(colorType, kUnknown_SkAlphaType, &canonicalAlphaType );
+ SkDebugf("%10s %10s ", colors[(int) colorType], alphas[(int) canonicalAlphaType ]);
+ for (SkAlphaType alphaType : alphaTypes) {
+ bitmap.setInfo(SkImageInfo::Make(4, 4, colorType, canonicalAlphaType));
+ bool result = bitmap.setAlphaType(alphaType);
+ SkDebugf("%s %s ", result ? "true " : "false", alphas[(int) bitmap.alphaType()]);
+ }
+ SkDebugf("\n");
+ }
+ }
+}
+##
+
+#SeeAlso Alpha_Type Color_Type Image_Info setInfo
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void* getPixels() const
+
+Returns pixel address, the base address corresponding to the pixel origin.
+
+#Return pixel address ##
+
+#Example
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::MakeN32(4, 4, kPremul_SkAlphaType));
+ bitmap.allocPixels();
+ bitmap.eraseColor(0x00000000);
+ void* baseAddr = bitmap.getPixels();
+ *(SkPMColor*)baseAddr = 0xFFFFFFFF;
+ SkDebugf("bitmap.getColor(0, 1) %c= 0x00000000\n",
+ bitmap.getColor(0, 1) == 0x00000000 ? '=' : '!');
+ SkDebugf("bitmap.getColor(0, 0) %c= 0xFFFFFFFF\n",
+ bitmap.getColor(0, 0) == 0xFFFFFFFF ? '=' : '!');
+#StdOut
+bitmap.getColor(0, 1) == 0x00000000
+bitmap.getColor(0, 0) == 0xFFFFFFFF
+##
+##
+
+#SeeAlso isNull drawsNothing
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method size_t computeByteSize() const
+
+Returns minimum memory required for pixel storage.
+Does not include unused memory on last row when rowBytesAsPixels exceeds width().
+Returns zero if result does not fit in size_t.
+Returns zero if height() or width() is 0.
+Returns height() times rowBytes if colorType is kUnknown_SkColorType.
+
+#Return size in bytes of image buffer ##
+
+#Example
+ SkBitmap bitmap;
+ for (int width : { 1, 1000, 1000000 } ) {
+ for (int height: { 1, 1000, 1000000 } ) {
+ SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
+ bitmap.setInfo(imageInfo, width * 5);
+ SkDebugf("width: %7d height: %7d computeByteSize: %13lld\n", width, height,
+ bitmap.computeByteSize());
+ }
+ }
+#StdOut
+width: 1 height: 1 computeByteSize: 4
+width: 1 height: 1000 computeByteSize: 4999
+width: 1 height: 1000000 computeByteSize: 4999999
+width: 1000 height: 1 computeByteSize: 4000
+width: 1000 height: 1000 computeByteSize: 4999000
+width: 1000 height: 1000000 computeByteSize: 4999999000
+width: 1000000 height: 1 computeByteSize: 4000000
+width: 1000000 height: 1000 computeByteSize: 4999000000
+width: 1000000 height: 1000000 computeByteSize: 4999999000000
+##
+##
+
+#SeeAlso SkImageInfo::computeByteSize
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method size_t getSize() const
+
+Returns conservative memory required for pixel storage.
+Includes unused memory on last row when rowBytesAsPixels exceeds width().
+
+Does not check to see if result fits in 32 bits. Use getSize64() if the
+result may exceed 32 bits.
+
+#Return height() times rowBytes() ##
+
+#Example
+#Description
+getSize results are not useful when width() and height() are large.
+##
+void draw(SkCanvas* canvas) {
+ SkBitmap bitmap;
+ for (int width : { 1, 1000, 1000000 } ) {
+ for (int height: { 1, 1000, 1000000 } ) {
+ SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
+ bitmap.setInfo(imageInfo, width * 5);
+ SkDebugf("width: %7d height: %7d getSize: %9zu\n", width, height, bitmap.getSize());
+ }
+ }
+}
+#StdOut
+width: 1 height: 1 getSize: 5
+width: 1 height: 1000 getSize: 5000
+width: 1 height: 1000000 getSize: 5000000
+width: 1000 height: 1 getSize: 5000
+width: 1000 height: 1000 getSize: 5000000
+width: 1000 height: 1000000 getSize: 705032704
+width: 1000000 height: 1 getSize: 5000000
+width: 1000000 height: 1000 getSize: 705032704
+width: 1000000 height: 1000000 getSize: 658067456
+##
+##
+
+#SeeAlso getSafeSize computeSize64 rowBytes width()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method size_t getSafeSize() const
+
+Returns minimum memory required for pixel storage.
+Does not include unused memory on last row when rowBytesAsPixels exceeds width().
+
+Returns zero if size does not fit in 32 bits. Use computeSafeSize64 if the
+result may exceed 32 bits.
+
+The pixel storage visible may be a subset of the Pixel_Ref. Accessing memory
+beyond the result may generate an exception.
+
+#Return exact pixel storage size ##
+
+#Example
+#Description
+getSafeSize results are not useful when width() and height() are large.
+##
+void draw(SkCanvas* canvas) {
+ SkBitmap bitmap;
+ for (int width : { 1, 1000, 1000000 } ) {
+ for (int height: { 1, 1000, 1000000 } ) {
+ SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
+ bitmap.setInfo(imageInfo, width * 5);
+ SkDebugf("width: %7d height: %7d getSafeSize: %9zu\n", width, height, bitmap.getSafeSize());
+ }
+ }
+}
+#StdOut
+width: 1 height: 1 getSafeSize: 4
+width: 1 height: 1000 getSafeSize: 4999
+width: 1 height: 1000000 getSafeSize: 4999999
+width: 1000 height: 1 getSafeSize: 4000
+width: 1000 height: 1000 getSafeSize: 4999000
+width: 1000 height: 1000000 getSafeSize: 0
+width: 1000000 height: 1 getSafeSize: 4000000
+width: 1000000 height: 1000 getSafeSize: 0
+width: 1000000 height: 1000000 getSafeSize: 0
+##
+##
+
+#SeeAlso getSize computeSafeSize64 rowBytes width()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int64_t computeSize64() const
+
+Returns conservative memory required for pixel storage.
+Includes unused memory on last row when rowBytesAsPixels exceeds width().
+
+#Return conservative pixel storage size ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ SkBitmap bitmap;
+ for (int width : { 1, 1000, 1000000 } ) {
+ for (int height: { 1, 1000, 1000000 } ) {
+ SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
+ bitmap.setInfo(imageInfo, width * 5);
+ SkDebugf("width: %7d height: %7d computeSize64: %13lld\n", width, height,
+ bitmap.computeSize64());
+ }
+ }
+}
+#StdOut
+width: 1 height: 1 computeSize64: 5
+width: 1 height: 1000 computeSize64: 5000
+width: 1 height: 1000000 computeSize64: 5000000
+width: 1000 height: 1 computeSize64: 5000
+width: 1000 height: 1000 computeSize64: 5000000
+width: 1000 height: 1000000 computeSize64: 5000000000
+width: 1000000 height: 1 computeSize64: 5000000
+width: 1000000 height: 1000 computeSize64: 5000000000
+width: 1000000 height: 1000000 computeSize64: 5000000000000
+##
+##
+
+#SeeAlso getSize computeSafeSize64 rowBytes width()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int64_t computeSafeSize64() const
+
+Returns minimum memory required for pixel storage.
+Does not include unused memory on last row when rowBytesAsPixels exceeds width().
+
+#Return exact pixel storage size ##
+
+#Example
+void draw(SkCanvas* canvas) {
+ SkBitmap bitmap;
+ for (int width : { 1, 1000, 1000000 } ) {
+ for (int height: { 1, 1000, 1000000 } ) {
+ SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
+ bitmap.setInfo(imageInfo, width * 5);
+ SkDebugf("width: %7d height: %7d computeSafeSize64: %13lld\n", width, height,
+ bitmap.computeSafeSize64());
+ }
+ }
+}
+#StdOut
+width: 1 height: 1 computeSafeSize64: 4
+width: 1 height: 1000 computeSafeSize64: 4999
+width: 1 height: 1000000 computeSafeSize64: 4999999
+width: 1000 height: 1 computeSafeSize64: 4000
+width: 1000 height: 1000 computeSafeSize64: 4999000
+width: 1000 height: 1000000 computeSafeSize64: 4999999000
+width: 1000000 height: 1 computeSafeSize64: 4000000
+width: 1000000 height: 1000 computeSafeSize64: 4999000000
+width: 1000000 height: 1000000 computeSafeSize64: 4999999000000
+##
+##
+
+#SeeAlso getSafeSize computeSize64 rowBytes width()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isImmutable() const
+
+Returns true if pixels can not change.
+
+Most immutable Bitmap checks trigger an assert only on debug builds.
+
+#Return true if pixels are immutable ##
+
+#Example
+ SkBitmap original;
+ SkImageInfo info = SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
+ if (original.tryAllocPixels(info)) {
+ original.setImmutable();
+ SkBitmap copy;
+ original.extractSubset(&copy, {5, 10, 15, 20});
+ SkDebugf("original is " "%s" "immutable\n", original.isImmutable() ? "" : "not ");
+ SkDebugf("copy is " "%s" "immutable\n", copy.isImmutable() ? "" : "not ");
+ }
+#StdOut
+original is immutable
+copy is immutable
+##
+##
+
+#SeeAlso setImmutable SkPixelRef::isImmutable SkImage
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setImmutable()
+
+Once set, pixels can not change. Any other bitmap sharing the same Pixel_Ref
+are also marked as immutable. Once Pixel_Ref is marked immutable, the setting
+cannot be cleared.
+
+Writing to immutable Bitmap pixels triggers an assert on debug builds.
+
+#Example
+#Description
+Triggers assert if SK_DEBUG is true, runs fine otherwise.
+##
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::MakeN32(4, 4, kPremul_SkAlphaType));
+ bitmap.allocPixels();
+ SkCanvas offscreen(bitmap);
+ SkDebugf("draw white\n");
+ offscreen.clear(SK_ColorWHITE);
+ bitmap.setImmutable();
+ SkDebugf("draw black\n");
+ offscreen.clear(SK_ColorBLACK);
+##
+
+#SeeAlso isImmutable SkPixelRef::setImmutable SkImage
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isOpaque() const
+
+Returns true if Alpha_Type is kOpaque_SkAlphaType.
+Does not check if Color_Type allows Alpha, or if any pixel value has
+transparency.
+
+#Return true if Image_Info describes opaque Alpha ##
+
+#Example
+#Description
+ isOpaque ignores whether all pixels are opaque or not.
+##
+ const int height = 2;
+ const int width = 2;
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType));
+ for (int index = 0; index < 2; ++index) {
+ bitmap.allocPixels();
+ bitmap.eraseColor(0x00000000);
+ SkDebugf("isOpaque: %s\n", bitmap.isOpaque() ? "true" : "false");
+ bitmap.eraseColor(0xFFFFFFFF);
+ SkDebugf("isOpaque: %s\n", bitmap.isOpaque() ? "true" : "false");
+ bitmap.setInfo(bitmap.info().makeAlphaType(kOpaque_SkAlphaType));
+ }
+#StdOut
+isOpaque: false
+isOpaque: false
+isOpaque: true
+isOpaque: true
+##
+##
+
+#SeeAlso ComputeIsOpaque SkImageInfo::isOpaque
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isVolatile() const
+
+If true, provides a hint to caller that pixels should not
+be cached. Only true if setIsVolatile has been called to mark as volatile.
+
+Volatile state is not shared by other bitmaps sharing the same Pixel_Ref.
+
+#Return true if marked volatile ##
+
+#Example
+ SkBitmap original;
+ SkImageInfo info = SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
+ if (original.tryAllocPixels(info)) {
+ original.setIsVolatile(true);
+ SkBitmap copy;
+ original.extractSubset(&copy, {5, 10, 15, 20});
+ SkDebugf("original is " "%s" "volatile\n", original.isVolatile() ? "" : "not ");
+ SkDebugf("copy is " "%s" "volatile\n", copy.isImmutable() ? "" : "not ");
+ }
+#StdOut
+original is volatile
+copy is not volatile
+##
+##
+
+#SeeAlso setIsVolatile
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setIsVolatile(bool isVolatile)
+
+Sets if pixels should be read from Pixel_Ref on every access. Bitmaps are not
+volatile by default; a GPU back end may upload pixel values expecting them to be
+accessed repeatedly. Marking temporary Bitmaps as volatile provides a hint to
+Device that the Bitmap pixels should not be cached. This can
+improve performance by avoiding overhead and reducing resource
+consumption on Device.
+
+#Param isVolatile true if backing pixels are temporary ##
+
+#Example
+#Height 20
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
+ bitmap.allocPixels();
+ bitmap.eraseColor(SK_ColorRED);
+ canvas->scale(16, 16);
+ canvas->drawBitmap(bitmap, 0, 0);
+ *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorBLUE);
+ canvas->drawBitmap(bitmap, 2, 0);
+ bitmap.setIsVolatile(true);
+ *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorGREEN);
+ canvas->drawBitmap(bitmap, 4, 0);
+##
+
+#SeeAlso isVolatile
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void reset()
+
+Resets to its initial state; all fields are set to zero, as if Bitmap had
+been initialized by SkBitmap().
+
+Sets width, height, row bytes to zero; pixel address to nullptr; SkColorType to
+kUnknown_SkColorType; and SkAlphaType to kUnknown_SkAlphaType.
+
+If Pixel_Ref is allocated, its reference count is decreased by one, releasing
+its memory if Bitmap is the sole owner.
+
+#Example
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
+ bitmap.allocPixels();
+ SkDebugf("width:%d height:%d isNull:%s\n", bitmap.width(), bitmap.height(),
+ bitmap.isNull() ? "true" : "false");
+ bitmap.reset();
+ SkDebugf("width:%d height:%d isNull:%s\n", bitmap.width(), bitmap.height(),
+ bitmap.isNull() ? "true" : "false");
+#StdOut
+width:1 height:1 isNull:false
+width:0 height:0 isNull:true
+##
+##
+
+#SeeAlso SkBitmap() SkAlphaType SkColorType
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static bool ComputeIsOpaque(const SkBitmap& bm)
+
+Returns true if all pixels are opaque. Color_Type determines how pixels
+are encoded, and whether pixel describes Alpha. Returns true for Color_Types
+without alpha in each pixel; for other Color_Types, returns true if all
+pixels have alpha values equivalent to 1.0 or greater.
+
+For Color_Types kRGB_565_SkColorType or kGray_8_SkColorType: always
+returns true. For Color_Types kAlpha_8_SkColorType, kBGRA_8888_SkColorType,
+kRGBA_8888_SkColorType: returns true if all pixel Alpha values are 255.
+For Color_Type kARGB_4444_SkColorType: returns true if all pixel Alpha values are 15.
+For kRGBA_F16_SkColorType: returns true if all pixel Alpha values are 1.0 or
+greater.
+
+Returns false for kUnknown_SkColorType.
+
+#Param bm Bitmap to check ##
+
+#Return true if all pixels have opaque values or Color_Type is opaque ##
+
+#Example
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::Make(2, 2, kN32_SkColorType, kPremul_SkAlphaType));
+ for (int index = 0; index < 2; ++index) {
+ bitmap.allocPixels();
+ bitmap.eraseColor(0x00000000);
+ SkDebugf("computeIsOpaque: %s\n", SkBitmap::ComputeIsOpaque(bitmap) ? "true" : "false");
+ bitmap.eraseColor(0xFFFFFFFF);
+ SkDebugf("computeIsOpaque: %s\n", SkBitmap::ComputeIsOpaque(bitmap) ? "true" : "false");
+ bitmap.setInfo(bitmap.info().makeAlphaType(kOpaque_SkAlphaType));
+ }
+#StdOut
+computeIsOpaque: false
+computeIsOpaque: true
+computeIsOpaque: false
+computeIsOpaque: true
+##
+##
+
+#SeeAlso isOpaque Color_Type Alpha
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void getBounds(SkRect* bounds) const
+
+Returns Rect { 0, 0, width(), height() }.
+
+#Param bounds container for floating point rectangle ##
+
+#Example
+#Height 160
+#Image 3
+ SkRect bounds;
+ source.getBounds(&bounds);
+ bounds.offset(100, 100);
+ SkPaint paint;
+ paint.setColor(SK_ColorGRAY);
+ canvas->scale(.25f, .25f);
+ canvas->drawRect(bounds, paint);
+ canvas->drawBitmap(source, 40, 40);
+##
+
+#SeeAlso bounds()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void getBounds(SkIRect* bounds) const
+
+Returns IRect { 0, 0, width(), height() }.
+
+#Param bounds container for integral rectangle ##
+
+#Example
+#Image 3
+ SkIRect bounds;
+ source.getBounds(&bounds);
+ bounds.inset(100, 100);
+ SkBitmap bitmap;
+ source.extractSubset(&bitmap, bounds);
+ canvas->scale(.5f, .5f);
+ canvas->drawBitmap(bitmap, 10, 10);
+##
+
+#SeeAlso bounds()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkIRect bounds() const
+
+Returns IRect { 0, 0, width(), height() }.
+
+#Return integral rectangle from origin to width() and height() ##
+
+#Example
+#Image 4
+ SkIRect bounds = source.bounds();
+ for (int x : { 0, bounds.width() } ) {
+ for (int y : { 0, bounds.height() } ) {
+ canvas->drawBitmap(source, x, y);
+ }
+ }
+##
+
+#SeeAlso getBounds
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkISize dimensions() const
+
+Returns ISize { width(), height() }.
+
+#Return integral size of width() and height() ##
+
+#Example
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::MakeN32(33, 55, kOpaque_SkAlphaType));
+ SkISize dimensions = bitmap.dimensions();
+ SkRect bounds;
+ bitmap.getBounds(&bounds);
+ SkRect dimensionsAsBounds = SkRect::Make(dimensions);
+ SkDebugf("dimensionsAsBounds %c= bounds\n", dimensionsAsBounds == bounds ? '=' : '!');
+##
+
+#SeeAlso height() width()
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkIRect getSubset() const
+
+Returns the bounds of this bitmap, offset by its Pixel_Ref origin.
+
+#Return bounds within Pixel_Ref bounds ##
+
+#Example
+#Image 3
+ SkIRect bounds;
+ source.getBounds(&bounds);
+ bounds.inset(100, 100);
+ SkBitmap subset;
+ source.extractSubset(&subset, bounds);
+ SkIRect r = source.getSubset();
+ SkDebugf("source: %d, %d, %d, %d\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
+ r = subset.getSubset();
+ SkDebugf("subset: %d, %d, %d, %d\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
+#StdOut
+source: 0, 0, 512, 512
+subset: 100, 100, 412, 412
+##
+##
+
+#SeeAlso extractSubset getBounds
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool setInfo(const SkImageInfo& imageInfo, size_t rowBytes = 0)
+
+Sets width, height, Alpha_Type, Color_Type, Color_Space, and optional
+rowBytes. Frees pixels, and returns true if successful.
+
+imageInfo.alphaType may be altered to a value permitted by imageInfo.colorSpace.
+If imageInfo.colorType is kUnknown_SkColorType, imageInfo.alphaType is
+set to kUnknown_SkAlphaType.
+If imageInfo.colorType is kAlpha_8_SkColorType and imageInfo.alphaType is
+kUnpremul_SkAlphaType, imageInfo.alphaType is replaced by kPremul_SkAlphaType.
+If imageInfo.colorType is kRGB_565_SkColorType or kGray_8_SkColorType,
+imageInfo.alphaType is set to kOpaque_SkAlphaType.
+If imageInfo.colorType is kARGB_4444_SkColorType, kRGBA_8888_SkColorType,
+kBGRA_8888_SkColorType, or kRGBA_F16_SkColorType: imageInfo.alphaType remains
+unchanged.
+
+rowBytes must equal or exceed imageInfo.minRowBytes. If imageInfo.colorSpace is
+kUnknown_SkColorType, rowBytes is ignored and treated as zero; for all other
+Color_Space values, rowBytes of zero is treated as imageInfo.minRowBytes.
+
+Calls reset() and returns false if:
+#List
+# rowBytes exceeds 31 bits ##
+# imageInfo.width() times imageInfo.bytesPerPixel exceeds 31 bits ##
+# imageInfo.width() is negative ##
+# imageInfo.height() is negative ##
+# rowBytes is positive and less than imageInfo.width() times imageInfo.bytesPerPixel ##
+##
+
+#Param imageInfo contains width, height, Alpha_Type, Color_Type, Color_Space ##
+#Param rowBytes imageInfo.minRowBytes or larger; or zero ##
+
+#Return true if Image_Info set successfully ##
+
+#Example
+#Height 96
+###^
+SkBitmap bitmap;
+bitmap.setInfo(SkImageInfo::MakeN32(44, 16, kOpaque_SkAlphaType));
+bitmap.allocPixels();
+bitmap.eraseColor(SK_ColorGREEN);
+SkCanvas offscreen(bitmap);
+SkPaint paint;
+offscreen.drawString("!@#$%", 0, 12, paint);
+canvas->scale(6, 6);
+canvas->drawBitmap(bitmap, 0, 0);
+^^^#
+##
+
+#SeeAlso Alpha_Type Color_Type Color_Space height rowBytes width
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Enum AllocFlags
+
+#Code
+ enum AllocFlags {
+ kZeroPixels_AllocFlag = 1 << 0,
+ };
+##
+
+AllocFlags provides the option to zero pixel memory when allocated.
+
+#Const kZeroPixels_AllocFlag 1
+ Instructs tryAllocPixelsFlags and allocPixelsFlags to zero pixel memory.
+##
+
+#NoExample
+##
+
+#SeeAlso tryAllocPixelsFlags allocPixelsFlags erase() eraseColor
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT tryAllocPixelsFlags(const SkImageInfo& info, uint32_t flags)
+
+Sets Image_Info to info following the rules in setInfo and allocates pixel
+memory. If flags is kZeroPixels_AllocFlag, memory is zeroed.
+
+Returns false and calls reset() if Image_Info could not be set, or memory could
+not be allocated, or memory size exceeds 31 bits, or memory could not optionally
+be zeroed.
+
+On most platforms, allocating pixel memory may succeed even though there is
+not sufficient memory to hold pixels; allocation does not take place
+until the pixels are written to. The actual behavior depends on the platform
+implementation of malloc(), if flags is zero, and calloc(), if flags is
+kZeroPixels_AllocFlag.
+
+Passing kZeroPixels_AllocFlag is usually faster than separately calling
+eraseColor(SK_ColorTRANSPARENT).
+
+#Param info contains width, height, Alpha_Type, Color_Type, Color_Space ##
+#Param flags kZeroPixels_AllocFlag, or zero ##
+
+#Return true if pixels allocation is successful ##
+
+#Example
+#Description
+For width of 100,000, height of 100,000, and 4 bytes per pixel, Pixel_Ref
+requires 40,000,000,000 bytes of storage. Allocator implemented
+internally by SkMallocPixelRef::MakeZeroed limits the maximum memory allowed;
+the allocation must fit in 31 bits.
+##
+ SkBitmap bitmap;
+ int loop = 0;
+ while (++loop) {
+ SkDebugf("attempt %d\n", loop);
+ if (!bitmap.tryAllocPixelsFlags(SkImageInfo::MakeN32(100000, 100000, kOpaque_SkAlphaType),
+ SkBitmap::kZeroPixels_AllocFlag)) {
+ SkDebugf("failed!\n");
+ break;
+ }
+ }
+#StdOut
+attempt 1
+failed!
+##
+##
+
+#SeeAlso allocPixelsFlags tryAllocPixels SkMallocPixelRef::MakeZeroed
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void allocPixelsFlags(const SkImageInfo& info, uint32_t flags)
+
+Sets Image_Info to info following the rules in setInfo and allocates pixel
+memory. If flags is kZeroPixels_AllocFlag, memory is zeroed.
+
+Aborts execution if Image_Info could not be set, or memory could
+not be allocated, or memory size exceeds 31 bits, or memory could not optionally
+be zeroed. Abort steps may be provided by the user at compile time by defining
+SK_ABORT.
+
+On most platforms, allocating pixel memory may succeed even though there is
+not sufficient memory to hold pixels; allocation does not take place
+until the pixels are written to. The actual behavior depends on the platform
+implementation of malloc(), if flags is zero, and calloc(), if flags is
+kZeroPixels_AllocFlag.
+
+Passing kZeroPixels_AllocFlag is usually faster than separately calling
+eraseColor(SK_ColorTRANSPARENT).
+
+#Param info contains width, height, Alpha_Type, Color_Type, Color_Space ##
+#Param flags kZeroPixels_AllocFlag, or zero ##
+
+#Example
+#Height 128
+#Description
+Text is drawn on a transparent background; drawing the bitmap a second time
+lets the first draw show through.
+##
+###^
+SkBitmap bitmap;
+bitmap.allocPixelsFlags(SkImageInfo::MakeN32(44, 16, kPremul_SkAlphaType),
+ SkBitmap::kZeroPixels_AllocFlag);
+SkCanvas offscreen(bitmap);
+SkPaint paint;
+offscreen.drawString("!@#$%", 0, 12, paint);
+canvas->scale(6, 6);
+canvas->drawBitmap(bitmap, 0, 0);
+canvas->drawBitmap(bitmap, 8, 8);
+^^^#
+##
+
+#SeeAlso tryAllocPixelsFlags allocPixels SkMallocPixelRef::MakeZeroed
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info, size_t rowBytes)
+
+#ToDo am I ever conflicted about setInfo rules. It needs to be able to be replicated
+ if, for instance, I generate one-page-per-method HTML-style documentation
+ I'm not so sure it makes sense to put the indirection in for .h either unless
+ my mantra is that .h should abbreviate full documentation. And, what to do
+ for generated markdown? At least there the rules are a click away, although
+ a pop-down in place would be way better. Hmmm.
+##
+
+Sets Image_Info to info following the rules in setInfo and allocates pixel
+memory. rowBytes must equal or exceed info.width() times info.bytesPerPixel(),
+or equal zero. Pass in zero for rowBytes to compute the minimum valid value.
+
+Returns false and calls reset() if Image_Info could not be set, or memory could
+not be allocated.
+
+On most platforms, allocating pixel memory may succeed even though there is
+not sufficient memory to hold pixels; allocation does not take place
+until the pixels are written to. The actual behavior depends on the platform
+implementation of malloc().
+
+#Param info contains width, height, Alpha_Type, Color_Type, Color_Space ##
+#Param rowBytes size of pixel row or larger; may be zero ##
+
+#Return true if pixel storage is allocated ##
+
+#Example
+#Image 3
+SkBitmap bitmap;
+SkImageInfo info = SkImageInfo::Make(64, 256, kGray_8_SkColorType, kOpaque_SkAlphaType);
+if (bitmap.tryAllocPixels(info, 0)) {
+ SkCanvas offscreen(bitmap);
+ offscreen.scale(.5f, .5f);
+ for (int x : { 0, 64, 128, 192 } ) {
+ offscreen.drawBitmap(source, -x, 0);
+ canvas->drawBitmap(bitmap, x, 0);
+ }
+}
+##
+
+#SeeAlso tryAllocPixelsFlags allocPixels SkMallocPixelRef::MakeAllocate
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void allocPixels(const SkImageInfo& info, size_t rowBytes)
+
+Sets Image_Info to info following the rules in setInfo and allocates pixel
+memory. rowBytes must equal or exceed info.width() times info.bytesPerPixel(),
+or equal zero. Pass in zero for rowBytes to compute the minimum valid value.
+
+Aborts execution if Image_Info could not be set, or memory could
+not be allocated, or memory size exceeds 31 bits. Abort steps may be provided by
+the user at compile time by defining SK_ABORT.
+
+On most platforms, allocating pixel memory may succeed even though there is
+not sufficient memory to hold pixels; allocation does not take place
+until the pixels are written to. The actual behavior depends on the platform
+implementation of malloc().
+
+#Param info contains width, height, Alpha_Type, Color_Type, Color_Space ##
+#Param rowBytes size of pixel row or larger; may be zero ##
+
+#Example
+#Image 3
+SkBitmap bitmap;
+SkImageInfo info = SkImageInfo::Make(256, 64, kGray_8_SkColorType, kOpaque_SkAlphaType);
+bitmap.allocPixels(info, info.width() * info.bytesPerPixel() + 64);
+SkCanvas offscreen(bitmap);
+offscreen.scale(.5f, .5f);
+for (int y : { 0, 64, 128, 192 } ) {
+ offscreen.drawBitmap(source, 0, -y);
+ canvas->drawBitmap(bitmap, 0, y);
+}
+##
+
+#SeeAlso tryAllocPixels allocPixelsFlags SkMallocPixelRef::MakeAllocate
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info)
+
+Sets Image_Info to info following the rules in setInfo and allocates pixel
+memory.
+
+Returns false and calls reset() if Image_Info could not be set, or memory could
+not be allocated.
+
+On most platforms, allocating pixel memory may succeed even though there is
+not sufficient memory to hold pixels; allocation does not take place
+until the pixels are written to. The actual behavior depends on the platform
+implementation of malloc().
+
+#Param info contains width, height, Alpha_Type, Color_Type, Color_Space ##
+
+#Return true if pixel storage is allocated ##
+
+#Example
+#Image 3
+SkBitmap bitmap;
+if (bitmap.tryAllocPixels(SkImageInfo::Make(64, 64, kGray_8_SkColorType, kOpaque_SkAlphaType))) {
+ SkCanvas offscreen(bitmap);
+ offscreen.scale(.25f, .5f);
+ for (int y : { 0, 64, 128, 192 } ) {
+ offscreen.drawBitmap(source, -y, -y);
+ canvas->drawBitmap(bitmap, y, y);
+ }
+}
+##
+
+#SeeAlso tryAllocPixelsFlags allocPixels SkMallocPixelRef::MakeAllocate
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void allocPixels(const SkImageInfo& info)
+
+Sets Image_Info to info following the rules in setInfo and allocates pixel
+memory.
+
+Aborts execution if Image_Info could not be set, or memory could
+not be allocated, or memory size exceeds 31 bits. Abort steps may be provided by
+the user at compile time by defining SK_ABORT.
+
+On most platforms, allocating pixel memory may succeed even though there is
+not sufficient memory to hold pixels; allocation does not take place
+until the pixels are written to. The actual behavior depends on the platform
+implementation of malloc().
+
+#Param info contains width, height, Alpha_Type, Color_Type, Color_Space ##
+
+#Example
+#Image 4
+SkBitmap bitmap;
+bitmap.allocPixels(SkImageInfo::Make(64, 64, kGray_8_SkColorType, kOpaque_SkAlphaType));
+SkCanvas offscreen(bitmap);
+offscreen.scale(.5f, .5f);
+for (int y : { 0, 64, 128, 192 } ) {
+ offscreen.drawBitmap(source, -y, -y);
+ canvas->drawBitmap(bitmap, y, y);
+}
+##
+
+#SeeAlso tryAllocPixels allocPixelsFlags SkMallocPixelRef::MakeAllocate
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT tryAllocN32Pixels(int width, int height, bool isOpaque = false)
+
+Sets Image_Info to width, height, and the native Color_Type; and allocates
+pixel memory. If isOpaque is true, sets Image_Info to kOpaque_SkAlphaType;
+otherwise, sets to kPremul_SkAlphaType.
+
+Calls reset() and returns false if width exceeds 29 bits or is negative,
+or height is negative.
+
+Returns false if allocation fails.
+
+Use to create Bitmap that matches native pixel arrangement on the platform,
+to draw without converting its pixel format.
+
+#Param width pixel column count; must be zero or greater ##
+#Param height pixel row count; must be zero or greater ##
+#Param isOpaque true if pixels do not have transparency ##
+
+#Return true if pixel storage is allocated ##
+
+#Example
+#Height 160
+ SkBitmap bitmap;
+ if (bitmap.tryAllocN32Pixels(80, 80)) {
+ bitmap.eraseColor(SK_ColorTRANSPARENT);
+ bitmap.erase(0x7f3f7fff, SkIRect::MakeWH(50, 30));
+ bitmap.erase(0x3f7fff3f, SkIRect::MakeXYWH(20, 10, 50, 30));
+ bitmap.erase(0x5fff3f7f, SkIRect::MakeXYWH(40, 20, 50, 30));
+ canvas->drawBitmap(bitmap, 0, 0);
+ for (int x : { 0, 30, 60, 90 } ) {
+ canvas->drawBitmap(bitmap, x, 70);
+ }
+ }
+##
+
+#SeeAlso tryAllocPixels allocN32Pixels SkMallocPixelRef::MakeAllocate
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void allocN32Pixels(int width, int height, bool isOpaque = false)
+
+Sets Image_Info to width, height, and the native Color_Type; and allocates
+pixel memory. If isOpaque is true, sets Image_Info to kPremul_SkAlphaType;
+otherwise, sets to kOpaque_SkAlphaType.
+
+Aborts if width exceeds 29 bits or is negative, or height is negative, or
+allocation fails. Abort steps may be provided by the user at compile time by
+defining SK_ABORT.
+
+Use to create Bitmap that matches native pixel arrangement on the platform,
+to draw without converting its pixel format.
+
+#Param width pixel column count; must be zero or greater ##
+#Param height pixel row count; must be zero or greater ##
+#Param isOpaque true if pixels do not have transparency ##
+
+#Example
+ SkRandom random;
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(64, 64);
+ bitmap.eraseColor(SK_ColorTRANSPARENT);
+ for (int y = 0; y < 256; y += 64) {
+ for (int x = 0; x < 256; x += 64) {
+ SkColor color = random.nextU();
+ uint32_t w = random.nextRangeU(4, 32);
+ uint32_t cx = random.nextRangeU(0, 64 - w);
+ uint32_t h = random.nextRangeU(4, 32);
+ uint32_t cy = random.nextRangeU(0, 64 - h);
+ bitmap.erase(color, SkIRect::MakeXYWH(cx, cy, w, h));
+ canvas->drawBitmap(bitmap, x, y);
+ }
+ }
+##
+
+#SeeAlso allocPixels tryAllocN32Pixels SkMallocPixelRef::MakeAllocate
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
+ void (*releaseProc)(void* addr, void* context), void* context)
+
+Sets Image_Info to info following the rules in setInfo, and creates Pixel_Ref
+containing pixels and rowBytes. releaseProc, if not nullptr, is called
+immediately on failure or when pixels are no longer referenced. context may be
+nullptr.
+
+If Image_Info could not be set, or rowBytes is less than info.minRowBytes:
+calls releaseProc if present, calls reset(), and returns false.
+
+Otherwise, if pixels equals nullptr: sets Image_Info, calls releaseProc if
+present, returns true.
+
+If Image_Info is set, pixels is not nullptr, and releaseProc is not nullptr:
+when pixels are no longer referenced, calls releaseProc with pixels and context
+as parameters.
+
+#Param info contains width, height, Alpha_Type, Color_Type, Color_Space ##
+#Param pixels address or pixel storage; may be nullptr ##
+#Param rowBytes size of pixel row or larger ##
+#Param releaseProc function called when pixels can be deleted; may be nullptr ##
+#Param context caller state passed to releaseProc; may be nullptr ##
+
+#Return true if Image_Info is set to info ##
+
+#Example
+#Description
+releaseProc is called immediately because rowBytes is too small for Pixel_Ref.
+##
+#Function
+static void releaseProc(void* addr, void* ) {
+ SkDebugf("releaseProc called\n");
+ delete[] (uint32_t*) addr;
+}
+
+##
+
+void draw(SkCanvas* canvas) {
+ SkBitmap bitmap;
+ void* pixels = new uint32_t[8 * 8];
+ SkImageInfo info = SkImageInfo::MakeN32(8, 8, kOpaque_SkAlphaType);
+ SkDebugf("before installPixels\n");
+ bool installed = bitmap.installPixels(info, pixels, 16, releaseProc, nullptr);
+ SkDebugf("install " "%s" "successful\n", installed ? "" : "not ");
+}
+#StdOut
+before installPixels
+releaseProc called
+install not successful
+##
+##
+
+#SeeAlso allocPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes)
+
+Sets Image_Info to info following the rules in setInfo, and creates Pixel_Ref
+containing pixels and rowBytes.
+
+If Image_Info could not be set, or rowBytes is less than info.minRowBytes:
+calls reset(), and returns false.
+
+Otherwise, if pixels equals nullptr: sets Image_Info, returns true.
+
+Caller must ensure that pixels are valid for the lifetime of Bitmap and Pixel_Ref.
+
+#Param info contains width, height, Alpha_Type, Color_Type, Color_Space ##
+#Param pixels address or pixel storage; may be nullptr ##
+#Param rowBytes size of pixel row or larger ##
+
+#Return true if Image_Info is set to info ##
+
+#Example
+#Description
+#Bug 7079 ##
+GPU does not support kUnpremul_SkAlphaType, does not assert that it does not.
+##
+void draw(SkCanvas* canvas) {
+ SkRandom random;
+ SkBitmap bitmap;
+ const int width = 8;
+ const int height = 8;
+ uint32_t pixels[width * height];
+ for (unsigned x = 0; x < width * height; ++x) {
+ pixels[x] = random.nextU();
+ }
+ SkImageInfo info = SkImageInfo::MakeN32(width, height, kUnpremul_SkAlphaType);
+ if (bitmap.installPixels(info, pixels, info.minRowBytes())) {
+ canvas->scale(32, 32);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
+}
+##
+
+#SeeAlso allocPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool installPixels(const SkPixmap& pixmap)
+
+Sets Image_Info to pixmap.info() following the rules in setInfo, and creates
+Pixel_Ref containing pixmap.addr() and pixmap.rowBytes.
+
+If Image_Info could not be set, or pixmap.rowBytes is less than
+SkImageInfo::minRowBytes: calls reset(), and returns false.
+
+Otherwise, if pixmap.addr() equals nullptr: sets Image_Info, returns true.
+
+Caller must ensure that pixmap is valid for the lifetime of Bitmap and Pixel_Ref.
+
+#Param pixmap Image_Info, pixel address, and rowBytes ##
+
+#Return true if Image_Info was set to pixmap.info() ##
+
+#Example
+#Description
+Draw a five by five bitmap, and draw it again with a center white pixel.
+##
+#Height 64
+ uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },
+ { 0xAC, 0xA8, 0x89, 0x47, 0x87 },
+ { 0x4B, 0x25, 0x25, 0x25, 0x46 },
+ { 0x90, 0x81, 0x25, 0x41, 0x33 },
+ { 0x75, 0x55, 0x44, 0x20, 0x00 }};
+ SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kOpaque_SkAlphaType);
+ SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);
+ SkBitmap bitmap;
+ bitmap.installPixels(pixmap);
+ canvas->scale(10, 10);
+ canvas->drawBitmap(bitmap, 0, 0);
+ *pixmap.writable_addr8(2, 2) = 0xFF;
+ bitmap.installPixels(pixmap);
+ canvas->drawBitmap(bitmap, 10, 0);
+##
+
+#SeeAlso allocPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool installMaskPixels(const SkMask& mask)
+
+Sets Image_Info to mask width, mask height, kAlpha_8_SkColorType, and
+kPremul_SkAlphaType. Sets Pixel_Ref to mask image and mask rowBytes.
+
+Returns false and calls reset() if mask format is not SkMask::kA8_Format,
+or if mask width or mask height is negative, or if mask rowBytes is less
+than mask width.
+
+Caller must ensure that mask is valid for the lifetime of Bitmap and Pixel_Ref.
+
+#Param mask Alpha 8-bit bitmap ##
+
+#Return true if Image_Info and Pixel_Ref refer to mask ##
+
+#Example
+#Description
+Draw a five by five bitmap, and draw it again with a center white pixel.
+##
+#Height 64
+ uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },
+ { 0xAC, 0xA8, 0x89, 0x47, 0x87 },
+ { 0x4B, 0x25, 0x25, 0x25, 0x46 },
+ { 0x90, 0x81, 0x25, 0x41, 0x33 },
+ { 0x75, 0x55, 0x44, 0x20, 0x00 }};
+ SkMask mask;
+ mask.fImage = storage[0];
+ mask.fBounds = SkIRect::MakeWH(5, 5);
+ mask.fRowBytes = 5;
+ mask.fFormat = SkMask::kA8_Format;
+ SkBitmap bitmap;
+ bitmap.installMaskPixels(mask);
+ canvas->scale(10, 10);
+ canvas->drawBitmap(bitmap, 0, 0);
+ storage[2][2] = 0xFF;
+ bitmap.installMaskPixels(mask);
+ canvas->drawBitmap(bitmap, 10, 0);
+##
+
+#SeeAlso installPixels allocPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setPixels(void* pixels)
+
+Replaces Pixel_Ref with pixels, preserving Image_Info and rowBytes.
+Sets Pixel_Ref origin to (0, 0).
+
+If pixels is nullptr, or if info().colorType equals kUnknown_SkColorType;
+release reference to Pixel_Ref, and set Pixel_Ref to nullptr.
+
+Caller is responsible for handling ownership pixel memory for the lifetime
+of Bitmap and Pixel_Ref.
+
+#Param pixels address of pixel storage, managed by caller ##
+
+#Example
+#Height 50
+ uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 };
+ uint8_t set2[5] = { 0xAC, 0xA8, 0x89, 0x47, 0x87 };
+ SkBitmap bitmap;
+ bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5);
+ canvas->scale(10, 50);
+ canvas->drawBitmap(bitmap, 0, 0);
+ bitmap.setPixels(set2);
+ canvas->drawBitmap(bitmap, 10, 0);
+##
+
+#SeeAlso installPixels allocPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT tryAllocPixels()
+
+Allocates pixel memory with HeapAllocator, and replaces existing Pixel_Ref.
+The allocation size is determined by Image_Info width, height, and Color_Type.
+
+Returns false if info().colorType is kUnknown_SkColorType, or allocation exceeds
+31 bits, or allocation fails.
+
+#Return true if the allocation succeeds
+##
+
+#Example
+#Height 50
+#Description
+Bitmap hosts and draws gray values in set1. tryAllocPixels replaces Pixel_Ref
+and erases it to black, but does not alter set1. setPixels replaces black
+Pixel_Ref with set1.
+##
+ uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 };
+ SkBitmap bitmap;
+ bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5);
+ canvas->scale(10, 50);
+ canvas->drawBitmap(bitmap, 0, 0);
+ if (bitmap.tryAllocPixels()) {
+ bitmap.eraseColor(SK_ColorBLACK);
+ canvas->drawBitmap(bitmap, 8, 0);
+ bitmap.setPixels(set1);
+ canvas->drawBitmap(bitmap, 16, 0);
+ }
+##
+
+#SeeAlso allocPixels installPixels setPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void allocPixels()
+
+Allocates pixel memory with HeapAllocator, and replaces existing Pixel_Ref.
+The allocation size is determined by Image_Info width, height, and Color_Type.
+
+Aborts if info().colorType is kUnknown_SkColorType, or allocation exceeds
+31 bits, or allocation fails. Abort steps may be provided by the user at compile
+time by defining SK_ABORT.
+
+#Example
+#Height 50
+#Description
+Bitmap hosts and draws gray values in set1. allocPixels replaces Pixel_Ref
+and erases it to black, but does not alter set1. setPixels replaces black
+Pixel_Ref with set2.
+##
+ uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 };
+ uint8_t set2[5] = { 0xAC, 0xA8, 0x89, 0x47, 0x87 };
+ SkBitmap bitmap;
+ bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5);
+ canvas->scale(10, 50);
+ canvas->drawBitmap(bitmap, 0, 0);
+ bitmap.allocPixels();
+ bitmap.eraseColor(SK_ColorBLACK);
+ canvas->drawBitmap(bitmap, 8, 0);
+ bitmap.setPixels(set2);
+ canvas->drawBitmap(bitmap, 16, 0);
+##
+
+#SeeAlso tryAllocPixels installPixels setPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT tryAllocPixels(Allocator* allocator)
+
+Allocates pixel memory with allocator, and replaces existing Pixel_Ref.
+The allocation size is determined by Image_Info width, height, and Color_Type.
+If allocator is nullptr, use HeapAllocator instead.
+
+Returns false if allocator allocPixelRef return false.
+
+#Param allocator instance of SkBitmap::Allocator instantiation ##
+
+#Return true if custom allocator reports success
+##
+
+#Example
+#Height 100
+#Description
+HeapAllocator limits the maximum size of Bitmap to two gigabytes. Using
+a custom allocator, this limitation may be relaxed. This example can be
+modified to allocate an eight gigabyte Bitmap on a 64 bit platform with
+sufficient memory.
+##
+#Function
+class LargePixelRef : public SkPixelRef {
+public:
+ LargePixelRef(const SkImageInfo& info, char* storage, size_t rowBytes)
+ : SkPixelRef(info.width(), info.height(), storage, rowBytes) {
+ }
+
+ ~LargePixelRef() override {
+ delete[] (char* ) this->pixels();
+ }
+};
+
+class LargeAllocator : public SkBitmap::Allocator {
+public:
+ bool allocPixelRef(SkBitmap* bitmap) override {
+ const SkImageInfo& info = bitmap->info();
+ uint64_t rowBytes = info.minRowBytes64();
+ uint64_t size = info.height() * rowBytes;
+ char* addr = new char[size];
+ if (nullptr == addr) {
+ return false;
+ }
+ sk_sp<SkPixelRef> pr = sk_sp<SkPixelRef>(new LargePixelRef(info, addr, rowBytes));
+ if (!pr) {
+ return false;
+ }
+ bitmap->setPixelRef(std::move(pr), 0, 0);
+ return true;
+ }
+};
+
+##
+
+void draw(SkCanvas* canvas) {
+ LargeAllocator largeAllocator;
+ SkBitmap bitmap;
+ int width = 100; // make this 20000
+ int height = 100; // and this 100000 to allocate 8 gigs on a 64-bit platform
+ bitmap.setInfo(SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType));
+ if (bitmap.tryAllocPixels(&largeAllocator)) {
+ bitmap.eraseColor(0xff55aa33);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
+}
+
+##
+
+#SeeAlso allocPixels Allocator Pixel_Ref
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void allocPixels(Allocator* allocator)
+
+Allocates pixel memory with allocator, and replaces existing Pixel_Ref.
+The allocation size is determined by Image_Info width, height, and Color_Type.
+If allocator is nullptr, use HeapAllocator instead.
+
+Aborts if allocator allocPixelRef return false. Abort steps may be provided by
+the user at compile time by defining SK_ABORT.
+
+#Param allocator instance of SkBitmap::Allocator instantiation ##
+
+#Example
+#Height 32
+#Function
+class TinyAllocator : public SkBitmap::Allocator {
+public:
+ bool allocPixelRef(SkBitmap* bitmap) override {
+ const SkImageInfo& info = bitmap->info();
+ if (info.height() * info.minRowBytes() > sizeof(storage)) {
+ return false;
+ }
+ sk_sp<SkPixelRef> pr = sk_sp<SkPixelRef>(
+ new SkPixelRef(info.width(), info.height(), storage, info.minRowBytes()));
+ bitmap->setPixelRef(std::move(pr), 0, 0);
+ return true;
+ }
+
+ char storage[16];
+};
+
+##
+
+void draw(SkCanvas* canvas) {
+ TinyAllocator tinyAllocator;
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::MakeN32(2, 2, kOpaque_SkAlphaType));
+ if (bitmap.tryAllocPixels(&tinyAllocator)) {
+ bitmap.eraseColor(0xff55aa33);
+ bitmap.erase(0xffaa3355, SkIRect::MakeXYWH(1, 1, 1, 1));
+ canvas->scale(16, 16);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
+}
+##
+
+#SeeAlso allocPixels Allocator Pixel_Ref
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkPixelRef* pixelRef() const
+
+Returns Pixel_Ref, which contains: pixel base address; its dimensions; and
+rowBytes, the interval from one row to the next. Does not change Pixel_Ref
+reference count. Pixel_Ref may be shared by multiple bitmaps.
+If Pixel_Ref has not been set, returns nullptr.
+
+#Return Pixel_Ref, or nullptr ##
+
+#Example
+#Image 3
+ SkBitmap subset;
+ source.extractSubset(&subset, SkIRect::MakeXYWH(32, 64, 128, 256));
+ SkDebugf("src ref %c= sub ref\n", source.pixelRef() == subset.pixelRef() ? '=' : '!');
+ SkDebugf("src pixels %c= sub pixels\n", source.getPixels() == subset.getPixels() ? '=' : '!');
+ SkDebugf("src addr %c= sub addr\n", source.getAddr(32, 64) == subset.getAddr(0, 0) ? '=' : '!');
+##
+
+#SeeAlso getPixels getAddr
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkIPoint pixelRefOrigin() const
+
+Returns origin of pixels within Pixel_Ref. Bitmap bounds is always contained
+by Pixel_Ref bounds, which may be the same size or larger. Multiple Bitmaps
+can share the same Pixel_Ref, where each Bitmap has different bounds.
+
+The returned origin added to Bitmap dimensions equals or is smaller than the
+Pixel_Ref dimensions.
+
+Returns (0, 0) if Pixel_Ref is nullptr.
+
+#Return pixel origin within Pixel_Ref ##
+
+#Example
+#Image 3
+ SkBitmap subset;
+ source.extractSubset(&subset, SkIRect::MakeXYWH(32, 64, 128, 256));
+ SkIPoint sourceOrigin = source.pixelRefOrigin();
+ SkIPoint subsetOrigin = subset.pixelRefOrigin();
+ SkDebugf("source origin: %d, %d\n", sourceOrigin.fX, sourceOrigin.fY);
+ SkDebugf("subset origin: %d, %d\n", subsetOrigin.fX, subsetOrigin.fY);
+#StdOut
+source origin: 0, 0
+subset origin: 32, 64
+##
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setPixelRef(sk_sp<SkPixelRef> pixelRef, int dx, int dy)
+
+Replaces pixelRef and origin in Bitmap. dx and dy specify the offset
+within the Pixel_Ref pixels for the top-left corner of the bitmap.
+
+Asserts in debug builds if dx or dy are out of range. Pins dx and dy
+to legal range in release builds.
+
+The caller is responsible for ensuring that the pixels match the
+Color_Type and Alpha_Type in Image_Info.
+
+#Param pixelRef Pixel_Ref describing pixel address and rowBytes ##
+#Param dx column offset in Pixel_Ref for bitmap origin ##
+#Param dy row offset in Pixel_Ref for bitmap origin ##
+
+#Example
+#Height 140
+#Image 5
+#Description
+Treating 32 bit data as 8 bit data is unlikely to produce useful results.
+##
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::Make(source.width() - 5, source.height() - 5,
+ kGray_8_SkColorType, kOpaque_SkAlphaType), source.rowBytes());
+ bitmap.setPixelRef(sk_ref_sp(source.pixelRef()), 5, 5);
+ canvas->drawBitmap(bitmap, 10, 10);
+##
+
+#SeeAlso setInfo
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool readyToDraw() const
+
+Returns true if Bitmap is can be drawn.
+
+#Return true if getPixels() is not nullptr ##
+
+#Example
+#Image 5
+#Height 160
+ if (source.readyToDraw()) {
+ canvas->drawBitmap(source, 10, 10);
+ }
+##
+
+#SeeAlso getPixels drawsNothing
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method uint32_t getGenerationID() const
+
+Returns a unique value corresponding to the pixels in Pixel_Ref.
+Returns a different value after notifyPixelsChanged has been called.
+Returns zero if Pixel_Ref is nullptr.
+
+Determines if pixels have changed since last examined.
+
+#Return unique value for pixels in Pixel_Ref ##
+
+#Example
+ SkBitmap bitmap;
+ SkDebugf("empty id %u\n", bitmap.getGenerationID());
+ bitmap.allocPixels(SkImageInfo::MakeN32(64, 64, kOpaque_SkAlphaType));
+ SkDebugf("alloc id %u\n", bitmap.getGenerationID());
+ bitmap.eraseColor(SK_ColorRED);
+ SkDebugf("erase id %u\n", bitmap.getGenerationID());
+#StdOut
+#Volatile
+empty id 0
+alloc id 4
+erase id 6
+##
+##
+
+#SeeAlso notifyPixelsChanged Pixel_Ref
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void notifyPixelsChanged() const
+
+Marks that pixels in Pixel_Ref have changed. Subsequent calls to
+getGenerationID() return a different value.
+
+#Example
+#Height 20
+ SkBitmap bitmap;
+ bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
+ bitmap.allocPixels();
+ bitmap.eraseColor(SK_ColorRED);
+ canvas->scale(16, 16);
+ canvas->drawBitmap(bitmap, 0, 0);
+ *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorBLUE);
+ canvas->drawBitmap(bitmap, 2, 0);
+ bitmap.notifyPixelsChanged();
+ *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorGREEN);
+ canvas->drawBitmap(bitmap, 4, 0);
+##
+
+#SeeAlso getGenerationID isVolatile Pixel_Ref
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void eraseColor(SkColor c) const
+
+Replaces pixel values with c. All pixels contained by bounds() are affected.
+If the colorType is kGray_8_SkColorType or k565_SkColorType, then Color_Alpha
+is ignored; Color_RGB is treated as opaque. If colorType is kAlpha_8_SkColorType,
+then Color_RGB is ignored.
+
+#Param c Unpremultiplied Color ##
+
+#Example
+#Height 20
+ SkBitmap bitmap;
+ bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kOpaque_SkAlphaType));
+ bitmap.eraseColor(SK_ColorRED);
+ canvas->scale(16, 16);
+ canvas->drawBitmap(bitmap, 0, 0);
+##
+
+#SeeAlso eraseARGB eraseRGB erase
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const
+
+Replaces pixel values with Unpremultiplied Color built from a, r, g, and b.
+All pixels contained by bounds() are affected.
+If the colorType is kGray_8_SkColorType or k565_SkColorType, then a
+is ignored; r, g, and b are treated as opaque. If colorType is kAlpha_8_SkColorType,
+then r, g, and b are ignored.
+
+#Param a amount of Color_Alpha, from fully transparent (0) to fully opaque (255) ##
+#Param r amount of Color_RGB_Red, from no red (0) to full red (255) ##
+#Param g amount of Color_RGB_Green, from no green (0) to full green (255) ##
+#Param b amount of Color_RGB_Blue, from no blue (0) to full blue (255) ##
+
+#Example
+#Height 80
+ SkBitmap bitmap;
+ bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType));
+ bitmap.eraseARGB(0x7f, 0xff, 0x7f, 0x3f);
+ canvas->scale(50, 50);
+ canvas->drawBitmap(bitmap, 0, 0);
+ canvas->drawBitmap(bitmap, .5f, .5f);
+##
+
+#SeeAlso eraseColor eraseRGB erase
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const
+
+Replaces pixel values with Color built from r, g, and b with Color_Alpha set
+to 255. All pixels contained by bounds() are affected.
+If colorType is kAlpha_8_SkColorType, all pixels are set to 255.
+
+#Param r amount of Color_RGB_Red, from no red (0) to full red (255) ##
+#Param g amount of Color_RGB_Green, from no green (0) to full green (255) ##
+#Param b amount of Color_RGB_Blue, from no blue (0) to full blue (255) ##
+
+#Example
+#Height 80
+ SkBitmap bitmap;
+ bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType));
+ bitmap.eraseRGB(0xff, 0x7f, 0x3f);
+ canvas->scale(50, 50);
+ canvas->drawBitmap(bitmap, 0, 0);
+ canvas->drawBitmap(bitmap, .5f, .5f);
+##
+
+#SeeAlso eraseColor eraseARGB erase
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void erase(SkColor c, const SkIRect& area) const
+
+Replaces pixel values inside area with c. If area does not intersect bounds(),
+call has no effect.
+
+If the colorType is kGray_8_SkColorType or k565_SkColorType, then Color_Alpha
+is ignored; Color_RGB is treated as opaque. If colorType is kAlpha_8_SkColorType,
+then Color_RGB is ignored.
+
+#Param c Unpremultiplied Color ##
+#Param area rectangle to fill ##
+
+#Example
+#Height 70
+ SkBitmap bitmap;
+ bitmap.allocPixels(SkImageInfo::MakeN32(2, 2, kPremul_SkAlphaType));
+ bitmap.erase(0x7fff7f3f, SkIRect::MakeWH(1, 1));
+ bitmap.erase(0x7f7f3fff, SkIRect::MakeXYWH(0, 1, 1, 1));
+ bitmap.erase(0x7f3fff7f, SkIRect::MakeXYWH(1, 0, 1, 1));
+ bitmap.erase(0x7f1fbf5f, SkIRect::MakeXYWH(1, 1, 1, 1));
+ canvas->scale(25, 25);
+ canvas->drawBitmap(bitmap, 0, 0);
+ canvas->drawBitmap(bitmap, .5f, .5f);
+
+##
+
+#SeeAlso eraseColor eraseARGB eraseRGB SkCanvas::drawRect
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void eraseArea(const SkIRect& area, SkColor c) const
+
+Legacy call to be deprecated.
+
+#Deprecated
+##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkColor getColor(int x, int y) const
+
+Returns pixel at (x, y) as Unpremultiplied Color.
+Returns black with Alpha if Color_Type is kAlpha_8_SkColorType.
+
+Input is not validated: out of bounds values of x or y trigger an assert() if
+built with SK_DEBUG defined; and returns undefined values or may crash if
+SK_RELEASE is defined. Fails if Color_Type is kUnknown_SkColorType or
+pixel address is nullptr.
+
+Color_Space in Image_Info is ignored. Some Color precision may be lost in the
+conversion to Unpremultiplied Color; original pixel data may have additional
+precision.
+
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
+
+#Return pixel converted to Unpremultiplied Color ##
+
+#Example
+ const int w = 4;
+ const int h = 4;
+ SkColor colors[][w] = {
+ 0x00000000, 0x2a0e002a, 0x55380055, 0x7f7f007f,
+ 0x2a000e2a, 0x551c1c55, 0x7f542a7f, 0xaaaa38aa,
+ 0x55003855, 0x7f2a547f, 0xaa7171aa, 0xd4d48dd4,
+ 0x7f007f7f, 0xaa38aaaa, 0xd48dd4d4, 0xffffffff,
+ };
+ SkDebugf("Premultiplied:\n");
+ for (int y = 0; y < h; ++y) {
+ SkDebugf("(0, %d) ", y);
+ for (int x = 0; x < w; ++x) {
+ SkDebugf("0x%08x%c", colors[y][x], x == w - 1 ? '\n' : ' ');
+ }
+ }
+ SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), colors, w * 4);
+ SkBitmap bitmap;
+ bitmap.installPixels(pixmap);
+ SkDebugf("Unpremultiplied:\n");
+ for (int y = 0; y < h; ++y) {
+ SkDebugf("(0, %d) ", y);
+ for (int x = 0; x < w; ++x) {
+ SkDebugf("0x%08x%c", bitmap.getColor(x, y), x == w - 1 ? '\n' : ' ');
+ }
+ }
+#StdOut
+Premultiplied:
+(0, 0) 0x00000000 0x2a0e002a 0x55380055 0x7f7f007f
+(0, 1) 0x2a000e2a 0x551c1c55 0x7f542a7f 0xaaaa38aa
+(0, 2) 0x55003855 0x7f2a547f 0xaa7171aa 0xd4d48dd4
+(0, 3) 0x7f007f7f 0xaa38aaaa 0xd48dd4d4 0xffffffff
+Unpremultiplied:
+(0, 0) 0x00000000 0x2a5500ff 0x55a800ff 0x7fff00ff
+(0, 1) 0x2a0055ff 0x555454ff 0x7fa954ff 0xaaff54ff
+(0, 2) 0x5500a8ff 0x7f54a9ff 0xaaaaaaff 0xd4ffaaff
+(0, 3) 0x7f00ffff 0xaa54ffff 0xd4aaffff 0xffffffff
+##
+##
+
+#SeeAlso getAddr readPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void* getAddr(int x, int y) const
+
+Returns pixel address at (x, y).
+
+Input is not validated: out of bounds values of x or y, or kUnknown_SkColorType,
+trigger an assert() if built with SK_DEBUG defined. Returns nullptr if
+Color_Type is kUnknown_SkColorType, or Pixel_Ref is nullptr.
+
+Performs a lookup of pixel size; for better performance, call
+one of: getAddr8, getAddr16, or getAddr32.
+
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
+
+#Return generic pointer to pixel ##
+
+#Example
+#Image 3
+ char* row0 = (char* ) source.getAddr(0, 0);
+ char* row1 = (char* ) source.getAddr(0, 1);
+ SkDebugf("addr interval %c= rowBytes\n", row1 - row0 == source.rowBytes() ? '=' : '!');
+#StdOut
+addr interval == rowBytes
+##
+##
+
+#SeeAlso getAddr8 getAddr16 getAddr32 readPixels SkPixmap::addr
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method inline uint32_t* getAddr32(int x, int y) const
+
+Returns address at (x, y).
+
+Input is not validated. Triggers an assert() if built with SK_DEBUG defined and:
+#List
+# Pixel_Ref is nullptr ##
+# bytesPerPixel() is not four ##
+# x is negative, or not less than width() ##
+# y is negative, or not less than height() ##
+##
+
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
+
+#Return unsigned 32-bit pointer to pixel at (x, y) ##
+
+#Example
+#Image 3
+ uint32_t* row0 = source.getAddr32(0, 0);
+ uint32_t* row1 = source.getAddr32(0, 1);
+ size_t interval = (row1 - row0) * source.bytesPerPixel();
+ SkDebugf("addr interval %c= rowBytes\n", interval == source.rowBytes() ? '=' : '!');
+#StdOut
+addr interval == rowBytes
+##
+##
+
+#SeeAlso getAddr8 getAddr16 getAddr readPixels SkPixmap::addr32
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method inline uint16_t* getAddr16(int x, int y) const
+
+Returns address at (x, y).
+
+Input is not validated. Triggers an assert() if built with SK_DEBUG defined and:
+#List
+# Pixel_Ref is nullptr ##
+# bytesPerPixel() is not two ##
+# x is negative, or not less than width() ##
+# y is negative, or not less than height() ##
+##
+
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
+
+#Return unsigned 16-bit pointer to pixel at (x, y)##
+
+#Example
+#Image 3
+ SkBitmap bitmap16;
+ SkImageInfo dstInfo = SkImageInfo::Make(source.width(), source.height(), kARGB_4444_SkColorType,
+ kPremul_SkAlphaType);
+ bitmap16.allocPixels(dstInfo);
+ if (source.readPixels(dstInfo, bitmap16.getPixels(), bitmap16.rowBytes(), 0, 0)) {
+ uint16_t* row0 = bitmap16.getAddr16(0, 0);
+ uint16_t* row1 = bitmap16.getAddr16(0, 1);
+ size_t interval = (row1 - row0) * bitmap16.bytesPerPixel();
+ SkDebugf("addr interval %c= rowBytes\n", interval == bitmap16.rowBytes() ? '=' : '!');
+ }
+#StdOut
+addr interval == rowBytes
+##
+##
+
+#SeeAlso getAddr8 getAddr getAddr32 readPixels SkPixmap::addr16
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method inline uint8_t* getAddr8(int x, int y) const
+
+Returns address at (x, y).
+
+Input is not validated. Triggers an assert() if built with SK_DEBUG defined and:
+#List
+# Pixel_Ref is nullptr ##
+# bytesPerPixel() is not one ##
+# x is negative, or not less than width() ##
+# y is negative, or not less than height() ##
+##
+
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
+
+#Return unsigned 8-bit pointer to pixel at (x, y) ##
+
+#Example
+ SkBitmap bitmap;
+ const int width = 8;
+ const int height = 8;
+ uint8_t pixels[height][width];
+ SkImageInfo info = SkImageInfo::Make(width, height, kGray_8_SkColorType, kOpaque_SkAlphaType);
+ if (bitmap.installPixels(info, pixels, info.minRowBytes())) {
+ SkDebugf("&pixels[4][2] %c= bitmap.getAddr8(2, 4)\n",
+ &pixels[4][2] == bitmap.getAddr8(2, 4) ? '=' : '!');
+ }
+#StdOut
+&pixels[4][2] == bitmap.getAddr8(2, 4)
+##
+##
+
+#SeeAlso getAddr getAddr16 getAddr32 readPixels SkPixmap::addr8
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool extractSubset(SkBitmap* dst, const SkIRect& subset) const
+
+Shares Pixel_Ref with dst. Pixels are not copied; Bitmap and dst point
+to the same pixels; dst bounds() are set to the intersection of subset
+and the original bounds().
+
+subset may be larger than bounds(). Any area outside of bounds() is ignored.
+
+Any contents of dst are discarded. isVolatile setting is copied to dst.
+dst is set to colorType, alphaType, and colorSpace.
+
+Return false if:
+#List
+# dst is nullptr ##
+# Pixel_Ref is nullptr ##
+# subset does not intersect bounds() ##
+##
+
+
+#Param dst Bitmap set to subset ##
+#Param subset rectangle of pixels to reference ##
+
+#Return true if dst is replaced by subset
+##
+
+#Example
+#Image 3
+ SkIRect bounds, s;
+ source.getBounds(&bounds);
+ SkDebugf("bounds: %d, %d, %d, %d\n", bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
+ SkBitmap subset;
+ for (int left: { -100, 0, 100, 1000 } ) {
+ for (int right: { 0, 100, 1000 } ) {
+ SkIRect b = SkIRect::MakeLTRB(left, 100, right, 200);
+ bool success = source.extractSubset(&subset, b);
+ SkDebugf("subset: %4d, %4d, %4d, %4d ", b.fLeft, b.fTop, b.fRight, b.fBottom);
+ SkDebugf("success; %s", success ? "true" : "false");
+ if (success) {
+ subset.getBounds(&s);
+ SkDebugf(" subset: %d, %d, %d, %d", s.fLeft, s.fTop, s.fRight, s.fBottom);
+ }
+ SkDebugf("\n");
+ }
+ }
+#StdOut
+bounds: 0, 0, 512, 512
+subset: -100, 100, 0, 200 success; false
+subset: -100, 100, 100, 200 success; true subset: 0, 0, 100, 100
+subset: -100, 100, 1000, 200 success; true subset: 0, 0, 512, 100
+subset: 0, 100, 0, 200 success; false
+subset: 0, 100, 100, 200 success; true subset: 0, 0, 100, 100
+subset: 0, 100, 1000, 200 success; true subset: 0, 0, 512, 100
+subset: 100, 100, 0, 200 success; false
+subset: 100, 100, 100, 200 success; false
+subset: 100, 100, 1000, 200 success; true subset: 0, 0, 412, 100
+subset: 1000, 100, 0, 200 success; false
+subset: 1000, 100, 100, 200 success; false
+subset: 1000, 100, 1000, 200 success; false
+##
+##
+
+#SeeAlso readPixels writePixels SkCanvas::drawBitmap
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
+ int srcX, int srcY, SkTransferFunctionBehavior behavior) const
+
+Copies a Rect of pixels to dstPixels. Copy starts at (srcX, srcY), and does not exceed
+(this->width(), this->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:
+#List
+# dstInfo.addr() equals nullptr ##
+# dstRowBytes is less than dstInfo.minRowBytes ##
+# Pixel_Ref is nullptr ##
+##
+
+Pixels are copied only if pixel conversion is possible. If this->colorType is
+kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType must match.
+If this->colorType is kGray_8_SkColorType, dstInfo.colorSpace must match.
+If this->alphaType is kOpaque_SkAlphaType, dstInfo.alphaType must
+match. If this->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) >= this->width()
+##
+, or if
+#Formula
+abs(srcY) >= this->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
+#Height 64
+void draw(SkCanvas* canvas) {
+ const int width = 256;
+ const int height = 32;
+ std::vector<int32_t> dstPixels;
+ dstPixels.resize(height * width * 4);
+ SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
+ SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 };
+ SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } };
+ SkPaint gradPaint;
+ gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
+ SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
+ for (auto behavior : { SkTransferFunctionBehavior::kRespect,
+ SkTransferFunctionBehavior::kIgnore} ) {
+ SkBitmap bitmap;
+ bitmap.allocPixels(info);
+ SkCanvas srcCanvas(bitmap);
+ srcCanvas.drawRect(SkRect::MakeWH(width, height), gradPaint);
+ if (bitmap.readPixels(info, &dstPixels.front(), width * 4, 0, 0, behavior)) {
+ SkPixmap dstPixmap(info, &dstPixels.front(), width * 4);
+ bitmap.installPixels(dstPixmap);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
+ canvas->translate(0, height);
+ }
+}
+##
+
+#SeeAlso writePixels SkPixmap::readPixels SkCanvas::readPixels SkImage::readPixels SkSurface::readPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
+ int srcX, int srcY) const
+
+Copies a Rect of pixels to dstPixels. Copy starts at (srcX, srcY), and does not exceed
+(this->width(), this->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:
+#List
+# dstInfo.addr() equals nullptr ##
+# dstRowBytes is less than dstInfo.minRowBytes ##
+# Pixel_Ref is nullptr ##
+##
+
+Pixels are copied only if pixel conversion is possible. If this->colorType is
+kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType must match.
+If this->colorType is kGray_8_SkColorType, dstInfo.colorSpace must match.
+If this->alphaType is kOpaque_SkAlphaType, dstInfo.alphaType must
+match. If this->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) >= this->width()
+##
+, or if
+#Formula
+abs(srcY) >= this->height()
+##
+.
+
+#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() ##
+
+#Return true if pixels are copied to dstPixels ##
+
+#Example
+#Height 128
+#Description
+Transferring the gradient from 8 bits per component to 4 bits per component
+creates visible banding.
+##
+ const int width = 256;
+ const int height = 64;
+ SkImageInfo srcInfo = SkImageInfo::MakeN32Premul(width, height);
+ SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 };
+ SkPoint gradPoints[] = { { 0, 0 }, { 256, 0 } };
+ SkPaint paint;
+ paint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
+ SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
+ SkBitmap bitmap;
+ bitmap.allocPixels(srcInfo);
+ SkCanvas srcCanvas(bitmap);
+ srcCanvas.drawRect(SkRect::MakeWH(width, height), paint);
+ canvas->drawBitmap(bitmap, 0, 0);
+ SkImageInfo dstInfo = srcInfo.makeColorType(kARGB_4444_SkColorType);
+ std::vector<int16_t> dstPixels;
+ dstPixels.resize(height * width);
+ bitmap.readPixels(dstInfo, &dstPixels.front(), width * 2, 0, 0);
+ SkPixmap dstPixmap(dstInfo, &dstPixels.front(), width * 2);
+ bitmap.installPixels(dstPixmap);
+ canvas->drawBitmap(bitmap, 0, 64);
+##
+
+#SeeAlso writePixels SkPixmap::readPixels SkCanvas::readPixels SkImage::readPixels SkSurface::readPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool readPixels(const SkPixmap& dst, int srcX, int srcY) const
+
+Copies a Rect of pixels to dst. Copy starts at (srcX, srcY), and does not exceed
+(this->width(), this->height()).
+
+dst specifies width, height, Color_Type, Alpha_Type, Color_Space, pixel storage,
+and row bytes of destination. dst.rowBytes specifics the gap from one destination
+row to the next. Returns true if pixels are copied. Returns false if:
+#List
+# dst pixel storage equals nullptr ##
+# dst.rowBytes is less than SkImageInfo::minRowBytes ##
+# Pixel_Ref is nullptr ##
+##
+
+Pixels are copied only if pixel conversion is possible. If this->colorType is
+kGray_8_SkColorType, or kAlpha_8_SkColorType; dst Color_Type must match.
+If this->colorType is kGray_8_SkColorType, dst Color_Space must match.
+If this->alphaType is kOpaque_SkAlphaType, dst Alpha_Type must
+match. If this->colorSpace is nullptr, dst Color_Space 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) >= this->width()
+##
+, or if
+#Formula
+abs(srcY) >= this->height()
+##
+.
+
+#Param dst destination Pixmap: Image_Info, pixels, row bytes ##
+#Param srcX column index whose absolute value is less than width() ##
+#Param srcY row index whose absolute value is less than height() ##
+
+#Return true if pixels are copied to dst ##
+
+#Example
+#Image 3
+ std::vector<int32_t> srcPixels;
+ srcPixels.resize(source.height() * source.rowBytes());
+ for (int y = 0; y < 4; ++y) {
+ for (int x = 0; x < 4; ++x) {
+ SkPixmap pixmap(SkImageInfo::MakeN32Premul(source.width() / 4, source.height() / 4),
+ &srcPixels.front() + x * source.height() * source.width() / 4 +
+ y * source.width() / 4, source.rowBytes());
+ source.readPixels(pixmap, x * source.width() / 4, y * source.height() / 4);
+ }
+ }
+ canvas->scale(.5f, .5f);
+ SkBitmap bitmap;
+ bitmap.installPixels(SkImageInfo::MakeN32Premul(source.width(), source.height()),
+ &srcPixels.front(), source.rowBytes());
+ canvas->drawBitmap(bitmap, 0, 0);
+##
+
+#SeeAlso writePixels SkPixmap::readPixels SkCanvas::readPixels SkImage::readPixels SkSurface::readPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool readPixels(const SkPixmap& dst) const
+
+Copies a Rect of pixels to dst. Copy starts at (0, 0), and does not exceed
+(this->width(), this->height()).
+
+dst specifies width, height, Color_Type, Alpha_Type, Color_Space, pixel storage,
+and row bytes of destination. dst.rowBytes specifics the gap from one destination
+row to the next. Returns true if pixels are copied. Returns false if:
+#List
+# dst pixel storage equals nullptr ##
+# dst.rowBytes is less than SkImageInfo::minRowBytes ##
+# Pixel_Ref is nullptr ##
+##
+
+Pixels are copied only if pixel conversion is possible. If this->colorType is
+kGray_8_SkColorType, or kAlpha_8_SkColorType; dst Color_Type must match.
+If this->colorType is kGray_8_SkColorType, dst Color_Space must match.
+If this->alphaType is kOpaque_SkAlphaType, dst Alpha_Type must
+match. If this->colorSpace is nullptr, dst Color_Space must match. Returns
+false if pixel conversion is not possible.
+
+#Param dst destination Pixmap: Image_Info, pixels, row bytes ##
+
+#Return true if pixels are copied to dst ##
+
+#Example
+#Height 128
+#Image 3
+ std::vector<int32_t> srcPixels;
+ srcPixels.resize(source.height() * source.width() * 8);
+ for (int i = 0; i < 2; ++i) {
+ SkPixmap pixmap(SkImageInfo::Make(source.width() * 2, source.height(),
+ i ? kRGBA_8888_SkColorType : kBGRA_8888_SkColorType, kPremul_SkAlphaType),
+ &srcPixels.front() + i * source.width(), source.rowBytes() * 2);
+ source.readPixels(pixmap);
+ }
+ canvas->scale(.25f, .25f);
+ SkBitmap bitmap;
+ bitmap.installPixels(SkImageInfo::MakeN32Premul(source.width() * 2, source.height()),
+ &srcPixels.front(), source.rowBytes() * 2);
+ canvas->drawBitmap(bitmap, 0, 0);
+##
+
+#SeeAlso writePixels SkPixmap::readPixels SkCanvas::readPixels SkImage::readPixels SkSurface::readPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool writePixels(const SkPixmap& src, int dstX, int dstY)
+
+Copies a Rect of pixels from src. Copy starts at (dstX, dstY), and does not exceed
+(src.width(), src.height()).
+
+src specifies width, height, Color_Type, Alpha_Type, Color_Space, pixel storage,
+and row bytes of source. src.rowBytes specifics the gap from one source
+row to the next. Returns true if pixels are copied. Returns false if:
+#List
+# src pixel storage equals nullptr ##
+# src.rowBytes is less than SkImageInfo::minRowBytes ##
+# Pixel_Ref is nullptr ##
+##
+
+Pixels are copied only if pixel conversion is possible. If this->colorType is
+kGray_8_SkColorType, or kAlpha_8_SkColorType; src Color_Type must match.
+If this->colorType is kGray_8_SkColorType, src Color_Space must match.
+If this->alphaType is kOpaque_SkAlphaType, src Alpha_Type must
+match. If this->colorSpace is nullptr, src Color_Space must match. Returns
+false if pixel conversion is not possible.
+
+dstX and dstY 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(dstX) >= this->width()
+##
+, or if
+#Formula
+abs(dstY) >= this->height()
+##
+.
+
+#Param src source Pixmap: Image_Info, pixels, row bytes ##
+#Param dstX column index whose absolute value is less than width() ##
+#Param dstY row index whose absolute value is less than height() ##
+
+#Return true if src pixels are copied to Bitmap ##
+
+#Example
+#Image 3
+ std::vector<int32_t> srcPixels;
+ int width = image->width();
+ int height = image->height();
+ srcPixels.resize(height * width * 4);
+ SkPixmap pixmap(SkImageInfo::MakeN32Premul(width, height), (const void*) &srcPixels.front(),
+ width * 4);
+ image->readPixels(pixmap, 0, 0);
+ canvas->scale(.5f, .5f);
+ width /= 4;
+ height /= 4;
+ for (int y = 0; y < 4; ++y) {
+ for (int x = 0; x < 4; ++x) {
+ SkBitmap bitmap;
+ bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height));
+ bitmap.writePixels(pixmap, -y * width, -x * height);
+ canvas->drawBitmap(bitmap, x * width, y * height);
+ }
+ }
+##
+
+#SeeAlso readPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool writePixels(const SkPixmap& src)
+
+Copies a Rect of pixels from src. Copy starts at (0, 0), and does not exceed
+(src.width(), src.height()).
+
+src specifies width, height, Color_Type, Alpha_Type, Color_Space, pixel storage,
+and row bytes of source. src.rowBytes specifics the gap from one source
+row to the next. Returns true if pixels are copied. Returns false if:
+#List
+# src pixel storage equals nullptr ##
+# src.rowBytes is less than SkImageInfo::minRowBytes ##
+# Pixel_Ref is nullptr ##
+##
+
+Pixels are copied only if pixel conversion is possible. If this->colorType is
+kGray_8_SkColorType, or kAlpha_8_SkColorType; src Color_Type must match.
+If this->colorType is kGray_8_SkColorType, src Color_Space must match.
+If this->alphaType is kOpaque_SkAlphaType, src Alpha_Type must
+match. If this->colorSpace is nullptr, src Color_Space must match. Returns
+false if pixel conversion is not possible.
+
+#Param src source Pixmap: Image_Info, pixels, row bytes ##
+
+#Return true if src pixels are copied to Bitmap ##
+
+#Example
+#Height 80
+ SkBitmap bitmap;
+ bitmap.allocPixels(SkImageInfo::MakeN32Premul(2, 2));
+ bitmap.eraseColor(SK_ColorGREEN);
+ SkPMColor color = 0xFF5599BB;
+ SkPixmap src(SkImageInfo::MakeN32Premul(1, 1), &color, 4);
+ bitmap.writePixels(src);
+ canvas->scale(40, 40);
+ canvas->drawBitmap(bitmap, 0, 0);
+##
+
+#SeeAlso readPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool writePixels(const SkPixmap& src, int x, int y, SkTransferFunctionBehavior behavior)
+
+Copies a Rect of pixels from src. Copy starts at (0, 0), and does not exceed
+(src.width(), src.height()).
+
+src specifies width, height, Color_Type, Alpha_Type, Color_Space, pixel storage,
+and row bytes of source. src.rowBytes specifics the gap from one source
+row to the next. Returns true if pixels are copied. Returns false if:
+#List
+# src pixel storage equals nullptr ##
+# src.rowBytes is less than SkImageInfo::minRowBytes ##
+# Pixel_Ref is nullptr ##
+##
+
+Pixels are copied only if pixel conversion is possible. If this->colorType is
+kGray_8_SkColorType, or kAlpha_8_SkColorType; src Color_Type must match.
+If this->colorType is kGray_8_SkColorType, src Color_Space must match.
+If this->alphaType is kOpaque_SkAlphaType, src Alpha_Type must
+match. If this->colorSpace is nullptr, src Color_Space must match. Returns
+false if pixel conversion is not possible. Returns false if width() or height()
+is zero or negative.
+
+If behavior is SkTransferFunctionBehavior::kRespect: converts src
+pixels to a linear space before converting to Image_Info.
+If behavior is SkTransferFunctionBehavior::kIgnore: src
+pixels are treated as if they are linear, regardless of how they are encoded.
+
+#Param src source Pixmap: Image_Info, pixels, row bytes ##
+#Param x column index whose absolute value is less than width() ##
+#Param y row index whose absolute value is less than height() ##
+#Param behavior one of: SkTransferFunctionBehavior::kRespect,
+ SkTransferFunctionBehavior::kIgnore
+##
+
+#Return true if src pixels are copied to Bitmap ##
+
+#Example
+#Height 64
+ const int width = 256;
+ const int height = 32;
+ std::vector<int32_t> dstPixels;
+ dstPixels.resize(height * width * 4);
+ SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
+ SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 };
+ SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } };
+ SkPaint gradPaint;
+ gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
+ SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
+ for (auto behavior : { SkTransferFunctionBehavior::kRespect,
+ SkTransferFunctionBehavior::kIgnore} ) {
+ SkPixmap dstPixmap(info, &dstPixels.front(), width * 4);
+ SkBitmap bitmap;
+ bitmap.installPixels(dstPixmap);
+ SkCanvas srcCanvas(bitmap);
+ srcCanvas.drawRect(SkRect::MakeWH(width, height), gradPaint);
+ if (bitmap.writePixels(dstPixmap, 0, 0, behavior)) {
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
+ canvas->translate(0, height);
+ }
+##
+
+#SeeAlso readPixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool hasHardwareMipMap() const
+
+#Private
+Android framework only.
+##
+
+#Return true if setHasHardwareMipMap has been called with true ##
+
+#NoExample
+##
+
+#SeeAlso setHasHardwareMipMap
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setHasHardwareMipMap(bool hasHardwareMipMap)
+
+#Private
+Android framework only.
+##
+
+#Param hasHardwareMipMap sets state ##
+
+#NoExample
+##
+
+#SeeAlso hasHardwareMipMap
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool extractAlpha(SkBitmap* dst) const
+
+Sets dst to Alpha described by pixels. Returns false if dst cannot be written to
+or dst pixels cannot be allocated.
+
+Uses HeapAllocator to reserve memory for dst Pixel_Ref.
+
+#Param dst holds Pixel_Ref to fill with alpha layer ##
+
+#Return true if Alpha layer was constructed in dst Pixel_Ref ##
+
+#Example
+#Height 100
+ SkBitmap alpha, bitmap;
+ bitmap.allocN32Pixels(100, 100);
+ SkCanvas offscreen(bitmap);
+ offscreen.clear(0);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setColor(SK_ColorBLUE);
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(20);
+ offscreen.drawCircle(50, 50, 39, paint);
+ offscreen.flush();
+ bitmap.extractAlpha(&alpha);
+ paint.setColor(SK_ColorRED);
+ canvas->drawBitmap(bitmap, 0, 0, &paint);
+ canvas->drawBitmap(alpha, 100, 0, &paint);
+##
+
+#SeeAlso extractSubset
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool extractAlpha(SkBitmap* dst, const SkPaint* paint,
+ SkIPoint* offset) const
+
+Sets dst to Alpha described by pixels. Returns false if dst cannot be written to
+or dst pixels cannot be allocated.
+
+If paint is not nullptr and contains Mask_Filter, SkMaskFilter::filterMask
+generates Mask_Alpha from Bitmap. Uses HeapAllocator to reserve memory for dst
+Pixel_Ref. Sets offset to top-left position for dst for alignment with Bitmap;
+(0, 0) unless SkMaskFilter generates mask.
+
+#Param dst holds Pixel_Ref to fill with alpha layer ##
+#Param paint holds optional Mask_Filter; may be nullptr ##
+#Param offset top-left position for dst; may be nullptr ##
+
+#Return true if Alpha layer was constructed in dst Pixel_Ref ##
+
+#Bug 7103 ##
+#Example
+#Height 160
+ SkBitmap alpha, bitmap;
+ bitmap.allocN32Pixels(100, 100);
+ SkCanvas offscreen(bitmap);
+ offscreen.clear(0);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setColor(SK_ColorBLUE);
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(20);
+ offscreen.drawCircle(50, 50, 39, paint);
+ offscreen.flush();
+ const SkScalar kBlurSigma = SkBlurMaskFilter::ConvertRadiusToSigma(SkIntToScalar(25));
+ paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kBlurSigma,
+ SkBlurMaskFilter::kHighQuality_BlurFlag));
+ SkIPoint offset;
+ bitmap.extractAlpha(&alpha, &paint, &offset);
+ paint.setColor(SK_ColorRED);
+ canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);
+ canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);
+##
+
+#SeeAlso extractSubset
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator,
+ SkIPoint* offset) const
+
+Sets dst to Alpha described by pixels. Returns false if dst cannot be written to
+or dst pixels cannot be allocated.
+
+If paint is not nullptr and contains Mask_Filter, SkMaskFilter::filterMask
+generates Mask_Alpha from Bitmap. allocator may reference a custom allocation
+class or be set to nullptr to use HeapAllocator. Sets offset to top-left
+position for dst for alignment with Bitmap; (0, 0) unless SkMaskFilter generates
+mask.
+
+#Param dst holds Pixel_Ref to fill with alpha layer ##
+#Param paint holds optional Mask_Filter; may be nullptr ##
+#Param allocator method to reserve memory for Pixel_Ref; may be nullptr ##
+#Param offset top-left position for dst; may be nullptr ##
+
+#Return true if Alpha layer was constructed in dst Pixel_Ref ##
+
+#Bug 7104 ##
+#Example
+#Height 128
+ SkBitmap alpha, bitmap;
+ bitmap.allocN32Pixels(100, 100);
+ SkCanvas offscreen(bitmap);
+ offscreen.clear(0);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setColor(SK_ColorBLUE);
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(20);
+ offscreen.drawCircle(50, 50, 39, paint);
+ offscreen.flush();
+ paint.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle, 3));
+ SkIPoint offset;
+ bitmap.extractAlpha(&alpha, &paint, nullptr, &offset);
+ paint.setColor(SK_ColorRED);
+ canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);
+ canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);
+##
+
+#SeeAlso extractSubset
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool peekPixels(SkPixmap* pixmap) const
+
+If the pixels are available from this bitmap return true, and fill out the
+specified pixmap (if not null). If there are no pixels, return false and
+ignore the pixmap parameter.
+Note: if this returns true, the results (in the pixmap) are only valid until the bitmap
+is changed in any way, in which case the results are invalid.
+
+#Param pixmap storage for pixel state if pixels are readable; otherwise, ignored ##
+
+#Return true if Bitmap has direct access to pixels ##
+
+#Example
+ SkBitmap bitmap;
+ bitmap.allocPixels(SkImageInfo::MakeN32Premul(6, 11));
+ SkCanvas offscreen(bitmap);
+ offscreen.clear(SK_ColorWHITE);
+ SkPaint paint;
+ offscreen.drawString("?", 0, 10, paint);
+ SkPixmap pixmap;
+ if (bitmap.peekPixels(&pixmap)) {
+ 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
+ ------
+ --xxx-
+ -x--x-
+ ----x-
+ ---xx-
+ --xx--
+ --x---
+ ------
+ --x---
+ --x---
+ ------
+ #StdOut ##
+##
+
+#SeeAlso installPixels readPixels writePixels
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void toString(SkString* str) const;
+
+#DefinedBy SK_TO_STRING_NONVIRT() ##
+
+#Private
+macro expands to: void toString(SkString* str) const;
+##
+
+Creates string representation. The representation is read by
+internal debugging tools. The interface and implementation may be
+suppressed by defining SK_IGNORE_TO_STRING.
+
+#Param str storage for string representation ##
+
+#Example
+ SkBitmap bitmap;
+ int width = 6;
+ int height = 11;
+ bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height));
+ SkString string;
+ bitmap.toString(&string);
+ SkString match;
+ match.printf("(%d, %d)", width, height);
+ int start = string.find(match.c_str());
+ if (start >= 0) {
+ SkString whStr(&string.c_str()[start], match.size());
+ SkDebugf("bitmap dimensions %s\n", whStr.c_str());
+ }
+ #StdOut
+ bitmap dimensions (6, 11)
+ ##
+##
+
+#SeeAlso SkPaint::toString
+
+##
+
+#Class SkBitmap ##
+
+#Topic Bitmap ##
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index d3121ba899..3e7369176e 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -261,7 +261,7 @@ width times bytes required for Image_Color_Type.
Pixel buffer size should be height times rowBytes.
#Param width pixel column count on Raster_Surface created; must be zero or greater ##
-#Param height pixel row count on Raster_Surface created.; must be zero or greater ##
+#Param height pixel row count on Raster_Surface created; must be zero or greater ##
#Param pixels pointer to destination pixels buffer; buffer size should be height
times rowBytes
##
@@ -284,7 +284,7 @@ void draw(SkCanvas* ) {
std::unique_ptr<SkCanvas> canvas = SkCanvas::MakeRasterDirectN32(
width,
height,
- pixels[0], // top left of the bitmap
+ pixels[0], // top-left of the bitmap
sizeof(pixels[0])); // byte width of the each row
// write a premultiplied value for white into all pixels in the bitmap
canvas->clear(SK_ColorWHITE);
@@ -453,7 +453,7 @@ The actual output depends on the installed fonts.
if (!canvas.peekPixels(&pixmap)) {
SkDebugf("peekPixels should never fail.\n");
}
- const SkPMColor* pixels = pixmap.addr32(); // points to top left of bitmap
+ const SkPMColor* pixels = pixmap.addr32(); // points to top-left of bitmap
SkPMColor pmWhite = pixels[0]; // the Premultiplied format may vary
SkPaint paint; // by default, draws black, 12 point text
canvas.drawString("!", 1, 10, paint); // 1 char at baseline (1, 10)
@@ -545,7 +545,7 @@ The actual output depends on the installed fonts.
if (!canvas.peekPixels(&pixmap)) {
SkDebugf("peekPixels should never fail.\n");
}
- const SkPMColor* pixels = pixmap.addr32(); // points to top left of bitmap
+ const SkPMColor* pixels = pixmap.addr32(); // points to top-left of bitmap
SkPMColor pmWhite = pixels[0]; // the Premultiplied format may vary
SkPaint paint; // by default, draws black, 12 point text
canvas.drawString("!", 1, 10, paint); // 1 char at baseline (1, 10)
@@ -814,7 +814,7 @@ If pixels are inaccessible, info, rowBytes, and origin are unchanged.
#Param info storage for writable pixels' Image_Info; may be nullptr ##
#Param rowBytes storage for writable pixels' row bytes; may be nullptr ##
-#Param origin storage for Canvas top Layer origin, its top left corner;
+#Param origin storage for Canvas top Layer origin, its top-left corner;
may be nullptr
##
@@ -888,7 +888,7 @@ void draw(SkCanvas* canvas) {
Returns custom context that tracks the Matrix and Clip.
Use Raster_Handle_Allocator to blend Skia drawing with custom drawing, typically performed
-by the host platform's user interface. The custom context returned is generated by
+by the host platform user interface. The custom context returned is generated by
SkRasterHandleAllocator::MakeCanvas, which creates a custom canvas with raster storage for
the drawing destination.
@@ -954,9 +954,7 @@ like SkDumpCanvas.
pixmap is valid only while Canvas is in scope and unchanged. Any
Canvas or Surface call may invalidate the pixmap values.
-#Param pixmap storage for Canvas pixel state if Canvas pixels are readable;
- otherwise, ignored
-##
+#Param pixmap storage for pixel state if pixels are readable; otherwise, ignored ##
#Return true if Canvas has direct access to pixels ##
@@ -2651,7 +2649,7 @@ before it is combined with Clip.
#Example
#Description
-Overlapping Rects form a clip. When clip's Path_Fill_Type is set to
+Overlapping Rects form a clip. When clip Path_Fill_Type is set to
SkPath::kWinding_FillType, the overlap is included. Set to
SkPath::kEvenOdd_FillType, the overlap is excluded and forms a hole.
##
@@ -2692,7 +2690,7 @@ path is transformed by Matrix before it is combined with Clip.
#Example
#Height 212
#Description
-Clip loops over itself covering its center twice. When clip's Path_Fill_Type
+Clip loops over itself covering its center twice. When clip Path_Fill_Type
is set to SkPath::kWinding_FillType, the overlap is included. Set to
SkPath::kEvenOdd_FillType, the overlap is excluded and forms a hole.
##
@@ -3367,7 +3365,7 @@ In paint: Paint_Style determines if rectangle is stroked or filled;
if stroked, Paint_Stroke_Width describes the line thickness, and
Paint_Stroke_Join draws the corners rounded or square.
-#Param rect rectangle to be drawn ##
+#Param rect rectangle to draw ##
#Param paint stroke or fill, blend, color, and so on, used to draw ##
#Example
@@ -3403,7 +3401,7 @@ In paint: Paint_Style determines if rectangle is stroked or filled;
if stroked, Paint_Stroke_Width describes the line thickness, and
Paint_Stroke_Join draws the corners rounded or square.
-#Param rect rectangle to be drawn ##
+#Param rect rectangle to draw ##
#Param paint stroke or fill, blend, color, and so on, used to draw ##
#Example
@@ -3433,7 +3431,7 @@ In paint: Paint_Style determines if rectangle is stroked or filled;
if stroked, Paint_Stroke_Width describes the line thickness, and
Paint_Stroke_Join draws the corners rounded or square.
-#Param region region to be drawn ##
+#Param region region to draw ##
#Param paint Paint stroke or fill, blend, color, and so on, used to draw ##
#Example
@@ -3825,7 +3823,7 @@ and Draw_Looper. If image is kAlpha_8_SkColorType, apply Shader.
If paint contains Mask_Filter, generate mask from image bounds. If generated
mask extends beyond image bounds, replicate image edge colors, just as Shader
made from SkImage::makeShader with SkShader::kClamp_TileMode set replicates the
-image's edge color when it samples outside of its bounds.
+image edge color when it samples outside of its bounds.
#Param image uncompressed rectangular map of pixels ##
#Param left left side of image ##
@@ -3865,7 +3863,7 @@ Blend_Mode, and Draw_Looper. If image is kAlpha_8_SkColorType, apply Shader.
If paint contains Mask_Filter, generate mask from image bounds. If generated
mask extends beyond image bounds, replicate image edge colors, just as Shader
made from SkImage::makeShader with SkShader::kClamp_TileMode set replicates the
-image's edge color when it samples outside of its bounds.
+image edge color when it samples outside of its bounds.
#Param image uncompressed rectangular map of pixels ##
#Param left left side of image ##
@@ -3974,7 +3972,7 @@ If paint contains Mask_Filter, generate mask from image bounds.
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
-replicates the image's edge color when it samples outside of its bounds.
+replicates the image edge color when it samples outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
sample within src; set to kFast_SrcRectConstraint allows sampling outside to
@@ -3992,7 +3990,7 @@ improve performance.
#Height 64
#Description
The left bitmap draws with Paint default kNone_SkFilterQuality, and stays within
- its bounds; there's no bleeding with kFast_SrcRectConstraint.
+ its bounds; there is no bleeding with kFast_SrcRectConstraint.
the middle and right bitmaps draw with kLow_SkFilterQuality; with
kStrict_SrcRectConstraint, the filter remains within the checkerboard, and
with kFast_SrcRectConstraint red bleeds on the edges.
@@ -4040,7 +4038,7 @@ If paint contains Mask_Filter, generate mask from image bounds.
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
-replicates the image's edge color when it samples outside of its bounds.
+replicates the image edge color when it samples outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
sample within isrc; set to kFast_SrcRectConstraint allows sampling outside to
@@ -4083,7 +4081,7 @@ If paint contains Mask_Filter, generate mask from image bounds.
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
-replicates the image's edge color when it samples outside of its bounds.
+replicates the image edge color when it samples outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
sample within image; set to kFast_SrcRectConstraint allows sampling outside to
@@ -4125,7 +4123,7 @@ If paint contains Mask_Filter, generate mask from image bounds.
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
-replicates the image's edge color when it samples outside of its bounds.
+replicates the image edge color when it samples outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
sample within src; set to kFast_SrcRectConstraint allows sampling outside to
@@ -4181,7 +4179,7 @@ If paint contains Mask_Filter, generate mask from image bounds.
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
-replicates the image's edge color when it samples outside of its bounds.
+replicates the image edge color when it samples outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
sample within image; set to kFast_SrcRectConstraint allows sampling outside to
@@ -4231,7 +4229,7 @@ If paint contains Mask_Filter, generate mask from image bounds.
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
-replicates the image's edge color when it samples outside of its bounds.
+replicates the image edge color when it samples outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
sample within image; set to kFast_SrcRectConstraint allows sampling outside to
@@ -4285,7 +4283,7 @@ If paint contains Mask_Filter, generate mask from image bounds.
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
-replicates the image's edge color when it samples outside of its bounds.
+replicates the image edge color when it samples outside of its bounds.
#Param image Image containing pixels, dimensions, and format ##
#Param center IRect edge of image corners and sides ##
@@ -4351,7 +4349,7 @@ If paint contains Mask_Filter, generate mask from image bounds.
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
-replicates the image's edge color when it samples outside of its bounds.
+replicates the image edge color when it samples outside of its bounds.
#Param image Image containing pixels, dimensions, and format ##
#Param center IRect edge of image corners and sides ##
@@ -4414,7 +4412,7 @@ If paint contains Mask_Filter, generate mask from bitmap bounds.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as Shader made from SkShader::MakeBitmapShader with
-SkShader::kClamp_TileMode set replicates the bitmap's edge color when it samples
+SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
outside of its bounds.
#Param bitmap Bitmap containing pixels, dimensions, and format ##
@@ -4466,7 +4464,7 @@ If paint contains Mask_Filter, generate mask from bitmap bounds.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as Shader made from SkShader::MakeBitmapShader with
-SkShader::kClamp_TileMode set replicates the bitmap's edge color when it samples
+SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
@@ -4524,7 +4522,7 @@ If paint contains Mask_Filter, generate mask from bitmap bounds.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as Shader made from SkShader::MakeBitmapShader with
-SkShader::kClamp_TileMode set replicates the bitmap's edge color when it samples
+SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
@@ -4582,7 +4580,7 @@ If paint contains Mask_Filter, generate mask from bitmap bounds.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as Shader made from SkShader::MakeBitmapShader with
-SkShader::kClamp_TileMode set replicates the bitmap's edge color when it samples
+SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
outside of its bounds.
constraint set to kStrict_SrcRectConstraint limits Paint Filter_Quality to
@@ -4637,7 +4635,7 @@ If paint contains Mask_Filter, generate mask from bitmap bounds.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as Shader made from SkShader::MakeBitmapShader with
-SkShader::kClamp_TileMode set replicates the bitmap's edge color when it samples
+SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
outside of its bounds.
#Param bitmap Bitmap containing pixels, dimensions, and format ##
@@ -4777,7 +4775,7 @@ Draw Bitmap bitmap stretched proportionally to fit into Rect dst.
Lattice lattice divides bitmap into a rectangular grid.
Each intersection of an even-numbered row and column is fixed; like the corners
of drawBitmapNine, fixed lattice elements never scale larger than their initial
-size and shrink proportionately when all fixed elements exceed the bitmap's
+size and shrink proportionately when all fixed elements exceed the bitmap
dimension. All other grid elements scale to fill the available space, if any.
Additionally transform draw using Clip, Matrix, and optional Paint paint.
@@ -4788,7 +4786,7 @@ If paint contains Mask_Filter, generate mask from bitmap bounds.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as Shader made from SkShader::MakeBitmapShader with
-SkShader::kClamp_TileMode set replicates the bitmap's edge color when it samples
+SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
outside of its bounds.
#Param bitmap Bitmap containing pixels, dimensions, and format ##
@@ -4854,7 +4852,7 @@ Draw Image image stretched proportionally to fit into Rect dst.
Lattice lattice divides image into a rectangular grid.
Each intersection of an even-numbered row and column is fixed; like the corners
of drawBitmapNine, fixed lattice elements never scale larger than their initial
-size and shrink proportionately when all fixed elements exceed the bitmap's
+size and shrink proportionately when all fixed elements exceed the bitmap
dimension. All other grid elements scale to fill the available space, if any.
Additionally transform draw using Clip, Matrix, and optional Paint paint.
@@ -4865,7 +4863,7 @@ If paint contains Mask_Filter, generate mask from bitmap bounds.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as Shader made from SkShader::MakeBitmapShader with
-SkShader::kClamp_TileMode set replicates the bitmap's edge color when it samples
+SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
outside of its bounds.
#Param image Image containing pixels, dimensions, and format ##
@@ -4930,11 +4928,11 @@ void draw(SkCanvas* canvas) {
Draw text, with origin at (x, y), using Clip, Matrix, and Paint paint.
-text's meaning depends on Paint_Text_Encoding; by default, text encoding is
+text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8.
x and y meaning depends on Paint_Text_Align and Paint_Vertical_Text; by default
-text draws left to right, positioning the first glyph's left side bearing at x
+text draws left to right, positioning the first glyph left side bearing at x
and its baseline at y. Text size is affected by Matrix and Paint_Text_Size.
All elements of paint: Path_Effect, Rasterizer, Mask_Filter, Shader,
@@ -4985,12 +4983,12 @@ void draw(SkCanvas* canvas) {
Draw null terminated string, with origin at (x, y), using Clip, Matrix, and
Paint paint.
-string's meaning depends on Paint_Text_Encoding; by default, string encoding is
-UTF-8. Other values of Paint_Text_Encoding are unlikely to produce the desired
+string meaning depends on Paint_Text_Encoding; by default, strings are encoded
+as UTF-8. Other values of Paint_Text_Encoding are unlikely to produce the desired
results, since zero bytes may be embedded in the string.
x and y meaning depends on Paint_Text_Align and Paint_Vertical_Text; by default
-string draws left to right, positioning the first glyph's left side bearing at x
+string draws left to right, positioning the first glyph left side bearing at x
and its baseline at y. Text size is affected by Matrix and Paint_Text_Size.
All elements of paint: Path_Effect, Rasterizer, Mask_Filter, Shader,
@@ -5018,12 +5016,12 @@ filled 12 point black Glyphs.
Draw null terminated string, with origin at (x, y), using Clip, Matrix, and
Paint paint.
-string's meaning depends on Paint_Text_Encoding; by default, string encoding is
-UTF-8. Other values of Paint_Text_Encoding are unlikely to produce the desired
+string meaning depends on Paint_Text_Encoding; by default, strings are encoded
+as UTF-8. Other values of Paint_Text_Encoding are unlikely to produce the desired
results, since zero bytes may be embedded in the string.
x and y meaning depends on Paint_Text_Align and Paint_Vertical_Text; by default
-string draws left to right, positioning the first glyph's left side bearing at x
+string draws left to right, positioning the first glyph left side bearing at x
and its baseline at y. Text size is affected by Matrix and Paint_Text_Size.
All elements of paint: Path_Effect, Rasterizer, Mask_Filter, Shader,
@@ -5056,9 +5054,9 @@ Draw each glyph in text with the origin in pos array, using Clip, Matrix, and
Paint paint. The number of entries in pos array must match the number of Glyphs
described by byteLength of text.
-text's meaning depends on Paint_Text_Encoding; by default, text encoding is
+text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. pos elements' meaning depends on Paint_Text_Align and Paint_Vertical_Text;
-by default each glyph's left side bearing is positioned at x and its
+by default each glyph left side bearing is positioned at x and its
baseline is positioned at y. Text size is affected by Matrix and
Paint_Text_Size.
@@ -5067,7 +5065,7 @@ Color_Filter, Image_Filter, and Draw_Looper; apply to text. By default, draws
filled 12 point black Glyphs.
Layout engines such as Harfbuzz typically position each glyph
-rather than using the font's advance widths.
+rather than using the font advance widths.
#Param text character code points or Glyphs drawn ##
#Param byteLength byte length of text array ##
@@ -5099,9 +5097,9 @@ Draw each glyph in text with its (x, y) origin composed from xpos array and
constY, using Clip, Matrix, and Paint paint. The number of entries in xpos array
must match the number of Glyphs described by byteLength of text.
-text's meaning depends on Paint_Text_Encoding; by default, text encoding is
+text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. xpos elements' meaning depends on Paint_Text_Align and Paint_Vertical_Text;
-by default each glyph's left side bearing is positioned at an xpos element and
+by default each glyph left side bearing is positioned at an xpos element and
its baseline is positioned at constY. Text size is affected by Matrix and
Paint_Text_Size.
@@ -5110,7 +5108,7 @@ Color_Filter, Image_Filter, and Draw_Looper; apply to text. By default, draws
filled 12 point black Glyphs.
Layout engines such as Harfbuzz typically position each glyph
-rather than using the font's advance widths if all Glyphs share the same
+rather than using the font advance widths if all Glyphs share the same
baseline.
#Param text character code points or Glyphs drawn ##
@@ -5142,12 +5140,12 @@ Draw text on Path path, using Clip, Matrix, and Paint paint.
Origin of text is at distance hOffset along the path, offset by a perpendicular
vector of length vOffset. If the path section corresponding the glyph advance is
curved, the glyph is drawn curved to match; control points in the glyph are
-mapped to projected points parallel to the path. If the text's advance is larger
+mapped to projected points parallel to the path. If the text advance is larger
than the path length, the excess text is clipped.
-text's meaning depends on Paint_Text_Encoding; by default, text encoding is
+text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. Origin meaning depends on Paint_Text_Align and Paint_Vertical_Text; by
-default text positions the first glyph's left side bearing at origin x and its
+default text positions the first glyph left side bearing at origin x and its
baseline at origin y. Text size is affected by Matrix and Paint_Text_Size.
All elements of paint: Path_Effect, Rasterizer, Mask_Filter, Shader,
@@ -5190,12 +5188,12 @@ Draw text on Path path, using Clip, Matrix, and Paint paint.
Origin of text is at beginning of path offset by matrix, if provided, before it
is mapped to path. If the path section corresponding the glyph advance is
curved, the glyph is drawn curved to match; control points in the glyph are
-mapped to projected points parallel to the path. If the text's advance is larger
+mapped to projected points parallel to the path. If the text advance is larger
than the path length, the excess text is clipped.
-text's meaning depends on Paint_Text_Encoding; by default, text encoding is
+text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. Origin meaning depends on Paint_Text_Align and Paint_Vertical_Text; by
-default text positions the first glyph's left side bearing at origin x and its
+default text positions the first glyph left side bearing at origin x and its
baseline at origin y. Text size is affected by Matrix and Paint_Text_Size.
All elements of paint: Path_Effect, Rasterizer, Mask_Filter, Shader,
@@ -5598,20 +5596,20 @@ void draw(SkCanvas* canvas) {
Draws a Coons patch: the interpolation of four cubics with shared corners,
associating a color, and optionally a texture coordinate, with each corner.
-The Coons patch uses Clip and Matrix, Paint paint's Shader, Color_Filter,
+The Coons patch uses Clip and Matrix, paint Shader, Color_Filter,
Color_Alpha, Image_Filter, and Blend_Mode. If Shader is provided it is treated
as the Coons patch texture; Blend_Mode mode combines Color colors and Shader if
both are provided.
-Point array cubics specifies four Cubics starting at the top left corner,
+Point array cubics specifies four Cubics starting at the top-left corner,
in clockwise order, sharing every fourth point. The last Cubic ends at the
first point.
-Color array color associates colors with corners in top left, top right,
-bottom right, bottom left order.
+Color array color associates colors with corners in top-left, top-right,
+bottom-right, bottom-left order.
If paint contains Shader, Point array texCoords maps Shader as texture to
-corners in top left, top right, bottom right, bottom left order.
+corners in top-left, top-right, bottom-right, bottom-left order.
#Param cubics Path_Cubic array, sharing common points ##
#Param colors Color array, one for each corner ##
@@ -5656,20 +5654,20 @@ void draw(SkCanvas* canvas) {
Draws Cubic Coons patch: the interpolation of four cubics with shared corners,
associating a color, and optionally a texture coordinate, with each corner.
-The Coons patch uses Clip and Matrix, Paint paint's Shader, Color_Filter,
+The Coons patch uses Clip and Matrix, paint Shader, Color_Filter,
Color_Alpha, Image_Filter, and Blend_Mode. If Shader is provided it is treated
as the Coons patch texture; Blend_Mode mode combines Color colors and Shader if
both are provided.
-Point array cubics specifies four Cubics starting at the top left corner,
+Point array cubics specifies four Cubics starting at the top-left corner,
in clockwise order, sharing every fourth point. The last Cubic ends at the
first point.
-Color array color associates colors with corners in top left, top right,
-bottom right, bottom left order.
+Color array color associates colors with corners in top-left, top-right,
+bottom-right, bottom-left order.
If paint contains Shader, Point array texCoords maps Shader as texture to
-corners in top left, top right, bottom right, bottom left order.
+corners in top-left, top-right, bottom-right, bottom-left order.
#Param cubics Path_Cubic array, sharing common points ##
#Param colors Color array, one for each corner ##
diff --git a/docs/SkIRect_Reference.bmh b/docs/SkIRect_Reference.bmh
new file mode 100644
index 0000000000..06bcdf0905
--- /dev/null
+++ b/docs/SkIRect_Reference.bmh
@@ -0,0 +1,1043 @@
+#Topic IRect
+#Alias IRect_Reference
+
+#Struct SkIRect
+
+SkIRect holds four 32 bit integer coordinates for a rectangle
+
+#Topic Overview
+
+#Subtopic Subtopics
+#ToDo manually add subtopics ##
+#Table
+#Legend
+# topics # description ##
+#Legend ##
+#Table ##
+##
+
+#Subtopic Operators
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# friend bool operator!=(const SkIRect& a, const SkIRect& b) # ##
+# friend bool operator==(const SkIRect& a, const SkIRect& b) # ##
+#Table ##
+#Subtopic ##
+
+#Subtopic Member_Functions
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# EmptyIRect # ##
+# Intersects # ##
+# IntersectsNoEmptyCheck # ##
+# MakeEmpty # ##
+# MakeLTRB # ##
+# MakeLargest # ##
+# MakeSize # ##
+# MakeWH # ##
+# MakeXYWH # ##
+# bottom # ##
+# centerX # ##
+# centerY # ##
+# contains # ##
+# containsNoEmptyCheck # ##
+# height # ##
+# inset # ##
+# intersect # ##
+# intersectNoEmptyCheck # ##
+# is16Bit # ##
+# isEmpty # ##
+# isLargest # ##
+# join # ##
+# left # ##
+# makeInset # ##
+# makeOffset # ##
+# makeOutset # ##
+# makeSorted # ##
+# offset # ##
+# offsetTo # ##
+# outset # ##
+# quickReject # ##
+# right # ##
+# set # ##
+# setEmpty # ##
+# setLTRB # ##
+# setLargest # ##
+# setLargestInverted # ##
+# setXYWH # ##
+# size # ##
+# sort # ##
+# top # ##
+# width # ##
+# x # ##
+# y # ##
+#Table ##
+#Subtopic ##
+
+#Topic ##
+
+#Member int32_t fLeft
+##
+
+#Member int32_t fTop
+##
+
+#Member int32_t fRight
+##
+
+#Member int32_t fBottom
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkIRect SK_WARN_UNUSED_RESULT MakeEmpty()
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkIRect SK_WARN_UNUSED_RESULT MakeLargest()
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkIRect SK_WARN_UNUSED_RESULT MakeWH(int32_t w, int32_t h)
+
+#Param w incomplete ##
+#Param h incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkIRect SK_WARN_UNUSED_RESULT MakeSize(const SkISize& size)
+
+#Param size incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkIRect SK_WARN_UNUSED_RESULT MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
+
+#Param l incomplete ##
+#Param t incomplete ##
+#Param r incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
+
+#Param x incomplete ##
+#Param y incomplete ##
+#Param w incomplete ##
+#Param h incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int left() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int top() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int right() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int bottom() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int x() const
+
+return the left edge of the rectangle
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int y() const
+
+return the top edge of the rectangle
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int width() const
+
+Returns the rectangle width. This does not check for a valid rectangle
+(i.e. left <= right) so the result may be negative.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int height() const
+
+Returns the rectangle height. This does not check for a valid rectangle
+(i.e. top <= bottom) so the result may be negative.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkISize size() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int centerX() const
+
+Since the center of an integer rectangle may fall on a factional value, this
+method is defined to return (right + left) >> 1.
+This is a specific "truncation" of the average, which is different than
+(right + left) / 2 when the sum is negative.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method int centerY() const
+
+Since the center of an integer rectangle may fall on a factional value, this
+method is defined to return (bottom + top) >> 1.
+This is a specific "truncation" of the average, which is different than
+(bottom + top) / 2 when the sum is negative.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isEmpty() const
+
+Return true if the rectangle width or height are <= 0
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isLargest() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method friend bool operator==(const SkIRect& a, const SkIRect& b)
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method friend bool operator!=(const SkIRect& a, const SkIRect& b)
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool is16Bit() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setEmpty()
+
+Set the rectangle to (0,0,0,0)
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void set(int32_t left, int32_t top, int32_t right, int32_t bottom)
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom)
+
+alias for set(l, t, r, b)
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
+
+#Param x incomplete ##
+#Param y incomplete ##
+#Param width incomplete ##
+#Param height incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setLargest()
+
+Sets rectangle left and top to most negative value, and sets
+right and bottom to most positive value.
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setLargestInverted()
+
+Sets rectangle left and top to most positive value, and sets
+right and bottom to most negative value.
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkIRect makeOffset(int32_t dx, int32_t dy) const
+
+Return a new IRect, built as an offset of this rectangle.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkIRect makeInset(int32_t dx, int32_t dy) const
+
+Return a new IRect, built as an inset of this rectangle.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkIRect makeOutset(int32_t dx, int32_t dy) const
+
+Return a new Rect, built as an outset of this rectangle.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void offset(int32_t dx, int32_t dy)
+
+Offset set the rectangle by adding dx to its left and right,
+and adding dy to its top and bottom.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void offset(const SkIPoint& delta)
+
+#Param delta incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void offsetTo(int32_t newX, int32_t newY)
+
+Offset this rectangle such its new x() and y() will equal newX and newY.
+
+#Param newX incomplete ##
+#Param newY incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void inset(int32_t dx, int32_t dy)
+
+Inset the rectangle by (dx,dy). If dx is positive, then the sides are moved inwards,
+making the rectangle narrower. If dx is negative, then the sides are moved outwards,
+making the rectangle wider. The same holds true for dy and the top and bottom.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void outset(int32_t dx, int32_t dy)
+
+Outset the rectangle by (dx,dy). If dx is positive, then the sides are
+moved outwards, making the rectangle wider. If dx is negative, then the
+sides are moved inwards, making the rectangle narrower. The same holds
+true for dy and the top and bottom.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool quickReject(int l, int t, int r, int b) const
+
+#Param l incomplete ##
+#Param t incomplete ##
+#Param r incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool contains(int32_t x, int32_t y) const
+
+Returns true if (x,y) is inside the rectangle and the rectangle is not
+empty. The left and top are considered to be inside, while the right
+and bottom are not. Thus for the rectangle (0, 0, 5, 10), the
+points (0,0) and (0,9) are inside, while (-1,0) and (5,9) are not.
+
+#Param x incomplete ##
+#Param y incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool contains(int32_t left, int32_t top, int32_t right, int32_t bottom) const
+
+Returns true if the 4 specified sides of a rectangle are inside or equal to this rectangle.
+If either rectangle is empty, contains() returns false.
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool contains(const SkIRect& r) const
+
+Returns true if the specified rectangle r is inside or equal to this rectangle.
+
+#Param r incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool contains(const SkRect& r) const
+
+Returns true if the specified rectangle r is inside or equal to this rectangle.
+
+#Param r incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool containsNoEmptyCheck(int32_t left, int32_t top,
+ int32_t right, int32_t bottom) const
+
+Return true if this rectangle contains the specified rectangle.
+For speed, this method does not check if either this or the specified
+rectangles are empty, and if either is, its return value is undefined.
+In the debugging build however, we assert that both this and the
+specified rectangles are non-empty.
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool containsNoEmptyCheck(const SkIRect& r) const
+
+#Param r incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool intersect(const SkIRect& r)
+
+If r intersects this rectangle, return true and set this rectangle to that
+intersection, otherwise return false and do not change this rectangle.
+If either rectangle is empty, do nothing and return false.
+
+#Param r incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b)
+
+If rectangles a and b intersect, return true and set this rectangle to
+that intersection, otherwise return false and do not change this
+rectangle. If either rectangle is empty, do nothing and return false.
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT intersectNoEmptyCheck(const SkIRect& a, const SkIRect& b)
+
+If rectangles a and b intersect, return true and set this rectangle to
+that intersection, otherwise return false and do not change this
+rectangle. For speed, no check to see if a or b are empty is performed.
+If either is, then the return result is undefined. In the debug build,
+we assert that both rectangles are non-empty.
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool intersect(int32_t left, int32_t top, int32_t right, int32_t bottom)
+
+If the rectangle specified by left,top,right,bottom intersects this rectangle,
+return true and set this rectangle to that intersection,
+otherwise return false and do not change this rectangle.
+If either rectangle is empty, do nothing and return false.
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static bool Intersects(const SkIRect& a, const SkIRect& b)
+
+Returns true if a and b are not empty, and they intersect
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static bool IntersectsNoEmptyCheck(const SkIRect& a, const SkIRect& b)
+
+Returns true if a and b intersect. debug-asserts that neither are empty.
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void join(int32_t left, int32_t top, int32_t right, int32_t bottom)
+
+Update this rectangle to enclose itself and the specified rectangle.
+If this rectangle is empty, just set it to the specified rectangle. If the specified
+rectangle is empty, do nothing.
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void join(const SkIRect& r)
+
+Update this rectangle to enclose itself and the specified rectangle.
+If this rectangle is empty, just set it to the specified rectangle. If the specified
+rectangle is empty, do nothing.
+
+#Param r incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void sort()
+
+Swap top/bottom or left/right if there are flipped.
+This can be called if the edges are computed separately,
+and may have crossed over each other.
+When this returns, left <= right && top <= bottom
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkIRect makeSorted() const
+
+Return a new Rect that is the sorted version of this rectangle (left <= right, top <= bottom).
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static const SkIRect& SK_WARN_UNUSED_RESULT EmptyIRect()
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+#Struct SkIRect ##
+
+#Topic IRect ##
diff --git a/docs/SkMatrix_Reference.bmh b/docs/SkMatrix_Reference.bmh
new file mode 100644
index 0000000000..db7e7c3c73
--- /dev/null
+++ b/docs/SkMatrix_Reference.bmh
@@ -0,0 +1,2388 @@
+#Topic Matrix
+#Alias Matrix_Reference
+
+#Class SkMatrix
+
+The SkMatrix class holds a 3x3 matrix for transforming coordinates.
+SkMatrix does not have a constructor, so it must be explicitly initialized
+using either reset() - to construct an identity matrix, or one of the set
+functions (e.g. setTranslate, setRotate, etc.).
+SkMatrix is not thread safe unless getType is called first.
+
+#Topic Overview
+
+#Subtopic Subtopics
+#ToDo manually add subtopics ##
+#Table
+#Legend
+# topics # description ##
+#Legend ##
+#Table ##
+##
+
+#Subtopic Operators
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# friend SK_API bool operator!=(const SkMatrix& a, const SkMatrix& b) # ##
+# friend SK_API bool operator==(const SkMatrix& a, const SkMatrix& b) # ##
+#Table ##
+#Subtopic ##
+
+#Subtopic Member_Functions
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# Concat # ##
+# GetMapPtsProc # ##
+# GetMapXYProc # ##
+# I # ##
+# InvalidMatrix # ##
+# MakeRectToRect # ##
+# MakeScale # ##
+# MakeTrans # ##
+# SetAffineIdentity # ##
+# [ # ##
+# asAffine # ##
+# cheapEqualTo # ##
+# decomposeScale # ##
+# dirtyMatrixTypeCache # ##
+# dump # ##
+# fixedStepInX # ##
+# get # ##
+# get9 # ##
+# getMapPtsProc # ##
+# getMapXYProc # ##
+# getMaxScale # ##
+# getMinMaxScales # ##
+# getMinScale # ##
+# getPerspX # ##
+# getPerspY # ##
+# getScaleX # ##
+# getScaleY # ##
+# getSkewX # ##
+# getSkewY # ##
+# getTranslateX # ##
+# getTranslateY # ##
+# getType # ##
+# hasPerspective # ##
+# invert # ##
+# isFinite # ##
+# isFixedStepInX # ##
+# isIdentity # ##
+# isScaleTranslate # ##
+# isSimilarity # ##
+# isTranslate # ##
+# mapHomogeneousPoints # ##
+# mapPoints # ##
+# mapPointsWithStride # ##
+# mapRadius # ##
+# mapRect # ##
+# mapRectScaleTranslate # ##
+# mapRectToQuad # ##
+# mapVector # ##
+# mapVectors # ##
+# mapXY # ##
+# postConcat # ##
+# postIDiv # ##
+# postRotate # ##
+# postScale # ##
+# postSkew # ##
+# postTranslate # ##
+# preConcat # ##
+# preRotate # ##
+# preScale # ##
+# preSkew # ##
+# preTranslate # ##
+# preservesAxisAlignment # ##
+# preservesRightAngles # ##
+# readFromMemory # ##
+# rectStaysRect # ##
+# reset # ##
+# set # ##
+# set9 # ##
+# setAffine # ##
+# setAll # ##
+# setConcat # ##
+# setIDiv # ##
+# setIdentity # ##
+# setPerspX # ##
+# setPerspY # ##
+# setPolyToPoly # ##
+# setRSXform # ##
+# setRectToRect # ##
+# setRotate # ##
+# setScale # ##
+# setScaleTranslate # ##
+# setScaleX # ##
+# setScaleY # ##
+# setSinCos # ##
+# setSkew # ##
+# setSkewX # ##
+# setSkewY # ##
+# setTranslate # ##
+# setTranslateX # ##
+# setTranslateY # ##
+# toString # ##
+# writeToMemory # ##
+#Table ##
+#Subtopic ##
+
+#Topic ##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar sx, SkScalar sy)
+
+#Param sx incomplete ##
+#Param sy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar scale)
+
+#Param scale incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkMatrix SK_WARN_UNUSED_RESULT MakeTrans(SkScalar dx, SkScalar dy)
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Enum TypeMask
+
+#Code
+ enum TypeMask {
+ kIdentity_Mask = 0,
+ kTranslate_Mask = 0x01,
+ kScale_Mask = 0x02,
+ kAffine_Mask = 0x04,
+ kPerspective_Mask = 0x08,
+ };
+##
+
+Enum of bit fields for the mask return by getType().
+Use this to identify the complexity of the matrix.
+
+#Const kIdentity_Mask = 0
+##
+#Const kTranslate_Mask = 0x01
+set if the matrix has translation
+##
+#Const kScale_Mask = 0x02
+set if the matrix has x or y scale
+##
+#Const kAffine_Mask = 0x04
+set if the matrix skews or rotates
+##
+#Const kPerspective_Mask = 0x08
+set if the matrix is in perspective
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method TypeMask getType() const
+
+Returns a bit field describing the transformations the matrix may
+perform. The bit field is computed conservatively, so it may include
+false positives. For example, when kPerspective_Mask is true, all
+other bits may be set to true even in the case of a pure perspective
+transform.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isIdentity() const
+
+Returns true if the matrix is identity.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isScaleTranslate() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isTranslate() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool rectStaysRect() const
+
+Returns true if will map a rectangle to another rectangle. This can be
+true if the matrix is identity, scale-only, or rotates a multiple of
+90 degrees, or mirrors in x or y.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool preservesAxisAlignment() const
+
+alias for rectStaysRect()
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool hasPerspective() const
+
+Returns true if the matrix contains perspective elements.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isSimilarity(SkScalar tol = SK_ScalarNearlyZero) const
+
+Returns true if the matrix contains only translation, rotation/reflection or uniform scale.
+Returns false if other transformation types are included or is degenerate
+
+#Param tol incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool preservesRightAngles(SkScalar tol = SK_ScalarNearlyZero) const
+
+Returns true if the matrix contains only translation, rotation/reflection or scale
+(non-uniform scale is allowed).
+Returns false if other transformation types are included or is degenerate
+
+#Param tol incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Enum _anonymous
+
+#Code
+ enum {
+ kMScaleX,
+ kMSkewX,
+ kMTransX,
+ kMSkewY,
+ kMScaleY,
+ kMTransY,
+ kMPersp0,
+ kMPersp1,
+ kMPersp2,
+ };
+##
+
+#Const kMScaleX 0
+##
+#Const kMSkewX 1
+##
+#Const kMTransX 2
+##
+#Const kMSkewY 3
+##
+#Const kMScaleY 4
+##
+#Const kMTransY 5
+##
+#Const kMPersp0 6
+##
+#Const kMPersp1 7
+##
+#Const kMPersp2 8
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Enum _anonymous_2
+
+#Code
+ enum {
+ kAScaleX,
+ kASkewY,
+ kASkewX,
+ kAScaleY,
+ kATransX,
+ kATransY,
+ };
+##
+
+Affine arrays are in column major order
+because that is how PDF and XPS like it.
+
+#Const kAScaleX 0
+##
+#Const kASkewY 1
+##
+#Const kASkewX 2
+##
+#Const kAScaleY 3
+##
+#Const kATransX 4
+##
+#Const kATransY 5
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar operator[](int index) const
+
+#Param index incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar get(int index) const
+
+#Param index incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getScaleX() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getScaleY() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getSkewY() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getSkewX() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getTranslateX() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getTranslateY() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getPerspX() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getPerspY() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar operator[](int index)
+
+#Param index incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void set(int index, SkScalar value)
+
+#Param index incomplete ##
+#Param value incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setScaleX(SkScalar v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setScaleY(SkScalar v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setSkewY(SkScalar v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setSkewX(SkScalar v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setTranslateX(SkScalar v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setTranslateY(SkScalar v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setPerspX(SkScalar v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setPerspY(SkScalar v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX,
+ SkScalar skewY, SkScalar scaleY, SkScalar transY,
+ SkScalar persp0, SkScalar persp1, SkScalar persp2)
+
+#Param scaleX incomplete ##
+#Param skewX incomplete ##
+#Param transX incomplete ##
+#Param skewY incomplete ##
+#Param scaleY incomplete ##
+#Param transY incomplete ##
+#Param persp0 incomplete ##
+#Param persp1 incomplete ##
+#Param persp2 incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void get9(SkScalar buffer[9]) const
+
+Copy the 9 scalars for this matrix into buffer, in member value ascending order:
+kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.
+
+#Param buffer incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void set9(const SkScalar buffer[9])
+
+Set this matrix to the 9 scalars from the buffer, in member value ascending order:
+kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.
+
+Note: calling set9 followed by get9 may not return the exact same values. Since the matrix
+is used to map non-homogeneous coordinates, it is free to scale the 9 values as needed.
+
+#Param buffer incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void reset()
+
+Set the matrix to identity
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setIdentity()
+
+alias for reset()
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setTranslate(SkScalar dx, SkScalar dy)
+
+Set the matrix to translate by (dx, dy).
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setTranslate(const SkVector& v)
+
+#Param v incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
+
+Set the matrix to scale by sx and sy, with a pivot point at (px, py).
+The pivot point is the coordinate that should remain unchanged by the
+specified transformation.
+
+#Param sx incomplete ##
+#Param sy incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setScale(SkScalar sx, SkScalar sy)
+
+Set the matrix to scale by sx and sy.
+
+#Param sx incomplete ##
+#Param sy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool setIDiv(int divx, int divy)
+
+Set the matrix to scale by 1/divx and 1/divy. Returns false and does not
+touch the matrix if either divx or divy is zero.
+
+#Param divx incomplete ##
+#Param divy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setRotate(SkScalar degrees, SkScalar px, SkScalar py)
+
+Set the matrix to rotate by the specified number of degrees, with a
+pivot point at (px, py). The pivot point is the coordinate that should
+remain unchanged by the specified transformation.
+
+#Param degrees incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setRotate(SkScalar degrees)
+
+Set the matrix to rotate about (0,0) by the specified number of degrees.
+
+#Param degrees incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setSinCos(SkScalar sinValue, SkScalar cosValue,
+ SkScalar px, SkScalar py)
+
+Set the matrix to rotate by the specified sine and cosine values, with
+a pivot point at (px, py). The pivot point is the coordinate that
+should remain unchanged by the specified transformation.
+
+#Param sinValue incomplete ##
+#Param cosValue incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setSinCos(SkScalar sinValue, SkScalar cosValue)
+
+Set the matrix to rotate by the specified sine and cosine values.
+
+#Param sinValue incomplete ##
+#Param cosValue incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkMatrix& setRSXform(const SkRSXform& rsxForm)
+
+#Param rsxForm incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
+
+Set the matrix to skew by kx and ky, with a pivot point at (px, py).
+The pivot point is the coordinate that should remain unchanged by the
+specified transformation.
+
+#Param kx incomplete ##
+#Param ky incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setSkew(SkScalar kx, SkScalar ky)
+
+Set the matrix to skew by kx and ky.
+
+#Param kx incomplete ##
+#Param ky incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setConcat(const SkMatrix& a, const SkMatrix& b)
+
+Set the matrix to the concatenation of the two specified matrices.
+Either of the two matrices may also be the target matrix.
+this = a * b;
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void preTranslate(SkScalar dx, SkScalar dy)
+
+Preconcats the matrix with the specified translation.
+#Formula
+M' = M * T(dx, dy)
+##
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
+
+Preconcats the matrix with the specified scale.
+#Formula
+M' = M * S(sx, sy, px, py)
+##
+
+#Param sx incomplete ##
+#Param sy incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void preScale(SkScalar sx, SkScalar sy)
+
+Preconcats the matrix with the specified scale.
+#Formula
+M' = M * S(sx, sy)
+##
+
+#Param sx incomplete ##
+#Param sy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void preRotate(SkScalar degrees, SkScalar px, SkScalar py)
+
+Preconcats the matrix with the specified rotation.
+#Formula
+M' = M * R(degrees, px, py)
+##
+
+#Param degrees incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void preRotate(SkScalar degrees)
+
+Preconcats the matrix with the specified rotation.
+#Formula
+M' = M * R(degrees)
+##
+
+#Param degrees incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void preSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
+
+Preconcats the matrix with the specified skew.
+#Formula
+M' = M * K(kx, ky, px, py)
+##
+
+#Param kx incomplete ##
+#Param ky incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void preSkew(SkScalar kx, SkScalar ky)
+
+Preconcats the matrix with the specified skew.
+#Formula
+M' = M * K(kx, ky)
+##
+
+#Param kx incomplete ##
+#Param ky incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void preConcat(const SkMatrix& other)
+
+Preconcats the matrix with the specified matrix.
+#Formula
+M' = M * other
+##
+
+#Param other incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void postTranslate(SkScalar dx, SkScalar dy)
+
+Postconcats the matrix with the specified translation.
+#Formula
+M' = T(dx, dy) * M
+##
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
+
+Postconcats the matrix with the specified scale.
+#Formula
+M' = S(sx, sy, px, py) * M
+##
+
+#Param sx incomplete ##
+#Param sy incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void postScale(SkScalar sx, SkScalar sy)
+
+Postconcats the matrix with the specified scale.
+#Formula
+M' = S(sx, sy) * M
+##
+
+#Param sx incomplete ##
+#Param sy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool postIDiv(int divx, int divy)
+
+Postconcats the matrix by dividing it by the specified integers.
+#Formula
+M' = S(1/divx, 1/divy, 0, 0) * M
+##
+
+#Param divx incomplete ##
+#Param divy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void postRotate(SkScalar degrees, SkScalar px, SkScalar py)
+
+Postconcats the matrix with the specified rotation.
+#Formula
+M' = R(degrees, px, py) * M
+##
+
+#Param degrees incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void postRotate(SkScalar degrees)
+
+Postconcats the matrix with the specified rotation.
+#Formula
+M' = R(degrees) * M
+##
+
+#Param degrees incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void postSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
+
+Postconcats the matrix with the specified skew.
+#Formula
+M' = K(kx, ky, px, py) * M
+##
+
+#Param kx incomplete ##
+#Param ky incomplete ##
+#Param px incomplete ##
+#Param py incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void postSkew(SkScalar kx, SkScalar ky)
+
+Postconcats the matrix with the specified skew.
+#Formula
+M' = K(kx, ky) * M
+##
+
+#Param kx incomplete ##
+#Param ky incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void postConcat(const SkMatrix& other)
+
+Postconcats the matrix with the specified matrix.
+#Formula
+M' = other * M
+##
+
+#Param other incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Enum ScaleToFit
+
+#Code
+ enum ScaleToFit {
+ kFill_ScaleToFit,
+ kStart_ScaleToFit,
+ kCenter_ScaleToFit,
+ kEnd_ScaleToFit,
+ };
+##
+
+#Const kFill_ScaleToFit
+Scale in X and Y independently, so that src matches dst exactly.
+This may change the aspect ratio of the src.
+##
+#Const kStart_ScaleToFit
+Compute a scale that will maintain the original src aspect ratio,
+but will also ensure that src fits entirely inside dst. At least one
+axis (x or y) will fit exactly. Aligns the result to the
+left and top edges of dst.
+##
+#Const kCenter_ScaleToFit
+Compute a scale that will maintain the original src aspect ratio,
+but will also ensure that src fits entirely inside dst. At least one
+axis (x or y) will fit exactly. The result is centered inside dst.
+##
+#Const kEnd_ScaleToFit
+Compute a scale that will maintain the original src aspect ratio,
+but will also ensure that src fits entirely inside dst. At least one
+axis (x or y) will fit exactly. Aligns the result to the
+right and bottom edges of dst.
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool setRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf)
+
+Set the matrix to the scale and translate values that map the source
+rectangle to the destination rectangle, returning true if the the result
+can be represented.
+
+#Param src the source rectangle to map from
+##
+#Param dst the destination rectangle to map to
+##
+#Param stf the ScaleToFit option
+##
+
+#Return true if the matrix can be represented by the rectangle mapping
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkMatrix MakeRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf)
+
+#Param src incomplete ##
+#Param dst incomplete ##
+#Param stf incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count)
+
+Set the matrix such that the specified src points would map to the
+specified dst points. count must be within [0..4].
+
+#Param src array of src points
+##
+#Param dst array of dst points
+##
+#Param count number of points to use for the transformation
+##
+
+#Return true if the matrix was set to the specified transformation
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT invert(SkMatrix* inverse) const
+
+If this matrix can be inverted, return true and if inverse is not null,
+set inverse to be the inverse of this matrix. If this matrix cannot be
+inverted, ignore inverse and return false
+
+#Param inverse incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static void SetAffineIdentity(SkScalar affine[6])
+
+Fills the passed array with affine identity values
+in column major order.
+
+#Param affine array to fill with affine identity values; must not be nullptr
+##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT asAffine(SkScalar affine[6]) const
+
+Fills the passed array with the affine values in column major order.
+If the matrix is a perspective transform, returns false
+and does not change the passed array.
+
+#Param affine array to fill with affine values; ignored if nullptr
+##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setAffine(const SkScalar affine[6])
+
+Set the matrix to the specified affine values.
+Note: these are passed in column major order.
+
+#Param affine incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
+
+Apply this matrix to the array of points specified by src, and write
+the transformed points into the array of points specified by dst.
+#Formula
+dst[] = M * src[]
+##
+
+#Param dst storage for transformed coordinates; must
+ allow count entries
+##
+#Param src original coordinates that are to be transformed;
+ must allow count entries
+##
+#Param count number of points in src to read, and then transform
+ into dst
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapPoints(SkPoint pts[], int count) const
+
+Apply this matrix to the array of points, overwriting it with the
+transformed values.
+#Formula
+dst[] = M * pts[]
+##
+
+#Param pts storage for transformed points; must allow count entries
+##
+#Param count number of points in pts
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapPointsWithStride(SkPoint pts[], size_t stride, int count) const
+
+Like mapPoints but with custom byte stride between the points. Stride
+should be a multiple of
+#Formula
+sizeof(SkScalar)
+##
+.
+
+#Param pts incomplete ##
+#Param stride incomplete ##
+#Param count incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapPointsWithStride(SkPoint dst[], const SkPoint src[], size_t stride, int count) const
+
+Like mapPoints but with custom byte stride between the points.
+
+#Param dst incomplete ##
+#Param src incomplete ##
+#Param stride incomplete ##
+#Param count incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapHomogeneousPoints(SkScalar dst[], const SkScalar src[], int count) const
+
+Apply this matrix to the array of homogeneous points, specified by src,
+where a homogeneous point is defined by 3 contiguous scalar values,
+and write the transformed points into the array of scalars specified by dst.
+#Formula
+dst[] = M * src[]
+##
+
+#Param dst storage for transformed coordinates; must
+ allow 3 * count entries
+##
+#Param src original coordinates to be transformed;
+ must contain at least 3 * count entries
+##
+#Param count number of triples (homogeneous points) in src to read,
+ and then transform into dst
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapXY(SkScalar x, SkScalar y, SkPoint* result) const
+
+#Param x incomplete ##
+#Param y incomplete ##
+#Param result incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkPoint mapXY(SkScalar x, SkScalar y) const
+
+#Param x incomplete ##
+#Param y incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapVectors(SkVector dst[], const SkVector src[], int count) const
+
+Apply this matrix to the array of vectors specified by src, and write
+the transformed vectors into the array of vectors specified by dst.
+This is similar to mapPoints, but ignores any translation in the matrix.
+
+#Param dst storage for transformed coordinates; must
+ allow count entries
+##
+#Param src coordinates to be transformed;
+ must contain at least count entries
+##
+#Param count number of vectors in src to read and transform
+ into dst
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapVectors(SkVector vecs[], int count) const
+
+Apply this matrix to count vectors in array vecs.
+This is similar to mapPoints, but ignores any translation in the matrix.
+
+#Param vecs vectors to transform; must contain at least
+ count entries
+##
+#Param count number of vectors in vecs
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapVector(SkScalar dx, SkScalar dy, SkVector* result) const
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+#Param result incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkVector mapVector(SkScalar dx, SkScalar dy) const
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool mapRect(SkRect* dst, const SkRect& src) const
+
+Apply this matrix to the src rectangle, and write the transformed
+rectangle into dst. This is accomplished by transforming the 4 corners
+of src, and then setting dst to the bounds of those points.
+
+#Param dst storage for transformed rectangle ##
+#Param src rectangle to transform ##
+
+#Return result of calling rectStaysRect
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool mapRect(SkRect* rect) const
+
+Apply this matrix to the rectangle, and write the transformed rectangle
+back into it. This is accomplished by transforming the 4 corners of
+rect, and then setting it to the bounds of those points
+
+#Param rect rectangle to transform
+##
+
+#Return the result of calling rectStaysRect
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapRectToQuad(SkPoint dst[4], const SkRect& rect) const
+
+Applies Matrix to rect, and write the four transformed
+points into dst. The points written to dst will be the original top-left, top-right,
+bottom-right, and bottom-left points transformed by Matrix.
+
+#Param dst storage for transformed quad
+##
+#Param rect rectangle to transform
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void mapRectScaleTranslate(SkRect* dst, const SkRect& src) const
+
+Maps a rectangle to another rectangle, asserting (in debug mode) that the matrix only contains
+scale and translate elements. If it contains other elements, the results are undefined.
+
+#Param dst incomplete ##
+#Param src incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar mapRadius(SkScalar radius) const
+
+Return the mean radius of a circle after it has been mapped by
+this matrix. NOTE: in perspective this value assumes the circle
+has its center at the origin.
+
+#Param radius incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static MapXYProc GetMapXYProc(TypeMask mask)
+
+#Param mask incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method MapXYProc getMapXYProc() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static MapPtsProc GetMapPtsProc(TypeMask mask)
+
+#Param mask incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method MapPtsProc getMapPtsProc() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isFixedStepInX() const
+
+Returns true if the matrix can be stepped in x (not complex
+perspective).
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkVector fixedStepInX(SkScalar y) const
+
+If the matrix can be stepped in x (not complex perspective)
+then return the step value.
+If it cannot, behavior is undefined.
+
+#Param y incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool cheapEqualTo(const SkMatrix& m) const
+
+Returns true if Matrix equals m, using an efficient comparison.
+
+Return false when the sign of zero values is the different, that is, one
+matrix has positive zero value and the other has negative zero value.
+
+Normally, comparing NaN prevents the value from equaling any other value,
+including itself. To improve performance, NaN values are treated as bit patterns
+that are equal if their bit patterns are equal.
+
+#Param m incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method friend SK_API bool operator==(const SkMatrix& a, const SkMatrix& b)
+
+mac chromium debug build requires SK_API to make operator== visible
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method friend SK_API bool operator!=(const SkMatrix& a, const SkMatrix& b)
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Enum _anonymous_3
+
+#Code
+ enum {
+ kMaxFlattenSize = 9 * sizeof(SkScalar) + sizeof(uint32_t),
+ };
+##
+
+#Const kMaxFlattenSize = 9 * sizeof(SkScalar) + sizeof(uint32_t)
+ writeToMemory and readFromMemory will never return a value larger than this
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method size_t writeToMemory(void* buffer) const
+
+return the number of bytes written, whether or not buffer is null
+
+#Param buffer incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method size_t readFromMemory(const void* buffer, size_t length)
+
+Reads data from the buffer parameter
+
+#Param buffer memory to read from
+##
+#Param length amount of memory available in the buffer
+##
+
+#Return number of bytes read (must be a multiple of 4) or
+ 0 if there was not enough memory available
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void dump() const
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void toString(SkString* str) const
+
+#Param str incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getMinScale() const
+
+Calculates the minimum scaling factor of the matrix as computed from the
+singular value decomposition of the upper
+left 2x2. If the max scale factor cannot be computed (for example overflow or perspective)
+-1 is returned.
+
+#Return minimum scale factor
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar getMaxScale() const
+
+Calculates the maximum scaling factor of the matrix as computed from the
+singular value decomposition of the upper
+left 2x2. If the max scale factor cannot be computed (for example overflow or perspective)
+-1 is returned.
+
+#Return maximum scale factor
+##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT getMinMaxScales(SkScalar scaleFactors[2]) const
+
+Gets both the min and max scale factors. The min scale factor is scaleFactors[0] and the max
+is scaleFactors[1]. If the min/max scale factors cannot be computed false is returned and the
+values of scaleFactors[] are undefined.
+
+#Param scaleFactors incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool decomposeScale(SkSize* scale, SkMatrix* remaining = nullptr) const
+
+Attempt to decompose this matrix into a scale-only component and whatever remains, where
+the scale component is to be applied first.
+#Formula
+M -> Remaining * Scale
+##
+On success, return true and assign the scale and remaining components (assuming their
+respective parameters are not null). On failure return false and ignore the parameters.
+Possible reasons to fail: perspective, one or more scale factors are zero.
+
+#Param scale incomplete ##
+#Param remaining incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static const SkMatrix& I()
+
+Return a reference to a const identity matrix
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static const SkMatrix& InvalidMatrix()
+
+Return a reference to a const matrix that is "invalid", one that could
+never be used.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkMatrix Concat(const SkMatrix& a, const SkMatrix& b)
+
+Return the concatenation of two matrices, a * b.
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void dirtyMatrixTypeCache()
+
+Testing routine; the matrix type cache should never need to be
+manually invalidated during normal use.
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty)
+
+Initialize the matrix to be scale + post-translate.
+
+#Param sx incomplete ##
+#Param sy incomplete ##
+#Param tx incomplete ##
+#Param ty incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isFinite() const
+
+Are all elements of the matrix finite?
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+#Class SkMatrix ##
+
+#Topic Matrix ##
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index 91644d8aa5..96822f950f 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -93,7 +93,7 @@ Shader attached to Paint.
# Hinting # Level of glyph outline adjustment. ##
# Join # Corner geometry on stroked shapes. ##
# Style # Stroke, fill, or both. ##
-# TextEncoding # Character or glyph encoding size. ##
+# TextEncoding # Character or glyph encoded size. ##
#Table ##
#Subtopic ##
@@ -171,7 +171,7 @@ Shader attached to Paint.
# getStyle # Returns Style: stroke, fill, or both. ##
# getTextAlign # Returns Align: left, center, or right. ##
# getTextBlobIntercepts # Returns where lines intersect Text_Blob; underlines. ##
-# getTextEncoding # Returns character or glyph encoding size. ##
+# getTextEncoding # Returns character or glyph encoded size. b ##
# getTextIntercepts # Returns where lines intersect text; underlines. ##
# getTextPath # Returns Path equivalent to text. ##
# getTextScaleX # Returns the text horizontal scale; condensed text. ##
@@ -229,7 +229,7 @@ Shader attached to Paint.
# setStyle # Sets Style: stroke, fill, or both. ##
# setSubpixelText # Sets or clears Subpixel_Text. ##
# setTextAlign # Sets Align: left, center, or right. ##
-# setTextEncoding # Sets character or glyph encoding size. ##
+# setTextEncoding # Sets character or glyph encoded size. ##
# setTextScaleX # Sets the text horizontal scale; condensed text. ##
# setTextSkewX # Sets the text horizontal skew; oblique text. ##
# setTextSize # Sets text size in points. ##
@@ -375,8 +375,8 @@ This prevents objects with Reference_Count from being modified once Paint refers
#Method void reset()
-Sets all paint's contents to their initial values. This is equivalent to replacing
-the paint with the result of SkPaint().
+Sets all Paint contents to their initial values. This is equivalent to replacing
+Paint with the result of SkPaint().
#Example
SkPaint paint1, paint2;
@@ -1626,7 +1626,7 @@ void draw(SkCanvas* canvas) {
Fake_Bold approximates the bold font style accompanying a normal font when a bold font face
is not available. Skia does not provide font substitution; it is up to the client to find the
-bold font face using the platform's Font_Manager.
+bold font face using the platform Font_Manager.
Use Text_Skew_X to approximate an italic font style when the italic font face
is not available.
@@ -1713,7 +1713,7 @@ Right_Side_Bearing. Full_Hinting_Spacing only applies to platforms that use
FreeType as their Font_Engine.
Full_Hinting_Spacing is not related to text Kerning, where the space between
-a specific pair of characters is adjusted using data in the font's Kerning tables.
+a specific pair of characters is adjusted using data in the font Kerning tables.
#Method bool isDevKernText() const
@@ -2019,10 +2019,10 @@ Set Style to kStroke_Style to stroke the shape.
#Subtopic ##
#Subtopic Stroke
-The stroke covers the area described by following the shape's edge with a pen or brush of
+The stroke covers the area described by following the shape edge with a pen or brush of
Stroke_Width. The area covered where the shape starts and stops is described by Stroke_Cap.
The area covered where the shape turns a corner is described by Stroke_Join.
-The stroke is centered on the shape; it extends equally on either side of the shape's edge.
+The stroke is centered on the shape; it extends equally on either side of the shape edge.
As Stroke_Width gets smaller, the drawn path frame is thinner. Stroke_Width less than one
may have gaps, and if kAntiAlias_Flag is set, Color_Alpha will increase to visually decrease coverage.
@@ -2170,14 +2170,14 @@ May be used to verify that Style is a legal value.
#Topic Stroke_Width
Stroke_Width sets the width for stroking. The width is the thickness
-of the stroke perpendicular to the path's direction when the paint's style is
+of the stroke perpendicular to the path direction when the paint style is
set to kStroke_Style or kStrokeAndFill_Style.
When width is greater than zero, the stroke encompasses as many pixels partially
or fully as needed. When the width equals zero, the paint enables hairlines;
the stroke is always one pixel wide.
-The stroke's dimensions are scaled by the canvas matrix, but Hairline stroke
+The stroke dimensions are scaled by the canvas matrix, but Hairline stroke
remains one pixel wide regardless of scaling.
The default width for the paint is zero.
@@ -2187,7 +2187,7 @@ The default width for the paint is zero.
#Platform raster gpu
#Description
The pixels hit to represent thin lines vary with the angle of the
- line and the platform's implementation.
+ line and the platform implementation.
##
void draw(SkCanvas* canvas) {
SkPaint paint;
@@ -2415,7 +2415,7 @@ Stroke_Cap draws at the beginning and end of an open Path_Contour.
#Enum ##
Stroke describes the area covered by a pen of Stroke_Width as it
-follows the Path_Contour, moving parallel to the contours's direction.
+follows the Path_Contour, moving parallel to the contour direction.
If the Path_Contour is not terminated by SkPath::kClose_Verb, the contour has a
visible beginning and end.
@@ -2495,7 +2495,7 @@ Stroke_Cap is kButt_Cap by default.
Stroke_Join draws at the sharp corners of an open or closed Path_Contour.
Stroke describes the area covered by a pen of Stroke_Width as it
-follows the Path_Contour, moving parallel to the contours's direction.
+follows the Path_Contour, moving parallel to the contour direction.
If the contour direction changes abruptly, because the tangent direction leading
to the end of a curve within the contour does not match the tangent direction of
@@ -4007,12 +4007,12 @@ Text_Skew_X defaults to 0.
##
TextEncoding determines whether text specifies character codes and their encoded
-size, or glyph indices. Character codes use the encoding specified by the
+size, or glyph indices. Characters are encoded as specified by the
#A Unicode standard # http://unicode.org/standard/standard.html ##
.
Character codes encoded size are specified by UTF-8, UTF-16, or UTF-32.
-All character encodings are able to represent all of Unicode, differing only
+All character code formats are able to represent all of Unicode, differing only
in the total storage required.
#A UTF-8 (RFC 3629) # https://tools.ietf.org/html/rfc3629 ##
@@ -4047,9 +4047,9 @@ Uses two byte words to represent glyph indices.
#Example
#Height 128
#Description
-First line has UTF-8 encoding.
-Second line has UTF-16 encoding.
-Third line has UTF-32 encoding.
+First line is encoded in UTF-8.
+Second line is encoded in UTF-16.
+Third line is encoded in UTF-32.
Fourth line has 16 bit glyph indices.
##
void draw(SkCanvas* canvas) {
@@ -4504,8 +4504,7 @@ Returns the number of glyph indices represented by text.
Text_Encoding specifies how text represents characters or glyphs.
glyphs may be nullptr, to compute the glyph count.
-Does not check text for valid character encoding or valid
-glyph indices.
+Does not check text for valid character codes or valid glyph indices.
If byteLength equals zero, returns zero.
If byteLength includes a partial character, the partial character is ignored.
diff --git a/docs/SkPixmap_Reference.bmh b/docs/SkPixmap_Reference.bmh
index 521d6dea15..09fb1a68fe 100644
--- a/docs/SkPixmap_Reference.bmh
+++ b/docs/SkPixmap_Reference.bmh
@@ -11,8 +11,8 @@ a direct drawing destination.
Use Bitmap to draw pixels referenced by Pixmap; use Surface to draw into
pixels referenced by Pixmap.
-Pixmap does not try to manage the lifetime of the pixel memory. Use PixelRef
-to manage pixel memory; PixelRef is safe across threads.
+Pixmap does not try to manage the lifetime of the pixel memory. Use Pixel_Ref
+to manage pixel memory; Pixel_Ref is safe across threads.
#Topic Overview
@@ -401,7 +401,8 @@ width() * info().bytesPerPixel()
##
.
-It is up to the Pixmap creator to ensure that row bytes is a useful value.
+Returns zero if colorType is kUnknown_SkColorType.
+It is up to the Bitmap creator to ensure that row bytes is a useful value.
#Return byte length of pixel row ##
@@ -461,7 +462,7 @@ inset address: 0x7f2a440fb210
Returns pixel count in each pixel row. Should be equal or less than:
#Formula
-rowBytes() / info.bytesPerPixel()
+rowBytes() / info().bytesPerPixel()
##
.
@@ -476,7 +477,7 @@ pixmap width: 16 info width: 16
##
##
-#SeeAlso height()
+#SeeAlso height() SkImageInfo::width()
##
@@ -489,15 +490,14 @@ Returns pixel row count.
#Return pixel height in Image_Info ##
#Example
- SkImageInfo info = SkImageInfo::MakeA8(16, 32);
- SkPixmap pixmap(info, nullptr, 64);
- SkDebugf("pixmap height: %d info height: %d\n", pixmap.height(), info.height());
+ SkPixmap pixmap(SkImageInfo::MakeA8(16, 32), nullptr, 64);
+ SkDebugf("pixmap height: %d info height: %d\n", pixmap.height(), pixmap.info().height());
#StdOut
pixmap height: 32 info height: 32
##
##
-#SeeAlso width()
+#SeeAlso width() ImageInfo::height()
##
@@ -521,7 +521,7 @@ color type: kAlpha_SkColorType
##
##
-#SeeAlso alphaType()
+#SeeAlso alphaType() SkImageInfo::colorType
##
@@ -543,7 +543,7 @@ alpha type: kPremul_SkAlphaType
##
##
-#SeeAlso colorType()
+#SeeAlso colorType() SkImageInfo::alphaType
##
@@ -551,9 +551,11 @@ alpha type: kPremul_SkAlphaType
#Method SkColorSpace* colorSpace() const
-Returns Color_Space associated with Image_Info.
+Returns Color_Space associated with Image_Info. The
+reference count of Color_Space is unchanged. The returned Color_Space is
+immutable.
-#Return Color_Space in Image_Info ##
+#Return Color_Space, the range of colors, in Image_Info ##
#Example
#Description
@@ -572,7 +574,7 @@ gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
##
##
-#SeeAlso Color_Space
+#SeeAlso Color_Space SkImageInfo::colorSpace
##
@@ -581,7 +583,8 @@ gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
#Method bool isOpaque() const
Returns true if Alpha_Type is kOpaque_SkAlphaType.
-Does not check if Color_Type allows Alpha, or Alpha in pixel values.
+Does not check if Color_Type allows Alpha, or if any pixel value has
+transparency.
#Return true if Image_Info has opaque Alpha_Type ##
@@ -717,31 +720,15 @@ color: kRGBA_F16_SkColorType bytesPerPixel: 8 shiftPerPixel: 3
#Method uint64_t getSize64() const
+#Deprecated
+##
+
Returns conservative memory required for pixel storage.
Includes unused memory on last row when rowBytesAsPixels exceeds width().
#Return conservative pixel storage size ##
-#Example
- SkPixmap pixmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- pixmap.reset(imageInfo , nullptr, width * 5);
- SkDebugf("width: %7d height: %7d getSize64: %13lld\n", width, height, pixmap.getSize64());
- }
- }
-#StdOut
-width: 1 height: 1 getSize64: 5
-width: 1 height: 1000 getSize64: 5000
-width: 1 height: 1000000 getSize64: 5000000
-width: 1000 height: 1 getSize64: 5000
-width: 1000 height: 1000 getSize64: 5000000
-width: 1000 height: 1000000 getSize64: 5000000000
-width: 1000000 height: 1 getSize64: 5000000
-width: 1000000 height: 1000 getSize64: 5000000000
-width: 1000000 height: 1000000 getSize64: 5000000000000
-##
+#NoExample
##
#SeeAlso getSafeSize64 getSafeSize height() rowBytes width() SkImageInfo::bytesPerPixel
@@ -752,32 +739,15 @@ width: 1000000 height: 1000000 getSize64: 5000000000000
#Method uint64_t getSafeSize64() const
+#Deprecated
+##
+
Returns minimum memory required for pixel storage.
Does not include unused memory on last row when rowBytesAsPixels exceeds width().
#Return exact pixel storage size ##
-#Example
- SkPixmap pixmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- pixmap.reset(imageInfo , nullptr, width * 5);
- SkDebugf("width: %7d height: %7d getSafeSize64: %13lld\n", width, height,
- pixmap.getSafeSize64());
- }
- }
-#StdOut
-width: 1 height: 1 getSafeSize64: 4
-width: 1 height: 1000 getSafeSize64: 4999
-width: 1 height: 1000000 getSafeSize64: 4999999
-width: 1000 height: 1 getSafeSize64: 4000
-width: 1000 height: 1000 getSafeSize64: 4999000
-width: 1000 height: 1000000 getSafeSize64: 4999999000
-width: 1000000 height: 1 getSafeSize64: 4000000
-width: 1000000 height: 1000 getSafeSize64: 4999000000
-width: 1000000 height: 1000000 getSafeSize64: 4999999000000
-##
+#NoExample
##
#SeeAlso getSize64 getSafeSize height() rowBytes width() SkImageInfo::bytesPerPixel
@@ -788,6 +758,9 @@ width: 1000000 height: 1000000 getSafeSize64: 4999999000000
#Method size_t getSafeSize() const
+#Deprecated
+##
+
Returns minimum memory required for pixel storage.
Does not include unused memory on last row when rowBytesAsPixels exceeds width().
Returns zero if value is does not fit in a signed 32-bit integer.
@@ -795,31 +768,50 @@ The largest value than can be returned is 2,147,483,647.
#Return exact pixel storage size if size fits in signed 32 bits ##
+#NoExample
+##
+
+#SeeAlso getSize64 getSafeSize64 height() rowBytes width() SkImageInfo::bytesPerPixel sk_64_isS32
+
+##
+
+
+# ------------------------------------------------------------------------------
+
+#Method size_t computeByteSize() const
+
+Returns minimum memory required for pixel storage.
+Does not include unused memory on last row when rowBytesAsPixels exceeds width().
+Returns zero if result does not fit in size_t.
+Returns zero if height() or width() is 0.
+Returns height() times rowBytes if colorType is kUnknown_SkColorType.
+
+#Return size in bytes of image buffer ##
+
#Example
-void draw(SkCanvas* canvas) {
SkPixmap pixmap;
for (int width : { 1, 1000, 1000000 } ) {
for (int height: { 1, 1000, 1000000 } ) {
SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- pixmap.reset(imageInfo , nullptr, width * 5);
- SkDebugf("width: %7d height: %7d getSafeSize: %7d\n", width, height, pixmap.getSafeSize());
+ pixmap.reset(imageInfo, nullptr, width * 5);
+ SkDebugf("width: %7d height: %7d computeByteSize: %13lld\n", width, height,
+ pixmap.computeByteSize());
}
}
-}
#StdOut
-width: 1 height: 1 getSafeSize: 4
-width: 1 height: 1000 getSafeSize: 4999
-width: 1 height: 1000000 getSafeSize: 4999999
-width: 1000 height: 1 getSafeSize: 4000
-width: 1000 height: 1000 getSafeSize: 4999000
-width: 1000 height: 1000000 getSafeSize: 0
-width: 1000000 height: 1 getSafeSize: 4000000
-width: 1000000 height: 1000 getSafeSize: 0
-width: 1000000 height: 1000000 getSafeSize: 0
+width: 1 height: 1 computeByteSize: 4
+width: 1 height: 1000 computeByteSize: 4999
+width: 1 height: 1000000 computeByteSize: 4999999
+width: 1000 height: 1 computeByteSize: 4000
+width: 1000 height: 1000 computeByteSize: 4999000
+width: 1000 height: 1000000 computeByteSize: 4999999000
+width: 1000000 height: 1 computeByteSize: 4000000
+width: 1000000 height: 1000 computeByteSize: 4999000000
+width: 1000000 height: 1000000 computeByteSize: 4999999000000
##
##
-#SeeAlso getSize64 getSafeSize64 height() rowBytes width() SkImageInfo::bytesPerPixel sk_64_isS32
+#SeeAlso SkImageInfo::computeByteSize
##
@@ -845,7 +837,7 @@ greater.
Returns false for kUnknown_SkColorType.
-#Return true all pixels have opaque values or Color_Type is opaque ##
+#Return true if all pixels have opaque values or Color_Type is opaque ##
#Example
std::vector<uint32_t> pixels;
@@ -943,10 +935,13 @@ Unpremultiplied:
#Method const void* addr(int x, int y) const
-Returns readable pixel address at (x, y).
+Returns readable pixel address at (x, y). Returns nullptr if Pixel_Ref is nullptr.
Input is not validated: out of bounds values of x or y trigger an assert() if
-built with SK_DEBUG defined. Returns zero if Color_Type is kUnknown_SkColorType.
+built with SK_DEBUG defined. Returns nullptr if Color_Type is kUnknown_SkColorType.
+
+Performs a lookup of pixel size; for better performance, call
+one of: addr8, addr16, addr32, addr64, or addrF16.
#Param x column index, zero or greater, and less than width() ##
#Param y row index, zero or greater, and less than height() ##
@@ -966,7 +961,7 @@ pixmap.addr(1, 2) == &storage[1 + 2 * w]
##
##
-#SeeAlso addr8 addr16 addr32 addr64 addrF16 getColor writable_addr
+#SeeAlso addr8 addr16 addr32 addr64 addrF16 getColor writable_addr SkBitmap::getAddr
##
@@ -1611,7 +1606,7 @@ abs(srcY) >= this->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 their encoding.
+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 ##
@@ -1625,6 +1620,7 @@ pixels are treated as if they are linear, regardless of their encoding.
#Return true if pixels are copied to dstPixels ##
#Example
+#ToDo example doesn't do anything interesting since info colorSpace is nullptr ##
#Image 3
void draw(SkCanvas* canvas) {
SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height(),
diff --git a/docs/SkRect_Reference.bmh b/docs/SkRect_Reference.bmh
new file mode 100644
index 0000000000..33d9e54591
--- /dev/null
+++ b/docs/SkRect_Reference.bmh
@@ -0,0 +1,1320 @@
+#Topic Rect
+#Alias Rects
+#Alias Rect_Reference
+
+#Struct SkRect
+
+#Topic Overview
+
+#Subtopic Subtopics
+#ToDo manually add subtopics ##
+#Table
+#Legend
+# topics # description ##
+#Legend ##
+#Table ##
+##
+
+#Subtopic Operators
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# friend bool operator!=(const SkRect& a, const SkRect& b) # ##
+# friend bool operator==(const SkRect& a, const SkRect& b) # ##
+#Table ##
+#Subtopic ##
+
+#Subtopic Member_Functions
+#Table
+#Legend
+# description # function ##
+#Legend ##
+# Make # ##
+# MakeEmpty # ##
+# MakeFromIRect # ##
+# MakeIWH # ##
+# MakeLTRB # ##
+# MakeLargest # ##
+# MakeSize # ##
+# MakeWH # ##
+# MakeXYWH # ##
+# bottom # ##
+# centerX # ##
+# centerY # ##
+# height # ##
+# inset # ##
+# intersect # ##
+# isEmpty # ##
+# isFinite # ##
+# isLargest # ##
+# isSorted # ##
+# iset # ##
+# isetWH # ##
+# left # ##
+# makeInset # ##
+# makeOffset # ##
+# makeOutset # ##
+# offset # ##
+# offsetTo # ##
+# outset # ##
+# right # ##
+# set # ##
+# setBounds # ##
+# setBoundsCheck # ##
+# setEmpty # ##
+# setLTRB # ##
+# setLargest # ##
+# setLargestInverted # ##
+# setWH # ##
+# setXYWH # ##
+# toQuad # ##
+# top # ##
+# width # ##
+# x # ##
+# y # ##
+#Table ##
+#Subtopic ##
+
+#Topic ##
+
+#Member SkScalar fLeft
+##
+
+#Member SkScalar fTop
+##
+
+#Member SkScalar fRight
+##
+
+#Member SkScalar fBottom
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty()
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkRect SK_WARN_UNUSED_RESULT MakeLargest()
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h)
+
+#Param w incomplete ##
+#Param h incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkRect SK_WARN_UNUSED_RESULT MakeIWH(int w, int h)
+
+#Param w incomplete ##
+#Param h incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size)
+
+#Param size incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeLTRB(SkScalar l, SkScalar t, SkScalar r,
+ SkScalar b)
+
+#Param l incomplete ##
+#Param t incomplete ##
+#Param r incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScalar w, SkScalar h)
+
+#Param x incomplete ##
+#Param y incomplete ##
+#Param w incomplete ##
+#Param h incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect)
+
+#Param irect incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkRect Make(const SkISize& size)
+
+#Param size incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect)
+
+#Param irect incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isEmpty() const
+
+Return true if the rectangle width or height are <= 0
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isSorted() const
+
+Return true if the rectangle width and height are >= 0
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isLargest() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool isFinite() const
+
+Returns true if and only if all values in the rectangle are finite. If any are
+infinite or NaN then this returns false.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar x() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar y() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar left() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar top() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar right() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar bottom() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar width() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar height() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar centerX() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkScalar centerY() const
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method friend bool operator==(const SkRect& a, const SkRect& b)
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method friend bool operator!=(const SkRect& a, const SkRect& b)
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void toQuad(SkPoint quad[4]) const
+
+return the 4 points that enclose the rectangle (top-left, top-right, bottom-right,
+bottom-left).
+#ToDo
+Consider adding param to control whether quad is CW or CCW.
+##
+
+#Param quad incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setEmpty()
+
+Set this rectangle to the empty rectangle (0,0,0,0)
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void set(const SkIRect& src)
+
+#Param src incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void set(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setLTRB(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
+
+alias for set(l, t, r, b)
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void iset(int left, int top, int right, int bottom)
+
+Initialize the rectangle with the 4 specified integers. The routine handles
+converting them to scalars (by calling SkIntToScalar)
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void isetWH(int width, int height)
+
+Set this rectangle to be left/top at 0,0, and have the specified width
+and height (automatically converted to SkScalar).
+
+#Param width incomplete ##
+#Param height incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void set(const SkPoint pts[], int count)
+
+Set this rectangle to be the bounds of the array of points.
+If the array is empty (count == 0), then set this rectangle
+to the empty rectangle (0,0,0,0)
+
+#Param pts incomplete ##
+#Param count incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setBounds(const SkPoint pts[], int count)
+
+alias for set(pts, count)
+
+#Param pts incomplete ##
+#Param count incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool setBoundsCheck(const SkPoint pts[], int count)
+
+Compute the bounds of the array of points, and set this rectangle to that
+bounds and return true... unless a non-finite value is encountered,
+in which case this rectangle is set to empty and false is returned.
+
+#Param pts incomplete ##
+#Param count incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void set(const SkPoint& p0, const SkPoint& p1)
+
+#Param p0 incomplete ##
+#Param p1 incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setXYWH(SkScalar x, SkScalar y, SkScalar width, SkScalar height)
+
+#Param x incomplete ##
+#Param y incomplete ##
+#Param width incomplete ##
+#Param height incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setWH(SkScalar width, SkScalar height)
+
+#Param width incomplete ##
+#Param height incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setLargest()
+
+Sets rectangle left and top to most negative value, and sets
+right and bottom to most positive value.
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void setLargestInverted()
+
+Sets rectangle left and top to most positive value, and sets
+right and bottom to most negative value.
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkRect makeOffset(SkScalar dx, SkScalar dy) const
+
+Return a new Rect, built as an offset of this rectangle.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkRect makeInset(SkScalar dx, SkScalar dy) const
+
+Return a new Rect, built as an inset of this rectangle.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method SkRect makeOutset(SkScalar dx, SkScalar dy) const
+
+Return a new Rect, built as an outset of this rectangle.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void offset(SkScalar dx, SkScalar dy)
+
+Offset set the rectangle by adding dx to its left and right,
+and adding dy to its top and bottom.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void offset(const SkPoint& delta)
+
+#Param delta incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void offsetTo(SkScalar newX, SkScalar newY)
+
+Offset this rectangle such its new x() and y() will equal newX and newY.
+
+#Param newX incomplete ##
+#Param newY incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void inset(SkScalar dx, SkScalar dy)
+
+Inset the rectangle by (dx,dy). If dx is positive, then the sides are
+moved inwards, making the rectangle narrower. If dx is negative, then
+the sides are moved outwards, making the rectangle wider. The same holds
+true for dy and the top and bottom.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method void outset(SkScalar dx, SkScalar dy)
+
+Outset the rectangle by (dx,dy). If dx is positive, then the sides are
+moved outwards, making the rectangle wider. If dx is negative, then the
+sides are moved inwards, making the rectangle narrower. The same holds
+true for dy and the top and bottom.
+
+#Param dx incomplete ##
+#Param dy incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool intersect(const SkRect& r)
+
+If this rectangle intersects r, return true and set this rectangle to that
+intersection, otherwise return false and do not change this rectangle.
+If either rectangle is empty, do nothing and return false.
+
+#Param r incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool intersect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
+
+If this rectangle intersects the rectangle specified by left, top, right, bottom,
+return true and set this rectangle to that intersection, otherwise return false
+and do not change this rectangle.
+If either rectangle is empty, do nothing and return false.
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SK_WARN_UNUSED_RESULT intersect(const SkRect& a, const SkRect& b)
+
+If rectangles a and b intersect, return true and set this rectangle to
+that intersection, otherwise return false and do not change this
+rectangle. If either rectangle is empty, do nothing and return false.
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#ToDo incomplete ##
+
+##
+
+#Method bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) const
+
+Returns true if this rectangle is not empty, and the specified sides of
+a rectangle are not empty, and they intersect.
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method bool intersects(const SkRect& r) const
+
+#Param r incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method static bool Intersects(const SkRect& a, const SkRect& b)
+
+Returns true if rectangles a and b are not empty and intersect.
+
+#Param a incomplete ##
+#Param b incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+
+#Method void join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
+
+Updates rectangle to enclose itself and the specified rectangle.
+If this rectangle is empty, just set it to the specified rectangle.
+If the specified rectangle is empty, do nothing.
+
+#Param left incomplete ##
+#Param top incomplete ##
+#Param right incomplete ##
+#Param bottom incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void join(const SkRect& r)
+
+If this rectangle is empty, just set it to the specified rectangle. If the specified
+rectangle is empty, do nothing.
+
+#Param r incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void joinNonEmptyArg(const SkRect& r)
+
+#Param r incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void joinPossiblyEmptyRect(const SkRect& r)
+
+Joins the rectangle with another without checking if either are empty (may produce unexpected
+results if either rectangle is inverted).
+
+#Param r incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void growToInclude(SkPoint pt)
+
+Grows rectangle to include the specified (x,y). After this call, the
+following will be true: fLeft <= x <= fRight && fTop <= y <= fBottom.
+
+This is close, but not quite the same contract as contains(), since
+contains() treats the left and top different from the right and bottom.
+contains(x,y) -> fLeft <= x < fRight && fTop <= y < fBottom. Also note
+that contains(x,y) always returns false if the rectangle is empty.
+
+#Param pt incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void growToInclude(const SkPoint pts[], int count)
+
+Bulk version of growToInclude
+
+#Param pts incomplete ##
+#Param count incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void growToInclude(const SkPoint pts[], size_t stride, int count)
+
+Bulk version of growToInclude with stride.
+
+#Param pts incomplete ##
+#Param stride incomplete ##
+#Param count incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method bool contains(const SkRect& r) const {
+
+Return true if this rectangle contains r, and if both rectangles are
+not empty.
+
+#Param r incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method bool contains(const SkIRect& r) const
+
+Returns true if the specified rectangle r is inside or equal to this rectangle.
+
+#Param r incomplete ##
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void round(SkIRect* dst) const
+
+Sets dst rectangle by rounding this rectangle coordinates to their
+nearest integer values using SkScalarRoundToInt.
+
+#Param dst incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void roundOut(SkIRect* dst) const
+
+Sets dst rectangle by rounding "out" this rectangle, choosing the
+SkScalarFloorToInt of top and left, and the SkScalarCeilToInt of right and bottom.
+
+#Param dst incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void roundOut(SkRect* dst) const
+
+Sets the dst rectangle by rounding "out" this rectangle, choosing the
+SkScalarFloorToScalar of top and left, and the SkScalarCeilToScalar of right and bottom.
+
+It is safe for this to equal dst.
+
+#Param dst incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void roundIn(SkIRect* dst) const
+
+Set the dst rectangle by rounding "in" this rectangle, choosing the
+ceil() of top and left, and the floor of right and bottom. This does *not*
+call sort(), so it is possible that the resulting rectangle is inverted;
+either left >= right or top >= bottom. Call isEmpty() to detect that.
+
+#Param dst incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method SkIRect round() const
+
+Returns the result of calling round(&dst)
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method SkIRect roundOut() const
+
+Returns the result of calling roundOut(&dst)
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method void sort()
+
+Swaps top/bottom or left/right if there are flipped; if width()
+or height() would have returned a negative value. This should be called
+if the edges are computed separately, and may have crossed over each
+other. When this returns, left <= right && top <= bottom
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method SkRect makeSorted() const
+
+Returns a new Rect that is the sorted version of this rectangle (left <= right, top <= bottom).
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+#SeeAlso incomplete
+
+##
+
+#Method const SkScalar* asScalars() const
+
+Cast-safe way to treat the rectangle as a SkScalar array with four entries.
+
+#Return incomplete ##
+
+#Example
+// incomplete
+##
+
+##
+
+#Method void dump(bool asHex) const
+
+#Param asHex incomplete ##
+
+#Example
+// incomplete
+##
+
+##
+
+#Method void dump() const
+
+#Example
+// incomplete
+##
+
+##
+
+#Method void dumpHex() const
+
+#Example
+// incomplete
+##
+
+##
+
+#Struct SkRect ##
+
+#Topic Rect ##
diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh
index ad7233f2b6..d66bcf87af 100644
--- a/docs/undocumented.bmh
+++ b/docs/undocumented.bmh
@@ -8,7 +8,9 @@
API
CPU
GPU GPU-backed OpenGL Vulkan
+ PDF XPS
RFC
+ NaN NaNs
Bezier Coons Cartesian
C C++ Destructor Subclasses
SaveLayerFlags # not external; need to add typedef support
@@ -16,6 +18,8 @@
SkXXX.h # ditto
SkXXX_Reference # ditto
Skia # ditto
+ SK_ABORT # ditto
+ SK_API # ditto
SK_DEBUG # ditto
SK_RELEASE # ditto
SK_USE_FREETYPE_EMBOLDEN # ditto
@@ -52,20 +56,6 @@ FT_Load_Glyph
##
##
-#Topic Bitmap
-#Class SkBitmap
- #Subtopic Row_Bytes
- ##
- #Method void erase(SkColor c, const SkIRect& area) const
- ##
- #Method bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes)
- ##
- #Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
- int srcX, int srcY, SkTransferFunctionBehavior behavior) const
- ##
-#Class ##
-##
-
#Topic Blend_Mode
#EnumClass SkBlendMode
#Const kSrc 1
@@ -325,6 +315,22 @@ FT_Load_Glyph
##
#Method int bytesPerPixel() const
##
+ #Method int height() const
+ ##
+ #Method int width() const
+ ##
+ #Method SkColorType colorType() const
+ ##
+ #Method SkAlphaType alphaType() const
+ ##
+ #Method SkColorSpace* colorSpace() const
+ ##
+ #Method bool isOpaque() const
+ ##
+ #Method size_t minRowBytes() const
+ ##
+ #Method size_t computeByteSize(size_t rowBytes) const
+ ##
##
#Subtopic ##
#Class SkImage
@@ -351,13 +357,6 @@ FT_Load_Glyph
#Topic Image_Scaling
##
-#Topic IRect
-#Struct SkIRect
- #Method bool intersect(const SkIRect& r)
- ##
-##
-##
-
#Topic Left_Side_Bearing
##
@@ -365,6 +364,15 @@ FT_Load_Glyph
#Alias Lines
#Topic ##
+#Topic Malloc_Pixel_Ref
+#Class SkMallocPixelRef
+ #Method static sk_sp<SkPixelRef> MakeZeroed(const SkImageInfo&, size_t rowBytes)
+ ##
+ #Method static sk_sp<SkPixelRef> MakeAllocate(const SkImageInfo&, size_t rowBytes)
+ ##
+##
+##
+
#Topic Mask
#Class SkMask
#Enum Format
@@ -387,18 +395,31 @@ FT_Load_Glyph
#Topic Mask_Filter
#Class SkMaskFilter
+#Method virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
+ SkIPoint* margin) const
+##
#Class ##
#Topic ##
#Topic Math
#Method static inline bool sk_64_isS32(int64_t value)
##
+ #Method SkIntToScalar(x)
+ ##
+ #Method SkScalarRoundToInt(x)
+ ##
+ #Method SkScalarFloorToInt(x)
+ ##
+ #Method SkScalarCeilToInt(x)
+ ##
+ #Method SkScalarFloorToScalar(x)
+ ##
+ #Method SkScalarCeilToScalar(x)
+ ##
##
-#Topic Matrix
-#Struct SkMatrix
-#Struct ##
-#Topic ##
+#Topic Mip_Map
+##
#Topic Nine_Patch
##
@@ -482,8 +503,16 @@ FT_Load_Glyph
##
##
-#Topic PixelRef
+#Topic Pixel_Ref
#Class SkPixelRef
+ #Method int width() const
+ ##
+ #Method int height() const
+ ##
+ #Method bool isImmutable() const
+ ##
+ #Method void setImmutable()
+ ##
##
##
@@ -534,20 +563,10 @@ FT_Load_Glyph
#Subtopic ##
#Topic ##
-#Topic Rect
-#Alias Rects
- #Struct SkRect
- #Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty()
- ##
- #Method void dump() const
- ##
- #Method void dumpHex() const
- ##
- #Struct ##
-#Topic ##
-
#Topic Reference_Count
#Substitute SkRefCnt
+#Class SkRefCnt
+#Class ##
#Class sk_sp
#Class ##
#Topic ##
@@ -588,6 +607,10 @@ FT_Load_Glyph
#Subtopic ##
#Topic ##
+#Topic Size
+#Alias ISize
+##
+
#Topic Sprite
#Alias Sprites
#Topic ##