# FIXED: offscreen color bug

**URL:** <https://psychtoolbox.discourse.group/t/fixed-offscreen-color-bug/813>\
**Category:** Uncategorized\
**Created:** [April 4, 2002, 7:00am UTC](https://psychtoolbox.discourse.group/t/fixed-offscreen-color-bug/813 "2002-04-04T07:00:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![denispelli](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@denispelli](https://psychtoolbox.discourse.group/u/denispelli)\
**Post date:** [April 4, 2002, 7:00am UTC](https://psychtoolbox.discourse.group/t/fixed-offscreen-color-bug/813/1 "2002-04-04T07:00:21Z")

</div>

hi all  
  
in october 2000, Erin Harley reported a bug. Drawing to offscreen windows   
referenced to screen 1 was often wrongly colored. That bug is now fixed.   
The new version of SCREEN.mex is enclosed. This fixed version will be   
included in the forthcoming Psychtoolbox version 2.5.  
[http://groups.yahoo.com/group/psychtoolbox/message/266](http://groups.yahoo.com/group/psychtoolbox/message/266)  
[http://groups.yahoo.com/group/psychtoolbox/message/881](http://groups.yahoo.com/group/psychtoolbox/message/881)  
  
i'm also including a test program, DrawTest.m, that tests for this   
problem, revealing the bug in version 2.44 and giving a clean bill of   
health to version 2.5.  
  
best  
  
denis  
  
p.s.  
The problem stemmed from the fact that Apple's QuickDraw operations use   
the color table of the current DEVICE (not the current port). This raised   
no issues if you were using any on-screen window, or an off-screen window   
associated with screen 0, which is usually the current device, but became   
an issue when you used an offscreen window associated with another   
screen. We've now enhanced a humble C routine called SetWindow to also   
make the offscreen window's device the current device. That fixed the bug.  
  
NOTE TO ALL: [denis.pelli@...](mailto:denis.pelli@...) is my preferred email address. Please   
use that address. My "verizon.net" address will go away soon, partly   
because Verizon forces me to use that as my "From:" address. My current   
email program won't allow me to designate a separate "Reply-to:" address.
