本文整理汇总了C++中sk_sp::seek方法的典型用法代码示例。如果您正苦于以下问题:C++ sk_sp::seek方法的具体用法?C++ sk_sp::seek怎么用?C++ sk_sp::seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sk_sp
的用法示例。
在下文中一共展示了sk_sp::seek方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDraw
DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override {
if (!fAnim) {
*errorMsg = "No animation.";
return DrawResult::kFail;
}
SkMatrix44 camera,
perspective,
mv;
SkMatrix viewport;
{
float w = this->width();
float h = this->height();
float s = std::min(w, h);
viewport.setTranslate(1, -1);
viewport.postScale(s/2, -s/2);
draw_viewport(canvas, viewport);
}
Sk3Perspective(&perspective, fNear, fFar, fAngle);
Sk3LookAt(&camera, fEye, fCOA, fUp);
mv.postConcat(camera);
mv.postConcat(perspective);
SkPoint pts[8];
Sk3MapPts(pts, mv, fP3, 8);
viewport.mapPoints(pts, 8);
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
SkFont font;
font.setEdging(SkFont::Edging::kAlias);
SkPath cube;
cube.moveTo(pts[0]);
cube.lineTo(pts[2]);
cube.lineTo(pts[6]);
cube.lineTo(pts[4]);
cube.close();
cube.moveTo(pts[1]);
cube.lineTo(pts[3]);
cube.lineTo(pts[7]);
cube.lineTo(pts[5]);
cube.close();
cube.moveTo(pts[0]); cube.lineTo(pts[1]);
cube.moveTo(pts[2]); cube.lineTo(pts[3]);
cube.moveTo(pts[4]); cube.lineTo(pts[5]);
cube.moveTo(pts[6]); cube.lineTo(pts[7]);
canvas->drawPath(cube, paint);
{
SkPoint3 src[4] = {
{ 0, 0, 0 }, { 2, 0, 0 }, { 0, 2, 0 }, { 0, 0, 2 },
};
SkPoint dst[4];
mv.setConcat(perspective, camera);
Sk3MapPts(dst, mv, src, 4);
viewport.mapPoints(dst, 4);
const char* str[3] = { "X", "Y", "Z" };
for (int i = 1; i <= 3; ++i) {
canvas->drawLine(dst[0], dst[i], paint);
}
for (int i = 0; i < 3; ++i) {
canvas->drawString(str[i], dst[i + 1].fX, dst[i + 1].fY, font, paint);
}
}
fAnim->seek(fAnimT);
draw_skia(canvas, mv, viewport, fAnim.get());
return DrawResult::kOk;
}