• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VectorImage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VectorImage的典型用法代码示例。如果您正苦于以下问题:C++ VectorImage类的具体用法?C++ VectorImage怎么用?C++ VectorImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VectorImage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: storeClosestVectorCurve

/**
 * @brief MoveTool::storeClosestVectorCurve
 * stores the curves closest to the mouse position in mClosestCurves
 */
void MoveTool::storeClosestVectorCurve(Layer* layer)
{
    auto layerVector = static_cast<LayerVector*>(layer);
    VectorImage* pVecImg = layerVector->getLastVectorImageAtFrame(mEditor->currentFrame(), 0);
    mScribbleArea->mClosestCurves = pVecImg->getCurvesCloseTo(getCurrentPoint(),
                                                              mScribbleArea->mSelectionTolerance / mEditor->view()->scaling());
}
开发者ID:chchwy,项目名称:pencil2d,代码行数:11,代码来源:movetool.cpp


示例2: Q_ASSERT

bool Editor::importVectorImage(QString filePath)
{
    Q_ASSERT(layers()->currentLayer()->type() == Layer::VECTOR);

    auto layer = static_cast<LayerVector*>(layers()->currentLayer());

    VectorImage* vectorImage = (static_cast<LayerVector*>(layer))->getVectorImageAtFrame(currentFrame());
    if (vectorImage == nullptr)
    {
        addNewKey();
        vectorImage = (static_cast<LayerVector*>(layer))->getVectorImageAtFrame(currentFrame());
    }

    VectorImage importedVectorImage;
    bool ok = importedVectorImage.read(filePath);
    if (ok)
    {
        importedVectorImage.selectAll();
        vectorImage->paste(importedVectorImage);

        backup(tr("Import Image"));
    }

    return ok;
}
开发者ID:scribblemaniac,项目名称:pencil,代码行数:25,代码来源:editor.cpp


示例3: Q_ASSERT

bool Editor::importVectorImage( QString filePath )
{
    Q_ASSERT( layers()->currentLayer()->type() == Layer::VECTOR );

    backup( tr( "ImportImg" ) );

    auto layer = static_cast<LayerVector*>( layers()->currentLayer() );

    VectorImage* vectorImage = ( ( LayerVector* )layer )->getVectorImageAtFrame( currentFrame() );
    if ( vectorImage == NULL )
    {
        addNewKey();
        vectorImage = ( ( LayerVector* )layer )->getVectorImageAtFrame( currentFrame() );
    }
    VectorImage* importedVectorImage = new VectorImage;
    bool ok = importedVectorImage->read( filePath );
    if ( ok )
    {
        importedVectorImage->selectAll();
        vectorImage->paste( *importedVectorImage );
    }
    /*
    else
    {
        QMessageBox::warning( mMainWindow,
                              tr( "Warning" ),
                              tr( "Unable to load vector image.<br><b>TIP:</b> Use Vector layer to import vectors." ),
                              QMessageBox::Ok,
                              QMessageBox::Ok );
    }
    */
    return ok;
}
开发者ID:qbdp,项目名称:pencil,代码行数:33,代码来源:editor.cpp


示例4: mouseReleaseEvent

void SelectTool::mouseReleaseEvent( QMouseEvent *event )
{
    Layer *layer = mEditor->layers()->currentLayer();
    if ( layer == NULL ) { return; }

    if ( event->button() == Qt::LeftButton )
    {
        if ( layer->type() == Layer::VECTOR )
        {
            if ( mScribbleArea->somethingSelected )
            {
                mEditor->tools()->setCurrentTool( MOVE );

                VectorImage *vectorImage = ( ( LayerVector * )layer )->getLastVectorImageAtFrame( mEditor->currentFrame(), 0 );
                mScribbleArea->setSelection( vectorImage->getSelectionRect(), true );
                if ( mScribbleArea->mySelection.size() == QSizeF( 0, 0 ) )
                {
                    mScribbleArea->somethingSelected = false;
                }
            }
            mScribbleArea->updateCurrentFrame();
            mScribbleArea->setAllDirty();
        }
        else if ( layer->type() == Layer::BITMAP )
        {
            mScribbleArea->updateCurrentFrame();
            mScribbleArea->setAllDirty();
        }
    }
}
开发者ID:CandyFace,项目名称:pencil,代码行数:30,代码来源:selecttool.cpp


示例5: getLastPoint

