• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parseColor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中parseColor函数的典型用法代码示例。如果您正苦于以下问题:C++ parseColor函数的具体用法?C++ parseColor怎么用?C++ parseColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: GetParameters

    void MaterialLibrary::Load()
    {
        ResourceType* currMat = nullptr;
        std::string currLine;
        auto filename = Resource::application->GetConfig().resourceBase + "/" + GetParameters()[0];
        std::ifstream inFile(filename);

        if (!inFile.is_open()) {
            throw resource_loading_error() << ::boost::errinfo_file_name(filename) << resid_info(id) << errdesc_info("Cannot open file.");
        }

        boost::regex reg_newmtl("^newmtl\\s+(\\w+)$");
        boost::regex reg_Ka("^Ka\\s+" + regex_help::flt3 + "$");
        boost::regex reg_Kd("^Kd\\s+" + regex_help::flt3 + "$");
        boost::regex reg_Ks("^Ks\\s+" + regex_help::flt3 + "$");
        boost::regex reg_d("^d\\s+" + regex_help::flt + "$");
        boost::regex reg_d_halo("^d\\s+-halo\\s+" + regex_help::flt + "$");
        boost::regex reg_Ns("^Ns\\s+" + regex_help::flt + "$");
        boost::regex reg_Ni("^Ni\\s+" + regex_help::flt + "$");
        boost::regex reg_map_Kd("^map_Kd\\s+(.*\\s+)?([\\w-]+\\.\\w+)$");
        boost::regex reg_map_bump("^(map_bump|bump)\\s+(.*\\s+)?([\\w-]+\\.\\w+)$");

        boost::smatch lineMatch;

        while (inFile.good()) {
            std::getline(inFile, currLine);

            boost::trim(currLine);
            if (currLine.length() == 0 || boost::starts_with(currLine, "#"))
                continue; // comment or empty line
            if (boost::regex_match(currLine, lineMatch, reg_newmtl)) {
                auto mtlName = lineMatch[1].str();
                currMat = SetResource(mtlName, std::move(std::make_unique<Material>()));
            } else if (boost::regex_match(currLine, lineMatch, reg_Ka) && currMat) {
                currMat->ambient = parseColor(lineMatch);
            } else if (boost::regex_match(currLine, lineMatch, reg_Kd) && currMat) {
                currMat->diffuse = parseColor(lineMatch);
            } else if (boost::regex_match(currLine, lineMatch, reg_Ks) && currMat) {
                currMat->specular = parseColor(lineMatch);
            } else if (boost::regex_match(currLine, lineMatch, reg_d) && currMat) {
                currMat->alpha = boost::lexical_cast<float>(lineMatch[1].str());
            } else if (boost::regex_match(currLine, lineMatch, reg_d_halo) && currMat) {
                currMat->minOrientedAlpha = boost::lexical_cast<float>(lineMatch[1].str());
            } else if (boost::regex_match(currLine, lineMatch, reg_Ns) && currMat) {
                currMat->N_s = boost::lexical_cast<float>(lineMatch[1].str());
            } else if (boost::regex_match(currLine, lineMatch, reg_Ni) && currMat) {
                currMat->N_i = boost::lexical_cast<float>(lineMatch[1].str());
            } else if (boost::regex_match(currLine, lineMatch, reg_map_Kd) && currMat) {
                currMat->diffuseTex = parseTexture(lineMatch[2].str(), "sRGB");
            } else if (boost::regex_match(currLine, lineMatch, reg_map_bump) && currMat) {
                currMat->bumpTex = parseTexture(lineMatch[3].str(), "");
                currMat->bumpMultiplier = parseFloatParameter("-bm", lineMatch[2].str(), 1.0f);
            } else {
                notImplemented(currLine);
            }
        }
        inFile.close();

        Resource::Load();
    }
开发者ID:dasmysh,项目名称:OGLFramework_uulm,代码行数:60,代码来源:MaterialLibrary.cpp


示例2: KdmItem

