# MATLAB Programming/Psychtoolbox/Screen Commands
### BlitImage255

Usage:
SCREEN(windowPtr,'PutImage',imageArray,[rect],[copyMode])
Copy "imageArray" to a window, slowly. "imageArray" may be double or uint8. Its values, which should be non-negative integers, are copied to the window, by CopyBits or CopyBitsQuickly. "imageArray" can be an MxN array (for any window) or MxNx3 array (only if the window pixelSize is 16 or 32 bits). In the latter case the three r g b components are combined, as appropriate for the window pixelSize, to form a single value that is copied to the window. In 16-bit mode r, g, and b each contribute 5 bits. In 32-bit mode r, g, and b each contribute 8 bits.
"rect" is in window coordinates. The whole image is copied to "rect", scaling if necessary. The rect default is the imageArray's rect, centered in the window. The orientation of the array in the window is identical to that of MATLAB's numerical array displays in the Command Window. The first pixel is in the upper left, and the rows are horizontal. Unless you specify a "Quickly" copyMode, PutImage inherits the behavior of CopyBits, scaling the image into the rect.
The copyMode argument is a string variable that is passed to the VideoToolbox CopyWindows routine. copyMode can be 'srcCopy' (default) or 'bltFast'.
The copying is done in two stages. First, slowly, from the image array into a temporary offscreen window, and then, quickly, from there to the window designated by "windowPtr".

### BringMATLABToFront

Usage:
SCREEN('MATLABToFront',[n])
Bring forward n-th window in MATLAB Window menu. If not specified, n defaults to 0 (the command window).

### BringWindowToFront

Usage:
SCREEN(windowPtr,'WindowToFront')
Bring specified window to front.

### ClearScreen

Usage:
SCREEN(windowPtr,'FillRect',[color],[rect])
Fill "rect". "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces white with the standard CLUT for this window's pixelSize. Default "rect" is entire screen, so you can use this function to clear the screen.

### Close

Usage:
SCREEN(windowPtr,'Close')
Close any of SCREEN's windows (on- or offscreen). Closing an on-screen window takes about a second. After closing the last on-screen window the cursor is made visible.

### CloseAll

Usage:
SCREEN('CloseAll')
Close all of SCREEN's windows (on- and offscreen). Closing each on-screen window takes about a second. After closing the last on-screen window the cursor is made visible.

### CloseScreen

Usage:
SCREEN(windowPtr,'Close')
Close any of SCREEN's windows (on- or offscreen). Closing an on-screen window takes about a second. After closing the last on-screen window the cursor is made visible.

### Computer

Usage:
desribeStruct=SCREEN('Computer')
Return information about the computer in a Matlab struct.

### CopyWindow

Usage:
SCREEN('CopyWindow',srcWindowPtr,dstWindowPtr,[srcRect],[dstRect],[copyMode])
Copy images, very quickly, between two windows (on- or off- screen). copyMode can be only 'srcCopy' on Win. (default, will scale image to fit in dstRect). Use with Rush for reliable timing. See Rush.

### CopyWindows

Usage:
SCREEN('CopyWindow',srcWindowPtr,dstWindowPtr,[srcRect],[dstRect],[copyMode])
Copy images, very quickly, between two windows (on- or off- screen). copyMode can be only 'srcCopy' on Win. (default, will scale image to fit in dstRect). Use with Rush for reliable timing. See Rush.

### DrawLine

Usage:
SCREEN(windowPtr,'DrawLine',[color],fromH,fromV,toH,toV,[penWidth],[penHeight],[penMode])
Draw a line. "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel. Default is black. Default "penWidth" and "penHeight" is 1. "penMode" specifies the drawing mode: The Win32 GDI interface does not have support for these Copy, Or, xOr operatation. So the pen modes here represent the line styles of the pen: 'patCopy' (solid pen, default), 'patOr' (dashed), 'patXor' (dashdot), 'patBic' (dotted), 'notPatCopy' (invisible), 'notPatOr' (dashed), 'notPatXor' (dashdotdot), 'notPatBic' (inside frame).

### DrawOval

Usage:
SCREEN(windowPtr,'FillOval',[color],[rect])
Fills an ellipse with the given color, inscribed within "rect"."color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces white with the standard CLUT for this window's pixelSize. Default rect is whole window.

### DrawPoly

