Image* ColorizeCommand::execute(Image* image){ Image* colorized = new Image(image->getWidth(), image->getHeight()); float*** newImage = colorized->getImage(); float*** originalImage = image->getImage(); int height = image->getHeight(); int width = image->getWidth(); //if this is an existing color scheme if (predefined){ if (myColorEffect == "-removered"){ applyColor(newImage, originalImage, height, width, 0.0, 1.0, 1.0); }else if( myColorEffect == "-negative"){ applyNegative(newImage, originalImage, height, width); }else if(myColorEffect == "-grayscale"){ applyGrayscale(newImage, originalImage, height, width); }else if(myColorEffect == "-cartoonize"){ applyCartoonize(newImage, originalImage, height, width); }else { //TODO: perhaps add error handling } }else{ applyColor(newImage,originalImage,height, width, myRedBias, myGreenBias, myBlueBias); } return colorized; }
static void colorizeKeyword (Task& task, const std::string& rule, const Color& base, Color& c, bool merge) { // Observe the case sensitivity setting. bool sensitive = context.config.getBoolean ("search.case.sensitive"); // The easiest thing to check is the description, because it is just one // attribute. if (find (task.get ("description"), rule.substr (14), sensitive) != std::string::npos) applyColor (base, c, merge); // Failing the description check, look at all annotations, returning on the // first match. else { for (auto& it : task) { if (it.first.substr (0, 11) == "annotation_" && find (it.second, rule.substr (14), sensitive) != std::string::npos) { applyColor (base, c, merge); return; } } } }
void PatBike::drawTrailerHitch() { glPushMatrix(); glTranslatef(-3.2, 0.45, 0); glRotatef(-5,0,0,1); glPushMatrix();//WHeels glTranslatef(-1.25, -0.58, -0.7); glPushMatrix(); drawTire(12); glPopMatrix(); glTranslatef(0,0,1.4); glPushMatrix(); drawTire(12); glPopMatrix(); glTranslatef(0,0,-1.6); glColor3f(0.31,0.1,1.0);//Rear Axl drawCylinder(0.075, 0.075, 1.8, 75, 75); glRotatef(180,0,1,0); glutSolidCone(0.075, 0.1, 25, 25); glRotatef(-180,0,1,0); glTranslatef(0,0,1.8); glutSolidCone(0.075, 0.1, 25, 25); glPopMatrix(); glScalef(0.9,0.7,0.7); //glRotatef(180, 1, 0, 0); glColor3f(0.39,0.1,0.1); applyColor(); glutSolidTeapot(1.0); //front of hitch glTranslatef(-0.9, 0.25, 0); glScalef(1.9,0.7,1); glScalef(1,1.5,1); gluSphere( quadric, 1,70,70); setMaterial(); glPopMatrix(); }
EditorColorDialog::EditorColorDialog(const QModelIndex& index, const QColor& initial, QWidget* parent) : QLineEdit(parent) , color_button_(new QPushButton(this)) , index_(index) , current_(initial) { connect(color_button_, SIGNAL(clicked()), this, SLOT(applyColor())); }
static void colorizeUDA (Task& task, const std::string& rule, const Color& base, Color& c, bool merge) { // Is the rule color.uda.name.value or color.uda.name? size_t pos = rule.find (".", 10); if (pos == std::string::npos) { if (task.has (rule.substr (10))) applyColor (base, c, merge); } else { const std::string uda = rule.substr (10, pos - 10); const std::string val = rule.substr (pos + 1); if ((val == "none" && ! task.has (uda)) || task.get (uda) == val) applyColor (base, c, merge); } }
void LVL_Background::setNone() { isNoImage=true; setup.id=0; color.r = 0.0f; color.g = 0.0f; color.b = 0.0f; applyColor(); }
void DocumentView::applyColor(cairo_t* cr, Stroke* s) { if (s->getToolType() == STROKE_TOOL_HIGHLIGHTER) { if (s->getFill() != -1) { applyColor(cr, s, s->getFill()); } else { applyColor(cr, s, 120); } } else { applyColor(cr, (Element*) s); } }
void ColorizedSubSkin::setStateData(MyGUI::IStateInfo* _data) { MyGUI::SubSkin::setStateData(_data); m_state_color = _data->castType<ColorizedSubSkinStateInfo>()->getColor(); applyColor(); if (nullptr != mNode) mNode->outOfDate(mRenderItem); }
static void applyColor (MdlObject *o, Vector3 color) { for (PolyIterator pi(o);!pi.End();pi.Next()) if (pi->isSelected){ pi->color = color; pi->texname.clear(); pi->texture=0; } for (unsigned int a=0;a<o->childs.size();a++) applyColor (o->childs[a], color); }
static void colorizeOverdue (Task& task, const Color& base, Color& c, bool merge) { if (task.has ("due")) { Task::status status = task.getStatus (); if (status != Task::completed && status != Task::deleted && task.getDateState ("due") == Task::dateBeforeToday) applyColor (base, c, merge); } }
void click (){ if (!fltk::color_chooser("Color for selected polygons", color.x, color.y, color.z)) return; Model *m=editor->GetMdl(); if (m->root) applyColor (m->root,color); BACKUP_POINT("Polygon color changed"); editor->RedrawViews(); }
void DocumentView::drawText(cairo_t* cr, Text* t) { XOJ_CHECK_TYPE(DocumentView); if (t->isInEditing()) { return; } applyColor(cr, t); TextView::drawText(cr, t); }
static void colorizeDueToday (Task& task, const Color& base, Color& c, bool merge) { if (task.has ("due")) { Task::status status = task.getStatus (); Task::dateState dateState = task.getDateState ("due"); if (status != Task::completed && status != Task::deleted && (dateState == Task::dateLaterToday || dateState == Task::dateEarlierToday)) applyColor (base, c, merge); } }
ImageSet applyTeamColors(const SdlSurface &baseImg) { initColors(); ImageSet ret; for (int i = 0; i < numTeams; ++i) { ret.emplace_back(sdlDeepCopy(baseImg)); applyColor(ret[i], i); } return ret; }
static void colorizeProject (Task& task, const std::string& rule, const Color& base, Color& c, bool merge) { // Observe the case sensitivity setting. bool sensitive = context.config.getBoolean ("search.case.sensitive"); std::string project = task.get ("project"); std::string rule_trunc = rule.substr (14); // Match project names leftmost. if (rule_trunc.length () <= project.length ()) if (compare (rule_trunc, project.substr (0, rule_trunc.length ()), sensitive)) applyColor (base, c, merge); }
void Aspring::render() //! Note depends on parent's position matching { if(P1 == NULL || P2 == NULL) return; applyColor(Acolor(0,1,0)); renderSpring(); if(registered){ gl::color(ColorA(1, 1, 0, 1)); Rectf rect( 0, 10, currD+P1->r+P2->r, -10 ); gl::drawStrokedRect( rect ); } }
void Label::drawWidget( Window* parent ) { if ( text ) { parent->getScourgeGui()->setFontType( fontType ); GuiTheme *theme = parent->getTheme(); if ( !specialColor && theme->getWindowText() ) { glColor4f( theme->getWindowText()->r, theme->getWindowText()->g, theme->getWindowText()->b, theme->getWindowText()->a ); } else { applyColor(); } if ( lines.empty() ) { // draw a single-line label parent->getScourgeGui()->texPrint( 0, 0, text ); } else { int y = 0; for ( int i = 0; i < static_cast<int>( lines.size() ); i++ ) { parent->getScourgeGui()->texPrint( 0, y, lines[i].c_str() ); y += lineHeight; } } parent->getScourgeGui()->setFontType( Constants::SCOURGE_DEFAULT_FONT ); } }
void PatBike::drawFrontFrame() { glColor3f(0.7, 0.7, 0.7); float high_shininess[] = {500.0f * alpha}; glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess); glPushMatrix(); glTranslatef(0.0, 0.0, -0.3); drawCylinder(0.07, 0.07, 0.6, 75, 75);//bearing in front glPopMatrix(); glPushMatrix(); glTranslatef(0.0, 0.0, 0.30); glRotatef (20.0 , 0.0, 0.0, 1.0); glRotatef (-90.0 , 1.0, 0.0, 0.0); drawCylinder(0.09, 0.09, 1.25, 75, 75); glPopMatrix(); glPushMatrix(); glTranslatef(0.0, 0.0, -0.30); glRotatef (20.0 , 0.0, 0.0, 1.0); glRotatef (-90.0 , 1.0, 0.0, 0.0); drawCylinder(0.09, 0.09, 1.25, 75, 75); glPopMatrix(); glPushMatrix(); glColor3d(1,0,0); glTranslatef(-0.1, 0.70, 0); glRotatef(7, 0, 0, 1); glScalef(0.55,0.2,0.25); //tm->BindTextureByIndex(4, quadric); applyColor(); gluSphere( quadric, 1,70,70); setMaterial(); glDisable(GL_TEXTURE_2D); glDisable(GL_CULL_FACE); //glutSolidSphere(1,20,20); glPopMatrix(); }
void PatBike::drawHead() { glRotatef(-20, 0, 0, 1); glPushMatrix(); //light cast glRotatef(-90.0, 0.0, 1.0, 0.0); glutSolidCone(0.25, 0.5, 50, 50); glPopMatrix(); glPushMatrix(); //light bulb glColor3f(1.0,1.0,1.0); glScalef(0.1, 0.2, 0.2); //glEnable(GL_BLEND); //glBlendFunc(GL_SRC_ALPHA, GL_ONE); //glEnable(GL_ALPHA_TEST); if(lm->light2) { GLfloat emission[] = { 1, 1, 0.6, alpha }; glMaterialfv(GL_FRONT, GL_EMISSION, emission); glutSolidSphere(1.0, 50, 50); GLfloat light_position1[] = { 0, 0, 0, 1.0 }; GLfloat light_direction[] = { 10, -1, 0, 1 }; //glLightfv(GL_LIGHT1, GL_POSITION, light_position1); //glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, light_direction); GLfloat emission1[] = { 0, 0, 0, alpha }; glMaterialfv(GL_FRONT, GL_EMISSION, emission1); //glEnable(GL_LIGHT1); } else { GLfloat emission[] = { 0.5, 0.5, 1, alpha }; glMaterialfv(GL_FRONT, GL_EMISSION, emission); glutSolidSphere(1.0, 50, 50); GLfloat light_position1[] = { 0, 0, 0, 1.0 }; GLfloat light_direction[] = {20, -1, 0, 1 }; //glLightfv(GL_LIGHT5, GL_POSITION, light_position1); //glLightfv(GL_LIGHT5, GL_SPOT_DIRECTION, light_direction); GLfloat emission1[] = { 0, 0, 0, alpha }; glMaterialfv(GL_FRONT, GL_EMISSION, emission1); //glEnable(GL_LIGHT5); } //glDisable(GL_ALPHA_TEST); //glDisable(GL_BLEND); //else //{ // glutSolidSphere(1.0, 50, 50); //} glPopMatrix(); glColor3f(1,0,0.5); glTranslatef(-0.3, 0.0, 0.0); glPushMatrix(); // light support panel applyColor(); glScalef(0.1, 0.2, 0.35); glutSolidSphere(1.5, 50, 50); setMaterial(); glPopMatrix(); glTranslatef(-0.15, 0.15, -0.75); glPushMatrix(); // Handle Bar main glColor3f(0.2, 0.2, 0.2); //glColor3f(0,0,0.5); glRotatef(-90.0, 0.0, 0.0, 1.0); drawCylinder(0.12, 0.12, 1.5, 75, 75); glTranslatef(0.0, 0.0, 0.07); //glColor3f(0,0.5,0.1); glPushMatrix();// left handle bar glRotatef(-90.0, 0.0, 1.0, 0.0); glRotatef(20.0, 1.0, 0.0, 0.0); drawCylinder(0.08, 0.08, 0.5, 75, 75); glTranslatef(0.0, 0.0, 0.45); glRotatef(-90, 0, 1, 0); //glRotatef(-40, 1, 0, 0); glRotatef(40, 1, 0, 0); drawCylinder(0.07, 0.07, 0.5, 75, 75); glPopMatrix(); glTranslatef(0.0, 0.0, 1.36); glPushMatrix();// right handle bar glRotatef(-90.0, 0.0, 1.0, 0.0); glRotatef(20.0, 1.0, 0.0, 0.0); drawCylinder(0.08, 0.08, 0.5, 75, 75); glTranslatef(0.0, 0.0, 0.45); glRotatef(90, 0, 1, 0); //glRotatef(-40, 1, 0, 0); glRotatef(40, 1, 0, 0); drawCylinder(0.07, 0.07, 0.5, 75, 75); glPopMatrix(); glPopMatrix(); }
static void colorizeActive (Task& task, const Color& base, Color& c, bool merge) { if (task.has ("start") && !task.has ("end")) applyColor (base, c, merge); }
void LVL_Background::setBg(obj_BG &bg) { setup = bg; bgType = (type)setup.type; qDebug()<< "BG Type" << bgType; //Reset magic background parameters isMagic = false; strips.clear(); switch(bgType) { case single_row: case tiled: { long tID = ConfigManager::getBGTexture(bg.id); if( tID >= 0 ) { txData1 = ConfigManager::level_textures[tID]; if(bg.attached) color = bg.Color_lower; else color = bg.Color_upper; isAnimated = bg.animated; animator_ID = bg.animator_ID; if(bg.magic) { for(int i=0; (unsigned int)i < bg.magic_strips; i++) { LVL_Background_strip x; if( i-1 < bg.magic_splits_i.size()) x.top = (i==0 ? 0.0 : ((double)bg.magic_splits_i[i-1]/(double)txData1.h) ); else x.top = 0.0; if( i < bg.magic_splits_i.size()) x.bottom = (double)bg.magic_splits_i[i] / (double)txData1.h; else x.bottom = 1.0; x.height = ( (i<bg.magic_splits_i.size()) ? bg.magic_splits_i[i] : txData1.h) - (i==0 ? 0.0 : (bg.magic_splits_i[i-1]) ); if( i < bg.magic_speeds_i.size()) x.repeat_h = bg.magic_speeds_i[i]; else x.repeat_h = bg.repeat_h; if(x.repeat_h<=0) x.repeat_h = 1; // qDebug() << "Magic " << (i==0 ? 0 : bg.magic_splits_i[i-1] ) // << (( i < bg.magic_splits_i.size()) // ? bg.magic_splits_i[i]: txData1.h ) // << x.height // << x.repeat_h // << x.top << x.bottom; strips.push_back(x); } //qDebug() << bg.magic_splits_i.size() << bg.magic_speeds_i.size(); isMagic = true; } } //qDebug()<<"SingleRow"; } break; case double_row: { long tID = ConfigManager::getBGTexture(bg.id); if( tID >= 0 ) { txData1 = ConfigManager::level_textures[tID]; if(bg.attached) color = bg.Color_lower; else color = bg.Color_upper; isAnimated = bg.animated; animator_ID = bg.animator_ID; } long tID2 = ConfigManager::getBGTexture(bg.id, true); if( tID2 >= 0 ) { txData2 = ConfigManager::level_textures[tID2]; /* if(tmpstr=="overfirst") sbg.second_attached = 0; else if(tmpstr=="bottom") sbg.second_attached = 1; else if(tmpstr=="top") sbg.second_attached = 2; else sbg.second_repeat_v = 0; */ if(bg.second_attached) color = bg.Color_upper; else color = bg.second_Color_upper; } qDebug()<<"DoubleRow"; } break; default: break; } applyColor(); isNoImage=false; }
static void colorizeProjectNone (Task& task, const Color& base, Color& c, bool merge) { if (task.get ("project") == "") applyColor (base, c, merge); }
void DrawingBasics::drawIt(drawtype type) {//DrawingBasics::drawtype if (okToDraw(type)) { applyColor(); myDraw(); } };
static void colorizeDeleted (Task& task, const Color& base, Color& c, bool merge) { if (task.getStatus () == Task::deleted) applyColor (base, c, merge); }
static void colorizeRecurring (Task& task, const Color& base, Color& c, bool merge) { if (task.has ("recur")) applyColor (base, c, merge); }
static void colorizeUntil (Task& task, const Color& base, Color& c, bool merge) { if (task.has ("until")) applyColor (base, c, merge); }
static void colorizeTag (Task& task, const std::string& rule, const Color& base, Color& c, bool merge) { if (task.hasTag (rule.substr (10))) applyColor (base, c, merge); }
void DocumentView::applyColor(cairo_t* cr, Element* e, int alpha) { applyColor(cr, e->getColor(), alpha); }
static void colorizeScheduled (Task& task, const Color& base, Color& c, bool merge) { if (task.has ("scheduled") && ISO8601d (task.get_date ("scheduled")) <= now) applyColor (base, c, merge); }
static void colorizeTagNone (Task& task, const Color& base, Color& c, bool merge) { if (task.getTagCount () == 0) applyColor (base, c, merge); }