KdmLabel::KdmLabel( QObject *parent, const QDomNode &node )
	: KdmItem( parent, node )
	, action( 0 )
{
	itemType = "label";

	// Set default values for label (note: strings are already Null)
	label.normal.font = label.active.font = label.prelight.font = style.font;
	label.normal.color = label.active.color = label.prelight.color =
		style.palette.isBrushSet( QPalette::Normal, QPalette::WindowText ) ?
			style.palette.color( QPalette::Normal, QPalette::WindowText ) :
			QColor( Qt::white );
	label.active.present = false;
	label.prelight.present = false;

	const QString locale = KGlobal::locale()->language();

	// Read LABEL TAGS
	QDomNodeList childList = node.childNodes();
	bool stockUsed = false;
	for (int nod = 0; nod < childList.count(); nod++) {
		QDomNode child = childList.item( nod );
		QDomElement el = child.toElement();
		QString tagName = el.tagName();

		if (tagName == "normal") {
			parseColor( el, label.normal.color );
			parseFont( el, label.normal.font );
		} else if (tagName == "active") {
			label.active.present = true;
			parseColor( el, label.active.color );
			parseFont( el, label.active.font );
		} else if (tagName == "prelight") {
			label.prelight.present = true;
			parseColor( el, label.prelight.color );
			parseFont( el, label.prelight.font );
		} else if (tagName == "text" && el.attributes().count() == 0 && !stockUsed) {
			label.text = el.text();
		} else if (tagName == "text" && !stockUsed) {
			QString lang = el.attribute( "xml:lang", "" );
			if (lang == locale)
				label.text = el.text();
		} else if (tagName == "stock") {
			label.text = lookupStock( el.attribute( "type", "" ) );
			stockUsed = true;
		}
	}

	// Check if this is a timer label
	label.isTimer = label.text.indexOf( "%c" ) >= 0;
	if (label.isTimer) {
		timer = new QTimer( this );
		timer->start( 1000 );
		connect( timer, SIGNAL(timeout()), SLOT(update()) );
	}
	label.text.replace( '\n', ' ' );
	setCText( lookupText( label.text ) );
}
开发者ID:jschwartzenberg,项目名称:kicker,代码行数:58,代码来源:kdmlabel.cpp


示例3: m_frame

TestPlugin::TestPlugin(WebFrame* frame, const WebPluginParams& params, WebTestDelegate* delegate)
    : m_frame(frame)
    , m_delegate(delegate)
    , m_container(0)
    , m_context(0)
    , m_colorTexture(0)
    , m_mailboxChanged(false)
    , m_framebuffer(0)
    , m_touchEventRequest(WebPluginContainer::TouchEventRequestTypeNone)
    , m_reRequestTouchEvents(false)
    , m_printEventDetails(false)
    , m_printUserGestureStatus(false)
    , m_canProcessDrag(false)
    , m_isPersistent(params.mimeType == pluginPersistsMimeType())
    , m_canCreateWithoutRenderer(params.mimeType == canCreateWithoutRendererMimeType())
{
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributePrimitive, ("primitive"));
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributeBackgroundColor, ("background-color"));
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributePrimitiveColor, ("primitive-color"));
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributeOpacity, ("opacity"));
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributeAcceptsTouch, ("accepts-touch"));
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributeReRequestTouchEvents, ("re-request-touch"));
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributePrintEventDetails, ("print-event-details"));
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributeCanProcessDrag, ("can-process-drag"));
    const CR_DEFINE_STATIC_LOCAL(WebString, kAttributePrintUserGestureStatus, ("print-user-gesture-status"));

    DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size());
    size_t size = params.attributeNames.size();
    for (size_t i = 0; i < size; ++i) {
        const WebString& attributeName = params.attributeNames[i];
        const WebString& attributeValue = params.attributeValues[i];

        if (attributeName == kAttributePrimitive)
            m_scene.primitive = parsePrimitive(attributeValue);
        else if (attributeName == kAttributeBackgroundColor)
            parseColor(attributeValue, m_scene.backgroundColor);
        else if (attributeName == kAttributePrimitiveColor)
            parseColor(attributeValue, m_scene.primitiveColor);
        else if (attributeName == kAttributeOpacity)
            m_scene.opacity = parseOpacity(attributeValue);
        else if (attributeName == kAttributeAcceptsTouch)
            m_touchEventRequest = parseTouchEventRequestType(attributeValue);
        else if (attributeName == kAttributeReRequestTouchEvents)
            m_reRequestTouchEvents = parseBoolean(attributeValue);
        else if (attributeName == kAttributePrintEventDetails)
            m_printEventDetails = parseBoolean(attributeValue);
        else if (attributeName == kAttributeCanProcessDrag)
            m_canProcessDrag = parseBoolean(attributeValue);
        else if (attributeName == kAttributePrintUserGestureStatus)
            m_printUserGestureStatus = parseBoolean(attributeValue);
    }
    if (m_canCreateWithoutRenderer)
        m_delegate->printMessage(std::string("TestPlugin: canCreateWithoutRenderer\n"));
}
开发者ID:Yoko2012,项目名称:webrtc,代码行数:54,代码来源:TestPlugin.cpp


