本文整理汇总了C++中CanvasRenderingContext2D::strokeText方法的典型用法代码示例。如果您正苦于以下问题:C++ CanvasRenderingContext2D::strokeText方法的具体用法?C++ CanvasRenderingContext2D::strokeText怎么用?C++ CanvasRenderingContext2D::strokeText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CanvasRenderingContext2D
的用法示例。
在下文中一共展示了CanvasRenderingContext2D::strokeText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notHandledByInterceptor
v8::Handle<v8::Value> V8CanvasRenderingContext2D::strokeTextCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.strokeText()");
CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
// Two forms:
// * strokeText(text, x, y)
// * strokeText(text, x, y, maxWidth)
if (args.Length() < 3 || args.Length() > 4) {
V8Proxy::setDOMException(SYNTAX_ERR);
return notHandledByInterceptor();
}
String text = toWebCoreString(args[0]);
float x = toFloat(args[1]);
float y = toFloat(args[2]);
if (args.Length() == 4) {
float maxWidth = toFloat(args[3]);
context->strokeText(text, x, y, maxWidth);
} else
context->strokeText(text, x, y);
return v8::Undefined();
}
示例2: throwError
JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec, const ArgList& args)
{
CanvasRenderingContext2D* context = impl();
// string arg = text to draw
// number arg = x
// number arg = y
// optional number arg = maxWidth
if (args.size() < 3 || args.size() > 4)
return throwError(exec, SyntaxError);
if (args.size() == 4)
context->strokeText(args.at(0).toString(exec), args.at(1).toFloat(exec), args.at(2).toFloat(exec), args.at(3).toFloat(exec));
else
context->strokeText(args.at(0).toString(exec), args.at(1).toFloat(exec), args.at(2).toFloat(exec));
return jsUndefined();
}