void EyedropperTool::mouseReleaseEvent(QMouseEvent *event)
{
    Layer* layer = mEditor->layers()->currentLayer();
    if (layer == NULL) { return; }

    if (event->button() == Qt::LeftButton)
    {
        if (layer->type() == Layer::BITMAP)
        {
            BitmapImage* targetImage = ((LayerBitmap *)layer)->getLastBitmapImageAtFrame( mEditor->currentFrame(), 0);
            //QColor pickedColour = targetImage->pixel(getLastPoint().x(), getLastPoint().y());
            QColor pickedColour;
            pickedColour.setRgba( targetImage->pixel( getLastPoint().x(), getLastPoint().y() ) );
            int transp = 255 - pickedColour.alpha();
            pickedColour.setRed( pickedColour.red() + transp );
            pickedColour.setGreen( pickedColour.green() + transp );
            pickedColour.setBlue( pickedColour.blue() + transp );
            if (pickedColour.alpha() != 0)
            {
                mEditor->color()->setColor(pickedColour);
            }
        }
        else if (layer->type() == Layer::VECTOR)
        {
            VectorImage *vectorImage = ((LayerVector *)layer)->getLastVectorImageAtFrame(mEditor->currentFrame(), 0);
            int colourNumber = vectorImage->getColourNumber(getLastPoint());
            if (colourNumber != -1)
            {
                mEditor->color()->setColorNumber(colourNumber);
            }
        }
    }
}
开发者ID:GraphiXS6,项目名称:pencil,代码行数:33,代码来源:eyedroppertool.cpp


示例6: layers

void Editor::duplicateKey()
{
    Layer* layer = mObject->getLayer( layers()->currentLayerIndex() );
    if ( layer != NULL )
    {
        if ( layer->type() == Layer::VECTOR )
        {
            mScribbleArea->selectAll();
            clipboardVectorOk = true;
            g_clipboardVectorImage = *( ( ( LayerVector* )layer )->getLastVectorImageAtFrame( currentFrame(), 0 ) );  // copy the image (that works but I should also provide a copy() method)
            addNewKey();
            VectorImage* vectorImage = ( ( LayerVector* )layer )->getLastVectorImageAtFrame( currentFrame(), 0 );
            vectorImage->paste( g_clipboardVectorImage ); // paste the clipboard
            mScribbleArea->setModified( layers()->currentLayerIndex(), currentFrame() );
            mScribbleArea->update();
        }
        if ( layer->type() == Layer::BITMAP )
        {
            mScribbleArea->selectAll();
            copy();
            addNewKey();
            paste();
        }
    }
}
开发者ID:qbdp,项目名称:pencil,代码行数:25,代码来源:editor.cpp


示例7: drawStroke

void SmudgeTool::mouseReleaseEvent(QMouseEvent *event)
{
    Layer *layer = m_pEditor->getCurrentLayer();
    if (layer == NULL) {
        return;
    }

    if (event->button() == Qt::LeftButton)
    {
        if (layer->type == Layer::BITMAP)
        {
            drawStroke();
            m_pScribbleArea->paintBitmapBuffer();
            m_pScribbleArea->setAllDirty();
            endStroke();
        }
        else if (layer->type == Layer::VECTOR)
        {
            VectorImage *vectorImage = ((LayerVector *)layer)->getLastVectorImageAtFrame(m_pEditor->m_nCurrentFrameIndex, 0);
            vectorImage->applySelectionTransformation();
            m_pScribbleArea->selectionTransformation.reset();
            for (int k = 0; k < m_pScribbleArea->vectorSelection.curve.size(); k++)
            {
                int curveNumber = m_pScribbleArea->vectorSelection.curve.at(k);
                vectorImage->curve[curveNumber].smoothCurve();
            }
            m_pScribbleArea->setModified(m_pEditor->m_nCurrentLayerIndex, m_pEditor->m_nCurrentFrameIndex);
        }
    }
}
开发者ID:shoshon,项目名称:pencil-1,代码行数:30,代码来源:smudgetool.cpp


示例8: drawStroke

