Example #1
0
void eWidgetDesktop::paint()
{
	m_require_redraw = 0;

		/* walk all root windows. */
	for (ePtrList<eWidget>::iterator i(m_root.begin()); i != m_root.end(); ++i)
	{

		if (!(i->m_vis & eWidget::wVisShow))
			continue;

		if (m_comp_mode == cmImmediate)
			paintLayer(i, 0);
		else
			for (int l = 0; l < MAX_LAYER; ++l)
			{
				paintLayer(i, l);
				paintBackground(i->m_comp_buffer[l]);
			}
	}

	if (m_comp_mode == cmImmediate)
		paintBackground(&m_screen);

	if (m_comp_mode == cmBuffered)
	{
//		redrawComposition(0);
	} else
	{
		gPainter painter(m_screen.m_dc);
		painter.flush();
	}
}
Example #2
0
void WaveViewer::resetWavePath() {
  if (!background_.isValid())
    return;

  wave_path_.clear();

  if (wave_slider_ == nullptr)
    return;

  float amplitude = amplitude_slider_ ? amplitude_slider_->getValue() : 1.0f;
  float draw_width = getWidth();
  float draw_height = getHeight() - 2.0f * PADDING;

  wave_path_.startNewSubPath(0, getHeight() / 2.0f);
  mopo::Wave::Type type = static_cast<mopo::Wave::Type>(static_cast<int>(wave_slider_->getValue()));
  for (int i = 1; i < resolution_ - 1; ++i) {
    float t = (1.0f * i) / resolution_;
    float val = amplitude * mopo::Wave::wave(type, t);
    wave_path_.lineTo(t * draw_width, PADDING + draw_height * ((1.0f - val) / 2.0f));
  }

  wave_path_.lineTo(getWidth(), getHeight() / 2.0f);

  const Desktop::Displays::Display& display = Desktop::getInstance().getDisplays().getMainDisplay();
  float scale = display.scale;
  Graphics g(background_);
  g.addTransform(AffineTransform::scale(scale, scale));
  paintBackground(g);

  repaint();
}
Example #3
0
void
GcScopeBar::paintEvent (QPaintEvent *event)
{
    // paint the darn thing!
    paintBackground(event);
    QWidget::paintEvent(event);
}
void
GcOverlayWidget::paintEvent (QPaintEvent *event)
{
    // paint the darn thing!
    paintBackground(event);
    QWidget::paintEvent(event);
}
Example #5
0
void Renderer::renderMetaTile(RenderAttributes& map, const shared_ptr<MetaTile>& tile)
{
	const shared_ptr<MetaIdentifier>& id = tile->getIdentifier();
	int width = id->getWidth() * TILE_SIZE;
	int height = id->getHeight() * TILE_SIZE;
	int zoom = id->getZoom();
	TileIdentifier::Format format = id->getIdentifiers()[0]->getImageFormat();

	shared_ptr<ImageWriter> writer = getWriter(format, width, height);

	FixedRect area;
	tileToMercator(id->getX(), id->getY(), zoom, area.minX, area.minY);
	tileToMercator(id->getX() + id->getWidth(),
				   id->getY() + id->getHeight(),
				   zoom, area.maxX, area.maxY);

#if OLD_CAIRO
	renderLock.lock();
#endif

	AssetCache cache;

	CairoLayer layers[LAYER_NUM];
	setupLayers(layers, writer, cache);

	paintBackground(layers[0], map.getCanvasStyle());

	renderArea(area, layers, width, height, map, cache);

#if OLD_CAIRO
	renderLock.unlock();
#endif

	tile->setData(layers[0].surface);
}
Example #6
0
void Renderer::renderEmptyTile(RenderAttributes& map, const shared_ptr<Tile>& tile)
{
	const shared_ptr<TileIdentifier>& id = tile->getIdentifier();
	shared_ptr<ImageWriter> writer = getWriter(id->getImageFormat(), TILE_SIZE, TILE_SIZE);

	Tile::ImageType buffer = boost::make_shared<Tile::ImageType::element_type>();
	// optimized for png images in the default stylesheet
	buffer->reserve(10*1024);

#if OLD_CAIRO
	renderLock.lock();
#endif

	CairoLayer layer(writer, buffer);
	paintBackground(layer, map.getCanvasStyle());

#if DEBUG_BUILD
	printTileId(layer.cr, tile->getIdentifier());
#endif

#if OLD_CAIRO
	renderLock.unlock();
#endif

	writer->write(layer.surface);
	tile->setImage(buffer);
}
Example #7
0
void KasBar::resizeEvent(QResizeEvent *ev)
{
    offscreen.resize( ev->size() );
    QPainter p( &offscreen );
    paintBackground( &p, QRect(QPoint(0,0),size()) );
    QWidget::resizeEvent(ev);
    emit layoutChanged();
}
Example #8
0
void XYPad::resized() {
  const Desktop::Displays::Display& display = Desktop::getInstance().getDisplays().getMainDisplay();
  float scale = display.scale;
  background_ = Image(Image::ARGB, scale * getWidth(), scale * getHeight(), true);
  Graphics g(background_);
  g.addTransform(AffineTransform::scale(scale, scale));
  paintBackground(g);
}
Example #9
0
void KoPAMasterPage::paintPage( QPainter & painter, KoZoomHandler & zoomHandler )
{
    paintBackground( painter, zoomHandler );

    KoShapePainter shapePainter;
    shapePainter.setShapes( shapes() );
    shapePainter.paint(painter, zoomHandler);
}
Example #10
0
void KasBar::setBackground( const QPixmap &newBg )
{
    bg = newBg;

    QPainter p( &offscreen );
    paintBackground( &p, QRect(QPoint(0,0),size()) );

    updateLayout();
}
Example #11
0
// Event handlers
void AnalogPad::resizeEvent(QResizeEvent * event)
{
    // Set center position and pad to center
    m_Position = QPointF(qreal(event->size().width())/2, qreal(event->size().height())/2);
    m_PadPosition = m_Position;
    // Redraw background and update
    paintBackground();
    update();
}
Example #12
0
void QSplineEdit::paintEvent(QPaintEvent *event)
{
	QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);
	
	paintBackground(painter);
	paintSpline(painter);
	paintControlLines(painter);
	paintControlHandles(painter);
}
Example #13
0
void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) {
    painter->setRenderHint(QPainter::HighQualityAntialiasing, true);
    paintBackground(painter);

    painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
    QGraphicsPixmapItem::paint(painter, item, widget);

    painter->setRenderHint(QPainter::HighQualityAntialiasing, true);
    paintForegroundOverlay(painter);
}
void UIGChooserItemMachine::paintDecorations(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption)
{
    /* Prepare variables: */
    QRect fullRect = pOption->rect;

    /* Paint background: */
    paintBackground(pPainter, fullRect);

    /* Paint frame: */
    paintFrameRectangle(pPainter, fullRect);
}
void GraphicalStepSequencer::resetBackground() {
  if (!background_.isValid())
    return;

  const Desktop::Displays::Display& display = Desktop::getInstance().getDisplays().getMainDisplay();
  float scale = display.scale;
  Graphics g(background_);
  g.addTransform(AffineTransform::scale(scale, scale));
  paintBackground(g);
  repaint();
}
Example #16
0
void FilterResponse::resized() {
  const Desktop::Displays::Display& display = Desktop::getInstance().getDisplays().getMainDisplay();
  float scale = display.scale;
  background_ = Image(Image::ARGB, scale * getWidth(), scale * getHeight(), true);
  Graphics g(background_);
  g.addTransform(AffineTransform::scale(scale, scale));
  paintBackground(g);

  computeFilterCoefficients();
  resetResponsePath();
}
Example #17
0
void SkinListDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex &index) const
{
    painter->save();

    paintBackground(painter, option);

    paintIcon(painter, option, index);

    paintText(painter, option, index);

    painter->restore();
}
Example #18
0
void SynthSection::resized() {
  Component::resized();

  const Desktop::Displays::Display& display = Desktop::getInstance().getDisplays().getMainDisplay();
  float scale = display.scale;
  Image background = Image(Image::ARGB, scale * getWidth(), scale * getHeight(), true);
  Graphics g(background);
  g.addTransform(AffineTransform::scale(scale, scale));

  paintBackground(g);
  background_ = background;
}
Example #19
0
void KoPAPage::paintPage( QPainter & painter, KoZoomHandler & zoomHandler )
{
    paintBackground( painter, zoomHandler );

    KoShapePainter shapePainter( getPaintingStrategy() );
    if ( displayMasterShapes() ) {
        shapePainter.setShapes( masterPage()->shapes() );
        shapePainter.paint(painter, zoomHandler);
    }
    shapePainter.setShapes( shapes() );
    shapePainter.paint(painter, zoomHandler);
}
Example #20
0
void ExtenderButton::paint(QPainter * painter,
        const QStyleOptionGraphicsItem * option, QWidget * widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);

    // if (Plasma::FrameSvg * svg = group()->backgroundSvg()) {
    //     if (isHovered() && (d->extenderPosition != NoExtender)) {
    //         svg->setEnabledBorders(d->borders);
    //     } else {
    //         svg->setEnabledBorders(Plasma::FrameSvg::AllBorders);
    //     }
    // }

    if (d->checked && !isDown()) {
        paintBackground(painter, "checked");
    } else {
        paintBackground(painter);
    }
    paintForeground(painter);
}
Example #21
0
void RadioButton::render(Graphics* graphics) {
    int x = getLocation().x;
    int y = getLocation().y;

    int w = getDimension().w;
    int h = getDimension().h;

    paintBackground(graphics);

    paintButtonIcon(graphics, isSelected(), isStatePressed(), isStateHover(), x, y, min(w, h));
    label->setDimension(label->getDimension().x, h);
    label->render(graphics);
}
Example #22
0
void BasicBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget /*= 0*/)
{
  if (_needRepaint == true || _width == 0.0 || _height == 0.0)
  {
    _cache = QPixmap(QSize(_width, _height));
    QPainter cachedPainter(&_cache);
    paintBackground(cachedPainter);
    cachedPainter.setRenderHint(QPainter::TextAntialiasing);
    paintText(cachedPainter);
    _needRepaint = false;
  }

  painter->drawPixmap(0, 0, _cache);
}
Example #23
0
void KasBar::updateItem( KasItem *i )
{
    if ( !i )
	return;
    if ( !isShown() )
	return;

    QPainter p( &offscreen );
    QPoint pos = i->pos();

    paintBackground( &p, QRect( pos, QSize( itemExtent(), itemExtent() ) ) );
    i->paint( &p, pos.x(), pos.y() );
    update( QRect( pos, QSize( itemExtent(), itemExtent() ) ) );
}
Example #24
0
void KasBar::repaintItem(KasItem *i, bool erase )
{
    if ( !i )
	return;
    if ( !isShown() )
	return;

    QPainter p( &offscreen );
    QPoint pos = i->pos();

    paintBackground( &p, QRect( pos, QSize( itemExtent(), itemExtent() ) ) );
    i->paint( &p, pos.x(), pos.y() );
    repaint( QRect( pos, QSize( itemExtent(), itemExtent()  ) ), transparent_ || erase );
}
Example #25
0
File: main.c Project: jessi/listas
void iniciar_SDL(){
	if (SDL_Init(SDL_INIT_VIDEO) < 0) {
		printf("No se pudo iniciar SDL: %s\n",SDL_GetError());
		exit(1);
	}
	// Activamos modo de video
	screen = SDL_SetVideoMode(SCREEN_W,SCREEN_H,24,SDL_HWSURFACE | SDL_DOUBLEBUF );
	if (screen == NULL) {
		printf("No se puede inicializar el modo gráfico: %s\n",SDL_GetError());
		exit(1);
	}
	cargar_img_nodos();
	paintBackground();
}
Example #26
0
void DisassemblyView::paintEvent(QPaintEvent * evt)
{
  if (_needRepaint == true)
  {
    _cache = QPixmap(viewport()->size());
    QPainter cachedPainter(&_cache);
    paintBackground(cachedPainter);
    paintSelection(cachedPainter);
    cachedPainter.setRenderHint(QPainter::TextAntialiasing);
    cachedPainter.setFont(font());
    paintText(cachedPainter);
    _needRepaint = false;
  }

  QPainter p(viewport());
  p.drawPixmap(0, 0, _cache);
  paintCursor(p);
}
void UIPopupPane::paintEvent(QPaintEvent *)
{
    /* Compose painting rectangle,
     * Shifts are required for the antialiasing support: */
    const QRect rect(1, 1, width() - 2, height() - 2);

    /* Create painter: */
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);

    /* Configure clipping: */
    configureClipping(rect, painter);

    /* Paint background: */
    paintBackground(rect, painter);

    /* Paint frame: */
    paintFrame(painter);
}
Example #28
0
void WaDigit::paintEvent(QPaintEvent *)
{
    paintBackground();

    const char *time = timeString.latin1();
    int len = strlen(time);
    if (len == 0) 
	return;

    // Declare all these variables after we check for zero-length
    WaSkinModel *waSkinModel = WaSkinModel::instance();

    int x = waSkinModel->getMapGeometry(mapping).x();
    int y = waSkinModel->getMapGeometry(mapping).y();

    QRect mapRect;

    // We expect strings either in the form "xx:yy", or "-xx:yy"
    // If the string length is 6, we have it in the form of "-xx:yy"
    // Remove the -, move the string forward one character, and 
    // continue parsing
    mapRect = waSkinModel->getMapGeometry(_WA_MAPPING_MINUS);
    if (len == 6) {
        waSkinModel->getDigit('-', this, mapRect.x() - x, mapRect.y() - y);
        time++;
    }
    else {
        waSkinModel->getDigit(' ', this, mapRect.x() - x, mapRect.y() - y);
    }

    mapRect = waSkinModel->getMapGeometry(_WA_MAPPING_DIGIT_1);
    waSkinModel->getDigit(time[0], this, mapRect.x() - x, mapRect.y() - y);

    mapRect = waSkinModel->getMapGeometry(_WA_MAPPING_DIGIT_2);
    waSkinModel->getDigit(time[1], this, mapRect.x() - x, mapRect.y() - y);

    mapRect = waSkinModel->getMapGeometry(_WA_MAPPING_DIGIT_3);
    waSkinModel->getDigit(time[3], this, mapRect.x() - x, mapRect.y() - y);

    mapRect = waSkinModel->getMapGeometry(_WA_MAPPING_DIGIT_4);
    waSkinModel->getDigit(time[4], this, mapRect.x() - x, mapRect.y() - y);
}
    void PianorollTrackView::paintMainContent(QPainter *painter, const QRect &rect) {
        paintBackground(painter, rect);
        ui->mainContent->paintMeasureLines(painter, rect);
        if (mutex) {
            mutex->lock();
            paintItems(painter, rect);
            mutex->unlock();
        } else {
            paintItems(painter, rect);
        }
        ui->mainContent->paintSongPosition(painter, rect);

        // 矩形選択の範囲を描画する
        if (mouseStatus.mode == MouseStatus::LEFTBUTTON_SELECT_ITEM) {
            QRect selectRect = mouseStatus.rect();
            static QColor fillColor(0, 0, 0, 100);
            static QColor borderColor(0, 0, 0, 200);
            static QColor shadowColor(0, 0, 0, 40);
            painter->fillRect(selectRect, fillColor);
            painter->setPen(borderColor);
            painter->drawRect(selectRect);

            // 選択範囲の周囲に影を描く
            painter->setPen(shadowColor);
            // 上側
            painter->drawLine(
                    selectRect.left(), selectRect.top() - 1,
                    selectRect.right() + 1, selectRect.top() - 1);
            // 下側
            painter->drawLine(
                    selectRect.left(), selectRect.bottom() + 2,
                    selectRect.right() + 1, selectRect.bottom() + 2);
            // 左側
            painter->drawLine(
                    selectRect.left() - 1, selectRect.top(),
                    selectRect.left() - 1, selectRect.bottom() + 1);
            // 右側
            painter->drawLine(
                    selectRect.right() + 2, selectRect.top(),
                    selectRect.right() + 2, selectRect.bottom() + 1);
        }
    }
