News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Have somebody implemented thick line algorithm?

Started by HSE, June 24, 2018, 07:10:53 AM

Previous topic - Next topic

HSE

Hi!

I'm fighting a little with Murphy's algorithm... but without success  :icon13:.

Perhaps somebody  :icon14:? (whatever thick line algorithm)
Equations in Assembly: SmplMath

avcaballero


Biterider

Hello HSE
ObjAsm32 has an object called Pixelmap that supports subpixel drawing.   :idea:
The width of a line can be easily achieved by painting adjacent pixels using Besenham, WU, or other similar algos.
I have slightly modified the demo application to draw wider lines (vertical line with 3 px and inner circle with 2 px)
I attach the new exe.  ;)

Biterider

jj2007


avcaballero

GDI/GDI+ routines are quite slow for making some time critical routines like demos

FORTRANS

Hi,

   When I made a general purpose line drawing routine, it used
a pixel routine to draw pixels on the screen.  By using different
pixel routines, you got different effects.  Black to draw.  White
to erase.  And then patterned pixels for dashed lines and fat
pixels for thick lines.  Certainly wasn't the fastest, but wasn't
really the slowest either.  Except maybe for the fat pixels.

   Faster line routines set the pixel as part of the line drawing
algorithm.  Not as a separate pixel routine.

HTH,

Steve N.

daydreamer

it depends on what you mean: line with just bigger fat size,its just easy to output more pixels in pixel macro/proc and call it from line algo
or nicerlooking search for antialiased bresenham,make code that puts some grey pixels around white line or darker shade of color of the line,especially where the sawshaped line looks worst

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

HSE

Quote from: caballero on June 24, 2018, 06:20:45 PM
Yes, I did it. Bresenham line algorithm
No. Bresenham algorithm is only for thin lines  :biggrin:

Quote from: Biterider on June 24, 2018, 07:23:06 PM
The width of a line can be easily achieved by painting adjacent pixels using Besenham, WU, or other similar algos.
It's easy if you know line orientation  8)

@FORTRANS && daydreamer :
  It's an expensive solution... but if algorithm don't work   

Quote from: jj2007 on June 24, 2018, 07:28:09 PM
What's wrong with Gdi+ thick lines?
Perhaps GDI+ or other graphics libraries with antialiasing are better, but now I'm trying to draw fast (and simple if posible).

Thanks for the ideas. Now I have a mix. Thin lines are Bresenham drawings. Over that is a normal thick GDI line, witch in theory it's Murphy's algorithm. The idea is to draw that line and to make nicer points in same process. 

Equations in Assembly: SmplMath

HSE

Using Fortrans and Daydreammer "big pixel" line.

Final result not so impressive  :(

Perhaps an antialiased line it's mandatory...
Equations in Assembly: SmplMath

felipe

Nice project and looks difficult too. Congratulations.  :t

HSE

Quote from: felipe on July 03, 2018, 08:47:00 AM
Nice project and looks difficult too.
Yes, nothing easy, and no time for that!

Using GDI+. With the antialiased thick line is far far better I think.
Equations in Assembly: SmplMath

daydreamer

wonder how it looks with dx9 line or poly used as line with fullfledged hardware antialias filter?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

HSE

Quote from: daydreamer on July 06, 2018, 04:16:33 AM
wonder how it looks with dx9 line or poly used as line with fullfledged hardware antialias filter?

Fanatics of DirectX assume that everybody know something that I don't know.

I found examples to draw a detailed tiger, planets in movement... but none to draw only a line  :biggrin:

But I was thinking in Biterider solution, I have to see.
Equations in Assembly: SmplMath

Siekmanski

Creative coders use backward thinking techniques as a strategy.

HSE

Apparently Direct2D is better suited for lines, but again examples are very complex
Equations in Assembly: SmplMath