void EraserTool::mouseReleaseEvent(QMouseEvent *event)
{
    Layer *layer = m_pEditor->getCurrentLayer();

    if (event->button() == Qt::LeftButton)
    {
        if (m_pScribbleArea->isLayerPaintable())
        {
            drawStroke();
        }

        if (layer->type == Layer::BITMAP)
        {
            m_pScribbleArea->paintBitmapBuffer();
            m_pScribbleArea->setAllDirty();
        }
        else if (layer->type == Layer::VECTOR)
        {
            VectorImage *vectorImage = ((LayerVector *)layer)->getLastVectorImageAtFrame(m_pEditor->m_nCurrentFrameIndex, 0);
            // Clear the area containing the last point
            //vectorImage->removeArea(lastPoint);
            // Clear the temporary pixel path
            m_pScribbleArea->clearBitmapBuffer();
            vectorImage->deleteSelectedPoints();
            //update();
            m_pScribbleArea->setModified(m_pEditor->m_nCurrentLayerIndex, m_pEditor->m_nCurrentFrameIndex);
            m_pScribbleArea->setAllDirty();
        }
    }

    endStroke();
}
开发者ID:sarathms,项目名称:pencil,代码行数:32,代码来源:erasertool.cpp


示例9: getVectorImageAtIndex

QImage* LayerVector::getImageAtIndex( int index,
                                      QSize size,
                                      bool simplified,
                                      bool showThinLines,
                                      qreal curveOpacity,
                                      bool antialiasing)
{
    if ( index < 0 || index >= framesImage.size() )
    {
        return NULL;
    }
    else
    {
        VectorImage* vectorImage = getVectorImageAtIndex(index);
        QImage* image = framesImage.at(index);
        if (vectorImage->isModified() || size != image->size() )
        {
            if ( image->size() != size)
            {
                delete image;
                framesImage[index] = image = new QImage(size, QImage::Format_ARGB32_Premultiplied);
            }
            vectorImage->outputImage(image, size, myView,
                                     simplified, showThinLines,
                                     curveOpacity, antialiasing );
            vectorImage->setModified(false);
        }
        return image;
    }
}
开发者ID:pietrondo,项目名称:pencil,代码行数:30,代码来源:layervector.cpp


示例10: saveKeyFrame

bool LayerVector::saveKeyFrame( KeyFrame* pKeyFrame, QString path )
{
    VectorImage* pVecImage = static_cast< VectorImage* >( pKeyFrame );

    QString theFileName = fileName( pKeyFrame->pos() );
    QString strFilePath = QDir( path ).filePath( theFileName );
    pVecImage->write( strFilePath, "VEC" );

    return true;
}
开发者ID:CandyFace,项目名称:pencil,代码行数:10,代码来源:layervector.cpp


示例11: newBitmapLayer

void Editor::paste()
{
    if((cutFlag||copyFlag)&&layers()->currentLayerIndex()>2)
    {
        newBitmapLayer();
    }
    Layer* layer = mObject->getLayer( layers()->currentLayerIndex() );
    if ( layer != NULL )
    {
        if ( layer->type() == Layer::BITMAP && g_clipboardBitmapImage.image() != NULL )
        {
            backup( tr( "Paste" ) );
            BitmapImage tobePasted = g_clipboardBitmapImage.copy();
            qDebug() << "to be pasted --->" << tobePasted.image()->size();
            if ( mScribbleArea->somethingSelected )
            {
                QRectF selection = mScribbleArea->getSelection();
                if ( g_clipboardBitmapImage.width() <= selection.width() && g_clipboardBitmapImage.height() <= selection.height() )
                {
                    tobePasted.moveTopLeft( selection.topLeft() );
                }
                else
                {
                    tobePasted.transform( selection, true );
                }
            }
            auto pLayerBitmap = static_cast< LayerBitmap* >( layer );
            pLayerBitmap->getLastBitmapImageAtFrame( currentFrame(), 0 )->paste( &tobePasted ); // paste the clipboard
        }
        else if ( layer->type() == Layer::VECTOR && clipboardVectorOk )
        {
            backup( tr( "Paste" ) );
            mScribbleArea->deselectAll();
            VectorImage* vectorImage = ( ( LayerVector* )layer )->getLastVectorImageAtFrame( currentFrame(), 0 );
            vectorImage->paste( g_clipboardVectorImage );  // paste the clipboard
            mScribbleArea->setSelection( vectorImage->getSelectionRect(), true );
            //((LayerVector*)layer)->getLastVectorImageAtFrame(backupFrame, 0)->modification(); ????
        }
    }
    mScribbleArea->updateCurrentFrame();
    if((cutFlag&&!mScribbleArea->somethingSelected)||(copyFlag&&mScribbleArea->somethingSelected))
    {
        mScribbleArea->mySelection=cutArea;
        mScribbleArea->setSelection( mScribbleArea->mySelection, true );
        mScribbleArea->myTransformedSelection = mScribbleArea->mySelection.adjusted( 0, 0, 0, 0 );
        mScribbleArea->myTempTransformedSelection = mScribbleArea->mySelection.adjusted( 0, 0, 0, 0 );
        mScribbleArea->update();
        mScribbleArea->mIncludeImg[mLayerManager->currentLayerIndex()]=mScribbleArea->mySelection;
        tools()->setCurrentTool(MOVE);
    }
    cutFlag =0;
    copyFlag =0;
}
开发者ID:zhangxiang2014,项目名称:cartoon-without-paper,代码行数:53,代码来源:editor.cpp


