Author Topic: Modernize graphics  (Read 5187 times)

0 Members and 1 Guest are viewing this topic.

Offline fschickel

  • Newbie
  • Posts: 1
    • View Profile
Modernize graphics
« on: April 08, 2020, 07:19:04 pm »
Hi all, long time lurker, first time poster.

Decades ago I read a book on generating chaotic attractors with a PC.  Beyond playing around with it I did not do much with it.  I found out recently that the author posted the book and program he used to generate the attractors on his page.  He used BASIC and C, developing the BASIC version step-by-step in the book.  I don't have much experience with the graphics capabilities in QB64 and was wondering how hard it would be to modernize the BASIC version to QB64 graphics.

The book and code are available here: http://sprott.physics.wisc.edu/sa.htm

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #1 on: April 08, 2020, 08:01:23 pm »
Welcome fschickel,

Here is a glimpse of Henon (from old files):
Code: QB64: [Select]
  1. CONST xmax = 800, ymax = 600
  2. SCREEN _NEWIMAGE(xmax, ymax, 32)
  3. a = -10.1: sc = 175: ox = 400: oy = 300
  4.     CLS
  5.     FOR x = -0.1 TO 0.8 STEP 0.05
  6.         FOR y = -0.1 TO 0.8 STEP 0.05
  7.             lx = x: ly = y
  8.             FOR n = 1 TO 40
  9.                 xx = lx * COS(a) - (ly - lx * lx) * SIN(a)
  10.                 ly = lx * SIN(a) + (ly - lx * lx) * COS(a)
  11.                 lx = xx
  12.                 IF ABS(lx + ly) > 3000 THEN n = 40 'end if
  13.                 PSET (ly * sc + ox, lx * sc + oy), _RGB32(n * 5, 255 - n * 5, 128 + n * 2)
  14.             NEXT
  15.         NEXT
  16.     NEXT
  17.     _DISPLAY
  18.     a = a + 0.005
  19.  
  20.  
« Last Edit: April 08, 2020, 08:49:57 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #2 on: April 08, 2020, 08:49:32 pm »
Here is what I come up with in little search on Internet (and fiddling with numbers):
Code: QB64: [Select]
  1. _TITLE "Lorenz Attractor Test" 'b+ 2020-04-08
  2. ' https://www.algosome.com/articles/lorenz-attractor-programming-code.html
  3. CONST xmax = 800, ymax = 600
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5. DEFDBL A-Z
  6. a = 170: b = 280: c = 30
  7. x = .1: y = 0: z = 0
  8.     xt = x + t * (a * (y - x))
  9.     yt = y + t * (x * (b - z) - y)
  10.     zt = z + t * (x * y - c * z)
  11.     PSET (x + 400, y + 300)
  12.     x = xt
  13.     y = yt
  14.     z = zt
  15.     t = t + .0000001
  16.  
  17.  
« Last Edit: April 08, 2020, 08:57:12 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #3 on: April 08, 2020, 09:26:56 pm »
Here is the Movie:

Code: QB64: [Select]
  1. _TITLE "Lorenz Attractor the Movie" 'b+ 2020-04-08
  2. ' https://www.algosome.com/articles/lorenz-attractor-programming-code.html
  3. CONST xmax = 800, ymax = 600
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5. DEFDBL A-Z
  6. a = 100: b = 300: c = 1
  7.  
  8. restart:
  9. x = .1: y = 0: z = 0
  10. WHILE t < .001
  11.     xt = x + t * (a * (y - x))
  12.     yt = y + t * (x * (b - z) - y)
  13.     zt = z + t * (x * y - c * z)
  14.     PSET (x + 400, y + 300) '   _RGB32(z MOD 600)
  15.     x = xt
  16.     y = yt
  17.     z = zt
  18.     t = t + .0000001
  19. PRINT "        a ="; a; "        b ="; b; "        c ="; c
  20. a = RND * 200: b = RND * 300 + a: c = RND * 30: t = 0
  21. GOTO restart
  22.  
  23.  
  24.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #4 on: April 08, 2020, 09:37:35 pm »
