diff options
author | Ruiqi Mao <ruiqimao@google.com> | 2018-07-02 15:20:10 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-03 13:33:43 +0000 |
commit | 94d57c477fe122c146a034c625cebb6c44ef21b0 (patch) | |
tree | c2709663d47bce026cc465ff6cda2b77f1c59efa /docs | |
parent | d7425b58df89b1cf67cf9a8b0a055c1d071a6d88 (diff) |
updated SkCanvas documentation for animation overloads of drawVertices
changed bookmaker ParserCommon::writeBlockTrim limit to 20000
disabled broken SkPaint::containsText example
Docs-Preview: https://skia.org/?cl=138862
Bug: skia:8123
Change-Id: Ib4003bf7b9603bf652f86cd56e0975cd09bcbf71
Reviewed-on: https://skia-review.googlesource.com/138862
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/SkCanvas_Reference.bmh | 100 | ||||
-rw-r--r-- | docs/SkPaint_Reference.bmh | 2 | ||||
-rw-r--r-- | docs/usingBookmaker.bmh | 2 |
3 files changed, 101 insertions, 3 deletions
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh index fc6093cf7a..cfeef6331b 100644 --- a/docs/SkCanvas_Reference.bmh +++ b/docs/SkCanvas_Reference.bmh @@ -5752,7 +5752,105 @@ void draw(SkCanvas* canvas) { SkShader::kClamp_TileMode)); auto vertices = SkVertices::MakeCopy(SkVertices::kTriangleFan_VertexMode, SK_ARRAY_COUNT(points), points, texs, colors); - canvas->drawVertices(vertices.get(), SkBlendMode::kDarken, paint); + canvas->drawVertices(vertices, SkBlendMode::kDarken, paint); +} +## + +#SeeAlso drawPatch drawPicture + +## + +# ------------------------------------------------------------------------------ + +#Method void drawVertices(const SkVertices* vertices, const SkMatrix* bones, int boneCount, + SkBlendMode mode, const SkPaint& paint) + +Draw Vertices vertices, a triangle mesh, using Clip and Matrix. Bone data is used to +deform vertices with bone weights. +If Vertices_Texs and Vertices_Colors are defined in vertices, and Paint paint +contains Shader, Blend_Mode mode combines Vertices_Colors with Shader. +The first element of bones should be an object to world space transformation matrix that +will be applied before performing mesh deformations. If no such transformation is needed, +it should be the identity matrix. + +#Param vertices triangle mesh to draw ## +#Param bones bone matrix data ## +#Param boneCount number of bone matrices ## +#Param mode combines Vertices_Colors with Shader, if both are present ## +#Param paint specifies the Shader, used as Vertices texture, may be nullptr ## + +#Example +void draw(SkCanvas* canvas) { + SkPaint paint; + SkPoint points[] = { { 0, 0 }, { 250, 0 }, { 100, 100 }, { 0, 250 } }; + SkPoint texs[] = { { 0, 0 }, { 0, 250 }, { 250, 250 }, { 250, 0 } }; + SkColor colors[] = { SK_ColorRED, SK_ColorBLUE, SK_ColorYELLOW, SK_ColorCYAN }; + SkVertices::BoneIndices boneIndices[] = { { 0, 0, 0, 0 }, + { 1, 0, 0, 0 }, + { 2, 0, 0, 0 }, + { 3, 0, 0, 0 } }; + SkVertices::BoneWeights boneWeights[] = { { 0.0f, 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f, 0.0f } }; + SkMatrix bones[] = { SkMatrix::I(), + SkMatrix::MakeTrans(0, 20), + SkMatrix::MakeTrans(50, 50), + SkMatrix::MakeTrans(20, 0) }; + paint.setShader(SkGradientShader::MakeLinear(points, colors, nullptr, 4, + SkShader::kClamp_TileMode)); + auto vertices = SkVertices::MakeCopy(SkVertices::kTriangleFan_VertexMode, + SK_ARRAY_COUNT(points), points, texs, colors, boneIndices, boneWeights); + canvas->drawVertices(vertices.get(), bones, SK_ARRAY_COUNT(bones), SkBlendMode::kDarken, paint); +} +## + +#SeeAlso drawPatch drawPicture + +## + +# ------------------------------------------------------------------------------ + +#Method void drawVertices(const sk_sp<SkVertices>& vertices, const SkMatrix* bones, int boneCount, + SkBlendMode mode, const SkPaint& paint) + +Draw Vertices vertices, a triangle mesh, using Clip and Matrix. Bone data is used to +deform vertices with bone weights. +If Vertices_Texs and Vertices_Colors are defined in vertices, and Paint paint +contains Shader, Blend_Mode mode combines Vertices_Colors with Shader. +The first element of bones should be an object to world space transformation matrix that +will be applied before performing mesh deformations. If no such transformation is needed, +it should be the identity matrix. + +#Param vertices triangle mesh to draw ## +#Param bones bone matrix data ## +#Param boneCount number of bone matrices ## +#Param mode combines Vertices_Colors with Shader, if both are present ## +#Param paint specifies the Shader, used as Vertices texture, may be nullptr ## + +#Example +void draw(SkCanvas* canvas) { + SkPaint paint; + SkPoint points[] = { { 0, 0 }, { 250, 0 }, { 100, 100 }, { 0, 250 } }; + SkPoint texs[] = { { 0, 0 }, { 0, 250 }, { 250, 250 }, { 250, 0 } }; + SkColor colors[] = { SK_ColorRED, SK_ColorBLUE, SK_ColorYELLOW, SK_ColorCYAN }; + SkVertices::BoneIndices boneIndices[] = { { 0, 0, 0, 0 }, + { 1, 0, 0, 0 }, + { 2, 0, 0, 0 }, + { 3, 0, 0, 0 } }; + SkVertices::BoneWeights boneWeights[] = { { 0.0f, 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f, 0.0f } }; + SkMatrix bones[] = { SkMatrix::I(), + SkMatrix::MakeTrans(0, 20), + SkMatrix::MakeTrans(50, 50), + SkMatrix::MakeTrans(20, 0) }; + paint.setShader(SkGradientShader::MakeLinear(points, colors, nullptr, 4, + SkShader::kClamp_TileMode)); + auto vertices = SkVertices::MakeCopy(SkVertices::kTriangleFan_VertexMode, + SK_ARRAY_COUNT(points), points, texs, colors, boneIndices, boneWeights); + canvas->drawVertices(vertices, bones, SK_ARRAY_COUNT(bones), SkBlendMode::kDarken, paint); } ## diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh index 21521af798..2b844fc9eb 100644 --- a/docs/SkPaint_Reference.bmh +++ b/docs/SkPaint_Reference.bmh @@ -4394,7 +4394,7 @@ text contains an invalid UTF-8 sequence, zero is returned. #Return true if all text corresponds to a non-zero glyph index ## - #Example + #NoExample #Description containsText succeeds for degree symbol, but cannot find a glyph index corresponding to the Unicode surrogate code point. diff --git a/docs/usingBookmaker.bmh b/docs/usingBookmaker.bmh index d804a3e37f..236c16d7c5 100644 --- a/docs/usingBookmaker.bmh +++ b/docs/usingBookmaker.bmh @@ -122,7 +122,7 @@ Get the fiddle command line interface tool. By default this will appear in your home directory. #Code -$ go get go.skia.org/infra/fiddle/go/fiddlecli +$ go get go.skia.org/infra/fiddlek/go/fiddlecli ## Build Bookmaker. |