[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

colors not consistent?



Color 


Hello:

The following problem has been bothering me for a while
and I cannot figure out how to fix it. Please help!

I am working on an interactive layout package, in which 
objects are represented as colored rectangles that can be 
moved around by clicking and dragging.

To define a rectangle's color, the user can select from
the menubar "New Rectangle" and get a window in which
to input the rectangle's dimensions and color.
An exerpt of my code is listed below:

(defun NEW-RECTANGLE ()

  "Pops up a window for the user to fill in information defining a new 
  dependent resource, that is, a resource whose timing depends on the timing 
  of one or several activities. This function allows a user to specify
  whether the resource is a rectangle or an oval, and what color it has.
  IDT 3/12/94."

  (modal-dialog
   (MAKE-INSTANCE 
    'COLOR-DIALOG
    :WINDOW-TYPE :DOCUMENT :WINDOW-TITLE "New RECTANGLE"
    :VIEW-POSITION '(:TOP 62)
    :VIEW-SIZE #@(258 140)
    :CLOSE-BOX-P NIL
    :VIEW-FONT '("Chicago" 12 :SRCOR :PLAIN)
    :VIEW-SUBVIEWS
    (LIST 
          (MAKE-DIALOG-ITEM 'STATIC-TEXT-DIALOG-ITEM
                            #@(10 60) #@(95 16) "Dimensions:" NIL)
          (MAKE-DIALOG-ITEM 'STATIC-TEXT-DIALOG-ITEM
                            #@(10 85) #@(95 16) "Color:" NIL)
          ;; more editable items
          (MAKE-DIALOG-ITEM 'EDITABLE-NUMBER-DIALOG-ITEM
                            #@(102 60) #@(65 16)
                            "0" NIL
                            :ALLOW-RETURNS NIL
                            :view-nick-name 'the-dimension-x)
          (MAKE-DIALOG-ITEM 'EDITABLE-NUMBER-DIALOG-ITEM
                            #@(177 60) #@(65 16)
                            "0" NIL
                            :ALLOW-RETURNS NIL
                            :view-nick-name 'the-dimension-y)
          (MAKE-DIALOG-ITEM 
           'BUTTON-DIALOG-ITEM
           #@(98 84) #@(110 20) "Change Color" 
           #'(lambda (item)
               (set-part-color item :body (user-pick-color :color (part-color item :body)))
               (princ (part-color item :body) t))
           :PART-COLOR-LIST '(:BODY 212)  ;; default is *blue-color* = 212
           :DEFAULT-BUTTON NIL
           :VIEW-NICK-NAME 'the-color)
          
          ;; buttons
          (MAKE-DIALOG-ITEM 
           'BUTTON-DIALOG-ITEM  #@(65 115) #@(62 16) "Cancel" 
           #'(lambda (item) (declare (ignore item))
              (return-from-modal-dialog :cancel))
           :DEFAULT-BUTTON NIL)

          (MAKE-DIALOG-ITEM 
           'BUTTON-DIALOG-ITEM #@(145 115) #@(62 16) "OK"
           #'(LAMBDA (ITEM) 
               (let ((dialog (view-container item)))
                 (return-from-modal-dialog
                  (make-instance 
                    'resources
                    :dimensions (list (read-from-string 
                                       (dialog-item-text 
                                        (view-named 'the-dimension-x dialog)))
                                      (read-from-string 
                                       (dialog-item-text 
                                        (view-named 'the-dimension-y dialog))))
                    :resource-color (part-color (view-named 'the-color dialog) :body)))))
           :DEFAULT-BUTTON T)
          ))))

Thus, by clicking the color button, the user gets to 
pick a color using the picker, and that color is then used
as the body color of the button.

Problem 1 is that some colors picked using the picker
do not truthfully get shown as the button body color.
Why???

Yet, the color number gets stored correctly (as far as I can
tell) as attribute on the instance that gets created when OKing
and closing the window.

I then have a layout display in which the user can move around
the rectangles. Here, colors appear to correspond to those chosen
in the picker.

However, I also have a playback mode, in which a sequence of 
layouts get shown, one after the other, and in which no user 
intraction is allowed. Here, the colors are 'wrong' again.
They appear to have become 'simpler' (are they 16 colors instead
of 256, or what? For example, what was orange now is red, and 
shades of green have become all the same plain green.

I would like to use a broad range of colors consistently
throughout my application. How can I accomplish this?

I am running MCL 2.01 on a Quadra 950. Monitor settings
to 256 or 16 colors exhibit the same problems.

Many thanks,

Iris