Main Menu

Drawing SImple Hash Pattern

Started by kevin, June 21, 2012, 01:49:24 PM

Previous topic - Next topic

kevin

 This example renders a two colour hash pattern.  

PlayBASIC Code: [Select]
   HashIMage=NewIMage(128,128,2)


rendertoimage HashIMage

Col1=$112233
Col2=$334455

Cls col1
For ylp =0 to 127
For xlp =0 to 127 step 2
xpos=xlp+(ylp and 1)
Dotc Xpos,ylp,col2
next
next


; redirect drawing to the screen
rendertoscreen


tileImage HashImage,0,0,false

Sync
waitkey





Slightly fatted version of the same thing

PlayBASIC Code: [Select]
   HashIMage=NewIMage(128,128)

rendertoimage HashIMage

Col1=$112233
Col2=$334455
Cls col1
For ylp =0 to 127
lockbuffer
For xlp =0 to 127 step 4
xpos=xlp+(ylp and 2)
Dotc Xpos,ylp,col2
next
unlockbuffer
next


; redirect drawing to the screen
rendertoscreen


tileImage HashImage,0,0,false

Sync
waitkey