[plt-scheme] help : White color and "get-pixel" on Viewport graphics.

From: A.Pasquino (ale_xp at yahoo.com)
Date: Sat Apr 12 15:35:44 EDT 2003

Hi all ,

(this is my first post) 

I'm doing some little tests with the Viewport library,

I have a little problem at using the "get-pixel"
operation.

In particular when I call this function on a white
pixel the result is '1' (but according to the manual
it should be '0'). 

I noticed that when I draw a white pixel the values of
the RGB colors are R=248/255 G=84/85 B=248/255, maybe
the "get-pixel" actually tests for a 255/255 R/G/B
value and so it replies 1?
(you can get the same values from an empty window
without drawing a white pixel with the "draw-pixel"). 

How can I set a 'true' white in order to get
a 0 from the 'get-pixel' function? 
Maybe I misunderstood how to use these functions? 
Any help is welcome, Thank you in advance.

Alex. 

PS: thank you to the PLT team for your Great
Environment! 

This is my test code: 

it should open a 10x10 pixels window and draw a white
pixel in the center, position (4,4)
(actually the "draw-pixel" is not necessary). 

(require (lib "graphics.ss" "graphics")) 
(define (test)
  (open-graphics)   

  (let ((my-port (open-viewport "rgb-test" 10 10))
        (position (make-posn 4 4)))
    ((draw-pixel my-port) position "white")
    (display ((get-pixel my-port) position))

    (let ((pix-color ((get-color-pixel my-port)
position)))
      (newline)
      (display (rgb-red pix-color))(display " ")
      (display (rgb-green pix-color))(display " ")
      (display (rgb-blue pix-color))(display " "))
    (close-viewport my-port)
    )
  (close-graphics)
  )
   
>(test)
1
248/255 84/85 248/255

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com


Posted on the users mailing list.