示例12: removeKeyFrame

void LayerVector::loadImageAtFrame(QString path, int frameNumber)
{
    if ( keyExists( frameNumber ) )
    {
        removeKeyFrame( frameNumber, false );
    }
    VectorImage* vecImg = new VectorImage;
    vecImg->setPos( frameNumber );
    vecImg->setObject( object() );
    vecImg->read( path );
    addKeyFrame( frameNumber, vecImg );
}
开发者ID:CandyFace,项目名称:pencil,代码行数:12,代码来源:layervector.cpp


示例13: getLastPoint

void BucketTool::mouseReleaseEvent(QMouseEvent *event)
{
    Layer *layer = m_pEditor->getCurrentLayer();
    if (layer == NULL) { return; }

    if (event->button() == Qt::LeftButton)
    {
        if (layer->type == Layer::BITMAP)
        {
            BitmapImage *sourceImage = ((LayerBitmap *)layer)->getLastBitmapImageAtFrame(m_pEditor->m_nCurrentFrameIndex, 0);
            Layer *targetLayer = layer; // by default
            int layerNumber = m_pEditor->m_nCurrentLayerIndex; // by default
            if (m_pEditor->m_nCurrentLayerIndex > 0)
            {
                Layer *layer2 = m_pEditor->getCurrentLayer(-1);
                if (layer2->type == Layer::BITMAP)
                {
                    targetLayer = layer2;
                    layerNumber = layerNumber - 1;
                }
            }
            BitmapImage *targetImage = ((LayerBitmap *)targetLayer)->getLastBitmapImageAtFrame(m_pEditor->m_nCurrentFrameIndex, 0);

            BitmapImage::floodFill(sourceImage,
                                   targetImage,
                                   getLastPoint().toPoint(),
                                   qRgba(0, 0, 0, 0),
                                   m_pEditor->colorManager()->frontColor().rgba(),
                                   10 * 10,
                                   true);

            m_pScribbleArea->setModified(layerNumber, m_pEditor->m_nCurrentFrameIndex);
            m_pScribbleArea->setAllDirty();
        }
        else if (layer->type == Layer::VECTOR)
        {
            VectorImage *vectorImage = ((LayerVector *)layer)->getLastVectorImageAtFrame(m_pEditor->m_nCurrentFrameIndex, 0);

            if (event->modifiers() == Qt::AltModifier)
            {
                vectorImage->removeArea(getLastPoint());
            }
            else
            {
                m_pScribbleArea->floodFill(vectorImage, getLastPixel().toPoint(), qRgba(0, 0, 0, 0), qRgb(200, 200, 200), 100 * 100);
            }
            m_pScribbleArea->setModified(m_pEditor->m_nCurrentLayerIndex, m_pEditor->m_nCurrentFrameIndex);
            m_pScribbleArea->setAllDirty();
        }
    }

}
开发者ID:andrewroldugin,项目名称:art,代码行数:52,代码来源:buckettool.cpp


示例14: startStroke

