Added an experimental DrawFrameOnScene method, which takes a raw pointer (as a long) from PyQt5 (i.e. unwrapped by sip), and draws a QBitmap on it.

This commit is contained in:
Jonathan Thomas
2014-01-22 01:08:14 -06:00
parent e4d6c026b7
commit 6dd5a79177
3 changed files with 23 additions and 1 deletions

View File

@@ -35,6 +35,11 @@
#include "Fraction.h"
#include "Frame.h"
#include "Json.h"
#include <qt5/QtCore/qstring.h>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QPixmap>
using namespace std;
@@ -101,6 +106,9 @@ namespace openshot
/// @param[in] number The frame number that is requested.
virtual tr1::shared_ptr<Frame> GetFrame(int number) = 0;
/// Test method to draw a bitmap on a Qt QGraphicsScene
void DrawFrameOnScene(string path, long _graphics_scene_address);
/// Initialize the values of the ReaderInfo struct. It is important for derived classes to call
/// this method, or the ReaderInfo struct values will not be initialized.
void InitFileInfo();

View File

@@ -243,7 +243,7 @@ ENDIF (BLACKMAGIC_FOUND)
FIND_PACKAGE(SWIG 2.0 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
FIND_PACKAGE(PythonLibs)
FIND_PACKAGE(PythonLibs REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
@@ -261,6 +261,7 @@ INSTALL(TARGETS openshot DESTINATION lib)
# Install Swig python library
INSTALL(TARGETS _openshot DESTINATION share/pyshared/libopenshot)
INSTALL(TARGETS openshot DESTINATION share/pyshared/libopenshot)
# Install Python bindings
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/openshot.py DESTINATION share/pyshared/libopenshot)

View File

@@ -204,3 +204,16 @@ void ReaderBase::SetJsonValue(Json::Value root) {
info.audio_timebase.den = root["audio_timebase"]["den"].asInt();
}
}
// Test method to draw a bitmap on a Qt QGraphicsScene
void ReaderBase::DrawFrameOnScene(string path, long _graphics_scene_address) {
// Get pixmap
QGraphicsScene *scene = reinterpret_cast<QGraphicsScene*>(_graphics_scene_address);
QGraphicsPixmapItem *item = new QGraphicsPixmapItem(QPixmap(QString(path.c_str())));
scene->addItem(item);
}