当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLCanvasElement::toDataURL方法代码示例

本文整理汇总了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;
}
开发者ID:jackyglony,项目名称:DuiBrowser-1,代码行数:14,代码来源:JSHTMLCanvasElement.cpp

示例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);
}
开发者ID:Treeeater,项目名称:Chromium_on_windows,代码行数:17,代码来源:V8HTMLCanvasElementCustom.cpp

示例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());
}
开发者ID:smil-in-javascript,项目名称:blink,代码行数:18,代码来源:V8HTMLCanvasElementCustom.cpp

示例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());
}
开发者ID:dog-god,项目名称:iptv,代码行数:18,代码来源:V8HTMLCanvasElementCustom.cpp

示例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;
}
开发者ID:Moondee,项目名称:Artemis,代码行数:20,代码来源:JSHTMLCanvasElementCustom.cpp


注:本文中的HTMLCanvasElement::toDataURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。