Esempio n. 1
0
void IndicatorLight::createLabel(int w, int h) {
    if(_glowEnabled && this->scene()) {

        // Draw label glow
        QPixmap pixmap = QPixmap(w,h);
        pixmap.fill(Qt::transparent);
        QPainter painter;
        painter.begin(&pixmap); {
            setupPainter(&painter);
            painter.setBrush(_labelColor);
            painter.setPen(Qt::NoPen);
            painter.drawRoundedRect(0,0,w,h,20,20);
        } painter.end();

        // Setup the graphics item for glow
        // This has a special z-value ontop of other graphics items so that it can glow above the panel cover...
        if(_labelGlowItem) {
            this->scene()->removeItem(_labelGlowItem);
        }
        _labelGlowItem = new QGraphicsPixmapItem(NULL);
        _labelGlowItem->setPixmap(pixmap);
        _labelGlowItem->setOpacity(_glowStrength/100.0);
        _labelGlowItem->setX(this->x());
        _labelGlowItem->setY(this->y());
        _labelGlowItem->setZValue(PANEL_PANELITEM_GLOW_ZVALUE);
        QGraphicsBlurEffect *effect = new QGraphicsBlurEffect(this);
        effect->setBlurRadius(40);
        _labelGlowItem->setGraphicsEffect(effect);
        this->scene()->addItem(_labelGlowItem);
    }
}
Esempio n. 2
0
void LinkSelectionItem::appear(const QPointF& animStartPos, const QRectF& linkRect) 
{
    QGraphicsBlurEffect* blur = new QGraphicsBlurEffect();
    blur->setBlurHints(QGraphicsBlurEffect::PerformanceHint);
    blur->setBlurRadius(15);
    setGraphicsEffect(blur);

    QPropertyAnimation* rectAnimation = new QPropertyAnimation(this, "rect");
    rectAnimation->setDuration(s_appearAnimDuration);

    rectAnimation->setStartValue(QRectF(animStartPos, QSize(3, 3)));
    rectAnimation->setEndValue(linkRect);    

    rectAnimation->setEasingCurve(QEasingCurve::OutExpo);

    QPropertyAnimation* opacityAnimation = new QPropertyAnimation(this, "opacity");
    opacityAnimation->setDuration(s_disappearAnimDuration);

    opacityAnimation->setStartValue(s_linkOpacity);
    opacityAnimation->setEndValue(0.0);

    opacityAnimation->setEasingCurve(QEasingCurve::InExpo);
    
    m_linkSelectiogroup.addAnimation(rectAnimation);
    m_linkSelectiogroup.addAnimation(opacityAnimation);
    m_linkSelectiogroup.start();
}
Esempio n. 3
0
MinaCurve::MinaCurve(QObject *object) :
    MinoAnimation(object)
{
    _generatorCurve = new MinoPropertyEasingCurve(this, true);
    _generatorCurve->setObjectName("curve");
    _generatorCurve->setLabel("Curve");

    _generatorAccel = new MinoPropertyEasingCurve(this);
    _generatorAccel->setObjectName("acceleration");
    _generatorAccel->setLabel("Accel.");
    // Please note that curve have not been tested with all parameters:
    // Theses following lines are here to show how to add curve type to selector
    _generatorAccel->addEasingCurveType(QEasingCurve::Linear);
    _generatorAccel->addEasingCurveType(QEasingCurve::OutInBack);
    _generatorAccel->addEasingCurveType(QEasingCurve::InOutBounce);
    _generatorAccel->addEasingCurveType(QEasingCurve::InOutQuart);
    _generatorAccel->setEasingCurveType(QEasingCurve::Linear);

    QColor color;
    color.setHsvF(0.4, 1.0, 1.0);
    for (int i=0;i<_boundingRect.width();i++)
    {
        _items.append(_scene->addLine(i,_boundingRect.height(),i,5,QPen(color)));
        _itemGroup.addToGroup(_items[i]);
    }

    QGraphicsBlurEffect *blur = new QGraphicsBlurEffect(this);
    blur->setBlurRadius(1.1);
    _itemGroup.setGraphicsEffect(blur);
    _itemGroup.setVisible(false);
}
Esempio n. 4
0
void AbstractContent::setFxIndex(int index)
{
    if (m_fxIndex == index)
        return;
    m_fxIndex = index;
    // apply graphics effect
#if QT_VERSION >= 0x040600
    switch (m_fxIndex) {
        default:
            setGraphicsEffect(0);
            break;
        case 1: {
            QGraphicsDropShadowEffect * ds = new QGraphicsDropShadowEffect(this);
            ds->setColor(Qt::black);
            ds->setBlurRadius(7);
            ds->setOffset(1, 1);
            setGraphicsEffect(ds);
            } break;
        case 2: {
            QGraphicsDropShadowEffect * ds = new QGraphicsDropShadowEffect(this);
            ds->setColor(Qt::white);
            ds->setBlurRadius(7);
            ds->setOffset(1, 1);
            setGraphicsEffect(ds);
            } break;
        case 3: {
            QGraphicsBlurEffect * b = new QGraphicsBlurEffect(this);
            b->setBlurRadius(5);
            b->setBlurHints(QGraphicsBlurEffect::QualityHint);
            setGraphicsEffect(b);
            } break;
        case 4: {
            QGraphicsBlurEffect * b = new QGraphicsBlurEffect(this);
            b->setBlurRadius(16);
            b->setBlurHints(QGraphicsBlurEffect::QualityHint);
            setGraphicsEffect(b);
            } break;
    }
#endif
    emit fxIndexChanged();
}
Esempio n. 5
0
QPixmap blurImage(const QImage &image, int radius)
{
    QGraphicsBlurEffect *blur = new QGraphicsBlurEffect;
    blur->setBlurRadius(radius);
    QImage result = applyEffectToImage(image, blur);
    int cropWidth = 20;
    QRect rect(cropWidth, cropWidth,
               result.width() - cropWidth * 2,
               result.height() - cropWidth * 2);
    QImage cropped = result.copy(rect);
    return QPixmap::fromImage(cropped);
}
Esempio n. 6
0
BlurItem::BlurItem(QGraphicsItem *parent)
  : QGraphicsRectItem(parent)
{
  m_item = new QGraphicsPixmapItem(this);

  QGraphicsBlurEffect *blur = new QGraphicsBlurEffect();
  blur->setBlurRadius(6);
  blur->setBlurHints(QGraphicsBlurEffect::PerformanceHint);
  m_item->setGraphicsEffect(blur);

  setFlag(ItemIsSelectable);
}
Esempio n. 7
0
QPixmap Icon::applyEffects() const
{
    QPixmap gfx = pixmap;

    if (isColor && !qFuzzyIsNull(depth)) {
        QLabel w;
        QGraphicsColorizeEffect *effect = new QGraphicsColorizeEffect();
        effect->setColor(color);
        effect->setStrength(depth);
        w.setPixmap(gfx);
        w.setGraphicsEffect(effect);
        gfx = w.grab();
    }

    if (!qFuzzyIsNull(radius)) {
        QImage canvas(gfx.size(), QImage::Format_ARGB32_Premultiplied);
        QPainter painter(&canvas);
        painter.setCompositionMode(QPainter::CompositionMode_Source);
        painter.fillRect(gfx.rect(), Qt::transparent);
        painter.setPen(Qt::NoPen);
        painter.setBrush(QBrush(gfx));
        painter.setRenderHint(QPainter::Antialiasing);
        painter.drawRoundedRect(gfx.rect(), radius, radius);
        painter.end();
        gfx = QPixmap::fromImage(canvas);
    }

    if (blur > 1.0) {
        QLabel w;
        QGraphicsBlurEffect *effect = new QGraphicsBlurEffect();
        effect->setBlurRadius(blur);
        effect->setBlurHints(QGraphicsBlurEffect::QualityHint);
        w.setPixmap(gfx);
        w.setGraphicsEffect(effect);
        gfx = w.grab();
    }

    if (flipX) {
        gfx = gfx.transformed(QTransform().scale(-1, 1));
    }

    if (flipY) {
        gfx = gfx.transformed(QTransform().scale(1, -1));
    }

    if (angle != 0) {
        gfx = gfx.transformed(QTransform().rotate(angle));
    }

    return gfx;
}
JournalGUI_ExerciseCard::JournalGUI_ExerciseCard( QWidget* theParent )
  : QGraphicsView( theParent )
{
  myShrink = 0.8;
  myDelta = -10;
  myShadowColor = QColor( 64, 64, 64, 200 );
  myBlurRadius = 20;
  myIsFinished = false;

  QGraphicsScene* aScene = new QGraphicsScene( this );
  setScene( aScene );
  
  setWindowFlags( Qt::Window | Qt::FramelessWindowHint );
  setAttribute( Qt::WA_TranslucentBackground );
  setFrameShape( QFrame::NoFrame );

  myShadowItem = new QGraphicsRectItem();
  myShadowItem->setBrush( myShadowColor );
  QGraphicsBlurEffect* aBlur = new QGraphicsBlurEffect( this );
  aBlur->setBlurRadius( myBlurRadius );
  myShadowItem->setGraphicsEffect( aBlur );
  aScene->addItem( myShadowItem );

  QFrame* aMainFrame = new QFrame( 0 );
  QVBoxLayout* aLayout = new QVBoxLayout( aMainFrame );

  QGridLayout* aMainLayout = new QGridLayout( 0 );
  QHBoxLayout* aStatusLayout = new QHBoxLayout( 0 );
  aLayout->addLayout( aMainLayout, 1 );
  aLayout->addLayout( aStatusLayout, 0 );

  myStateLabel = new QLabel( "", this );
  aStatusLayout->addWidget( myStateLabel, 1 );

  myVerify = new QPushButton( tr( "Verify" ), this );
  connect( myVerify, SIGNAL( clicked() ), this, SLOT( OnFinish() ) );
  aStatusLayout->addWidget( myVerify, 0 );

  myNext = new QPushButton( tr( "Next" ), this );
  connect( myNext, SIGNAL( clicked() ), this, SIGNAL( next() ) );
  aStatusLayout->addWidget( myNext, 0 );
  
  aMainLayout->setColumnStretch( 0, 1 );
  aMainLayout->setRowStretch( MAX_NB_ROWS, 1 );

  myFrameItem = aScene->addWidget( aMainFrame );
}
Esempio n. 9
0
 QImage BrushPainter::applyBlur(Brush brush)
{
     QImage res(brush.img.size()*2, QImage::Format_RGBA8888_Premultiplied);
     res.fill(Qt::transparent);
     QPainter paint;
     paint.begin(&res);
          paint.setOpacity((double)brush.opacity/100);
     paint.drawImage(brush.img.width()/2,brush.img.height()/2, brush.img);
     paint.end();
     QGraphicsBlurEffect *blur;
     blur = new QGraphicsBlurEffect();
     blur->setBlurRadius(brush.blur);
     qDebug () << "set blur radius:"<<brush.blur;
    // res = applyEffectToImage(res.scaled(brush.img.size()), blur);
     res = applyEffectToImage(res, blur);
     return res;

}
Esempio n. 10
0
void QGraphicsGlowEffect::draw(QPainter* painter) {
  QPoint offset;
  QPixmap source = sourcePixmap(Qt::LogicalCoordinates, &offset);
  source = source.scaled(source.size().width()/source.devicePixelRatio(), source.size().height()/source.devicePixelRatio());
  QPixmap glow;

  QGraphicsColorizeEffect *colorize = new QGraphicsColorizeEffect;
  colorize->setColor(_color);
  colorize->setStrength(1);
  glow = applyEffectToPixmap(source, colorize, 0);

  QGraphicsBlurEffect *blur = new QGraphicsBlurEffect;
  blur->setBlurRadius(_blurRadius);
  glow = applyEffectToPixmap(glow, blur, _extent);

  for (int i = 0; i < _strength; i++)
    painter->drawPixmap(offset - QPoint(_extent, _extent), glow);
  drawSource(painter);
}
Esempio n. 11
0
void MainWindow::show_notification(QString msg) {
    for(int i=0; i<5; i++)
        for(int j=0; j<5; j++)
            this->cells[i][j]->setEnabled(false);

    for(int i=0; i<this->clues_checkbox.size(); i++)
        this->clues_checkbox.at(i)->setEnabled(false);

    for(int i=0; i<4; i++) this->buttons[i]->setEnabled(false);

    QGraphicsBlurEffect *blur = new QGraphicsBlurEffect(this);
    blur->setBlurRadius(3);
    this->setGraphicsEffect(blur);

    this->notification = new NotificationWidget(msg, this);
    QObject::connect(notification, SIGNAL(closed()), this, SLOT(notification_closed()));
    this->notification->show();

    this->has_active_notification = true;
}
QPixmap *PlainDesktopBackgroundPixmap::createDefocusedPixmap(const QPixmap &pixmap, int blurRadius, qreal brightness)
{
    // Create a scene and put the pixmap on it using a blur effect
    QGraphicsScene scene;
    QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap);
    QGraphicsBlurEffect *blur = new QGraphicsBlurEffect;
    blur->setBlurRadius(blurRadius);
    item->setGraphicsEffect(blur);
    item->setOpacity(brightness);
    scene.addItem(item);

    // Create a pixmap for the defocused version of the pixmap
    QPixmap *defocusedPixmap = new QPixmap(pixmap.width(), pixmap.height());
    defocusedPixmap->fill(Qt::black);

    // Paint the scene to the pixmap
    QPainter painter(defocusedPixmap);
    scene.render(&painter);

    return defocusedPixmap;
}
Esempio n. 13
0
QImage BrushPainter::drawBrush(Brush &brush, QSize size)
{
    QImage img(size, QImage::Format_RGBA8888);

    QGraphicsColorizeEffect *effect;
    QGraphicsBlurEffect *blur;
    effect = new QGraphicsColorizeEffect();
    blur = new QGraphicsBlurEffect();

    effect->setColor(brush.color_main);
    blur->setBlurRadius(brush.blur);
    QImage drawImg = applyEffectToImage(brush.img,effect);
    int width = drawImg.scaled(brush.size, brush.size, Qt::KeepAspectRatio).width();
    if(width < 4)
        width = 4;

    QBrush qBrush;
    QPainter paint(&img);
    paint.setBrush(qBrush);
    QImage resultImg;
    QTransform transformation;
    paint.setOpacity((double)brush.opacity/100);
    int n = (size.width() - 100 ) / (width/4);
    n--;
    for(int j = 0; j <= brush.count; j++)
        for(int i = 0; i < n; i++)
        {
            int b = brush.size_delta/2 - rand() % ((int)brush.size_delta + 1);
            int m = brush.dispers/2 - rand() % ((int)brush.dispers + 1);
         //   transformation.rotate(brush.angle_delta/2 - rand() % ((int)brush.angle_delta + 1));
            resultImg = drawImg.scaled(brush.size +  b, brush.size + b, Qt::KeepAspectRatio).transformed(transformation);
            qBrush.setTextureImage(resultImg);
            paint.drawImage(i*resultImg.width()/4,size.height()/2 - resultImg.height()/2 + m,resultImg);
        }
   // paint.fillRect(0,0,200,200,QBrush(brush.color_main, Qt::SolidPattern));

    bool bEnd = paint.end();
    return applyEffectToImage(img, blur);
    }