Usage:
SCREEN(windowPtr,'FillPoly',[color],pointList)
Fill polygon. "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces white with the standard CLUT for this window's pixelSize. "pointList" is a matrix: each row specifies the (x,y) coordinates of a vertex.

### DrawRect

Usage:
SCREEN(windowPtr,'FillRect',[color],[rect])
Fill "rect". "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces white with the standard CLUT for this window's pixelSize. Default "rect" is entire screen, so you can use this function to clear the screen.

### DrawText

Usage:
[newX,newY] = SCREEN(windowPtr,'DrawText',text,[x],[y],[color])
Draw text. "text" may include two-byte characters (e.g. Chinese). Default "x" "y" is current pen location. "color" is the CLUT index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces black with the standard CLUT for this window's pixelSize. "newX,newY" return the final pen location.

### FillArc

Usage:
SCREEN(windowPtr,'FillArc',[color],[rect],startAngle,arcAngle)
Draw a filled arc inscribed within the rect. "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces black with the standard CLUT for this window's pixelSize. Default "rect" is entire window. Angles are measured clockwise from vertical.

### FillOval

Usage:
SCREEN(windowPtr,'FillOval',[color],[rect])
Fills an ellipse with the given color, inscribed within "rect"."color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces white with the standard CLUT for this window's pixelSize. Default rect is whole window.

### FillPoly

Usage:
SCREEN(windowPtr,'FillPoly',[color],pointList)
Fill polygon. "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces white with the standard CLUT for this window's pixelSize. "pointList" is a matrix: each row specifies the (x,y) coordinates of a vertex.

### FillRect

Usage:
SCREEN(windowPtr,'FillRect',[color],[rect])
Fill "rect". "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces white with the standard CLUT for this window's pixelSize. Default "rect" is entire screen, so you can use this function to clear the screen.

### FrameArc

Usage:
SCREEN(windowPtr,'FrameArc',[color],[rect],startAngle,arcAngle,[penWidth],[penHeight],[penMode])
Draw an arc inscribed within the rect. "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces black with the standard CLUT for this window's pixelSize. Default "rect" is entire window. Default pen size is 1,1 .Angles are measured in degrees, clockwise from vertical.

### FrameOval

Usage:
SCREEN(windowPtr,'FrameOval',[color],[rect],[penWidth],[penHeight],[penMode])
Draw the outline of an oval. "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces black with the standard CLUT for this window's pixelSize. Default "rect" is entire window. Default pen size is 1,1.

### FrameRate

Usage:
hz=SCREEN(windowPtrOrScreenNumber,'FrameRate',[hz])
Frame rate, in Hz, as most recently measured for this screen (typically when you first opened it).
MacOS: FrameRate counts frames over some measured period and calculates the rate. Setting "hz" doesn't affect the screen, only the returned value. Setting "hz" to NaN or forces SCREEN to remeasure it now, eg after you use a Control Panel to change the screen resolution. The cached value is flushed when you close the last window on this screen.
Windows: The returned value is the nominal frame rate, not the measured rate. The returned value is always current. FrameRate will accept an argument, for compatibility with the MacOS implementation, but it ignores the value passed.

### FrameRect

Usage:
SCREEN(windowPtr,'FrameRect',[color],[rect],[penWidth],[penHeight],[penMode])
Draw the outline of a rectangle. "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default produces black with the standard CLUT for this window's pixelSize. Default "rect" is entire window. Default pen size is 1,1. "penMode" specifies the drawing mode: The Win32 GDI interface does not have support for these Copy, Or, xOr operatation. So these pen modes here reprensent the line styles of the pen: 'patCopy' (solid pen, default), 'patOr' (dashed), 'patXor' (dashdot), 'patBic' (dotted), 'notPatCopy' (invisible), 'notPatOr' (dashed), 'notPatXor' (dashdotdot), 'notPatBic' (inside frame).

### Gamma

Usage:
[oldGammaTable,dacSize]=SCREEN(windowPtrOrScreenNumber,'Gamma',[gammaTable],[dacSize])
Get/set the gamma table. The gamma table will usually be 256x1 or 256x3. Most users won't need this function.

### GetClut

Usage:
clut=SCREEN(windowPtrOrScreenNumber,'GetClut',[bits])
Get the color lookup table (CLUT) of a video screen. The returned "clut" is a 3-column matrix with one row per RGB entry in the hardware CLUT. The "clut" values will be in the range 0 to 255 for an 8-bit CLUT.

