Add docs for SkMatrix, SkRect, SkIRect, SkBitmap

Also minor changes to earlier docs.

Many small changes to improve indentation in generated includes.
Added support for matrix math illustrations.

Docs-Preview: https://skia.org/?cl=58500
Bug: skia:6898
Change-Id: I7da58ad55f82d7fd41d19288beb2cd71730fb01f
Reviewed-on: https://skia-review.googlesource.com/58500
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
This commit is contained in:
Cary Clark 2017-10-26 07:58:48 -04:00 committed by Skia Commit-Bot
parent 456b292956
commit 154beea859
26 changed files with 10247 additions and 3747 deletions

View File

@ -89,8 +89,7 @@ is useful to position one or more Bitmaps within a shared pixel array.
# 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. ##
# computeByteSize # Returns 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. ##
@ -98,7 +97,7 @@ is useful to position one or more Bitmaps within a shared pixel array.
# eraseARGB # Writes Color to pixels. ##
# eraseArea # Deprecated ##
# eraseColor # Writes Color to pixels. ##
# eraseRGB # Writes opaque Color to pixels. ##
# eraseRGB # Deprecated ##
# extractAlpha # Creates Bitmap containing Alpha of pixels. ##
# extractSubset # Creates Bitmap, sharing pixels if possible. ##
# getAddr # Returns readable pixel address as void pointer. ##
@ -109,8 +108,6 @@ is useful to position one or more Bitmaps within a shared pixel array.
# 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. ##
@ -144,6 +141,7 @@ is useful to position one or more Bitmaps within a shared pixel array.
# 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. ##
# validate() # Asserts if Bitmap is invalid (debug only). ##
# width() # Returns pixel column count. ##
# writePixels # Copies and converts pixels. ##
#Table ##
@ -480,6 +478,7 @@ width: 56 height: 56 color: BGRA_8888 alpha: Opaque
#Method int width() const
Returns pixel count in each pixel row. Should be equal or less than:
#Formula
rowBytes() / info().bytesPerPixel()
##
@ -1004,171 +1003,6 @@ width: 1000000 height: 1000000 computeByteSize: 4999999000000
# ------------------------------------------------------------------------------
#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.
@ -1201,9 +1035,9 @@ copy is immutable
#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.
Sets internal flag to mark Bitmap as immutable. 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.
@ -2547,7 +2381,7 @@ then Color_RGB is ignored.
canvas->drawBitmap(bitmap, 0, 0);
##
#SeeAlso eraseARGB eraseRGB erase
#SeeAlso eraseARGB erase
##
@ -2576,7 +2410,7 @@ then r, g, and b are ignored.
canvas->drawBitmap(bitmap, .5f, .5f);
##
#SeeAlso eraseColor eraseRGB erase
#SeeAlso eraseColor erase
##
@ -2584,22 +2418,13 @@ then r, g, and b are ignored.
#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.
Deprecated. Use eraseARGB or eraseColor.
#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) ##
#Param r amount of red ##
#Param g amount of green ##
#Param b amount of blue ##
#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);
#NoExample
##
#SeeAlso eraseColor eraseARGB erase
@ -2950,7 +2775,8 @@ 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
false if width() or height() is zero or negative.
Returns false if
#Formula
abs(srcX) >= this->width()
##
@ -3034,7 +2860,8 @@ 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
false if width() or height() is zero or negative.
Returns false if
#Formula
abs(srcX) >= this->width()
##
@ -3108,7 +2935,8 @@ 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
false if width() or height() is zero or negative.
Returns false if
#Formula
abs(srcX) >= this->width()
##
@ -3220,7 +3048,8 @@ 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
false if width() or height() is zero or negative.
Returns false if
#Formula
abs(dstX) >= this->width()
##
@ -3541,11 +3370,11 @@ mask.
#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.
Copies Bitmap pixel address, row bytes, and Image_Info to pixmap, if address
is available, and returns true. If pixel address is not available, return
false and leave pixmap unchanged.
pixmap contents become invalid on any future change to Bitmap.
#Param pixmap storage for pixel state if pixels are readable; otherwise, ignored ##
@ -3590,6 +3419,20 @@ is changed in any way, in which case the results are invalid.
# ------------------------------------------------------------------------------
#Method void validate() const;
Asserts if internal values are illegal or inconsistent. Only available if
SK_DEBUG is defined at compile time.
#NoExample
##
#SeeAlso SkImageInfo::validate()
##
# ------------------------------------------------------------------------------
#Method void toString(SkString* str) const;
#DefinedBy SK_TO_STRING_NONVIRT() ##

View File

