本文整理汇总了C++中HTMLCanvasElement::toDataURL方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLCanvasElement::toDataURL方法的具体用法?C++ HTMLCanvasElement::toDataURL怎么用?C++ HTMLCanvasElement::toDataURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLCanvasElement
的用法示例。
在下文中一共展示了HTMLCanvasElement::toDataURL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsHTMLCanvasElementPrototypeFunctionToDataURL
JSValue* jsHTMLCanvasElementPrototypeFunctionToDataURL(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSHTMLCanvasElement::s_info))
return throwError(exec, TypeError);
JSHTMLCanvasElement* castedThisObj = static_cast<JSHTMLCanvasElement*>(thisValue);
HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(castedThisObj->impl());
ExceptionCode ec = 0;
const UString& type = valueToStringWithUndefinedOrNullCheck(exec, args[0]);
KJS::JSValue* result = jsString(exec, imp->toDataURL(type, ec));
setDOMException(exec, ec);
return result;
}
示例2: toWebCoreString
v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments& args)
{
double quality = 1.0;
if (args.Length() > 1) {
if (args[1]->IsNumber())
quality = args[1]->NumberValue();
if (!(0.0 <= quality && quality <= 1.0))
quality = 1.0;
}
v8::Handle<v8::Object> holder = args.Holder();
HTMLCanvasElement* canvas = V8HTMLCanvasElement::toNative(holder);
String type = toWebCoreString(args[0]);
ExceptionCode ec = 0;
String result = canvas->toDataURL(type, &quality, ec);
V8Proxy::setDOMException(ec);
return v8StringOrUndefined(result);
}
示例3: exceptionState
void V8HTMLCanvasElement::toDataURLMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Handle<v8::Object> holder = info.Holder();
HTMLCanvasElement* canvas = V8HTMLCanvasElement::toNative(holder);
ExceptionState exceptionState(ExceptionState::ExecutionContext, "toDataURL", "HTMLCanvasElement", info.Holder(), info.GetIsolate());
TOSTRING_VOID(V8StringResource<>, type, info[0]);
double quality;
double* qualityPtr = 0;
if (info.Length() > 1 && info[1]->IsNumber()) {
quality = info[1]->NumberValue();
qualityPtr = &quality;
}
String result = canvas->toDataURL(type, qualityPtr, exceptionState);
exceptionState.throwIfNeeded();
v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate());
}
示例4: toWebCoreString
v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments& args)
{
v8::Handle<v8::Object> holder = args.Holder();
HTMLCanvasElement* canvas = V8HTMLCanvasElement::toNative(holder);
ExceptionCode ec = 0;
String type = toWebCoreString(args[0]);
double quality;
double* qualityPtr = 0;
if (args.Length() > 1 && args[1]->IsNumber()) {
quality = args[1]->NumberValue();
qualityPtr = &quality;
}
String result = canvas->toDataURL(type, qualityPtr, ec);
setDOMException(ec, args.GetIsolate());
return v8StringOrUndefined(result, args.GetIsolate());
}
示例5: toDataURL
JSValue JSHTMLCanvasElement::toDataURL(ExecState* exec)
{
HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl());
ExceptionCode ec = 0;
const String& type = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
double quality;
double* qualityPtr = 0;
if (exec->argumentCount() > 1) {
JSValue v = exec->argument(1);
if (v.isNumber()) {
quality = v.toNumber(exec);
qualityPtr = &quality;
}
}
JSValue result = jsString(exec, canvas->toDataURL(type, qualityPtr, ec));
setDOMException(exec, ec);
return result;
}