### GetFrontWindow

Usage:
[windowPtr,rect]=SCREEN('GetFrontWindow')
Get window pointer for frontmost window.

### GetImage

Usage:
imageArray=SCREEN(windowPtr,'GetImage',[rect])
Slowly copy an image from a window, returning a MATLAB uint8 array. If the window's pixelSize>8 then the returned imageArray has three layers, an RGB image. "rect" is in window coordinates, and its default is the whole window. CHANGE: as of April, 1998, imageArray is now uint8 instead of double to save space (a factor of 8). However, MATLAB will issue an error if you try to do math on a uint8 array, so you may need to use DOUBLE to convert it, e.g. imageArray/255 will produce an error, but double(imageArray)/255 is ok. Also see 'PutImage' and 'CopyWindow'.

### GetImage255

Usage:
imageArray=SCREEN(windowPtr,'GetImage',[rect])
Slowly copy an image from a window, returning a MATLAB uint8 array. If the window's pixelSize>8 then the returned imageArray has three layers, an RGB image. "rect" is in window coordinates, and its default is the whole window. CHANGE: as of April, 1998, imageArray is now uint8 instead of double to save space (a factor of 8). However, MATLAB will issue an error if you try to do math on a uint8 array, so you may need to use DOUBLE to convert it, e.g. imageArray/255 will produce an error, but double(imageArray)/255 is ok. Also see 'PutImage' and 'CopyWindow'.

### GetMATLABWindow

Usage:
[windowPtr,rect]=SCREEN('GetMATLABWindow',[n])
Get window pointer for n-th in MATLAB's Window menu.

### GetWindowByTitle

Usage:
[windowPtr,rect]=SCREEN('GetWindowByTitle',title);
Get window pointer for window with specified title.

### GlobalRect

SCREENGlobalRect not supported yet.

### IsOffscreen

Usage:
isOffscreen=SCREEN(windowPtr,'IsOffscreen')
Find out whether window is offscreen. Responses: 1=yes; 0=no

### MATLABToFront

Usage:
SCREEN('MATLABToFront',[n])
Bring forward n-th window in MATLAB Window menu. If not specified, n defaults to 0 (the command window).

### MoveWindow

SCREENMoveWindow is not supported yet.

### OpenOffscreenWindow

Usage:
[windowPtr,rect]=SCREEN(windowPtrOrScreenNumber,'OpenOffscreenWindow',[color],[rect],[pixelSize]);
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.

### OpenWindow

Usage:
[windowPtr,rect]=SCREEN(windowPtrOrScreenNumber,'OpenWindow',[color],[rect],[pixelSize]);
Open an onscreen window. Specify a screen by a windowPtr or a screenNumber (0 is the main screen, with menu bar). "color" is the clut index (scalar or [r g b] triplet) that you want to poke into each pixel; default is white. If supplied, "rect" must contain at least one pixel. If a windowPtr is supplied then "rect" is in the window's coordinates (origin at upper left), and defaults to the whole window. If a screenNumber is supplied then "rect" is in screen coordinates (origin at upper left), and defaults to the whole screen. (In all cases, subsequent references to this new window will use its coordinates: origin at its upper left.) The Windows version accepts "rect" but disregards it, the window is always the size of the display on which it appears. "pixelSize" sets the depth (in bits) of each pixel; default is to leave depth unchanged. Opening or closing a window takes about a second.

### PixelSize