示例4: inheritedAttribute

void SvgStyleParser::parseColorStops(QGradient *gradient, const KoXmlElement &e)
{
    QGradientStops stops;
    QColor c;

    for (KoXmlNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
        KoXmlElement stop = n.toElement();
        if (stop.tagName() == "stop") {
            float offset;
            QString temp = stop.attribute("offset");
            if (temp.contains('%')) {
                temp = temp.left(temp.length() - 1);
                offset = temp.toFloat() / 100.0;
            } else
                offset = temp.toFloat();

            QString stopColorStr = stop.attribute("stop-color");
            if (!stopColorStr.isEmpty()) {
                if (stopColorStr == "inherit") {
                    stopColorStr = inheritedAttribute("stop-color", stop);
                }
                parseColor(c, stopColorStr);
            }
            else {
                // try style attr
                QString style = stop.attribute("style").simplified();
                QStringList substyles = style.split(';', QString::SkipEmptyParts);
                for (QStringList::Iterator it = substyles.begin(); it != substyles.end(); ++it) {
                    QStringList substyle = it->split(':');
                    QString command = substyle[0].trimmed();
                    QString params  = substyle[1].trimmed();
                    if (command == "stop-color")
                        parseColor(c, params);
                    if (command == "stop-opacity")
                        c.setAlphaF(params.toDouble());
                }

            }
            QString opacityStr = stop.attribute("stop-opacity");
            if (!opacityStr.isEmpty()) {
                if (opacityStr == "inherit") {
                    opacityStr = inheritedAttribute("stop-opacity", stop);
                }
                c.setAlphaF(opacityStr.toDouble());
            }
            stops.append(QPair<qreal, QColor>(offset, c));
        }
    }
    if (stops.count())
        gradient->setStops(stops);
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:51,代码来源:SvgStyleParser.cpp


示例5: m_frame

TestPlugin::TestPlugin(WebFrame* frame, const WebPluginParams& params, WebTestDelegate* delegate)
    : m_frame(frame)
    , m_delegate(delegate)
    , m_container(0)
    , m_context(0)
    , m_colorTexture(0)
    , m_mailboxChanged(false)
    , m_framebuffer(0)
    , m_touchEventRequest(WebPluginContainer::TouchEventRequestTypeNone)
    , m_reRequestTouchEvents(false)
    , m_printEventDetails(false)
    , m_printUserGestureStatus(false)
    , m_canProcessDrag(false)
{
    static const WebString kAttributePrimitive = WebString::fromUTF8("primitive");
    static const WebString kAttributeBackgroundColor = WebString::fromUTF8("background-color");
    static const WebString kAttributePrimitiveColor = WebString::fromUTF8("primitive-color");
    static const WebString kAttributeOpacity = WebString::fromUTF8("opacity");
    static const WebString kAttributeAcceptsTouch = WebString::fromUTF8("accepts-touch");
    static const WebString kAttributeReRequestTouchEvents = WebString::fromUTF8("re-request-touch");
    static const WebString kAttributePrintEventDetails = WebString::fromUTF8("print-event-details");
    static const WebString kAttributeCanProcessDrag = WebString::fromUTF8("can-process-drag");
    static const WebString kAttributePrintUserGestureStatus = WebString::fromUTF8("print-user-gesture-status");

    BLINK_ASSERT(params.attributeNames.size() == params.attributeValues.size());
    size_t size = params.attributeNames.size();
    for (size_t i = 0; i < size; ++i) {
        const WebString& attributeName = params.attributeNames[i];
        const WebString& attributeValue = params.attributeValues[i];

        if (attributeName == kAttributePrimitive)
            m_scene.primitive = parsePrimitive(attributeValue);
        else if (attributeName == kAttributeBackgroundColor)
            parseColor(attributeValue, m_scene.backgroundColor);
        else if (attributeName == kAttributePrimitiveColor)
            parseColor(attributeValue, m_scene.primitiveColor);
        else if (attributeName == kAttributeOpacity)
            m_scene.opacity = parseOpacity(attributeValue);
        else if (attributeName == kAttributeAcceptsTouch)
            m_touchEventRequest = parseTouchEventRequestType(attributeValue);
        else if (attributeName == kAttributeReRequestTouchEvents)
            m_reRequestTouchEvents = parseBoolean(attributeValue);
        else if (attributeName == kAttributePrintEventDetails)
            m_printEventDetails = parseBoolean(attributeValue);
        else if (attributeName == kAttributeCanProcessDrag)
            m_canProcessDrag = parseBoolean(attributeValue);
        else if (attributeName == kAttributePrintUserGestureStatus)
            m_printUserGestureStatus = parseBoolean(attributeValue);
    }
}
开发者ID:rzr,项目名称:Tizen_Crosswalk,代码行数:50,代码来源:TestPlugin.cpp


示例6: if

void MTLFileReader::parseLine(const char*& current, const char* endOfLine)
{
	if(matchCommand(current, "newmtl"))
	{
		WavefrontMaterial mat;
		mat.name = current;
		materials.push_back(mat);

		current = endOfLine;
	}
	else if(matchCommand(current, "Ka")) // ambient color
		curMaterial().ambient = parseColor(current);
	else if(matchCommand(current, "Kd")) // diffuse color
		curMaterial().diffuse = parseColor(current);
	else if(matchCommand(current, "Ks")) // specular color
		curMaterial().specular = parseColor(current);
	else if(matchCommand(current, "Ns")) // specular exponent
		curMaterial().specularExp = parseFloat(current);
	else if(matchCommand(current, "Km")) // no idea what this is
		parseFloat(current);
	else if(matchCommand(current, "Ni")) // optical density
		curMaterial().refractiveInd = parseFloat(current);
  else if(matchCommand(current, "illum")) // illumination model
    curMaterial().illuminationModel = parseInt(current);
	else if(matchCommand(current, "d")) // dissolve
	{
		if(matchCommand(current, "-halo"))
			diagnostic(true, current, "dissolve halo not supported");

		curMaterial().opacity = parseFloat(current);
	}
	else if(matchCommand(current, "map_Kd")) // diffuse texture
	{
		curMaterial().diffuseTex = current;
		current = endOfLine;
	}
	else if(matchCommand(current, "map_Bump")) // bump texture
	{
		curMaterial().bumpTex = current;
		current = endOfLine;
	}
	else if(matchCommand(current, "map_d") || matchCommand(current, "map_D")) // opacity texture
	{
		curMaterial().opacityTex = current;
		current = endOfLine;
	}
	else
		diagnostic(false, current, "unknown command");
}
开发者ID:Ambrevar,项目名称:fr_public,代码行数:49,代码来源:_wavefront.cpp


示例7: parseColor

void
KdmRect::init( const TQDomNode &node, const char * )
{
	itemType = "rect";

	// Set default values for rect (note: strings are already Null)
	rect.normal.alpha = 1;
	rect.active.present = false;
	rect.prelight.present = false;
	rect.hasBorder = false;

	// A rect can have no properties (defaults to parent ones)
	if (node.isNull()) {
		return;
	}

	// Read RECT ID
	TQDomNode n = node;
	TQDomElement elRect = n.toElement();

	// Read RECT TAGS
	TQDomNodeList childList = node.childNodes();
	for (uint nod = 0; nod < childList.count(); nod++) {
		TQDomNode child = childList.item( nod );
		TQDomElement el = child.toElement();
		TQString tagName = el.tagName();

		if (tagName == "normal") {
			parseColor( el.attribute( "color", TQString::null ), rect.normal.color );
			rect.normal.alpha = el.attribute( "alpha", "1.0" ).toFloat();
			parseFont( el.attribute( "font", "Sans 14" ), rect.normal.font );
		}
		else if (tagName == "active") {
			rect.active.present = true;
			parseColor( el.attribute( "color", TQString::null ), rect.active.color );
			rect.active.alpha = el.attribute( "alpha", "1.0" ).toFloat();
			parseFont( el.attribute( "font", "Sans 14" ), rect.active.font );
		}
		else if (tagName == "prelight") {
			rect.prelight.present = true;
			parseColor( el.attribute( "color", TQString::null ), rect.prelight.color );
			rect.prelight.alpha = el.attribute( "alpha", "1.0" ).toFloat();
			parseFont( el.attribute( "font", "Sans 14" ), rect.prelight.font );
		}
		else if (tagName == "border") {
			rect.hasBorder = true;
		}
	}
}
开发者ID:Fat-Zer,项目名称:tdebase,代码行数:49,代码来源:tdmrect.cpp


示例8: _themeParseTextureEntry

static int _themeParseTextureEntry(const char *json, jsmntok_t *tokens, const char *name, void *context) {
    flubGuiTheme_t *theme = (flubGuiTheme_t *)context;
    _jsonTextureEntry_t entry;
    flubGuiThemeTexture_t *texture;
    int red = 0;
    int green = 0;
    int blue = 0;

    memset(&entry, 0, sizeof(_jsonTextureEntry_t));
    if(!jsonParseToStruct(json, tokens, _themeTextureParseMap, "Theme texture entry", &entry, _jsonTextureCleanup)) {
        return 0;
    }
    texture = util_calloc(sizeof(flubGuiThemeTexture_t), 0, NULL);
    texture->type = eFlubGuiThemeTexture;
    texture->id = entry.id;
    if(entry.colorkey != NULL) {
        parseColor(entry.colorkey, &red, &green, &blue, NULL);
    }
    if((texture->texture = texmgrLoad(entry.filename, NULL, entry.minfilter,
                                      entry.magfilter,
                                      ((entry.colorkey != NULL) ? 1 : 0),
                                      red, green, blue)) == NULL) {
        _jsonTextureCleanup(&entry);
        util_free(texture);
        return 0;
    }
    critbitInsert(&theme->textures, name, texture, NULL);
    _flubGuiThemeIndexAdd(theme, entry.id, texture);
    debugf(DBG_GUI, DBG_GUI_DTL_THEME, "Found texture \"%s\" as %d, file [%s], %s %s %s", name, entry.id,
          entry.filename, texmgrGLMinFilterStr(entry.minfilter),
          texmgrGLMagFilterStr(entry.magfilter), ((entry.colorkey == NULL) ? "No colorkey" : entry.colorkey));
    _jsonTextureCleanup(&entry);
    return 1;
}
开发者ID:Mojofreem,项目名称:flub,代码行数:34,代码来源:theme.c


示例9: handleColorsSection

int handleColorsSection(gamedef_t *gamedef, const char *name, const char *value)
{
    int result = -1;
    draw_color_t colorBuf;

    for (int i = 0; i < validBoxTypes; i++)
    {
        if (strcmp(boxTypeNames[i], name) == 0) {
            currentName = name;
            result = parseColor(value, &colorBuf, boxFillAlpha);
            if (result == 0)
            {
                memcpy(&(boxFillColors[i]), &colorBuf, sizeof(colorBuf));
                memcpy(&(boxEdgeColors[i]), &colorBuf, sizeof(colorBuf));
                boxEdgeColors[i].a = boxEdgeAlpha;
            }
            POST_CHECK;
        }
    }

    MATCH_COLOR("playerPivot", playerPivotColor, pivotAlpha);
    MATCH_COLOR("rangeMarker", closeNormalRangeColor, closeNormalRangeAlpha);
    MATCH_COLOR("gaugeBorder", gaugeBorderColor, gaugeBorderAlpha);
    MATCH_COLOR("stunGauge", stunGaugeFillColor, gaugeFillAlpha);
    MATCH_COLOR("stunRecoveryGauge", stunRecoverGaugeFillColor, gaugeFillAlpha);
    MATCH_COLOR("guardGauge", guardGaugeFillColor, gaugeFillAlpha);

    return result;
}
开发者ID:odabugs,项目名称:kof-combo-hitboxes,代码行数:29,代码来源:config.c


示例10: _themeParseColorEntry

static int _themeParseColorEntry(const char *json, jsmntok_t *tokens, const char *name, void *context) {
    flubGuiTheme_t *theme = (flubGuiTheme_t *)context;
    _jsonColorEntry_t entry;
    flubGuiThemeColor_t *color;
    int red;
    int green;
    int blue;

    memset(&entry, 0, sizeof(_jsonColorEntry_t));
    if(!jsonParseToStruct(json, tokens,_themeColorParseMap, "Theme color entry", &entry, _jsonColorCleanup)) {
        return 0;
    }

    color = util_calloc(sizeof(flubGuiThemeColor_t), 0, NULL);
    color->type = eFlubGuiThemeColor;
    color->id = entry.id;
    parseColor(entry.color, &red, &green, &blue, NULL);
    color->red = COLOR_ITOF(red);
    color->green = COLOR_ITOF(green);
    color->blue = COLOR_ITOF(blue);
    critbitInsert(&theme->colors, name, color, NULL);
    _flubGuiThemeIndexAdd(theme, entry.id, color);
    _jsonColorCleanup(&entry);
    debugf(DBG_GUI, DBG_GUI_DTL_THEME, "Found color \"%s\" as %d, value #%02x%02x%02x", name, entry.id, red, green, blue);
    return 1;
}
开发者ID:Mojofreem,项目名称:flub,代码行数:26,代码来源:theme.c


示例11: parseAttr

void parseAttr(lua_State *L,int KeyIdx,int ValIdx,void *Struct,const ParseAttrib *Attrs)
{
    byte *H=(byte *)Struct;
    const char *Key=lua_tostring(L,KeyIdx);
    size_t Len;
    const char *Val=lua_tolstring(L,ValIdx,&Len);
    for (ParseAttrib const *P=Attrs; P->name!=NULL; P++)
    {
        if (0!=strcmp(P->name,Key))
            continue;
        switch (P->type)
        {
        case 2: //string
        {
            char *NewString=(char*)noxAlloc(Len+1);
            strcpy(NewString,Val);
            *((char**)( H + P->ofs))=NewString;
        }
        break;
        case 3: //color
            *((DWORD*)( H + P->ofs))=parseColor(Val);
            break;
        case 4:// wstring
        {
            wchar_t *NewString=(wchar_t *)noxAlloc(2*(Len+1));
            mbstowcs(NewString,Val,Len+1);
            *((wchar_t**)( H + P->ofs))=NewString;
        }
        break;
        case 5: //bitfield
            break;//TODO
        }
    }
}
开发者ID:Evengard,项目名称:UniMod,代码行数:34,代码来源:gui.cpp


示例12: while

        Model::EntityDefinition* DefParser::nextDefinition() {
            Token token = m_tokenizer.nextToken();
            while (token.type() != Eof && token.type() != ODefinition)
                token = m_tokenizer.nextToken();
            if (token.type() == Eof)
                return NULL;

            expect(ODefinition, token);
            
            StringList baseClasses;
            ClassInfo classInfo;
            
            token = m_tokenizer.nextToken();
            expect(Word, token);
            classInfo.name = token.data();

            token = m_tokenizer.peekToken();
            expect(OParenthesis | Newline, token);
            if (token.type() == OParenthesis) {
                classInfo.setColor(parseColor());
                
                token = m_tokenizer.peekToken();
                expect(OParenthesis | Question, token);
                if (token.type() == OParenthesis) {
                    classInfo.setSize(parseBounds());
                } else {
                    m_tokenizer.nextToken();
                }
                
                token = m_tokenizer.peekToken();
                if (token.type() == Word) {
                    Model::FlagsPropertyDefinition::Ptr spawnflags = parseFlags();
                    classInfo.properties[spawnflags->name()] = spawnflags;
                }
            }

            expect(Newline, token = m_tokenizer.nextToken());
            parseProperties(classInfo.properties, classInfo.models, baseClasses);
            
            classInfo.setDescription(parseDescription());
            expect(CDefinition, token = m_tokenizer.nextToken());

            Model::EntityDefinition* definition = NULL;
            
            if (classInfo.hasColor) {
                ClassInfo::resolveBaseClasses(m_baseClasses, baseClasses, classInfo);
                if (classInfo.hasSize) { // point definition
                    definition = new Model::PointEntityDefinition(classInfo.name, classInfo.color, classInfo.size, classInfo.description, classInfo.propertyList(), classInfo.models);
                } else {
                    definition = new Model::BrushEntityDefinition(classInfo.name, classInfo.color, classInfo.description, classInfo.propertyList());
                }
            } else { // base definition
                m_baseClasses[classInfo.name] = classInfo;
                definition = nextDefinition();
            }
            
            return definition;
        }
开发者ID:rebb,项目名称:TrenchBroom,代码行数:58,代码来源:DefParser.cpp


示例13: KdmItem

KdmPixmap::KdmPixmap(KdmItem *parent, const QDomNode &node, const char *name) : KdmItem(parent, node, name)
{
    itemType = "pixmap";

    // Set default values for pixmap (note: strings are already Null)
    pixmap.normal.tint.setRgb(0xFFFFFF);
    pixmap.normal.alpha = 1.0;
    pixmap.active.present = false;
    pixmap.prelight.present = false;

    // Read PIXMAP ID
    // it rarely happens that a pixmap can be a button too!
    QDomNode n = node;
    QDomElement elPix = n.toElement();

    // Read PIXMAP TAGS
    QDomNodeList childList = node.childNodes();
    for(uint nod = 0; nod < childList.count(); nod++)
    {
        QDomNode child = childList.item(nod);
        QDomElement el = child.toElement();
        QString tagName = el.tagName();

        if(tagName == "normal")
        {
            loadPixmap(el.attribute("file", ""), pixmap.normal.pixmap, pixmap.normal.fullpath);
            parseColor(el.attribute("tint", "#ffffff"), pixmap.normal.tint);
            pixmap.normal.alpha = el.attribute("alpha", "1.0").toFloat();
        }
        else if(tagName == "active")
        {
            pixmap.active.present = true;
            loadPixmap(el.attribute("file", ""), pixmap.active.pixmap, pixmap.active.fullpath);
            parseColor(el.attribute("tint", "#ffffff"), pixmap.active.tint);
            pixmap.active.alpha = el.attribute("alpha", "1.0").toFloat();
        }
        else if(tagName == "prelight")
        {
            pixmap.prelight.present = true;
            loadPixmap(el.attribute("file", ""), pixmap.prelight.pixmap, pixmap.prelight.fullpath);
            parseColor(el.attribute("tint", "#ffffff"), pixmap.prelight.tint);
            pixmap.prelight.alpha = el.attribute("alpha", "1.0").toFloat();
        }
    }
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:45,代码来源:kdmpixmap.cpp


示例14: parseColor

void Conf::get(const Common::String &key, byte *color, const byte *defaultColor) {
	if (ConfMan.hasKey(key)) {
		parseColor(ConfMan.get(key), color);
	} else if (defaultColor) {
		Common::copy(defaultColor, defaultColor + 3, color);
	} else {
		Common::fill(color, color + 3, 0);
	}
}
开发者ID:Templier,项目名称:scummvm,代码行数:9,代码来源:conf.cpp


示例15: colorFromRGBColorString

StyleColor CSSParser::colorFromRGBColorString(const String& string)
{
    // FIXME: Rework css parser so it is more SVG aware.
    RGBA32 color;
    if (parseColor(color, string.stripWhiteSpace()))
        return StyleColor(color);
    // FIXME: This branch catches the string currentColor, but we should error if we have an illegal color value.
    return StyleColor::currentColor();
}
开发者ID:shawngao5,项目名称:blink-crosswalk,代码行数:9,代码来源:CSSParser.cpp


示例16: GetPrivateProfileString

TxSkin::color TxSkin::parseColor( LPCWSTR section, LPCWSTR key, TxSkin::color defColor, LPCWSTR iniFile )
{
	WCHAR str[255];
	GetPrivateProfileString(section, key, L"", str, 255, iniFile);
	if(!str[0])
	{
		return defColor;
	}
	return parseColor(str);
}
开发者ID:tordex,项目名称:tlbskinslib,代码行数:10,代码来源:utils.cpp


示例17: Material

void Model3DS::parseMaterial()
{
	cout << "parseMaterial" << endl;
	DWord length = currentChunk.length;
	DWord n = cfg3ds::chunkHeaderSize;
	
	Material *material = new Material();
	
	while (n < length)
	{
		readChunkHeader();
		n += currentChunk.length;
		switch (currentChunk.id)
		{
			case chunks::MATERIAL_NAME:
				readString(material->name);
				break;
			
			case chunks::MATERIAL_AMBIENT:
				parseColor(material->ambient);
				break;
				
			case chunks::MATERIAL_DIFFUSE:
				parseColor(material->diffuse);
				break;
			
			case chunks::MATERIAL_SPECULAR:
				parseColor(material->specular);
				break;
				
			case chunks::MATERIAL_TEXMAP:
				parseTexmap(material);
				break;
			
			default:
				skipChunk();
		}
	}
	
	cout << "\tname: " << material->name << endl;
	materials.push_back(material);
}
开发者ID:jgonera,项目名称:open3ds,代码行数:42,代码来源:3ds.cpp


示例18: parseColor

PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode)
{
    if (RefPtrWillBeRawPtr<CSSValue> length = parseSimpleLengthValue(propertyID, string, parserMode))
        return length.release();
    if (isColorPropertyID(propertyID))
        return parseColor(string, isQuirksModeBehavior(parserMode));
    if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, string))
        return keyword.release();
    if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID, string))
        return transform.release();
    return nullptr;
}
开发者ID:hnney,项目名称:chromium.bb,代码行数:12,代码来源:CSSParserFastPaths.cpp


示例19: parseColor

void ColorEditor::parseText()
{
  QColor new_color = parseColor( text() );
  if( new_color.isValid() )
  {
    color_ = new_color;
    if( property_ )
    {
      property_->setColor( new_color );
    }
  }
}
开发者ID:jkammerl,项目名称:rviz,代码行数:12,代码来源:color_editor.cpp


示例20: parseColor

CSSValue* CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID,
                                              const String& string,
                                              CSSParserMode parserMode) {
  if (CSSValue* length = parseSimpleLengthValue(propertyID, string, parserMode))
    return length;
  if (isColorPropertyID(propertyID))
    return parseColor(string, parserMode);
  if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode))
    return keyword;
  if (CSSValue* transform = parseSimpleTransform(propertyID, string))
    return transform;
  return nullptr;
}
开发者ID:mirror,项目名称:chromium,代码行数:13,代码来源:CSSParserFastPaths.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parseCommand函数代码示例发布时间:2022-05-30
下一篇:
C++ parseBlock函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap