MATLAB Programming/Psychtoolbox/Screen Commands/OpenOffscreenWindow

From Wikibooks, open books for an open world
< MATLAB Programming‎ | Psychtoolbox‎ | Screen Commands
Jump to: navigation, search



Open an offscreen window (offscreen surface in DirectDraw). This is simply an area in memory that is treated as a window. Offscreen windows are very useful for creating images for subsequent display, because copying between windows is very fast. You may specify a screen (a screenNumber>=0) or no screen (screenNumber=-1). If you do designate a screen then the offscreen window is attached to the DirectDraw object associated with that screen. You may specify no screen (screenNumber=-1), but any real screen must already have an open SCREEN window when you call OpenOffscreenWindow. color is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default is white. rect specifies the size of the offscreen window and what part of the screen the offscreen window is aligned with. If supplied, rect must contain at least one pixel. If a screenNumber is supplied then rect is in screen coordinates (origin at upper left), and defaults to the size of that screen. If a screenNumber of -1 is supplied then rect defaults to the size of the main screen. (In all cases, subsequent references to this new offscreen window will use its coordinates: origin at its upper left.) pixelSize sets the depth (in bits) of each pixel. If you specify a screen (screenNumber>=0) and a pixelSize>0 then they must be consistent. If you specify no screen (screenNumber=-1) then the default pixelSize' is the same as the main screen, but you can specify any legal depth: 8, 16, 24, 32. A pixelSize of 0 or [] is replaced by the default.