]> git.sesse.net Git - mlt/commitdiff
Use QImage instead of QPixmap, add myself in copyright
authorj-b-m <jb@kdenlive.org>
Fri, 31 Jul 2009 17:08:33 +0000 (19:08 +0200)
committerj-b-m <jb@kdenlive.org>
Fri, 31 Jul 2009 17:08:33 +0000 (19:08 +0200)
modified:   kdenlivetitle_wrapper.cpp
modified:   kdenlivetitle_wrapper.h
modified:   producer_kdenlivetitle.c

src/modules/qimage/kdenlivetitle_wrapper.cpp
src/modules/qimage/kdenlivetitle_wrapper.h
src/modules/qimage/producer_kdenlivetitle.c

index 1e7589d169b07c544592432841de81a4df34790c..9ffa9599e1f5d62c5bc3f93957db040f20e6015f 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * kdenlivetitle_wrapper.cpp -- kdenlivetitle wrapper
  * Copyright (c) 2009 Marco Gittler <g.marco@freenet.de>
+ * Copyright (c) 2009 Jean-Baptiste Mardelle <jb@kdenlive.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,6 +28,7 @@
 #include <QtGui/QGraphicsScene>
 #include <QtGui/QGraphicsTextItem>
 #include <QtGui/QTextCursor>
+#include <QtGui/QStyleOptionGraphicsItem>
 
 static QApplication *app = NULL;
 
@@ -51,6 +53,29 @@ extern "C"
 }
 
 
+class ImageItem: public QGraphicsRectItem
+{
+public:
+    ImageItem(QImage img)
+    {
+       m_img = img;
+    }
+    
+    QImage m_img;
+
+protected:
+virtual void paint( QPainter *painter,
+                       const QStyleOptionGraphicsItem *option,
+                       QWidget* )
+{
+   //todo: clip rect ?
+   painter->drawImage(QPointF(), m_img);
+   //painter->fillRect(option->exposedRect, QBrush(QColor(0,255,0)));
+}
+    
+    
+};
+
 
 void drawKdenliveTitle( mlt_producer producer, uint8_t * buffer, int width, int height, double position, int force_refresh )
 {
@@ -135,7 +160,11 @@ void loadFromXml( mlt_producer producer, QGraphicsScene *scene, const char *temp
            int originalWidth = doc.documentElement().attribute("width").toInt();
            int originalHeight = doc.documentElement().attribute("height").toInt();
            if (originalWidth != width || originalHeight != height) {
+#if QT_VERSION < 0x40500
+                   transform = QTransform().scale(  (double) width / originalWidth, (double) height / originalHeight );
+#else
                    transform = QTransform::fromScale ( (double) width / originalWidth, (double) height / originalHeight);
+#endif
            }
        }
        if ( titles.size() )
@@ -224,8 +253,9 @@ void loadFromXml( mlt_producer producer, QGraphicsScene *scene, const char *temp
                                else if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsPixmapItem" )
                                {
                                        QString url = items.item( i ).namedItem( "content" ).attributes().namedItem( "url" ).nodeValue();
-                                       QPixmap pix( url );
-                                       QGraphicsPixmapItem *rec = scene->addPixmap( pix );
+                                       QImage img( url );
+                                       ImageItem *rec = new ImageItem(img);
+                                       scene->addItem( rec );
                                        rec->setData( Qt::UserRole, url );
                                        gitem = rec;
                                }
index 4363b59a2ae08336ed9f12eae5d8214f5749d855..81fad1118af14ab9247aa931c0e4b3fcbb0f9cf5 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * kdenlivetitle_wrapper.h -- kdenlivetitle wrapper
  * Copyright (c) 2009 Marco Gittler <g.marco@freenet.de>
+ * Copyright (c) 2009 Jean-Baptiste Mardelle <jb@kdenlive.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
index f1db7e70e7a70b91587b1d01ea60341816bf3886..e9d2662a19e55600c752e46c315d8d1c5dd975e1 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * producer_kdenlivetitle.c -- kdenlive producer
  * Copyright (c) 2009 Marco Gittler <g.marco@freenet.de>
+ * Copyright (c) 2009 Jean-Baptiste Mardelle <jb@kdenlive.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public