The Director's Cut of the Movie:

Code: QB64: [Select]
  1. _TITLE "Lorenz Attractor the Movie" 'b+ 2020-04-08
  2. ' https://www.algosome.com/articles/lorenz-attractor-programming-code.html
  3. CONST xmax = 800, ymax = 600
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5. DEFDBL A-Z
  6. a = 100: b = 300: c = 1
  7. restart:
  8. PRINT "        a ="; a; "        b ="; b; "        c ="; c
  9. x = .1: y = 0: z = 0
  10. WHILE t < .001
  11.     xt = x + t * (a * (y - x))
  12.     yt = y + t * (x * (b - z) - y)
  13.     zt = z + t * (x * y - c * z)
  14.     PSET (x + 400, y + 300) '   _RGB32(z MOD 600)
  15.     x = xt
  16.     y = yt
  17.     z = zt
  18.     t = t + .0000001
  19.     _LIMIT 500
  20. a = RND * 200: b = RND * 300 + a: c = RND * 30: t = 0
  21. GOTO restart
  22.  
  23.  
  24.  

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: Modernize graphics
« Reply #5 on: April 08, 2020, 09:37:59 pm »
It looks like Bplus is taking care of you. Just wanted to say welcome to the forum!
In order to understand recursion, one must first understand recursion.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #6 on: April 08, 2020, 10:06:29 pm »
Ha, looks like fschickel has taken care of me :)

I just found this at SmallBASIC library and translated it, "Oh! we can do different views because it's 3D."

Code: QB64: [Select]
  1. _TITLE "Strange Attractor" ' trans from SmallBASIC b+ 2020-04-08
  2. ' Plot of the "Strange Attractor"
  3. ' Define 3 differential equations
  4. ' Set initial conditions
  5.  
  6. CONST xmax = 1280, ymax = 740
  7. SCREEN _NEWIMAGE(xmax, ymax, 32)
  8. _DELAY .25
  9.  
  10. INPUT "initial x (.5) "; x
  11. INPUT "initial y (-.5) "; y
  12. INPUT "initial z (.3) "; z
  13. INPUT "final time (50) "; tf
  14. INPUT "number of intervals (100000) "; n
  15.  
  16. ' Begin numerical integration of the d.e.q.'s
  17. h = tf / n
  18. FOR q = 1 TO n
  19.     kxt1 = h * lxt(x, y)
  20.     kyt1 = h * lyt(x, y, z)
  21.     kzt1 = h * lzt(x, y, z)
  22.     kxt2 = h * lxt(x + .5 * kxt1, y + .5 * kyt1)
  23.     kyt2 = h * lyt(x + .5 * kxt1, y + .5 * kyt1, z + .5 * kzt1)
  24.     kzt2 = h * lzt(x + .5 * kxt1, y + .5 * kyt1, z + .5 * kzt1)
  25.     kxt3 = h * lxt(x + .5 * kxt2, y + .5 * kyt2)
  26.     kyt3 = h * lyt(x + .5 * kxt2, y + .5 * kyt2, z + .5 * kzt2)
  27.     kzt3 = h * lzt(x + .5 * kxt2, y + .5 * kyt2, z + .5 * kzt2)
  28.     kxt4 = h * lxt(x + .5 * kxt3, y + .5 * kyt3)
  29.     kyt4 = h * lyt(x + .5 * kxt3, y + .5 * kyt3, z + .5 * kzt3)
  30.     kzt4 = h * lzt(x + .5 * kxt3, y + .5 * kyt3, z + .5 * kzt3)
  31.     x = x + (kxt1 + 2 * kxt2 + 2 * kxt3 + kxt4) / 6
  32.     y = y + (kyt1 + 2 * kyt2 + 2 * kyt3 + kyt4) / 6
  33.     z = z + (kzt1 + 2 * kzt2 + 2 * kzt3 + kzt4) / 6
  34.     xp = 10 * x + 900: yp = 15 * y + 400: zp = 10 * z + 100
  35.     PSET (xp, yp), _RGB32(0, 0, 255): PSET (zp, yp), _RGB32(0, 100, 0)
  36. FUNCTION lxt (x, y)
  37.     lxt = 10 * (y - x)
  38. FUNCTION lyt (x, y, z)
  39.     lyt = 28 * x - y - x * z
  40. FUNCTION lzt (x, y, z)
  41.     lzt = x * y - 8 * z / 3
  42.  
  43.  

  [ You are not allowed to view this attachment ]  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #7 on: April 08, 2020, 10:37:39 pm »
