home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1992-09-28 | 3.3 KB | 122 lines |
- >MkAnnulus
- auxillary library file for "MakeSpGen"
- creates "rotating buckets"
- *********************************************************************
- These are constants
- _Define_Constants
- I Usage$ = "[-RMin <r>] [-NSpoke <n>] [-In <rrGGbb>] [-Out <rrGGbb>]"
- % Param$ = "RMin,NSpoke/e,In,Out"
- ; RMin = 0.6 :
- (0, 1) Inner radius
- < NSpoke = 5 :
- non-negative integer
- . In$ = "FFdd33" :
- rrGGbb
- . Out$ = "337711" :
- rrGGbb
- In%(2), Out%(2), C%(2)
- *********************************************************************
- " Parse the command line
- _Params(b%)
- getr(RMin, b%!0)
- geti(NSpoke, b%!4)
- getz(In$, b%!8)
- getz(Out$, b%!12)
- _Colour(In$, In%())
- _Colour(Out$, Out%())
- _Colour(c$,
- c%())
- , "Bad Colours parameter ("+
- report+ ")"
- (c$)<>6
- 1, "format of colour is rrGGbb"
- c% =
- eval("&"+ c$)
- %! c%(0) = (c%
- &0000FF) >> 0
- &! c%(1) = (c%
- &00FF00) >> 8
- '" c%(2) = (c%
- &FF0000) >> 12
- *********************************************************************
- +! The mode has been set
- _Define_Palette
- 19, &0, 16, &00, &00, &00 :
- palette
- 19, &1, 16, &00, &ff, &00
- 19, &2, 16, &ee, &00, &00
- 19, &3, 16, &ff, &bb, &44
- 19, &4, 16, &ee, &ee, &00
- 19, &5, 16, &bb, &88, &55
- 19, &6, 16, &aa, &44, &bb
- 19, &7, 16, &44, &ff, &00
- 19, &8, 16, &66, &dd, &ff
- 19, &9, 16, &44, &33, &bb
- 19, &a, 16, &77, &77, &77
- 19, &b, 16, &bb, &ff, &dd
- 19, &c, 16, &11, &11, &dd
- 19, &d, 16, &ff, &99, &44
- 19, &e, 16, &ff, &ff, &ff
- 19, &f, 16, &ee, &ee, &ee
- *********************************************************************
- f = (0, 1]
- B. xc, yc = OS co-ordinates of center
- _Draw_Frame(f, xc, yc)
- f2, OuterR, InnerR, InnerRR, OuterRR, x, y, t, dx, dy
- spoke%
- f2 =
- (f - 1/2) * 2
- H$ OuterR = RMax * (1 - (f2 / 2))
- InnerR = OuterR * RMin
- InnerRR = InnerR * InnerR
- OuterRR = OuterR * OuterR
- x= -OuterR-HalfX
- OuterR
- M'
- y= -OuterR-HalfY
- OuterR
- t = x*x+y*y
- O%
- t>=InnerRR
- t<=OuterRR
- P%
- t-InnerRR < OuterRR-t
- t =
- (t) - InnerR
-
- t = OuterR -
-
- U+ t = t / ((OuterR - InnerR) / 2)
- V5 C%(0) = (Out%(0)-In%(0))*t + 0.5 + In%(0)
- W5 C%(1) = (Out%(1)-In%(1))*t + 0.5 + In%(1)
- X5 C%(2) = (Out%(2)-In%(2))*t + 0.5 + In%(2)
- Y= p% = (C%(0) << 24) + (C%(1) << 16) + (C%(2) << 8)
- Z3
- "ColourTrans_SetGCOL", p%,,, &100, 0
- [-
- &45, xc + x + 0.5, y + yc + 0.5
-
- _0 InnerR = RMax * (RMin + ((1 - RMin) * f2))
- NSpoke
- spoke%= 1
- NSpoke
-
- 0, spoke% * 2
- c4 x = xc + InnerR*
- *(f + spoke%/NSpoke))
- d4 y = yc + InnerR*
- *(f + spoke%/NSpoke))
-
- dx= -X
- HalfX
- f!
- dy= -Y
- HalfY
- g#
- xc + 0.5 , yc + 0.5
- h*
- x + dx + 0.5, y + dy + 0.5
-
-
- spoke%
-