English
Experimente

so goes Antialiasing: The Xiaolin Wu-Algorithmus (slow XProfan-11-Version)

 

p.specht

XProfan-11 demonstration-Umsetzung the Xiaolin Wu - Antialiasing-Algorithmus

... unfortunately yet with a light bow, but the principle becomes at least explicit!
circa in vernünftiger speed To walk, should in the practice The Channel alpha-Blending-quality moderner Graphic-Cards used go!
Window Title "Antialiased Line (Xiaolin Wu-Algorithmus)"
'Q: https://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorithm
's: https://rosettacode.org/wiki/Xiaolin_Wu%27s_line_algorithm#BBC_BASIC
Window Style 24
Window 0,0-%maxx,%maxy
screen width(%hwnd)\5,height(%hwnd)\5
set("Truecolor",0)
cls rgb(255,255,180)
drawAntiAliasedLine(20,20, 50,100,   255,0,0)
screen width(%hwnd),height(%hwnd)
Waitinput
END

Proc drawAntiAliasedLine

    parameters x1!,y1& , x2&,y2&, r%,g%,b%
    declare tmp&, dx&,dy&, xend&,yend!, strain!,yf!,xgap!, ix1%,iy1%, ix2%,iy2%, x%
    dx& = x2& - x1!
    dy& = y2& - y1&

    IF ABS(dx&) < ABS(dy&)

        tmp&=x1!:x1!=y1&:y1&=tmp&
        tmp&=x2&:x2&=y2&:y2&=tmp&
        tmp&=dx&:dx&=dy&:dy&=tmp&

    ENDIF

    IF x2& < x1!

        tmp&=x1!:x1!=x2&:x2&=tmp&
        tmp&=y1&:y1&=y2&:y2&=tmp&

    ENDIF

    strain! = dy& / dx&
    xend& = INT(x1! + 0.5)
    yend! = y1& + strain! * (xend& - x1!)
    xgap! = xend& + 0.5 - x1!
    ix1% = xend&
    iy1% = INT(yend!)
    plot(ix1%, iy1%, r%,g%,b%, (INT(yend!) + 1 - yend!) * xgap!)
    plot(ix1%, iy1% + 1, r%,g%,b%, (yend! - INT(yend!)) * xgap!)
    yf! = yend! + strain!
    xend& = INT(x2& + 0.5)
    yend! = y2& + strain! * (xend& - x2&)
    xgap! = x2& + 0.5 - xend&
    ix2% = xend&
    iy2% = INT(yend!)
    plot(ix2%,iy2%,   r%,g%,b%,(INT(yend!) + 1 - yend!) * xgap!)
    plot(ix2%,iy2%+1, r%,g%,b%,(yend! - INT(yend!)) * xgap!)

    Whileloop ix1%+1,ix2%-1 : x%=&Loop

        plot(x%, INT(yf!),   r%,g%,b%, INT(yf!) + 1 - yf!)'RGBA-stature
        plot(x%, INT(yf!)+1, r%,g%,b%, yf!-INT(yf!))
        yf!=yf!+strain!

    Endwhile

ENDPROC

Proc plot : parameters X%,Y%, R%,G%,B%, A!

    var C% = GetPixel(X%*2,Y%*2)
    'print int(1000*A!);
    USEPEN 0,2, R%*(1-a!) + ( C% AND 255)*a!, \
    G%*(1-a!) + ((C%>>8) AND 255)*a!, \
    B%*(1-a!) + ((C%>>16) AND 255)*a!
    'MODE "OR" would nachzubauen
    LINE X%*2,Y%*2 - X%*2,Y%*2

ENDPROC

 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/28/21  
 



Zum Experiment


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.128 Views

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie