Re: Gradient Background??

new topic     » goto parent     » topic index » view thread      » older message » newer message

--  gradient.ex
--  jbabor at paradise.net.nz
--  00-12-11

include image.e             -- get_al_palette(), includes graphics.e
include get.e               -- wait_key()

sequence pal
integer i, y, y1

if graphics_mode(257) then
    puts(1, "Error: couldn't set the required graphics mode!\n")
    abort(1)
end if

pal = get_all_palette()     -- get default palette
i = 4                       -- very dark blue, almost black
for c = 196 to 255 do       -- set last 60 colors to shades of blue
    pal[c] = {0,0,i}
    i += 1
end for
all_palette(pal)            -- reset colors using modified palette

y = 0
for c = 196 to 255 do
    y1 = y + 7
    polygon(c, 1, {{0, y}, {639, y}, {639, y1}, {0, y1}})
    y += 8
end for

i = wait_key()
i = graphics_mode(-1)

----- Original Message -----
From: "Brian" <impee3 at EXCITE.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, December 11, 2000 6:51 AM
Subject: Gradient Background??


> I'm having a hard time creating a gradient background. I want it to
fill in
> the background from black at top to a dark blue at the bottom. I
keep
> getting a "Trying to redefine intY" error. Here's the code I'm
using.
>
> procedure gradientbg()
>     atom intY
>     sequence gradcolor
>     for intY = 1 to 480 by 1
>     gradcolor = {0, 0, floor(intY / 480) * 255}
>     draw_line(gradcolor, {{1, intY},{640, intY}})
>     next
>     end for
> End Procedure
>
> Any ideas why this is happening?
>
> Draw line repeated 480 times seems a little inefficient. Any ideas
on a
> better way of doing this?
>
> Thanks,
> Brian
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu