MATLAB Programming/Psychtoolbox/Screen Commands

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Back to MATLAB Programming/Psychtoolbox

BlitImage255[edit | edit source]

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[edit | edit source]

Usage:

SCREEN('MATLABToFront',[n])

Bring forward n-th window in MATLAB Window menu. If not specified, n defaults to 0 (the command window).

BringWindowToFront[edit | edit source]

Usage:

SCREEN(windowPtr,'WindowToFront')

Bring specified window to front.

ClearScreen[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Usage:

desribeStruct=SCREEN('Computer')

Return information about the computer in a Matlab struct.

CopyWindow[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Usage:

[windowPtr,rect]=SCREEN('GetFrontWindow')

Get window pointer for frontmost window.

GetImage[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Usage:

[windowPtr,rect]=SCREEN('GetMATLABWindow',[n])

Get window pointer for n-th in MATLAB's Window menu.

GetWindowByTitle[edit | edit source]

Usage:

[windowPtr,rect]=SCREEN('GetWindowByTitle',title);

Get window pointer for window with specified title.

GlobalRect[edit | edit source]

SCREENGlobalRect not supported yet.

IsOffscreen[edit | edit source]

Usage:

isOffscreen=SCREEN(windowPtr,'IsOffscreen')

Find out whether window is offscreen. Responses: 1=yes; 0=no

MATLABToFront[edit | edit source]

Usage:

SCREEN('MATLABToFront',[n])

Bring forward n-th window in MATLAB Window menu. If not specified, n defaults to 0 (the command window).

MoveWindow[edit | edit source]

SCREENMoveWindow is not supported yet.

OpenOffscreenWindow[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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

PutImage[edit | edit source]

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[edit | edit source]

Usage:

rect=SCREEN(windowPtrOrScreenNumber,'Rect')

Get local rect of window or screen.

Screens[edit | edit source]

Usage:

screenNumbers=SCREEN('Screens')

Return an array of screenNumbers.

SelectMATLAB[edit | edit source]

Usage:

SCREEN('MATLABToFront',[n])

Bring forward n-th window in MATLAB Window menu. If not specified, n defaults to 0 (the command window).

SetClut[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Usage:

oldFontSize=SCREEN(windowPtr,'TextSize',[fontSize])

Get/set the font size for future text draws in this window.

TextStyle[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Usage:

[oldMore,oldSeverity,oldAlready]=SCREEN('UsageWarnings',[more],[severity],[already])

Control how usage warnings are handled.

Severity=0(suppress),1(warn), 2(error)

VideoCard[edit | edit source]

Usage:

[cardName,driverName,driverVersion,slotName]=SCREEN(windowPtrOrScreenNumber,'VideoCard')

Get information about video hardware.

WaitBlanking[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Usage:

windowPtrs=SCREEN('Windows')

Return an array of windowPtrs.

WindowScreenNumber[edit | edit source]

Usage:

screenNumber=SCREEN(windowPtrOrScreenNumber,'WindowScreenNumber')

Get the screen number.

WindowTitle[edit | edit source]

Usage:

title=SCREEN(windowPtr,'WindowTitle')

Get window's title

WindowToBack[edit | edit source]

Usage:

SCREEN(windowPtr,'WindowToBack')

Send specified window to back

WindowToFront[edit | edit source]

Usage:

SCREEN(windowPtr,'WindowToFront')

Bring specified window to front.