Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Thick Line Algorithm

Thick Line Algorithm

Scheduled Pinned Locked Moved Graphics
algorithmsjsonhelp
6 Posts 5 Posters 2 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.
  • A Offline
    A Offline
    A_Fa
    wrote on last edited by
    #1

    Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.

    U I T B 4 Replies Last reply
    0
    • A A_Fa

      Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.

      U Offline
      U Offline
      Uwe Klatt
      wrote on last edited by
      #2

      Hello, you can draw a filled rectangle and a filled circle at every end. Uwe

      I 1 Reply Last reply
      0
      • A A_Fa

        Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.

        I Offline
        I Offline
        Ingo
        wrote on last edited by
        #3

        Some years ago (nearly ten) I adopted Xiaolin Wu's line algorithm for that. It's an antialiasing algorithm, but with little changes you can use it. You can even do it on your own. When you draw, you got a virtual direction corresponding to an angle. You can turn 90° and paint the neighbor points.

        ------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

        1 Reply Last reply
        0
        • U Uwe Klatt

          Hello, you can draw a filled rectangle and a filled circle at every end. Uwe

          I Offline
          I Offline
          Ingo
          wrote on last edited by
          #4

          You did read, that he has to build it on his own with setpixel? So the problem is he can't draw a rectangle.

          ------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

          1 Reply Last reply
          0
          • A A_Fa

            Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.

            T Offline
            T Offline
            TheRealRarius
            wrote on last edited by
            #5

            Sounds like a school assignment to me... Its been a few years (20+) since I had to do this, but I seem to remember the best way to acheive this was to use the standard Bresenham algorithm, but to just set more than one pixel at each point. Basically for a three pixel wide line, set the 8 pixels around each point as well as the point itself... Some optimisation is possible.

            1 Reply Last reply
            0
            • A A_Fa

              Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.

              B Offline
              B Offline
              Brian J Rothwell
              wrote on last edited by
              #6

              http://www.zoo.co.uk/~murphy/thickline/[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups