Re: Gradient Background??
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Dec 11, 2000
- 558 views
Sorry, I made a mistake in my previous post. The last polygon is drawn in incorrect color. The line for c = 196 to 255 do -- set last 60 colors to shades of blue should read for c = 197 to 256 do -- set last 60 colors to shades of blue because, regrettably, Euphoria sequence indexing is '1' based, just to be different from the rest of the world, which is, of course, zero ('0') based. jiri ----- Original Message ----- From: "jiri babor" <jbabor at PARADISE.NET.NZ> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Monday, December 11, 2000 10:50 AM Subject: Re: Gradient Background?? > -- 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 > > >