@ -975,14 +975,11 @@ Canvas or Surface call may invalidate the pixmap values.
#Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY)
Copies rectangle of pixels from Canvas into dstPixels. Matrix and Clip are
ignored. Source rectangle corners are (srcX, srcY) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
.
Copies Rect of pixels from Canvas into dstPixels. Matrix and Clip are
ignored. Source Rect corners are (srcX, srcY) and
(imageInfo().width(), imageInfo().height()).
Destination rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()).
Destination Rect corners are (0, 0) and (bitmap.width(), bitmap.height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to dstInfo.colorType() and dstInfo.alphaType() if required.
@ -995,7 +992,7 @@ The destination pixel storage must be allocated by the caller.
Pixel values are converted only if Image_Color_Type and Image_Alpha_Type
do not match. Only pixels within both source and destination rectangles
are copied. dstPixels contents outside the rectangle intersection are unchanged.
are copied. dstPixels contents outside Rect intersection are unchanged.
Pass negative values for srcX or srcY to offset pixels across or down destination.
@ -1070,14 +1067,11 @@ Does not copy, and returns false if:
#Method bool readPixels(const SkPixmap& pixmap, int srcX, int srcY)
Copies rectangle of pixels from Canvas into pixmap. Matrix and Clip are
ignored. Source rectangle corners are (srcX, srcY) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
.
Copies Rect of pixels from Canvas into pixmap. Matrix and Clip are
ignored. Source Rect corners are (srcX, srcY) and
(imageInfo().width(), imageInfo().height()).
Destination rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()).
Destination Rect corners are (0, 0) and (bitmap.width(), bitmap.height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to pixmap.colorType() and pixmap.alphaType() if required.
@ -1089,8 +1083,8 @@ class like SkDumpCanvas.
Caller must allocate pixel storage in pixmap if needed.
Pixel values are converted only if Image_Color_Type and Image_Alpha_Type
do not match. Only pixels within both source and destination rectangles
are copied. pixmap pixels contents outside the rectangle intersection are unchanged.
do not match. Only pixels within both source and destination Rects
are copied. pixmap pixels contents outside Rect intersection are unchanged.
Pass negative values for srcX or srcY to offset pixels across or down pixmap.
@ -1136,14 +1130,11 @@ Does not copy, and returns false if:
#Method bool readPixels(const SkBitmap& bitmap, int srcX, int srcY)
Copies rectangle of pixels from Canvas into bitmap. Matrix and Clip are
ignored. Source rectangle corners are (srcX, srcY) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
.
Copies Rect of pixels from Canvas into bitmap. Matrix and Clip are
ignored. Source Rect corners are (srcX, srcY) and
(imageInfo().width(), imageInfo().height()).
Destination rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()).
Destination Rect corners are (0, 0) and (bitmap.width(), bitmap.height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to bitmap.colorType() and bitmap.alphaType() if required.
@ -1156,7 +1147,7 @@ Caller must allocate pixel storage in bitmap if needed.
Bitmap values are converted only if Image_Color_Type and Image_Alpha_Type
do not match. Only pixels within both source and destination rectangles
are copied. Bitmap pixels outside the rectangle intersection are unchanged.
are copied. Bitmap pixels outside Rect intersection are unchanged.
Pass negative values for srcX or srcY to offset pixels across or down bitmap.
@ -1202,24 +1193,13 @@ void draw(SkCanvas* canvas) {
#Method bool writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y)
Copies rectangle from pixels to Canvas. Matrix and Clip are ignored.
Source rectangle corners are (0, 0) and (info.width(), info.height()).
Destination rectangle corners are (x, y) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
.
Copies Rect from pixels to Canvas. Matrix and Clip are ignored.
Source Rect corners are (0, 0) and (info.width(), info.height()).
Destination Rect corners are (x, y) and
(imageInfo().width(), imageInfo().height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to
#Formula
this->imageInfo.colorType()
##
and
#Formula
this->imageInfo.alphaType()
##
if required.
converting to imageInfo().colorType() and imageInfo().alphaType() if required.
Pixels are writable when Device is raster, or backed by a GPU.
Pixels are not writable when SkCanvas is returned by SkDocument::beginPage,
@ -1228,7 +1208,7 @@ class like SkDumpCanvas.
Pixel values are converted only if Image_Color_Type and Image_Alpha_Type
do not match. Only pixels within both source and destination rectangles
are copied. Canvas pixels outside the rectangle intersection are unchanged.
are copied. Canvas pixels outside Rect intersection are unchanged.
Pass negative values for x or y to offset pixels to the left or
above Canvas pixels.
@ -1237,8 +1217,8 @@ Does not copy, and returns false if:
#List
# Source and destination rectangles do not intersect. ##
# pixels could not be converted to this->imageInfo.colorType() or
this->imageInfo.alphaType(). ##
# pixels could not be converted to this->imageInfo().colorType() or
this->imageInfo().alphaType(). ##
# Canvas pixels are not writable; for instance, Canvas is document-based. ##
# rowBytes is too small to contain one row of pixels. ##
##
@ -1270,25 +1250,14 @@ this->imageInfo.alphaType(). ##
#Method bool writePixels(const SkBitmap& bitmap, int x, int y)
Copies rectangle from pixels to Canvas. Matrix and Clip are ignored.
Source rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()).
Copies Rect from pixels to Canvas. Matrix and Clip are ignored.
Source Rect corners are (0, 0) and (bitmap.width(), bitmap.height()).
Destination rectangle corners are (x, y) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
.
Destination Rect corners are (x, y) and
(imageInfo().width(), imageInfo().height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to
#Formula
this->imageInfo.colorType()
##
and
#Formula
this->imageInfo.alphaType()
##
if required.
converting to imageInfo().colorType() and imageInfo().alphaType() if required.
Pixels are writable when Device is raster, or backed by a GPU.
Pixels are not writable when SkCanvas is returned by SkDocument::beginPage,
@ -1297,7 +1266,7 @@ class like SkDumpCanvas.
Pixel values are converted only if Image_Color_Type and Image_Alpha_Type
do not match. Only pixels within both source and destination rectangles
are copied. Canvas pixels outside the rectangle intersection are unchanged.
are copied. Canvas pixels outside Rect intersection are unchanged.
Pass negative values for x or y to offset pixels to the left or
above Canvas pixels.
@ -1307,8 +1276,8 @@ Does not copy, and returns false if:
#List
# Source and destination rectangles do not intersect. ##
# bitmap does not have allocated pixels. ##
# bitmap pixels could not be converted to this->imageInfo.colorType() or
this->imageInfo.alphaType(). ##
# bitmap pixels could not be converted to this->imageInfo().colorType() or
this->imageInfo().alphaType(). ##
# Canvas pixels are not writable; for instance, Canvas is document based. ##
# bitmap pixels are inaccessible; for instance, bitmap wraps a texture. ##
##
@ -4687,14 +4656,6 @@ void draw(SkCanvas* canvas) {
# ------------------------------------------------------------------------------
#Struct Lattice
Lattice divides Bitmap or Image into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
#Code
struct Lattice {
enum Flags {...
@ -4708,6 +4669,14 @@ void draw(SkCanvas* canvas) {
};
##
Lattice divides Bitmap or Image into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
#Enum Flags
#Code
enum Flags : uint8_t {
@ -6142,8 +6111,8 @@ Restores Canvas to saved state.
#Method void restore()
Restores Canvas to saved state immediately. Subsequent calls and class
destructor have no effect.
Restores Canvas to saved state immediately. Subsequent calls and
~SkAutoCanvasRestore have no effect.
#Example
// incomplete

View File

@ -254,7 +254,7 @@ rect: 5, 25, 15, 35 isEmpty: false
#Method static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
Returns constructed IRect set to
Returns constructed IRect set to:
#Formula
(x, y, x + w, y + h)
##
@ -789,7 +789,7 @@ rect2: {3, 4, 1, 2}
#Method void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
Sets IRect to
Sets IRect to:
#Formula
(x, y, x + width, y + height)
##
@ -1139,14 +1139,18 @@ rect (7, 11, 13, 17) test(12, 16, 14, 18) quickReject false; intersects true
#Method bool contains(int32_t x, int32_t y) const
Returns true if
Returns true if:
#Formula
fLeft <= x < fRight && fTop <= y < fBottom
##
.
Returns false if Rect is empty.
Considers input to describe constructed IRect (x, y, x + 1, y + 1) and
Considers input to describe constructed IRect:
#Formula
(x, y, x + 1, y + 1)
##
and
returns true if constructed area is completely enclosed by IRect area.
#Param x test Point x-coordinate ##
@ -1357,7 +1361,7 @@ rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
IRects intersect when they enclose a common area. To intersect, each of the pair
must describe area; fLeft is less than fRight, and fTop is less than fBottom;
empty() returns false. The intersection of IRect a and IRect b can be described by:
empty() returns false. The intersection of IRect pair can be described by:
#Formula
(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))

File diff suppressed because it is too large Load Diff

View File

@ -4177,16 +4177,6 @@ void draw(SkCanvas* canvas) {
#Struct FontMetrics
FontMetrics is filled out by getFontMetrics. FontMetrics contents reflect the values
computed by Font_Manager using Typeface. Values are set to zero if they are
not available.
fUnderlineThickness and fUnderlinePosition have a bit set in fFlags if their values
are valid, since their value may be zero.
fStrikeoutThickness and fStrikeoutPosition have a bit set in fFlags if their values
are valid, since their value may be zero.
#Code
struct FontMetrics {
enum FontMetricsFlags {
@ -4220,11 +4210,17 @@ void draw(SkCanvas* canvas) {
};
##
#Enum FontMetricsFlags
FontMetrics is filled out by getFontMetrics. FontMetrics contents reflect the values
computed by Font_Manager using Typeface. Values are set to zero if they are
not available.
FontMetricsFlags are set in fFlags when underline and strikeout metrics are valid;
the underline or strikeout metric may be valid and zero.
Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
fUnderlineThickness and fUnderlinePosition have a bit set in fFlags if their values
are valid, since their value may be zero.
fStrikeoutThickness and fStrikeoutPosition have a bit set in fFlags if their values
are valid, since their value may be zero.
#Enum FontMetricsFlags
#Code
enum FontMetricsFlags {
@ -4235,6 +4231,10 @@ void draw(SkCanvas* canvas) {
};
##
FontMetricsFlags are set in fFlags when underline and strikeout metrics are valid;
the underline or strikeout metric may be valid and zero.
Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
#Const kUnderlineThicknessIsValid_Flag 0x0001
Set if fUnderlineThickness is valid.
##

View File

@ -456,10 +456,10 @@ kCW_Direction travel clockwise; the same added with kCCW_Direction
travel counterclockwise.
#Const kCW_Direction 0
Contour travels in a clockwise direction.
Contour travels in a clockwise direction
##
#Const kCCW_Direction 1
Contour travels in a counterclockwise direction.
Contour travels in a counterclockwise direction
##
@ -744,6 +744,7 @@ Point_Array, using the formula:
#Formula
(this->points * weight) + ending->points * (1 - weight)
##
.
weight is most useful when between zero (ending Point_Array) and
one (this Point_Array); will work with values outside of this
@ -3464,10 +3465,10 @@ Four Oval parts with radii (rx, ry) start at last Path Point and ends at (x, y).
ArcSize and Direction select one of the four Oval parts.
#Const kSmall_ArcSize 0
Smaller of Arc pair.
smaller of Arc pair
##
#Const kLarge_ArcSize 1
Larger of Arc pair.
larger of Arc pair
##
#Example
@ -3505,18 +3506,20 @@ void draw(SkCanvas* canvas) {
#Method void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
Direction sweep, SkScalar x, SkScalar y)
Append Arc to Path. Arc is implemented by one or more Conics weighted to describe part of Oval
with radii (rx, ry) rotated by xAxisRotate degrees. Arc curves from last Path Point to (x, y),
choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.
Append Arc to Path. Arc is implemented by one or more Conics weighted to
describe part of Oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc
curves from last Path Point to (x, y), choosing one of four possible routes:
clockwise or counterclockwise, and smaller or larger.
Arc sweep is always less than 360 degrees. arcTo appends Line to (x, y) if either radii are zero,
or if last Path Point equals (x, y). arcTo scales radii (rx, ry) to fit last Path Point and
(x, y) if both are greater than zero but too small.
Arc sweep is always less than 360 degrees. arcTo appends Line to (x, y) if
either radii are zero, or if last Path Point equals (x, y). arcTo scales radii
(rx, ry) to fit last Path Point and (x, y) if both are greater than zero but
too small.
arcTo appends up to four Conic curves.
arcTo implements the functionality of SVG_Arc, although SVG "sweep-flag" value is
opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while kCW_Direction
cast to int is zero.
arcTo implements the functionality of SVG_Arc, although SVG "sweep-flag" value
is opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise,
while kCW_Direction cast to int is zero.
#Param rx radius in x before x-axis rotation ##
#Param ry radius in y before x-axis rotation ##
@ -3601,7 +3604,8 @@ void draw(SkCanvas* canvas) {
Append Arc to Path, relative to last Path Point. Arc is implemented by one or
more Conic, weighted to describe part of Oval with radii (rx, ry) rotated by
xAxisRotate degrees. Arc curves from last Path Point (x0, y0) to end Point
xAxisRotate degrees. Arc curves from last Path Point (x0, y0) to end Point:
#Formula
(x0 + dx, y0 + dy)
##
@ -3812,8 +3816,9 @@ next Quad. Maximum pts storage size is given by:
#Formula
(1 + 2 * (1 << pow2)) * sizeof(SkPoint)
##
.
ConvertConicToQuads returns Quad count used the approximation, which may be smaller
Returns Quad count used the approximation, which may be smaller
than the number requested.
Conic_Weight determines the amount of influence Conic control point has on the curve.
@ -4200,12 +4205,12 @@ void draw(SkCanvas* canvas) {
Direction dir = kCW_Direction)
Add Circle centered at (x, y) of size radius to Path, appending kMove_Verb,
four kConic_Verb, and kClose_Verb. Circle begins at
four kConic_Verb, and kClose_Verb. Circle begins at:
#Formula
(x + radius, y)
##
, continuing clockwise if dir is kCW_Direction, and counterclockwise if dir is
kCCW_Direction.
, continuing
clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.
Has no effect if radius is zero or negative.
@ -5040,9 +5045,9 @@ for (int y = 2; y < 256; y += 9) {
#Method void dump(SkWStream* stream, bool forceClose, bool dumpAsHex) const
Writes text representation of Path to stream. If stream is nullptr, dump() writes to
standard output. Set forceClose to true to get
edges used to fill Path. Set dumpAsHex true to generate exact binary representations
Writes text representation of Path to stream. If stream is nullptr, writes to
standard output. Set forceClose to true to get edges used to fill Path.
Set dumpAsHex true to generate exact binary representations
of floating point numbers used in Point_Array and Conic_Weights.
#Param stream writable Stream receiving Path text representation; may be nullptr ##

View File

@ -55,13 +55,11 @@ to manage pixel memory; Pixel_Ref is safe across threads.
# bounds() # Returns width and height as Rectangle. ##
# colorSpace # Returns Image_Info Color_Space. ##
# colorType # Returns Image_Info Color_Type. ##
# computeByteSize # Returns size required for pixels. ##
# computeIsOpaque # Returns true if all pixels are opaque. ##
# erase() # Writes Color to pixels. ##
# extractSubset # Sets pointer to portion of original. ##
# getColor # Returns one pixel as Unpremultiplied Color. ##
# getSafeSize # Returns minimum size required for pixels in 32 bits. ##
# getSafeSize64 # Returns minimum size required for pixels in 64 bits. ##
# getSize64 # Returns conservative size required for pixels. ##
# height() # Returns pixel row count. ##
# info() # Returns Image_Info. ##
# isOpaque # Returns true if Image_Info describes opaque pixels. ##
@ -395,7 +393,7 @@ width: 384 height: 384 color: BGRA_8888 alpha: Opaque
#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
is at least as large as:
#Formula
width() * info().bytesPerPixel()
##
@ -461,6 +459,7 @@ inset address: 0x7f2a440fb210
#Method int width() const
Returns pixel count in each pixel row. Should be equal or less than:
#Formula
rowBytes() / info().bytesPerPixel()
##
@ -622,11 +621,7 @@ isOpaque: true
#Method SkIRect bounds() const
Returns IRect
#Formula
{ 0, 0, width(), height() }
##
.
Returns IRect { 0, 0, width(), height() }.
#Return integral rectangle from origin to width() and height() ##
@ -716,66 +711,6 @@ 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 ##
#NoExample
##
#SeeAlso getSafeSize64 getSafeSize height() rowBytes width() SkImageInfo::bytesPerPixel
##
# ------------------------------------------------------------------------------
#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 ##
#NoExample
##
#SeeAlso getSize64 getSafeSize height() rowBytes width() SkImageInfo::bytesPerPixel
##
# ------------------------------------------------------------------------------
#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.
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
@ -1574,11 +1509,8 @@ is drawn after overwriting bottom half float color with top half float color.
#Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY, SkTransferFunctionBehavior behavior) const
Copies a Rect of pixels to dstPixels. Copy starts at (srcX, srcY), and does not exceed
#Formula
(this->width(), this->height())
##
.
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
@ -1593,7 +1525,8 @@ 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
false if width() or height() is zero or negative. Returns false if:
#Formula
abs(srcX) >= this->width()
##
@ -1655,11 +1588,7 @@ void draw(SkCanvas* canvas) {
#Method bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes) const
Copies a Rect of pixels to dstPixels. Copy starts at (0, 0), and does not
exceed
#Formula
(this->width(), this->height())
##
.
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
@ -1722,11 +1651,7 @@ creates visible banding.
int srcY) const
Copies a Rect of pixels to dstPixels. Copy starts at (srcX, srcY), and does not
exceed
#Formula
(this->width(), this->height())
##
.
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
@ -1741,7 +1666,8 @@ 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 this->width() or this->height() is zero or negative. Returns false if
false if this->width() or this->height() is zero or negative. Returns false if:
#Formula
abs(srcX) >= this->width()
##
@ -1803,7 +1729,8 @@ match. If this->colorSpace is nullptr, dst.info().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 this->width() or this->height() is zero or negative. Returns false if
false this->width() or this->height() is zero or negative. Returns false if:
#Formula
abs(srcX) >= this->width()
##

View File

@ -1587,11 +1587,14 @@ rect: 5, 1, 55, 86
Rects intersect when they enclose a common area. To intersect, each of the pair
must describe area; fLeft is less than fRight, and fTop is less than fBottom;
empty() returns false. The intersection of Rect a and Rect b can be described by:
empty() returns false. The intersection of Rect pair can be described by:
#Formula
(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))
##
.
The intersection is only meaningful if the resulting Rect is not empty and
describes an area: fLeft is less than fRight, and fTop is less than fBottom.
@ -1896,6 +1899,7 @@ sorted: 10, 0, 55, 100
#Method void growToInclude(SkPoint pt)
Grows Rect to include (pt.fX, pt.fY), modifying it so that:
#Formula
fLeft <= pt.fX <= fRight && fTop <= pt.fY <= fBottom
##
@ -1962,8 +1966,10 @@ it so that:
#Formula
fLeft <= pt.fX <= fRight && fTop <= pt.fY <= fBottom
##
. Point may be followed with other data in each array element. stride is number
of bytes in element; the interval to skip to advance from one Point to
.
Point may be followed with other data in each array element. stride is number
of bytes in element; the interval to skip to advance from one Point to
the next.
If Rect is initialized with setLargestInverted, then Rect will contain bounds of
@ -2148,6 +2154,7 @@ round: 30, 50, 41, 61
Sets Rect by rounding up fLeft and fTop; and
discarding the fractional portion of fRight and FBottom, using
#Formula
(SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop),
SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom))

View File

@ -11,7 +11,7 @@
PDF XPS
RFC
NaN NaNs
Bezier Coons Cartesian
Bezier Coons Cartesian Euclidean
C C++ Destructor Subclasses
SaveLayerFlags # not external; need to add typedef support
SkUserConfig # not external, but still thinking about how markup refers to this
@ -336,6 +336,8 @@ FT_Load_Glyph
##
#Method size_t computeByteSize(size_t rowBytes) const
##
#Method void validate() const
##
##
#Subtopic ##
#Class SkImage
@ -362,6 +364,11 @@ FT_Load_Glyph
#Topic Image_Scaling
##
#Topic ISize
#Struct SkISize
##
##
#Topic Left_Side_Bearing
##
@ -559,6 +566,11 @@ FT_Load_Glyph
#Subtopic ##
#Topic ##
#Topic Point3
#Struct SkPoint3
##
#Topic ##
#Topic PostScript
#Substitute PostScript
#Subtopic Arct
@ -637,7 +649,8 @@ FT_Load_Glyph
#Topic ##
#Topic Size
#Alias ISize
#Struct SkSize
##
##
#Topic Sprite
@ -645,7 +658,7 @@ FT_Load_Glyph
#Topic ##
#Topic Stream
#Class SkFlattenable
#Class SkStream
#Class ##
#Topic ##
@ -702,6 +715,7 @@ FT_Load_Glyph
##
#Topic Vector
#Alias Vectors
#Struct SkVector
##
##

View File

@ -74,8 +74,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared
| <a href="#SkBitmap_bytesPerPixel">bytesPerPixel</a> | Returns number of bytes in pixel based on <a href="undocumented#Color_Type">Color Type</a>. |
| <a href="#SkBitmap_colorSpace">colorSpace</a> | Returns <a href="#Info">Image Info</a> <a href="undocumented#Color_Space">Color Space</a>. |
| <a href="#SkBitmap_colorType">colorType</a> | Returns <a href="#Info">Image Info</a> <a href="undocumented#Color_Type">Color Type</a>. |
| <a href="#SkBitmap_computeSafeSize64">computeSafeSize64</a> | Returns minimum size required for pixels in 64 bits. |
| <a href="#SkBitmap_computeSize64">computeSize64</a> | Returns conservative size required for pixels. |
| <a href="#SkBitmap_computeByteSize">computeByteSize</a> | Returns size required for pixels. |
| <a href="#SkBitmap_dimensions">dimensions</a> | Returns <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a>. |
| <a href="#SkBitmap_drawsNothing">drawsNothing</a> | Returns true if no <a href="#SkBitmap_width">width</a>, no <a href="#SkBitmap_height">height</a>, or no <a href="undocumented#Pixel_Ref">Pixel Ref</a>. |
| <a href="#SkBitmap_empty">empty</a> | Returns true if <a href="#Info">Image Info</a> has zero <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a>. |
@ -83,7 +82,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared
| <a href="#SkBitmap_eraseARGB">eraseARGB</a> | Writes <a href="undocumented#Color">Color</a> to pixels. |
| <a href="#SkBitmap_eraseArea">eraseArea</a> | Deprecated |
| <a href="#SkBitmap_eraseColor">eraseColor</a> | Writes <a href="undocumented#Color">Color</a> to pixels. |
| <a href="#SkBitmap_eraseRGB">eraseRGB</a> | Writes opaque <a href="undocumented#Color">Color</a> to pixels. |
| <a href="#SkBitmap_eraseRGB">eraseRGB</a> | Deprecated |
| <a href="#SkBitmap_extractAlpha">extractAlpha</a> | Creates <a href="#Bitmap">Bitmap</a> containing <a href="#Alpha">Alpha</a> of pixels. |
| <a href="#SkBitmap_extractSubset">extractSubset</a> | Creates <a href="#Bitmap">Bitmap</a>, sharing pixels if possible. |
| <a href="#SkBitmap_getAddr">getAddr</a> | Returns readable pixel address as void pointer. |
@ -94,8 +93,6 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared
| <a href="#SkBitmap_getColor">getColor</a> | Returns one pixel as <a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>. |
| <a href="#SkBitmap_getGenerationID">getGenerationID</a> | Returns unique ID. |
| <a href="#SkBitmap_getPixels">getPixels</a> | Returns address of pixels. |
| <a href="#SkBitmap_getSafeSize">getSafeSize</a> | Returns minimum size required for pixels in 32 bits. |
| <a href="#SkBitmap_getSize">getSize</a> | Returns conservative size required for pixels in 32 bits. |
| <a href="#SkBitmap_getSubset">getSubset</a> | Returns <a href="#SkBitmap_bounds">bounds</a> offset by origin. |
| <a href="#SkBitmap_hasHardwareMipMap">hasHardwareMipMap</a> | Returns <a href="undocumented#Mip_Map">Mip Map</a> support present; <a href="undocumented#Android">Android</a> only. |
| <a href="#SkBitmap_height">height</a> | Returns pixel row count. |
@ -129,12 +126,13 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared
| <a href="#SkBitmap_tryAllocN32Pixels">tryAllocN32Pixels</a> | Allocates compatible <a href="#ARGB">Color ARGB</a> pixels if possible. |
| <a href="#SkBitmap_tryAllocPixels">tryAllocPixels</a> | Allocates pixels from <a href="#Info">Image Info</a> if possible. |
| <a href="#SkBitmap_tryAllocPixelsFlags">tryAllocPixelsFlags</a> | Allocates pixels from <a href="#Info">Image Info</a> with options if possible. |
| <a href="#SkBitmap_validate">validate</a> | Asserts if <a href="#Bitmap">Bitmap</a> is invalid (debug only). |
| <a href="#SkBitmap_width">width</a> | Returns pixel column count. |
| <a href="#SkBitmap_writePixels">writePixels</a> | Copies and converts pixels. |
# <a name="SkBitmap::Allocator"></a> Class SkBitmap::Allocator
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
class <a href="#SkBitmap_Allocator">Allocator</a> : public <a href="undocumented#SkRefCnt">SkRefCnt</a> {
public:
virtual bool <a href="#SkBitmap_Allocator_allocPixelRef">allocPixelRef(SkBitmap* bitmap)</a> = 0;
@ -172,7 +170,7 @@ true if <a href="undocumented#Pixel_Ref">Pixel Ref</a> was allocated
# <a name="SkBitmap::HeapAllocator"></a> Class SkBitmap::HeapAllocator
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
class <a href="#SkBitmap_HeapAllocator">HeapAllocator</a> : public <a href="#SkBitmap_Allocator">Allocator</a> {
public:
bool <a href="#SkBitmap_HeapAllocator_allocPixelRef">allocPixelRef(SkBitmap* bitmap)</a> override;
@ -516,6 +514,7 @@ int width() const
</pre>
Returns pixel count in each pixel row. Should be equal or less than:
<a href="#SkBitmap_rowBytes">rowBytes</a> / <a href="#SkBitmap_info">info</a>.<a href="#SkBitmap_bytesPerPixel">bytesPerPixel</a>.
Maybe be less than <a href="#SkBitmap_pixelRef">pixelRef</a>.<a href="#SkBitmap_width">width</a>. Will not exceed <a href="#SkBitmap_pixelRef">pixelRef</a>.<a href="#SkBitmap_width">width</a> less
@ -1096,175 +1095,6 @@ width: 1000000 height: 1000000 computeByteSize: 4999999000000
---
<a name="SkBitmap_getSize"></a>
## getSize
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
size_t getSize() const
</pre>
Returns conservative memory required for pixel storage.
Includes unused memory on last row when <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkBitmap_width">width</a>.
Does not check to see if result fits in 32 bits. Use getSize64() if the
result may exceed 32 bits.
### Return Value
<a href="#SkBitmap_height">height</a> times <a href="#SkBitmap_rowBytes">rowBytes</a>
### Example
<div><fiddle-embed name="798d5f259dbd1ead4f3b1eac955c2cde"><div><a href="#SkBitmap_getSize">getSize</a> results are not useful when <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a> are large.</div>
#### Example Output
~~~~
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
~~~~
</fiddle-embed></div>
### See Also
<a href="#SkBitmap_getSafeSize">getSafeSize</a> <a href="#SkBitmap_computeSize64">computeSize64</a> <a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_width">width</a>
---
<a name="SkBitmap_getSafeSize"></a>
## getSafeSize
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
size_t getSafeSize() const
</pre>
Returns minimum memory required for pixel storage.
Does not include unused memory on last row when <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkBitmap_width">width</a>.
Returns zero if size does not fit in 32 bits. Use <a href="#SkBitmap_computeSafeSize64">computeSafeSize64</a> if the
result may exceed 32 bits.
The pixel storage visible may be a subset of the <a href="undocumented#Pixel_Ref">Pixel Ref</a>. Accessing memory
beyond the result may generate an exception.
### Return Value
exact pixel storage size
### Example
<div><fiddle-embed name="47a93c44326c86371dbf42d2544e76be"><div><a href="#SkBitmap_getSafeSize">getSafeSize</a> results are not useful when <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a> are large.</div>
#### Example Output
~~~~
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
~~~~
</fiddle-embed></div>
### See Also
<a href="#SkBitmap_getSize">getSize</a> <a href="#SkBitmap_computeSafeSize64">computeSafeSize64</a> <a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_width">width</a>
---
<a name="SkBitmap_computeSize64"></a>
## computeSize64
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
int64_t computeSize64() const
</pre>
Returns conservative memory required for pixel storage.
Includes unused memory on last row when <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkBitmap_width">width</a>.
### Return Value
conservative pixel storage size
### Example
<div><fiddle-embed name="e7deb420416751aa68c1bd7956596833">
#### Example Output
~~~~
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
~~~~
</fiddle-embed></div>
### See Also
<a href="#SkBitmap_getSize">getSize</a> <a href="#SkBitmap_computeSafeSize64">computeSafeSize64</a> <a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_width">width</a>
---
<a name="SkBitmap_computeSafeSize64"></a>
## computeSafeSize64
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
int64_t computeSafeSize64() const
</pre>
Returns minimum memory required for pixel storage.
Does not include unused memory on last row when <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkBitmap_width">width</a>.
### Return Value
exact pixel storage size
### Example
<div><fiddle-embed name="ff12ff8354c1add9ea00797412f6342c">
#### Example Output
~~~~
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
~~~~
</fiddle-embed></div>
### See Also
<a href="#SkBitmap_getSafeSize">getSafeSize</a> <a href="#SkBitmap_computeSize64">computeSize64</a> <a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_width">width</a>
---
<a name="SkBitmap_isImmutable"></a>
## isImmutable
@ -1306,9 +1136,9 @@ copy is immutable
void setImmutable()
</pre>
Once set, pixels can not change. Any other bitmap sharing the same <a href="undocumented#Pixel_Ref">Pixel Ref</a>
are also marked as immutable. Once <a href="undocumented#Pixel_Ref">Pixel Ref</a> is marked immutable, the setting
cannot be cleared.
Sets internal flag to mark <a href="#Bitmap">Bitmap</a> as immutable. Once set, pixels can not change.
Any other bitmap sharing the same <a href="undocumented#Pixel_Ref">Pixel Ref</a> are also marked as immutable.
Once <a href="undocumented#Pixel_Ref">Pixel Ref</a> is marked immutable, the setting cannot be cleared.
Writing to immutable <a href="#Bitmap">Bitmap</a> pixels triggers an assert on debug builds.
@ -1591,7 +1421,7 @@ integral rectangle from origin to <a href="#SkBitmap_width">width</a> and <a hre
SkISize dimensions() const
</pre>
Returns <a href="#Size">ISize</a> { <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a> }.
Returns <a href="undocumented#ISize">ISize</a> { <a href="#SkBitmap_width">width</a>, <a href="#SkBitmap_height">height</a> }.
### Return Value
@ -1699,7 +1529,7 @@ true if <a href="#Info">Image Info</a> set successfully
## <a name="SkBitmap_AllocFlags"></a> Enum SkBitmap::AllocFlags
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkBitmap_AllocFlags">AllocFlags</a> {
<a href="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a> = 1 << 0,
};</pre>
@ -2577,7 +2407,7 @@ then <a href="#RGB">Color RGB</a> is ignored.
### See Also
<a href="#SkBitmap_eraseARGB">eraseARGB</a> <a href="#SkBitmap_eraseRGB">eraseRGB</a> <a href="#SkBitmap_erase">erase</a>
<a href="#SkBitmap_eraseARGB">eraseARGB</a> <a href="#SkBitmap_erase">erase</a>
---
@ -2613,7 +2443,7 @@ amount of <a href="#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue
### See Also
<a href="#SkBitmap_eraseColor">eraseColor</a> <a href="#SkBitmap_eraseRGB">eraseRGB</a> <a href="#SkBitmap_erase">erase</a>
<a href="#SkBitmap_eraseColor">eraseColor</a> <a href="#SkBitmap_erase">erase</a>
---
@ -2624,25 +2454,19 @@ amount of <a href="#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue
void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const
</pre>
Replaces pixel values with <a href="undocumented#Color">Color</a> built from <a href="#SkBitmap_eraseRGB_r">r</a>, <a href="#SkBitmap_eraseRGB_g">g</a>, and <a href="#SkBitmap_eraseRGB_b">b</a> with <a href="#Alpha">Color Alpha</a> set
to 255. All pixels contained by <a href="#SkBitmap_bounds">bounds</a> are affected.
If <a href="#SkBitmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>, all pixels are set to 255.
Deprecated. Use <a href="#SkBitmap_eraseARGB">eraseARGB</a> or <a href="#SkBitmap_eraseColor">eraseColor</a>.
### Parameters
<table> <tr> <td><a name="SkBitmap_eraseRGB_r"> <code><strong>r </strong></code> </a></td> <td>
amount of <a href="#RGB_Red">Color RGB Red</a>, from no red (0) to full red (255)</td>
amount of red</td>
</tr> <tr> <td><a name="SkBitmap_eraseRGB_g"> <code><strong>g </strong></code> </a></td> <td>
amount of <a href="#RGB_Green">Color RGB Green</a>, from no green (0) to full green (255)</td>
amount of green</td>
</tr> <tr> <td><a name="SkBitmap_eraseRGB_b"> <code><strong>b </strong></code> </a></td> <td>
amount of <a href="#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue (255)</td>
amount of blue</td>
</tr>
</table>
### Example
<div><fiddle-embed name="3088f4d6cf8a01644ffd41bfddad5e03"></fiddle-embed></div>
### See Also
<a href="#SkBitmap_eraseColor">eraseColor</a> <a href="#SkBitmap_eraseARGB">eraseARGB</a> <a href="#SkBitmap_erase">erase</a>
@ -3041,7 +2865,8 @@ If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#Sk
match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. Returns
false if pixel conversion is not possible.
<a href="#SkBitmap_readPixels_srcX">srcX</a> and <a href="#SkBitmap_readPixels_srcY">srcY</a> may be negative to copy only top or left of source. Returns
false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>,
false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative.
Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>,
or ifabs(srcY) >= this-><a href="#SkBitmap_height">height</a>.
If <a href="#SkBitmap_readPixels_behavior">behavior</a> is <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts source
@ -3106,7 +2931,8 @@ If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#Sk
match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_2_dstInfo">dstInfo</a>.<a href="#SkBitmap_colorSpace">colorSpace</a> must match. Returns
false if pixel conversion is not possible.
<a href="#SkBitmap_readPixels_2_srcX">srcX</a> and <a href="#SkBitmap_readPixels_2_srcY">srcY</a> may be negative to copy only top or left of source. Returns
false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>,
false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative.
Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>,
or ifabs(srcY) >= this-><a href="#SkBitmap_height">height</a>.
### Parameters
@ -3163,7 +2989,8 @@ If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#Sk
match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_readPixels_3_dst">dst</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns
false if pixel conversion is not possible.
<a href="#SkBitmap_readPixels_3_srcX">srcX</a> and <a href="#SkBitmap_readPixels_3_srcY">srcY</a> may be negative to copy only top or left of source. Returns
false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>,
false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative.
Returns false ifabs(srcX) >= this-><a href="#SkBitmap_width">width</a>,
or ifabs(srcY) >= this-><a href="#SkBitmap_height">height</a>.
### Parameters
@ -3263,7 +3090,8 @@ If this-><a href="#SkBitmap_alphaType">alphaType</a> is <a href="undocumented#Sk
match. If this-><a href="#SkBitmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkBitmap_writePixels_src">src</a> <a href="undocumented#Color_Space">Color Space</a> must match. Returns
false if pixel conversion is not possible.
<a href="#SkBitmap_writePixels_dstX">dstX</a> and <a href="#SkBitmap_writePixels_dstY">dstY</a> may be negative to copy only top or left of source. Returns
false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative. Returns false ifabs(dstX) >= this-><a href="#SkBitmap_width">width</a>,
false if <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> is zero or negative.
Returns false ifabs(dstX) >= this-><a href="#SkBitmap_width">width</a>,
or ifabs(dstY) >= this-><a href="#SkBitmap_height">height</a>.
### Parameters
@ -3550,11 +3378,11 @@ true if <a href="#Alpha">Alpha</a> layer was constructed in <a href="#SkBitmap_e
bool peekPixels(SkPixmap* pixmap) const
</pre>
If the pixels are available from this bitmap return true, and fill out the
specified <a href="#SkBitmap_peekPixels_pixmap">pixmap</a> (if not null). If there are no pixels, return false and
ignore the <a href="#SkBitmap_peekPixels_pixmap">pixmap</a> parameter.
Note: if this returns true, the results (in the <a href="#SkBitmap_peekPixels_pixmap">pixmap</a>) are only valid until the bitmap
is changed in any way, in which case the results are invalid.
Copies <a href="#Bitmap">Bitmap</a> pixel address, row bytes, and <a href="#Info">Image Info</a> to <a href="#SkBitmap_peekPixels_pixmap">pixmap</a>, if address
is available, and returns true. If pixel address is not available, return
false and leave <a href="#SkBitmap_peekPixels_pixmap">pixmap</a> unchanged.
<a href="#SkBitmap_peekPixels_pixmap">pixmap</a> contents become invalid on any future change to <a href="#Bitmap">Bitmap</a>.
### Parameters
@ -3595,6 +3423,22 @@ true if <a href="#Bitmap">Bitmap</a> has direct access to pixels
---
<a name="SkBitmap_validate"></a>
## validate
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
void validate() const;
</pre>
Asserts if internal values are illegal or inconsistent. Only available if
<a href="undocumented#SK_DEBUG">SK DEBUG</a> is defined at compile time.
### See Also
<a href="#SkImageInfo_validate">SkImageInfo::validate()</a>
---
<a name="SkBitmap_toString"></a>
## toString

View File

@ -430,7 +430,7 @@ storage of <a href="undocumented#Raster_Surface">Raster Surface</a></td>
## <a name="SkCanvas_ColorBehavior"></a> Enum SkCanvas::ColorBehavior
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum class <a href="#SkCanvas_ColorBehavior">ColorBehavior</a> {
<a href="#SkCanvas_ColorBehavior_kLegacy">kLegacy</a>,
};</pre>
@ -875,10 +875,11 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY)
</pre>
Copies rectangle of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_dstPixels">dstPixels</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are
ignored. Source rectangle corners are (<a href="#SkCanvas_readPixels_srcX">srcX</a>, <a href="#SkCanvas_readPixels_srcY">srcY</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_dstPixels">dstPixels</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are
ignored. Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_readPixels_srcX">srcX</a>, <a href="#SkCanvas_readPixels_srcY">srcY</a>) and
(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Destination rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()).
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (bitmap.width(), bitmap.height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to <a href="#SkCanvas_readPixels_dstInfo">dstInfo</a>.colorType() and <a href="#SkCanvas_readPixels_dstInfo">dstInfo</a>.alphaType() if required.
@ -891,7 +892,7 @@ The destination pixel storage must be allocated by the caller.
<a href="undocumented#Pixel">Pixel</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a>
do not match. Only pixels within both source and destination rectangles
are copied. <a href="#SkCanvas_readPixels_dstPixels">dstPixels</a> contents outside the rectangle intersection are unchanged.
are copied. <a href="#SkCanvas_readPixels_dstPixels">dstPixels</a> contents outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged.
Pass negative values for <a href="#SkCanvas_readPixels_srcX">srcX</a> or <a href="#SkCanvas_readPixels_srcY">srcY</a> to offset pixels across or down destination.
@ -956,10 +957,11 @@ pixel = 8056a9ff
bool readPixels(const SkPixmap& pixmap, int srcX, int srcY)
</pre>
Copies rectangle of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are
ignored. Source rectangle corners are (<a href="#SkCanvas_readPixels_2_srcX">srcX</a>, <a href="#SkCanvas_readPixels_2_srcY">srcY</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are
ignored. Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_readPixels_2_srcX">srcX</a>, <a href="#SkCanvas_readPixels_2_srcY">srcY</a>) and
(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Destination rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()).
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (bitmap.width(), bitmap.height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>.colorType() and <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>.alphaType() if required.
@ -971,8 +973,8 @@ class like <a href="undocumented#SkDumpCanvas">SkDumpCanvas</a>.
Caller must allocate pixel storage in <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a> if needed.
<a href="undocumented#Pixel">Pixel</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a>
do not match. Only pixels within both source and destination rectangles
are copied. <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a> pixels contents outside the rectangle intersection are unchanged.
do not match. Only pixels within both source and destination <a href="#Rect">Rects</a>
are copied. <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a> pixels contents outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged.
Pass negative values for <a href="#SkCanvas_readPixels_2_srcX">srcX</a> or <a href="#SkCanvas_readPixels_2_srcY">srcY</a> to offset pixels across or down <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>.
@ -1025,10 +1027,11 @@ pixel = 802b5580
bool readPixels(const SkBitmap& bitmap, int srcX, int srcY)
</pre>
Copies rectangle of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are
ignored. Source rectangle corners are (<a href="#SkCanvas_readPixels_3_srcX">srcX</a>, <a href="#SkCanvas_readPixels_3_srcY">srcY</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from <a href="#Canvas">Canvas</a> into <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are
ignored. Source <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_readPixels_3_srcX">srcX</a>, <a href="#SkCanvas_readPixels_3_srcY">srcY</a>) and
(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Destination rectangle corners are (0, 0) and (<a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.width(), <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.height()).
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.width(), <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting to <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.colorType() and <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.alphaType() if required.
@ -1041,7 +1044,7 @@ Caller must allocate pixel storage in <a href="#SkCanvas_readPixels_3_bitmap">bi
<a href="SkBitmap_Reference#Bitmap">Bitmap</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a>
do not match. Only pixels within both source and destination rectangles
are copied. <a href="SkBitmap_Reference#Bitmap">Bitmap</a> pixels outside the rectangle intersection are unchanged.
are copied. <a href="SkBitmap_Reference#Bitmap">Bitmap</a> pixels outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged.
Pass negative values for <a href="#SkCanvas_readPixels_3_srcX">srcX</a> or <a href="#SkCanvas_readPixels_3_srcY">srcY</a> to offset pixels across or down <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a>.
@ -1098,12 +1101,13 @@ bool writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes,
int x, int y)
</pre>
Copies rectangle from <a href="#SkCanvas_writePixels_pixels">pixels</a> to <a href="#Canvas">Canvas</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are ignored.
Source rectangle corners are (0, 0) and (<a href="#SkCanvas_writePixels_info">info</a>.width(), <a href="#SkCanvas_writePixels_info">info</a>.height()).
Destination rectangle corners are (<a href="#SkCanvas_writePixels_x">x</a>, <a href="#SkCanvas_writePixels_y">y</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Copies <a href="SkRect_Reference#Rect">Rect</a> from <a href="#SkCanvas_writePixels_pixels">pixels</a> to <a href="#Canvas">Canvas</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are ignored.
Source <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkCanvas_writePixels_info">info</a>.width(), <a href="#SkCanvas_writePixels_info">info</a>.height()).
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_writePixels_x">x</a>, <a href="#SkCanvas_writePixels_y">y</a>) and
(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting tothis-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType()andthis-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType()if required.
converting to <a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() and <a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType() if required.
Pixels are writable when <a href="undocumented#Device">Device</a> is raster, or backed by a <a href="undocumented#GPU">GPU</a>.
Pixels are not writable when <a href="#SkCanvas">SkCanvas</a> is returned by <a href="#SkDocument_beginPage">SkDocument::beginPage</a>,
@ -1112,7 +1116,7 @@ class like <a href="undocumented#SkDumpCanvas">SkDumpCanvas</a>.
<a href="undocumented#Pixel">Pixel</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a>
do not match. Only <a href="#SkCanvas_writePixels_pixels">pixels</a> within both source and destination rectangles
are copied. <a href="#Canvas">Canvas</a> <a href="#SkCanvas_writePixels_pixels">pixels</a> outside the rectangle intersection are unchanged.
are copied. <a href="#Canvas">Canvas</a> <a href="#SkCanvas_writePixels_pixels">pixels</a> outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged.
Pass negative values for <a href="#SkCanvas_writePixels_x">x</a> or <a href="#SkCanvas_writePixels_y">y</a> to offset <a href="#SkCanvas_writePixels_pixels">pixels</a> to the left or
above <a href="#Canvas">Canvas</a> <a href="#SkCanvas_writePixels_pixels">pixels</a>.
@ -1160,13 +1164,14 @@ true if <a href="#SkCanvas_writePixels_pixels">pixels</a> were written to <a hre
bool writePixels(const SkBitmap& bitmap, int x, int y)
</pre>
Copies rectangle from pixels to <a href="#Canvas">Canvas</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are ignored.
Source rectangle corners are (0, 0) and (<a href="#SkCanvas_writePixels_2_bitmap">bitmap</a>.width(), <a href="#SkCanvas_writePixels_2_bitmap">bitmap</a>.height()).
Copies <a href="SkRect_Reference#Rect">Rect</a> from pixels to <a href="#Canvas">Canvas</a>. <a href="#Matrix">Matrix</a> and <a href="#Clip">Clip</a> are ignored.
Source <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkCanvas_writePixels_2_bitmap">bitmap</a>.width(), <a href="#SkCanvas_writePixels_2_bitmap">bitmap</a>.height()).
Destination rectangle corners are (<a href="#SkCanvas_writePixels_2_x">x</a>, <a href="#SkCanvas_writePixels_2_y">y</a>) and(this-><a href="#SkCanvas_imageInfo">imageInfo</a>.width(), this-><a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkCanvas_writePixels_2_x">x</a>, <a href="#SkCanvas_writePixels_2_y">y</a>) and
(<a href="#SkCanvas_imageInfo">imageInfo</a>.width(), <a href="#SkCanvas_imageInfo">imageInfo</a>.height()).
Copies each readable pixel intersecting both rectangles, without scaling,
converting tothis-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType()andthis-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType()if required.
converting to <a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() and <a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType() if required.
Pixels are writable when <a href="undocumented#Device">Device</a> is raster, or backed by a <a href="undocumented#GPU">GPU</a>.
Pixels are not writable when <a href="#SkCanvas">SkCanvas</a> is returned by <a href="#SkDocument_beginPage">SkDocument::beginPage</a>,
@ -1175,7 +1180,7 @@ class like <a href="undocumented#SkDumpCanvas">SkDumpCanvas</a>.
<a href="undocumented#Pixel">Pixel</a> values are converted only if <a href="#Color_Type">Image Color Type</a> and <a href="#Alpha_Type">Image Alpha Type</a>
do not match. Only pixels within both source and destination rectangles
are copied. <a href="#Canvas">Canvas</a> pixels outside the rectangle intersection are unchanged.
are copied. <a href="#Canvas">Canvas</a> pixels outside <a href="SkRect_Reference#Rect">Rect</a> intersection are unchanged.
Pass negative values for <a href="#SkCanvas_writePixels_2_x">x</a> or <a href="#SkCanvas_writePixels_2_y">y</a> to offset pixels to the left or
above <a href="#Canvas">Canvas</a> pixels.
@ -1554,7 +1559,7 @@ depth of saved stack
## <a name="SkCanvas__anonymous"></a> Enum SkCanvas::_anonymous
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum {
<a href="#SkCanvas_kIsOpaque_SaveLayerFlag">kIsOpaque SaveLayerFlag</a> = 1 << 0,
<a href="#SkCanvas_kPreserveLCDText_SaveLayerFlag">kPreserveLCDText SaveLayerFlag</a> = 1 << 1,
@ -1596,7 +1601,7 @@ scalePaint blends <a href="#Layer">Layer</a> back with transparency.</div></fidd
# <a name="SkCanvas_SaveLayerRec"></a> Struct SkCanvas::SaveLayerRec
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
struct <a href="#SkCanvas_SaveLayerRec_SaveLayerRec">SaveLayerRec</a> {
<a href="#SkCanvas_SaveLayerRec_SaveLayerRec">SaveLayerRec</a>*(...
@ -2732,7 +2737,7 @@ graphics state used to fill <a href="#Canvas">Canvas</a></td>
## <a name="SkCanvas_PointMode"></a> Enum SkCanvas::PointMode
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkCanvas_PointMode">PointMode</a> {
<a href="#SkCanvas_kPoints_PointMode">kPoints PointMode</a>,
<a href="#SkCanvas_kLines_PointMode">kLines PointMode</a>,
@ -3389,7 +3394,7 @@ and so on; or nullptr</td>
## <a name="SkCanvas_SrcRectConstraint"></a> Enum SkCanvas::SrcRectConstraint
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkCanvas_SrcRectConstraint">SrcRectConstraint</a> {
<a href="#SkCanvas_kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a>,
<a href="#SkCanvas_kFast_SrcRectConstraint">kFast SrcRectConstraint</a>,
@ -4007,15 +4012,8 @@ and below <a href="#SkCanvas_drawBitmapNine_center">center</a> to fill the remai
---
# <a name="SkCanvas_Lattice"></a> Struct SkCanvas::Lattice
<a href="#SkCanvas_Lattice">Lattice</a> divides <a href="SkBitmap_Reference#Bitmap">Bitmap</a> or <a href="undocumented#Image">Image</a> into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
struct <a href="#SkCanvas_Lattice">Lattice</a> {
enum <a href="#SkCanvas_Lattice_Flags">Flags</a> {...
@ -4027,9 +4025,17 @@ int <a href="#SkCanvas_Lattice_fYCount">fYCount</a>;
const <a href="SkIRect_Reference#SkIRect">SkIRect</a>* <a href="#SkCanvas_Lattice_fBounds">fBounds</a>;
};</pre>
<a href="#SkCanvas_Lattice">Lattice</a> divides <a href="SkBitmap_Reference#Bitmap">Bitmap</a> or <a href="undocumented#Image">Image</a> into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
## <a name="SkCanvas_Lattice_Flags"></a> Enum SkCanvas::Lattice::Flags
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkCanvas_Lattice_Flags">Flags</a> : uint8_t {
<a href="#SkCanvas_Lattice_kTransparent_Flags">kTransparent Flags</a> = 1 << 0,
};</pre>
@ -5306,8 +5312,8 @@ Restores <a href="#Canvas">Canvas</a> to saved state.
void restore()
</pre>
Restores <a href="#Canvas">Canvas</a> to saved state immediately. Subsequent calls and class
destructor have no effect.
Restores <a href="#Canvas">Canvas</a> to saved state immediately. Subsequent calls and
<a href="#SkAutoCanvasRestore_destructor">~SkAutoCanvasRestore</a> have no effect.
### Example

View File

@ -34,7 +34,7 @@ its <a href="#SkIRect_top">top</a>, it is considered empty.
| <a href="#SkIRect_MakeEmpty">MakeEmpty</a> | Returns bounds of (0, 0, 0, 0). |
| <a href="#SkIRect_MakeLTRB">MakeLTRB</a> | Constructs from int <a href="#SkIRect_left">left</a>, <a href="#SkIRect_top">top</a>, <a href="#SkIRect_right">right</a>, <a href="#SkIRect_bottom">bottom</a>. |
| <a href="#SkIRect_MakeLargest">MakeLargest</a> | Constructs from (<a href="undocumented#SK_MinS32">SK MinS32</a>, <a href="undocumented#SK_MinS32">SK MinS32</a>, <a href="undocumented#SK_MaxS32">SK MaxS32</a>, <a href="undocumented#SK_MaxS32">SK MaxS32</a>). |
| <a href="#SkIRect_MakeSize">MakeSize</a> | Constructs from <a href="#Size">ISize</a> returning (0, 0, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). |
| <a href="#SkIRect_MakeSize">MakeSize</a> | Constructs from <a href="undocumented#ISize">ISize</a> returning (0, 0, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). |
| <a href="#SkIRect_MakeWH">MakeWH</a> | Constructs from int input returning (0, 0, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). |
| <a href="#SkIRect_MakeXYWH">MakeXYWH</a> | Constructs from int input returning (<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). |
| <a href="#SkIRect_bottom">bottom</a> | Returns larger bounds in <a href="#SkIRect_y">y</a>, if sorted. |
@ -66,7 +66,7 @@ its <a href="#SkIRect_top">top</a>, it is considered empty.
| <a href="#SkIRect_setLargest">setLargest</a> | Sets to (<a href="undocumented#SK_MinS32">SK MinS32</a>, <a href="undocumented#SK_MinS32">SK MinS32</a>, <a href="undocumented#SK_MaxS32">SK MaxS32</a>, <a href="undocumented#SK_MaxS32">SK MaxS32</a>). |
| <a href="#SkIRect_setLargestInverted">setLargestInverted</a> | Sets to (<a href="undocumented#SK_MaxS32">SK MaxS32</a>, <a href="undocumented#SK_MaxS32">SK MaxS32</a>, <a href="undocumented#SK_MinS32">SK MinS32</a>, <a href="undocumented#SK_MinS32">SK MinS32</a>). |
| <a href="#SkIRect_setXYWH">setXYWH</a> | Sets to (<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). |
| <a href="#SkIRect_size">size</a> | Returns <a href="#Size">ISize</a> (<a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). |
| <a href="#SkIRect_size">size</a> | Returns <a href="undocumented#ISize">ISize</a> (<a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>). |
| <a href="#SkIRect_sort">sort</a> | Orders sides from smaller to larger. |
| <a href="#SkIRect_top">top</a> | Returns smaller bounds in <a href="#SkIRect_y">y</a>, if sorted. |
| <a href="#SkIRect_width">width</a> | Returns span in <a href="#SkIRect_x">x</a>. |
@ -301,7 +301,8 @@ static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y,
int32_t w, int32_t h)
</pre>
Returns constructed <a href="#IRect">IRect</a> <a href="#SkIRect_set">set</a> to(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + <a href="#SkIRect_MakeXYWH_w">w</a>, <a href="#SkIRect_y">y</a> + <a href="#SkIRect_MakeXYWH_h">h</a>).
Returns constructed <a href="#IRect">IRect</a> <a href="#SkIRect_set">set</a> to:
(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + <a href="#SkIRect_MakeXYWH_w">w</a>, <a href="#SkIRect_y">y</a> + <a href="#SkIRect_MakeXYWH_h">h</a>).
Does not validate input;
<a href="#SkIRect_MakeXYWH_w">w</a> or <a href="#SkIRect_MakeXYWH_h">h</a> may be negative.
@ -617,7 +618,7 @@ or if result fits in 32-bit signed integer; result may be negative.
### Return Value
<a href="#Size">ISize</a> (<a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>)
<a href="undocumented#ISize">ISize</a> (<a href="#SkIRect_width">width</a>, <a href="#SkIRect_height">height</a>)
### Example
@ -1019,7 +1020,8 @@ rect2: {3, 4, 1, 2}
void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
</pre>
Sets <a href="#IRect">IRect</a> to(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + <a href="#SkIRect_width">width</a>, <a href="#SkIRect_y">y</a> + <a href="#SkIRect_height">height</a>).
Sets <a href="#IRect">IRect</a> to:
(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + <a href="#SkIRect_width">width</a>, <a href="#SkIRect_y">y</a> + <a href="#SkIRect_height">height</a>).
Does not validate input;
<a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a> may be negative.
@ -1495,11 +1497,13 @@ rect (7, 11, 13, 17) test(12, 16, 14, 18) quickReject false; intersects true
bool contains(int32_t x, int32_t y) const
</pre>
Returns true if<a href="#SkIRect_fLeft">fLeft</a> <= <a href="#SkIRect_x">x</a> < <a href="#SkIRect_fRight">fRight</a> && <a href="#SkIRect_fTop">fTop</a> <= <a href="#SkIRect_y">y</a> < <a href="#SkIRect_fBottom">fBottom</a>.
Returns true if:
<a href="#SkIRect_fLeft">fLeft</a> <= <a href="#SkIRect_x">x</a> < <a href="#SkIRect_fRight">fRight</a> && <a href="#SkIRect_fTop">fTop</a> <= <a href="#SkIRect_y">y</a> < <a href="#SkIRect_fBottom">fBottom</a>.
Returns false if <a href="SkRect_Reference#Rect">Rect</a> is empty.
Considers input to describe constructed <a href="#IRect">IRect</a> (<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + 1, <a href="#SkIRect_y">y</a> + 1) and
Considers input to describe constructed <a href="#IRect">IRect</a>:
(<a href="#SkIRect_x">x</a>, <a href="#SkIRect_y">y</a>, <a href="#SkIRect_x">x</a> + 1, <a href="#SkIRect_y">y</a> + 1)and
returns true if constructed area is completely enclosed by <a href="#IRect">IRect</a> area.
### Parameters
@ -1758,7 +1762,7 @@ rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
# <a name="Intersection"></a> Intersection
IRects <a href="#SkIRect_intersect">intersect</a> when they enclose a common area. To <a href="#SkIRect_intersect">intersect</a>, each of the pair
must describe area; <a href="#SkIRect_fLeft">fLeft</a> is less than <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fTop">fTop</a> is less than <a href="#SkIRect_fBottom">fBottom</a>;
empty() returns false. The intersection of <a href="#IRect">IRect</a> a and <a href="#IRect">IRect</a> b can be described by:
empty() returns false. The intersection of <a href="#IRect">IRect</a> pair can be described by:
(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))The intersection is only meaningful if the resulting <a href="#IRect">IRect</a> is not empty and
describes an area: <a href="#SkIRect_fLeft">fLeft</a> is less than <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fTop">fTop</a> is less than <a href="#SkIRect_fBottom">fBottom</a>.

File diff suppressed because it is too large Load Diff

View File

@ -653,7 +653,7 @@ serialized data describing <a href="#Paint">Paint</a> content</td>
## <a name="SkPaint_Hinting"></a> Enum SkPaint::Hinting
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#Hinting">Hinting</a> {
<a href="#SkPaint_kNo_Hinting">kNo Hinting</a> = 0,
<a href="#SkPaint_kSlight_Hinting">kSlight Hinting</a> = 1,
@ -776,7 +776,7 @@ paint1 == paint2
## <a name="SkPaint_Flags"></a> Enum SkPaint::Flags
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#Flags">Flags</a> {
<a href="#SkPaint_kAntiAlias_Flag">kAntiAlias Flag</a> = 0x01,
<a href="#SkPaint_kDither_Flag">kDither Flag</a> = 0x04,
@ -845,7 +845,7 @@ multiple settings at once.
## <a name="SkPaint_ReserveFlags"></a> Enum SkPaint::ReserveFlags
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPaint_ReserveFlags">ReserveFlags</a> {
<a href="#SkPaint_kUnderlineText_ReserveFlag">kUnderlineText ReserveFlag</a> = 0x08,
<a href="#SkPaint_kStrikeThruText_ReserveFlag">kStrikeThruText ReserveFlag</a> = 0x10,
@ -1356,7 +1356,7 @@ the outline glyph if <a href="#SkPaint_kEmbeddedBitmapText_Flag">kEmbeddedBitmap
### Example
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
<div>The "" <a href="undocumented#TrueType">TrueType</a> font in the <a href="undocumented#Skia">Skia</a> resources/fonts directory
includes an embedded bitmap <a href="undocumented#Glyph">Glyph</a> at odd font sizes. This example works
on platforms that use <a href="undocumented#FreeType">FreeType</a> as their <a href="#Engine">Font Engine</a>.
@ -2066,7 +2066,7 @@ while stroking.
## <a name="SkPaint_Style"></a> Enum SkPaint::Style
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPaint_Style">Style</a> {
<a href="#SkPaint_kFill_Style">kFill Style</a>,
<a href="#SkPaint_kStroke_Style">kStroke Style</a>,
@ -2110,7 +2110,7 @@ and the set <a href="#Fill_Type">Path Fill Type</a> is ignored.</td>
## <a name="SkPaint__anonymous"></a> Enum SkPaint::_anonymous
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum {
<a href="#SkPaint_kStyleCount">kStyleCount</a> = <a href="#SkPaint_kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1,
};</pre>
@ -2375,7 +2375,7 @@ default miter limit == 8
## <a name="SkPaint_Cap"></a> Enum SkPaint::Cap
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPaint_Cap">Cap</a> {
<a href="#SkPaint_kButt_Cap">kButt Cap</a>,
<a href="#SkPaint_kRound_Cap">kRound Cap</a>,
@ -2520,7 +2520,7 @@ the following curve, the pair of curves meet at <a href="#Stroke_Join">Stroke Jo
## <a name="SkPaint_Join"></a> Enum SkPaint::Join
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPaint_Join">Join</a> {
<a href="#SkPaint_kMiter_Join">kMiter Join</a>,
<a href="#SkPaint_kRound_Join">kRound Join</a>,
@ -3663,7 +3663,7 @@ sets <a href="undocumented#Draw_Looper">Draw Looper</a> to <a href="#SkPaint_set
## <a name="SkPaint_Align"></a> Enum SkPaint::Align
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPaint_Align">Align</a> {
<a href="#SkPaint_kLeft_Align">kLeft Align</a>,
<a href="#SkPaint_kCenter_Align">kCenter Align</a>,
@ -3706,7 +3706,7 @@ and by its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kV
## <a name="SkPaint__anonymous_2"></a> Enum SkPaint::_anonymous_2
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum {
<a href="#SkPaint_kAlignCount">kAlignCount</a> = 3,
};</pre>
@ -3944,7 +3944,7 @@ additional shear in x-axis relative to y-axis</td>
## <a name="SkPaint_TextEncoding"></a> Enum SkPaint::TextEncoding
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPaint_TextEncoding">TextEncoding</a> {
<a href="#SkPaint_kUTF8_TextEncoding">kUTF8 TextEncoding</a>,
<a href="#SkPaint_kUTF16_TextEncoding">kUTF16 TextEncoding</a>,
@ -4075,16 +4075,8 @@ Y-axis values above the baseline are negative, and below the baseline are positi
<div><fiddle-embed name="b5b76e0a15da0c3530071186a9006498"></fiddle-embed></div>
# <a name="SkPaint_FontMetrics"></a> Struct SkPaint::FontMetrics
<a href="#SkPaint_FontMetrics">FontMetrics</a> is filled out by <a href="#SkPaint_getFontMetrics">getFontMetrics</a>. <a href="#SkPaint_FontMetrics">FontMetrics</a> contents reflect the values
computed by <a href="undocumented#Font_Manager">Font Manager</a> using <a href="undocumented#Typeface">Typeface</a>. Values are set to zero if they are
not available.
<a href="#SkPaint_FontMetrics_fUnderlineThickness">fUnderlineThickness</a> and <a href="#SkPaint_FontMetrics_fUnderlinePosition">fUnderlinePosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values
are valid, since their value may be zero.
<a href="#SkPaint_FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> and <a href="#SkPaint_FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values
are valid, since their value may be zero.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
struct <a href="#SkPaint_FontMetrics">FontMetrics</a> {
enum <a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> {
<a href="#SkPaint_FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> = 1 << 0,
@ -4116,13 +4108,18 @@ bool <a href="#SkPaint_FontMetrics_hasStrikeoutThickness">hasStrikeoutThickness(
bool <a href="#SkPaint_FontMetrics_hasStrikeoutPosition">hasStrikeoutPosition(SkScalar* position)</a> const;
};</pre>
<a href="#SkPaint_FontMetrics">FontMetrics</a> is filled out by <a href="#SkPaint_getFontMetrics">getFontMetrics</a>. <a href="#SkPaint_FontMetrics">FontMetrics</a> contents reflect the values
computed by <a href="undocumented#Font_Manager">Font Manager</a> using <a href="undocumented#Typeface">Typeface</a>. Values are set to zero if they are
not available.
<a href="#SkPaint_FontMetrics_fUnderlineThickness">fUnderlineThickness</a> and <a href="#SkPaint_FontMetrics_fUnderlinePosition">fUnderlinePosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values
are valid, since their value may be zero.
<a href="#SkPaint_FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> and <a href="#SkPaint_FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values
are valid, since their value may be zero.
## <a name="SkPaint_FontMetrics_FontMetricsFlags"></a> Enum SkPaint::FontMetrics::FontMetricsFlags
<a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> are set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> when underline and strikeout metrics are valid;
the underline or strikeout metric may be valid and zero.
Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> {
<a href="#SkPaint_FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> = 1 << 0,
<a href="#SkPaint_FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> = 1 << 1,
@ -4130,6 +4127,10 @@ enum <a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> {
<a href="#SkPaint_FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> = 1 << 3,
};</pre>
<a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> are set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> when underline and strikeout metrics are valid;
the underline or strikeout metric may be valid and zero.
Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
### Constants
<table>

View File

@ -216,7 +216,7 @@ Internally, <a href="#Path">Path</a> lazily computes metrics likes bounds and co
## <a name="SkPath_Verb"></a> Enum SkPath::Verb
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#Verb">Verb</a> {
<a href="#SkPath_kMove_Verb">kMove Verb</a>,
<a href="#SkPath_kLine_Verb">kLine Verb</a>,
@ -298,7 +298,7 @@ verbs: kMove_Verb kLine_Verb kQuad_Verb kClose_Verb kMove_Verb kCubic_Verb kConi
## <a name="SkPath_Direction"></a> Enum SkPath::Direction
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#Direction">Direction</a> {
<a href="#SkPath_kCW_Direction">kCW Direction</a>,
<a href="#SkPath_kCCW_Direction">kCCW Direction</a>,
@ -320,10 +320,10 @@ travel counterclockwise.
<table>
<tr>
<td><a name="SkPath_kCW_Direction"> <code><strong>SkPath::kCW_Direction </strong></code> </a></td><td>0</td><td><a href="#Contour">Contour</a> travels in a clockwise direction.</td>
<td><a name="SkPath_kCW_Direction"> <code><strong>SkPath::kCW_Direction </strong></code> </a></td><td>0</td><td><a href="#Contour">Contour</a> travels in a clockwise direction</td>
</tr>
<tr>
<td><a name="SkPath_kCCW_Direction"> <code><strong>SkPath::kCCW_Direction </strong></code> </a></td><td>1</td><td><a href="#Contour">Contour</a> travels in a counterclockwise direction.</td>
<td><a name="SkPath_kCCW_Direction"> <code><strong>SkPath::kCCW_Direction </strong></code> </a></td><td>1</td><td><a href="#Contour">Contour</a> travels in a counterclockwise direction</td>
</tr>
</table>
@ -617,7 +617,9 @@ Interpolate between <a href="#Path">Paths</a> with equal sized <a href="SkPath_R
Copy <a href="#Verb_Array">Verb Array</a> and <a href="#Weight">Weights</a> to <a href="#SkPath_interpolate_out">out</a>,
and set <a href="#SkPath_interpolate_out">out</a> <a href="#Point_Array">Point Array</a> to a weighted average of this <a href="#Point_Array">Point Array</a> and <a href="#SkPath_interpolate_ending">ending</a>
<a href="#Point_Array">Point Array</a>, using the formula:
(this->points * <a href="#SkPath_interpolate_weight">weight</a>) + ending->points * (1 - <a href="#SkPath_interpolate_weight">weight</a>)<a href="#SkPath_interpolate_weight">weight</a> is most useful when between zero (<a href="#SkPath_interpolate_ending">ending</a> <a href="#Point_Array">Point Array</a>) and
(this->points * <a href="#SkPath_interpolate_weight">weight</a>) + ending->points * (1 - <a href="#SkPath_interpolate_weight">weight</a>).
<a href="#SkPath_interpolate_weight">weight</a> is most useful when between zero (<a href="#SkPath_interpolate_ending">ending</a> <a href="#Point_Array">Point Array</a>) and
one (this <a href="#Point_Array">Point Array</a>); will work with values outside of this
range.
@ -668,7 +670,7 @@ true if <a href="#Path">Path</a> has one owner
## <a name="SkPath_FillType"></a> Enum SkPath::FillType
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPath_FillType">FillType</a> {
<a href="#SkPath_kWinding_FillType">kWinding FillType</a>,
<a href="#SkPath_kEvenOdd_FillType">kEvenOdd FillType</a>,
@ -842,7 +844,7 @@ unmodified by the original <a href="#SkPath_FillType">FillType</a>.
## <a name="SkPath_Convexity"></a> Enum SkPath::Convexity
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#Convexity">Convexity</a> : uint8_t {
<a href="#SkPath_kUnknown_Convexity">kUnknown Convexity</a>,
<a href="#SkPath_kConvex_Convexity">kConvex Convexity</a>,
@ -2805,7 +2807,7 @@ line (156,20),(200,20)
## <a name="SkPath_ArcSize"></a> Enum SkPath::ArcSize
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPath_ArcSize">ArcSize</a> {
<a href="#SkPath_kSmall_ArcSize">kSmall ArcSize</a>,
<a href="#SkPath_kLarge_ArcSize">kLarge ArcSize</a>,
@ -2818,10 +2820,10 @@ Four <a href="undocumented#Oval">Oval</a> parts with radii (rx, ry) start at las
<table>
<tr>
<td><a name="SkPath_kSmall_ArcSize"> <code><strong>SkPath::kSmall_ArcSize </strong></code> </a></td><td>0</td><td>Smaller of <a href="#Arc">Arc</a> pair.</td>
<td><a name="SkPath_kSmall_ArcSize"> <code><strong>SkPath::kSmall_ArcSize </strong></code> </a></td><td>0</td><td>smaller of <a href="#Arc">Arc</a> pair</td>
</tr>
<tr>
<td><a name="SkPath_kLarge_ArcSize"> <code><strong>SkPath::kLarge_ArcSize </strong></code> </a></td><td>1</td><td>Larger of <a href="#Arc">Arc</a> pair.</td>
<td><a name="SkPath_kLarge_ArcSize"> <code><strong>SkPath::kLarge_ArcSize </strong></code> </a></td><td>1</td><td>larger of <a href="#Arc">Arc</a> pair</td>
</tr>
</table>
@ -2840,18 +2842,20 @@ void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
Direction sweep, SkScalar x, SkScalar y)
</pre>
Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>. <a href="#Arc">Arc</a> is implemented by one or more <a href="#Conic">Conics</a> weighted to describe part of <a href="undocumented#Oval">Oval</a>
with radii (<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) rotated by <a href="#SkPath_arcTo_4_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>),
choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.
Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>. <a href="#Arc">Arc</a> is implemented by one or more <a href="#Conic">Conics</a> weighted to
describe part of <a href="undocumented#Oval">Oval</a> with radii (<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) rotated by <a href="#SkPath_arcTo_4_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a>
curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>), choosing one of four possible routes:
clockwise or counterclockwise, and smaller or larger.
<a href="#Arc">Arc</a> <a href="#SkPath_arcTo_4_sweep">sweep</a> is always less than 360 degrees. <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if either radii are zero,
or if last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> equals (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>). <a href="#SkPath_arcTo">arcTo</a> scales radii (<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) to fit last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> and
(<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if both are greater than zero but too small.
<a href="#Arc">Arc</a> <a href="#SkPath_arcTo_4_sweep">sweep</a> is always less than 360 degrees. <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if
either radii are zero, or if last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> equals (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>). <a href="#SkPath_arcTo">arcTo</a> scales radii
(<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) to fit last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> and (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if both are greater than zero but
too small.
<a href="#SkPath_arcTo">arcTo</a> appends up to four <a href="#Conic">Conic</a> curves.
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> "" value is
opposite the integer value of <a href="#SkPath_arcTo_4_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> "" uses 1 for clockwise, while <a href="#SkPath_kCW_Direction">kCW Direction</a>
cast to int is zero.
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> "" value
is opposite the integer value of <a href="#SkPath_arcTo_4_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> "" uses 1 for clockwise,
while <a href="#SkPath_kCW_Direction">kCW Direction</a> cast to int is zero.
### Parameters
@ -2936,7 +2940,9 @@ void rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>, relative to last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a>. <a href="#Arc">Arc</a> is implemented by one or
more <a href="#Conic">Conic</a>, weighted to describe part of <a href="undocumented#Oval">Oval</a> with radii (<a href="#SkPath_rArcTo_rx">rx</a>, <a href="#SkPath_rArcTo_ry">ry</a>) rotated by
<a href="#SkPath_rArcTo_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> (x0, y0) to end <a href="undocumented#Point">Point</a>(x0 + <a href="#SkPath_rArcTo_dx">dx</a>, y0 + <a href="#SkPath_rArcTo_dy">dy</a>),
<a href="#SkPath_rArcTo_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> (x0, y0) to end <a href="undocumented#Point">Point</a>:
(x0 + <a href="#SkPath_rArcTo_dx">dx</a>, y0 + <a href="#SkPath_rArcTo_dy">dy</a>),
choosing one of four possible routes: clockwise or
counterclockwise, and smaller or larger. If <a href="#Path">Path</a> is empty, the start <a href="#Arc">Arc</a> <a href="undocumented#Point">Point</a>
is (0, 0).
@ -3118,7 +3124,9 @@ control <a href="undocumented#Point">Point</a> <a href="#SkPath_ConvertConicToQu
Maximum <a href="#Quad">Quad</a> count is 2 to the <a href="#SkPath_ConvertConicToQuads_pow2">pow2</a>.
Every third point in array shares last <a href="undocumented#Point">Point</a> of previous <a href="#Quad">Quad</a> and first <a href="undocumented#Point">Point</a> of
next <a href="#Quad">Quad</a>. Maximum <a href="#SkPath_ConvertConicToQuads_pts">pts</a> storage size is given by:
(1 + 2 * (1 << <a href="#SkPath_ConvertConicToQuads_pow2">pow2</a>)) * sizeof(SkPoint)<a href="#SkPath_ConvertConicToQuads">ConvertConicToQuads</a> returns <a href="#Quad">Quad</a> count used the approximation, which may be smaller
(1 + 2 * (1 << <a href="#SkPath_ConvertConicToQuads_pow2">pow2</a>)) * sizeof(SkPoint).
Returns <a href="#Quad">Quad</a> count used the approximation, which may be smaller
than the number requested.
<a href="#Conic_Weight">Conic Weight</a> determines the amount of influence <a href="#Conic">Conic</a> control point has on the curve.
<a href="#SkPath_ConvertConicToQuads_w">w</a> less than one represents an elliptical section. <a href="#SkPath_ConvertConicToQuads_w">w</a> greater than one represents
@ -3446,9 +3454,10 @@ void addCircle(SkScalar x, SkScalar y, SkScalar radius,
</pre>
Add <a href="undocumented#Circle">Circle</a> centered at (<a href="#SkPath_addCircle_x">x</a>, <a href="#SkPath_addCircle_y">y</a>) of size <a href="#SkPath_addCircle_radius">radius</a> to <a href="#Path">Path</a>, appending <a href="#SkPath_kMove_Verb">kMove Verb</a>,
four <a href="#SkPath_kConic_Verb">kConic Verb</a>, and <a href="#SkPath_kClose_Verb">kClose Verb</a>. <a href="undocumented#Circle">Circle</a> begins at(<a href="#SkPath_addCircle_x">x</a> + <a href="#SkPath_addCircle_radius">radius</a>, <a href="#SkPath_addCircle_y">y</a>),
continuing clockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCW_Direction">kCW Direction</a>, and counterclockwise if <a href="#SkPath_addCircle_dir">dir</a> is
<a href="#SkPath_kCCW_Direction">kCCW Direction</a>.
four <a href="#SkPath_kConic_Verb">kConic Verb</a>, and <a href="#SkPath_kClose_Verb">kClose Verb</a>. <a href="undocumented#Circle">Circle</a> begins at:
(<a href="#SkPath_addCircle_x">x</a> + <a href="#SkPath_addCircle_radius">radius</a>, <a href="#SkPath_addCircle_y">y</a>),
continuing
clockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCW_Direction">kCW Direction</a>, and counterclockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCCW_Direction">kCCW Direction</a>.
Has no effect if <a href="#SkPath_addCircle_radius">radius</a> is zero or negative.
@ -3725,7 +3734,7 @@ true to add <a href="undocumented#Line">Line</a> connecting <a href="#Contour">C
## <a name="SkPath_AddPathMode"></a> Enum SkPath::AddPathMode
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPath_AddPathMode">AddPathMode</a> {
<a href="#SkPath_kAppend_AddPathMode">kAppend AddPathMode</a>,
<a href="#SkPath_kExtend_AddPathMode">kExtend AddPathMode</a>,
@ -4096,7 +4105,7 @@ set value of <a href="#Last_Point">Last Point</a></td>
## <a name="SkPath_SegmentMask"></a> Enum SkPath::SegmentMask
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
enum <a href="#SkPath_SegmentMask">SegmentMask</a> {
<a href="#SkPath_kLine_SegmentMask">kLine SegmentMask</a> = 1 << 0,
<a href="#SkPath_kQuad_SegmentMask">kQuad SegmentMask</a> = 1 << 1,
@ -4225,9 +4234,9 @@ true if <a href="undocumented#Point">Point</a> is in <a href="#Path">Path</a>
void dump(SkWStream* stream, bool forceClose, bool dumpAsHex) const
</pre>
Writes text representation of <a href="#Path">Path</a> to <a href="#SkPath_dump_stream">stream</a>. If <a href="#SkPath_dump_stream">stream</a> is nullptr, <a href="#SkPath_dump_2">dump</a> writes to
standard output. Set <a href="#SkPath_dump_forceClose">forceClose</a> to true to get
edges used to fill <a href="#Path">Path</a>. Set <a href="#SkPath_dump_dumpAsHex">dumpAsHex</a> true to generate exact binary representations
Writes text representation of <a href="#Path">Path</a> to <a href="#SkPath_dump_stream">stream</a>. If <a href="#SkPath_dump_stream">stream</a> is nullptr, writes to
standard output. Set <a href="#SkPath_dump_forceClose">forceClose</a> to true to get edges used to fill <a href="#Path">Path</a>.
Set <a href="#SkPath_dump_dumpAsHex">dumpAsHex</a> true to generate exact binary representations
of floating point numbers used in <a href="#Point_Array">Point Array</a> and <a href="#Weight">Conic Weights</a>.
### Parameters
@ -4554,7 +4563,7 @@ Iterates through <a href="#Verb_Array">Verb Array</a>, and associated <a href="#
Provides options to treat open <a href="#Contour">Contours</a> as closed, and to ignore
degenerate data.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
class <a href="#SkPath_Iter_Iter">Iter</a> {
public:
<a href="#SkPath_Iter_Iter">Iter()</a>;
@ -4899,7 +4908,7 @@ with close(), forceClose is true : isClosedContour returns true
Iterates through <a href="#Verb_Array">Verb Array</a>, and associated <a href="#Point_Array">Point Array</a> and <a href="#Conic_Weight">Conic Weight</a>.
<a href="#Verb_Array">Verb Array</a>, <a href="#Point_Array">Point Array</a>, and <a href="#Conic_Weight">Conic Weight</a> are returned unaltered.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
class <a href="#SkPath_RawIter_RawIter">RawIter</a> {
public:
<a href="#SkPath_RawIter_RawIter">RawIter()</a>;

View File

@ -49,13 +49,11 @@ to manage pixel memory; <a href="undocumented#Pixel_Ref">Pixel Ref</a> is safe a
| <a href="#SkPixmap_bounds">bounds</a> | Returns <a href="#SkPixmap_width">width</a> and <a href="#SkPixmap_height">height</a> as Rectangle. |
| <a href="#SkPixmap_colorSpace">colorSpace</a> | Returns <a href="#Info">Image Info</a> <a href="undocumented#Color_Space">Color Space</a>. |
| <a href="#SkPixmap_colorType">colorType</a> | Returns <a href="#Info">Image Info</a> <a href="undocumented#Color_Type">Color Type</a>. |
| <a href="#SkPixmap_computeByteSize">computeByteSize</a> | Returns size required for pixels. |
| <a href="#SkPixmap_computeIsOpaque">computeIsOpaque</a> | Returns true if all pixels are opaque. |
| <a href="#SkPixmap_erase">erase</a> | Writes <a href="undocumented#Color">Color</a> to pixels. |
| <a href="#SkPixmap_extractSubset">extractSubset</a> | Sets pointer to portion of original. |
| <a href="#SkPixmap_getColor">getColor</a> | Returns one pixel as <a href="#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>. |
| <a href="#SkPixmap_getSafeSize">getSafeSize</a> | Returns minimum size required for pixels in 32 bits. |
| <a href="#SkPixmap_getSafeSize64">getSafeSize64</a> | Returns minimum size required for pixels in 64 bits. |
| <a href="#SkPixmap_getSize64">getSize64</a> | Returns conservative size required for pixels. |
| <a href="#SkPixmap_height">height</a> | Returns pixel row count. |
| <a href="#SkPixmap_info">info</a> | Returns <a href="#Info">Image Info</a>. |
| <a href="#SkPixmap_isOpaque">isOpaque</a> | Returns true if <a href="#Info">Image Info</a> describes opaque pixels. |
@ -389,7 +387,8 @@ size_t rowBytes() const
</pre>
Returns row bytes, the interval from one pixel row to the next. Row bytes
is at least as large as<a href="#SkPixmap_width">width</a> * <a href="#SkPixmap_info">info</a>.bytesPerPixel().
is at least as large as:
<a href="#SkPixmap_width">width</a> * <a href="#SkPixmap_info">info</a>.bytesPerPixel().
Returns zero if <a href="#SkPixmap_colorType">colorType</a> is <a href="undocumented#SkColorType">kUnknown SkColorType</a>.
It is up to the <a href="SkBitmap_Reference#Bitmap">Bitmap</a> creator to ensure that row bytes is a useful value.
@ -460,6 +459,7 @@ int width() const
</pre>
Returns pixel count in each pixel row. Should be equal or less than:
<a href="#SkPixmap_rowBytes">rowBytes</a> / <a href="#SkPixmap_info">info</a>.bytesPerPixel().
### Return Value
@ -657,7 +657,7 @@ isOpaque: true
SkIRect bounds() const
</pre>
Returns <a href="SkIRect_Reference#IRect">IRect</a>{ 0, 0, <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a> }.
Returns <a href="SkIRect_Reference#IRect">IRect</a> { 0, 0, <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a> }.
### Return Value
@ -759,68 +759,6 @@ color: kRGBA_F16_SkColorType bytesPerPixel: 8 shiftPerPixel: 3
---
<a name="SkPixmap_getSize64"></a>
## getSize64
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
uint64_t getSize64() const
</pre>
Returns conservative memory required for pixel storage.
Includes unused memory on last row when <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkPixmap_width">width</a>.
### Return Value
conservative pixel storage size
### See Also
<a href="#SkPixmap_getSafeSize64">getSafeSize64</a> <a href="#SkPixmap_getSafeSize">getSafeSize</a> <a href="#SkPixmap_height">height</a> <a href="#SkPixmap_rowBytes">rowBytes</a> <a href="#SkPixmap_width">width</a> <a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a>
---
<a name="SkPixmap_getSafeSize64"></a>
## getSafeSize64
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
uint64_t getSafeSize64() const
</pre>
Returns minimum memory required for pixel storage.
Does not include unused memory on last row when <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkPixmap_width">width</a>.
### Return Value
exact pixel storage size
### See Also
<a href="#SkPixmap_getSize64">getSize64</a> <a href="#SkPixmap_getSafeSize">getSafeSize</a> <a href="#SkPixmap_height">height</a> <a href="#SkPixmap_rowBytes">rowBytes</a> <a href="#SkPixmap_width">width</a> <a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a>
---
<a name="SkPixmap_getSafeSize"></a>
## getSafeSize
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
size_t getSafeSize() const
</pre>
Returns minimum memory required for pixel storage.
Does not include unused memory on last row when <a href="#SkPixmap_rowBytesAsPixels">rowBytesAsPixels</a> exceeds <a href="#SkPixmap_width">width</a>.
Returns zero if value is does not fit in a signed 32-bit integer.
The largest value than can be returned is 2,147,483,647.
### Return Value
exact pixel storage size if size fits in signed 32 bits
### See Also
<a href="#SkPixmap_getSize64">getSize64</a> <a href="#SkPixmap_getSafeSize64">getSafeSize64</a> <a href="#SkPixmap_height">height</a> <a href="#SkPixmap_rowBytes">rowBytes</a> <a href="#SkPixmap_width">width</a> <a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a> <a href="undocumented#sk_64_isS32">sk 64 isS32</a>
---
<a name="SkPixmap_computeByteSize"></a>
## computeByteSize
@ -1679,7 +1617,8 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY, SkTransferFunctionBehavior behavior) const
</pre>
Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkPixmap_readPixels_srcX">srcX</a>, <a href="#SkPixmap_readPixels_srcY">srcY</a>), and does not exceed(this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>).
Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkPixmap_readPixels_srcX">srcX</a>, <a href="#SkPixmap_readPixels_srcY">srcY</a>), and does not
exceed (this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>).
<a href="#SkPixmap_readPixels_dstInfo">dstInfo</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Color_Type">Color Type</a>, <a href="undocumented#Alpha_Type">Alpha Type</a>, and
<a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_dstRowBytes">dstRowBytes</a> specifics the gap from one destination
@ -1693,7 +1632,9 @@ If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#Sk
match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns
false if pixel conversion is not possible.
<a href="#SkPixmap_readPixels_srcX">srcX</a> and <a href="#SkPixmap_readPixels_srcY">srcY</a> may be negative to copy only top or left of source. Returns
false if <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Returns false ifabs(srcX) >= this-><a href="#SkPixmap_width">width</a>,
false if <a href="#SkPixmap_width">width</a> or <a href="#SkPixmap_height">height</a> is zero or negative. Returns false if:
abs(srcX) >= this-><a href="#SkPixmap_width">width</a>,
or ifabs(srcY) >= this-><a href="#SkPixmap_height">height</a>.
If <a href="#SkPixmap_readPixels_behavior">behavior</a> is <a href="#SkTransferFunctionBehavior_kRespect">SkTransferFunctionBehavior::kRespect</a>: converts source
@ -1738,7 +1679,7 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes)
</pre>
Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_2_dstPixels">dstPixels</a>. Copy starts at (0, 0), and does not
exceed(this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>).
exceed (this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>).
<a href="#SkPixmap_readPixels_2_dstInfo">dstInfo</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Color_Type">Color Type</a>, <a href="undocumented#Alpha_Type">Alpha Type</a>, and
<a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_2_dstRowBytes">dstRowBytes</a> specifics the gap from one destination
@ -1786,7 +1727,7 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
</pre>
Copies a <a href="SkRect_Reference#Rect">Rect</a> of pixels to <a href="#SkPixmap_readPixels_3_dstPixels">dstPixels</a>. Copy starts at (<a href="#SkPixmap_readPixels_3_srcX">srcX</a>, <a href="#SkPixmap_readPixels_3_srcY">srcY</a>), and does not
exceed(this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>).
exceed (this-><a href="#SkPixmap_width">width</a>, this-><a href="#SkPixmap_height">height</a>).
<a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a> specifies <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Color_Type">Color Type</a>, <a href="undocumented#Alpha_Type">Alpha Type</a>, and
<a href="undocumented#Color_Space">Color Space</a> of destination. <a href="#SkPixmap_readPixels_3_dstRowBytes">dstRowBytes</a> specifics the gap from one destination
@ -1800,7 +1741,9 @@ If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#Sk
match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_3_dstInfo">dstInfo</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns
false if pixel conversion is not possible.
<a href="#SkPixmap_readPixels_3_srcX">srcX</a> and <a href="#SkPixmap_readPixels_3_srcY">srcY</a> may be negative to copy only top or left of source. Returns
false if this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. Returns false ifabs(srcX) >= this-><a href="#SkPixmap_width">width</a>,
false if this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. Returns false if:
abs(srcX) >= this-><a href="#SkPixmap_width">width</a>,
or ifabs(srcY) >= this-><a href="#SkPixmap_height">height</a>.
### Parameters
@ -1849,7 +1792,9 @@ If this-><a href="#SkPixmap_alphaType">alphaType</a> is <a href="undocumented#Sk
match. If this-><a href="#SkPixmap_colorSpace">colorSpace</a> is nullptr, <a href="#SkPixmap_readPixels_4_dst">dst</a>.<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_colorSpace">colorSpace</a> must match. Returns
false if pixel conversion is not possible.
<a href="#SkPixmap_readPixels_4_srcX">srcX</a> and <a href="#SkPixmap_readPixels_4_srcY">srcY</a> may be negative to copy only top or left of source. Returns
false this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. Returns false ifabs(srcX) >= this-><a href="#SkPixmap_width">width</a>,
false this-><a href="#SkPixmap_width">width</a> or this-><a href="#SkPixmap_height">height</a> is zero or negative. Returns false if:
abs(srcX) >= this-><a href="#SkPixmap_width">width</a>,
or ifabs(srcY) >= this-><a href="#SkPixmap_height">height</a>.
### Parameters

View File

@ -32,7 +32,7 @@ integer input cannot convert to <a href="undocumented#SkScalar">SkScalar</a> wit
| description | function |
| --- | --- |
| <a href="#SkRect_Intersects">Intersects</a> | Returns true if areas overlap. |
| <a href="#SkRect_Make">Make</a> | Constructs from <a href="#Size">ISize</a> returning (0, 0, <a href="#SkRect_width">width</a>, <a href="#SkRect_height">height</a>). |
| <a href="#SkRect_Make">Make</a> | Constructs from <a href="undocumented#ISize">ISize</a> returning (0, 0, <a href="#SkRect_width">width</a>, <a href="#SkRect_height">height</a>). |
| <a href="#SkRect_MakeEmpty">MakeEmpty</a> | Constructs from bounds of (0, 0, 0, 0). |
| <a href="#SkRect_MakeFromIRect">MakeFromIRect</a> | Deprecated. |
| <a href="#SkRect_MakeIWH">MakeIWH</a> | Constructs from int input returning (0, 0, <a href="#SkRect_width">width</a>, <a href="#SkRect_height">height</a>). |
@ -2016,9 +2016,12 @@ rect: 5, 1, 55, 86
# <a name="Intersection"></a> Intersection
<a href="#Rect">Rects</a> <a href="#SkRect_intersect">intersect</a> when they enclose a common area. To <a href="#SkRect_intersect">intersect</a>, each of the pair
must describe area; <a href="#SkRect_fLeft">fLeft</a> is less than <a href="#SkRect_fRight">fRight</a>, and <a href="#SkRect_fTop">fTop</a> is less than <a href="#SkRect_fBottom">fBottom</a>;
empty() returns false. The intersection of <a href="#Rect">Rect</a> a and <a href="#Rect">Rect</a> b can be described by:
empty() returns false. The intersection of <a href="#Rect">Rect</a> pair can be described by:
(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))The intersection is only meaningful if the resulting <a href="#Rect">Rect</a> is not empty and
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom)).
The intersection is only meaningful if the resulting <a href="#Rect">Rect</a> is not empty and
describes an area: <a href="#SkRect_fLeft">fLeft</a> is less than <a href="#SkRect_fRight">fRight</a>, and <a href="#SkRect_fTop">fTop</a> is less than <a href="#SkRect_fBottom">fBottom</a>.
<a name="SkRect_intersect"></a>
@ -2443,6 +2446,7 @@ void growToInclude(SkPoint pt)
</pre>
Grows <a href="#Rect">Rect</a> to include (<a href="#SkRect_growToInclude_pt">pt</a>.fX, <a href="#SkRect_growToInclude_pt">pt</a>.fY), modifying it so that:
<a href="#SkRect_fLeft">fLeft</a> <= <a href="#SkRect_growToInclude_pt">pt</a>.fX <= <a href="#SkRect_fRight">fRight</a> && <a href="#SkRect_fTop">fTop</a> <= <a href="#SkRect_growToInclude_pt">pt</a>.fY <= <a href="#SkRect_fBottom">fBottom</a>.
If <a href="#Rect">Rect</a> is initialized with <a href="#SkRect_setLargestInverted">setLargestInverted</a>, then <a href="#Rect">Rect</a> will contain bounds of
@ -2518,6 +2522,7 @@ void growToInclude(const SkPoint pts[], size_t stride, int count)
For each of <a href="#SkRect_growToInclude_3_count">count</a> <a href="undocumented#Point">Point</a> in <a href="#SkRect_growToInclude_3_pts">pts</a>, grows <a href="#Rect">Rect</a> to include (pt.fX, pt.fY), modifying
it so that:
<a href="#SkRect_fLeft">fLeft</a> <= pt.fX <= <a href="#SkRect_fRight">fRight</a> && <a href="#SkRect_fTop">fTop</a> <= pt.fY <= <a href="#SkRect_fBottom">fBottom</a>.
<a href="undocumented#Point">Point</a> may be followed with other data in each array element. <a href="#SkRect_growToInclude_3_stride">stride</a> is number
of bytes in element; the interval to skip to advance from one <a href="undocumented#Point">Point</a> to
the next.

View File

@ -25,6 +25,8 @@ SkCanvas* beginPage(SkScalar width, SkScalar height,
# <a name="Size"></a> Size
# <a name="SkSize"></a> Struct SkSize
# <a name="Arc"></a> Arc
# <a name="Line"></a> Line
@ -85,6 +87,10 @@ bool equalsWithinTolerance(const SkPoint& p) const
## <a name="ArcTo"></a> ArcTo
# <a name="ISize"></a> ISize
# <a name="SkISize"></a> Struct SkISize
# <a name="Alias"></a> Alias
# <a name="Anti-alias"></a> Anti-alias
@ -521,6 +527,15 @@ size_t computeByteSize(size_t rowBytes) const
---
<a name="SkImageInfo_validate"></a>
## validate
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
void validate() const
</pre>
---
# <a name="SkImage"></a> Class SkImage
<a name="SkImage_makeShader"></a>
@ -874,6 +889,10 @@ void setImmutable()
---
# <a name="Point3"></a> Point3
# <a name="SkPoint3"></a> Struct SkPoint3
# <a name="Premultiply"></a> Premultiply
# <a name="Raster_Engine"></a> Raster Engine
@ -952,7 +971,7 @@ static sk_sp&lt;SkShader&gt; MakeBitmapShader(const SkBitmap& src, TileMode tmx,
# <a name="Stream"></a> Stream
# <a name="SkFlattenable"></a> Class SkFlattenable
# <a name="SkStream"></a> Class SkStream
# <a name="String"></a> String

View File

@ -8,22 +8,22 @@ Install<a href="usingBookmaker#Go">Go</a>if needed.
Get the fiddle command line interface tool.
By default this will appear in your home directory.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
$ go get go.skia.org/infra/fiddle/go/fiddlecli</pre>
Build <a href="#Bookmaker">Bookmaker</a>.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
$ ninja -<a href="undocumented#C">C</a> out/dir bookmaker</pre>
Generate an starter <a href="#Bookmaker">Bookmaker</a> file from an existing include.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -i include/core/<a href="undocumented#SkXXX.h">SkXXX.h</a> -t docs</pre>
If a method or function has an unnamed parameter, bookmaker generates an error:
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
<a href="undocumented#C">C</a>:/puregit/include/core/<a href="SkPixmap_Reference#SkPixmap">SkPixmap</a>.h(208): error: # missing param name
bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const
^
@ -34,14 +34,14 @@ them. After naming all parameters, check in the include before continuing.
A successful run generates
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
docs/<a href="undocumented#SkXXX_Reference">SkXXX Reference</a>.bmh</pre>
.
Next, use your favorite editor to fill out
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
docs/<a href="undocumented#SkXXX_Reference">SkXXX Reference</a>.bmh</pre>
.
@ -82,13 +82,13 @@ correct parents.
If you run <a href="#Bookmaker">Bookmaker</a> inside <a href="usingBookmaker#Visual_Studio">Visual Studio</a>, you can click on errors and it
will take you to the source line in question.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -e fiddle.json -b docs</pre>
Once complete, run fiddlecli to generate the example hashes.
Errors are contained by the output but aren't reported yet.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
$ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json</pre>
Generate <a href="usingBookmaker#bmh_SkXXX">bmh SkXXX</a>.md from <a href="usingBookmaker#SkXXX">SkXXX</a>.bmh and fiddleout.json.
@ -96,19 +96,19 @@ Error checking includes: undefined references, fiddle compiler errors,
missing or mismatched printf output.
Again, you can click on any errors inside <a href="usingBookmaker#Visual_Studio">Visual Studio</a>.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json</pre>
The original include may have changed since you started creating the markdown.
Check to see if it is up to date.
This reports if a method no longer exists or its parameters have changed.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -x -b docs/<a href="usingBookmaker#SkXXX">SkXXX</a>.bmh -i include/core/<a href="usingBookmaker#SkXXX">SkXXX</a>.h</pre>
Generate an updated include header. Run:
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -p -b docs -i include/core/<a href="usingBookmaker#SkXXX">SkXXX</a>.h</pre>
to write the updated <a href="undocumented#SkXXX.h">SkXXX.h</a> to the current directory.

View File

@ -630,6 +630,9 @@ const Definition* Definition::hasParam(const string& ref) const {
}
bool Definition::methodHasReturn(const string& name, TextParser* methodParser) const {
if (methodParser->skipExact("static")) {
methodParser->skipWhiteSpace();
}
const char* lastStart = methodParser->fChar;
const char* nameInParser = methodParser->strnstr(name.c_str(), methodParser->fEnd);
methodParser->skipTo(nameInParser);
@ -1160,6 +1163,8 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
case MarkType::kFile:
case MarkType::kHeight:
case MarkType::kImage:
case MarkType::kLiteral:
case MarkType::kOutdent:
case MarkType::kPlatform:
case MarkType::kSeeAlso:
case MarkType::kSubstitute:
@ -2001,6 +2006,8 @@ vector<string> BmhParser::typeName(MarkType markType, bool* checkEnd) {
case MarkType::kFile:
case MarkType::kHeight:
case MarkType::kImage:
case MarkType::kLiteral:
case MarkType::kOutdent:
case MarkType::kPlatform:
case MarkType::kReturn:
case MarkType::kSeeAlso:
@ -2335,6 +2342,7 @@ int main(int argc, char** const argv) {
}
if (!done && !FLAGS_spellcheck.isEmpty() && FLAGS_examples.isEmpty()) {
bmhParser.spellCheck(FLAGS_bmh[0], FLAGS_spellcheck);
bmhParser.fWroteOut = true;
done = true;
}
int examples = 0;

View File

@ -40,6 +40,7 @@ using std::vector;
enum class KeyWord {
kNone,
kSK_API,
kSK_BEGIN_REQUIRE_DENSE,
kBool,
kChar,
kClass,
@ -107,10 +108,12 @@ enum class MarkType {
kLegend,
kLink,
kList,
kLiteral, // don't lookup hyperlinks, do substitution, etc
kMarkChar,
kMember,
kMethod,
kNoExample,
kOutdent,
kParam,
kPlatform,
kPrivate,
@ -1063,6 +1066,7 @@ public:
fMaxLF = 2;
fPendingLF = 0;
fPendingSpace = 0;
fOutdentNext = false;
nl();
}
@ -1078,46 +1082,14 @@ public:
fMaxLF = 1;
}
bool writeBlockTrim(int size, const char* data) {
while (size && ' ' >= data[0]) {
++data;
--size;
}
while (size && ' ' >= data[size - 1]) {
--size;
}
if (size <= 0) {
fLastChar = '\0';
return false;
}
SkASSERT(size < 16000);
if (size > 3 && !strncmp("#end", data, 4)) {
fMaxLF = 1;
}
if (this->leadingPunctuation(data, (size_t) size)) {
fPendingSpace = 0;
}
writePending();
if (fDebugOut) {
string check(data, size);
SkDebugf("%s", check.c_str());
}
fprintf(fOut, "%.*s", size, data);
int added = 0;
fLastChar = data[size - 1];
while (size > 0 && '\n' != data[--size]) {
++added;
}
fColumn = size ? added : fColumn + added;
fSpaces = 0;
fLinefeeds = 0;
fMaxLF = added > 2 && !strncmp("#if", &data[size + (size > 0)], 3) ? 1 : 2;
return true;
}
void writeBlock(int size, const char* data) {
SkAssertResult(writeBlockTrim(size, data));
}
void writeBlockIndent(int size, const char* data);
bool writeBlockTrim(int size, const char* data);
void writeCommentHeader() {
this->lf(2);
this->writeString("/**");
@ -1129,6 +1101,8 @@ public:
this->lfcr();
}
void writePending();
// write a pending space, so that two consecutive calls
// don't double write, and trailing spaces on lines aren't written
void writeSpace(int count = 1) {
@ -1139,62 +1113,12 @@ public:
fPendingSpace = count;
}
void writeString(const char* str) {
const size_t len = strlen(str);
SkASSERT(len > 0);
SkASSERT(' ' < str[0]);
fLastChar = str[len - 1];
SkASSERT(' ' < fLastChar);
SkASSERT(!strchr(str, '\n'));
if (this->leadingPunctuation(str, strlen(str))) {
fPendingSpace = 0;
}
writePending();
if (fDebugOut) {
SkDebugf("%s", str);
}
fprintf(fOut, "%s", str);
fColumn += len;
fSpaces = 0;
fLinefeeds = 0;
fMaxLF = 2;
}
void writeString(const char* str);
void writeString(const string& str) {
this->writeString(str.c_str());
}
void writePending() {
fPendingLF = SkTMin(fPendingLF, fMaxLF);
bool wroteLF = false;
while (fLinefeeds < fPendingLF) {
if (fDebugOut) {
SkDebugf("\n");
}
fprintf(fOut, "\n");
++fLinefeeds;
wroteLF = true;
}
fPendingLF = 0;
if (wroteLF) {
SkASSERT(0 == fColumn);
SkASSERT(fIndent >= fSpaces);
if (fDebugOut) {
SkDebugf("%*s", fIndent - fSpaces, "");
}
fprintf(fOut, "%*s", fIndent - fSpaces, "");
fColumn = fIndent;
fSpaces = fIndent;
}
for (int index = 0; index < fPendingSpace; ++index) {
if (fDebugOut) {
SkDebugf(" ");
}
fprintf(fOut, " ");
++fColumn;
}
fPendingSpace = 0;
}
unordered_map<string, sk_sp<SkData>> fRawData;
unordered_map<string, vector<char>> fLFOnly;
@ -1209,6 +1133,7 @@ public:
int fPendingSpace; // one or two spaces should preceed the next string or block
char fLastChar; // last written
bool fDebugOut; // set true to write to std out
bool fOutdentNext; // set at end of embedded struct to prevent premature outdent
private:
typedef TextParser INHERITED;
};
@ -1226,6 +1151,7 @@ public:
kNo, // neither resolved nor output
kYes, // resolved, output
kOut, // not resolved, but output
kLiteral, // output untouched (FIXME: is this really different from kOut?)
};
enum class Exemplary {
@ -1267,7 +1193,7 @@ public:
, { "Alias", nullptr, MarkType::kAlias, R_N, E_N, 0 }
, { "Bug", nullptr, MarkType::kBug, R_N, E_N, 0 }
, { "Class", &fClassMap, MarkType::kClass, R_Y, E_O, M_CSST | M(Root) }
, { "Code", nullptr, MarkType::kCode, R_O, E_N, M_CSST | M_E }
, { "Code", nullptr, MarkType::kCode, R_O, E_N, M_CSST | M_E | M(Method) }
, { "", nullptr, MarkType::kColumn, R_Y, E_N, M(Row) }
, { "", nullptr, MarkType::kComment, R_N, E_N, 0 }
, { "Const", &fConstMap, MarkType::kConst, R_Y, E_N, M_E | M_ST }
@ -1291,10 +1217,12 @@ public:
, { "Legend", nullptr, MarkType::kLegend, R_Y, E_N, M(Table) }
, { "", nullptr, MarkType::kLink, R_N, E_N, M(Anchor) }
, { "List", nullptr, MarkType::kList, R_Y, E_N, M(Method) | M_CSST | M_E | M_D }
, { "Literal", nullptr, MarkType::kLiteral, R_N, E_N, M(Code) }
, { "", nullptr, MarkType::kMarkChar, R_N, E_N, 0 }
, { "Member", nullptr, MarkType::kMember, R_Y, E_N, M(Class) | M(Struct) }
, { "Method", &fMethodMap, MarkType::kMethod, R_Y, E_Y, M_CSST }
, { "NoExample", nullptr, MarkType::kNoExample, R_Y, E_N, 0 }
, { "Outdent", nullptr, MarkType::kOutdent, R_N, E_N, M(Code) }
, { "Param", nullptr, MarkType::kParam, R_Y, E_N, M(Method) }
, { "Platform", nullptr, MarkType::kPlatform, R_N, E_N, M(Example) }
, { "Private", nullptr, MarkType::kPrivate, R_N, E_N, 0 }
@ -1474,10 +1402,12 @@ public:
, { nullptr, MarkType::kLegend }
, { nullptr, MarkType::kLink }
, { nullptr, MarkType::kList }
, { nullptr, MarkType::kLiteral }
, { nullptr, MarkType::kMarkChar }
, { nullptr, MarkType::kMember }
, { nullptr, MarkType::kMethod }
, { nullptr, MarkType::kNoExample }
, { nullptr, MarkType::kOutdent }
, { nullptr, MarkType::kParam }
, { nullptr, MarkType::kPlatform }
, { nullptr, MarkType::kPrivate }
@ -1685,6 +1615,20 @@ public:
this->writeEndTag(tagType, tagID.c_str(), spaces);
}
void writeIncompleteTag(const char* tagType, const string& tagID, int spaces = 1) {
this->writeString(string("#") + tagType + " " + tagID);
this->writeSpace(spaces);
this->writeString("incomplete");
this->writeSpace();
this->writeString("##");
this->lf(1);
}
void writeIncompleteTag(const char* tagType) {
this->writeString(string("#") + tagType + " incomplete ##");
this->lf(1);
}
void writeTableHeader(const char* col1, size_t pad, const char* col2) {
this->lf(1);
this->writeString("#Table");
@ -1858,11 +1802,13 @@ public:
fBmhParser = nullptr;
fEnumDef = nullptr;
fMethodDef = nullptr;
fStructDef = nullptr;
fBmhStructDef = nullptr;
fAttrDeprecated = nullptr;
fAnonymousEnumCount = 1;
fInStruct = false;
fWroteMethod = false;
fIndentNext = false;
fPendingMethod = false;
}
string resolveMethod(const char* start, const char* end, bool first);
@ -1880,7 +1826,7 @@ private:
const Definition* fBmhMethod;
const Definition* fEnumDef;
const Definition* fMethodDef;
const Definition* fStructDef;
const Definition* fBmhStructDef;
const Definition* fAttrDeprecated;
const char* fContinuation; // used to construct paren-qualified method name
int fAnonymousEnumCount;
@ -1891,6 +1837,8 @@ private:
int fStructCommentTab;
bool fInStruct;
bool fWroteMethod;
bool fIndentNext;
bool fPendingMethod;
typedef IncludeParser INHERITED;
};
@ -1988,7 +1936,15 @@ private:
fInList = false;
}
BmhParser::Resolvable resolvable(MarkType markType) {
BmhParser::Resolvable resolvable(const Definition* definition) const {
MarkType markType = definition->fMarkType;
if (MarkType::kCode == markType) {
for (auto child : definition->fChildren) {
if (MarkType::kLiteral == child->fMarkType) {
return BmhParser::Resolvable::kLiteral;
}
}
}
if ((MarkType::kExample == markType
|| MarkType::kFunction == markType) && fHasFiddle) {
return BmhParser::Resolvable::kNo;

View File

@ -10,6 +10,7 @@
const IncludeKey kKeyWords[] = {
{ "", KeyWord::kNone, KeyProperty::kNone },
{ "SK_API", KeyWord::kSK_API, KeyProperty::kModifier },
{ "SK_BEGIN_REQUIRE_DENSE", KeyWord::kSK_BEGIN_REQUIRE_DENSE, KeyProperty::kModifier },
{ "bool", KeyWord::kBool, KeyProperty::kNumber },
{ "char", KeyWord::kChar, KeyProperty::kNumber },
{ "class", KeyWord::kClass, KeyProperty::kObject },
@ -105,7 +106,7 @@ void IncludeParser::checkForMissingParams(const vector<string>& methodParams,
}
}
if (!found) {
this->writeEndTag("Param", methodParam, 2);
this->writeIncompleteTag("Param", methodParam, 2);
}
}
for (auto& foundParam : foundParams) {
@ -508,11 +509,16 @@ void IncludeParser::dumpClassTokens(IClassDefinition& classDef) {
}
this->lf(2);
this->writeTag("Example");
this->lf(1);
this->writeString("// incomplete");
this->lf(1);
this->writeEndTag();
this->lf(2);
this->writeEndTag("ToDo", "incomplete");
this->writeTag("SeeAlso");
this->writeSpace();
this->writeString("incomplete");
this->lf(2);
this->writeEndTag();
this->writeEndTag("Method");
this->lf(2);
}
}
@ -673,7 +679,7 @@ void IncludeParser::dumpComment(const Definition& token) {
this->nl();
}
this->lf(2);
this->writeEndTag("Return");
this->writeIncompleteTag("Return");
}
}
}
@ -1389,11 +1395,36 @@ bool IncludeParser::parseMethod(Definition* child, Definition* markupDef) {
auto tokenIter = child->fParent->fTokens.begin();
std::advance(tokenIter, child->fParentIndex);
tokenIter = std::prev(tokenIter);
string nameStr(tokenIter->fStart, tokenIter->fContentEnd - tokenIter->fStart);
const char* nameEnd = tokenIter->fContentEnd;
bool add2 = false;
if ('[' == tokenIter->fStart[0]) {
auto closeParen = std::next(tokenIter);
SkASSERT(Definition::Type::kBracket == closeParen->fType &&
'(' == closeParen->fContentStart[0]);
nameEnd = closeParen->fContentEnd + 1;
closeParen = std::next(closeParen);
add2 = true;
if (Definition::Type::kKeyWord == closeParen->fType &&
KeyWord::kConst == closeParen->fKeyWord) {
add2 = false;
}
tokenIter = std::prev(tokenIter);
}
string nameStr(tokenIter->fStart, nameEnd - tokenIter->fStart);
if (add2) {
nameStr += "_2";
}
while (tokenIter != child->fParent->fTokens.begin()) {
auto testIter = std::prev(tokenIter);
switch (testIter->fType) {
case Definition::Type::kWord:
if (testIter == child->fParent->fTokens.begin() &&
(KeyWord::kIfdef == child->fParent->fKeyWord ||
KeyWord::kIfndef == child->fParent->fKeyWord ||
KeyWord::kIf == child->fParent->fKeyWord)) {
std::next(tokenIter);
break;
}
goto keepGoing;
case Definition::Type::kKeyWord: {
KeyProperty keyProperty = kKeyWords[(int) testIter->fKeyWord].fProperty;
@ -1608,7 +1639,9 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) {
// pick up templated function pieces when method is found
break;
case Bracket::kDebugCode:
// todo: handle this
if (!this->parseObjects(child, markupDef)) {
return false;
}
break;
case Bracket::kSquare: {
// check to see if parent is operator, the only case we handle so far

View File

@ -11,8 +11,44 @@ void IncludeWriter::descriptionOut(const Definition* def) {
const char* commentStart = def->fContentStart;
int commentLen = (int) (def->fContentEnd - commentStart);
bool breakOut = false;
SkDEBUGCODE(bool wroteCode = false);
for (auto prop : def->fChildren) {
switch (prop->fMarkType) {
case MarkType::kCode: {
bool literal = false;
bool literalOutdent = false;
commentLen = (int) (prop->fStart - commentStart);
if (commentLen > 0) {
SkASSERT(commentLen < 1000);
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
this->lf(2);
}
}
size_t childSize = prop->fChildren.size();
if (childSize) {
SkASSERT(1 == childSize || 2 == childSize); // incomplete
SkASSERT(MarkType::kLiteral == prop->fChildren[0]->fMarkType);
SkASSERT(1 == childSize || MarkType::kOutdent == prop->fChildren[1]->fMarkType);
commentStart = prop->fChildren[childSize - 1]->fContentStart;
literal = true;
literalOutdent = 2 == childSize &&
MarkType::kOutdent == prop->fChildren[1]->fMarkType;
}
commentLen = (int) (prop->fContentEnd - commentStart);
SkASSERT(commentLen > 0);
if (literal) {
if (!literalOutdent) {
fIndent += 4;
}
this->writeBlockIndent(commentLen, commentStart);
this->lf(2);
if (!literalOutdent) {
fIndent -= 4;
}
commentStart = prop->fTerminator;
SkDEBUGCODE(wroteCode = true);
}
} break;
case MarkType::kDefinedBy:
commentStart = prop->fTerminator;
break;
@ -48,20 +84,35 @@ void IncludeWriter::descriptionOut(const Definition* def) {
commentStart = prop->fTerminator;
commentLen = (int) (def->fContentEnd - commentStart);
break;
case MarkType::kFormula:
case MarkType::kFormula: {
commentLen = prop->fStart - commentStart;
if (commentLen > 0) {
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
this->lfcr();
if (commentLen > 1 && '\n' == prop->fStart[-1] &&
'\n' == prop->fStart[-2]) {
this->lf(1);
} else {
this->writeSpace();
}
}
}
this->writeBlock(prop->length(), prop->fContentStart);
int saveIndent = fIndent;
if (fIndent < fColumn + 1) {
fIndent = fColumn + 1;
}
this->writeBlockIndent(prop->length(), prop->fContentStart);
fIndent = saveIndent;
commentStart = prop->fTerminator;
commentLen = (int) (def->fContentEnd - commentStart);
if ('\n' == commentStart[0] && '\n' == commentStart[1]) {
if (commentLen > 1 && '\n' == commentStart[0] && '\n' == commentStart[1]) {
this->lf(2);
} else {
SkASSERT('\n' == prop->fTerminator[0]);
if ('.' != prop->fTerminator[1] && !fLinefeeds) {
this->writeSpace();
}
}
break;
} break;
case MarkType::kToDo:
commentLen = (int) (prop->fStart - commentStart);
if (commentLen > 0) {
@ -105,8 +156,10 @@ void IncludeWriter::descriptionOut(const Definition* def) {
break;
}
}
SkASSERT(commentLen > 0 && commentLen < 1500);
this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
SkASSERT(wroteCode || (commentLen > 0 && commentLen < 1500));
if (commentLen > 0) {
this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
}
}
void IncludeWriter::enumHeaderOut(const RootDefinition* root,
@ -116,6 +169,10 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
child.fContentStart;
this->writeBlockTrim((int) (bodyEnd - fStart), fStart); // may write nothing
this->lf(2);
if (fIndentNext) {
fIndent += 4;
fIndentNext = false;
}
fDeferComment = nullptr;
fStart = child.fContentStart;
const auto& nameDef = child.fTokens.front();
@ -172,6 +229,9 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
const char* commentEnd = test->fStart;
if (!wroteHeader &&
!this->contentFree((int) (commentEnd - commentStart), commentStart)) {
if (fIndentNext) {
fIndent += 4;
}
this->writeCommentHeader();
this->writeString("\\enum");
if (fullName.length() > 0) {
@ -193,9 +253,15 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
}
this->rewriteBlock((int) (commentEnd - commentStart), commentStart, Phrase::kNo);
if (MarkType::kAnchor == test->fMarkType) {
bool newLine = commentEnd - commentStart > 1 &&
'\n' == commentEnd[-1] && '\n' == commentEnd[-2];
commentStart = test->fContentStart;
commentEnd = test->fChildren[0]->fStart;
this->writeSpace();
if (newLine) {
this->lf(2);
} else {
this->writeSpace();
}
this->rewriteBlock((int) (commentEnd - commentStart), commentStart, Phrase::kNo);
lastAnchor = true; // this->writeSpace();
}
@ -518,12 +584,17 @@ void IncludeWriter::enumSizeItems(const Definition& child) {
// walk children and output complete method doxygen description
void IncludeWriter::methodOut(const Definition* method, const Definition& child) {
if (fPendingMethod) {
fIndent -= 4;
fPendingMethod = false;
}
fBmhMethod = method;
fMethodDef = &child;
fContinuation = nullptr;
fDeferComment = nullptr;
if (0 == fIndent) {
fIndent = 4;
if (0 == fIndent || fIndentNext) {
fIndent += 4;
fIndentNext = false;
}
this->writeCommentHeader();
fIndent += 4;
@ -602,13 +673,17 @@ Definition* IncludeWriter::structMemberOut(const Definition* memberStart, const
const char* blockEnd = fWroteMethod && fDeferComment ? fDeferComment->fStart - 1 :
memberStart->fStart;
this->writeBlockTrim((int) (blockEnd - blockStart), blockStart);
if (fIndentNext) {
fIndent += 4;
fIndentNext = false;
}
fWroteMethod = false;
const char* commentStart = nullptr;
ptrdiff_t commentLen = 0;
string name(child.fContentStart, (int) (child.fContentEnd - child.fContentStart));
bool isShort;
Definition* commentBlock = nullptr;
for (auto memberDef : fStructDef->fChildren) {
for (auto memberDef : fBmhStructDef->fChildren) {
if (memberDef->fName.length() - name.length() == memberDef->fName.find(name)) {
commentStart = memberDef->fContentStart;
commentLen = memberDef->fContentEnd - commentStart;
@ -668,8 +743,8 @@ Definition* IncludeWriter::structMemberOut(const Definition* memberStart, const
this->writeString("//!<");
this->writeSpace();
this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
this->lfcr();
}
this->lf(2);
return valueEnd;
}
@ -784,7 +859,7 @@ void IncludeWriter::structSizeMembers(const Definition& child) {
fStructValueTab -= 1 /* ; */ ;
}
// iterate through bmh children and see which comments fit on include lines
for (auto& member : fStructDef->fChildren) {
for (auto& member : fBmhStructDef->fChildren) {
if (MarkType::kMember != member->fMarkType) {
continue;
}
@ -800,6 +875,21 @@ void IncludeWriter::structSizeMembers(const Definition& child) {
}
}
static bool find_start(const Definition* startDef, const char* start) {
for (const auto& child : startDef->fTokens) {
if (child.fContentStart == start) {
return MarkType::kMethod == child.fMarkType;
}
if (child.fContentStart >= start) {
break;
}
if (find_start(&child, start)) {
return true;
}
}
return false;
}
bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefinition* root) {
ParentPair pair = { def, prevPair };
// write bulk of original include up to class, method, enum, etc., excepting preceding comment
@ -816,11 +906,30 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
bool inStruct = false;
bool inConstructor = false;
bool inInline = false;
bool eatOperator = false;
const Definition* requireDense = nullptr;
const Definition* startDef = nullptr;
for (auto& child : def->fTokens) {
if (KeyWord::kOperator == child.fKeyWord && method &&
Definition::MethodType::kOperator == method->fMethodType) {
eatOperator = true;
continue;
}
if (eatOperator) {
if (Bracket::kSquare == child.fBracket || Bracket::kParen == child.fBracket) {
continue;
}
eatOperator = false;
fContinuation = nullptr;
if (KeyWord::kConst == child.fKeyWord) {
continue;
}
}
if (memberEnd) {
if (memberEnd != &child) {
continue;
}
startDef = &child;
fStart = child.fContentStart + 1;
memberEnd = nullptr;
}
@ -958,6 +1067,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
continue;
}
const char* bodyEnd = fDeferComment ? fDeferComment->fContentStart - 1 :
fAttrDeprecated ? fAttrDeprecated->fContentStart - 1 :
child.fContentStart;
// FIXME: roll end-trimming into writeBlockTrim call
while (fStart < bodyEnd && ' ' >= bodyEnd[-1]) {
@ -967,11 +1077,15 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
if (blockSize) {
this->writeBlock(blockSize, fStart);
}
startDef = &child;
fStart = child.fContentStart;
methodName = root->fName + "::" + child.fName;
inConstructor = root->fName == child.fName;
fContinuation = child.fContentEnd;
method = root->find(methodName, RootDefinition::AllowParens::kNo);
// if (!method) {
// method = root->find(methodName + "()", RootDefinition::AllowParens::kNo);
// }
if (!method) {
continue;
}
@ -981,13 +1095,26 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
}
this->methodOut(method, child);
if (fAttrDeprecated) {
startDef = fAttrDeprecated;
fStart = fAttrDeprecated->fContentStart;
fAttrDeprecated = nullptr;
}
continue;
}
if (Definition::Type::kKeyWord == child.fType) {
const Definition* structDef = nullptr;
if (fIndentNext) {
SkDebugf("");
// too soon
#if 0 // makes struct Lattice indent when it oughtn't
if (KeyWord::kEnum == child.fKeyWord) {
fIndent += 4;
}
if (KeyWord::kPublic != child.fKeyWord) {
fIndentNext = false;
}
#endif
}
const Definition* cIncludeStructDef = nullptr;
switch (child.fKeyWord) {
case KeyWord::kStruct:
case KeyWord::kClass:
@ -1002,20 +1129,51 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
}
}
if (fInStruct) {
// try child; root+child; root->parent+child; etc.
int trial = 0;
const RootDefinition* search = root;
const Definition* parent = search->fParent;
do {
string name;
if (0 == trial) {
name = child.fName;
} else if (1 == trial) {
name = root->fName + "::" + child.fName;
} else {
SkASSERT(parent);
name = parent->fName + "::" + child.fName;
search = parent->asRoot();
parent = search->fParent;
}
fBmhStructDef = search->find(name, RootDefinition::AllowParens::kNo);
} while (!fBmhStructDef && ++trial);
root = const_cast<RootDefinition*>(fBmhStructDef->asRoot());
SkASSERT(root);
fIndent += 4;
fStructDef = root->find(child.fName, RootDefinition::AllowParens::kNo);
if (nullptr == structDef) {
fStructDef = root->find(root->fName + "::" + child.fName,
RootDefinition::AllowParens::kNo);
}
this->structSizeMembers(child);
fIndent -= 4;
SkASSERT(!fIndentNext);
fIndentNext = true;
}
if (child.fChildren.size() > 0) {
const char* bodyEnd = fDeferComment ? fDeferComment->fContentStart - 1 :
child.fContentStart;
this->writeBlockTrim((int) (bodyEnd - fStart), fStart);
fStart = child.fContentStart;
if (fPendingMethod) {
fIndent -= 4;
fPendingMethod = false;
}
startDef = requireDense ? requireDense : &child;
fStart = requireDense ? requireDense->fContentStart : child.fContentStart;
requireDense = nullptr;
if (!fInStruct && child.fName != root->fName) {
root = &fBmhParser->fClassMap[child.fName];
fRootTopic = root->fParent;
SkASSERT(!root->fVisited);
root->clearVisited();
fIndent = 0;
fBmhStructDef = root;
}
if (child.fName == root->fName) {
if (Definition* parent = root->fParent) {
if (MarkType::kTopic == parent->fMarkType ||
@ -1030,36 +1188,43 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
SkASSERT(0); // incomplete
}
} else {
structDef = root->find(child.fName, RootDefinition::AllowParens::kNo);
if (nullptr == structDef) {
structDef = root->find(root->fName + "::" + child.fName,
SkASSERT(fInStruct);
#if 0
fBmhStructDef = root->find(child.fName, RootDefinition::AllowParens::kNo);
if (nullptr == fBmhStructDef) {
fBmhStructDef = root->find(root->fName + "::" + child.fName,
RootDefinition::AllowParens::kNo);
}
if (!structDef) {
if (!fBmhStructDef) {
this->lf(2);
fIndent = 0;
this->writeBlock((int) (fStart - bodyEnd), bodyEnd);
this->lfcr();
continue;
}
#endif
Definition* codeBlock = nullptr;
SkDEBUGCODE(Definition* nextBlock = nullptr);
for (auto test : structDef->fChildren) {
Definition* nextBlock = nullptr;
for (auto test : fBmhStructDef->fChildren) {
if (MarkType::kCode == test->fMarkType) {
SkASSERT(!codeBlock); // FIXME: check enum for correct order earlier
codeBlock = test;
continue;
}
if (codeBlock) {
SkDEBUGCODE(nextBlock = test);
nextBlock = test;
break;
}
}
// FIXME: trigger error earlier if inner #Struct or #Class is missing #Code
SkASSERT(nextBlock); // FIXME: check enum for correct order earlier
const char* commentStart = structDef->fContentStart;
const char* commentEnd = codeBlock->fStart;
this->structOut(root, *structDef, commentStart, commentEnd);
const char* commentStart = codeBlock->fTerminator;
const char* commentEnd = nextBlock->fStart;
if (fIndentNext) {
// fIndent += 4;
}
fIndentNext = true;
this->structOut(root, *fBmhStructDef, commentStart, commentEnd);
}
fDeferComment = nullptr;
} else {
@ -1096,17 +1261,21 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
case KeyWord::kSK_API:
case KeyWord::kTypedef:
break;
case KeyWord::kSK_BEGIN_REQUIRE_DENSE:
requireDense = &child;
break;
default:
SkASSERT(0);
}
if (structDef) {
if (cIncludeStructDef) {
TextParser structName(&child);
SkAssertResult(structName.skipToEndBracket('{'));
startDef = &child;
fStart = structName.fChar + 1;
this->writeBlock((int) (fStart - child.fStart), child.fStart);
this->lf(2);
fIndent += 4;
if (!this->populate(&child, &pair, const_cast<Definition*>(structDef)->asRoot())) {
if (!this->populate(&child, &pair, const_cast<Definition*>(cIncludeStructDef)->asRoot())) {
return false;
}
// output any remaining definitions at current indent level
@ -1126,8 +1295,28 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
if (!this->populate(child.fChildren[0], &pair, root)) {
return false;
}
} else if (!this->populate(&child, &pair, root)) {
return false;
} else {
if (!this->populate(&child, &pair, root)) {
return false;
}
if (KeyWord::kClass == child.fKeyWord || KeyWord::kStruct == child.fKeyWord) {
fStructMemberTab = 0;
if (fInStruct) {
fInStruct = false;
do {
SkASSERT(root);
root = const_cast<RootDefinition*>(root->fParent->asRoot());
} while (MarkType::kTopic == root->fMarkType ||
MarkType::kSubtopic == root->fMarkType);
SkASSERT(MarkType::kStruct == root->fMarkType ||
MarkType::kClass == root->fMarkType);
fPendingMethod = false;
if (startDef) {
fPendingMethod = find_start(startDef, fStart);
}
fOutdentNext = !fPendingMethod;
}
}
}
}
continue;
@ -1140,17 +1329,25 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
this->enumMembersOut(root, child);
this->writeString("};");
this->lf(2);
startDef = child.fParent;
fStart = child.fParent->fContentEnd;
SkASSERT(';' == fStart[0]);
++fStart;
fDeferComment = nullptr;
fInEnum = false;
if (fIndentNext) {
// fIndent -= 4;
fIndentNext = false;
}
continue;
}
if (fAttrDeprecated) {
continue;
}
fDeferComment = nullptr;
if (KeyWord::kClass == def->fKeyWord || KeyWord::kStruct == def->fKeyWord) {
fIndentNext = true;
}
if (!this->populate(&child, &pair, root)) {
return false;
}
@ -1162,13 +1359,17 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
auto iter = def->fTokens.begin();
std::advance(iter, child.fParentIndex - 1);
memberStart = &*iter;
if (!fStructDef) {
if (!fStructMemberTab) {
SkASSERT(KeyWord::kStruct == def->fParent->fKeyWord);
fStructDef = def->fParent;
this->structSizeMembers(*fStructDef);
fIndent += 4;
this->structSizeMembers(*def->fParent);
fIndent -= 4;
// SkASSERT(!fIndentNext);
fIndentNext = true;
}
}
memberEnd = this->structMemberOut(memberStart, child);
startDef = &child;
fStart = child.fContentEnd + 1;
fDeferComment = nullptr;
}
@ -1322,8 +1523,8 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first,
rootDefIter = fBmhParser->fTopicMap.find(prefixedName);
if (fBmhParser->fTopicMap.end() != rootDefIter) {
rootDef = rootDefIter->second;
} else if (fStructDef) {
string localPrefix = fStructDef->fFiddle + '_' + undername;
} else if (fBmhStructDef) {
string localPrefix = fBmhStructDef->fFiddle + '_' + undername;
rootDefIter = fBmhParser->fTopicMap.find(localPrefix);
if (fBmhParser->fTopicMap.end() != rootDefIter) {
rootDef = rootDefIter->second;
@ -1648,7 +1849,7 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
break;
case Word::kCap:
case Word::kFirst:
if (!isupper(last)) {
if (!isupper(last) && '~' != last) {
word = Word::kMixed;
}
break;
@ -1697,6 +1898,14 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
hasIndirection |= embeddedIndirection;
hasSymbol |= embeddedSymbol;
break;
case '~':
SkASSERT(Word::kStart == word);
word = PunctuationState::kStart == punctuation ? Word::kFirst : Word::kCap;
start = run;
hasUpper = true;
hasIndirection |= embeddedIndirection;
hasSymbol |= embeddedSymbol;
break;
default:
SkASSERT(0);
}

View File

@ -324,7 +324,7 @@ bool MdOut::buildRefFromFile(const char* name, const char* outDir) {
bool MdOut::checkParamReturnBody(const Definition* def) const {
TextParser paramBody(def);
const char* descriptionStart = paramBody.fChar;
if (!islower(descriptionStart[0])) {
if (!islower(descriptionStart[0]) && !isdigit(descriptionStart[0])) {
paramBody.skipToNonAlphaNum();
string ref = string(descriptionStart, paramBody.fChar - descriptionStart);
if (!this->isDefined(paramBody, ref, true)) {
@ -349,7 +349,7 @@ void MdOut::childrenOut(const Definition* def, const char* start) {
} else if (MarkType::kEnumClass == def->fMarkType) {
fEnumClass = def;
}
BmhParser::Resolvable resolvable = this->resolvable(def->fMarkType);
BmhParser::Resolvable resolvable = this->resolvable(def);
for (auto& child : def->fChildren) {
end = child->fStart;
if (BmhParser::Resolvable::kNo != resolvable) {
@ -640,7 +640,7 @@ void MdOut::markTypeOut(Definition* def) {
case MarkType::kCode:
this->lfAlways(2);
fprintf(fOut, "<pre style=\"padding: 1em 1em 1em 1em;"
"width: 44em; background-color: #f0f0f0\">");
"width: 50em; background-color: #f0f0f0\">");
this->lf(1);
break;
case MarkType::kColumn:
@ -714,7 +714,7 @@ void MdOut::markTypeOut(Definition* def) {
fprintf(fOut, "<div><fiddle-embed name=\"%s\">", def->fHash.c_str());
} else {
fprintf(fOut, "<pre style=\"padding: 1em 1em 1em 1em;"
"width: 44em; background-color: #f0f0f0\">");
"width: 50em; background-color: #f0f0f0\">");
this->lf(1);
}
} break;
@ -742,6 +742,8 @@ void MdOut::markTypeOut(Definition* def) {
fprintf(fOut, "<table>");
this->lf(1);
break;
case MarkType::kLiteral:
break;
case MarkType::kMarkChar:
fBmhParser.fMC = def->fContentStart[0];
break;
@ -768,7 +770,7 @@ void MdOut::markTypeOut(Definition* def) {
}
// TODO: put in css spec that we can define somewhere else (if markup supports that)
// TODO: 50em below should match limt = 80 in formatFunction()
// TODO: 50em below should match limit = 80 in formatFunction()
this->writePending();
string preformattedStr = preformat(formattedStr);
fprintf(fOut, "<pre style=\"padding: 1em 1em 1em 1em;"
@ -781,6 +783,8 @@ void MdOut::markTypeOut(Definition* def) {
} break;
case MarkType::kNoExample:
break;
case MarkType::kOutdent:
break;
case MarkType::kParam: {
if (TableState::kNone == fTableState) {
this->mdHeaderOut(3);
@ -1004,6 +1008,24 @@ void MdOut::mdHeaderOutLF(int depth, int lf) {
}
void MdOut::resolveOut(const char* start, const char* end, BmhParser::Resolvable resolvable) {
if (BmhParser::Resolvable::kLiteral == resolvable && end > start) {
while ('\n' == *start) {
++start;
}
const char* spaceStart = start;
while (' ' == *start) {
++start;
}
if (start > spaceStart) {
fIndent = start - spaceStart;
}
this->writeBlockTrim(end - start, start);
if ('\n' == end[-1]) {
this->lf(1);
}
fIndent = 0;
return;
}
// FIXME: this needs the markdown character present when the def was defined,
// not the last markdown character the parser would have seen...
while (fBmhParser.fMC == end[-1]) {

View File

@ -7,6 +7,11 @@
#include "bookmaker.h"
static void debug_out(int len, const char* data) {
// convenient place to intercept arbitrary output
SkDebugf("%.*s", len, data);
}
bool ParserCommon::parseSetup(const char* path) {
this->reset();
sk_sp<SkData> data = SkData::MakeFromFileName(path);
@ -49,3 +54,131 @@ bool ParserCommon::parseSetup(const char* path) {
fLineCount = 1;
return true;
}
void ParserCommon::writeBlockIndent(int size, const char* data) {
while (size && ' ' >= data[size - 1]) {
--size;
}
bool newLine = false;
while (size) {
while (size && ' ' > data[0]) {
++data;
--size;
}
if (!size) {
return;
}
if (newLine) {
this->lf(1);
}
TextParser parser(fFileName, data, data + size, fLineCount);
const char* lineEnd = parser.strnchr('\n', data + size);
int len = lineEnd ? (int) (lineEnd - data) : size;
this->writePending();
this->indentToColumn(fIndent);
if (fDebugOut) {
debug_out(len, data);
}
fprintf(fOut, "%.*s", len, data);
size -= len;
data += len;
newLine = true;
}
}
bool ParserCommon::writeBlockTrim(int size, const char* data) {
if (fOutdentNext) {
fIndent -= 4;
fOutdentNext = false;
}
while (size && ' ' >= data[0]) {
++data;
--size;
}
while (size && ' ' >= data[size - 1]) {
--size;
}
if (size <= 0) {
fLastChar = '\0';
return false;
}
SkASSERT(size < 16000);
if (size > 3 && !strncmp("#end", data, 4)) {
fMaxLF = 1;
}
if (this->leadingPunctuation(data, (size_t) size)) {
fPendingSpace = 0;
}
this->writePending();
if (fDebugOut) {
debug_out(size, data);
}
fprintf(fOut, "%.*s", size, data);
int added = 0;
fLastChar = data[size - 1];
while (size > 0 && '\n' != data[--size]) {
++added;
}
fColumn = size ? added : fColumn + added;
fSpaces = 0;
fLinefeeds = 0;
fMaxLF = added > 2 && !strncmp("#if", &data[size + (size > 0)], 3) ? 1 : 2;
if (fOutdentNext) {
fIndent -= 4;
fOutdentNext = false;
}
return true;
}
void ParserCommon::writePending() {
fPendingLF = SkTMin(fPendingLF, fMaxLF);
bool wroteLF = false;
while (fLinefeeds < fPendingLF) {
if (fDebugOut) {
SkDebugf("\n");
}
fprintf(fOut, "\n");
++fLinefeeds;
wroteLF = true;
}
fPendingLF = 0;
if (wroteLF) {
SkASSERT(0 == fColumn);
SkASSERT(fIndent >= fSpaces);
if (fDebugOut) {
SkDebugf("%*s", fIndent - fSpaces, "");
}
fprintf(fOut, "%*s", fIndent - fSpaces, "");
fColumn = fIndent;
fSpaces = fIndent;
}
for (int index = 0; index < fPendingSpace; ++index) {
if (fDebugOut) {
SkDebugf(" ");
}
fprintf(fOut, " ");
++fColumn;
}
fPendingSpace = 0;
}
void ParserCommon::writeString(const char* str) {
const size_t len = strlen(str);
SkASSERT(len > 0);
SkASSERT(' ' < str[0]);
fLastChar = str[len - 1];
SkASSERT(' ' < fLastChar);
SkASSERT(!strchr(str, '\n'));
if (this->leadingPunctuation(str, strlen(str))) {
fPendingSpace = 0;
}
this->writePending();
if (fDebugOut) {
debug_out((int) strlen(str), str);
}
fprintf(fOut, "%s", str);
fColumn += len;
fSpaces = 0;
fLinefeeds = 0;
fMaxLF = 2;
}

View File

@ -202,6 +202,8 @@ bool SpellCheck::check(Definition* def) {
break;
case MarkType::kList:
break;
case MarkType::kLiteral:
break;
case MarkType::kMarkChar:
break;
case MarkType::kMember:
@ -220,6 +222,8 @@ bool SpellCheck::check(Definition* def) {
} break;
case MarkType::kNoExample:
break;
case MarkType::kOutdent:
break;
case MarkType::kParam: {
if (TableState::kNone == fTableState) {
fTableState = TableState::kRow;
@ -490,6 +494,7 @@ void SpellCheck::report(SkCommandLineFlags::StringArray report) {
if (report.contains("all")) {
int column = 0;
char lastInitial = 'a';
int count = 0;
for (auto iter : elems) {
if (string::npos != iter.second.fFile.find("undocumented.bmh")) {
continue;
@ -521,8 +526,9 @@ void SpellCheck::report(SkCommandLineFlags::StringArray report) {
}
SkDebugf("%s ", check.c_str());
column += check.length();
++count;
}
SkDebugf("\n\n");
SkDebugf("\n\ncount = %d\n", count);
return;
}
int index = 0;