Split Screen (More than 2 X's better!)

Code: QB64: [Select]
  1. _TITLE "Lorenz Attractor Split Screen" 'b+ 2020-04-08
  2. ' https://www.algosome.com/articles/lorenz-attractor-programming-code.html
  3. CONST xmax = 1280, ymax = 640
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5. DEFDBL A-Z
  6. a = 100: b = 300: c = 1
  7. restart:
  8. PRINT "        a ="; a; "        b ="; b; "        c ="; c
  9. x = .1: y = 0: z = 0
  10. WHILE t < .001
  11.     xt = x + t * (a * (y - x))
  12.     yt = y + t * (x * (b - z) - y)
  13.     zt = z + t * (x * y - c * z)
  14.     IF y >= -320 AND y <= 320 THEN
  15.         IF x >= -320 AND x <= 320 THEN PSET (x + 320, y + 320)
  16.         IF z >= -320 AND z <= 640 THEN PSET (z + 640, y + 320)
  17.     END IF
  18.     x = xt
  19.     y = yt
  20.     z = zt
  21.     t = t + .0000001
  22.     _LIMIT 500
  23. a = RND * 200: b = RND * 300 + a: c = RND * 30: t = 0
  24. GOTO restart
  25.  
  26.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #8 on: April 08, 2020, 11:23:08 pm »
Now in Living Color:

Code: QB64: [Select]
  1. _TITLE "Lorenz Attractor Colorized" 'b+ 2020-04-08
  2. ' https://www.algosome.com/articles/lorenz-attractor-programming-code.html
  3. CONST xmax = 1280, ymax = 640
  4. DEFDBL A-Z
  5. DIM SHARED cN, pR, pG, pB 'plasma
  6. SCREEN _NEWIMAGE(xmax, ymax, 32)
  7. a = 100: b = 300: c = 1
  8. restart:
  9. resetPlasma
  10. COLOR &HFFBBBBBB
  11. PRINT "        a ="; a; "        b ="; b; "        c ="; c
  12. x = .1: y = 0: z = 0
  13. WHILE t < .002
  14.     xt = x + t * (a * (y - x))
  15.     yt = y + t * (x * (b - z) - y)
  16.     zt = z + t * (x * y - c * z)
  17.     IF y >= -320 AND y <= 320 THEN
  18.         IF x >= -320 AND x <= 320 THEN PSET (x + 320, y + 320), plasma
  19.         IF z >= -320 AND z <= 640 THEN PSET (z + 640, y + 320), plasma
  20.     END IF
  21.     x = xt
  22.     y = yt
  23.     z = zt
  24.     t = t + .0000001
  25.     cN = cN + .005
  26.     _LIMIT 500
  27. a = RND * 200: b = RND * 300 + a: c = RND * 30: t = 0
  28. IF c > a / 3 THEN c = a / 3 * RND
  29. GOTO restart
  30.  
  31. FUNCTION plasma~&
  32.     plasma~& = _RGB32(127 + 127 * SIN(pR * cN), 127 + 127 * SIN(pG * cN), 127 + 127 * SIN(pB * cN))
  33.  
  34. SUB resetPlasma ()
  35.     pR = RND ^ 2: pG = RND ^ 2: pB = RND ^ 2: cN = 0
  36.  
  37.  

  [ You are not allowed to view this attachment ]  
« Last Edit: April 08, 2020, 11:53:35 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #9 on: April 08, 2020, 11:50:49 pm »
And FX:

Code: QB64: [Select]
  1. _TITLE "Lorenz Attractor FX" 'b+ 2020-04-08
  2. ' https://www.algosome.com/articles/lorenz-attractor-programming-code.html
  3. CONST xmax = 1280, ymax = 640
  4. DEFDBL A-Z
  5. DIM SHARED cN, pR, pG, pB 'plasma
  6. SCREEN _NEWIMAGE(xmax, ymax, 32)
  7. a = 100: b = 300: c = 1
  8. restart:
  9. resetPlasma
  10. COLOR &HFFBBBBBB
  11. PRINT "        a ="; a; "        b ="; b; "        c ="; c
  12. x = .1: y = 0: z = 0
  13. WHILE t < .002
  14.     LINE (0, 0)-(xmax, ymax), _RGBA32(0, 0, 0, 2), BF
  15.     xt = x + t * (a * (y - x))
  16.     yt = y + t * (x * (b - z) - y)
  17.     zt = z + t * (x * y - c * z)
  18.     IF y >= -320 AND y <= 320 THEN
  19.         IF x >= -320 AND x <= 320 THEN PSET (x + 320, y + 320), plasma
  20.         IF z >= -320 AND z <= 640 THEN PSET (z + 640, y + 320), plasma
  21.     END IF
  22.     x = xt
  23.     y = yt
  24.     z = zt
  25.     t = t + .0000002
  26.     cN = cN + .005
  27.     _LIMIT 500
  28. a = RND * 200: b = RND * 300 + a: c = RND * 30: t = 0
  29. IF c > a / 3 THEN c = a / 3 * RND
  30. GOTO restart
  31.  
  32. FUNCTION plasma~&
  33.     plasma~& = _RGB32(191 + 64 * SIN(pR * cN), 191 + 64 * SIN(pG * cN), 191 + 64 * SIN(pB * cN))
  34.  
  35. SUB resetPlasma ()
  36.     pR = RND ^ 2: pG = RND ^ 2: pB = RND ^ 2: cN = 0
  37.  
  38.  

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Modernize graphics
« Reply #10 on: April 09, 2020, 05:30:57 am »
Some nice geometric patterns. :)
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Modernize graphics
« Reply #11 on: April 09, 2020, 02:56:47 pm »
Updated my old generator.  The _DELAY is to allow
squirrels to take over the planet.