Esempio n. 14
0
QGraphicsMapScene::QGraphicsMapScene(int id, QGraphicsView *view, QObject *parent) :
    QGraphicsScene(parent)
{
    m_init = false;
    m_view = view;
    m_view->setMouseTracking(true);
    m_undoStack = new QUndoStack(this);
    m_selectionTile = new QGraphicsRectItem(QRectF(QRect(0,32,32,32)));
    m_selecting = false;
    for (unsigned int i = 1; i < Data::treemap.maps.size(); i++)
        if (Data::treemap.maps[i].ID == id)
        {
            n_mapInfo = Data::treemap.maps[i];
            break;
        }
    m_eventMenu = new QMenu(m_view);
    QList<QAction*> actions;
    actions << new QAction(QIcon(":/icons/share/old_playtest.png"),
                           "Start Game Here",
                           this);
    actions << new QAction(QIcon(":/icons/share/old_edit.png"),
                           "Set Start Position",
                           this);
    actions << new QAction(QIcon(":/icons/share/old_event_layer.png"),
                           "New Event",
                           this);
    actions << new QAction(QIcon(":/icons/share/old_event_layer.png"),
                           "Copy Event",
                           this);
    actions << new QAction(QIcon(":/icons/share/old_event_layer.png"),
                           "Cut Event",
                           this);
    actions << new QAction(QIcon(":/icons/share/old_event_layer.png"),
                           "Paste Event",
                           this);
    actions << new QAction(QIcon(":/icons/share/old_event_layer.png"),
                           "Delete Event",
                           this);
    connect(actions[0],SIGNAL(triggered()),this,SLOT(on_actionRunHere()));
    connect(actions[1],SIGNAL(triggered()),this,SLOT(on_actionSetStartPosition()));
    connect(actions[2],SIGNAL(triggered()),this,SLOT(on_actionNewEvent()));
    connect(actions[6],SIGNAL(triggered()),this,SLOT(on_actionDeleteEvent()));

    m_eventMenu->addActions(actions);
    m_lowerpix = new QGraphicsPixmapItem();
    m_upperpix = new QGraphicsPixmapItem();
    addItem(m_lowerpix);
    addItem(m_upperpix);
    Load();
    QPen selPen(Qt::yellow);
    selPen.setWidth(2);
    m_selectionTile->setPen(selPen);
    m_selectionTile->setVisible(false);
    this->addItem(m_selectionTile);
    m_drawing = false;
    m_cancelled = false;
    m_selecting = false;
    QGraphicsBlurEffect * effect = new QGraphicsBlurEffect(this);
    effect->setBlurRadius(2.0);
    effect->setBlurHints(QGraphicsBlurEffect::PerformanceHint);
    m_lowerpix->setGraphicsEffect(effect);
    m_upperpix->setGraphicsEffect(new QGraphicsOpacityEffect(this));
    onLayerChanged();
    onToolChanged();
}
Esempio n. 15
0
void loadFromXml( mlt_producer producer, QGraphicsScene *scene, const char *templateXml, const char *templateText )
{
	scene->clear();
	mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
	QDomDocument doc;
	QString data = QString::fromUtf8(templateXml);
	QString replacementText = QString::fromUtf8(templateText);
	doc.setContent(data);
	QDomElement title = doc.documentElement();

	// Check for invalid title
	if ( title.isNull() || title.tagName() != "kdenlivetitle" ) return;
	
	// Check title locale
	if ( title.hasAttribute( "LC_NUMERIC" ) ) {
	    QString locale = title.attribute( "LC_NUMERIC" );
	    QLocale::setDefault( locale );
	}
	
        int originalWidth;
        int originalHeight;
	if ( title.hasAttribute("width") ) {
            originalWidth = title.attribute("width").toInt();
            originalHeight = title.attribute("height").toInt();
            scene->setSceneRect(0, 0, originalWidth, originalHeight);
        }
        else {
            originalWidth = scene->sceneRect().width();
            originalHeight = scene->sceneRect().height();
        }
        if ( title.hasAttribute( "out" ) ) {
            mlt_properties_set_position( producer_props, "_animation_out", title.attribute( "out" ).toDouble() );
        }
        else {
            mlt_properties_set_position( producer_props, "_animation_out", mlt_producer_get_out( producer ) );
        }
        
	mlt_properties_set_int( producer_props, "_original_width", originalWidth );
	mlt_properties_set_int( producer_props, "_original_height", originalHeight );

	QDomNode node;
	QDomNodeList items = title.elementsByTagName("item");
        for ( int i = 0; i < items.count(); i++ )
	{
		QGraphicsItem *gitem = NULL;
		node = items.item( i );
		QDomNamedNodeMap nodeAttributes = node.attributes();
		int zValue = nodeAttributes.namedItem( "z-index" ).nodeValue().toInt();
		if ( zValue > -1000 )
		{
			if ( nodeAttributes.namedItem( "type" ).nodeValue() == "QGraphicsTextItem" )
			{
				QDomNamedNodeMap txtProperties = node.namedItem( "content" ).attributes();
				QFont font( txtProperties.namedItem( "font" ).nodeValue() );
				QDomNode propsNode = txtProperties.namedItem( "font-bold" );
				if ( !propsNode.isNull() )
				{
					// Old: Bold/Not bold.
					font.setBold( propsNode.nodeValue().toInt() );
				}
				else
				{
					// New: Font weight (QFont::)
					font.setWeight( txtProperties.namedItem( "font-weight" ).nodeValue().toInt() );
				}
				font.setItalic( txtProperties.namedItem( "font-italic" ).nodeValue().toInt() );
				font.setUnderline( txtProperties.namedItem( "font-underline" ).nodeValue().toInt() );
				// Older Kdenlive version did not store pixel size but point size
				if ( txtProperties.namedItem( "font-pixel-size" ).isNull() )
				{
					QFont f2;
					f2.setPointSize( txtProperties.namedItem( "font-size" ).nodeValue().toInt() );
					font.setPixelSize( QFontInfo( f2 ).pixelSize() );
				}
				else
					font.setPixelSize( txtProperties.namedItem( "font-pixel-size" ).nodeValue().toInt() );
				QColor col( stringToColor( txtProperties.namedItem( "font-color" ).nodeValue() ) );
				QString text = node.namedItem( "content" ).firstChild().nodeValue();
				if ( !replacementText.isEmpty() )
				{
					text = text.replace( "%s", replacementText );
				}
				QGraphicsTextItem *txt = scene->addText(text, font);
				if (txtProperties.namedItem("font-outline").nodeValue().toDouble()>0.0){
					QTextDocument *doc = txt->document();
					// Make sure some that the text item does not request refresh by itself
					doc->blockSignals(true);
					QTextCursor cursor(doc);
					cursor.select(QTextCursor::Document);
					QTextCharFormat format;
					format.setTextOutline(
							QPen(QColor( stringToColor( txtProperties.namedItem( "font-outline-color" ).nodeValue() ) ),
							txtProperties.namedItem("font-outline").nodeValue().toDouble(),
							Qt::SolidLine,Qt::RoundCap,Qt::RoundJoin)
					);
					format.setForeground(QBrush(col));

					cursor.mergeCharFormat(format);
				} else {
					txt->setDefaultTextColor( col );
				}
				
				// Effects
				if (!txtProperties.namedItem( "typewriter" ).isNull()) {
					// typewriter effect
					mlt_properties_set_int( producer_props, "_animated", 1 );
					QStringList effetData = QStringList() << "typewriter" << text << txtProperties.namedItem( "typewriter" ).nodeValue();
					txt->setData(0, effetData);
					if ( !txtProperties.namedItem( "textwidth" ).isNull() )
						txt->setData( 1, txtProperties.namedItem( "textwidth" ).nodeValue() );
				}
				
				if ( txtProperties.namedItem( "alignment" ).isNull() == false )
				{
					txt->setTextWidth( txt->boundingRect().width() );
					QTextOption opt = txt->document()->defaultTextOption ();
					opt.setAlignment(( Qt::Alignment ) txtProperties.namedItem( "alignment" ).nodeValue().toInt() );
					txt->document()->setDefaultTextOption (opt);
				}
					if ( !txtProperties.namedItem( "kdenlive-axis-x-inverted" ).isNull() )
				{
					//txt->setData(OriginXLeft, txtProperties.namedItem("kdenlive-axis-x-inverted").nodeValue().toInt());
				}
				if ( !txtProperties.namedItem( "kdenlive-axis-y-inverted" ).isNull() )
				{
					//txt->setData(OriginYTop, txtProperties.namedItem("kdenlive-axis-y-inverted").nodeValue().toInt());
				}
					gitem = txt;
			}
			else if ( nodeAttributes.namedItem( "type" ).nodeValue() == "QGraphicsRectItem" )
			{
				QString rect = node.namedItem( "content" ).attributes().namedItem( "rect" ).nodeValue();
				QString br_str = node.namedItem( "content" ).attributes().namedItem( "brushcolor" ).nodeValue();
				QString pen_str = node.namedItem( "content" ).attributes().namedItem( "pencolor" ).nodeValue();
				double penwidth = node.namedItem( "content" ).attributes().namedItem( "penwidth") .nodeValue().toDouble();
				QGraphicsRectItem *rec = scene->addRect( stringToRect( rect ), QPen( QBrush( stringToColor( pen_str ) ), penwidth, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin ), QBrush( stringToColor( br_str ) ) );
				gitem = rec;
			}
			else if ( nodeAttributes.namedItem( "type" ).nodeValue() == "QGraphicsPixmapItem" )
			{
				const QString url = node.namedItem( "content" ).attributes().namedItem( "url" ).nodeValue();
				const QString base64 = items.item(i).namedItem("content").attributes().namedItem("base64").nodeValue();
				QImage img;
				if (base64.isEmpty()){
					img.load(url);
				}else{
					img.loadFromData(QByteArray::fromBase64(base64.toAscii()));
				}
				ImageItem *rec = new ImageItem(img);
				scene->addItem( rec );
				gitem = rec;
			}
			else if ( nodeAttributes.namedItem( "type" ).nodeValue() == "QGraphicsSvgItem" )
			{
				QString url = items.item(i).namedItem("content").attributes().namedItem("url").nodeValue();
				QString base64 = items.item(i).namedItem("content").attributes().namedItem("base64").nodeValue();
				QGraphicsSvgItem *rec = NULL;
				if (base64.isEmpty()){
					rec = new QGraphicsSvgItem(url);
				}else{
					rec = new QGraphicsSvgItem();
					QSvgRenderer *renderer= new QSvgRenderer(QByteArray::fromBase64(base64.toAscii()), rec );
					rec->setSharedRenderer(renderer);
				}
				if (rec){
					scene->addItem(rec);
					gitem = rec;
				}
			}
		}
		//pos and transform
		if ( gitem )
		{
			QPointF p( node.namedItem( "position" ).attributes().namedItem( "x" ).nodeValue().toDouble(),
			           node.namedItem( "position" ).attributes().namedItem( "y" ).nodeValue().toDouble() );
			gitem->setPos( p );
			gitem->setTransform( stringToTransform( node.namedItem( "position" ).firstChild().firstChild().nodeValue() ) );
			int zValue = nodeAttributes.namedItem( "z-index" ).nodeValue().toInt();
			gitem->setZValue( zValue );

#if QT_VERSION >= 0x040600
			// effects
			QDomNode eff = items.item(i).namedItem("effect");
			if (!eff.isNull()) {
				QDomElement e = eff.toElement();
				if (e.attribute("type") == "blur") {
					QGraphicsBlurEffect *blur = new QGraphicsBlurEffect();
					blur->setBlurRadius(e.attribute("blurradius").toInt());
					gitem->setGraphicsEffect(blur);
				}
				else if (e.attribute("type") == "shadow") {
					QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();
					shadow->setBlurRadius(e.attribute("blurradius").toInt());
					shadow->setOffset(e.attribute("xoffset").toInt(), e.attribute("yoffset").toInt());
					gitem->setGraphicsEffect(shadow);
				}
			}
#endif
		}
	}

	QDomNode n = title.firstChildElement("background");
	if (!n.isNull()) {
		QColor color = QColor( stringToColor( n.attributes().namedItem( "color" ).nodeValue() ) );
                if (color.alpha() > 0) {
                        QGraphicsRectItem *rec = scene->addRect(0, 0, scene->width(), scene->height() , QPen( Qt::NoPen ), QBrush( color ) );
                        rec->setZValue(-1100);
                }
	  
	}

	QString startRect;
	n = title.firstChildElement( "startviewport" );
        // Check if node exists, if it has an x attribute, it is an old version title, don't use viewport
	if (!n.isNull() && !n.toElement().hasAttribute("x"))
	{
		startRect = n.attributes().namedItem( "rect" ).nodeValue();
	}
	n = title.firstChildElement( "endviewport" );
        // Check if node exists, if it has an x attribute, it is an old version title, don't use viewport
	if (!n.isNull() && !n.toElement().hasAttribute("x"))
	{
		QString rect = n.attributes().namedItem( "rect" ).nodeValue();
		if (startRect != rect)
			mlt_properties_set( producer_props, "_endrect", rect.toUtf8().data() );
	}
	if (!startRect.isEmpty()) {
	  	mlt_properties_set( producer_props, "_startrect", startRect.toUtf8().data() );
	}
	return;
}