December 03, 2020, 08:06:12 PM

Author Topic: [bb] SLine by Snarty [ 1+ years ago ]  (Read 536 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] SLine by Snarty [ 1+ years ago ]
« on: June 29, 2017, 12:28:39 AM »
Title : SLine
Author : Snarty
Posted : 1+ years ago

Description : This is the same SLine as the B3D/BB version, except it uses the new direct pixel method. You will need the <a href="codearcs888f.html?code=585" target="_blank">"ConvertRGB()"[/url] function also.

Code :
Code: BlitzBasic
  1. Function SLineBP(stx#,sty#,enx#,eny#,r,g,b,Buffer)
  2.  
  3.         mvx#=Stx-enx:mvy#=sty-eny
  4.         If mvx<0 mvx=-mvx
  5.         If mvy<0 mvy=-mvy
  6.         If mvy>mvx mv#=mvy Else mv#=mvx
  7.         stpx#=(mvx/mv):If Stx>enx stpx=-stpx
  8.         stpy#=(mvy/mv):If Sty>eny stpy=-stpy
  9.         LockBuffer Buffer
  10.         SL_Pitch=LockedPitch(Buffer)
  11.         SL_Bank=LockedPixels(Buffer)
  12.         SL_Mode=LockedFormat(Buffer)
  13.         Col=ConvertRGB(r,g,b,SL_Mode)
  14.         If SL_Mode=1 Or SL_Mode=2
  15.                 For nc=0 To Floor(mv)
  16.                         PokeShort SL_Bank,(Floor(stx)*2)+(Floor(sty)*SL_Pitch),Col
  17.                         stx=stx+stpx:sty=sty+stpy
  18.                 Next
  19.         Else
  20.                 For nc=0 To Floor(mv)
  21.                         PokeInt SL_Bank,(Floor(sty)*SL_Pitch)+(Floor(stx)*4),Col
  22.                         stx=stx+stpx:sty=sty+stpy
  23.                 Next
  24.         EndIf
  25.         UnlockBuffer Buffer
  26.  
  27. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal