aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/SkCanvas_Reference.bmh90
-rw-r--r--docs/SkPaint_Reference.bmh120
-rw-r--r--docs/SkPath_Reference.bmh22
-rw-r--r--docs/SkPixmap_Reference.bmh1314
-rw-r--r--docs/usingBookmaker.bmh8
-rw-r--r--site/user/api/SkCanvas_Reference.md58
-rw-r--r--site/user/api/SkPaint_Reference.md92
-rw-r--r--site/user/api/SkPath_Reference.md13
-rw-r--r--site/user/api/SkPixmap_Reference.md120
-rw-r--r--tools/bookmaker/bookmaker.cpp4
-rw-r--r--tools/bookmaker/bookmaker.h3
-rw-r--r--tools/bookmaker/includeWriter.cpp237
12 files changed, 1113 insertions, 968 deletions
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index 0c86011c78..d3121ba899 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -982,11 +982,10 @@ ignored. Source rectangle corners are (srcX, srcY) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
-. Destination rectangle corners are (0, 0) and
-#Formula
-(dstInfo.width(), dstInfo.height())
-##
-. Copies each readable pixel intersecting both rectangles, without scaling,
+.
+
+Destination rectangle 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.
Pixels are readable when Device is raster, or backed by a GPU.
@@ -1078,11 +1077,10 @@ ignored. Source rectangle corners are (srcX, srcY) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
-. Destination rectangle are (0, 0) and
-#Formula
-(pixmap.width(), pixmap.height())
-##
-. Copies each readable pixel intersecting both rectangles, without scaling,
+.
+
+Destination rectangle 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.
Pixels are readable when Device is raster, or backed by a GPU.
@@ -1090,7 +1088,7 @@ Pixels are not readable when SkCanvas is returned by SkDocument::beginPage,
returned by SkPictureRecorder::beginRecording, or Canvas is the base of a utility
class like SkDumpCanvas.
-Allocates pixel storage in pixmap if needed.
+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
@@ -1145,7 +1143,9 @@ ignored. Source rectangle corners are (srcX, srcY) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
-. Destination rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()).
+.
+
+Destination rectangle 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.
@@ -1154,7 +1154,7 @@ Pixels are not readable when SkCanvas is returned by SkDocument::beginPage,
returned by SkPictureRecorder::beginRecording, or Canvas is the base of a utility
class like SkDumpCanvas.
-Allocates pixel storage in bitmap if needed.
+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
@@ -1210,8 +1210,10 @@ Destination rectangle corners are (x, y) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
-. Copies each readable pixel
-intersecting both rectangles, without scaling, converting to
+.
+
+Copies each readable pixel intersecting both rectangles, without scaling,
+converting to
#Formula
this->imageInfo.colorType()
##
@@ -1237,15 +1239,8 @@ Does not copy, and returns false if:
#List
# Source and destination rectangles do not intersect. ##
-# pixels could not be converted to
-#Formula
-this->imageInfo.colorType()
-##
-or
-#Formula
-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. ##
##
@@ -1278,17 +1273,16 @@ 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
-#Formula
-(bitmap.width(), bitmap.height())
-##
-.
+Source rectangle corners are (0, 0) and (bitmap.width(), bitmap.height()).
+
Destination rectangle corners are (x, y) and
#Formula
(this->imageInfo.width(), this->imageInfo.height())
##
-. Copies each readable pixel
-intersecting both rectangles, without scaling, converting to
+.
+
+Copies each readable pixel intersecting both rectangles, without scaling,
+converting to
#Formula
this->imageInfo.colorType()
##
@@ -1315,15 +1309,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
-#Formula
-this->imageInfo.colorType()
-##
-or
-#Formula
-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. ##
##
@@ -1682,7 +1669,7 @@ Call restoreToCount with returned value to restore this and subsequent saves.
Draw text on an opaque background so that LCD_Text blends correctly with the
prior Layer. LCD_Text drawn on a background with transparency may result in
-incorrect banding.
+incorrect blending.
#Param bounds hint to limit the size of Layer; may be nullptr ##
#Param paint graphics state for Layer; may be nullptr ##
@@ -4760,6 +4747,7 @@ void draw(SkCanvas* canvas) {
(fXCount + 1) * (fYCount + 1)
##
.
+
Array entries correspond to the rectangular grid entries, ascending
left to right and then top to bottom.
##
@@ -5760,11 +5748,11 @@ If cullRect is outside of Clip, canvas can skip drawing.
#Param atlas Image containing sprites ##
#Param xform RSXform mappings for sprites in atlas ##
#Param tex Rect locations of sprites in atlas ##
-#Param colors Color, one per sprite, blended with sprite using Blend_Mode; may be nullptr ##
+#Param colors one per sprite, blended with sprite using Blend_Mode; may be nullptr ##
#Param count number of sprites to draw ##
#Param mode Blend_Mode combining colors and sprites ##
-#Param cullRect Rect bounds of transformed sprites for efficient clipping; may be nullptr ##
-#Param paint Paint Color_Filter, Image_Filter, Blend_Mode, and so on; may be nullptr ##
+#Param cullRect bounds of transformed sprites for efficient clipping; may be nullptr ##
+#Param paint Color_Filter, Image_Filter, Blend_Mode, and so on; may be nullptr ##
#Example
#Image 3
@@ -5801,11 +5789,11 @@ If cullRect is outside of Clip, canvas can skip drawing.
#Param atlas Image containing sprites ##
#Param xform RSXform mappings for sprites in atlas ##
#Param tex Rect locations of sprites in atlas ##
-#Param colors Color, one per sprite, blended with sprite using Blend_Mode; may be nullptr ##
+#Param colors one per sprite, blended with sprite using Blend_Mode; may be nullptr ##
#Param count number of sprites to draw ##
#Param mode Blend_Mode combining colors and sprites ##
-#Param cullRect Rect bounds of transformed sprites for efficient clipping; may be nullptr ##
-#Param paint Paint Color_Filter, Image_Filter, Blend_Mode, and so on; may be nullptr ##
+#Param cullRect bounds of transformed sprites for efficient clipping; may be nullptr ##
+#Param paint Color_Filter, Image_Filter, Blend_Mode, and so on; may be nullptr ##
#Example
#Image 3
@@ -5842,8 +5830,8 @@ If cullRect is outside of Clip, canvas can skip drawing.
#Param xform RSXform mappings for sprites in atlas ##
#Param tex Rect locations of sprites in atlas ##
#Param count number of sprites to draw ##
-#Param cullRect Rect bounds of transformed sprites for efficient clipping; may be nullptr ##
-#Param paint Paint Color_Filter, Image_Filter, Blend_Mode, and so on; may be nullptr ##
+#Param cullRect bounds of transformed sprites for efficient clipping; may be nullptr ##
+#Param paint Color_Filter, Image_Filter, Blend_Mode, and so on; may be nullptr ##
#Example
#Image 3
@@ -5878,8 +5866,8 @@ If cullRect is outside of Clip, canvas can skip drawing.
#Param xform RSXform mappings for sprites in atlas ##
#Param tex Rect locations of sprites in atlas ##
#Param count number of sprites to draw ##
-#Param cullRect Rect bounds of transformed sprites for efficient clipping; may be nullptr ##
-#Param paint Paint Color_Filter, Image_Filter, Blend_Mode, and so on; may be nullptr ##
+#Param cullRect bounds of transformed sprites for efficient clipping; may be nullptr ##
+#Param paint Color_Filter, Image_Filter, Blend_Mode, and so on; may be nullptr ##
#Example
#Image 3
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index 6dc3109e84..91644d8aa5 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -673,15 +673,15 @@ as the Font_Engine.
##
#Const kNormal_Hinting 2
Modifies glyph outlines to improve constrast. This is the default.
- With FreeType, this supplies FT_LOAD_TARGET_NORMAL to FT_Load_Glyph,
+ With FreeType, this supplies FT_LOAD_TARGET_NORMAL to FT_Load_Glyph,
choosing the default hinting algorithm, which is optimized for standard
gray-level rendering.
##
#Const kFull_Hinting 3
- Modifies glyph outlines for maxiumum constrast. With FreeType, this selects
- FT_LOAD_TARGET_LCD or FT_LOAD_TARGET_LCD_V if kLCDRenderText_Flag is set.
- FT_LOAD_TARGET_LCD is a variant of FT_LOAD_TARGET_NORMAL optimized for
- horizontally decimated LCD displays; FT_LOAD_TARGET_LCD_V is a
+ Modifies glyph outlines for maxiumum constrast. With FreeType, this selects
+ FT_LOAD_TARGET_LCD or FT_LOAD_TARGET_LCD_V if kLCDRenderText_Flag is set.
+ FT_LOAD_TARGET_LCD is a variant of FT_LOAD_TARGET_NORMAL optimized for
+ horizontally decimated LCD displays; FT_LOAD_TARGET_LCD_V is a
variant of FT_LOAD_TARGET_NORMAL optimized for vertically decimated LCD displays.
##
@@ -1544,7 +1544,9 @@ Glyphs to position below the preceding glyph.
Skia can translate text character codes as a series of Glyphs, but does not implement
font substitution,
textual substitution, line layout, or contextual spacing like Kerning pairs. Use
-a text shaping engine like #A HarfBuzz # http://harfbuzz.org/ ## to translate text runs
+a text shaping engine like
+#A HarfBuzz # http://harfbuzz.org/ ##
+ to translate text runs
into glyph series.
Vertical_Text is clear if text is drawn left to right or set if drawn from top to bottom.
@@ -2380,6 +2382,7 @@ Here are some miter limits and the angles that triggers them.
kLast_Cap = kSquare_Cap,
kDefault_Cap = kButt_Cap,
};
+
static constexpr int kCapCount = kLast_Cap + 1;
##
@@ -2523,6 +2526,7 @@ the following curve, the pair of curves meet at Stroke_Join.
kLast_Join = kBevel_Join,
kDefault_Join = kMiter_Join,
};
+
static constexpr int kJoinCount = kLast_Join + 1;
##
@@ -2839,7 +2843,7 @@ void draw(SkCanvas* canvas) {
Optional colors used when filling a path, such as a gradient.
Sets Shader to shader, decreasing Reference_Count of the previous Shader.
- Does not alter shader Reference_Count.
+ Increments shader Reference_Count by one.
#Param shader how geometry is filled with color; if nullptr, Color is used instead ##
@@ -2930,9 +2934,10 @@ void draw(SkCanvas* canvas) {
#Method void setColorFilter(sk_sp<SkColorFilter> colorFilter)
- Sets Color_Filter to filter, decreasing Reference_Count of the previous Color_Filter.
- Pass nullptr to clear Color_Filter.
- Does not alter filter Reference_Count.
+Sets Color_Filter to filter, decreasing Reference_Count of the previous
+Color_Filter. Pass nullptr to clear Color_Filter.
+
+Increments filter Reference_Count by one.
#Param colorFilter Color_Filter to apply to subsequent draw ##
@@ -3119,10 +3124,10 @@ If Paint has no Path_Effect, the path geometry is unaltered when filled or strok
#Method void setPathEffect(sk_sp<SkPathEffect> pathEffect)
- Sets Path_Effect to pathEffect,
- decreasing Reference_Count of the previous Path_Effect.
- Pass nullptr to leave the path geometry unaltered.
- Does not alter pathEffect Reference_Count.
+Sets Path_Effect to pathEffect, decreasing Reference_Count of the previous
+Path_Effect. Pass nullptr to leave the path geometry unaltered.
+
+Increments pathEffect Reference_Count by one.
#Param pathEffect replace Path with a modification when drawn ##
@@ -3143,8 +3148,10 @@ If Paint has no Path_Effect, the path geometry is unaltered when filled or strok
Mask_Filter uses coverage of the shape drawn to create Mask_Alpha.
Mask_Filter operates at a lower level than Rasterizer; Mask_Filter takes a Mask,
and returns a Mask.
-Mask_Filter may change the geometry and transparency of the shape, such as creating a blur effect.
-Set Mask_Filter to nullptr to prevent Mask_Filter from modifying the draw.
+
+Mask_Filter may change the geometry and transparency of the shape, such as
+creating a blur effect. Set Mask_Filter to nullptr to prevent Mask_Filter from
+modifying the draw.
#Example
void draw(SkCanvas* canvas) {
@@ -3180,6 +3187,7 @@ Set Mask_Filter to nullptr to prevent Mask_Filter from modifying the draw.
#Method sk_sp<SkMaskFilter> refMaskFilter() const
Returns Mask_Filter if set, or nullptr.
+
Increases Mask_Filter Reference_Count by one.
#Return Mask_Filter if previously set, nullptr otherwise ##
@@ -3203,11 +3211,12 @@ Set Mask_Filter to nullptr to prevent Mask_Filter from modifying the draw.
#Method void setMaskFilter(sk_sp<SkMaskFilter> maskFilter)
- Sets Mask_Filter to maskFilter,
- decreasing Reference_Count of the previous Mask_Filter.
- Pass nullptr to clear Mask_Filter and leave Mask_Filter effect on Mask_Alpha unaltered.
- Does not affect Rasterizer.
- Does not alter maskFilter Reference_Count.
+Sets Mask_Filter to maskFilter, decreasing Reference_Count of the previous
+Mask_Filter. Pass nullptr to clear Mask_Filter and leave Mask_Filter effect on
+Mask_Alpha unaltered.
+
+Does not affect Rasterizer.
+Increments maskFilter Reference_Count by one.
#Param maskFilter modifies clipping mask generated from drawn geometry ##
@@ -3249,7 +3258,7 @@ implementation.
#Method SkTypeface* getTypeface() const
Returns Typeface if set, or nullptr.
- Does not alter Typeface Reference_Count.
+ Increments Typeface Reference_Count by one.
#Return Typeface if previously set, nullptr otherwise ##
@@ -3298,10 +3307,9 @@ implementation.
#Method void setTypeface(sk_sp<SkTypeface> typeface)
- Sets Typeface to typeface,
- decreasing Reference_Count of the previous Typeface.
- Pass nullptr to clear Typeface and use the default typeface.
- Does not alter typeface Reference_Count.
+Sets Typeface to typeface, decreasing Reference_Count of the previous Typeface.
+Pass nullptr to clear Typeface and use the default typeface. Increments
+typeface Reference_Count by one.
#Param typeface font and style used to draw text ##
@@ -3325,9 +3333,11 @@ implementation.
Rasterizer controls how shapes are converted to Mask_Alpha.
Rasterizer operates at a higher level than Mask_Filter; Rasterizer takes a Path,
and returns a Mask.
+
Rasterizer may change the geometry and transparency of the shape, such as
creating a shadow effect. Rasterizer forms the base of Rasterizer_Layer, which
creates effects like embossing and outlining.
+
Rasterizer applies to Rect, Region, Round_Rect, Arcs, Circles, Ovals,
Path, and Text.
@@ -3415,11 +3425,12 @@ Path, and Text.
#Method void setRasterizer(sk_sp<SkRasterizer> rasterizer)
- Sets Rasterizer to rasterizer,
- decreasing Reference_Count of the previous Rasterizer.
- Pass nullptr to clear Rasterizer and leave Rasterizer effect on Mask_Alpha unaltered.
- Does not affect Mask_Filter.
- Does not alter rasterizer Reference_Count.
+Sets Rasterizer to rasterizer, decreasing Reference_Count of the previous
+Rasterizer. Pass nullptr to clear Rasterizer and leave Rasterizer effect on
+Mask_Alpha unaltered.
+
+Does not affect Mask_Filter.
+Increments rasterizer Reference_Count by one.
#Param rasterizer how geometry is converted to Mask_Alpha ##
@@ -3448,6 +3459,7 @@ Path, and Text.
Image_Filter operates on the pixel representation of the shape, as modified by Paint
with Blend_Mode set to SkBlendMode::kSrcOver. Image_Filter creates a new bitmap,
which is drawn to the device using the set Blend_Mode.
+
Image_Filter is higher level than Mask_Filter; for instance, an Image_Filter
can operate on all channels of Color, while Mask_Filter generates Alpha only.
Image_Filter operates independently of and can be used in combination with
@@ -3520,12 +3532,12 @@ Mask_Filter and Rasterizer.
#Method void setImageFilter(sk_sp<SkImageFilter> imageFilter)
- Sets Image_Filter to imageFilter,
- decreasing Reference_Count of the previous Image_Filter.
- Pass nullptr to clear Image_Filter, and remove Image_Filter effect
- on drawing.
- Does not affect Rasterizer or Mask_Filter.
- Does not alter imageFilter Reference_Count.
+Sets Image_Filter to imageFilter, decreasing Reference_Count of the previous
+Image_Filter. Pass nullptr to clear Image_Filter, and remove Image_Filter effect
+on drawing.
+
+Does not affect Rasterizer or Mask_Filter.
+Increments imageFilter Reference_Count by one.
#Param imageFilter how Image is sampled when transformed ##
@@ -3556,6 +3568,7 @@ Mask_Filter and Rasterizer.
Draw_Looper sets a modifier that communicates state from one Draw_Layer
to another to construct the draw.
+
Draw_Looper draws one or more times, modifying the canvas and paint each time.
Draw_Looper may be used to draw multiple colors or create a colored shadow.
Set Draw_Looper to nullptr to prevent Draw_Looper from modifying the draw.
@@ -3641,10 +3654,11 @@ Deprecated.
#Method void setDrawLooper(sk_sp<SkDrawLooper> drawLooper)
- Sets Draw_Looper to drawLooper,
- decreasing Reference_Count of the previous drawLooper.
- Pass nullptr to clear Draw_Looper and leave Draw_Looper effect on drawing unaltered.
- Does not alter drawLooper Reference_Count.
+Sets Draw_Looper to drawLooper, decreasing Reference_Count of the previous
+drawLooper. Pass nullptr to clear Draw_Looper and leave Draw_Looper effect on
+drawing unaltered.
+
+Increments drawLooper Reference_Count by one.
#Param drawLooper iterates through drawing one or more time, altering Paint ##
@@ -3992,19 +4006,23 @@ Text_Skew_X defaults to 0.
};
##
-TextEncoding determines whether text specifies character codes and their encoded size,
-or glyph indices. Character codes use the encoding specified by the
-#A Unicode standard # http://unicode.org/standard/standard.html ##.
+TextEncoding determines whether text specifies character codes and their encoded
+size, or glyph indices. Character codes use the encoding specified by the
+#A Unicode standard # http://unicode.org/standard/standard.html ##
+.
+
Character codes encoded size are specified by UTF-8, UTF-16, or UTF-32.
-All character encoding are able to represent all of Unicode, differing only
+All character encodings are able to represent all of Unicode, differing only
in the total storage required.
-#A UTF-8 (RFC 3629) # https://tools.ietf.org/html/rfc3629 ## is made up of 8-bit bytes,
-and encodes ASCII in one byte, and all valid code points in Unicode in multiple
-bytes. #A UTF-16 (RFC 2781) # https://tools.ietf.org/html/rfc2781 ## uses one or two 16-bit words,
-and encodes Unicode ranges 0x0000 to 0xD7FF and 0xE000 to 0xFFFF in one
-word. #A UTF-32 # http://www.unicode.org/versions/Unicode5.0.0/ch03.pdf ## describes
-a 32-bit word, which encodes all code points in Unicode.
+#A UTF-8 (RFC 3629) # https://tools.ietf.org/html/rfc3629 ##
+ encodes each character as one or more 8-bit bytes.
+
+#A UTF-16 (RFC 2781) # https://tools.ietf.org/html/rfc2781 ##
+ encodes each character as one or two 16-bit words.
+
+#A UTF-32 # http://www.unicode.org/versions/Unicode5.0.0/ch03.pdf ##
+ encodes each character as one 32-bit word.
Font_Manager uses font data to convert character code points into glyph indices.
A glyph index is a 16-bit word.
diff --git a/docs/SkPath_Reference.bmh b/docs/SkPath_Reference.bmh
index ca17a9cc8f..c34a21298b 100644
--- a/docs/SkPath_Reference.bmh
+++ b/docs/SkPath_Reference.bmh
@@ -2626,7 +2626,7 @@ A 90 degree circular arc has the weight
#Formula
1 / sqrt(2)
##
- .
+.
##
void draw(SkCanvas* canvas) {
const char* verbNames[] = { "move", "line", "quad", "conic", "cubic", "close", "done" };
@@ -3812,6 +3812,7 @@ 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
than the number requested.
@@ -4203,10 +4204,10 @@ four kConic_Verb, and kClose_Verb. Circle begins at
#Formula
(x + radius, y)
##
-and continues clockwise if dir is kCW_Direction, counterclockwise if dir is
+, continuing clockwise if dir is kCW_Direction, and counterclockwise if dir is
kCCW_Direction.
-addCircle has no effect if radius is zero or negative.
+Has no effect if radius is zero or negative.
#Param x center of Circle ##
#Param y center of Circle ##
@@ -4469,13 +4470,10 @@ void draw(SkCanvas* canvas) {
#Method void addPoly(const SkPoint pts[], int count, bool close)
-Add Contour created from Line array, adding
-#Formula
-count - 1
-##
-Line segments. Contour added starts at pts[0], then adds a line
-for every additional Point in pts array. If close is true,
-appends kClose_Verb to Path, connecting pts[count - 1] and pts[0].
+Add Contour created from Line array, adding (count - 1) Line segments.
+Contour added starts at pts[0], then adds a line for every additional Point
+in pts array. If close is true,appends kClose_Verb to Path, connecting
+pts[count - 1] and pts[0].
If count is zero, append kMove_Verb to path.
Has no effect if count is less than one.
@@ -5125,7 +5123,9 @@ directly compiled as C++ code. Floating point values are written
in hexadecimal to preserve their exact bit pattern. The output reconstructs the
original Path.
-Use instead of dump() when submitting #A bug reports against Skia # http://bug.skia.org ##.
+Use instead of dump() when submitting
+#A bug reports against Skia # http://bug.skia.org ##
+.
Slight value changes in Point_Array may cause the bug to disappear.
#Example
diff --git a/docs/SkPixmap_Reference.bmh b/docs/SkPixmap_Reference.bmh
index 409090b2bd..521d6dea15 100644
--- a/docs/SkPixmap_Reference.bmh
+++ b/docs/SkPixmap_Reference.bmh
@@ -98,21 +98,21 @@ after Pixmap has been created.
#Return empty Pixmap ##
#Example
-void draw(SkCanvas* canvas) {
- const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
- const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", "RGBA_8888", "BGRA_8888",
- "Gray_8", "RGBA_F16"};
- SkPixmap pixmap;
- for (int i = 0; i < 2; ++i) {
- SkDebugf("width: %2d height: %2d", pixmap.width(), pixmap.height());
- SkDebugf(" color: k%s_SkColorType", colors[pixmap.colorType()]);
- SkDebugf(" alpha: k%s_SkAlphaType\n", alphas[pixmap.alphaType()]);
- pixmap.reset(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType),
- nullptr, 0);
- }
+void draw(SkCanvas* canvas) {
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", "RGBA_8888", "BGRA_8888",
+ "Gray_8", "RGBA_F16"};
+ SkPixmap pixmap;
+ for (int i = 0; i < 2; ++i) {
+ SkDebugf("width: %2d height: %2d", pixmap.width(), pixmap.height());
+ SkDebugf(" color: k%s_SkColorType", colors[pixmap.colorType()]);
+ SkDebugf(" alpha: k%s_SkAlphaType\n", alphas[pixmap.alphaType()]);
+ pixmap.reset(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType),
+ nullptr, 0);
+ }
}
#StdOut
-width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
+width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType
##
##
@@ -126,16 +126,13 @@ width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType
#Method SkPixmap(const SkImageInfo& info, const void* addr, size_t rowBytes)
Creates Pixmap from info width, height, SkAlphaType, and SkColorType.
-addr points to pixels, or nullptr. rowBytes should be
-#Formula
-info.width() * info.bytesPerPixel()
-##
-or larger.
+addr points to pixels, or nullptr. rowBytes should be info.width() times
+info.bytesPerPixel(), or larger.
No parameter checking is performed; it is up to the caller to ensure that
addr and rowBytes agree with info.
-The memory lifetime pixels are managed by the caller. When Pixmap goes
+The memory lifetime of pixels is managed by the caller. When Pixmap goes
out of scope, addr is unaffected.
Pixmap may be later modified by reset() to change its size, pixel type, or
@@ -153,14 +150,14 @@ storage.
SkImage::MakeRasterCopy takes const SkPixmap& as an argument. The example
constructs a SkPixmap from the brace-delimited parameters.
##
- SkDebugf("image alpha only = %s\n", image->isAlphaOnly() ? "true" : "false");
- SkPMColor pmColors = 0;
- sk_sp<SkImage> copy = SkImage::MakeRasterCopy({SkImageInfo::MakeA8(1, 1),
- (uint8_t*)&pmColors,
- 1});
+ SkDebugf("image alpha only = %s\n", image->isAlphaOnly() ? "true" : "false");
+ SkPMColor pmColors = 0;
+ sk_sp<SkImage> copy = SkImage::MakeRasterCopy({SkImageInfo::MakeA8(1, 1),
+ (uint8_t*)&pmColors,
+ 1});
SkDebugf("copy alpha only = %s\n", copy->isAlphaOnly() ? "true" : "false");
#StdOut
-image alpha only = false
+image alpha only = false
copy alpha only = true
##
##
@@ -180,22 +177,22 @@ The prior pixels are unaffected; it is up to the caller to release pixels
memory if desired.
#Example
-void draw(SkCanvas* canvas) {
- const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
- const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", "RGBA_8888", "BGRA_8888",
- "Gray_8", "RGBA_F16"};
- SkPixmap pixmap(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType),
- nullptr, 0);
- for (int i = 0; i < 2; ++i) {
- SkDebugf("width: %2d height: %2d", pixmap.width(), pixmap.height());
- SkDebugf(" color: k%s_SkColorType", colors[pixmap.colorType()]);
- SkDebugf(" alpha: k%s_SkAlphaType\n", alphas[pixmap.alphaType()]);
- pixmap.reset();
- }
-}
+void draw(SkCanvas* canvas) {
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", "RGBA_8888", "BGRA_8888",
+ "Gray_8", "RGBA_F16"};
+ SkPixmap pixmap(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType),
+ nullptr, 0);
+ for (int i = 0; i < 2; ++i) {
+ SkDebugf("width: %2d height: %2d", pixmap.width(), pixmap.height());
+ SkDebugf(" color: k%s_SkColorType", colors[pixmap.colorType()]);
+ SkDebugf(" alpha: k%s_SkAlphaType\n", alphas[pixmap.alphaType()]);
+ pixmap.reset();
+ }
+}
#StdOut
width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType
-width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
+width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
##
##
@@ -209,11 +206,8 @@ width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
Sets width, height, SkAlphaType, and SkColorType from info.
Sets pixel address from addr, which may be nullptr.
-Sets row bytes from rowBytes, which should be
-#Formula
-info.width() * info.bytesPerPixel()
-##
-or larger.
+Sets row bytes from rowBytes, which should be info.width() times
+info.bytesPerPixel(), or larger.
Does not check addr. Asserts if built with SK_DEBUG defined and if rowBytes is
too small to hold one row of pixels.
@@ -228,21 +222,21 @@ out of scope, addr is unaffected.
#Example
#Image 4
#Height 128
-void draw(SkCanvas* canvas) {
- std::vector<int32_t> pixels;
- pixels.resize(image->height() * image->width() * 4);
- SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
- image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
- image->readPixels(pixmap, 0, 0);
- int x = 0;
- for (auto colorType : { kRGBA_8888_SkColorType, kBGRA_8888_SkColorType } ) {
- pixmap.reset(SkImageInfo::Make(image->width(), image->height(), colorType,
- image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
- SkBitmap bitmap;
- bitmap.installPixels(pixmap);
- canvas->drawBitmap(bitmap, x, 0);
- x += 128;
- }
+void draw(SkCanvas* canvas) {
+ std::vector<int32_t> pixels;
+ pixels.resize(image->height() * image->width() * 4);
+ SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
+ image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
+ image->readPixels(pixmap, 0, 0);
+ int x = 0;
+ for (auto colorType : { kRGBA_8888_SkColorType, kBGRA_8888_SkColorType } ) {
+ pixmap.reset(SkImageInfo::Make(image->width(), image->height(), colorType,
+ image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
+ SkBitmap bitmap;
+ bitmap.installPixels(pixmap);
+ canvas->drawBitmap(bitmap, x, 0);
+ x += 128;
+ }
}
##
@@ -257,18 +251,18 @@ void draw(SkCanvas* canvas) {
Changes Color_Space in Image_Info; preserves width, height, SkAlphaType, and
SkColorType in Image, and leaves pixel address and row bytes unchanged.
-colorSpace reference count is incremented.
+Color_Space reference count is incremented.
#Param colorSpace Color_Space moved to Image_Info ##
#Example
-void draw(SkCanvas* canvas) {
- SkPixmap pixmap;
- sk_sp<SkColorSpace> colorSpace1 = SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma,
- SkColorSpace::kRec2020_Gamut);
- SkDebugf("is %sunique\n", colorSpace1->unique() ? "" : "not ");
- pixmap.setColorSpace(colorSpace1);
- SkDebugf("is %sunique\n", colorSpace1->unique() ? "" : "not ");
+void draw(SkCanvas* canvas) {
+ SkPixmap pixmap;
+ sk_sp<SkColorSpace> colorSpace1 = SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma,
+ SkColorSpace::kRec2020_Gamut);
+ SkDebugf("is %sunique\n", colorSpace1->unique() ? "" : "not ");
+ pixmap.setColorSpace(colorSpace1);
+ SkDebugf("is %sunique\n", colorSpace1->unique() ? "" : "not ");
}
#StdOut
is unique
@@ -296,26 +290,26 @@ Failing to read the return value generates a compile time warning.
#Return true if set to Mask properties ##
#Example
- const int width = 2;
- const int height = 2;
- uint8_t bytes[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
- SkMask mask;
- mask.fFormat = SkMask::kA8_Format;
- mask.fBounds = {0, 0, width, height};
- mask.fImage = bytes;
- mask.fRowBytes = (width + 7) >> 3;
- SkPixmap pixmap;
- bool success = pixmap.reset(mask);
- SkDebugf("success: %s width: %d height: %d\n", success ? "true " : "false",
- pixmap.width(), pixmap.height());
- mask.fFormat = SkMask::kBW_Format;
- success = pixmap.reset(mask);
- SkDebugf("success: %s width: %d height: %d\n", success ? "true " : "false",
- pixmap.width(), pixmap.height());
-#StdOut
-success: true width: 2 height: 2
-success: false width: 0 height: 0
-##
+ const int width = 2;
+ const int height = 2;
+ uint8_t bytes[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+ SkMask mask;
+ mask.fFormat = SkMask::kA8_Format;
+ mask.fBounds = {0, 0, width, height};
+ mask.fImage = bytes;
+ mask.fRowBytes = (width + 7) >> 3;
+ SkPixmap pixmap;
+ bool success = pixmap.reset(mask);
+ SkDebugf("success: %s width: %d height: %d\n", success ? "true " : "false",
+ pixmap.width(), pixmap.height());
+ mask.fFormat = SkMask::kBW_Format;
+ success = pixmap.reset(mask);
+ SkDebugf("success: %s width: %d height: %d\n", success ? "true " : "false",
+ pixmap.width(), pixmap.height());
+#StdOut
+success: true width: 2 height: 2
+success: false width: 0 height: 0
+##
##
#SeeAlso Mask reset()
@@ -340,18 +334,18 @@ Failing to read the return value generates a compile time warning.
#Example
#Image 3
#Height 128
-void draw(SkCanvas* canvas) {
- std::vector<int32_t> pixels;
- pixels.resize(image->height() * image->width() * 4);
- SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
- image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
- image->readPixels(pixmap, 0, 0);
- SkPixmap inset;
- if (pixmap.extractSubset(&inset, {128, 128, 512, 512})) {
- SkBitmap bitmap;
- bitmap.installPixels(inset);
- canvas->drawBitmap(bitmap, 0, 0);
- }
+void draw(SkCanvas* canvas) {
+ std::vector<int32_t> pixels;
+ pixels.resize(image->height() * image->width() * 4);
+ SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
+ image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
+ image->readPixels(pixmap, 0, 0);
+ SkPixmap inset;
+ if (pixmap.extractSubset(&inset, {128, 128, 512, 512})) {
+ SkBitmap bitmap;
+ bitmap.installPixels(inset);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
}
##
@@ -367,29 +361,29 @@ void draw(SkCanvas* canvas) {
#Method const SkImageInfo& info() const
-Returns width, height, SkAlphaType, and SkColorType.
+Returns width, height, Alpha_Type, Color_Type, and Color_Space.
#Return reference to ImageInfo ##
#Example
#Image 3
- std::vector<int32_t> pixels;
- pixels.resize(image->height() * image->width() * 4);
- SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
- image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
- image->readPixels(pixmap, 0, 0);
- SkPixmap inset;
- if (pixmap.extractSubset(&inset, {128, 128, 512, 512})) {
- const SkImageInfo& info = inset.info();
- const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
- const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
- "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
- SkDebugf("width: %d height: %d color: %s alpha: %s\n", info.width(), info.height(),
- colors[info.colorType()], alphas[info.alphaType()]);
- }
-#StdOut
-width: 384 height: 384 color: BGRA_8888 alpha: Opaque
-##
+ std::vector<int32_t> pixels;
+ pixels.resize(image->height() * image->width() * 4);
+ SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
+ image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
+ image->readPixels(pixmap, 0, 0);
+ SkPixmap inset;
+ if (pixmap.extractSubset(&inset, {128, 128, 512, 512})) {
+ const SkImageInfo& info = inset.info();
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
+ "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
+ SkDebugf("width: %d height: %d color: %s alpha: %s\n", info.width(), info.height(),
+ colors[info.colorType()], alphas[info.alphaType()]);
+ }
+#StdOut
+width: 384 height: 384 color: BGRA_8888 alpha: Opaque
+##
##
#SeeAlso Image_Info
@@ -419,7 +413,7 @@ for (auto& pixmap : { badPixmap, okPixmap } ) {
pixmap.info().minRowBytes());
}
#StdOut
-rowBytes: 2 minRowBytes: 4
+rowBytes: 2 minRowBytes: 4
rowBytes: 8 minRowBytes: 4
##
##
@@ -432,7 +426,7 @@ rowBytes: 8 minRowBytes: 4
#Method const void* addr() const
-Returns pixel address, the base corresponding the pixel origin.
+Returns pixel address, the base address corresponding to the pixel origin.
It is up to the Pixmap creator to ensure that pixel address is a useful value.
@@ -440,21 +434,21 @@ It is up to the Pixmap creator to ensure that pixel address is a useful value.
#Example
#Image 3
- std::vector<int32_t> pixels;
- pixels.resize(image->height() * image->width() * 4);
- SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
- image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
- image->readPixels(pixmap, 0, 0);
- SkDebugf("pixels address: 0x%llx\n", pixmap.addr());
- SkPixmap inset;
- if (pixmap.extractSubset(&inset, {128, 128, 512, 512})) {
- SkDebugf("inset address: 0x%llx\n", inset.addr());
- }
-#StdOut
-#Volatile
-pixels address: 0x7f2a440bb010
-inset address: 0x7f2a440fb210
-##
+ std::vector<int32_t> pixels;
+ pixels.resize(image->height() * image->width() * 4);
+ SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
+ image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
+ image->readPixels(pixmap, 0, 0);
+ SkDebugf("pixels address: 0x%llx\n", pixmap.addr());
+ SkPixmap inset;
+ if (pixmap.extractSubset(&inset, {128, 128, 512, 512})) {
+ SkDebugf("inset address: 0x%llx\n", inset.addr());
+ }
+#StdOut
+#Volatile
+pixels address: 0x7f2a440bb010
+inset address: 0x7f2a440fb210
+##
##
#SeeAlso addr(int x, int y) addr8 addr16 addr32 addr64 info() rowBytes()
@@ -475,11 +469,11 @@ rowBytes() / info.bytesPerPixel()
#Example
SkImageInfo info = SkImageInfo::MakeA8(16, 32);
- SkPixmap pixmap(info, nullptr, 64);
- SkDebugf("pixmap width: %d info width: %d\n", pixmap.width(), info.width());
-#StdOut
-pixmap width: 16 info width: 16
-##
+ SkPixmap pixmap(info, nullptr, 64);
+ SkDebugf("pixmap width: %d info width: %d\n", pixmap.width(), info.width());
+#StdOut
+pixmap width: 16 info width: 16
+##
##
#SeeAlso height()
@@ -496,11 +490,11 @@ Returns pixel row count.
#Example
SkImageInfo info = SkImageInfo::MakeA8(16, 32);
- SkPixmap pixmap(info, nullptr, 64);
- SkDebugf("pixmap height: %d info height: %d\n", pixmap.height(), info.height());
-#StdOut
-pixmap height: 32 info height: 32
-##
+ SkPixmap pixmap(info, nullptr, 64);
+ SkDebugf("pixmap height: %d info height: %d\n", pixmap.height(), info.height());
+#StdOut
+pixmap height: 32 info height: 32
+##
##
#SeeAlso width()
@@ -518,13 +512,13 @@ kBGRA_8888_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType.
#Return Color_Type in Image_Info ##
#Example
- const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
- "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
- SkPixmap pixmap(SkImageInfo::MakeA8(16, 32), nullptr, 64);
- SkDebugf("color type: k" "%s" "_SkColorType\n", colors[pixmap.colorType()]);
-#StdOut
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
+ "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
+ SkPixmap pixmap(SkImageInfo::MakeA8(16, 32), nullptr, 64);
+ SkDebugf("color type: k" "%s" "_SkColorType\n", colors[pixmap.colorType()]);
+#StdOut
color type: kAlpha_SkColorType
-##
+##
##
#SeeAlso alphaType()
@@ -541,9 +535,9 @@ kPremul_SkAlphaType, kUnpremul_SkAlphaType.
#Return Alpha_Type in Image_Info ##
#Example
- const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
- SkPixmap pixmap(SkImageInfo::MakeA8(16, 32), nullptr, 64);
- SkDebugf("alpha type: k" "%s" "_SkAlphaType\n", alphas[pixmap.alphaType()]);
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ SkPixmap pixmap(SkImageInfo::MakeA8(16, 32), nullptr, 64);
+ SkDebugf("alpha type: k" "%s" "_SkAlphaType\n", alphas[pixmap.alphaType()]);
#StdOut
alpha type: kPremul_SkAlphaType
##
@@ -566,16 +560,16 @@ Returns Color_Space associated with Image_Info.
SkColorSpace::MakeSRGBLinear creates Color_Space with linear gamma
and an sRGB gamut. This Color_Space gamma is not close to sRGB gamma.
##
- SkPixmap pixmap(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,
- SkColorSpace::MakeSRGBLinear()), nullptr, 64);
- SkColorSpace* colorSpace = pixmap.colorSpace();
- SkDebugf("gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\n",
- colorSpace->gammaCloseToSRGB() ? "true" : "false",
- colorSpace->gammaIsLinear() ? "true" : "false",
- colorSpace->isSRGB() ? "true" : "false");
-#StdOut
-gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
-##
+ SkPixmap pixmap(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,
+ SkColorSpace::MakeSRGBLinear()), nullptr, 64);
+ SkColorSpace* colorSpace = pixmap.colorSpace();
+ SkDebugf("gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\n",
+ colorSpace->gammaCloseToSRGB() ? "true" : "false",
+ colorSpace->gammaIsLinear() ? "true" : "false",
+ colorSpace->isSRGB() ? "true" : "false");
+#StdOut
+gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
+##
##
#SeeAlso Color_Space
@@ -595,24 +589,24 @@ Does not check if Color_Type allows Alpha, or Alpha in pixel values.
#Description
isOpaque ignores whether all pixels are opaque or not.
##
- std::vector<uint32_t> pixels;
- const int height = 2;
- const int width = 2;
- pixels.resize(height * width * 4);
- SkPixmap pixmap(SkImageInfo::Make(width, height, kN32_SkColorType,
- kPremul_SkAlphaType), (const void*) &pixels.front(), width * 4);
- for (int index = 0; index < 2; ++index) {
- pixmap.erase(0x00000000);
- SkDebugf("isOpaque: %s\n", pixmap.isOpaque() ? "true" : "false");
- pixmap.erase(0xFFFFFFFF);
- SkDebugf("isOpaque: %s\n", pixmap.isOpaque() ? "true" : "false");
- pixmap.reset(pixmap.info().makeAlphaType(kOpaque_SkAlphaType),
- (const void*) &pixels.front(), width * 4);
- }
+ std::vector<uint32_t> pixels;
+ const int height = 2;
+ const int width = 2;
+ pixels.resize(height * width * 4);
+ SkPixmap pixmap(SkImageInfo::Make(width, height, kN32_SkColorType,
+ kPremul_SkAlphaType), (const void*) &pixels.front(), width * 4);
+ for (int index = 0; index < 2; ++index) {
+ pixmap.erase(0x00000000);
+ SkDebugf("isOpaque: %s\n", pixmap.isOpaque() ? "true" : "false");
+ pixmap.erase(0xFFFFFFFF);
+ SkDebugf("isOpaque: %s\n", pixmap.isOpaque() ? "true" : "false");
+ pixmap.reset(pixmap.info().makeAlphaType(kOpaque_SkAlphaType),
+ (const void*) &pixels.front(), width * 4);
+ }
#StdOut
-isOpaque: false
-isOpaque: false
-isOpaque: true
+isOpaque: false
+isOpaque: false
+isOpaque: true
isOpaque: true
##
##
@@ -636,15 +630,15 @@ Returns IRect
#Example
for (int width : { 0, 2 } ) {
for (int height : { 0, 2 } ) {
- SkPixmap pixmap(SkImageInfo::MakeA8(width, height), nullptr, width);
+ SkPixmap pixmap(SkImageInfo::MakeA8(width, height), nullptr, width);
SkDebugf("width: %d height: %d empty: %s\n", width, height,
pixmap.bounds().isEmpty() ? "true" : "false");
}
}
#StdOut
-width: 0 height: 0 empty: true
-width: 0 height: 2 empty: true
-width: 2 height: 0 empty: true
+width: 0 height: 0 empty: true
+width: 0 height: 2 empty: true
+width: 2 height: 0 empty: true
width: 2 height: 2 empty: false
##
##
@@ -664,15 +658,15 @@ width().
#Return maximum pixels per row ##
#Example
- for (int rowBytes : { 4, 5, 6, 7, 8} ) {
- SkPixmap pixmap(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType), nullptr, rowBytes);
- SkDebugf("rowBytes: %d rowBytesAsPixels: %d\n", rowBytes, pixmap.rowBytesAsPixels());
- }
+ for (int rowBytes : { 4, 5, 6, 7, 8} ) {
+ SkPixmap pixmap(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType), nullptr, rowBytes);
+ SkDebugf("rowBytes: %d rowBytesAsPixels: %d\n", rowBytes, pixmap.rowBytesAsPixels());
+ }
#StdOut
-rowBytes: 4 rowBytesAsPixels: 1
-rowBytes: 5 rowBytesAsPixels: 1
-rowBytes: 6 rowBytesAsPixels: 1
-rowBytes: 7 rowBytesAsPixels: 1
+rowBytes: 4 rowBytesAsPixels: 1
+rowBytes: 5 rowBytesAsPixels: 1
+rowBytes: 6 rowBytesAsPixels: 1
+rowBytes: 7 rowBytesAsPixels: 1
rowBytes: 8 rowBytesAsPixels: 2
##
##
@@ -691,26 +685,26 @@ Returns zero for kUnknown_SkColorType.
#Return one of: 0, 1, 2, 3; left shift to convert pixels to bytes ##
#Example
- const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
- "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
- SkImageInfo info = SkImageInfo::MakeA8(1, 1);
- for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType,
- kRGB_565_SkColorType, kARGB_4444_SkColorType,
- kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
- kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
- SkPixmap pixmap(info.makeColorType(colorType), nullptr, 4);
- SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d shiftPerPixel: %d\n",
- colors[colorType], 10 - strlen(colors[colorType]), " ",
- pixmap.info().bytesPerPixel(), pixmap.shiftPerPixel());
- }
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
+ "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
+ SkImageInfo info = SkImageInfo::MakeA8(1, 1);
+ for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType,
+ kRGB_565_SkColorType, kARGB_4444_SkColorType,
+ kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+ kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
+ SkPixmap pixmap(info.makeColorType(colorType), nullptr, 4);
+ SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d shiftPerPixel: %d\n",
+ colors[colorType], 10 - strlen(colors[colorType]), " ",
+ pixmap.info().bytesPerPixel(), pixmap.shiftPerPixel());
+ }
#StdOut
-color: kUnknown_SkColorType bytesPerPixel: 0 shiftPerPixel: 0
-color: kAlpha_SkColorType bytesPerPixel: 1 shiftPerPixel: 0
-color: kRGB_565_SkColorType bytesPerPixel: 2 shiftPerPixel: 1
-color: kARGB_4444_SkColorType bytesPerPixel: 2 shiftPerPixel: 1
-color: kRGBA_8888_SkColorType bytesPerPixel: 4 shiftPerPixel: 2
-color: kBGRA_8888_SkColorType bytesPerPixel: 4 shiftPerPixel: 2
-color: kGray_8_SkColorType bytesPerPixel: 1 shiftPerPixel: 0
+color: kUnknown_SkColorType bytesPerPixel: 0 shiftPerPixel: 0
+color: kAlpha_SkColorType bytesPerPixel: 1 shiftPerPixel: 0
+color: kRGB_565_SkColorType bytesPerPixel: 2 shiftPerPixel: 1
+color: kARGB_4444_SkColorType bytesPerPixel: 2 shiftPerPixel: 1
+color: kRGBA_8888_SkColorType bytesPerPixel: 4 shiftPerPixel: 2
+color: kBGRA_8888_SkColorType bytesPerPixel: 4 shiftPerPixel: 2
+color: kGray_8_SkColorType bytesPerPixel: 1 shiftPerPixel: 0
color: kRGBA_F16_SkColorType bytesPerPixel: 8 shiftPerPixel: 3
##
##
@@ -729,25 +723,25 @@ Includes unused memory on last row when rowBytesAsPixels exceeds width().
#Return conservative pixel storage size ##
#Example
- SkPixmap pixmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- pixmap.reset(imageInfo , nullptr, width * 5);
- SkDebugf("width: %7d height: %7d getSize64: %13lld\n", width, height, pixmap.getSize64());
- }
- }
-#StdOut
-width: 1 height: 1 getSize64: 5
-width: 1 height: 1000 getSize64: 5000
-width: 1 height: 1000000 getSize64: 5000000
-width: 1000 height: 1 getSize64: 5000
-width: 1000 height: 1000 getSize64: 5000000
-width: 1000 height: 1000000 getSize64: 5000000000
-width: 1000000 height: 1 getSize64: 5000000
-width: 1000000 height: 1000 getSize64: 5000000000
-width: 1000000 height: 1000000 getSize64: 5000000000000
-##
+ SkPixmap pixmap;
+ for (int width : { 1, 1000, 1000000 } ) {
+ for (int height: { 1, 1000, 1000000 } ) {
+ SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
+ pixmap.reset(imageInfo , nullptr, width * 5);
+ SkDebugf("width: %7d height: %7d getSize64: %13lld\n", width, height, pixmap.getSize64());
+ }
+ }
+#StdOut
+width: 1 height: 1 getSize64: 5
+width: 1 height: 1000 getSize64: 5000
+width: 1 height: 1000000 getSize64: 5000000
+width: 1000 height: 1 getSize64: 5000
+width: 1000 height: 1000 getSize64: 5000000
+width: 1000 height: 1000000 getSize64: 5000000000
+width: 1000000 height: 1 getSize64: 5000000
+width: 1000000 height: 1000 getSize64: 5000000000
+width: 1000000 height: 1000000 getSize64: 5000000000000
+##
##
#SeeAlso getSafeSize64 getSafeSize height() rowBytes width() SkImageInfo::bytesPerPixel
@@ -764,24 +758,24 @@ Does not include unused memory on last row when rowBytesAsPixels exceeds width()
#Return exact pixel storage size ##
#Example
- SkPixmap pixmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- pixmap.reset(imageInfo , nullptr, width * 5);
- SkDebugf("width: %7d height: %7d getSafeSize64: %13lld\n", width, height,
- pixmap.getSafeSize64());
- }
- }
-#StdOut
-width: 1 height: 1 getSafeSize64: 4
-width: 1 height: 1000 getSafeSize64: 4999
-width: 1 height: 1000000 getSafeSize64: 4999999
-width: 1000 height: 1 getSafeSize64: 4000
-width: 1000 height: 1000 getSafeSize64: 4999000
-width: 1000 height: 1000000 getSafeSize64: 4999999000
-width: 1000000 height: 1 getSafeSize64: 4000000
-width: 1000000 height: 1000 getSafeSize64: 4999000000
+ SkPixmap pixmap;
+ for (int width : { 1, 1000, 1000000 } ) {
+ for (int height: { 1, 1000, 1000000 } ) {
+ SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
+ pixmap.reset(imageInfo , nullptr, width * 5);
+ SkDebugf("width: %7d height: %7d getSafeSize64: %13lld\n", width, height,
+ pixmap.getSafeSize64());
+ }
+ }
+#StdOut
+width: 1 height: 1 getSafeSize64: 4
+width: 1 height: 1000 getSafeSize64: 4999
+width: 1 height: 1000000 getSafeSize64: 4999999
+width: 1000 height: 1 getSafeSize64: 4000
+width: 1000 height: 1000 getSafeSize64: 4999000
+width: 1000 height: 1000000 getSafeSize64: 4999999000
+width: 1000000 height: 1 getSafeSize64: 4000000
+width: 1000000 height: 1000 getSafeSize64: 4999000000
width: 1000000 height: 1000000 getSafeSize64: 4999999000000
##
##
@@ -802,26 +796,26 @@ The largest value than can be returned is 2,147,483,647.
#Return exact pixel storage size if size fits in signed 32 bits ##
#Example
-void draw(SkCanvas* canvas) {
- SkPixmap pixmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- pixmap.reset(imageInfo , nullptr, width * 5);
- SkDebugf("width: %7d height: %7d getSafeSize: %7d\n", width, height, pixmap.getSafeSize());
- }
- }
+void draw(SkCanvas* canvas) {
+ SkPixmap pixmap;
+ for (int width : { 1, 1000, 1000000 } ) {
+ for (int height: { 1, 1000, 1000000 } ) {
+ SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
+ pixmap.reset(imageInfo , nullptr, width * 5);
+ SkDebugf("width: %7d height: %7d getSafeSize: %7d\n", width, height, pixmap.getSafeSize());
+ }
+ }
}
-#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
+#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
##
##
@@ -839,7 +833,7 @@ width: 1000000 height: 1000000 getSafeSize: 0
Returns true if all pixels are opaque. Color_Type determines how pixels
are encoded, and whether pixel describes Alpha. Returns true for Color_Types
-without alpha for each pixel; for other Color_Types, returns true if all
+without alpha in each pixel; for other Color_Types, returns true if all
pixels have alpha values equivalent to 1.0 or greater.
For Color_Types kRGB_565_SkColorType or kGray_8_SkColorType: always
@@ -849,29 +843,29 @@ For Color_Type kARGB_4444_SkColorType: returns true if all pixel Alpha values ar
For kRGBA_F16_SkColorType: returns true if all pixel Alpha values are 1.0 or
greater.
-Returns false for any other Color_Type.
+Returns false for kUnknown_SkColorType.
#Return true all pixels have opaque values or Color_Type is opaque ##
#Example
- std::vector<uint32_t> pixels;
- const int height = 2;
- const int width = 2;
- pixels.resize(height * width * 4);
- SkPixmap pixmap(SkImageInfo::Make(width, height, kN32_SkColorType,
- kPremul_SkAlphaType), (const void*) &pixels.front(), width * 4);
- for (int index = 0; index < 2; ++index) {
- pixmap.erase(0x00000000);
- SkDebugf("computeIsOpaque: %s\n", pixmap.computeIsOpaque() ? "true" : "false");
- pixmap.erase(0xFFFFFFFF);
- SkDebugf("computeIsOpaque: %s\n", pixmap.computeIsOpaque() ? "true" : "false");
- pixmap.reset(pixmap.info().makeAlphaType(kOpaque_SkAlphaType),
- (const void*) &pixels.front(), width * 4);
+ std::vector<uint32_t> pixels;
+ const int height = 2;
+ const int width = 2;
+ pixels.resize(height * width * 4);
+ SkPixmap pixmap(SkImageInfo::Make(width, height, kN32_SkColorType,
+ kPremul_SkAlphaType), (const void*) &pixels.front(), width * 4);
+ for (int index = 0; index < 2; ++index) {
+ pixmap.erase(0x00000000);
+ SkDebugf("computeIsOpaque: %s\n", pixmap.computeIsOpaque() ? "true" : "false");
+ pixmap.erase(0xFFFFFFFF);
+ SkDebugf("computeIsOpaque: %s\n", pixmap.computeIsOpaque() ? "true" : "false");
+ pixmap.reset(pixmap.info().makeAlphaType(kOpaque_SkAlphaType),
+ (const void*) &pixels.front(), width * 4);
}
#StdOut
-computeIsOpaque: false
-computeIsOpaque: true
-computeIsOpaque: false
+computeIsOpaque: false
+computeIsOpaque: true
+computeIsOpaque: false
computeIsOpaque: true
##
##
@@ -896,43 +890,43 @@ Color_Space in Image_Info is ignored. Some Color precision may be lost in the
conversion to Unpremultiplied Color; original pixel data may have additional
precision.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return pixel converted to Unpremultiplied Color ##
#Example
- const int w = 4;
- const int h = 4;
- std::vector<SkPMColor> storage;
- storage.resize(w * h);
- SkDebugf("Premultiplied:\n");
- for (int y = 0; y < h; ++y) {
- SkDebugf("(0, %d) ", y);
- for (int x = 0; x < w; ++x) {
- int a = 0xFF * (x + y) / (w - 1 + h - 1);
- storage[x + y * w] = SkPackARGB32(a, a * x / (w - 1), a * y / (h - 1), a);
- SkDebugf("0x%08x%c", storage[x + y * w], x == w - 1 ? '\n' : ' ');
- }
- }
- SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), &storage.front(), w * 4);
- SkDebugf("Unpremultiplied:\n");
- for (int y = 0; y < h; ++y) {
- SkDebugf("(0, %d) ", y);
- for (int x = 0; x < w; ++x) {
- SkDebugf("0x%08x%c", pixmap.getColor(x, y), x == w - 1 ? '\n' : ' ');
- }
- }
+ const int w = 4;
+ const int h = 4;
+ std::vector<SkPMColor> storage;
+ storage.resize(w * h);
+ SkDebugf("Premultiplied:\n");
+ for (int y = 0; y < h; ++y) {
+ SkDebugf("(0, %d) ", y);
+ for (int x = 0; x < w; ++x) {
+ int a = 0xFF * (x + y) / (w - 1 + h - 1);
+ storage[x + y * w] = SkPackARGB32(a, a * x / (w - 1), a * y / (h - 1), a);
+ SkDebugf("0x%08x%c", storage[x + y * w], x == w - 1 ? '\n' : ' ');
+ }
+ }
+ SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), &storage.front(), w * 4);
+ SkDebugf("Unpremultiplied:\n");
+ for (int y = 0; y < h; ++y) {
+ SkDebugf("(0, %d) ", y);
+ for (int x = 0; x < w; ++x) {
+ SkDebugf("0x%08x%c", pixmap.getColor(x, y), x == w - 1 ? '\n' : ' ');
+ }
+ }
#StdOut
-Premultiplied:
-(0, 0) 0x00000000 0x2a0e002a 0x55380055 0x7f7f007f
-(0, 1) 0x2a000e2a 0x551c1c55 0x7f542a7f 0xaaaa38aa
-(0, 2) 0x55003855 0x7f2a547f 0xaa7171aa 0xd4d48dd4
-(0, 3) 0x7f007f7f 0xaa38aaaa 0xd48dd4d4 0xffffffff
-Unpremultiplied:
-(0, 0) 0x00000000 0x2a5500ff 0x55a800ff 0x7fff00ff
-(0, 1) 0x2a0055ff 0x555454ff 0x7fa954ff 0xaaff54ff
-(0, 2) 0x5500a8ff 0x7f54a9ff 0xaaaaaaff 0xd4ffaaff
+Premultiplied:
+(0, 0) 0x00000000 0x2a0e002a 0x55380055 0x7f7f007f
+(0, 1) 0x2a000e2a 0x551c1c55 0x7f542a7f 0xaaaa38aa
+(0, 2) 0x55003855 0x7f2a547f 0xaa7171aa 0xd4d48dd4
+(0, 3) 0x7f007f7f 0xaa38aaaa 0xd48dd4d4 0xffffffff
+Unpremultiplied:
+(0, 0) 0x00000000 0x2a5500ff 0x55a800ff 0x7fff00ff
+(0, 1) 0x2a0055ff 0x555454ff 0x7fa954ff 0xaaff54ff
+(0, 2) 0x5500a8ff 0x7f54a9ff 0xaaaaaaff 0xd4ffaaff
(0, 3) 0x7f00ffff 0xaa54ffff 0xd4aaffff 0xffffffff
##
##
@@ -954,17 +948,17 @@ Returns readable pixel address at (x, y).
Input is not validated: out of bounds values of x or y trigger an assert() if
built with SK_DEBUG defined. Returns zero if Color_Type is kUnknown_SkColorType.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return readable generic pointer to pixel ##
#Example
- const int w = 4;
- const int h = 4;
- std::vector<SkPMColor> storage;
- storage.resize(w * h);
- SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), &storage.front(), w * 4);
+ const int w = 4;
+ const int h = 4;
+ std::vector<SkPMColor> storage;
+ storage.resize(w * h);
+ SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), &storage.front(), w * 4);
SkDebugf("pixmap.addr(1, 2) %c= &storage[1 + 2 * w]\n",
pixmap.addr(1, 2) == &storage[1 + 2 * w] ? '=' : '!');
#StdOut
@@ -989,11 +983,11 @@ One byte corresponds to one pixel.
#Return readable unsigned 8-bit pointer to pixels ##
#Example
- const int w = 4;
- const int h = 4;
- uint8_t storage[w * h];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kGray_8_SkColorType, kPremul_SkAlphaType),
- storage, w * sizeof(storage[0]));
+ const int w = 4;
+ const int h = 4;
+ uint8_t storage[w * h];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kGray_8_SkColorType, kPremul_SkAlphaType),
+ storage, w * sizeof(storage[0]));
SkDebugf("pixmap.addr8() %c= storage\n",
pixmap.addr8() == storage ? '=' : '!');
#StdOut
@@ -1018,11 +1012,11 @@ One word corresponds to one pixel.
#Return readable unsigned 16-bit pointer to pixels ##
#Example
- const int w = 4;
- const int h = 4;
- uint16_t storage[w * h];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kARGB_4444_SkColorType, kPremul_SkAlphaType),
- storage, w * sizeof(storage[0]));
+ const int w = 4;
+ const int h = 4;
+ uint16_t storage[w * h];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kARGB_4444_SkColorType, kPremul_SkAlphaType),
+ storage, w * sizeof(storage[0]));
SkDebugf("pixmap.addr16() %c= storage\n",
pixmap.addr16() == storage ? '=' : '!');
#StdOut
@@ -1047,11 +1041,11 @@ One word corresponds to one pixel.
#Return readable unsigned 32-bit pointer to pixels ##
#Example
- const int w = 4;
- const int h = 4;
- uint32_t storage[w * h];
- SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType),
- storage, w * sizeof(storage[0]));
+ const int w = 4;
+ const int h = 4;
+ uint32_t storage[w * h];
+ SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType),
+ storage, w * sizeof(storage[0]));
SkDebugf("pixmap.addr32() %c= storage\n",
pixmap.addr32() == storage ? '=' : '!');
#StdOut
@@ -1076,11 +1070,11 @@ One word corresponds to one pixel.
#Return readable unsigned 64-bit pointer to pixels ##
#Example
- const int w = 4;
- const int h = 4;
- uint64_t storage[w * h];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_SkAlphaType),
- storage, w * sizeof(storage[0]));
+ const int w = 4;
+ const int h = 4;
+ uint64_t storage[w * h];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_SkAlphaType),
+ storage, w * sizeof(storage[0]));
SkDebugf("pixmap.addr64() %c= storage\n",
pixmap.addr64() == storage ? '=' : '!');
#StdOut
@@ -1106,11 +1100,11 @@ Four words correspond to one pixel.
#Return readable unsigned 16-bit pointer to first component of pixels ##
#Example
- const int w = 4;
- const int h = 4;
- uint16_t storage[w * h * 4];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_SkAlphaType),
- storage, w * 4 * sizeof(storage[0]));
+ const int w = 4;
+ const int h = 4;
+ uint16_t storage[w * h * 4];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_SkAlphaType),
+ storage, w * 4 * sizeof(storage[0]));
SkDebugf("pixmap.addrF16() %c= storage\n",
pixmap.addrF16() == storage ? '=' : '!');
#StdOut
@@ -1134,19 +1128,19 @@ built with SK_DEBUG defined.
Will trigger an assert() if Color_Type is not kAlpha_8_SkColorType or
kGray_8_SkColorType, and is built with SK_DEBUG defined.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return readable unsigned 8-bit pointer to pixel at (x, y) ##
#Example
- const int w = 4;
- const int h = 4;
- uint8_t storage[w * h];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kGray_8_SkColorType, kPremul_SkAlphaType),
- storage, w * sizeof(storage[0]));
- SkDebugf("pixmap.addr8(1, 2) %c= &storage[1 + 2 * w]\n",
- pixmap.addr8(1, 2) == &storage[1 + 2 * w] ? '=' : '!');
+ const int w = 4;
+ const int h = 4;
+ uint8_t storage[w * h];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kGray_8_SkColorType, kPremul_SkAlphaType),
+ storage, w * sizeof(storage[0]));
+ SkDebugf("pixmap.addr8(1, 2) %c= &storage[1 + 2 * w]\n",
+ pixmap.addr8(1, 2) == &storage[1 + 2 * w] ? '=' : '!');
#StdOut
pixmap.addr8(1, 2) == &storage[1 + 2 * w]
##
@@ -1168,17 +1162,17 @@ built with SK_DEBUG defined.
Will trigger an assert() if Color_Type is not kRGB_565_SkColorType or
kARGB_4444_SkColorType, and is built with SK_DEBUG defined.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return readable unsigned 16-bit pointer to pixel at (x, y) ##
#Example
- const int w = 4;
- const int h = 4;
- uint16_t storage[w * h];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kARGB_4444_SkColorType, kPremul_SkAlphaType),
- storage, w * sizeof(storage[0]));
+ const int w = 4;
+ const int h = 4;
+ uint16_t storage[w * h];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kARGB_4444_SkColorType, kPremul_SkAlphaType),
+ storage, w * sizeof(storage[0]));
SkDebugf("pixmap.addr16(1, 2) %c= &storage[1 + 2 * w]\n",
pixmap.addr16(1, 2) == &storage[1 + 2 * w] ? '=' : '!');
#StdOut
@@ -1202,17 +1196,17 @@ built with SK_DEBUG defined.
Will trigger an assert() if Color_Type is not kRGBA_8888_SkColorType or
kBGRA_8888_SkColorType, and is built with SK_DEBUG defined.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return readable unsigned 32-bit pointer to pixel at (x, y) ##
#Example
- const int w = 4;
- const int h = 4;
- uint32_t storage[w * h];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_8888_SkColorType, kPremul_SkAlphaType),
- storage, w * sizeof(storage[0]));
+ const int w = 4;
+ const int h = 4;
+ uint32_t storage[w * h];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_8888_SkColorType, kPremul_SkAlphaType),
+ storage, w * sizeof(storage[0]));
SkDebugf("pixmap.addr32(1, 2) %c= &storage[1 + 2 * w]\n",
pixmap.addr32(1, 2) == &storage[1 + 2 * w] ? '=' : '!');
#StdOut
@@ -1236,17 +1230,17 @@ built with SK_DEBUG defined.
Will trigger an assert() if Color_Type is not kRGBA_F16_SkColorType and is built
with SK_DEBUG defined.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return readable unsigned 64-bit pointer to pixel at (x, y) ##
#Example
- const int w = 4;
- const int h = 4;
- uint64_t storage[w * h];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_SkAlphaType),
- storage, w * sizeof(storage[0]));
+ const int w = 4;
+ const int h = 4;
+ uint64_t storage[w * h];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_SkAlphaType),
+ storage, w * sizeof(storage[0]));
SkDebugf("pixmap.addr64(1, 2) %c= &storage[1 + 2 * w]\n",
pixmap.addr64(1, 2) == &storage[1 + 2 * w] ? '=' : '!');
#StdOut
@@ -1273,21 +1267,21 @@ with SK_DEBUG defined.
Each unsigned 16-bit word represents one color component encoded as a half float.
Four words correspond to one pixel.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return readable unsigned 16-bit pointer to pixel component at (x, y) ##
#Example
- const int w = 4;
- const int h = 4;
- const int wordsPerPixel = 4;
- const int rowWords = w * wordsPerPixel;
- uint16_t storage[rowWords * h];
- SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_SkAlphaType),
- storage, rowWords * sizeof(storage[0]));
- SkDebugf("pixmap.addrF16(1, 2) %c= &storage[1 * wordsPerPixel + 2 * rowWords]\n",
- pixmap.addrF16(1, 2) == &storage[1 * wordsPerPixel + 2 * rowWords] ? '=' : '!');
+ const int w = 4;
+ const int h = 4;
+ const int wordsPerPixel = 4;
+ const int rowWords = w * wordsPerPixel;
+ uint16_t storage[rowWords * h];
+ SkPixmap pixmap(SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_SkAlphaType),
+ storage, rowWords * sizeof(storage[0]));
+ SkDebugf("pixmap.addrF16(1, 2) %c= &storage[1 * wordsPerPixel + 2 * rowWords]\n",
+ pixmap.addrF16(1, 2) == &storage[1 * wordsPerPixel + 2 * rowWords] ? '=' : '!');
#StdOut
pixmap.addrF16(1, 2) == &storage[1 * wordsPerPixel + 2 * rowWords]
##
@@ -1310,21 +1304,21 @@ Returns writable base pixel address.
#Return writable generic base pointer to pixels ##
#Example
- const int w = 4;
- const int h = 4;
- SkPMColor storage[w * h * 4];
- SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), storage, w * 4);
- SkDebugf("pixmap.writable_addr() %c= (void *)storage\n",
- pixmap.writable_addr() == (void *)storage ? '=' : '!');
- pixmap.erase(0x00000000);
- *(SkPMColor*)pixmap.writable_addr() = 0xFFFFFFFF;
- SkDebugf("pixmap.getColor(0, 1) %c= 0x00000000\n",
- pixmap.getColor(0, 1) == 0x00000000 ? '=' : '!');
- SkDebugf("pixmap.getColor(0, 0) %c= 0xFFFFFFFF\n",
+ const int w = 4;
+ const int h = 4;
+ SkPMColor storage[w * h * 4];
+ SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), storage, w * 4);
+ SkDebugf("pixmap.writable_addr() %c= (void *)storage\n",
+ pixmap.writable_addr() == (void *)storage ? '=' : '!');
+ pixmap.erase(0x00000000);
+ *(SkPMColor*)pixmap.writable_addr() = 0xFFFFFFFF;
+ SkDebugf("pixmap.getColor(0, 1) %c= 0x00000000\n",
+ pixmap.getColor(0, 1) == 0x00000000 ? '=' : '!');
+ SkDebugf("pixmap.getColor(0, 0) %c= 0xFFFFFFFF\n",
pixmap.getColor(0, 0) == 0xFFFFFFFF ? '=' : '!');
#StdOut
-pixmap.writable_addr() == (void *)storage
-pixmap.getColor(0, 1) == 0x00000000
+pixmap.writable_addr() == (void *)storage
+pixmap.getColor(0, 1) == 0x00000000
pixmap.getColor(0, 0) == 0xFFFFFFFF
##
##
@@ -1342,27 +1336,27 @@ Returns writable pixel address at (x, y).
Input is not validated: out of bounds values of x or y trigger an assert() if
built with SK_DEBUG defined. Returns zero if Color_Type is kUnknown_SkColorType.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return writable generic pointer to pixel ##
#Example
- const int w = 4;
- const int h = 4;
- SkPMColor storage[w * h * 4];
- SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), storage, w * 4);
- SkDebugf("pixmap.writable_addr() %c= (void *)storage\n",
- pixmap.writable_addr() == (void *)storage ? '=' : '!');
- pixmap.erase(0x00000000);
- *(SkPMColor*)pixmap.writable_addr(1, 2) = 0xFFFFFFFF;
- SkDebugf("pixmap.getColor(0, 0) %c= 0x00000000\n",
- pixmap.getColor(0, 0) == 0x00000000 ? '=' : '!');
- SkDebugf("pixmap.getColor(1, 2) %c= 0xFFFFFFFF\n",
+ const int w = 4;
+ const int h = 4;
+ SkPMColor storage[w * h * 4];
+ SkPixmap pixmap(SkImageInfo::MakeN32(w, h, kPremul_SkAlphaType), storage, w * 4);
+ SkDebugf("pixmap.writable_addr() %c= (void *)storage\n",
+ pixmap.writable_addr() == (void *)storage ? '=' : '!');
+ pixmap.erase(0x00000000);
+ *(SkPMColor*)pixmap.writable_addr(1, 2) = 0xFFFFFFFF;
+ SkDebugf("pixmap.getColor(0, 0) %c= 0x00000000\n",
+ pixmap.getColor(0, 0) == 0x00000000 ? '=' : '!');
+ SkDebugf("pixmap.getColor(1, 2) %c= 0xFFFFFFFF\n",
pixmap.getColor(1, 2) == 0xFFFFFFFF ? '=' : '!');
#StdOut
-pixmap.writable_addr() == (void *)storage
-pixmap.getColor(0, 0) == 0x00000000
+pixmap.writable_addr() == (void *)storage
+pixmap.getColor(0, 0) == 0x00000000
pixmap.getColor(1, 2) == 0xFFFFFFFF
##
##
@@ -1375,14 +1369,14 @@ pixmap.getColor(1, 2) == 0xFFFFFFFF
#Method uint8_t* writable_addr8(int x, int y) const
-Returns writable base pixel address. Result is addressable as unsigned 8-bit bytes.
-Will trigger an assert() if Color_Type is not kAlpha_8_SkColorType or
-kGray_8_SkColorType, and is built with SK_DEBUG defined.
+Returns writable pixel address at (x, y). Result is addressable as unsigned
+8-bit bytes. Will trigger an assert() if Color_Type is not kAlpha_8_SkColorType
+or kGray_8_SkColorType, and is built with SK_DEBUG defined.
One byte corresponds to one pixel.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return writable unsigned 8-bit pointer to pixels ##
@@ -1393,21 +1387,21 @@ Altering pixels after drawing Bitmap is not guaranteed to affect subsequent
drawing on all platforms. Adding a second SkBitmap::installPixels after editing
pixel memory is safer.
##
-void draw(SkCanvas* canvas) {
- uint8_t storage[][5] = {{ 0, 0, 64, 0, 0},
- { 0, 128, 255, 128, 0},
- {64, 255, 255, 255, 64},
- { 0, 128, 255, 128, 0},
- { 0, 0, 64, 0, 0}};
- SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kPremul_SkAlphaType);
- SkPixmap pixmap(imageInfo, storage[0], 5);
- SkBitmap bitmap;
- bitmap.installPixels(pixmap);
- canvas->scale(10, 10);
- canvas->drawBitmap(bitmap, 0, 0);
- *pixmap.writable_addr8(2, 2) = 0;
-// bitmap.installPixels(pixmap); // uncomment to fix on GPU
- canvas->drawBitmap(bitmap, 10, 0);
+void draw(SkCanvas* canvas) {
+ uint8_t storage[][5] = {{ 0, 0, 64, 0, 0},
+ { 0, 128, 255, 128, 0},
+ {64, 255, 255, 255, 64},
+ { 0, 128, 255, 128, 0},
+ { 0, 0, 64, 0, 0}};
+ SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kPremul_SkAlphaType);
+ SkPixmap pixmap(imageInfo, storage[0], 5);
+ SkBitmap bitmap;
+ bitmap.installPixels(pixmap);
+ canvas->scale(10, 10);
+ canvas->drawBitmap(bitmap, 0, 0);
+ *pixmap.writable_addr8(2, 2) = 0;
+// bitmap.installPixels(pixmap); // uncomment to fix on GPU
+ canvas->drawBitmap(bitmap, 10, 0);
}
##
@@ -1419,14 +1413,14 @@ void draw(SkCanvas* canvas) {
#Method uint16_t* writable_addr16(int x, int y) const
-Returns writable_addr base pixel address. Result is addressable as unsigned 16-bit words.
-Will trigger an assert() if Color_Type is not kRGB_565_SkColorType or
-kARGB_4444_SkColorType, and is built with SK_DEBUG defined.
+Returns writable_addr pixel address at (x, y). Result is addressable as unsigned
+16-bit words. Will trigger an assert() if Color_Type is not kRGB_565_SkColorType
+or kARGB_4444_SkColorType, and is built with SK_DEBUG defined.
One word corresponds to one pixel.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return writable unsigned 16-bit pointer to pixel ##
@@ -1436,19 +1430,19 @@ Draw a five by five bitmap, and draw it again with a center black pixel.
The low nibble of the 16-bit word is Alpha.
##
#Height 64
- uint16_t storage[][5] = {{ 0xCABF, 0xDABE, 0xCA9D, 0xC96C, 0xA39B },
- { 0xACEE, 0xA87C, 0x893A, 0x4779, 0x8708 },
- { 0x4B7C, 0x255B, 0x2559, 0x2557, 0x4656 },
- { 0x9099, 0x8128, 0x2557, 0x4124, 0x3323 },
- { 0x7547, 0x5505, 0x4434, 0x2012, 0x0000 }};
- SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kARGB_4444_SkColorType, kPremul_SkAlphaType);
- SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);
- SkBitmap bitmap;
- bitmap.installPixels(pixmap);
- canvas->scale(10, 10);
- canvas->drawBitmap(bitmap, 0, 0);
- *pixmap.writable_addr16(2, 2) = 0x000F;
- bitmap.installPixels(pixmap);
+ uint16_t storage[][5] = {{ 0xCABF, 0xDABE, 0xCA9D, 0xC96C, 0xA39B },
+ { 0xACEE, 0xA87C, 0x893A, 0x4779, 0x8708 },
+ { 0x4B7C, 0x255B, 0x2559, 0x2557, 0x4656 },
+ { 0x9099, 0x8128, 0x2557, 0x4124, 0x3323 },
+ { 0x7547, 0x5505, 0x4434, 0x2012, 0x0000 }};
+ SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kARGB_4444_SkColorType, kPremul_SkAlphaType);
+ SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);
+ SkBitmap bitmap;
+ bitmap.installPixels(pixmap);
+ canvas->scale(10, 10);
+ canvas->drawBitmap(bitmap, 0, 0);
+ *pixmap.writable_addr16(2, 2) = 0x000F;
+ bitmap.installPixels(pixmap);
canvas->drawBitmap(bitmap, 10, 0);
##
@@ -1460,35 +1454,36 @@ The low nibble of the 16-bit word is Alpha.
#Method uint32_t* writable_addr32(int x, int y) const
-Returns writable base pixel address. Result is addressable as unsigned 32-bit words.
-Will trigger an assert() if Color_Type is not kRGBA_8888_SkColorType or
-kBGRA_8888_SkColorType, and is built with SK_DEBUG defined.
+Returns writable pixel address at (x, y). Result is addressable as unsigned
+32-bit words. Will trigger an assert() if Color_Type is not
+kRGBA_8888_SkColorType or kBGRA_8888_SkColorType, and is built with SK_DEBUG
+defined.
One word corresponds to one pixel.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return writable unsigned 32-bit pointer to pixel ##
#Example
#Image 4
#Height 72
- std::vector<int32_t> pixels;
- pixels.resize(image->height() * image->width() * 4);
- SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
- image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
- image->readPixels(pixmap, 0, 0);
- for (int y = 0; y < pixmap.height() / 2; ++y) {
- for (int x = 0; x < pixmap.width(); ++x) {
- if ((x & 4) == (y & 4)) {
- SkTSwap(*pixmap.writable_addr32(x, y),
- *pixmap.writable_addr32(pixmap.width() - x, pixmap.height() - y));
- }
- }
- }
- SkBitmap bitmap;
- bitmap.installPixels(pixmap);
+ std::vector<int32_t> pixels;
+ pixels.resize(image->height() * image->width() * 4);
+ SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
+ image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
+ image->readPixels(pixmap, 0, 0);
+ for (int y = 0; y < pixmap.height() / 2; ++y) {
+ for (int x = 0; x < pixmap.width(); ++x) {
+ if ((x & 4) == (y & 4)) {
+ SkTSwap(*pixmap.writable_addr32(x, y),
+ *pixmap.writable_addr32(pixmap.width() - x, pixmap.height() - y));
+ }
+ }
+ }
+ SkBitmap bitmap;
+ bitmap.installPixels(pixmap);
canvas->drawBitmap(bitmap, 0, 0);
##
@@ -1500,29 +1495,29 @@ One word corresponds to one pixel.
#Method uint64_t* writable_addr64(int x, int y) const
-Returns writable base pixel address. Result is addressable as unsigned 64-bit words.
-Will trigger an assert() if Color_Type is not kRGBA_F16_SkColorType and is built
-with SK_DEBUG defined.
+Returns writable pixel address at (x, y). Result is addressable as unsigned
+64-bit words. Will trigger an assert() if Color_Type is not
+kRGBA_F16_SkColorType and is built with SK_DEBUG defined.
One word corresponds to one pixel.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return writable unsigned 64-bit pointer to pixel ##
#Example
- SkImageInfo info = SkImageInfo::Make(3, 3, kRGBA_F16_SkColorType, kPremul_SkAlphaType);
- uint64_t storage[9];
- SkPixmap pixmap(info, storage, 3 * sizeof(uint64_t));
- SkColor4f c4 { 1, 0.45f, 0.25f, 0.65f };
- pixmap.erase(c4);
- SkBitmap bitmap;
- canvas->scale(10, 10);
- bitmap.installPixels(pixmap);
- canvas->drawBitmap(bitmap, 0, 0);
- *pixmap.writable_addr64(1, 1) |= 0x00ff000000000000LL;
- bitmap.installPixels(pixmap);
+ SkImageInfo info = SkImageInfo::Make(3, 3, kRGBA_F16_SkColorType, kPremul_SkAlphaType);
+ uint64_t storage[9];
+ SkPixmap pixmap(info, storage, 3 * sizeof(uint64_t));
+ SkColor4f c4 { 1, 0.45f, 0.25f, 0.65f };
+ pixmap.erase(c4);
+ SkBitmap bitmap;
+ canvas->scale(10, 10);
+ bitmap.installPixels(pixmap);
+ canvas->drawBitmap(bitmap, 0, 0);
+ *pixmap.writable_addr64(1, 1) |= 0x00ff000000000000LL;
+ bitmap.installPixels(pixmap);
canvas->drawBitmap(bitmap, 10, 0);
##
@@ -1534,15 +1529,15 @@ One word corresponds to one pixel.
#Method uint16_t* writable_addrF16(int x, int y) const
-Returns writable base pixel address. Result is addressable as unsigned 16-bit words.
-Will trigger an assert() if Color_Type is not kRGBA_F16_SkColorType and is built
-with SK_DEBUG defined.
+Returns writable pixel address at (x, y). Result is addressable as unsigned
+16-bit words. Will trigger an assert() if Color_Type is not
+kRGBA_F16_SkColorType and is built with SK_DEBUG defined.
Each word represents one color component encoded as a half float.
Four words correspond to one pixel.
-#Param x positive column index less than width() ##
-#Param y positive row index less than height() ##
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
#Return writable unsigned 16-bit pointer to first component of pixel ##
@@ -1552,23 +1547,23 @@ Four words correspond to one pixel.
Left bitmap is drawn with two pixels defined in half float format. Right bitmap
is drawn after overwriting bottom half float color with top half float color.
##
- SkImageInfo info = SkImageInfo::Make(1, 2, kRGBA_F16_SkColorType, kPremul_SkAlphaType);
- uint16_t storage[2][4];
- SkPixmap pixmap(info, storage[0], sizeof(uint64_t));
- SkIRect topPixelBounds = {0, 0, 1, 1};
- pixmap.erase({ 0.65f, 0.45f, 0.25f, 1 }, &topPixelBounds);
- SkIRect bottomPixelBounds = {0, 1, 1, 2};
- pixmap.erase({ 0.25f, 0.65f, 0.45f, 1 }, &bottomPixelBounds);
- SkBitmap bitmap;
- canvas->scale(20, 20);
- bitmap.installPixels(pixmap);
- canvas->drawBitmap(bitmap, 0, 0);
- uint16_t* pixel2 = pixmap.writable_addrF16(0, 1);
- for (int i = 0; i < 4; ++i) {
- pixel2[i] = storage[0][i];
- }
- bitmap.installPixels(pixmap);
- canvas->drawBitmap(bitmap, 4, 0);
+ SkImageInfo info = SkImageInfo::Make(1, 2, kRGBA_F16_SkColorType, kPremul_SkAlphaType);
+ uint16_t storage[2][4];
+ SkPixmap pixmap(info, storage[0], sizeof(uint64_t));
+ SkIRect topPixelBounds = {0, 0, 1, 1};
+ pixmap.erase({ 0.65f, 0.45f, 0.25f, 1 }, &topPixelBounds);
+ SkIRect bottomPixelBounds = {0, 1, 1, 2};
+ pixmap.erase({ 0.25f, 0.65f, 0.45f, 1 }, &bottomPixelBounds);
+ SkBitmap bitmap;
+ canvas->scale(20, 20);
+ bitmap.installPixels(pixmap);
+ canvas->drawBitmap(bitmap, 0, 0);
+ uint16_t* pixel2 = pixmap.writable_addrF16(0, 1);
+ for (int i = 0; i < 4; ++i) {
+ pixel2[i] = storage[0][i];
+ }
+ bitmap.installPixels(pixmap);
+ canvas->drawBitmap(bitmap, 4, 0);
##
#SeeAlso writable_addr writable_addr8 writable_addr16 writable_addr32 writable_addr64 addr() addrF16
@@ -1584,12 +1579,13 @@ 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
+Copies a Rect of pixels to dstPixels. Copy starts at (srcX, srcY), and does not exceed
#Formula
(this->width(), this->height())
##
-. dstInfo specifies width, height, Color_Type, Alpha_Type, and
+.
+
+dstInfo specifies width, height, Color_Type, Alpha_Type, and
Color_Space of destination. dstRowBytes specifics the gap from one destination
row to the next. Returns true if pixels are copied. Returns false if
dstInfo.addr() equals nullptr, or dstRowBytes is less than dstInfo.minRowBytes.
@@ -1604,7 +1600,11 @@ false if pixel conversion is not possible.
srcX and srcY may be negative to copy only top or left of source. Returns
false if width() or height() is zero or negative. Returns false if
#Formula
-abs(srcX) >= this->width() || abs(scrY) >= this->height()
+abs(srcX) >= this->width()
+##
+, or if
+#Formula
+abs(srcY) >= this->height()
##
.
@@ -1629,17 +1629,17 @@ pixels are treated as if they are linear, regardless of their encoding.
void draw(SkCanvas* canvas) {
SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height(),
canvas->imageInfo().colorSpace() ? SkColorSpace::MakeSRGB() : nullptr);
- std::vector<int32_t> srcPixels;
- srcPixels.resize(image->height() * image->width() * 4);
- SkPixmap pixmap(info, (const void*) &srcPixels.front(), image->width() * 4);
- image->readPixels(pixmap, 0, 0);
+ std::vector<int32_t> srcPixels;
+ srcPixels.resize(image->height() * image->width() * 4);
+ SkPixmap pixmap(info, (const void*) &srcPixels.front(), image->width() * 4);
+ image->readPixels(pixmap, 0, 0);
SkTransferFunctionBehavior behavior = canvas->imageInfo().colorSpace() ?
SkTransferFunctionBehavior::kRespect : SkTransferFunctionBehavior::kIgnore;
- std::vector<int32_t> dstPixels;
- dstPixels.resize(image->height() * image->width() * 4);
- int offset = 0;
- for (auto behavior : { SkTransferFunctionBehavior::kRespect,
- SkTransferFunctionBehavior::kIgnore} ) {
+ std::vector<int32_t> dstPixels;
+ dstPixels.resize(image->height() * image->width() * 4);
+ int offset = 0;
+ for (auto behavior : { SkTransferFunctionBehavior::kRespect,
+ SkTransferFunctionBehavior::kIgnore} ) {
pixmap.readPixels(info, &dstPixels.front(), image->width() * 4, offset, 0, behavior);
offset += 128;
}
@@ -1663,7 +1663,9 @@ exceed
#Formula
(this->width(), this->height())
##
-. dstInfo specifies width, height, Color_Type, Alpha_Type, and
+.
+
+dstInfo specifies width, height, Color_Type, Alpha_Type, and
Color_Space of destination. dstRowBytes specifics the gap from one destination
row to the next. Returns true if pixels are copied. Returns false if
dstInfo.addr() equals nullptr, or dstRowBytes is less than dstInfo.minRowBytes.
@@ -1689,28 +1691,28 @@ Returns false if this->width() or this->height() is zero or negative.
Transferring the gradient from 8 bits per component to 4 bits per component
creates visible banding.
##
- std::vector<int32_t> pixels;
- const int width = 256;
- const int height = 64;
- pixels.resize(height * width * 4);
- SkImageInfo srcInfo = SkImageInfo::MakeN32Premul(width, height);
- SkPixmap srcPixmap(srcInfo, (const void*) &pixels.front(), width * 4);
- SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 };
- SkPoint gradPoints[] = { { 0, 0 }, { 256, 0 } };
- SkPaint paint;
- paint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
- SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
- SkBitmap bitmap;
- bitmap.installPixels(srcPixmap);
- SkCanvas srcCanvas(bitmap);
- srcCanvas.drawRect(SkRect::MakeWH(width, height), paint);
- canvas->drawBitmap(bitmap, 0, 0);
- std::vector<int32_t> dstPixels;
- dstPixels.resize(height * width * 2);
- SkImageInfo dstInfo = srcInfo.makeColorType(kARGB_4444_SkColorType);
- srcPixmap.readPixels(dstInfo, &dstPixels.front(), width * 2);
- SkPixmap dstPixmap(dstInfo, &dstPixels.front(), width * 2);
- bitmap.installPixels(dstPixmap);
+ std::vector<int32_t> pixels;
+ const int width = 256;
+ const int height = 64;
+ pixels.resize(height * width * 4);
+ SkImageInfo srcInfo = SkImageInfo::MakeN32Premul(width, height);
+ SkPixmap srcPixmap(srcInfo, (const void*) &pixels.front(), width * 4);
+ SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 };
+ SkPoint gradPoints[] = { { 0, 0 }, { 256, 0 } };
+ SkPaint paint;
+ paint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
+ SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
+ SkBitmap bitmap;
+ bitmap.installPixels(srcPixmap);
+ SkCanvas srcCanvas(bitmap);
+ srcCanvas.drawRect(SkRect::MakeWH(width, height), paint);
+ canvas->drawBitmap(bitmap, 0, 0);
+ std::vector<int32_t> dstPixels;
+ dstPixels.resize(height * width * 2);
+ SkImageInfo dstInfo = srcInfo.makeColorType(kARGB_4444_SkColorType);
+ srcPixmap.readPixels(dstInfo, &dstPixels.front(), width * 2);
+ SkPixmap dstPixmap(dstInfo, &dstPixels.front(), width * 2);
+ bitmap.installPixels(dstPixmap);
canvas->drawBitmap(bitmap, 0, 128);
##
@@ -1728,7 +1730,9 @@ exceed
#Formula
(this->width(), this->height())
##
-. dstInfo specifies width, height, Color_Type, Alpha_Type, and
+.
+
+dstInfo specifies width, height, Color_Type, Alpha_Type, and
Color_Space of destination. dstRowBytes specifics the gap from one destination
row to the next. Returns true if pixels are copied. Returns false if
dstInfo.addr() equals nullptr, or dstRowBytes is less than dstInfo.minRowBytes.
@@ -1743,7 +1747,11 @@ 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
#Formula
-abs(srcX) >= this->width() || abs(scrY) >= this->height()
+abs(srcX) >= this->width()
+##
+, or if
+#Formula
+abs(srcY) >= this->height()
##
.
@@ -1757,23 +1765,23 @@ abs(srcX) >= this->width() || abs(scrY) >= this->height()
#Example
#Image 3
-void draw(SkCanvas* canvas) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
- std::vector<int32_t> srcPixels;
- const int rowBytes = image->width() * 4;
- srcPixels.resize(image->height() * rowBytes);
- SkPixmap pixmap(info, (const void*) &srcPixels.front(), rowBytes);
- image->readPixels(pixmap, 0, 0);
- for (int offset : { 32, 64, 96 } ) {
- std::vector<int32_t> dstPixels;
- dstPixels.resize(image->height() * rowBytes);
- pixmap.readPixels(info, &dstPixels.front(), rowBytes, offset, 0);
- SkBitmap bitmap;
- SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
- bitmap.installPixels(dstmap);
- canvas->translate(32, 32);
- canvas->drawBitmap(bitmap, 0, 0);
- }
+void draw(SkCanvas* canvas) {
+ SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
+ std::vector<int32_t> srcPixels;
+ const int rowBytes = image->width() * 4;
+ srcPixels.resize(image->height() * rowBytes);
+ SkPixmap pixmap(info, (const void*) &srcPixels.front(), rowBytes);
+ image->readPixels(pixmap, 0, 0);
+ for (int offset : { 32, 64, 96 } ) {
+ std::vector<int32_t> dstPixels;
+ dstPixels.resize(image->height() * rowBytes);
+ pixmap.readPixels(info, &dstPixels.front(), rowBytes, offset, 0);
+ SkBitmap bitmap;
+ SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
+ bitmap.installPixels(dstmap);
+ canvas->translate(32, 32);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
}
##
@@ -1801,7 +1809,11 @@ 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
#Formula
-abs(srcX) >= this->width() || abs(scrY) >= this->height()
+abs(srcX) >= this->width()
+##
+, or if
+#Formula
+abs(srcY) >= this->height()
##
.
@@ -1813,23 +1825,23 @@ abs(srcX) >= this->width() || abs(scrY) >= this->height()
#Example
#Image 3
-void draw(SkCanvas* canvas) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
- std::vector<int32_t> srcPixels;
- const int rowBytes = image->width() * 4;
- srcPixels.resize(image->height() * rowBytes);
- SkPixmap pixmap(info, (const void*) &srcPixels.front(), rowBytes);
- image->readPixels(pixmap, 0, 0);
- for (int offset : { 32, 64, 96 } ) {
- std::vector<int32_t> dstPixels;
- dstPixels.resize(image->height() * rowBytes);
- SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
- pixmap.readPixels(dstmap, offset, 0);
- SkBitmap bitmap;
- bitmap.installPixels(dstmap);
- canvas->translate(32, 32);
- canvas->drawBitmap(bitmap, 0, 0);
- }
+void draw(SkCanvas* canvas) {
+ SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
+ std::vector<int32_t> srcPixels;
+ const int rowBytes = image->width() * 4;
+ srcPixels.resize(image->height() * rowBytes);
+ SkPixmap pixmap(info, (const void*) &srcPixels.front(), rowBytes);
+ image->readPixels(pixmap, 0, 0);
+ for (int offset : { 32, 64, 96 } ) {
+ std::vector<int32_t> dstPixels;
+ dstPixels.resize(image->height() * rowBytes);
+ SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
+ pixmap.readPixels(dstmap, offset, 0);
+ SkBitmap bitmap;
+ bitmap.installPixels(dstmap);
+ canvas->translate(32, 32);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
}
##
@@ -1861,23 +1873,23 @@ Returns false if this->width() or this->height() is zero or negative.
#Example
#Image 3
-void draw(SkCanvas* canvas) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
- std::vector<int32_t> srcPixels;
- const int rowBytes = image->width() * 4;
- srcPixels.resize(image->height() * rowBytes);
- SkPixmap pixmap(info, (const void*) &srcPixels.front(), rowBytes);
- image->readPixels(pixmap, 0, 0);
- for (int index = 0; index < 3; ++index ) {
- std::vector<int32_t> dstPixels;
- dstPixels.resize(image->height() * rowBytes);
- SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
- pixmap.readPixels(dstmap);
- SkBitmap bitmap;
- bitmap.installPixels(dstmap);
- canvas->translate(32, 32);
- canvas->drawBitmap(bitmap, 0, 0);
- }
+void draw(SkCanvas* canvas) {
+ SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
+ std::vector<int32_t> srcPixels;
+ const int rowBytes = image->width() * 4;
+ srcPixels.resize(image->height() * rowBytes);
+ SkPixmap pixmap(info, (const void*) &srcPixels.front(), rowBytes);
+ image->readPixels(pixmap, 0, 0);
+ for (int index = 0; index < 3; ++index ) {
+ std::vector<int32_t> dstPixels;
+ dstPixels.resize(image->height() * rowBytes);
+ SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
+ pixmap.readPixels(dstmap);
+ SkBitmap bitmap;
+ bitmap.installPixels(dstmap);
+ canvas->translate(32, 32);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
}
##
@@ -1919,25 +1931,25 @@ kHigh_SkFilterQuality is slowest, typically implemented with Filter_Quality_BiCu
#Example
#Image 3
-void draw(SkCanvas* canvas) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
- std::vector<int32_t> srcPixels;
- int rowBytes = image->width() * 4;
- srcPixels.resize(image->height() * rowBytes);
- SkPixmap pixmap(info, (const void*) &srcPixels.front(), rowBytes);
- image->readPixels(pixmap, 0, 0);
- for (int offset : { 32, 64, 96 } ) {
- info = SkImageInfo::MakeN32Premul(image->width() + offset, image->height());
- rowBytes = info.width() * 4;
- std::vector<int32_t> dstPixels;
- dstPixels.resize(image->height() * rowBytes);
- SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
- pixmap.scalePixels(dstmap, kMedium_SkFilterQuality);
- SkBitmap bitmap;
- bitmap.installPixels(dstmap);
- canvas->translate(32, 32);
- canvas->drawBitmap(bitmap, 0, 0);
- }
+void draw(SkCanvas* canvas) {
+ SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
+ std::vector<int32_t> srcPixels;
+ int rowBytes = image->width() * 4;
+ srcPixels.resize(image->height() * rowBytes);
+ SkPixmap pixmap(info, (const void*) &srcPixels.front(), rowBytes);
+ image->readPixels(pixmap, 0, 0);
+ for (int offset : { 32, 64, 96 } ) {
+ info = SkImageInfo::MakeN32Premul(image->width() + offset, image->height());
+ rowBytes = info.width() * 4;
+ std::vector<int32_t> dstPixels;
+ dstPixels.resize(image->height() * rowBytes);
+ SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
+ pixmap.scalePixels(dstmap, kMedium_SkFilterQuality);
+ SkBitmap bitmap;
+ bitmap.installPixels(dstmap);
+ canvas->translate(32, 32);
+ canvas->drawBitmap(bitmap, 0, 0);
+ }
}
##
@@ -1959,15 +1971,15 @@ not intersect bounds().
#Return true if pixels are changed ##
#Example
- uint32_t storage[2];
- SkImageInfo info = SkImageInfo::MakeN32Premul(1, 2);
- SkPixmap pixmap(info, storage, info.minRowBytes());
- pixmap.erase(SK_ColorBLUE, {0, 0, 1, 1});
- pixmap.erase(SK_ColorRED, {0, 1, 1, 2});
- SkBitmap bitmap;
- canvas->scale(20, 20);
- bitmap.installPixels(pixmap);
- canvas->drawBitmap(bitmap, 0, 0);
+ uint32_t storage[2];
+ SkImageInfo info = SkImageInfo::MakeN32Premul(1, 2);
+ SkPixmap pixmap(info, storage, info.minRowBytes());
+ pixmap.erase(SK_ColorBLUE, {0, 0, 1, 1});
+ pixmap.erase(SK_ColorRED, {0, 1, 1, 2});
+ SkBitmap bitmap;
+ canvas->scale(20, 20);
+ bitmap.installPixels(pixmap);
+ canvas->drawBitmap(bitmap, 0, 0);
##
#SeeAlso SkBitmap::erase SkCanvas::clear SkCanvas::drawColor
@@ -1987,14 +1999,14 @@ is empty.
#Return true if pixels are changed ##
#Example
- uint32_t storage[2];
- SkImageInfo info = SkImageInfo::MakeN32Premul(1, 2);
- SkPixmap pixmap(info, storage, info.minRowBytes());
- pixmap.erase(SK_ColorBLUE);
- SkBitmap bitmap;
- canvas->scale(20, 20);
- bitmap.installPixels(pixmap);
- canvas->drawBitmap(bitmap, 0, 0);
+ uint32_t storage[2];
+ SkImageInfo info = SkImageInfo::MakeN32Premul(1, 2);
+ SkPixmap pixmap(info, storage, info.minRowBytes());
+ pixmap.erase(SK_ColorBLUE);
+ SkBitmap bitmap;
+ canvas->scale(20, 20);
+ bitmap.installPixels(pixmap);
+ canvas->drawBitmap(bitmap, 0, 0);
##
#SeeAlso SkBitmap::erase SkCanvas::clear SkCanvas::drawColor
@@ -2016,17 +2028,17 @@ not intersect bounds(), or if subset is nullptr and bounds() is empty.
#Return true if pixels are changed ##
#Example
- uint32_t storage[2];
- SkImageInfo info = SkImageInfo::MakeN32Premul(1, 2);
- SkPixmap pixmap(info, storage, info.minRowBytes());
- SkIRect topPixelBounds = {0, 0, 1, 1};
- pixmap.erase({ 0.65f, 0.45f, 0.25f, 1 }, &topPixelBounds);
- SkIRect bottomPixelBounds = {0, 1, 1, 2};
- pixmap.erase({ 0.25f, 0.65f, 0.45f, 1 }, &bottomPixelBounds);
- SkBitmap bitmap;
- canvas->scale(20, 20);
- bitmap.installPixels(pixmap);
- canvas->drawBitmap(bitmap, 0, 0);
+ uint32_t storage[2];
+ SkImageInfo info = SkImageInfo::MakeN32Premul(1, 2);
+ SkPixmap pixmap(info, storage, info.minRowBytes());
+ SkIRect topPixelBounds = {0, 0, 1, 1};
+ pixmap.erase({ 0.65f, 0.45f, 0.25f, 1 }, &topPixelBounds);
+ SkIRect bottomPixelBounds = {0, 1, 1, 2};
+ pixmap.erase({ 0.25f, 0.65f, 0.45f, 1 }, &bottomPixelBounds);
+ SkBitmap bitmap;
+ canvas->scale(20, 20);
+ bitmap.installPixels(pixmap);
+ canvas->drawBitmap(bitmap, 0, 0);
##
#SeeAlso SkBitmap::erase SkCanvas::clear SkCanvas::drawColor
diff --git a/docs/usingBookmaker.bmh b/docs/usingBookmaker.bmh
index 16775c5716..4e1f84b864 100644
--- a/docs/usingBookmaker.bmh
+++ b/docs/usingBookmaker.bmh
@@ -10,7 +10,9 @@ Visual_Studio
How to use the Bookmaker utility.
-Install #A Go # https://golang.org/doc/install ## if needed.
+Install
+#A Go # https://golang.org/doc/install ##
+ if needed.
Get the fiddle command line interface tool.
By default this will appear in your home directory.
@@ -132,7 +134,9 @@ to write the updated SkXXX.h to the current directory.
#Subtopic Bugs
-Bookmaker bugs are tracked #A here # bug.skia.org/6898 ##.
+Bookmaker bugs are tracked
+#A here # bug.skia.org/6898 ##
+.
##
diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md
index 32990c663a..f07ed00130 100644
--- a/site/user/api/SkCanvas_Reference.md
+++ b/site/user/api/SkCanvas_Reference.md
@@ -877,8 +877,9 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
</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()).
-Destination rectangle corners are (0, 0) and(<a href="#SkCanvas_readPixels_dstInfo">dstInfo</a>.width(), <a href="#SkCanvas_readPixels_dstInfo">dstInfo</a>.height()).
+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()).
+
+Destination rectangle 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.
@@ -958,7 +959,8 @@ bool readPixels(const SkPixmap& pixmap, int srcX, int srcY)
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()).
-Destination rectangle are (0, 0) and(<a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>.width(), <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a>.height()).
+
+Destination rectangle 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.
@@ -967,7 +969,7 @@ Pixels are not readable when <a href="#SkCanvas">SkCanvas</a> is returned by <a
returned by <a href="#SkPictureRecorder_beginRecording">SkPictureRecorder::beginRecording</a>, or <a href="#Canvas">Canvas</a> is the base of a utility
class like <a href="undocumented#SkDumpCanvas">SkDumpCanvas</a>.
-Allocates pixel storage in <a href="#SkCanvas_readPixels_2_pixmap">pixmap</a> if needed.
+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
@@ -1026,6 +1028,7 @@ bool readPixels(const SkBitmap& bitmap, int srcX, int srcY)
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()).
+
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()).
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.
@@ -1035,7 +1038,7 @@ Pixels are not readable when <a href="#SkCanvas">SkCanvas</a> is returned by <a
returned by <a href="#SkPictureRecorder_beginRecording">SkPictureRecorder::beginRecording</a>, or <a href="#Canvas">Canvas</a> is the base of a utility
class like <a href="undocumented#SkDumpCanvas">SkDumpCanvas</a>.
-Allocates pixel storage in <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a> if needed.
+Caller must allocate pixel storage in <a href="#SkCanvas_readPixels_3_bitmap">bitmap</a> if needed.
<a href="undocumented#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
@@ -1098,9 +1101,10 @@ bool writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes,
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 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.
+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 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.
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>,
@@ -1118,7 +1122,8 @@ Does not copy, and returns false if:
<table> <tr>
<td>Source and destination rectangles do not intersect.</td> </tr> <tr>
- <td><a href="#SkCanvas_writePixels_pixels">pixels</a> could not be converted tothis-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType()orthis-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType().</td> </tr> <tr>
+ <td><a href="#SkCanvas_writePixels_pixels">pixels</a> could not be converted to this-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() or
+this-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType().</td> </tr> <tr>
<td><a href="#Canvas">Canvas</a> <a href="#SkCanvas_writePixels_pixels">pixels</a> are not writable; for instance, <a href="#Canvas">Canvas</a> is document-based.</td> </tr> <tr>
<td><a href="#SkCanvas_writePixels_rowBytes">rowBytes</a> is too small to contain one row of <a href="#SkCanvas_writePixels_pixels">pixels</a>.</td> </tr>
</table>
@@ -1157,11 +1162,12 @@ 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()).
+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()).
+
+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 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()).
-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.
+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.
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>,
@@ -1180,7 +1186,8 @@ Does not copy, and returns false if:
<table> <tr>
<td>Source and destination rectangles do not intersect.</td> </tr> <tr>
<td><a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> does not have allocated pixels.</td> </tr> <tr>
- <td><a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> pixels could not be converted tothis-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType()orthis-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType().</td> </tr> <tr>
+ <td><a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> pixels could not be converted to this-><a href="#SkCanvas_imageInfo">imageInfo</a>.colorType() or
+this-><a href="#SkCanvas_imageInfo">imageInfo</a>.alphaType().</td> </tr> <tr>
<td><a href="#Canvas">Canvas</a> pixels are not writable; for instance, <a href="#Canvas">Canvas</a> is document based.</td> </tr> <tr>
<td><a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> pixels are inaccessible; for instance, <a href="#SkCanvas_writePixels_2_bitmap">bitmap</a> wraps a texture.</td> </tr>
</table>
@@ -1482,7 +1489,7 @@ Call <a href="#SkCanvas_restoreToCount">restoreToCount</a> with returned value t
Draw text on an opaque background so that <a href="SkPaint_Reference#LCD_Text">LCD Text</a> blends correctly with the
prior <a href="#Layer">Layer</a>. <a href="SkPaint_Reference#LCD_Text">LCD Text</a> drawn on a background with transparency may result in
-incorrect banding.
+incorrect blending.
### Parameters
@@ -4059,6 +4066,7 @@ grid entries.
Optional array of <a href="#SkCanvas_Lattice_Flags">Flags</a>, one per rectangular grid entry:
array length must be( <a href="#SkCanvas_Lattice_fXCount">fXCount</a> + 1) * (<a href="#SkCanvas_Lattice_fYCount">fYCount</a> + 1).
+
Array entries correspond to the rectangular grid entries, ascending
left to right and then top to bottom.
@@ -4903,15 +4911,15 @@ If <a href="#SkCanvas_drawAtlas_cullRect">cullRect</a> is outside of <a href="#C
</tr> <tr> <td><a name="SkCanvas_drawAtlas_tex"> <code><strong>tex </strong></code> </a></td> <td>
<a href="undocumented#Rect">Rect</a> locations of sprites in <a href="#SkCanvas_drawAtlas_atlas">atlas</a></td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_colors"> <code><strong>colors </strong></code> </a></td> <td>
-<a href="undocumented#Color">Color</a>, one per sprite, blended with sprite using <a href="undocumented#Blend_Mode">Blend Mode</a>; may be nullptr</td>
+one per sprite, blended with sprite using <a href="undocumented#Blend_Mode">Blend Mode</a>; may be nullptr</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_count"> <code><strong>count </strong></code> </a></td> <td>
number of sprites to draw</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_mode"> <code><strong>mode </strong></code> </a></td> <td>
<a href="undocumented#Blend_Mode">Blend Mode</a> combining <a href="#SkCanvas_drawAtlas_colors">colors</a> and sprites</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_cullRect"> <code><strong>cullRect </strong></code> </a></td> <td>
-<a href="undocumented#Rect">Rect</a> bounds of transformed sprites for efficient clipping; may be nullptr</td>
+bounds of transformed sprites for efficient clipping; may be nullptr</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_paint"> <code><strong>paint </strong></code> </a></td> <td>
-<a href="SkPaint_Reference#Paint">Paint</a> <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and so on; may be nullptr</td>
+<a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and so on; may be nullptr</td>
</tr>
</table>
@@ -4946,15 +4954,15 @@ If <a href="#SkCanvas_drawAtlas_2_cullRect">cullRect</a> is outside of <a href="
</tr> <tr> <td><a name="SkCanvas_drawAtlas_2_tex"> <code><strong>tex </strong></code> </a></td> <td>
<a href="undocumented#Rect">Rect</a> locations of sprites in <a href="#SkCanvas_drawAtlas_2_atlas">atlas</a></td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_2_colors"> <code><strong>colors </strong></code> </a></td> <td>
-<a href="undocumented#Color">Color</a>, one per sprite, blended with sprite using <a href="undocumented#Blend_Mode">Blend Mode</a>; may be nullptr</td>
+one per sprite, blended with sprite using <a href="undocumented#Blend_Mode">Blend Mode</a>; may be nullptr</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_2_count"> <code><strong>count </strong></code> </a></td> <td>
number of sprites to draw</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_2_mode"> <code><strong>mode </strong></code> </a></td> <td>
<a href="undocumented#Blend_Mode">Blend Mode</a> combining <a href="#SkCanvas_drawAtlas_2_colors">colors</a> and sprites</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_2_cullRect"> <code><strong>cullRect </strong></code> </a></td> <td>
-<a href="undocumented#Rect">Rect</a> bounds of transformed sprites for efficient clipping; may be nullptr</td>
+bounds of transformed sprites for efficient clipping; may be nullptr</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_2_paint"> <code><strong>paint </strong></code> </a></td> <td>
-<a href="SkPaint_Reference#Paint">Paint</a> <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and so on; may be nullptr</td>
+<a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and so on; may be nullptr</td>
</tr>
</table>
@@ -4989,9 +4997,9 @@ If <a href="#SkCanvas_drawAtlas_3_cullRect">cullRect</a> is outside of <a href="
</tr> <tr> <td><a name="SkCanvas_drawAtlas_3_count"> <code><strong>count </strong></code> </a></td> <td>
number of sprites to draw</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_3_cullRect"> <code><strong>cullRect </strong></code> </a></td> <td>
-<a href="undocumented#Rect">Rect</a> bounds of transformed sprites for efficient clipping; may be nullptr</td>
+bounds of transformed sprites for efficient clipping; may be nullptr</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_3_paint"> <code><strong>paint </strong></code> </a></td> <td>
-<a href="SkPaint_Reference#Paint">Paint</a> <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and so on; may be nullptr</td>
+<a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and so on; may be nullptr</td>
</tr>
</table>
@@ -5027,9 +5035,9 @@ If <a href="#SkCanvas_drawAtlas_4_cullRect">cullRect</a> is outside of <a href="
</tr> <tr> <td><a name="SkCanvas_drawAtlas_4_count"> <code><strong>count </strong></code> </a></td> <td>
number of sprites to draw</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_4_cullRect"> <code><strong>cullRect </strong></code> </a></td> <td>
-<a href="undocumented#Rect">Rect</a> bounds of transformed sprites for efficient clipping; may be nullptr</td>
+bounds of transformed sprites for efficient clipping; may be nullptr</td>
</tr> <tr> <td><a name="SkCanvas_drawAtlas_4_paint"> <code><strong>paint </strong></code> </a></td> <td>
-<a href="SkPaint_Reference#Paint">Paint</a> <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and so on; may be nullptr</td>
+<a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and so on; may be nullptr</td>
</tr>
</table>
diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md
index a1f2b8bbef..d7ba1e232a 100644
--- a/site/user/api/SkPaint_Reference.md
+++ b/site/user/api/SkPaint_Reference.md
@@ -2384,6 +2384,7 @@ enum <a href="#SkPaint_Cap">Cap</a> {
<a href="#SkPaint_kLast_Cap">kLast Cap</a> = <a href="#SkPaint_kSquare_Cap">kSquare Cap</a>,
<a href="#SkPaint_kDefault_Cap">kDefault Cap</a> = <a href="#SkPaint_kButt_Cap">kButt Cap</a>,
};
+
static constexpr int <a href="#SkPaint_kCapCount">kCapCount</a> = <a href="#SkPaint_kLast_Cap">kLast Cap</a> + 1;</pre>
<a href="#Stroke_Cap">Stroke Cap</a> draws at the beginning and end of an open <a href="#Contour">Path Contour</a>.
@@ -2528,6 +2529,7 @@ enum <a href="#SkPaint_Join">Join</a> {
<a href="#SkPaint_kLast_Join">kLast Join</a> = <a href="#SkPaint_kBevel_Join">kBevel Join</a>,
<a href="#SkPaint_kDefault_Join">kDefault Join</a> = <a href="#SkPaint_kMiter_Join">kMiter Join</a>,
};
+
static constexpr int <a href="#SkPaint_kJoinCount">kJoinCount</a> = <a href="#SkPaint_kLast_Join">kLast Join</a> + 1;</pre>
<a href="#SkPaint_Join">Join</a> specifies how corners are drawn when a shape is stroked. <a href="#SkPaint_Join">Join</a>
@@ -2826,7 +2828,7 @@ void setShader(sk_sp<SkShader> shader)
Optional colors used when filling a path, such as a gradient.
Sets <a href="undocumented#Shader">Shader</a> to <a href="#SkPaint_setShader_shader">shader</a>, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="undocumented#Shader">Shader</a>.
-Does not alter <a href="#SkPaint_setShader_shader">shader</a> <a href="undocumented#Reference_Count">Reference Count</a>.
+Increments <a href="#SkPaint_setShader_shader">shader</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Parameters
@@ -2917,9 +2919,10 @@ color filter unique: false
void setColorFilter(sk_sp<SkColorFilter> colorFilter)
</pre>
-Sets <a href="undocumented#Color_Filter">Color Filter</a> to filter, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="undocumented#Color_Filter">Color Filter</a>.
-Pass nullptr to clear <a href="undocumented#Color_Filter">Color Filter</a>.
-Does not alter filter <a href="undocumented#Reference_Count">Reference Count</a>.
+Sets <a href="undocumented#Color_Filter">Color Filter</a> to filter, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous
+<a href="undocumented#Color_Filter">Color Filter</a>. Pass nullptr to clear <a href="undocumented#Color_Filter">Color Filter</a>.
+
+Increments filter <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Parameters
@@ -3114,10 +3117,10 @@ path effect unique: false
void setPathEffect(sk_sp<SkPathEffect> pathEffect)
</pre>
-Sets <a href="undocumented#Path_Effect">Path Effect</a> to <a href="#SkPaint_setPathEffect_pathEffect">pathEffect</a>,
-decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="undocumented#Path_Effect">Path Effect</a>.
-Pass nullptr to leave the path geometry unaltered.
-Does not alter <a href="#SkPaint_setPathEffect_pathEffect">pathEffect</a> <a href="undocumented#Reference_Count">Reference Count</a>.
+Sets <a href="undocumented#Path_Effect">Path Effect</a> to <a href="#SkPaint_setPathEffect_pathEffect">pathEffect</a>, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous
+<a href="undocumented#Path_Effect">Path Effect</a>. Pass nullptr to leave the path geometry unaltered.
+
+Increments <a href="#SkPaint_setPathEffect_pathEffect">pathEffect</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Parameters
@@ -3136,8 +3139,10 @@ replace <a href="SkPath_Reference#Path">Path</a> with a modification when drawn<
<a href="undocumented#Mask_Filter">Mask Filter</a> uses coverage of the shape drawn to create <a href="undocumented#Mask_Alpha">Mask Alpha</a>.
<a href="undocumented#Mask_Filter">Mask Filter</a> operates at a lower level than <a href="undocumented#Rasterizer">Rasterizer</a>; <a href="undocumented#Mask_Filter">Mask Filter</a> takes a <a href="undocumented#Mask">Mask</a>,
and returns a <a href="undocumented#Mask">Mask</a>.
-<a href="undocumented#Mask_Filter">Mask Filter</a> may change the geometry and transparency of the shape, such as creating a blur effect.
-Set <a href="undocumented#Mask_Filter">Mask Filter</a> to nullptr to prevent <a href="undocumented#Mask_Filter">Mask Filter</a> from modifying the draw.
+
+<a href="undocumented#Mask_Filter">Mask Filter</a> may change the geometry and transparency of the shape, such as
+creating a blur effect. Set <a href="undocumented#Mask_Filter">Mask Filter</a> to nullptr to prevent <a href="undocumented#Mask_Filter">Mask Filter</a> from
+modifying the draw.
### Example
@@ -3180,6 +3185,7 @@ sk_sp<SkMaskFilter> refMaskFilter() const
</pre>
Returns <a href="undocumented#Mask_Filter">Mask Filter</a> if set, or nullptr.
+
Increases <a href="undocumented#Mask_Filter">Mask Filter</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Return Value
@@ -3208,11 +3214,12 @@ mask filter unique: false
void setMaskFilter(sk_sp<SkMaskFilter> maskFilter)
</pre>
-Sets <a href="undocumented#Mask_Filter">Mask Filter</a> to <a href="#SkPaint_setMaskFilter_maskFilter">maskFilter</a>,
-decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="undocumented#Mask_Filter">Mask Filter</a>.
-Pass nullptr to clear <a href="undocumented#Mask_Filter">Mask Filter</a> and leave <a href="undocumented#Mask_Filter">Mask Filter</a> effect on <a href="undocumented#Mask_Alpha">Mask Alpha</a> unaltered.
+Sets <a href="undocumented#Mask_Filter">Mask Filter</a> to <a href="#SkPaint_setMaskFilter_maskFilter">maskFilter</a>, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous
+<a href="undocumented#Mask_Filter">Mask Filter</a>. Pass nullptr to clear <a href="undocumented#Mask_Filter">Mask Filter</a> and leave <a href="undocumented#Mask_Filter">Mask Filter</a> effect on
+<a href="undocumented#Mask_Alpha">Mask Alpha</a> unaltered.
+
Does not affect <a href="undocumented#Rasterizer">Rasterizer</a>.
-Does not alter <a href="#SkPaint_setMaskFilter_maskFilter">maskFilter</a> <a href="undocumented#Reference_Count">Reference Count</a>.
+Increments <a href="#SkPaint_setMaskFilter_maskFilter">maskFilter</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Parameters
@@ -3245,7 +3252,7 @@ SkTypeface* getTypeface() const
</pre>
Returns <a href="undocumented#Typeface">Typeface</a> if set, or nullptr.
-Does not alter <a href="undocumented#Typeface">Typeface</a> <a href="undocumented#Reference_Count">Reference Count</a>.
+Increments <a href="undocumented#Typeface">Typeface</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Return Value
@@ -3301,10 +3308,9 @@ typeface1 == typeface2
void setTypeface(sk_sp<SkTypeface> typeface)
</pre>
-Sets <a href="undocumented#Typeface">Typeface</a> to <a href="#SkPaint_setTypeface_typeface">typeface</a>,
-decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="undocumented#Typeface">Typeface</a>.
-Pass nullptr to clear <a href="undocumented#Typeface">Typeface</a> and use the default <a href="#SkPaint_setTypeface_typeface">typeface</a>.
-Does not alter <a href="#SkPaint_setTypeface_typeface">typeface</a> <a href="undocumented#Reference_Count">Reference Count</a>.
+Sets <a href="undocumented#Typeface">Typeface</a> to <a href="#SkPaint_setTypeface_typeface">typeface</a>, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="undocumented#Typeface">Typeface</a>.
+Pass nullptr to clear <a href="undocumented#Typeface">Typeface</a> and use the default <a href="#SkPaint_setTypeface_typeface">typeface</a>. Increments
+<a href="#SkPaint_setTypeface_typeface">typeface</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Parameters
@@ -3323,9 +3329,11 @@ font and style used to draw text</td>
<a href="undocumented#Rasterizer">Rasterizer</a> controls how shapes are converted to <a href="undocumented#Mask_Alpha">Mask Alpha</a>.
<a href="undocumented#Rasterizer">Rasterizer</a> operates at a higher level than <a href="undocumented#Mask_Filter">Mask Filter</a>; <a href="undocumented#Rasterizer">Rasterizer</a> takes a <a href="SkPath_Reference#Path">Path</a>,
and returns a <a href="undocumented#Mask">Mask</a>.
+
<a href="undocumented#Rasterizer">Rasterizer</a> may change the geometry and transparency of the shape, such as
creating a shadow effect. <a href="undocumented#Rasterizer">Rasterizer</a> forms the base of <a href="#Layer">Rasterizer Layer</a>, which
creates effects like embossing and outlining.
+
<a href="undocumented#Rasterizer">Rasterizer</a> applies to <a href="undocumented#Rect">Rect</a>, <a href="undocumented#Region">Region</a>, <a href="undocumented#Round_Rect">Round Rect</a>, <a href="#Arc">Arcs</a>, <a href="#Circle">Circles</a>, <a href="#Oval">Ovals</a>,
<a href="SkPath_Reference#Path">Path</a>, and <a href="undocumented#Text">Text</a>.
@@ -3398,11 +3406,12 @@ rasterizer unique: false
void setRasterizer(sk_sp<SkRasterizer> rasterizer)
</pre>
-Sets <a href="undocumented#Rasterizer">Rasterizer</a> to <a href="#SkPaint_setRasterizer_rasterizer">rasterizer</a>,
-decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="undocumented#Rasterizer">Rasterizer</a>.
-Pass nullptr to clear <a href="undocumented#Rasterizer">Rasterizer</a> and leave <a href="undocumented#Rasterizer">Rasterizer</a> effect on <a href="undocumented#Mask_Alpha">Mask Alpha</a> unaltered.
+Sets <a href="undocumented#Rasterizer">Rasterizer</a> to <a href="#SkPaint_setRasterizer_rasterizer">rasterizer</a>, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous
+<a href="undocumented#Rasterizer">Rasterizer</a>. Pass nullptr to clear <a href="undocumented#Rasterizer">Rasterizer</a> and leave <a href="undocumented#Rasterizer">Rasterizer</a> effect on
+<a href="undocumented#Mask_Alpha">Mask Alpha</a> unaltered.
+
Does not affect <a href="undocumented#Mask_Filter">Mask Filter</a>.
-Does not alter <a href="#SkPaint_setRasterizer_rasterizer">rasterizer</a> <a href="undocumented#Reference_Count">Reference Count</a>.
+Increments <a href="#SkPaint_setRasterizer_rasterizer">rasterizer</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Parameters
@@ -3421,6 +3430,7 @@ how geometry is converted to <a href="undocumented#Mask_Alpha">Mask Alpha</a></t
<a href="undocumented#Image_Filter">Image Filter</a> operates on the pixel representation of the shape, as modified by <a href="#Paint">Paint</a>
with <a href="undocumented#Blend_Mode">Blend Mode</a> set to <a href="#SkBlendMode_kSrcOver">SkBlendMode::kSrcOver</a>. <a href="undocumented#Image_Filter">Image Filter</a> creates a new bitmap,
which is drawn to the device using the set <a href="undocumented#Blend_Mode">Blend Mode</a>.
+
<a href="undocumented#Image_Filter">Image Filter</a> is higher level than <a href="undocumented#Mask_Filter">Mask Filter</a>; for instance, an <a href="undocumented#Image_Filter">Image Filter</a>
can operate on all channels of <a href="undocumented#Color">Color</a>, while <a href="undocumented#Mask_Filter">Mask Filter</a> generates <a href="#Alpha">Alpha</a> only.
<a href="undocumented#Image_Filter">Image Filter</a> operates independently of and can be used in combination with
@@ -3495,12 +3505,12 @@ image filter unique: false
void setImageFilter(sk_sp<SkImageFilter> imageFilter)
</pre>
-Sets <a href="undocumented#Image_Filter">Image Filter</a> to <a href="#SkPaint_setImageFilter_imageFilter">imageFilter</a>,
-decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="undocumented#Image_Filter">Image Filter</a>.
-Pass nullptr to clear <a href="undocumented#Image_Filter">Image Filter</a>, and remove <a href="undocumented#Image_Filter">Image Filter</a> effect
+Sets <a href="undocumented#Image_Filter">Image Filter</a> to <a href="#SkPaint_setImageFilter_imageFilter">imageFilter</a>, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous
+<a href="undocumented#Image_Filter">Image Filter</a>. Pass nullptr to clear <a href="undocumented#Image_Filter">Image Filter</a>, and remove <a href="undocumented#Image_Filter">Image Filter</a> effect
on drawing.
+
Does not affect <a href="undocumented#Rasterizer">Rasterizer</a> or <a href="undocumented#Mask_Filter">Mask Filter</a>.
-Does not alter <a href="#SkPaint_setImageFilter_imageFilter">imageFilter</a> <a href="undocumented#Reference_Count">Reference Count</a>.
+Increments <a href="#SkPaint_setImageFilter_imageFilter">imageFilter</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Parameters
@@ -3518,6 +3528,7 @@ how <a href="undocumented#Image">Image</a> is sampled when transformed</td>
# <a name="Draw_Looper_Methods"></a> Draw Looper Methods
<a href="undocumented#Draw_Looper">Draw Looper</a> sets a modifier that communicates state from one <a href="undocumented#Draw_Layer">Draw Layer</a>
to another to construct the draw.
+
<a href="undocumented#Draw_Looper">Draw Looper</a> draws one or more times, modifying the canvas and paint each time.
<a href="undocumented#Draw_Looper">Draw Looper</a> may be used to draw multiple colors or create a colored shadow.
Set <a href="undocumented#Draw_Looper">Draw Looper</a> to nullptr to prevent <a href="undocumented#Draw_Looper">Draw Looper</a> from modifying the draw.
@@ -3608,10 +3619,11 @@ Deprecated.
void setDrawLooper(sk_sp<SkDrawLooper> drawLooper)
</pre>
-Sets <a href="undocumented#Draw_Looper">Draw Looper</a> to <a href="#SkPaint_setDrawLooper_drawLooper">drawLooper</a>,
-decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous <a href="#SkPaint_setDrawLooper_drawLooper">drawLooper</a>.
-Pass nullptr to clear <a href="undocumented#Draw_Looper">Draw Looper</a> and leave <a href="undocumented#Draw_Looper">Draw Looper</a> effect on drawing unaltered.
-Does not alter <a href="#SkPaint_setDrawLooper_drawLooper">drawLooper</a> <a href="undocumented#Reference_Count">Reference Count</a>.
+Sets <a href="undocumented#Draw_Looper">Draw Looper</a> to <a href="#SkPaint_setDrawLooper_drawLooper">drawLooper</a>, decreasing <a href="undocumented#Reference_Count">Reference Count</a> of the previous
+<a href="#SkPaint_setDrawLooper_drawLooper">drawLooper</a>. Pass nullptr to clear <a href="undocumented#Draw_Looper">Draw Looper</a> and leave <a href="undocumented#Draw_Looper">Draw Looper</a> effect on
+drawing unaltered.
+
+Increments <a href="#SkPaint_setDrawLooper_drawLooper">drawLooper</a> <a href="undocumented#Reference_Count">Reference Count</a> by one.
### Parameters
@@ -3940,18 +3952,18 @@ enum <a href="#SkPaint_TextEncoding">TextEncoding</a> {
<a href="#SkPaint_kGlyphID_TextEncoding">kGlyphID TextEncoding</a>,
};</pre>
-<a href="#SkPaint_TextEncoding">TextEncoding</a> determines whether text specifies character codes and their encoded size,
-or glyph indices. Character codes use the encoding specified by the<a href="undocumented#Unicode">Unicode</a> standard.
+<a href="#SkPaint_TextEncoding">TextEncoding</a> determines whether text specifies character codes and their encoded
+size, or glyph indices. Character codes use the encoding specified by the<a href="undocumented#Unicode">Unicode</a> standard.
+
Character codes encoded size are specified by <a href="undocumented#UTF_8">UTF-8</a>, <a href="undocumented#UTF_16">UTF-16</a>, or <a href="undocumented#UTF_32">UTF-32</a>.
-All character encoding are able to represent all of <a href="undocumented#Unicode">Unicode</a>, differing only
+All character encodings are able to represent all of <a href="undocumented#Unicode">Unicode</a>, differing only
in the total storage required.
-<a href="undocumented#UTF_8">UTF-8</a> (<a href="undocumented#RFC">RFC</a> 3629)is made up of 8-bit bytes,
-and encodes <a href="undocumented#ASCII">ASCII</a> in one byte, and all valid code points in <a href="undocumented#Unicode">Unicode</a> in multiple
-bytes.<a href="undocumented#UTF_16">UTF-16</a> (<a href="undocumented#RFC">RFC</a> 2781)uses one or two 16-bit words,
-and encodes <a href="undocumented#Unicode">Unicode</a> ranges 0x0000 to 0xD7FF and 0xE000 to 0xFFFF in one
-word.<a href="undocumented#UTF_32">UTF-32</a>describes
-a 32-bit word, which encodes all code points in <a href="undocumented#Unicode">Unicode</a>.
+<a href="undocumented#UTF_8">UTF-8</a> (<a href="undocumented#RFC">RFC</a> 3629)encodes each character as one or more 8-bit bytes.
+
+<a href="undocumented#UTF_16">UTF-16</a> (<a href="undocumented#RFC">RFC</a> 2781)encodes each character as one or two 16-bit words.
+
+<a href="undocumented#UTF_32">UTF-32</a>encodes each character as one 32-bit word.
<a href="undocumented#Font_Manager">Font Manager</a> uses font data to convert character code points into glyph indices.
A glyph index is a 16-bit word.
diff --git a/site/user/api/SkPath_Reference.md b/site/user/api/SkPath_Reference.md
index 9de8b30713..cbf344cd09 100644
--- a/site/user/api/SkPath_Reference.md
+++ b/site/user/api/SkPath_Reference.md
@@ -3446,10 +3446,11 @@ 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>)and continues clockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCW_Direction">kCW Direction</a>, counterclockwise if <a href="#SkPath_addCircle_dir">dir</a> is
+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>.
-<a href="#SkPath_addCircle">addCircle</a> has no effect if <a href="#SkPath_addCircle_radius">radius</a> is zero or negative.
+Has no effect if <a href="#SkPath_addCircle_radius">radius</a> is zero or negative.
### Parameters
@@ -3693,9 +3694,10 @@ index of initial point of <a href="undocumented#Round_Rect">Round Rect</a></td>
void addPoly(const SkPoint pts[], int count, bool close)
</pre>
-Add <a href="#Contour">Contour</a> created from <a href="undocumented#Line">Line</a> array, adding<a href="#SkPath_addPoly_count">count</a> - 1<a href="undocumented#Line">Line</a> segments. <a href="#Contour">Contour</a> added starts at <a href="#SkPath_addPoly_pts">pts</a>[0], then adds a line
-for every additional <a href="undocumented#Point">Point</a> in <a href="#SkPath_addPoly_pts">pts</a> array. If <a href="#SkPath_close">close</a> is true,
-appends <a href="#SkPath_kClose_Verb">kClose Verb</a> to <a href="#Path">Path</a>, connecting <a href="#SkPath_addPoly_pts">pts</a>[<a href="#SkPath_addPoly_count">count</a> - 1] and <a href="#SkPath_addPoly_pts">pts</a>[0].
+Add <a href="#Contour">Contour</a> created from <a href="undocumented#Line">Line</a> array, adding (<a href="#SkPath_addPoly_count">count</a> - 1) <a href="undocumented#Line">Line</a> segments.
+<a href="#Contour">Contour</a> added starts at <a href="#SkPath_addPoly_pts">pts</a>[0], then adds a line for every additional <a href="undocumented#Point">Point</a>
+in <a href="#SkPath_addPoly_pts">pts</a> array. If <a href="#SkPath_close">close</a> is true,appends <a href="#SkPath_kClose_Verb">kClose Verb</a> to <a href="#Path">Path</a>, connecting
+<a href="#SkPath_addPoly_pts">pts</a>[<a href="#SkPath_addPoly_count">count</a> - 1] and <a href="#SkPath_addPoly_pts">pts</a>[0].
If <a href="#SkPath_addPoly_count">count</a> is zero, append <a href="#SkPath_kMove_Verb">kMove Verb</a> to path.
Has no effect if <a href="#SkPath_addPoly_count">count</a> is less than one.
@@ -4315,6 +4317,7 @@ in hexadecimal to preserve their exact bit pattern. The output reconstructs the
original <a href="#Path">Path</a>.
Use instead of <a href="#SkPath_dump_2">dump</a> when submittingbug reports against <a href="undocumented#Skia">Skia</a>.
+
Slight value changes in <a href="#Point_Array">Point Array</a> may cause the bug to disappear.
### Example
diff --git a/site/user/api/SkPixmap_Reference.md b/site/user/api/SkPixmap_Reference.md
index 8fc14c4d86..fd454a4c37 100644
--- a/site/user/api/SkPixmap_Reference.md
+++ b/site/user/api/SkPixmap_Reference.md
@@ -119,12 +119,13 @@ SkPixmap(const SkImageInfo& info, const void* addr, size_t rowBytes)
</pre>
Creates <a href="#Pixmap">Pixmap</a> from <a href="#SkPixmap_info">info</a> <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#SkAlphaType">SkAlphaType</a>, and <a href="undocumented#SkColorType">SkColorType</a>.
-<a href="#SkPixmap_addr">addr</a> points to pixels, or nullptr. <a href="#SkPixmap_rowBytes">rowBytes</a> should be<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_width">width</a> * <a href="#SkPixmap_info">info</a>.bytesPerPixel()or larger.
+<a href="#SkPixmap_addr">addr</a> points to pixels, or nullptr. <a href="#SkPixmap_rowBytes">rowBytes</a> should be <a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_width">width</a> times
+<a href="#SkPixmap_info">info</a>.bytesPerPixel(), or larger.
No parameter checking is performed; it is up to the caller to ensure that
<a href="#SkPixmap_addr">addr</a> and <a href="#SkPixmap_rowBytes">rowBytes</a> agree with <a href="#SkPixmap_info">info</a>.
-The memory lifetime pixels are managed by the caller. When <a href="#Pixmap">Pixmap</a> goes
+The memory lifetime of pixels is managed by the caller. When <a href="#Pixmap">Pixmap</a> goes
out of scope, <a href="#SkPixmap_addr">addr</a> is unaffected.
<a href="#Pixmap">Pixmap</a> may be later modified by <a href="#SkPixmap_reset">reset</a> to change its size, pixel type, or
@@ -203,7 +204,8 @@ void reset(const SkImageInfo& info, const void* addr, size_t rowBytes)
Sets <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#SkAlphaType">SkAlphaType</a>, and <a href="undocumented#SkColorType">SkColorType</a> from <a href="#SkPixmap_info">info</a>.
Sets pixel address from <a href="#SkPixmap_addr">addr</a>, which may be nullptr.
-Sets row bytes from <a href="#SkPixmap_rowBytes">rowBytes</a>, which should be<a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_width">width</a> * <a href="#SkPixmap_info">info</a>.bytesPerPixel()or larger.
+Sets row bytes from <a href="#SkPixmap_rowBytes">rowBytes</a>, which should be <a href="#SkPixmap_info">info</a>.<a href="#SkPixmap_width">width</a> times
+<a href="#SkPixmap_info">info</a>.bytesPerPixel(), or larger.
Does not check <a href="#SkPixmap_addr">addr</a>. Asserts if built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined and if <a href="#SkPixmap_rowBytes">rowBytes</a> is
too small to hold one row of pixels.
@@ -241,7 +243,7 @@ void setColorSpace(sk_sp<SkColorSpace> colorSpace)
Changes <a href="undocumented#Color_Space">Color Space</a> in <a href="#Info">Image Info</a>; preserves <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#SkAlphaType">SkAlphaType</a>, and
<a href="undocumented#SkColorType">SkColorType</a> in <a href="undocumented#Image">Image</a>, and leaves pixel address and row bytes unchanged.
-<a href="#SkPixmap_colorSpace">colorSpace</a> reference count is incremented.
+<a href="undocumented#Color_Space">Color Space</a> reference count is incremented.
### Parameters
@@ -355,7 +357,7 @@ true if intersection of <a href="#Pixmap">Pixmap</a> and <a href="#SkPixmap_extr
const SkImageInfo& info() const
</pre>
-Returns <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#SkAlphaType">SkAlphaType</a>, and <a href="undocumented#SkColorType">SkColorType</a>.
+Returns <a href="#SkPixmap_width">width</a>, <a href="#SkPixmap_height">height</a>, <a href="undocumented#Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Type">Color Type</a>, and <a href="undocumented#Color_Space">Color Space</a>.
### Return Value
@@ -421,7 +423,7 @@ rowBytes: 8 minRowBytes: 4
const void* addr() const
</pre>
-Returns pixel address, the base corresponding the pixel origin.
+Returns pixel address, the base address corresponding to the pixel origin.
It is up to the <a href="#Pixmap">Pixmap</a> creator to ensure that pixel address is a useful value.
@@ -886,7 +888,7 @@ bool computeIsOpaque() const
Returns true if all pixels are opaque. <a href="undocumented#Color_Type">Color Type</a> determines how pixels
are encoded, and whether pixel describes <a href="#Alpha">Alpha</a>. Returns true for <a href="undocumented#Color_Type">Color Types</a>
-without alpha for each pixel; for other <a href="undocumented#Color_Type">Color Types</a>, returns true if all
+without alpha in each pixel; for other <a href="undocumented#Color_Type">Color Types</a>, returns true if all
pixels have alpha values equivalent to 1.0 or greater.
For <a href="undocumented#Color_Type">Color Types</a> <a href="undocumented#SkColorType">kRGB 565 SkColorType</a> or <a href="undocumented#SkColorType">kGray 8 SkColorType</a>: always
@@ -896,7 +898,7 @@ For <a href="undocumented#Color_Type">Color Type</a> <a href="undocumented#SkCol
For <a href="undocumented#SkColorType">kRGBA F16 SkColorType</a>: returns true if all pixel <a href="#Alpha">Alpha</a> values are 1.0 or
greater.
-Returns false for any other <a href="undocumented#Color_Type">Color Type</a>.
+Returns false for <a href="undocumented#SkColorType">kUnknown SkColorType</a>.
### Return Value
@@ -945,9 +947,9 @@ precision.
### Parameters
<table> <tr> <td><a name="SkPixmap_getColor_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_getColor_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -996,9 +998,9 @@ built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined. Returns zero if
### Parameters
<table> <tr> <td><a name="SkPixmap_addr_2_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_addr_2_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1215,9 +1217,9 @@ Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is
### Parameters
<table> <tr> <td><a name="SkPixmap_addr8_2_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_addr8_2_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1258,9 +1260,9 @@ Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is
### Parameters
<table> <tr> <td><a name="SkPixmap_addr16_2_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_addr16_2_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1301,9 +1303,9 @@ Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is
### Parameters
<table> <tr> <td><a name="SkPixmap_addr32_2_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_addr32_2_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1340,9 +1342,9 @@ with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
### Parameters
<table> <tr> <td><a name="SkPixmap_addr64_2_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_addr64_2_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1386,9 +1388,9 @@ Four words correspond to one pixel.
### Parameters
<table> <tr> <td><a name="SkPixmap_addrF16_2_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_addrF16_2_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1461,9 +1463,9 @@ built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined. Returns zero if
### Parameters
<table> <tr> <td><a name="SkPixmap_writable_addr_2_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_writable_addr_2_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1498,18 +1500,18 @@ pixmap.getColor(1, 2) == 0xFFFFFFFF
uint8_t* writable_addr8(int x, int y) const
</pre>
-Returns writable base pixel address. Result is addressable as unsigned 8-bit bytes.
-Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a> or
-<a href="undocumented#SkColorType">kGray 8 SkColorType</a>, and is built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
+Returns writable pixel address at (<a href="#SkPixmap_writable_addr8_x">x</a>, <a href="#SkPixmap_writable_addr8_y">y</a>). Result is addressable as unsigned
+8-bit bytes. Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not <a href="undocumented#SkColorType">kAlpha 8 SkColorType</a>
+or <a href="undocumented#SkColorType">kGray 8 SkColorType</a>, and is built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
One byte corresponds to one pixel.
### Parameters
<table> <tr> <td><a name="SkPixmap_writable_addr8_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_writable_addr8_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1536,18 +1538,18 @@ pixel memory is safer.</div></fiddle-embed></div>
uint16_t* writable_addr16(int x, int y) const
</pre>
-Returns <a href="#SkPixmap_writable_addr">writable addr</a> base pixel address. Result is addressable as unsigned 16-bit words.
-Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not <a href="undocumented#SkColorType">kRGB 565 SkColorType</a> or
-<a href="undocumented#SkColorType">kARGB 4444 SkColorType</a>, and is built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
+Returns <a href="#SkPixmap_writable_addr">writable addr</a> pixel address at (<a href="#SkPixmap_writable_addr16_x">x</a>, <a href="#SkPixmap_writable_addr16_y">y</a>). Result is addressable as unsigned
+16-bit words. Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not <a href="undocumented#SkColorType">kRGB 565 SkColorType</a>
+or <a href="undocumented#SkColorType">kARGB 4444 SkColorType</a>, and is built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
One word corresponds to one pixel.
### Parameters
<table> <tr> <td><a name="SkPixmap_writable_addr16_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_writable_addr16_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1573,18 +1575,19 @@ The low nibble of the 16-bit word is <a href="#Alpha">Alpha</a>.</div></fiddle-e
uint32_t* writable_addr32(int x, int y) const
</pre>
-Returns writable base pixel address. Result is addressable as unsigned 32-bit words.
-Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not <a href="undocumented#SkColorType">kRGBA 8888 SkColorType</a> or
-<a href="undocumented#SkColorType">kBGRA 8888 SkColorType</a>, and is built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
+Returns writable pixel address at (<a href="#SkPixmap_writable_addr32_x">x</a>, <a href="#SkPixmap_writable_addr32_y">y</a>). Result is addressable as unsigned
+32-bit words. Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not
+<a href="undocumented#SkColorType">kRGBA 8888 SkColorType</a> or <a href="undocumented#SkColorType">kBGRA 8888 SkColorType</a>, and is built with <a href="undocumented#SK_DEBUG">SK DEBUG</a>
+defined.
One word corresponds to one pixel.
### Parameters
<table> <tr> <td><a name="SkPixmap_writable_addr32_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_writable_addr32_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1609,18 +1612,18 @@ writable unsigned 32-bit pointer to pixel
uint64_t* writable_addr64(int x, int y) const
</pre>
-Returns writable base pixel address. Result is addressable as unsigned 64-bit words.
-Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not <a href="undocumented#SkColorType">kRGBA F16 SkColorType</a> and is built
-with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
+Returns writable pixel address at (<a href="#SkPixmap_writable_addr64_x">x</a>, <a href="#SkPixmap_writable_addr64_y">y</a>). Result is addressable as unsigned
+64-bit words. Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not
+<a href="undocumented#SkColorType">kRGBA F16 SkColorType</a> and is built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
One word corresponds to one pixel.
### Parameters
<table> <tr> <td><a name="SkPixmap_writable_addr64_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_writable_addr64_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1645,9 +1648,9 @@ writable unsigned 64-bit pointer to pixel
uint16_t* writable_addrF16(int x, int y) const
</pre>
-Returns writable base pixel address. Result is addressable as unsigned 16-bit words.
-Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not <a href="undocumented#SkColorType">kRGBA F16 SkColorType</a> and is built
-with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
+Returns writable pixel address at (<a href="#SkPixmap_writable_addrF16_x">x</a>, <a href="#SkPixmap_writable_addrF16_y">y</a>). Result is addressable as unsigned
+16-bit words. Will trigger an assert() if <a href="undocumented#Color_Type">Color Type</a> is not
+<a href="undocumented#SkColorType">kRGBA F16 SkColorType</a> and is built with <a href="undocumented#SK_DEBUG">SK DEBUG</a> defined.
Each word represents one color component encoded as a half float.
Four words correspond to one pixel.
@@ -1655,9 +1658,9 @@ Four words correspond to one pixel.
### Parameters
<table> <tr> <td><a name="SkPixmap_writable_addrF16_x"> <code><strong>x </strong></code> </a></td> <td>
-positive column index less than <a href="#SkPixmap_width">width</a></td>
+column index, zero or greater, and less than <a href="#SkPixmap_width">width</a></td>
</tr> <tr> <td><a name="SkPixmap_writable_addrF16_y"> <code><strong>y </strong></code> </a></td> <td>
-positive row index less than <a href="#SkPixmap_height">height</a></td>
+row index, zero or greater, and less than <a href="#SkPixmap_height">height</a></td>
</tr>
</table>
@@ -1686,8 +1689,8 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY, SkTransferFunctionBehavior behavior) const
</pre>
-Copies a <a href="undocumented#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="undocumented#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
row to the next. Returns true if pixels are copied. Returns false if
@@ -1700,7 +1703,8 @@ 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> || abs(scrY) >= this-><a href="#SkPixmap_height">height</a>.
+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>,
+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
pixels to a linear space before converting to <a href="#SkPixmap_readPixels_dstInfo">dstInfo</a>.
@@ -1744,7 +1748,8 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes)
</pre>
Copies a <a href="undocumented#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
row to the next. Returns true if pixels are copied. Returns false if
@@ -1791,7 +1796,8 @@ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
</pre>
Copies a <a href="undocumented#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
row to the next. Returns true if pixels are copied. Returns false if
@@ -1804,7 +1810,8 @@ 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> || abs(scrY) >= this-><a href="#SkPixmap_height">height</a>.
+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>,
+or ifabs(srcY) >= this-><a href="#SkPixmap_height">height</a>.
### Parameters
@@ -1852,7 +1859,8 @@ 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> || abs(scrY) >= this-><a href="#SkPixmap_height">height</a>.
+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>,
+or ifabs(srcY) >= this-><a href="#SkPixmap_height">height</a>.
### Parameters
diff --git a/tools/bookmaker/bookmaker.cpp b/tools/bookmaker/bookmaker.cpp
index ac1a4a9939..2ec987b333 100644
--- a/tools/bookmaker/bookmaker.cpp
+++ b/tools/bookmaker/bookmaker.cpp
@@ -1119,8 +1119,10 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
case MarkType::kTime:
case MarkType::kVolatile:
case MarkType::kWidth:
- if (hasEnd) {
+ if (hasEnd && MarkType::kAnchor != markType) {
return this->reportError<bool>("one liners omit end element");
+ } else if (!hasEnd && MarkType::kAnchor == markType) {
+ return this->reportError<bool>("anchor line must have end element last");
}
fMarkup.emplace_front(markType, defStart, fLineCount, fParent);
definition = &fMarkup.front();
diff --git a/tools/bookmaker/bookmaker.h b/tools/bookmaker/bookmaker.h
index 4e93f88faf..4cb9fea1c7 100644
--- a/tools/bookmaker/bookmaker.h
+++ b/tools/bookmaker/bookmaker.h
@@ -1841,12 +1841,13 @@ public:
return 0 == size;
}
+ void descriptionOut(const Definition* def);
void enumHeaderOut(const RootDefinition* root, const Definition& child);
void enumMembersOut(const RootDefinition* root, Definition& child);
void enumSizeItems(const Definition& child);
int lookupMethod(const PunctuationState punctuation, const Word word,
const int start, const int run, int lastWrite,
- const char* data);
+ const char* data, bool hasIndirection);
int lookupReference(const PunctuationState punctuation, const Word word,
const int start, const int run, int lastWrite, const char last,
const char* data);
diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp
index 60b1b9288a..e2215a6e1c 100644
--- a/tools/bookmaker/includeWriter.cpp
+++ b/tools/bookmaker/includeWriter.cpp
@@ -7,6 +7,108 @@
#include "bookmaker.h"
+void IncludeWriter::descriptionOut(const Definition* def) {
+ const char* commentStart = def->fContentStart;
+ int commentLen = (int) (def->fContentEnd - commentStart);
+ bool breakOut = false;
+ for (auto prop : def->fChildren) {
+ switch (prop->fMarkType) {
+ case MarkType::kDefinedBy:
+ commentStart = prop->fTerminator;
+ break;
+ case MarkType::kDeprecated:
+ case MarkType::kPrivate:
+ commentLen = (int) (prop->fStart - commentStart);
+ if (commentLen > 0) {
+ SkASSERT(commentLen < 1000);
+ if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
+ this->lfcr();
+ }
+ }
+ commentStart = prop->fContentStart;
+ commentLen = (int) (prop->fContentEnd - commentStart);
+ if (commentLen > 0) {
+ if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
+ this->lfcr();
+ }
+ }
+ commentStart = prop->fTerminator;
+ commentLen = (int) (def->fContentEnd - commentStart);
+ break;
+ case MarkType::kExperimental:
+ this->writeString("EXPERIMENTAL:");
+ this->writeSpace();
+ commentStart = prop->fContentStart;
+ commentLen = (int) (prop->fContentEnd - commentStart);
+ if (commentLen > 0) {
+ if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
+ this->lfcr();
+ }
+ }
+ commentStart = prop->fTerminator;
+ commentLen = (int) (def->fContentEnd - commentStart);
+ break;
+ case MarkType::kFormula:
+ commentLen = prop->fStart - commentStart;
+ if (commentLen > 0) {
+ if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
+ this->lfcr();
+ }
+ }
+ this->writeBlock(prop->length(), prop->fContentStart);
+ commentStart = prop->fTerminator;
+ commentLen = (int) (def->fContentEnd - commentStart);
+ if ('\n' == commentStart[0] && '\n' == commentStart[1]) {
+ this->lf(2);
+ }
+ break;
+ case MarkType::kToDo:
+ commentLen = (int) (prop->fStart - commentStart);
+ if (commentLen > 0) {
+ SkASSERT(commentLen < 1000);
+ if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
+ this->lfcr();
+ }
+ }
+ commentStart = prop->fTerminator;
+ commentLen = (int) (def->fContentEnd - commentStart);
+ break;
+ case MarkType::kList:
+ commentLen = prop->fStart - commentStart;
+ if (commentLen > 0) {
+ if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart,
+ Phrase::kNo)) {
+ this->lfcr();
+ }
+ }
+ for (auto row : prop->fChildren) {
+ SkASSERT(MarkType::kRow == row->fMarkType);
+ for (auto column : row->fChildren) {
+ SkASSERT(MarkType::kColumn == column->fMarkType);
+ this->writeString("-");
+ this->writeSpace();
+ this->descriptionOut(column);
+ this->lf(1);
+ }
+ }
+ commentStart = prop->fTerminator;
+ commentLen = (int) (def->fContentEnd - commentStart);
+ if ('\n' == commentStart[0] && '\n' == commentStart[1]) {
+ this->lf(2);
+ }
+ break;
+ default:
+ commentLen = (int) (prop->fStart - commentStart);
+ breakOut = true;
+ }
+ if (breakOut) {
+ break;
+ }
+ }
+ SkASSERT(commentLen > 0 && commentLen < 1500);
+ this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
+}
+
void IncludeWriter::enumHeaderOut(const RootDefinition* root,
const Definition& child) {
const Definition* enumDef = nullptr;
@@ -55,6 +157,7 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
Definition* codeBlock = nullptr;
const char* commentStart = nullptr;
bool wroteHeader = false;
+ bool lastAnchor = false;
SkDEBUGCODE(bool foundConst = false);
for (auto test : enumDef->fChildren) {
if (MarkType::kCode == test->fMarkType) {
@@ -79,13 +182,22 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
this->lfcr();
wroteHeader = true;
}
+ if (lastAnchor) {
+ if (commentEnd - commentStart > 1) {
+ SkASSERT('\n' == commentStart[0]);
+ if (' ' == commentStart[1]) {
+ this->writeSpace();
+ }
+ }
+ lastAnchor = false;
+ }
this->rewriteBlock((int) (commentEnd - commentStart), commentStart, Phrase::kNo);
if (MarkType::kAnchor == test->fMarkType) {
commentStart = test->fContentStart;
commentEnd = test->fChildren[0]->fStart;
this->writeSpace();
this->rewriteBlock((int) (commentEnd - commentStart), commentStart, Phrase::kNo);
- this->writeSpace();
+ lastAnchor = true; // this->writeSpace();
}
commentStart = test->fTerminator;
if (MarkType::kConst == test->fMarkType) {
@@ -415,67 +527,7 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child)
}
this->writeCommentHeader();
fIndent += 4;
- const char* commentStart = method->fContentStart;
- int commentLen = (int) (method->fContentEnd - commentStart);
- bool breakOut = false;
- for (auto methodProp : method->fChildren) {
- switch (methodProp->fMarkType) {
- case MarkType::kDefinedBy:
- commentStart = methodProp->fTerminator;
- break;
- case MarkType::kDeprecated:
- case MarkType::kPrivate:
- commentLen = (int) (methodProp->fStart - commentStart);
- if (commentLen > 0) {
- SkASSERT(commentLen < 1000);
- if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
- this->lfcr();
- }
- }
- commentStart = methodProp->fContentStart;
- commentLen = (int) (methodProp->fContentEnd - commentStart);
- if (commentLen > 0) {
- if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
- this->lfcr();
- }
- }
- commentStart = methodProp->fTerminator;
- commentLen = (int) (method->fContentEnd - commentStart);
- break;
- case MarkType::kExperimental:
- this->writeString("EXPERIMENTAL:");
- this->writeSpace();
- commentStart = methodProp->fContentStart;
- commentLen = (int) (methodProp->fContentEnd - commentStart);
- if (commentLen > 0) {
- if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
- this->lfcr();
- }
- }
- commentStart = methodProp->fTerminator;
- commentLen = (int) (method->fContentEnd - commentStart);
- break;
- case MarkType::kToDo:
- commentLen = (int) (methodProp->fStart - commentStart);
- if (commentLen > 0) {
- SkASSERT(commentLen < 1000);
- if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
- this->lfcr();
- }
- }
- commentStart = methodProp->fTerminator;
- commentLen = (int) (method->fContentEnd - commentStart);
- break;
- default:
- commentLen = (int) (methodProp->fStart - commentStart);
- breakOut = true;
- }
- if (breakOut) {
- break;
- }
- }
- SkASSERT(commentLen > 0 && commentLen < 1500);
- this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
+ this->descriptionOut(method);
// compute indention column
size_t column = 0;
bool hasParmReturn = false;
@@ -595,7 +647,7 @@ Definition* IncludeWriter::structMemberOut(const Definition* memberStart, const
memberStart->fContentStart);
this->indentToColumn(fStructMemberTab);
this->writeString(name.c_str());
- auto tokenIter = child.fParent->fTokens.begin();
+ auto tokenIter = child.fParent->fTokens.begin();
std::advance(tokenIter, child.fParentIndex + 1);
Definition* valueStart = &*tokenIter;
while (Definition::Type::kPunctuation != tokenIter->fType) {
@@ -828,7 +880,8 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
}
if (Definition::Type::kPunctuation == child.fType &&
(Punctuation::kSemicolon == child.fPunctuation ||
- Punctuation::kLeftBrace == child.fPunctuation)) {
+ Punctuation::kLeftBrace == child.fPunctuation ||
+ (Punctuation::kColon == child.fPunctuation && inConstructor))) {
SkASSERT(fContinuation[0] == '(');
const char* continueEnd = child.fContentStart;
while (continueEnd > fContinuation && isspace(continueEnd[-1])) {
@@ -838,7 +891,6 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
method = root->find(methodName, RootDefinition::AllowParens::kNo);
if (!method) {
fLineCount = child.fLineCount;
- fclose(fOut); // so we can see what we've written so far
return this->reportError<bool>("method not found");
}
this->methodOut(method, child);
@@ -852,17 +904,19 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
if (inConstructor) {
continue;
}
- methodName += "()";
- method = root->find(methodName, RootDefinition::AllowParens::kNo);
+ method = root->find(methodName + "()", RootDefinition::AllowParens::kNo);
if (method && MarkType::kDefinedBy == method->fMarkType) {
method = method->fParent;
}
if (method) {
+ if (method->fCloned) {
+ clonedMethod = method;
+ continue;
+ }
this->methodOut(method, child);
continue;
}
fLineCount = child.fLineCount;
- fclose(fOut); // so we can see what we've written so far
return this->reportError<bool>("method not found");
}
if (Bracket::kSlashSlash == child.fBracket || Bracket::kSlashStar == child.fBracket) {
@@ -1196,6 +1250,16 @@ string IncludeWriter::resolveMethod(const char* start, const char* end, bool fir
report.reportError("method should not include references to itself");
return "";
}
+ if (fBmhMethod) {
+ for (auto child : fBmhMethod->fChildren) {
+ if (MarkType::kParam != child->fMarkType) {
+ continue;
+ }
+ if (methodname == child->fName) {
+ return "";
+ }
+ }
+ }
return substitute;
}
@@ -1292,14 +1356,27 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first,
}
int IncludeWriter::lookupMethod(const PunctuationState punctuation, const Word word,
- const int lastSpace, const int run, int lastWrite, const char* data) {
+ const int lastSpace, const int run, int lastWrite, const char* data,
+ bool hasIndirection) {
int wordStart = lastSpace;
while (' ' >= data[wordStart]) {
++wordStart;
}
const int wordEnd = PunctuationState::kDelimiter == punctuation ||
PunctuationState::kPeriod == punctuation ? run - 1 : run;
- string temp = this->resolveMethod(&data[wordStart], &data[wordEnd], Word::kFirst == word);
+ string temp;
+ if (hasIndirection && '(' != data[wordEnd - 1] && ')' != data[wordEnd - 1]) {
+ // FIXME: hard-coded to assume a.b or a->b is a.b() or a->b().
+ // need to check class a for member b to see if this is so
+ TextParser parser(fFileName, &data[wordStart], &data[wordEnd], fLineCount);
+ const char* indirection = parser.anyOf(".>");
+ if (&data[wordEnd] <= &indirection[2] || 'f' != indirection[1] ||
+ !isupper(indirection[2])) {
+ temp = string(&data[wordStart], wordEnd - wordStart) + "()";
+ }
+ } else {
+ temp = this->resolveMethod(&data[wordStart], &data[wordEnd], Word::kFirst == word);
+ }
if (temp.length()) {
if (wordStart > lastWrite) {
SkASSERT(data[wordStart - 1] >= ' ');
@@ -1372,9 +1449,11 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
int lastSpace = -1;
char c = 0;
char last;
+ bool embeddedIndirection = false;
bool embeddedSymbol = false;
bool hasLower = false;
bool hasUpper = false;
+ bool hasIndirection = false;
bool hasSymbol = false;
while (run < size) {
last = c;
@@ -1417,7 +1496,7 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
case Word::kMixed:
if (hasUpper && hasLower && !hasSymbol && lastSpace > 0) {
lastWrite = this->lookupMethod(punctuation, word, lastSpace, run,
- lastWrite, data);
+ lastWrite, data, hasIndirection && !hasSymbol);
}
break;
default:
@@ -1427,9 +1506,11 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
(PunctuationState::kStart == punctuation && ' ' >= last) ?
PunctuationState::kStart : PunctuationState::kSpace;
word = Word::kStart;
+ embeddedIndirection = false;
embeddedSymbol = false;
hasLower = false;
hasUpper = false;
+ hasIndirection = false;
hasSymbol = false;
lastSpace = run;
break;
@@ -1450,7 +1531,7 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
default:
SkASSERT(0);
}
- embeddedSymbol = true;
+ embeddedIndirection = true;
break;
case ',': case ';': case ':':
switch (word) {
@@ -1471,11 +1552,16 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
}
embeddedSymbol = true;
break;
+ case '>':
+ if ('-' == last) {
+ embeddedIndirection = true;
+ break;
+ }
case '\'': // possessive apostrophe isn't treated as delimiting punctation
case '\"': // quote is passed straight through
case '=':
case '!': // assumed not to be punctuation, but a programming symbol
- case '&': case '>': case '<': case '{': case '}': case '/': case '*': case '[': case ']':
+ case '&': case '<': case '{': case '}': case '/': case '*': case '[': case ']':
word = Word::kMixed;
embeddedSymbol = true;
break;
@@ -1545,6 +1631,7 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
PunctuationState::kDelimiter == punctuation) {
word = Word::kMixed;
}
+ hasIndirection |= embeddedIndirection;
hasSymbol |= embeddedSymbol;
break;
case 'a': case 'b': case 'c': case 'd': case 'e':
@@ -1570,6 +1657,7 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
}
hasLower = true;
punctuation = PunctuationState::kStart;
+ hasIndirection |= embeddedIndirection;
hasSymbol |= embeddedSymbol;
break;
default:
@@ -1580,7 +1668,8 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr
if ((word == Word::kCap || word == Word::kFirst || word == Word::kUnderline) && hasLower) {
lastWrite = this->lookupReference(punctuation, word, start, run, lastWrite, last, data);
} else if (word == Word::kMixed && hasUpper && hasLower && !hasSymbol && lastSpace > 0) {
- lastWrite = this->lookupMethod(punctuation, word, lastSpace, run, lastWrite, data);
+ lastWrite = this->lookupMethod(punctuation, word, lastSpace, run, lastWrite, data,
+ hasIndirection && !hasSymbol);
}
if (run > lastWrite) {
if (' ' == data[lastWrite]) {