Author Topic: Outline Letters  (Read 5053 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Outline Letters
« on: March 04, 2018, 02:18:04 am »
Well we've rotated letters every which way, how about outling them?
Code: QB64: [Select]
  1. _TITLE "Outline Letter bplus 2018-03-03"
  2. CONST xmax = 1260
  3. CONST ymax = 600
  4.  
  5.  
  6. COMMON SHARED cN, pR!, pG!, pB!
  7.  
  8. SCREEN _NEWIMAGE(xmax, ymax, 32)
  9. _SCREENMOVE 100, 20
  10. mess$ = "Bplus strikes again!"
  11. PRINT mess$
  12.  
  13. w = 8 * LEN(mess$): h = 16
  14. DIM p(8 * w, 8 * h)
  15. black&& = POINT(0, 0)
  16. FOR y = 0 TO h - 1
  17.     FOR x = 0 TO w - 1
  18.         IF POINT(x, y) <> black&& THEN
  19.             FOR yy = 0 TO 7
  20.                 FOR xx = 0 TO 7
  21.                     p(8 * x + xx, 8 * y + yy) = 1
  22.                 NEXT
  23.             NEXT
  24.         END IF
  25.     NEXT
  26.  
  27. 'now hollow out letter
  28. DIM newP(8 * w, 8 * h)
  29. FOR y = 0 TO 8 * h
  30.     FOR x = 0 TO 8 * w
  31.         IF x > 0 AND x < 8 * w THEN
  32.             IF y > 0 AND y < 8 * h THEN
  33.                 IF p(x, y) THEN
  34.                     IF p(x - 1, y) AND p(x + 1, y) AND p(x, y - 1) AND p(x, y + 1) THEN
  35.                         newP(x, y) = 0
  36.                     ELSE
  37.                         newP(x, y) = 1
  38.                     END IF
  39.                 ELSE
  40.                     newP(x, y) = 0
  41.                 END IF
  42.             ELSE
  43.                 newP(x, y) = p(x, y)
  44.             END IF
  45.         ELSE
  46.             newP(x, y) = p(x, y)
  47.         END IF
  48.     NEXT
  49.  
  50. xo = 5: yo = 235: m = 4
  51. resetPlasma
  52.     CLS
  53.     FOR y = 0 TO 8 * h
  54.         FOR x = 0 TO 8 * w
  55.             IF newP(x, y) THEN
  56.                 IF cycle MOD 4 = 0 THEN
  57.                     changePlasma
  58.                     LINE (x, y)-STEP(0, 4), , BF
  59.                 ELSE
  60.                     LINE (x, y)-STEP(0, 4), _RGB(lc, lc, lc), BF
  61.                 END IF
  62.                 x1 = x + 20 * COS(A)
  63.                 y1 = y + 40 * COS(A) * SIN(A)
  64.                 PSET (x1, y1 + lc + 200), _RGB(255, 255, 0)
  65.             ELSEIF p(x, y) THEN
  66.                 LINE (x, y)-STEP(0, 4), _RGB32(100, 0, 0), BF
  67.             END IF
  68.         NEXT
  69.     NEXT
  70.     _DISPLAY
  71.     _LIMIT 30
  72.     A = A + _PI(1 / 12)
  73.     lc = lc + 1
  74.     lc = lc MOD 255
  75.     IF lc MOD 255 = 0 THEN cycle = cycle + 1: resetPlasma
  76.  
  77. SUB changePlasma ()
  78.     cN = cN + 1
  79.     COLOR _RGB(127 + 127 * SIN(pR! * .1 * cN), 127 + 127 * SIN(pG! * .1 * cN), 127 + 127 * SIN(pB! * .1 * cN))
  80.  
  81. SUB resetPlasma ()
  82.     pR! = RND ^ 2: pG! = RND ^ 2: pB! = RND ^ 2
  83.  
  84.  
Outline letters.PNG
* Outline letters.PNG (Filesize: 19.92 KB, Dimensions: 1264x605, Views: 524)