| allegro-cl archives 1997-4-20 | home index prev H thread prev K thread next J next L |
|
From: Felix.Stude (Felix Studer) Subject: inverted colors Date: 1997-4-20 8:37
Hi,
In the following code a first window (mymain-window) is created and a
.bmp-file (picture1.bmp) is displayed in this window. Then a dialog is
opened and another .bmp-file (picture2.bmp) is displayed in this dialog. At
this moment the colors of the first picture (picture1.bmp) are inverted
(dark-gray is orange and so on). How can I avoid the modification of the
colors?
(in-package :common-lisp-user)
(defvar mymain-window)
(defvar *bannerdialog*)
(defvar *bitmapinbanner*)
(defclass main-window (bitmap-window)())
(defclass main-pane (bitmap-pane)())
(defmethod default-pane-class ((stream main-window)) 'main-pane)
(defun create-mymain-window ()
(setq mymain-window
(open-stream
'main-window
*screen*
:io
:title "myTitle"
:window-border :frame
:window-state nil
:user-movable t
:user-resizable nil
:user-closable t
:user-shrinkable nil
:user-scrollable nil
:overlapped nil
:background-color
(make-rgb :red 192 :green 192 :blue 192)
:pop-up-p nil
:window-interior (make-box 1 19 506 427)))
(setq pict (copy-pixels-to-stream-from-file
"picture1.bmp"
mymain-window))
(redisplay-window pict))
(defun make-bannerdialog ()
(setq *bannerdialog*
(open-dialog
(list
(make-dialog-item
:widget 'default-button
:name :default-button-1
:title "OK"
:box (make-box 170 218 270 238)
:3d-border t
:tabstop nil
:groupstart nil
:set-value-fn 'closebanner
:font (make-font nil :arial 16 '(:bold))))
'dialog mymain-window
:name :bannerdialog
:title "Dialog 1"
:font (make-font :swiss :system 16 '(:bold))
:window-state :shrunk
:window-border :dialog-box
:left-attachment nil
:top-attachment nil
:right-attachment nil
:bottom-attachment nil
:user-movable nil
:user-resizable nil
:user-closable t
:user-shrinkable t
:user-scrollable nil
:overlapped nil
:background-color light-grey
:pop-up-p t
:window-interior
(make-box (+ (box-left (window-interior mymain-window)) 57)
(+ (box-top (window-interior mymain-window)) 64)
(- (box-right (window-interior mymain-window)) 58)
(- (box-bottom (window-interior mymain-window)) 64)))))
(defun make-bitmapinbanner (&aux pict)
(setq *bitmapinbanner*
(open-stream 'bitmap-window
*bannerdialog*
:io
:name :bitmap-window-1
:title ""
:font (make-font :swiss :system 16 '(:bold))
:window-state nil
:window-border nil
:left-attachment nil
:top-attachment nil
:right-attachment nil
:bottom-attachment nil
:user-movable nil
:user-resizable nil
:user-closable nil
:user-shrinkable nil
:user-scrollable nil
:overlapped nil
:background-color light-grey
:pop-up-p nil
:window-interior (make-box 20 30 97 244)))
(setq pict (copy-pixels-to-stream-from-file
"picture2.bmp"
*bitmapinbanner*))
(redisplay-window pict))
(defun bannershow ()
(make-bannerdialog)
(make-bitmapinbanner)
(pop-up-dialog *bannerdialog*))
(defun closebanner (dialog-item-dialog widget var)
(return-t-from-pop-up-dialog dialog-item-dialog widget var))
(defun start-it (&aux pict)
(create-mymain-window)
(bannershow))
(start-it)
This was my first attempt using 'copy-pixels-to-stream-from-file'. Then I
tried the following version with 'load-pixmap' and 'copy-pixels-to-stream'.
The behavior is exactly the same.
(in-package :common-lisp-user)
(defvar mymain-window)
(defvar *bannerdialog*)
(defvar *bitmapinbanner*)
(defvar box)
(defvar texture-info)
(defvar pixmap)
(defvar boxb)
(defvar texture-infob)
(defvar pixmapb)
(defclass main-window (bitmap-window)())
(defclass main-pane (bitmap-pane)())
(defmethod default-pane-class ((stream main-window)) 'main-pane)
(defun create-mymain-window ()
(setq mymain-window
(open-stream
'main-window
*screen*
:io
:title "Induktives Denken"
:window-border :frame
:window-state nil
:user-movable t
:user-resizable nil
:user-closable t
:user-shrinkable nil
:user-scrollable nil
:overlapped nil
:background-color
(make-rgb :red 192 :green 192 :blue 192)
:pop-up-p nil
:window-interior (make-box 1 19 506 427)))
(multiple-value-setq (pixmap texture-info)
(load-pixmap "grund.bmp"))
(setq box (make-box 0 0 (texture-info-width texture-info)
(texture-info-height texture-info)))
(set-palette mymain-window
(open-palette *screen* (texture-info-colors texture-info) nil))
(copy-pixels-to-stream mymain-window pixmap texture-info box box 204))
(defun make-bannerdialog ()
(setq *bannerdialog*
(open-dialog
(list
(make-dialog-item
:widget 'default-button
:name :default-button-1
:title "OK"
:box (make-box 170 218 270 238)
:3d-border t
:tabstop nil
:groupstart nil
:set-value-fn 'closebanner
:font (make-font nil :arial 16 '(:bold))))
'dialog mymain-window
:name :bannerdialog
:title "Dialog 1"
:font (make-font :swiss :system 16 '(:bold))
:window-state :shrunk
:window-border :dialog-box
:left-attachment nil
:top-attachment nil
:right-attachment nil
:bottom-attachment nil
:user-movable nil
:user-resizable nil
:user-closable t
:user-shrinkable t
:user-scrollable nil
:overlapped nil
:background-color light-grey
:pop-up-p t
:window-interior
(make-box (+ (box-left (window-interior mymain-window)) 57)
(+ (box-top (window-interior mymain-window)) 64)
(- (box-right (window-interior mymain-window)) 58)
(- (box-bottom (window-interior mymain-window)) 64)))))
(defun make-bitmapinbanner (&aux pict)
(setq *bitmapinbanner*
(open-stream 'bitmap-window
*bannerdialog*
:io
:name :bitmap-window-1
:title ""
:font (make-font :swiss :system 16 '(:bold))
:window-state nil
:window-border nil
:left-attachment nil
:top-attachment nil
:right-attachment nil
:bottom-attachment nil
:user-movable nil
:user-resizable nil
:user-closable nil
:user-shrinkable nil
:user-scrollable nil
:overlapped nil
:background-color light-grey
:pop-up-p nil
:window-interior (make-box 20 30 97 244)))
(multiple-value-setq (pixmapb texture-infob)
(load-pixmap "banner.bmp"))
(setq boxb (make-box 0 0 (texture-info-width texture-infob)
(texture-info-height texture-infob)))
(set-palette *bitmapinbanner*
(open-palette *screen* (texture-info-colors texture-infob) nil))
(copy-pixels-to-stream *bitmapinbanner* pixmapb texture-infob boxb boxb
204))
(defun bannershow ()
(make-bannerdialog)
(make-bitmapinbanner)
(pop-up-dialog *bannerdialog*))
(defun closebanner (dialog-item-dialog widget var)
(return-t-from-pop-up-dialog dialog-item-dialog widget var))
(defun start-it (&aux pict)
(create-mymain-window)
(bannershow))
(start-it)
Must developers be confronted with such stupid problems? I have read the
documentation and the Allegro CL FAQs. I can't understand how I can solve
the problem.
I will appreciate your help! Thanks.
Felix Studer
________________________________________________
Felix STUDER, Dr. phil.
Institute for Special Education
University of Fribourg
Canisius 21
CH-1700 Fribourg/Switzerland
Phone: +41 26 300 77 00
Fax: +41 26 300 97 49
E-Mail: <unifr.ch at Felix.Studer>
WWW URL http://pedcurmac13.unifr.ch/CogStrat.html
________________________________________________
|