相关疑难解决方法(0)

Qt中的线插值?

我试图通过除去线的长度来减少画笔笔划的间距(在QPixmap上).如果我乘以线,则间距增加,但间距不会减小.此外,线条可以具有的最小长度为1.显然划分它会减少 - 可能低于允许的数量?不确定这是否会对像素图的绘制产生负面影响.

这是违规代码:

QLineF line = QLineF(lastPoint, endPoint);
float lineLength = line.length();
qDebug() << line.length();
line.setLength(lineLength / 50.0f);
qDebug() << line.length();

painter.drawPixmap(line.p1().x() - 16, line.p2().y() - 16, 32, 32, testPixmap);
Run Code Online (Sandbox Code Playgroud)

以下是此特定文件中的所有代码:

#include "inkspot.h"
#include "inkpuppet.h"
#include "ui_inkpuppet.h"

#include "newdialog.h"
#include "ui_newdialog.h"

#include <QtCore>
#include <QtGui>
#include <QWidget>
#include <QPainter>
#include <QPaintEvent>

InkSpot::InkSpot(QWidget *parent) :
    QWidget(parent)
{
    widget = this;
    drawing = false;
}

void InkSpot::mousePressEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        lastPoint = event->pos();
        drawing = true;
    }
} …
Run Code Online (Sandbox Code Playgroud)

c++ qt

5
推荐指数
1
解决办法
2527
查看次数

标签 统计

c++ ×1

qt ×1