Example #30
0
// NOTE: This is not the most time-efficient implementation, but it saves space by not caching unnecessary data
//       This is a deliberate trade-off. (-> selectFmt creation, data() call)
void ChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    Q_UNUSED(option); Q_UNUSED(widget);
    painter->save();
    painter->setClipRect(boundingRect());
    paintBackground(painter);

    layout()->draw(painter, pos(), additionalFormats(), boundingRect());

    //  layout()->draw(painter, QPointF(0,0), formats, boundingRect());

    // Debuging Stuff
    // uncomment partially or all of the following stuff:
    //
    // 0) alternativ painter color for debug stuff
//   if(row() % 2)
//     painter->setPen(Qt::red);
//   else
//     painter->setPen(Qt::blue);
// 1) draw wordwrap points in the first line
//   if(column() == 2) {
//     ChatLineModel::WrapList wrapList = data(ChatLineModel::WrapListRole).value<ChatLineModel::WrapList>();
//     foreach(ChatLineModel::Word word, wrapList) {
//       if(word.endX > width())
//      break;
//       painter->drawLine(word.endX, 0, word.endX, height());
//     }
//   }
// 2) draw MsgId over the time column
//   if(column() == 0) {
//     QString msgIdString = QString::number(data(MessageModel::MsgIdRole).value<MsgId>().toInt());
//     QPointF bottomPoint = boundingRect().bottomLeft();
//     bottomPoint.ry() -= 2;
//     painter->drawText(bottomPoint, msgIdString);
//   }
// 3) draw bounding rect
//   painter->drawRect(_boundingRect.adjusted(0, 0, -1, -1));

    painter->restore();
}