Usage:
[oldPixelSize,oldIsColor,pages]=SCREEN(windowPtrOrScreenNumber,'PixelSize',[pixelSize],[isColor])
Get/set screen depth, gray/color mode, and number of video pages. (We don't yet provide a way of changing the page.)

### PixelSizes

Usage:
pixelSizes=SCREEN(windowPtrOrScreenNumber,'PixelSizes')
List all possible pixelSizes for this screen.The Windows Version returns only pixel sizes available at the current display size.

### Preference

Usage:
boolean=SCREEN('Preference','Backgrounding') oldBoolean=SCREEN('Preference','IgnoreCase',[boolean]) psychTableVersion=SCREEN('Preference','PsychTableVersion') mexFunctionName=SCREEN('Preference','PsychTableCreator') oldPriority=SCREEN(windowPtrOrScreenNumber,'Preference','MaxPriorityForBlankingInterrupt',priority) oldBoolean=SCREEN(windowPtrOrScreenNumber,'Preference','WaitBlankingUsesInterrupt',[boolean]) bits=SCREEN(windowPtrOrScreenNumber,'Preference','ClutDacSize') boolean=SCREEN(windowPtrOrScreenNumber,'Preference','FixedClut') oldBoolean=SCREEN(windowPtrOrScreenNumber,'Preference','SetClutDriverWaitsForBlanking',[boolean]) oldBoolean=SCREEN(windowPtrOrScreenNumber,'Preference','SetClutQuickly',[boolean]) oldBoolean=SCREEN(windowPtrOrScreenNumber,'Preference','SetClutCallsWaitBlanking',[boolean]) oldFrames=SCREEN(windowPtrOrScreenNumber,'Preference','SetClutSimulatesBlankingInterrupts',[frames])
Get/set various preferences. The first four are general, the rest are related to WaitBlanking or SetClut and are screen-specific. "boolean" values are 1 (nonzero) for Yes and 0 for No. Preferences are volatile: They're set by SCREEN when you first use each screen, and they're flushed by closing the last SCREEN window (e.g. by 'Close', 'CloseAll', or flushing SCREEN.mex by typing "clear screen"). So do any preference setting after calling 'OpenWindow'. WARNING: These settings allow you to access all the internal parameters that determine SCREEN's behavior. As a result the set of parameters is ever-changing, as SCREEN evolves to deal with an ever-changing environment (e.g. video drivers that don't wait for blanking, and Rush's high priority). Feel free to play with these expert controls, but, if you do, realize that you may have to tweak your 'Preference' calls with each new release of the PsychToolbox.
- SetClutDriverWaitsForBlanking reports whether the monitor's video driver waits for blanking. Usually read-only, you can also set/clear this on the PowerMac 7300/7500/7600/8500/8600 built-in driver. - SetClutQuickly specifies your preference for whether to use a custom SetEntriesQuickly.c driver (if available for this device) in place of the standard video driver. The SetEntriesQuickly drivers don't wait for blanking. - SetClutCallsWaitBlanking determines whether WaitBlanking should be called after each call to SetClut. - SetClutSimulatesBlankingInterrupts sets/gets the number of blanking interrupts to simulate after each SetClut, to make up for interrupts missed during the SetClut call. - WaitBlankingUsesInterrupt specifies a preference for whether WaitBlanking should use SetClut (original driver) or the screen's blanking interrupt to wait for blanking. See 'WaitBlanking'. - MaxPriorityForBlankingInterrupt specifies the maximum priority at which the hardware blanking interrupt still works. Normally this is 1, but it's reduced to 0.5 (on non-PCI Macs) if necessary for timing the 3-ms interval during which spurious VBL interrupts are ignored. Your programs can override this setting, but your computer is likely to hang unless you really know what you're doing.

### PutColorImage

PutColorImage is obsolete. Use PutImage instead. Please use SCREENPutImage.

### PutImage

Usage:
SCREEN(windowPtr,'PutImage',imageArray,[rect],[copyMode])
Copy "imageArray" to a window, slowly. "imageArray" may be double or uint8. Its values, which should be non-negative integers, are copied to the window, by CopyBits or CopyBitsQuickly. "imageArray" can be an MxN array (for any window) or MxNx3 array (only if the window pixelSize is 16 or 32 bits). In the latter case the three r g b components are combined, as appropriate for the window pixelSize, to form a single value that is copied to the window. In 16-bit mode r, g, and b each contribute 5 bits. In 32-bit mode r, g, and b each contribute 8 bits.
"rect" is in window coordinates. The whole image is copied to "rect", scaling if necessary. The rect default is the imageArray's rect, centered in the window. The orientation of the array in the window is identical to that of MATLAB's numerical array displays in the Command Window. The first pixel is in the upper left, and the rows are horizontal. Unless you specify a "Quickly" copyMode, PutImage inherits the behavior of CopyBits, scaling the image into the rect.
The copyMode argument is a string variable that is passed to the VideoToolbox CopyWindows routine. copyMode can be 'srcCopy' (default) or 'bltFast'.
The copying is done in two stages. First, slowly, from the image array into a temporary offscreen window, and then, quickly, from there to the window designated by "windowPtr".

### Rect

Usage:
rect=SCREEN(windowPtrOrScreenNumber,'Rect')
Get local rect of window or screen.

### Screens

Usage:
screenNumbers=SCREEN('Screens')
Return an array of screenNumbers.

### SelectMATLAB

Usage:
SCREEN('MATLABToFront',[n])
Bring forward n-th window in MATLAB Window menu. If not specified, n defaults to 0 (the command window).

### SetClut

Usage:
err=SCREEN(windowPtr,'SetClut',clut,[startEntry],[bits])
Set the DirectDraw palette for the screen.
The palette is set immediately, without waiting for the vertical blanking.
The "clut" argument is a MATLAB matrix with 3 columns. The number of entries written is the number of rows in "clut". Each RGB entry in the hardware CLUT is loaded with a row of "clut". Each "clut" value should be in the range 0 to 255 for an 8-bit CLUT. Argument startEntry is optional and determines which CLUT entry to load first (entries are numbered from 0 up), to load just a subset of the CLUT's entries. We suggest that "startEntry" always be zero or greater.
The "bits" argument specifies how many bits you want to write to the CLUT. Typically it will be 8, which is the default value. If you set it to some other value, the range of allowable entries scales accordingly. Thus if you use a 9-bit CLUT, then each entry should be between 0 and 511, etc.
PREFERENCES:

### SetClutQ

Usage:
err=SCREEN(windowPtr,'SetClut',clut,[startEntry],[bits])
Set the DirectDraw palette for the screen.
The palette is set immediately, without waiting for the vertical blanking.
The "clut" argument is a MATLAB matrix with 3 columns. The number of entries written is the number of rows in "clut". Each RGB entry in the hardware CLUT is loaded with a row of "clut". Each "clut" value should be in the range 0 to 255 for an 8-bit CLUT. Argument startEntry is optional and determines which CLUT entry to load first (entries are numbered from 0 up), to load just a subset of the CLUT's entries. We suggest that "startEntry" always be zero or greater.
The "bits" argument specifies how many bits you want to write to the CLUT. Typically it will be 8, which is the default value. If you set it to some other value, the range of allowable entries scales accordingly. Thus if you use a 9-bit CLUT, then each entry should be between 0 and 511, etc.
PREFERENCES:

### SetDrawingRegion

Usage:
SCREEN(windowPtr,'SetDrawingRegion',shapeSpec,[shapeFlag])
Make subsequent drawing to the window visible only if it is within the specified region. This does not apply to PutImage or CopyWindow operations. Call with rect equal to screenRect to reestablish the entire screen. Drawing outside the region is suppressed, but still takes the normal amount of time to complete.
If shapeFlag == 0 [default], shapeSpec is a rect, region is rectangular. If shapeFlag == 1, shapeSpec is a rect, region is oval. If shapeFlag == 2, shapeSpec is a point list, region is polygonal.

### SetGamma

Usage:
[oldGammaTable,dacSize]=SCREEN(windowPtrOrScreenNumber,'Gamma',[gammaTable],[dacSize])
Get/set the gamma table. The gamma table will usually be 256x1 or 256x3. Most users won't need this function.

### TextFace

Usage:
oldStyle=SCREEN(windowPtr,'TextStyle',[style])
Get/set the font style for future text draws in this window. Useful values for style follow; they may be OR'd.
0=normal,1=bold,2=italic,4=underline. (Outline, Condense and Extend are not yet supported on the Windows version)

### TextFont

Usage:
[oldFontName,oldFontNumber]=SCREEN(windowPtr,'TextFont',[fontNameOrNumber])
Get/set the font for future text draws in this window. You can ask what the current font is, or specify the desired font by number or by name (e.g. 'Helvetica'). Font numbers may not be consistent from PC to PC.If no windowPtr is given, and no fontName argument is supplied, then print out a list of all font names. The default font (set by Windows) is 1 (the System font) for both on-screen off-screen windows.

### TextMode

Usage:
oldCopyMode=SCREEN(windowPtr,'TextMode',[copyMode])
Get/set text copy mode of this window.
copyMode can be an integer or a string: 'srcCopy' (default), 'srcOr', 'srcXor', 'srcBic', 'notSrcCopy', 'notSrcOr', 'notSrcXor', 'notSrcBic', 'patCopy', 'patOr', 'patXor', 'patBic', 'notPatCopy', 'notPatOr', 'notPatXor', 'notPatBic'. On the Windows version, this function does nothing, since there is no apparent options on Windows that correspond to the Mac text modes.

### TextSize

Usage:
oldFontSize=SCREEN(windowPtr,'TextSize',[fontSize])
Get/set the font size for future text draws in this window.

### TextStyle

Usage:
oldStyle=SCREEN(windowPtr,'TextStyle',[style])
Get/set the font style for future text draws in this window. Useful values for style follow; they may be OR'd.
0=normal,1=bold,2=italic,4=underline. (Outline, Condense and Extend are not yet supported on the Windows version)

### TextWidth

Usage:
width=SCREEN(windowPtr,'TextWidth',text); % horizontal offset (negative for right-to-left scripts, e.g. Hebrew).
Get width of text string. Width is the change in horizontal pen position that would be produced by calling DrawText; it's negative for right-to-left scripts (e.g. Hebrew). The text may include 2-byte characters (e.g. Chinese).

### UsageWarnings

Usage:
[oldMore,oldSeverity,oldAlready]=SCREEN('UsageWarnings',[more],[severity],[already])
Control how usage warnings are handled.
Severity=0(suppress),1(warn), 2(error)

### VideoCard

Usage:
[cardName,driverName,driverVersion,slotName]=SCREEN(windowPtrOrScreenNumber,'VideoCard')
Get information about video hardware.

### WaitBlanking

Usage:
framesSinceLastWait=SCREEN(windowPtrOrScreenNumber,'WaitBlanking',[waitFrames])
Wait specified number of blankings (frame endings). Call with waitFrames==1 (or omit it, since that's the default) to wait for the beginning of the next frame. Video cards mark the end of each video frame by briefly reducing the voltage to the Vertical Blanking Level (VBL), which "blanks" the screen to black. We do all video timing relative to the beginning of blanking. You may want to run 'WaitBlanking' at high priority (see Rush and Priority) for reliable timing. To keep this routine as fast as possible, no value is returned unless you supply an argument to receive it. When processor priority is at or below MaxPriorityForBlankingInterrupt the WaitBlankingUsesInterrupt 'Preference' controls, for each screen, whether 'WaitBlanking' calls SetClut (default) or waits for a blanking interrupt. When processor priority is above MaxPriorityForBlankingInterrupt, 'WaitBlanking' always uses SetClut (i.e. cscSetEntries or cscDirectSetEntries call to video driver).

### WaitVBL

Usage:
framesSinceLastWait=SCREEN(windowPtrOrScreenNumber,'WaitBlanking',[waitFrames])
Wait specified number of blankings (frame endings). Call with waitFrames==1 (or omit it, since that's the default) to wait for the beginning of the next frame. Video cards mark the end of each video frame by briefly reducing the voltage to the Vertical Blanking Level (VBL), which "blanks" the screen to black. We do all video timing relative to the beginning of blanking. You may want to run 'WaitBlanking' at high priority (see Rush and Priority) for reliable timing. To keep this routine as fast as possible, no value is returned unless you supply an argument to receive it. When processor priority is at or below MaxPriorityForBlankingInterrupt the WaitBlankingUsesInterrupt 'Preference' controls, for each screen, whether 'WaitBlanking' calls SetClut (default) or waits for a blanking interrupt. When processor priority is above MaxPriorityForBlankingInterrupt, 'WaitBlanking' always uses SetClut (i.e. cscSetEntries or cscDirectSetEntries call to video driver).

### WindowKind

Usage:
kind=SCREEN(windowPtr,'WindowKind')
What kind of windowPtr is this? Returns 0 if it's invalid, -1 our offscreen, 1 our onscreen, 2 MATLAB's onscreen.

### Windows

Usage:
windowPtrs=SCREEN('Windows')
Return an array of windowPtrs.

### WindowScreenNumber

Usage:
screenNumber=SCREEN(windowPtrOrScreenNumber,'WindowScreenNumber')
Get the screen number.

### WindowTitle

Usage:
title=SCREEN(windowPtr,'WindowTitle')
Get window's title

### WindowToBack

Usage:
SCREEN(windowPtr,'WindowToBack')
Send specified window to back

### WindowToFront

Usage:
SCREEN(windowPtr,'WindowToFront')
Bring specified window to front.