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


C++ CanvasRenderingContext2D::setStrokeColor方法代码示例

本文整理汇总了C++中CanvasRenderingContext2D::setStrokeColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CanvasRenderingContext2D::setStrokeColor方法的具体用法?C++ CanvasRenderingContext2D::setStrokeColor怎么用?C++ CanvasRenderingContext2D::setStrokeColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CanvasRenderingContext2D的用法示例。


在下文中一共展示了CanvasRenderingContext2D::setStrokeColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void V8CanvasRenderingContext2D::strokeStyleAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
    if (value->IsString())
        impl->setStrokeColor(toWebCoreString(value));
    else
        impl->setStrokeStyle(toCanvasStyle(value, info.GetIsolate()));
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:8,代码来源:V8CanvasRenderingContext2DCustom.cpp

示例2:

void JSCanvasRenderingContext2D::setStrokeStyle(ExecState* exec, JSValue value)
{
    CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());
    if (value.isString()) {
        context->setStrokeColor(asString(value)->value(exec));
        return;
    }
    context->setStrokeStyle(toHTMLCanvasStyle(exec, value));
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:9,代码来源:JSCanvasRenderingContext2DCustom.cpp

示例3:

void V8CanvasRenderingContext2D::strokeStyleAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
    CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
    if (RefPtr<CanvasStyle> canvasStyle = toCanvasStyle(value, info.GetIsolate())) {
        impl->setStrokeStyle(canvasStyle);
    } else {
        TOSTRING_VOID(V8StringResource<>, colorString, value);
        impl->setStrokeColor(colorString);
    }
}
开发者ID:coinpayee,项目名称:blink,代码行数:10,代码来源:V8CanvasRenderingContext2DCustom.cpp

示例4: switch

// TODO: SetStrokeColor and SetFillColor are similar except function names,
// consolidate them into one.
v8::Handle<v8::Value> V8CanvasRenderingContext2D::setStrokeColorCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.CanvasRenderingContext2D.setStrokeColor()");
    CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
    switch (args.Length()) {
    case 1:
        if (args[0]->IsString())
            context->setStrokeColor(toWebCoreString(args[0]));
        else
            context->setStrokeColor(toFloat(args[0]));
        break;
    case 2:
        if (args[0]->IsString())
            context->setStrokeColor(toWebCoreString(args[0]), toFloat(args[1]));
        else
            context->setStrokeColor(toFloat(args[0]), toFloat(args[1]));
        break;
    case 4:
        context->setStrokeColor(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]));
        break;
    case 5:
        context->setStrokeColor(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]));
        break;
    default:
        V8Proxy::throwError(V8Proxy::SyntaxError, "setStrokeColor: Invalid number of arguments");
        break;
    }
    return v8::Undefined();
}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:31,代码来源:V8CanvasRenderingContext2DCustom.cpp

示例5: throwError

JSValue* JSCanvasRenderingContext2D::setStrokeColor(ExecState* exec, const ArgList& args)
{ 
    CanvasRenderingContext2D* context = impl();

    // string arg = named color
    // number arg = gray color
    // string arg, number arg = named color, alpha
    // number arg, number arg = gray color, alpha
    // 4 args = r, g, b, a
    // 5 args = c, m, y, k, a
    switch (args.size()) {
        case 1:
            if (args[0]->isString())
                context->setStrokeColor(static_cast<JSString*>(args[0])->value());
            else
                context->setStrokeColor(args[0]->toFloat(exec));
            break;
        case 2:
            if (args[0]->isString())
                context->setStrokeColor(static_cast<JSString*>(args[0])->value(), args[1]->toFloat(exec));
            else
                context->setStrokeColor(args[0]->toFloat(exec), args[1]->toFloat(exec));
            break;
        case 4:
            context->setStrokeColor(args[0]->toFloat(exec), args[1]->toFloat(exec),
                                    args[2]->toFloat(exec), args[3]->toFloat(exec));
            break;
        case 5:
            context->setStrokeColor(args[0]->toFloat(exec), args[1]->toFloat(exec),
                                    args[2]->toFloat(exec), args[3]->toFloat(exec), args[4]->toFloat(exec));
            break;
        default:
            return throwError(exec, SyntaxError);
    }
    
    return jsUndefined();
}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:37,代码来源:JSCanvasRenderingContext2DCustom.cpp


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