ColorArray(0) = 3
ColorArray
(1) = _RGB32(255, 0, 0)ColorArray
(2) = _RGB32(255, 255, 255)ColorArray
(3) = _RGB32(0, 0, 255)
DisplayImage a&, 300, 500, 0, 0 'Show the original bee
RainbowImage a&, ColorArray(), 1, 0, 1 'Rainbow the Bee's background
DisplayImage a&, 700, 500, 0, 0
a&
= _LOADIMAGE("qb64.png", 32) 'reload the image (we altered it before with the last RainbowImage call)RainbowImage a&, ColorArray(), 1, 0, 0 'Rainbow the Bee
DisplayImage a&, 500, 500, 0, 0
b& = SaveBackground&
c&
= TextToImage
("This is moving rainbow text!", 16, _RGB32(255, 0, 0), 0, 0)ScaleImage c&, 3, 3
ColorArray(0) = 0
RainbowImage c&
, ColorArray
(), _RGB32(255, 0, 0), 0, 0
RestoreBackground b&
DisplayImage a&, i, i, i, 0
DisplayImage a&, 800 - i, 800 - i, i, 1
DisplayImage c&, 300, i - 100, i, 0
'Image is our image handle created by TextToImage
'C() is our color array. c(0) tells us how many colors to use to blend (from 0 - our color array limit)
'If 0, we go with the default rainbow color routine
'If 1, we get a solid color, whatever is c(1)
'If more than 1, we blend our colors from (c1) to c(2) to c(3) to c(4) to c(...up to our limit)
'fc is our foreground color (or font color if you're coloring text)
'bfc is our background color (or background font color, for text)
'mode is how we create our rainbow. 0 is for the foreground to be rainbow, 1 is for background
'This is the default, where we print a nice balanced rainbow
r = 255: g = 0: b = 0
IF r
>= 255 AND g
>= 255 AND b
<= 0 THEN rc
= -s: gc
= 0: bc
= 0:
EXIT DO 'subtract the old color IF g
>= 255 AND b
>= 255 AND r
<= 0 THEN rc
= 0: gc
= -s: bc
= 0:
EXIT DO 'subtract the old color IF b
>= 255 AND r
>= 255 AND g
<= 0 THEN rc
= 0: gc
= 0: bc
= -s:
EXIT DO 'subtract the old color r = r + rc: g = g + gc: b = b + bc
s
= ((c
(0) - 1) * 255) / _WIDTH(Image
) 'our scale is going to depend on how many colors we blend. It's 255 steps from 1 color to another in this process.
'c(0) is how many colors we blend
BlendOn = 1: counter = 0: counter2 = 1
counter = counter + s
Reverse_RGB c(BlendOn), r1%, g1%, b1%
Reverse_RGB c(BlendOn + 1), r2%, g2%, b2%
rd = (r1% - r2%) / 255 * s
gd = (g1% - g2%) / 255 * s
bd = (b1% - b2%) / 255 * s
ru = r1% - rd * (i - subtract)
gu = g1% - gd * (i - subtract)
bu = b1% - bd * (i - subtract)
coloruse~&
= _RGB32(ru
, gu
, bu
) IF counter \
255 >= counter2
THEN BlendOn = BlendOn + 1
counter2 = counter2 + 1
subtract = i
SUB Reverse_RGB
(c~&
, r%
, g%
, b%
) r$
= "&H" + MID$(h$
, 3, 2) g$
= "&H" + MID$(h$
, 5, 2) b$
= "&H" + MID$(h$
, 7, 2)
'Mode 1 is print forwards
'Mode 2 is print backwards
'Mode 3 is print from top to bottom
'Mode 4 is print from bottom up
'print the text lengthwise
'print the text vertically
'Print text forward
'Print text backwards
temp$ = ""
temp$
= temp$
+ MID$(text$
, LEN(text$
) - i
, 1) 'Print text upwards
'first lets reverse the text, so it's easy to place
temp$ = ""
temp$
= temp$
+ MID$(text$
, LEN(text$
) - i
, 1) 'then put it where it belongs
fx
= (w&
- _PRINTWIDTH(MID$(temp$
, i
, 1))) / 2 + .99 'This is to center any non-monospaced letters so they look better 'Print text downwards
fx
= (w&
- _PRINTWIDTH(MID$(text$
, i
, 1))) / 2 + .99 'This is to center any non-monospaced letters so they look better
w2 = w * xscale: h2 = h * yscale
Image = NewImage&
px(0) = -w \ 2: py(0) = -h \ 2: px(3) = w \ 2: py(3) = -h \ 2
px(1) = -w \ 2: py(1) = h \ 2: px(2) = w \ 2: py(2) = h \ 2
px(0) = 0: py(0) = 0: px(3) = w: py(3) = 0
px(1) = 0: py(1) = h: px(2) = w: py(2) = h
px(0) = 0: py(0) = -h: px(3) = w: py(3) = -h
px(1) = 0: py(1) = 0: px(2) = w: py(2) = 0
px(0) = -w: py(0) = 0: px(3) = 0: py(3) = 0
px(1) = -w: py(1) = h: px(2) = 0: py(2) = h
px(0) = -w: py(0) = -h: px(3) = 0: py(3) = -h
px(1) = -w: py(1) = 0: px(2) = 0: py(2) = 0
sinr
= SIN(angle
/ 57.2957795131): cosr
= COS(angle
/ 57.2957795131) x2 = (px(i) * cosr + sinr * py(i)) + x: y2 = (py(i) * cosr - px(i) * sinr) + y
px(i) = x2: py(i) = y2
_MAPTRIANGLE (0, 0)-(0, h
- 1)-(w
- 1, h
- 1), Image
TO(px
(0), py
(0))-(px
(1), py
(1))-(px
(2), py
(2)) _MAPTRIANGLE (0, 0)-(w
- 1, 0)-(w
- 1, h
- 1), Image
TO(px
(0), py
(0))-(px
(3), py
(3))-(px
(2), py
(2))