Code: QB64: [Select]
  1. _TITLE "Henon Plots"
  2.  
  3. SCREEN _NEWIMAGE(800, 600, 32)
  4. mm# = 99999999999#
  5. FOR i = 1 TO 3
  6.     READ a#, xb#, xe#, yb#, ye#
  7.     r# = _D2R(a#): si# = SIN(r#): co# = COS(r#)
  8.     CLS: WINDOW (xb#, yb#)-(xe#, ye#)
  9.     FOR z# = xb# TO xe# \ 2 STEP (xe# - xb#) / 500
  10.         xo# = z#: yo# = z#
  11.         c& = _RGB32(RND * 255, RND * 255, RND * 255)
  12.         FOR n = 0 TO 2000
  13.             IF (ABS(xo#) > mm#) OR (ABS(yo#) > mm#) THEN EXIT FOR
  14.             tt# = yo# - xo# * xo#
  15.             xn# = xo# * co# - tt# * si#
  16.             yn# = xo# * si# + tt# * co#
  17.             PSET (xn#, yn#), c&
  18.             xo# = xn#: yo# = yn#
  19.         NEXT n
  20.         _DELAY .01
  21.     NEXT z#
  22.     SLEEP
  23.  
  24. DATA 90.3,-1.00,1.30,-1.00,1.00
  25. DATA 74,-0.80,1.30,-0.90,1.00
  26. DATA 71,-0.70,1.10,-0.80,0.80
  27.  
  28.  
It works better if you plug it in.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #12 on: April 09, 2020, 03:06:42 pm »
Ah, that reminds me of old girlfriend Mira:

Code: QB64: [Select]
  1. 'Mira.bas for QB64 Fork (B+=MGA) 2017-05-01 from:
  2. 'Mira.bas for SmallBASIC 0.12.8 [B+=MGA] update 2017-02-20
  3.  
  4. ''update  Mira fractals from SmallBASIC
  5. '' Martin Latter
  6. '' Converted to SB from my old 1992 version in Archimedes BASIC
  7. '' - SB and modern computers thankfully plot a bit faster.
  8.  
  9. 'In most Mira all the interesting stuff happens immediately.
  10.  
  11. 'This code will stay with one display until you press a key
  12.  
  13.  
  14. CONST xmax = 1200, ymax = 700
  15. CONST xc = xmax / 2
  16. CONST yc = ymax / 2
  17. CONST dots = 10000 'for one round on Mira
  18.  
  19. SCREEN _NEWIMAGE(xmax, ymax, 32)
  20. _TITLE "Mira fractal classic translated to QB64 Fork  by bplus"
  21.  
  22. DIM ca(INT(dots / 100)) AS _UNSIGNED LONG 'for color array
  23. DIM a, b, c, x, y, z, j AS DOUBLE 'fractal calcs
  24. DIM xp, yp, red, green, blue AS INTEGER 'screen x, y and color r, g, b
  25.  
  26.     'set round
  27.     a = RND
  28.     b = RND * .008 + .993 'originally held const .9998
  29.     c = 2 - 2 * a
  30.     x = 0
  31.     j = 0
  32.     y = RND * 12 + .1
  33.  
  34.     'set palette (originally only 6 colors)
  35.     FOR pc = 0 TO INT(dots / 100)
  36.         red = INT(RND * 2) * (RND * 195 + 60)
  37.         green = INT(RND * 2) * (RND * 195 + 60)
  38.         blue = INT(RND * 2) * (RND * 195 + 60)
  39.         ca(pc) = _RGB(red, green, blue)
  40.     NEXT
  41.  
  42.     'the outer loop here waits for keypress to move out to new mira
  43.     COLOR _RGB(0, 255, 255)
  44.     PRINT "Start: a = "; a; "   b = "; b; "  Use the spacebar to toggle next random screen scene..."
  45.     WHILE _KEYHIT <> 32
  46.         _LIMIT 60
  47.         FOR i = 0 TO dots
  48.             z = x
  49.             x = b * y + j
  50.             j = a * x + c * (x ^ 2) / (1 + x ^ 2)
  51.             y = j - z
  52.             xp = (x * 20) + xc
  53.             yp = (y * 20) + yc
  54.             COLOR ca(INT(i / 100))
  55.             PSET (xp, yp)
  56.         NEXT
  57.         _DISPLAY
  58.     WEND
  59.     CLS
  60.  
  61.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #13 on: April 09, 2020, 03:16:51 pm »
Found this guy hanging out with Mira, I am foggy why this was called a cloud:

Code: QB64: [Select]
  1. _TITLE "orbit cloud fractal.bas by bplus 2017-10-15"
  2. '
  3. ''' cloud.bas
  4. '' From "Fractals" by Hans Lauwerier
  5. '' Shows Orbits of a dynamical system
  6. '' by Tim Corcoran 2001
  7. '' modified by ML 4/1/07
  8.  
  9. CONST xmax = 800
  10. CONST ymax = 600
  11.  
  12. SCREEN _NEWIMAGE(xmax, ymax, 32)
  13. _DELAY .5 'sorry, my system needs .5 delay for _MIDDLE, yours may NOT
  14. _SCREENMOVE _MIDDLE ' not working with 32 in line above
  15.  
  16. xoffs = xmax / 2
  17. yoffs = ymax / 2
  18.     CLS
  19.     a = 3.5 'orig 3.5
  20.     b = -3 'orig -3
  21.     x = 3.14 'orig 3.21
  22.     y = 6.85 'orig 6.54
  23.     IF x > 1 THEN
  24.         w = a * x + b * (x - 1)
  25.     ELSEIF x < -1 THEN
  26.         w = a * x + b * (x + 1)
  27.     ELSE
  28.         w = a * x
  29.     END IF
  30.     plasmaR = RND ^ 2: plasmaG = RND ^ 2: plasmaB = RND ^ 2: plasmaN = 0
  31.     FOR n = 0 TO 20000
  32.         plasmaN = plasmaN + .05
  33.         COLOR _RGB(127 + 127 * SIN(plasmaR * plasmaN), 127 + 127 * SIN(plasmaG * plasmaN), 127 + 127 * SIN(plasmaB * plasmaN))
  34.  
  35.         PSET ((x * 4) + xoffs, (y * 4) + yoffs)
  36.         z = x: x = y + w
  37.         IF x > 1 THEN
  38.             w = a * x + b * (x - 1)
  39.         ELSEIF x < -1 THEN
  40.             w = a * x + b * (x + 1)
  41.         ELSE
  42.             w = a * x
  43.         END IF
  44.         y = w - z
  45.     NEXT
  46.     _LIMIT 1
  47.  

Maybe a Cubic Cloud?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Modernize graphics
« Reply #14 on: April 09, 2020, 04:41:52 pm »
Here is old favorite:

Code: QB64: [Select]
  1. _TITLE "Glitter Hopalong, any key quits" 'trans from SmallBASIC 2020-04-09
  2. 'Glitter hopalong.bas SmallBASIC 2015-05-04 modified for Bpf, B+
  3. ' color changes for the night shift
  4.  
  5. CONST xmax = 1200, ymax = 700
  6. SCREEN _NEWIMAGE(xmax, ymax, 32)
  7. _DELAY .25
  8.  
  9. xoffs = xmax * 5 / 12
  10. yoffs = ymax * 5 / 12
  11.     CLS
  12.     j = RND * 100
  13.     k = RND * 100
  14.     x = 0: y = 0: r = 0: n = 0
  15.     FOR i = 1 TO 10000000
  16.         r = RND * 4000
  17.         IF r > 3997 THEN COLOR qb(INT(RND * 15) + 1)
  18.         xx = y - SGN(x) * SQR(ABS(k * x - 1))
  19.         y = j - x
  20.         x = xx
  21.         xp = x * 3 + xoffs
  22.         yp = y * 3 + yoffs
  23.         CIRCLE (xp, yp), 1
  24.     NEXT i
  25.     _DELAY 1
  26.  
  27.     SELECT CASE n
  28.         CASE 0: qb~& = &HFF000000
  29.         CASE 1: qb~& = &HFF000088
  30.         CASE 2: qb~& = &HFF008800
  31.         CASE 3: qb~& = &HFF008888
  32.         CASE 4: qb~& = &HFF880000
  33.         CASE 5: qb~& = &HFF880088
  34.         CASE 6: qb~& = &HFF888800
  35.         CASE 7: qb~& = &HFFCCCCCC
  36.         CASE 8: qb~& = &HFF888888
  37.         CASE 9: qb~& = &HFF0000FF
  38.         CASE 10: qb~& = &HFF00FF00
  39.         CASE 11: qb~& = &HFF00FFFF
  40.         CASE 12: qb~& = &HFFFF0000
  41.         CASE 13: qb~& = &HFFFF00FF
  42.         CASE 14: qb~& = &HFFFFFF00
  43.         CASE 15: qb~& = &HFFFFFFFF
  44.     END SELECT
  45.  
  46.