rageworx / fl_imgtk

FLTK image toolkit for some useful effects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

smooth line error.

rageworx opened this issue · comments

It will occurs with this condition.

  • x1 is less than x2.
  • y1 is less than y2.
  • thickness more than 3.f.
    image

It maybe belong this,

        // step of X.
        if ( ( 2*e2 ) >= -dx )
        {
            for( e2 += dy, y3 = y1; (e2 < ed*wd) && ((y2 != y3) || (dx > dy)); e2 += dx )
            {
                int xfix = 0;
                
                dr = abs( e2 ) / ed - wd + 1.f;
                fl_imgtk_dla_plot( img, x1, y3 += sy, col, __MIN( 1.f, 1.f - dr ) );
            }
            
            if ( x1 == x2 )
                break;
            
            e2   = err; 
            err -= dy;
            x1  += sx;
        }

x1 always minimum coordination. it cannot be goes to more than below.

New error found:
image
Need to replace to other algorithm? or my wrong ?

Fixed error pixels, but still remains clipping issue ...
image

Replaced drawing line alogrithm with "SDF optimization with AABB".

image