コード例 #1
0
void VboCircleRenderer::noFillCircle(float x, float y, float size) {
    int res = getResolution(size);
    
    float oneStep = M_2XPI / res;
    int baseIndex = noFillCounter.vertex;
    
    float rad = 0;
    ofVec2f pos;
    for(int i = 0; i < res; i++) {
        rad = oneStep * i;
        pos = getVertPos(x, y, rad, size);
        addVertex(noFill, pos); //put into base index
        
        //This Vertex
        addIndex(noFill, baseIndex + i);
        addColor(noFill, color);
        
        //Second
        if(i == (res - 1)) {
            addIndex(noFill, baseIndex);
            addColor(noFill, color);
        } else {
            addIndex(noFill, baseIndex + i + 1);
            addColor(noFill, color);
        }
    }
}
コード例 #2
0
ファイル: colormodel.cpp プロジェクト: KaneHart/Elmlor-Client
ColorModel *ColorModel::createDefault(const Widget2 *const widget)
{
    ColorModel *const model = new ColorModel();
    // TRANSLATORS: color name
    addColor(_("black"), BLACK);
    // TRANSLATORS: color name
    addColor(_("red"), RED);
    // TRANSLATORS: color name
    addColor(_("green"), GREEN);
    // TRANSLATORS: color name
    addColor(_("blue"), BLUE);
    // TRANSLATORS: color name
    addColor(_("gold"), ORANGE);
    // TRANSLATORS: color name
    addColor(_("yellow"), YELLOW);
    // TRANSLATORS: color name
    addColor(_("pink"), PINK);
    // TRANSLATORS: color name
    addColor(_("purple"), PURPLE);
    // TRANSLATORS: color name
    addColor(_("grey"), GRAY);
    // TRANSLATORS: color name
    addColor(_("brown"), BROWN);
    return model;
}
コード例 #3
0
ファイル: GridVisualizer.cpp プロジェクト: JackOfDawn/AI
void GridVisualizer::refresh()
{
	const ALLEGRO_COLOR& color = BLACK_COLOR; 
	const ALLEGRO_COLOR& portalColor = { 247, 0, 100, 255 };
	if( mDirty )
	{
		//remove old entries first
		removeAllEntriesOfColor( color );
		removeAllEntriesOfColor(portalColor);

		int size = mpGrid->getGridWidth() * mpGrid->getGridHeight();
		//get any non-zero squares and send them to the visualizer
		for( int i=0; i<size; i++ )
		{
			if( mpGrid->getValueAtIndex(i) == 1 )
			{
				addColor( i, color );
			}
			else if (mpGrid->getValueAtIndex(i) >= 100)
			{
				addColor(i, portalColor);
			}
		}
	}
	mDirty = false;
}
コード例 #4
0
void FastLEDRenderer::render(ParticleSysConfig *g, Particle_Abstract particles[], byte numParticles, CRGB *_leds) {
    byte row, col;
    uint16_t dx, dy;
    unsigned long tempVal;
    CRGB baseRGB;

    //go over particles and update matrix cells on the way
    for(int i = 0; i<numParticles; i++) {
        if (! particles[i].isAlive) {  // only render if particle is alive
            continue;
        }
        if(crop_left > 0 && crop_left * g->res_x > particles[i].x) {  // only render if x-position is inside cropped window
            continue;
        }
        if(crop_top > 0 && crop_top * g->res_y > particles[i].y) {  // only render if y-position is inside cropped window
            continue;
        }
        uint16_t part_x = particles[i].x - (crop_left * g->res_x);
        uint16_t part_y = particles[i].y - (crop_top * g->res_y);
        //generate RGB values for particle
        baseRGB = CHSV(particles[i].hue, 255,255);

        dx = g->res_x - (part_x % g->res_x);
        dy = g->res_y - (part_y % g->res_y);

        //bottom left
        col = part_x / g->res_x;
        row = part_y / g->res_y;
        tempVal = ((unsigned long)dx*dy*particles[i].ttl)/g->res_area;
        if(tempVal > 255) {tempVal = 255;}
        addColor(col, row, &baseRGB, tempVal, _leds);

        //bottom right;
        col++;
        if (col < g->width) {
            tempVal = ((unsigned long)(g->res_x-dx)*dy*particles[i].ttl)/g->res_area;
            if(tempVal > 255) {tempVal = 255;}
            addColor(col, row, &baseRGB, tempVal, _leds);
        }

        //top right
        row++;
        if (col < g->width && row < g->height) {
            tempVal = ((unsigned long)(g->res_x-dx)*(g->res_y-dy)*particles[i].ttl)/g->res_area;
            if(tempVal > 255) {tempVal = 255;}
            addColor(col, row, &baseRGB, tempVal, _leds);
        }

        //top left
        col--;
        if (row < g->height) {
            tempVal = ((unsigned long)dx*(g->res_y-dy)*particles[i].ttl)/g->res_area;
            if(tempVal > 255) {tempVal = 255;}
            addColor(col, row, &baseRGB, tempVal, _leds);
        }
    }
}
コード例 #5
0
ファイル: Colormap.cpp プロジェクト: Norman0406/LISA-old
 Colormap::Colormap(int range, QObject* parent)
     : QObject(parent), m_range(range)
 {
     // create color table
     m_colorTable = new QColor[range];
     
     // standard color map
     addColor(0, Qt::black);
     addColor(range - 1, Qt::white);
     
     buildColorTable();
 }
