diff options
25 files changed, 3228 insertions, 983 deletions
diff --git a/docs/SkColor4f_Reference.bmh b/docs/SkColor4f_Reference.bmh new file mode 100644 index 0000000000..71bdb76d1c --- /dev/null +++ b/docs/SkColor4f_Reference.bmh @@ -0,0 +1,193 @@ +#Topic Color4f +#Alias Color4f_Reference + +#Struct SkColor4f + +The float values are 0...1 unpremultiplied + +#Subtopic Overview + #Subtopic Subtopic + #Populate + ## +## + +#Subtopic Operator +#Populate +## + +#Subtopic Member_Function +#Populate +## + +#Member float fR +## + +#Member float fG +## + +#Member float fB +## + +#Member float fA +## + +# ------------------------------------------------------------------------------ + +#Method bool operator==(const SkColor4f& other)_const +#In Operator +#Line # incomplete ## + +#Param other incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method bool operator!=(const SkColor4f& other)_const +#In Operator +#Line # incomplete ## + +#Param other incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method const float* vec() const +#In incomplete +#Line # incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method float* vec() +#In incomplete +#Line # incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method static SkColor4f Pin(float r, float g, float b, float a) +#In incomplete +#Line # incomplete ## + +#Param r incomplete ## +#Param g incomplete ## +#Param b incomplete ## +#Param a incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method static SkColor4f FromColor(SkColor) +#In incomplete +#Line # incomplete ## + +Convert to SkColor4f, assuming SkColor is sRGB + +#Param SkColor incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method SkColor toSkColor() const +#In incomplete +#Line # incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method SkColor4f pin() const +#In incomplete +#Line # incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method SkPM4f premul() const +#In incomplete +#Line # incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +#Struct SkColor4f ## + +#Topic Color4f ## diff --git a/docs/SkColor_Reference.bmh b/docs/SkColor_Reference.bmh new file mode 100644 index 0000000000..7d174e7fec --- /dev/null +++ b/docs/SkColor_Reference.bmh @@ -0,0 +1,735 @@ +#Topic Color +#Alias Color_Reference + +#Subtopic Overview + #Subtopic Subtopic + #Populate + ## +## + +#Subtopic Define +#Populate +## + +#Subtopic Function +#Populate +## + +#Subtopic Typedef +#Populate +## + + #Subtopic Alpha + #Alias Alpha + #Subtopic ## + + #Subtopic RGB + #Substitute RGB + #Subtopic Red + #Alias Red + #Subtopic ## + #Subtopic Blue + #Alias Blue + #Subtopic ## + #Subtopic Green + #Alias Green + #Subtopic ## + #Subtopic ## + + #Subtopic ARGB + #Substitute ARGB + #Subtopic ## + + #Subtopic RBG + #Substitute RBG + #Subtopic ## + + #Subtopic RGB-565 + #Substitute RGB-565 + #Alias Color_RGB-565 # quit changing - to _ ! + #Subtopic ## + + #Subtopic Gray + ## + +# ------------------------------------------------------------------------------ + +#Typedef uint8_t SkAlpha + +Types and macros for colors +8-bit type for an alpha value. 0xFF is 100% opaque, 0x00 is 100% transparent. + +#Typedef ## + +# ------------------------------------------------------------------------------ + +#Typedef uint32_t SkColor + +32 bit ARGB color value, not premultiplied. The color components are always in +a known order. This is different from SkPMColor, which has its bytes in a configuration +dependent order, to match the format of kBGRA_8888_SkColorType bitmaps. SkColor +is the type used to specify colors in SkPaint and in gradients. + +#Typedef ## + +# ------------------------------------------------------------------------------ + +#Method static constexpr inline SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) +#In Function +#Line # incomplete ## + +Return a SkColor value from 8 bit component values + +#Param a incomplete ## +#Param r incomplete ## +#Param g incomplete ## +#Param b incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Define SkColorSetARGBInline + +#Code +###$ + #define SkColorSetARGBInline SkColorSetARGB +$$$# +## + +Legacy aliases. + +#NoExample +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SkColorSetARGBMacro + +#Code +###$ + #define SkColorSetARGBMacro SkColorSetARGB +$$$# +## + +#NoExample +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SkColorSetRGB +#Line # incomplete ## + +#Code +###$ + #define SkColorSetRGB(r, g, b) SkColorSetARGB(0xFF, r, g, b) +$$$# +## + +Return a SkColor value from 8 bit component values, with an implied value +of 0xFF for alpha (fully opaque) + +#Param r incomplete ## +#Param g incomplete ## +#Param b incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SkColorGetA +#Line # incomplete ## + +#Code +###$ + #define SkColorGetA(color) (((color) >> 24) & 0xFF) +$$$# +## + +return the alpha byte from a SkColor value + +#Param color incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SkColorGetR +#Line # incomplete ## + +#Code +###$ + #define SkColorGetR(color) (((color) >> 16) & 0xFF) +$$$# +## + +return the red byte from a SkColor value + +#Param color incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SkColorGetG +#Line # incomplete ## + +#Code +###$ + #define SkColorGetG(color) (((color) >> 8) & 0xFF) +$$$# +## + +return the green byte from a SkColor value + +#Param color incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SkColorGetB +#Line # incomplete ## + +#Code +###$ + #define SkColorGetB(color) (((color) >> 0) & 0xFF) +$$$# +## + +return the blue byte from a SkColor value + +#Param color incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Method static constexpr inline SkColor SkColorSetA(SkColor c, U8CPU a) +#In Function +#Line # incomplete ## + +#Param c incomplete ## +#Param a incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Define SK_AlphaTRANSPARENT + +#Code +###$ + #define SK_AlphaTRANSPARENT static_cast<SkAlpha>(0x00) +$$$# +## + +common colors +transparent SkAlpha value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_AlphaOPAQUE + +#Code +###$ + #define SK_AlphaOPAQUE static_cast<SkAlpha>(0xFF) +$$$# +## + +opaque SkAlpha value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorTRANSPARENT + +#Code +###$ + #define SK_ColorTRANSPARENT static_cast<SkColor>(0x00000000) +$$$# +## + +transparent SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorBLACK + +#Code +###$ + #define SK_ColorBLACK static_cast<SkColor>(0xFF000000) +$$$# +## + +black SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorDKGRAY + +#Code +###$ + #define SK_ColorDKGRAY static_cast<SkColor>(0xFF444444) +$$$# +## + +dark gray SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorGRAY + +#Code +###$ + #define SK_ColorGRAY static_cast<SkColor>(0xFF888888) +$$$# +## + +gray SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorLTGRAY + +#Code +###$ + #define SK_ColorLTGRAY static_cast<SkColor>(0xFFCCCCCC) +$$$# +## + +light gray SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorWHITE + +#Code +###$ + #define SK_ColorWHITE static_cast<SkColor>(0xFFFFFFFF) +$$$# +## + +white SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorRED + +#Code +###$ + #define SK_ColorRED static_cast<SkColor>(0xFFFF0000) +$$$# +## + +red SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorGREEN + +#Code +###$ + #define SK_ColorGREEN static_cast<SkColor>(0xFF00FF00) +$$$# +## + +green SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorBLUE + +#Code +###$ + #define SK_ColorBLUE static_cast<SkColor>(0xFF0000FF) +$$$# +## + +blue SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorYELLOW + +#Code +###$ + #define SK_ColorYELLOW static_cast<SkColor>(0xFFFFFF00) +$$$# +## + +yellow SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorCYAN + +#Code +###$ + #define SK_ColorCYAN static_cast<SkColor>(0xFF00FFFF) +$$$# +## + +cyan SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Define SK_ColorMAGENTA + +#Code +###$ + #define SK_ColorMAGENTA static_cast<SkColor>(0xFFFF00FF) +$$$# +## + +magenta SkColor value + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Define ## + +# ------------------------------------------------------------------------------ + +#Subtopic HSV + +#Subtopic Hue +Hue represents an angle, in degrees, on a color wheel. Hue has a positive value +modulo 360, where zero degrees is red. +## + +#Subtopic Saturation +## + +#Subtopic Value +## + +#Method SK_API void SkRGBToHSV(U8CPU red, U8CPU green, U8CPU blue, SkScalar hsv[3]) +#In Function +#Line # incomplete ## + +Convert RGB components to HSV. +hsv[0] is Hue [0 .. 360) +hsv[1] is Saturation [0...1] +hsv[2] is Value [0...1] + +#Param red red component value [0..255] +## +#Param green green component value [0..255] +## +#Param blue blue component value [0..255] +## +#Param hsv 3 element array which holds the resulting HSV components. +## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method static inline void SkColorToHSV(SkColor color, SkScalar hsv[3]) +#In Function +#Line # incomplete ## + +Convert the argb color to its HSV components. +hsv[0] represents Hue, and is assigned a value from zero to less than 360. +hsv[1] is Saturation [0...1] +hsv[2] is Value [0...1] + +#Param color the argb color to convert. Note: the alpha component is ignored. +## +#Param hsv 3 element array which holds the resulting HSV components. +## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3]) +#In Function +#Line # incomplete ## + +Convert HSV components to an ARGB color. The alpha component is passed through unchanged. +hsv[0] represents Hue, an angle from zero to less than 360. +hsv[1] represents Saturation, and varies from zero to one. +hsv[2] represents Value, and varies from zero to one. + +If hsv values are out of range, they are pinned. + +#Param alpha the alpha component of the returned argb color. +## +#Param hsv 3 element array which holds the input HSV components. +## + +#Return the resulting argb color +## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method static inline SkColor SkHSVToColor(const SkScalar hsv[3]) +#In Function +#Line # incomplete ## + +Convert HSV components to an ARGB color. The alpha component set to 0xFF. +hsv[0] represents Hue, an angle from zero to less than 360. +hsv[1] represents Saturation, and varies from zero to one. +hsv[2] represents Value, and varies from zero to one. + +If hsv values are out of range, they are pinned. + +#Param hsv 3 element array which holds the input HSV components. +## + +#Return the resulting argb color +## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +#Subtopic HSV ## + +# ------------------------------------------------------------------------------ + +#Typedef uint32_t SkPMColor + +32 bit ARGB color value, premultiplied. The byte order for this value is +configuration dependent, matching the format of kBGRA_8888_SkColorType bitmaps. +This is different from SkColor, which is nonpremultiplied, and is always in the +same byte order. + +#Typedef ## + +# ------------------------------------------------------------------------------ + +#Method SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) +#In Function +#Line # incomplete ## + +Return a SkPMColor value from unpremultiplied 8 bit component values + +#Param a incomplete ## +#Param r incomplete ## +#Param g incomplete ## +#Param b incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +# ------------------------------------------------------------------------------ + +#Method SK_API SkPMColor SkPreMultiplyColor(SkColor c) +#In Function +#Line # incomplete ## + +Return a SkPMColor value from a SkColor value. This is done by multiplying the color +components by the color's alpha, and by arranging the bytes in a configuration +dependent order, to match the format of kBGRA_8888_SkColorType bitmaps. + +#Param c incomplete ## + +#Return incomplete ## + +#Example +// incomplete +## + +#SeeAlso incomplete + +#Method ## + +#Topic Color ## diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh index 2070441a5b..162e4791a2 100644 --- a/docs/SkPaint_Reference.bmh +++ b/docs/SkPaint_Reference.bmh @@ -791,7 +791,9 @@ at compile time. Some platform implementations may ignore dithering. Set -#Define SK_IGNORE_GPU_DITHER +#Formula +SK_IGNORE_GPU_DITHER +## to ignore Dither on GPU_Surface. diff --git a/docs/status.json b/docs/status.json index fab616efbb..a24da579a5 100644 --- a/docs/status.json +++ b/docs/status.json @@ -37,9 +37,12 @@ "InProgress": { "include": { "core": [ + "SkColor.h" ] }, "docs": [ + "SkColor_Reference.bmh", + "SkColor4f_Reference.bmh", "overview.bmh", "usingBookmaker.bmh" ] diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh index 6d767fc37d..84f4f90d3b 100644 --- a/docs/undocumented.bmh +++ b/docs/undocumented.bmh @@ -32,6 +32,7 @@ SK_HAS_JPEG_LIBRARY # ditto SK_HAS_PNG_LIBRARY # ditto SK_HAS_WEBP_LIBRARY # ditto + SK_IGNORE_GPU_DITHER # ditto SK_PMCOLOR_BYTE_ORDER # ditto # FreeType related @@ -93,71 +94,6 @@ FT_Load_Glyph ## ## -#Topic Color - #Typedef uint32_t SkColor - #Typedef ## - - #Typedef uint32_t SkPMColor - #Typedef ## - - # fixme: defines, not methods, need new markup type - #Method int SkColorGetA(color) - ## - #Method int SkColorGetR(color) - ## - #Method int SkColorGetG(color) - ## - #Method int SkColorGetB(color) - ## - #Method int SkColorSetARGB(a, r, g, b) - ## - #Method SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) - ## - - #Const SK_ColorBLACK 0xFF000000 - ## - #Const SK_ColorBLUE 0xFF0000FF - ## - #Const SK_ColorGREEN 0xFF00FF00 - ## - #Const SK_ColorRED 0xFFFF0000 - ## - #Const SK_ColorWHITE 0xFFFFFFFF - ## - #Const SK_ColorTRANSPARENT 0x00000000 - ## - #Subtopic Alpha - #Alias Alpha - #Subtopic ## - #Subtopic RGB - #Substitute RGB - #Subtopic Red - #Alias Red - #Subtopic ## - #Subtopic Blue - #Alias Blue - #Subtopic ## - #Subtopic Green - #Alias Green - #Subtopic ## - #Subtopic ## - #Subtopic ARGB - #Substitute ARGB - #Subtopic ## - - #Subtopic RBG - #Substitute RBG - #Subtopic ## - - #Subtopic RGB-565 - #Substitute RGB-565 - #Alias Color_RGB-565 # quit changing - to _ ! - #Subtopic ## - - #Subtopic Gray - ## -#Topic ## - #Topic Color_Filter #Class SkColorFilter #Method void toString(SkString* str) const diff --git a/site/user/api/SkBitmap_Reference.md b/site/user/api/SkBitmap_Reference.md index 9c9f7ecf8d..601ab104b6 100644 --- a/site/user/api/SkBitmap_Reference.md +++ b/site/user/api/SkBitmap_Reference.md @@ -50,7 +50,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | name | description | | --- | --- | | <a href="#Allocate">Allocate</a> | allocates storage for pixels | -| <a href="#Draw">Draw</a> | set pixels to <a href="undocumented#Color">Color</a> | +| <a href="#Draw">Draw</a> | set pixels to <a href="SkColor_Reference#Color">Color</a> | | <a href="#Pixels">Pixels</a> | read and write pixel values | | <a href="#Property">Property</a> | metrics and attributes | | <a href="#Row_Bytes">Row Bytes</a> | interval from one row to the next | @@ -77,7 +77,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | <a href="#SkBitmap_empty_constructor">SkBitmap()</a> | constructs with default values | | <a href="#SkBitmap_move_SkBitmap">SkBitmap(SkBitmap&& src)</a> | takes ownership of pixels | | <a href="#SkBitmap_copy_const_SkBitmap">SkBitmap(const SkBitmap& src)</a> | shares ownership of pixels | -| <a href="#SkBitmap_extractAlpha">extractAlpha</a> | creates <a href="#Bitmap">Bitmap</a> containing <a href="undocumented#Alpha">Alpha</a> of pixels | +| <a href="#SkBitmap_extractAlpha">extractAlpha</a> | creates <a href="#Bitmap">Bitmap</a> containing <a href="SkColor_Reference#Alpha">Alpha</a> of pixels | | | <a href="#SkBitmap_extractAlpha">extractAlpha(SkBitmap* dst)</a> const | | | <a href="#SkBitmap_extractAlpha_2">extractAlpha(SkBitmap* dst, const SkPaint* paint, SkIPoint* offset)</a> const | | | <a href="#SkBitmap_extractAlpha_3">extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, SkIPoint* offset)</a> const | @@ -97,7 +97,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | name | description | | --- | --- | | <a href="#SkBitmap_ComputeIsOpaque">ComputeIsOpaque</a> | returns true if all pixels are opaque | -| <a href="#SkBitmap_allocN32Pixels">allocN32Pixels</a> | allocates compatible <a href="undocumented#ARGB">Color ARGB</a> pixels, or aborts | +| <a href="#SkBitmap_allocN32Pixels">allocN32Pixels</a> | allocates compatible <a href="SkColor_Reference#ARGB">Color ARGB</a> pixels, or aborts | | <a href="#SkBitmap_allocPixels">allocPixels</a> | allocates pixels from <a href="SkImageInfo_Reference#Image_Info">Image Info</a>, or aborts | | <a href="#SkBitmap_allocPixelsFlags">allocPixelsFlags</a> | allocates pixels from <a href="SkImageInfo_Reference#Image_Info">Image Info</a> with options, or aborts | | <a href="#SkBitmap_alphaType">alphaType</a> | returns <a href="SkImageInfo_Reference#Image_Info">Image Info</a> <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> | @@ -109,17 +109,17 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | <a href="#SkBitmap_dimensions">dimensions</a> | returns <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a> | | <a href="#SkBitmap_drawsNothing">drawsNothing</a> | returns true if no <a href="#SkBitmap_width">width</a>, no <a href="#SkBitmap_height">height</a>, or no <a href="undocumented#Pixel_Ref">Pixel Ref</a> | | <a href="#SkBitmap_empty">empty</a> | returns true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> has zero <a href="#SkBitmap_width">width</a> or <a href="#SkBitmap_height">height</a> | -| <a href="#SkBitmap_erase">erase</a> | writes <a href="undocumented#Color">Color</a> to rectangle of pixels | -| <a href="#SkBitmap_eraseARGB">eraseARGB</a> | writes <a href="undocumented#Color">Color</a> to pixels | -| <a href="#SkBitmap_eraseColor">eraseColor</a> | writes <a href="undocumented#Color">Color</a> to pixels | -| <a href="#SkBitmap_extractAlpha">extractAlpha</a> | creates <a href="#Bitmap">Bitmap</a> containing <a href="undocumented#Alpha">Alpha</a> of pixels | +| <a href="#SkBitmap_erase">erase</a> | writes <a href="SkColor_Reference#Color">Color</a> to rectangle of pixels | +| <a href="#SkBitmap_eraseARGB">eraseARGB</a> | writes <a href="SkColor_Reference#Color">Color</a> to pixels | +| <a href="#SkBitmap_eraseColor">eraseColor</a> | writes <a href="SkColor_Reference#Color">Color</a> to pixels | +| <a href="#SkBitmap_extractAlpha">extractAlpha</a> | creates <a href="#Bitmap">Bitmap</a> containing <a href="SkColor_Reference#Alpha">Alpha</a> of pixels | | <a href="#SkBitmap_extractSubset">extractSubset</a> | creates <a href="#Bitmap">Bitmap</a>, sharing pixels if possible | | <a href="#SkBitmap_getAddr">getAddr</a> | returns readable pixel address as void pointer | | <a href="#SkBitmap_getAddr16">getAddr16</a> | returns readable pixel address as 16-bit pointer | | <a href="#SkBitmap_getAddr32">getAddr32</a> | returns readable pixel address as 32-bit pointer | | <a href="#SkBitmap_getAddr8">getAddr8</a> | returns readable pixel address as 8-bit pointer | | <a href="#SkBitmap_getBounds">getBounds</a> | returns <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a> as Rectangle | -| <a href="#SkBitmap_getColor">getColor</a> | returns one pixel as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> | +| <a href="#SkBitmap_getColor">getColor</a> | returns one pixel as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> | | <a href="#SkBitmap_getGenerationID">getGenerationID</a> | returns unique ID | | <a href="#SkBitmap_getPixels">getPixels</a> | returns address of pixels | | <a href="#SkBitmap_getSubset">getSubset</a> | returns bounds offset by origin | @@ -152,7 +152,7 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared | <a href="#SkBitmap_shiftPerPixel">shiftPerPixel</a> | returns bit shift from pixels to bytes | | <a href="#SkBitmap_swap">swap</a> | exchanges <a href="#Bitmap">Bitmap</a> pair | | <a href="#SkBitmap_toString">toString</a> | converts <a href="#Bitmap">Bitmap</a> to machine readable form | -| <a href="#SkBitmap_tryAllocN32Pixels">tryAllocN32Pixels</a> | allocates compatible <a href="undocumented#ARGB">Color ARGB</a> pixels if possible | +| <a href="#SkBitmap_tryAllocN32Pixels">tryAllocN32Pixels</a> | allocates compatible <a href="SkColor_Reference#ARGB">Color ARGB</a> pixels if possible | | <a href="#SkBitmap_tryAllocPixels">tryAllocPixels</a> | allocates pixels from <a href="SkImageInfo_Reference#Image_Info">Image Info</a> if possible | | <a href="#SkBitmap_tryAllocPixelsFlags">tryAllocPixelsFlags</a> | allocates pixels from <a href="SkImageInfo_Reference#Image_Info">Image Info</a> with options if possible | | <a href="#SkBitmap_validate">validate</a> | asserts if <a href="#Bitmap">Bitmap</a> is invalid (debug only) | @@ -525,7 +525,7 @@ two width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaT | <a href="#SkBitmap_getBounds">getBounds</a> | returns <a href="#SkBitmap_width">width</a> and <a href="#SkBitmap_height">height</a> as Rectangle | | | <a href="#SkBitmap_getBounds">getBounds(SkRect* bounds)</a> const | | | <a href="#SkBitmap_getBounds_2">getBounds(SkIRect* bounds)</a> const | -| <a href="#SkBitmap_getColor">getColor</a> | returns one pixel as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> | +| <a href="#SkBitmap_getColor">getColor</a> | returns one pixel as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> | | <a href="#SkBitmap_getPixels">getPixels</a> | returns address of pixels | | <a href="#SkBitmap_getSubset">getSubset</a> | returns bounds offset by origin | | <a href="#SkBitmap_hasHardwareMipMap">hasHardwareMipMap</a> | returns Mip_Map support present; Android only | @@ -1290,10 +1290,10 @@ bool isOpaque() const </pre> Returns true if <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is set to hint that all pixels are opaque; their -<a href="undocumented#Alpha">Color Alpha</a> value is implicitly or explicitly 1.0. If true, and all pixels are +<a href="SkColor_Reference#Alpha">Color Alpha</a> value is implicitly or explicitly 1.0. If true, and all pixels are not opaque, Skia may draw incorrectly. -Does not check if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> allows <a href="undocumented#Alpha">Alpha</a>, or if any pixel value has +Does not check if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> allows <a href="SkColor_Reference#Alpha">Alpha</a>, or if any pixel value has transparency. ### Return Value @@ -1431,15 +1431,15 @@ static bool ComputeIsOpaque(const SkBitmap& bm) </pre> Returns true if all pixels are opaque. <a href="SkImageInfo_Reference#Color_Type">Color Type</a> determines how pixels -are encoded, and whether pixel describes <a href="undocumented#Alpha">Alpha</a>. Returns true for <a href="SkImageInfo_Reference#Color_Type">Color Types</a> +are encoded, and whether pixel describes <a href="SkColor_Reference#Alpha">Alpha</a>. Returns true for <a href="SkImageInfo_Reference#Color_Type">Color Types</a> without alpha in each pixel; for other <a href="SkImageInfo_Reference#Color_Type">Color Types</a>, returns true if all pixels have alpha values equivalent to 1.0 or greater. For <a href="SkImageInfo_Reference#Color_Type">Color Types</a> <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a> or <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>: always returns true. For <a href="SkImageInfo_Reference#Color_Type">Color Types</a> <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, -<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>: returns true if all pixel <a href="undocumented#Alpha">Alpha</a> values are 255. -For <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>: returns true if all pixel <a href="undocumented#Alpha">Alpha</a> values are 15. -For <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>: returns true if all pixel <a href="undocumented#Alpha">Alpha</a> values are 1.0 or +<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>: returns true if all pixel <a href="SkColor_Reference#Alpha">Alpha</a> values are 255. +For <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>: returns true if all pixel <a href="SkColor_Reference#Alpha">Alpha</a> values are 15. +For <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>: returns true if all pixel <a href="SkColor_Reference#Alpha">Alpha</a> values are 1.0 or greater. Returns false for <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>. @@ -1472,7 +1472,7 @@ computeIsOpaque: true ### See Also -<a href="#SkBitmap_isOpaque">isOpaque</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="undocumented#Alpha">Alpha</a> +<a href="#SkBitmap_isOpaque">isOpaque</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="SkColor_Reference#Alpha">Alpha</a> --- @@ -1691,7 +1691,7 @@ true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> set successful | name | description | | --- | --- | -| <a href="#SkBitmap_allocN32Pixels">allocN32Pixels</a> | allocates compatible <a href="undocumented#ARGB">Color ARGB</a> pixels, or aborts | +| <a href="#SkBitmap_allocN32Pixels">allocN32Pixels</a> | allocates compatible <a href="SkColor_Reference#ARGB">Color ARGB</a> pixels, or aborts | | <a href="#SkBitmap_allocPixels">allocPixels</a> | allocates pixels from <a href="SkImageInfo_Reference#Image_Info">Image Info</a>, or aborts | | | <a href="#SkBitmap_allocPixels">allocPixels(const SkImageInfo& info, size t rowBytes)</a> | | | <a href="#SkBitmap_allocPixels_2">allocPixels(const SkImageInfo& info)</a> | @@ -1702,7 +1702,7 @@ true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> set successful | | <a href="#SkBitmap_installPixels">installPixels(const SkImageInfo& info, void* pixels, size t rowBytes, void (*releaseProc)</a> (void* addr, void* context) , void* context) | | | <a href="#SkBitmap_installPixels_2">installPixels(const SkImageInfo& info, void* pixels, size t rowBytes)</a> | | | <a href="#SkBitmap_installPixels_3">installPixels(const SkPixmap& pixmap)</a> | -| <a href="#SkBitmap_tryAllocN32Pixels">tryAllocN32Pixels</a> | allocates compatible <a href="undocumented#ARGB">Color ARGB</a> pixels if possible | +| <a href="#SkBitmap_tryAllocN32Pixels">tryAllocN32Pixels</a> | allocates compatible <a href="SkColor_Reference#ARGB">Color ARGB</a> pixels if possible | | <a href="#SkBitmap_tryAllocPixels">tryAllocPixels</a> | allocates pixels from <a href="SkImageInfo_Reference#Image_Info">Image Info</a> if possible | | | <a href="#SkBitmap_tryAllocPixels">tryAllocPixels(const SkImageInfo& info, size t rowBytes)</a> | | | <a href="#SkBitmap_tryAllocPixels_2">tryAllocPixels(const SkImageInfo& info)</a> | @@ -1730,7 +1730,7 @@ implementation of malloc(), if <a href="#SkBitmap_tryAllocPixelsFlags_flags">fla <a href="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a>. <a href="#SkBitmap_tryAllocPixelsFlags_flags">flags</a> set to <a href="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a> offers equal or better performance than -subsequently calling <a href="#SkBitmap_eraseColor">eraseColor</a> with <a href="undocumented#SK_ColorTRANSPARENT">SK ColorTRANSPARENT</a>. +subsequently calling <a href="#SkBitmap_eraseColor">eraseColor</a> with <a href="SkColor_Reference#SK_ColorTRANSPARENT">SK ColorTRANSPARENT</a>. ### Parameters @@ -1785,7 +1785,7 @@ implementation of malloc(), if <a href="#SkBitmap_allocPixelsFlags_flags">flags< <a href="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a>. <a href="#SkBitmap_allocPixelsFlags_flags">flags</a> set to <a href="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a> offers equal or better performance than -subsequently calling <a href="#SkBitmap_eraseColor">eraseColor</a> with <a href="undocumented#SK_ColorTRANSPARENT">SK ColorTRANSPARENT</a>. +subsequently calling <a href="#SkBitmap_eraseColor">eraseColor</a> with <a href="SkColor_Reference#SK_ColorTRANSPARENT">SK ColorTRANSPARENT</a>. ### Parameters @@ -1978,7 +1978,7 @@ or height is negative. Returns false if allocation fails. -Use to create <a href="#Bitmap">Bitmap</a> that matches <a href="undocumented#SkPMColor">SkPMColor</a>, the native pixel arrangement on +Use to create <a href="#Bitmap">Bitmap</a> that matches <a href="SkColor_Reference#SkPMColor">SkPMColor</a>, the native pixel arrangement on the platform. <a href="#Bitmap">Bitmap</a> drawn to output device skips converting its pixel format. ### Parameters @@ -2021,7 +2021,7 @@ Aborts if width exceeds 29 bits or is negative, or height is negative, or allocation fails. Abort steps may be provided by the user at compile time by defining SK_ABORT. -Use to create <a href="#Bitmap">Bitmap</a> that matches <a href="undocumented#SkPMColor">SkPMColor</a>, the native pixel arrangement on +Use to create <a href="#Bitmap">Bitmap</a> that matches <a href="SkColor_Reference#SkPMColor">SkPMColor</a>, the native pixel arrangement on the platform. <a href="#Bitmap">Bitmap</a> drawn to output device skips converting its pixel format. ### Parameters @@ -2569,9 +2569,9 @@ Marks that pixels in <a href="undocumented#Pixel_Ref">Pixel Ref</a> have changed | name | description | | --- | --- | -| <a href="#SkBitmap_erase">erase</a> | writes <a href="undocumented#Color">Color</a> to rectangle of pixels | -| <a href="#SkBitmap_eraseARGB">eraseARGB</a> | writes <a href="undocumented#Color">Color</a> to pixels | -| <a href="#SkBitmap_eraseColor">eraseColor</a> | writes <a href="undocumented#Color">Color</a> to pixels | +| <a href="#SkBitmap_erase">erase</a> | writes <a href="SkColor_Reference#Color">Color</a> to rectangle of pixels | +| <a href="#SkBitmap_eraseARGB">eraseARGB</a> | writes <a href="SkColor_Reference#Color">Color</a> to pixels | +| <a href="#SkBitmap_eraseColor">eraseColor</a> | writes <a href="SkColor_Reference#Color">Color</a> to pixels | <a name="SkBitmap_eraseColor"></a> ## eraseColor @@ -2581,14 +2581,14 @@ void eraseColor(SkColor c) const </pre> Replaces pixel values with <a href="#SkBitmap_eraseColor_c">c</a>. All pixels contained by <a href="#SkBitmap_bounds">bounds</a> are affected. -If the <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a> or k565_SkColorType, then <a href="undocumented#Alpha">Color Alpha</a> -is ignored; <a href="undocumented#RGB">Color RGB</a> is treated as opaque. If <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, -then <a href="undocumented#RGB">Color RGB</a> is ignored. +If the <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a> or k565_SkColorType, then <a href="SkColor_Reference#Alpha">Color Alpha</a> +is ignored; <a href="SkColor_Reference#RGB">Color RGB</a> is treated as opaque. If <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, +then <a href="SkColor_Reference#RGB">Color RGB</a> is ignored. ### Parameters <table> <tr> <td><a name="SkBitmap_eraseColor_c"> <code><strong>c </strong></code> </a></td> <td> -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a></td> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a></td> </tr> </table> @@ -2609,7 +2609,7 @@ then <a href="undocumented#RGB">Color RGB</a> is ignored. void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const </pre> -Replaces pixel values with <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> built from <a href="#SkBitmap_eraseARGB_a">a</a>, <a href="#SkBitmap_eraseARGB_r">r</a>, <a href="#SkBitmap_eraseARGB_g">g</a>, and <a href="#SkBitmap_eraseARGB_b">b</a>. +Replaces pixel values with <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> built from <a href="#SkBitmap_eraseARGB_a">a</a>, <a href="#SkBitmap_eraseARGB_r">r</a>, <a href="#SkBitmap_eraseARGB_g">g</a>, and <a href="#SkBitmap_eraseARGB_b">b</a>. All pixels contained by <a href="#SkBitmap_bounds">bounds</a> are affected. If the <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a> or k565_SkColorType, then <a href="#SkBitmap_eraseARGB_a">a</a> is ignored; <a href="#SkBitmap_eraseARGB_r">r</a>, <a href="#SkBitmap_eraseARGB_g">g</a>, and <a href="#SkBitmap_eraseARGB_b">b</a> are treated as opaque. If <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, @@ -2618,13 +2618,13 @@ then <a href="#SkBitmap_eraseARGB_r">r</a>, <a href="#SkBitmap_eraseARGB_g">g</a ### Parameters <table> <tr> <td><a name="SkBitmap_eraseARGB_a"> <code><strong>a </strong></code> </a></td> <td> -amount of <a href="undocumented#Alpha">Color Alpha</a>, from fully transparent (0) to fully opaque (255)</td> +amount of <a href="SkColor_Reference#Alpha">Color Alpha</a>, from fully transparent (0) to fully opaque (255)</td> </tr> <tr> <td><a name="SkBitmap_eraseARGB_r"> <code><strong>r </strong></code> </a></td> <td> -amount of <a href="undocumented#RGB_Red">Color RGB Red</a>, from no red (0) to full red (255)</td> +amount of <a href="SkColor_Reference#RGB_Red">Color RGB Red</a>, from no red (0) to full red (255)</td> </tr> <tr> <td><a name="SkBitmap_eraseARGB_g"> <code><strong>g </strong></code> </a></td> <td> -amount of <a href="undocumented#RGB_Green">Color RGB Green</a>, from no green (0) to full green (255)</td> +amount of <a href="SkColor_Reference#RGB_Green">Color RGB Green</a>, from no green (0) to full green (255)</td> </tr> <tr> <td><a name="SkBitmap_eraseARGB_b"> <code><strong>b </strong></code> </a></td> <td> -amount of <a href="undocumented#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue (255)</td> +amount of <a href="SkColor_Reference#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue (255)</td> </tr> </table> @@ -2657,14 +2657,14 @@ void erase(SkColor c, const SkIRect& area) const Replaces pixel values inside <a href="#SkBitmap_erase_area">area</a> with <a href="#SkBitmap_erase_c">c</a>. If <a href="#SkBitmap_erase_area">area</a> does not intersect <a href="#SkBitmap_bounds">bounds</a>, call has no effect. -If the <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a> or k565_SkColorType, then <a href="undocumented#Alpha">Color Alpha</a> -is ignored; <a href="undocumented#RGB">Color RGB</a> is treated as opaque. If <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, -then <a href="undocumented#RGB">Color RGB</a> is ignored. +If the <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a> or k565_SkColorType, then <a href="SkColor_Reference#Alpha">Color Alpha</a> +is ignored; <a href="SkColor_Reference#RGB">Color RGB</a> is treated as opaque. If <a href="#SkBitmap_colorType">colorType</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, +then <a href="SkColor_Reference#RGB">Color RGB</a> is ignored. ### Parameters <table> <tr> <td><a name="SkBitmap_erase_c"> <code><strong>c </strong></code> </a></td> <td> -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a></td> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a></td> </tr> <tr> <td><a name="SkBitmap_erase_area"> <code><strong>area </strong></code> </a></td> <td> rectangle to fill</td> </tr> @@ -2696,16 +2696,16 @@ void eraseArea(const SkIRect& area, SkColor c) const SkColor getColor(int x, int y) const </pre> -Returns pixel at (<a href="#SkBitmap_getColor_x">x</a>, <a href="#SkBitmap_getColor_y">y</a>) as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>. -Returns black with <a href="undocumented#Alpha">Alpha</a> if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>. +Returns pixel at (<a href="#SkBitmap_getColor_x">x</a>, <a href="#SkBitmap_getColor_y">y</a>) as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a>. +Returns black with <a href="SkColor_Reference#Alpha">Alpha</a> if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>. Input is not validated: out of bounds values of <a href="#SkBitmap_getColor_x">x</a> or <a href="#SkBitmap_getColor_y">y</a> trigger an assert() if built with SK_DEBUG defined; and returns undefined values or may crash if SK_RELEASE is defined. Fails if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a> or pixel address is nullptr. -<a href="undocumented#Color_Space">Color Space</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> is ignored. Some <a href="undocumented#Color">Color</a> precision may be lost in the -conversion to <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>; original pixel data may have additional +<a href="undocumented#Color_Space">Color Space</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> is ignored. Some <a href="SkColor_Reference#Color">Color</a> precision may be lost in the +conversion to <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a>; original pixel data may have additional precision. ### Parameters @@ -2719,7 +2719,7 @@ row index, zero or greater, and less than <a href="#SkBitmap_height">height</a>< ### Return Value -pixel converted to <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> +pixel converted to <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> ### Example @@ -3448,7 +3448,7 @@ sets state</td> bool extractAlpha(SkBitmap* dst) const </pre> -Sets <a href="#SkBitmap_extractAlpha_dst">dst</a> to <a href="undocumented#Alpha">Alpha</a> described by pixels. Returns false if <a href="#SkBitmap_extractAlpha_dst">dst</a> cannot be written to +Sets <a href="#SkBitmap_extractAlpha_dst">dst</a> to <a href="SkColor_Reference#Alpha">Alpha</a> described by pixels. Returns false if <a href="#SkBitmap_extractAlpha_dst">dst</a> cannot be written to or <a href="#SkBitmap_extractAlpha_dst">dst</a> pixels cannot be allocated. Uses <a href="#SkBitmap_HeapAllocator">HeapAllocator</a> to reserve memory for <a href="#SkBitmap_extractAlpha_dst">dst</a> <a href="undocumented#Pixel_Ref">Pixel Ref</a>. @@ -3462,7 +3462,7 @@ holds <a href="undocumented#Pixel_Ref">Pixel Ref</a> to fill with alpha layer</t ### Return Value -true if <a href="undocumented#Alpha">Alpha</a> layer was constructed in <a href="#SkBitmap_extractAlpha_dst">dst</a> <a href="undocumented#Pixel_Ref">Pixel Ref</a> +true if <a href="SkColor_Reference#Alpha">Alpha</a> layer was constructed in <a href="#SkBitmap_extractAlpha_dst">dst</a> <a href="undocumented#Pixel_Ref">Pixel Ref</a> ### Example @@ -3480,7 +3480,7 @@ true if <a href="undocumented#Alpha">Alpha</a> layer was constructed in <a href= bool extractAlpha(SkBitmap* dst, const SkPaint* paint, SkIPoint* offset) const </pre> -Sets <a href="#SkBitmap_extractAlpha_2_dst">dst</a> to <a href="undocumented#Alpha">Alpha</a> described by pixels. Returns false if <a href="#SkBitmap_extractAlpha_2_dst">dst</a> cannot be written to +Sets <a href="#SkBitmap_extractAlpha_2_dst">dst</a> to <a href="SkColor_Reference#Alpha">Alpha</a> described by pixels. Returns false if <a href="#SkBitmap_extractAlpha_2_dst">dst</a> cannot be written to or <a href="#SkBitmap_extractAlpha_2_dst">dst</a> pixels cannot be allocated. If <a href="#SkBitmap_extractAlpha_2_paint">paint</a> is not nullptr and contains <a href="undocumented#Mask_Filter">Mask Filter</a>, <a href="undocumented#SkMaskFilter">SkMaskFilter</a> @@ -3501,7 +3501,7 @@ top-left position for <a href="#SkBitmap_extractAlpha_2_dst">dst</a>; may be nul ### Return Value -true if <a href="undocumented#Alpha">Alpha</a> layer was constructed in <a href="#SkBitmap_extractAlpha_2_dst">dst</a> <a href="undocumented#Pixel_Ref">Pixel Ref</a> +true if <a href="SkColor_Reference#Alpha">Alpha</a> layer was constructed in <a href="#SkBitmap_extractAlpha_2_dst">dst</a> <a href="undocumented#Pixel_Ref">Pixel Ref</a> ### Example @@ -3519,7 +3519,7 @@ true if <a href="undocumented#Alpha">Alpha</a> layer was constructed in <a href= bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, SkIPoint* offset) const </pre> -Sets <a href="#SkBitmap_extractAlpha_3_dst">dst</a> to <a href="undocumented#Alpha">Alpha</a> described by pixels. Returns false if <a href="#SkBitmap_extractAlpha_3_dst">dst</a> cannot be written to +Sets <a href="#SkBitmap_extractAlpha_3_dst">dst</a> to <a href="SkColor_Reference#Alpha">Alpha</a> described by pixels. Returns false if <a href="#SkBitmap_extractAlpha_3_dst">dst</a> cannot be written to or <a href="#SkBitmap_extractAlpha_3_dst">dst</a> pixels cannot be allocated. If <a href="#SkBitmap_extractAlpha_3_paint">paint</a> is not nullptr and contains <a href="undocumented#Mask_Filter">Mask Filter</a>, <a href="undocumented#SkMaskFilter">SkMaskFilter</a> @@ -3543,7 +3543,7 @@ top-left position for <a href="#SkBitmap_extractAlpha_3_dst">dst</a>; may be nul ### Return Value -true if <a href="undocumented#Alpha">Alpha</a> layer was constructed in <a href="#SkBitmap_extractAlpha_3_dst">dst</a> <a href="undocumented#Pixel_Ref">Pixel Ref</a> +true if <a href="SkColor_Reference#Alpha">Alpha</a> layer was constructed in <a href="#SkBitmap_extractAlpha_3_dst">dst</a> <a href="undocumented#Pixel_Ref">Pixel Ref</a> ### Example diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md index fe07eca728..a393168962 100644 --- a/site/user/api/SkCanvas_Reference.md +++ b/site/user/api/SkCanvas_Reference.md @@ -14,6 +14,7 @@ SkCanvas Reference | <a href="#Constructor">Constructor</a> | functions that construct <a href="#SkCanvas">SkCanvas</a> | | <a href="#Member_Function">Member Function</a> | static functions and member methods | | <a href="#Related_Function">Related Function</a> | similar methods grouped together | +| Typedef | types defined by other types | # <a name="SkCanvas"></a> Class SkCanvas <a href="#Canvas">Canvas</a> provides an interface for drawing, and how the drawing is clipped and transformed. @@ -23,7 +24,7 @@ SkCanvas Reference Each <a href="#Canvas">Canvas</a> draw call transforms the geometry of the object by the concatenation of all <a href="#Matrix">Matrix</a> values in the stack. The transformed geometry is clipped by the intersection of all of <a href="#Clip">Clip</a> values in the stack. The <a href="#Canvas">Canvas</a> draw calls use <a href="SkPaint_Reference#Paint">Paint</a> to supply drawing -state such as <a href="undocumented#Color">Color</a>, <a href="undocumented#Typeface">Typeface</a>, text size, stroke width, <a href="undocumented#Shader">Shader</a> and so on. +state such as <a href="SkColor_Reference#Color">Color</a>, <a href="undocumented#Typeface">Typeface</a>, text size, stroke width, <a href="undocumented#Shader">Shader</a> and so on. To draw to a pixel-based destination, create <a href="undocumented#Raster_Surface">Raster Surface</a> or <a href="undocumented#GPU_Surface">GPU Surface</a>. Request <a href="#Canvas">Canvas</a> from <a href="SkSurface_Reference#Surface">Surface</a> to obtain the interface to draw. @@ -94,7 +95,7 @@ when no <a href="SkSurface_Reference#Surface">Surface</a> is required, and some | <a href="#SkCanvas_accessTopLayerPixels">accessTopLayerPixels</a> | returns writable pixel access if available | | <a href="#SkCanvas_accessTopRasterHandle">accessTopRasterHandle</a> | returns context that tracks <a href="#Clip">Clip</a> and <a href="#Matrix">Matrix</a> | | <a href="#SkCanvas_androidFramework_setDeviceClipRestriction">androidFramework setDeviceClipRestriction</a> | for use by Android framework | -| <a href="#SkCanvas_clear">clear</a> | fills <a href="#Clip">Clip</a> with <a href="undocumented#Color">Color</a> | +| <a href="#SkCanvas_clear">clear</a> | fills <a href="#Clip">Clip</a> with <a href="SkColor_Reference#Color">Color</a> | | <a href="#SkCanvas_clipPath">clipPath</a> | combines <a href="#Clip">Clip</a> with <a href="SkPath_Reference#Path">Path</a> | | <a href="#SkCanvas_clipRRect">clipRRect</a> | combines <a href="#Clip">Clip</a> with <a href="undocumented#Round_Rect">Round Rect</a> | | <a href="#SkCanvas_clipRect">clipRect</a> | combines <a href="#Clip">Clip</a> with <a href="SkRect_Reference#Rect">Rect</a> | @@ -109,7 +110,7 @@ when no <a href="SkSurface_Reference#Surface">Surface</a> is required, and some | <a href="#SkCanvas_drawBitmapNine">drawBitmapNine</a> | draws <a href="undocumented#Nine_Patch">Nine Patch</a> <a href="SkBitmap_Reference#Bitmap">Bitmap</a> | | <a href="#SkCanvas_drawBitmapRect">drawBitmapRect</a> | draws <a href="SkBitmap_Reference#Bitmap">Bitmap</a>, source <a href="SkRect_Reference#Rect">Rect</a> to destination <a href="SkRect_Reference#Rect">Rect</a> | | <a href="#SkCanvas_drawCircle">drawCircle</a> | draws <a href="undocumented#Circle">Circle</a> using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and <a href="SkPaint_Reference#Paint">Paint</a> | -| <a href="#SkCanvas_drawColor">drawColor</a> | fills <a href="#Clip">Clip</a> with <a href="undocumented#Color">Color</a> and <a href="undocumented#Blend_Mode">Blend Mode</a> | +| <a href="#SkCanvas_drawColor">drawColor</a> | fills <a href="#Clip">Clip</a> with <a href="SkColor_Reference#Color">Color</a> and <a href="undocumented#Blend_Mode">Blend Mode</a> | | <a href="#SkCanvas_drawDRRect">drawDRRect</a> | draws double <a href="undocumented#Round_Rect">Round Rect</a> stroked or filled | | <a href="#SkCanvas_drawDrawable">drawDrawable</a> | draws <a href="undocumented#Drawable">Drawable</a>, encapsulated drawing commands | | <a href="#SkCanvas_drawIRect">drawIRect</a> | draws <a href="SkIRect_Reference#IRect">IRect</a> using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and <a href="SkPaint_Reference#Paint">Paint</a> | @@ -1034,8 +1035,8 @@ The copied quarter circles overdraw the original circle. ### Example <div><fiddle-embed name="481e990e923a0ed34654f4361b94f096"><div><a href="#Canvas">Canvas</a> returned by <a href="undocumented#Raster_Surface">Raster Surface</a> has <a href="undocumented#Premultiply">Premultiplied</a> pixel values. -<a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="undocumented#Alpha">Color Alpha</a> equal 0x80 -and <a href="undocumented#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="undocumented#RGB">Color RGB</a> is multiplied by <a href="undocumented#Alpha">Color Alpha</a> +<a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="SkColor_Reference#Alpha">Color Alpha</a> equal 0x80 +and <a href="SkColor_Reference#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="SkColor_Reference#RGB">Color RGB</a> is multiplied by <a href="SkColor_Reference#Alpha">Color Alpha</a> to generate <a href="undocumented#Premultiply">Premultiplied</a> value 0x802B5580. <a href="#SkCanvas_readPixels">readPixels</a> converts pixel back to <a href="undocumented#Unpremultiply">Unpremultiplied</a> value 0x8056A9FF, introducing error. </div> @@ -1109,8 +1110,8 @@ true if pixels were copied ### Example -<div><fiddle-embed name="85f199032943b6483722c34a91c4e20f"><div><a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="undocumented#Alpha">Color Alpha</a> equal 0x80 -and <a href="undocumented#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="undocumented#RGB">Color RGB</a> is multiplied by <a href="undocumented#Alpha">Color Alpha</a> +<div><fiddle-embed name="85f199032943b6483722c34a91c4e20f"><div><a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="SkColor_Reference#Alpha">Color Alpha</a> equal 0x80 +and <a href="SkColor_Reference#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="SkColor_Reference#RGB">Color RGB</a> is multiplied by <a href="SkColor_Reference#Alpha">Color Alpha</a> to generate <a href="undocumented#Premultiply">Premultiplied</a> value 0x802B5580. </div> @@ -1182,8 +1183,8 @@ true if pixels were copied ### Example -<div><fiddle-embed name="af6dec8ef974aa67bf102f29915bcd6a"><div><a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="undocumented#Alpha">Color Alpha</a> equal 0x80 -and <a href="undocumented#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="undocumented#RGB">Color RGB</a> is multiplied by <a href="undocumented#Alpha">Color Alpha</a> +<div><fiddle-embed name="af6dec8ef974aa67bf102f29915bcd6a"><div><a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="SkColor_Reference#Alpha">Color Alpha</a> equal 0x80 +and <a href="SkColor_Reference#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="SkColor_Reference#RGB">Color RGB</a> is multiplied by <a href="SkColor_Reference#Alpha">Color Alpha</a> to generate <a href="undocumented#Premultiply">Premultiplied</a> value 0x802B5580. </div> @@ -1508,7 +1509,7 @@ is restored, the <a href="SkBitmap_Reference#Bitmap">Bitmap</a> is drawn into th <a href="#Layer">Layer</a> may be initialized with the contents of the previous <a href="#Layer">Layer</a>. When <a href="#Layer">Layer</a> is restored, its <a href="SkBitmap_Reference#Bitmap">Bitmap</a> can be modified by <a href="SkPaint_Reference#Paint">Paint</a> passed to <a href="#Layer">Layer</a> to apply -<a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a>. +<a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a>. <a name="SkCanvas_saveLayer"></a> ## saveLayer @@ -1529,7 +1530,7 @@ and draws the <a href="SkBitmap_Reference#Bitmap">Bitmap</a>. <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_saveLayer_bounds">bounds</a> suggests but does not define the <a href="SkBitmap_Reference#Bitmap">Bitmap</a> size. To clip drawing to a specific rectangle, use <a href="#SkCanvas_clipRect">clipRect</a>. -Optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_saveLayer_paint">paint</a> applies <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and +Optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_saveLayer_paint">paint</a> applies <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> when <a href="#SkCanvas_restore">restore</a> is called. Call <a href="#SkCanvas_restoreToCount">restoreToCount</a> with returned value to restore this and subsequent saves. @@ -1577,7 +1578,7 @@ and draws the <a href="SkBitmap_Reference#Bitmap">Bitmap</a>. <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_saveLayer_2_bounds">bounds</a> suggests but does not define the <a href="#Layer">Layer</a> size. To clip drawing to a specific rectangle, use <a href="#SkCanvas_clipRect">clipRect</a>. -Optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_saveLayer_2_paint">paint</a> applies <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and +Optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_saveLayer_2_paint">paint</a> applies <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> when <a href="#SkCanvas_restore">restore</a> is called. Call <a href="#SkCanvas_restoreToCount">restoreToCount</a> with returned value to restore this and subsequent saves. @@ -1628,7 +1629,7 @@ and draws <a href="#Layer">Layer</a>. <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_saveLayerPreserveLCDTextRequests_bounds">bounds</a> suggests but does not define the <a href="#Layer">Layer</a> size. To clip drawing to a specific rectangle, use <a href="#SkCanvas_clipRect">clipRect</a>. -Optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_saveLayerPreserveLCDTextRequests_paint">paint</a> applies <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and +Optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_saveLayerPreserveLCDTextRequests_paint">paint</a> applies <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> when <a href="#SkCanvas_restore">restore</a> is called. Call <a href="#SkCanvas_restoreToCount">restoreToCount</a> with returned value to restore this and subsequent saves. @@ -1773,7 +1774,7 @@ a specific rectangle, use <a href="#SkCanvas_clipRect">clipRect</a>. <a name="SkCanvas_SaveLayerRec_fPaint"> <code><strong>const SkPaint* fPaint</strong></code> </a> <a href="#SkCanvas_SaveLayerRec_fPaint">fPaint</a> modifies how <a href="#Layer">Layer</a> overlays the prior <a href="#Layer">Layer</a>; may be nullptr. -<a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Draw_Looper">Draw Looper</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and +<a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Draw_Looper">Draw Looper</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Mask_Filter">Mask Filter</a> affect <a href="#Layer">Layer</a> draw. <a name="SkCanvas_SaveLayerRec_fBackdrop"> <code><strong>const SkImageFilter* fBackdrop</strong></code> </a> @@ -1784,7 +1785,7 @@ prior <a href="#Layer">Layer</a> without an <a href="undocumented#Image_Filter"> <a name="SkCanvas_SaveLayerRec_fClipMask"> <code><strong>const SkImage* fClipMask</strong></code> </a> -<a href="#SkCanvas_restore">restore</a> clips <a href="#Layer">Layer</a> by the <a href="undocumented#Alpha">Color Alpha</a> channel of <a href="#SkCanvas_SaveLayerRec_fClipMask">fClipMask</a> when +<a href="#SkCanvas_restore">restore</a> clips <a href="#Layer">Layer</a> by the <a href="SkColor_Reference#Alpha">Color Alpha</a> channel of <a href="#SkCanvas_SaveLayerRec_fClipMask">fClipMask</a> when <a href="#Layer">Layer</a> is copied to <a href="undocumented#Device">Device</a>. <a href="#SkCanvas_SaveLayerRec_fClipMask">fClipMask</a> may be nullptr. . <a name="SkCanvas_SaveLayerRec_fClipMatrix"> <code><strong>const SkMatrix* fClipMatrix</strong></code> </a> @@ -1932,7 +1933,7 @@ SaveLayerRec(const SkRect* bounds, const SkPaint* paint, const SkImageFilter* ba Not ready for general use. Sets <a href="#SkCanvas_SaveLayerRec_fBounds">fBounds</a>, <a href="#SkCanvas_SaveLayerRec_fPaint">fPaint</a>, <a href="#SkCanvas_SaveLayerRec_fBackdrop">fBackdrop</a>, <a href="#SkCanvas_SaveLayerRec_fClipMask">fClipMask</a>, <a href="#SkCanvas_SaveLayerRec_fClipMatrix">fClipMatrix</a>, and <a href="#SkCanvas_SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a>. -<a href="#SkCanvas_SaveLayerRec_SaveLayerRec_4_clipMatrix">clipMatrix</a> uses <a href="undocumented#Alpha">Color Alpha</a> channel of image, transformed by <a href="#SkCanvas_SaveLayerRec_SaveLayerRec_4_clipMatrix">clipMatrix</a>, to clip +<a href="#SkCanvas_SaveLayerRec_SaveLayerRec_4_clipMatrix">clipMatrix</a> uses <a href="SkColor_Reference#Alpha">Color Alpha</a> channel of image, transformed by <a href="#SkCanvas_SaveLayerRec_SaveLayerRec_4_clipMatrix">clipMatrix</a>, to clip <a href="#Layer">Layer</a> when drawn to <a href="#Canvas">Canvas</a>. Implementation is not complete; has no effect if <a href="undocumented#Device">Device</a> is GPU-backed. @@ -1977,7 +1978,7 @@ Saves <a href="#Matrix">Matrix</a>, <a href="#Clip">Clip</a>, and <a href="undoc and allocates <a href="SkBitmap_Reference#Bitmap">Bitmap</a> for subsequent drawing. Calling <a href="#SkCanvas_restore">restore</a> discards changes to <a href="#Matrix">Matrix</a>, <a href="#Clip">Clip</a>, and <a href="undocumented#Draw_Filter">Draw Filter</a>, -and blends <a href="SkBitmap_Reference#Bitmap">Bitmap</a> with <a href="undocumented#Alpha">Color Alpha</a> opacity onto the prior <a href="#Layer">Layer</a>. +and blends <a href="SkBitmap_Reference#Bitmap">Bitmap</a> with <a href="SkColor_Reference#Alpha">Color Alpha</a> opacity onto the prior <a href="#Layer">Layer</a>. <a href="#Matrix">Matrix</a> may be changed by <a href="#SkCanvas_translate">translate</a>, <a href="#SkCanvas_scale">scale</a>, <a href="#SkCanvas_rotate">rotate</a>, <a href="#SkCanvas_skew">skew</a>, <a href="#SkCanvas_concat">concat</a>, <a href="#SkCanvas_setMatrix">setMatrix</a>, and <a href="#SkCanvas_resetMatrix">resetMatrix</a>. <a href="#Clip">Clip</a> may be changed by <a href="#SkCanvas_clipRect">clipRect</a>, <a href="#SkCanvas_clipRRect">clipRRect</a>, @@ -2189,9 +2190,9 @@ amount to skew in y</td> <div><fiddle-embed name="2e2acc21d7774df7e0940a30ad2ca99e"><div>Black text mimics an oblique text style by using a negative skew in x that shifts the geometry to the right as the y values decrease. -<a href="undocumented#RGB_Red">Red</a> text uses a positive skew in y to shift the geometry down as the x values +<a href="SkColor_Reference#RGB_Red">Red</a> text uses a positive skew in y to shift the geometry down as the x values increase. -<a href="undocumented#RGB_Blue">Blue</a> text combines x and y skew to rotate and scale. +<a href="SkColor_Reference#RGB_Blue">Blue</a> text combines x and y skew to rotate and scale. </div></fiddle-embed></div> ### See Also @@ -2957,7 +2958,7 @@ device bounds empty = true | name | description | | --- | --- | -| <a href="#SkCanvas_clear">clear</a> | fills <a href="#Clip">Clip</a> with <a href="undocumented#Color">Color</a> | +| <a href="#SkCanvas_clear">clear</a> | fills <a href="#Clip">Clip</a> with <a href="SkColor_Reference#Color">Color</a> | | <a href="#SkCanvas_drawAnnotation">drawAnnotation</a> | associates a <a href="SkRect_Reference#Rect">Rect</a> with a key-value pair | | | <a href="#SkCanvas_drawAnnotation">drawAnnotation(const SkRect& rect, const char key[], SkData* value)</a> | | | <a href="#SkCanvas_drawAnnotation_2">drawAnnotation(const SkRect& rect, const char key[], const sk sp<SkData>& value)</a> | @@ -2970,7 +2971,7 @@ device bounds empty = true | <a href="#SkCanvas_drawCircle">drawCircle</a> | draws <a href="undocumented#Circle">Circle</a> using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and <a href="SkPaint_Reference#Paint">Paint</a> | | | <a href="#SkCanvas_drawCircle">drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint& paint)</a> | | | <a href="#SkCanvas_drawCircle_2">drawCircle(SkPoint center, SkScalar radius, const SkPaint& paint)</a> | -| <a href="#SkCanvas_drawColor">drawColor</a> | fills <a href="#Clip">Clip</a> with <a href="undocumented#Color">Color</a> and <a href="undocumented#Blend_Mode">Blend Mode</a> | +| <a href="#SkCanvas_drawColor">drawColor</a> | fills <a href="#Clip">Clip</a> with <a href="SkColor_Reference#Color">Color</a> and <a href="undocumented#Blend_Mode">Blend Mode</a> | | <a href="#SkCanvas_drawDRRect">drawDRRect</a> | draws double <a href="undocumented#Round_Rect">Round Rect</a> stroked or filled | | <a href="#SkCanvas_drawDrawable">drawDrawable</a> | draws <a href="undocumented#Drawable">Drawable</a>, encapsulated drawing commands | | | <a href="#SkCanvas_drawDrawable">drawDrawable(SkDrawable* drawable, const SkMatrix* matrix = nullptr)</a> | @@ -3009,13 +3010,13 @@ device bounds empty = true void drawColor(SkColor color, SkBlendMode mode = SkBlendMode::kSrcOver) </pre> -Fill <a href="#Clip">Clip</a> with <a href="undocumented#Color">Color</a> <a href="#SkCanvas_drawColor_color">color</a>. -<a href="#SkCanvas_drawColor_mode">mode</a> determines how <a href="undocumented#ARGB">Color ARGB</a> is combined with destination. +Fill <a href="#Clip">Clip</a> with <a href="SkColor_Reference#Color">Color</a> <a href="#SkCanvas_drawColor_color">color</a>. +<a href="#SkCanvas_drawColor_mode">mode</a> determines how <a href="SkColor_Reference#ARGB">Color ARGB</a> is combined with destination. ### Parameters <table> <tr> <td><a name="SkCanvas_drawColor_color"> <code><strong>color </strong></code> </a></td> <td> -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#ARGB">Color ARGB</a></td> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#ARGB">Color ARGB</a></td> </tr> <tr> <td><a name="SkCanvas_drawColor_mode"> <code><strong>mode </strong></code> </a></td> <td> <a href="undocumented#SkBlendMode">SkBlendMode</a> used to combine source <a href="#SkCanvas_drawColor_color">color</a> and destination</td> </tr> @@ -3038,13 +3039,13 @@ Fill <a href="#Clip">Clip</a> with <a href="undocumented#Color">Color</a> <a hre void clear(SkColor color) </pre> -Fill <a href="#Clip">Clip</a> with <a href="undocumented#Color">Color</a> <a href="#SkCanvas_clear_color">color</a> using <a href="undocumented#SkBlendMode_kSrc">SkBlendMode::kSrc</a>. +Fill <a href="#Clip">Clip</a> with <a href="SkColor_Reference#Color">Color</a> <a href="#SkCanvas_clear_color">color</a> using <a href="undocumented#SkBlendMode_kSrc">SkBlendMode::kSrc</a>. This has the effect of replacing all pixels contained by <a href="#Clip">Clip</a> with <a href="#SkCanvas_clear_color">color</a>. ### Parameters <table> <tr> <td><a name="SkCanvas_clear_color"> <code><strong>color </strong></code> </a></td> <td> -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#ARGB">Color ARGB</a></td> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#ARGB">Color ARGB</a></td> </tr> </table> @@ -3782,7 +3783,7 @@ void drawImage(const SkImage* image, SkScalar left, SkScalar top, const SkPaint* <a href="#Draw">Draw</a> <a href="SkImage_Reference#Image">Image</a> <a href="#SkCanvas_drawImage_image">image</a>, with its <a href="#SkCanvas_drawImage_top">top</a>-<a href="#SkCanvas_drawImage_left">left</a> corner at (<a href="#SkCanvas_drawImage_left">left</a>, <a href="#SkCanvas_drawImage_top">top</a>), using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImage_paint">paint</a>. -If <a href="#SkCanvas_drawImage_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, +If <a href="#SkCanvas_drawImage_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImage_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImage_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImage_image">image</a> bounds. If generated mask extends beyond <a href="#SkCanvas_drawImage_image">image</a> bounds, replicate <a href="#SkCanvas_drawImage_image">image</a> edge colors, just as <a href="undocumented#Shader">Shader</a> @@ -3823,7 +3824,7 @@ void drawImage(const sk_sp<SkImage>& image, SkScalar left, SkScalar top, <a href="#Draw">Draw</a> <a href="SkImage_Reference#Image">Image</a> <a href="#SkCanvas_drawImage_2_image">image</a>, with its <a href="#SkCanvas_drawImage_2_top">top</a>-<a href="#SkCanvas_drawImage_2_left">left</a> corner at (<a href="#SkCanvas_drawImage_2_left">left</a>, <a href="#SkCanvas_drawImage_2_top">top</a>), using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImage_2_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImage_2_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImage_2_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImage_2_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImage_2_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImage_2_image">image</a> bounds. If generated mask extends beyond <a href="#SkCanvas_drawImage_2_image">image</a> bounds, replicate <a href="#SkCanvas_drawImage_2_image">image</a> edge colors, just as <a href="undocumented#Shader">Shader</a> @@ -3912,7 +3913,7 @@ void drawImageRect(const SkImage* image, const SkRect& src, const SkRect& dst, c <a href="#Draw">Draw</a> <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawImageRect_src">src</a> of <a href="SkImage_Reference#Image">Image</a> <a href="#SkCanvas_drawImageRect_image">image</a>, scaled and translated to fill <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawImageRect_dst">dst</a>. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImageRect_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageRect_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImageRect_image">image</a> bounds. @@ -3967,7 +3968,7 @@ Note that <a href="#SkCanvas_drawImageRect_2_isrc">isrc</a> is on integer pixel boundaries. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_2_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_2_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_2_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImageRect_2_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageRect_2_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImageRect_2_image">image</a> bounds. @@ -4015,7 +4016,7 @@ void drawImageRect(const SkImage* image, const SkRect& dst, const SkPaint* paint <a href="#Draw">Draw</a> <a href="SkImage_Reference#Image">Image</a> <a href="#SkCanvas_drawImageRect_3_image">image</a>, scaled and translated to fill <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawImageRect_3_dst">dst</a>, using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_3_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_3_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_3_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImageRect_3_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageRect_3_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImageRect_3_image">image</a> bounds. @@ -4061,7 +4062,7 @@ void drawImageRect(const sk_sp<SkImage>& image, const SkRect& src, const S <a href="#Draw">Draw</a> <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawImageRect_4_src">src</a> of <a href="SkImage_Reference#Image">Image</a> <a href="#SkCanvas_drawImageRect_4_image">image</a>, scaled and translated to fill <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawImageRect_4_dst">dst</a>. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_4_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_4_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_4_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImageRect_4_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageRect_4_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImageRect_4_image">image</a> bounds. @@ -4112,7 +4113,7 @@ void drawImageRect(const sk_sp<SkImage>& image, const SkIRect& isrc, const <a href="#SkCanvas_drawImageRect_5_isrc">isrc</a> is on integer pixel boundaries; <a href="#SkCanvas_drawImageRect_5_dst">dst</a> may include fractional boundaries. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_5_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_5_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_5_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImageRect_5_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageRect_5_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImageRect_5_image">image</a> bounds. @@ -4160,7 +4161,7 @@ void drawImageRect(const sk_sp<SkImage>& image, const SkRect& dst, const S <a href="#Draw">Draw</a> <a href="SkImage_Reference#Image">Image</a> <a href="#SkCanvas_drawImageRect_6_image">image</a>, scaled and translated to fill <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawImageRect_6_dst">dst</a>, using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_6_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_6_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageRect_6_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImageRect_6_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageRect_6_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImageRect_6_image">image</a> bounds. @@ -4211,7 +4212,7 @@ are larger than <a href="#SkCanvas_drawImageNine_dst">dst</a>; <a href="#SkCanva Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageNine_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageNine_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageNine_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImageNine_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageNine_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImageNine_image">image</a> bounds. @@ -4261,7 +4262,7 @@ are larger than <a href="#SkCanvas_drawImageNine_2_dst">dst</a>; <a href="#SkCan Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageNine_2_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageNine_2_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageNine_2_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawImageNine_2_image">image</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageNine_2_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawImageNine_2_image">image</a> bounds. @@ -4309,7 +4310,7 @@ void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPai <a href="#Draw">Draw</a> <a href="SkBitmap_Reference#Bitmap">Bitmap</a> <a href="#SkCanvas_drawBitmap_bitmap">bitmap</a>, with its <a href="#SkCanvas_drawBitmap_top">top</a>-<a href="#SkCanvas_drawBitmap_left">left</a> corner at (<a href="#SkCanvas_drawBitmap_left">left</a>, <a href="#SkCanvas_drawBitmap_top">top</a>), using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmap_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmap_paint">paint</a> is not nullptr, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmap_paint">paint</a> is not nullptr, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawBitmap_bitmap">bitmap</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawBitmap_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawBitmap_bitmap">bitmap</a> bounds. @@ -4353,7 +4354,7 @@ void drawBitmapRect(const SkBitmap& bitmap, const SkRect& src, const SkRect& dst <a href="#Draw">Draw</a> <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawBitmapRect_src">src</a> of <a href="SkBitmap_Reference#Bitmap">Bitmap</a> <a href="#SkCanvas_drawBitmapRect_bitmap">bitmap</a>, scaled and translated to fill <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawBitmapRect_dst">dst</a>. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawBitmapRect_bitmap">bitmap</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawBitmapRect_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawBitmapRect_bitmap">bitmap</a> bounds. @@ -4403,7 +4404,7 @@ void drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const SkRect& d <a href="#SkCanvas_drawBitmapRect_2_isrc">isrc</a> is on integer pixel boundaries; <a href="#SkCanvas_drawBitmapRect_2_dst">dst</a> may include fractional boundaries. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_2_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_2_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_2_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawBitmapRect_2_bitmap">bitmap</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawBitmapRect_2_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawBitmapRect_2_bitmap">bitmap</a> bounds. @@ -4453,7 +4454,7 @@ void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const SkPaint* pa <a href="#SkCanvas_drawBitmapRect_3_bitmap">bitmap</a> bounds is on integer pixel boundaries; <a href="#SkCanvas_drawBitmapRect_3_dst">dst</a> may include fractional boundaries. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_3_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_3_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapRect_3_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawBitmapRect_3_bitmap">bitmap</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawBitmapRect_3_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawBitmapRect_3_bitmap">bitmap</a> bounds. @@ -4506,7 +4507,7 @@ space, if any. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapNine_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapNine_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapNine_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawBitmapNine_bitmap">bitmap</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawBitmapNine_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawBitmapNine_bitmap">bitmap</a> bounds. @@ -4557,7 +4558,7 @@ and below <a href="#SkCanvas_drawBitmapNine_center">center</a> to fill the remai int <a href="#SkCanvas_Lattice_fXCount">fXCount</a>; int <a href="#SkCanvas_Lattice_fYCount">fYCount</a>; const <a href="SkIRect_Reference#SkIRect">SkIRect</a>* <a href="#SkCanvas_Lattice_fBounds">fBounds</a>; - const <a href="undocumented#SkColor">SkColor</a>* <a href="#SkCanvas_Lattice_fColors">fColors</a>; + const <a href="SkColor_Reference#SkColor">SkColor</a>* <a href="#SkCanvas_Lattice_fColors">fColors</a>; }; </pre> @@ -4669,7 +4670,7 @@ dimension. All other grid elements scale to fill the available space, if any. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapLattice_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapLattice_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawBitmapLattice_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If <a href="#SkCanvas_drawBitmapLattice_bitmap">bitmap</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawBitmapLattice_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from <a href="#SkCanvas_drawBitmapLattice_bitmap">bitmap</a> bounds. @@ -4726,7 +4727,7 @@ dimension. All other grid elements scale to fill the available space, if any. Additionally transform draw using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageLattice_paint">paint</a>. -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageLattice_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawImageLattice_paint">paint</a> is supplied, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. If bitmap is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, apply <a href="undocumented#Shader">Shader</a>. If <a href="#SkCanvas_drawImageLattice_paint">paint</a> contains <a href="undocumented#Mask_Filter">Mask Filter</a>, generate mask from bitmap bounds. @@ -5319,7 +5320,7 @@ void drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint </pre> <a href="#Draw">Draw</a> <a href="undocumented#Picture">Picture</a> <a href="#SkCanvas_drawPicture_3_picture">picture</a>, using <a href="#Clip">Clip</a> and <a href="#Matrix">Matrix</a>; transforming <a href="#SkCanvas_drawPicture_3_picture">picture</a> with -<a href="#Matrix">Matrix</a> <a href="#SkCanvas_drawPicture_3_matrix">matrix</a>, if provided; and use <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawPicture_3_paint">paint</a> <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, +<a href="#Matrix">Matrix</a> <a href="#SkCanvas_drawPicture_3_matrix">matrix</a>, if provided; and use <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawPicture_3_paint">paint</a> <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a>, if provided. <a href="#SkCanvas_drawPicture_3_matrix">matrix</a> transformation is equivalent to: <a href="#SkCanvas_save">save</a>, <a href="#SkCanvas_concat">concat</a>, <a href="#SkCanvas_drawPicture">drawPicture</a>, <a href="#SkCanvas_restore">restore</a>. @@ -5353,7 +5354,7 @@ void drawPicture(const sk_sp<SkPicture>& picture, const SkMatrix* matrix, </pre> <a href="#Draw">Draw</a> <a href="undocumented#Picture">Picture</a> <a href="#SkCanvas_drawPicture_4_picture">picture</a>, using <a href="#Clip">Clip</a> and <a href="#Matrix">Matrix</a>; transforming <a href="#SkCanvas_drawPicture_4_picture">picture</a> with -<a href="#Matrix">Matrix</a> <a href="#SkCanvas_drawPicture_4_matrix">matrix</a>, if provided; and use <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawPicture_4_paint">paint</a> <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, +<a href="#Matrix">Matrix</a> <a href="#SkCanvas_drawPicture_4_matrix">matrix</a>, if provided; and use <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawPicture_4_paint">paint</a> <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a>, if provided. <a href="#SkCanvas_drawPicture_4_matrix">matrix</a> transformation is equivalent to: <a href="#SkCanvas_save">save</a>, <a href="#SkCanvas_concat">concat</a>, <a href="#SkCanvas_drawPicture">drawPicture</a>, <a href="#SkCanvas_restore">restore</a>. @@ -5455,15 +5456,15 @@ Draws a Coons_Patch: the interpolation of four <a href="#SkCanvas_drawPatch_cubi associating a color, and optionally a texture coordinate, with each corner. Coons_Patch uses <a href="#Clip">Clip</a> and <a href="#Matrix">Matrix</a>, <a href="#SkCanvas_drawPatch_paint">paint</a> <a href="undocumented#Shader">Shader</a>, <a href="undocumented#Color_Filter">Color Filter</a>, -<a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a>. If <a href="undocumented#Shader">Shader</a> is provided it is treated -as Coons_Patch texture; <a href="undocumented#Blend_Mode">Blend Mode</a> <a href="#SkCanvas_drawPatch_mode">mode</a> combines <a href="undocumented#Color">Color</a> <a href="#SkCanvas_drawPatch_colors">colors</a> and <a href="undocumented#Shader">Shader</a> if +<a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a>. If <a href="undocumented#Shader">Shader</a> is provided it is treated +as Coons_Patch texture; <a href="undocumented#Blend_Mode">Blend Mode</a> <a href="#SkCanvas_drawPatch_mode">mode</a> combines <a href="SkColor_Reference#Color">Color</a> <a href="#SkCanvas_drawPatch_colors">colors</a> and <a href="undocumented#Shader">Shader</a> if both are provided. <a href="SkPoint_Reference#Point">Point</a> array <a href="#SkCanvas_drawPatch_cubics">cubics</a> specifies four <a href="SkPath_Reference#Cubic">Cubics</a> starting at the top-left corner, in clockwise order, sharing every fourth point. The last <a href="SkPath_Reference#Cubic">Cubic</a> ends at the first point. -<a href="undocumented#Color">Color</a> array color associates <a href="#SkCanvas_drawPatch_colors">colors</a> with corners in top-left, top-right, +<a href="SkColor_Reference#Color">Color</a> array color associates <a href="#SkCanvas_drawPatch_colors">colors</a> with corners in top-left, top-right, bottom-right, bottom-left order. If <a href="#SkCanvas_drawPatch_paint">paint</a> contains <a href="undocumented#Shader">Shader</a>, <a href="SkPoint_Reference#Point">Point</a> array <a href="#SkCanvas_drawPatch_texCoords">texCoords</a> maps <a href="undocumented#Shader">Shader</a> as texture to @@ -5474,7 +5475,7 @@ corners in top-left, top-right, bottom-right, bottom-left order. <table> <tr> <td><a name="SkCanvas_drawPatch_cubics"> <code><strong>cubics </strong></code> </a></td> <td> <a href="SkPath_Reference#Cubic">Path Cubic</a> array, sharing common points</td> </tr> <tr> <td><a name="SkCanvas_drawPatch_colors"> <code><strong>colors </strong></code> </a></td> <td> -<a href="undocumented#Color">Color</a> array, one for each corner</td> +<a href="SkColor_Reference#Color">Color</a> array, one for each corner</td> </tr> <tr> <td><a name="SkCanvas_drawPatch_texCoords"> <code><strong>texCoords </strong></code> </a></td> <td> <a href="SkPoint_Reference#Point">Point</a> array of texture coordinates, mapping <a href="undocumented#Shader">Shader</a> to corners; may be nullptr</td> @@ -5507,15 +5508,15 @@ Draws <a href="SkPath_Reference#Cubic">Cubic</a> Coons_Patch: the interpolation associating a color, and optionally a texture coordinate, with each corner. Coons_Patch uses <a href="#Clip">Clip</a> and <a href="#Matrix">Matrix</a>, <a href="#SkCanvas_drawPatch_2_paint">paint</a> <a href="undocumented#Shader">Shader</a>, <a href="undocumented#Color_Filter">Color Filter</a>, -<a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a>. If <a href="undocumented#Shader">Shader</a> is provided it is treated -as Coons_Patch texture; <a href="undocumented#Blend_Mode">Blend Mode</a> mode combines <a href="undocumented#Color">Color</a> <a href="#SkCanvas_drawPatch_2_colors">colors</a> and <a href="undocumented#Shader">Shader</a> if +<a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a>. If <a href="undocumented#Shader">Shader</a> is provided it is treated +as Coons_Patch texture; <a href="undocumented#Blend_Mode">Blend Mode</a> mode combines <a href="SkColor_Reference#Color">Color</a> <a href="#SkCanvas_drawPatch_2_colors">colors</a> and <a href="undocumented#Shader">Shader</a> if both are provided. <a href="SkPoint_Reference#Point">Point</a> array <a href="#SkCanvas_drawPatch_2_cubics">cubics</a> specifies four <a href="SkPath_Reference#Cubic">Cubics</a> starting at the top-left corner, in clockwise order, sharing every fourth point. The last <a href="SkPath_Reference#Cubic">Cubic</a> ends at the first point. -<a href="undocumented#Color">Color</a> array color associates <a href="#SkCanvas_drawPatch_2_colors">colors</a> with corners in top-left, top-right, +<a href="SkColor_Reference#Color">Color</a> array color associates <a href="#SkCanvas_drawPatch_2_colors">colors</a> with corners in top-left, top-right, bottom-right, bottom-left order. If <a href="#SkCanvas_drawPatch_2_paint">paint</a> contains <a href="undocumented#Shader">Shader</a>, <a href="SkPoint_Reference#Point">Point</a> array <a href="#SkCanvas_drawPatch_2_texCoords">texCoords</a> maps <a href="undocumented#Shader">Shader</a> as texture to @@ -5526,7 +5527,7 @@ corners in top-left, top-right, bottom-right, bottom-left order. <table> <tr> <td><a name="SkCanvas_drawPatch_2_cubics"> <code><strong>cubics </strong></code> </a></td> <td> <a href="SkPath_Reference#Cubic">Path Cubic</a> array, sharing common points</td> </tr> <tr> <td><a name="SkCanvas_drawPatch_2_colors"> <code><strong>colors </strong></code> </a></td> <td> -<a href="undocumented#Color">Color</a> array, one for each corner</td> +<a href="SkColor_Reference#Color">Color</a> array, one for each corner</td> </tr> <tr> <td><a name="SkCanvas_drawPatch_2_texCoords"> <code><strong>texCoords </strong></code> </a></td> <td> <a href="SkPoint_Reference#Point">Point</a> array of texture coordinates, mapping <a href="undocumented#Shader">Shader</a> to corners; may be nullptr</td> @@ -5560,7 +5561,7 @@ void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[] </pre> <a href="#Draw">Draw</a> a set of sprites from <a href="#SkCanvas_drawAtlas_atlas">atlas</a>, using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawAtlas_paint">paint</a>. -<a href="#SkCanvas_drawAtlas_paint">paint</a> uses Anti-alias, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> +<a href="#SkCanvas_drawAtlas_paint">paint</a> uses Anti-alias, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> to draw, if present. For each entry in the array, <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawAtlas_tex">tex</a> locates sprite in <a href="#SkCanvas_drawAtlas_atlas">atlas</a>, and <a href="undocumented#RSXform">RSXform</a> <a href="#SkCanvas_drawAtlas_xform">xform</a> transforms it into destination space. @@ -5609,7 +5610,7 @@ void drawAtlas(const sk_sp<SkImage>& atlas, const SkRSXform xform[], const </pre> <a href="#Draw">Draw</a> a set of sprites from <a href="#SkCanvas_drawAtlas_2_atlas">atlas</a>, using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawAtlas_2_paint">paint</a>. -<a href="#SkCanvas_drawAtlas_2_paint">paint</a> uses Anti-alias, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> +<a href="#SkCanvas_drawAtlas_2_paint">paint</a> uses Anti-alias, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> to draw, if present. For each entry in the array, <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawAtlas_2_tex">tex</a> locates sprite in <a href="#SkCanvas_drawAtlas_2_atlas">atlas</a>, and <a href="undocumented#RSXform">RSXform</a> <a href="#SkCanvas_drawAtlas_2_xform">xform</a> transforms it into destination space. @@ -5657,7 +5658,7 @@ void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[] </pre> <a href="#Draw">Draw</a> a set of sprites from <a href="#SkCanvas_drawAtlas_3_atlas">atlas</a>, using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawAtlas_3_paint">paint</a>. -<a href="#SkCanvas_drawAtlas_3_paint">paint</a> uses Anti-alias, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> +<a href="#SkCanvas_drawAtlas_3_paint">paint</a> uses Anti-alias, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> to draw, if present. For each entry in the array, <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawAtlas_3_tex">tex</a> locates sprite in <a href="#SkCanvas_drawAtlas_3_atlas">atlas</a>, and <a href="undocumented#RSXform">RSXform</a> <a href="#SkCanvas_drawAtlas_3_xform">xform</a> transforms it into destination space. @@ -5700,7 +5701,7 @@ void drawAtlas(const sk_sp<SkImage>& atlas, const SkRSXform xform[], const </pre> <a href="#Draw">Draw</a> a set of sprites from <a href="#SkCanvas_drawAtlas_4_atlas">atlas</a>, using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and optional <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawAtlas_4_paint">paint</a>. -<a href="#SkCanvas_drawAtlas_4_paint">paint</a> uses Anti-alias, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> +<a href="#SkCanvas_drawAtlas_4_paint">paint</a> uses Anti-alias, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Image_Filter">Image Filter</a>, and <a href="undocumented#Blend_Mode">Blend Mode</a> to draw, if present. For each entry in the array, <a href="SkRect_Reference#Rect">Rect</a> <a href="#SkCanvas_drawAtlas_4_tex">tex</a> locates sprite in <a href="#SkCanvas_drawAtlas_4_atlas">atlas</a>, and <a href="undocumented#RSXform">RSXform</a> <a href="#SkCanvas_drawAtlas_4_xform">xform</a> transforms it into destination space. diff --git a/site/user/api/SkColor4f_Reference.md b/site/user/api/SkColor4f_Reference.md new file mode 100644 index 0000000000..9717ec4781 --- /dev/null +++ b/site/user/api/SkColor4f_Reference.md @@ -0,0 +1,268 @@ +SkColor4f Reference +=== + +# <a name="Color4f"></a> Color4f + +# <a name="SkColor4f"></a> Struct SkColor4f +The float values are 0...1 unpremultiplied + +## <a name="Overview"></a> Overview + +## <a name="Overview_Subtopic"></a> Overview Subtopic + +| name | description | +| --- | --- | +| <a href="#Member_Function">Member Function</a> | static functions and member methods | +| Member | member values | +| <a href="#Operator">Operator</a> | operator overloading methods | + +## <a name="Operator"></a> Operator + +| name | description | +| --- | --- | +| <a href="#SkColor4f_notequal1_operator">operator!=(const SkColor4f& other) const</a> | incomplete | +| <a href="#SkColor4f_equal1_operator">operator==(const SkColor4f& other) const</a> | incomplete | + +## <a name="Member_Function"></a> Member Function + +| name | description | +| --- | --- | +| <a href="#SkColor4f_FromColor">FromColor</a> | incomplete | +| <a href="#SkColor4f_Pin">Pin</a> | incomplete | +| <a href="#SkColor4f_pin">pin</a> | incomplete | +| <a href="#SkColor4f_premul">premul</a> | incomplete | +| <a href="#SkColor4f_toSkColor">toSkColor</a> | incomplete | +| <a href="#SkColor4f_vec">vec</a> | incomplete | + +<a name="SkColor4f_fR"> <code><strong>float fR</strong></code> </a> + +<a name="SkColor4f_fG"> <code><strong>float fG</strong></code> </a> + +<a name="SkColor4f_fB"> <code><strong>float fB</strong></code> </a> + +<a name="SkColor4f_fA"> <code><strong>float fA</strong></code> </a> + +<a name="SkColor4f_equal1_operator"></a> +## operator== + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +bool operator==(const SkColor4f& other) _const +</pre> + +### Parameters + +<table> <tr> <td><a name="SkColor4f_equal1_operator_other"> <code><strong>other </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColor4f_notequal1_operator"></a> +## operator!= + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +bool operator!=(const SkColor4f& other) _const +</pre> + +### Parameters + +<table> <tr> <td><a name="SkColor4f_notequal1_operator_other"> <code><strong>other </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColor4f_vec"></a> +## vec + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +const float* vec() const +</pre> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColor4f_vec_2"></a> + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +float* vec() +</pre> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColor4f_Pin"></a> +## Pin + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +static SkColor4f Pin(float r, float g, float b, float a) +</pre> + +### Parameters + +<table> <tr> <td><a name="SkColor4f_Pin_r"> <code><strong>r </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColor4f_Pin_g"> <code><strong>g </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColor4f_Pin_b"> <code><strong>b </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColor4f_Pin_a"> <code><strong>a </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColor4f_FromColor"></a> +## FromColor + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +static SkColor4f FromColor(SkColor) +</pre> + +Convert to <a href="#SkColor4f">SkColor4f</a>, assuming <a href="SkColor_Reference#SkColor">SkColor</a> is sRGB + +### Parameters + +<table> <tr> <td><a name="SkColor4f_FromColor_SkColor"> <code><strong>SkColor </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColor4f_toSkColor"></a> +## toSkColor + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +SkColor toSkColor() const +</pre> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColor4f_pin"></a> +## pin + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +SkColor4f pin() const +</pre> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColor4f_premul"></a> +## premul + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +SkPM4f premul() const +</pre> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + diff --git a/site/user/api/SkColor_Reference.md b/site/user/api/SkColor_Reference.md new file mode 100644 index 0000000000..42de657ae3 --- /dev/null +++ b/site/user/api/SkColor_Reference.md @@ -0,0 +1,681 @@ +SkColor Reference +=== + +# <a name="Color"></a> Color + +## <a name="Overview"></a> Overview + +## <a name="Overview_Subtopic"></a> Overview Subtopic + +| name | description | +| --- | --- | + +## <a name="Define"></a> Define + +| name | description | +| --- | --- | + +## <a name="Function"></a> Function + +| name | description | +| --- | --- | + +## <a name="Typedef"></a> Typedef + +| name | description | +| --- | --- | + +## <a name="Alpha"></a> Alpha + +## <a name="RGB"></a> RGB + +## <a name="RGB_Red"></a> RGB Red + +## <a name="RGB_Blue"></a> RGB Blue + +## <a name="RGB_Green"></a> RGB Green + +## <a name="ARGB"></a> ARGB + +## <a name="RBG"></a> RBG + +## <a name="RGB-565"></a> RGB-565 + +## <a name="Gray"></a> Gray + +<a href="undocumented#Types">Types</a> and macros for colors +8-bit type for an alpha value. 0xFF is 100% opaque, 0x00 is 100% transparent. +32 bit <a href="#ARGB">ARGB</a> color value, not premultiplied. The color components are always in +a known order. This is different from <a href="#SkPMColor">SkPMColor</a>, which has its bytes in a configuration +dependent order, to match the format of <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a> bitmaps. <a href="#SkColor">SkColor</a> +is the type used to specify colors in <a href="SkPaint_Reference#SkPaint">SkPaint</a> and in gradients. + +<a name="SkColorSetARGB"></a> +## SkColorSetARGB + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +static constexpr inline SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) +</pre> + +Return <a href="#SkColorSetARGB_a">a</a> <a href="#SkColor">SkColor</a> value from 8 bit component values + +### Parameters + +<table> <tr> <td><a name="SkColorSetARGB_a"> <code><strong>a </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColorSetARGB_r"> <code><strong>r </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColorSetARGB_g"> <code><strong>g </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColorSetARGB_b"> <code><strong>b </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SkColorSetARGBInline">SkColorSetARGBInline</a> <a href="#SkColorSetARGB">SkColorSetARGB</a> +</pre> + +Legacy aliases. + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SkColorSetARGBMacro">SkColorSetARGBMacro</a> <a href="#SkColorSetARGB">SkColorSetARGB</a> +</pre> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define SkColorSetRGB(r, g, b) <a href="#SkColorSetARGB">SkColorSetARGB(0xFF, r, g, b)</a> +</pre> + +Return a <a href="#SkColor">SkColor</a> value from 8 bit component values, with an implied value +of 0xFF for alpha (fully opaque) + +### Parameters + +<table> <tr> <td><a name="SkColorSetRGB_r"> <code><strong>r </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColorSetRGB_g"> <code><strong>g </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColorSetRGB_b"> <code><strong>b </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define SkColorGetA(color) (((color) >> 24) & 0xFF) +</pre> + +return the alpha byte from a <a href="#SkColor">SkColor</a> value + +### Parameters + +<table> <tr> <td><a name="SkColorGetA_color"> <code><strong>color </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define SkColorGetR(color) (((color) >> 16) & 0xFF) +</pre> + +return the red byte from a <a href="#SkColor">SkColor</a> value + +### Parameters + +<table> <tr> <td><a name="SkColorGetR_color"> <code><strong>color </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define SkColorGetG(color) (((color) >> 8) & 0xFF) +</pre> + +return the green byte from a <a href="#SkColor">SkColor</a> value + +### Parameters + +<table> <tr> <td><a name="SkColorGetG_color"> <code><strong>color </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define SkColorGetB(color) (((color) >> 0) & 0xFF) +</pre> + +return the blue byte from a <a href="#SkColor">SkColor</a> value + +### Parameters + +<table> <tr> <td><a name="SkColorGetB_color"> <code><strong>color </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<a name="SkColorSetA"></a> +## SkColorSetA + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +static constexpr inline SkColor SkColorSetA(SkColor c, U8CPU a) +</pre> + +### Parameters + +<table> <tr> <td><a name="SkColorSetA_c"> <code><strong>c </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkColorSetA_a"> <code><strong>a </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_AlphaTRANSPARENT">SK AlphaTRANSPARENT</a> static_cast<<a href="#SkAlpha">SkAlpha</a>>(0x00) +</pre> + +common colors +transparent <a href="#SkAlpha">SkAlpha</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_AlphaOPAQUE">SK AlphaOPAQUE</a> static_cast<<a href="#SkAlpha">SkAlpha</a>>(0xFF) +</pre> + +opaque <a href="#SkAlpha">SkAlpha</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorTRANSPARENT">SK ColorTRANSPARENT</a> static_cast<<a href="#SkColor">SkColor</a>>(0x00000000) +</pre> + +transparent <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorBLACK">SK ColorBLACK</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFF000000) +</pre> + +black <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorDKGRAY">SK ColorDKGRAY</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFF444444) +</pre> + +dark gray <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorGRAY">SK ColorGRAY</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFF888888) +</pre> + +gray <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorLTGRAY">SK ColorLTGRAY</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFFCCCCCC) +</pre> + +light gray <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorWHITE">SK ColorWHITE</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFFFFFFFF) +</pre> + +white <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorRED">SK ColorRED</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFFFF0000) +</pre> + +red <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorGREEN">SK ColorGREEN</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFF00FF00) +</pre> + +green <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorBLUE">SK ColorBLUE</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFF0000FF) +</pre> + +blue <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorYELLOW">SK ColorYELLOW</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFFFFFF00) +</pre> + +yellow <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorCYAN">SK ColorCYAN</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFF00FFFF) +</pre> + +cyan <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> + #define <a href="#SK_ColorMAGENTA">SK ColorMAGENTA</a> static_cast<<a href="#SkColor">SkColor</a>>(0xFFFF00FF) +</pre> + +magenta <a href="#SkColor">SkColor</a> value + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +## <a name="HSV"></a> HSV + +## <a name="HSV_Hue"></a> HSV Hue + +<a href="#HSV_Hue">Hue</a> represents an angle, in degrees, on a color wheel. <a href="#HSV_Hue">Hue</a> has a positive value +modulo 360, where zero degrees is red. + +## <a name="HSV_Saturation"></a> HSV Saturation + +## <a name="HSV_Value"></a> HSV Value + +<a name="SkRGBToHSV"></a> +## SkRGBToHSV + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +SK_API void SkRGBToHSV(U8CPU red, U8CPU green, U8CPU blue, SkScalar hsv[3]) +</pre> + +Convert RGB components to <a href="#HSV">HSV</a>. +<a href="#SkRGBToHSV_hsv">hsv</a>[0] is <a href="#HSV_Hue">Hue</a> [0 .. 360) +<a href="#SkRGBToHSV_hsv">hsv</a>[1] is <a href="#HSV_Saturation">Saturation</a> [0...1] +<a href="#SkRGBToHSV_hsv">hsv</a>[2] is <a href="#HSV_Value">Value</a> [0...1] + +### Parameters + +<table> <tr> <td><a name="SkRGBToHSV_red"> <code><strong>red </strong></code> </a></td> <td> +<a href="#SkRGBToHSV_red">red</a> component value [0..255] +</td> + </tr> <tr> <td><a name="SkRGBToHSV_green"> <code><strong>green </strong></code> </a></td> <td> +<a href="#SkRGBToHSV_green">green</a> component value [0..255] +</td> + </tr> <tr> <td><a name="SkRGBToHSV_blue"> <code><strong>blue </strong></code> </a></td> <td> +<a href="#SkRGBToHSV_blue">blue</a> component value [0..255] +</td> + </tr> <tr> <td><a name="SkRGBToHSV_hsv"> <code><strong>hsv </strong></code> </a></td> <td> +3 element array which holds the resulting <a href="#HSV">HSV</a> components. +</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkColorToHSV"></a> +## SkColorToHSV + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +static inline void SkColorToHSV(SkColor color, SkScalar hsv[3]) +</pre> + +Convert the argb <a href="#SkColorToHSV_color">color</a> to its <a href="#HSV">HSV</a> components. +<a href="#SkColorToHSV_hsv">hsv</a>[0] represents <a href="#HSV_Hue">Hue</a>, and is assigned a value from zero to less than 360. +<a href="#SkColorToHSV_hsv">hsv</a>[1] is <a href="#HSV_Saturation">Saturation</a> [0...1] +<a href="#SkColorToHSV_hsv">hsv</a>[2] is <a href="#HSV_Value">Value</a> [0...1] + +### Parameters + +<table> <tr> <td><a name="SkColorToHSV_color"> <code><strong>color </strong></code> </a></td> <td> +the argb <a href="#SkColorToHSV_color">color</a> to convert. Note: the alpha component is ignored. +</td> + </tr> <tr> <td><a name="SkColorToHSV_hsv"> <code><strong>hsv </strong></code> </a></td> <td> +3 element array which holds the resulting <a href="#HSV">HSV</a> components. +</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkHSVToColor"></a> +## SkHSVToColor + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3]) +</pre> + +Convert <a href="#HSV">HSV</a> components to an <a href="#ARGB">ARGB</a> color. The <a href="#SkHSVToColor_alpha">alpha</a> component is passed through unchanged. +<a href="#SkHSVToColor_hsv">hsv</a>[0] represents <a href="#HSV_Hue">Hue</a>, an angle from zero to less than 360. +<a href="#SkHSVToColor_hsv">hsv</a>[1] represents <a href="#HSV_Saturation">Saturation</a>, and varies from zero to one. +<a href="#SkHSVToColor_hsv">hsv</a>[2] represents <a href="#HSV_Value">Value</a>, and varies from zero to one. + +If <a href="#SkHSVToColor_hsv">hsv</a> values are out of range, they are pinned. + +### Parameters + +<table> <tr> <td><a name="SkHSVToColor_alpha"> <code><strong>alpha </strong></code> </a></td> <td> +the <a href="#SkHSVToColor_alpha">alpha</a> component of the returned argb color. +</td> + </tr> <tr> <td><a name="SkHSVToColor_hsv"> <code><strong>hsv </strong></code> </a></td> <td> +3 element array which holds the input <a href="#HSV">HSV</a> components. +</td> + </tr> +</table> + +### Return Value + +the resulting argb color + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkHSVToColor_2"></a> + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +static inline SkColor SkHSVToColor(const SkScalar hsv[3]) +</pre> + +Convert <a href="#HSV">HSV</a> components to an <a href="#ARGB">ARGB</a> color. The alpha component set to 0xFF. +<a href="#SkHSVToColor_2_hsv">hsv</a>[0] represents <a href="#HSV_Hue">Hue</a>, an angle from zero to less than 360. +<a href="#SkHSVToColor_2_hsv">hsv</a>[1] represents <a href="#HSV_Saturation">Saturation</a>, and varies from zero to one. +<a href="#SkHSVToColor_2_hsv">hsv</a>[2] represents <a href="#HSV_Value">Value</a>, and varies from zero to one. + +If <a href="#SkHSVToColor_2_hsv">hsv</a> values are out of range, they are pinned. + +### Parameters + +<table> <tr> <td><a name="SkHSVToColor_2_hsv"> <code><strong>hsv </strong></code> </a></td> <td> +3 element array which holds the input <a href="#HSV">HSV</a> components. +</td> + </tr> +</table> + +### Return Value + +the resulting argb color + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +32 bit <a href="#ARGB">ARGB</a> color value, premultiplied. The byte order for this value is +configuration dependent, matching the format of <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a> bitmaps. +This is different from <a href="#SkColor">SkColor</a>, which is nonpremultiplied, and is always in the +same byte order. + +<a name="SkPreMultiplyARGB"></a> +## SkPreMultiplyARGB + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) +</pre> + +Return <a href="#SkPreMultiplyARGB_a">a</a> <a href="#SkPMColor">SkPMColor</a> value from unpremultiplied 8 bit component values + +### Parameters + +<table> <tr> <td><a name="SkPreMultiplyARGB_a"> <code><strong>a </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkPreMultiplyARGB_r"> <code><strong>r </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkPreMultiplyARGB_g"> <code><strong>g </strong></code> </a></td> <td> +incomplete</td> + </tr> <tr> <td><a name="SkPreMultiplyARGB_b"> <code><strong>b </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + +<a name="SkPreMultiplyColor"></a> +## SkPreMultiplyColor + +<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> +SK_API SkPMColor SkPreMultiplyColor(SkColor c) +</pre> + +Return a <a href="#SkPMColor">SkPMColor</a> value from a <a href="#SkColor">SkColor</a> value. This is done by multiplying the color +components by the color's alpha, and by arranging the bytes in a configuration +dependent order, to match the format of <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a> bitmaps. + +### Parameters + +<table> <tr> <td><a name="SkPreMultiplyColor_c"> <code><strong>c </strong></code> </a></td> <td> +incomplete</td> + </tr> +</table> + +### Return Value + +incomplete + +### Example + +<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div> + +### See Also + +incomplete + +--- + diff --git a/site/user/api/SkImageInfo_Reference.md b/site/user/api/SkImageInfo_Reference.md index 12742f7bcb..439f6d7155 100644 --- a/site/user/api/SkImageInfo_Reference.md +++ b/site/user/api/SkImageInfo_Reference.md @@ -4,7 +4,7 @@ SkImageInfo Reference # <a name="Image_Info"></a> Image Info <a href="#Image_Info">Image Info</a> specifies the dimensions and encoding of the pixels in a <a href="SkBitmap_Reference#Bitmap">Bitmap</a>. The dimensions are integral width and height. The encoding is how pixel -bits describe <a href="undocumented#Alpha">Color Alpha</a>, transparency; <a href="undocumented#Color">Color</a> components red, blue, +bits describe <a href="SkColor_Reference#Alpha">Color Alpha</a>, transparency; <a href="SkColor_Reference#Color">Color</a> components red, blue, and green; and <a href="undocumented#Color_Space">Color Space</a>, the range and linearity of colors. <a href="#Image_Info">Image Info</a> describes an uncompressed raster pixels. In contrast, <a href="SkImage_Reference#Image">Image</a> @@ -43,16 +43,16 @@ but <a href="SkImage_Reference#Image">Image</a> and <a href="SkSurface_Reference </pre> Describes how to interpret the alpha component of a pixel. A pixel may -be opaque, or <a href="undocumented#Alpha">Color Alpha</a>, describing multiple levels of transparency. +be opaque, or <a href="SkColor_Reference#Alpha">Color Alpha</a>, describing multiple levels of transparency. -In simple blending, <a href="undocumented#Alpha">Color Alpha</a> weights the draw color and the destination +In simple blending, <a href="SkColor_Reference#Alpha">Color Alpha</a> weights the draw color and the destination color to create a new color. If alpha describes a weight from zero to one: new color = draw color * alpha + destination color * (1 - alpha) In practice alpha is encoded in two or more bits, where 1.0 equals all bits set. -<a href="undocumented#RGB">Color RGB</a> may have <a href="undocumented#Alpha">Color Alpha</a> included in each component value; the stored -value is the original <a href="undocumented#RGB">Color RGB</a> multiplied by <a href="undocumented#Alpha">Color Alpha</a>. <a href="undocumented#Premultiply">Premultiplied</a> color +<a href="SkColor_Reference#RGB">Color RGB</a> may have <a href="SkColor_Reference#Alpha">Color Alpha</a> included in each component value; the stored +value is the original <a href="SkColor_Reference#RGB">Color RGB</a> multiplied by <a href="SkColor_Reference#Alpha">Color Alpha</a>. <a href="undocumented#Premultiply">Premultiplied</a> color components improve performance. ### Constants @@ -96,9 +96,9 @@ undefined. ### Example -<div><fiddle-embed name="79146a1a41d58d22582fdc567c6ffe4e"><div><a href="undocumented#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to 255, its maximum value, and is interpreted -as <a href="undocumented#Alpha">Color Alpha</a> of 1.0. <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a> may be set to improve performance. -If <a href="undocumented#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to a value smaller than 255, +<div><fiddle-embed name="79146a1a41d58d22582fdc567c6ffe4e"><div><a href="SkColor_Reference#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to 255, its maximum value, and is interpreted +as <a href="SkColor_Reference#Alpha">Color Alpha</a> of 1.0. <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a> may be set to improve performance. +If <a href="SkColor_Reference#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to a value smaller than 255, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a> must be used instead to avoid undefined results. The four displayed values are the original component values, though not necessarily in the same order. @@ -115,9 +115,9 @@ or the results are undefined. ### Example -<div><fiddle-embed name="ad696b39c915803d566e96896ec3a36c"><div><a href="undocumented#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to 150, less than its maximum value, and is -interpreted as <a href="undocumented#Alpha">Color Alpha</a> of about 0.6. <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a> must be set, since -<a href="undocumented#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to a value smaller than 255, +<div><fiddle-embed name="ad696b39c915803d566e96896ec3a36c"><div><a href="SkColor_Reference#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to 150, less than its maximum value, and is +interpreted as <a href="SkColor_Reference#Alpha">Color Alpha</a> of about 0.6. <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a> must be set, since +<a href="SkColor_Reference#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to a value smaller than 255, to avoid undefined results. The four displayed values reflect that the alpha component has been multiplied by the original color. @@ -130,8 +130,8 @@ Some drawing destinations may not support <a href="#Alpha_Type_Unpremul">Unpremu ### Example -<div><fiddle-embed name="b8216a9e5ff5bc61a0e46eba7d36307b"><div><a href="undocumented#SkColorSetARGB">SkColorSetARGB</a> parameter a is set to 150, less than its maximum value, and is -interpreted as <a href="undocumented#Alpha">Color Alpha</a> of about 0.6. color is not premultiplied; +<div><fiddle-embed name="b8216a9e5ff5bc61a0e46eba7d36307b"><div><a href="SkColor_Reference#SkColorSetARGB">SkColorSetARGB</a> parameter a is set to 150, less than its maximum value, and is +interpreted as <a href="SkColor_Reference#Alpha">Color Alpha</a> of about 0.6. color is not premultiplied; color components may have values greater than color alpha. The four displayed values are the original component values, though not necessarily in the same order. @@ -145,9 +145,9 @@ static inline bool SkAlphaTypeIsOpaque(SkAlphaType at) </pre> Returns true if <a href="#Alpha_Type">Alpha Type</a> equals <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>. <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a> is a -hint that the <a href="#Color_Type">Color Type</a> is opaque, or that all <a href="undocumented#Alpha">Color Alpha</a> values are set to +hint that the <a href="#Color_Type">Color Type</a> is opaque, or that all <a href="SkColor_Reference#Alpha">Color Alpha</a> values are set to their 1.0 equivalent. If <a href="#Alpha_Type">Alpha Type</a> is <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, and <a href="#Color_Type">Color Type</a> is not -opaque, then the result of drawing any pixel with a <a href="undocumented#Alpha">Color Alpha</a> value less than +opaque, then the result of drawing any pixel with a <a href="SkColor_Reference#Alpha">Color Alpha</a> value less than 1.0 is undefined. ### Parameters @@ -190,16 +190,16 @@ true if <a href="#SkAlphaTypeIsOpaque_at">at</a> equals <a href="#kOpaque_SkAlph #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) <a href="#kN32_SkColorType">kN32_SkColorType</a> = <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, #else - #error "SK_*32_SHIFT values must correspond to BGRA or RGBA byte order" + #error #endif }; </pre> Describes how pixel bits encode color. A pixel may be an alpha mask, a -gray level, <a href="undocumented#RGB">Color RGB</a>, or <a href="undocumented#ARGB">Color ARGB</a>. +gray level, <a href="SkColor_Reference#RGB">Color RGB</a>, or <a href="SkColor_Reference#ARGB">Color ARGB</a>. -<a href="#kN32_SkColorType">kN32_SkColorType</a> selects the native 32-bit <a href="undocumented#ARGB">Color ARGB</a> format. On Little_Endian -processors, pixels containing 8-bit <a href="undocumented#ARGB">Color ARGB</a> components pack into 32-bit +<a href="#kN32_SkColorType">kN32_SkColorType</a> selects the native 32-bit <a href="SkColor_Reference#ARGB">Color ARGB</a> format. On Little_Endian +processors, pixels containing 8-bit <a href="SkColor_Reference#ARGB">Color ARGB</a> components pack into 32-bit <a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>. On Big_Endian processors, pixels pack into 32-bit <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>. @@ -211,43 +211,43 @@ processors, pixels containing 8-bit <a href="undocumented#ARGB">Color ARGB</a> c </td> </tr> <tr> - <td><a name="kAlpha_8_SkColorType"> <code><strong>kAlpha_8_SkColorType </strong></code> </a></td><td>1</td><td>Encodes <a href="undocumented#Alpha">Color Alpha</a> as <a href="#Color_Type_Alpha_8">Alpha 8</a> pixel in an 8-bit byte. + <td><a name="kAlpha_8_SkColorType"> <code><strong>kAlpha_8_SkColorType </strong></code> </a></td><td>1</td><td>Encodes <a href="SkColor_Reference#Alpha">Color Alpha</a> as <a href="#Color_Type_Alpha_8">Alpha 8</a> pixel in an 8-bit byte. </td> </tr> <tr> - <td><a name="kRGB_565_SkColorType"> <code><strong>kRGB_565_SkColorType </strong></code> </a></td><td>2</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_BGR_565">BGR 565</a> pixel in a 16-bit word. + <td><a name="kRGB_565_SkColorType"> <code><strong>kRGB_565_SkColorType </strong></code> </a></td><td>2</td><td>Encodes <a href="SkColor_Reference#RGB">Color RGB</a> as <a href="#Color_Type_BGR_565">BGR 565</a> pixel in a 16-bit word. </td> </tr> <tr> - <td><a name="kARGB_4444_SkColorType"> <code><strong>kARGB_4444_SkColorType </strong></code> </a></td><td>3</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_ABGR_4444">ABGR 4444</a> pixel in a 16-bit word. + <td><a name="kARGB_4444_SkColorType"> <code><strong>kARGB_4444_SkColorType </strong></code> </a></td><td>3</td><td>Encodes <a href="SkColor_Reference#ARGB">Color ARGB</a> as <a href="#Color_Type_ABGR_4444">ABGR 4444</a> pixel in a 16-bit word. </td> </tr> <tr> - <td><a name="kRGBA_8888_SkColorType"> <code><strong>kRGBA_8888_SkColorType </strong></code> </a></td><td>4</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_8888">RGBA 8888</a> pixel in a 32-bit word. + <td><a name="kRGBA_8888_SkColorType"> <code><strong>kRGBA_8888_SkColorType </strong></code> </a></td><td>4</td><td>Encodes <a href="SkColor_Reference#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_8888">RGBA 8888</a> pixel in a 32-bit word. </td> </tr> <tr> - <td><a name="kRGB_888x_SkColorType"> <code><strong>kRGB_888x_SkColorType </strong></code> </a></td><td>5</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_RGB_888x">RGB 888x</a> pixel in a 32-bit word. + <td><a name="kRGB_888x_SkColorType"> <code><strong>kRGB_888x_SkColorType </strong></code> </a></td><td>5</td><td>Encodes <a href="SkColor_Reference#RGB">Color RGB</a> as <a href="#Color_Type_RGB_888x">RGB 888x</a> pixel in a 32-bit word. </td> </tr> <tr> - <td><a name="kBGRA_8888_SkColorType"> <code><strong>kBGRA_8888_SkColorType </strong></code> </a></td><td>6</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_BGRA_8888">BGRA 8888</a> pixel in a 32-bit word. + <td><a name="kBGRA_8888_SkColorType"> <code><strong>kBGRA_8888_SkColorType </strong></code> </a></td><td>6</td><td>Encodes <a href="SkColor_Reference#ARGB">Color ARGB</a> as <a href="#Color_Type_BGRA_8888">BGRA 8888</a> pixel in a 32-bit word. </td> </tr> <tr> - <td><a name="kRGBA_1010102_SkColorType"> <code><strong>kRGBA_1010102_SkColorType </strong></code> </a></td><td>7</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_1010102">RGBA 1010102</a> pixel in a 32-bit word. + <td><a name="kRGBA_1010102_SkColorType"> <code><strong>kRGBA_1010102_SkColorType </strong></code> </a></td><td>7</td><td>Encodes <a href="SkColor_Reference#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_1010102">RGBA 1010102</a> pixel in a 32-bit word. </td> </tr> <tr> - <td><a name="kRGB_101010x_SkColorType"> <code><strong>kRGB_101010x_SkColorType </strong></code> </a></td><td>8</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_RGB_101010x">RGB 101010x</a> pixel in a 32-bit word. + <td><a name="kRGB_101010x_SkColorType"> <code><strong>kRGB_101010x_SkColorType </strong></code> </a></td><td>8</td><td>Encodes <a href="SkColor_Reference#RGB">Color RGB</a> as <a href="#Color_Type_RGB_101010x">RGB 101010x</a> pixel in a 32-bit word. </td> </tr> <tr> - <td><a name="kGray_8_SkColorType"> <code><strong>kGray_8_SkColorType </strong></code> </a></td><td>9</td><td>Encodes <a href="undocumented#Gray">Color Gray</a> as <a href="#Color_Type_Gray_8">Gray 8</a> in an 8-bit byte. + <td><a name="kGray_8_SkColorType"> <code><strong>kGray_8_SkColorType </strong></code> </a></td><td>9</td><td>Encodes <a href="SkColor_Reference#Gray">Color Gray</a> as <a href="#Color_Type_Gray_8">Gray 8</a> in an 8-bit byte. </td> </tr> <tr> - <td><a name="kRGBA_F16_SkColorType"> <code><strong>kRGBA_F16_SkColorType </strong></code> </a></td><td>10</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_F16">RGBA F16</a> in a 64-bit word. + <td><a name="kRGBA_F16_SkColorType"> <code><strong>kRGBA_F16_SkColorType </strong></code> </a></td><td>10</td><td>Encodes <a href="SkColor_Reference#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_F16">RGBA F16</a> in a 64-bit word. </td> </tr> </table> @@ -256,7 +256,7 @@ processors, pixels containing 8-bit <a href="undocumented#ARGB">Color ARGB</a> c <table> <tr> - <td><a name="kN32_SkColorType"> <code><strong>kN32_SkColorType </strong></code> </a></td><td>4</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as either <a href="#Color_Type_RGBA_8888">RGBA 8888</a> or <a href="#Color_Type_BGRA_8888">BGRA 8888</a>, whichever + <td><a name="kN32_SkColorType"> <code><strong>kN32_SkColorType </strong></code> </a></td><td>4</td><td>Encodes <a href="SkColor_Reference#ARGB">Color ARGB</a> as either <a href="#Color_Type_RGBA_8888">RGBA 8888</a> or <a href="#Color_Type_BGRA_8888">BGRA 8888</a>, whichever is native to the platform. </td> </tr> @@ -285,7 +285,7 @@ with its transparency set to alpha8 pixel value. <a href="#Color_Type_BGR_565">BGR 565</a> is a 16-bit word pixel encoding that contains five bits of blue, six bits of green, and five bits of red. <a href="#Color_Type_BGR_565">BGR 565</a> is fully opaque as if its -<a href="undocumented#Alpha">Color Alpha</a> was set to one, and should always be paired with <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>. +<a href="SkColor_Reference#Alpha">Color Alpha</a> was set to one, and should always be paired with <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>. ![Color_Type_BGR_565](https://fiddle.skia.org/i/b674a54eb4188d5ce66c04cebdb61089_raster.png "") @@ -347,7 +347,7 @@ the platform at compile time. <a href="#Color_Type_RGB_888x">RGB 888x</a> is a 32-bit word pixel encoding that contains eight bits of red, eight bits of green, eight bits of blue, and eight unused bits. <a href="#Color_Type_RGB_888x">RGB 888x</a> is fully -opaque as if its <a href="undocumented#Alpha">Color Alpha</a> was set to one, and should always be paired with +opaque as if its <a href="SkColor_Reference#Alpha">Color Alpha</a> was set to one, and should always be paired with <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>. ![Color_Type_RGB_888x](https://fiddle.skia.org/i/fecfe58c25cfc1b1e411e5eb50f7d8d1_raster.png "") @@ -412,7 +412,7 @@ less than 3, the drawn result is undefined. <a href="#Color_Type_RGB_101010x">RGB 101010x</a> is a 32-bit word pixel encoding that contains ten bits of red, ten bits of green, ten bits of blue, and two unused bits. <a href="#Color_Type_RGB_101010x">RGB 101010x</a> is fully -opaque as if its <a href="undocumented#Alpha">Color Alpha</a> was set to one, and should always be paired with +opaque as if its <a href="SkColor_Reference#Alpha">Color Alpha</a> was set to one, and should always be paired with <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>. ![Color_Type_RGB_101010x](https://fiddle.skia.org/i/c22477b11dabaa3e3a0b5bb33a7733cd_raster.png "") @@ -425,7 +425,7 @@ opaque as if its <a href="undocumented#Alpha">Color Alpha</a> was set to one, an <a href="#Color_Type_Gray_8">Gray 8</a> is an 8-bit byte pixel encoding that represents equal values for red, blue, and green, reprsenting colors from black to white. <a href="#Color_Type_Gray_8">Gray 8</a> is fully -opaque as if its <a href="undocumented#Alpha">Color Alpha</a> was set to one, and should always be paired with +opaque as if its <a href="SkColor_Reference#Alpha">Color Alpha</a> was set to one, and should always be paired with <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>. ### Example @@ -503,8 +503,8 @@ bytes per pixel bool SkColorTypeIsAlwaysOpaque(SkColorType ct) </pre> -Returns true if <a href="#Color_Type">Color Type</a> always decodes <a href="undocumented#Alpha">Color Alpha</a> to 1.0, making the pixel -fully opaque. If true, <a href="#Color_Type">Color Type</a> does not reserve bits to encode <a href="undocumented#Alpha">Color Alpha</a>. +Returns true if <a href="#Color_Type">Color Type</a> always decodes <a href="SkColor_Reference#Alpha">Color Alpha</a> to 1.0, making the pixel +fully opaque. If true, <a href="#Color_Type">Color Type</a> does not reserve bits to encode <a href="SkColor_Reference#Alpha">Color Alpha</a>. ### Parameters @@ -518,7 +518,7 @@ one of: <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlp ### Return Value -true if <a href="undocumented#Alpha">Color Alpha</a> is always set to 1.0 +true if <a href="SkColor_Reference#Alpha">Color Alpha</a> is always set to 1.0 ### Example @@ -652,7 +652,7 @@ can be created from <a href="#Image_Info">Image Info</a>. <a href="#Image_Info"> implementations may defer pixel depth, so may not completely specify <a href="#Image_Info">Image Info</a>. <a href="#Image_Info">Image Info</a> contains dimensions, the pixel integral width and height. It encodes -how pixel bits describe <a href="undocumented#Alpha">Color Alpha</a>, transparency; <a href="undocumented#Color">Color</a> components red, blue, +how pixel bits describe <a href="SkColor_Reference#Alpha">Color Alpha</a>, transparency; <a href="SkColor_Reference#Color">Color</a> components red, blue, and green; and <a href="undocumented#Color_Space">Color Space</a>, the range and linearity of colors. ## <a name="Member_Function"></a> Member Function @@ -1293,10 +1293,10 @@ bool isOpaque() const </pre> Returns true if <a href="#Alpha_Type">Alpha Type</a> is set to hint that all pixels are opaque; their -<a href="undocumented#Alpha">Color Alpha</a> value is implicitly or explicitly 1.0. If true, and all pixels are +<a href="SkColor_Reference#Alpha">Color Alpha</a> value is implicitly or explicitly 1.0. If true, and all pixels are not opaque, Skia may draw incorrectly. -Does not check if <a href="#Color_Type">Color Type</a> allows <a href="undocumented#Alpha">Alpha</a>, or if any pixel value has +Does not check if <a href="#Color_Type">Color Type</a> allows <a href="SkColor_Reference#Alpha">Alpha</a>, or if any pixel value has transparency. ### Return Value @@ -1320,7 +1320,7 @@ isOpaque: true ### See Also -<a href="undocumented#Alpha">Color Alpha</a> <a href="#SkColorTypeValidateAlphaType">SkColorTypeValidateAlphaType</a> <a href="SkBitmap_Reference#SkBitmap_isOpaque">SkBitmap::isOpaque</a> <a href="SkImage_Reference#SkImage_isOpaque">SkImage::isOpaque</a> <a href="SkPixmap_Reference#SkPixmap_isOpaque">SkPixmap::isOpaque</a> +<a href="SkColor_Reference#Alpha">Color Alpha</a> <a href="#SkColorTypeValidateAlphaType">SkColorTypeValidateAlphaType</a> <a href="SkBitmap_Reference#SkBitmap_isOpaque">SkBitmap::isOpaque</a> <a href="SkImage_Reference#SkImage_isOpaque">SkImage::isOpaque</a> <a href="SkPixmap_Reference#SkPixmap_isOpaque">SkPixmap::isOpaque</a> --- diff --git a/site/user/api/SkImage_Reference.md b/site/user/api/SkImage_Reference.md index c97b0845fa..1dd2c6e358 100644 --- a/site/user/api/SkImage_Reference.md +++ b/site/user/api/SkImage_Reference.md @@ -13,6 +13,7 @@ SkImage Reference | <a href="#Constructor">Constructor</a> | functions that construct <a href="#SkImage">SkImage</a> | | <a href="#Member_Function">Member Function</a> | static functions and member methods | | <a href="#Related_Function">Related Function</a> | similar methods grouped together | +| Typedef | types defined by other types | # <a name="SkImage"></a> Class SkImage <a href="#Image">Image</a> describes a two dimensional array of pixels to draw. The pixels may be @@ -783,11 +784,11 @@ created <a href="#Image">Image</a>, or nullptr <table> <tr> - <td><a name="SkImage_BitDepth_kU8"> <code><strong>SkImage::BitDepth::kU8 </strong></code> </a></td><td>0</td><td>Use 8 bits per <a href="undocumented#ARGB">Color ARGB</a> component using unsigned integer format. + <td><a name="SkImage_BitDepth_kU8"> <code><strong>SkImage::BitDepth::kU8 </strong></code> </a></td><td>0</td><td>Use 8 bits per <a href="SkColor_Reference#ARGB">Color ARGB</a> component using unsigned integer format. </td> </tr> <tr> - <td><a name="SkImage_BitDepth_kF16"> <code><strong>SkImage::BitDepth::kF16 </strong></code> </a></td><td>1</td><td>Use 16 bits per <a href="undocumented#ARGB">Color ARGB</a> component using half-precision floating point format. + <td><a name="SkImage_BitDepth_kF16"> <code><strong>SkImage::BitDepth::kF16 </strong></code> </a></td><td>1</td><td>Use 16 bits per <a href="SkColor_Reference#ARGB">Color ARGB</a> component using half-precision floating point format. </td> </tr> </table> @@ -1173,7 +1174,7 @@ alphaOnly = true bool isOpaque() const </pre> -Returns true if pixels ignore their <a href="undocumented#Alpha">Alpha</a> value and are treated as fully opaque. +Returns true if pixels ignore their <a href="SkColor_Reference#Alpha">Alpha</a> value and are treated as fully opaque. ### Return Value diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md index b5983555e7..a30e073b27 100644 --- a/site/user/api/SkPaint_Reference.md +++ b/site/user/api/SkPaint_Reference.md @@ -47,12 +47,12 @@ Multiple colors are drawn either by using multiple paints or with objects like | name | description | | --- | --- | -| <a href="#Alpha_Methods">Alpha Methods</a> | get and set <a href="undocumented#Alpha">Alpha</a> | +| <a href="#Alpha_Methods">Alpha Methods</a> | get and set <a href="SkColor_Reference#Alpha">Alpha</a> | | Anti-alias | approximating coverage with transparency | | <a href="#Automatic_Hinting">Automatic Hinting</a> | always adjust glyph paths | | <a href="#Blend_Mode_Methods">Blend Mode Methods</a> | get and set <a href="undocumented#Blend_Mode">Blend Mode</a> | | <a href="#Color_Filter_Methods">Color Filter Methods</a> | get and set <a href="undocumented#Color_Filter">Color Filter</a> | -| <a href="#Color_Methods">Color Methods</a> | get and set <a href="undocumented#Color">Color</a> | +| <a href="#Color_Methods">Color Methods</a> | get and set <a href="SkColor_Reference#Color">Color</a> | | <a href="#Device_Text">Device Text</a> | increase precision of glyph position | | <a href="#Dither">Dither</a> | distributing color error | | <a href="#Draw_Looper_Methods">Draw Looper Methods</a> | get and set <a href="undocumented#Draw_Looper">Draw Looper</a> | @@ -67,7 +67,7 @@ Multiple colors are drawn either by using multiple paints or with objects like | <a href="#SkPaint_Hinting">Hinting</a> | glyph outline adjustment | | <a href="#Image_Filter_Methods">Image Filter Methods</a> | get and set <a href="undocumented#Image_Filter">Image Filter</a> | | <a href="#Initializers">Initializers</a> | constructors and initialization | -| <a href="#LCD_Text">LCD Text</a> | text relying on the order of <a href="undocumented#RGB">Color RGB</a> stripes | +| <a href="#LCD_Text">LCD Text</a> | text relying on the order of <a href="SkColor_Reference#RGB">Color RGB</a> stripes | | <a href="#Linear_Text">Linear Text</a> | selects text rendering as <a href="undocumented#Glyph">Glyph</a> or <a href="SkPath_Reference#Path">Path</a> | | <a href="#Management">Management</a> | paint copying, moving, comparing | | <a href="#Mask_Filter_Methods">Mask Filter Methods</a> | get and set <a href="undocumented#Mask_Filter">Mask Filter</a> | @@ -143,9 +143,9 @@ Multiple colors are drawn either by using multiple paints or with objects like | <a href="#SkPaint_containsText">containsText</a> | returns if all text corresponds to <a href="undocumented#Glyph">Glyphs</a> | | <a href="#SkPaint_countText">countText</a> | returns number of <a href="undocumented#Glyph">Glyphs</a> in text | | <a href="#SkPaint_doComputeFastBounds">doComputeFastBounds</a> | returns bounds for quick reject tests | -| <a href="#SkPaint_getAlpha">getAlpha</a> | returns <a href="undocumented#Alpha">Color Alpha</a>, color opacity | +| <a href="#SkPaint_getAlpha">getAlpha</a> | returns <a href="SkColor_Reference#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 <a href="undocumented#Device">Device</a> | -| <a href="#SkPaint_getColor">getColor</a> | returns <a href="undocumented#Alpha">Color Alpha</a> and <a href="undocumented#RGB">Color RGB</a>, one drawing color | +| <a href="#SkPaint_getColor">getColor</a> | returns <a href="SkColor_Reference#Alpha">Color Alpha</a> and <a href="SkColor_Reference#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 | | <a href="#SkPaint_getFillPath">getFillPath</a> | returns fill path equivalent to stroke | @@ -201,11 +201,11 @@ Multiple colors are drawn either by using multiple paints or with objects like | <a href="#SkPaint_refTypeface">refTypeface</a> | references <a href="undocumented#Typeface">Typeface</a>, font description | | <a href="#SkPaint_reset">reset</a> | sets to default values | | <a href="#SkPaint_setARGB">setARGB</a> | sets color by component | -| <a href="#SkPaint_setAlpha">setAlpha</a> | sets <a href="undocumented#Alpha">Color Alpha</a>, color opacity | +| <a href="#SkPaint_setAlpha">setAlpha</a> | sets <a href="SkColor_Reference#Alpha">Color Alpha</a>, color opacity | | <a href="#SkPaint_setAntiAlias">setAntiAlias</a> | sets or clears Anti-alias | | <a href="#SkPaint_setAutohinted">setAutohinted</a> | sets <a href="undocumented#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="undocumented#Alpha">Color Alpha</a> and <a href="undocumented#RGB">Color RGB</a>, one drawing color | +| <a href="#SkPaint_setColor">setColor</a> | sets <a href="SkColor_Reference#Alpha">Color Alpha</a> and <a href="SkColor_Reference#RGB">Color RGB</a>, one drawing color | | <a href="#SkPaint_setColorFilter">setColorFilter</a> | sets <a href="undocumented#Color_Filter">Color Filter</a>, alters color | | <a href="#SkPaint_setDevKernText">setDevKernText</a> | sets or clears <a href="#Full_Hinting_Spacing">Full Hinting Spacing</a> | | <a href="#SkPaint_setDither">setDither</a> | sets or clears <a href="#Dither">Dither</a> | @@ -252,8 +252,8 @@ Constructs <a href="#Paint">Paint</a> with default values. | --- | --- | | Anti-alias | false | | <a href="undocumented#Blend_Mode">Blend Mode</a> | <a href="undocumented#SkBlendMode_kSrcOver">SkBlendMode::kSrcOver</a> | -| <a href="undocumented#Color">Color</a> | <a href="undocumented#SK_ColorBLACK">SK ColorBLACK</a> | -| <a href="undocumented#Alpha">Color Alpha</a> | 255 | +| <a href="SkColor_Reference#Color">Color</a> | <a href="SkColor_Reference#SK_ColorBLACK">SK ColorBLACK</a> | +| <a href="SkColor_Reference#Alpha">Color Alpha</a> | 255 | | <a href="undocumented#Color_Filter">Color Filter</a> | nullptr | | <a href="#Dither">Dither</a> | false | | <a href="undocumented#Draw_Looper">Draw Looper</a> | nullptr | @@ -903,7 +903,7 @@ paint.isDither() Anti-alias drawing approximates partial pixel coverage with transparency. 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="undocumented#Alpha">Color Alpha</a> equal to their coverage. +If <a href="#SkPaint_kAntiAlias_Flag">kAntiAlias Flag</a> is set, pixels are drawn with <a href="SkColor_Reference#Alpha">Color Alpha</a> equal to their coverage. The rule for <a href="undocumented#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. @@ -1093,17 +1093,17 @@ paint1 == paint2 ### See Also -Gradient <a href="undocumented#RGB">Color RGB</a>-565 +Gradient <a href="SkColor_Reference#RGB">Color RGB</a>-565 ## <a name="Device_Text"></a> Device Text <a href="#LCD_Text">LCD Text</a> and <a href="#Subpixel_Text">Subpixel Text</a> increase the precision of glyph position. -When set, <a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="undocumented#RGB">Color RGB</a> stripes that +When set, <a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="SkColor_Reference#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 imperceptible. <a href="#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="undocumented#RGB">Color RGB</a> or <a href="undocumented#RBG">Color RBG</a>. +the color components as <a href="SkColor_Reference#RGB">Color RGB</a> or <a href="SkColor_Reference#RBG">Color RBG</a>. <a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kSubpixelText_Flag">kSubpixelText Flag</a> uses the pixel transparency to represent a fractional offset. As the opaqueness @@ -1253,11 +1253,11 @@ paint1 == paint2 ## <a name="LCD_Text"></a> LCD Text -When set, <a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="undocumented#RGB">Color RGB</a> stripes that +When set, <a href="#SkPaint_Flags">Flags</a> <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="SkColor_Reference#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 imperceptible. <a href="#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="undocumented#RGB">Color RGB</a> or <a href="undocumented#RBG">Color RBG</a>. +the color components as <a href="SkColor_Reference#RGB">Color RGB</a> or <a href="SkColor_Reference#RBG">Color RBG</a>. <a name="SkPaint_isLCDRenderText"></a> ## isLCDRenderText @@ -1836,22 +1836,22 @@ kHigh_SkFilterQuality == paint.getFilterQuality() | name | description | | --- | --- | -| <a href="#SkPaint_getColor">getColor</a> | returns <a href="undocumented#Alpha">Color Alpha</a> and <a href="undocumented#RGB">Color RGB</a>, one drawing color | -| <a href="#SkPaint_setColor">setColor</a> | sets <a href="undocumented#Alpha">Color Alpha</a> and <a href="undocumented#RGB">Color RGB</a>, one drawing color | +| <a href="#SkPaint_getColor">getColor</a> | returns <a href="SkColor_Reference#Alpha">Color Alpha</a> and <a href="SkColor_Reference#RGB">Color RGB</a>, one drawing color | +| <a href="#SkPaint_setColor">setColor</a> | sets <a href="SkColor_Reference#Alpha">Color Alpha</a> and <a href="SkColor_Reference#RGB">Color RGB</a>, one drawing color | -<a href="undocumented#Color">Color</a> specifies the <a href="undocumented#RGB_Red">Color RGB Red</a>, <a href="undocumented#RGB_Blue">Color RGB Blue</a>, <a href="undocumented#RGB_Green">Color RGB Green</a>, and <a href="undocumented#Alpha">Color Alpha</a> +<a href="SkColor_Reference#Color">Color</a> specifies the <a href="SkColor_Reference#RGB_Red">Color RGB Red</a>, <a href="SkColor_Reference#RGB_Blue">Color RGB Blue</a>, <a href="SkColor_Reference#RGB_Green">Color RGB Green</a>, and <a href="SkColor_Reference#Alpha">Color Alpha</a> values used to draw a filled 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 <a href="undocumented#Premultiply">Premultiplied</a>; <a href="undocumented#Alpha">Color Alpha</a> sets the transparency independent of -<a href="undocumented#RGB">Color RGB</a>: <a href="undocumented#RGB_Red">Color RGB Red</a>, <a href="undocumented#RGB_Blue">Color RGB Blue</a>, and <a href="undocumented#RGB_Green">Color RGB Green</a>. +<a href="SkColor_Reference#Color">Color</a> is not <a href="undocumented#Premultiply">Premultiplied</a>; <a href="SkColor_Reference#Alpha">Color Alpha</a> sets the transparency independent of +<a href="SkColor_Reference#RGB">Color RGB</a>: <a href="SkColor_Reference#RGB_Red">Color RGB Red</a>, <a href="SkColor_Reference#RGB_Blue">Color RGB Blue</a>, and <a href="SkColor_Reference#RGB_Green">Color RGB Green</a>. -The bit positions of <a href="undocumented#Alpha">Color Alpha</a> and <a href="undocumented#RGB">Color RGB</a> are independent of the bit +The bit positions of <a href="SkColor_Reference#Alpha">Color Alpha</a> and <a href="SkColor_Reference#RGB">Color RGB</a> are independent of the bit positions on the output device, which may have more or fewer bits, and may have a different arrangement. -| bit positions | <a href="undocumented#Alpha">Color Alpha</a> | <a href="undocumented#RGB_Red">Color RGB Red</a> | <a href="undocumented#RGB_Blue">Color RGB Blue</a> | <a href="undocumented#RGB_Green">Color RGB Green</a> | +| bit positions | <a href="SkColor_Reference#Alpha">Color Alpha</a> | <a href="SkColor_Reference#RGB_Red">Color RGB Red</a> | <a href="SkColor_Reference#RGB_Blue">Color RGB Blue</a> | <a href="SkColor_Reference#RGB_Green">Color RGB Green</a> | | --- | --- | --- | --- | --- | | | 31 - 24 | 23 - 16 | 15 - 8 | 7 - 0 | @@ -1866,13 +1866,13 @@ a different arrangement. SkColor getColor() const </pre> -Retrieves <a href="undocumented#Alpha">Alpha</a> and <a href="undocumented#RGB">Color RGB</a>, <a href="undocumented#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 +Retrieves <a href="SkColor_Reference#Alpha">Alpha</a> and <a href="SkColor_Reference#RGB">Color RGB</a>, <a href="undocumented#Unpremultiply">Unpremultiplied</a>, packed into 32 bits. +Use helpers <a href="SkColor_Reference#SkColorGetA">SkColorGetA</a>, <a href="SkColor_Reference#SkColorGetR">SkColorGetR</a>, <a href="SkColor_Reference#SkColorGetG">SkColorGetG</a>, and <a href="SkColor_Reference#SkColorGetB">SkColorGetB</a> to extract a color component. ### Return Value -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#ARGB">Color ARGB</a> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#ARGB">Color ARGB</a> ### Example @@ -1888,7 +1888,7 @@ Yellow is 100% red, 100% green, and 0% blue. ### See Also -<a href="undocumented#SkColor">SkColor</a> +<a href="SkColor_Reference#SkColor">SkColor</a> --- @@ -1899,13 +1899,13 @@ Yellow is 100% red, 100% green, and 0% blue. void setColor(SkColor color) </pre> -Sets <a href="undocumented#Alpha">Alpha</a> and <a href="undocumented#RGB">Color RGB</a> used when stroking and filling. The <a href="#SkPaint_setColor_color">color</a> is a 32-bit value, -<a href="undocumented#Unpremultiply">Unpremultiplied</a>, packing 8-bit components for <a href="undocumented#Alpha">Alpha</a>, <a href="undocumented#RGB_Red">Red</a>, <a href="undocumented#RGB_Blue">Blue</a>, and <a href="undocumented#RGB_Green">Green</a>. +Sets <a href="SkColor_Reference#Alpha">Alpha</a> and <a href="SkColor_Reference#RGB">Color RGB</a> used when stroking and filling. The <a href="#SkPaint_setColor_color">color</a> is a 32-bit value, +<a href="undocumented#Unpremultiply">Unpremultiplied</a>, packing 8-bit components for <a href="SkColor_Reference#Alpha">Alpha</a>, <a href="SkColor_Reference#RGB_Red">Red</a>, <a href="SkColor_Reference#RGB_Blue">Blue</a>, and <a href="SkColor_Reference#RGB_Green">Green</a>. ### Parameters <table> <tr> <td><a name="SkPaint_setColor_color"> <code><strong>color </strong></code> </a></td> <td> -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#ARGB">Color ARGB</a></td> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#ARGB">Color ARGB</a></td> </tr> </table> @@ -1923,13 +1923,13 @@ green1 == green2 ### See Also -<a href="undocumented#SkColor">SkColor</a> <a href="#SkPaint_setARGB">setARGB</a> <a href="undocumented#SkColorSetARGB">SkColorSetARGB</a> +<a href="SkColor_Reference#SkColor">SkColor</a> <a href="#SkPaint_setARGB">setARGB</a> <a href="SkColor_Reference#SkColorSetARGB">SkColorSetARGB</a> --- ## <a name="Alpha_Methods"></a> Alpha Methods -<a href="undocumented#Alpha">Color Alpha</a> sets the transparency independent of <a href="undocumented#RGB">Color RGB</a>: <a href="undocumented#RGB_Red">Color RGB Red</a>, <a href="undocumented#RGB_Blue">Color RGB Blue</a>, and <a href="undocumented#RGB_Green">Color RGB Green</a>. +<a href="SkColor_Reference#Alpha">Color Alpha</a> sets the transparency independent of <a href="SkColor_Reference#RGB">Color RGB</a>: <a href="SkColor_Reference#RGB_Red">Color RGB Red</a>, <a href="SkColor_Reference#RGB_Blue">Color RGB Blue</a>, and <a href="SkColor_Reference#RGB_Green">Color RGB Green</a>. <a name="SkPaint_getAlpha"></a> ## getAlpha @@ -1938,11 +1938,11 @@ green1 == green2 uint8_t getAlpha() const </pre> -Retrieves <a href="undocumented#Alpha">Alpha</a> from the <a href="undocumented#Color">Color</a> used when stroking and filling. +Retrieves <a href="SkColor_Reference#Alpha">Alpha</a> from the <a href="SkColor_Reference#Color">Color</a> used when stroking and filling. ### Return Value -<a href="undocumented#Alpha">Alpha</a> ranging from zero, fully transparent, to 255, fully opaque +<a href="SkColor_Reference#Alpha">Alpha</a> ranging from zero, fully transparent, to 255, fully opaque ### Example @@ -1965,16 +1965,16 @@ Retrieves <a href="undocumented#Alpha">Alpha</a> from the <a href="undocumented# void setAlpha(U8CPU a) </pre> -Replaces <a href="undocumented#Alpha">Alpha</a>, leaving <a href="undocumented#RGB">Color RGB</a> +Replaces <a href="SkColor_Reference#Alpha">Alpha</a>, leaving <a href="SkColor_Reference#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> +<a href="#SkPaint_setAlpha_a">a</a> set to zero makes <a href="SkColor_Reference#Color">Color</a> fully transparent; <a href="#SkPaint_setAlpha_a">a</a> set to 255 makes <a href="SkColor_Reference#Color">Color</a> fully opaque. ### Parameters <table> <tr> <td><a name="SkPaint_setAlpha_a"> <code><strong>a </strong></code> </a></td> <td> -<a href="undocumented#Alpha">Alpha</a> component of <a href="undocumented#Color">Color</a></td> +<a href="SkColor_Reference#Alpha">Alpha</a> component of <a href="SkColor_Reference#Color">Color</a></td> </tr> </table> @@ -1999,19 +1999,19 @@ fully opaque. 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 <a href="undocumented#Unpremultiply">Unpremultiplied</a>; <a href="undocumented#Alpha">Alpha</a> sets the transparency independent of <a href="undocumented#RGB">Color RGB</a>. +Sets <a href="SkColor_Reference#Color">Color</a> used when drawing solid fills. The color components range from 0 to 255. +The color is <a href="undocumented#Unpremultiply">Unpremultiplied</a>; <a href="SkColor_Reference#Alpha">Alpha</a> sets the transparency independent of <a href="SkColor_Reference#RGB">Color RGB</a>. ### Parameters <table> <tr> <td><a name="SkPaint_setARGB_a"> <code><strong>a </strong></code> </a></td> <td> -amount of <a href="undocumented#Alpha">Color Alpha</a>, from fully transparent (0) to fully opaque (255)</td> +amount of <a href="SkColor_Reference#Alpha">Color Alpha</a>, from fully transparent (0) to fully opaque (255)</td> </tr> <tr> <td><a name="SkPaint_setARGB_r"> <code><strong>r </strong></code> </a></td> <td> -amount of <a href="undocumented#RGB_Red">Color RGB Red</a>, from no red (0) to full red (255)</td> +amount of <a href="SkColor_Reference#RGB_Red">Color RGB Red</a>, from no red (0) to full red (255)</td> </tr> <tr> <td><a name="SkPaint_setARGB_g"> <code><strong>g </strong></code> </a></td> <td> -amount of <a href="undocumented#RGB_Green">Color RGB Green</a>, from no green (0) to full green (255)</td> +amount of <a href="SkColor_Reference#RGB_Green">Color RGB Green</a>, from no green (0) to full green (255)</td> </tr> <tr> <td><a name="SkPaint_setARGB_b"> <code><strong>b </strong></code> </a></td> <td> -amount of <a href="undocumented#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue (255)</td> +amount of <a href="SkColor_Reference#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue (255)</td> </tr> </table> @@ -2029,7 +2029,7 @@ transRed1 == transRed2 ### See Also -<a href="#SkPaint_setColor">setColor</a> <a href="undocumented#SkColorSetARGB">SkColorSetARGB</a> +<a href="#SkPaint_setColor">setColor</a> <a href="SkColor_Reference#SkColorSetARGB">SkColorSetARGB</a> --- @@ -2057,7 +2057,7 @@ The area covered where the shape turns a corner is described by <a href="#Stroke The stroke is centered on the shape; it extends equally on either side of the shape edge. As <a href="#Stroke_Width">Stroke Width</a> gets smaller, the drawn path frame is thinner. <a href="#Stroke_Width">Stroke Width</a> less than one -may have gaps, and if <a href="#SkPaint_kAntiAlias_Flag">kAntiAlias Flag</a> is set, <a href="undocumented#Alpha">Color Alpha</a> will increase to visually decrease coverage. +may have gaps, and if <a href="#SkPaint_kAntiAlias_Flag">kAntiAlias Flag</a> is set, <a href="SkColor_Reference#Alpha">Color Alpha</a> will increase to visually decrease coverage. ## <a name="Style_Hairline"></a> Style Hairline @@ -2774,19 +2774,19 @@ true if the path represents <a href="#Style_Fill">Style Fill</a>, or false if it <a href="undocumented#Shader">Shader</a> defines the colors used when drawing a shape. <a href="undocumented#Shader">Shader</a> may be an image, a gradient, or a computed fill. -If <a href="#Paint">Paint</a> has no <a href="undocumented#Shader">Shader</a>, then <a href="undocumented#Color">Color</a> fills the shape. +If <a href="#Paint">Paint</a> has no <a href="undocumented#Shader">Shader</a>, then <a href="SkColor_Reference#Color">Color</a> fills the shape. -<a href="undocumented#Shader">Shader</a> is modulated by <a href="undocumented#Alpha">Color Alpha</a> component of <a href="undocumented#Color">Color</a>. -If <a href="undocumented#Shader">Shader</a> object defines only <a href="undocumented#Alpha">Color Alpha</a>, then <a href="undocumented#Color">Color</a> modulated by <a href="undocumented#Alpha">Color Alpha</a> describes +<a href="undocumented#Shader">Shader</a> is modulated by <a href="SkColor_Reference#Alpha">Color Alpha</a> component of <a href="SkColor_Reference#Color">Color</a>. +If <a href="undocumented#Shader">Shader</a> object defines only <a href="SkColor_Reference#Alpha">Color Alpha</a>, then <a href="SkColor_Reference#Color">Color</a> modulated by <a href="SkColor_Reference#Alpha">Color Alpha</a> describes the fill. -The drawn transparency can be modified without altering <a href="undocumented#Shader">Shader</a>, by changing <a href="undocumented#Alpha">Color Alpha</a>. +The drawn transparency can be modified without altering <a href="undocumented#Shader">Shader</a>, by changing <a href="SkColor_Reference#Alpha">Color Alpha</a>. ### Example <div><fiddle-embed name="c015dc2010c15e1c00b4f7330232b0f7"></fiddle-embed></div> -If <a href="undocumented#Shader">Shader</a> generates only <a href="undocumented#Alpha">Color Alpha</a> then all components of <a href="undocumented#Color">Color</a> modulate the output. +If <a href="undocumented#Shader">Shader</a> generates only <a href="SkColor_Reference#Alpha">Color Alpha</a> then all components of <a href="SkColor_Reference#Color">Color</a> modulate the output. ### Example @@ -2867,7 +2867,7 @@ Increments <a href="#SkPaint_setShader_shader">shader</a> <a href="undocumented# ### Parameters <table> <tr> <td><a name="SkPaint_setShader_shader"> <code><strong>shader </strong></code> </a></td> <td> -how geometry is filled with color; if nullptr, <a href="undocumented#Color">Color</a> is used instead</td> +how geometry is filled with color; if nullptr, <a href="SkColor_Reference#Color">Color</a> is used instead</td> </tr> </table> @@ -2883,7 +2883,7 @@ how geometry is filled with color; if nullptr, <a href="undocumented#Color">Colo <a href="undocumented#Color_Filter">Color Filter</a> may apply <a href="undocumented#Blend_Mode">Blend Mode</a>, transform the color through a matrix, or composite multiple filters. If <a href="#Paint">Paint</a> has no <a href="undocumented#Color_Filter">Color Filter</a>, the color is unaltered. -The drawn transparency can be modified without altering <a href="undocumented#Color_Filter">Color Filter</a>, by changing <a href="undocumented#Alpha">Color Alpha</a>. +The drawn transparency can be modified without altering <a href="undocumented#Color_Filter">Color Filter</a>, by changing <a href="SkColor_Reference#Alpha">Color Alpha</a>. ### Example @@ -2974,7 +2974,7 @@ Increments filter <a href="undocumented#Reference_Count">Reference Count</a> by ## <a name="Blend_Mode_Methods"></a> Blend Mode Methods -<a href="undocumented#Blend_Mode">Blend Mode</a> describes how <a href="undocumented#Color">Color</a> combines with the destination color. +<a href="undocumented#Blend_Mode">Blend Mode</a> describes how <a href="SkColor_Reference#Color">Color</a> combines with the destination color. The default setting, <a href="undocumented#SkBlendMode_kSrcOver">SkBlendMode::kSrcOver</a>, draws the source color over the destination color. @@ -3369,7 +3369,7 @@ with <a href="undocumented#Blend_Mode">Blend Mode</a> set to <a href="undocument 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="undocumented#Alpha">Alpha</a> only. +can operate on all channels of <a href="SkColor_Reference#Color">Color</a>, while <a href="undocumented#Mask_Filter">Mask Filter</a> generates <a href="SkColor_Reference#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>. @@ -5001,8 +5001,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, for example, <a href="undocumented#Blend_Mode">Blend Mode</a> combined with <a href="undocumented#Alpha">Color Alpha</a> computes a -new <a href="undocumented#Alpha">Alpha</a> of zero. +Returns true if, for example, <a href="undocumented#Blend_Mode">Blend Mode</a> combined with <a href="SkColor_Reference#Alpha">Color Alpha</a> computes a +new <a href="SkColor_Reference#Alpha">Alpha</a> of zero. ### Return Value diff --git a/site/user/api/SkPixmap_Reference.md b/site/user/api/SkPixmap_Reference.md index c0a760e5cd..d76a2ffd5b 100644 --- a/site/user/api/SkPixmap_Reference.md +++ b/site/user/api/SkPixmap_Reference.md @@ -59,9 +59,9 @@ to manage pixel memory; <a href="undocumented#Pixel_Ref">Pixel Ref</a> is safe a | <a href="#SkPixmap_colorType">colorType</a> | returns <a href="SkImageInfo_Reference#Image_Info">Image Info</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> | | <a href="#SkPixmap_computeByteSize">computeByteSize</a> | returns size required for pixels | | <a href="#SkPixmap_computeIsOpaque">computeIsOpaque</a> | returns true if all pixels are opaque | -| <a href="#SkPixmap_erase">erase</a> | writes <a href="undocumented#Color">Color</a> to pixels | +| <a href="#SkPixmap_erase">erase</a> | writes <a href="SkColor_Reference#Color">Color</a> to pixels | | <a href="#SkPixmap_extractSubset">extractSubset</a> | sets pointer to portion of original | -| <a href="#SkPixmap_getColor">getColor</a> | returns one pixel as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> | +| <a href="#SkPixmap_getColor">getColor</a> | returns one pixel as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> | | <a href="#SkPixmap_height">height</a> | returns pixel row count | | <a href="#SkPixmap_info">info</a> | returns <a href="SkImageInfo_Reference#Image_Info">Image Info</a> | | <a href="#SkPixmap_isOpaque">isOpaque</a> | returns true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> describes opaque pixels | @@ -604,7 +604,7 @@ bool isOpaque() const </pre> Returns true if <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>. -Does not check if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> allows <a href="undocumented#Alpha">Alpha</a>, or if any pixel value has +Does not check if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> allows <a href="SkColor_Reference#Alpha">Alpha</a>, or if any pixel value has transparency. ### Return Value @@ -795,15 +795,15 @@ bool computeIsOpaque() const </pre> Returns true if all pixels are opaque. <a href="SkImageInfo_Reference#Color_Type">Color Type</a> determines how pixels -are encoded, and whether pixel describes <a href="undocumented#Alpha">Alpha</a>. Returns true for <a href="SkImageInfo_Reference#Color_Type">Color Types</a> +are encoded, and whether pixel describes <a href="SkColor_Reference#Alpha">Alpha</a>. Returns true for <a href="SkImageInfo_Reference#Color_Type">Color Types</a> without alpha in each pixel; for other <a href="SkImageInfo_Reference#Color_Type">Color Types</a>, returns true if all pixels have alpha values equivalent to 1.0 or greater. For <a href="SkImageInfo_Reference#Color_Type">Color Types</a> <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a> or <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>: always returns true. For <a href="SkImageInfo_Reference#Color_Type">Color Types</a> <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, -<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>: returns true if all pixel <a href="undocumented#Alpha">Alpha</a> values are 255. -For <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>: returns true if all pixel <a href="undocumented#Alpha">Alpha</a> values are 15. -For <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>: returns true if all pixel <a href="undocumented#Alpha">Alpha</a> values are 1.0 or +<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>: returns true if all pixel <a href="SkColor_Reference#Alpha">Alpha</a> values are 255. +For <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>: returns true if all pixel <a href="SkColor_Reference#Alpha">Alpha</a> values are 15. +For <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>: returns true if all pixel <a href="SkColor_Reference#Alpha">Alpha</a> values are 1.0 or greater. Returns false for <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>. @@ -829,7 +829,7 @@ computeIsOpaque: true ### See Also -<a href="#SkPixmap_isOpaque">isOpaque</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="undocumented#Alpha">Alpha</a> +<a href="#SkPixmap_isOpaque">isOpaque</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> <a href="SkColor_Reference#Alpha">Alpha</a> --- @@ -840,16 +840,16 @@ computeIsOpaque: true SkColor getColor(int x, int y) const </pre> -Returns pixel at (<a href="#SkPixmap_getColor_x">x</a>, <a href="#SkPixmap_getColor_y">y</a>) as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>. -Returns black with <a href="undocumented#Alpha">Alpha</a> if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>. +Returns pixel at (<a href="#SkPixmap_getColor_x">x</a>, <a href="#SkPixmap_getColor_y">y</a>) as <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a>. +Returns black with <a href="SkColor_Reference#Alpha">Alpha</a> if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>. Input is not validated: out of bounds values of <a href="#SkPixmap_getColor_x">x</a> or <a href="#SkPixmap_getColor_y">y</a> trigger an assert() if built with SK_DEBUG defined; and returns undefined values or may crash if SK_RELEASE is defined. Fails if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a> or pixel address is nullptr. -<a href="undocumented#Color_Space">Color Space</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> is ignored. Some <a href="undocumented#Color">Color</a> precision may be lost in the -conversion to <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a>; original pixel data may have additional +<a href="undocumented#Color_Space">Color Space</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a> is ignored. Some <a href="SkColor_Reference#Color">Color</a> precision may be lost in the +conversion to <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a>; original pixel data may have additional precision. ### Parameters @@ -863,7 +863,7 @@ row index, zero or greater, and less than <a href="#SkPixmap_height">height</a>< ### Return Value -pixel converted to <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> +pixel converted to <a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> ### Example @@ -1490,7 +1490,7 @@ writable unsigned 16-bit pointer to pixel ### Example <div><fiddle-embed name="6da54774f6432b46b47ea9013c15f280"><div>Draw a five by five bitmap, and draw it again with a center black pixel. -The low nibble of the 16-bit word is <a href="undocumented#Alpha">Alpha</a>. +The low nibble of the 16-bit word is <a href="SkColor_Reference#Alpha">Alpha</a>. </div></fiddle-embed></div> ### See Also @@ -1615,7 +1615,7 @@ is drawn after overwriting bottom half float color with top half float color. | name | description | | --- | --- | -| <a href="#SkPixmap_erase">erase</a> | writes <a href="undocumented#Color">Color</a> to pixels | +| <a href="#SkPixmap_erase">erase</a> | writes <a href="SkColor_Reference#Color">Color</a> to pixels | | | <a href="#SkPixmap_erase">erase(SkColor color, const SkIRect& subset)</a> const | | | <a href="#SkPixmap_erase_2">erase(SkColor color)</a> const | | | <a href="#SkPixmap_erase_3">erase(const SkColor4f& color, const SkIRect* subset = nullptr)</a> const | @@ -1952,7 +1952,7 @@ not intersect <a href="#SkPixmap_bounds">bounds</a>. ### Parameters <table> <tr> <td><a name="SkPixmap_erase_color"> <code><strong>color </strong></code> </a></td> <td> -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> to write</td> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> to write</td> </tr> <tr> <td><a name="SkPixmap_erase_subset"> <code><strong>subset </strong></code> </a></td> <td> bounding integer <a href="SkRect_Reference#Rect">Rect</a> of written pixels</td> </tr> @@ -1985,7 +1985,7 @@ is empty. ### Parameters <table> <tr> <td><a name="SkPixmap_erase_2_color"> <code><strong>color </strong></code> </a></td> <td> -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> to write</td> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> to write</td> </tr> </table> @@ -2017,7 +2017,7 @@ not intersect <a href="#SkPixmap_bounds">bounds</a>, or if <a href="#SkPixmap_er ### Parameters <table> <tr> <td><a name="SkPixmap_erase_3_color"> <code><strong>color </strong></code> </a></td> <td> -<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="undocumented#Color">Color</a> to write</td> +<a href="undocumented#Unpremultiply">Unpremultiplied</a> <a href="SkColor_Reference#Color">Color</a> to write</td> </tr> <tr> <td><a name="SkPixmap_erase_3_subset"> <code><strong>subset </strong></code> </a></td> <td> bounding integer <a href="SkRect_Reference#Rect">Rect</a> of pixels to write; may be nullptr</td> </tr> diff --git a/site/user/api/SkSurface_Reference.md b/site/user/api/SkSurface_Reference.md index 2b312c25cc..a9c6a916d9 100644 --- a/site/user/api/SkSurface_Reference.md +++ b/site/user/api/SkSurface_Reference.md @@ -52,7 +52,6 @@ of the requested dimensions are zero, then nullptr will be returned. | <a href="#SkSurface_getBackendRenderTarget">getBackendRenderTarget</a> | returns the GPU reference to render target | | <a href="#SkSurface_getBackendTexture">getBackendTexture</a> | returns the GPU reference to texture | | <a href="#SkSurface_getCanvas">getCanvas</a> | returns <a href="SkCanvas_Reference#Canvas">Canvas</a> that draws into <a href="#Surface">Surface</a> | -| <a href="#SkSurface_getRenderTargetHandle">getRenderTargetHandle</a> | returns the GPU reference to render target | | <a href="#SkSurface_getTextureHandle">getTextureHandle</a> | returns the GPU reference to texture | | <a href="#SkSurface_height">height</a> | returns pixel row count | | <a href="#SkSurface_makeImageSnapshot">makeImageSnapshot</a> | creates <a href="SkImage_Reference#Image">Image</a> capturing <a href="#Surface">Surface</a> contents | @@ -327,7 +326,7 @@ Internally, sets <a href="SkImageInfo_Reference#Image_Info">Image Info</a> to wi <a href="#Surface">Surface</a> is returned if width and height are greater than zero. -Use to create <a href="#Surface">Surface</a> that matches <a href="undocumented#SkPMColor">SkPMColor</a>, the native pixel arrangement on +Use to create <a href="#Surface">Surface</a> that matches <a href="SkColor_Reference#SkPMColor">SkPMColor</a>, the native pixel arrangement on the platform. <a href="#Surface">Surface</a> drawn to output device skips converting its pixel format. ### Parameters @@ -808,7 +807,6 @@ surf->makeImageSnapshot() == nullptr | <a href="#SkSurface_getBackendRenderTarget">getBackendRenderTarget</a> | returns the GPU reference to render target | | <a href="#SkSurface_getBackendTexture">getBackendTexture</a> | returns the GPU reference to texture | | <a href="#SkSurface_getCanvas">getCanvas</a> | returns <a href="SkCanvas_Reference#Canvas">Canvas</a> that draws into <a href="#Surface">Surface</a> | -| <a href="#SkSurface_getRenderTargetHandle">getRenderTargetHandle</a> | returns the GPU reference to render target | | <a href="#SkSurface_getTextureHandle">getTextureHandle</a> | returns the GPU reference to texture | | <a href="#SkSurface_height">height</a> | returns pixel row count | | <a href="#SkSurface_props">props</a> | returns <a href="undocumented#Surface_Properties">Surface Properties</a> | @@ -1025,7 +1023,7 @@ one of: <a href="#SkSurface_kDiscard_ContentChangeMode">kDiscard ContentChangeMo ### See Also -<a href="#SkSurface_getTextureHandle">getTextureHandle</a> <a href="#SkSurface_getRenderTargetHandle">getRenderTargetHandle</a> +<a href="#SkSurface_getTextureHandle">getTextureHandle</a> @@ -1060,49 +1058,7 @@ GPU texture reference ### See Also -<a href="#SkSurface_getRenderTargetHandle">getRenderTargetHandle</a> <a href="undocumented#GrBackendObject">GrBackendObject</a> <a href="#SkSurface_BackendHandleAccess">BackendHandleAccess</a> - ---- - -<a name="SkSurface_getRenderTargetHandle"></a> -## getRenderTargetHandle - -<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -bool getRenderTargetHandle(GrBackendObject* backendObject, BackendHandleAccess backendHandleAccess) -</pre> - -Returns true and stores the GPU back-end reference of the render target used -by <a href="#Surface">Surface</a> in <a href="#SkSurface_getRenderTargetHandle_backendObject">backendObject</a>. - -Return false if <a href="#Surface">Surface</a> is not backed by a GPU render target, and leaves -<a href="#SkSurface_getRenderTargetHandle_backendObject">backendObject</a> unchanged. - -The returned render target handle is only valid until the next draw into <a href="#Surface">Surface</a>, -or when <a href="#Surface">Surface</a> is deleted. - -In OpenGL this returns the frame buffer object ID. - -### Parameters - -<table> <tr> <td><a name="SkSurface_getRenderTargetHandle_backendObject"> <code><strong>backendObject </strong></code> </a></td> <td> -GPU intermediate memory buffer</td> - </tr> <tr> <td><a name="SkSurface_getRenderTargetHandle_backendHandleAccess"> <code><strong>backendHandleAccess </strong></code> </a></td> <td> -one of: <a href="#SkSurface_kFlushRead_BackendHandleAccess">kFlushRead BackendHandleAccess</a>, -<a href="#SkSurface_kFlushWrite_BackendHandleAccess">kFlushWrite BackendHandleAccess</a>, <a href="#SkSurface_kDiscardWrite_BackendHandleAccess">kDiscardWrite BackendHandleAccess</a></td> - </tr> -</table> - -### Return Value - -true if <a href="#Surface">Surface</a> is backed by GPU texture - -### Example - -<div><fiddle-embed name="dbc6c0e01a177ba03c87c00c32a43148" gpu="true"></fiddle-embed></div> - -### See Also - -<a href="#SkSurface_getTextureHandle">getTextureHandle</a> <a href="undocumented#GrBackendObject">GrBackendObject</a> <a href="#SkSurface_BackendHandleAccess">BackendHandleAccess</a> +<a href="undocumented#GrBackendObject">GrBackendObject</a> <a href="#SkSurface_BackendHandleAccess">BackendHandleAccess</a> --- @@ -1280,7 +1236,7 @@ void draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) Draws <a href="#Surface">Surface</a> contents to <a href="#SkSurface_draw_canvas">canvas</a>, with its top-left corner at (<a href="#SkSurface_draw_x">x</a>, <a href="#SkSurface_draw_y">y</a>). -If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkSurface_draw_paint">paint</a> is not nullptr, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="undocumented#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, +If <a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkSurface_draw_paint">paint</a> is not nullptr, apply <a href="undocumented#Color_Filter">Color Filter</a>, <a href="SkColor_Reference#Alpha">Color Alpha</a>, <a href="undocumented#Image_Filter">Image Filter</a>, <a href="undocumented#Blend_Mode">Blend Mode</a>, and <a href="undocumented#Draw_Looper">Draw Looper</a>. ### Parameters diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm index a731ed91c7..e81a37df5e 100644 --- a/site/user/api/catalog.htm +++ b/site/user/api/catalog.htm @@ -3739,6 +3739,118 @@ "file": "SkPath_Reference", "name": "Path_2" }, + "SK_AlphaOPAQUE": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_AlphaOPAQUE" +}, + "SK_AlphaTRANSPARENT": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_AlphaTRANSPARENT" +}, + "SK_ColorBLACK": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorBLACK" +}, + "SK_ColorBLUE": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorBLUE" +}, + "SK_ColorCYAN": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorCYAN" +}, + "SK_ColorDKGRAY": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorDKGRAY" +}, + "SK_ColorGRAY": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorGRAY" +}, + "SK_ColorGREEN": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorGREEN" +}, + "SK_ColorLTGRAY": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorLTGRAY" +}, + "SK_ColorMAGENTA": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorMAGENTA" +}, + "SK_ColorRED": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorRED" +}, + "SK_ColorTRANSPARENT": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorTRANSPARENT" +}, + "SK_ColorWHITE": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorWHITE" +}, + "SK_ColorYELLOW": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SK_ColorYELLOW" +}, "SkAutoCanvasRestore_SkCanvas_star": { "code": "void draw(SkCanvas* canvas) {\n SkPaint p;\n p.setAntiAlias(true);\n p.setTextSize(64);\n for (SkScalar sx : { -1, 1 } ) {\n for (SkScalar sy : { -1, 1 } ) {\n SkAutoCanvasRestore autoRestore(canvas, true);\n SkMatrix m = SkMatrix::MakeAll(sx, 1, 96, 0, sy, 64, 0, 0, 1);\n canvas->concat(m);\n canvas->drawString(\"R\", 0, 0, p);\n }\n }\n}", "width": 256, @@ -4827,6 +4939,142 @@ "file": "SkCanvas_Reference", "name": "SkCanvas::writePixels_2" }, + "SkColor4f_FromColor": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::FromColor" +}, + "SkColor4f_Pin": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::Pin" +}, + "SkColor4f_equal1_operator": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::operator==(const SkColor4f& other)_const" +}, + "SkColor4f_notequal1_operator": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::operator!=(const SkColor4f& other)_const" +}, + "SkColor4f_pin": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::pin()" +}, + "SkColor4f_premul": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::premul()" +}, + "SkColor4f_toSkColor": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::toSkColor" +}, + "SkColor4f_vec": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::vec()" +}, + "SkColor4f_vec_2": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor4f_Reference", + "name": "SkColor4f::vec_2" +}, + "SkColorGetA": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkColorGetA" +}, + "SkColorGetB": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkColorGetB" +}, + "SkColorGetG": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkColorGetG" +}, + "SkColorGetR": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkColorGetR" +}, + "SkColorSetA": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkColorSetA" +}, + "SkColorSetARGB": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkColorSetARGB" +}, + "SkColorSetRGB": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkColorSetRGB" +}, + "SkColorToHSV": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkColorToHSV" +}, "SkColorTypeBytesPerPixel": { "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = { \"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\" };\n SkPaint paint;\n paint.setTypeface(SkTypeface::MakeFromName(\"monospace\", SkFontStyle()));\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n int y = 15;\n canvas->drawString(\" colorType bytes\", 10, y, paint);\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n int result = SkColorTypeBytesPerPixel(colorType);\n SkString string;\n string.printf(\"%13s %4d\", colors[(int) colorType], result);\n canvas->drawString(string, 10, y += 14, paint);\n }\n}", "width": 256, @@ -4851,6 +5099,22 @@ "file": "SkImageInfo_Reference", "name": "SkColorTypeValidateAlphaType" }, + "SkHSVToColor": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkHSVToColor" +}, + "SkHSVToColor_2": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkHSVToColor_2" +}, "SkIPoint_add_operator": { "code": "void draw(SkCanvas* canvas) {\n auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void {\n for (size_t i = 0; i < count - 1; ++i) {\n SkPoint p0, p1;\n p0.iset(pts[i]);\n p1.iset(pts[i + 1]);\n canvas->drawLine(p0, p1, paint);\n }\n };\n SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } };\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n canvas->scale(30, 15);\n draw_lines(points, SK_ARRAY_COUNT(points), paint);\n SkIPoint mod = {4, 1};\n for (auto& point : points) {\n point = point + mod;\n mod.fX -= 1;\n mod.fY += 1;\n }\n paint.setColor(SK_ColorRED);\n draw_lines(points, SK_ARRAY_COUNT(points), paint);\n}", "width": 256, @@ -6979,6 +7243,30 @@ "file": "SkPoint_Reference", "name": "SkPoint::operator-=(const SkVector& v)" }, + "SkPreMultiplyARGB": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkPreMultiplyARGB" +}, + "SkPreMultiplyColor": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkPreMultiplyColor" +}, + "SkRGBToHSV": { + "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "width": 256, + "height": 256, + "hash": "882e8e0103048009a25cfc20400492f7", + "file": "SkColor_Reference", + "name": "SkRGBToHSV" +}, "SkSurface_BackendHandleAccess": { "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n int y = 20;\n SkString str;\n paint.setTextSize(16);\n for (auto access : { SkSurface::kFlushRead_BackendHandleAccess, \n SkSurface::kFlushWrite_BackendHandleAccess,\n SkSurface::kDiscardWrite_BackendHandleAccess } ) {\n sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());\n str.printf(\"uniqueID=%d\", image->uniqueID());\n canvas->drawString(str, 20, y += 20, paint);\n GrBackendObject backendObject = gpuSurface->getTextureHandle(access);\n str.printf(\"backendObject %c= 0\", backendObject != 0 ? '!' : '=');\n canvas->drawString(str, 20, y += 20, paint);\n }\n sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());\n str.printf(\"final image uniqueID=%d\", image->uniqueID());\n canvas->drawString(str, 20, y += 20, paint);\n}", "width": 256, @@ -7059,14 +7347,6 @@ "file": "SkSurface_Reference", "name": "SkSurface::getCanvas" }, - "SkSurface_getRenderTargetHandle": { - "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n GrBackendObject backendObject;\n if (gpuSurface->getRenderTargetHandle(&backendObject, \n SkSurface::kFlushRead_BackendHandleAccess)) {\n SkString str;\n str.printf(\"backendObject=%ld\", backendObject);\n paint.setTextSize(16);\n canvas->drawString(str, 20, 40, paint);\n }\n}", - "width": 256, - "height": 64, - "hash": "dbc6c0e01a177ba03c87c00c32a43148", - "file": "SkSurface_Reference", - "name": "SkSurface::getRenderTargetHandle" -}, "SkSurface_getTextureHandle": { "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n GrBackendObject backendObject = gpuSurface->getTextureHandle(\n SkSurface::kFlushRead_BackendHandleAccess);\n if (backendObject) {\n SkString str;\n str.printf(\"backendObject=%08lx\", backendObject);\n paint.setTextSize(16);\n canvas->drawString(str, 20, 40, paint);\n }\n}", "width": 256, diff --git a/site/user/api/undocumented.md b/site/user/api/undocumented.md index 4f1da9b830..95846019b0 100644 --- a/site/user/api/undocumented.md +++ b/site/user/api/undocumented.md @@ -52,103 +52,6 @@ undocumented -# <a name="Color"></a> Color - -<a name="SkColorGetA"></a> -## SkColorGetA - -<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -int SkColorGetA(color) -</pre> - ---- - -<a name="SkColorGetR"></a> -## SkColorGetR - -<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -int SkColorGetR(color) -</pre> - ---- - -<a name="SkColorGetG"></a> -## SkColorGetG - -<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -int SkColorGetG(color) -</pre> - ---- - -<a name="SkColorGetB"></a> -## SkColorGetB - -<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -int SkColorGetB(color) -</pre> - ---- - -<a name="SkColorSetARGB"></a> -## SkColorSetARGB - -<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -int SkColorSetARGB(a, r, g, b) -</pre> - ---- - -<a name="SkPreMultiplyARGB"></a> -## SkPreMultiplyARGB - -<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> -SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) -</pre> - ---- - -### Constants - -<table> - <tr> - <td><a name="SK_ColorBLACK"> <code><strong>SK_ColorBLACK </strong></code> </a></td><td>0xFF000000 </td><td></td> - </tr> - <tr> - <td><a name="SK_ColorBLUE"> <code><strong>SK_ColorBLUE </strong></code> </a></td><td>0xFF0000FF </td><td></td> - </tr> - <tr> - <td><a name="SK_ColorGREEN"> <code><strong>SK_ColorGREEN </strong></code> </a></td><td>0xFF00FF00 </td><td></td> - </tr> - <tr> - <td><a name="SK_ColorRED"> <code><strong>SK_ColorRED </strong></code> </a></td><td>0xFFFF0000 </td><td></td> - </tr> - <tr> - <td><a name="SK_ColorWHITE"> <code><strong>SK_ColorWHITE </strong></code> </a></td><td>0xFFFFFFFF </td><td></td> - </tr> - <tr> - <td><a name="SK_ColorTRANSPARENT"> <code><strong>SK_ColorTRANSPARENT </strong></code> </a></td><td>0x00000000</td><td></td> - </tr> -</table> - -## <a name="Alpha"></a> Alpha - -## <a name="RGB"></a> RGB - -## <a name="RGB_Red"></a> RGB Red - -## <a name="RGB_Blue"></a> RGB Blue - -## <a name="RGB_Green"></a> RGB Green - -## <a name="ARGB"></a> ARGB - -## <a name="RBG"></a> RBG - -## <a name="RGB-565"></a> RGB-565 - -## <a name="Gray"></a> Gray - # <a name="Color_Filter"></a> Color Filter # <a name="SkColorFilter"></a> Class SkColorFilter diff --git a/tools/bookmaker/bookmaker.cpp b/tools/bookmaker/bookmaker.cpp index 223c5b521a..49e347e6ea 100644 --- a/tools/bookmaker/bookmaker.cpp +++ b/tools/bookmaker/bookmaker.cpp @@ -64,6 +64,112 @@ see head of selfCheck.cpp for additional todos parameters may be reused in other methods */ +#define M(mt) (1LL << (int) MarkType::k##mt) +#define M_D M(Description) +#define M_CS M(Class) | M(Struct) +#define M_ST M(Subtopic) | M(Topic) +#define M_CSST M_CS | M_ST +#ifdef M_E +#undef M_E +#endif +#define M_E M(Enum) | M(EnumClass) + +#define R_Y Resolvable::kYes +#define R_N Resolvable::kNo +#define R_O Resolvable::kOut +#define R_F Resolvable::kFormula +#define R_C Resolvable::kClone + +#define E_Y Exemplary::kYes +#define E_N Exemplary::kNo +#define E_O Exemplary::kOptional + +BmhParser::MarkProps BmhParser::kMarkProps[] = { +// names without formal definitions (e.g. Column) aren't included +// fill in other names once they're actually used + { "", MarkType::kNone, R_Y, E_N, 0 } +, { "A", MarkType::kAnchor, R_N, E_N, 0 } +, { "Alias", MarkType::kAlias, R_N, E_N, 0 } +, { "Bug", MarkType::kBug, R_N, E_N, 0 } +, { "Class", MarkType::kClass, R_Y, E_O, M_CSST | M(Root) } +, { "Code", MarkType::kCode, R_F, E_N, M_CSST | M_E | M(Method) | M(Define) | M(Typedef) } +, { "", MarkType::kColumn, R_Y, E_N, M(Row) } +, { "", MarkType::kComment, R_N, E_N, 0 } +, { "Const", MarkType::kConst, R_Y, E_O, M_E | M_ST } +, { "Define", MarkType::kDefine, R_O, E_Y, M_ST } +, { "DefinedBy", MarkType::kDefinedBy, R_N, E_N, M(Method) } +, { "Deprecated", MarkType::kDeprecated, R_Y, E_N, 0 } +, { "Description", MarkType::kDescription, R_Y, E_N, M(Example) | M(NoExample) } +, { "Doxygen", MarkType::kDoxygen, R_Y, E_N, 0 } +, { "Duration", MarkType::kDuration, R_N, E_N, M(Example) | M(NoExample) } +, { "Enum", MarkType::kEnum, R_Y, E_O, M_CSST | M(Root) } +, { "EnumClass", MarkType::kEnumClass, R_Y, E_O, M_CSST | M(Root) } +, { "Example", MarkType::kExample, R_O, E_N, M_CSST | M_E | M(Method) | M(Const) | M(Define) } +, { "Experimental", MarkType::kExperimental, R_Y, E_N, 0 } +, { "External", MarkType::kExternal, R_Y, E_N, M(Root) } +, { "File", MarkType::kFile, R_N, E_N, M(Track) } +, { "Formula", MarkType::kFormula, R_F, E_N, + M(Column) | M_E | M_ST | M(Member) | M(Method) | M_D } +, { "Function", MarkType::kFunction, R_O, E_N, M(Example) | M(NoExample) } +, { "Height", MarkType::kHeight, R_N, E_N, M(Example) | M(NoExample) } +, { "Illustration", MarkType::kIllustration, R_N, E_N, M(Subtopic) } +, { "Image", MarkType::kImage, R_N, E_N, M(Example) | M(NoExample) } +, { "In", MarkType::kIn, R_N, E_N, M_CSST | M_E | M(Method) | M(Typedef) } +, { "Legend", MarkType::kLegend, R_Y, E_N, M(Table) } +, { "Line", MarkType::kLine, R_N, E_N, M_CSST | M_E | M(Method) | M(Typedef) } +, { "", MarkType::kLink, R_N, E_N, M(Anchor) } +, { "List", MarkType::kList, R_Y, E_N, M(Method) | M_CSST | M_E | M_D } +, { "Literal", MarkType::kLiteral, R_N, E_N, M(Code) } +, { "", MarkType::kMarkChar, R_N, E_N, 0 } +, { "Member", MarkType::kMember, R_Y, E_N, M_CSST } +, { "Method", MarkType::kMethod, R_Y, E_Y, M_CSST } +, { "NoExample", MarkType::kNoExample, R_N, E_N, M_CSST | M_E | M(Method) | M(Const) | M(Define) } +, { "Outdent", MarkType::kOutdent, R_N, E_N, M(Code) } +, { "Param", MarkType::kParam, R_Y, E_N, M(Method) | M(Define) } +, { "PhraseDef", MarkType::kPhraseDef, R_Y, E_N, M(Subtopic) } +, { "", MarkType::kPhraseRef, R_Y, E_N, 0 } +, { "Platform", MarkType::kPlatform, R_N, E_N, M(Example) | M(NoExample) } +, { "Populate", MarkType::kPopulate, R_N, E_N, M(Subtopic) } +, { "Private", MarkType::kPrivate, R_N, E_N, 0 } +, { "Return", MarkType::kReturn, R_Y, E_N, M(Method) } +, { "", MarkType::kRoot, R_Y, E_N, 0 } +, { "", MarkType::kRow, R_Y, E_N, M(Table) | M(List) } +, { "SeeAlso", MarkType::kSeeAlso, R_C, E_N, M_CSST | M_E | M(Method) | M(Define) | M(Typedef) } +, { "Set", MarkType::kSet, R_N, E_N, M(Example) | M(NoExample) } +, { "StdOut", MarkType::kStdOut, R_N, E_N, M(Example) | M(NoExample) } +, { "Struct", MarkType::kStruct, R_Y, E_O, M(Class) | M(Root) | M_ST } +, { "Substitute", MarkType::kSubstitute, R_N, E_N, M_ST } +, { "Subtopic", MarkType::kSubtopic, R_Y, E_Y, M_CSST } +, { "Table", MarkType::kTable, R_Y, E_N, M(Method) | M_CSST | M_E } +, { "Template", MarkType::kTemplate, R_Y, E_N, 0 } +, { "", MarkType::kText, R_N, E_N, 0 } +, { "Time", MarkType::kTime, R_Y, E_N, M(Track) } +, { "ToDo", MarkType::kToDo, R_N, E_N, 0 } +, { "Topic", MarkType::kTopic, R_Y, E_Y, M_CS | M(Root) | M(Topic) } +, { "Track", MarkType::kTrack, R_Y, E_N, M_E | M_ST } +, { "Typedef", MarkType::kTypedef, R_Y, E_N, M(Class) | M_ST } +, { "", MarkType::kUnion, R_Y, E_N, 0 } +, { "Volatile", MarkType::kVolatile, R_N, E_N, M(StdOut) } +, { "Width", MarkType::kWidth, R_N, E_N, M(Example) | M(NoExample) } +}; + +#undef R_O +#undef R_N +#undef R_Y +#undef R_F +#undef R_C + +#undef M_E +#undef M_CSST +#undef M_ST +#undef M_CS +#undef M_D +#undef M + +#undef E_Y +#undef E_N +#undef E_O + bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markType, const vector<string>& typeNameBuilder, HasTag hasTag) { Definition* definition = nullptr; @@ -77,6 +183,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy case MarkType::kClass: case MarkType::kStruct: case MarkType::kConst: + case MarkType::kDefine: case MarkType::kEnum: case MarkType::kEnumClass: case MarkType::kMember: @@ -88,7 +195,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy if (typeNameBuilder.size() > 1) { return this->reportError<bool>("expected one name only"); } - const string& name = typeNameBuilder[0]; + string name = typeNameBuilder[0]; if (nullptr == fRoot) { fRoot = this->findBmhObject(markType, name); fRoot->fFileName = fFileName; @@ -134,8 +241,8 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy || MarkType::kExperimental == child->fMarkType || MarkType::kNoExample == child->fMarkType; } - if (fMaps[(int) markType].fExemplary != hasExample - && fMaps[(int) markType].fExemplary != Exemplary::kOptional) { + if (kMarkProps[(int) markType].fExemplary != hasExample + && kMarkProps[(int) markType].fExemplary != Exemplary::kOptional) { if (string::npos == fFileName.find("undocumented") && !hasExcluder) { hasExample == Exemplary::kNo ? @@ -394,7 +501,6 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy case MarkType::kAlias: case MarkType::kAnchor: case MarkType::kBug: - case MarkType::kDefine: case MarkType::kDeprecated: case MarkType::kDuration: case MarkType::kFile: @@ -445,7 +551,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy } else if (MarkType::kAlias == markType) { this->skipWhiteSpace(); const char* start = fChar; - this->skipToNonAlphaNum(); + this->skipToNonName(); string alias(start, fChar - start); if (fAliasMap.end() != fAliasMap.find(alias)) { return this->reportError<bool>("duplicate alias"); @@ -493,7 +599,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy return true; } -void BmhParser::reportDuplicates(const Definition& def, const string& dup) const { +void BmhParser::reportDuplicates(const Definition& def, string dup) const { if (MarkType::kExample == def.fMarkType && dup == def.fFiddle) { TextParser reporter(&def); reporter.reportError("duplicate example name"); @@ -546,14 +652,14 @@ bool BmhParser::checkEndMarker(MarkType markType, string match) const { return this->reportError<bool>("mismatched end marker expect #"); } const char* nameStart = tp.fChar; - tp.skipToNonAlphaNum(); + tp.skipToNonName(); string markName(nameStart, tp.fChar - nameStart); - if (fMaps[(int) markType].fName != markName) { + if (kMarkProps[(int) markType].fName != markName) { return this->reportError<bool>("expected #XXX ## to match"); } tp.skipSpace(); nameStart = tp.fChar; - tp.skipToNonAlphaNum(); + tp.skipToNonName(); markName = string(nameStart, tp.fChar - nameStart); if ("" == markName) { if (fMC != tp.next() || fMC != tp.next()) { @@ -619,7 +725,7 @@ bool BmhParser::checkParamReturn(const Definition* definition) const { bool BmhParser::childOf(MarkType markType) const { auto childError = [this](MarkType markType) -> bool { string errStr = "expected "; - errStr += fMaps[(int) markType].fName; + errStr += kMarkProps[(int) markType].fName; errStr += " parent"; return this->reportError<bool>(errStr.c_str()); }; @@ -645,7 +751,7 @@ string BmhParser::className(MarkType markType) { TextParserSave savePlace(this); this->skipSpace(); const char* wordStart = fChar; - this->skipToNonAlphaNum(); + this->skipToNonName(); const char* wordEnd = fChar; classID = string(wordStart, wordEnd - wordStart); if (!mc) { @@ -705,14 +811,14 @@ bool BmhParser::collectExternals() { this->skipLine(); continue; } - if (this->startsWith(fMaps[(int) MarkType::kExternal].fName)) { - this->skipToNonAlphaNum(); + if (this->startsWith(kMarkProps[(int) MarkType::kExternal].fName)) { + this->skipToNonName(); continue; } } this->skipToAlpha(); const char* wordStart = fChar; - this->skipToNonAlphaNum(); + this->skipToNonName(); if (fChar - wordStart > 0) { fExternals.emplace_front(MarkType::kExternal, wordStart, fChar, fLineCount, fParent, fMC); @@ -792,7 +898,7 @@ bool BmhParser::endTableColumn(const char* end, const char* terminator) { return true; } -static size_t count_indent(const string& text, size_t test, size_t end) { +static size_t count_indent(string text, size_t test, size_t end) { size_t result = test; while (test < end) { if (' ' != text[test]) { @@ -803,7 +909,7 @@ static size_t count_indent(const string& text, size_t test, size_t end) { return test - result; } -static void add_code(const string& text, int pos, int end, +static void add_code(string text, int pos, int end, size_t outIndent, size_t textIndent, string& example) { do { // fix this to move whole paragraph in, out, but preserve doc indent @@ -935,9 +1041,8 @@ bool BmhParser::exampleToScript(Definition* def, ExampleOptions exampleOptions, code += "}"; } string example = "\"" + normalizedName + "\": {\n"; - size_t nameStart = def->fFileName.find(SkOSPath::SEPARATOR, 0); - SkASSERT(string::npos != nameStart); - string baseFile = def->fFileName.substr(nameStart + 1, def->fFileName.length() - nameStart - 5); + string filename = def->fileName(); + string baseFile = filename.substr(0, filename.length() - 4); if (ExampleOptions::kText == exampleOptions) { example += " \"code\": \"" + code + "\",\n"; example += " \"hash\": \"" + def->fHash + "\",\n"; @@ -1107,12 +1212,12 @@ bool BmhParser::findDefinitions() { bool hasEnd = this->hasEndToken(); if (!hasEnd) { MarkType parentType = fParent ? fParent->fMarkType : MarkType::kRoot; - uint64_t parentMask = fMaps[(int) markType].fParentMask; + uint64_t parentMask = kMarkProps[(int) markType].fParentMask; if (parentMask && !(parentMask & (1LL << (int) parentType))) { return this->reportError<bool>("invalid parent"); } } - if (!this->skipName(fMaps[(int) markType].fName)) { + if (!this->skipName(kMarkProps[(int) markType].fName)) { return this->reportError<bool>("illegal markup character"); } if (!this->skipSpace()) { @@ -1226,14 +1331,14 @@ bool BmhParser::findDefinitions() { MarkType BmhParser::getMarkType(MarkLookup lookup) const { for (int index = 0; index <= Last_MarkType; ++index) { - int typeLen = strlen(fMaps[index].fName); + int typeLen = strlen(kMarkProps[index].fName); if (typeLen == 0) { continue; } if (fChar + typeLen >= fEnd || fChar[typeLen] > ' ') { continue; } - int chCompare = strncmp(fChar, fMaps[index].fName, typeLen); + int chCompare = strncmp(fChar, kMarkProps[index].fName, typeLen); if (chCompare < 0) { goto fail; } @@ -1489,7 +1594,7 @@ string BmhParser::memberName() { do { this->skipSpace(); wordStart = fChar; - this->skipToNonAlphaNum(); + this->skipToNonName(); } while (this->anyOf(wordStart, prefixes, SK_ARRAY_COUNT(prefixes))); if ('*' == this->peek()) { this->next(); @@ -1631,7 +1736,7 @@ const char* BmhParser::checkForFullTerminal(const char* end, const Definition* d if (parser.eof() || fMC != parser.next()) { return end; } - const char* markName = fMaps[(int) definition->fMarkType].fName; + const char* markName = kMarkProps[(int) definition->fMarkType].fName; if (!parser.skipExact(markName)) { return end; } @@ -1929,6 +2034,7 @@ vector<string> BmhParser::typeName(MarkType markType, bool* checkEnd) { builder = fParent->fName; } switch (markType) { + case MarkType::kDefine: case MarkType::kEnum: // enums may be nameless case MarkType::kConst: @@ -1963,7 +2069,6 @@ vector<string> BmhParser::typeName(MarkType markType, bool* checkEnd) { case MarkType::kAlias: case MarkType::kAnchor: case MarkType::kBug: // fixme: expect number - case MarkType::kDefine: case MarkType::kDefinedBy: case MarkType::kDeprecated: case MarkType::kDuration: @@ -2046,7 +2151,7 @@ string BmhParser::typedefName() { return uniqueRootName(builder, MarkType::kTypedef); } -string BmhParser::uniqueName(const string& base, MarkType markType) { +string BmhParser::uniqueName(string base, MarkType markType) { string builder(base); if (!builder.length()) { builder = fParent->fName; @@ -2076,8 +2181,8 @@ tryNext: ; return numBuilder; } -string BmhParser::uniqueRootName(const string& base, MarkType markType) { - auto checkName = [markType](const Definition& def, const string& numBuilder) -> bool { +string BmhParser::uniqueRootName(string base, MarkType markType) { + auto checkName = [markType](const Definition& def, string numBuilder) -> bool { return markType == def.fMarkType && def.fName == numBuilder; }; @@ -2132,11 +2237,11 @@ tryNext: ; void BmhParser::validate() const { for (int index = 0; index <= (int) Last_MarkType; ++index) { - SkASSERT(fMaps[index].fMarkType == (MarkType) index); + SkASSERT(kMarkProps[index].fMarkType == (MarkType) index); } const char* last = ""; for (int index = 0; index <= (int) Last_MarkType; ++index) { - const char* next = fMaps[index].fName; + const char* next = kMarkProps[index].fName; if (!last[0]) { last = next; continue; @@ -2149,7 +2254,7 @@ void BmhParser::validate() const { } } -string BmhParser::word(const string& prefix, const string& delimiter) { +string BmhParser::word(string prefix, string delimiter) { string builder(prefix); this->skipWhiteSpace(); const char* lineEnd = fLine + this->lineLength(); @@ -2338,7 +2443,7 @@ int main(int argc, char** const argv) { } if (FLAGS_tokens) { includeParser.fDebugOut = FLAGS_stdout; - if (includeParser.dumpTokens(FLAGS_bmh[0])) { + if (includeParser.dumpTokens()) { bmhParser.fWroteOut = true; } done = true; diff --git a/tools/bookmaker/bookmaker.h b/tools/bookmaker/bookmaker.h index bbec6d6266..62f2faa34b 100644 --- a/tools/bookmaker/bookmaker.h +++ b/tools/bookmaker/bookmaker.h @@ -198,7 +198,7 @@ struct IncludeKey { extern const IncludeKey kKeyWords[]; -static inline bool has_nonwhitespace(const string& s) { +static inline bool has_nonwhitespace(string s) { bool nonwhite = false; for (const char& c : s) { if (' ' < c) { @@ -246,7 +246,7 @@ class TextParser : public NonAssignable { public: virtual ~TextParser() {} - TextParser(const string& fileName, const char* start, const char* end, int lineCount) + TextParser(string fileName, const char* start, const char* end, int lineCount) : fFileName(fileName) , fStart(start) , fLine(start) @@ -477,6 +477,12 @@ public: } void skipToNonAlphaNum() { + while (fChar < fEnd && (isalnum(fChar[0]) || '_' == fChar[0])) { + fChar++; + } + } + + void skipToNonName() { while (fChar < fEnd && (isalnum(fChar[0]) || '_' == fChar[0] || '-' == fChar[0] || (':' == fChar[0] && fChar + 1 < fEnd && ':' == fChar[1]) @@ -840,8 +846,7 @@ public: virtual RootDefinition* asRoot() { SkASSERT(0); return nullptr; } virtual const RootDefinition* asRoot() const { SkASSERT(0); return nullptr; } - bool boilerplateIfDef(Definition* parent); - bool boilerplateDef(Definition* parent); + bool boilerplateIfDef(); bool boilerplateEndIf() { return true; @@ -864,11 +869,12 @@ public: } string fiddleName() const; + string fileName() const; const Definition* findClone(string match) const; string formatFunction(Format format) const; const Definition* hasChild(MarkType markType) const; - bool hasMatch(const string& name) const; - const Definition* hasParam(const string& ref) const; + bool hasMatch(string name) const; + const Definition* hasParam(string ref) const; bool isClone() const { return fClone; } Definition* iRootParent() { @@ -889,12 +895,12 @@ public: return (int) (fContentEnd - fContentStart); } - bool methodHasReturn(const string& name, TextParser* methodParser) const; + bool methodHasReturn(string name, TextParser* methodParser) const; string methodName() const; bool nextMethodParam(TextParser* methodParser, const char** nextEndPtr, string* paramName) const; static string NormalizedName(string name); - bool paramsMatch(const string& fullRef, const string& name) const; + bool paramsMatch(string fullRef, string name) const; bool parseOperator(size_t doubleColons, string& result); string printableName() const { @@ -991,7 +997,7 @@ public: const RootDefinition* asRoot() const override { return this; } void clearVisited(); bool dumpUnVisited(); - const Definition* find(const string& ref, AllowParens ) const; + const Definition* find(string ref, AllowParens ) const; bool isRoot() const override { return true; } RootDefinition* rootParent() override { return fRootParent; } const RootDefinition* rootParent() const override { return fRootParent; } @@ -1004,6 +1010,7 @@ private: }; struct IClassDefinition : public Definition { + unordered_map<string, Definition*> fDefines; unordered_map<string, Definition*> fEnums; unordered_map<string, Definition*> fMembers; unordered_map<string, Definition*> fMethods; @@ -1135,6 +1142,13 @@ public: } void writeBlockIndent(int size, const char* data); + + void writeBlockSeparator() { + this->writeString( + "# ------------------------------------------------------------------------------"); + this->lf(2); + } + bool writeBlockTrim(int size, const char* data); void writeCommentHeader() { @@ -1162,7 +1176,7 @@ public: void writeString(const char* str); - void writeString(const string& str) { + void writeString(string str) { this->writeString(str.c_str()); } @@ -1253,120 +1267,76 @@ public: kYes }; -#define M(mt) (1LL << (int) MarkType::k##mt) -#define M_D M(Description) -#define M_CS M(Class) | M(Struct) -#define M_ST M(Subtopic) | M(Topic) -#define M_CSST M_CS | M_ST -#ifdef M_E -#undef M_E -#endif -#define M_E M(Enum) | M(EnumClass) - -#define R_Y Resolvable::kYes -#define R_N Resolvable::kNo -#define R_O Resolvable::kOut -#define R_F Resolvable::kFormula -#define R_C Resolvable::kClone - -#define E_Y Exemplary::kYes -#define E_N Exemplary::kNo -#define E_O Exemplary::kOptional - BmhParser(bool skip) : ParserCommon() , fMaps { -// names without formal definitions (e.g. Column) aren't included -// fill in other names once they're actually used - { "", nullptr, MarkType::kNone, R_Y, E_N, 0 } -, { "A", nullptr, MarkType::kAnchor, R_N, E_N, 0 } -, { "Alias", nullptr, MarkType::kAlias, R_N, E_N, 0 } -, { "Bug", nullptr, MarkType::kBug, R_N, E_N, 0 } -, { "Class", &fClassMap, MarkType::kClass, R_Y, E_O, M_CSST | M(Root) } -, { "Code", nullptr, MarkType::kCode, R_O, E_N, M_CSST | M_E | M(Method) } -, { "", nullptr, MarkType::kColumn, R_Y, E_N, M(Row) } -, { "", nullptr, MarkType::kComment, R_N, E_N, 0 } -, { "Const", &fConstMap, MarkType::kConst, R_Y, E_O, M_E | M_ST } -, { "Define", nullptr, MarkType::kDefine, R_O, E_N, M_ST } -, { "DefinedBy", nullptr, MarkType::kDefinedBy, R_N, E_N, M(Method) } -, { "Deprecated", nullptr, MarkType::kDeprecated, R_Y, E_N, 0 } -, { "Description", nullptr, MarkType::kDescription, R_Y, E_N, M(Example) | M(NoExample) } -, { "Doxygen", nullptr, MarkType::kDoxygen, R_Y, E_N, 0 } -, { "Duration", nullptr, MarkType::kDuration, R_N, E_N, M(Example) | M(NoExample) } -, { "Enum", &fEnumMap, MarkType::kEnum, R_Y, E_O, M_CSST | M(Root) } -, { "EnumClass", &fClassMap, MarkType::kEnumClass, R_Y, E_O, M_CSST | M(Root) } -, { "Example", nullptr, MarkType::kExample, - R_O, E_N, M_CSST | M_E | M(Method) | M(Const) } -, { "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_F, E_N, - M(Column) | M_E | M_ST | M(Member) | M(Method) | M_D } -, { "Function", nullptr, MarkType::kFunction, R_O, E_N, M(Example) | M(NoExample) } -, { "Height", nullptr, MarkType::kHeight, R_N, E_N, M(Example) | M(NoExample) } -, { "Illustration", nullptr, MarkType::kIllustration, R_N, E_N, M(Subtopic) } -, { "Image", nullptr, MarkType::kImage, R_N, E_N, M(Example) | M(NoExample) } -, { "In", nullptr, MarkType::kIn, R_N, E_N, - M_CSST | M_E | M(Method) | M(Typedef) } -, { "Legend", nullptr, MarkType::kLegend, R_Y, E_N, M(Table) } -, { "Line", nullptr, MarkType::kLine, R_N, E_N, - M_CSST | M_E | M(Method) | M(Typedef) } -, { "", nullptr, MarkType::kLink, R_N, E_N, M(Anchor) } -, { "List", nullptr, MarkType::kList, R_Y, E_N, M(Method) | M_CSST | M_E | M_D } -, { "Literal", nullptr, MarkType::kLiteral, R_N, E_N, M(Code) } -, { "", nullptr, MarkType::kMarkChar, R_N, E_N, 0 } -, { "Member", nullptr, MarkType::kMember, R_Y, E_N, M_CSST } -, { "Method", &fMethodMap, MarkType::kMethod, R_Y, E_Y, M_CSST } -, { "NoExample", nullptr, MarkType::kNoExample, R_N, E_N, M_CSST | M_E | M(Method) } -, { "Outdent", nullptr, MarkType::kOutdent, R_N, E_N, M(Code) } -, { "Param", nullptr, MarkType::kParam, R_Y, E_N, M(Method) } -, { "PhraseDef", nullptr, MarkType::kPhraseDef, R_Y, E_N, M(Subtopic) } -, { "", nullptr, MarkType::kPhraseRef, R_Y, E_N, 0 } -, { "Platform", nullptr, MarkType::kPlatform, R_N, E_N, M(Example) | M(NoExample) } -, { "Populate", nullptr, MarkType::kPopulate, R_N, E_N, M(Subtopic) } -, { "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 } -, { "", nullptr, MarkType::kRow, R_Y, E_N, M(Table) | M(List) } -, { "SeeAlso", nullptr, MarkType::kSeeAlso, R_C, E_N, - M_CSST | M_E | M(Method) | M(Typedef) } -, { "Set", nullptr, MarkType::kSet, R_N, E_N, M(Example) | M(NoExample) } -, { "StdOut", nullptr, MarkType::kStdOut, R_N, E_N, M(Example) | M(NoExample) } -, { "Struct", &fClassMap, MarkType::kStruct, R_Y, E_O, M(Class) | M(Root) | M_ST } -, { "Substitute", nullptr, MarkType::kSubstitute, R_N, E_N, M_ST } -, { "Subtopic", nullptr, MarkType::kSubtopic, R_Y, E_Y, M_CSST } -, { "Table", nullptr, MarkType::kTable, R_Y, E_N, M(Method) | M_CSST | M_E } -, { "Template", nullptr, MarkType::kTemplate, R_Y, E_N, 0 } -, { "", nullptr, MarkType::kText, R_N, E_N, 0 } -, { "Time", nullptr, MarkType::kTime, R_Y, E_N, M(Track) } -, { "ToDo", nullptr, MarkType::kToDo, R_N, E_N, 0 } -, { "Topic", nullptr, MarkType::kTopic, R_Y, E_Y, M_CS | M(Root) | M(Topic) } -, { "Track", nullptr, MarkType::kTrack, R_Y, E_N, M_E | M_ST } -, { "Typedef", &fTypedefMap, MarkType::kTypedef, R_Y, E_N, M(Class) | M_ST } -, { "", nullptr, MarkType::kUnion, R_Y, E_N, 0 } -, { "Volatile", nullptr, MarkType::kVolatile, R_N, E_N, M(StdOut) } -, { "Width", nullptr, MarkType::kWidth, R_N, E_N, M(Example) | M(NoExample) } } -, fSkip(skip) - { + { nullptr, MarkType::kNone } + , { nullptr, MarkType::kAnchor } + , { nullptr, MarkType::kAlias } + , { nullptr, MarkType::kBug } + , { &fClassMap, MarkType::kClass } + , { nullptr, MarkType::kCode } + , { nullptr, MarkType::kColumn } + , { nullptr, MarkType::kComment } + , { &fConstMap, MarkType::kConst } + , { &fDefineMap, MarkType::kDefine } + , { nullptr, MarkType::kDefinedBy } + , { nullptr, MarkType::kDeprecated } + , { nullptr, MarkType::kDescription } + , { nullptr, MarkType::kDoxygen } + , { nullptr, MarkType::kDuration } + , { &fEnumMap, MarkType::kEnum } + , { &fClassMap, MarkType::kEnumClass } + , { nullptr, MarkType::kExample } + , { nullptr, MarkType::kExperimental } + , { nullptr, MarkType::kExternal } + , { nullptr, MarkType::kFile } + , { nullptr, MarkType::kFormula } + , { nullptr, MarkType::kFunction } + , { nullptr, MarkType::kHeight } + , { nullptr, MarkType::kIllustration } + , { nullptr, MarkType::kImage } + , { nullptr, MarkType::kIn } + , { nullptr, MarkType::kLegend } + , { nullptr, MarkType::kLine } + , { nullptr, MarkType::kLink } + , { nullptr, MarkType::kList } + , { nullptr, MarkType::kLiteral } + , { nullptr, MarkType::kMarkChar } + , { nullptr, MarkType::kMember } + , { &fMethodMap, MarkType::kMethod } + , { nullptr, MarkType::kNoExample } + , { nullptr, MarkType::kOutdent } + , { nullptr, MarkType::kParam } + , { nullptr, MarkType::kPhraseDef } + , { nullptr, MarkType::kPhraseRef } + , { nullptr, MarkType::kPlatform } + , { nullptr, MarkType::kPopulate } + , { nullptr, MarkType::kPrivate } + , { nullptr, MarkType::kReturn } + , { nullptr, MarkType::kRoot } + , { nullptr, MarkType::kRow } + , { nullptr, MarkType::kSeeAlso } + , { nullptr, MarkType::kSet } + , { nullptr, MarkType::kStdOut } + , { &fClassMap, MarkType::kStruct } + , { nullptr, MarkType::kSubstitute } + , { nullptr, MarkType::kSubtopic } + , { nullptr, MarkType::kTable } + , { nullptr, MarkType::kTemplate } + , { nullptr, MarkType::kText } + , { nullptr, MarkType::kTime } + , { nullptr, MarkType::kToDo } + , { nullptr, MarkType::kTopic } + , { nullptr, MarkType::kTrack } + , { &fTypedefMap, MarkType::kTypedef } + , { nullptr, MarkType::kUnion } + , { nullptr, MarkType::kVolatile } + , { nullptr, MarkType::kWidth } + } + , fSkip(skip) { this->reset(); } -#undef R_O -#undef R_N -#undef R_Y -#undef R_F -#undef R_C - -#undef M_E -#undef M_CSST -#undef M_ST -#undef M_CS -#undef M_D -#undef M - -#undef E_Y -#undef E_N -#undef E_O - ~BmhParser() override {} bool addDefinition(const char* defStart, bool hasEnd, MarkType markType, @@ -1385,8 +1355,8 @@ public: bool exampleToScript(Definition*, ExampleOptions, string* result ) const; string extractText(const Definition* , TrimExtract ) const; - RootDefinition* findBmhObject(MarkType markType, const string& typeName) const { - auto map = fMaps[(int) markType].fBmh; + RootDefinition* findBmhObject(MarkType markType, string typeName) const { + auto map = fMaps[(int) markType].fMap; if (!map) { return nullptr; } @@ -1410,7 +1380,7 @@ public: } bool popParentStack(Definition* definition); - void reportDuplicates(const Definition& def, const string& dup) const; + void reportDuplicates(const Definition& def, string dup) const; void reset() override { INHERITED::resetCommon(); @@ -1436,28 +1406,35 @@ public: vector<string> topicName(); vector<string> typeName(MarkType markType, bool* expectEnd); string typedefName() override; - string uniqueName(const string& base, MarkType markType); - string uniqueRootName(const string& base, MarkType markType); + string uniqueName(string base, MarkType markType); + string uniqueRootName(string base, MarkType markType); void validate() const; - string word(const string& prefix, const string& delimiter); + string word(string prefix, string delimiter); public: - struct DefinitionMap { + struct MarkProps { const char* fName; - unordered_map<string, RootDefinition>* fBmh; MarkType fMarkType; Resolvable fResolve; Exemplary fExemplary; // worthy of an example uint64_t fParentMask; }; + struct DefinitionMap { + unordered_map<string, RootDefinition>* fMap; + MarkType fMarkType; + }; + DefinitionMap fMaps[Last_MarkType + 1]; + + static MarkProps kMarkProps[Last_MarkType + 1]; forward_list<RootDefinition> fTopics; forward_list<Definition> fMarkup; forward_list<RootDefinition> fExternals; vector<string> fInputFiles; unordered_map<string, RootDefinition> fClassMap; unordered_map<string, RootDefinition> fConstMap; + unordered_map<string, RootDefinition> fDefineMap; unordered_map<string, RootDefinition> fEnumMap; unordered_map<string, RootDefinition> fMethodMap; unordered_map<string, RootDefinition> fTypedefMap; @@ -1578,25 +1555,28 @@ public: bool checkForWord(); string className() const; bool crossCheck(BmhParser& ); - IClassDefinition* defineClass(const Definition& includeDef, const string& className); + IClassDefinition* defineClass(const Definition& includeDef, string className); void dumpClassTokens(IClassDefinition& classDef); void dumpComment(const Definition& ); - void dumpEnum(const Definition& , const string& name); - void dumpMethod(const Definition& ); + void dumpCommonTail(const Definition& ); + void dumpDefine(const Definition& ); + void dumpEnum(const Definition& , string name); + bool dumpGlobals(); + void dumpMethod(const Definition& , string className); void dumpMember(const Definition& ); - bool dumpTokens(const string& directory); - bool dumpTokens(const string& directory, const string& skClassName); + bool dumpTokens(); + bool dumpTokens(string skClassName); bool findComments(const Definition& includeDef, Definition* markupDef); Definition* findIncludeObject(const Definition& includeDef, MarkType markType, - const string& typeName) { + string typeName) { typedef Definition* DefinitionPtr; - unordered_map<string, Definition>* map = fMaps[(int) markType].fInclude; + unordered_map<string, Definition*>* map = fMaps[(int) markType].fInclude; if (!map) { return reportError<DefinitionPtr>("invalid mark type"); } string name = this->uniqueName(*map, typeName); - Definition& markupDef = (*map)[name]; + Definition& markupDef = *(*map)[name]; if (markupDef.fStart) { return reportError<DefinitionPtr>("definition already defined"); } @@ -1615,12 +1595,15 @@ public: } static KeyWord FindKey(const char* start, const char* end); - bool internalName(const Definition& ) const; + bool isClone(const Definition& token); + bool isConstructor(const Definition& token, string className); + bool isInternalName(const Definition& token); + bool isOperator(const Definition& token); bool parseChar(); - bool parseComment(const string& filename, const char* start, const char* end, int lineCount, + bool parseComment(string filename, const char* start, const char* end, int lineCount, Definition* markupDef); bool parseClass(Definition* def, IsStruct); - bool parseDefine(); + bool parseDefine(Definition* child, Definition* markupDef); bool parseEnum(Definition* child, Definition* markupDef); bool parseFromFile(const char* path) override { @@ -1632,7 +1615,7 @@ public: return this->parseInclude(name); } - bool parseInclude(const string& name); + bool parseInclude(string name); bool parseMember(Definition* child, Definition* markupDef); bool parseMethod(Definition* child, Definition* markupDef); bool parseObject(Definition* child, Definition* markupDef); @@ -1671,6 +1654,7 @@ public: fInChar = false; fInCharCommentString = false; fInComment = false; + fInDefine = false; fInEnum = false; fInFunction = false; fInString = false; @@ -1694,7 +1678,7 @@ public: } template <typename T> - string uniqueName(const unordered_map<string, T>& m, const string& typeName) { + string uniqueName(const unordered_map<string, T>& m, string typeName) { string base(typeName.size() > 0 ? typeName : "_anonymous"); string name(base); int anonCount = 1; @@ -1719,7 +1703,7 @@ public: } } - void writeDefinition(const Definition& def, const string& name, int spaces) { + void writeDefinition(const Definition& def, string name, int spaces) { this->writeBlock((int) (def.fContentEnd - def.fContentStart), def.fContentStart); this->writeSpace(spaces); this->writeString(name); @@ -1746,11 +1730,11 @@ public: this->lf(1); } - void writeEndTag(const char* tagType, const string& tagID, int spaces = 1) { + void writeEndTag(const char* tagType, string tagID, int spaces = 1) { this->writeEndTag(tagType, tagID.c_str(), spaces); } - void writeIncompleteTag(const char* tagType, const string& tagID, int spaces = 1) { + void writeIncompleteTag(const char* tagType, string tagID, int spaces = 1) { this->writeString(string("#") + tagType + " " + tagID); this->writeSpace(spaces); this->writeString("incomplete"); @@ -1784,14 +1768,14 @@ public: this->lf(1); } - void writeTableRow(size_t pad, const string& col1) { + void writeTableRow(size_t pad, string col1) { this->lf(1); string row = "# " + col1 + string(pad - col1.length(), ' ') + " # ##"; this->writeString(row); this->lf(1); } - void writeTableRow(size_t pad1, const string& col1, size_t pad2, const string& col2) { + void writeTableRow(size_t pad1, string col1, size_t pad2, string col2) { this->lf(1); string row = "# " + col1 + string(pad1 - col1.length(), ' ') + " # " + col2 + string(pad2 - col2.length(), ' ') + " ##"; @@ -1818,7 +1802,7 @@ public: this->writeString(tagID); } - void writeTagNoLF(const char* tagType, const string& tagID) { + void writeTagNoLF(const char* tagType, string tagID) { this->writeTagNoLF(tagType, tagID.c_str()); } @@ -1827,7 +1811,7 @@ public: this->writeTagNoLF(tagType, tagID); } - void writeTag(const char* tagType, const string& tagID) { + void writeTag(const char* tagType, string tagID) { this->writeTag(tagType, tagID.c_str()); } @@ -1835,7 +1819,7 @@ protected: static void ValidateKeyWords(); struct DefinitionMap { - unordered_map<string, Definition>* fInclude; + unordered_map<string, Definition*>* fInclude; MarkType fMarkType; }; @@ -1844,14 +1828,15 @@ protected: DefinitionMap fMaps[Last_MarkType + 1]; unordered_map<string, Definition> fIncludeMap; + list<Definition> fGlobals; unordered_map<string, IClassDefinition> fIClassMap; - unordered_map<string, Definition> fIDefineMap; - unordered_map<string, Definition> fIEnumMap; - unordered_map<string, Definition> fIFunctionMap; - unordered_map<string, Definition> fIStructMap; - unordered_map<string, Definition> fITemplateMap; - unordered_map<string, Definition> fITypedefMap; - unordered_map<string, Definition> fIUnionMap; + unordered_map<string, Definition*> fIDefineMap; + unordered_map<string, Definition*> fIEnumMap; + unordered_map<string, Definition*> fIFunctionMap; + unordered_map<string, Definition*> fIStructMap; + unordered_map<string, Definition*> fITemplateMap; + unordered_map<string, Definition*> fITypedefMap; + unordered_map<string, Definition*> fIUnionMap; Definition* fRootTopic; Definition* fInBrace; Definition* fLastObject; @@ -1863,6 +1848,7 @@ protected: bool fInChar; bool fInCharCommentString; bool fInComment; + bool fInDefine; bool fInEnum; bool fInFunction; bool fInString; @@ -1943,7 +1929,6 @@ public: } const Definition* fDefinition; - const Definition* fBracket; const char* fStart; const char* fEnd; bool fWord; @@ -1975,7 +1960,7 @@ public: vector<IterState>& iterStack, IterState** iterState, Preprocessor* ); void enumSizeItems(const Definition& child); bool findEnumSubtopic(string undername, const Definition** ) const; - Definition* findMemberCommentBlock(const vector<Definition*>& bmhChildren, const string& name) const; + Definition* findMemberCommentBlock(const vector<Definition*>& bmhChildren, string name) const; int lookupMethod(const PunctuationState punctuation, const Word word, const int start, const int run, int lastWrite, const char* data, bool hasIndirection); @@ -2088,7 +2073,7 @@ class Catalog : public FiddleBase { public: Catalog(BmhParser* bmh) : FiddleBase(bmh) {} - bool appendFile(const string& path); + bool appendFile(string path); bool closeCatalog(); bool openCatalog(const char* inDir, const char* outDir); bool openStatus(const char* inDir, const char* outDir); @@ -2157,12 +2142,14 @@ public: static constexpr const char* kClassesAndStructs = "Class_or_Struct"; static constexpr const char* kConstants = "Constant"; static constexpr const char* kConstructors = "Constructor"; + static constexpr const char* kDefines = "Define"; static constexpr const char* kMemberFunctions = "Member_Function"; static constexpr const char* kMembers = "Member"; static constexpr const char* kOperators = "Operator"; static constexpr const char* kOverview = "Overview"; static constexpr const char* kRelatedFunctions = "Related_Function"; static constexpr const char* kSubtopics = "Overview_Subtopic"; + static constexpr const char* kTypedefs = "Typedef"; private: enum class TableState { @@ -2187,9 +2174,9 @@ private: void childrenOut(const Definition* def, const char* contentStart); const Definition* csParent() const; const Definition* findParamType(); - const Definition* isDefined(const TextParser& , const string& ref, BmhParser::Resolvable ); + const Definition* isDefined(const TextParser& , string ref, BmhParser::Resolvable ); string linkName(const Definition* ) const; - string linkRef(const string& leadingSpaces, const Definition*, const string& ref, + string linkRef(string leadingSpaces, const Definition*, string ref, BmhParser::Resolvable ) const; void markTypeOut(Definition* ); void mdHeaderOut(int depth) { mdHeaderOutLF(depth, 2); } @@ -2233,11 +2220,11 @@ private: || MarkType::kFunction == markType) && fHasFiddle) { return BmhParser::Resolvable::kNo; } - return fBmhParser.fMaps[(int) markType].fResolve; + return BmhParser::kMarkProps[(int) markType].fResolve; } void resolveOut(const char* start, const char* end, BmhParser::Resolvable ); - void rowOut(const char * name, const string& description); + void rowOut(const char * name, string description); void subtopicOut(const TableContents& tableContents); void subtopicsOut(); @@ -2264,7 +2251,7 @@ private: // some methods cannot be trivially parsed; look for class-name / ~ / operator class MethodParser : public TextParser { public: - MethodParser(const string& className, const string& fileName, + MethodParser(string className, string fileName, const char* start, const char* end, int lineCount) : TextParser(fileName, start, end, lineCount) , fClassName(className) { @@ -2305,7 +2292,7 @@ public: } } if (this->startsWith("Sk") && this->wordEndsWith(".h")) { // allow include refs - this->skipToNonAlphaNum(); + this->skipToNonName(); } else { this->skipFullName(); if (this->endsWith("operator")) { diff --git a/tools/bookmaker/cataloger.cpp b/tools/bookmaker/cataloger.cpp index de46ecd1a7..0e1e38ac45 100644 --- a/tools/bookmaker/cataloger.cpp +++ b/tools/bookmaker/cataloger.cpp @@ -10,7 +10,7 @@ #include "SkOSFile.h" #include "SkOSPath.h" -bool Catalog::appendFile(const string& path) { +bool Catalog::appendFile(string path) { FILE* file = fopen(path.c_str(), "r"); if (!file) { SkDebugf("could not append %s\n", path.c_str()); diff --git a/tools/bookmaker/definition.cpp b/tools/bookmaker/definition.cpp index e3a5aa3bd5..06db96487e 100644 --- a/tools/bookmaker/definition.cpp +++ b/tools/bookmaker/definition.cpp @@ -6,6 +6,7 @@ */ #include "bookmaker.h" +#include "SkOSPath.h" #ifdef CONST #undef CONST @@ -138,7 +139,7 @@ const struct OperatorParser { {{ CONST, OpType::kThis, OpMod::kReference, }}}, }; -OpType lookup_type(const string& typeWord, const string& name) { +OpType lookup_type(string typeWord, string name) { if (typeWord == name || (typeWord == "SkIVector" && name == "SkIPoint") || (typeWord == "SkVector" && name == "SkPoint")) { return OpType::kThis; @@ -191,7 +192,7 @@ bool Definition::parseOperator(size_t doubleColons, string& result) { SkASSERT(isStatic == false || returnsConst == false); iParser.skipWhiteSpace(); const char* returnTypeStart = iParser.fChar; - iParser.skipToNonAlphaNum(); + iParser.skipToNonName(); SkASSERT(iParser.fChar > returnTypeStart); string returnType(returnTypeStart, iParser.fChar - returnTypeStart); OpType returnOpType = lookup_type(returnType, className); @@ -241,7 +242,7 @@ bool Definition::parseOperator(size_t doubleColons, string& result) { } iParser.skipWhiteSpace(); const char* paramStart = iParser.fChar; - iParser.skipToNonAlphaNum(); + iParser.skipToNonName(); SkASSERT(iParser.fChar > paramStart); string paramType(paramStart, iParser.fChar - paramStart); OpType paramOpType = lookup_type(paramType, className); @@ -257,7 +258,7 @@ bool Definition::parseOperator(size_t doubleColons, string& result) { countsMatch = false; break; } - iParser.skipToNonAlphaNum(); + iParser.skipToNonName(); if ('[' == iParser.peek()) { paramMod = OpMod::kArray; SkAssertResult(iParser.skipExact("[]")); @@ -324,7 +325,7 @@ bool Definition::parseOperator(size_t doubleColons, string& result) { #undef BLANK #undef DEFOP -bool Definition::boilerplateIfDef(Definition* parent) { +bool Definition::boilerplateIfDef() { const Definition& label = fTokens.front(); if (Type::kWord != label.fType) { return false; @@ -333,32 +334,6 @@ bool Definition::boilerplateIfDef(Definition* parent) { return true; } -// todo: this is matching #ifndef SkXXX_DEFINED for no particular reason -// it doesn't do anything useful with arbitrary input, e.g. #ifdef SK_SUPPORT_LEGACY_CANVAS_HELPERS -// also doesn't know what to do with SK_REQUIRE_LOCAL_VAR() -bool Definition::boilerplateDef(Definition* parent) { - if (!this->boilerplateIfDef(parent)) { - return false; - } - const char* s = fName.c_str(); - const char* e = strchr(s, '_'); - return true; // fixme: if this is trying to do something useful with define, do it here - if (!e) { - return false; - } - string prefix(s, e - s); - const char* inName = strstr(parent->fName.c_str(), prefix.c_str()); - if (!inName) { - return false; - } - if ('/' != inName[-1] && '\\' != inName[-1]) { - return false; - } - if (strcmp(inName + prefix.size(), ".h")) { - return false; - } - return true; -} // fixme: this will need to be more complicated to handle all of Skia // for now, just handle paint -- maybe fiddle will loosen naming restrictions @@ -414,7 +389,7 @@ void Definition::setCanonicalFiddle() { if (params.startsWith("const") || params.startsWith("int") || params.startsWith("Sk")) { const char* wordStart = params.fChar; - params.skipToNonAlphaNum(); + params.skipToNonName(); if (underline) { result += '_'; } else { @@ -422,7 +397,7 @@ void Definition::setCanonicalFiddle() { } result += string(wordStart, params.fChar - wordStart); } else { - params.skipToNonAlphaNum(); + params.skipToNonName(); } if (!params.eof() && '*' == params.peek()) { if (underline) { @@ -766,6 +741,18 @@ string Definition::fiddleName() const { return fFiddle.substr(start, end - start); } +string Definition::fileName() const { + size_t nameStart = fFileName.rfind(SkOSPath::SEPARATOR); + if (SkOSPath::SEPARATOR != '/') { + size_t altNameStart = fFileName.rfind('/'); + nameStart = string::npos == nameStart ? altNameStart : + string::npos != altNameStart && altNameStart > nameStart ? altNameStart : nameStart; + } + SkASSERT(string::npos != nameStart); + string baseFile = fFileName.substr(nameStart + 1); + return baseFile; +} + const Definition* Definition::findClone(string match) const { for (auto child : fChildren) { if (!child->fClone) { @@ -791,7 +778,7 @@ const Definition* Definition::hasChild(MarkType markType) const { return nullptr; } -const Definition* Definition::hasParam(const string& ref) const { +const Definition* Definition::hasParam(string ref) const { SkASSERT(MarkType::kMethod == fMarkType); for (auto iter : fChildren) { if (MarkType::kParam != iter->fMarkType) { @@ -805,7 +792,7 @@ const Definition* Definition::hasParam(const string& ref) const { return nullptr; } -bool Definition::hasMatch(const string& name) const { +bool Definition::hasMatch(string name) const { for (auto child : fChildren) { if (name == child->fName) { return true; @@ -827,7 +814,7 @@ bool Definition::isStructOrClass() const { return true; } -bool Definition::methodHasReturn(const string& name, TextParser* methodParser) const { +bool Definition::methodHasReturn(string name, TextParser* methodParser) const { if (methodParser->skipExact("static")) { methodParser->skipWhiteSpace(); } @@ -965,7 +952,7 @@ string Definition::NormalizedName(string name) { return normalizedName; } -static string unpreformat(const string& orig) { +static string unpreformat(string orig) { string result; int amp = 0; for (auto c : orig) { @@ -1030,7 +1017,7 @@ static string unpreformat(const string& orig) { return result; } -bool Definition::paramsMatch(const string& matchFormatted, const string& name) const { +bool Definition::paramsMatch(string matchFormatted, string name) const { string match = unpreformat(matchFormatted); TextParser def(fFileName, fStart, fContentStart, fLineCount); const char* dName = def.strnstr(name.c_str(), fContentStart); @@ -1097,7 +1084,7 @@ bool RootDefinition::dumpUnVisited() { return success; } -const Definition* RootDefinition::find(const string& ref, AllowParens allowParens) const { +const Definition* RootDefinition::find(string ref, AllowParens allowParens) const { const auto leafIter = fLeaves.find(ref); if (leafIter != fLeaves.end()) { return &leafIter->second; diff --git a/tools/bookmaker/fiddleParser.cpp b/tools/bookmaker/fiddleParser.cpp index 682c87c845..524f89d020 100644 --- a/tools/bookmaker/fiddleParser.cpp +++ b/tools/bookmaker/fiddleParser.cpp @@ -144,6 +144,7 @@ bool FiddleParser::textOut(Definition* example, const char* stdOutStart, } } else if (strncmp(bmh.fChar, fiddle.fChar, fiddleLen)) { if (!foundVolatile) { + SkDebugf("%.*s\n", fiddleLen, fiddle.fChar); bmh.reportError("mismatched stdout text\n"); } } diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp index 033599977c..982f7b3a78 100644 --- a/tools/bookmaker/includeParser.cpp +++ b/tools/bookmaker/includeParser.cpp @@ -161,6 +161,10 @@ bool IncludeParser::checkForWord() { switch (keyWord) { // these do not link to other # directives case KeyWord::kDefine: + if (!fInBrace) { + SkASSERT(!fInDefine); + fInDefine = true; + } case KeyWord::kInclude: case KeyWord::kError: break; @@ -259,7 +263,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) { const Definition* def = root->find(fullName, RootDefinition::AllowParens::kYes); switch (token.fMarkType) { case MarkType::kMethod: { - if (this->internalName(token)) { + if (this->isInternalName(token)) { continue; } if (!def) { @@ -378,7 +382,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) { firstMember.skipWhiteSpace(); SkASSERT('k' == firstMember.peek()); const char* savePos = firstMember.fChar; - firstMember.skipToNonAlphaNum(); + firstMember.skipToNonName(); const char* wordEnd = firstMember.fChar; firstMember.fChar = savePos; const char* lastUnderscore = nullptr; @@ -499,7 +503,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) { } IClassDefinition* IncludeParser::defineClass(const Definition& includeDef, - const string& name) { + string name) { string className; const Definition* test = fParent; while (Definition::Type::kFileType != test->fType) { @@ -539,9 +543,7 @@ void IncludeParser::dumpClassTokens(IClassDefinition& classDef) { continue; } if (MarkType::kMember != token.fMarkType) { - this->writeString( - "# ------------------------------------------------------------------------------"); - this->lf(2); + this->writeBlockSeparator(); } switch (token.fMarkType) { case MarkType::kEnum: @@ -549,7 +551,7 @@ void IncludeParser::dumpClassTokens(IClassDefinition& classDef) { this->dumpEnum(token, token.fName); break; case MarkType::kMethod: - this->dumpMethod(token); + this->dumpMethod(token, classDef.fName); break; case MarkType::kMember: this->dumpMember(token); @@ -558,33 +560,7 @@ void IncludeParser::dumpClassTokens(IClassDefinition& classDef) { default: SkASSERT(0); } - this->lf(2); - this->writeTag("Example"); - this->lf(1); - this->writeString("// incomplete"); - this->lf(1); - this->writeEndTag(); - this->lf(2); - this->writeTag("SeeAlso"); - this->writeSpace(); - this->writeString("incomplete"); - this->lf(2); - switch (token.fMarkType) { - case MarkType::kEnum: - case MarkType::kEnumClass: - this->writeEndTag("Enum"); - break; - case MarkType::kMethod: - this->writeEndTag("Method"); - break; - case MarkType::kMember: - this->writeEndTag("Member"); - continue; - break; - default: - SkASSERT(0); - } - this->lf(2); + this->dumpCommonTail(token); } } void IncludeParser::dumpComment(const Definition& token) { @@ -751,10 +727,55 @@ void IncludeParser::dumpComment(const Definition& token) { } } -void IncludeParser::dumpEnum(const Definition& token, const string& name) { +void IncludeParser::dumpCommonTail(const Definition& token) { + this->lf(2); + this->writeTag("Example"); + this->lf(1); + this->writeString("// incomplete"); + this->lf(1); + this->writeEndTag(); + this->lf(2); + this->writeTag("SeeAlso"); + this->writeSpace(); + this->writeString("incomplete"); + this->lf(2); + this->writeEndTag(BmhParser::kMarkProps[(int) token.fMarkType].fName); + this->lf(2); +} + +void IncludeParser::dumpDefine(const Definition& token) { + this->writeTag("Define", token.fName); + this->lf(2); + this->writeTag("Code"); + this->lfAlways(1); + this->writeString("###$"); + this->lfAlways(1); + this->indentToColumn(4); + this->writeBlock(token.fTerminator - token.fStart, token.fStart); + this->lf(1); + this->indentToColumn(0); + this->writeString("$$$#"); + + this->writeEndTag(); + this->lf(2); + this->dumpComment(token); + for (auto& child : token.fTokens) { + if (MarkType::kComment == child.fMarkType) { + continue; + } + this->writeTag("Param", child.fName); + this->writeSpace(); + this->writeString("incomplete"); + this->writeSpace(); + this->writeString("##"); + this->lf(1); + } +} + +void IncludeParser::dumpEnum(const Definition& token, string name) { this->writeTag("Enum", name); this->lf(2); - this->writeString("#Code"); + this->writeTag("Code"); this->lfAlways(1); this->indentToColumn(4); this->writeString("enum"); @@ -787,7 +808,7 @@ void IncludeParser::dumpEnum(const Definition& token, const string& name) { // start here; // get comments before // or after const values - this->writeString("#Const"); + this->writeTag("Const"); this->writeSpace(); this->writeString(child->fName); TextParser val(child); @@ -827,35 +848,203 @@ void IncludeParser::dumpEnum(const Definition& token, const string& name) { this->lf(2); } -void IncludeParser::dumpMethod(const Definition& token) { - this->writeString("#Method"); - this->writeSpace(); - if ("SK_TO_STRING_NONVIRT" == token.fName) { - this->writeString("void toString(SkString* str) const;"); +bool IncludeParser::dumpGlobals() { + size_t lastBSlash = fFileName.rfind('\\'); + size_t lastSlash = fFileName.rfind('/'); + size_t lastDotH = fFileName.rfind(".h"); + SkASSERT(string::npos != lastDotH); + if (string::npos != lastBSlash && (string::npos == lastSlash + || lastBSlash < lastSlash)) { + lastSlash = lastBSlash; + } else if (string::npos == lastSlash) { + lastSlash = -1; + } + lastSlash += 1; + string globalsName = fFileName.substr(lastSlash, lastDotH - lastSlash); + string fileName = globalsName + "_Reference.bmh"; + fOut = fopen(fileName.c_str(), "wb"); + if (!fOut) { + SkDebugf("could not open output file %s\n", globalsName.c_str()); + return false; + } + string prefixName = globalsName.substr(0, 2); + string topicName = globalsName.length() > 2 && isupper(globalsName[2]) && + ("Sk" == prefixName || "Gr" == prefixName) ? globalsName.substr(2) : globalsName; + this->writeTagNoLF("Topic", topicName); + this->writeTag("Alias", topicName + "_Reference"); + this->lf(2); + this->writeTag("Subtopic", "Overview"); + fIndent += 4; + this->writeTag("Subtopic", "Subtopic"); + fIndent += 4; + this->writeTag("Populate"); + fIndent -= 4; + this->writeEndTag(); + fIndent -= 4; + this->writeEndTag(); + this->lf(2); + if (!fIDefineMap.empty()) { + this->writeTag("Subtopic", "Define"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); - this->writeEndTag("DefinedBy", "void toString(SkString* str) const;"); + } + if (!fIFunctionMap.empty()) { + this->writeTag("Subtopic", "Function"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); - this->writeTag("Private"); - this->lf(1); - this->writeString("macro expands to: void toString(SkString* str) const;"); + } + if (!fIEnumMap.empty()) { + this->writeTag("Subtopic", "Enum"); + this->writeTag("Populate"); this->writeEndTag(); this->lf(2); - const char desc[] = - "Creates string representation. The representation is read by\n" - "internal debugging tools. The interface and implementation may be\n" - "suppressed by defining SK_IGNORE_TO_STRING."; - this->writeBlock(sizeof(desc) - 1, desc); + } + if (!fITemplateMap.empty()) { + this->writeTag("Subtopic", "Template"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); - this->writeTag("Param", "str"); - this->writeSpace(2); - this->writeString("storage for string representation"); - this->writeSpace(); - this->writeString("##"); + } + if (!fITypedefMap.empty()) { + this->writeTag("Subtopic", "Typedef"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); - return; } - this->writeBlock(token.length(), token.fStart); - this->lf(1); + if (!fIUnionMap.empty()) { + this->writeTag("Subtopic", "Union"); + this->writeTag("Populate"); + this->writeEndTag(); + this->lf(2); + } + std::map<int, Definition*> sortedDefs; + for (const auto& entry : fIDefineMap) { + sortedDefs[entry.second->fLineCount] = entry.second; + } + for (const auto& entry : fIFunctionMap) { + sortedDefs[entry.second->fLineCount] = entry.second; + } + for (const auto& entry : fIEnumMap) { + sortedDefs[entry.second->fLineCount] = entry.second; + } + for (const auto& entry : fITemplateMap) { + sortedDefs[entry.second->fLineCount] = entry.second; + } + for (const auto& entry : fITypedefMap) { + sortedDefs[entry.second->fLineCount] = entry.second; + } + for (const auto& entry : fIUnionMap) { + sortedDefs[entry.second->fLineCount] = entry.second; + } + for (const auto& entry : sortedDefs) { + const Definition* def = entry.second; + this->writeBlockSeparator(); + switch (def->fMarkType) { + case MarkType::kDefine: + this->dumpDefine(*def); + break; + case MarkType::kMethod: + this->dumpMethod(*def, globalsName); + break; + case MarkType::kEnum: + case MarkType::kEnumClass: + this->dumpEnum(*def, globalsName); + break; + case MarkType::kTemplate: + SkASSERT(0); // incomplete + break; + case MarkType::kTypedef: { + this->writeTag("Typedef"); + this->writeSpace(); + TextParser parser(def); + if (!parser.skipExact("typedef")) { + return false; + } + if (!parser.skipSpace()) { + return false; + } + this->writeBlock(parser.fEnd - parser.fChar, parser.fChar); + this->lf(2); + this->dumpComment(*def); + this->writeEndTag(BmhParser::kMarkProps[(int) entry.second->fMarkType].fName); + this->lf(2); + } continue; + case MarkType::kUnion: + SkASSERT(0); // incomplete + break; + default: + SkASSERT(0); + } + this->dumpCommonTail(*def); + } + this->writeEndTag("Topic", topicName); + this->lfAlways(1); + fclose(fOut); + SkDebugf("wrote %s\n", fileName.c_str()); + return true; +} + +bool IncludeParser::isClone(const Definition& token) { + string name = token.fName; + return name[name.length() - 2] == '_' && isdigit(name[name.length() - 1]); +} + +bool IncludeParser::isConstructor(const Definition& token, string className) { + string name = token.fName; + return 0 == name.find(className) || '~' == name[0]; +} + +bool IncludeParser::isInternalName(const Definition& token) { + string name = token.fName; + // exception for this SkCanvas function .. for now + if (0 == token.fName.find("androidFramework_setDeviceClipRestriction")) { + return false; + } + return name.substr(0, 7) == "android" + || 0 == token.fName.find("internal_") + || 0 == token.fName.find("Internal_") + || 0 == token.fName.find("legacy_") + || 0 == token.fName.find("temporary_") + || 0 == token.fName.find("private_"); +} + +bool IncludeParser::isOperator(const Definition& token) { + return "operator" == token.fName.substr(0, 8); +} + +void IncludeParser::dumpMethod(const Definition& token, string className) { + this->writeTag("Method"); + this->writeSpace(); + + string name = string(token.fStart ? token.fStart : token.fContentStart, + token.length()); + if (this->isOperator(token)) { + string spaceConst(" const"); + size_t constPos = name.rfind(spaceConst); + if (name.length() - spaceConst.length() == constPos) { + name = name.substr(0, constPos) + "_const"; + } + } + this->writeString(name); + string inType; + if (this->isConstructor(token, className)) { + inType = "Constructor"; + } else if (this->isOperator(token)) { + inType = "Operator"; + } else { + inType = "incomplete"; + } + this->writeTag("In", inType); + this->writeTag("Line"); + this->writeSpace(1); + this->writeString("#"); + this->writeSpace(1); + this->writeString("incomplete"); + this->writeSpace(1); + this->writeString("##"); + this->lf(2); this->dumpComment(token); } @@ -871,12 +1060,15 @@ void IncludeParser::dumpMember(const Definition& token) { lf(2); } -bool IncludeParser::dumpTokens(const string& dir) { +bool IncludeParser::dumpTokens() { + if (!this->dumpGlobals()) { + return false; + } for (const auto& member : fIClassMap) { if (string::npos != member.first.find("::")) { continue; } - if (!this->dumpTokens(dir, member.first)) { + if (!this->dumpTokens(member.first)) { return false; } } @@ -884,12 +1076,8 @@ bool IncludeParser::dumpTokens(const string& dir) { } // dump equivalent markup -bool IncludeParser::dumpTokens(const string& dir, const string& skClassName) { - string fileName = dir; - if (dir.length() && '/' != dir[dir.length() - 1]) { - fileName += '/'; - } - fileName += skClassName + "_Reference.bmh"; +bool IncludeParser::dumpTokens(string skClassName) { + string fileName = skClassName + "_Reference.bmh"; fOut = fopen(fileName.c_str(), "wb"); if (!fOut) { SkDebugf("could not open output file %s\n", fileName.c_str()); @@ -915,160 +1103,82 @@ bool IncludeParser::dumpTokens(const string& dir, const string& skClassName) { this->lf(1); } this->lf(2); - string className(skClassName.substr(2)); - vector<string> classNames; - vector<string> constNames; - vector<string> constructorNames; - vector<string> memberNames; - vector<string> operatorNames; - size_t classMaxLen = 0; - size_t constMaxLen = 0; - size_t constructorMaxLen = 0; - size_t memberMaxLen = 0; - size_t operatorMaxLen = 0; + bool hasClass = false; + bool hasConst = !fIEnumMap.empty(); + bool hasConstructor = false; + bool hasMember = false; + bool hasOperator = false; for (const auto& oneClass : fIClassMap) { if (skClassName + "::" != oneClass.first.substr(0, skClassName.length() + 2)) { continue; } - string structName = oneClass.first.substr(skClassName.length() + 2); - classMaxLen = SkTMax(classMaxLen, structName.length()); - classNames.emplace_back(structName); - } - for (const auto& oneEnum : fIEnumMap) { - string enumName = oneEnum.first; - constMaxLen = SkTMax(constMaxLen, enumName.length()); - constNames.emplace_back(enumName); + hasClass = true; + break; } for (const auto& token : classMap.fTokens) { if (Definition::Type::kMark != token.fType || MarkType::kMethod != token.fMarkType) { continue; } - string name = token.fName; - if (name.substr(0, 7) == "android" || string::npos != name.find("nternal_")) { + if (this->isInternalName(token)) { continue; } - if ((name.substr(0, 2) == "Sk" && 2 == name.find(className)) || '~' == name[0]) { - name = string(token.fContentStart, (int) (token.fContentEnd - token.fContentStart)); - constructorMaxLen = SkTMax(constructorMaxLen, name.length()); - constructorNames.emplace_back(name); + if (this->isConstructor(token, skClassName)) { + hasConstructor = true; continue; } - if (name.substr(0, 8) == "operator") { - name = string(token.fContentStart, (int) (token.fContentEnd - token.fContentStart)); - operatorMaxLen = SkTMax(operatorMaxLen, name.length()); - operatorNames.emplace_back(name); + if (this->isOperator(token)) { + hasOperator = true; continue; } - if (name[name.length() - 2] == '_' && isdigit(name[name.length() - 1])) { + if (this->isClone(token)) { continue; } - if ("SK_TO_STRING_NONVIRT" == name) { - name = "toString"; - } - size_t paren = name.find('('); - size_t funcLen = string::npos == paren ? name.length() : paren; - memberMaxLen = SkTMax(memberMaxLen, funcLen); - memberNames.emplace_back(name); + hasMember = true; } - this->writeTag("Topic", "Overview"); - this->lf(2); - this->writeTag("Subtopic", "Subtopics"); - string classesName = classMaxLen ? "Classes_and_Structs" : ""; - string constsName = constructorMaxLen ? "Constants" : ""; - string constructorsName = constructorMaxLen ? "Constructors" : ""; - string membersName = memberMaxLen ? "Member_Functions" : ""; - string operatorsName = operatorMaxLen ? "Operators" : ""; - size_t nameLen = SkTMax(classesName.size(), SkTMax(constsName.size(), - SkTMax(constructorsName.size(), SkTMax(membersName.size(), operatorsName.size())))); - this->writeTableHeader("name", nameLen, "description"); - string classDesc = classMaxLen ? "embedded struct and class members" : ""; - string constDesc = constMaxLen ? "enum and enum class, const values" : ""; - string constructorDesc = constructorMaxLen ? "functions that construct " + className : ""; - string memberDesc = memberMaxLen ? "static functions and member methods" : ""; - string operatorDesc = operatorMaxLen ? "operator overloading methods" : ""; - size_t descLen = SkTMax(classDesc.size(), SkTMax(constDesc.size(), SkTMax(constructorDesc.size(), - SkTMax(memberDesc.size(), operatorDesc.size())))); - if (classMaxLen) { - this->writeTableRow(nameLen, classesName, descLen, classDesc); - } - if (constMaxLen) { - this->writeTableRow(nameLen, constsName, descLen, constDesc); - } - if (constructorMaxLen) { - this->writeTableRow(nameLen, constructorsName, descLen, constructorDesc); - } - if (memberMaxLen) { - this->writeTableRow(nameLen, membersName, descLen, memberDesc); - } - if (operatorMaxLen) { - this->writeTableRow(nameLen, operatorsName, descLen, operatorDesc); - } - this->writeTableTrailer(); + this->writeTag("Subtopic", "Overview"); + fIndent += 4; + this->writeTag("Subtopic", "Subtopic"); + fIndent += 4; + this->writeTag("Populate"); + fIndent -= 4; + this->writeEndTag(); + fIndent -= 4; this->writeEndTag(); this->lf(2); - if (classMaxLen) { - std::sort(classNames.begin(), classNames.end()); - this->writeTag("Subtopic", "Classes_and_Structs"); - this->writeTableHeader("name", classMaxLen, "description"); - for (auto& name : classNames) { - this->writeTableRow(classMaxLen, name); - } - this->writeTableTrailer(); - this->writeEndTag("Subtopic"); + + if (hasClass) { + this->writeTag("Subtopic", "Class_or_Struct"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); } - if (constMaxLen) { - std::sort(constNames.begin(), constNames.end()); - this->writeTag("Subtopic", "Constants"); - this->writeTableHeader("name", constMaxLen, "description"); - for (auto& name : constNames) { - this->writeTableRow(constMaxLen, name); - } - this->writeTableTrailer(); - this->writeEndTag("Subtopic"); + if (hasConst) { + this->writeTag("Subtopic", "Constant"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); } - if (constructorMaxLen) { - std::sort(constructorNames.begin(), constructorNames.end()); - this->writeTag("Subtopic", "Constructors"); - this->writeTableHeader("name", constructorMaxLen, "description"); - for (auto& name : constructorNames) { - this->writeTableRow(constructorMaxLen, name); - } - this->writeTableTrailer(); - this->writeEndTag("Subtopic"); + if (hasConstructor) { + this->writeTag("Subtopic", "Constructor"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); } - if (operatorMaxLen) { - std::sort(operatorNames.begin(), operatorNames.end()); - this->writeTag("Subtopic", "Operators"); - this->writeTableHeader("name", operatorMaxLen, "description"); - for (auto& name : operatorNames) { - this->writeTableRow(operatorMaxLen, name); - } - this->writeTableTrailer(); - this->writeEndTag("Subtopic"); + if (hasOperator) { + this->writeTag("Subtopic", "Operator"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); } - if (memberMaxLen) { - std::sort(memberNames.begin(), memberNames.end()); - this->writeTag("Subtopic", "Member_Functions"); - this->writeTableHeader("name", memberMaxLen, "description"); - for (auto& name : memberNames) { - size_t paren = name.find('('); - size_t funcLen = string::npos == paren ? name.length() : paren; - this->writeTableRow(memberMaxLen, name.substr(0, funcLen)); - } - this->writeTableTrailer(); - this->writeEndTag("Subtopic"); + if (hasMember) { + this->writeTag("Subtopic", "Member_Function"); + this->writeTag("Populate"); + this->writeEndTag(); this->lf(2); } - this->writeEndTag("Topic"); - this->lf(2); for (auto& oneEnum : fIEnumMap) { - this->writeString( - "# ------------------------------------------------------------------------------"); - this->dumpEnum(oneEnum.second, oneEnum.first); + this->writeBlockSeparator(); + this->dumpEnum(*oneEnum.second, oneEnum.first); this->lf(2); this->writeTag("Example"); this->lfcr(); @@ -1085,9 +1195,7 @@ bool IncludeParser::dumpTokens(const string& dir, const string& skClassName) { continue; } string innerName = oneClass.first.substr(skClassName.length() + 2); - this->writeString( - "# ------------------------------------------------------------------------------"); - this->lf(2); + this->writeBlockSeparator(); KeyWord keyword = oneClass.second.fKeyWord; SkASSERT(KeyWord::kClass == keyword || KeyWord::kStruct == keyword); const char* containerType = KeyWord::kClass == keyword ? "Class" : "Struct"; @@ -1159,14 +1267,6 @@ bool IncludeParser::findComments(const Definition& includeDef, Definition* marku return true; } -bool IncludeParser::internalName(const Definition& token) const { - return 0 == token.fName.find("internal_") - || 0 == token.fName.find("Internal_") - || 0 == token.fName.find("legacy_") - || 0 == token.fName.find("temporary_") - || 0 == token.fName.find("private_"); -} - // caller calls reportError, so just return false here bool IncludeParser::parseClass(Definition* includeDef, IsStruct isStruct) { SkASSERT(includeDef->fTokens.size() > 0); @@ -1267,7 +1367,7 @@ bool IncludeParser::parseClass(Definition* includeDef, IsStruct isStruct) { return true; } -bool IncludeParser::parseComment(const string& filename, const char* start, const char* end, +bool IncludeParser::parseComment(string filename, const char* start, const char* end, int lineCount, Definition* markupDef) { TextParser parser(filename, start, end, lineCount); // parse doxygen if present @@ -1277,14 +1377,26 @@ bool IncludeParser::parseComment(const string& filename, const char* start, cons parser.skipWhiteSpace(); if ('\\' == parser.peek()) { parser.next(); - if (!parser.skipWord(kKeyWords[(int) markupDef->fKeyWord].fName)) { - return reportError<bool>("missing object type"); - } - if (!parser.skipWord(markupDef->fName.c_str()) && - KeyWord::kEnum != markupDef->fKeyWord) { - return reportError<bool>("missing object name"); + // Doxygen tag may be "file" or "fn" in addition to "class", "enum", "struct" + if (parser.skipExact("file")) { + if (Definition::Type::kFileType != fParent->fType) { + return reportError<bool>("expected parent is file"); + } + string filename = markupDef->fileName(); + if (!parser.skipWord(filename.c_str())) { + return reportError<bool>("missing object type"); + } + } else if (parser.skipExact("fn")) { + SkASSERT(0); // incomplete + } else { + if (!parser.skipWord(kKeyWords[(int) markupDef->fKeyWord].fName)) { + return reportError<bool>("missing object type"); + } + if (!parser.skipWord(markupDef->fName.c_str()) && + KeyWord::kEnum != markupDef->fKeyWord) { + return reportError<bool>("missing object name"); + } } - } } // remove leading '*' if present @@ -1308,8 +1420,87 @@ bool IncludeParser::parseComment(const string& filename, const char* start, cons return true; } -bool IncludeParser::parseDefine() { - +bool IncludeParser::parseDefine(Definition* child, Definition* markupDef) { + TextParser parser(child); + if (!parser.skipExact("#define")) { + return false; + } + if (!parser.skipSpace()) { + return false; + } + const char* nameStart = parser.fChar; + parser.skipToNonAlphaNum(); // FIXME: just want to skip isalnum() and '_' + if (parser.eof()) { + return true; // do nothing if #define doesn't define anything + } + string nameStr(nameStart, parser.fChar - nameStart); + struct Param { + const char* fStart; + const char* fEnd; + }; + vector<Param> params; + if ('(' == parser.peek()) { + parser.next(); + if (!parser.skipSpace()) { + return false; + } + do { + const char* paramStart = parser.fChar; + if (!parser.skipExact("...")) { + parser.skipToNonAlphaNum(); + } + if (parser.eof()) { + return false; + } + params.push_back({paramStart, parser.fChar}); + if (!parser.skipSpace()) { + return false; + } + if (')' == parser.peek()) { + parser.next(); + break; + } + if (',' != parser.next()) { + return false; + } + if (!parser.skipSpace()) { + return false; + } + } while (true); + } + if (!parser.skipSpace()) { + return false; + } + if (!markupDef) { + fGlobals.emplace_back(MarkType::kDefine, nameStart, child->fContentEnd, + child->fLineCount, fParent, '\0'); + Definition* globalMarkupChild = &fGlobals.back(); + string globalUniqueName = this->uniqueName(fIDefineMap, nameStr); + globalMarkupChild->fName = globalUniqueName; + globalMarkupChild->fTerminator = child->fContentEnd; + if (!this->findComments(*child, globalMarkupChild)) { + return false; + } + fIDefineMap[globalUniqueName] = globalMarkupChild; + for (Param param : params) { + globalMarkupChild->fTokens.emplace_back(MarkType::kParam, param.fStart, param.fEnd, + child->fLineCount, globalMarkupChild, '\0'); + Definition* paramChild = &globalMarkupChild->fTokens.back(); + paramChild->fName = string(param.fStart, param.fEnd - param.fStart); + paramChild->fTerminator = param.fEnd; + } + return true; + } + markupDef->fTokens.emplace_back(MarkType::kDefine, child->fContentStart, child->fContentEnd, + child->fLineCount, markupDef, '\0'); + Definition* markupChild = &markupDef->fTokens.back(); + markupChild->fName = nameStr; + markupChild->fTerminator = markupChild->fContentEnd; + IClassDefinition& classDef = fIClassMap[markupDef->fName]; + if (!this->findComments(*child, markupChild)) { + return false; + } + classDef.fDefines[nameStr] = markupChild; return true; } @@ -1332,17 +1523,13 @@ bool IncludeParser::parseEnum(Definition* child, Definition* markupDef) { } Definition* markupChild; if (!markupDef) { - auto finder = fIEnumMap.find(nameStr); - if (fIEnumMap.end() != finder) { - return child->reportError<bool>("duplicate global enum name"); - } - markupChild = &fIEnumMap[nameStr]; - markupChild->fContentStart = child->fContentStart; - markupChild->fName = nameStr; - markupChild->fFiddle = nameStr; - markupChild->fContentEnd = child->fContentEnd; - markupChild->fFileName = child->fFileName; - markupChild->fLineCount = child->fLineCount; + fGlobals.emplace_back(MarkType::kEnum, child->fContentStart, child->fContentEnd, + child->fLineCount, fParent, '\0'); + markupChild = &fGlobals.back(); + string globalUniqueName = this->uniqueName(fIEnumMap, nameStr); + markupChild->fName = globalUniqueName; + markupChild->fTerminator = child->fContentEnd; + fIEnumMap[globalUniqueName] = markupChild; } else { markupDef->fTokens.emplace_back(MarkType::kEnum, child->fContentStart, child->fContentEnd, child->fLineCount, markupDef, '\0'); @@ -1407,7 +1594,7 @@ bool IncludeParser::parseEnum(Definition* child, Definition* markupDef) { } // if there's comment on same the line as member def, output first as if it was before - parser.skipToNonAlphaNum(); + parser.skipToNonName(); string memberName(memberStart, parser.fChar); if (parser.eof() || !parser.skipWhiteSpace()) { return this->reportError<bool>("enum member must end with comma 1"); @@ -1486,7 +1673,7 @@ bool IncludeParser::parseEnum(Definition* child, Definition* markupDef) { return true; } -bool IncludeParser::parseInclude(const string& name) { +bool IncludeParser::parseInclude(string name) { fParent = &fIncludeMap[name]; fParent->fName = name; fParent->fFileName = fFileName; @@ -1513,7 +1700,7 @@ bool IncludeParser::parseMember(Definition* child, Definition* markupDef) { child->fLineCount, markupDef, '\0'); Definition* markupChild = &markupDef->fTokens.back(); TextParser nameParser(child); - nameParser.skipToNonAlphaNum(); + nameParser.skipToNonName(); string nameStr = string(child->fContentStart, nameParser.fChar - child->fContentStart); IClassDefinition& classDef = fIClassMap[markupDef->fName]; string uniqueName = this->uniqueName(classDef.fMethods, nameStr); @@ -1667,19 +1854,15 @@ bool IncludeParser::parseMethod(Definition* child, Definition* markupDef) { if (nameParser.skipToEndBracket(':') && nameParser.startsWith("::")) { return true; // expect this is inline class definition outside of class } - string name(nameParser.fLine, nameParser.lineLength()); - auto finder = fIFunctionMap.find(name); - if (fIFunctionMap.end() != finder) { - // create unique name - SkASSERT(0); // incomplete - } - auto globalFunction = &fIFunctionMap[name]; - globalFunction->fContentStart = start; - globalFunction->fName = name; - globalFunction->fFiddle = name; - globalFunction->fContentEnd = end; - globalFunction->fMarkType = MarkType::kMethod; - globalFunction->fLineCount = tokenIter->fLineCount; + fGlobals.emplace_back(MarkType::kMethod, start, end, tokenIter->fLineCount, + fParent, '\0'); + Definition* globalMarkupChild = &fGlobals.back(); + string globalUniqueName = this->uniqueName(fIFunctionMap, nameStr); + globalMarkupChild->fName = globalUniqueName; + if (!this->findComments(*child, globalMarkupChild)) { + return false; + } + fIFunctionMap[globalUniqueName] = globalMarkupChild; return true; } markupDef->fTokens.emplace_back(MarkType::kMethod, start, end, tokenIter->fLineCount, @@ -1799,7 +1982,7 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) { case KeyWord::kIf: case KeyWord::kIfndef: case KeyWord::kIfdef: - if (child->boilerplateIfDef(fParent)) { + if (child->boilerplateIfDef()) { if (!this->parseObjects(child, markupDef)) { return false; } @@ -1807,7 +1990,7 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) { } goto preproError; case KeyWord::kDefine: - if (child->boilerplateDef(fParent)) { + if (this->parseDefine(child, markupDef)) { break; } goto preproError; @@ -1873,16 +2056,15 @@ bool IncludeParser::parseTypedef(Definition* child, Definition* markupDef) { typedefParser.skipWhiteSpace(); string nameStr = typedefParser.typedefName(); if (!markupDef) { - Definition& typedefDef = fITypedefMap[nameStr]; - SkASSERT(!typedefDef.fStart); - typedefDef.fStart = child->fContentStart; - typedefDef.fContentStart = child->fContentStart; - typedefDef.fName = nameStr; - typedefDef.fFiddle = nameStr; - typedefDef.fContentEnd = child->fContentEnd; - typedefDef.fTerminator = child->fContentEnd; - typedefDef.fMarkType = MarkType::kTypedef; - typedefDef.fLineCount = child->fLineCount; + fGlobals.emplace_back(MarkType::kTypedef, child->fContentStart, child->fContentEnd, + child->fLineCount, fParent, '\0'); + Definition* globalMarkupChild = &fGlobals.back(); + string globalUniqueName = this->uniqueName(fITypedefMap, nameStr); + globalMarkupChild->fName = globalUniqueName; + if (!this->findComments(*child, globalMarkupChild)) { + return false; + } + fITypedefMap[globalUniqueName] = globalMarkupChild; return true; } markupDef->fTokens.emplace_back(MarkType::kTypedef, child->fContentStart, child->fContentEnd, @@ -1927,9 +2109,17 @@ bool IncludeParser::parseChar() { if (KeyWord::kNone == keyWord) { return this->reportError<bool>("unhandled preprocessor directive"); } + if (fInDefine) { + SkASSERT(KeyWord::kDefine == keyWord); + fInDefine = false; + } if (KeyWord::kInclude == keyWord || KeyWord::kDefine == keyWord || KeyWord::kError == keyWord) { this->popBracket(); } + if (fInBrace) { + SkASSERT(KeyWord::kDefine == fInBrace->fKeyWord); + fInBrace = nullptr; + } } else if (Bracket::kSlashSlash == this->topBracket()) { this->popBracket(); } @@ -1986,18 +2176,21 @@ bool IncludeParser::parseChar() { this->pushBracket(Bracket::kString); } break; - case ':': case '(': - case '[': - case '{': { - if (fIncludeWord && '(' == test && fChar - fIncludeWord >= 10 && + if (fIncludeWord && fChar - fIncludeWord >= 10 && !strncmp("SkDEBUGCODE", fIncludeWord, 10)) { this->pushBracket(Bracket::kDebugCode); break; } + case ':': + case '[': + case '{': { if (fInCharCommentString) { break; } + if (fInDefine && fInBrace) { + break; + } if (':' == test && (fInBrace || ':' == fChar[-1] || ':' == fChar[1])) { break; } @@ -2051,6 +2244,9 @@ bool IncludeParser::parseChar() { if (fInCharCommentString) { break; } + if (fInDefine && fInBrace) { + break; + } if (!fInBrace) { if (!this->checkForWord()) { return false; @@ -2104,9 +2300,14 @@ bool IncludeParser::parseChar() { this->pushBracket(Bracket::kPound); break; } + case ' ': + if (fInDefine && !fInBrace && Bracket::kPound == this->topBracket()) { + SkASSERT(KeyWord::kDefine == fParent->fKeyWord); + fInBrace = fParent; + // delimiting brackets are space ... unescaped-linefeed + } case '&': case ',': - case ' ': case '+': case '=': case '-': @@ -2260,7 +2461,7 @@ bool IncludeParser::parseChar() { std::advance(tokenWalker, 1); if (tokenWalker != fParent->fTokens.end()) { TextParser tp(fFileName, nameStart, tokenWalker->fStart, fLineCount); - tp.skipToNonAlphaNum(); + tp.skipToNonName(); start->fName = string(nameStart, tp.fChar - nameStart); start->fContentEnd = fChar; priorEnum->fChildren.emplace_back(start); diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp index 9fd238ac78..daf4c36145 100644 --- a/tools/bookmaker/includeWriter.cpp +++ b/tools/bookmaker/includeWriter.cpp @@ -684,9 +684,6 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child) fContinuation = nullptr; fDeferComment = nullptr; const Definition* csParent = method->csParent(); - if (!csParent) { - SkDebugf(""); - } if (csParent && (0 == fIndent || fIndentNext)) { fIndent += 4; fIndentNext = false; @@ -721,22 +718,7 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child) } this->indentToColumn(column); fIndent = column; -#if 0 - const char* partStart = methodPart->fContentStart; - const char* partEnd = methodPart->fContentEnd; - while ('\n' == partEnd[-1]) { - --partEnd; - } - while ('#' == partEnd[-1]) { // FIXME: so wrong; should not be before fContentEnd - --partEnd; - } - int partLen = (int) (partEnd - partStart); - // FIXME : detect this earlier; assert if #Return is empty - SkASSERT(partLen > 0 && partLen < 300); // may assert if param desc is especially long - this->rewriteBlock(partLen, partStart, Phrase::kYes); -#else this->descriptionOut(methodPart, SkipFirstLine::kNo, Phrase::kYes); -#endif fIndent = saveIndent; this->lfcr(); } @@ -784,7 +766,7 @@ bool IncludeWriter::findEnumSubtopic(string undername, const Definition** rootDe } Definition* IncludeWriter::findMemberCommentBlock(const vector<Definition*>& bmhChildren, - const string& name) const { + string name) const { for (auto memberDef : bmhChildren) { if (MarkType::kMember != memberDef->fMarkType) { continue; @@ -1222,7 +1204,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti continue; } if (MarkType::kMethod == child.fMarkType) { - if (this->internalName(child)) { + if (this->isInternalName(child)) { continue; } const char* bodyEnd = fDeferComment ? fDeferComment->fContentStart - 1 : @@ -1242,6 +1224,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti --bodyEnd; } int blockSize = (int) (bodyEnd - fStart); + SkASSERT(blockSize >= 0); if (blockSize) { string debugstr(fStart, blockSize); this->writeBlock(blockSize, fStart); @@ -1617,6 +1600,7 @@ bool IncludeWriter::populate(BmhParser& bmhParser) { RootDefinition* root = &bmhParser.fClassMap[skClassName]; fRootTopic = root->fParent; root->clearVisited(); + fFileName = includeMapper.second.fFileName; fStart = includeMapper.second.fContentStart; fEnd = includeMapper.second.fContentEnd; fAnonymousEnumCount = 1; diff --git a/tools/bookmaker/mdOut.cpp b/tools/bookmaker/mdOut.cpp index 4b4e2b89be..db6a8cf7d6 100644 --- a/tools/bookmaker/mdOut.cpp +++ b/tools/bookmaker/mdOut.cpp @@ -16,11 +16,11 @@ } \ fprintf(fOut, __VA_ARGS__) -static void add_ref(const string& leadingSpaces, const string& ref, string* result) { +static void add_ref(string leadingSpaces, string ref, string* result) { *result += leadingSpaces + ref; } -static string preformat(const string& orig) { +static string preformat(string orig) { string result; for (auto c : orig) { if ('<' == c) { @@ -34,7 +34,7 @@ static string preformat(const string& orig) { return result; } -static bool all_lower(const string& ref) { +static bool all_lower(string ref) { for (auto ch : ref) { if (!islower(ch)) { return false; @@ -57,6 +57,12 @@ string MdOut::addReferences(const char* refStart, const char* refEnd, const char* base = t.fChar; t.skipWhiteSpace(); const char* wordStart = t.fChar; + if (BmhParser::Resolvable::kFormula == resolvable && !t.eof() && '"' == t.peek()) { + t.next(); + t.skipToEndBracket('"'); + t.next(); + continue; + } t.skipToMethodStart(); const char* start = t.fChar; if (wordStart < start) { @@ -179,14 +185,16 @@ string MdOut::addReferences(const char* refStart, const char* refEnd, // look for Sk / sk / SK .. if (!ref.compare(0, 2, "Sk") && ref != "Skew" && ref != "Skews" && ref != "Skip" && ref != "Skips") { - if (BmhParser::Resolvable::kOut != resolvable) { + if (BmhParser::Resolvable::kOut != resolvable && + BmhParser::Resolvable::kFormula != resolvable) { t.reportError("missed Sk prefixed"); fAddRefFailed = true; return result; } } if (!ref.compare(0, 2, "SK")) { - if (BmhParser::Resolvable::kOut != resolvable) { + if (BmhParser::Resolvable::kOut != resolvable && + BmhParser::Resolvable::kFormula != resolvable) { t.reportError("missed SK prefixed"); fAddRefFailed = true; return result; @@ -196,7 +204,7 @@ string MdOut::addReferences(const char* refStart, const char* refEnd, // TODO: // look for all lowercase w/o trailing parens as mistaken method matches // will also need to see if Example Description matches var in example - const Definition* def; + const Definition* def = nullptr; if (fMethod && (def = fMethod->hasParam(ref))) { result += linkRef(leadingSpaces, def, ref, resolvable); fLastParam = def; @@ -268,7 +276,8 @@ string MdOut::addReferences(const char* refStart, const char* refEnd, } while ((test = test->fParent)); found: if (!test) { - if (BmhParser::Resolvable::kOut != resolvable) { + if (BmhParser::Resolvable::kOut != resolvable && + BmhParser::Resolvable::kFormula != resolvable) { t.reportError("undefined reference"); fAddRefFailed = true; } else { @@ -385,11 +394,13 @@ bool MdOut::buildRefFromFile(const char* name, const char* outDir) { fPopulators[kClassesAndStructs].fDescription = "embedded struct and class members"; fPopulators[kConstants].fDescription = "enum and enum class, const values"; fPopulators[kConstructors].fDescription = "functions that construct"; + fPopulators[kDefines].fDescription = "preprocessor definitions of functions, values"; fPopulators[kMemberFunctions].fDescription = "static functions and member methods"; fPopulators[kMembers].fDescription = "member values"; fPopulators[kOperators].fDescription = "operator overloading methods"; fPopulators[kRelatedFunctions].fDescription = "similar methods grouped together"; fPopulators[kSubtopics].fDescription = ""; + fPopulators[kTypedefs].fDescription = "types defined by other types"; this->populateTables(fRoot); this->markTypeOut(topicDef); } @@ -416,7 +427,7 @@ bool MdOut::checkParamReturnBody(const Definition* def) { TextParser paramBody(def); const char* descriptionStart = paramBody.fChar; if (!islower(descriptionStart[0]) && !isdigit(descriptionStart[0])) { - paramBody.skipToNonAlphaNum(); + paramBody.skipToNonName(); string ref = string(descriptionStart, paramBody.fChar - descriptionStart); if (!this->isDefined(paramBody, ref, BmhParser::Resolvable::kYes)) { string errorStr = MarkType::kReturn == def->fMarkType ? "return" : "param"; @@ -504,7 +515,7 @@ const Definition* MdOut::findParamType() { return nullptr; } -const Definition* MdOut::isDefined(const TextParser& parser, const string& ref, +const Definition* MdOut::isDefined(const TextParser& parser, string ref, BmhParser::Resolvable resolvable) { auto rootIter = fBmhParser.fClassMap.find(ref); if (rootIter != fBmhParser.fClassMap.end()) { @@ -530,6 +541,10 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref, if (aliasIter != fBmhParser.fAliasMap.end()) { return aliasIter->second; } + auto defineIter = fBmhParser.fDefineMap.find(ref); + if (defineIter != fBmhParser.fDefineMap.end()) { + return &defineIter->second; + } for (const auto& external : fBmhParser.fExternals) { if (external.fName == ref) { return &external; @@ -682,8 +697,8 @@ string MdOut::linkName(const Definition* ref) const { // for now, hard-code to html links // def should not include SkXXX_ -string MdOut::linkRef(const string& leadingSpaces, const Definition* def, - const string& ref, BmhParser::Resolvable resolvable) const { +string MdOut::linkRef(string leadingSpaces, const Definition* def, + string ref, BmhParser::Resolvable resolvable) const { string buildup; string refName; const string* str = &def->fFiddle; @@ -1015,7 +1030,7 @@ void MdOut::markTypeOut(Definition* def) { paramParser.skipWhiteSpace(); SkASSERT(paramParser.startsWith("#Param")); paramParser.next(); // skip hash - paramParser.skipToNonAlphaNum(); // skip Param + paramParser.skipToNonName(); // skip Param paramParser.skipSpace(); const char* paramName = paramParser.fChar; paramParser.skipToSpace(); @@ -1140,7 +1155,7 @@ void MdOut::markTypeOut(Definition* def) { break; default: SkDebugf("fatal error: MarkType::k%s unhandled in %s()\n", - fBmhParser.fMaps[(int) def->fMarkType].fName, __func__); + BmhParser::kMarkProps[(int) def->fMarkType].fName, __func__); SkASSERT(0); // handle everything break; } @@ -1276,9 +1291,9 @@ void MdOut::populateTables(const Definition* def) { if (MarkType::kTopic == child->fMarkType || MarkType::kSubtopic == child->fMarkType) { string name = child->fName; bool builtInTopic = name == kClassesAndStructs || name == kConstants - || name == kConstructors || name == kMemberFunctions || name == kMembers - || name == kOperators || name == kOverview || name == kRelatedFunctions - || name == kSubtopics; + || name == kConstructors || name == kDefines || name == kMemberFunctions + || name == kMembers || name == kOperators || name == kOverview + || name == kRelatedFunctions || name == kSubtopics || name == kTypedefs; if (!builtInTopic && child->fName != kOverview) { this->populator(kRelatedFunctions).fMembers.push_back(child); } @@ -1298,10 +1313,16 @@ void MdOut::populateTables(const Definition* def) { this->populator(kConstants).fMembers.push_back(child); continue; } + if (MarkType::kDefine == child->fMarkType) { + this->populator(kDefines).fMembers.push_back(child); + } if (MarkType::kMember == child->fMarkType) { this->populator(kMembers).fMembers.push_back(child); continue; } + if (MarkType::kTypedef == child->fMarkType) { + this->populator(kTypedefs).fMembers.push_back(child); + } if (MarkType::kMethod != child->fMarkType) { continue; } @@ -1410,7 +1431,7 @@ void MdOut::resolveOut(const char* start, const char* end, BmhParser::Resolvable } } -void MdOut::rowOut(const char* name, const string& description) { +void MdOut::rowOut(const char* name, string description) { this->lfAlways(1); FPRINTF("| "); this->resolveOut(name, name + strlen(name), BmhParser::Resolvable::kYes); @@ -1425,8 +1446,8 @@ void MdOut::subtopicsOut() { SkASSERT(csParent); this->rowOut("name", "description"); this->rowOut("---", "---"); - for (auto item : { kClassesAndStructs, kConstants, kConstructors, kMemberFunctions, - kMembers, kOperators, kRelatedFunctions } ) { + for (auto item : { kClassesAndStructs, kConstants, kConstructors, kDefines, + kMemberFunctions, kMembers, kOperators, kRelatedFunctions, kTypedefs } ) { for (auto entry : this->populator(item).fMembers) { if (entry->csParent() == csParent) { string description = fPopulators.find(item)->second.fDescription; diff --git a/tools/bookmaker/spellCheck.cpp b/tools/bookmaker/spellCheck.cpp index e5ad746379..488ceacc7d 100644 --- a/tools/bookmaker/spellCheck.cpp +++ b/tools/bookmaker/spellCheck.cpp @@ -47,7 +47,7 @@ private: void childCheck(const Definition* def, const char* start); void leafCheck(const char* start, const char* end); bool parseFromFile(const char* path) override { return true; } - void printCheck(const string& str); + void printCheck(string str); void reset() override { INHERITED::resetCommon(); @@ -60,7 +60,7 @@ private: fInStdOut = false; } - void wordCheck(const string& str); + void wordCheck(string str); void wordCheck(ptrdiff_t len, const char* ch); unordered_map<string, CheckEntry> fCode; @@ -121,7 +121,7 @@ bool SpellCheck::check(const char* match) { return true; } -static bool all_lower(const string& str) { +static bool all_lower(string str) { for (auto c : str) { if (!islower(c)) { return false; @@ -231,7 +231,7 @@ bool SpellCheck::check(Definition* def) { paramParser.skipWhiteSpace(); SkASSERT(paramParser.startsWith("#Param")); paramParser.next(); // skip hash - paramParser.skipToNonAlphaNum(); // skip Param + paramParser.skipToNonName(); // skip Param paramParser.skipSpace(); const char* paramName = paramParser.fChar; paramParser.skipToSpace(); @@ -345,7 +345,7 @@ bool SpellCheck::check(Definition* def) { } bool SpellCheck::checkable(MarkType markType) { - return BmhParser::Resolvable::kYes == fBmhParser.fMaps[(int) markType].fResolve; + return BmhParser::Resolvable::kYes == fBmhParser.kMarkProps[(int) markType].fResolve; } void SpellCheck::childCheck(const Definition* def, const char* start) { @@ -459,7 +459,7 @@ void SpellCheck::leafCheck(const char* start, const char* end) { } while (++chPtr <= end); } -void SpellCheck::printCheck(const string& str) { +void SpellCheck::printCheck(string str) { string word; for (std::stringstream stream(str); stream >> word; ) { wordCheck(word); @@ -566,7 +566,7 @@ void SpellCheck::report(SkCommandLineFlags::StringArray report) { } } -void SpellCheck::wordCheck(const string& str) { +void SpellCheck::wordCheck(string str) { if ("nullptr" == str) { return; // doesn't seem worth it, treating nullptr as a word in need of correction } |