void SmudgeTool::mousePressEvent(QMouseEvent *event)
{
    //qDebug() << "smudgetool: mousePressEvent";

    Layer *layer = m_pEditor->getCurrentLayer();
    if (layer == NULL) {
        return;
    }

    if (event->button() == Qt::LeftButton)
    {
        if (layer->type == Layer::BITMAP)
        {
            m_pEditor->backup(typeName());
            m_pScribbleArea->setAllDirty();
            startStroke();
            lastBrushPoint = getCurrentPoint();
        }
        else if (layer->type == Layer::VECTOR)
        {
            m_pScribbleArea->closestCurves = ((LayerVector *)layer)->getLastVectorImageAtFrame(m_pEditor->m_nCurrentFrameIndex, 0)
                                             ->getCurvesCloseTo(getCurrentPoint(), m_pScribbleArea->tol / m_pScribbleArea->getTempViewScaleX());
            m_pScribbleArea->closestVertices = ((LayerVector *)layer)->getLastVectorImageAtFrame(m_pEditor->m_nCurrentFrameIndex, 0)
                                               ->getVerticesCloseTo(getCurrentPoint(), m_pScribbleArea->tol / m_pScribbleArea->getTempViewScaleX());

            if (m_pScribbleArea->closestVertices.size() > 0 || m_pScribbleArea->closestCurves.size() > 0)      // the user clicks near a vertex or a curve
            {
                //qDebug() << "closestCurves:" << closestCurves << " | closestVertices" << closestVertices;
                m_pEditor->backup(typeName());
                VectorImage *vectorImage = ((LayerVector *)layer)->getLastVectorImageAtFrame(m_pEditor->m_nCurrentFrameIndex, 0);

                if (event->modifiers() != Qt::ShiftModifier && !vectorImage->isSelected(m_pScribbleArea->closestVertices))
                {
                    m_pScribbleArea->paintTransformedSelection();
                    m_pScribbleArea->deselectAll();
                }

                vectorImage->setSelected(m_pScribbleArea->closestVertices, true);
                m_pScribbleArea->vectorSelection.add(m_pScribbleArea->closestCurves);
                m_pScribbleArea->vectorSelection.add(m_pScribbleArea->closestVertices);

                m_pScribbleArea->update();
            }
            else
            {
                m_pScribbleArea->deselectAll();
            }
        }
    }
}
开发者ID:shoshon,项目名称:pencil-1,代码行数:50,代码来源:smudgetool.cpp


示例15: Q_ASSERT

bool Editor::importVectorImage( QString filePath )
{
    Q_ASSERT( layers()->currentLayer()->type() == Layer::VECTOR );

    backup( tr( "ImportImg" ) );

    auto layer = static_cast<LayerVector*>( layers()->currentLayer() );

    VectorImage* vectorImage = ( ( LayerVector* )layer )->getVectorImageAtFrame( currentFrame() );
    if ( vectorImage == NULL )
    {
        addNewKey();
        vectorImage = ( ( LayerVector* )layer )->getVectorImageAtFrame( currentFrame() );
    }
//    mScribbleArea->clearBitmapBuffer();
//    qreal tol = mScribbleArea->getCurveSmoothing() / mEditor->view()->scaling();
//    BezierCurve curve( mStrokePoints, mStrokePressures, tol );
//    curve.setWidth( properties.width );
//    curve.setFeather( properties.feather );
//    curve.setInvisibility( false );
//    curve.setVariableWidth( mScribbleArea->usePressure() );
//    curve.setColourNumber( mEditor->color()->frontColorNumber() );

//    auto pLayerVector = static_cast< LayerVector* >( layer );
//    VectorImage* vectorImage = pLayerVector->getLastVectorImageAtFrame( mEditor->currentFrame(), 0 );
//    vectorImage->addCurve( curve, mEditor->view()->scaling() );

//    mScribbleArea->setModified( mEditor->layers()->currentLayerIndex(), mEditor->currentFrame() );
//    mScribbleArea->setAllDirty();
    VectorImage* importedVectorImage = new VectorImage;
    bool ok = importedVectorImage->read( filePath );
    if ( ok )
    {
        importedVectorImage->selectAll();
        vectorImage->paste( *importedVectorImage );
    }
    /*
    else
    {
        QMessageBox::warning( mMainWindow,
                              tr( "Warning" ),
                              tr( "Unable to load vector image.<br><b>TIP:</b> Use Vector layer to import vectors." ),
                              QMessageBox::Ok,
                              QMessageBox::Ok );
    }
    */
    return ok;
}
开发者ID:zhangxiang2014,项目名称:cartoon-without-paper,代码行数:48,代码来源:editor.cpp


示例16: assert

/**
 * @brief MoveTool::createVectorSelection
 * In vector the selection rectangle is based on the bounding box of the curves
 * We can therefore create a selection just by clicking near/on a curve
 */