コード例 #6
0
ファイル: colorinfovisual.cpp プロジェクト: KDE/kcoloredit
ColorInfoVisualTriadic::ColorInfoVisualTriadic(QWidget * parent)
    : ColorInfoVisual(parent)
{
    m_triad1ColorWidget = new ColorWidget(this);
    m_triad2ColorWidget = new ColorWidget(this);

    setWindowTitle(i18n("Triadic"));

    layout()->addWidget(m_triad1ColorWidget);
    layout()->addWidget(m_triad2ColorWidget);

    connect(m_triad1ColorWidget, SIGNAL( colorAdded(QColor) ), this, SLOT( addColor(QColor) ));
    connect(m_triad2ColorWidget, SIGNAL( colorAdded(QColor) ), this, SLOT( addColor(QColor) ));
}
コード例 #7
0
ファイル: colorinfovisual.cpp プロジェクト: KDE/kcoloredit
ColorInfoVisualAnalogous::ColorInfoVisualAnalogous(QWidget * parent)
    : ColorInfoVisual(parent)
{
    m_analogous1ColorWidget = new ColorWidget(this);
    m_analogous2ColorWidget = new ColorWidget(this);

    setWindowTitle(i18n("Analogous"));

    layout()->addWidget(m_analogous1ColorWidget);
    layout()->addWidget(m_analogous2ColorWidget);

    connect(m_analogous1ColorWidget, SIGNAL( colorAdded(QColor) ), this, SLOT( addColor(QColor) ));
    connect(m_analogous2ColorWidget, SIGNAL( colorAdded(QColor) ), this, SLOT( addColor(QColor) ));
}
コード例 #8
0
ファイル: frg_match_image.cpp プロジェクト: sisong/libfrg
 inline void addVLine(const TPixels32Ref& ref,int x,int y0,int y1,TUInt32 colorMask){
     const Color32* pixel=&ref.pixels(x,y0);
     for (int y=y0;y<y1;++y){
         addColor(*pixel,colorMask);
         pixel=ref.nextLine(pixel);
     }
 }
コード例 #9
0
void mutableSquareImageContainer::
addColors(const QVector<flossColor>& colors) {

  for (int i = 0, size = colors.size(); i < size; ++i) {
    addColor(colors[i]);
  }
}
コード例 #10
0
ファイル: leappointer.cpp プロジェクト: jinpengxuan/osgleap
 bool mouseLeave(double, double, const osgWidget::WindowManager*) {
     addColor(osgWidget::Color(0.4f, 0.4f, 0.4f, 0.0f));
     
     // osgWidget::warn() << "leave: " << getColor() << std::endl;
     
     return true;
 }
