void SmilExportPlugin::exportToFormat(const QString &filePath, const QList<KTScene *> &scenes, Format format, const QSize &size,float sx, float sy) { m_size = size; QFileInfo fileInfo(filePath); QDir dir = fileInfo.dir(); if ( !dir.exists() ) { dir.mkdir(dir.path()); } m_baseName = fileInfo.baseName(); dir.mkdir("data"); initSmil(); createImages(scenes, dir, sx, sy); m_smil.documentElement().appendChild(m_body); QFile save(filePath); if ( save.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream out(&save); out << m_smil.toString(); } }
// ------------------------------------------------------------------------------- bool HTMLWriter::writeCollectionToHTMLFile( CInformationCollection& collection, const QString& dirPath ) // ------------------------------------------------------------------------------- { QDir dir = QDir( dirPath ); bool bSuccess = createSubDir( dir ); if ( !bSuccess ) return FALSE; bSuccess = createImages( dir ); if ( !bSuccess ) return FALSE; static_List.clear(); // TODO: Check if files could be opened, also. If not -> return 'FALSE'. createTopFrame( dir ); CInformationElement* pRootElem = collection.getRootElement(); if ( NULLPTR != pRootElem ) { createIndexFile( dir, pRootElem->getDescription() ); createTreeFrame( collection, dir ); } static_List.clear(); return TRUE; }
void ofxGuiGrid::init( int id, string name, int x, int y, int width, int height, int xGrid, int yGrid, int border, int spacing, int mode ) { int textHeight = (name == "") ? 0 : mGlobals->mParamFontHeight; mParamId = id; mParamName = name; mObjX = x; mObjY = y; mObjWidth = width; mObjHeight = textHeight + height; mXGrid = xGrid; mYGrid = yGrid; mBorder = border; mSpacing = spacing; mDisplayMode = mode; calculateWH(); setControlRegion( 0, textHeight, width, height ); clearSelectedColor(); createImages(); }
void ofxGuiGrid::setXY( int x, int y ) { //! Just display mode can be set X/Y if ( mDisplayMode == kofxGui_Grid_Display ) { clearImages(); mXGrid = x; mYGrid = y; calculateWH(); setSelectedId( -1 ); // Clear the selected value createImages(); removeControls(); switchDblClickMode( false ); } }
void FFMpegPlugin::exportToFormat(const QString &filePath, const QList<KTScene *> &scenes, Format format, const QSize &size, float sx, float sy) { #ifdef HAVE_FFMPEG FFMpegManager manager; m_size = size; QDir temp(REPOSITORY+"/exporting"); if ( !temp.exists() ) { temp.mkdir(temp.path()); } QStringList paths = createImages(scenes, temp, sx, sy); manager.create(filePath, format, paths, m_size,scenes[0]->fps()); foreach(QString path, paths) { QFile::remove(path); }
void QgsColorWheel::resizeEvent( QResizeEvent *event ) { //recreate images for new size createImages( event->size() ); QgsColorWidget::resizeEvent( event ); }
void QgsColorWheel::paintEvent( QPaintEvent *event ) { Q_UNUSED( event ); QPainter painter( this ); //draw a frame QStyleOptionFrameV3 option = QStyleOptionFrameV3(); option.initFrom( this ); option.state = this->hasFocus() ? QStyle::State_Active : QStyle::State_None; style()->drawPrimitive( QStyle::PE_Frame, &option, &painter ); if ( !mWidgetImage || !mWheelImage || !mTriangleImage ) { createImages( size() ); } //draw everything in an image mWidgetImage->fill( Qt::transparent ); QPainter imagePainter( mWidgetImage ); imagePainter.setRenderHint( QPainter::Antialiasing ); if ( mWheelDirty ) { //need to redraw the wheel image createWheel(); } //draw wheel centered on widget QPointF center = QPointF( width() / 2.0, height() / 2.0 ); imagePainter.drawImage( QPointF( center.x() - ( mWheelImage->width() / 2.0 ), center.y() - ( mWheelImage->height() / 2.0 ) ), *mWheelImage ); //draw hue marker int h = hue(); double length = mWheelImage->width() / 2.0; QLineF hueMarkerLine = QLineF( center.x(), center.y(), center.x() + length, center.y() ); hueMarkerLine.setAngle( h ); imagePainter.save(); //use sourceIn mode for nicer antialiasing imagePainter.setCompositionMode( QPainter::CompositionMode_SourceIn ); QPen pen; pen.setWidth( 2 ); //adapt pen color for hue pen.setColor( h > 20 && h < 200 ? Qt::black : Qt::white ); imagePainter.setPen( pen ); imagePainter.drawLine( hueMarkerLine ); imagePainter.restore(); //draw triangle if ( mTriangleDirty ) { createTriangle(); } imagePainter.drawImage( QPointF( center.x() - ( mWheelImage->width() / 2.0 ), center.y() - ( mWheelImage->height() / 2.0 ) ), *mTriangleImage ); //draw current color marker double triangleRadius = length - mWheelThickness - 1; //adapted from equations at https://github.com/timjb/colortriangle/blob/master/colortriangle.js by Tim Baumann double lightness = mCurrentColor.lightnessF(); double hueRadians = ( h * M_PI / 180.0 ); double hx = cos( hueRadians ) * triangleRadius; double hy = -sin( hueRadians ) * triangleRadius; double sx = -cos( -hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double sy = -sin( -hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double vx = -cos( hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double vy = sin( hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double mx = ( sx + vx ) / 2.0; double my = ( sy + vy ) / 2.0; double a = ( 1 - 2.0 * fabs( lightness - 0.5 ) ) * mCurrentColor.hslSaturationF(); double x = sx + ( vx - sx ) * lightness + ( hx - mx ) * a; double y = sy + ( vy - sy ) * lightness + ( hy - my ) * a; //adapt pen color for lightness pen.setColor( lightness > 0.7 ? Qt::black : Qt::white ); imagePainter.setPen( pen ); imagePainter.setBrush( Qt::NoBrush ); imagePainter.drawEllipse( QPointF( x + center.x(), y + center.y() ), 4.0, 4.0 ); imagePainter.end(); //draw image onto widget painter.drawImage( QPoint( 0, 0 ), *mWidgetImage ); painter.end(); }
Image::Image(RabsgPlayer* player, uint typeId) { QColor playersColor = Utils::toQColor(player->getColorCode()); createImages(typeId, playersColor); }