wip spelling mania
Work on spell-checker to identify errors and isolate more concepts requiring definitions. Docs-Preview: https://skia.org/?cl=41180 TBR: reed@google.com Bug: skia: 6898 Change-Id: I0759beb42eaf6095908a9bd7decfcd0026253609 Reviewed-on: https://skia-review.googlesource.com/41180 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
This commit is contained in:
parent
dbb24efcc5
commit
da65a0489a
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@ Paint does not directly implement dashing or blur, but contains the objects that
|
||||
The objects contained by Paint are opaque, and cannot be edited outside of the Paint
|
||||
to affect it. The implementation is free to defer computations associated with the
|
||||
Paint, or ignore them altogether. For instance, some GPU implementations draw all
|
||||
Path geometries with anti-aliasing, regardless of how SkPaint::kAntiAlias_Flag
|
||||
Path geometries with Anti-aliasing, regardless of how SkPaint::kAntiAlias_Flag
|
||||
is set in Paint.
|
||||
|
||||
Paint describes a single color, a single font, a single image quality, and so on.
|
||||
@ -46,7 +46,7 @@ Shader attached to Paint.
|
||||
# Anti-alias # Approximating coverage with transparency. ##
|
||||
# Dither # Distributing color error. ##
|
||||
# Device_Text # Increase precision of glyph position. ##
|
||||
# Font_Embedded_Bitmaps # Custom-sized bitmap glyphs. ##
|
||||
# Font_Embedded_Bitmaps # Custom sized bitmap Glyphs. ##
|
||||
# Automatic_Hinting # Always adjust glyph paths. ##
|
||||
# Vertical_Text # Orient text from top to bottom. ##
|
||||
# Fake_Bold # Approximate font styles. ##
|
||||
@ -72,12 +72,12 @@ Shader attached to Paint.
|
||||
# Text_Size # Overall height in points. ##
|
||||
# Text_Scale_X # Text horizontal scale. ##
|
||||
# Text_Skew_X # Text horizontal slant. ##
|
||||
# Text_Encoding # Text encoded as characters or glyphs. ##
|
||||
# Text_Encoding # Text encoded as characters or Glyphs. ##
|
||||
# Font_Metrics # Common glyph dimensions. ##
|
||||
# Measure_Text # Width, height, bounds of text. ##
|
||||
# Text_Path # Geometry of glyphs. ##
|
||||
# Text_Path # Geometry of Glyphs. ##
|
||||
# Text_Intercepts # Advanced underline, strike through. ##
|
||||
# Fast_Bounds # Appproxiate area required by Paint. ##
|
||||
# Fast_Bounds # Approximate area required by Paint. ##
|
||||
#Table ##
|
||||
#Subtopic ##
|
||||
|
||||
@ -139,12 +139,12 @@ Shader attached to Paint.
|
||||
# canComputeFastBounds # Returns true if settings allow for fast bounds computation. ##
|
||||
# computeFastBounds # Returns fill bounds for quick reject tests. ##
|
||||
# computeFastStrokeBounds # Returns stroke bounds for quick reject tests. ##
|
||||
# containsText # Returns if all text corresponds to glyphs. ##
|
||||
# countText # Returns number of glyphs in text. ##
|
||||
# containsText # Returns if all text corresponds to Glyphs. ##
|
||||
# countText # Returns number of Glyphs in text. ##
|
||||
# doComputeFastBounds # Returns bounds for quick reject tests. ##
|
||||
# flatten() # Serializes into a buffer. ##
|
||||
# getAlpha # Returns Color_Alpha, color opacity. ##
|
||||
# getBlendMode # Returns Blend_Mode, how colors combine with dest. ##
|
||||
# getBlendMode # Returns Blend_Mode, how colors combine with Device. ##
|
||||
# getColor # Returns Color_Alpha and Color_RGB, one drawing color. ##
|
||||
# getColorFilter # Returns Color_Filter, how colors are altered. ##
|
||||
# getDrawLooper # Returns Draw_Looper, multiple layers. ##
|
||||
@ -179,9 +179,9 @@ Shader attached to Paint.
|
||||
# getTextSize # Returns text size in points. ##
|
||||
# getTextWidths # Returns advance and bounds for each glyph in text. ##
|
||||
# getTypeface # Returns Typeface, font description. ##
|
||||
# glyphsToUnichars # Converts glyphs into text. ##
|
||||
# glyphsToUnichars # Converts Glyphs into text. ##
|
||||
# isAntiAlias # Returns true if Anti-alias is set. ##
|
||||
# isAutohinted # Returns true if glyphs are always hinted. ##
|
||||
# isAutohinted # Returns true if Glyphs are always hinted. ##
|
||||
# isDevKernText # Returns true if Full_Hinting_Spacing is set. ##
|
||||
# isDither # Returns true if Dither is set. ##
|
||||
# isEmbeddedBitmapText # Returns true if Font_Embedded_Bitmaps is set. ##
|
||||
@ -204,7 +204,7 @@ Shader attached to Paint.
|
||||
# setAlpha # Sets Color_Alpha, color opacity. ##
|
||||
# setAntiAlias # Sets or clears Anti-alias. ##
|
||||
# setARGB # Sets color by component. ##
|
||||
# setAutohinted # Sets glyphs to always be hinted. ##
|
||||
# setAutohinted # Sets Glyphs to always be hinted. ##
|
||||
# setBlendMode # Sets Blend_Mode, how colors combine with destination. ##
|
||||
# setColor # Sets Color_Alpha and Color_RGB, one drawing color. ##
|
||||
# setColorFilter # Sets Color_Filter, alters color. ##
|
||||
@ -236,7 +236,7 @@ Shader attached to Paint.
|
||||
# setTypeface # Sets Typeface, font description. ##
|
||||
# setVerticalText # Sets or clears Vertical_Text. ##
|
||||
# textToGlyphs # Converts text into glyph indices. ##
|
||||
# toString # Converts Paint to machine parsable form (Developer_Mode) ##
|
||||
# toString # Converts Paint to machine readable form. ##
|
||||
# unflatten() # Populates from a serialized stream. ##
|
||||
#Table ##
|
||||
#Subtopic ##
|
||||
@ -290,7 +290,7 @@ Constructs Paint with default values.
|
||||
#Table ##
|
||||
|
||||
The flags, text size, hinting, and miter limit may be overridden at compile time by defining
|
||||
paint default values. The overrides may be included in SkUserConfig.h or predefined by the
|
||||
paint default values. The overrides may be included in "SkUserConfig.h" or predefined by the
|
||||
build system.
|
||||
|
||||
#Return default initialized Paint ##
|
||||
@ -622,7 +622,7 @@ flatten() at an earlier time.
|
||||
SkReadBuffer class is not public, so unflatten() cannot be meaningfully called
|
||||
by the client.
|
||||
|
||||
#Param buffer serialized data to unflatten ##
|
||||
#Param buffer serialized data describing Paint content ##
|
||||
|
||||
# why is unflatten() public?
|
||||
#Bug 6172 ##
|
||||
@ -669,7 +669,7 @@ as the Font_Engine.
|
||||
With FreeType, this is equivalent in spirit to the
|
||||
FT_LOAD_TARGET_LIGHT value supplied to FT_Load_Glyph. It chooses a
|
||||
lighter hinting algorithm for non-monochrome modes.
|
||||
Generated glyphs may be fuzzy but better resemble their original shape.
|
||||
Generated Glyphs may be fuzzy but better resemble their original shape.
|
||||
##
|
||||
#Const kNormal_Hinting 2
|
||||
Modifies glyph outlines to improve constrast. This is the default.
|
||||
@ -733,9 +733,9 @@ Set SkPaintDefaults_Hinting at compile time to change the default setting.
|
||||
# Hinting # value # effect on generated glyph outlines ##
|
||||
##
|
||||
# kNo_Hinting # 0 # leaves glyph outlines unchanged from their native representation ##
|
||||
# kSlight_Hinting # 1 # modifies glyph outlines minimally to improve constrast ##
|
||||
# kNormal_Hinting # 2 # modifies glyph outlines to improve constrast ##
|
||||
# kFull_Hinting # 3 # modifies glyph outlines for maxiumum constrast ##
|
||||
# kSlight_Hinting # 1 # modifies glyph outlines minimally to improve contrast ##
|
||||
# kNormal_Hinting # 2 # modifies glyph outlines to improve contrast ##
|
||||
# kFull_Hinting # 3 # modifies glyph outlines for maximum contrast ##
|
||||
##
|
||||
|
||||
#Param hintingLevel one of: kNo_Hinting, kSlight_Hinting, kNormal_Hinting, kFull_Hinting ##
|
||||
@ -901,19 +901,19 @@ Anti-alias drawing approximates partial pixel coverage with transparency.
|
||||
If kAntiAlias_Flag is clear, pixel centers contained by the shape edge are drawn opaque.
|
||||
If kAntiAlias_Flag is set, pixels are drawn with Color_Alpha equal to their coverage.
|
||||
|
||||
The rule for aliased pixels is inconsistent across platforms. A shape edge
|
||||
The rule for Aliased pixels is inconsistent across platforms. A shape edge
|
||||
passing through the pixel center may, but is not required to, draw the pixel.
|
||||
|
||||
Raster_Engine draws aliased pixels whose centers are on or to the right of the start of an
|
||||
Raster_Engine draws Aliased pixels whose centers are on or to the right of the start of an
|
||||
active Path edge, and whose center is to the left of the end of the active Path edge.
|
||||
|
||||
#ToDo add illustration of raster pixels ##
|
||||
|
||||
A platform may only support anti-aliased drawing. Some GPU-backed platforms use
|
||||
supersampling to anti-alias all drawing, and have no mechanism to selectively
|
||||
alias.
|
||||
A platform may only support Anti-aliased drawing. Some GPU-backed platforms use
|
||||
Supersampling to Anti-alias all drawing, and have no mechanism to selectively
|
||||
Alias.
|
||||
|
||||
The amount of coverage computed for anti-aliased pixels also varies across platforms.
|
||||
The amount of coverage computed for Anti-aliased pixels also varies across platforms.
|
||||
|
||||
Anti-alias is disabled by default.
|
||||
Anti-alias can be enabled by default by setting SkPaintDefaults_Flags to kAntiAlias_Flag
|
||||
@ -924,8 +924,8 @@ at compile time.
|
||||
#Description
|
||||
A red line is drawn with transparency on the edges to make it look smoother.
|
||||
A blue line draws only where the pixel centers are contained.
|
||||
The lines are drawn into an offscreen bitmap, then drawn magified to make the
|
||||
aliasing easier to see.
|
||||
The lines are drawn into Bitmap, then drawn magnified to make the
|
||||
Aliasing easier to see.
|
||||
##
|
||||
|
||||
void draw(SkCanvas* canvas) {
|
||||
@ -1000,7 +1000,7 @@ at compile time.
|
||||
# ------------------------------------------------------------------------------
|
||||
#Topic Dither
|
||||
|
||||
Dither increases fidelity by adjusting the color of adjcent pixels.
|
||||
Dither increases fidelity by adjusting the color of adjacent pixels.
|
||||
This can help to smooth color transitions and reducing banding in gradients.
|
||||
Dithering lessens visible banding from kRGB_565_SkColorType
|
||||
and kRGBA_8888_SkColorType gradients,
|
||||
@ -1133,7 +1133,7 @@ LCD_Text and Subpixel_Text increase the precision of glyph position.
|
||||
|
||||
When set, Flags kLCDRenderText_Flag takes advantage of the organization of Color_RGB stripes that
|
||||
create a color, and relies
|
||||
on the small size of the stripe and visual perception to make the color fringing inperceptible.
|
||||
on the small size of the stripe and visual perception to make the color fringing imperceptible.
|
||||
LCD_Text can be enabled on devices that orient stripes horizontally or vertically, and that order
|
||||
the color components as Color_RGB or Color_RBG.
|
||||
|
||||
@ -1149,8 +1149,8 @@ kLCDRenderText_Flag or kSubpixelText_Flag (or both) at compile time.
|
||||
#Example
|
||||
#Description
|
||||
Four commas are drawn normally and with combinations of LCD_Text and Subpixel_Text.
|
||||
When Subpixel_Text is disabled, the comma glyphs are indentical, but not evenly spaced.
|
||||
When Subpixel_Text is enabled, the comma glyphs are unique, but appear evenly spaced.
|
||||
When Subpixel_Text is disabled, the comma Glyphs are identical, but not evenly spaced.
|
||||
When Subpixel_Text is enabled, the comma Glyphs are unique, but appear evenly spaced.
|
||||
##
|
||||
|
||||
SkBitmap bitmap;
|
||||
@ -1254,7 +1254,7 @@ of the color increases, the edge of the glyph appears to move towards the outsid
|
||||
|
||||
#Method bool isSubpixelText() const
|
||||
|
||||
If true, glyphs at different sub-pixel positions may differ on pixel edge coverage.
|
||||
If true, Glyphs at different sub-pixel positions may differ on pixel edge coverage.
|
||||
|
||||
Equivalent to getFlags masked with kSubpixelText_Flag.
|
||||
|
||||
@ -1278,7 +1278,7 @@ SkDebugf("paint.isSubpixelText() %c= !!(paint.getFlags() & SkPaint::kSubpixelTex
|
||||
|
||||
#Method void setSubpixelText(bool subpixelText)
|
||||
|
||||
Requests, but does not require, that glyphs respect sub-pixel positioning.
|
||||
Requests, but does not require, that Glyphs respect sub-pixel positioning.
|
||||
|
||||
Sets kSubpixelText_Flag if subpixelText is true.
|
||||
Clears kSubpixelText_Flag if subpixelText is false.
|
||||
@ -1305,13 +1305,13 @@ SkDebugf("paint.isSubpixelText() %c= !!(paint.getFlags() & SkPaint::kSubpixelTex
|
||||
|
||||
When set, Flags kLCDRenderText_Flag takes advantage of the organization of Color_RGB stripes that
|
||||
create a color, and relies
|
||||
on the small size of the stripe and visual perception to make the color fringing inperceptible.
|
||||
on the small size of the stripe and visual perception to make the color fringing imperceptible.
|
||||
LCD_Text can be enabled on devices that orient stripes horizontally or vertically, and that order
|
||||
the color components as Color_RGB or Color_RBG.
|
||||
|
||||
#Method bool isLCDRenderText() const
|
||||
|
||||
If true, glyphs may use LCD striping to improve glyph edges.
|
||||
If true, Glyphs may use LCD striping to improve glyph edges.
|
||||
|
||||
Returns true if Flags kLCDRenderText_Flag is set.
|
||||
|
||||
@ -1335,7 +1335,7 @@ SkDebugf("paint.isLCDRenderText() %c= !!(paint.getFlags() & SkPaint::kLCDRenderT
|
||||
|
||||
#Method void setLCDRenderText(bool lcdText)
|
||||
|
||||
Requests, but does not require, that glyphs use LCD striping for glyph edges.
|
||||
Requests, but does not require, that Glyphs use LCD striping for glyph edges.
|
||||
|
||||
Sets kLCDRenderText_Flag if lcdText is true.
|
||||
Clears kLCDRenderText_Flag if lcdText is false.
|
||||
@ -1363,7 +1363,7 @@ SkDebugf("paint.isLCDRenderText() %c= !!(paint.getFlags() & SkPaint::kLCDRenderT
|
||||
#Topic Font_Embedded_Bitmaps
|
||||
#Alias Font_Embedded_Bitmaps # long-winded enough, alias so I don't type Paint_Font_...
|
||||
|
||||
Font_Embedded_Bitmaps allows selecting custom-sized bitmap glyphs.
|
||||
Font_Embedded_Bitmaps allows selecting custom sized bitmap Glyphs.
|
||||
Flags kEmbeddedBitmapText_Flag when set chooses an embedded bitmap glyph over an outline contained
|
||||
in a font if the platform supports this option.
|
||||
|
||||
@ -1380,10 +1380,11 @@ kEmbeddedBitmapText_Flag at compile time.
|
||||
#ToDo image will only output on Ubuntu ... how to handle that in fiddle? ##
|
||||
#Platform !fiddle
|
||||
#Description
|
||||
The hintgasp TrueType font in the Skia resources/fonts directory includes an embedded
|
||||
bitmap glyph at odd font sizes. This example works on platforms that use FreeType
|
||||
as their Font_Engine.
|
||||
Windows may, but is not required to, return a bitmap glyph if kEmbeddedBitmapText_Flag is set.
|
||||
The "hintgasp" TrueType font in the Skia resources/fonts directory
|
||||
includes an embedded bitmap Glyph at odd font sizes. This example works
|
||||
on platforms that use FreeType as their Font_Engine.
|
||||
Windows may, but is not required to, return a bitmap glyph if
|
||||
kEmbeddedBitmapText_Flag is set.
|
||||
##
|
||||
#Image embeddedbitmap.png
|
||||
|
||||
@ -1406,7 +1407,7 @@ kEmbeddedBitmapText_Flag at compile time.
|
||||
|
||||
#Method bool isEmbeddedBitmapText() const
|
||||
|
||||
If true, Font_Engine may return glyphs from font bitmaps instead of from outlines.
|
||||
If true, Font_Engine may return Glyphs from font bitmaps instead of from outlines.
|
||||
|
||||
Equivalent to getFlags masked with kEmbeddedBitmapText_Flag.
|
||||
|
||||
@ -1460,7 +1461,7 @@ kEmbeddedBitmapText_Flag at compile time.
|
||||
#Substitute auto-hinting
|
||||
|
||||
If Hinting is set to kNormal_Hinting or kFull_Hinting, Automatic_Hinting
|
||||
instructs the Font_Manager to always hint glyphs.
|
||||
instructs the Font_Manager to always hint Glyphs.
|
||||
Automatic_Hinting has no effect if Hinting is set to kNo_Hinting or
|
||||
kSlight_Hinting.
|
||||
|
||||
@ -1470,7 +1471,7 @@ Automatic_Hinting only affects platforms that use FreeType as the Font_Manager.
|
||||
|
||||
If true, and if Hinting is set to kNormal_Hinting or kFull_Hinting, and if
|
||||
platform uses FreeType as the Font_Manager, instruct the Font_Manager to always hint
|
||||
glyphs.
|
||||
Glyphs.
|
||||
|
||||
Equivalent to getFlags masked with kAutoHinting_Flag.
|
||||
|
||||
@ -1498,7 +1499,7 @@ Automatic_Hinting only affects platforms that use FreeType as the Font_Manager.
|
||||
#Method void setAutohinted(bool useAutohinter)
|
||||
|
||||
If Hinting is set to kNormal_Hinting or kFull_Hinting and useAutohinter is set,
|
||||
instruct the Font_Manager to always hint glyphs.
|
||||
instruct the Font_Manager to always hint Glyphs.
|
||||
Automatic_Hinting has no effect if Hinting is set to kNo_Hinting or
|
||||
kSlight_Hinting.
|
||||
|
||||
@ -1536,13 +1537,13 @@ Automatic_Hinting only affects platforms that use FreeType as the Font_Manager.
|
||||
#Topic Vertical_Text
|
||||
|
||||
Text may be drawn by positioning each glyph, or by positioning the first glyph and
|
||||
using Font_Advance to position subsequent glyphs. By default, each successive glyph
|
||||
is positioned to the right of the preceeding glyph. Vertical_Text sets successive
|
||||
glyphs to position below the preceeding glyph.
|
||||
using Font_Advance to position subsequent Glyphs. By default, each successive glyph
|
||||
is positioned to the right of the preceding glyph. Vertical_Text sets successive
|
||||
Glyphs to position below the preceding glyph.
|
||||
|
||||
Skia can translate text character codes as a series of glyphs, but does not implement
|
||||
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
|
||||
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
|
||||
into glyph series.
|
||||
|
||||
@ -1571,7 +1572,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
#Method bool isVerticalText() const
|
||||
|
||||
If true, glyphs are drawn top to bottom instead of left to right.
|
||||
If true, Glyphs are drawn top to bottom instead of left to right.
|
||||
|
||||
Equivalent to getFlags masked with kVerticalText_Flag.
|
||||
|
||||
@ -1628,8 +1629,8 @@ bold font face using the platform's Font_Manager.
|
||||
Use Text_Skew_X to approximate an italic font style when the italic font face
|
||||
is not available.
|
||||
|
||||
A FreeType-based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct
|
||||
the font engine to create the bold glyphs. Otherwise, the extra bold is computed
|
||||
A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct
|
||||
the font engine to create the bold Glyphs. Otherwise, the extra bold is computed
|
||||
by increasing the stroke width and setting the Style to kStrokeAndFill_Style as needed.
|
||||
|
||||
Fake_Bold is disabled by default.
|
||||
@ -1678,7 +1679,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
#Method void setFakeBoldText(bool fakeBoldText)
|
||||
|
||||
Use increased stroke width when creating glyph bitmaps to approximate bolding.
|
||||
Use increased stroke width when creating glyph bitmaps to approximate a bold typeface.
|
||||
|
||||
Sets kFakeBoldText_Flag if fakeBoldText is true.
|
||||
Clears kFakeBoldText_Flag if fakeBoldText is false.
|
||||
@ -1704,13 +1705,13 @@ void draw(SkCanvas* canvas) {
|
||||
#Topic Full_Hinting_Spacing
|
||||
#Alias Full_Hinting_Spacing # long winded enough -- maybe things with two underscores auto-aliased?
|
||||
|
||||
Full_Hinting_Spacing adjusts the character spacing by the difference of the
|
||||
hinted and unhinted left and right side bearings,
|
||||
if Hinting is set to kFull_Hinting. Full_Hinting_Spacing only
|
||||
applies to platforms that use FreeType as their Font_Engine.
|
||||
if Hinting is set to kFull_Hinting, Full_Hinting_Spacing adjusts the character
|
||||
spacing by the difference of the hinted and Unhinted Left_Side_Bearing and
|
||||
Right_Side_Bearing. Full_Hinting_Spacing only applies to platforms that use
|
||||
FreeType as their Font_Engine.
|
||||
|
||||
Full_Hinting_Spacing is not related to text kerning, where the space between
|
||||
a specific pair of characters is adjusted using data in the font's kerning tables.
|
||||
Full_Hinting_Spacing is not related to text Kerning, where the space between
|
||||
a specific pair of characters is adjusted using data in the font's Kerning tables.
|
||||
|
||||
#Method bool isDevKernText() const
|
||||
|
||||
@ -1760,8 +1761,8 @@ a specific pair of characters is adjusted using data in the font's kerning table
|
||||
Filter_Quality trades speed for image filtering when the image is scaled.
|
||||
A lower Filter_Quality draws faster, but has less fidelity.
|
||||
A higher Filter_Quality draws slower, but looks better.
|
||||
If the image is unscaled, the Filter_Quality choice will not result in a noticable
|
||||
difference.
|
||||
If the image is drawn without scaling, the Filter_Quality choice will not result
|
||||
in a noticeable difference.
|
||||
|
||||
Filter_Quality is used in Paint passed as a parameter to
|
||||
#List
|
||||
@ -1846,7 +1847,7 @@ or stroked shape in a
|
||||
32-bit value. Each component occupies 8-bits, ranging from zero: no contribution;
|
||||
to 255: full intensity. All values in any combination are valid.
|
||||
|
||||
Color is not premultiplied;
|
||||
Color is not Premultiplied;
|
||||
Color_Alpha sets the transparency independent of Color_RGB: Color_RGB_Red, Color_RGB_Blue, and Color_RGB_Green.
|
||||
|
||||
The bit positions of Color_Alpha and Color_RGB are independent of the bit positions
|
||||
@ -1875,7 +1876,7 @@ on the output device, which may have more or fewer bits, and may have a differen
|
||||
|
||||
#Method SkColor getColor() const
|
||||
|
||||
Retrieves Color_Alpha and Color_RGB, unpremultiplied, packed into 32 bits.
|
||||
Retrieves Alpha and Color_RGB, Unpremultiplied, packed into 32 bits.
|
||||
Use helpers SkColorGetA, SkColorGetR, SkColorGetG, and SkColorGetB to extract
|
||||
a color component.
|
||||
|
||||
@ -1899,8 +1900,8 @@ on the output device, which may have more or fewer bits, and may have a differen
|
||||
|
||||
#Method void setColor(SkColor color)
|
||||
|
||||
Sets Color_Alpha and Color_RGB used when stroking and filling. The color is a 32-bit value,
|
||||
unpremutiplied, packing 8-bit components for Color_Alpha, Color_RGB_Red, Color_RGB_Blue, and Color_RGB_Green.
|
||||
Sets Alpha and Color_RGB used when stroking and filling. The color is a 32-bit value,
|
||||
Unpremultiplied, packing 8-bit components for Alpha, Red, Blue, and Green.
|
||||
|
||||
#Param color Unpremultiplied Color_ARGB ##
|
||||
|
||||
@ -1929,9 +1930,9 @@ Color_Alpha sets the transparency independent of Color_RGB: Color_RGB_Red, Color
|
||||
|
||||
#Method uint8_t getAlpha() const
|
||||
|
||||
Retrieves Color_Alpha from the Color used when stroking and filling.
|
||||
Retrieves Alpha from the Color used when stroking and filling.
|
||||
|
||||
#Return Color_Alpha ranging from zero, fully transparent, to 255, fully opaque ##
|
||||
#Return Alpha ranging from zero, fully transparent, to 255, fully opaque ##
|
||||
|
||||
#Example
|
||||
SkPaint paint;
|
||||
@ -1946,13 +1947,13 @@ Color_Alpha sets the transparency independent of Color_RGB: Color_RGB_Red, Color
|
||||
|
||||
#Method void setAlpha(U8CPU a)
|
||||
|
||||
Replaces Color_Alpha, leaving Color_RGB
|
||||
Replaces Alpha, leaving Color_RGB
|
||||
unchanged. An out of range value triggers an assert in the debug
|
||||
build. a is a value from zero to 255.
|
||||
a set to zero makes Color fully transparent; a set to 255 makes Color
|
||||
fully opaque.
|
||||
|
||||
#Param a Color_Alpha component of Color ##
|
||||
#Param a Alpha component of Color ##
|
||||
|
||||
#Example
|
||||
SkPaint paint;
|
||||
@ -1972,8 +1973,7 @@ Color_Alpha sets the transparency independent of Color_RGB: Color_RGB_Red, Color
|
||||
#Method void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
|
||||
|
||||
Sets Color used when drawing solid fills. The color components range from 0 to 255.
|
||||
The color is unpremultiplied;
|
||||
Color_Alpha sets the transparency independent of Color_RGB.
|
||||
The color is Unpremultiplied; Alpha sets the transparency independent of Color_RGB.
|
||||
|
||||
#Param a amount of Color_Alpha, from fully transparent (0) to fully opaque (255) ##
|
||||
#Param r amount of Color_RGB_Red, from no red (0) to full red (255) ##
|
||||
@ -2033,7 +2033,7 @@ Stroke_Width of zero has a special meaning and switches drawing to use Hairline.
|
||||
Hairline draws the thinnest continuous frame. If kAntiAlias_Flag is clear, adjacent pixels
|
||||
flow horizontally, vertically,or diagonally.
|
||||
|
||||
#ToDo what is the description of anti-aliased hairlines? ##
|
||||
#ToDo what is the description of Anti-aliased hairlines? ##
|
||||
|
||||
Path drawing with Hairline may hit the same pixel more than once. For instance, Path containing
|
||||
two lines in one Path_Contour will draw the corner point once, but may both lines may draw the adjacent
|
||||
@ -2062,8 +2062,8 @@ a fill draw.
|
||||
|
||||
#Const kFill_Style 0
|
||||
Set to fill geometry.
|
||||
Applies to Rect, Region, Round_Rect, Circle, Oval, Path, and Text.
|
||||
Bitmap, Image, Patch, Region, Sprite, and Vertices are painted as if
|
||||
Applies to Rect, Region, Round_Rect, Circles, Ovals, Path, and Text.
|
||||
Bitmap, Image, Patches, Region, Sprites, and Vertices are painted as if
|
||||
kFill_Style is set, and ignore the set Style.
|
||||
The Path_Fill_Type specifies additional rules to fill the area outside the path edge,
|
||||
and to create an unfilled hole inside the shape.
|
||||
@ -2072,16 +2072,15 @@ a fill draw.
|
||||
|
||||
#Const kStroke_Style 1
|
||||
Set to stroke geometry.
|
||||
Applies to Rect, Region, Round_Rect, Arc, Circle, Oval,
|
||||
Path, and Text.
|
||||
Arc, Line, Point, and Point_Array are always drawn as if kStroke_Style is set,
|
||||
Applies to Rect, Region, Round_Rect, Arcs, Circles, Ovals, Path, and Text.
|
||||
Arcs, Lines, and Points, are always drawn as if kStroke_Style is set,
|
||||
and ignore the set Style.
|
||||
The stroke construction is unaffected by the Path_Fill_Type.
|
||||
##
|
||||
|
||||
#Const kStrokeAndFill_Style 2
|
||||
Set to stroke and fill geometry.
|
||||
Applies to Rect, Region, Round_Rect, Circle, Oval, Path, and Text.
|
||||
Applies to Rect, Region, Round_Rect, Circles, Ovals, Path, and Text.
|
||||
Path is treated as if it is set to SkPath::kWinding_FillType,
|
||||
and the set Path_Fill_Type is ignored.
|
||||
##
|
||||
@ -2264,7 +2263,7 @@ Miter_Limit can be computed from the corner angle:
|
||||
|
||||
Miter_Limit default value is 4.
|
||||
The default may be changed at compile time by setting SkPaintDefaults_MiterLimit
|
||||
in SkUserConfig.h or as a define supplied by the build environment.
|
||||
in "SkUserConfig.h" or as a define supplied by the build environment.
|
||||
|
||||
Here are some miter limits and the angles that triggers them.
|
||||
#Table
|
||||
@ -2673,8 +2672,8 @@ returns false since Hairline has no filled equivalent.
|
||||
#Example
|
||||
#Height 192
|
||||
#Description
|
||||
A very small quad stroke is turned into a filled path with increasing levels of precision.
|
||||
At the lowest precision, the quad stroke is approximated by a rectangle.
|
||||
A very small Quad stroke is turned into a filled path with increasing levels of precision.
|
||||
At the lowest precision, the Quad stroke is approximated by a rectangle.
|
||||
At the highest precision, the filled path has high fidelity compared to the original stroke.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
@ -3141,7 +3140,7 @@ If Paint has no Path_Effect, the path geometry is unaltered when filled or strok
|
||||
# ------------------------------------------------------------------------------
|
||||
#Topic Mask_Filter_Methods
|
||||
|
||||
Mask_Filter uses Color_Alpha of the shape drawn to create Mask_Alpha.
|
||||
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.
|
||||
@ -3329,7 +3328,7 @@ 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, Arc, Circle, Oval,
|
||||
Rasterizer applies to Rect, Region, Round_Rect, Arcs, Circles, Ovals,
|
||||
Path, and Text.
|
||||
|
||||
#Example
|
||||
@ -3450,7 +3449,7 @@ Image_Filter operates on the pixel representation of the shape, as modified by P
|
||||
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 Color_Alpha only.
|
||||
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
|
||||
Mask_Filter and Rasterizer.
|
||||
|
||||
@ -3690,11 +3689,11 @@ Deprecated.
|
||||
##
|
||||
|
||||
Align adjusts the text relative to the text position.
|
||||
Align affects glyphs drawn with: SkCanvas::drawText, SkCanvas::drawPosText,
|
||||
Align affects Glyphs drawn with: SkCanvas::drawText, SkCanvas::drawPosText,
|
||||
SkCanvas::drawPosTextH, SkCanvas::drawTextOnPath,
|
||||
SkCanvas::drawTextOnPathHV, SkCanvas::drawTextRSXform, SkCanvas::drawTextBlob,
|
||||
and SkCanvas::drawString;
|
||||
as well as calls that place text glyphs like getTextWidths and getTextPath.
|
||||
as well as calls that place text Glyphs like getTextWidths and getTextPath.
|
||||
|
||||
The text position is set by the font for both horizontal and vertical text.
|
||||
Typically, for horizontal text, the position is to the left side of the glyph on the
|
||||
@ -4105,7 +4104,7 @@ void draw(SkCanvas* canvas) {
|
||||
# ------------------------------------------------------------------------------
|
||||
#Topic Font_Metrics
|
||||
|
||||
Font_Metrics describe dimensions common to the glyphs in Typeface.
|
||||
Font_Metrics describe dimensions common to the Glyphs in Typeface.
|
||||
The dimensions are computed by Font_Manager from font data and do not take
|
||||
Paint settings other than Text_Size into account.
|
||||
|
||||
@ -4195,7 +4194,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
FontMetrics is filled out by getFontMetrics. FontMetrics contents reflect the values
|
||||
computed by Font_Manager using Typeface. Values are set to zero if they are
|
||||
not availble.
|
||||
not available.
|
||||
|
||||
fUnderlineThickness and fUnderlinePosition have a bit set in fFlags if their values
|
||||
are valid, since their value may be zero.
|
||||
@ -4271,12 +4270,12 @@ void draw(SkCanvas* canvas) {
|
||||
##
|
||||
|
||||
#Member SkScalar fXMin
|
||||
Minimum bounding box x value for all glyphs.
|
||||
Minimum bounding box x value for all Glyphs.
|
||||
Typically less than zero.
|
||||
##
|
||||
|
||||
#Member SkScalar fXMax
|
||||
Maximum bounding box x value for all glyphs.
|
||||
Maximum bounding box x value for all Glyphs.
|
||||
Typically greater than zero.
|
||||
##
|
||||
|
||||
@ -4325,8 +4324,8 @@ void draw(SkCanvas* canvas) {
|
||||
#Method bool hasUnderlineThickness(SkScalar* thickness) const
|
||||
|
||||
If Font_Metrics has a valid underline thickness, return true, and set
|
||||
thickness to that value. If it doesn't, return false, and ignore
|
||||
thickness.
|
||||
thickness to that value. If the underline thickness is not valid,
|
||||
return false, and ignore thickness.
|
||||
|
||||
#Param thickness storage for underline width ##
|
||||
|
||||
@ -4339,8 +4338,8 @@ void draw(SkCanvas* canvas) {
|
||||
#Method bool hasUnderlinePosition(SkScalar* position) const
|
||||
|
||||
If Font_Metrics has a valid underline position, return true, and set
|
||||
position to that value. If it doesn't, return false, and ignore
|
||||
position.
|
||||
position to that value. If the underline position is not valid,
|
||||
return false, and ignore position.
|
||||
|
||||
#Param position storage for underline position ##
|
||||
|
||||
@ -4353,8 +4352,8 @@ void draw(SkCanvas* canvas) {
|
||||
#Method bool hasStrikeoutThickness(SkScalar* thickness) const
|
||||
|
||||
If Font_Metrics has a valid strikeout thickness, return true, and set
|
||||
thickness to that value. If it doesn't, return false, and ignore
|
||||
thickness.
|
||||
thickness to that value. If the underline thickness is not valid,
|
||||
return false, and ignore thickness.
|
||||
|
||||
#Param thickness storage for strikeout width ##
|
||||
|
||||
@ -4367,8 +4366,8 @@ void draw(SkCanvas* canvas) {
|
||||
#Method bool hasStrikeoutPosition(SkScalar* position) const
|
||||
|
||||
If Font_Metrics has a valid strikeout position, return true, and set
|
||||
position to that value. If it doesn't, return false, and ignore
|
||||
position.
|
||||
position to that value. If the underline position is not valid,
|
||||
return false, and ignore position.
|
||||
|
||||
#Param position storage for strikeout position ##
|
||||
|
||||
@ -4448,7 +4447,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
#Method SkRect getFontBounds() const
|
||||
|
||||
Returns the union of bounds of all glyphs.
|
||||
Returns the union of bounds of all Glyphs.
|
||||
Returned dimensions are computed by Font_Manager from font data,
|
||||
ignoring Hinting. Includes Text_Size, Text_Scale_X,
|
||||
and Text_Skew_X, but not Fake_Bold or Path_Effect.
|
||||
@ -4457,7 +4456,7 @@ If Text_Size is large, Text_Scale_X is one, and Text_Skew_X is zero,
|
||||
returns the same bounds as Font_Metrics { FontMetrics::fXMin,
|
||||
FontMetrics::fTop, FontMetrics::fXMax, FontMetrics::fBottom }.
|
||||
|
||||
#Return union of bounds of all glyphs ##
|
||||
#Return union of bounds of all Glyphs ##
|
||||
|
||||
#Example
|
||||
SkPaint paint;
|
||||
@ -4495,7 +4494,7 @@ If byteLength includes a partial character, the partial character is ignored.
|
||||
If Text_Encoding is kUTF8_TextEncoding and
|
||||
text contains an invalid UTF-8 sequence, zero is returned.
|
||||
|
||||
#Param text character stroage encoded with Text_Encoding ##
|
||||
#Param text character storage encoded with Text_Encoding ##
|
||||
#Param byteLength length of character storage in bytes ##
|
||||
#Param glyphs storage for glyph indices; may be nullptr ##
|
||||
|
||||
@ -4520,14 +4519,14 @@ text contains an invalid UTF-8 sequence, zero is returned.
|
||||
|
||||
#Method int countText(const void* text, size_t byteLength) const
|
||||
|
||||
Returns the number of glyphs in text.
|
||||
Uses Text_Encoding to count the glyphs.
|
||||
Returns the number of Glyphs in text.
|
||||
Uses Text_Encoding to count the Glyphs.
|
||||
Returns the same result as textToGlyphs.
|
||||
|
||||
#Param text character stroage encoded with Text_Encoding ##
|
||||
#Param text character storage encoded with Text_Encoding ##
|
||||
#Param byteLength length of character storage in bytes ##
|
||||
|
||||
#Return number of glyphs represented by text of length byteLength ##
|
||||
#Return number of Glyphs represented by text of length byteLength ##
|
||||
|
||||
#Example
|
||||
SkPaint paint;
|
||||
@ -4552,9 +4551,9 @@ text contains an invalid UTF-8 sequence, zero is returned.
|
||||
returns true if all glyph indices in text are non-zero;
|
||||
does not check to see if text contains valid glyph indices for Typeface.
|
||||
|
||||
Returns true if bytelength is zero.
|
||||
Returns true if byteLength is zero.
|
||||
|
||||
#Param text array of characters or glyphs ##
|
||||
#Param text array of characters or Glyphs ##
|
||||
#Param byteLength number of bytes in text array ##
|
||||
|
||||
#Return true if all text corresponds to a non-zero glyph index ##
|
||||
@ -4781,7 +4780,7 @@ text contains an invalid UTF-8 sequence, zero is returned.
|
||||
#Example
|
||||
#Height 160
|
||||
#Description
|
||||
Bounds of glyphs increase for stroked text, but text advance remains the same.
|
||||
Bounds of Glyphs increase for stroked text, but text advance remains the same.
|
||||
The underlines show the text advance, spaced to keep them distinct.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
@ -4821,7 +4820,7 @@ text contains an invalid UTF-8 sequence, zero is returned.
|
||||
# ------------------------------------------------------------------------------
|
||||
#Topic Text_Path
|
||||
|
||||
Text_Path describes the geometry of glyphs used to draw text.
|
||||
Text_Path describes the geometry of Glyphs used to draw text.
|
||||
|
||||
#Method void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
|
||||
SkPath* path) const
|
||||
@ -4836,7 +4835,7 @@ Uses x, y, and Text_Align to position path.
|
||||
#Param length number of bytes of text ##
|
||||
#Param x x-coordinate of the origin of the text ##
|
||||
#Param y y-coordinate of the origin of the text ##
|
||||
#Param path geometry of the glyphs ##
|
||||
#Param path geometry of the Glyphs ##
|
||||
|
||||
#Example
|
||||
#Description
|
||||
@ -4872,12 +4871,12 @@ pos contains a position for each glyph.
|
||||
#Param text character codes or glyph indices ##
|
||||
#Param length number of bytes of text ##
|
||||
#Param pos positions of each glyph ##
|
||||
#Param path geometry of the glyphs ##
|
||||
#Param path geometry of the Glyphs ##
|
||||
|
||||
#Example
|
||||
#Height 85
|
||||
#Description
|
||||
Simplifies three glyphs to eliminate overlaps, and strokes the result.
|
||||
Simplifies three Glyphs to eliminate overlaps, and strokes the result.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
@ -4897,16 +4896,16 @@ pos contains a position for each glyph.
|
||||
# ------------------------------------------------------------------------------
|
||||
#Topic Text_Intercepts
|
||||
|
||||
Text_Intercepts describe the intersection of drawn text glyphs with a pair
|
||||
Text_Intercepts describe the intersection of drawn text Glyphs with a pair
|
||||
of lines parallel to the text advance. Text_Intercepts permits creating a
|
||||
underline that skips descenders.
|
||||
underline that skips Descenders.
|
||||
|
||||
#Method int getTextIntercepts(const void* text, size_t length, SkScalar x, SkScalar y,
|
||||
const SkScalar bounds[2], SkScalar* intervals) const
|
||||
|
||||
Returns the number of intervals that intersect bounds.
|
||||
bounds describes a pair of lines parallel to the text advance.
|
||||
The return count is zero or a multiple of two, and is at most twice the number of glyphs in
|
||||
The return count is zero or a multiple of two, and is at most twice the number of Glyphs in
|
||||
the string.
|
||||
Uses Text_Encoding to decode text, Typeface to get the glyph paths,
|
||||
and Text_Size, Fake_Bold, and Path_Effect to scale and modify the glyph paths.
|
||||
@ -4928,7 +4927,7 @@ underline that skips descenders.
|
||||
#Example
|
||||
#Height 128
|
||||
#Description
|
||||
Underline uses intercepts to draw on either side of the glyph descender.
|
||||
Underline uses intercepts to draw on either side of the glyph Descender.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
@ -4959,7 +4958,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
Returns the number of intervals that intersect bounds.
|
||||
bounds describes a pair of lines parallel to the text advance.
|
||||
The return count is zero or a multiple of two, and is at most twice the number of glyphs in
|
||||
The return count is zero or a multiple of two, and is at most twice the number of Glyphs in
|
||||
the string.
|
||||
Uses Text_Encoding to decode text, Typeface to get the glyph paths,
|
||||
and Text_Size, Fake_Bold, and Path_Effect to scale and modify the glyph paths.
|
||||
@ -4979,7 +4978,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
#Example
|
||||
#Description
|
||||
Text intercepts draw on either side of, but not inside, glyphs in a run.
|
||||
Text intercepts draw on either side of, but not inside, Glyphs in a run.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
@ -5012,7 +5011,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
Returns the number of intervals that intersect bounds.
|
||||
bounds describes a pair of lines parallel to the text advance.
|
||||
The return count is zero or a multiple of two, and is at most twice the number of glyphs in
|
||||
The return count is zero or a multiple of two, and is at most twice the number of Glyphs in
|
||||
the string.
|
||||
Uses Text_Encoding to decode text, Typeface to get the glyph paths,
|
||||
and Text_Size, Fake_Bold, and Path_Effect to scale and modify the glyph paths.
|
||||
@ -5070,17 +5069,17 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
Returns the number of intervals that intersect bounds.
|
||||
bounds describes a pair of lines parallel to the text advance.
|
||||
The return count is zero or a multiple of two, and is at most twice the number of glyphs in
|
||||
The return count is zero or a multiple of two, and is at most twice the number of Glyphs in
|
||||
the string.
|
||||
Uses Text_Encoding to decode text, Typeface to get the glyph paths,
|
||||
and Text_Size, Fake_Bold, and Path_Effect to scale and modify the glyph paths.
|
||||
Uses pos array and Text_Align to position intervals.
|
||||
Uses run array and Text_Align to position intervals.
|
||||
|
||||
Pass nullptr for intervals to determine the size of the interval array.
|
||||
|
||||
intervals are cached to improve performance for multiple calls.
|
||||
|
||||
#Param blob glyphs, positions, and text paint attributes ##
|
||||
#Param blob Glyphs, positions, and text paint attributes ##
|
||||
#Param bounds lower and upper line parallel to the advance ##
|
||||
#Param intervals returned intersections; may be nullptr ##
|
||||
|
||||
@ -5127,8 +5126,8 @@ void draw(SkCanvas* canvas) {
|
||||
Returns true if Paint prevents all drawing;
|
||||
otherwise, the Paint may or may not allow drawing.
|
||||
|
||||
Returns true if Blend_Mode and Color_Alpha are enabled,
|
||||
and computed Color_Alpha is zero.
|
||||
Returns true if, for example, Blend_Mode combined with Color_Alpha computes a
|
||||
new Alpha of zero.
|
||||
|
||||
#Return true if Paint prevents all drawing ##
|
||||
|
||||
@ -5187,13 +5186,13 @@ Paint may draw to.
|
||||
Only call this if canComputeFastBounds returned true. This takes a
|
||||
raw rectangle (the raw bounds of a shape), and adjusts it for stylistic
|
||||
effects in the paint (e.g. stroking). If needed, it uses the storage
|
||||
rect parameter. It returns the adjusted bounds that can then be used
|
||||
parameter. It returns the adjusted bounds that can then be used
|
||||
for SkCanvas::quickReject tests.
|
||||
|
||||
The returned rect will either be orig or storage, thus the caller
|
||||
The returned Rect will either be orig or storage, thus the caller
|
||||
should not rely on storage being set to the result, but should always
|
||||
use the retured value. It is legal for orig and storage to be the same
|
||||
rect.
|
||||
use the returned value. It is legal for orig and storage to be the same
|
||||
Rect.
|
||||
|
||||
#Private
|
||||
e.g.
|
||||
@ -5231,8 +5230,9 @@ Paint may draw to.
|
||||
(to be made private)
|
||||
##
|
||||
|
||||
Take the style explicitly, so the caller can force us to be stroked
|
||||
without having to make a copy of the paint just to change that field.
|
||||
Computes the bounds, overriding the Paint Style. This can be used to
|
||||
account for additional width required by stroking orig, without
|
||||
altering Style set to fill.
|
||||
|
||||
#Param orig geometry modified by Paint when drawn ##
|
||||
#Param storage computed bounds of geometry ##
|
||||
@ -5252,9 +5252,11 @@ Paint may draw to.
|
||||
macro expands to: void toString(SkString* str) const;
|
||||
##
|
||||
|
||||
Converts Paint to machine parsable form in developer mode.
|
||||
Creates string representation of Paint. The representation is read by
|
||||
internal debugging tools. The interface and implementation may be
|
||||
suppressed by defining SK_IGNORE_TO_STRING.
|
||||
|
||||
#Param str storage for string containing parsable Paint ##
|
||||
#Param str storage for string representation of Paint ##
|
||||
|
||||
#Example
|
||||
SkPaint paint;
|
||||
|
@ -16,7 +16,7 @@ the middle entry as the end of the first Line and the start of the second Line.
|
||||
Path components Arc, Rect, Round_Rect, Circle, and Oval are composed of
|
||||
Lines and Curves with as many Verbs and Points required
|
||||
for an exact description. Once added to Path, these components may lose their
|
||||
identity; although Path can be inspected to determine if it decribes a single
|
||||
identity; although Path can be inspected to determine if it describes a single
|
||||
Rect, Oval, Round_Rect, and so on.
|
||||
|
||||
#Example
|
||||
@ -103,7 +103,7 @@ SkPath::kMove_Verb; each SkPath::kMove_Verb that follows starts a new Contour.
|
||||
#Example
|
||||
#Description
|
||||
Each SkPath::moveTo starts a new Contour, and content after SkPath::close()
|
||||
also starts a new Contour. Since SkPath::conicTo wasn't preceded by
|
||||
also starts a new Contour. Since SkPath::conicTo is not preceded by
|
||||
SkPath::moveTo, the first Point of the third Contour starts at the last Point
|
||||
of the second Contour.
|
||||
##
|
||||
@ -188,10 +188,10 @@ Paths contain geometry. Paths may be empty, or contain one or more Verbs that
|
||||
outline a figure. Path always starts with a move verb to a Cartesian
|
||||
coordinate, and may be followed by additional verbs that add lines or curves.
|
||||
Adding a close verb makes the geometry into a continuous loop, a closed contour.
|
||||
Paths may contain any number of contours, each beginnning with a move verb.
|
||||
Paths may contain any number of contours, each beginning with a move verb.
|
||||
|
||||
Path contours may contain only a move verb, or may also contain lines,
|
||||
quadratic Beziers, conics, and cubic Beziers. Path contours may be open or
|
||||
Quadratic_Beziers, Conics, and Cubic_Beziers. Path contours may be open or
|
||||
closed.
|
||||
|
||||
When used to draw a filled area, Path describes whether the fill is inside or
|
||||
@ -210,7 +210,7 @@ SkPath::updateBoundsCache to make Path thread safe.
|
||||
# constants # description ##
|
||||
#Legend ##
|
||||
# AddPathMode # Sets addPath options. ##
|
||||
# ArcSize # Sets arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep, SkScalar x, SkScalar y) options. ##
|
||||
# ArcSize # Used by arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep, SkScalar x, SkScalar y).##
|
||||
# Convexity # Returns if Path is convex or concave. ##
|
||||
# Direction # Sets Contour clockwise or counterclockwise. ##
|
||||
# FillType # Sets winding rule and inverse fill. ##
|
||||
@ -279,8 +279,8 @@ SkPath::updateBoundsCache to make Path thread safe.
|
||||
# countPoints # Returns Point_Array length. ##
|
||||
# countVerbs # Returns Verb_Array length. ##
|
||||
# cubicTo # Appends Cubic. ##
|
||||
# dump() # Sends text representation using floats to stdout. ##
|
||||
# dumpHex # Sends text representation using hexadecimal to stdout. ##
|
||||
# dump() # Sends text representation using floats to standard output. ##
|
||||
# dumpHex # Sends text representation using hexadecimal to standard output. ##
|
||||
# getBounds # Returns maximum and minimum of Point_Array. ##
|
||||
# getConvexity # Returns geometry convexity, computing if necessary. ##
|
||||
# getConvexityOrUnknown # Returns geometry convexity if known. ##
|
||||
@ -569,7 +569,7 @@ Releases ownership of any shared data and deletes data if Path is sole owner.
|
||||
|
||||
#Example
|
||||
#Description
|
||||
delete calls Path destructor, but copy of original in path2 is unaffected.
|
||||
delete calls Path Destructor, but copy of original in path2 is unaffected.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkPath* path = new SkPath();
|
||||
@ -596,7 +596,7 @@ Copying Paths by assignment is very efficient and never allocates memory.
|
||||
Paths are always copied by value from the interface; the underlying shared
|
||||
pointers are not exposed.
|
||||
|
||||
#Param path Verb_Array, Point_Array, Weights, amd Fill_Type to copy ##
|
||||
#Param path Verb_Array, Point_Array, Weights, and Fill_Type to copy ##
|
||||
|
||||
#Return Path copied by value ##
|
||||
|
||||
@ -708,7 +708,7 @@ Return true if Paths contain equal Verbs and equal Weights.
|
||||
If Paths contain one or more Conics, the Weights must match.
|
||||
|
||||
conicTo may add different Verbs depending on Conic_Weight, so it is not
|
||||
trival to interpolate a pair of Paths containing Conics with different
|
||||
trivial to interpolate a pair of Paths containing Conics with different
|
||||
Conic_Weight values.
|
||||
|
||||
#Param compare Path to compare ##
|
||||
@ -1289,7 +1289,7 @@ void draw(SkCanvas* canvas) {
|
||||
unsigned* start = nullptr) const
|
||||
|
||||
Returns true if constructed by addRoundRect, addRRect; and if construction
|
||||
is not empty, not Rect, and not Oval. Path constructed with other other calls
|
||||
is not empty, not Rect, and not Oval. Path constructed with other calls
|
||||
will not return true though Path draws Round_Rect.
|
||||
|
||||
rrect receives bounds of Round_Rect.
|
||||
@ -1305,9 +1305,13 @@ Triggers performance optimizations on some GPU_Surface implementations.
|
||||
#Param dir storage for Direction; may be nullptr ##
|
||||
#Param start storage for start of Round_Rect; may be nullptr ##
|
||||
|
||||
#Return true for Round_Rect Path constructed by addRoundRect or addRRect ##
|
||||
#Return true if Path contains only Round_Rect ##
|
||||
|
||||
#Example
|
||||
#Description
|
||||
Draw rounded rectangle and its bounds. Draw an arc indicating where the rounded
|
||||
rectangle starts and its direction.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
SkPath path;
|
||||
@ -1343,7 +1347,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
#Method void reset()
|
||||
|
||||
Sets Path to its intial state.
|
||||
Sets Path to its initial state.
|
||||
Removes Verb_Array, Point_Array, and Weights, and sets FillType to kWinding_FillType.
|
||||
Internal storage associated with Path is released.
|
||||
|
||||
@ -1364,7 +1368,7 @@ Internal storage associated with Path is released.
|
||||
|
||||
#Method void rewind()
|
||||
|
||||
Sets Path to its intial state, preserving internal storage.
|
||||
Sets Path to its initial state, preserving internal storage.
|
||||
Removes Verb_Array, Point_Array, and Weights, and sets FillType to kWinding_FillType.
|
||||
Internal storage associated with Path is retained.
|
||||
|
||||
@ -1535,7 +1539,7 @@ Mark temporary paths, discarded or modified after use, as volatile
|
||||
to inform Device that the path need not be cached.
|
||||
|
||||
Mark animating Path volatile to improve performance.
|
||||
Mark unchanging Path non-volative to improve repeated rendering.
|
||||
Mark unchanging Path non-volatile to improve repeated rendering.
|
||||
|
||||
Raster_Surface Path draws are affected by volatile for some shadows.
|
||||
GPU_Surface Path draws are affected by volatile for some shadows and concave geometries.
|
||||
@ -1582,8 +1586,8 @@ If false, returns true if p1 equals or nearly equals p2.
|
||||
|
||||
#Example
|
||||
#Description
|
||||
As single precision floats, 100 and 100.000001f have the same bit representation,
|
||||
and are exactly equal. 100 and 100.0001f have different bit representations, and
|
||||
As single precision floats, 100 and 100.000001 have the same bit representation,
|
||||
and are exactly equal. 100 and 100.0001 have different bit representations, and
|
||||
are not exactly equal, but are nearly equal.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
@ -1617,9 +1621,9 @@ Test if Quad is degenerate.
|
||||
Quad with no length or that moves a very short distance is degenerate; it is
|
||||
treated as a point.
|
||||
|
||||
#Param p1 quad start point ##
|
||||
#Param p2 quad control point ##
|
||||
#Param p3 quad end point ##
|
||||
#Param p1 Quad start point ##
|
||||
#Param p2 Quad control point ##
|
||||
#Param p3 Quad end point ##
|
||||
#Param exact if true, returns true only if p1, p2, and p3 are equal;
|
||||
if false, returns true if p1, p2, and p3 are equal or nearly equal
|
||||
##
|
||||
@ -1628,9 +1632,9 @@ treated as a point.
|
||||
|
||||
#Example
|
||||
#Description
|
||||
As single precision floats: 100, 100.00001f, and 100.00002f have different bit representations
|
||||
As single precision floats: 100, 100.00001, and 100.00002 have different bit representations
|
||||
but nearly the same value. Translating all three by 1000 gives them the same bit representation;
|
||||
the fractional portion of the number can't be represented by the float and is lost.
|
||||
the fractional portion of the number can not be represented by the float and is lost.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
auto debugster = [](const SkPath& path, bool exact) -> void {
|
||||
@ -1669,10 +1673,10 @@ Test if Cubic is degenerate.
|
||||
Cubic with no length or that moves a very short distance is degenerate; it is
|
||||
treated as a point.
|
||||
|
||||
#Param p1 cubic start point ##
|
||||
#Param p2 cubic control point 1 ##
|
||||
#Param p3 cubic control point 2 ##
|
||||
#Param p4 cubic end point ##
|
||||
#Param p1 Cubic start point ##
|
||||
#Param p2 Cubic control point 1 ##
|
||||
#Param p3 Cubic control point 2 ##
|
||||
#Param p4 Cubic end point ##
|
||||
#Param exact if true, returns true only if p1, p2, p3, and p4 are equal;
|
||||
if false, returns true if p1, p2, p3, and p4 are equal or nearly equal
|
||||
##
|
||||
@ -1759,7 +1763,7 @@ second move is not line
|
||||
|
||||
Point_Array contains Points satisfying the allocated Points for
|
||||
each Verb in Verb_Array. For instance, Path containing one Contour with Line
|
||||
and Quad is described by Verb_Array: move to, line to, quad to; and
|
||||
and Quad is described by Verb_Array: Verb::kMoveTo, Verb::kLineTo, Verb::kQuadTo; and
|
||||
one Point for move, one Point for Line, two Points for Quad; totaling four Points.
|
||||
|
||||
Point_Array may be read directly from Path with getPoints, or inspected with
|
||||
@ -1960,7 +1964,7 @@ Cached state is also exchanged. swap() internally exchanges pointers, so
|
||||
it is lightweight and does not allocate memory.
|
||||
|
||||
swap() usage has largely been replaced by operator=(const SkPath& path).
|
||||
Paths do not copy their content on assignment util they are written to,
|
||||
Paths do not copy their content on assignment until they are written to,
|
||||
making assignment as efficient as swap().
|
||||
|
||||
#Param other Path exchanged by value ##
|
||||
@ -2163,7 +2167,7 @@ grows Path Verb_Array and Point_Array to contain extraPtCount additional Points.
|
||||
May improve performance and use less memory by
|
||||
reducing the number and size of allocations when creating Path.
|
||||
|
||||
#Param extraPtCount number of additional Points to preallocate ##
|
||||
#Param extraPtCount number of additional Points to allocate ##
|
||||
|
||||
#Example
|
||||
#Height 192
|
||||
@ -2257,7 +2261,7 @@ void draw(SkCanvas* canvas) {
|
||||
Adds beginning of Contour relative to Last_Point.
|
||||
If Path is empty, starts Contour at (dx, dy).
|
||||
Otherwise, start Contour at Last_Point offset by (dx, dy).
|
||||
Function name stands for relative move to.
|
||||
Function name stands for "relative move to".
|
||||
|
||||
#Param dx offset from Last_Point x to Contour start x ##
|
||||
#Param dy offset from Last_Point y to Contour start y ##
|
||||
@ -2365,7 +2369,7 @@ kClose_Verb, Last_Point is set to (0, 0) before adding Line.
|
||||
Appends kMove_Verb to Verb_Array and (0, 0) to Point_Array, if needed;
|
||||
then appends kLine_Verb to Verb_Array and Line end to Point_Array.
|
||||
Line end is Last_Point plus Vector (dx, dy).
|
||||
Function name stands for relative line to.
|
||||
Function name stands for "relative line to".
|
||||
|
||||
#Param dx offset from Last_Point x to Line end x ##
|
||||
#Param dy offset from Last_Point y to Line end y ##
|
||||
@ -2395,8 +2399,10 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#Topic Quad
|
||||
#Substitute quads
|
||||
#Alias Quad
|
||||
#Alias Quads
|
||||
#Alias Quadratic_Bezier
|
||||
#Alias Quadratic_Beziers
|
||||
|
||||
Quad describes a quadratic Bezier, a second-order curve identical to a section
|
||||
of a parabola. Quad begins at a start Point, curves towards a control Point,
|
||||
@ -2529,7 +2535,7 @@ void draw(SkCanvas* canvas) {
|
||||
control and Quad end to Point_Array.
|
||||
Quad control is Last_Point plus Vector (dx1, dy1).
|
||||
Quad end is Last_Point plus Vector (dx2, dy2).
|
||||
Function name stands for relative quad to.
|
||||
Function name stands for "relative quad to".
|
||||
|
||||
#Param dx1 offset from Last_Point x to Quad control x ##
|
||||
#Param dy1 offset from Last_Point x to Quad control y ##
|
||||
@ -2561,7 +2567,6 @@ void draw(SkCanvas* canvas) {
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
#Topic Conic
|
||||
#Substitute conics
|
||||
#Alias Conics
|
||||
|
||||
Conic describes a conical section: a piece of an ellipse, or a piece of a
|
||||
@ -2573,9 +2578,8 @@ Each Conic in Path adds two Points and one Conic_Weight. Conic_Weights in Path
|
||||
may be inspected with Iter, or with RawIter.
|
||||
|
||||
#Subtopic Weight
|
||||
#Substitute weights
|
||||
#Alias Weights
|
||||
#Alias Conic_Weights
|
||||
#Alias Weights
|
||||
|
||||
Weight determines both the strength of the control Point and the type of Conic.
|
||||
If Weight is exactly one, then Conic is identical to Quad; it is always a
|
||||
@ -2651,7 +2655,7 @@ done
|
||||
##
|
||||
##
|
||||
|
||||
If weight is greater than one, Conic is a hyperbolic segment. As w gets large,
|
||||
If weight is greater than one, Conic is a hyperbolic segment. As weight gets large,
|
||||
a hyperbolic segment can be approximated by straight lines connecting the
|
||||
control Point with the end Points.
|
||||
|
||||
@ -2767,7 +2771,7 @@ void draw(SkCanvas* canvas) {
|
||||
#Height 128
|
||||
#Description
|
||||
Conics and arcs use identical representations. As the arc sweep increases
|
||||
the conic weight also increases, but remains smaller than one.
|
||||
the Conic_Weight also increases, but remains smaller than one.
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
@ -2817,7 +2821,7 @@ void draw(SkCanvas* canvas) {
|
||||
control is Last_Point plus Vector (dx1, dy1).
|
||||
end is Last_Point plus Vector (dx2, dy2).
|
||||
|
||||
Function name stands for relative conic to.
|
||||
Function name stands for "relative conic to".
|
||||
|
||||
#Param dx1 offset from Last_Point x to Conic control x ##
|
||||
#Param dy1 offset from Last_Point x to Conic control y ##
|
||||
@ -2849,10 +2853,12 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#Topic Cubic
|
||||
#Substitute cubics
|
||||
#Alias Cubic
|
||||
#Alias Cubics
|
||||
#Alias Cubic_Bezier
|
||||
#Alias Cubic_Beziers
|
||||
|
||||
Cubic describes a cubic Bezier, a third-order curve.
|
||||
Cubic describes a Bezier curve segment described by a third-order polynomial.
|
||||
Cubic begins at a start Point, curving towards the first control Point;
|
||||
and curves from the end Point towards the second control Point.
|
||||
|
||||
@ -2970,7 +2976,7 @@ to Point_Array.
|
||||
control and Cubic end to Point_Array.
|
||||
Cubic control is Last_Point plus Vector (dx1, dy1).
|
||||
Cubic end is Last_Point plus Vector (dx2, dy2).
|
||||
Function name stands for relative cubic to.
|
||||
Function name stands for "relative cubic to".
|
||||
|
||||
#Param x1 offset from Last_Point x to first Cubic control x ##
|
||||
#Param y1 offset from Last_Point x to first Cubic control y ##
|
||||
@ -3335,7 +3341,7 @@ Arc sweep is always less than 180 degrees. If radius is zero, or if
|
||||
tangents are nearly parallel, arcTo appends Line from last Path Point to (x1, y1).
|
||||
|
||||
arcTo appends at most one Line and one Conic.
|
||||
arcTo implements the functionality of PostScript_arct and HTML_Canvas_arcTo.
|
||||
arcTo implements the functionality of PostScript_Arct and HTML_Canvas_ArcTo.
|
||||
|
||||
#Param x1 x common to pair of tangents ##
|
||||
#Param y1 y common to pair of tangents ##
|
||||
@ -3398,7 +3404,7 @@ Arc sweep is always less than 180 degrees. If radius is zero, or if
|
||||
tangents are nearly parallel, arcTo appends Line from last Path Point to p1.
|
||||
|
||||
arcTo appends at most one Line and one Conic.
|
||||
arcTo implements the functionality of PostScript_arct and HTML_Canvas_arcTo.
|
||||
arcTo implements the functionality of PostScript_Arct and HTML_Canvas_ArcTo.
|
||||
|
||||
#Param p1 Point common to pair of tangents ##
|
||||
#Param p2 end of second tangent ##
|
||||
@ -3499,7 +3505,7 @@ void draw(SkCanvas* canvas) {
|
||||
#Method void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
|
||||
Direction sweep, SkScalar x, SkScalar y)
|
||||
|
||||
Append Arc to Path. Arc is implemented by one or more Conic weighted to describe part of Oval
|
||||
Append Arc to Path. Arc is implemented by one or more Conics weighted to describe part of Oval
|
||||
with radii (rx, ry) rotated by xAxisRotate degrees. Arc curves from last Path Point to (x, y),
|
||||
choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.
|
||||
|
||||
@ -3508,13 +3514,13 @@ or if last Path Point equals (x, y). arcTo scales radii (rx, ry) to fit last Pat
|
||||
(x, y) if both are greater than zero but too small.
|
||||
|
||||
arcTo appends up to four Conic curves.
|
||||
arcTo implements the functionatlity of SVG_Arc, although SVG sweep-flag value is
|
||||
opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, while kCW_Direction
|
||||
arcTo implements the functionality of SVG_Arc, although SVG "sweep-flag" value is
|
||||
opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while kCW_Direction
|
||||
cast to int is zero.
|
||||
|
||||
#Param rx radius in x before x-axis rotation ##
|
||||
#Param ry radius in y before x-axis rotation ##
|
||||
#Param xAxisRotate x-axis rotation in degrees; positve values are clockwise ##
|
||||
#Param xAxisRotate x-axis rotation in degrees; positive values are clockwise ##
|
||||
#Param largeArc chooses smaller or larger Arc ##
|
||||
#Param sweep chooses clockwise or counterclockwise Arc ##
|
||||
#Param x end of Arc ##
|
||||
@ -3557,15 +3563,15 @@ and smaller or larger.
|
||||
|
||||
Arc sweep is always less than 360 degrees. arcTo appends Line to xy if either radii are zero,
|
||||
or if last Path Point equals (x, y). arcTo scales radii r to fit last Path Point and
|
||||
xy if both are greater than zero but too small.
|
||||
xy if both are greater than zero but too small to describe an arc.
|
||||
|
||||
arcTo appends up to four Conic curves.
|
||||
arcTo implements the functionatlity of SVG_Arc, although SVG sweep-flag value is
|
||||
opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, while kCW_Direction
|
||||
cast to int is zero.
|
||||
arcTo implements the functionality of SVG_Arc, although SVG "sweep-flag" value is
|
||||
opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while
|
||||
kCW_Direction cast to int is zero.
|
||||
|
||||
#Param r radii in x and y before x-axis rotation ##
|
||||
#Param xAxisRotate x-axis rotation in degrees; positve values are clockwise ##
|
||||
#Param xAxisRotate x-axis rotation in degrees; positive values are clockwise ##
|
||||
#Param largeArc chooses smaller or larger Arc ##
|
||||
#Param sweep chooses clockwise or counterclockwise Arc ##
|
||||
#Param xy end of Arc ##
|
||||
@ -3594,8 +3600,8 @@ void draw(SkCanvas* canvas) {
|
||||
Direction sweep, SkScalar dx, SkScalar dy)
|
||||
|
||||
Append Arc to Path, relative to last Path Point. Arc is implemented by one or
|
||||
more Conic, weighted to describe part of Oval with radii (r.fX, r.fY) rotated by
|
||||
xAxisRotate degrees. Arc curves from last Path Point (x0, y0) to
|
||||
more Conic, weighted to describe part of Oval with radii (rx, ry) rotated by
|
||||
xAxisRotate degrees. Arc curves from last Path Point (x0, y0) to end Point
|
||||
#Formula
|
||||
(x0 + dx, y0 + dy)
|
||||
##
|
||||
@ -3603,18 +3609,19 @@ xAxisRotate degrees. Arc curves from last Path Point (x0, y0) to
|
||||
counterclockwise, and smaller or larger. If Path is empty, the start Arc Point
|
||||
is (0, 0).
|
||||
|
||||
Arc sweep is always less than 360 degrees. arcTo appends Line to xy if either
|
||||
radii are zero, or if last Path Point equals (x, y). arcTo scales radii r to fit
|
||||
last Path Point and xy if both are greater than zero but too small.
|
||||
Arc sweep is always less than 360 degrees. arcTo appends Line to end Point
|
||||
if either radii are zero, or if last Path Point equals end Point.
|
||||
arcTo scales radii (rx, ry) to fit last Path Point and end Point if both are
|
||||
greater than zero but too small to describe an arc.
|
||||
|
||||
arcTo appends up to four Conic curves.
|
||||
arcTo implements the functionatlity of SVG_Arc, although SVG sweep-flag value is
|
||||
opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, while
|
||||
arcTo implements the functionality of SVG_Arc, although SVG "sweep-flag" value is
|
||||
opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while
|
||||
kCW_Direction cast to int is zero.
|
||||
|
||||
#Param rx radius in x before x-axis rotation ##
|
||||
#Param ry radius in y before x-axis rotation ##
|
||||
#Param xAxisRotate x-axis rotation in degrees; positve values are clockwise ##
|
||||
#Param xAxisRotate x-axis rotation in degrees; positive values are clockwise ##
|
||||
#Param largeArc chooses smaller or larger Arc ##
|
||||
#Param sweep chooses clockwise or counterclockwise Arc ##
|
||||
#Param dx x offset end of Arc from last Path Point ##
|
||||
@ -3645,7 +3652,7 @@ void draw(SkCanvas* canvas) {
|
||||
#Method void close()
|
||||
|
||||
Append kClose_Verb to Path. A closed Contour connects the first and last Point
|
||||
with Line, forming a continous loop. Open and closed Contour draw the same
|
||||
with Line, forming a continuous loop. Open and closed Contour draw the same
|
||||
with SkPaint::kFill_Style. With SkPaint::kStroke_Style, open Contour draws
|
||||
Paint_Stroke_Cap at Contour start and end; closed Contour draws
|
||||
Paint_Stroke_Join at Contour start and end.
|
||||
@ -3862,7 +3869,7 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
#Method bool isRect(SkRect* rect, bool* isClosed = nullptr, Direction* direction = nullptr) const
|
||||
|
||||
Returns true if Path is eqivalent to Rect when filled.
|
||||
Returns true if Path is equivalent to Rect when filled.
|
||||
If false: rect, isClosed, and direction are unchanged.
|
||||
If true: rect, isClosed, and direction are written to if not nullptr.
|
||||
|
||||
@ -4466,7 +4473,7 @@ Add Contour created from Line array, adding
|
||||
#Formula
|
||||
count - 1
|
||||
##
|
||||
Line segments. Contour added starts at pt[0], then adds a line
|
||||
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].
|
||||
|
||||
@ -5036,13 +5043,13 @@ for (int y = 2; y < 256; y += 9) {
|
||||
#Method void dump(SkWStream* stream, bool forceClose, bool dumpAsHex) const
|
||||
|
||||
Writes text representation of Path to stream. If stream is nullptr, dump() writes to
|
||||
stdout. Set forceClose to true to get
|
||||
standard output. Set forceClose to true to get
|
||||
edges used to fill Path. Set dumpAsHex true to get exact binary representations
|
||||
of floating point numbers used in Point_Array and Conic_Weights.
|
||||
|
||||
#Param stream writable Stream receiving Path text representation; may be nullptr ##
|
||||
#Param forceClose true if missing kClose_Verb is output ##
|
||||
#Param dumpAsHex true if SkScalar values are written as hexidecimal ##
|
||||
#Param dumpAsHex true if SkScalar values are written as hexadecimal ##
|
||||
|
||||
#Example
|
||||
SkPath path;
|
||||
@ -5084,7 +5091,7 @@ path.close();
|
||||
|
||||
#Method void dump() const
|
||||
|
||||
Writes text representation of Path to stdout. The representation may be
|
||||
Writes text representation of Path to standard output. The representation may be
|
||||
directly compiled as C++ code. Floating point values are written
|
||||
with limited precision; it may not be possible to reconstruct original Path
|
||||
from output.
|
||||
@ -5113,7 +5120,7 @@ path is not equal to copy
|
||||
|
||||
#Method void dumpHex() const
|
||||
|
||||
Writes text representation of Path to stdout. The representation may be
|
||||
Writes text representation of Path to standard output. The representation may be
|
||||
directly compiled as C++ code. Floating point values are written
|
||||
in hexadecimal to preserve their exact bit pattern. The output reconstructs the
|
||||
original Path.
|
||||
|
@ -1,30 +1,24 @@
|
||||
# external references that will be documented eventually ...
|
||||
#External
|
||||
DirectWrite TrueType Windows Linux Android
|
||||
DirectWrite TrueType Windows Linux Android iOS
|
||||
FreeType FreeType-based Harfbuzz
|
||||
PostScript PostScript_arct
|
||||
OS_X Core_Graphics Core_Text iOS
|
||||
Descenders Kerning Unhinted
|
||||
LCD RGB
|
||||
Premultiplied Unpremultiplied
|
||||
Unicode Unicode5 UTF-8 UTF-16 UTF-32 ASCII Unichar
|
||||
HTML_Canvas HTML_Canvas_arcTo
|
||||
API
|
||||
CPU
|
||||
GPU GPU-backed OpenGL Vulkan
|
||||
NULL
|
||||
RFC
|
||||
Bezier Coons Cartesian
|
||||
C C++
|
||||
C C++ Destructor Subclasses
|
||||
SaveLayerFlags # not external; need to add typedef support
|
||||
SkUserConfig.h # not external, but still thinking about how markup refers to this
|
||||
SkUserConfig # not external, but still thinking about how markup refers to this
|
||||
SkXXX.h # ditto
|
||||
Skia # ditto
|
||||
SK_USE_FREETYPE_EMBOLDEN # ditto
|
||||
SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION # ditto
|
||||
SK_BUILD_FOR_ANDROID_FRAMEWORK # ditto
|
||||
Developer_Mode # ditto
|
||||
Draw_Layer # ditto
|
||||
Raster_Engine # ditto
|
||||
SK_IGNORE_TO_STRING # ditto
|
||||
|
||||
# FreeType related
|
||||
FT_LOAD_TARGET_LIGHT
|
||||
@ -36,8 +30,18 @@ FT_Load_Glyph
|
||||
|
||||
#External ##
|
||||
|
||||
#Topic Alias
|
||||
#Alias Aliased
|
||||
#Alias Aliasing
|
||||
##
|
||||
|
||||
#Topic Anti-alias
|
||||
#Alias Anti-aliased
|
||||
#Alias Anti-aliasing
|
||||
##
|
||||
|
||||
#Topic Arc
|
||||
#Substitute arcs
|
||||
#Alias Arcs
|
||||
#Topic ##
|
||||
|
||||
#Topic BBH_Factory
|
||||
@ -64,7 +68,7 @@ FT_Load_Glyph
|
||||
#Topic ##
|
||||
|
||||
#Topic Circle
|
||||
#Substitute circles
|
||||
#Alias Circles
|
||||
#Topic ##
|
||||
|
||||
#Topic Clip_Op
|
||||
@ -103,18 +107,18 @@ FT_Load_Glyph
|
||||
#Const SK_ColorWHITE 0xFFFFFFFF
|
||||
##
|
||||
#Subtopic Alpha
|
||||
#Substitute alpha
|
||||
#Alias Alpha
|
||||
#Subtopic ##
|
||||
#Subtopic RGB
|
||||
#Substitute RGB
|
||||
#Subtopic Red
|
||||
#Substitute red
|
||||
#Alias Red
|
||||
#Subtopic ##
|
||||
#Subtopic Blue
|
||||
#Substitute blue
|
||||
#Alias Blue
|
||||
#Subtopic ##
|
||||
#Subtopic Green
|
||||
#Substitute green
|
||||
#Alias Green
|
||||
#Subtopic ##
|
||||
#Subtopic ##
|
||||
#Subtopic ARGB
|
||||
@ -139,6 +143,14 @@ FT_Load_Glyph
|
||||
#Topic Color_Space
|
||||
##
|
||||
|
||||
#Topic Core_Graphics
|
||||
#Substitute Core Graphics
|
||||
##
|
||||
|
||||
#Topic Core_Text
|
||||
#Substitute Core Text
|
||||
##
|
||||
|
||||
#Topic Curve
|
||||
#Alias Curves
|
||||
##
|
||||
@ -166,6 +178,9 @@ FT_Load_Glyph
|
||||
##
|
||||
##
|
||||
|
||||
#Topic Draw_Layer
|
||||
##
|
||||
|
||||
#Topic Draw_Looper
|
||||
#Class SkDrawLooper
|
||||
#Class ##
|
||||
@ -207,6 +222,7 @@ FT_Load_Glyph
|
||||
#Topic ##
|
||||
|
||||
#Topic Glyph
|
||||
#Alias Glyphs
|
||||
##
|
||||
|
||||
#Topic GPU_Context
|
||||
@ -217,6 +233,13 @@ FT_Load_Glyph
|
||||
#Substitute GPU surface
|
||||
##
|
||||
|
||||
#Topic HTML_Canvas
|
||||
#Substitute HTML Canvas
|
||||
#Subtopic ArcTo
|
||||
#Substitute HTML Canvas arcTo
|
||||
##
|
||||
##
|
||||
|
||||
#Topic Image
|
||||
#Subtopic Alpha_Type
|
||||
#Enum SkAlphaType
|
||||
@ -277,8 +300,10 @@ FT_Load_Glyph
|
||||
##
|
||||
##
|
||||
|
||||
#Topic Left_Side_Bearing
|
||||
##
|
||||
|
||||
#Topic Line
|
||||
#Substitute lines
|
||||
#Alias Lines
|
||||
#Topic ##
|
||||
|
||||
@ -324,8 +349,12 @@ FT_Load_Glyph
|
||||
#Typedef ##
|
||||
#Topic ##
|
||||
|
||||
#Topic OS_X
|
||||
#Substitute OS X
|
||||
##
|
||||
|
||||
#Topic Oval
|
||||
#Substitute ovals
|
||||
#Alias Ovals
|
||||
#Topic ##
|
||||
|
||||
#Topic Paint_Defaults
|
||||
@ -340,7 +369,7 @@ FT_Load_Glyph
|
||||
#Topic ##
|
||||
|
||||
#Topic Patch
|
||||
#Substitute patches
|
||||
#Alias Patches
|
||||
#Topic ##
|
||||
|
||||
#Topic Path_Effect
|
||||
@ -395,6 +424,20 @@ FT_Load_Glyph
|
||||
#Subtopic ##
|
||||
#Topic ##
|
||||
|
||||
#Topic PostScript
|
||||
#Substitute PostScript
|
||||
#Subtopic Arct
|
||||
#Substitute PostScript arct
|
||||
##
|
||||
##
|
||||
|
||||
#Topic Premultiply
|
||||
#Alias Premultiplied
|
||||
##
|
||||
|
||||
#Topic Raster_Engine
|
||||
##
|
||||
|
||||
#Topic Raster_Handle_Allocator
|
||||
#Class SkRasterHandleAllocator
|
||||
#Struct Rec
|
||||
@ -437,6 +480,9 @@ FT_Load_Glyph
|
||||
##
|
||||
#Topic ##
|
||||
|
||||
#Topic Right_Side_Bearing
|
||||
##
|
||||
|
||||
#Topic Round_Rect
|
||||
#Class SkRRect
|
||||
#Method void dump() const
|
||||
@ -466,7 +512,7 @@ FT_Load_Glyph
|
||||
#Topic ##
|
||||
|
||||
#Topic Sprite
|
||||
#Substitute sprites
|
||||
#Alias Sprites
|
||||
#Topic ##
|
||||
|
||||
#Topic Stream
|
||||
@ -479,6 +525,9 @@ FT_Load_Glyph
|
||||
#Class ##
|
||||
#Topic ##
|
||||
|
||||
#Topic Supersampling
|
||||
##
|
||||
|
||||
#Topic Surface
|
||||
#Class SkSurface
|
||||
#Method static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes,
|
||||
@ -517,13 +566,16 @@ FT_Load_Glyph
|
||||
#Class ##
|
||||
#Topic ##
|
||||
|
||||
#Topic Unpremultiply
|
||||
#Alias Unpremultiplied
|
||||
##
|
||||
|
||||
#Topic Vector
|
||||
#Struct SkVector
|
||||
##
|
||||
##
|
||||
|
||||
#Topic Vertices
|
||||
#Substitute vertices
|
||||
#Subtopic Colors
|
||||
##
|
||||
#Subtopic Texs
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,7 @@ algorithms that alter the drawing geometry, color, and transparency. For instanc
|
||||
The objects contained by <a href="#Paint">Paint</a> are opaque, and cannot be edited outside of the <a href="#Paint">Paint</a>
|
||||
to affect it. The implementation is free to defer computations associated with the
|
||||
<a href="#Paint">Paint</a>, or ignore them altogether. For instance, some <a href="undocumented#GPU">GPU</a> implementations draw all
|
||||
<a href="SkPath_Reference#Path">Path</a> geometries with anti-aliasing, regardless of how <a href="#SkPaint_kAntiAlias_Flag">SkPaint::kAntiAlias Flag</a>
|
||||
<a href="SkPath_Reference#Path">Path</a> geometries with <a href="undocumented#Anti_alias">Anti-aliasing</a>, regardless of how <a href="#SkPaint_kAntiAlias_Flag">SkPaint::kAntiAlias Flag</a>
|
||||
is set in <a href="#Paint">Paint</a>.
|
||||
|
||||
<a href="#Paint">Paint</a> describes a single color, a single font, a single image quality, and so on.
|
||||
@ -37,14 +37,14 @@ Multiple colors are drawn either by using multiple paints or with objects like
|
||||
| topics | description |
|
||||
| --- | --- |
|
||||
| <a href="#Initializers">Initializers</a> | Constructors and initialization. |
|
||||
| <a href="#Destructor">Destructor</a> | <a href="#Paint">Paint</a> termination. |
|
||||
| <a href="undocumented#Destructor">Destructor</a> | <a href="#Paint">Paint</a> termination. |
|
||||
| <a href="#Management">Management</a> | <a href="#Paint">Paint</a> copying, moving, comparing. |
|
||||
| <a href="#SkPaint_Hinting">Hinting</a> | <a href="undocumented#Glyph">Glyph</a> outline adjustment. |
|
||||
| <a href="#SkPaint_Flags">Flags</a> | Attributes represented by single bits. |
|
||||
| <a href="SkPaint_Reference#Anti_alias">Anti-alias</a> | Approximating coverage with transparency. |
|
||||
| <a href="#Dither">Dither</a> | Distributing color error. |
|
||||
| <a href="#Device_Text">Device Text</a> | Increase precision of glyph position. |
|
||||
| <a href="SkPaint_Reference#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> | Custom-sized bitmap glyphs. |
|
||||
| <a href="SkPaint_Reference#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> | Custom sized bitmap <a href="#Glyph">Glyphs</a>. |
|
||||
| <a href="#Automatic_Hinting">Automatic Hinting</a> | Always adjust glyph paths. |
|
||||
| <a href="#Vertical_Text">Vertical Text</a> | Orient text from top to bottom. |
|
||||
| <a href="#Fake_Bold">Fake Bold</a> | Approximate font styles. |
|
||||
@ -70,12 +70,12 @@ Multiple colors are drawn either by using multiple paints or with objects like
|
||||
| <a href="#Text_Size">Text Size</a> | Overall height in points. |
|
||||
| <a href="#Text_Scale_X">Text Scale X</a> | <a href="undocumented#Text">Text</a> horizontal scale. |
|
||||
| <a href="#Text_Skew_X">Text Skew X</a> | <a href="undocumented#Text">Text</a> horizontal slant. |
|
||||
| <a href="#Text_Encoding">Text Encoding</a> | <a href="undocumented#Text">Text</a> encoded as characters or glyphs. |
|
||||
| <a href="#Text_Encoding">Text Encoding</a> | <a href="undocumented#Text">Text</a> encoded as characters or <a href="#Glyph">Glyphs</a>. |
|
||||
| <a href="#Font_Metrics">Font Metrics</a> | Common glyph dimensions. |
|
||||
| <a href="#Measure_Text">Measure Text</a> | Width, height, bounds of text. |
|
||||
| <a href="#Text_Path">Text Path</a> | Geometry of glyphs. |
|
||||
| <a href="#Text_Path">Text Path</a> | Geometry of <a href="#Glyph">Glyphs</a>. |
|
||||
| <a href="#Text_Intercepts">Text Intercepts</a> | Advanced underline, strike through. |
|
||||
| <a href="#Fast_Bounds">Fast Bounds</a> | Appproxiate area required by <a href="#Paint">Paint</a>. |
|
||||
| <a href="#Fast_Bounds">Fast Bounds</a> | Approximate area required by <a href="#Paint">Paint</a>. |
|
||||
|
||||
## <a name="Constants"></a> Constants
|
||||
|
||||
@ -122,12 +122,12 @@ Multiple colors are drawn either by using multiple paints or with objects like
|
||||
| <a href="#SkPaint_canComputeFastBounds">canComputeFastBounds</a> | Returns true if settings allow for fast bounds computation. |
|
||||
| <a href="#SkPaint_computeFastBounds">computeFastBounds</a> | Returns fill bounds for quick reject tests. |
|
||||
| <a href="#SkPaint_computeFastStrokeBounds">computeFastStrokeBounds</a> | Returns stroke bounds for quick reject tests. |
|
||||
| <a href="#SkPaint_containsText">containsText</a> | Returns if all text corresponds to glyphs. |
|
||||
| <a href="#SkPaint_countText">countText</a> | Returns number of glyphs in text. |
|
||||
| <a href="#SkPaint_containsText">containsText</a> | Returns if all text corresponds to <a href="#Glyph">Glyphs</a>. |
|
||||
| <a href="#SkPaint_countText">countText</a> | Returns number of <a href="#Glyph">Glyphs</a> in text. |
|
||||
| <a href="#SkPaint_doComputeFastBounds">doComputeFastBounds</a> | Returns bounds for quick reject tests. |
|
||||
| <a href="#SkPaint_flatten">flatten</a> | Serializes into a buffer. |
|
||||
| <a href="#SkPaint_getAlpha">getAlpha</a> | Returns <a href="#Alpha">Color Alpha</a>, color opacity. |
|
||||
| <a href="#SkPaint_getBlendMode">getBlendMode</a> | Returns <a href="undocumented#Blend_Mode">Blend Mode</a>, how colors combine with dest. |
|
||||
| <a href="#SkPaint_getBlendMode">getBlendMode</a> | Returns <a href="undocumented#Blend_Mode">Blend Mode</a>, how colors combine with <a href="undocumented#Device">Device</a>. |
|
||||
| <a href="#SkPaint_getColor">getColor</a> | Returns <a href="#Alpha">Color Alpha</a> and <a href="#RGB">Color RGB</a>, one drawing color. |
|
||||
| <a href="#SkPaint_getColorFilter">getColorFilter</a> | Returns <a href="undocumented#Color_Filter">Color Filter</a>, how colors are altered. |
|
||||
| <a href="#SkPaint_getDrawLooper">getDrawLooper</a> | Returns <a href="undocumented#Draw_Looper">Draw Looper</a>, multiple layers. |
|
||||
@ -162,9 +162,9 @@ Multiple colors are drawn either by using multiple paints or with objects like
|
||||
| <a href="#SkPaint_getTextSize">getTextSize</a> | Returns text size in points. |
|
||||
| <a href="#SkPaint_getTextWidths">getTextWidths</a> | Returns advance and bounds for each glyph in text. |
|
||||
| <a href="#SkPaint_getTypeface">getTypeface</a> | Returns <a href="undocumented#Typeface">Typeface</a>, font description. |
|
||||
| <a href="#SkPaint_glyphsToUnichars">glyphsToUnichars</a> | Converts glyphs into text. |
|
||||
| <a href="#SkPaint_glyphsToUnichars">glyphsToUnichars</a> | Converts <a href="#Glyph">Glyphs</a> into text. |
|
||||
| <a href="#SkPaint_isAntiAlias">isAntiAlias</a> | Returns true if <a href="SkPaint_Reference#Anti_alias">Anti-alias</a> is set. |
|
||||
| <a href="#SkPaint_isAutohinted">isAutohinted</a> | Returns true if glyphs are always hinted. |
|
||||
| <a href="#SkPaint_isAutohinted">isAutohinted</a> | Returns true if <a href="#Glyph">Glyphs</a> are always hinted. |
|
||||
| <a href="#SkPaint_isDevKernText">isDevKernText</a> | Returns true if <a href="SkPaint_Reference#Full_Hinting_Spacing">Full Hinting Spacing</a> is set. |
|
||||
| <a href="#SkPaint_isDither">isDither</a> | Returns true if <a href="#Dither">Dither</a> is set. |
|
||||
| <a href="#SkPaint_isEmbeddedBitmapText">isEmbeddedBitmapText</a> | Returns true if <a href="SkPaint_Reference#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> is set. |
|
||||
@ -187,7 +187,7 @@ Multiple colors are drawn either by using multiple paints or with objects like
|
||||
| <a href="#SkPaint_setAlpha">setAlpha</a> | Sets <a href="#Alpha">Color Alpha</a>, color opacity. |
|
||||
| <a href="#SkPaint_setAntiAlias">setAntiAlias</a> | Sets or clears <a href="SkPaint_Reference#Anti_alias">Anti-alias</a>. |
|
||||
| <a href="#SkPaint_setARGB">setARGB</a> | Sets color by component. |
|
||||
| <a href="#SkPaint_setAutohinted">setAutohinted</a> | Sets glyphs to always be hinted. |
|
||||
| <a href="#SkPaint_setAutohinted">setAutohinted</a> | Sets <a href="#Glyph">Glyphs</a> to always be hinted. |
|
||||
| <a href="#SkPaint_setBlendMode">setBlendMode</a> | Sets <a href="undocumented#Blend_Mode">Blend Mode</a>, how colors combine with destination. |
|
||||
| <a href="#SkPaint_setColor">setColor</a> | Sets <a href="#Alpha">Color Alpha</a> and <a href="#RGB">Color RGB</a>, one drawing color. |
|
||||
| <a href="#SkPaint_setColorFilter">setColorFilter</a> | Sets <a href="undocumented#Color_Filter">Color Filter</a>, alters color. |
|
||||
@ -219,7 +219,7 @@ Multiple colors are drawn either by using multiple paints or with objects like
|
||||
| <a href="#SkPaint_setTypeface">setTypeface</a> | Sets <a href="undocumented#Typeface">Typeface</a>, font description. |
|
||||
| <a href="#SkPaint_setVerticalText">setVerticalText</a> | Sets or clears <a href="#Vertical_Text">Vertical Text</a>. |
|
||||
| <a href="#SkPaint_textToGlyphs">textToGlyphs</a> | Converts text into glyph indices. |
|
||||
| <a href="#SkPaint_toString">toString</a> | Converts <a href="#Paint">Paint</a> to machine parsable form (<a href="undocumented#Developer_Mode">Developer Mode</a>) |
|
||||
| <a href="#SkPaint_toString">toString</a> | Converts <a href="#Paint">Paint</a> to machine readable form. |
|
||||
| <a href="#SkPaint_unflatten">unflatten</a> | Populates from a serialized stream. |
|
||||
|
||||
# <a name="Initializers"></a> Initializers
|
||||
@ -270,7 +270,7 @@ Constructs <a href="#Paint">Paint</a> with default values.
|
||||
| <a href="#Vertical_Text">Vertical Text</a> | false |
|
||||
|
||||
The flags, text size, hinting, and miter limit may be overridden at compile time by defining
|
||||
paint default values. The overrides may be included in <a href="undocumented#SkUserConfig.h">SkUserConfig.h</a> or predefined by the
|
||||
paint default values. The overrides may be included in "<a href="undocumented#SkUserConfig">SkUserConfig</a>.h" or predefined by the
|
||||
build system.
|
||||
|
||||
### Return Value
|
||||
@ -643,7 +643,7 @@ by the client.
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPaint_unflatten_buffer"> <code><strong>buffer </strong></code> </a></td> <td>
|
||||
serialized data to <a href="#SkPaint_unflatten">unflatten</a></td>
|
||||
serialized data describing <a href="#Paint">Paint</a> content</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -683,7 +683,7 @@ to 26.6 fractional pixels.</td>
|
||||
With <a href="undocumented#FreeType">FreeType</a>, this is equivalent in spirit to the
|
||||
<a href="undocumented#FT_LOAD_TARGET_LIGHT">FT LOAD TARGET LIGHT</a> value supplied to <a href="undocumented#FT_Load_Glyph">FT Load Glyph</a>. It chooses a
|
||||
lighter hinting algorithm for non-monochrome modes.
|
||||
Generated glyphs may be fuzzy but better resemble their original shape.</td>
|
||||
Generated <a href="#Glyph">Glyphs</a> may be fuzzy but better resemble their original shape.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kNormal_Hinting"> <code><strong>SkPaint::kNormal_Hinting </strong></code> </a></td><td>2</td><td>Modifies glyph outlines to improve constrast. This is the default.
|
||||
@ -747,9 +747,9 @@ Does not check for valid values of <a href="#SkPaint_setHinting_hintingLevel">hi
|
||||
| <a href="#Hinting">Hinting</a> | value | effect on generated glyph outlines |
|
||||
| --- | --- | --- |
|
||||
| <a href="#SkPaint_kNo_Hinting">kNo Hinting</a> | 0 | leaves glyph outlines unchanged from their native representation |
|
||||
| <a href="#SkPaint_kSlight_Hinting">kSlight Hinting</a> | 1 | modifies glyph outlines minimally to improve constrast |
|
||||
| <a href="#SkPaint_kNormal_Hinting">kNormal Hinting</a> | 2 | modifies glyph outlines to improve constrast |
|
||||
| <a href="#SkPaint_kFull_Hinting">kFull Hinting</a> | 3 | modifies glyph outlines for maxiumum constrast |
|
||||
| <a href="#SkPaint_kSlight_Hinting">kSlight Hinting</a> | 1 | modifies glyph outlines minimally to improve contrast |
|
||||
| <a href="#SkPaint_kNormal_Hinting">kNormal Hinting</a> | 2 | modifies glyph outlines to improve contrast |
|
||||
| <a href="#SkPaint_kFull_Hinting">kFull Hinting</a> | 3 | modifies glyph outlines for maximum contrast |
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -929,17 +929,17 @@ paint.isDither()
|
||||
If <a href="#SkPaint_kAntiAlias_Flag">kAntiAlias Flag</a> is clear, pixel centers contained by the shape edge are drawn opaque.
|
||||
If <a href="#SkPaint_kAntiAlias_Flag">kAntiAlias Flag</a> is set, pixels are drawn with <a href="#Alpha">Color Alpha</a> equal to their coverage.
|
||||
|
||||
The rule for aliased pixels is inconsistent across platforms. A shape edge
|
||||
The rule for <a href="#Alias">Aliased</a> pixels is inconsistent across platforms. A shape edge
|
||||
passing through the pixel center may, but is not required to, draw the pixel.
|
||||
|
||||
<a href="undocumented#Raster_Engine">Raster Engine</a> draws aliased pixels whose centers are on or to the right of the start of an
|
||||
<a href="undocumented#Raster_Engine">Raster Engine</a> draws <a href="#Alias">Aliased</a> pixels whose centers are on or to the right of the start of an
|
||||
active <a href="SkPath_Reference#Path">Path</a> edge, and whose center is to the left of the end of the active <a href="SkPath_Reference#Path">Path</a> edge.
|
||||
|
||||
A platform may only support anti-aliased drawing. Some <a href="undocumented#GPU_backed">GPU-backed</a> platforms use
|
||||
supersampling to anti-alias all drawing, and have no mechanism to selectively
|
||||
alias.
|
||||
A platform may only support <a href="undocumented#Anti_alias">Anti-aliased</a> drawing. Some <a href="undocumented#GPU_backed">GPU-backed</a> platforms use
|
||||
<a href="undocumented#Supersampling">Supersampling</a> to <a href="SkPaint_Reference#Anti_alias">Anti-alias</a> all drawing, and have no mechanism to selectively
|
||||
<a href="undocumented#Alias">Alias</a>.
|
||||
|
||||
The amount of coverage computed for anti-aliased pixels also varies across platforms.
|
||||
The amount of coverage computed for <a href="undocumented#Anti_alias">Anti-aliased</a> pixels also varies across platforms.
|
||||
|
||||
<a href="SkPaint_Reference#Anti_alias">Anti-alias</a> is disabled by default.
|
||||
<a href="SkPaint_Reference#Anti_alias">Anti-alias</a> can be enabled by default by setting <a href="undocumented#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to <a href="#SkPaint_kAntiAlias_Flag">kAntiAlias Flag</a>
|
||||
@ -949,8 +949,8 @@ at compile time.
|
||||
|
||||
<div><fiddle-embed name="a6575a49467ce8d28bb01cc7638fa04d"><div>A red line is drawn with transparency on the edges to make it look smoother.
|
||||
A blue line draws only where the pixel centers are contained.
|
||||
The lines are drawn into an offscreen bitmap, then drawn magified to make the
|
||||
aliasing easier to see.</div></fiddle-embed></div>
|
||||
The lines are drawn into <a href="undocumented#Bitmap">Bitmap</a>, then drawn magnified to make the
|
||||
<a href="#Alias">Aliasing</a> easier to see.</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPaint_isAntiAlias"></a>
|
||||
## isAntiAlias
|
||||
@ -1017,7 +1017,7 @@ paint1 == paint2
|
||||
---
|
||||
|
||||
# <a name="Dither"></a> Dither
|
||||
<a href="#Dither">Dither</a> increases fidelity by adjusting the color of adjcent pixels.
|
||||
<a href="#Dither">Dither</a> increases fidelity by adjusting the color of adjacent pixels.
|
||||
This can help to smooth color transitions and reducing banding in gradients.
|
||||
Dithering lessens visible banding from <a href="undocumented#SkColorType">kRGB 565 SkColorType</a>
|
||||
and <a href="undocumented#SkColorType">kRGBA 8888 SkColorType</a> gradients,
|
||||
@ -1120,7 +1120,7 @@ Gradient <a href="undocumented#RGB_565">Color RGB-565</a>
|
||||
|
||||
When set, <a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="#RGB">Color RGB</a> stripes that
|
||||
create a color, and relies
|
||||
on the small size of the stripe and visual perception to make the color fringing inperceptible.
|
||||
on the small size of the stripe and visual perception to make the color fringing imperceptible.
|
||||
<a href="SkPaint_Reference#LCD_Text">LCD Text</a> can be enabled on devices that orient stripes horizontally or vertically, and that order
|
||||
the color components as <a href="#RGB">Color RGB</a> or <a href="#RBG">Color RBG</a>.
|
||||
|
||||
@ -1136,8 +1136,8 @@ Either or both techniques can be enabled.
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="4606ae1be792d6bc46d496432f050ee9"><div>Four commas are drawn normally and with combinations of <a href="SkPaint_Reference#LCD_Text">LCD Text</a> and <a href="SkPaint_Reference#Subpixel_Text">Subpixel Text</a>.
|
||||
When <a href="SkPaint_Reference#Subpixel_Text">Subpixel Text</a> is disabled, the comma glyphs are indentical, but not evenly spaced.
|
||||
When <a href="SkPaint_Reference#Subpixel_Text">Subpixel Text</a> is enabled, the comma glyphs are unique, but appear evenly spaced.</div></fiddle-embed></div>
|
||||
When <a href="SkPaint_Reference#Subpixel_Text">Subpixel Text</a> is disabled, the comma <a href="#Glyph">Glyphs</a> are identical, but not evenly spaced.
|
||||
When <a href="SkPaint_Reference#Subpixel_Text">Subpixel Text</a> is enabled, the comma <a href="#Glyph">Glyphs</a> are unique, but appear evenly spaced.</div></fiddle-embed></div>
|
||||
|
||||
## <a name="Linear_Text"></a> Linear Text
|
||||
|
||||
@ -1213,7 +1213,7 @@ of the color increases, the edge of the glyph appears to move towards the outsid
|
||||
bool isSubpixelText() const
|
||||
</pre>
|
||||
|
||||
If true, glyphs at different sub-pixel positions may differ on pixel edge coverage.
|
||||
If true, <a href="#Glyph">Glyphs</a> at different sub-pixel positions may differ on pixel edge coverage.
|
||||
|
||||
Equivalent to <a href="#SkPaint_getFlags">getFlags</a> masked with <a href="#SkPaint_kSubpixelText_Flag">kSubpixelText Flag</a>.
|
||||
|
||||
@ -1243,7 +1243,7 @@ paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag)
|
||||
void setSubpixelText(bool subpixelText)
|
||||
</pre>
|
||||
|
||||
Requests, but does not require, that glyphs respect sub-pixel positioning.
|
||||
Requests, but does not require, that <a href="#Glyph">Glyphs</a> respect sub-pixel positioning.
|
||||
|
||||
Sets <a href="#SkPaint_kSubpixelText_Flag">kSubpixelText Flag</a> if <a href="#SkPaint_setSubpixelText_subpixelText">subpixelText</a> is true.
|
||||
Clears <a href="#SkPaint_kSubpixelText_Flag">kSubpixelText Flag</a> if <a href="#SkPaint_setSubpixelText_subpixelText">subpixelText</a> is false.
|
||||
@ -1273,7 +1273,7 @@ paint1 == paint2
|
||||
|
||||
When set, <a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="#RGB">Color RGB</a> stripes that
|
||||
create a color, and relies
|
||||
on the small size of the stripe and visual perception to make the color fringing inperceptible.
|
||||
on the small size of the stripe and visual perception to make the color fringing imperceptible.
|
||||
<a href="SkPaint_Reference#LCD_Text">LCD Text</a> can be enabled on devices that orient stripes horizontally or vertically, and that order
|
||||
the color components as <a href="#RGB">Color RGB</a> or <a href="#RBG">Color RBG</a>.
|
||||
|
||||
@ -1284,7 +1284,7 @@ the color components as <a href="#RGB">Color RGB</a> or <a href="#RBG">Color RBG
|
||||
bool isLCDRenderText() const
|
||||
</pre>
|
||||
|
||||
If true, glyphs may use <a href="undocumented#LCD">LCD</a> striping to improve glyph edges.
|
||||
If true, <a href="#Glyph">Glyphs</a> may use <a href="undocumented#LCD">LCD</a> striping to improve glyph edges.
|
||||
|
||||
Returns true if <a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> is set.
|
||||
|
||||
@ -1314,7 +1314,7 @@ paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag)
|
||||
void setLCDRenderText(bool lcdText)
|
||||
</pre>
|
||||
|
||||
Requests, but does not require, that glyphs use <a href="undocumented#LCD">LCD</a> striping for glyph edges.
|
||||
Requests, but does not require, that <a href="#Glyph">Glyphs</a> use <a href="undocumented#LCD">LCD</a> striping for glyph edges.
|
||||
|
||||
Sets <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> if <a href="#SkPaint_setLCDRenderText_lcdText">lcdText</a> is true.
|
||||
Clears <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> if <a href="#SkPaint_setLCDRenderText_lcdText">lcdText</a> is false.
|
||||
@ -1341,7 +1341,7 @@ paint1 == paint2
|
||||
---
|
||||
|
||||
# <a name="Font_Embedded_Bitmaps"></a> Font Embedded Bitmaps
|
||||
<a href="SkPaint_Reference#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> allows selecting custom-sized bitmap glyphs.
|
||||
<a href="SkPaint_Reference#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> allows selecting custom sized bitmap <a href="#Glyph">Glyphs</a>.
|
||||
<a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> when set chooses an embedded bitmap glyph over an outline contained
|
||||
in a font if the platform supports this option.
|
||||
|
||||
@ -1357,10 +1357,11 @@ the outline glyph if <a href="#SkPaint_kEmbeddedBitmapText_Flag">kEmbeddedBitmap
|
||||
### Example
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
|
||||
!fiddle<div>The hintgasp <a href="undocumented#TrueType">TrueType</a> font in the <a href="undocumented#Skia">Skia</a> resources/fonts directory includes an embedded
|
||||
bitmap glyph at odd font sizes. This example works on platforms that use <a href="undocumented#FreeType">FreeType</a>
|
||||
as their <a href="#Engine">Font Engine</a>.
|
||||
<a href="undocumented#Windows">Windows</a> may, but is not required to, return a bitmap glyph if <a href="#SkPaint_kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> is set.</div><a href="undocumented#SkBitmap">SkBitmap</a> bitmap;
|
||||
<div>The "" <a href="undocumented#TrueType">TrueType</a> font in the <a href="undocumented#Skia">Skia</a> resources/fonts directory
|
||||
includes an embedded bitmap <a href="undocumented#Glyph">Glyph</a> at odd font sizes. This example works
|
||||
on platforms that use <a href="undocumented#FreeType">FreeType</a> as their <a href="#Engine">Font Engine</a>.
|
||||
<a href="undocumented#Windows">Windows</a> may, but is not required to, return a bitmap glyph if
|
||||
<a href="#SkPaint_kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> is set.</div><a href="undocumented#SkBitmap">SkBitmap</a> bitmap;
|
||||
bitmap.allocN32Pixels(30, 15);
|
||||
bitmap.eraseColor(0);
|
||||
<a href="SkCanvas_Reference#SkCanvas">SkCanvas</a> offscreen(bitmap);
|
||||
@ -1374,7 +1375,7 @@ paint.</pre>
|
||||
bool isEmbeddedBitmapText() const
|
||||
</pre>
|
||||
|
||||
If true, <a href="#Engine">Font Engine</a> may return glyphs from font bitmaps instead of from outlines.
|
||||
If true, <a href="#Engine">Font Engine</a> may return <a href="#Glyph">Glyphs</a> from font bitmaps instead of from outlines.
|
||||
|
||||
Equivalent to <a href="#SkPaint_getFlags">getFlags</a> masked with <a href="#SkPaint_kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a>.
|
||||
|
||||
@ -1432,7 +1433,7 @@ paint1 == paint2
|
||||
|
||||
# <a name="Automatic_Hinting"></a> Automatic Hinting
|
||||
If <a href="#SkPaint_Hinting">Hinting</a> is set to <a href="#SkPaint_kNormal_Hinting">kNormal Hinting</a> or <a href="#SkPaint_kFull_Hinting">kFull Hinting</a>, <a href="#Automatic_Hinting">Automatic Hinting</a>
|
||||
instructs the <a href="undocumented#Font_Manager">Font Manager</a> to always hint glyphs.
|
||||
instructs the <a href="undocumented#Font_Manager">Font Manager</a> to always hint <a href="#Glyph">Glyphs</a>.
|
||||
<a href="#Automatic_Hinting">Automatic Hinting</a> has no effect if <a href="#SkPaint_Hinting">Hinting</a> is set to <a href="#SkPaint_kNo_Hinting">kNo Hinting</a> or
|
||||
<a href="#SkPaint_kSlight_Hinting">kSlight Hinting</a>.
|
||||
|
||||
@ -1447,7 +1448,7 @@ bool isAutohinted() const
|
||||
|
||||
If true, and if <a href="#SkPaint_Hinting">Hinting</a> is set to <a href="#SkPaint_kNormal_Hinting">kNormal Hinting</a> or <a href="#SkPaint_kFull_Hinting">kFull Hinting</a>, and if
|
||||
platform uses <a href="undocumented#FreeType">FreeType</a> as the <a href="undocumented#Font_Manager">Font Manager</a>, instruct the <a href="undocumented#Font_Manager">Font Manager</a> to always hint
|
||||
glyphs.
|
||||
<a href="#Glyph">Glyphs</a>.
|
||||
|
||||
Equivalent to <a href="#SkPaint_getFlags">getFlags</a> masked with <a href="#SkPaint_kAutoHinting_Flag">kAutoHinting Flag</a>.
|
||||
|
||||
@ -1482,7 +1483,7 @@ void setAutohinted(bool useAutohinter)
|
||||
</pre>
|
||||
|
||||
If <a href="#SkPaint_Hinting">Hinting</a> is set to <a href="#SkPaint_kNormal_Hinting">kNormal Hinting</a> or <a href="#SkPaint_kFull_Hinting">kFull Hinting</a> and <a href="#SkPaint_setAutohinted_useAutohinter">useAutohinter</a> is set,
|
||||
instruct the <a href="undocumented#Font_Manager">Font Manager</a> to always hint glyphs.
|
||||
instruct the <a href="undocumented#Font_Manager">Font Manager</a> to always hint <a href="#Glyph">Glyphs</a>.
|
||||
<a href="#Automatic_Hinting">Automatic Hinting</a> has no effect if <a href="#SkPaint_Hinting">Hinting</a> is set to <a href="#SkPaint_kNo_Hinting">kNo Hinting</a> or
|
||||
<a href="#SkPaint_kSlight_Hinting">kSlight Hinting</a>.
|
||||
|
||||
@ -1510,14 +1511,14 @@ setting for <a href="#SkPaint_kAutoHinting_Flag">kAutoHinting Flag</a></td>
|
||||
|
||||
# <a name="Vertical_Text"></a> Vertical Text
|
||||
<a href="undocumented#Text">Text</a> may be drawn by positioning each glyph, or by positioning the first glyph and
|
||||
using <a href="#Advance">Font Advance</a> to position subsequent glyphs. By default, each successive glyph
|
||||
is positioned to the right of the preceeding glyph. <a href="#Vertical_Text">Vertical Text</a> sets successive
|
||||
glyphs to position below the preceeding glyph.
|
||||
using <a href="#Advance">Font Advance</a> to position subsequent <a href="#Glyph">Glyphs</a>. By default, each successive glyph
|
||||
is positioned to the right of the preceding glyph. <a href="#Vertical_Text">Vertical Text</a> sets successive
|
||||
<a href="#Glyph">Glyphs</a> to position below the preceding glyph.
|
||||
|
||||
<a href="undocumented#Skia">Skia</a> can translate text character codes as a series of glyphs, but does not implement
|
||||
<a href="undocumented#Skia">Skia</a> can translate text character codes as a series of <a href="#Glyph">Glyphs</a>, but does not implement
|
||||
font substitution,
|
||||
textual substitution, line layout, or contextual spacing like kerning pairs. Use
|
||||
a text shaping engine likeHarfBuzzhttp://harfbuzz.org/to translate text runs
|
||||
textual substitution, line layout, or contextual spacing like <a href="undocumented#Kerning">Kerning</a> pairs. Use
|
||||
a text shaping engine likeHarfBuzzto translate text runs
|
||||
into glyph series.
|
||||
|
||||
<a href="#Vertical_Text">Vertical Text</a> is clear if text is drawn left to right or set if drawn from top to bottom.
|
||||
@ -1540,7 +1541,7 @@ into glyph series.
|
||||
bool isVerticalText() const
|
||||
</pre>
|
||||
|
||||
If true, glyphs are drawn top to bottom instead of left to right.
|
||||
If true, <a href="#Glyph">Glyphs</a> are drawn top to bottom instead of left to right.
|
||||
|
||||
Equivalent to <a href="#SkPaint_getFlags">getFlags</a> masked with <a href="#SkPaint_kVerticalText_Flag">kVerticalText Flag</a>.
|
||||
|
||||
@ -1605,8 +1606,8 @@ bold font face using the platform's <a href="undocumented#Font_Manager">Font Man
|
||||
Use <a href="#Text_Skew_X">Text Skew X</a> to approximate an italic font style when the italic font face
|
||||
is not available.
|
||||
|
||||
A <a href="undocumented#FreeType_based">FreeType-based</a> port may define <a href="undocumented#SK_USE_FREETYPE_EMBOLDEN">SK USE FREETYPE EMBOLDEN</a> at compile time to direct
|
||||
the font engine to create the bold glyphs. Otherwise, the extra bold is computed
|
||||
A <a href="undocumented#FreeType">FreeType</a> based port may define <a href="undocumented#SK_USE_FREETYPE_EMBOLDEN">SK USE FREETYPE EMBOLDEN</a> at compile time to direct
|
||||
the font engine to create the bold <a href="#Glyph">Glyphs</a>. Otherwise, the extra bold is computed
|
||||
by increasing the stroke width and setting the <a href="#SkPaint_Style">Style</a> to <a href="#SkPaint_kStrokeAndFill_Style">kStrokeAndFill Style</a> as needed.
|
||||
|
||||
<a href="#Fake_Bold">Fake Bold</a> is disabled by default.
|
||||
@ -1653,7 +1654,7 @@ paint.isFakeBoldText() == !!(paint.getFlags() & SkPaint::kFakeBoldText_Flag)
|
||||
void setFakeBoldText(bool fakeBoldText)
|
||||
</pre>
|
||||
|
||||
Use increased stroke width when creating glyph bitmaps to approximate bolding.
|
||||
Use increased stroke width when creating glyph bitmaps to approximate a bold typeface.
|
||||
|
||||
Sets <a href="#SkPaint_kFakeBoldText_Flag">kFakeBoldText Flag</a> if <a href="#SkPaint_setFakeBoldText_fakeBoldText">fakeBoldText</a> is true.
|
||||
Clears <a href="#SkPaint_kFakeBoldText_Flag">kFakeBoldText Flag</a> if <a href="#SkPaint_setFakeBoldText_fakeBoldText">fakeBoldText</a> is false.
|
||||
@ -1680,13 +1681,13 @@ paint1 == paint2
|
||||
---
|
||||
|
||||
# <a name="Full_Hinting_Spacing"></a> Full Hinting Spacing
|
||||
<a href="SkPaint_Reference#Full_Hinting_Spacing">Full Hinting Spacing</a> adjusts the character spacing by the difference of the
|
||||
hinted and unhinted left and right side bearings,
|
||||
if <a href="#SkPaint_Hinting">Hinting</a> is set to <a href="#SkPaint_kFull_Hinting">kFull Hinting</a>. <a href="SkPaint_Reference#Full_Hinting_Spacing">Full Hinting Spacing</a> only
|
||||
applies to platforms that use <a href="undocumented#FreeType">FreeType</a> as their <a href="#Engine">Font Engine</a>.
|
||||
if <a href="#SkPaint_Hinting">Hinting</a> is set to <a href="#SkPaint_kFull_Hinting">kFull Hinting</a>, <a href="SkPaint_Reference#Full_Hinting_Spacing">Full Hinting Spacing</a> adjusts the character
|
||||
spacing by the difference of the hinted and <a href="undocumented#Unhinted">Unhinted</a> <a href="undocumented#Left_Side_Bearing">Left Side Bearing</a> and
|
||||
<a href="undocumented#Right_Side_Bearing">Right Side Bearing</a>. <a href="SkPaint_Reference#Full_Hinting_Spacing">Full Hinting Spacing</a> only applies to platforms that use
|
||||
<a href="undocumented#FreeType">FreeType</a> as their <a href="#Engine">Font Engine</a>.
|
||||
|
||||
<a href="SkPaint_Reference#Full_Hinting_Spacing">Full Hinting Spacing</a> is not related to text kerning, where the space between
|
||||
a specific pair of characters is adjusted using data in the font's kerning tables.
|
||||
<a href="SkPaint_Reference#Full_Hinting_Spacing">Full Hinting Spacing</a> is not related to text <a href="undocumented#Kerning">Kerning</a>, where the space between
|
||||
a specific pair of characters is adjusted using data in the font's <a href="undocumented#Kerning">Kerning</a> tables.
|
||||
|
||||
<a name="SkPaint_isDevKernText"></a>
|
||||
## isDevKernText
|
||||
@ -1746,8 +1747,8 @@ paint1 == paint2
|
||||
<a href="undocumented#Filter_Quality">Filter Quality</a> trades speed for image filtering when the image is scaled.
|
||||
A lower <a href="undocumented#Filter_Quality">Filter Quality</a> draws faster, but has less fidelity.
|
||||
A higher <a href="undocumented#Filter_Quality">Filter Quality</a> draws slower, but looks better.
|
||||
If the image is unscaled, the <a href="undocumented#Filter_Quality">Filter Quality</a> choice will not result in a noticable
|
||||
difference.
|
||||
If the image is drawn without scaling, the <a href="undocumented#Filter_Quality">Filter Quality</a> choice will not result
|
||||
in a noticeable difference.
|
||||
|
||||
<a href="undocumented#Filter_Quality">Filter Quality</a> is used in <a href="#Paint">Paint</a> passed as a parameter to
|
||||
|
||||
@ -1838,7 +1839,7 @@ or stroked shape in a
|
||||
32-bit value. Each component occupies 8-bits, ranging from zero: no contribution;
|
||||
to 255: full intensity. All values in any combination are valid.
|
||||
|
||||
<a href="undocumented#Color">Color</a> is not premultiplied;
|
||||
<a href="undocumented#Color">Color</a> is not <a href="#Premultiply">Premultiplied</a>;
|
||||
<a href="#Alpha">Color Alpha</a> sets the transparency independent of <a href="#RGB">Color RGB</a>: <a href="#RGB_Red">Color RGB Red</a>, <a href="#RGB_Blue">Color RGB Blue</a>, and <a href="#RGB_Green">Color RGB Green</a>.
|
||||
|
||||
The bit positions of <a href="#Alpha">Color Alpha</a> and <a href="#RGB">Color RGB</a> are independent of the bit positions
|
||||
@ -1859,13 +1860,13 @@ on the output device, which may have more or fewer bits, and may have a differen
|
||||
SkColor getColor() const
|
||||
</pre>
|
||||
|
||||
Retrieves <a href="#Alpha">Color Alpha</a> and <a href="#RGB">Color RGB</a>, unpremultiplied, packed into 32 bits.
|
||||
Retrieves <a href="#Alpha">Alpha</a> and <a href="#RGB">Color RGB</a>, <a href="#Unpremultiply">Unpremultiplied</a>, packed into 32 bits.
|
||||
Use helpers <a href="undocumented#SkColorGetA">SkColorGetA</a>, <a href="undocumented#SkColorGetR">SkColorGetR</a>, <a href="undocumented#SkColorGetG">SkColorGetG</a>, and <a href="undocumented#SkColorGetB">SkColorGetB</a> to extract
|
||||
a color component.
|
||||
|
||||
### Return Value
|
||||
|
||||
<a href="undocumented#Unpremultiplied">Unpremultiplied</a> <a href="#ARGB">Color ARGB</a>
|
||||
<a href="#Unpremultiply">Unpremultiplied</a> <a href="#ARGB">Color ARGB</a>
|
||||
|
||||
### Example
|
||||
|
||||
@ -1892,13 +1893,13 @@ Yellow is 100% red, 100% green, and 0% blue.
|
||||
void setColor(SkColor color)
|
||||
</pre>
|
||||
|
||||
Sets <a href="#Alpha">Color Alpha</a> and <a href="#RGB">Color RGB</a> used when stroking and filling. The <a href="#SkPaint_setColor_color">color</a> is a 32-bit value,
|
||||
unpremutiplied, packing 8-bit components for <a href="#Alpha">Color Alpha</a>, <a href="#RGB_Red">Color RGB Red</a>, <a href="#RGB_Blue">Color RGB Blue</a>, and <a href="#RGB_Green">Color RGB Green</a>.
|
||||
Sets <a href="#Alpha">Alpha</a> and <a href="#RGB">Color RGB</a> used when stroking and filling. The <a href="#SkPaint_setColor_color">color</a> is a 32-bit value,
|
||||
<a href="#Unpremultiply">Unpremultiplied</a>, packing 8-bit components for <a href="#Alpha">Alpha</a>, <a href="#Red">Red</a>, <a href="#Blue">Blue</a>, and <a href="#Green">Green</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPaint_setColor_color"> <code><strong>color </strong></code> </a></td> <td>
|
||||
<a href="undocumented#Unpremultiplied">Unpremultiplied</a> <a href="#ARGB">Color ARGB</a></td>
|
||||
<a href="#Unpremultiply">Unpremultiplied</a> <a href="#ARGB">Color ARGB</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1931,11 +1932,11 @@ green1 == green2
|
||||
uint8_t getAlpha() const
|
||||
</pre>
|
||||
|
||||
Retrieves <a href="#Alpha">Color Alpha</a> from the <a href="undocumented#Color">Color</a> used when stroking and filling.
|
||||
Retrieves <a href="#Alpha">Alpha</a> from the <a href="undocumented#Color">Color</a> used when stroking and filling.
|
||||
|
||||
### Return Value
|
||||
|
||||
<a href="#Alpha">Color Alpha</a> ranging from zero, fully transparent, to 255, fully opaque
|
||||
<a href="#Alpha">Alpha</a> ranging from zero, fully transparent, to 255, fully opaque
|
||||
|
||||
### Example
|
||||
|
||||
@ -1958,7 +1959,7 @@ Retrieves <a href="#Alpha">Color Alpha</a> from the <a href="undocumented#Color"
|
||||
void setAlpha(U8CPU a)
|
||||
</pre>
|
||||
|
||||
Replaces <a href="#Alpha">Color Alpha</a>, leaving <a href="#RGB">Color RGB</a>
|
||||
Replaces <a href="#Alpha">Alpha</a>, leaving <a href="#RGB">Color RGB</a>
|
||||
unchanged. An out of range value triggers an assert in the debug
|
||||
build. <a href="#SkPaint_setAlpha_a">a</a> is <a href="#SkPaint_setAlpha_a">a</a> value from zero to 255.
|
||||
<a href="#SkPaint_setAlpha_a">a</a> set to zero makes <a href="undocumented#Color">Color</a> fully transparent; <a href="#SkPaint_setAlpha_a">a</a> set to 255 makes <a href="undocumented#Color">Color</a>
|
||||
@ -1967,7 +1968,7 @@ fully opaque.
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPaint_setAlpha_a"> <code><strong>a </strong></code> </a></td> <td>
|
||||
<a href="#Alpha">Color Alpha</a> component of <a href="undocumented#Color">Color</a></td>
|
||||
<a href="#Alpha">Alpha</a> component of <a href="undocumented#Color">Color</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1993,8 +1994,7 @@ void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
|
||||
</pre>
|
||||
|
||||
Sets <a href="undocumented#Color">Color</a> used when drawing solid fills. The color components range from 0 to 255.
|
||||
The color is unpremultiplied;
|
||||
<a href="#Alpha">Color Alpha</a> sets the transparency independent of <a href="#RGB">Color RGB</a>.
|
||||
The color is <a href="#Unpremultiply">Unpremultiplied</a>; <a href="#Alpha">Alpha</a> sets the transparency independent of <a href="#RGB">Color RGB</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -2085,8 +2085,8 @@ a fill draw.
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kFill_Style"> <code><strong>SkPaint::kFill_Style </strong></code> </a></td><td>0</td><td>Set to fill geometry.
|
||||
Applies to <a href="undocumented#Rect">Rect</a>, <a href="undocumented#Region">Region</a>, <a href="undocumented#Round_Rect">Round Rect</a>, <a href="undocumented#Circle">Circle</a>, <a href="undocumented#Oval">Oval</a>, <a href="SkPath_Reference#Path">Path</a>, and <a href="undocumented#Text">Text</a>.
|
||||
<a href="undocumented#Bitmap">Bitmap</a>, <a href="undocumented#Image">Image</a>, <a href="undocumented#Patch">Patch</a>, <a href="undocumented#Region">Region</a>, <a href="undocumented#Sprite">Sprite</a>, and <a href="undocumented#Vertices">Vertices</a> are painted as if
|
||||
Applies to <a href="undocumented#Rect">Rect</a>, <a href="undocumented#Region">Region</a>, <a href="undocumented#Round_Rect">Round Rect</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>.
|
||||
<a href="undocumented#Bitmap">Bitmap</a>, <a href="undocumented#Image">Image</a>, <a href="#Patch">Patches</a>, <a href="undocumented#Region">Region</a>, <a href="#Sprite">Sprites</a>, and <a href="undocumented#Vertices">Vertices</a> are painted as if
|
||||
<a href="#SkPaint_kFill_Style">kFill Style</a> is set, and ignore the set <a href="#SkPaint_Style">Style</a>.
|
||||
The <a href="#Fill_Type">Path Fill Type</a> specifies additional rules to fill the area outside the path edge,
|
||||
and to create an unfilled hole inside the shape.
|
||||
@ -2094,15 +2094,14 @@ and to create an unfilled hole inside the shape.
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kStroke_Style"> <code><strong>SkPaint::kStroke_Style </strong></code> </a></td><td>1</td><td>Set to stroke geometry.
|
||||
Applies to <a href="undocumented#Rect">Rect</a>, <a href="undocumented#Region">Region</a>, <a href="undocumented#Round_Rect">Round Rect</a>, <a href="undocumented#Arc">Arc</a>, <a href="undocumented#Circle">Circle</a>, <a href="undocumented#Oval">Oval</a>,
|
||||
<a href="SkPath_Reference#Path">Path</a>, and <a href="undocumented#Text">Text</a>.
|
||||
<a href="undocumented#Arc">Arc</a>, <a href="undocumented#Line">Line</a>, <a href="undocumented#Point">Point</a>, and <a href="#Array">Point Array</a> are always drawn as if <a href="#SkPaint_kStroke_Style">kStroke Style</a> is set,
|
||||
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>.
|
||||
<a href="#Arc">Arcs</a>, <a href="#Line">Lines</a>, and <a href="#Point">Points</a>, are always drawn as if <a href="#SkPaint_kStroke_Style">kStroke Style</a> is set,
|
||||
and ignore the set <a href="#SkPaint_Style">Style</a>.
|
||||
The stroke construction is unaffected by the <a href="#Fill_Type">Path Fill Type</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kStrokeAndFill_Style"> <code><strong>SkPaint::kStrokeAndFill_Style </strong></code> </a></td><td>2</td><td>Set to stroke and fill geometry.
|
||||
Applies to <a href="undocumented#Rect">Rect</a>, <a href="undocumented#Region">Region</a>, <a href="undocumented#Round_Rect">Round Rect</a>, <a href="undocumented#Circle">Circle</a>, <a href="undocumented#Oval">Oval</a>, <a href="SkPath_Reference#Path">Path</a>, and <a href="undocumented#Text">Text</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="#Circle">Circles</a>, <a href="#Oval">Ovals</a>, <a href="SkPath_Reference#Path">Path</a>, and <a href="undocumented#Text">Text</a>.
|
||||
<a href="SkPath_Reference#Path">Path</a> is treated as if it is set to <a href="#SkPath_kWinding_FillType">SkPath::kWinding FillType</a>,
|
||||
and the set <a href="#Fill_Type">Path Fill Type</a> is ignored.</td>
|
||||
</tr>
|
||||
@ -2204,7 +2203,7 @@ The default width for the paint is zero.
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="01e3e08a3022a351628ff54e84887756">raster gpu<div>The pixels hit to represent thin lines vary with the angle of the
|
||||
<div><fiddle-embed name="01e3e08a3022a351628ff54e84887756"><div>The pixels hit to represent thin lines vary with the angle of the
|
||||
line and the platform's implementation.</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPaint_getStrokeWidth"></a>
|
||||
@ -2282,7 +2281,7 @@ is replaced with <a href="#SkPaint_kBevel_Join">kBevel Join</a>.
|
||||
|
||||
miter limit = 1 / sin ( angle / 2 )<a href="#Miter_Limit">Miter Limit</a> default value is 4.
|
||||
The default may be changed at compile time by setting <a href="undocumented#SkPaintDefaults_MiterLimit">SkPaintDefaults MiterLimit</a>
|
||||
in <a href="undocumented#SkUserConfig.h">SkUserConfig.h</a> or as a define supplied by the build environment.
|
||||
in "<a href="undocumented#SkUserConfig">SkUserConfig</a>.h" or as a define supplied by the build environment.
|
||||
|
||||
Here are some miter limits and the angles that triggers them.
|
||||
|
||||
@ -2698,8 +2697,8 @@ true if the path represents <a href="#Style_Fill">Style Fill</a>, or false if it
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="cedd6233848198e1fca4d1e14816baaf"><div>A very small quad stroke is turned into a filled path with increasing levels of precision.
|
||||
At the lowest precision, the quad stroke is approximated by a rectangle.
|
||||
<div><fiddle-embed name="cedd6233848198e1fca4d1e14816baaf"><div>A very small <a href="#Quad">Quad</a> stroke is turned into a filled path with increasing levels of precision.
|
||||
At the lowest precision, the <a href="#Quad">Quad</a> stroke is approximated by a rectangle.
|
||||
At the highest precision, the filled path has high fidelity compared to the original stroke.</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
@ -3134,7 +3133,7 @@ replace <a href="SkPath_Reference#Path">Path</a> with a modification when drawn<
|
||||
---
|
||||
|
||||
# <a name="Mask_Filter_Methods"></a> Mask Filter Methods
|
||||
<a href="undocumented#Mask_Filter">Mask Filter</a> uses <a href="#Alpha">Color Alpha</a> of the shape drawn to create <a href="undocumented#Mask_Alpha">Mask Alpha</a>.
|
||||
<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.
|
||||
@ -3327,7 +3326,7 @@ 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="undocumented#Arc">Arc</a>, <a href="undocumented#Circle">Circle</a>, <a href="undocumented#Oval">Oval</a>,
|
||||
<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>.
|
||||
|
||||
### Example
|
||||
@ -3423,7 +3422,7 @@ how geometry is converted to <a href="undocumented#Mask_Alpha">Mask Alpha</a></t
|
||||
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">Color Alpha</a> only.
|
||||
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
|
||||
<a href="undocumented#Mask_Filter">Mask Filter</a> and <a href="undocumented#Rasterizer">Rasterizer</a>.
|
||||
|
||||
@ -3660,11 +3659,11 @@ enum <a href="#SkPaint_Align">Align</a> {
|
||||
};</pre>
|
||||
|
||||
<a href="#SkPaint_Align">Align</a> adjusts the text relative to the text position.
|
||||
<a href="#SkPaint_Align">Align</a> affects glyphs drawn with: <a href="#SkCanvas_drawText">SkCanvas::drawText</a>, <a href="#SkCanvas_drawPosText">SkCanvas::drawPosText</a>,
|
||||
<a href="#SkPaint_Align">Align</a> affects <a href="#Glyph">Glyphs</a> drawn with: <a href="#SkCanvas_drawText">SkCanvas::drawText</a>, <a href="#SkCanvas_drawPosText">SkCanvas::drawPosText</a>,
|
||||
<a href="#SkCanvas_drawPosTextH">SkCanvas::drawPosTextH</a>, <a href="#SkCanvas_drawTextOnPath">SkCanvas::drawTextOnPath</a>,
|
||||
<a href="#SkCanvas_drawTextOnPathHV">SkCanvas::drawTextOnPathHV</a>, <a href="#SkCanvas_drawTextRSXform">SkCanvas::drawTextRSXform</a>, <a href="#SkCanvas_drawTextBlob">SkCanvas::drawTextBlob</a>,
|
||||
and <a href="#SkCanvas_drawString">SkCanvas::drawString</a>;
|
||||
as well as calls that place text glyphs like <a href="#SkPaint_getTextWidths">getTextWidths</a> and <a href="#SkPaint_getTextPath">getTextPath</a>.
|
||||
as well as calls that place text <a href="#Glyph">Glyphs</a> like <a href="#SkPaint_getTextWidths">getTextWidths</a> and <a href="#SkPaint_getTextPath">getTextPath</a>.
|
||||
|
||||
The text position is set by the font for both horizontal and vertical text.
|
||||
Typically, for horizontal text, the position is to the left side of the glyph on the
|
||||
@ -3942,16 +3941,16 @@ enum <a href="#SkPaint_TextEncoding">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> standardhttp://unicode.org/standard/standard.html.
|
||||
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
|
||||
in the total storage required.
|
||||
|
||||
<a href="undocumented#UTF_8">UTF-8</a> (<a href="undocumented#RFC">RFC</a> 3629)https://tools.ietf.org/html/rfc3629is made up of 8-bit bytes,
|
||||
<a href="undocumented#UTF_8">UTF-8</a> (<a href="undocumented#RFC">RFC</a> 3629)is made up of 8-bit bytes,
|
||||
and is a superset of <a href="undocumented#ASCII">ASCII</a>.
|
||||
<a href="undocumented#UTF_16">UTF-16</a> (<a href="undocumented#RFC">RFC</a> 2781)https://tools.ietf.org/html/rfc2781is made up of 16-bit words,
|
||||
<a href="undocumented#UTF_16">UTF-16</a> (<a href="undocumented#RFC">RFC</a> 2781)is made up of 16-bit words,
|
||||
and is a superset of <a href="undocumented#Unicode">Unicode</a> ranges 0x0000 to 0xD7FF and 0xE000 to 0xFFFF.
|
||||
<a href="undocumented#UTF_32">UTF-32</a>http://www.unicode.org/versions/<a href="undocumented#Unicode5">Unicode5</a>.0.0/ch03.pdfis
|
||||
<a href="undocumented#UTF_32">UTF-32</a>is
|
||||
made up of 32-bit words, and is a superset of <a href="undocumented#Unicode">Unicode</a>.
|
||||
|
||||
<a href="undocumented#Font_Manager">Font Manager</a> uses font data to convert character code points into glyph indices.
|
||||
@ -4050,7 +4049,7 @@ one of: <a href="#SkPaint_kUTF8_TextEncoding">kUTF8 TextEncoding</a>, <a href="#
|
||||
---
|
||||
|
||||
# <a name="Font_Metrics"></a> Font Metrics
|
||||
<a href="#Font_Metrics">Font Metrics</a> describe dimensions common to the glyphs in <a href="undocumented#Typeface">Typeface</a>.
|
||||
<a href="#Font_Metrics">Font Metrics</a> describe dimensions common to the <a href="#Glyph">Glyphs</a> in <a href="undocumented#Typeface">Typeface</a>.
|
||||
The dimensions are computed by <a href="undocumented#Font_Manager">Font Manager</a> from font data and do not take
|
||||
<a href="#Paint">Paint</a> settings other than <a href="#Text_Size">Text Size</a> into account.
|
||||
|
||||
@ -4099,7 +4098,7 @@ bool <a href="#SkPaint_FontMetrics_hasStrikeoutPosition">hasStrikeoutPosition(Sk
|
||||
|
||||
<a href="#SkPaint_FontMetrics">FontMetrics</a> is filled out by <a href="#SkPaint_getFontMetrics">getFontMetrics</a>. <a href="#SkPaint_FontMetrics">FontMetrics</a> contents reflect the values
|
||||
computed by <a href="undocumented#Font_Manager">Font Manager</a> using <a href="undocumented#Typeface">Typeface</a>. Values are set to zero if they are
|
||||
not availble.
|
||||
not available.
|
||||
|
||||
<a href="#SkPaint_FontMetrics_fUnderlineThickness">fUnderlineThickness</a> and <a href="#SkPaint_FontMetrics_fUnderlinePosition">fUnderlinePosition</a> have a bit set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> if their values
|
||||
are valid, since their value may be zero.
|
||||
@ -4178,12 +4177,12 @@ Maximum character width.
|
||||
|
||||
<a name="SkPaint_FontMetrics_fXMin"> <code><strong>SkScalar fXMin</strong></code> </a>
|
||||
|
||||
Minimum bounding box x value for all glyphs.
|
||||
Minimum bounding box x value for all <a href="#Glyph">Glyphs</a>.
|
||||
Typically less than zero.
|
||||
|
||||
<a name="SkPaint_FontMetrics_fXMax"> <code><strong>SkScalar fXMax</strong></code> </a>
|
||||
|
||||
Maximum bounding box x value for all glyphs.
|
||||
Maximum bounding box x value for all <a href="#Glyph">Glyphs</a>.
|
||||
Typically greater than zero.
|
||||
|
||||
<a name="SkPaint_FontMetrics_fXHeight"> <code><strong>SkScalar fXHeight</strong></code> </a>
|
||||
@ -4236,8 +4235,8 @@ bool hasUnderlineThickness(SkScalar* thickness) const
|
||||
</pre>
|
||||
|
||||
If <a href="#Font_Metrics">Font Metrics</a> has a valid underline <a href="#SkPaint_FontMetrics_hasUnderlineThickness_thickness">thickness</a>, return true, and set
|
||||
<a href="#SkPaint_FontMetrics_hasUnderlineThickness_thickness">thickness</a> to that value. If it doesn't, return false, and ignore
|
||||
<a href="#SkPaint_FontMetrics_hasUnderlineThickness_thickness">thickness</a>.
|
||||
<a href="#SkPaint_FontMetrics_hasUnderlineThickness_thickness">thickness</a> to that value. If the underline <a href="#SkPaint_FontMetrics_hasUnderlineThickness_thickness">thickness</a> is not valid,
|
||||
return false, and ignore <a href="#SkPaint_FontMetrics_hasUnderlineThickness_thickness">thickness</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -4260,8 +4259,8 @@ bool hasUnderlinePosition(SkScalar* position) const
|
||||
</pre>
|
||||
|
||||
If <a href="#Font_Metrics">Font Metrics</a> has a valid underline <a href="#SkPaint_FontMetrics_hasUnderlinePosition_position">position</a>, return true, and set
|
||||
<a href="#SkPaint_FontMetrics_hasUnderlinePosition_position">position</a> to that value. If it doesn't, return false, and ignore
|
||||
<a href="#SkPaint_FontMetrics_hasUnderlinePosition_position">position</a>.
|
||||
<a href="#SkPaint_FontMetrics_hasUnderlinePosition_position">position</a> to that value. If the underline <a href="#SkPaint_FontMetrics_hasUnderlinePosition_position">position</a> is not valid,
|
||||
return false, and ignore <a href="#SkPaint_FontMetrics_hasUnderlinePosition_position">position</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -4284,8 +4283,8 @@ bool hasStrikeoutThickness(SkScalar* thickness) const
|
||||
</pre>
|
||||
|
||||
If <a href="#Font_Metrics">Font Metrics</a> has a valid strikeout <a href="#SkPaint_FontMetrics_hasStrikeoutThickness_thickness">thickness</a>, return true, and set
|
||||
<a href="#SkPaint_FontMetrics_hasStrikeoutThickness_thickness">thickness</a> to that value. If it doesn't, return false, and ignore
|
||||
<a href="#SkPaint_FontMetrics_hasStrikeoutThickness_thickness">thickness</a>.
|
||||
<a href="#SkPaint_FontMetrics_hasStrikeoutThickness_thickness">thickness</a> to that value. If the underline <a href="#SkPaint_FontMetrics_hasStrikeoutThickness_thickness">thickness</a> is not valid,
|
||||
return false, and ignore <a href="#SkPaint_FontMetrics_hasStrikeoutThickness_thickness">thickness</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -4308,8 +4307,8 @@ bool hasStrikeoutPosition(SkScalar* position) const
|
||||
</pre>
|
||||
|
||||
If <a href="#Font_Metrics">Font Metrics</a> has a valid strikeout <a href="#SkPaint_FontMetrics_hasStrikeoutPosition_position">position</a>, return true, and set
|
||||
<a href="#SkPaint_FontMetrics_hasStrikeoutPosition_position">position</a> to that value. If it doesn't, return false, and ignore
|
||||
<a href="#SkPaint_FontMetrics_hasStrikeoutPosition_position">position</a>.
|
||||
<a href="#SkPaint_FontMetrics_hasStrikeoutPosition_position">position</a> to that value. If the underline <a href="#SkPaint_FontMetrics_hasStrikeoutPosition_position">position</a> is not valid,
|
||||
return false, and ignore <a href="#SkPaint_FontMetrics_hasStrikeoutPosition_position">position</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -4405,7 +4404,7 @@ textSize: 32 fontSpacing: 37.25
|
||||
SkRect getFontBounds() const
|
||||
</pre>
|
||||
|
||||
Returns the union of bounds of all glyphs.
|
||||
Returns the union of bounds of all <a href="#Glyph">Glyphs</a>.
|
||||
Returned dimensions are computed by <a href="undocumented#Font_Manager">Font Manager</a> from font data,
|
||||
ignoring <a href="#SkPaint_Hinting">Hinting</a>. Includes <a href="#Text_Size">Text Size</a>, <a href="#Text_Scale_X">Text Scale X</a>,
|
||||
and <a href="#Text_Skew_X">Text Skew X</a>, but not <a href="#Fake_Bold">Fake Bold</a> or <a href="undocumented#Path_Effect">Path Effect</a>.
|
||||
@ -4416,7 +4415,7 @@ returns the same bounds as <a href="#Font_Metrics">Font Metrics</a> { <a href="#
|
||||
|
||||
### Return Value
|
||||
|
||||
union of bounds of all glyphs
|
||||
union of bounds of all <a href="#Glyph">Glyphs</a>
|
||||
|
||||
### Example
|
||||
|
||||
@ -4457,7 +4456,7 @@ If <a href="#Text_Encoding">Text Encoding</a> is <a href="#SkPaint_kUTF8_TextEnc
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPaint_textToGlyphs_text"> <code><strong>text </strong></code> </a></td> <td>
|
||||
character stroage encoded with <a href="#Text_Encoding">Text Encoding</a></td>
|
||||
character storage encoded with <a href="#Text_Encoding">Text Encoding</a></td>
|
||||
</tr> <tr> <td><a name="SkPaint_textToGlyphs_byteLength"> <code><strong>byteLength </strong></code> </a></td> <td>
|
||||
length of character storage in bytes</td>
|
||||
</tr> <tr> <td><a name="SkPaint_textToGlyphs_glyphs"> <code><strong>glyphs </strong></code> </a></td> <td>
|
||||
@ -4482,14 +4481,14 @@ number of <a href="#SkPaint_textToGlyphs_glyphs">glyphs</a> represented by <a hr
|
||||
int countText(const void* text, size_t byteLength) const
|
||||
</pre>
|
||||
|
||||
Returns the number of glyphs in <a href="#SkPaint_countText_text">text</a>.
|
||||
Uses <a href="#Text_Encoding">Text Encoding</a> to count the glyphs.
|
||||
Returns the number of <a href="#Glyph">Glyphs</a> in <a href="#SkPaint_countText_text">text</a>.
|
||||
Uses <a href="#Text_Encoding">Text Encoding</a> to count the <a href="#Glyph">Glyphs</a>.
|
||||
Returns the same result as <a href="#SkPaint_textToGlyphs">textToGlyphs</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPaint_countText_text"> <code><strong>text </strong></code> </a></td> <td>
|
||||
character stroage encoded with <a href="#Text_Encoding">Text Encoding</a></td>
|
||||
character storage encoded with <a href="#Text_Encoding">Text Encoding</a></td>
|
||||
</tr> <tr> <td><a name="SkPaint_countText_byteLength"> <code><strong>byteLength </strong></code> </a></td> <td>
|
||||
length of character storage in bytes</td>
|
||||
</tr>
|
||||
@ -4497,7 +4496,7 @@ length of character storage in bytes</td>
|
||||
|
||||
### Return Value
|
||||
|
||||
number of glyphs represented by <a href="#SkPaint_countText_text">text</a> of length <a href="#SkPaint_countText_byteLength">byteLength</a>
|
||||
number of <a href="#Glyph">Glyphs</a> represented by <a href="#SkPaint_countText_text">text</a> of length <a href="#SkPaint_countText_byteLength">byteLength</a>
|
||||
|
||||
### Example
|
||||
|
||||
@ -4528,12 +4527,12 @@ If <a href="#Text_Encoding">Text Encoding</a> is <a href="#SkPaint_kGlyphID_Text
|
||||
returns true if all glyph indices in <a href="#SkPaint_containsText_text">text</a> are non-zero;
|
||||
does not check to see if <a href="#SkPaint_containsText_text">text</a> contains valid glyph indices for <a href="undocumented#Typeface">Typeface</a>.
|
||||
|
||||
Returns true if bytelength is zero.
|
||||
Returns true if <a href="#SkPaint_containsText_byteLength">byteLength</a> is zero.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPaint_containsText_text"> <code><strong>text </strong></code> </a></td> <td>
|
||||
array of characters or glyphs</td>
|
||||
array of characters or <a href="#Glyph">Glyphs</a></td>
|
||||
</tr> <tr> <td><a name="SkPaint_containsText_byteLength"> <code><strong>byteLength </strong></code> </a></td> <td>
|
||||
number of bytes in <a href="#SkPaint_containsText_text">text</a> array</td>
|
||||
</tr>
|
||||
@ -4769,13 +4768,13 @@ glyph count in <a href="#SkPaint_getTextWidths_text">text</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="6b9e101f49e9c2c28755c5bdcef64dfb"><div>Bounds of glyphs increase for stroked <a href="#SkPaint_getTextWidths_text">text</a>, but <a href="#SkPaint_getTextWidths_text">text</a> advance remains the same.
|
||||
<div><fiddle-embed name="6b9e101f49e9c2c28755c5bdcef64dfb"><div>Bounds of <a href="#Glyph">Glyphs</a> increase for stroked <a href="#SkPaint_getTextWidths_text">text</a>, but <a href="#SkPaint_getTextWidths_text">text</a> advance remains the same.
|
||||
The underlines show the <a href="#SkPaint_getTextWidths_text">text</a> advance, spaced to keep them distinct.</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
# <a name="Text_Path"></a> Text Path
|
||||
<a href="#Text_Path">Text Path</a> describes the geometry of glyphs used to draw text.
|
||||
<a href="#Text_Path">Text Path</a> describes the geometry of <a href="#Glyph">Glyphs</a> used to draw text.
|
||||
|
||||
<a name="SkPaint_getTextPath"></a>
|
||||
## getTextPath
|
||||
@ -4802,7 +4801,7 @@ x-coordinate of the origin of the <a href="#SkPaint_getTextPath_text">text</a></
|
||||
</tr> <tr> <td><a name="SkPaint_getTextPath_y"> <code><strong>y </strong></code> </a></td> <td>
|
||||
y-coordinate of the origin of the <a href="#SkPaint_getTextPath_text">text</a></td>
|
||||
</tr> <tr> <td><a name="SkPaint_getTextPath_path"> <code><strong>path </strong></code> </a></td> <td>
|
||||
geometry of the glyphs</td>
|
||||
geometry of the <a href="#Glyph">Glyphs</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -4837,20 +4836,20 @@ number of bytes of <a href="#SkPaint_getPosTextPath_text">text</a></td>
|
||||
</tr> <tr> <td><a name="SkPaint_getPosTextPath_pos"> <code><strong>pos </strong></code> </a></td> <td>
|
||||
positions of each glyph</td>
|
||||
</tr> <tr> <td><a name="SkPaint_getPosTextPath_path"> <code><strong>path </strong></code> </a></td> <td>
|
||||
geometry of the glyphs</td>
|
||||
geometry of the <a href="#Glyph">Glyphs</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="7f27c93472aa99a7542fb3493076f072"><div>Simplifies three glyphs to eliminate overlaps, and strokes the result.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="7f27c93472aa99a7542fb3493076f072"><div>Simplifies three <a href="#Glyph">Glyphs</a> to eliminate overlaps, and strokes the result.</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
# <a name="Text_Intercepts"></a> Text Intercepts
|
||||
<a href="#Text_Intercepts">Text Intercepts</a> describe the intersection of drawn text glyphs with a pair
|
||||
<a href="#Text_Intercepts">Text Intercepts</a> describe the intersection of drawn text <a href="#Glyph">Glyphs</a> with a pair
|
||||
of lines parallel to the text advance. <a href="#Text_Intercepts">Text Intercepts</a> permits creating a
|
||||
underline that skips descenders.
|
||||
underline that skips <a href="undocumented#Descenders">Descenders</a>.
|
||||
|
||||
<a name="SkPaint_getTextIntercepts"></a>
|
||||
## getTextIntercepts
|
||||
@ -4862,7 +4861,7 @@ int getTextIntercepts(const void* text, size_t length, SkScalar x, SkScalar y,
|
||||
|
||||
Returns the number of <a href="#SkPaint_getTextIntercepts_intervals">intervals</a> that intersect <a href="#SkPaint_getTextIntercepts_bounds">bounds</a>.
|
||||
<a href="#SkPaint_getTextIntercepts_bounds">bounds</a> describes a pair of lines parallel to the <a href="#SkPaint_getTextIntercepts_text">text</a> advance.
|
||||
The return count is zero or a multiple of two, and is at most twice the number of glyphs in
|
||||
The return count is zero or a multiple of two, and is at most twice the number of <a href="#Glyph">Glyphs</a> in
|
||||
the string.
|
||||
Uses <a href="#Text_Encoding">Text Encoding</a> to decode <a href="#SkPaint_getTextIntercepts_text">text</a>, <a href="undocumented#Typeface">Typeface</a> to get the glyph paths,
|
||||
and <a href="#Text_Size">Text Size</a>, <a href="#Fake_Bold">Fake Bold</a>, and <a href="undocumented#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
|
||||
@ -4893,7 +4892,7 @@ number of intersections; may be zero
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="2a0b80ed20d193c688085b79deb5bdc9"><div>Underline uses intercepts to draw on either side of the glyph descender.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="2a0b80ed20d193c688085b79deb5bdc9"><div>Underline uses intercepts to draw on either side of the glyph Descender.</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4907,7 +4906,7 @@ int getPosTextIntercepts(const void* text, size_t length, const SkPoint pos[],
|
||||
|
||||
Returns the number of <a href="#SkPaint_getPosTextIntercepts_intervals">intervals</a> that intersect <a href="#SkPaint_getPosTextIntercepts_bounds">bounds</a>.
|
||||
<a href="#SkPaint_getPosTextIntercepts_bounds">bounds</a> describes a pair of lines parallel to the <a href="#SkPaint_getPosTextIntercepts_text">text</a> advance.
|
||||
The return count is zero or a multiple of two, and is at most twice the number of glyphs in
|
||||
The return count is zero or a multiple of two, and is at most twice the number of <a href="#Glyph">Glyphs</a> in
|
||||
the string.
|
||||
Uses <a href="#Text_Encoding">Text Encoding</a> to decode <a href="#SkPaint_getPosTextIntercepts_text">text</a>, <a href="undocumented#Typeface">Typeface</a> to get the glyph paths,
|
||||
and <a href="#Text_Size">Text Size</a>, <a href="#Fake_Bold">Fake Bold</a>, and <a href="undocumented#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
|
||||
@ -4936,7 +4935,7 @@ number of intersections; may be zero
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="98b2dfc552d0540a7c041fe7a2839bd7"><div><a href="undocumented#Text">Text</a> intercepts draw on either side of, but not inside, glyphs in a run.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="98b2dfc552d0540a7c041fe7a2839bd7"><div><a href="undocumented#Text">Text</a> intercepts draw on either side of, but not inside, <a href="#Glyph">Glyphs</a> in a run.</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4951,7 +4950,7 @@ int getPosTextHIntercepts(const void* text, size_t length, const SkScalar xpos[]
|
||||
|
||||
Returns the number of <a href="#SkPaint_getPosTextHIntercepts_intervals">intervals</a> that intersect <a href="#SkPaint_getPosTextHIntercepts_bounds">bounds</a>.
|
||||
<a href="#SkPaint_getPosTextHIntercepts_bounds">bounds</a> describes a pair of lines parallel to the <a href="#SkPaint_getPosTextHIntercepts_text">text</a> advance.
|
||||
The return count is zero or a multiple of two, and is at most twice the number of glyphs in
|
||||
The return count is zero or a multiple of two, and is at most twice the number of <a href="#Glyph">Glyphs</a> in
|
||||
the string.
|
||||
Uses <a href="#Text_Encoding">Text Encoding</a> to decode <a href="#SkPaint_getPosTextHIntercepts_text">text</a>, <a href="undocumented#Typeface">Typeface</a> to get the glyph paths,
|
||||
and <a href="#Text_Size">Text Size</a>, <a href="#Fake_Bold">Fake Bold</a>, and <a href="undocumented#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
|
||||
@ -4996,18 +4995,18 @@ int getTextBlobIntercepts(const SkTextBlob* blob, const SkScalar bounds[2],
|
||||
|
||||
Returns the number of <a href="#SkPaint_getTextBlobIntercepts_intervals">intervals</a> that intersect <a href="#SkPaint_getTextBlobIntercepts_bounds">bounds</a>.
|
||||
<a href="#SkPaint_getTextBlobIntercepts_bounds">bounds</a> describes a pair of lines parallel to the text advance.
|
||||
The return count is zero or a multiple of two, and is at most twice the number of glyphs in
|
||||
The return count is zero or a multiple of two, and is at most twice the number of <a href="#Glyph">Glyphs</a> in
|
||||
the string.
|
||||
Uses <a href="#Text_Encoding">Text Encoding</a> to decode text, <a href="undocumented#Typeface">Typeface</a> to get the glyph paths,
|
||||
and <a href="#Text_Size">Text Size</a>, <a href="#Fake_Bold">Fake Bold</a>, and <a href="undocumented#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
|
||||
Uses pos array and <a href="#Text_Align">Text Align</a> to position <a href="#SkPaint_getTextBlobIntercepts_intervals">intervals</a>.
|
||||
Uses run array and <a href="#Text_Align">Text Align</a> to position <a href="#SkPaint_getTextBlobIntercepts_intervals">intervals</a>.
|
||||
Pass nullptr for <a href="#SkPaint_getTextBlobIntercepts_intervals">intervals</a> to determine the size of the interval array.
|
||||
<a href="#SkPaint_getTextBlobIntercepts_intervals">intervals</a> are cached to improve performance for multiple calls.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPaint_getTextBlobIntercepts_blob"> <code><strong>blob </strong></code> </a></td> <td>
|
||||
glyphs, positions, and text paint attributes</td>
|
||||
<a href="#Glyph">Glyphs</a>, positions, and text paint attributes</td>
|
||||
</tr> <tr> <td><a name="SkPaint_getTextBlobIntercepts_bounds"> <code><strong>bounds </strong></code> </a></td> <td>
|
||||
lower and upper line parallel to the advance</td>
|
||||
</tr> <tr> <td><a name="SkPaint_getTextBlobIntercepts_intervals"> <code><strong>intervals </strong></code> </a></td> <td>
|
||||
@ -5035,8 +5034,8 @@ bool nothingToDraw() const
|
||||
Returns true if <a href="#Paint">Paint</a> prevents all drawing;
|
||||
otherwise, the <a href="#Paint">Paint</a> may or may not allow drawing.
|
||||
|
||||
Returns true if <a href="undocumented#Blend_Mode">Blend Mode</a> and <a href="#Alpha">Color Alpha</a> are enabled,
|
||||
and computed <a href="#Alpha">Color Alpha</a> is zero.
|
||||
Returns true if, for example, <a href="undocumented#Blend_Mode">Blend Mode</a> combined with <a href="#Alpha">Color Alpha</a> computes a
|
||||
new <a href="#Alpha">Alpha</a> of zero.
|
||||
|
||||
### Return Value
|
||||
|
||||
@ -5090,13 +5089,13 @@ const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const
|
||||
Only call this if <a href="#SkPaint_canComputeFastBounds">canComputeFastBounds</a> returned true. This takes a
|
||||
raw rectangle (the raw bounds of a shape), and adjusts it for stylistic
|
||||
effects in the paint (e.g. stroking). If needed, it uses the <a href="#SkPaint_computeFastBounds_storage">storage</a>
|
||||
rect parameter. It returns the adjusted bounds that can then be used
|
||||
parameter. It returns the adjusted bounds that can then be used
|
||||
for <a href="#SkCanvas_quickReject">SkCanvas::quickReject</a> tests.
|
||||
|
||||
The returned rect will either be <a href="#SkPaint_computeFastBounds_orig">orig</a> or <a href="#SkPaint_computeFastBounds_storage">storage</a>, thus the caller
|
||||
The returned <a href="undocumented#Rect">Rect</a> will either be <a href="#SkPaint_computeFastBounds_orig">orig</a> or <a href="#SkPaint_computeFastBounds_storage">storage</a>, thus the caller
|
||||
should not rely on <a href="#SkPaint_computeFastBounds_storage">storage</a> being set to the result, but should always
|
||||
use the retured value. It is legal for <a href="#SkPaint_computeFastBounds_orig">orig</a> and <a href="#SkPaint_computeFastBounds_storage">storage</a> to be the same
|
||||
rect.
|
||||
use the returned value. It is legal for <a href="#SkPaint_computeFastBounds_orig">orig</a> and <a href="#SkPaint_computeFastBounds_storage">storage</a> to be the same
|
||||
<a href="undocumented#Rect">Rect</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -5143,8 +5142,9 @@ const SkRect& doComputeFastBounds(const SkRect& orig, SkRect* storage,
|
||||
Style style) const
|
||||
</pre>
|
||||
|
||||
Take the <a href="#SkPaint_doComputeFastBounds_style">style</a> explicitly, so the caller can force us to be stroked
|
||||
without having to make a copy of the paint just to change that field.
|
||||
Computes the bounds, overriding the <a href="#Paint">Paint</a> <a href="#SkPaint_Style">Style</a>. This can be used to
|
||||
account for additional width required by stroking <a href="#SkPaint_doComputeFastBounds_orig">orig</a>, without
|
||||
altering <a href="#SkPaint_Style">Style</a> set to fill.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -5170,12 +5170,14 @@ fast computed bounds
|
||||
void toString(SkString* str) const;
|
||||
</pre>
|
||||
|
||||
Converts <a href="#Paint">Paint</a> to machine parsable form in developer mode.
|
||||
Creates string representation of <a href="#Paint">Paint</a>. The representation is read by
|
||||
internal debugging tools. The interface and implementation may be
|
||||
suppressed by defining <a href="undocumented#SK_IGNORE_TO_STRING">SK IGNORE TO STRING</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPaint_toString_str"> <code><strong>str </strong></code> </a></td> <td>
|
||||
storage for string containing parsable <a href="#Paint">Paint</a></td>
|
||||
storage for string representation of <a href="#Paint">Paint</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -16,7 +16,7 @@ the middle entry as the end of the first <a href="undocumented#Line">Line</a> an
|
||||
<a href="#Path">Path</a> components <a href="#Arc">Arc</a>, <a href="undocumented#Rect">Rect</a>, <a href="undocumented#Round_Rect">Round Rect</a>, <a href="undocumented#Circle">Circle</a>, and <a href="undocumented#Oval">Oval</a> are composed of
|
||||
<a href="#Line">Lines</a> and <a href="#Curve">Curves</a> with as many <a href="#Verb">Verbs</a> and <a href="#Point">Points</a> required
|
||||
for an exact description. Once added to <a href="#Path">Path</a>, these components may lose their
|
||||
identity; although <a href="#Path">Path</a> can be inspected to determine if it decribes a single
|
||||
identity; although <a href="#Path">Path</a> can be inspected to determine if it describes a single
|
||||
<a href="undocumented#Rect">Rect</a>, <a href="undocumented#Oval">Oval</a>, <a href="undocumented#Round_Rect">Round Rect</a>, and so on.
|
||||
|
||||
### Example
|
||||
@ -51,7 +51,7 @@ are required to satisfy <a href="#Verb_Array">Verb Array</a>. First <a href="#Ve
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="0374f2dcd7effeb1dd435205a6c2de6f"><div>Each <a href="#SkPath_moveTo">SkPath::moveTo</a> starts a new <a href="#Contour">Contour</a>, and content after <a href="#SkPath_close">SkPath::close()</a>
|
||||
also starts a new <a href="#Contour">Contour</a>. Since <a href="#SkPath_conicTo">SkPath::conicTo</a> wasn't preceded by
|
||||
also starts a new <a href="#Contour">Contour</a>. Since <a href="#SkPath_conicTo">SkPath::conicTo</a> is not preceded by
|
||||
<a href="#SkPath_moveTo">SkPath::moveTo</a>, the first <a href="undocumented#Point">Point</a> of the third <a href="#Contour">Contour</a> starts at the last <a href="undocumented#Point">Point</a>
|
||||
of the second <a href="#Contour">Contour</a>.</div></fiddle-embed></div>
|
||||
|
||||
@ -82,10 +82,10 @@ makes them visible.
|
||||
outline a figure. <a href="#Path">Path</a> always starts with a move verb to a <a href="undocumented#Cartesian">Cartesian</a>
|
||||
coordinate, and may be followed by additional verbs that add lines or curves.
|
||||
Adding a <a href="#SkPath_close">close</a> verb makes the geometry into a continuous loop, a closed contour.
|
||||
<a href="#Path">Paths</a> may contain any number of contours, each beginnning with a move verb.
|
||||
<a href="#Path">Paths</a> may contain any number of contours, each beginning with a move verb.
|
||||
|
||||
<a href="#Path">Path</a> contours may contain only a move verb, or may also contain lines,
|
||||
quadratic Beziers, conics, and cubic Beziers. <a href="#Path">Path</a> contours may be open or
|
||||
<a href="#Quad">Quadratic Beziers</a>, <a href="#Conic">Conics</a>, and <a href="#Cubic">Cubic Beziers</a>. <a href="#Path">Path</a> contours may be open or
|
||||
closed.
|
||||
|
||||
When used to draw a filled area, <a href="#Path">Path</a> describes whether the fill is inside or
|
||||
@ -102,12 +102,11 @@ Internally, <a href="#Path">Path</a> lazily computes metrics likes bounds and co
|
||||
| constants | description |
|
||||
| --- | --- |
|
||||
| <a href="#SkPath_AddPathMode">AddPathMode</a> | Sets <a href="#SkPath_addPath">addPath</a> options. |
|
||||
| <a href="#SkPath_ArcSize">ArcSize</a> | Sets <a href="#SkPath_arcTo_4">arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep, SkScalar x, SkScalar y)</a> options. |
|
||||
| <a href="#SkPath_ArcSize">ArcSize</a> | Used by <a href="#SkPath_arcTo_4">arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep, SkScalar x, SkScalar y)</a>. |
|
||||
| <a href="#SkPath_Convexity">Convexity</a> | Returns if <a href="#Path">Path</a> is convex or concave. |
|
||||
| <a href="#SkPath_Direction">Direction</a> | Sets <a href="#Contour">Contour</a> clockwise or counterclockwise. |
|
||||
| <a href="#SkPath_FillType">FillType</a> | Sets winding rule and inverse fill. |
|
||||
| <a href="#SkPath_SegmentMask">SegmentMask</a> |
|
||||
<a href="#SkPath_Verb">Verb</a>| Controls how <a href="#Path">Path</a> <a href="#Point">Points</a> are interpreted. |
|
||||
| <a href="#SkPath_SegmentMask">SegmentMask</a> | <a href="#SkPath_Verb">Verb</a> | Controls how <a href="#Path">Path</a> <a href="#Point">Points</a> are interpreted. |
|
||||
|
||||
## <a name="Classes_and_Structs"></a> Classes and Structs
|
||||
|
||||
@ -159,8 +158,8 @@ Internally, <a href="#Path">Path</a> lazily computes metrics likes bounds and co
|
||||
| <a href="#SkPath_countPoints">countPoints</a> | Returns <a href="#Point_Array">Point Array</a> length. |
|
||||
| <a href="#SkPath_countVerbs">countVerbs</a> | Returns <a href="#Verb_Array">Verb Array</a> length. |
|
||||
| <a href="#SkPath_cubicTo">cubicTo</a> | Appends <a href="#Cubic">Cubic</a>. |
|
||||
| <a href="#SkPath_dump_2">dump</a> | Sends text representation using floats to stdout. |
|
||||
| <a href="#SkPath_dumpHex">dumpHex</a> | Sends text representation using hexadecimal to stdout. |
|
||||
| <a href="#SkPath_dump_2">dump</a> | Sends text representation using floats to standard output. |
|
||||
| <a href="#SkPath_dumpHex">dumpHex</a> | Sends text representation using hexadecimal to standard output. |
|
||||
| <a href="#SkPath_getBounds">getBounds</a> | Returns maximum and minimum of <a href="#Point_Array">Point Array</a>. |
|
||||
| <a href="#SkPath_getConvexity">getConvexity</a> | Returns geometry convexity, computing if necessary. |
|
||||
| <a href="#SkPath_getConvexityOrUnknown">getConvexityOrUnknown</a> | Returns geometry convexity if known. |
|
||||
@ -430,7 +429,7 @@ Releases ownership of any shared data and deletes data if <a href="#Path">Path</
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="01ad6be9b7d15a2217daea273eb3d466"><div>delete calls <a href="#Path">Path</a> destructor, but copy of original in path2 is unaffected.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="01ad6be9b7d15a2217daea273eb3d466"><div>delete calls <a href="#Path">Path</a> <a href="undocumented#Destructor">Destructor</a>, but copy of original in path2 is unaffected.</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -456,7 +455,7 @@ pointers are not exposed.
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPath_copy_assignment_operator_path"> <code><strong>path </strong></code> </a></td> <td>
|
||||
<a href="#Verb_Array">Verb Array</a>, <a href="#Point_Array">Point Array</a>, <a href="#Weight">Weights</a>, amd <a href="#Fill_Type">Fill Type</a> to copy</td>
|
||||
<a href="#Verb_Array">Verb Array</a>, <a href="#Point_Array">Point Array</a>, <a href="#Weight">Weights</a>, and <a href="#Fill_Type">Fill Type</a> to copy</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -575,7 +574,7 @@ Return true if <a href="#Path">Paths</a> contain equal <a href="#Verb">Verbs</a>
|
||||
If <a href="#Path">Paths</a> contain one or more <a href="#Conic">Conics</a>, the <a href="#Weight">Weights</a> must match.
|
||||
|
||||
<a href="#SkPath_conicTo">conicTo</a> may add different <a href="#Verb">Verbs</a> depending on <a href="#Conic_Weight">Conic Weight</a>, so it is not
|
||||
trival to <a href="#SkPath_interpolate">interpolate</a> a pair of <a href="#Path">Paths</a> containing <a href="#Conic">Conics</a> with different
|
||||
trivial to <a href="#SkPath_interpolate">interpolate</a> a pair of <a href="#Path">Paths</a> containing <a href="#Conic">Conics</a> with different
|
||||
<a href="#Conic_Weight">Conic Weight</a> values.
|
||||
|
||||
### Parameters
|
||||
@ -1064,7 +1063,7 @@ bool isRRect(SkRRect* rrect, Direction* dir = nullptr, unsigned* start = nullptr
|
||||
</pre>
|
||||
|
||||
Returns true if constructed by <a href="#SkPath_addRoundRect">addRoundRect</a>, <a href="#SkPath_addRRect">addRRect</a>; and if construction
|
||||
is not empty, not <a href="undocumented#Rect">Rect</a>, and not <a href="undocumented#Oval">Oval</a>. <a href="#Path">Path</a> constructed with other other calls
|
||||
is not empty, not <a href="undocumented#Rect">Rect</a>, and not <a href="undocumented#Oval">Oval</a>. <a href="#Path">Path</a> constructed with other calls
|
||||
will not return true though <a href="#Path">Path</a> draws <a href="undocumented#Round_Rect">Round Rect</a>.
|
||||
|
||||
<a href="#SkPath_isRRect_rrect">rrect</a> receives bounds of <a href="undocumented#Round_Rect">Round Rect</a>.
|
||||
@ -1089,11 +1088,12 @@ storage for <a href="#SkPath_isRRect_start">start</a> of <a href="undocumented#R
|
||||
|
||||
### Return Value
|
||||
|
||||
true for <a href="undocumented#Round_Rect">Round Rect</a> <a href="#Path">Path</a> constructed by <a href="#SkPath_addRoundRect">addRoundRect</a> or <a href="#SkPath_addRRect">addRRect</a>
|
||||
true if <a href="#Path">Path</a> <a href="#SkPath_contains">contains</a> only <a href="undocumented#Round_Rect">Round Rect</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="f2b7e57a385e6604475c99ec8daa2697"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="f2b7e57a385e6604475c99ec8daa2697"><div>Draw rounded rectangle and its bounds. Draw an arc indicating where the rounded
|
||||
rectangle starts and its direction.</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1108,7 +1108,7 @@ true for <a href="undocumented#Round_Rect">Round Rect</a> <a href="#Path">Path</
|
||||
void reset()
|
||||
</pre>
|
||||
|
||||
Sets <a href="#Path">Path</a> to its intial state.
|
||||
Sets <a href="#Path">Path</a> to its initial state.
|
||||
Removes <a href="#Verb_Array">Verb Array</a>, <a href="#Point_Array">Point Array</a>, and <a href="#Weight">Weights</a>, and sets <a href="#SkPath_FillType">FillType</a> to <a href="#SkPath_kWinding_FillType">kWinding FillType</a>.
|
||||
Internal storage associated with <a href="#Path">Path</a> is released.
|
||||
|
||||
@ -1129,7 +1129,7 @@ Internal storage associated with <a href="#Path">Path</a> is released.
|
||||
void rewind()
|
||||
</pre>
|
||||
|
||||
Sets <a href="#Path">Path</a> to its intial state, preserving internal storage.
|
||||
Sets <a href="#Path">Path</a> to its initial state, preserving internal storage.
|
||||
Removes <a href="#Verb_Array">Verb Array</a>, <a href="#Point_Array">Point Array</a>, and <a href="#Weight">Weights</a>, and sets <a href="#SkPath_FillType">FillType</a> to <a href="#SkPath_kWinding_FillType">kWinding FillType</a>.
|
||||
Internal storage associated with <a href="#Path">Path</a> is retained.
|
||||
|
||||
@ -1303,7 +1303,7 @@ Mark temporary paths, discarded or modified after use, as volatile
|
||||
to inform <a href="undocumented#Device">Device</a> that the path need not be cached.
|
||||
|
||||
Mark animating <a href="#Path">Path</a> volatile to improve performance.
|
||||
Mark unchanging <a href="#Path">Path</a> non-volative to improve repeated rendering.
|
||||
Mark unchanging <a href="#Path">Path</a> non-volatile to improve repeated rendering.
|
||||
|
||||
<a href="undocumented#Raster_Surface">Raster Surface</a> <a href="#Path">Path</a> draws are affected by volatile for some shadows.
|
||||
<a href="undocumented#GPU_Surface">GPU Surface</a> <a href="#Path">Path</a> draws are affected by volatile for some shadows and concave geometries.
|
||||
@ -1356,8 +1356,8 @@ true if <a href="undocumented#Line">Line</a> is degenerate; its length is effect
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="97a031f9186ade586928563840ce9116"><div>As single precision floats, 100 and 100.000001f have the same bit representation,
|
||||
and are exactly equal. 100 and 100.0001f have different bit representations, and
|
||||
<div><fiddle-embed name="97a031f9186ade586928563840ce9116"><div>As single precision floats, 100 and 100.000001 have the same bit representation,
|
||||
and are exactly equal. 100 and 100.0001 have different bit representations, and
|
||||
are not exactly equal, but are nearly equal.</div>
|
||||
|
||||
#### Example Output
|
||||
@ -1392,11 +1392,11 @@ treated as a point.
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPath_IsQuadDegenerate_p1"> <code><strong>p1 </strong></code> </a></td> <td>
|
||||
quad start point</td>
|
||||
<a href="#Quad">Quad</a> start point</td>
|
||||
</tr> <tr> <td><a name="SkPath_IsQuadDegenerate_p2"> <code><strong>p2 </strong></code> </a></td> <td>
|
||||
quad control point</td>
|
||||
<a href="#Quad">Quad</a> control point</td>
|
||||
</tr> <tr> <td><a name="SkPath_IsQuadDegenerate_p3"> <code><strong>p3 </strong></code> </a></td> <td>
|
||||
quad end point</td>
|
||||
<a href="#Quad">Quad</a> end point</td>
|
||||
</tr> <tr> <td><a name="SkPath_IsQuadDegenerate_exact"> <code><strong>exact </strong></code> </a></td> <td>
|
||||
if true, returns true only if <a href="#SkPath_IsQuadDegenerate_p1">p1</a>, <a href="#SkPath_IsQuadDegenerate_p2">p2</a>, and <a href="#SkPath_IsQuadDegenerate_p3">p3</a> are equal;
|
||||
if false, returns true if <a href="#SkPath_IsQuadDegenerate_p1">p1</a>, <a href="#SkPath_IsQuadDegenerate_p2">p2</a>, and <a href="#SkPath_IsQuadDegenerate_p3">p3</a> are equal or nearly equal</td>
|
||||
@ -1409,9 +1409,9 @@ true if <a href="#Quad">Quad</a> is degenerate; its length is effectively zero
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="1d50896c528cd4581966646b7d96acff"><div>As single precision floats: 100, 100.00001f, and 100.00002f have different bit representations
|
||||
<div><fiddle-embed name="1d50896c528cd4581966646b7d96acff"><div>As single precision floats: 100, 100.00001, and 100.00002 have different bit representations
|
||||
but nearly the same value. Translating all three by 1000 gives them the same bit representation;
|
||||
the fractional portion of the number can't be represented by the float and is lost.</div>
|
||||
the fractional portion of the number can not be represented by the float and is lost.</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1445,13 +1445,13 @@ treated as a point.
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPath_IsCubicDegenerate_p1"> <code><strong>p1 </strong></code> </a></td> <td>
|
||||
cubic start point</td>
|
||||
<a href="#Cubic">Cubic</a> start point</td>
|
||||
</tr> <tr> <td><a name="SkPath_IsCubicDegenerate_p2"> <code><strong>p2 </strong></code> </a></td> <td>
|
||||
cubic control point 1</td>
|
||||
<a href="#Cubic">Cubic</a> control point 1</td>
|
||||
</tr> <tr> <td><a name="SkPath_IsCubicDegenerate_p3"> <code><strong>p3 </strong></code> </a></td> <td>
|
||||
cubic control point 2</td>
|
||||
<a href="#Cubic">Cubic</a> control point 2</td>
|
||||
</tr> <tr> <td><a name="SkPath_IsCubicDegenerate_p4"> <code><strong>p4 </strong></code> </a></td> <td>
|
||||
cubic end point</td>
|
||||
<a href="#Cubic">Cubic</a> end point</td>
|
||||
</tr> <tr> <td><a name="SkPath_IsCubicDegenerate_exact"> <code><strong>exact </strong></code> </a></td> <td>
|
||||
if true, returns true only if <a href="#SkPath_IsCubicDegenerate_p1">p1</a>, <a href="#SkPath_IsCubicDegenerate_p2">p2</a>, <a href="#SkPath_IsCubicDegenerate_p3">p3</a>, and <a href="#SkPath_IsCubicDegenerate_p4">p4</a> are equal;
|
||||
if false, returns true if <a href="#SkPath_IsCubicDegenerate_p1">p1</a>, <a href="#SkPath_IsCubicDegenerate_p2">p2</a>, <a href="#SkPath_IsCubicDegenerate_p3">p3</a>, and <a href="#SkPath_IsCubicDegenerate_p4">p4</a> are equal or nearly equal</td>
|
||||
@ -1522,7 +1522,7 @@ second move is not line
|
||||
|
||||
<a href="#Point_Array">Point Array</a> <a href="#SkPath_contains">contains</a> <a href="#Point">Points</a> satisfying the allocated <a href="#Point">Points</a> for
|
||||
each <a href="#SkPath_Verb">Verb</a> in <a href="#Verb_Array">Verb Array</a>. For instance, <a href="#Path">Path</a> containing one <a href="#Contour">Contour</a> with <a href="undocumented#Line">Line</a>
|
||||
and <a href="#Quad">Quad</a> is described by <a href="#Verb_Array">Verb Array</a>: move to, line to, quad to; and
|
||||
and <a href="#Quad">Quad</a> is described by <a href="#Verb_Array">Verb Array</a>: Verb::kMoveTo, Verb::kLineTo, Verb::kQuadTo; and
|
||||
one <a href="undocumented#Point">Point</a> for move, one <a href="undocumented#Point">Point</a> for <a href="undocumented#Line">Line</a>, two <a href="#Point">Points</a> for <a href="#Quad">Quad</a>; totaling four <a href="#Point">Points</a>.
|
||||
|
||||
<a href="#Point_Array">Point Array</a> may be read directly from <a href="#Path">Path</a> with <a href="#SkPath_getPoints">getPoints</a>, or inspected with
|
||||
@ -1749,7 +1749,7 @@ Cached state is also exchanged. <a href="#SkPath_swap">swap</a> internally excha
|
||||
it is lightweight and does not allocate memory.
|
||||
|
||||
<a href="#SkPath_swap">swap</a> usage has largely been replaced by <a href="#SkPath_copy_assignment_operator">operator=(const SkPath& path)</a>.
|
||||
<a href="#Path">Paths</a> do not copy their content on assignment util they are written to,
|
||||
<a href="#Path">Paths</a> do not copy their content on assignment until they are written to,
|
||||
making assignment as efficient as <a href="#SkPath_swap">swap</a>.
|
||||
|
||||
### Parameters
|
||||
@ -1946,7 +1946,7 @@ reducing the number and size of allocations when creating <a href="#Path">Path</
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPath_incReserve_extraPtCount"> <code><strong>extraPtCount </strong></code> </a></td> <td>
|
||||
number of additional <a href="#Point">Points</a> to preallocate</td>
|
||||
number of additional <a href="#Point">Points</a> to allocate</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -2021,7 +2021,7 @@ void rMoveTo(SkScalar dx, SkScalar dy)
|
||||
Adds beginning of <a href="#Contour">Contour</a> relative to <a href="#Last_Point">Last Point</a>.
|
||||
If <a href="#Path">Path</a> is empty, starts <a href="#Contour">Contour</a> at (<a href="#SkPath_rMoveTo_dx">dx</a>, <a href="#SkPath_rMoveTo_dy">dy</a>).
|
||||
Otherwise, start <a href="#Contour">Contour</a> at <a href="#Last_Point">Last Point</a> <a href="#SkPath_offset">offset</a> by (<a href="#SkPath_rMoveTo_dx">dx</a>, <a href="#SkPath_rMoveTo_dy">dy</a>).
|
||||
Function name stands for relative move to.
|
||||
Function name stands for "relative move to".
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -2114,7 +2114,7 @@ Adds <a href="undocumented#Line">Line</a> from <a href="#Last_Point">Last Point<
|
||||
Appends <a href="#SkPath_kMove_Verb">kMove Verb</a> to <a href="#Verb_Array">Verb Array</a> and (0, 0) to <a href="#Point_Array">Point Array</a>, if needed;
|
||||
then appends <a href="#SkPath_kLine_Verb">kLine Verb</a> to <a href="#Verb_Array">Verb Array</a> and <a href="undocumented#Line">Line</a> end to <a href="#Point_Array">Point Array</a>.
|
||||
<a href="undocumented#Line">Line</a> end is <a href="#Last_Point">Last Point</a> plus <a href="undocumented#Vector">Vector</a> (<a href="#SkPath_rLineTo_dx">dx</a>, <a href="#SkPath_rLineTo_dy">dy</a>).
|
||||
Function name stands for relative line to.
|
||||
Function name stands for "relative line to".
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -2239,7 +2239,7 @@ if needed; then appends <a href="#SkPath_kQuad_Verb">kQuad Verb</a> to <a href="
|
||||
control and <a href="#Quad">Quad</a> end to <a href="#Point_Array">Point Array</a>.
|
||||
<a href="#Quad">Quad</a> control is <a href="#Last_Point">Last Point</a> plus <a href="undocumented#Vector">Vector</a> (<a href="#SkPath_rQuadTo_dx1">dx1</a>, <a href="#SkPath_rQuadTo_dy1">dy1</a>).
|
||||
<a href="#Quad">Quad</a> end is <a href="#Last_Point">Last Point</a> plus <a href="undocumented#Vector">Vector</a> (<a href="#SkPath_rQuadTo_dx2">dx2</a>, <a href="#SkPath_rQuadTo_dy2">dy2</a>).
|
||||
Function name stands for relative quad to.
|
||||
Function name stands for "relative quad to".
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -2309,7 +2309,7 @@ done
|
||||
|
||||
</fiddle-embed></div>
|
||||
|
||||
If weight is greater than one, <a href="#Conic">Conic</a> is a hyperbolic segment. As w gets large,
|
||||
If weight is greater than one, <a href="#Conic">Conic</a> is a hyperbolic segment. As weight gets large,
|
||||
a hyperbolic segment can be approximated by straight lines connecting the
|
||||
control <a href="undocumented#Point">Point</a> with the end <a href="#Point">Points</a>.
|
||||
|
||||
@ -2410,7 +2410,7 @@ weight of added <a href="#Conic">Conic</a></td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="22d25e03b19d5bae92118877e462361b"><div><a href="#Conic">Conics</a> and arcs use identical representations. As the arc sweep increases
|
||||
the conic weight also increases, but remains smaller than one.</div></fiddle-embed></div>
|
||||
the <a href="#Conic_Weight">Conic Weight</a> also increases, but remains smaller than one.</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2440,7 +2440,7 @@ In all cases appends <a href="#Point">Points</a> control and end to <a href="#Po
|
||||
control is <a href="#Last_Point">Last Point</a> plus <a href="undocumented#Vector">Vector</a> (<a href="#SkPath_rConicTo_dx1">dx1</a>, <a href="#SkPath_rConicTo_dy1">dy1</a>).
|
||||
end is <a href="#Last_Point">Last Point</a> plus <a href="undocumented#Vector">Vector</a> (<a href="#SkPath_rConicTo_dx2">dx2</a>, <a href="#SkPath_rConicTo_dy2">dy2</a>).
|
||||
|
||||
Function name stands for relative conic to.
|
||||
Function name stands for "relative conic to".
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -2468,7 +2468,7 @@ weight of added <a href="#Conic">Conic</a></td>
|
||||
---
|
||||
|
||||
# <a name="Cubic"></a> Cubic
|
||||
<a href="#Cubic">Cubic</a> describes a cubic <a href="undocumented#Bezier">Bezier</a>, a third-order curve.
|
||||
<a href="#Cubic">Cubic</a> describes a <a href="undocumented#Bezier">Bezier</a> curve segment described by a third-order polynomial.
|
||||
<a href="#Cubic">Cubic</a> begins at a start <a href="undocumented#Point">Point</a>, curving towards the first control <a href="undocumented#Point">Point</a>;
|
||||
and curves from the end <a href="undocumented#Point">Point</a> towards the second control <a href="undocumented#Point">Point</a>.
|
||||
|
||||
@ -2570,7 +2570,7 @@ if needed; then appends <a href="#SkPath_kCubic_Verb">kCubic Verb</a> to <a href
|
||||
control and <a href="#Cubic">Cubic</a> end to <a href="#Point_Array">Point Array</a>.
|
||||
<a href="#Cubic">Cubic</a> control is <a href="#Last_Point">Last Point</a> plus <a href="undocumented#Vector">Vector</a> (dx1, dy1).
|
||||
<a href="#Cubic">Cubic</a> end is <a href="#Last_Point">Last Point</a> plus <a href="undocumented#Vector">Vector</a> (dx2, dy2).
|
||||
Function name stands for relative cubic to.
|
||||
Function name stands for "relative cubic to".
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -2717,7 +2717,7 @@ The length of <a href="undocumented#Vector">Vector</a> from (<a href="#SkPath_ar
|
||||
tangents are nearly parallel, <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> to (<a href="#SkPath_arcTo_2_x1">x1</a>, <a href="#SkPath_arcTo_2_y1">y1</a>).
|
||||
|
||||
<a href="#SkPath_arcTo">arcTo</a> appends at most one <a href="undocumented#Line">Line</a> and one <a href="#Conic">Conic</a>.
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="undocumented#PostScript_arct">PostScript arct</a> and <a href="undocumented#HTML_Canvas_arcTo">HTML Canvas arcTo</a>.
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arct">PostScript Arct</a> and <a href="undocumented#HTML_Canvas_ArcTo">HTML Canvas ArcTo</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -2770,7 +2770,7 @@ The length of <a href="undocumented#Vector">Vector</a> from <a href="#SkPath_arc
|
||||
tangents are nearly parallel, <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> to <a href="#SkPath_arcTo_3_p1">p1</a>.
|
||||
|
||||
<a href="#SkPath_arcTo">arcTo</a> appends at most one <a href="undocumented#Line">Line</a> and one <a href="#Conic">Conic</a>.
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="undocumented#PostScript_arct">PostScript arct</a> and <a href="undocumented#HTML_Canvas_arcTo">HTML Canvas arcTo</a>.
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arct">PostScript Arct</a> and <a href="undocumented#HTML_Canvas_ArcTo">HTML Canvas ArcTo</a>.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -2840,7 +2840,7 @@ void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
|
||||
Direction sweep, SkScalar x, SkScalar y)
|
||||
</pre>
|
||||
|
||||
Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>. <a href="#Arc">Arc</a> is implemented by one or more <a href="#Conic">Conic</a> weighted to describe part of <a href="undocumented#Oval">Oval</a>
|
||||
Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>. <a href="#Arc">Arc</a> is implemented by one or more <a href="#Conic">Conics</a> weighted to describe part of <a href="undocumented#Oval">Oval</a>
|
||||
with radii (<a href="#SkPath_arcTo_4_rx">rx</a>, <a href="#SkPath_arcTo_4_ry">ry</a>) rotated by <a href="#SkPath_arcTo_4_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> to (<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>),
|
||||
choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.
|
||||
|
||||
@ -2849,8 +2849,8 @@ or if last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> equal
|
||||
(<a href="#SkPath_arcTo_4_x">x</a>, <a href="#SkPath_arcTo_4_y">y</a>) if both are greater than zero but too small.
|
||||
|
||||
<a href="#SkPath_arcTo">arcTo</a> appends up to four <a href="#Conic">Conic</a> curves.
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionatlity of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> sweep-flag value is
|
||||
opposite the integer value of <a href="#SkPath_arcTo_4_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> sweep-flag uses 1 for clockwise, while <a href="#SkPath_kCW_Direction">kCW Direction</a>
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> "" value is
|
||||
opposite the integer value of <a href="#SkPath_arcTo_4_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> "" uses 1 for clockwise, while <a href="#SkPath_kCW_Direction">kCW Direction</a>
|
||||
cast to int is zero.
|
||||
|
||||
### Parameters
|
||||
@ -2860,7 +2860,7 @@ radius in <a href="#SkPath_arcTo_4_x">x</a> before x-axis rotation</td>
|
||||
</tr> <tr> <td><a name="SkPath_arcTo_4_ry"> <code><strong>ry </strong></code> </a></td> <td>
|
||||
radius in <a href="#SkPath_arcTo_4_y">y</a> before x-axis rotation</td>
|
||||
</tr> <tr> <td><a name="SkPath_arcTo_4_xAxisRotate"> <code><strong>xAxisRotate </strong></code> </a></td> <td>
|
||||
x-axis rotation in degrees; positve values are clockwise</td>
|
||||
x-axis rotation in degrees; positive values are clockwise</td>
|
||||
</tr> <tr> <td><a name="SkPath_arcTo_4_largeArc"> <code><strong>largeArc </strong></code> </a></td> <td>
|
||||
chooses smaller or larger <a href="#Arc">Arc</a></td>
|
||||
</tr> <tr> <td><a name="SkPath_arcTo_4_sweep"> <code><strong>sweep </strong></code> </a></td> <td>
|
||||
@ -2894,19 +2894,19 @@ and smaller or larger.
|
||||
|
||||
<a href="#Arc">Arc</a> <a href="#SkPath_arcTo_5_sweep">sweep</a> is always less than 360 degrees. <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> to <a href="#SkPath_arcTo_5_xy">xy</a> if either radii are zero,
|
||||
or if last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> equals (x, y). <a href="#SkPath_arcTo">arcTo</a> scales radii <a href="#SkPath_arcTo_5_r">r</a> to fit last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> and
|
||||
<a href="#SkPath_arcTo_5_xy">xy</a> if both are greater than zero but too small.
|
||||
<a href="#SkPath_arcTo_5_xy">xy</a> if both are greater than zero but too small to describe an arc.
|
||||
|
||||
<a href="#SkPath_arcTo">arcTo</a> appends up to four <a href="#Conic">Conic</a> curves.
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionatlity of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> sweep-flag value is
|
||||
opposite the integer value of <a href="#SkPath_arcTo_5_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> sweep-flag uses 1 for clockwise, while <a href="#SkPath_kCW_Direction">kCW Direction</a>
|
||||
cast to int is zero.
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> "" value is
|
||||
opposite the integer value of <a href="#SkPath_arcTo_5_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> "" uses 1 for clockwise, while
|
||||
<a href="#SkPath_kCW_Direction">kCW Direction</a> cast to int is zero.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkPath_arcTo_5_r"> <code><strong>r </strong></code> </a></td> <td>
|
||||
radii in x and y before x-axis rotation</td>
|
||||
</tr> <tr> <td><a name="SkPath_arcTo_5_xAxisRotate"> <code><strong>xAxisRotate </strong></code> </a></td> <td>
|
||||
x-axis rotation in degrees; positve values are clockwise</td>
|
||||
x-axis rotation in degrees; positive values are clockwise</td>
|
||||
</tr> <tr> <td><a name="SkPath_arcTo_5_largeArc"> <code><strong>largeArc </strong></code> </a></td> <td>
|
||||
chooses smaller or larger <a href="#Arc">Arc</a></td>
|
||||
</tr> <tr> <td><a name="SkPath_arcTo_5_sweep"> <code><strong>sweep </strong></code> </a></td> <td>
|
||||
@ -2935,19 +2935,20 @@ void rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
|
||||
</pre>
|
||||
|
||||
Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>, relative to last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a>. <a href="#Arc">Arc</a> is implemented by one or
|
||||
more <a href="#Conic">Conic</a>, weighted to describe part of <a href="undocumented#Oval">Oval</a> with radii (r.fX, r.fY) rotated by
|
||||
<a href="#SkPath_rArcTo_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> (x0, y0) to(x0 + <a href="#SkPath_rArcTo_dx">dx</a>, y0 + <a href="#SkPath_rArcTo_dy">dy</a>),
|
||||
more <a href="#Conic">Conic</a>, weighted to describe part of <a href="undocumented#Oval">Oval</a> with radii (<a href="#SkPath_rArcTo_rx">rx</a>, <a href="#SkPath_rArcTo_ry">ry</a>) rotated by
|
||||
<a href="#SkPath_rArcTo_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> (x0, y0) to end <a href="undocumented#Point">Point</a>(x0 + <a href="#SkPath_rArcTo_dx">dx</a>, y0 + <a href="#SkPath_rArcTo_dy">dy</a>),
|
||||
choosing one of four possible routes: clockwise or
|
||||
counterclockwise, and smaller or larger. If <a href="#Path">Path</a> is empty, the start <a href="#Arc">Arc</a> <a href="undocumented#Point">Point</a>
|
||||
is (0, 0).
|
||||
|
||||
<a href="#Arc">Arc</a> <a href="#SkPath_rArcTo_sweep">sweep</a> is always less than 360 degrees. <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> to xy if either
|
||||
radii are zero, or if last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> equals (x, y). <a href="#SkPath_arcTo">arcTo</a> scales radii r to fit
|
||||
last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> and xy if both are greater than zero but too small.
|
||||
<a href="#Arc">Arc</a> <a href="#SkPath_rArcTo_sweep">sweep</a> is always less than 360 degrees. <a href="#SkPath_arcTo">arcTo</a> appends <a href="undocumented#Line">Line</a> to end <a href="undocumented#Point">Point</a>
|
||||
if either radii are zero, or if last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> equals end <a href="undocumented#Point">Point</a>.
|
||||
<a href="#SkPath_arcTo">arcTo</a> scales radii (<a href="#SkPath_rArcTo_rx">rx</a>, <a href="#SkPath_rArcTo_ry">ry</a>) to fit last <a href="#Path">Path</a> <a href="undocumented#Point">Point</a> and end <a href="undocumented#Point">Point</a> if both are
|
||||
greater than zero but too small to describe an arc.
|
||||
|
||||
<a href="#SkPath_arcTo">arcTo</a> appends up to four <a href="#Conic">Conic</a> curves.
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionatlity of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> sweep-flag value is
|
||||
opposite the integer value of <a href="#SkPath_rArcTo_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> sweep-flag uses 1 for clockwise, while
|
||||
<a href="#SkPath_arcTo">arcTo</a> implements the functionality of <a href="#Arc">SVG Arc</a>, although <a href="undocumented#SVG">SVG</a> "" value is
|
||||
opposite the integer value of <a href="#SkPath_rArcTo_sweep">sweep</a>; <a href="undocumented#SVG">SVG</a> "" uses 1 for clockwise, while
|
||||
<a href="#SkPath_kCW_Direction">kCW Direction</a> cast to int is zero.
|
||||
|
||||
### Parameters
|
||||
@ -2957,7 +2958,7 @@ radius in x before x-axis rotation</td>
|
||||
</tr> <tr> <td><a name="SkPath_rArcTo_ry"> <code><strong>ry </strong></code> </a></td> <td>
|
||||
radius in y before x-axis rotation</td>
|
||||
</tr> <tr> <td><a name="SkPath_rArcTo_xAxisRotate"> <code><strong>xAxisRotate </strong></code> </a></td> <td>
|
||||
x-axis rotation in degrees; positve values are clockwise</td>
|
||||
x-axis rotation in degrees; positive values are clockwise</td>
|
||||
</tr> <tr> <td><a name="SkPath_rArcTo_largeArc"> <code><strong>largeArc </strong></code> </a></td> <td>
|
||||
chooses smaller or larger <a href="#Arc">Arc</a></td>
|
||||
</tr> <tr> <td><a name="SkPath_rArcTo_sweep"> <code><strong>sweep </strong></code> </a></td> <td>
|
||||
@ -2987,7 +2988,7 @@ void close()
|
||||
</pre>
|
||||
|
||||
Append <a href="#SkPath_kClose_Verb">kClose Verb</a> to <a href="#Path">Path</a>. A closed <a href="#Contour">Contour</a> connects the first and last <a href="undocumented#Point">Point</a>
|
||||
with <a href="undocumented#Line">Line</a>, forming a continous loop. Open and closed <a href="#Contour">Contour</a> draw the same
|
||||
with <a href="undocumented#Line">Line</a>, forming a continuous loop. Open and closed <a href="#Contour">Contour</a> draw the same
|
||||
with <a href="#SkPaint_kFill_Style">SkPaint::kFill Style</a>. With <a href="#SkPaint_kStroke_Style">SkPaint::kStroke Style</a>, open <a href="#Contour">Contour</a> draws
|
||||
<a href="#Stroke_Cap">Paint Stroke Cap</a> at <a href="#Contour">Contour</a> start and end; closed <a href="#Contour">Contour</a> draws
|
||||
<a href="#Stroke_Join">Paint Stroke Join</a> at <a href="#Contour">Contour</a> start and end.
|
||||
@ -3167,7 +3168,7 @@ bool isRect(SkRect* rect, bool* isClosed = nullptr,
|
||||
Direction* direction = nullptr) const
|
||||
</pre>
|
||||
|
||||
Returns true if <a href="#Path">Path</a> is eqivalent to <a href="undocumented#Rect">Rect</a> when filled.
|
||||
Returns true if <a href="#Path">Path</a> is equivalent to <a href="undocumented#Rect">Rect</a> when filled.
|
||||
If false: <a href="#SkPath_isRect_rect">rect</a>, <a href="#SkPath_isRect_isClosed">isClosed</a>, and <a href="#SkPath_isRect_direction">direction</a> are unchanged.
|
||||
If true: <a href="#SkPath_isRect_rect">rect</a>, <a href="#SkPath_isRect_isClosed">isClosed</a>, and <a href="#SkPath_isRect_direction">direction</a> are written to if not nullptr.
|
||||
|
||||
@ -3692,7 +3693,7 @@ 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 pt[0], then adds a line
|
||||
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].
|
||||
|
||||
@ -4223,7 +4224,7 @@ void dump(SkWStream* stream, bool forceClose, bool dumpAsHex) const
|
||||
</pre>
|
||||
|
||||
Writes text representation of <a href="#Path">Path</a> to <a href="#SkPath_dump_stream">stream</a>. If <a href="#SkPath_dump_stream">stream</a> is nullptr, <a href="#SkPath_dump_2">dump</a> writes to
|
||||
stdout. Set <a href="#SkPath_dump_forceClose">forceClose</a> to true to get
|
||||
standard output. Set <a href="#SkPath_dump_forceClose">forceClose</a> to true to get
|
||||
edges used to fill <a href="#Path">Path</a>. Set <a href="#SkPath_dump_dumpAsHex">dumpAsHex</a> true to get exact binary representations
|
||||
of floating point numbers used in <a href="#Point_Array">Point Array</a> and <a href="#Weight">Conic Weights</a>.
|
||||
|
||||
@ -4234,7 +4235,7 @@ writable <a href="undocumented#Stream">Stream</a> receiving <a href="#Path">Path
|
||||
</tr> <tr> <td><a name="SkPath_dump_forceClose"> <code><strong>forceClose </strong></code> </a></td> <td>
|
||||
true if missing <a href="#SkPath_kClose_Verb">kClose Verb</a> is output</td>
|
||||
</tr> <tr> <td><a name="SkPath_dump_dumpAsHex"> <code><strong>dumpAsHex </strong></code> </a></td> <td>
|
||||
true if <a href="undocumented#SkScalar">SkScalar</a> values are written as hexidecimal</td>
|
||||
true if <a href="undocumented#SkScalar">SkScalar</a> values are written as hexadecimal</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -4275,7 +4276,7 @@ path.close();
|
||||
void dump() const
|
||||
</pre>
|
||||
|
||||
Writes text representation of <a href="#Path">Path</a> to stdout. The representation may be
|
||||
Writes text representation of <a href="#Path">Path</a> to standard output. The representation may be
|
||||
directly compiled as <a href="undocumented#C">C</a>++ code. Floating point values are written
|
||||
with limited precision; it may not be possible to reconstruct original <a href="#Path">Path</a>
|
||||
from output.
|
||||
@ -4308,12 +4309,12 @@ path is not equal to copy
|
||||
void dumpHex() const
|
||||
</pre>
|
||||
|
||||
Writes text representation of <a href="#Path">Path</a> to stdout. The representation may be
|
||||
Writes text representation of <a href="#Path">Path</a> to standard output. The representation may be
|
||||
directly compiled as <a href="undocumented#C">C</a>++ code. Floating point values are written
|
||||
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>http://bug.skia.org.
|
||||
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
|
||||
|
@ -93,6 +93,10 @@ bool equalsWithinTolerance(const SkPoint& p) const
|
||||
|
||||
# <a name="SkDumpCanvas"></a> Class SkDumpCanvas
|
||||
|
||||
# <a name="Alias"></a> Alias
|
||||
|
||||
# <a name="Anti-alias"></a> Anti-alias
|
||||
|
||||
# <a name="BBH_Factory"></a> BBH Factory
|
||||
|
||||
# <a name="SkBBHFactory"></a> Class SkBBHFactory
|
||||
@ -229,12 +233,18 @@ int SkColorSetARGB(a, r, g, b)
|
||||
|
||||
# <a name="Color_Space"></a> Color Space
|
||||
|
||||
# <a name="Core_Graphics"></a> Core Graphics
|
||||
|
||||
# <a name="Core_Text"></a> Core Text
|
||||
|
||||
# <a name="Data"></a> Data
|
||||
|
||||
# <a name="Draw_Filter"></a> Draw Filter
|
||||
|
||||
# <a name="SkDrawFilter"></a> Class SkDrawFilter
|
||||
|
||||
# <a name="Draw_Layer"></a> Draw Layer
|
||||
|
||||
# <a name="Draw_Looper"></a> Draw Looper
|
||||
|
||||
# <a name="SkDrawLooper"></a> Class SkDrawLooper
|
||||
@ -306,6 +316,10 @@ static std::unique_ptr<SkCanvas>
|
||||
|
||||
# <a name="GPU_Surface"></a> GPU Surface
|
||||
|
||||
# <a name="HTML_Canvas"></a> HTML Canvas
|
||||
|
||||
## <a name="ArcTo"></a> ArcTo
|
||||
|
||||
# <a name="Image"></a> Image
|
||||
|
||||
## <a name="Alpha_Type"></a> Alpha Type
|
||||
@ -403,6 +417,8 @@ sk_sp<SkShader> makeShader(SkShader::TileMode, SkShader::TileMode,
|
||||
|
||||
# <a name="SkIRect"></a> Struct SkIRect
|
||||
|
||||
# <a name="Left_Side_Bearing"></a> Left Side Bearing
|
||||
|
||||
# <a name="Mask"></a> Mask
|
||||
|
||||
# <a name="Mask_Alpha"></a> Mask Alpha
|
||||
@ -436,6 +452,8 @@ sk_sp<SkShader> makeShader(SkShader::TileMode, SkShader::TileMode,
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# <a name="OS_X"></a> OS X
|
||||
|
||||
# <a name="Paint_Defaults"></a> Paint Defaults
|
||||
|
||||
### Constants
|
||||
@ -507,6 +525,14 @@ SkCanvas* beginRecording(const SkRect& bounds, SkBBHFactory* bbhFactory = NULL,
|
||||
|
||||
# <a name="SkPixmap"></a> Class SkPixmap
|
||||
|
||||
# <a name="PostScript"></a> PostScript
|
||||
|
||||
## <a name="Arct"></a> Arct
|
||||
|
||||
# <a name="Premultiply"></a> Premultiply
|
||||
|
||||
# <a name="Raster_Engine"></a> Raster Engine
|
||||
|
||||
# <a name="Raster_Surface"></a> Raster Surface
|
||||
|
||||
# <a name="Rasterizer"></a> Rasterizer
|
||||
@ -519,6 +545,8 @@ SkCanvas* beginRecording(const SkRect& bounds, SkBBHFactory* bbhFactory = NULL,
|
||||
|
||||
# <a name="sk_sp"></a> Class sk_sp
|
||||
|
||||
# <a name="Right_Side_Bearing"></a> Right Side Bearing
|
||||
|
||||
# <a name="Round_Rect"></a> Round Rect
|
||||
|
||||
# <a name="SkRRect"></a> Class SkRRect
|
||||
@ -583,6 +611,8 @@ static sk_sp<SkShader> MakeBitmapShader(const SkBitmap& src, TileMode tmx,
|
||||
|
||||
# <a name="SkString"></a> Class SkString
|
||||
|
||||
# <a name="Supersampling"></a> Supersampling
|
||||
|
||||
# <a name="Surface"></a> Surface
|
||||
|
||||
# <a name="SkSurface"></a> Class SkSurface
|
||||
@ -627,6 +657,8 @@ static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo&, void* pixels,
|
||||
|
||||
# <a name="SkTextBlob"></a> Class SkTextBlob
|
||||
|
||||
# <a name="Unpremultiply"></a> Unpremultiply
|
||||
|
||||
# <a name="Vertices"></a> Vertices
|
||||
|
||||
## <a name="Colors"></a> Colors
|
||||
|
@ -4,7 +4,7 @@ usingBookmaker
|
||||
# <a name="Bookmaker"></a> Bookmaker
|
||||
How to use the <a href="#Bookmaker">Bookmaker</a> utility.
|
||||
|
||||
Install<a href="usingBookmaker#Go">Go</a>https://golang.org/doc/installif needed.
|
||||
Install<a href="usingBookmaker#Go">Go</a>if needed.
|
||||
Get the fiddle command line interface tool.
|
||||
By default this will appear in your home directory.
|
||||
|
||||
@ -94,4 +94,4 @@ $ ./out/dir/bookmaker -p -b docs -i include/core/<a href="usingBookmaker#SkXXX">
|
||||
|
||||
## <a name="Bugs"></a> Bugs
|
||||
|
||||
<a href="#Bookmaker">Bookmaker</a> bugs are trackedherebug.skia.org/6898.
|
||||
<a href="#Bookmaker">Bookmaker</a> bugs are trackedhere.
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "bookmaker.h"
|
||||
|
||||
#include "SkCommandLineFlags.h"
|
||||
#include "SkOSFile.h"
|
||||
#include "SkOSPath.h"
|
||||
|
||||
@ -790,12 +789,12 @@ bool RootDefinition::dumpUnVisited() {
|
||||
return allStructElementsFound;
|
||||
}
|
||||
|
||||
const Definition* RootDefinition::find(const string& ref) const {
|
||||
const Definition* RootDefinition::find(const string& ref, AllowParens allowParens) const {
|
||||
const auto leafIter = fLeaves.find(ref);
|
||||
if (leafIter != fLeaves.end()) {
|
||||
return &leafIter->second;
|
||||
}
|
||||
if (string::npos == ref.find("()")) {
|
||||
if (AllowParens::kYes == allowParens && string::npos == ref.find("()")) {
|
||||
string withParens = ref + "()";
|
||||
const auto parensIter = fLeaves.find(withParens);
|
||||
if (parensIter != fLeaves.end()) {
|
||||
@ -810,7 +809,7 @@ const Definition* RootDefinition::find(const string& ref) const {
|
||||
const Definition* result = nullptr;
|
||||
for (const auto& branch : fBranches) {
|
||||
const RootDefinition* rootDef = branch.second;
|
||||
result = rootDef->find(ref);
|
||||
result = rootDef->find(ref, allowParens);
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
@ -866,7 +865,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
}
|
||||
definition = fParent;
|
||||
} else {
|
||||
if (!hasEnd && fRoot->find(name)) {
|
||||
if (!hasEnd && fRoot->find(name, RootDefinition::AllowParens::kNo)) {
|
||||
return this->reportError<bool>("duplicate symbol");
|
||||
}
|
||||
if (MarkType::kStruct == markType || MarkType::kClass == markType) {
|
||||
@ -990,7 +989,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
case MarkType::kDefinedBy: {
|
||||
string prefixed(fRoot->fName);
|
||||
const char* start = fChar;
|
||||
string name(start, this->trimmedBracketEnd(fMC, OneLine::kYes) - start);
|
||||
string name(start, this->trimmedBracketEnd(fMC) - start);
|
||||
prefixed += "::" + name;
|
||||
this->skipToEndBracket(fMC);
|
||||
const auto leafIter = fRoot->fLeaves.find(prefixed);
|
||||
@ -1039,7 +1038,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
definition->fName = typeNameBuilder[0];
|
||||
definition->fFiddle = fParent->fFiddle;
|
||||
definition->fContentStart = fChar;
|
||||
definition->fContentEnd = this->trimmedBracketEnd(fMC, OneLine::kYes);
|
||||
definition->fContentEnd = this->trimmedBracketEnd(fMC);
|
||||
this->skipToEndBracket(fMC);
|
||||
SkAssertResult(fMC == this->next());
|
||||
SkAssertResult(fMC == this->next());
|
||||
@ -1079,6 +1078,9 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
fMarkup.emplace_front(markType, defStart, fLineCount, fParent);
|
||||
definition = &fMarkup.front();
|
||||
definition->fContentStart = fChar;
|
||||
if (MarkType::kFormula == markType && MarkType::kRow == definition->fParent->fMarkType) {
|
||||
SkDebugf("");
|
||||
}
|
||||
definition->fName = typeNameBuilder[0];
|
||||
definition->fFiddle = fParent->fFiddle;
|
||||
char suffix = '\0';
|
||||
@ -1127,7 +1129,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
definition->fName = typeNameBuilder[0];
|
||||
definition->fFiddle = normalized_name(typeNameBuilder[0]);
|
||||
definition->fContentStart = fChar;
|
||||
definition->fContentEnd = this->trimmedBracketEnd('\n', OneLine::kYes);
|
||||
definition->fContentEnd = this->trimmedBracketEnd('\n');
|
||||
definition->fTerminator = this->lineEnd() - 1;
|
||||
fParent->fChildren.push_back(definition);
|
||||
if (MarkType::kAnchor == markType) {
|
||||
@ -1137,7 +1139,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
this->skipWhiteSpace();
|
||||
Definition* link = &fMarkup.front();
|
||||
link->fContentStart = fChar;
|
||||
link->fContentEnd = this->trimmedBracketEnd(fMC, OneLine::kYes);
|
||||
link->fContentEnd = this->trimmedBracketEnd(fMC);
|
||||
this->skipToEndBracket(fMC);
|
||||
SkAssertResult(fMC == this->next());
|
||||
SkAssertResult(fMC == this->next());
|
||||
@ -1393,14 +1395,29 @@ int BmhParser::endHashCount() const {
|
||||
return count;
|
||||
}
|
||||
|
||||
bool BmhParser::endTableColumn(const char* end, const char* terminator) {
|
||||
if (!this->popParentStack(fParent)) {
|
||||
return false;
|
||||
}
|
||||
fWorkingColumn->fContentEnd = end;
|
||||
fWorkingColumn->fTerminator = terminator;
|
||||
fColStart = fChar - 1;
|
||||
this->skipSpace();
|
||||
fTableState = TableState::kColumnStart;
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME: some examples may produce different output on different platforms
|
||||
// if the text output can be different, think of how to author that
|
||||
|
||||
bool BmhParser::findDefinitions() {
|
||||
bool lineStart = true;
|
||||
const char* lastChar = nullptr;
|
||||
const char* lastMC = nullptr;
|
||||
fParent = nullptr;
|
||||
while (!this->eof()) {
|
||||
if (this->peek() == fMC) {
|
||||
lastMC = fChar;
|
||||
this->next();
|
||||
if (this->peek() == fMC) {
|
||||
this->next();
|
||||
@ -1408,11 +1425,26 @@ bool BmhParser::findDefinitions() {
|
||||
return this->reportError<bool>("expected definition");
|
||||
}
|
||||
if (this->peek() != fMC) {
|
||||
if (MarkType::kColumn == fParent->fMarkType) {
|
||||
SkASSERT(TableState::kColumnEnd == fTableState);
|
||||
if (!this->endTableColumn(lastChar, lastMC)) {
|
||||
return false;
|
||||
}
|
||||
SkASSERT(fRow);
|
||||
if (!this->popParentStack(fParent)) {
|
||||
return false;
|
||||
}
|
||||
fRow->fContentEnd = fWorkingColumn->fContentEnd;
|
||||
fWorkingColumn = nullptr;
|
||||
fRow = nullptr;
|
||||
fTableState = TableState::kNone;
|
||||
} else {
|
||||
vector<string> parentName;
|
||||
parentName.push_back(fParent->fName);
|
||||
if (!this->addDefinition(fChar - 1, true, fParent->fMarkType, parentName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SkAssertResult(this->next() == fMC);
|
||||
fMC = this->next(); // change markup character
|
||||
@ -1462,15 +1494,22 @@ bool BmhParser::findDefinitions() {
|
||||
&& MarkType::kLegend != fParent->fMarkType
|
||||
&& MarkType::kList != fParent->fMarkType)) {
|
||||
int endHashes = this->endHashCount();
|
||||
if (endHashes <= 1) { // one line comment
|
||||
if (endHashes <= 1) {
|
||||
if (fParent) {
|
||||
fMarkup.emplace_front(MarkType::kComment, fChar - 1, fLineCount, fParent);
|
||||
if (TableState::kColumnEnd == fTableState) {
|
||||
if (!this->endTableColumn(lastChar, lastMC)) {
|
||||
return false;
|
||||
}
|
||||
} else { // one line comment
|
||||
fMarkup.emplace_front(MarkType::kComment, fChar - 1, fLineCount,
|
||||
fParent);
|
||||
Definition* comment = &fMarkup.front();
|
||||
comment->fContentStart = fChar - 1;
|
||||
this->skipToEndBracket('\n');
|
||||
comment->fContentEnd = fChar;
|
||||
comment->fTerminator = fChar;
|
||||
fParent->fChildren.push_back(comment);
|
||||
}
|
||||
} else {
|
||||
fChar = fLine + this->lineLength() - 1;
|
||||
}
|
||||
@ -1485,41 +1524,37 @@ bool BmhParser::findDefinitions() {
|
||||
return this->reportError<bool>("missing table");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (TableState::kNone == fTableState) {
|
||||
bool parentIsList = MarkType::kList == fParent->fMarkType;
|
||||
if (parentIsList && fLineCount > 1230) {
|
||||
SkDebugf("");
|
||||
}
|
||||
// fixme? no nested tables for now
|
||||
const char* colStart = fChar - 1;
|
||||
fMarkup.emplace_front(MarkType::kRow, colStart, fLineCount, fParent);
|
||||
Definition* row = &fMarkup.front();
|
||||
fColStart = fChar - 1;
|
||||
fMarkup.emplace_front(MarkType::kRow, fColStart, fLineCount, fParent);
|
||||
fRow = &fMarkup.front();
|
||||
fRow->fName = fParent->fName;
|
||||
this->skipWhiteSpace();
|
||||
row->fContentStart = fChar;
|
||||
this->setAsParent(row);
|
||||
const char* lineEnd = this->lineEnd();
|
||||
do {
|
||||
fMarkup.emplace_front(MarkType::kColumn, colStart, fLineCount, fParent);
|
||||
Definition* column = &fMarkup.front();
|
||||
column->fContentStart = fChar;
|
||||
column->fContentEnd = this->trimmedBracketEnd(fMC,
|
||||
parentIsList ? OneLine::kNo : OneLine::kYes);
|
||||
this->skipToEndBracket(fMC);
|
||||
colStart = fChar;
|
||||
SkAssertResult(fMC == this->next());
|
||||
if (fMC == this->peek()) {
|
||||
this->next();
|
||||
fRow->fContentStart = fChar;
|
||||
this->setAsParent(fRow);
|
||||
fTableState = TableState::kColumnStart;
|
||||
}
|
||||
column->fTerminator = fChar;
|
||||
fParent->fChildren.push_back(column);
|
||||
this->skipSpace();
|
||||
} while (fChar < lineEnd && '\n' != this->peek());
|
||||
if (!this->popParentStack(fParent)) {
|
||||
return false;
|
||||
}
|
||||
const Definition* lastCol = row->fChildren.back();
|
||||
row->fContentEnd = lastCol->fContentEnd;
|
||||
if (TableState::kColumnStart == fTableState) {
|
||||
fMarkup.emplace_front(MarkType::kColumn, fColStart, fLineCount, fParent);
|
||||
fWorkingColumn = &fMarkup.front();
|
||||
fWorkingColumn->fName = fParent->fName;
|
||||
fWorkingColumn->fContentStart = fChar;
|
||||
this->setAsParent(fWorkingColumn);
|
||||
fTableState = TableState::kColumnEnd;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
lineStart = this->next() == '\n';
|
||||
char nextChar = this->next();
|
||||
lineStart = nextChar == '\n';
|
||||
if (' ' < nextChar) {
|
||||
lastChar = fChar;
|
||||
}
|
||||
}
|
||||
if (fParent) {
|
||||
return this->reportError<bool>("mismatched end");
|
||||
@ -2115,7 +2150,7 @@ DEFINE_string2(include, i, "", "A path to a *.h file or a directory.");
|
||||
DEFINE_bool2(hack, k, false, "Do a find/replace hack to update all *.bmh files. (Requires -b)");
|
||||
DEFINE_bool2(populate, p, false, "Populate include from bmh. (Requires -b -i)");
|
||||
DEFINE_string2(ref, r, "", "Resolve refs and write bmh_*.md files to path. (Requires -b)");
|
||||
DEFINE_bool2(spellcheck, s, false, "Spell-check. (Requires -b)");
|
||||
DEFINE_string2(spellcheck, s, "", "Spell-check [once, all, mispellings]. (Requires -b)");
|
||||
DEFINE_bool2(tokens, t, false, "Output include tokens. (Requires -i)");
|
||||
DEFINE_bool2(crosscheck, x, false, "Check bmh against includes. (Requires -b -i)");
|
||||
|
||||
@ -2198,7 +2233,7 @@ int main(int argc, char** const argv) {
|
||||
SkCommandLineFlags::PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
if (FLAGS_bmh.isEmpty() && FLAGS_spellcheck) {
|
||||
if (FLAGS_bmh.isEmpty() && !FLAGS_spellcheck.isEmpty()) {
|
||||
SkDebugf("-s requires -b\n");
|
||||
SkCommandLineFlags::PrintUsage();
|
||||
return 1;
|
||||
@ -2257,8 +2292,8 @@ int main(int argc, char** const argv) {
|
||||
MdOut mdOut(bmhParser);
|
||||
mdOut.buildReferences(FLAGS_bmh[0], FLAGS_ref[0]);
|
||||
}
|
||||
if (!done && FLAGS_spellcheck && FLAGS_examples.isEmpty()) {
|
||||
bmhParser.spellCheck(FLAGS_bmh[0]);
|
||||
if (!done && !FLAGS_spellcheck.isEmpty() && FLAGS_examples.isEmpty()) {
|
||||
bmhParser.spellCheck(FLAGS_bmh[0], FLAGS_spellcheck);
|
||||
done = true;
|
||||
}
|
||||
int examples = 0;
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#define STDOUT_TO_IDE_OUT 0
|
||||
|
||||
#include "SkCommandLineFlags.h"
|
||||
#include "SkData.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -205,11 +206,6 @@ class TextParser : public NonAssignable {
|
||||
TextParser() {} // only for ParserCommon to call
|
||||
friend class ParserCommon;
|
||||
public:
|
||||
enum OneLine {
|
||||
kNo,
|
||||
kYes
|
||||
};
|
||||
|
||||
class Save {
|
||||
public:
|
||||
Save(TextParser* parser) {
|
||||
@ -435,7 +431,7 @@ public:
|
||||
void skipToNonAlphaNum() {
|
||||
while (fChar < fEnd && (isalnum(fChar[0])
|
||||
|| '_' == fChar[0] || '-' == fChar[0]
|
||||
|| (':' == fChar[0] && fChar +1 < fEnd && ':' == fChar[1])
|
||||
|| (':' == fChar[0] && fChar + 1 < fEnd && ':' == fChar[1])
|
||||
|| ('.' == fChar[0] && fChar + 1 < fEnd && isalpha(fChar[1])))) {
|
||||
if (':' == fChar[0] && fChar +1 < fEnd && ':' == fChar[1]) {
|
||||
fChar++;
|
||||
@ -452,7 +448,7 @@ public:
|
||||
|
||||
bool skipName(const char* word) {
|
||||
size_t len = strlen(word);
|
||||
if (len < (size_t) (fEnd - fChar) && !strncmp(word, fChar, len)) {
|
||||
if (len <= (size_t) (fEnd - fChar) && !strncmp(word, fChar, len)) {
|
||||
fChar += len;
|
||||
}
|
||||
return this->eof() || ' ' >= fChar[0];
|
||||
@ -495,7 +491,7 @@ public:
|
||||
|
||||
bool startsWith(const char* str) const {
|
||||
size_t len = strlen(str);
|
||||
ptrdiff_t lineLen = this->lineLength();
|
||||
ptrdiff_t lineLen = fEnd - fChar;
|
||||
return len <= (size_t) lineLen && 0 == strncmp(str, fChar, len);
|
||||
}
|
||||
|
||||
@ -556,8 +552,8 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* trimmedBracketEnd(const char bracket, OneLine oneLine) const {
|
||||
int max = (int) (OneLine::kYes == oneLine ? this->lineLength() : fEnd - fChar);
|
||||
const char* trimmedBracketEnd(const char bracket) const {
|
||||
int max = (int) (this->lineLength());
|
||||
int index = 0;
|
||||
while (index < max && bracket != fChar[index]) {
|
||||
++index;
|
||||
@ -899,6 +895,11 @@ public:
|
||||
|
||||
class RootDefinition : public Definition {
|
||||
public:
|
||||
enum class AllowParens {
|
||||
kNo,
|
||||
kYes,
|
||||
};
|
||||
|
||||
RootDefinition() {
|
||||
}
|
||||
|
||||
@ -920,7 +921,7 @@ public:
|
||||
const RootDefinition* asRoot() const override { return this; }
|
||||
void clearVisited();
|
||||
bool dumpUnVisited();
|
||||
const Definition* find(const string& ref) const;
|
||||
const Definition* find(const string& ref, AllowParens ) const;
|
||||
bool isRoot() const override { return true; }
|
||||
RootDefinition* rootParent() override { return fRootParent; }
|
||||
void setRootParent(RootDefinition* rootParent) { fRootParent = rootParent; }
|
||||
@ -1108,6 +1109,9 @@ public:
|
||||
}
|
||||
|
||||
void writeString(const char* str) {
|
||||
if (!strcmp("utf-8", str)) {
|
||||
SkDebugf("");
|
||||
}
|
||||
SkASSERT(strlen(str) > 0);
|
||||
SkASSERT(' ' < str[0]);
|
||||
SkASSERT(' ' < str[strlen(str) - 1]);
|
||||
@ -1194,6 +1198,12 @@ public:
|
||||
kOptional,
|
||||
};
|
||||
|
||||
enum class TableState {
|
||||
kNone,
|
||||
kColumnStart,
|
||||
kColumnEnd,
|
||||
};
|
||||
|
||||
#define M(mt) (1LL << (int) MarkType::k##mt)
|
||||
#define M_D M(Description)
|
||||
#define M_CS M(Class) | M(Struct)
|
||||
@ -1237,19 +1247,20 @@ public:
|
||||
, { "Experimental", nullptr, MarkType::kExperimental, R_Y, E_N, 0 }
|
||||
, { "External", nullptr, MarkType::kExternal, R_Y, E_N, M(Root) }
|
||||
, { "File", nullptr, MarkType::kFile, R_N, E_N, M(Track) }
|
||||
, { "Formula", nullptr, MarkType::kFormula, R_O, E_N, M_ST | M(Member) | M(Method) | M_D }
|
||||
, { "Formula", nullptr, MarkType::kFormula, R_O, E_N,
|
||||
M(Column) | M_ST | M(Member) | M(Method) | M_D }
|
||||
, { "Function", nullptr, MarkType::kFunction, R_O, E_N, M(Example) }
|
||||
, { "Height", nullptr, MarkType::kHeight, R_N, E_N, M(Example) }
|
||||
, { "Image", nullptr, MarkType::kImage, R_N, E_N, M(Example) }
|
||||
, { "Legend", nullptr, MarkType::kLegend, R_Y, E_N, M(Table) }
|
||||
, { "", nullptr, MarkType::kLink, R_Y, E_N, M(Anchor) }
|
||||
, { "", nullptr, MarkType::kLink, R_N, E_N, M(Anchor) }
|
||||
, { "List", nullptr, MarkType::kList, R_Y, E_N, M(Method) | M_CSST | M_E | M_D }
|
||||
, { "", nullptr, MarkType::kMarkChar, R_N, E_N, 0 }
|
||||
, { "Member", nullptr, MarkType::kMember, R_Y, E_N, M(Class) | M(Struct) }
|
||||
, { "Method", &fMethodMap, MarkType::kMethod, R_Y, E_Y, M_CSST }
|
||||
, { "NoExample", nullptr, MarkType::kNoExample, R_Y, E_N, 0 }
|
||||
, { "Param", nullptr, MarkType::kParam, R_Y, E_N, M(Method) }
|
||||
, { "Platform", nullptr, MarkType::kPlatform, R_Y, E_N, M(Example) }
|
||||
, { "Platform", nullptr, MarkType::kPlatform, R_N, E_N, M(Example) }
|
||||
, { "Private", nullptr, MarkType::kPrivate, R_N, E_N, 0 }
|
||||
, { "Return", nullptr, MarkType::kReturn, R_Y, E_N, M(Method) }
|
||||
, { "", nullptr, MarkType::kRoot, R_Y, E_N, 0 }
|
||||
@ -1296,6 +1307,7 @@ public:
|
||||
string className(MarkType markType);
|
||||
bool collectExternals();
|
||||
int endHashCount() const;
|
||||
bool endTableColumn(const char* end, const char* terminator);
|
||||
|
||||
RootDefinition* findBmhObject(MarkType markType, const string& typeName) {
|
||||
auto map = fMaps[(int) markType].fBmh;
|
||||
@ -1326,6 +1338,9 @@ public:
|
||||
void reset() override {
|
||||
INHERITED::resetCommon();
|
||||
fRoot = nullptr;
|
||||
fWorkingColumn = nullptr;
|
||||
fRow = nullptr;
|
||||
fTableState = TableState::kNone;
|
||||
fMC = '#';
|
||||
fInChar = false;
|
||||
fInCharCommentString = false;
|
||||
@ -1337,7 +1352,7 @@ public:
|
||||
|
||||
bool skipNoName();
|
||||
bool skipToDefinitionEnd(MarkType markType);
|
||||
void spellCheck(const char* match) const;
|
||||
void spellCheck(const char* match, SkCommandLineFlags::StringArray report) const;
|
||||
vector<string> topicName();
|
||||
vector<string> typeName(MarkType markType, bool* expectEnd);
|
||||
string uniqueName(const string& base, MarkType markType);
|
||||
@ -1368,6 +1383,10 @@ public:
|
||||
unordered_map<string, Definition*> fTopicMap;
|
||||
unordered_map<string, Definition*> fAliasMap;
|
||||
RootDefinition* fRoot;
|
||||
Definition* fWorkingColumn;
|
||||
Definition* fRow;
|
||||
const char* fColStart;
|
||||
TableState fTableState;
|
||||
mutable char fMC; // markup character
|
||||
bool fAnonymous;
|
||||
bool fCloned;
|
||||
@ -1639,6 +1658,12 @@ public:
|
||||
kSpace,
|
||||
};
|
||||
|
||||
enum class RefType {
|
||||
kUndefined,
|
||||
kNormal,
|
||||
kExternal,
|
||||
};
|
||||
|
||||
enum class Wrote {
|
||||
kNone,
|
||||
kLF,
|
||||
@ -1699,7 +1724,7 @@ public:
|
||||
}
|
||||
|
||||
string resolveMethod(const char* start, const char* end, bool first);
|
||||
string resolveRef(const char* start, const char* end, bool first);
|
||||
string resolveRef(const char* start, const char* end, bool first, RefType* refType);
|
||||
Wrote rewriteBlock(int size, const char* data);
|
||||
Definition* structMemberOut(const Definition* memberStart, const Definition& child);
|
||||
void structOut(const Definition* root, const Definition& child,
|
||||
|
@ -231,7 +231,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
|
||||
continue;
|
||||
}
|
||||
string fullName = classMapper.first + "::" + token.fName;
|
||||
const Definition* def = root->find(fullName);
|
||||
const Definition* def = root->find(fullName, RootDefinition::AllowParens::kYes);
|
||||
switch (token.fMarkType) {
|
||||
case MarkType::kMethod: {
|
||||
if (this->internalName(token)) {
|
||||
@ -241,7 +241,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
|
||||
string paramName = className + "::";
|
||||
paramName += string(token.fContentStart,
|
||||
token.fContentEnd - token.fContentStart);
|
||||
def = root->find(paramName);
|
||||
def = root->find(paramName, RootDefinition::AllowParens::kYes);
|
||||
if (!def && 0 == token.fName.find("operator")) {
|
||||
string operatorName = className + "::";
|
||||
TextParser oper("", token.fStart, token.fContentEnd, 0);
|
||||
@ -258,7 +258,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
|
||||
}
|
||||
} while (!oper.eof() && oper.next() && parens > 0);
|
||||
operatorName += string(start, oper.fChar - start);
|
||||
def = root->find(operatorName);
|
||||
def = root->find(operatorName, RootDefinition::AllowParens::kYes);
|
||||
}
|
||||
}
|
||||
if (!def) {
|
||||
@ -267,17 +267,18 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
|
||||
string constructorName = className + "::";
|
||||
constructorName += string(token.fContentStart + skip,
|
||||
token.fContentEnd - token.fContentStart - skip);
|
||||
def = root->find(constructorName);
|
||||
def = root->find(constructorName, RootDefinition::AllowParens::kYes);
|
||||
}
|
||||
if (!def && 0 == token.fName.find("SK_")) {
|
||||
string incName = token.fName + "()";
|
||||
string macroName = className + "::" + incName;
|
||||
def = root->find(macroName);
|
||||
def = root->find(macroName, RootDefinition::AllowParens::kYes);
|
||||
if (def) {
|
||||
if (def->fName == incName) {
|
||||
def->fVisited = true;
|
||||
if ("SK_TO_STRING_NONVIRT" == token.fName) {
|
||||
def = root->find(className + "::toString");
|
||||
def = root->find(className + "::toString",
|
||||
RootDefinition::AllowParens::kYes);
|
||||
if (def) {
|
||||
def->fVisited = true;
|
||||
} else {
|
||||
@ -300,7 +301,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
|
||||
}
|
||||
if (allLower) {
|
||||
string lowerName = className + "::" + token.fName + "()";
|
||||
def = root->find(lowerName);
|
||||
def = root->find(lowerName, RootDefinition::AllowParens::kYes);
|
||||
}
|
||||
}
|
||||
if (!def) {
|
||||
@ -314,7 +315,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
|
||||
if (!def) {
|
||||
// simple method names inside nested classes have a bug and are missing trailing parens
|
||||
string withParens = fullName + "()"; // FIXME: this shouldn't be necessary
|
||||
def = root->find(withParens);
|
||||
def = root->find(withParens, RootDefinition::AllowParens::kNo);
|
||||
}
|
||||
if (!def) {
|
||||
SkDebugf("method missing from bmh: %s\n", fullName.c_str());
|
||||
@ -359,7 +360,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
|
||||
++lastUnderscore;
|
||||
string anonName = className + "::" + string(lastUnderscore,
|
||||
wordEnd - lastUnderscore) + 's';
|
||||
def = root->find(anonName);
|
||||
def = root->find(anonName, RootDefinition::AllowParens::kYes);
|
||||
}
|
||||
if (!def) {
|
||||
SkDebugf("enum missing from bmh: %s\n", fullName.c_str());
|
||||
@ -386,10 +387,10 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
|
||||
string constName = MarkType::kEnumClass == token.fMarkType ?
|
||||
fullName : className;
|
||||
constName += "::" + child->fName;
|
||||
def = root->find(constName);
|
||||
def = root->find(constName, RootDefinition::AllowParens::kYes);
|
||||
if (!def) {
|
||||
string innerName = classMapper.first + "::" + child->fName;
|
||||
def = root->find(innerName);
|
||||
def = root->find(innerName, RootDefinition::AllowParens::kYes);
|
||||
}
|
||||
if (!def) {
|
||||
if (string::npos == child->fName.find("Legacy_")) {
|
||||
@ -1142,7 +1143,7 @@ bool IncludeParser::parseMember(Definition* child, Definition* markupDef) {
|
||||
break;
|
||||
}
|
||||
const char* start = parser.fChar;
|
||||
const char* end = parser.trimmedBracketEnd('\n', OneLine::kYes);
|
||||
const char* end = parser.trimmedBracketEnd('\n');
|
||||
if (Bracket::kSlashStar == comment->fBracket) {
|
||||
const char* commentEnd = parser.strnstr("*/", end);
|
||||
if (commentEnd) {
|
||||
@ -1450,6 +1451,7 @@ bool IncludeParser::parseChar() {
|
||||
return reportError<bool>("malformed closing comment");
|
||||
}
|
||||
if (Bracket::kSlashStar == this->topBracket()) {
|
||||
this->next(); // include close in bracket -- FIXME? will this skip stuff?
|
||||
this->popBracket();
|
||||
}
|
||||
break;
|
||||
|
@ -33,9 +33,9 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
|
||||
child.fChildren[0]->fName = enumName;
|
||||
}
|
||||
fullName = root->fName + "::" + enumName;
|
||||
enumDef = root->find(enumName);
|
||||
enumDef = root->find(enumName, RootDefinition::AllowParens::kNo);
|
||||
if (!enumDef) {
|
||||
enumDef = root->find(fullName);
|
||||
enumDef = root->find(fullName, RootDefinition::AllowParens::kNo);
|
||||
}
|
||||
SkASSERT(enumDef);
|
||||
// child[0] should be #Code comment starts at child[0].fTerminator
|
||||
@ -48,7 +48,7 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
|
||||
if (fAnonymousEnumCount > 1) {
|
||||
enumName += '_' + to_string(fAnonymousEnumCount);
|
||||
}
|
||||
enumDef = root->find(enumName);
|
||||
enumDef = root->find(enumName, RootDefinition::AllowParens::kNo);
|
||||
SkASSERT(enumDef);
|
||||
++fAnonymousEnumCount;
|
||||
}
|
||||
@ -794,7 +794,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
|
||||
}
|
||||
++alternate;
|
||||
string alternateMethod = methodName + '_' + to_string(alternate);
|
||||
clonedMethod = root->find(alternateMethod);
|
||||
clonedMethod = root->find(alternateMethod, RootDefinition::AllowParens::kNo);
|
||||
} while (clonedMethod);
|
||||
if (!clonedMethod) {
|
||||
return this->reportError<bool>("cloned method not found");
|
||||
@ -823,7 +823,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
|
||||
--continueEnd;
|
||||
}
|
||||
methodName += string(fContinuation, continueEnd - fContinuation);
|
||||
method = root->find(methodName);
|
||||
method = root->find(methodName, RootDefinition::AllowParens::kNo);
|
||||
if (!method) {
|
||||
fLineCount = child.fLineCount;
|
||||
fclose(fOut); // so we can see what we've written so far
|
||||
@ -836,7 +836,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
|
||||
continue;
|
||||
}
|
||||
methodName += "()";
|
||||
method = root->find(methodName);
|
||||
method = root->find(methodName, RootDefinition::AllowParens::kNo);
|
||||
if (method && MarkType::kDefinedBy == method->fMarkType) {
|
||||
method = method->fParent;
|
||||
}
|
||||
@ -873,7 +873,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
|
||||
methodName = root->fName + "::" + child.fName;
|
||||
inConstructor = root->fName == child.fName;
|
||||
fContinuation = child.fContentEnd;
|
||||
method = root->find(methodName);
|
||||
method = root->find(methodName, RootDefinition::AllowParens::kNo);
|
||||
if (!method) {
|
||||
continue;
|
||||
}
|
||||
@ -905,9 +905,10 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
|
||||
}
|
||||
if (fInStruct) {
|
||||
fIndent += 4;
|
||||
fStructDef = root->find(child.fName);
|
||||
fStructDef = root->find(child.fName, RootDefinition::AllowParens::kNo);
|
||||
if (nullptr == structDef) {
|
||||
fStructDef = root->find(root->fName + "::" + child.fName);
|
||||
fStructDef = root->find(root->fName + "::" + child.fName,
|
||||
RootDefinition::AllowParens::kNo);
|
||||
}
|
||||
this->structSizeMembers(child);
|
||||
fIndent -= 4;
|
||||
@ -937,9 +938,10 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
|
||||
SkASSERT(0); // incomplete
|
||||
}
|
||||
} else {
|
||||
structDef = root->find(child.fName);
|
||||
structDef = root->find(child.fName, RootDefinition::AllowParens::kNo);
|
||||
if (nullptr == structDef) {
|
||||
structDef = root->find(root->fName + "::" + child.fName);
|
||||
structDef = root->find(root->fName + "::" + child.fName,
|
||||
RootDefinition::AllowParens::kNo);
|
||||
}
|
||||
if (!structDef) {
|
||||
this->lf(2);
|
||||
@ -1162,7 +1164,8 @@ string IncludeWriter::resolveMethod(const char* start, const char* end, bool fir
|
||||
}
|
||||
}
|
||||
SkASSERT(parent);
|
||||
auto defRef = parent->find(parent->fName + "::" + methodname);
|
||||
auto defRef = parent->find(parent->fName + "::" + methodname,
|
||||
RootDefinition::AllowParens::kNo);
|
||||
if (defRef && MarkType::kMethod == defRef->fMarkType) {
|
||||
substitute = methodname + "()";
|
||||
}
|
||||
@ -1175,9 +1178,17 @@ string IncludeWriter::resolveMethod(const char* start, const char* end, bool fir
|
||||
return substitute;
|
||||
}
|
||||
|
||||
string IncludeWriter::resolveRef(const char* start, const char* end, bool first) {
|
||||
string IncludeWriter::resolveRef(const char* start, const char* end, bool first,
|
||||
RefType* refType) {
|
||||
// look up Xxx_Xxx
|
||||
string undername(start, end - start);
|
||||
for (const auto& external : fBmhParser->fExternals) {
|
||||
if (external.fName == undername) {
|
||||
*refType = RefType::kExternal;
|
||||
return external.fName;
|
||||
}
|
||||
}
|
||||
*refType = RefType::kNormal;
|
||||
SkASSERT(string::npos == undername.find(' '));
|
||||
const Definition* rootDef = nullptr;
|
||||
{
|
||||
@ -1200,11 +1211,6 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first)
|
||||
if (fBmhParser->fAliasMap.end() != aliasIter) {
|
||||
rootDef = aliasIter->second->fParent;
|
||||
} else if (!first) {
|
||||
for (const auto& external : fBmhParser->fExternals) {
|
||||
if (external.fName == undername) {
|
||||
return external.fName;
|
||||
}
|
||||
}
|
||||
SkDebugf("unfound: %s\n", undername.c_str());
|
||||
this->reportError("reference unfound");
|
||||
return "";
|
||||
@ -1291,11 +1297,12 @@ int IncludeWriter::lookupReference(const PunctuationState punctuation, const Wor
|
||||
const int start, const int run, int lastWrite, const char last, const char* data) {
|
||||
const int end = PunctuationState::kDelimiter == punctuation ||
|
||||
PunctuationState::kPeriod == punctuation ? run - 1 : run;
|
||||
string temp = this->resolveRef(&data[start], &data[end], Word::kFirst == word);
|
||||
RefType refType = RefType::kUndefined;
|
||||
string resolved = string(&data[start], (size_t) (end - start));
|
||||
string temp = this->resolveRef(&data[start], &data[end], Word::kFirst == word, &refType);
|
||||
if (!temp.length()) {
|
||||
if (Word::kFirst != word && '_' != last) {
|
||||
temp = string(&data[start], (size_t) (end - start));
|
||||
temp = ConvertRef(temp, false);
|
||||
temp = ConvertRef(resolved, false);
|
||||
}
|
||||
}
|
||||
if (temp.length()) {
|
||||
@ -1439,6 +1446,7 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data) {
|
||||
embeddedSymbol = 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 ']':
|
||||
|
@ -184,7 +184,8 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
||||
for (string prefix : { "_", "::" } ) {
|
||||
RootDefinition* root = test->asRoot();
|
||||
string prefixed = root->fName + prefix + ref;
|
||||
if (const Definition* def = root->find(prefixed)) {
|
||||
if (const Definition* def = root->find(prefixed,
|
||||
RootDefinition::AllowParens::kYes)) {
|
||||
result += linkRef(leadingSpaces, def, ref);
|
||||
goto found;
|
||||
}
|
||||
@ -363,7 +364,7 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref,
|
||||
if (ref == fRoot->fName) {
|
||||
return fRoot;
|
||||
}
|
||||
if (const Definition* definition = fRoot->find(ref)) {
|
||||
if (const Definition* definition = fRoot->find(ref, RootDefinition::AllowParens::kYes)) {
|
||||
return definition;
|
||||
}
|
||||
Definition* test = fRoot;
|
||||
@ -376,14 +377,16 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref,
|
||||
if (ref == leaf.first) {
|
||||
return leaf.second;
|
||||
}
|
||||
const Definition* definition = leaf.second->find(ref);
|
||||
const Definition* definition = leaf.second->find(ref,
|
||||
RootDefinition::AllowParens::kYes);
|
||||
if (definition) {
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
for (string prefix : { "::", "_" } ) {
|
||||
string prefixed = root->fName + prefix + ref;
|
||||
if (const Definition* definition = root->find(prefixed)) {
|
||||
if (const Definition* definition = root->find(prefixed,
|
||||
RootDefinition::AllowParens::kYes)) {
|
||||
return definition;
|
||||
}
|
||||
if (isupper(prefixed[0])) {
|
||||
@ -401,7 +404,7 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref,
|
||||
auto classIter = fBmhParser.fClassMap.find(className);
|
||||
if (classIter != fBmhParser.fClassMap.end()) {
|
||||
const RootDefinition& classDef = classIter->second;
|
||||
const Definition* result = classDef.find(ref);
|
||||
const Definition* result = classDef.find(ref, RootDefinition::AllowParens::kYes);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
@ -414,7 +417,7 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref,
|
||||
// try with a prefix
|
||||
if ('k' == ref[0]) {
|
||||
for (auto const& iter : fBmhParser.fEnumMap) {
|
||||
if (iter.second.find(ref)) {
|
||||
if (iter.second.find(ref, RootDefinition::AllowParens::kYes)) {
|
||||
return &iter.second;
|
||||
}
|
||||
}
|
||||
@ -456,13 +459,15 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref,
|
||||
string className(ref, 0, pos);
|
||||
auto classIter = fBmhParser.fClassMap.find(className);
|
||||
if (classIter != fBmhParser.fClassMap.end()) {
|
||||
if (const Definition* definition = classIter->second.find(ref)) {
|
||||
if (const Definition* definition = classIter->second.find(ref,
|
||||
RootDefinition::AllowParens::kYes)) {
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
auto enumIter = fBmhParser.fEnumMap.find(className);
|
||||
if (enumIter != fBmhParser.fEnumMap.end()) {
|
||||
if (const Definition* definition = enumIter->second.find(ref)) {
|
||||
if (const Definition* definition = enumIter->second.find(ref,
|
||||
RootDefinition::AllowParens::kYes)) {
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
@ -682,7 +687,7 @@ void MdOut::markTypeOut(Definition* def) {
|
||||
TextParser tp(def->fFileName, def->fStart, def->fContentStart, def->fLineCount);
|
||||
tp.skipExact("#Member");
|
||||
tp.skipWhiteSpace();
|
||||
const char* end = tp.trimmedBracketEnd('\n', TextParser::OneLine::kYes);
|
||||
const char* end = tp.trimmedBracketEnd('\n');
|
||||
this->lfAlways(2);
|
||||
fprintf(fOut, "<a name=\"%s\"> <code><strong>%.*s</strong></code> </a>",
|
||||
def->fFiddle.c_str(), (int) (end - tp.fChar), tp.fChar);
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
this->reset();
|
||||
}
|
||||
bool check(const char* match);
|
||||
void report();
|
||||
void report(SkCommandLineFlags::StringArray report);
|
||||
private:
|
||||
enum class TableState {
|
||||
kNone,
|
||||
@ -56,6 +56,7 @@ private:
|
||||
fTableState = TableState::kNone;
|
||||
fInCode = false;
|
||||
fInConst = false;
|
||||
fInFormula = false;
|
||||
fInDescription = false;
|
||||
fInStdOut = false;
|
||||
}
|
||||
@ -77,6 +78,7 @@ private:
|
||||
bool fInCode;
|
||||
bool fInConst;
|
||||
bool fInDescription;
|
||||
bool fInFormula;
|
||||
bool fInStdOut;
|
||||
typedef ParserCommon INHERITED;
|
||||
};
|
||||
@ -88,10 +90,10 @@ private:
|
||||
modifiers to try to maintain a consistent voice.
|
||||
Maybe also look for passive verbs (e.g. 'is') and suggest active ones?
|
||||
*/
|
||||
void BmhParser::spellCheck(const char* match) const {
|
||||
void BmhParser::spellCheck(const char* match, SkCommandLineFlags::StringArray report) const {
|
||||
SpellCheck checker(*this);
|
||||
checker.check(match);
|
||||
checker.report();
|
||||
checker.report(report);
|
||||
}
|
||||
|
||||
bool SpellCheck::check(const char* match) {
|
||||
@ -112,13 +114,22 @@ bool SpellCheck::check(const char* match) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool all_lower(const string& str) {
|
||||
for (auto c : str) {
|
||||
if (!islower(c)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SpellCheck::check(Definition* def) {
|
||||
fFileName = def->fFileName;
|
||||
fLineCount = def->fLineCount;
|
||||
string printable = def->printableName();
|
||||
const char* textStart = def->fContentStart;
|
||||
if (MarkType::kParam != def->fMarkType && MarkType::kConst != def->fMarkType &&
|
||||
TableState::kNone != fTableState) {
|
||||
MarkType::kPrivate != def->fMarkType && TableState::kNone != fTableState) {
|
||||
fTableState = TableState::kNone;
|
||||
}
|
||||
switch (def->fMarkType) {
|
||||
@ -170,11 +181,14 @@ bool SpellCheck::check(Definition* def) {
|
||||
break;
|
||||
case MarkType::kExample:
|
||||
break;
|
||||
case MarkType::kExperimental:
|
||||
break;
|
||||
case MarkType::kExternal:
|
||||
break;
|
||||
case MarkType::kFile:
|
||||
break;
|
||||
case MarkType::kFormula:
|
||||
fInFormula = true;
|
||||
break;
|
||||
case MarkType::kFunction:
|
||||
break;
|
||||
@ -184,12 +198,19 @@ bool SpellCheck::check(Definition* def) {
|
||||
break;
|
||||
case MarkType::kLegend:
|
||||
break;
|
||||
case MarkType::kLink:
|
||||
break;
|
||||
case MarkType::kList:
|
||||
break;
|
||||
case MarkType::kMarkChar:
|
||||
break;
|
||||
case MarkType::kMember:
|
||||
break;
|
||||
case MarkType::kMethod: {
|
||||
string method_name = def->methodName();
|
||||
if (all_lower(method_name)) {
|
||||
method_name += "()";
|
||||
}
|
||||
string formattedStr = def->formatFunction();
|
||||
if (!def->isClone()) {
|
||||
this->wordCheck(method_name);
|
||||
@ -197,6 +218,8 @@ bool SpellCheck::check(Definition* def) {
|
||||
fTableState = TableState::kNone;
|
||||
fMethod = def;
|
||||
} break;
|
||||
case MarkType::kNoExample:
|
||||
break;
|
||||
case MarkType::kParam: {
|
||||
if (TableState::kNone == fTableState) {
|
||||
fTableState = TableState::kRow;
|
||||
@ -219,6 +242,8 @@ bool SpellCheck::check(Definition* def) {
|
||||
} break;
|
||||
case MarkType::kPlatform:
|
||||
break;
|
||||
case MarkType::kPrivate:
|
||||
break;
|
||||
case MarkType::kReturn:
|
||||
break;
|
||||
case MarkType::kRow:
|
||||
@ -240,6 +265,8 @@ bool SpellCheck::check(Definition* def) {
|
||||
fRoot = def->asRoot();
|
||||
this->wordCheck(def->fName);
|
||||
break;
|
||||
case MarkType::kSubstitute:
|
||||
break;
|
||||
case MarkType::kSubtopic:
|
||||
this->printCheck(printable);
|
||||
break;
|
||||
@ -263,6 +290,8 @@ bool SpellCheck::check(Definition* def) {
|
||||
break;
|
||||
case MarkType::kUnion:
|
||||
break;
|
||||
case MarkType::kVolatile:
|
||||
break;
|
||||
case MarkType::kWidth:
|
||||
break;
|
||||
default:
|
||||
@ -284,6 +313,9 @@ bool SpellCheck::check(Definition* def) {
|
||||
break;
|
||||
case MarkType::kExample:
|
||||
break;
|
||||
case MarkType::kFormula:
|
||||
fInFormula = false;
|
||||
break;
|
||||
case MarkType::kLegend:
|
||||
break;
|
||||
case MarkType::kMethod:
|
||||
@ -336,21 +368,90 @@ void SpellCheck::childCheck(const Definition* def, const char* start) {
|
||||
}
|
||||
|
||||
void SpellCheck::leafCheck(const char* start, const char* end) {
|
||||
TextParser text("", start, end, fLineCount);
|
||||
const char* chPtr = start;
|
||||
int inAngles = 0;
|
||||
int inParens = 0;
|
||||
bool inQuotes = false;
|
||||
bool allLower = true;
|
||||
char priorCh = 0;
|
||||
char lastCh = 0;
|
||||
const char* wordStart = nullptr;
|
||||
const char* wordEnd = nullptr;
|
||||
const char* possibleEnd = nullptr;
|
||||
do {
|
||||
const char* lineStart = text.fChar;
|
||||
text.skipToAlpha();
|
||||
if (text.eof()) {
|
||||
if (wordStart && wordEnd) {
|
||||
if (!allLower || (!inQuotes && '\"' != lastCh && !inParens
|
||||
&& ')' != lastCh && !inAngles && '>' != lastCh)) {
|
||||
string word(wordStart, (possibleEnd ? possibleEnd : wordEnd) - wordStart);
|
||||
wordCheck(word);
|
||||
}
|
||||
wordStart = nullptr;
|
||||
}
|
||||
if (chPtr == end) {
|
||||
break;
|
||||
}
|
||||
const char* wordStart = text.fChar;
|
||||
text.fChar = lineStart;
|
||||
text.skipTo(wordStart); // advances line number
|
||||
text.skipToNonAlphaNum();
|
||||
fLineCount = text.fLineCount;
|
||||
string word(wordStart, text.fChar - wordStart);
|
||||
wordCheck(word);
|
||||
} while (!text.eof());
|
||||
switch (*chPtr) {
|
||||
case '>':
|
||||
if (isalpha(lastCh)) {
|
||||
--inAngles;
|
||||
SkASSERT(inAngles >= 0);
|
||||
}
|
||||
wordEnd = chPtr;
|
||||
break;
|
||||
case '(':
|
||||
++inParens;
|
||||
possibleEnd = chPtr;
|
||||
break;
|
||||
case ')':
|
||||
--inParens;
|
||||
if ('(' == lastCh) {
|
||||
wordEnd = chPtr + 1;
|
||||
} else {
|
||||
wordEnd = chPtr;
|
||||
}
|
||||
SkASSERT(inParens >= 0);
|
||||
break;
|
||||
case '\"':
|
||||
inQuotes = !inQuotes;
|
||||
wordEnd = chPtr;
|
||||
SkASSERT(inQuotes == !wordStart);
|
||||
break;
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E':
|
||||
case 'F': case 'G': case 'H': case 'I': case 'J':
|
||||
case 'K': case 'L': case 'M': case 'N': case 'O':
|
||||
case 'P': case 'Q': case 'R': case 'S': case 'T':
|
||||
case 'U': case 'V': case 'W': case 'X': case 'Y':
|
||||
case 'Z':
|
||||
allLower = false;
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||
case 'f': case 'g': case 'h': case 'i': case 'j':
|
||||
case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||
case 'p': case 'q': case 'r': case 's': case 't':
|
||||
case 'u': case 'v': case 'w': case 'x': case 'y':
|
||||
case 'z':
|
||||
if (!wordStart) {
|
||||
wordStart = chPtr;
|
||||
wordEnd = nullptr;
|
||||
possibleEnd = nullptr;
|
||||
allLower = 'a' <= *chPtr;
|
||||
if ('<' == lastCh || ('<' == priorCh && '/' == lastCh)) {
|
||||
++inAngles;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case '_':
|
||||
allLower = false;
|
||||
case '-': // note that dash doesn't clear allLower
|
||||
break;
|
||||
default:
|
||||
wordEnd = chPtr;
|
||||
break;
|
||||
}
|
||||
priorCh = lastCh;
|
||||
lastCh = *chPtr;
|
||||
} while (++chPtr <= end);
|
||||
}
|
||||
|
||||
void SpellCheck::printCheck(const string& str) {
|
||||
@ -360,8 +461,15 @@ void SpellCheck::printCheck(const string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
void SpellCheck::report() {
|
||||
for (auto iter : fWords) {
|
||||
static bool stringCompare(std::pair<string, CheckEntry>& i, std::pair<string, CheckEntry>& j) {
|
||||
return i.first.compare(j.first) < 0;
|
||||
}
|
||||
|
||||
void SpellCheck::report(SkCommandLineFlags::StringArray report) {
|
||||
vector<std::pair<string, CheckEntry>> elems(fWords.begin(), fWords.end());
|
||||
std::sort(elems.begin(), elems.end(), stringCompare);
|
||||
if (report.contains("once")) {
|
||||
for (auto iter : elems) {
|
||||
if (string::npos != iter.second.fFile.find("undocumented.bmh")) {
|
||||
continue;
|
||||
}
|
||||
@ -372,13 +480,88 @@ void SpellCheck::report() {
|
||||
continue;
|
||||
}
|
||||
if (iter.second.fCount == 1) {
|
||||
SkDebugf("%s %s %d\n", iter.first.c_str(), iter.second.fFile.c_str(),
|
||||
iter.second.fLine);
|
||||
SkDebugf("%s(%d): %s\n", iter.second.fFile.c_str(), iter.second.fLine,
|
||||
iter.first.c_str());
|
||||
}
|
||||
}
|
||||
SkDebugf("\n");
|
||||
}
|
||||
if (report.contains("all")) {
|
||||
int column = 0;
|
||||
for (auto iter : elems) {
|
||||
if (string::npos != iter.second.fFile.find("undocumented.bmh")) {
|
||||
continue;
|
||||
}
|
||||
if (string::npos != iter.second.fFile.find("markup.bmh")) {
|
||||
continue;
|
||||
}
|
||||
if (string::npos != iter.second.fFile.find("usingBookmaker.bmh")) {
|
||||
continue;
|
||||
}
|
||||
string check = iter.first.c_str();
|
||||
bool allLower = true;
|
||||
for (auto c : check) {
|
||||
if (isupper(c)) {
|
||||
allLower = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!allLower) {
|
||||
continue;
|
||||
}
|
||||
if (column + check.length() > 100) {
|
||||
SkDebugf("\n");
|
||||
column = 0;
|
||||
}
|
||||
SkDebugf("%s ", check.c_str());
|
||||
column += check.length();
|
||||
}
|
||||
SkDebugf("\n\n");
|
||||
}
|
||||
if (report.contains("mispellings")) {
|
||||
const char* mispelled[] = {
|
||||
"decrementing",
|
||||
"differentially",
|
||||
"incrementing",
|
||||
"superset",
|
||||
};
|
||||
const char** mispellPtr = mispelled;
|
||||
const char** mispellEnd = &mispelled[SK_ARRAY_COUNT(mispelled)];
|
||||
for (auto iter : elems) {
|
||||
if (string::npos != iter.second.fFile.find("undocumented.bmh")) {
|
||||
continue;
|
||||
}
|
||||
if (string::npos != iter.second.fFile.find("markup.bmh")) {
|
||||
continue;
|
||||
}
|
||||
if (string::npos != iter.second.fFile.find("usingBookmaker.bmh")) {
|
||||
continue;
|
||||
}
|
||||
string check = iter.first.c_str();
|
||||
while (check.compare(*mispellPtr) > 0) {
|
||||
SkDebugf("%s not found\n", *mispellPtr);
|
||||
if (mispellEnd == ++mispellPtr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mispellEnd == mispellPtr) {
|
||||
break;
|
||||
}
|
||||
if (check.compare(*mispellPtr) == 0) {
|
||||
SkDebugf("%s(%d): %s\n", iter.second.fFile.c_str(), iter.second.fLine,
|
||||
iter.first.c_str());
|
||||
if (mispellEnd == ++mispellPtr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpellCheck::wordCheck(const string& str) {
|
||||
if ("nullptr" == str) {
|
||||
return; // doesn't seem worth it, treating nullptr as a word in need of correction
|
||||
}
|
||||
bool hasColon = false;
|
||||
bool hasDot = false;
|
||||
bool hasParen = false;
|
||||
@ -433,11 +616,20 @@ void SpellCheck::wordCheck(const string& str) {
|
||||
&& islower(str[0]) && isupper(str[1])) {
|
||||
inCode = true;
|
||||
}
|
||||
bool methodParam = false;
|
||||
if (fMethod) {
|
||||
for (auto child : fMethod->fChildren) {
|
||||
if (MarkType::kParam == child->fMarkType && str == child->fName) {
|
||||
methodParam = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
auto& mappy = hasColon ? fColons :
|
||||
hasDot ? fDots :
|
||||
hasParen ? fParens :
|
||||
hasUnderscore ? fUnderscores :
|
||||
fInStdOut || inCode || fInConst ? fCode :
|
||||
fInStdOut || fInFormula || inCode || fInConst || methodParam ? fCode :
|
||||
sawDigit ? fDigits : fWords;
|
||||
auto iter = mappy.find(str);
|
||||
if (mappy.end() != iter) {
|
||||
|
Loading…
Reference in New Issue
Block a user