コード例 #11
0
ファイル: leappointer.cpp プロジェクト: jinpengxuan/osgleap
    bool mouseEnter(double, double, const osgWidget::WindowManager*) {
        addColor(-osgWidget::Color(1.0f, 0.4f, 0.4f, 0.0f));
        
        // osgWidget::warn() << "enter: " << getColor() << std::endl;

        return true;
    }
コード例 #12
0
ファイル: shop.cpp プロジェクト: lindianyin/sgbj
int shopMgr::addShopRecord(const std::string& who, int type, const std::string& what, int count, int quality)
{
    json_spirit::Object rcd;
    std::string msg = strBuy;
    str_replace(msg, "$N", who);
    std::string get_name = what;

    if (count > 1)
    {
        get_name += (strCounts + LEX_CAST_STR(count));
    }

    addColor(get_name, quality);
    str_replace(msg, "$G", get_name);
    rcd.push_back( Pair("msg", msg) );

    json_spirit::Array& notice_array = m_notices_value.get_array();

    notice_array.push_back(rcd);
    while ((int)notice_array.size() > 15)
    {
        notice_array.erase(notice_array.begin());
    }
    //保存
    InsertSaveDb("replace into custom_settings (code,value) values ('shop_notices','" +GetDb().safestr(json_spirit::write(m_notices_value)) + "')");

    return 0;
}
コード例 #13
0
ファイル: Cell.c プロジェクト: torococo/ExampleCode
void CellBump(Grid* W,Cell* c){/* cells with overlapping radii get force vectors applied to them to bounce off each other*/
  double usageColor=c->myBody->usageB/(BINSIZE*NUMBINS*0.7);
  //usageColor=0.7<usageColor?0.7:usageColor;
  addColor(W,c->color,usageColor,usageColor,usageColor,EVOLUTIONVIEW);
  LL* touching=withinRad(W,c->CellPos,CELLRAD,c,0);
  if(touching){
    for(LL* curr=touching;curr!=NULL;curr=curr->next){
      //AddNeuron(&c->myBrain->inputs[1],0.5,__func__);
      Cell* touching=curr->val;
      double dist=getDist(c->CellPos,touching->CellPos);
      //double forceMag=(1-(dist/pow((2*CELLRAD),3)))*0.1;//function to bounce cells with differing severity
      double forceMag=(1-(pow(dist/(2.0*CELLRAD),BUMP_FUNCTION_EXPONENT)));
      /*BUMP_FUNCTION_EXPONENT combined with BUMP_FORCE_MULT dictate how strongly bumping cells repel each other*/
      double diff[]={touching->CellPos[0]-c->CellPos[0],touching->CellPos[1]-c->CellPos[1]};
      double touchLoc[]={c->CellPos[0]+diff[0]/2,c->CellPos[1]+diff[1]/2};
      double scale=(forceMag*BUMP_FORCE_MULT)/dist;
      double xyComp[]={-(touching->CellPos[0]-c->CellPos[0])*scale,-(touching->CellPos[1]-c->CellPos[1])*scale};
      /*Force is applied from the touching location to the center of the cell (for single cells exerts no torque)*/
      FORCE_FUN(W,c->myBody,touchLoc,xyComp,0);
      //here we force closest cells to separate instantly! no matter what, by rewinding time until they are fully apart
      //applyImpulse(W,c,touching);
      c->myBody->touching=1;

      //c->dxy[0]-=distx*(forceMag/dist);
      //c->dxy[1]-=disty*(forceMag/dist);
    }
    freeLL(touching);
  }
  else{
    //AddNeuron(&c->myBrain->inputs[1],-0.5,__func__);
  }
}
コード例 #14
0
ファイル: replacecolors.cpp プロジェクト: JLuc/scribus
replaceColorsDialog::replaceColorsDialog(QWidget* parent, ColorList &colorList, ColorList &colorListUsed) : QDialog(parent)
{
	setupUi(this);
	setModal(true);
	setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
	EditColors = colorList;
	UsedColors = colorListUsed;
	selectedRow = -1;
	replaceMap.clear();
	alertIcon = loadIcon("alert.png", true);
	cmykIcon = loadIcon("cmyk.png", true);
	rgbIcon = loadIcon("rgb.png", true);
	spotIcon = loadIcon("spot.png", true);
	regIcon = loadIcon("register.png", true);
	replacementTable->horizontalHeader()->setSectionsClickable(false );
	replacementTable->horizontalHeader()->setSectionsMovable( false );
	replacementTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
	replacementTable->setHorizontalHeaderItem(0, new QTableWidgetItem( tr("Original")));
	replacementTable->setHorizontalHeaderItem(1, new QTableWidgetItem( tr("Replacement")));
	replacementTable->verticalHeader()->setSectionsMovable( false );
	replacementTable->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
	replacementTable->verticalHeader()->hide();
	replacementTable->setIconSize(QSize(60, 15));
	updateReplacementTable();
	removeButton->setEnabled(false);
	connect(addButton, SIGNAL(clicked()), this, SLOT(addColor()));
	connect(replacementTable, SIGNAL(cellClicked(int, int)), this, SLOT(selReplacement(int)));
	connect(removeButton, SIGNAL(clicked()), this, SLOT(delReplacement()));
	connect(editButton, SIGNAL(clicked()), this, SLOT(editReplacement()));
}
コード例 #15
0
ファイル: sci_figure.c プロジェクト: FOSSEE-Internship/scilab
/*--------------------------------------------------------------------------*/
int setDefaultProperties(int _iFig, BOOL _bDefaultAxes)
{
    //get figure axes
    int iAxes = -1;
    int iDrawing = 0;
    int iColorIndex = 0;
    int iFilled = 0;
    int iAxesVisible = 0;
    int* piAxesSize = NULL;
    double pdblNewColor[COLOR_COMPONENT] = {0.8, 0.8, 0.8};

    iColorIndex = addColor(_iFig, pdblNewColor);

    setGraphicObjectProperty(_iFig, __GO_BACKGROUND__, &iColorIndex, jni_int, 1);
    if (_bDefaultAxes)
    {
        iAxes = getOrCreateDefaultSubwin();
        //set background in figure and axes to new ( or existting ) color
        setGraphicObjectProperty(iAxes, __GO_BACKGROUND__, &iColorIndex, jni_int, 1);

        //a.filled = "off"
        setGraphicObjectProperty(iAxes, __GO_FILLED__, &iFilled, jni_bool, 1);

        //a.axes_visible = "off"
        setGraphicObjectProperty(iAxes, __GO_X_AXIS_VISIBLE__, &iAxesVisible, jni_bool, 1);
        setGraphicObjectProperty(iAxes, __GO_Y_AXIS_VISIBLE__, &iAxesVisible, jni_bool, 1);
        setGraphicObjectProperty(iAxes, __GO_Z_AXIS_VISIBLE__, &iAxesVisible, jni_bool, 1);
    }

    return iAxes;
}
コード例 #16
0
ファイル: color_dropdown.cpp プロジェクト: FEK10/mapper
void ColorDropDown::updateColor(const MapColor* color)
{
	if (!spot_colors_only || color->getSpotColorMethod() == MapColor::SpotColor)
	{
		int pos = 0;
		for (; pos < count(); ++pos)
		{
			if (itemData(pos).value<const MapColor*>() == color)
				break;
		}
		
		if (pos < count())
		{
			int icon_size = style()->pixelMetric(QStyle::PM_SmallIconSize);
			QPixmap pixmap(icon_size, icon_size);
			pixmap.fill(*color);
			setItemText(pos, color->getName());
			setItemData(pos, pixmap, Qt::DecorationRole);
		}
		else
		{
			addColor(color);
		}
	}
	else
	{
		removeColor(color);
	}
}
コード例 #17
0
ファイル: egcolor_menu.cpp プロジェクト: tts-ll/grafalgo
/** Add a color to the menu of a group and update all related data structures.
 *  @param grp is a group number
 *  @param c is a color to be added to grp's menu
 *  @return the deficit of grp after c has been added
 */