void MoveTool::createVectorSelection(Qt::KeyboardModifiers keyMod, Layer* layer)
{
    assert(layer->type() == Layer::VECTOR);
    LayerVector* vecLayer = static_cast<LayerVector*>(layer);
    VectorImage* vectorImage = vecLayer->getLastVectorImageAtFrame(mEditor->currentFrame(), 0);

    if (!mScribbleArea->mClosestCurves.empty()) // the user clicks near a curve
    {
        setCurveSelected(vectorImage, keyMod);
    }
    else if (vectorImage->getLastAreaNumber(getLastPoint()) > -1)
    {
        setAreaSelected(vectorImage, keyMod);
    }
    mScribbleArea->update();
}
开发者ID:chchwy,项目名称:pencil2d,代码行数:21,代码来源:movetool.cpp


示例17: Q_UNUSED

void EyedropperTool::mouseMoveEvent(QMouseEvent *event)
{
    Q_UNUSED(event);

    Layer* layer = mEditor->layers()->currentLayer();
    if (layer == NULL) { return; }

    if (layer->type() == Layer::BITMAP)
    {
        BitmapImage *targetImage = ((LayerBitmap *)layer)->getLastBitmapImageAtFrame(mEditor->currentFrame(), 0);
        if (targetImage->contains(getCurrentPoint()))
        {
            QColor pickedColour;
            //pickedColour.setRgba(targetImage->pixel(getCurrentPoint().x(), getCurrentPoint().y()));
            pickedColour.setRgba( targetImage->pixel( getCurrentPoint().x(), getCurrentPoint().y() ) );
            int transp = 255 - pickedColour.alpha();
            pickedColour.setRed( pickedColour.red() + transp );
            pickedColour.setGreen( pickedColour.green() + transp );
            pickedColour.setBlue( pickedColour.blue() + transp );
            if (pickedColour.alpha() != 0)
            {
                mScribbleArea->setCursor(cursor(pickedColour));
            }
            else
            {
                mScribbleArea->setCursor(cursor());
            }
        }
        else
        {
            mScribbleArea->setCursor(cursor());
        }
    }
    if (layer->type() == Layer::VECTOR)
    {
        VectorImage *vectorImage = ((LayerVector *)layer)->getLastVectorImageAtFrame(mEditor->currentFrame(), 0);
        int colourNumber = vectorImage->getColourNumber(getCurrentPoint());
        if (colourNumber != -1)
        {
            mScribbleArea->setCursor(cursor(mEditor->object()->getColour(colourNumber).colour));
        }
        else
        {
            mScribbleArea->setCursor(cursor());
        }
    }
}
开发者ID:GraphiXS6,项目名称:pencil,代码行数:47,代码来源:eyedroppertool.cpp


示例18: paintAt

void BrushTool::mouseReleaseEvent( QMouseEvent *event )
{
    Layer* layer = mEditor->layers()->currentLayer();

    if ( event->button() == Qt::LeftButton )
    {
        if ( mScribbleArea->isLayerPaintable() )
        {
            if (getCurrentPoint()==mMouseDownPoint)
            {
                paintAt(mMouseDownPoint);
            }
            else
            {
                drawStroke();
            }
        }

        if ( layer->type() == Layer::BITMAP )
        {
            mScribbleArea->paintBitmapBuffer();
            mScribbleArea->setAllDirty();
            mScribbleArea->clearBitmapBuffer();
        }
        else if ( layer->type() == Layer::VECTOR && mStrokePoints.size() > -1 )
        {
            // Clear the temporary pixel path
            mScribbleArea->clearBitmapBuffer();
            qreal tol = mScribbleArea->getCurveSmoothing() / mEditor->view()->scaling();
            BezierCurve curve( mStrokePoints, mStrokePressures, tol );
            curve.setWidth( properties.width );
            curve.setFeather( properties.feather );
            curve.setInvisibility( false );
            curve.setVariableWidth( properties.pressure );
            curve.setColourNumber( mEditor->color()->frontColorNumber() );

            auto pLayerVector = static_cast< LayerVector* >( layer );
            VectorImage* vectorImage = pLayerVector->getLastVectorImageAtFrame( mEditor->currentFrame(), 0 );
            vectorImage->insertCurve( 0, curve, mEditor->view()->scaling(), false );

            mScribbleArea->setModified( mEditor->layers()->currentLayerIndex(), mEditor->currentFrame() );
            mScribbleArea->setAllDirty();
        }
    }

    endStroke();
}
开发者ID:,项目名称:,代码行数:47,代码来源:


