Вопрос

can someone say me how to access all the pixels, that are under a QPainterPath?

The Elements of QPainterPath have some methods like isLineTo(), so my first idea was to create a linear function with the start and end point. But that's a problem, if the path includes a vertical line.

Greetings

//UPDATE

Maybe this is a better question: How to draw a linear path on a image and gather all the points from it?

Это было полезно?

Решение

I've found a performant solution to get all points from a line:

            QLineF line(lastPoint,currentPoint);
            for (int var = 0; var < line.length(); ++var) {
                x=line.x1()+var*cos(line.angle());
                y=line.y1()+var*sin(line.angle());
                //qDebug()<<x<<"  "<<y;

with this, i also get the points from a vertical line.

Greetings

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top