int egcolor_menu::growMenu(int grp, int c) {
	vertex u = gp->input(gp->firstEdgeInGroup(grp));
	addColor(c, grp); allocate(c, u);
	int cnt = 0;
	for (edge e = gp->firstEdgeInGroup(grp); e != 0;
	     	  e = gp->nextEdgeInGroup(grp,e)) {
		vertex v = gp->output(e); int dv = gp->degree(v);
		Graph& mg = *mgraf[v];
		mg.join(gx[e], c+dv);
		dmatch& dm = *dymatch[v];
		if (dm.size() < dv) {
			dm.maxMatch();
			for (edge ee = gp->firstAt(v); ee != 0; 
				  ee = gp->nextAt(v,ee)) {
				int me = dm.matchEdge(gx[ee]);
				if (me == 0) continue;
				int cc = mg.right(me) - dv;
				if (avail[v].member(cc)) {
					allocate(cc, v);
				}
			}
		}
		if (dm.matchEdge(gx[e]) == 0) cnt++;
	}
	return cnt;
}
コード例 #18
0
ファイル: minMax.cpp プロジェクト: ksujaym/entropy-ai
void chaosMove(action2 a){
	currentState->board[a.x][a.y]=a.color;
	addColor(a.color);
	currentState->depth++;
	int x=currentState->depth;
	chance[x]=chance[x-1]*a.probability;
}
コード例 #19
0
ファイル: colorinfovisual.cpp プロジェクト: KDE/kcoloredit
ColorInfoVisualComplement::ColorInfoVisualComplement(QWidget * parent)
    : ColorInfoVisual(parent)
{
    setWindowTitle(i18n("Complement"));

    m_complementColorWidget = new ColorWidget(this);

    layout()->addWidget(m_complementColorWidget);

    connect(m_complementColorWidget, SIGNAL( colorAdded(QColor) ), this, SLOT( addColor(QColor) ));
}
コード例 #20
0
ファイル: sdl-draw.c プロジェクト: jagt/brogue-chs-translate
/*  Apply the current color transform state, which applied a multiplier,
    followed by an addition and finally an average.  The transform values
    are set in the draw context state.  */
