Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. "Not so basic" drawing application
Forum Updated to NodeBB v4.3 + New Features

"Not so basic" drawing application

Scheduled Pinned Locked Moved General and Desktop
24 Posts 4 Posters 13.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #21

    ^^ And how exactly is your post helpful? From the many images I posted you should have concluded I already have a commercial image editor. And how exactly will GIMP help me to draw lines with stencils in my application? And thanks for your suggestion but I have plenty more questions on this topic, but those will have to wait till tomorrow. Geez... hunt rank much?

    Anyway, I was able to do it with interpolation, the following is an actual screenshot, but it is a primitive, quick and dirty way to interpolate, and it shows - the lines are quite jagged, nowhere nearly as smooth as those in the images above, which I made in photoshop, will have to do some optimization tomorrow.
    !http://i39.tinypic.com/2ntabgm.png(final)!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #22

      Perhaps you can study how Krita works? From wat I read in the past, it is quite advanced in terms of brush handling.

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #23

        Reinventing the wheel is usually a bad idea, but looking at the source code for Krita all I find is method calls within method calls within method calls, never really reaching the actual drawing logic. The project is so vast it will probably take me less time to reinvent the wheel in that particular case...

        Perhaps if someone here is familiar with the project can give me a few pointers on where to look...

        As for reinventing the wheel, I do realize I am stepping out of Qt land into generic algorithms so I will take it elsewhere.

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #24

          BTW, here is my interpolation logic, it is fairly primitive, but I ain't no programmer yet, and I do realize Qt might have a better API for this, so any recommendations are welcome!

          @void Widget::drawLine()
          {
          QPointF point, drawPoint;
          point = newPos - lastPos;
          int length = point.manhattanLength();
          double xInc, yInc;

          xInc = point.x() / length;
          yInc = point.y() / length;
          
          drawPoint = lastPos;
          
          for (int x=0; x < length; ++x) {
              drawPoint.setX(drawPoint.x()+xInc);
              drawPoint.setY(drawPoint.y()+yInc);
              drawToCanvas(drawPoint);
          }
          

          }@

          Edit: One optimization that comes to mind looking at the code now is use the rx and ry methods of QPoint that return references to use the += on and save the extra function call...

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved