Thread View: comp.lang.lisp.mcl
1 messages
1 total messages
Started by mdavis
Sat, 23 Jan 1993 18:15
Windows vs. color-dialogs and getting a cpixel value
Author: mdavis
Date: Sat, 23 Jan 1993 18:15
Date: Sat, 23 Jan 1993 18:15
56 lines
2309 bytes
2309 bytes
Hi,
I am really stumped on something. I have written a simple
color-dropper function which allows the user to get a color by
positioning an eye-dropper cursor on a point and clicking to get its
color value. The problem I have is that this function returns the
correct color when defined as the dialog-item-action of a button when
that button is the subview of a window, but not when the button is the
subview of a color-dialog (it just seems to return black or white).
What is going on here?
Marc Davis
MIT Media Lab
******Code below (urgent help appreciated)*****
;function to get a color value at an x y
(defun getcpixelcolorvalue (x y)
(with-rgb (rgb *black-color*)
(#_getcpixel x y rgb)
(rgb-to-color rgb)))
;Code to get a color value by clicking on a point
;put your favorite cursor in here
;(we took one from Studio 8, the *watch-cursor* from MCL works too.
(defvar *color-dropper-cursor* *watch-cursor*)
(defun get-color-with-color-dropper (&optional (color-dropper-cursor
*color-dropper-cursor*))
(with-cursor color-dropper-cursor
(let ((color nil))
(do () ((mouse-down-p))
(let ((mouse-position (view-mouse-position nil)))
(setf color (getcpixelcolorvalue (point-h mouse-position)
(point-v mouse-position)))))
color)))
;this works
(make-instance 'window
:view-subviews (list (make-instance 'button-dialog-item
:dialog-item-action
#'(lambda (item)
(declare (ignore item))
(pprint (get-color-with-color-dropper))))))
;this does not
(make-instance 'color-dialog
:view-subviews (list (make-instance 'button-dialog-item
:dialog-item-action
#'(lambda (item)
(declare (ignore item))
(pprint (get-color-with-color-dropper))))))
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads