1. RE: get_pixel() troubles
- Posted by dstanger at belco.bc.ca Jun 12, 2001
- 312 views
Thomas Parslow (PatRat) wrote: > > hi, > > > I am trying to us get_pixel() but -1 keeps being returned and I finally > > get > > an error telling me that there is a type check failure and that c = -1. > > I am > > refered to graphics.e. c is used as a variable there but is not present > > in > > my program. > > Any suggestions as to what is going on? > > > David S > > This is in a DOS (.ex) program right? > > Could you send the bit of code that is causing this error? > > Thomas Parslow (PatRat) ICQ #:26359483 > Rat Software > http://www.rat-software.com/ > Please leave quoted text in place when replying > > Hi there, Yes this is DOS program. Here is the code that is puzzling me: atom n n = graphics_mode(18) atom r, g, b, height, width, len object x, current_color sequence vc, colors colors = {} --Checks what graphics mode is being used. vc = video_config() --Pass the results to an object. x = vc[2] --If mode 1, 2, or 3 is being used an error results as they are for --text only. if x <=3 then puts(1, "ERROR! MUST BE IN PIXEL GRAPHICS MODE TO WORK!") abort(0) else width = vc[5] --Otherwise the width and height of the screen is obtained height = vc[6] end if --Here the screen is "scanned" with the color of each pixel being stored --in a sequence. for y_pix = 0 to height do for x_pix = 0 to width do colors = append(colors, get_pixel({width, height})) end for end for Any ideas? The error seems to be produced in graphics.e during a machine_proc(). I'm stumped! Any help would be greatly appreciated, David S
2. RE: get_pixel() troubles
- Posted by Matthew Lewis <matthewwalkerlewis at YAHOO.COM> Jun 12, 2001
- 324 views
> > > > Yes this is DOS program. Here is the code that is puzzling me: > > > <snip> > > > > Any ideas? The error seems to be produced in graphics.e during a > > machine_proc(). I'm stumped! > > > > Any help would be greatly appreciated, > > David S > > That code works fine at this end, not sure what's causing your > problem... I don't have any problems either, but your problem is that you're looking at the wrong pixels. I'd recommend this: for y_pix = 1 to height do colors &= get_pixel({0,y_pix,width-1}) end for You were always looking at {640,480}, which I believe is off the screen. Plus, it's faster to get a whole line at once (according to the docs). As for the error, that must come when you go to draw something. It looks like graphics.e uses the variable 'c' as a color, which is typed as a non-zero integer less than 256. Matt Lewis