문제

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