本文整理汇总了C++中ColorList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ ColorList::end方法的具体用法?C++ ColorList::end怎么用?C++ ColorList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColorList
的用法示例。
在下文中一共展示了ColorList::end方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate
int RandomColor::generate( ColorList colors, Luminosity luminosity )
{
// Each color will have probability = color.hRange.size() / totalRangeSize,
// so calculate totalRangeSize
double totalRangeSize = 0;
for (Color color : colors) {
totalRangeSize += colorMap[color].hRange.size();
}
// Generate a number within [0; 1) and select a color according with the
// cumulative distribution function f(i) = f(i - 1) + colorProbability(i)
std::uniform_real_distribution<double> probability(0, 1);
double p = probability(randomEngine);
double f = 0;
for (Color color : colors) {
const double colorProbability = colorMap[color].hRange.size() / totalRangeSize;
f += colorProbability;
if (f >= p) {
return generate(color, luminosity);
}
}
// This place can be reached due to rounding (if p ~ 1 and f < p even
// for the last color). Then return the last color.
Color lastColor = *(colors.end() - 1);
return generate(lastColor, luminosity);
}
示例2: Colorize
void CFulEditCtrl::Colorize(const tstring& aLine, int begin) {
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
ColorList *cList = HighlightManager::getInstance()->getList();
int end = GetTextLengthEx(GTL_NUMCHARS);
SetSel(begin, end);
//otroligt fulhack, måste lagas riktigt nån gång
SetSelectionCharFormat(selFormat);
logged = false;
//compare the last line against all strings in the vector
for(ColorIter i = cList->begin(); i != cList->end(); ++i) {
ColorSettings* cs = &(*i);
int pos;
//set start position for find
if( cs->getIncludeNick() ) {
pos = 0;
} else {
pos = aLine.find(_T(">"));
if(pos == tstring::npos)
pos = aLine.find(_T("**")) + nick.length();
}
//prepare the charformat
cf.dwMask = CFM_BOLD | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_ITALIC;
cf.dwEffects = 0;
if(cs->getBold()) cf.dwEffects |= CFE_BOLD;
if(cs->getItalic()) cf.dwEffects |= CFE_ITALIC;
if(cs->getUnderline()) cf.dwEffects |= CFE_UNDERLINE;
if(cs->getStrikeout()) cf.dwEffects |= CFE_STRIKEOUT;
if(cs->getHasBgColor()){
cf.dwMask |= CFM_BACKCOLOR;
cf.crBackColor = cs->getBgColor();
}
if(cs->getHasFgColor()){
cf.dwMask |= CFM_COLOR;
cf.crTextColor = cs->getFgColor();
}
while( pos != string::npos ){
if(cs->usingRegexp())
pos = RegExpMatch(cs, cf, aLine, begin);
else
pos = FullTextMatch(cs, cf, aLine, pos, begin);
}
matchedPopup = false;
matchedSound = false;
}//end for
}//end Colorize
示例3: addColors
void ColorList::addColors(const ColorList& colorList, bool overwrite)
{
ColorList::ConstIterator it;
ColorList::ConstIterator itend;
itend = colorList.end();
for (it = colorList.begin(); it != itend; ++it)
{
if (overwrite || !contains(it.key()))
insert(it.key(), it.value());
}
}
示例4: fillFillColorCombo
void SMCellStyleWidget::fillFillColorCombo(ColorList &colors)
{
fillColor->clear();
fillColor->addItem(CommonStrings::tr_NoneColor);
ColorList::Iterator itEnd = colors.end();
ScribusDoc* doc = colors.document();
for (ColorList::Iterator it = colors.begin(); it != itEnd; ++it)
{
fillColor->insertFancyItem(it.value(), doc, it.key());
}
fillColor->view()->setMinimumWidth(fillColor->view()->maximumViewportSize().width()+24);
}
示例5: insertFancyPixmapItems
void ColorListBox::insertFancyPixmapItems(ColorList& list)
{
ColorList::Iterator it;
ScribusDoc* doc = list.document();
for (it = list.begin(); it != list.end(); ++it)
{
if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
continue;
addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
}
if (itemDelegate())
delete itemDelegate();
setItemDelegate(new ColorFancyItemDelegate());
}
示例6: ColorAPI
/**
* Scripter.colors
* Property
* returns a color object
*/
QList<QVariant> ScripterImpl::colors()
{
QList<QVariant> l;
ColorList names = PrefsManager::instance()->colorSet();
ColorList::Iterator it;
for (it = names.begin(); it != names.end(); ++it)
{
ScColor *value = &(names[it.key()]);
ColorAPI *color = new ColorAPI(value, it.key());
l.append(qVariantFromValue((QObject *)(color)));
}
return l;
}
示例7: ColorAPI
/**
* Scripter.activeDocument.colors
* Property
* Colors of activeDocument
*/
QList<QVariant> DocumentAPI::colors()
{
QList<QVariant> l;
ColorList names = ScCore->primaryMainWindow()->doc->PageColors;
ColorList::Iterator it;
for (it = names.begin(); it != names.end(); ++it)
{
ScColor *value = &(names[it.key()]);
ColorAPI *color = new ColorAPI(value, it.key());
l.append(qVariantFromValue((QObject *)(color)));
}
return l;
}
示例8: mergePixelIntoColorCounts
void ColorFilter::mergePixelIntoColorCounts (QRgb pixel,
ColorList &colorCounts) const
{
ColorFilterEntry entry;
entry.color = pixel;
entry.count = 0;
// Look for previous entry
bool found = false;
for (ColorList::iterator itr = colorCounts.begin (); itr != colorCounts.end (); itr++) {
if (colorCompare (entry.color.rgb(),
(*itr).color.rgb())) {
found = true;
++(*itr).count;
break;
}
}
if (!found) {
colorCounts.append (entry);
}
}
示例9: marginColor
QRgb ColorFilter::marginColor(const QImage *image) const
{
// Add unique colors to colors list
ColorList colorCounts;
for (int x = 0; x < image->width (); x++) {
mergePixelIntoColorCounts (image->pixel (x, 0), colorCounts);
mergePixelIntoColorCounts (image->pixel (x, image->height () - 1), colorCounts);
}
for (int y = 0; y < image->height (); y++) {
mergePixelIntoColorCounts (image->pixel (0, y), colorCounts);
mergePixelIntoColorCounts (image->pixel (image->width () - 1, y), colorCounts);
}
// Margin color is the most frequent color
ColorFilterEntry entryMax;
entryMax.count = 0;
for (ColorList::const_iterator itr = colorCounts.begin (); itr != colorCounts.end (); itr++) {
if ((*itr).count > entryMax.count) {
entryMax = *itr;
}
}
return entryMax.color.rgb();
}
示例10: commitIdChanges
//=============================================================================
//commits the changes of the ID session
//
void EntertainerManager::commitIdChanges(PlayerObject* customer,PlayerObject* designer, BString hair, uint32 amount,uint8 statMigration, BString holoEmote,uint8 flagHair)
{
Ham* ham = designer->getHam();
if(ham->checkMainPools(0,0,66))
{
//int32 mindCost = 66;
designer->getHam()->updatePropertyValue(HamBar_Mind,HamProperty_CurrentHitpoints,-(66));
}
const PlayerObjectSet* const inRangePlayers = customer->getKnownPlayers();
PlayerObjectSet::const_iterator itiR = inRangePlayers->begin();
int8 sql[1024];
EntertainerManagerAsyncContainer* asyncContainer;
//money
if(amount >0)
applyMoney(customer,designer,amount);
////////
//Hair//
///////
if(flagHair)
applyHair(customer,hair);
////////////
//attributes
///////////
int8 mySQL[2048];
AttributesList* aList = customer->getIdAttributesList();
AttributesList::iterator it = aList->begin();
BString data;
bool firstUpdate = true;
sprintf(mySQL,"UPDATE character_appearance set ");
while(it != aList->end())
{
gLogger->log(LogManager::DEBUG,"ID apply changes : attribute : %s crc : %u", it->first.getAnsi(),it->first.getCrc());
//apply the attributes and retrieve the data to update the db
if(it->first.getCrc() != BString("height").getCrc())
{
data = commitIdAttribute(customer, it->first, it->second);
}
else
{
data = commitIdheight(customer, it->second);
}
if (firstUpdate)
{
sprintf(mySQL,"%s %s",mySQL,data.getAnsi());
firstUpdate = false;
}
else
sprintf(mySQL,"%s, %s",mySQL,data.getAnsi());
++it;
}
//colors
ColorList* cList = customer->getIdColorList();
ColorList::iterator cIt = cList->begin();
while(cIt != cList->end())
{
gLogger->log(LogManager::DEBUG,"ID apply changes : attribute : %s crc : %u",cIt->first.getAnsi(),cIt->first.getCrc());
data = commitIdColor(customer, cIt->first, cIt->second);
if(data.getLength())
{
if (firstUpdate)
{
sprintf(mySQL,"%s %s",mySQL,data.getAnsi());
firstUpdate = false;
}
else
sprintf(mySQL,"%s, %s",mySQL,data.getAnsi());
}
++cIt;
}
//do we have actual data or only the primer ??? "UPDATE character_appearance set "
if(strlen(mySQL) > 33)
{
sprintf(sql,"%s where character_id = '%"PRIu64"'",mySQL,customer->getId());
gLogger->log(LogManager::DEBUG,"ID apply changes : sql: %s ",sql);
asyncContainer = new EntertainerManagerAsyncContainer(EMQuery_NULL,0);
mDatabase->ExecuteSqlAsync(this,asyncContainer,sql);
}
//.........这里部分代码省略.........
示例11: serializeObjects
void Serializer::serializeObjects(const Selection& selection, SaxHandler& outputhandler)
{
Xml_attr attr;
UniqueID handler( & outputhandler );
handler.beginDoc();
handler.begin("SCRIBUSFRAGMENT", attr);
ScribusDoc* doc = selection.itemAt(0)->doc();
QMap<QString,int>::Iterator itf;
for (itf = doc->UsedFonts.begin(); itf != doc->UsedFonts.end(); ++itf)
{
attr["name"] = itf.key();
handler.beginEnd("font", attr);
}
ColorList usedColors;
doc->getUsedColors(usedColors, false);
ColorList::Iterator itc;
for (itc = usedColors.begin(); itc != usedColors.end(); ++itc)
{
Xml_attr cattr;
cattr["name"] = itc.key();
if (doc->PageColors[itc.key()].getColorModel() == colorModelRGB)
cattr["RGB"] = doc->PageColors[itc.key()].nameRGB();
else
cattr["CMYK"] = doc->PageColors[itc.key()].nameCMYK();
cattr["Spot"] = toXMLString(doc->PageColors[itc.key()].isSpotColor());
cattr["Register"] = toXMLString(doc->PageColors[itc.key()].isRegistrationColor());
handler.beginEnd("color", cattr);
}
ResourceCollection lists;
for (int i=0; i < doc->Items->count(); ++i)
doc->Items->at(i)->getNamedResources(lists);
QList<QString>::Iterator it;
QList<QString> names = lists.styleNames();
for (it = names.begin(); it != names.end(); ++it)
doc->paragraphStyles().get(*it).saxx(handler);
names = lists.charStyleNames();
for (it = names.begin(); it != names.end(); ++it)
doc->charStyles().get(*it).saxx(handler);
names = lists.lineStyleNames();
for (it = names.begin(); it != names.end(); ++it)
{
Xml_attr multiattr;
multiattr["Name"] = *it;
handler.begin("MultiLine", multiattr);
multiLine ml = doc->MLineStyles[*it];
multiLine::Iterator itMU2;
for (itMU2 = ml.begin(); itMU2 != ml.end(); ++itMU2)
{
Xml_attr lineattr;
lineattr["Color"] = (*itMU2).Color;
lineattr["Shade"] = toXMLString((*itMU2).Shade);
lineattr["Dash"] = toXMLString((*itMU2).Dash);
lineattr["LineEnd"] = toXMLString((*itMU2).LineEnd);
lineattr["LineJoin"] = toXMLString((*itMU2).LineJoin);
lineattr["Width"] = toXMLString((*itMU2).Width);
handler.beginEnd("SubLine", lineattr);
}
handler.end("MultiLine");
}
/* names = lists.patterns();
for (it = names.begin(); it != names.end(); ++it)
doc->patterns[*it].saxx(handler);
*/
/*
QStringList patterns = doc->getUsedPatternsSelection((Selection*)&selection);
for (int c = 0; c < patterns.count(); ++c)
{
ScPattern& pa = doc->docPatterns[patterns[c]];
Xml_attr cattr;
cattr["Name"] = patterns[c];
cattr["scaleX"] = toXMLString(pa.scaleX);
cattr["scaleY"] = toXMLString(pa.scaleY);
cattr["width"] = toXMLString(pa.width);
cattr["height"] = toXMLString(pa.height);
cattr["xoffset"] = toXMLString(pa.xoffset);
cattr["yoffset"] = toXMLString(pa.yoffset);
handler.begin("Pattern", cattr);
for (int o = 0; o < pa.items.count(); o++)
{
pa.items.at(o)->saxx(handler);
}
handler.end("Pattern");
}
*/
for (int i=0; i < doc->Items->count(); ++i)
{
int k = selection.findItem(doc->Items->at(i));
if (k >=0)
doc->Items->at(i)->saxx(handler);
}
//.........这里部分代码省略.........
示例12: importColorsFromFile
bool importColorsFromFile(QString fileName, ColorList &EditColors, QHash<QString, VGradient> *dialogGradients, bool merge)
{
if (fileName.isEmpty())
return false;
int oldCount = EditColors.count();
QFileInfo fi = QFileInfo(fileName);
QString ext = fi.suffix().toLower();
if (extensionIndicatesEPSorPS(ext))
{
PaletteLoader_PS psPalLoader;
psPalLoader.setupTargets(&EditColors, dialogGradients);
return psPalLoader.importFile(fileName, merge);
}
else
{
QStringList allFormatsV = LoadSavePlugin::getExtensionsForColors();
if (allFormatsV.contains(ext))
{
FileLoader fl(fileName);
int testResult = fl.testFile();
if (testResult != -1)
{
ColorList LColors;
if (fl.readColors(LColors))
{
ColorList::Iterator it;
for (it = LColors.begin(); it != LColors.end(); ++it)
{
EditColors.tryAddColor(it.key(), it.value());
}
return (EditColors.count() != oldCount);
}
}
}
if (ext == "acb") // Adobe color book format
{
PaletteLoader_Adobe_acb adobePalLoader;
if (adobePalLoader.isFileSupported(fileName))
{
adobePalLoader.setupTargets(&EditColors, dialogGradients);
return adobePalLoader.importFile(fileName, merge);
}
PaletteLoader_Autocad_acb autocadPalLoder;
if (autocadPalLoder.isFileSupported(fileName))
{
autocadPalLoder.setupTargets(&EditColors, dialogGradients);
return autocadPalLoder.importFile(fileName, merge);
}
return false;
}
else if (ext == "aco") // Adobe color swatch format
{
PaletteLoader_Adobe_aco adobePalLoader;
if (adobePalLoader.isFileSupported(fileName))
{
adobePalLoader.setupTargets(&EditColors, dialogGradients);
return adobePalLoader.importFile(fileName, merge);
}
return false;
}
else if (ext == "ase") // Adobe swatch exchange format
{
PaletteLoader_Adobe_ase adobePalLoader;
if (adobePalLoader.isFileSupported(fileName))
{
adobePalLoader.setupTargets(&EditColors, dialogGradients);
return adobePalLoader.importFile(fileName, merge);
}
return false;
}
else if (ext == "cxf") // Adobe swatch exchange format
{
PaletteLoader_CxF cxfLoader;
if (cxfLoader.isFileSupported(fileName))
{
cxfLoader.setupTargets(&EditColors, dialogGradients);
return cxfLoader.importFile(fileName, merge);
}
return false;
}
else if (ext == "skp") // Sk1 palette
{
PaletteLoader_sK1 sk1PalLoader;
if (sk1PalLoader.isFileSupported(fileName))
{
sk1PalLoader.setupTargets(&EditColors, dialogGradients);
return sk1PalLoader.importFile(fileName, merge);
}
return false;
}
else if (ext == "sbz")
{
PaletteLoader_Swatchbook swatchbookLoader;
if (swatchbookLoader.isFileSupported(fileName))
{
swatchbookLoader.setupTargets(&EditColors, dialogGradients);
return swatchbookLoader.importFile(fileName, merge);
}
//.........这里部分代码省略.........