示例19: curve

void PencilTool::paintVectorStroke(Layer* layer)
{
    if (mStrokePoints.empty())
        return;

    // Clear the temporary pixel path
    mScribbleArea->clearBitmapBuffer();
    qreal tol = mScribbleArea->getCurveSmoothing() / mEditor->view()->scaling();

    BezierCurve curve(mStrokePoints, mStrokePressures, tol);
    curve.setWidth(0);
    curve.setFeather(0);
    curve.setFilled(false);
    curve.setInvisibility(true);
    curve.setVariableWidth(false);
    curve.setColourNumber(mEditor->color()->frontColorNumber());
    VectorImage* vectorImage = ((LayerVector *)layer)->getLastVectorImageAtFrame(mEditor->currentFrame(), 0);

    vectorImage->addCurve(curve, qAbs(mEditor->view()->scaling()), properties.vectorMergeEnabled);

    if (properties.useFillContour)
    {
        vectorImage->fillContour(mStrokePoints,
                                 mEditor->color()->frontColorNumber());
    }

    if (vectorImage->isAnyCurveSelected() || mScribbleArea->isSomethingSelected())
    {
        mScribbleArea->deselectAll();
    }

    // select last/newest curve
    vectorImage->setSelected(vectorImage->getLastCurveNumber(), true);

    // TODO: selection doesn't apply on enter

    mScribbleArea->setModified(mEditor->layers()->currentLayerIndex(), mEditor->currentFrame());
    mScribbleArea->setAllDirty();
}
开发者ID:chchwy,项目名称:pencil2d,代码行数:39,代码来源:penciltool.cpp


示例20: getLastPoint

void BucketTool::mouseReleaseEvent( QMouseEvent *event )
{
    Layer* layer = mEditor->layers()->currentLayer();
    if ( layer == NULL ) { return; }

    if ( event->button() == Qt::LeftButton )
    {
        if ( layer->type() == Layer::BITMAP )
        {
            BitmapImage *sourceImage = ( ( LayerBitmap * )layer )->getLastBitmapImageAtFrame( mEditor->currentFrame(), 0 );
            Layer *targetLayer = layer; // by default
            int layerNumber = mEditor->layers()->currentLayerIndex(); // by default
            if ( mEditor->layers()->currentLayerIndex() > 0 )
            {
                Layer *layer2 = mEditor->layers()->currentLayer( -1 );
                if ( layer2->type() == Layer::BITMAP )
                {
                    targetLayer = layer2;
                    layerNumber = layerNumber - 1;
                }
            }
            BitmapImage *targetImage = ( ( LayerBitmap * )targetLayer )->getLastBitmapImageAtFrame( mEditor->currentFrame(), 0 );

            BitmapImage::floodFill( sourceImage,
                                    targetImage,
                                    getLastPoint().toPoint(),
                                    qRgba( 0, 0, 0, 0 ),
                                    mEditor->color()->frontColor().rgba(),
                                    10 * 10,
                                    true );

            mScribbleArea->setModified( layerNumber, mEditor->currentFrame() );
            mScribbleArea->setAllDirty();
        }
        else if ( layer->type() == Layer::VECTOR )
        {
            mScribbleArea->clearBitmapBuffer();
            VectorImage *vectorImage = ( ( LayerVector * )layer )->getLastVectorImageAtFrame( mEditor->currentFrame(), 0 );

            if ( event->modifiers() == Qt::AltModifier )
            {
                vectorImage->removeArea( getLastPoint() );
            }
            else
            {
                QList<QPointF> path = mStrokePoints;
                if (path.size() < 10) {
                    vectorImage->fill( getLastPoint(),
                                       mEditor->color()->frontColorNumber(),
                                       3.0 / mEditor->view()->scaling() );
                }
                else {
                    vectorImage->fill( path,
                                       mEditor->color()->frontColorNumber(),
                                       10.0 / mEditor->view()->scaling() );
                }
            }
            mScribbleArea->setModified( mEditor->layers()->currentLayerIndex(), mEditor->currentFrame() );
            mScribbleArea->setAllDirty();
        }
    }
    endStroke();
}
开发者ID:qbdp,项目名称:pencil,代码行数:63,代码来源:buckettool.cpp



注:本文中的VectorImage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VectorKKStr类代码示例发布时间:2022-05-31
下一篇:
C++ VectorI类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap