Zone::Zone(QGraphicsItem *parent) : MapItem(parent) { // Set parameters width = 501; height = 512; setLineColor(QColor(Qt::white)); setFillColor(QColor(Qt::white)); }
/** * Instantiates paddle in bottom-middle of window. */ GRect initPaddle(GWindow window) { GRect paddle = newGRect(((WIDTH/2)-35), 550, P_WIDTH, P_HEIGHT); setColor(paddle, "BLACK"); setFillColor(paddle, "BLACK"); setFilled(paddle, true); add(window, paddle); return paddle; }
Prey::Prey() { setRadius(8); setFillColor(Color::Green); vX = .8; vY = .8; setPosition(5, 50); }
void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern) { ASSERT(pattern); if (!pattern) { setFillColor(Color::black, ColorSpaceDeviceRGB); return; } m_state.fillGradient.clear(); m_state.fillPattern = pattern; }
void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient) { ASSERT(gradient); if (!gradient) { setFillColor(Color::black, ColorSpaceDeviceRGB); return; } m_state.fillGradient = gradient; m_state.fillPattern.clear(); }
//example implementation void Button::animation_upadate() { if(!m_isEnabled) { setFillColor(m_color_disabled); return; } Color c = m_color_mouseOver; double ratio1 = sqrt((double)m_animation) / sqrt((double)m_animationLength); double ratio2 = 1 - ratio1; setFillColor(Color( (Uint8)(c.r * ratio1 + m_color.r * ratio2), (Uint8)(c.g * ratio1 + m_color.g * ratio2), (Uint8)(c.b * ratio1 + m_color.b * ratio2), (Uint8)(c.a * ratio1 + m_color.a * ratio2))); updateVisuals(); }
TextButton::TextButton(const std::string &text, sf::Font& font, Widget *parent) :Button(parent), _label(text, font, nullptr){ _label = Label (text, font, this); setFillColor(sf::Color(153,204,255)); setOutlineThickness(2); setOutlineColor(sf::Color(0,153,153)); }
void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient) { ASSERT(gradient); if (!gradient) { setFillColor(Color::black); return; } m_common->state.fillColorSpace = GradientColorSpace; m_common->state.fillGradient = gradient; }
void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern) { ASSERT(pattern); if (!pattern) { setFillColor(Color::black); return; } m_common->state.fillColorSpace = PatternColorSpace; m_common->state.fillPattern = pattern; }
void GraphicsContext::drawRaisedEllipse(const FloatRect& rect, const Color& ellipseColor, const Color& shadowColor) { if (paintingDisabled()) return; save(); setStrokeColor(shadowColor); setFillColor(shadowColor); drawEllipse(FloatRect(rect.x(), rect.y() + 1, rect.width(), rect.height())); setStrokeColor(ellipseColor); setFillColor(ellipseColor); drawEllipse(rect); restore(); }
/** * Initializes window with a grid of bricks. */ void initBricks(GWindow window) { int b_y = 40; for (int i = 0; i < 5; i++) { int b_x = 2; for (int j = 0; j < 10; j++) { GRect bricks = newGRect(b_x, b_y, 35, 10); add(window, bricks); if (i == 0) { setFillColor(bricks, "BLUE"); } else if (i == 1) { setFillColor(bricks, "BLACK"); } else if (i == 2) { setFillColor(bricks, "RED"); } else if (i == 3) { setFillColor(bricks, "YELLOW"); } else if (i == 4) { setFillColor(bricks, "GREEN"); } setFilled(bricks, true); b_x = b_x + 40; } b_y = b_y + 20; } }
void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient) { ASSERT(gradient); if (!gradient) { setFillColor(Color::black, DeviceColorSpace); return; } m_common->state.fillGradient = gradient; m_common->state.fillPattern.clear(); setPlatformFillGradient(m_common->state.fillGradient.get()); }
void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern) { ASSERT(pattern); if (!pattern) { setFillColor(Color::black, DeviceColorSpace); return; } m_common->state.fillGradient.clear(); m_common->state.fillPattern = pattern; setPlatformFillPattern(m_common->state.fillPattern.get()); }
void draw(void *userData) { /* Draw rectangle */ setPenColor(POLO_TRANSPARENT); setFillColor(POLO_MIDNIGHT); drawRect(0, 0, 120, 44); /* Draw hello world */ setPenColor(POLO_WHITE); drawText(10, 10, "Hello world"); }
//----------------------------------------------------------------------------- void CDrawContext::init () { // set the default values setFrameColor (kWhiteCColor); setLineStyle (kLineSolid); setLineWidth (1); setFillColor (kBlackCColor); setFontColor (kWhiteCColor); setFont (kSystemFont); setDrawMode (kAliasing); setClipRect (surfaceRect); }
//----------------------------------------------------------------------------- void D2DDrawContext::setGlobalAlpha (float newAlpha) { if (currentState.globalAlpha == newAlpha) return; COffscreenContext::setGlobalAlpha (newAlpha); CColor color (currentState.frameColor); currentState.frameColor = kTransparentCColor; setFrameColor (color); color = currentState.fillColor; currentState.fillColor = kTransparentCColor; setFillColor (color); color = currentState.fontColor; currentState.fontColor = kTransparentCColor; setFontColor (color); }
bool CircleObject::init() { setIsDrag(false); setObjectType(ObjectType::CIRCLE_OBJECT); setTypeName("CircleObject"); m_drawnode = CCDrawNode::create(); addChild(m_drawnode); registerWithTouchDispatcher(); setBorderColor(ccc4f(1, 0, 0, 1)); setFillColor(ccc4f(0.5, 0.5, 0.5, 0.5)); m_radius = 10; return true; }
void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color) { if (paintingDisabled()) return; Path path; path.addRect(rect); if (!roundedHoleRect.radii().isZero()) path.addRoundedRect(roundedHoleRect); else path.addRect(roundedHoleRect.rect()); WindRule oldFillRule = fillRule(); Color oldFillColor = fillColor(); setFillRule(RULE_EVENODD); setFillColor(color); fillPath(path); setFillRule(oldFillRule); setFillColor(oldFillColor); }
void MyDebugDraw::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) { auto circle = sf::CircleShape(radius); circle.setPosition(center.x - radius, center.y - radius); circle.setFillColor(B2SFColor(color)); this->m_window->draw(circle); // line of the circle wich shows the angle b2Vec2 p = center + (radius * axis); sf::VertexArray lines(sf::Lines, 2); lines[0].color = sf::Color(0,0,0); lines[0].position = sf::Vector2f(center.x, center.y); lines[1].position = sf::Vector2f(p.x, p.y); this->m_window->draw(lines); }
Starship::Starship(VideoConfig &videoConfig) : sf::RectangleShape() { this->videoConfig = videoConfig; Speed = 600.0; BorderWidth = -2; BackgroundColor = sf::Color(255,255,255); BorderColor = sf::Color(0,0,0); setSize(sf::Vector2f(100, 18)); setOrigin(50, 9); setFillColor(BackgroundColor); setOutlineColor(BorderColor); setOutlineThickness(BorderWidth); setPosition(videoConfig.Width / 2, videoConfig.Height - 40); }
void load( Archive & ar, const unsigned int file_version ) { (void) file_version; (void) ar; this-> setPointCount(points.size()); deque<Point>::iterator it; unsigned int i=0; for(it=points.begin();it != points.end(); it++){ setPoint(i, sf::Vector2f(it->getX(), it->getY())); i++; } setFillColor(sf::Color(100,100,100,100)); setOutlineColor(sf::Color::Red); setOutlineThickness(3.); }
int main() { sf::RenderWindow window(sf::VideoMode(500, 500), "Fading Dots"); window.setFramerateLimit(60); sf::Vector2f old_pos(0.f, 0.f); const int STEP = 1; std::list<sf::CircleShape> points; while(window.isOpen()) { sf::Event event; while(window.pollEvent(event)) { if(event.type == sf::Event::Closed) window.close(); } // Check if the mouse has moved sf::Vector2f pos = static_cast<sf::Vector2f>(sf::Mouse::getPosition(window)); if(pos != old_pos) { // Create and add a new circle to the points list. sf::CircleShape cs; cs.setRadius(10.f); cs.setPosition(pos); cs.setFillColor(sf::Color::Red); points.push_back(cs); old_pos = pos; } window.clear(); for(auto it = points.begin(); it != points.end(); ++it) { window.draw(*it); if(it->getFillColor().a-STEP < 0) // When the transparency falls below zero (= invisible) then erase the dot. it = points.erase(it); else // Otherwise draw it with a increasing green touch (turns yellowish). it->setFillColor(sf::Color(255, it->getFillColor().g+STEP, 0, it->getFillColor().a-STEP)); } window.display(); } }
int QDeclarativePaintedItem::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDeclarativeItem::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 5) qt_static_metacall(this, _c, _id, _a); _id -= 5; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QSize*>(_v) = contentsSize(); break; case 1: *reinterpret_cast< QColor*>(_v) = fillColor(); break; case 2: *reinterpret_cast< int*>(_v) = pixelCacheSize(); break; case 3: *reinterpret_cast< bool*>(_v) = smoothCache(); break; case 4: *reinterpret_cast< qreal*>(_v) = contentsScale(); break; } _id -= 5; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setContentsSize(*reinterpret_cast< QSize*>(_v)); break; case 1: setFillColor(*reinterpret_cast< QColor*>(_v)); break; case 2: setPixelCacheSize(*reinterpret_cast< int*>(_v)); break; case 3: setSmoothCache(*reinterpret_cast< bool*>(_v)); break; case 4: setContentsScale(*reinterpret_cast< qreal*>(_v)); break; } _id -= 5; } else if (_c == QMetaObject::ResetProperty) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 5; } #endif // QT_NO_PROPERTIES return _id; }
polyFixWidth::polyFixWidth() { polySimple::polySimple(); polyAdv::polyAdv(); polyEditable::polyEditable(); center.set(0,0); width = 1; bSquare = false; length = 0; ppA.set(0,0); ppB.set(0,0); setFillColor(200,200,200,100); setStrokeColor(255,0,0,255); }
Block() { setPointCount(point_number); setFillColor(sf::Color(200, 100, 100)); setOutlineColor(sf::Color(255, 100, 100)); setOutlineThickness(2.f); setPoint(0, sf::Vector2f(0, 0)); setPoint(1, sf::Vector2f(length1, 0)); setPoint(2, sf::Vector2f(length1 + offset_length, offset_depth)); setPoint(3, sf::Vector2f(length1 + offset_length + length2, offset_depth)); setPoint(4, sf::Vector2f(length1 + offset_length * 2 + length2, 0)); setPoint(5, sf::Vector2f(min_width, 0)); for(std::size_t i = 0; i < 6; ++i) setPoint(11 - i, getPoint(i) + sf::Vector2f(0, min_height)); }
RectangleAnnotation::RectangleAnnotation(Component *pParent) : ShapeAnnotation(pParent) { // set the default values GraphicItem::setDefaults(); FilledShape::setDefaults(); ShapeAnnotation::setDefaults(); // create a grey rectangle setLineColor(QColor(0, 0, 0)); setFillColor(QColor(240, 240, 240)); setFillPattern(StringHandler::FillSolid); QList<QPointF> extents; extents << QPointF(-100, -100) << QPointF(100, 100); setExtents(extents); setPos(mOrigin); setRotation(mRotation); }
ListWidget::ListWidget() : selectedItem_(nullptr), scrollValue_(0) { setFillColor(DEFAULT_FILL_COLOR); setOutlineColor(DEFAULT_OUTLINE_COLOR); setOutlineThickness(DEFAULT_OUTLINE_THICKNESS); scrollBar_ = new ScrollBar(); scrollBar_->signalValueChanged.connect([this] (float value) { slotScrollBarValueChanged(value); }); scrollBar_->setSize({SCROLLBAR_WIDTH, this->getSize().y}); scrollBar_->setParentAnchor({1, 0}); scrollBar_->setAnchor({1, 0}); addWidget(scrollBar_); signalClicked.connect([this] { slotClicked(); }); }
Shape::Shape() : QGraphicsRectItem() { setShapeName( "Shape" ); setText( "Some Text" ); setTextColor( QColor::fromHsv(rand()%256,255,190) ); setText( "Some Text" ); setTextColor( QColor::fromHsv(rand()%256,255,190) ); setLineColor( QColor::fromHsv(rand()%256,255,190) ); setFillColor( QColor::fromHsv(rand()%256,255,190) ); setScenePosition( QPointF(100,100) ); setGeometry( QRectF(-100,-50,200,100) ); }
int StickMan::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGraphicsObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QColor*>(_v) = penColor(); break; case 1: *reinterpret_cast< QColor*>(_v) = fillColor(); break; case 2: *reinterpret_cast< bool*>(_v) = isDead(); break; } _id -= 3; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setPenColor(*reinterpret_cast< QColor*>(_v)); break; case 1: setFillColor(*reinterpret_cast< QColor*>(_v)); break; case 2: setIsDead(*reinterpret_cast< bool*>(_v)); break; } _id -= 3; } else if (_c == QMetaObject::ResetProperty) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 3; } #endif // QT_NO_PROPERTIES return _id; }
SpectrumPanel::SpectrumPanel() { floorValue = 0; ceilValue = 1; showDb = false; fftSize = DEFAULT_FFT_SIZE; bandwidth = DEFAULT_DEMOD_BW; freq = 0; setFill(GLPANEL_FILL_GRAD_Y); setFillColor(ThemeMgr::mgr.currentTheme->fftBackground * 2.0, ThemeMgr::mgr.currentTheme->fftBackground); dbPanelCeil.setMarginPx(0); dbPanelCeil.setFill(GLPanel::GLPANEL_FILL_GRAD_X); dbPanelCeil.setFillColor(RGBA4f(0.2f,0.2f,0.2f,5.0f), RGBA4f(0.2f,0.2f,0.2f,0.0f)); dbPanelFloor.setMarginPx(0); dbPanelFloor.setFill(GLPanel::GLPANEL_FILL_GRAD_X); dbPanelFloor.setFillColor(RGBA4f(0.2f,0.2f,0.2f,5.0f), RGBA4f(0.2f,0.2f,0.2f,0.0f)); }