Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Boxing accident
#1
So writing a sub to draw rectangles with line thickness and the first one I knocked out revealed a curious and happy surprise:


Code: (Select All)
'Boxing accident
Screen _NewImage(800, 500, 32)
Dim Shared pencolor As _Unsigned Long
pencolor = _RGB32(250, 250, 250)

box 2, 2, 140, 80, 3, &HFFFFFFFF

box 152, 2, 250, 100, 3, &HFF

box 300, 2, 400, 200, 9, &HF0F0F0F

box 30, 200, 90, 400, 20, &HF00F00F

Locate 20, 20: Print "A happy accident using line styles"
Locate 21, 20: Print "and a simple algorithm"
Sub box (x1, y1, x2, y2, thickness, style)
    xa = x1: xb = x2: ya = y1: yb = y2
    For l = 1 To thickness
        Line (xa, ya)-(xb, yb), pencolor, B , style
        xa = xa + 1: xb = xb - 1
        ya = ya + 1: yb = yb - 1
    Next l
End Sub
Reply




Users browsing this thread: 1 Guest(s)