static BROGUE_DRAW_COLOR applyColorTransform(
    BROGUE_DRAW_CONTEXT_STATE *state, 
    BROGUE_DRAW_COLOR color, int is_foreground)
{
    if (is_foreground)
    {
	color = multiplyColor(color, state->foreground_multiplier);
	color = addColor(color, state->foreground_addition);
	color = averageColor(color, 
			     state->foreground_average_target, 
			     state->foreground_average_weight);
    }
    else
    {
	color = multiplyColor(color, state->background_multiplier);
	color = addColor(color, state->background_addition);
	color = averageColor(color, 
			     state->background_average_target, 
			     state->background_average_weight);
    }

    return color;
}
コード例 #21
0
//--------------------------------------------------------------
void ofxFatLine::setFromPolyline(ofPolyline & poly){
//	ofxFatLine();
	setGlobalColor(ofGetStyle().color);
	setGlobalWidth(ofGetStyle().lineWidth);
	if (!poly.getVertices().empty()){
		addVertices(poly.getVertices());
	for (int i = 0; i <getVertices().size(); i++) {
		addColor(globalColor);
		addWeight(globalWidth);
	}
	update();
	//*/
	}		
}
コード例 #22
0
void VboCircleRenderer::filledCircle(float x, float y, float size) {
    
    int res = getResolution(size);
    float oneStep = M_2XPI / res;
    int baseIndex = filledCounter.vertex;
    
    //Set Center vertex
    ofVec2f center = ofVec2f(x * width, y * height);
    addVertex(filled, center);  //Add Center first
    addColor(filled, color);
    
    float rad = 0;
    ofVec2f pos;
    for(int i = 0; i < res; i++) {
        rad = oneStep * i;
        pos = getVertPos(x, y, rad, size);
        addVertex(filled, pos);
        //cout << "Vertex :" << pos << endl;
        
        //Center Vertex
        addIndex(filled, baseIndex);
        addColor(filled, color);
        
        //First
        addIndex(filled, baseIndex + i + 1);
        addColor(filled, color);
        
        //Second
        if(i == (res - 1)) {
            addIndex(filled, baseIndex + 1);
            addColor(filled, color);
        } else {
            addIndex(filled, baseIndex + i + 2);
            addColor(filled, color);
        }
    }
}
コード例 #23
0
ファイル: cubesgames.cpp プロジェクト: DLD-Cubes/gamelogic
dldCubesGame::dldCubesGame()
{

    COLOR_PINK = Color(175, 75, 148);
    COLOR_RED = Color(255,0,0);
    COLOR_WHITE = Color(255,255,255);
    COLOR_ORANGE = Color(237,120,6),
    COLOR_YELLOW = Color(255,255,0);
    COLOR_PURPLE = Color(128, 0, 255);
    COLOR_BLUE = Color(0,0,255);
    COLOR_GREEN = Color(0,255,0);
    COLOR_BLACK = Color(0,0,0);

    addColor(COLOR_PINK, COLOR_RED, COLOR_WHITE);
    addColor(COLOR_ORANGE, COLOR_RED, COLOR_YELLOW);
    addColor(COLOR_PURPLE, COLOR_RED, COLOR_BLUE);
    addColor(COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW);

    //Get resources
    m_devices = m_server.getDevices();

    nTimeout = 5 * 60;

}
コード例 #24
0
/*
addTile builds a set of vertices that make up two triangles
*/
void renderer::addTile(int center[2], double color[3], int size)
{
	for(int i = 0; i < 6; i++) addColor(color);
	int point[2];
	point[0] = center[0] - size/2, point[1] = center[1] - size/2;
	addPoint(point);
	point[0] = center[0] + size/2, point[1] = center[1] - size/2;
	addPoint(point);
	point[0] = center[0] - size/2, point[1] = center[1] + size/2;
	addPoint(point);
	point[0] = center[0] - size/2, point[1] = center[1] + size/2;
	addPoint(point);
	point[0] = center[0] + size/2, point[1] = center[1] + size/2;
	addPoint(point);
	point[0] = center[0] + size/2, point[1] = center[1] - size/2;
	addPoint(point);
}
コード例 #25
0
ファイル: tagwidget.cpp プロジェクト: Farzana89/subsurface
TagWidget::TagWidget(QWidget *parent) : GroupedLineEdit(parent), m_completer(NULL)
{
	connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(reparse()));
	connect(this, SIGNAL(textChanged()), this, SLOT(reparse()));

	QColor textColor = palette().color(QPalette::Text);
	qreal h, s, l, a;
	textColor.getHslF(&h, &s, &l, &a);
	// I use dark themes
	if (l <= 0.3) { // very dark text. get a brigth background
		addColor(QColor(Qt::red).lighter(120));
		addColor(QColor(Qt::green).lighter(120));
		addColor(QColor(Qt::blue).lighter(120));
	} else if (l <= 0.6) { // moderated dark text. get a somewhat brigth background
		addColor(QColor(Qt::red).lighter(60));
		addColor(QColor(Qt::green).lighter(60));
		addColor(QColor(Qt::blue).lighter(60));
	} else {
		addColor(QColor(Qt::red).darker(120));
		addColor(QColor(Qt::green).darker(120));
		addColor(QColor(Qt::blue).darker(120));
	} // light text. get a dark background.
	setFocusPolicy(Qt::StrongFocus);
}
コード例 #26
0
ファイル: theme.cpp プロジェクト: amosbird/CopyQ
QColor evalColor(const QString &expression, const Theme &theme, int maxRecursion)
{
    int r = 0;
    int g = 0;
    int b = 0;
    int a = 0;

    QStringList addList = QString(expression).remove(' ').split('+');
    for (const auto &add : addList) {
        QStringList subList = add.split('-');
        float multiply = 1;
        for (const auto &sub : subList) {
            addColor(sub, multiply, &r, &g, &b, &a, theme, maxRecursion);
            multiply = -1;
        }
    }

    return QColor(r, g, b, a);
}
コード例 #27
0
dockListUpdate mutableSquareImageContainer::fillRegion(int x, int y,
                                                       flossColor newColor) {

  const triC oldColor = image_.pixel(x, y);
  if (newColor == oldColor) {
    return dockListUpdate();
  }
  const QVector<pairOfInts> coordinates =
    ::fillRegion(&image_, x, y, newColor.qrgb(), originalDimension_);

  const bool colorAdded = addColor(newColor);
  const flossColor oldFlossColor = getFlossColorFromColor(oldColor);
  addToHistory(historyItemPtr(new fillRegionHistoryItem(oldFlossColor,
                                                        newColor,
                                                        colorAdded,
                                                        coordinates)));
  colorListCheckNeeded_ = true;
  return dockListUpdate(newColor.color(), colorAdded);
}
コード例 #28
0
ファイル: colorlist.cpp プロジェクト: Aconex/pcp
bool
ColorList::add(const char *name, const char *scaleColor)
{
    if (list(name) != NULL)
	return false;

    _names.append(name);
    if (scaleColor != NULL) {
	_colors.append(new ColorSpec(true));
	if (addColor(scaleColor, 0.0) == false) {
	    _colors.last()->_list.append(new SbColor(0.0, 0.0, 1.0));
	    _colors.last()->_max.append(0.0);
	}
    }
    else
	_colors.append(new ColorSpec(false));

    return true;
}
コード例 #29
0
dockListUpdate mutableSquareImageContainer::
commitChangeOneDrag(const QSet<pairOfInts>& squares, flossColor newColor) {

  const QRgb newRgbColor = newColor.qrgb();
  const bool colorAdded = addColor(newColor);
  QVector<pixel> historyPixels;
  QVector<triC> pixelColors;
  for (QSet<pairOfInts>::const_iterator it = squares.begin(),
          end = squares.end(); it != end; ++it) {
    const int x = it->x() * originalDimension_;
    const int y = it->y() * originalDimension_;
    const QRgb thisColor = image_.pixel(x, y);
    pixelColors.push_back(thisColor);
    historyPixels.push_back(pixel(thisColor, pairOfInts(x, y)));
  }
  ::changeBlocks(&image_, historyPixels, newRgbColor, originalDimension_);
  addToHistory(historyItemPtr(new changeOneHistoryItem(newColor, colorAdded,
                                                       historyPixels)));
  colorListCheckNeeded_ = true;
  return dockListUpdate(newRgbColor, colorAdded);
}
コード例 #30
0
ファイル: palarith.c プロジェクト: intgr/sc2-uqm
int main(int argc, char* argv[])
{
	struct options opts;
	int ret;
	uqm_palette_t pal;

	parse_arguments(argc, argv, &opts);
	verbose_level = opts.verbose;

	verbose(2, "Processing '%s', index %d-%d\n", opts.infile, opts.from, opts.to);

	memset(&pal, 0, sizeof(pal));

	ret = readPalette(&pal, opts.infile);
	if (ret != 0)
		return ret;

	if (opts.luma < 0 && !opts.add && !opts.sub && !opts.blend)
		setColor(&pal, opts.from, opts.to, &opts.color);

	if (opts.luma >= 0)
	{
		if (opts.color_set && !opts.add && !opts.sub && !opts.blend)
			setColorLuma(&pal, opts.from, opts.to, opts.luma, &opts.color);
		else
			adjustLuma(&pal, opts.from, opts.to, opts.luma);
	}

	if (opts.add)
		addColor(&pal, opts.from, opts.to, &opts.color, opts.prorate);
	else if (opts.sub)
		subColor(&pal, opts.from, opts.to, &opts.color, opts.prorate);
	else if (opts.blend)
		blendToColor(&pal, opts.from, opts.to, opts.blend, &opts.color,
				opts.prorate);

	ret = writePalette(&pal, opts.outfile);

	return ret;
}