本文整理汇总了C++中ColorMap类的典型用法代码示例。如果您正苦于以下问题:C++ ColorMap类的具体用法?C++ ColorMap怎么用?C++ ColorMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ColorMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setRange
void TransferFunctionEditor::loadState(Value& in)
{
transferFunction.loadState(in);
setRange(transferFunction.GetMin(), transferFunction.GetMax());
transferFunctionAlphaScalingSlider.setValue(int(transferFunction.GetScale() * (transferFunctionAlphaScalingSlider.minimum() + transferFunctionAlphaScalingSlider.maximum())));
QVector<QPointF> points;
for (int i = 0; i < transferFunction.GetAlphas().size(); i++)
points.push_back(QPointF(transferFunction.GetAlphas()[i].x, transferFunction.GetAlphas()[i].y));
transferFunctionAlphaWidget.setPoints(points);
if (in.HasMember("Colormap"))
{
ColorMap cmap;
cmap.loadState(in["Colormap"]);
int colorMapIndex;
for(colorMapIndex = 0; colorMapIndex < colorMaps.size(); colorMapIndex++)
if (colorMaps[colorMapIndex].getName() == cmap.getName())
break;
if (colorMapIndex == colorMaps.size())
addColorMap(VColorMap(cmap));
colorMapComboBox.setCurrentIndex(colorMapIndex);
}
}
示例2: cmap_pylookup
static PyObject *
cmap_pylookup(PyObject *self, PyObject *args)
{
PyObject *pyobj, *pyret;
double d;
rgba_t color;
ColorMap *cmap;
if(!PyArg_ParseTuple(args,"Od", &pyobj, &d))
{
return NULL;
}
cmap = (ColorMap *)PyCObject_AsVoidPtr(pyobj);
if(!cmap)
{
return NULL;
}
color = cmap->lookup(d);
pyret = Py_BuildValue("iiii",color.r,color.g,color.b,color.a);
return pyret;
}
示例3: Q_ASSERT
void ConfigurationParser::readMap()
{
Q_ASSERT(isStartElement()
&& name() == "map");
while(!atEnd()) {
readNext();
if(isEndElement())
break;
if(isStartElement()) {
if(name() == "geometry") {
readGeometry();
}
else if (name() == "layer") {
DataLayer *layer = readLayer();
if(layer) {
m_layers.insert(layer->name(), layer);
}
}
else if (name() == "colorMap") {
ColorMap colorMap = ColorMap::readColorMap(this);
m_colorMaps.insert(colorMap.name(), colorMap);
}
else {
readUnknownElement();
}
}
}
}
示例4: cmap_pylookup_with_flags
static PyObject *
cmap_pylookup_with_flags(PyObject *self, PyObject *args)
{
PyObject *pyobj, *pyret;
double d;
rgba_t color;
ColorMap *cmap;
int inside;
int solid;
if(!PyArg_ParseTuple(args,"Odii", &pyobj, &d, &solid, &inside))
{
return NULL;
}
cmap = (ColorMap *)PyCObject_AsVoidPtr(pyobj);
if(!cmap)
{
return NULL;
}
color = cmap->lookup_with_transfer(d,solid,inside);
pyret = Py_BuildValue("iiii",color.r,color.g,color.b,color.a);
return pyret;
}
示例5: addXmlColors
void addXmlColors(
TiXmlElement *rootElement,
const ColorMap &colors,
bool /*old*/)
{
TiXmlElement *colorsElement = new TiXmlElement("Colors");
for (ColorMap::const_iterator it = colors.begin(); it != colors.end(); it++)
{
unsigned int ldrawNum = it->first;
const Color &color = it->second;
TiXmlElement *colorElement = new TiXmlElement("Color");
char numberBuf[128];
sprintf(numberBuf, "%d", ldrawNum);
addElement(colorElement, "LDrawNumber", numberBuf);
addElement(colorElement, "POVName", color.lgeoName);
//if (old)
//{
// addElement(colorElement, "POVVersion", "3.0");
//}
addElement(colorElement, "Dependency", "LGColors");
if (color.transparent)
{
addElement(colorElement, "IoR", "lg_ior");
}
colorsElement->LinkEndChild(colorElement);
}
rootElement->LinkEndChild(colorsElement);
}
示例6: toLowerI
static const Color *create_named_color(std::string str){
toLowerI(str);
static ColorMap cm;
ColorMap::iterator it = cm.find(str);
if(it != cm.end()) return &it->second;
else return 0;
}
示例7: Color
int Color(ColorVector& colors) {
int maxColorUsed = 0;
//Reset all the colors
for(ColorVertex* cVertex: adjacencyList) {
cVertex->setColor(-1);
}
for(ColorVertex* cVertex: adjacencyList) {
ColorMap cmap;
for(Edge* edge: cVertex->edges) {
cmap[((ColorVertex *)(edge->getVertex()))->getColor()] = true;
}
for(color_t color: colors) {
if(cmap.find(color) == cmap.end()) {
cout << color << endl;
cVertex->setColor(color);
if(color > maxColorUsed) {
maxColorUsed = color;
}
break;
}
}
}
return maxColorUsed;
}
示例8: init
ColorMap::ColorMap(const ColorMap &o)
{
init(o.getCols(),o.getRows());
for(int row=0; row<rows; row++)
for(int col=0; col<cols; col++)
c[row][col] = o.get(row,col);
}
示例9: createSequential
ColorMap ColorMap::createSequential(const tgt::Color& base) {
ColorMap cm;
cm.colors_.clear();
cm.addColorLast(tgt::Color(1.f, 1.f, 1.f, 1.f));
cm.addColorLast(base);
cm.setName("Sequential");
return cm;
}
示例10: getColorByName
// ----------------------------------------------------------------------------
//
bool RGBWA::getColorByName( LPCSTR color_name, RGBWA& rgb ) {
ColorMap::iterator it = predefinedColors.find( color_name );
if ( it == predefinedColors.end() )
return false;
rgb = (*it).second;
return true;
}
示例11: createGermany
ColorMap ColorMap::createGermany() {
ColorMap cm;
cm.colors_.clear();
cm.addColorLast(tgt::Color(0.f, 0.f, 0.f, 1.f));
cm.addColorLast(tgt::Color(1.f, 0.f, 0.f, 1.f));
cm.addColorLast(tgt::Color(1.f, 0.8f, 0.f, 1.f));
cm.setName("Germany");
return cm;
}
示例12: createColdHot
ColorMap ColorMap::createColdHot() {
ColorMap cm;
cm.colors_.clear();
cm.addColorLast(tgt::Color(0.f, 0.f, 1.f, 1.f));
cm.addColorLast(tgt::Color(1.f, 1.f, 1.f, 1.f));
cm.addColorLast(tgt::Color(1.f, 0.f, 0.f, 1.f));
cm.setName("Cold Hot");
return cm;
}
示例13: MakeColorMap
static void MakeColorMap (ColorMap& cmap)
{
cmap.Load("copper-256"); // load a default colormap
if (! cmap) Matpack.Error("Can't load colormap");
cmap.Reverse(); // reverse ordering
int i, n = cmap.Size(); // change colormap now
for (i = 0; i < 20; i++) cmap[i] = ColorB(0,100+2*i,160+2*i); // water
for (i = 20; i < 80; i++) cmap[i] = ColorB(2*i+20,2*i+20,i/2+10); // mangrove
for (i = 1; i < 60; i++) cmap[n-i] = ColorB(255-i,250-i,250-2*i); // snow
}
示例14: createSpectral
ColorMap ColorMap::createSpectral() {
ColorMap cm;
cm.colors_.clear();
cm.addColorLast(tgt::Color(1.f, 0.f, 0.f, 1.f));
cm.addColorLast(tgt::Color(1.f, 1.f, 0.f, 1.f));
cm.addColorLast(tgt::Color(0.f, 1.f, 0.f, 1.f));
cm.addColorLast(tgt::Color(0.f, 0.f, 1.f, 1.f));
cm.setName("Spectral");
return cm;
}
示例15: LOCALARRAY
bool EdgeColoringTest<DefaultStructs>::test(const Graph &graph, const ColorMap &colors)
{
typedef typename Graph::PVertex Vert;
typedef typename Graph::PEdge Edge;
const EdgeDirection Mask = EdDirIn|EdDirOut|EdUndir;
int degree = graph.Delta(Mask);
int LOCALARRAY(kolory, degree+1);
int lenKolory = 0;
for(Vert vv = graph.getVert(); vv; vv = graph.getVertNext(vv)) {
lenKolory = 0;
for(Edge ee = graph.getEdge(vv, Mask); ee;
ee = graph.getEdgeNext(vv, ee, Mask))
{
if(!colors.hasKey(ee)) return false;
int col = colors[ee];
if(col<0) return false;
kolory[lenKolory++] = col;
}
DefaultStructs::sort(kolory, kolory+lenKolory);
int tmpLen = std::unique(kolory, kolory+lenKolory)-kolory;
if(tmpLen!=lenKolory)
return false;
}
return true;
}